{
  "id": "@typed/template/Parser#parse",
  "canonicalId": "@typed/template#parse",
  "symbol": {
    "id": "@typed/template/Parser#parse",
    "packageName": "@typed/template",
    "moduleName": "Parser",
    "exportName": "parse",
    "kind": "function",
    "signatures": [
      "export declare function parse(template: ReadonlyArray<string>): Template.Template;"
    ],
    "summary": "Parses a template string array (from a tagged template literal) into a reusable `Template` object.\n\nThis parser handles:\n- Standard HTML structure (elements, attributes, text, comments).\n- Custom part syntax for interpolation (e.g., `${value}`).\n- Special attributes like `.property`, `@event`, `?boolean`.\n- Self-closing tags and text-only elements (script, style).\n\nEach call returns a new `Template` instance containing the static AST and dynamic part locations.\nRender targets cache their compiled DOM fragments or HTML chunks independently by template-literal\nidentity.",
    "sections": {
      "Why": "One renderer-neutral AST gives DOM rendering, SSR, and hydration the same\ninterpolation paths and template hash. Template syntax remains ordinary HTML\nwith explicit prefixes for properties, events, booleans, data, spreads, and\nrefs.",
      "Ownership and lifetime": "The parser reuses internal scratch storage synchronously but returns a fresh,\ncaller-owned immutable model on every call. Render layers decide whether and\nhow long to cache compiled results by template-literal identity.",
      "Errors and trust": "Malformed author templates throw parser errors during compilation. Parsing\ndoes not sanitize markup; dynamic values are escaped later by the HTML\nrenderer according to the recorded part context."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { parse } from \"@typed/template/Parser\"\n\n// Each array boundary records one interpolation point. Runtime values are\n// supplied later by a renderer, not passed to parse.\nconst template = parse([\n  \"<div id=\\\"\",\n  \"\\\" class=\\\"container\\\"><p>Hello, \",\n  \"!</p></div>\"\n])\n\n// Access parsed structure\nconsole.log(template.nodes) // Array of parsed nodes\nconsole.log(template.parts) // Array of dynamic interpolation points\nconsole.log(template.hash) // Unique hash for the template"
      }
    ],
    "relations": [],
    "source": {
      "file": "packages/template/src/Parser.ts",
      "line": 71
    },
    "since": "1.0.0",
    "category": "Template parsing"
  },
  "exposure": {
    "recordKind": "declaration",
    "id": "@typed/template/Parser#parse",
    "packageName": "@typed/template",
    "packageVersion": "1.0.0-beta.13",
    "moduleName": "Parser",
    "consumerSpecifier": "@typed/template/Parser",
    "exportName": "parse",
    "qualifiedName": "parse",
    "declarationKey": "declaration:f9351f93261a8e83b11c67ec",
    "family": "function",
    "signatures": [
      "export declare function parse(template: ReadonlyArray<string>): Template.Template;"
    ],
    "sourceSpans": [
      {
        "file": "packages/template/src/Parser.ts",
        "start": {
          "line": 71,
          "column": 1
        },
        "end": {
          "line": 74,
          "column": 2
        }
      }
    ],
    "aliases": [
      "@typed/template#parse"
    ],
    "isAlias": false,
    "static": false
  },
  "declaration": {
    "declarationKey": "declaration:f9351f93261a8e83b11c67ec",
    "name": "parse",
    "family": "function",
    "facets": [
      {
        "family": "function",
        "syntaxKind": "FunctionDeclaration",
        "signatures": [
          "export declare function parse(template: ReadonlyArray<string>): Template.Template;"
        ],
        "typeParameters": [],
        "sourceSpans": [
          {
            "file": "packages/template/src/Parser.ts",
            "start": {
              "line": 71,
              "column": 1
            },
            "end": {
              "line": 74,
              "column": 2
            }
          }
        ],
        "static": false,
        "readonly": false,
        "optional": false
      }
    ],
    "signatures": [
      "export declare function parse(template: ReadonlyArray<string>): Template.Template;"
    ],
    "typeParameters": [],
    "summary": "Parses a template string array (from a tagged template literal) into a reusable `Template` object.\n\nThis parser handles:\n- Standard HTML structure (elements, attributes, text, comments).\n- Custom part syntax for interpolation (e.g., `${value}`).\n- Special attributes like `.property`, `@event`, `?boolean`.\n- Self-closing tags and text-only elements (script, style).\n\nEach call returns a new `Template` instance containing the static AST and dynamic part locations.\nRender targets cache their compiled DOM fragments or HTML chunks independently by template-literal\nidentity.",
    "sections": {
      "Why": "One renderer-neutral AST gives DOM rendering, SSR, and hydration the same\ninterpolation paths and template hash. Template syntax remains ordinary HTML\nwith explicit prefixes for properties, events, booleans, data, spreads, and\nrefs.",
      "Ownership and lifetime": "The parser reuses internal scratch storage synchronously but returns a fresh,\ncaller-owned immutable model on every call. Render layers decide whether and\nhow long to cache compiled results by template-literal identity.",
      "Errors and trust": "Malformed author templates throw parser errors during compilation. Parsing\ndoes not sanitize markup; dynamic values are escaped later by the HTML\nrenderer according to the recorded part context."
    },
    "examples": [
      {
        "language": "ts",
        "code": "import { parse } from \"@typed/template/Parser\"\n\n// Each array boundary records one interpolation point. Runtime values are\n// supplied later by a renderer, not passed to parse.\nconst template = parse([\n  \"<div id=\\\"\",\n  \"\\\" class=\\\"container\\\"><p>Hello, \",\n  \"!</p></div>\"\n])\n\n// Access parsed structure\nconsole.log(template.nodes) // Array of parsed nodes\nconsole.log(template.parts) // Array of dynamic interpolation points\nconsole.log(template.hash) // Unique hash for the template"
      }
    ],
    "sourceSpans": [
      {
        "file": "packages/template/src/Parser.ts",
        "start": {
          "line": 71,
          "column": 1
        },
        "end": {
          "line": 74,
          "column": 2
        }
      }
    ],
    "since": "1.0.0",
    "category": "Template parsing"
  }
}
