@atom.io/spa 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/README.md +169 -25
  2. package/README.mdx +62 -15
  3. package/dist/astro-application.d.ts +1 -1
  4. package/dist/astro-client.d.ts +1 -1
  5. package/dist/astro-client.d.ts.map +1 -1
  6. package/dist/astro-client.js +5 -4
  7. package/dist/astro-client.js.map +1 -1
  8. package/dist/astro-resumability-client.d.ts +1 -1
  9. package/dist/astro-server.js +4 -4
  10. package/dist/astro-server.js.map +1 -1
  11. package/dist/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  12. package/dist/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  13. package/dist/{astro-shared-DZp1x8RQ.d.ts → astro-shared-KxK9OUSj.d.ts} +2 -2
  14. package/dist/{astro-shared-DZp1x8RQ.d.ts.map → astro-shared-KxK9OUSj.d.ts.map} +1 -1
  15. package/dist/astro.d.ts +1 -1
  16. package/dist/astro.js +1 -1
  17. package/dist/{capabilities-DNcnGRv_.d.ts → capabilities-ChgSs6bp.d.ts} +34 -6
  18. package/dist/capabilities-ChgSs6bp.d.ts.map +1 -0
  19. package/dist/client.min.js +1 -1
  20. package/dist/core-DD2giR6E.js +451 -0
  21. package/dist/core-DD2giR6E.js.map +1 -0
  22. package/dist/development/astro-client.js +5 -4
  23. package/dist/development/astro-client.js.map +1 -1
  24. package/dist/development/astro-server.js +4 -4
  25. package/dist/development/astro-server.js.map +1 -1
  26. package/dist/development/{astro-shared-83hxw7-M.js → astro-shared-DBwINQav.js} +2 -2
  27. package/dist/development/{astro-shared-83hxw7-M.js.map → astro-shared-DBwINQav.js.map} +1 -1
  28. package/dist/development/astro.js +1 -1
  29. package/dist/development/core-DrUd8x25.js +465 -0
  30. package/dist/development/core-DrUd8x25.js.map +1 -0
  31. package/dist/development/{dom-DQ0M3rLL.js → dom-BRFv7FP_.js} +150 -35
  32. package/dist/development/dom-BRFv7FP_.js.map +1 -0
  33. package/dist/development/floating.js +2 -6
  34. package/dist/development/floating.js.map +1 -1
  35. package/dist/development/hot.js +164 -0
  36. package/dist/development/hot.js.map +1 -0
  37. package/dist/development/identity-DwB8MTM1.js +121 -0
  38. package/dist/development/identity-DwB8MTM1.js.map +1 -0
  39. package/dist/development/index.js +5 -5
  40. package/dist/development/jsx-runtime-BGDPK50B.js +49 -0
  41. package/dist/development/jsx-runtime-BGDPK50B.js.map +1 -0
  42. package/dist/development/jsx-runtime.js +1 -25
  43. package/dist/development/konva.js +12 -5
  44. package/dist/development/konva.js.map +1 -1
  45. package/dist/development/motion.js +4 -21
  46. package/dist/development/motion.js.map +1 -1
  47. package/dist/development/renderer.js +41 -40
  48. package/dist/development/renderer.js.map +1 -1
  49. package/dist/development/{server-renderer-DCLoMdOX.js → server-renderer-u1-c5PGd.js} +8 -18
  50. package/dist/development/server-renderer-u1-c5PGd.js.map +1 -0
  51. package/dist/development/server.js +1 -1
  52. package/dist/{src-Bme1kz2b.js → development/src-CB7ruwRs.js} +3 -3
  53. package/dist/development/src-CB7ruwRs.js.map +1 -0
  54. package/dist/development/three.js +20 -19
  55. package/dist/development/three.js.map +1 -1
  56. package/dist/development/vite-WUiz1ju6.js +545 -0
  57. package/dist/development/vite-WUiz1ju6.js.map +1 -0
  58. package/dist/development/vite.js +1 -1
  59. package/dist/{dom-D8g3roX9.js → dom--HZvmgqd.js} +139 -32
  60. package/dist/dom--HZvmgqd.js.map +1 -0
  61. package/dist/floating.d.ts +1 -1
  62. package/dist/floating.d.ts.map +1 -1
  63. package/dist/floating.js +2 -6
  64. package/dist/floating.js.map +1 -1
  65. package/dist/hot.d.ts +15 -0
  66. package/dist/hot.d.ts.map +1 -0
  67. package/dist/hot.js +19 -0
  68. package/dist/hot.js.map +1 -0
  69. package/dist/identity-oFU5p-Qj.js +121 -0
  70. package/dist/identity-oFU5p-Qj.js.map +1 -0
  71. package/dist/{index-BFnXIfOj.d.ts → index-DdA39aMv.d.ts} +4 -4
  72. package/dist/{index-BFnXIfOj.d.ts.map → index-DdA39aMv.d.ts.map} +1 -1
  73. package/dist/index.d.ts +4 -4
  74. package/dist/index.js +5 -5
  75. package/dist/jsx-runtime-BGDPK50B.js +49 -0
  76. package/dist/jsx-runtime-BGDPK50B.js.map +1 -0
  77. package/dist/{jsx-runtime-DQnpyT_g.d.ts → jsx-runtime-CCvcEosg.d.ts} +14 -9
  78. package/dist/jsx-runtime-CCvcEosg.d.ts.map +1 -0
  79. package/dist/jsx-runtime.d.ts +1 -1
  80. package/dist/jsx-runtime.js +1 -25
  81. package/dist/konva.d.ts +46 -9
  82. package/dist/konva.d.ts.map +1 -1
  83. package/dist/konva.js +12 -5
  84. package/dist/konva.js.map +1 -1
  85. package/dist/motion.d.ts +1 -1
  86. package/dist/motion.js +4 -21
  87. package/dist/motion.js.map +1 -1
  88. package/dist/renderer.d.ts +1 -1
  89. package/dist/renderer.d.ts.map +1 -1
  90. package/dist/renderer.js +39 -40
  91. package/dist/renderer.js.map +1 -1
  92. package/dist/{server-renderer-D0rsFL_-.js → server-renderer-BYFDmqnM.js} +8 -18
  93. package/dist/server-renderer-BYFDmqnM.js.map +1 -0
  94. package/dist/server.d.ts +1 -1
  95. package/dist/server.js +1 -1
  96. package/dist/size.json +12 -12
  97. package/dist/{development/src-DoQgCX-O.js → src-B2W_TA_X.js} +3 -3
  98. package/dist/src-B2W_TA_X.js.map +1 -0
  99. package/dist/three.d.ts +3 -3
  100. package/dist/three.d.ts.map +1 -1
  101. package/dist/three.js +20 -19
  102. package/dist/three.js.map +1 -1
  103. package/dist/vite-WUiz1ju6.js +545 -0
  104. package/dist/vite-WUiz1ju6.js.map +1 -0
  105. package/dist/vite.d.ts.map +1 -1
  106. package/dist/vite.js +1 -1
  107. package/package.json +16 -9
  108. package/src/astro-client.ts +3 -2
  109. package/src/astro-server.ts +2 -2
  110. package/src/capabilities.ts +48 -21
  111. package/src/compiler-hmr.ts +297 -0
  112. package/src/compiler.ts +127 -25
  113. package/src/core.ts +282 -33
  114. package/src/dom-forms.ts +127 -0
  115. package/src/dom.ts +116 -52
  116. package/src/floating.ts +2 -6
  117. package/src/hot.ts +190 -0
  118. package/src/identity.ts +39 -0
  119. package/src/index.ts +2 -0
  120. package/src/jsx-runtime.ts +6 -26
  121. package/src/jsx-types.d.ts +8 -3
  122. package/src/konva.ts +66 -10
  123. package/src/motion.ts +3 -1
  124. package/src/presence.ts +11 -23
  125. package/src/props.ts +55 -0
  126. package/src/renderer.ts +91 -71
  127. package/src/server-renderer.ts +18 -13
  128. package/src/three.ts +23 -24
  129. package/src/use-loadable.ts +2 -2
  130. package/src/vite.ts +44 -4
  131. package/dist/capabilities-DNcnGRv_.d.ts.map +0 -1
  132. package/dist/capabilities-nOIitQ-_.js +0 -65
  133. package/dist/capabilities-nOIitQ-_.js.map +0 -1
  134. package/dist/core-B4rJ0xdc.js +0 -268
  135. package/dist/core-B4rJ0xdc.js.map +0 -1
  136. package/dist/development/capabilities-nOIitQ-_.js +0 -65
  137. package/dist/development/capabilities-nOIitQ-_.js.map +0 -1
  138. package/dist/development/core-BHA7I1nf.js +0 -271
  139. package/dist/development/core-BHA7I1nf.js.map +0 -1
  140. package/dist/development/dom-DQ0M3rLL.js.map +0 -1
  141. package/dist/development/jsx-runtime.js.map +0 -1
  142. package/dist/development/server-renderer-DCLoMdOX.js.map +0 -1
  143. package/dist/development/src-DoQgCX-O.js.map +0 -1
  144. package/dist/development/vite-Bmyb6P5w.js +0 -265
  145. package/dist/development/vite-Bmyb6P5w.js.map +0 -1
  146. package/dist/dom-D8g3roX9.js.map +0 -1
  147. package/dist/jsx-runtime-DQnpyT_g.d.ts.map +0 -1
  148. package/dist/jsx-runtime.js.map +0 -1
  149. package/dist/server-renderer-D0rsFL_-.js.map +0 -1
  150. package/dist/src-Bme1kz2b.js.map +0 -1
  151. package/dist/vite-Bmyb6P5w.js +0 -265
  152. package/dist/vite-Bmyb6P5w.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-Bmyb6P5w.js","names":[],"sources":["../../src/compiler.ts","../../src/vite.ts"],"sourcesContent":["import { decode } from \"html-entities\"\nimport type { SourceMap } from \"magic-string\"\nimport MagicString from \"magic-string\"\nimport type {\n\tExpression,\n\tJSXElement,\n\tJSXElementName,\n\tJSXFragment,\n\tNode,\n} from \"oxc-parser\"\nimport { parseSync, visitorKeys } from \"oxc-parser\"\n\ntype Part = string | Node\n\nconst decodeJsx = (value: string): string =>\n\tdecode(value, { level: `html4`, scope: `strict` })\n\n/** Match JSX's multiline whitespace rules without reprinting JavaScript. */\nfunction text(value: string): string {\n\tconst lines = value.split(/\\r\\n|\\n|\\r/)\n\tlet last = 0\n\tfor (let i = 0; i < lines.length; i++) if (/[^ \\t]/.test(lines[i])) last = i\n\treturn lines\n\t\t.map((line, i) => {\n\t\t\tline = line.replace(/\\t/g, ` `)\n\t\t\tif (i > 0) line = line.replace(/^ +/, ``)\n\t\t\tif (i < lines.length - 1) line = line.replace(/ +$/, ``)\n\t\t\treturn line && i < last ? `${line} ` : line\n\t\t})\n\t\t.join(``)\n}\n\nfunction eager(node: Node, allowJsx = false): boolean {\n\tif (node.type === `ParenthesizedExpression`)\n\t\treturn eager(node.expression, allowJsx)\n\treturn (\n\t\tnode.type === `Literal` ||\n\t\tnode.type === `FunctionExpression` ||\n\t\tnode.type === `ArrowFunctionExpression` ||\n\t\t(allowJsx && (node.type === `JSXElement` || node.type === `JSXFragment`)) ||\n\t\t(node.type === `TemplateLiteral` && node.expressions.length === 0)\n\t)\n}\n\nexport function compile(\n\tcode: string,\n\tfilename: string,\n): { code: string; map: SourceMap } {\n\tconst parsed = parseSync(filename, code, {\n\t\tlang: `tsx`,\n\t\tpreserveParens: true,\n\t})\n\tif (parsed.errors.length) {\n\t\tconst error = parsed.errors[0]\n\t\tthrow new SyntaxError(\n\t\t\t[`${filename}: ${error.message}`, error.codeframe]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(`\\n`),\n\t\t)\n\t}\n\tconst output = new MagicString(code)\n\tconst parents = new WeakMap<Node, Node>()\n\tconst identifiers = new Set<string>()\n\tconst elements: (JSXElement | JSXFragment)[] = []\n\tconst functions = new Set<Node>()\n\tfunction walk(node: Node, parent?: Node, outerFunction?: Node): void {\n\t\tif (parent) parents.set(node, parent)\n\t\toutput.addSourcemapLocation(node.start)\n\t\toutput.addSourcemapLocation(node.end)\n\t\tif (node.type === `Identifier` || node.type === `JSXIdentifier`)\n\t\t\tidentifiers.add(node.name)\n\t\tif (\n\t\t\t!outerFunction &&\n\t\t\t(node.type === `FunctionDeclaration` ||\n\t\t\t\tnode.type === `FunctionExpression` ||\n\t\t\t\tnode.type === `ArrowFunctionExpression`)\n\t\t)\n\t\t\touterFunction = node\n\t\tif (node.type === `JSXElement` || node.type === `JSXFragment`) {\n\t\t\telements.push(node)\n\t\t\tif (outerFunction) functions.add(outerFunction)\n\t\t}\n\t\tfor (const key of visitorKeys[node.type]) {\n\t\t\tconst value = (node as unknown as Record<string, unknown>)[key]\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tfor (const child of value) if (child) walk(child, node, outerFunction)\n\t\t\t} else if (value) walk(value as Node, node, outerFunction)\n\t\t}\n\t}\n\twalk(parsed.program)\n\tfunction uid(base: string): string {\n\t\tlet name = `_${base}`\n\t\tlet suffix = 1\n\t\twhile (identifiers.has(name)) name = `_${base}${++suffix}`\n\t\tidentifiers.add(name)\n\t\treturn name\n\t}\n\tconst create = uid(`spa`)\n\tconst merge = uid(`props`)\n\tconst join = (parts: Part[][], separator: string): Part[] =>\n\t\tparts.flatMap((part, i) => (i ? [separator, ...part] : part))\n\tconst expression = (node: Expression): Part[] =>\n\t\teager(node, true) ? [`(`, node, `)`] : [`() => (`, node, `)`]\n\tfunction tag(node: JSXElementName): string {\n\t\tif (node.type === `JSXNamespacedName`)\n\t\t\treturn JSON.stringify(`${node.namespace.name}:${node.name.name}`)\n\t\tif (node.type === `JSXMemberExpression`)\n\t\t\treturn code.slice(node.start, node.end)\n\t\treturn /^[a-z]/.test(node.name) || node.name.includes(`-`)\n\t\t\t? JSON.stringify(node.name)\n\t\t\t: node.name\n\t}\n\t/** Rewrite syntax around untouched expression spans, including nested JSX. */\n\tfunction rewrite(node: JSXElement | JSXFragment, parts: Part[]): void {\n\t\tlet cursor = node.start\n\t\tlet replacement = ``\n\t\tfor (const part of parts) {\n\t\t\tif (typeof part === `string`) {\n\t\t\t\treplacement += part\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (cursor < part.start) output.update(cursor, part.start, replacement)\n\t\t\telse output.appendLeft(cursor, replacement)\n\t\t\tcursor = part.end\n\t\t\treplacement = ``\n\t\t}\n\t\t// Every JSX node ends with closing syntax after its last expression span.\n\t\toutput.update(cursor, node.end, replacement)\n\t}\n\tfor (const node of elements) {\n\t\tconst chunks: Part[][] = []\n\t\tlet properties: Part[][] = []\n\t\tconst flush = () => {\n\t\t\tif (properties.length) chunks.push([`{`, ...join(properties, `, `), `}`])\n\t\t\tproperties = []\n\t\t}\n\t\tif (node.type === `JSXElement`) {\n\t\t\tfor (const attribute of node.openingElement.attributes) {\n\t\t\t\tif (attribute.type === `JSXSpreadAttribute`) {\n\t\t\t\t\tflush()\n\t\t\t\t\tchunks.push([`() => (`, attribute.argument, `)`])\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst key = JSON.stringify(\n\t\t\t\t\tattribute.name.type === `JSXNamespacedName`\n\t\t\t\t\t\t? `${attribute.name.namespace.name}:${attribute.name.name.name}`\n\t\t\t\t\t\t: attribute.name.name,\n\t\t\t\t)\n\t\t\t\tconst value = attribute.value\n\t\t\t\tif (!value) properties.push([`${key}: true`])\n\t\t\t\telse if (value.type === `Literal`)\n\t\t\t\t\tproperties.push([`${key}: ${JSON.stringify(decodeJsx(value.value))}`])\n\t\t\t\telse {\n\t\t\t\t\tconst expr =\n\t\t\t\t\t\tvalue.type === `JSXExpressionContainer` ? value.expression : value\n\t\t\t\t\tproperties.push(\n\t\t\t\t\t\tkey === `\"key\"` || eager(expr)\n\t\t\t\t\t\t\t? [`${key}: (`, expr, `)`]\n\t\t\t\t\t\t\t: [`get ${key}(){ return (`, expr, `); }`],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst component =\n\t\t\tnode.type === `JSXElement` &&\n\t\t\t!tag(node.openingElement.name).startsWith(`\"`)\n\t\tconst children: Part[][] = []\n\t\tlet lazyChildren = false\n\t\tfor (const child of node.children) {\n\t\t\tif (child.type === `JSXText`) {\n\t\t\t\tconst value = text(decodeJsx(child.value))\n\t\t\t\tif (value) children.push([JSON.stringify(value)])\n\t\t\t} else if (child.type === `JSXElement` || child.type === `JSXFragment`)\n\t\t\t\tchildren.push([child])\n\t\t\telse if (child.type === `JSXExpressionContainer`) {\n\t\t\t\tif (child.expression.type !== `JSXEmptyExpression`) {\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\t// Component props expose their declared values, including callbacks.\n\t\t\t\t\t\tchildren.push([`(`, child.expression, `)`])\n\t\t\t\t\t\tif (!eager(child.expression, true)) lazyChildren = true\n\t\t\t\t\t} else children.push(expression(child.expression))\n\t\t\t\t}\n\t\t\t} else\n\t\t\t\tthrow new SyntaxError(`${filename}: JSX spread children are unsupported`)\n\t\t}\n\t\tif (children.length) {\n\t\t\tconst value =\n\t\t\t\tchildren.length === 1 ? children[0] : [`[`, ...join(children, `, `), `]`]\n\t\t\tif (lazyChildren) {\n\t\t\t\t// Capture the computation outside the getter's method scope.\n\t\t\t\tconst read = uid(`children`)\n\t\t\t\tproperties.push([`get children(){ return ${read}(); }`])\n\t\t\t\tchunks.push([\n\t\t\t\t\t`((${read}) => ({`,\n\t\t\t\t\t...join(properties, `, `),\n\t\t\t\t\t`}))(() => (`,\n\t\t\t\t\t...value,\n\t\t\t\t\t`))`,\n\t\t\t\t])\n\t\t\t\tproperties = []\n\t\t\t} else properties.push([`children: `, ...value])\n\t\t}\n\t\tflush()\n\t\tconst spreads =\n\t\t\tnode.type === `JSXElement` &&\n\t\t\tnode.openingElement.attributes.some(\n\t\t\t\t(attr) => attr.type === `JSXSpreadAttribute`,\n\t\t\t)\n\t\tconst props = spreads\n\t\t\t? [`${merge}(`, ...join(chunks, `, `), `)`]\n\t\t\t: (chunks[0] ?? [`{}`])\n\t\trewrite(node, [\n\t\t\t`${create}(${node.type === `JSXElement` ? tag(node.openingElement.name) : `null`}, `,\n\t\t\t...props,\n\t\t\t`)`,\n\t\t])\n\t}\n\tconst components = new Set<string>()\n\tfor (const fn of functions) {\n\t\tlet node = fn\n\t\tlet parent = parents.get(node)\n\t\twhile (parent?.type === `ParenthesizedExpression`) {\n\t\t\tnode = parent\n\t\t\tparent = parents.get(node)\n\t\t}\n\t\tif (fn.type === `FunctionDeclaration` && fn.id) components.add(fn.id.name)\n\t\telse if (\n\t\t\tparent?.type === `VariableDeclarator` &&\n\t\t\tparent.id.type === `Identifier`\n\t\t)\n\t\t\tcomponents.add(parent.id.name)\n\t\telse if (parent?.type === `ExportDefaultDeclaration`) {\n\t\t\tconst name = uid(`Component`)\n\t\t\tif (fn.type === `FunctionDeclaration`) {\n\t\t\t\t// Keep anonymous default function declarations hoisted.\n\t\t\t\tconst token = [\n\t\t\t\t\t...code\n\t\t\t\t\t\t.slice(fn.start, fn.body!.start)\n\t\t\t\t\t\t.matchAll(/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*|\\bfunction\\b|\\*/g),\n\t\t\t\t].find((match) => match[0] === (fn.generator ? `*` : `function`))!\n\t\t\t\toutput.appendLeft(fn.start + token.index + token[0].length, ` ${name}`)\n\t\t\t} else {\n\t\t\t\t// Replace only keywords so intervening comments and annotations survive.\n\t\t\t\tconst prefix = code.slice(parent.start, node.start)\n\t\t\t\tfor (const token of prefix.matchAll(\n\t\t\t\t\t/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*|\\b(?:export|default)\\b/g,\n\t\t\t\t)) {\n\t\t\t\t\tif (token[0] !== `export` && token[0] !== `default`) continue\n\t\t\t\t\toutput.update(\n\t\t\t\t\t\tparent.start + token.index,\n\t\t\t\t\t\tparent.start + token.index + token[0].length,\n\t\t\t\t\t\ttoken[0] === `export` ? `const ${name} =` : ``,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\toutput.appendLeft(parent.end, `;\\nexport default ${name};`)\n\t\t\t}\n\t\t\tcomponents.add(name)\n\t\t}\n\t}\n\tif (elements.length) {\n\t\t// Keep hashbangs and directive prologues ahead of generated imports.\n\t\tlet position = parsed.program.hashbang?.end ?? 0\n\t\tfor (const statement of parsed.program.body) {\n\t\t\tif (statement.type !== `ExpressionStatement` || !statement.directive) break\n\t\t\tposition = statement.end\n\t\t}\n\t\toutput.appendLeft(\n\t\t\tposition,\n\t\t\t`\\nimport { jsx as ${create}, merge as ${merge} } from \"@atom.io/spa/jsx-runtime\";\\n`,\n\t\t)\n\t\tfor (const component of components)\n\t\t\toutput.append(`\\n;${component}.spa = true;`)\n\t}\n\treturn {\n\t\tcode: output.toString(),\n\t\tmap: output.generateMap({\n\t\t\tsource: filename,\n\t\t\tincludeContent: true,\n\t\t\thires: true,\n\t\t}),\n\t}\n}\n","import type { Plugin } from \"vite\"\n\nimport { compile } from \"./compiler.ts\"\n\nexport interface SpaPluginOptions {\n\tinclude?: RegExp\n}\nexport default function spa(options: SpaPluginOptions = {}): Plugin {\n\tconst include = options.include ?? /\\.[jt]sx$/\n\tconst matches = (id: string): boolean => {\n\t\tinclude.lastIndex = 0\n\t\treturn !id.includes(`/node_modules/`) && include.test(id.split(`?`)[0])\n\t}\n\treturn {\n\t\tname: `spa`,\n\t\tenforce: `pre`,\n\t\tconfig() {\n\t\t\treturn {\n\t\t\t\tresolve: { dedupe: [`@atom.io/spa`, `atom.io`] },\n\t\t\t\toptimizeDeps: { exclude: [`@atom.io/spa`, `atom.io`] },\n\t\t\t}\n\t\t},\n\t\tconfigEnvironment: {\n\t\t\torder: `post`,\n\t\t\thandler(_name, config) {\n\t\t\t\t// Astro and its adapters force renderer entries into the optimizer.\n\t\t\t\t// Vite processes explicit includes even when their package is excluded.\n\t\t\t\t// Keep the renderer, hooks, and store in one unbundled module graph.\n\t\t\t\tif (config.optimizeDeps?.include) {\n\t\t\t\t\tconfig.optimizeDeps.include = config.optimizeDeps.include.filter(\n\t\t\t\t\t\t(id) => !/^(@atom\\.io\\/spa|atom\\.io)(\\/|$)/.test(id),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\ttransform(code, id) {\n\t\t\tif (!matches(id)) return\n\t\t\treturn compile(code, id)\n\t\t},\n\t\t// A reload disposes the whole document. No state-preserving HMR is promised.\n\t\thandleHotUpdate({ server, file }) {\n\t\t\tif (matches(file)) {\n\t\t\t\tserver.ws.send({ type: `full-reload` })\n\t\t\t\treturn []\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;;;AAcA,MAAM,aAAa,UAClB,OAAO,OAAO;CAAE,OAAO;CAAS,OAAO;AAAS,CAAC;;AAGlD,SAAS,KAAK,OAAuB;CACpC,MAAM,QAAQ,MAAM,MAAM,YAAY;CACtC,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,IAAI,SAAS,KAAK,MAAM,EAAE,GAAG,OAAO;CAC3E,OAAO,MACL,KAAK,MAAM,MAAM;EACjB,OAAO,KAAK,QAAQ,OAAO,GAAG;EAC9B,IAAI,IAAI,GAAG,OAAO,KAAK,QAAQ,OAAO,EAAE;EACxC,IAAI,IAAI,MAAM,SAAS,GAAG,OAAO,KAAK,QAAQ,OAAO,EAAE;EACvD,OAAO,QAAQ,IAAI,OAAO,GAAG,KAAK,KAAK;CACxC,CAAC,CAAC,CACD,KAAK,EAAE;AACV;AAEA,SAAS,MAAM,MAAY,WAAW,OAAgB;CACrD,IAAI,KAAK,SAAS,2BACjB,OAAO,MAAM,KAAK,YAAY,QAAQ;CACvC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YAAY;GACvB,QAAQ;GACR,gBAAgB;GAChB,OAAO;EACR,CAAC;CACF;AACD;;AClRA,SAAwB,IAAI,UAA4B,CAAC,GAAW;CACnE,MAAM,UAAU,QAAQ,WAAW;CACnC,MAAM,WAAW,OAAwB;EACxC,QAAQ,YAAY;EACpB,OAAO,CAAC,GAAG,SAAS,gBAAgB,KAAK,QAAQ,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC,EAAE;CACvE;CACA,OAAO;EACN,MAAM;EACN,SAAS;EACT,SAAS;GACR,OAAO;IACN,SAAS,EAAE,QAAQ,CAAC,gBAAgB,SAAS,EAAE;IAC/C,cAAc,EAAE,SAAS,CAAC,gBAAgB,SAAS,EAAE;GACtD;EACD;EACA,mBAAmB;GAClB,OAAO;GACP,QAAQ,OAAO,QAAQ;IAItB,IAAI,OAAO,cAAc,SACxB,OAAO,aAAa,UAAU,OAAO,aAAa,QAAQ,QACxD,OAAO,CAAC,mCAAmC,KAAK,EAAE,CACpD;GAEF;EACD;EACA,UAAU,MAAM,IAAI;GACnB,IAAI,CAAC,QAAQ,EAAE,GAAG;GAClB,OAAO,QAAQ,MAAM,EAAE;EACxB;EAEA,gBAAgB,EAAE,QAAQ,QAAQ;GACjC,IAAI,QAAQ,IAAI,GAAG;IAClB,OAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;IACtC,OAAO,CAAC;GACT;EACD;CACD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"dom-D8g3roX9.js","names":[],"sources":["../src/dom.ts"],"sourcesContent":["import { capabilityProps } from \"./capabilities.ts\"\nimport type {\n\tAccessor,\n\tChildren,\n\tRootOptions,\n\tScope,\n\tSpaElement,\n} from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tfail,\n\tinvalidate,\n\tobserve,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment, merge } from \"./jsx-runtime.ts\"\n\nconst HTML = `http://www.w3.org/1999/xhtml`\nconst SVG = `http://www.w3.org/2000/svg`\ntype Cursor = {\n\tnode: Node | null\n\treport(expected: Node | null, found: Node | null): void\n}\ntype RecordNode = { _value: Children; _scope: Scope; _start: Node; _end: Node }\n\nfunction finish(cursor?: Cursor): void {\n\tif (cursor?.node) {\n\t\tcursor.report(null, cursor.node)\n\t\twhile (cursor.node) {\n\t\t\tconst node: Node = cursor.node\n\t\t\tcursor.node = node.nextSibling\n\t\t\t;(node as ChildNode).remove()\n\t\t}\n\t}\n}\n\nfunction take(\n\tnode: Node,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\tif (\n\t\tcursor &&\n\t\t!(node.nodeType === 3 && !node.nodeValue && cursor.node?.nodeType !== 3)\n\t) {\n\t\tconst found = cursor.node\n\t\tif (\n\t\t\t!found ||\n\t\t\tfound.nodeType !== node.nodeType ||\n\t\t\tfound.nodeName !== node.nodeName ||\n\t\t\t(found as Element).namespaceURI !== (node as Element).namespaceURI ||\n\t\t\t(node.nodeType !== 1 && found.nodeValue !== node.nodeValue)\n\t\t) {\n\t\t\tcursor.report(node, found)\n\t\t\tparent.insertBefore(node, found)\n\t\t\tcursor.node = found?.nextSibling ?? null\n\t\t\t;(found as ChildNode | null)?.remove()\n\t\t} else {\n\t\t\tnode = found\n\t\t\tcursor.node = found.nextSibling\n\t\t}\n\t} else parent.insertBefore(node, cursor ? cursor.node : before)\n\towner._cleanups.add(() => {\n\t\t;(node as ChildNode).remove()\n\t})\n\treturn node\n}\nfunction comment(\n\tvalue: string,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tcursor?: Cursor,\n): Node {\n\treturn take(\n\t\tparent.ownerDocument!.createComment(value),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t)\n}\nfunction property(\n\telement: Element,\n\tkey: string,\n\tvalue: any,\n\tprevious: any,\n): void {\n\tif (/^(key|children|ref)$/.test(key)) return\n\tif (key === `innerHTML` && element.localName === `astro-slot`) return\n\tif (\n\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\tkey,\n\t\t)\n\t)\n\t\tthrow new Error(import.meta.env.DEV ? `spa: owned content` : undefined)\n\tif (key.startsWith(`on`)) {\n\t\tconst capture = /(?<!Pointer)Capture$/.test(key)\n\t\tconst event = key\n\t\t\t.slice(2, capture ? -7 : undefined)\n\t\t\t.toLowerCase()\n\t\t\t.replace(`doubleclick`, `dblclick`)\n\t\tif (previous) element.removeEventListener(event, previous, capture)\n\t\tif (value != null) {\n\t\t\tif (import.meta.env.DEV && typeof value !== `function`)\n\t\t\t\tthrow new Error(`spa: event handler`)\n\t\t\telement.addEventListener(event, value, capture)\n\t\t}\n\t\treturn\n\t}\n\tif (key === `className`) key = `class`\n\tif (key === `htmlFor`) key = `for`\n\tif (\n\t\timport.meta.env.DEV &&\n\t\tkey === `style` &&\n\t\tvalue != null &&\n\t\ttypeof value !== `string`\n\t)\n\t\tthrow new Error(`spa: CSS string required`)\n\tif (\n\t\telement.namespaceURI === HTML &&\n\t\tkey in element &&\n\t\t!/^(style|form|list)$/.test(key)\n\t) {\n\t\tconst target = element as any\n\t\ttarget[key] = value ?? (typeof target[key] === `boolean` ? false : ``)\n\t} else if (value == null || (value === false && !/^(aria-|data-)/.test(key)))\n\t\telement.removeAttribute(key)\n\telse\n\t\telement.setAttribute(\n\t\t\tkey,\n\t\t\tvalue === true && !/^(aria-|data-)/.test(key) ? `` : String(value),\n\t\t)\n}\n\nfunction mount(\n\tvalue: Children,\n\tparent: Node,\n\tbefore: Node | null,\n\towner: Scope,\n\tnamespace: string,\n\tcursor?: Cursor,\n\tsource = () => value,\n): void {\n\tif (typeof value === `function`) {\n\t\tcomment(`{`, parent, before, owner, cursor)\n\t\tlet end: Node | null = null\n\t\tlet records = new Map<unknown, RecordNode>()\n\t\tconst presence = owner._root._presence?.collection<RecordNode, Children>(\n\t\t\t(record) => record._scope,\n\t\t\t(record, child) =>\n\t\t\t\ttypeof record._value === typeof child &&\n\t\t\t\t(record._value as SpaElement | null)?.type ===\n\t\t\t\t\t(child as SpaElement | null)?.type,\n\t\t)\n\t\tconst retire = (\n\t\t\trecord: RecordNode,\n\t\t\tkey: unknown,\n\t\t\teligible: boolean,\n\t\t\tindex: number,\n\t\t) => {\n\t\t\tif (presence) presence.remove(record, key, eligible, index, () => {})\n\t\t\telse dispose(record._scope)\n\t\t}\n\t\tlet initial = cursor\n\t\tobserve(\n\t\t\towner,\n\t\t\t() => (source() as () => Children)(),\n\t\t\t(next) => {\n\t\t\t\tconst values = ([next] as unknown[]).flat(Infinity) as Children[]\n\t\t\t\tconst kept = new Map<unknown, RecordNode>()\n\t\t\t\tconst focus = parent.ownerDocument!.activeElement as HTMLElement | null\n\t\t\t\tfor (let index = 0; index < values.length; index++) {\n\t\t\t\t\tconst child = values[index]\n\t\t\t\t\tconst vnode = child as SpaElement | null\n\t\t\t\t\tconst explicit = vnode?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (import.meta.env.DEV && kept.has(key))\n\t\t\t\t\t\tthrow new Error(`spa: duplicate key`)\n\t\t\t\t\tlet record = records.get(key)\n\t\t\t\t\tif (\n\t\t\t\t\t\trecord &&\n\t\t\t\t\t\t(typeof record._value !== typeof child ||\n\t\t\t\t\t\t\t(record._value as SpaElement | null)?.type !== vnode?.type)\n\t\t\t\t\t) {\n\t\t\t\t\t\tretire(\n\t\t\t\t\t\t\trecord,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tchild == null || typeof child === `boolean`,\n\t\t\t\t\t\t\t[...records.keys()].indexOf(key),\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord = undefined\n\t\t\t\t\t}\n\t\t\t\t\trecord ??= presence?.take(key, child)\n\t\t\t\t\tif (!record) {\n\t\t\t\t\t\tconst childOwner = createScope(owner)\n\t\t\t\t\t\trecord = {\n\t\t\t\t\t\t\t_value: child,\n\t\t\t\t\t\t\t_scope: childOwner,\n\t\t\t\t\t\t\t_start: comment(`[`, parent, end ?? before, childOwner, initial),\n\t\t\t\t\t\t\t_end: null!,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst held = record\n\t\t\t\t\t\tmount(\n\t\t\t\t\t\t\tchild,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tnamespace,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t\t() => held._value,\n\t\t\t\t\t\t)\n\t\t\t\t\t\trecord._end = comment(\n\t\t\t\t\t\t\t`]`,\n\t\t\t\t\t\t\tparent,\n\t\t\t\t\t\t\tend ?? before,\n\t\t\t\t\t\t\tchildOwner,\n\t\t\t\t\t\t\tinitial,\n\t\t\t\t\t\t)\n\t\t\t\t\t} else {\n\t\t\t\t\t\trecord._value = child\n\t\t\t\t\t\towner._root._presence?.resume(record._scope)\n\t\t\t\t\t\tinvalidate(record._scope)\n\t\t\t\t\t}\n\t\t\t\t\tkept.set(key, record)\n\t\t\t\t}\n\t\t\t\tfor (const [key, record] of records)\n\t\t\t\t\tif (!kept.has(key))\n\t\t\t\t\t\tretire(record, key, true, [...records.keys()].indexOf(key))\n\t\t\t\tif (!initial) {\n\t\t\t\t\tlet at = end ?? before\n\t\t\t\t\tconst rendered = presence?.merge([...kept.values()]) ?? [\n\t\t\t\t\t\t...kept.values(),\n\t\t\t\t\t]\n\t\t\t\t\tfor (const record of rendered.reverse()) {\n\t\t\t\t\t\tif (record._end.nextSibling !== at) {\n\t\t\t\t\t\t\tconst range = parent.ownerDocument!.createRange()\n\t\t\t\t\t\t\trange.setStartBefore(record._start)\n\t\t\t\t\t\t\trange.setEndAfter(record._end)\n\t\t\t\t\t\t\tparent.insertBefore(range.extractContents(), at)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tat = record._start\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\tfocus?.isConnected &&\n\t\t\t\t\t\t!focus.closest(`[inert]`) &&\n\t\t\t\t\t\tfocus !== parent.ownerDocument!.activeElement\n\t\t\t\t\t)\n\t\t\t\t\t\tfocus.focus({ preventScroll: true })\n\t\t\t\t}\n\t\t\t\tinitial = undefined\n\t\t\t\trecords = kept\n\t\t\t},\n\t\t)\n\t\tend = comment(`}`, parent, before, owner, cursor)\n\t\treturn\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const child of value)\n\t\t\tmount(child, parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (value == null || typeof value === `boolean`) return\n\tif (typeof value !== `object`) {\n\t\tcomment(`t`, parent, before, owner, cursor)\n\t\tconst text = take(\n\t\t\tparent.ownerDocument!.createTextNode(String(value)),\n\t\t\tparent,\n\t\t\tbefore,\n\t\t\towner,\n\t\t\tcursor,\n\t\t)\n\t\tobserve(owner, source as Accessor<string | number | bigint>, (next) => {\n\t\t\tconst data = String(next)\n\t\t\tif (text.nodeValue !== data) text.nodeValue = data\n\t\t})\n\t\treturn\n\t}\n\tif (import.meta.env.DEV && (!(`type` in value) || !(`props` in value)))\n\t\tthrow new Error(`spa: invalid child`)\n\tconst vnode = value as SpaElement\n\tconst props = merge(() => (source() as SpaElement).props)\n\tif (!vnode.type || vnode.type === Fragment) {\n\t\tmount(() => props[`children`], parent, before, owner, namespace, cursor)\n\t\treturn\n\t}\n\tif (typeof vnode.type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\tconst output = within(childOwner, () =>\n\t\t\tuntrack(() => (vnode.type as Function)(props)),\n\t\t)\n\t\tmount(output, parent, before, childOwner, namespace, cursor)\n\t\treturn\n\t}\n\tconst ns = vnode.type === `svg` ? SVG : namespace\n\tconst element = take(\n\t\tparent.ownerDocument!.createElementNS(ns, vnode.type),\n\t\tparent,\n\t\tbefore,\n\t\towner,\n\t\tcursor,\n\t) as Element\n\tif (vnode.type === `astro-slot`) {\n\t\tif (!cursor) element.innerHTML = props[`innerHTML`] ?? ``\n\t} else if (ns === HTML && /^(textarea|title|style|script)$/.test(vnode.type)) {\n\t\tobserve(\n\t\t\towner,\n\t\t\t() =>\n\t\t\t\tplain(\n\t\t\t\t\tvnode.type === `textarea`\n\t\t\t\t\t\t? (props[`value`] ?? props[`children`])\n\t\t\t\t\t\t: props[`children`],\n\t\t\t\t),\n\t\t\t(text) => {\n\t\t\t\tif (element.textContent !== text) element.textContent = text\n\t\t\t},\n\t\t)\n\t} else {\n\t\tconst children = cursor\n\t\t\t? { node: element.firstChild, report: cursor.report }\n\t\t\t: undefined\n\t\tif (\n\t\t\t!/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/.test(\n\t\t\t\tvnode.type,\n\t\t\t) ||\n\t\t\tns !== HTML\n\t\t)\n\t\t\tmount(\n\t\t\t\t() => props[`children`],\n\t\t\t\telement,\n\t\t\t\tnull,\n\t\t\t\towner,\n\t\t\t\tvnode.type === `foreignObject` ? HTML : ns,\n\t\t\t\tchildren,\n\t\t\t)\n\t\tfinish(children)\n\t}\n\tlet previous: Record<string, any> = {}\n\tconst nativeProps = capabilityProps(\n\t\towner,\n\t\t{ kind: `dom`, node: element },\n\t\t() => ({ ...props }),\n\t\t(next) => {\n\t\t\tconst previousStyle =\n\t\t\t\tprevious[`style`] !== next[`style`]\n\t\t\t\t\t? (element.getAttribute(`style`) ?? ``)\n\t\t\t\t\t: undefined\n\t\t\tfor (const key in { ...previous, ...next })\n\t\t\t\tif (\n\t\t\t\t\t!Object.is(previous[key], next[key]) ||\n\t\t\t\t\ttypeof next[key] === `object`\n\t\t\t\t) {\n\t\t\t\t\tproperty(element, key, next[key], previous[key])\n\t\t\t\t\tprevious[key] = next[key]\n\t\t\t\t}\n\t\t\tprevious = next\n\t\t\treturn previousStyle\n\t\t},\n\t)\n\towner._cleanups.add(() => {\n\t\tfor (const key in previous)\n\t\t\tif (key.startsWith(`on`)) property(element, key, null, previous[key])\n\t})\n\tobserve(owner, () => ({ ...props }), nativeProps)\n\tconst ref = untrack(() => props[`ref`])\n\tif (ref) {\n\t\towner._root._mounts!.unshift(() => {\n\t\t\tif (!owner._dead) {\n\t\t\t\towner._cleanups.add(() => ref(null))\n\t\t\t\tref(element)\n\t\t\t}\n\t\t})\n\t}\n}\n\nexport interface SpaRoot {\n\tdispose(): void\n\tflush(): void\n}\nfunction start(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions,\n\thydrating: boolean,\n): SpaRoot {\n\tlet reported = false\n\tconst cursor: Cursor | undefined = hydrating\n\t\t? {\n\t\t\t\tnode: host.firstChild,\n\t\t\t\treport(expected, found) {\n\t\t\t\t\tif (!reported) {\n\t\t\t\t\t\treported = true\n\t\t\t\t\t\t// eslint-disable-next-line no-console -- Recoverable degradation must remain human-readable in production.\n\t\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t\t`spa: hydration mismatch. Repairing server HTML to match the browser view; replaced nodes may lose focus or unsaved input.`,\n\t\t\t\t\t\t\t{ host, expected, found },\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t: undefined\n\tconst marker = cursor?.node\n\tconst prefix =\n\t\tmarker?.nodeType === 8 && marker.nodeValue?.startsWith(`w:`)\n\t\t\t? marker.nodeValue.slice(2)\n\t\t\t: undefined\n\tconst root = createRoot(options)\n\tif (prefix !== undefined && options.idPrefix === undefined)\n\t\troot._prefix = prefix\n\ttry {\n\t\tcomment(`w:${root._prefix}`, host, null, root, cursor)\n\t\twithin(root, () => {\n\t\t\tmount(\n\t\t\t\tuntrack(setup),\n\t\t\t\thost,\n\t\t\t\tnull,\n\t\t\t\troot,\n\t\t\t\thost.namespaceURI === SVG ? SVG : HTML,\n\t\t\t\tcursor,\n\t\t\t)\n\t\t})\n\t\tcomment(`/w`, host, null, root, cursor)\n\t\tfinish(cursor)\n\t\troot.flush()\n\t} catch (error) {\n\t\tfail(root, error)\n\t}\n\treturn {\n\t\tdispose: () => {\n\t\t\tdispose(root)\n\t\t},\n\t\tflush: root.flush,\n\t}\n}\nexport function render(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, false)\n}\nexport function hydrate(\n\tsetup: () => Children,\n\thost: Element,\n\toptions: RootOptions = {},\n): SpaRoot {\n\treturn start(setup, host, options, true)\n}\n"],"mappings":";;;;AAqBA,MAAM,OAAO;AACb,MAAM,MAAM;AAOZ,SAAS,OAAO,QAAuB;CACtC,IAAI,QAAQ,MAAM;EACjB,OAAO,OAAO,MAAM,OAAO,IAAI;EAC/B,OAAO,OAAO,MAAM;GACnB,MAAM,OAAa,OAAO;GAC1B,OAAO,OAAO,KAAK;GAClB,KAAoB,OAAO;EAC7B;CACD;AACD;AAEA,SAAS,KACR,MACA,QACA,QACA,OACA,QACO;CACP,IACC,UACA,EAAE,KAAK,aAAa,KAAK,CAAC,KAAK,aAAa,OAAO,MAAM,aAAa,IACrE;EACD,MAAM,QAAQ,OAAO;EACrB,IACC,CAAC,SACD,MAAM,aAAa,KAAK,YACxB,MAAM,aAAa,KAAK,YACvB,MAAkB,iBAAkB,KAAiB,gBACrD,KAAK,aAAa,KAAK,MAAM,cAAc,KAAK,WAChD;GACD,OAAO,OAAO,MAAM,KAAK;GACzB,OAAO,aAAa,MAAM,KAAK;GAC/B,OAAO,OAAO,OAAO,eAAe;GACnC,OAA6B,OAAO;EACtC,OAAO;GACN,OAAO;GACP,OAAO,OAAO,MAAM;EACrB;CACD,OAAO,OAAO,aAAa,MAAM,SAAS,OAAO,OAAO,MAAM;CAC9D,MAAM,UAAU,UAAU;EACxB,KAAoB,OAAO;CAC7B,CAAC;CACD,OAAO;AACR;AACA,SAAS,QACR,OACA,QACA,QACA,OACA,QACO;CACP,OAAO,KACN,OAAO,cAAe,cAAc,KAAK,GACzC,QACA,QACA,OACA,MACD;AACD;AACA,SAAS,SACR,SACA,KACA,OACA,UACO;CACP,IAAI,uBAAuB,KAAK,GAAG,GAAG;CACtC,IAAI,Q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K;CACjB;CACA,OAAO;EACN,eAAe;GACd,QAAQ,IAAI;EACb;EACA,OAAO,KAAK;CACb;AACD;AACA,SAAgB,OACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,KAAK;AACzC;AACA,SAAgB,QACf,OACA,MACA,UAAuB,CAAC,GACd;CACV,OAAO,MAAM,OAAO,MAAM,SAAS,IAAI;AACxC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime-DQnpyT_g.d.ts","names":[],"sources":["../src/jsx-types.d.ts","../src/jsx-runtime.ts"],"mappings":";;KAIY,cAAc,UAAU,SAAS,UAAU,QAAQ,SAAS,KACvE;WAEc,eAAe;;KAClB,aAAa,UAAU,SAAS,UAAU,QAAQ,UAC7D,OAAO,cAAc,GAAG;KAEb,IAAI,UAAU,YAAY,SAAS;KAE1C,WAAW,QAAQ,WAAW,KAAK,EAAE;;UAGhC;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAEI,UAAU,oBACZ,IACA,WAAW,MACV,gBAAgB,aAAa,WAAW;KACvC,cAAc,UAAU,WAAW,UAAU,mBAC/C,2BACA,UAAU,mBACT,2BACA,UAAU,kBACT,0BACA,UAAU,sBACT,8BACA,UAAU,gBACT,wBACA,UAAU,aACT,qBACA;KACI,gBAAgB,UAAU,cAEpC,WAAW,cAAc,oBAAoB,UAAU,yBACpD,aAAa,GAAG,QAAQ,cAAc,GAAG,IAAI;KAG7C;KACO,iBAAiB;GAC3B;GACA,gBAAgB;GAChB;GACA;GACA;GACA,cAAc;GACd,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,iBAAiB;GACjB;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA,kBAAkB;GAClB;GACA,iBAAiB;GACjB,kBAAkB;GAClB,gBAAgB;GAChB,iBAAiB;GACjB;GACA;GACA;GACA;GACA;GACA,eAAe;GACf,mBAAmB;GACnB,yBAAyB;GACzB;GACA;GACA;GACA;GACA,iBAAiB;GACjB,kBAAkB;GAClB;GAWA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;GACA;;KAGU,cAAc,UAAU,WAAW,8BAC9C,gBAAgB,KAChB,iBACA;EACC,UAAU;EACV;EACA,KAAK,IAAI;EACT;EACA;EACA;EACA;EACA;EACA;EACA;EACA;QACO;;;KAIJ,YAAY,KAAK,WAAW,QAC/B,WAAW,KAAK,mBAAmB,UAAU,cAC3C,EAAE;KAIM,eAAe,UAAU,cAAc,eAClD,cAAc,KACb;EACC;EACA;EAOA;EACA;EACA;EACA;EACA;EACA;EAQA;EACA;EACA;EACA;EASA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGE;KACA;KAUA;KACA;EACJ;EACA;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA,aAAa;EACb;EACA;EACA;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA,gBAAgB;EAChB;EACA;EACA;;KAEI;EACJ;EACA;EACA;EACA;EACA;;;UAIS;EACT,GAAG;EACH,MAAM;IACL;IACA;IACA;;EAED,OAAO;EACP;IAAQ;IAAc;;EACtB;IAAc;;EACd,QAAQ;IACP;IACA;IACA;IACA,OAAO;IACP;IACA;IACA;IACA;;EAED;IAAU,QAAQ;IAAgB,OAAO;;EACzC;IAAO;;EACP;IAAY;;EACZ;IAAQ,OAAO;;EACf;IAAO;IAAc;;EACrB;IAAW;IAAc;;EACzB;IAAU;IAAe;;EACzB;IACC,QAAQ;IACR;IACA;IACA,OAAO;;EAER;IAAY;IAAmB;IAAc;;EAC7C;IACC;KACC;IACD;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED;IAAQ;;EACR;IACC;IACA;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA,OAAO;;EAER;IACC;IACA,aAAa;IACb;IACA;IACA,QAAQ;IACR;IACA;IACA,gBAAgB;IAChB;IACA;IACA;IACA;IACA,OAAO;;EAER,OAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA,cAAc;IACd;IACA;IACA,QAAQ;IACR;IACA,KAAK;IACL;IACA,KAAK;IACL;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,MAAM;IACN;IACA,OAAO;IACP,OAAO;;EAER;IAAO;IAAc;;EACrB;IAAS;IAAa;IAAiB;;EACvC;IAAM;;EACN;IACC;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;IACA;;EAED;IAAO;;EACP;IACC;IACA;IACA;KACC;IACD;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;;EAED;IACC;IACA;IACA,QAAQ;IACR;IACA;IACA;IACA,OAAO;;EAER;IAAM;IAAmB;IAAe;;EACxC;IAAY;IAAmB;;EAC/B;IACC;IACA;IACA;IACA,OAAO;;EAER;IAAU;IAAa;IAAiB;IAAc;;EACtD;IAAY;IAAa;;EACzB;IAAK;;EACL;IACC;IACA;IACA;IACA,aAAa;IACb;IACA;IACA;IACA;IACA,gBAAgB;IAChB;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAQ;;EACR;IACC,QAAQ;IACR;IACA;IACA;IACA;IACA;IACA,OAAO;;EAER;IAAS;IAAkB;IAAe;IAAe;;EACzD;IAAS,aAAa;IAAgB,aAAa;;EACnD,IAAI;EACJ;IACC;IACA;IACA;IACA;;EAED;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,IAAI;EACJ;IAAQ;;EACR;IACC;IACA;IACA;IACA;IACA;;EAED,OAAO;IACN;IACA,QAAQ;IACR;IACA;IACA,OAAO;;;KAIG,2BACV,aAAa,wBAAwB,eACrC,sBAAsB,SAErB,kBAAkB,oBAChB,YAAY,kBAAkB;;KAKvB,cAAc,UAAU,aAAa,cAAc,cAAc,KAC5E;EACC;GACC;GACA;EACD;GACC;GACA;GACA,mBAAmB;EACpB;GACC;GACA;EACD;GACC;GACA;GACA;EACD;EACA;EACA;GACC;EACD;GACC,iBAAiB;GACjB;EACD;GACC;GACA,kBAAkB;GAClB;GACA,cAAc;GACd,qBAAqB;GACrB;GACA;GACA;GACA,gBAAgB;GAChB;GACA,mBAAmB;GACnB;GACA;GACA;GACA;EACD;EACA,SAAS;EACT;GACC;GACA;GACA;GACA;GACA,iBAAiB;EAClB;GACC,qBAAqB;GACrB,sBAAsB;GACtB;GACA;GACA,sBAAsB;GACtB,mBAAmB;GACnB,iBAAiB;GACjB;GACA;GACA;EACD;GACC;GACA;GACA;EACD;GACC,iBAAiB;GACjB;;KAGE;EACJ,GAAG;EACH,GAAG;EACH,OAAO;EACP,QAAQ;;KAEJ;EAAe;EAAiB;;KAChC;EAAY;GAAe;;KAC3B,qBAAqB;EAAW;;KAChC,eAAe;EACnB;EACA;EACA,OAAO;EACP,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL;EACA,aAAa;EACb,WAAW;EACX;EACA;EACA;EACA;EACA,MAAM;EACN,IAAI;EACJ,IAAI;EACJ;EACA;;KAEI;EACJ,GAAG;EACH,GAAG;EACH,IAAI;EACJ,IAAI;EACJ,QAAQ;EACR,YAAY;EACZ;;UAES;EACT,GAAG;IACF;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,eAAe;IACd;IACA;IACA,QAAQ;IACR;;EAED,kBAAkB;IACjB;;EAED;IACC,IAAI;IACJ,IAAI;IACJ,GAAG;IACH;;EAED;IAAY;;EACZ;IACC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;;EAED,SAAS;IAAuB;IAAY;IAAa;;EACzD,eAAe;IACd;IACA;IACA;;EAED,qBAAqB;IAAuB;;EAC5C,aAAa;IACZ;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,kBAAkB;IACjB;IACA,OAAO;IACP;IACA;IACA;IACA;IACA;IACA;IACA,eAAe;;EAEhB,mBAAmB;IAClB;IACA;IACA;IACA,kBAAkB;;EAEnB,mBAAmB;IAClB;IACA;IACA;IACA;IACA;;EAED;IAAkB;IAAiB;;EACnC,cAAc;IACb,IAAI;IACJ,IAAI;IACJ,cAAc;;EAEf,SAAS;EACT;IACC;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,SAAS;EACT,SAAS;EACT,SAAS;EACT,gBAAgB;IACf;IACA,cAAc;IACd;;EAED,SAAS,qBACR;IAAY;IAA6B,aAAa;;EACvD,SAAS;EACT;IAAe;;EACf,cAAc;IACb;IACA;IACA,QAAQ;;EAET,UAAU;IACT;IACA,IAAI;IACJ,IAAI;;EAEL;IAAgB;IAAW;IAAW;;EACtC,oBAAoB;IACnB;IACA;IACA;IACA;IACA,kBAAkB;;EAEnB;IACC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;EAED,QAAQ;IAAuB;;EAC/B,cAAc;IACb,eAAe;IACf;IACA;IACA;IACA;;EAED,QAAQ;IAAW;IAAqB;;EACxC,eAAe;EACf,OAAO,SACN;IACC;IACA,aAAa;IACb;;EAEF;IACC,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;;EAED,gBAAgB;IACf,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;IACA;IACA;;EAED,QAAQ;IACP,MAAM;IACN,MAAM;IACN,aAAa;IACb,cAAc;IACd;IACA,QAAQ;;EAET,MAAM;IAAW;IAAmB;;EACpC,OAAO;EACP;IAAQ;IAAW;;EACnB,SAAS,SACR,aACA;IACC;IACA;IACA;;EAEF;IAAW;IAAgB;;EAC3B,UAAU;EACV,gBAAgB;IACf,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ;IACA;IACA;;EAED,MAAM;IAAW,IAAI;IAAgB,IAAI;IAAgB;;EACzD,QAAQ;IAAY;IAAc,aAAa;;EAC/C,KAAK;EACL;IAAQ,QAAQ;;EAChB;IAAS;IAAc;IAAe;;EACtC,KAAK,SAAS;IAAe;;EAC7B,QAAQ,SAAS;IAAe,MAAM;IAAgB,MAAM;;EAC5D,MAAM;EACN,UAAU;IACT,aAAa;IACb;IACA;IACA;IACA,YAAY;IACZ;;EAED,OAAO;EACP,KAAK,SAAS;EACd,MAAM;IAAe;;;KAEV,0BACV,aAAa,uBAAuB,cAAc,qBAAqB,SACtE,kBAAkB,mBAAmB,WAAW,iBAAiB;;;KAKxD,iBAAiB,wBAC5B,KAAK,4BAA4B;;UC93BjB,qBAAqB;cAEzB,WAAQ;EAAa,WAAW;MAAa;iBAE1C,IACf,MAAM,oBACN,OAAO,4BACP,gBACE;cAMU,aAAI;cACJ,eAAM;;iBAGH,SACZ,UAAU,6BAA6B,0BACxC;kBAqBc;OACJ,UAAU;OACV,oBAAoB,oBAAoB;YACnC;IAChB;;YAEgB;IAChB;;;YAGgB,0BAA0B;KACzC,6BAA6B,eAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx-runtime.js","names":[],"sources":["../src/jsx-runtime.ts"],"sourcesContent":["import type { Children, Component, SpaElement } from \"./core.ts\"\nimport type { HTMLAttributes, NativeElements } from \"./jsx-types.d.ts\"\n\nexport type {\n\tAriaAttributes,\n\tDOMAttributes,\n\tEventAttributes,\n\tEventHandler,\n\tHTMLAttributes,\n\tRef,\n\tSVGAttributes,\n\tTargetedEvent,\n} from \"./jsx-types.d.ts\"\n\n/** Optional integrations augment attributes without changing element identity. */\n// oxlint-disable-next-line typescript/no-empty-interface -- Optional integrations augment this declaration.\nexport interface CapabilityAttributes<Kind extends string = string> {}\n\nexport const Fragment = (props: { children?: Children }): Children =>\n\tprops.children\nexport function jsx(\n\ttype: SpaElement[`type`],\n\tprops: SpaElement[`props`] | null,\n\tkey?: unknown,\n): SpaElement {\n\treturn {\n\t\ttype,\n\t\tprops: key === undefined ? (props ?? {}) : merge(props ?? {}, { key }),\n\t}\n}\nexport const jsxs = jsx\nexport const jsxDEV = jsx\n\n/** Preserve lazy props and spread precedence, including keys added by later updates. */\nexport function merge(\n\t...sources: (Record<string, any> | (() => Record<string, any>))[]\n): Record<string, any> {\n\tconst values = () =>\n\t\tsources.map(\n\t\t\t(source) => (typeof source === `function` ? source() : source) ?? {},\n\t\t)\n\treturn new Proxy(\n\t\t{},\n\t\t{\n\t\t\tget: (_, key) =>\n\t\t\t\tvalues()\n\t\t\t\t\t.reverse()\n\t\t\t\t\t.find((source) => Object.hasOwn(source, key))?.[key],\n\t\t\townKeys: () => [...new Set(values().flatMap(Object.keys))],\n\t\t\tgetOwnPropertyDescriptor: (_, key) =>\n\t\t\t\tvalues().some((source) => Object.hasOwn(source, key))\n\t\t\t\t\t? { enumerable: true, configurable: true }\n\t\t\t\t\t: undefined,\n\t\t},\n\t)\n}\n\nexport namespace JSX {\n\texport type Element = SpaElement\n\texport type ElementType = keyof IntrinsicElements | Component\n\texport interface ElementChildrenAttribute {\n\t\tchildren: {}\n\t}\n\texport interface IntrinsicAttributes {\n\t\tkey?: string | number\n\t}\n\t/** Augment this interface to declare attributes for registered custom elements. */\n\texport interface IntrinsicElements extends NativeElements {\n\t\t[tag: `${string}-${string}`]: HTMLAttributes<HTMLElement>\n\t}\n}\n"],"mappings":";AAkBA,MAAa,YAAY,UACxB,MAAM;AACP,SAAgB,IACf,MACA,OACA,KACa;CACb,OAAO;EACN;EACA,OAAO,QAAQ,KAAA,IAAa,SAAS,CAAC,IAAK,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC;CACtE;AACD;AACA,MAAa,OAAO;AACpB,MAAa,SAAS;;AAGtB,SAAgB,MACf,GAAG,SACmB;CACtB,MAAM,eACL,QAAQ,KACN,YAAY,OAAO,WAAW,aAAa,OAAO,IAAI,WAAW,CAAC,CACpE;CACD,OAAO,IAAI,MACV,CAAC,GACD;EACC,MAAM,GAAG,QACR,OAAO,CAAC,CACN,QAAQ,CAAC,CACT,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,CAAC,GAAG;EAClD,eAAe,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,CAAC,QAAQ,OAAO,IAAI,CAAC,CAAC;EACzD,2BAA2B,GAAG,QAC7B,OAAO,CAAC,CAAC,MAAM,WAAW,OAAO,OAAO,QAAQ,GAAG,CAAC,IACjD;GAAE,YAAY;GAAM,cAAc;EAAK,IACvC,KAAA;CACL,CACD;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-renderer-D0rsFL_-.js","names":[],"sources":["../src/server-renderer.ts"],"sourcesContent":["import type { ReadableToken } from \"atom.io\"\n\nimport { capabilityNamespace, validateCapabilities } from \"./capabilities.ts\"\nimport type { Children, RootOptions, Scope, SpaElement } from \"./core.ts\"\nimport {\n\tcreateRoot,\n\tcreateScope,\n\tdispose,\n\tplain,\n\tuntrack,\n\twithin,\n} from \"./core.ts\"\nimport { Fragment } from \"./jsx-runtime.ts\"\n\nconst escape = (value: unknown): string =>\n\tString(value).replace(\n\t\t/[&<>\"']/g,\n\t\t(char) =>\n\t\t\t({ \"&\": `&amp;`, \"<\": `&lt;`, \">\": `&gt;`, '\"': `&quot;`, \"'\": `&#39;` })[\n\t\t\t\tchar\n\t\t\t]!,\n\t)\nconst voidTags =\n\t/^(area|base|br|col|embed|hr|img|input|link|meta|param|source|track|wbr)$/\nconst booleans = new Set(\n\t`allowfullscreen async autofocus autoplay checked controls credentialless default defer disabled disablepictureinpicture disableremoteplayback formnovalidate inert ismap itemscope loop multiple muted nomodule novalidate open playsinline readonly required reversed selected shadowrootclonable shadowrootdelegatesfocus shadowrootserializable`.split(\n\t\t` `,\n\t),\n)\nfunction stringify(\n\tvalue: Children,\n\towner: Scope,\n\tnamespace = `html`,\n\tselectValue?: string | number,\n): string {\n\tif (typeof value === `function`) {\n\t\tconst values = ([untrack(value)] as unknown[]).flat(Infinity) as Children[]\n\t\tconst keys = new Set<unknown>()\n\t\treturn (\n\t\t\t`<!--{-->` +\n\t\t\tvalues\n\t\t\t\t.map((child, index) => {\n\t\t\t\t\tconst explicit = (child as SpaElement | null)?.props?.[`key`]\n\t\t\t\t\tconst key = explicit == null ? index : String(explicit)\n\t\t\t\t\tif (keys.has(key)) throw new Error(`spa: duplicate key`)\n\t\t\t\t\tkeys.add(key)\n\t\t\t\t\treturn `<!--[-->${within(owner, () => stringify(child, createScope(owner), namespace, selectValue))}<!--]-->`\n\t\t\t\t})\n\t\t\t\t.join(``) +\n\t\t\t`<!--}-->`\n\t\t)\n\t}\n\tif (Array.isArray(value))\n\t\treturn value\n\t\t\t.map((child) => stringify(child, owner, namespace, selectValue))\n\t\t\t.join(``)\n\tif (value == null || typeof value === `boolean`) return ``\n\tif (typeof value !== `object`) return `<!--t-->${escape(value)}`\n\tif (!(`type` in value) || !(`props` in value))\n\t\tthrow new TypeError(`spa: invalid child`)\n\tconst { type, props } = value\n\tif (!type || type === Fragment)\n\t\treturn stringify(() => props[`children`], owner, namespace, selectValue)\n\tif (typeof type === `function`) {\n\t\tconst childOwner = createScope(owner)\n\t\treturn within(childOwner, () =>\n\t\t\tstringify(\n\t\t\t\tuntrack(() => type(props)),\n\t\t\t\tchildOwner,\n\t\t\t\tnamespace,\n\t\t\t\tselectValue,\n\t\t\t),\n\t\t)\n\t}\n\tif (!/^[A-Za-z][\\w.:-]*$/.test(type)) throw new Error(`spa: invalid tag`)\n\tif (type === `astro-slot`)\n\t\treturn `<astro-slot${props[`name`] ? ` name=\"${escape(props[`name`])}\"` : ``}>${props[`innerHTML`] ?? ``}</astro-slot>`\n\tconst ns = type === `svg` ? `svg` : namespace\n\tvalidateCapabilities(owner, props)\n\tlet attrs = ``\n\tlet textValue: string | number | undefined\n\tfor (let key of Object.keys(props)) {\n\t\tif (\n\t\t\tcapabilityNamespace(key) !== undefined ||\n\t\t\tkey === `children` ||\n\t\t\tkey === `ref` ||\n\t\t\tkey === `key` ||\n\t\t\tkey.startsWith(`on`)\n\t\t)\n\t\t\tcontinue\n\t\tif (\n\t\t\t/^(innerHTML|outerHTML|textContent|innerText|dangerouslySetInnerHTML)$/.test(\n\t\t\t\tkey,\n\t\t\t)\n\t\t)\n\t\t\tthrow new Error(`spa: owned content`)\n\t\tlet attribute = props[key]\n\t\tif (ns === `html`) {\n\t\t\tif (key === `defaultValue` && (type === `input` || type === `textarea`)) {\n\t\t\t\tif (props[`value`] != null) continue\n\t\t\t\tkey = `value`\n\t\t\t} else if (key === `defaultChecked` && type === `input`) {\n\t\t\t\tif (props[`checked`] != null) continue\n\t\t\t\tkey = `checked`\n\t\t\t}\n\t\t}\n\t\tif (key === `className`) key = `class`\n\t\tif (key === `htmlFor`) key = `for`\n\t\tif (!/^[^\\s\"'<>/=]+$/.test(key)) throw new Error(`spa: invalid attribute`)\n\t\tif (key === `value` && (type === `select` || type === `textarea`)) {\n\t\t\ttextValue = attribute ?? textValue\n\t\t\tcontinue\n\t\t}\n\t\tif (key === `style` && attribute != null && typeof attribute !== `string`)\n\t\t\tthrow new TypeError(`spa: CSS string required`)\n\t\tconst boolean =\n\t\t\tns === `html` &&\n\t\t\t(booleans.has(key.toLowerCase()) ||\n\t\t\t\t(/^(capture|download|hidden)$/.test(key) &&\n\t\t\t\t\ttypeof attribute === `boolean`))\n\t\tif (attribute == null || (boolean && !attribute)) continue\n\t\tattrs += boolean ? ` ${key}=\"\"` : ` ${key}=\"${escape(attribute)}\"`\n\t}\n\tif (\n\t\ttype === `option` &&\n\t\tselectValue !== undefined &&\n\t\tString(props[`value`]) === String(selectValue)\n\t)\n\t\tattrs += ` selected=\"\"`\n\tif (ns === `html` && voidTags.test(type)) return `<${type}${attrs}>`\n\tif (ns === `html` && /^(textarea|title|style|script)$/.test(type)) {\n\t\tlet text = plain(\n\t\t\ttype === `textarea` ? (textValue ?? props[`children`]) : props[`children`],\n\t\t)\n\t\tif (type === `textarea` && text.startsWith(`\\n`)) text = `\\n${text}`\n\t\tif (/^(script|style)$/.test(type) && new RegExp(`</${type}`, `i`).test(text))\n\t\t\tthrow new Error(`spa: unsafe raw text`)\n\t\treturn `<${type}${attrs}>${/^(script|style)$/.test(type) ? text : escape(text)}</${type}>`\n\t}\n\tconst children = stringify(\n\t\t() => props[`children`],\n\t\towner,\n\t\ttype === `foreignObject` ? `html` : ns,\n\t\ttype === `select` ? textValue : selectValue,\n\t)\n\treturn `<${type}${attrs}>${children}</${type}>`\n}\n\nexport function renderToStringWithReads(\n\tsetup: () => Children,\n\toptions: RootOptions = {},\n\tonRead?: (value: unknown, token: ReadableToken<unknown>) => void,\n): string {\n\tconst root = createRoot(options, true)\n\troot._onRead = onRead\n\tif (/--|[<>]/.test(root._prefix)) throw new Error(`spa: invalid idPrefix`)\n\ttry {\n\t\treturn `<!--w:${root._prefix}-->${within(root, () => stringify(untrack(setup), root))}<!--/w-->`\n\t} finally {\n\t\tdispose(root)\n\t}\n}\n"],"mappings":";;;;AAcA,MAAM,UAAU,UACf,OAAO,KAAK,CAAC,CAAC,QACb,aACC,UACC;CAAE,KAAK;CAAS,KAAK;CAAQ,KAAK;CAAQ,MAAK;CAAU,KAAK;AAAQ,EAAA,CACtE,KAEH;AACD,MAAM,WACL;AACD,MAAM,WAAW,IAAI,IACpB,qVAAqV,MACpV,GACD,CACD;AACA,SAAS,UACR,OACA,OACA,YAA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E,IAAI,OAAO,UAAU,kCAAkC,KAAK,IAAI,GAAG;EAClE,IAAI,OAAO,MACV,SAAS,aAAc,aAAa,MAAM,cAAe,MAAM,WAChE;EACA,IAAI,SAAS,cAAc,KAAK,WAAW,IAAI,GAAG,OAAO,KAAK;EAC9D,IAAI,mBAAmB,KAAK,IAAI,KAAK,IAAI,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,KAAK,IAAI,GAC1E,MAAM,IAAI,MAAM,sBAAsB;EACvC,OAAO,IAAI,OAAO,MAAM,GAAG,mBAAmB,KAAK,IAAI,IAAI,OAAO,OAAO,IAAI,EAAE,IAAI,KAAK;CACzF;CACA,MAAM,WAAW,gBACV,MAAM,aACZ,OACA,SAAS,kBAAkB,SAAS,IACpC,SAAS,WAAW,YAAY,WACjC;CACA,OAAO,IAAI,OAAO,MAAM,GAAG,SAAS,IAAI,KAAK;AAC9C;AAEA,SAAgB,wBACf,OACA,UAAuB,CAAC,GACxB,QACS;CACT,MAAM,OAAO,WAAW,SAAS,IAAI;CACrC,KAAK,UAAU;CACf,IAAI,UAAU,KAAK,KAAK,OAAO,GAAG,MAAM,IAAI,MAAM,uBAAuB;CACzE,IAAI;EACH,OAAO,SAAS,KAAK,QAAQ,KAAK,OAAO,YAAY,UAAU,QAAQ,KAAK,GAAG,IAAI,CAAC,EAAE;CACvF,UAAU;EACT,QAAQ,IAAI;CACb;AACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-Bme1kz2b.js","names":[],"sources":["../src/use-loadable.ts"],"sourcesContent":["import type {\n\tLoadable,\n\tReadableFamilyToken,\n\tReadableToken,\n\tViewOf,\n} from \"atom.io\"\nimport type { Canonical } from \"atom.io/foundations/canonical\"\nimport { withdraw } from \"atom.io/internal\"\n\nimport { type Accessor, owner, resolveStateToken, useGetter } from \"./core.ts\"\n\nexport type LoadableValue<T> = { loading: boolean; value: T }\n\nexport function useLoadable<T, E>(\n\ttoken: ReadableToken<Loadable<T>, any, E>,\n): Accessor<`LOADING` | LoadableValue<ViewOf<T | E>>>\nexport function useLoadable<T, K extends Canonical, E>(\n\ttoken: ReadableFamilyToken<Loadable<T>, K, E>,\n\tkey: NoInfer<K>,\n): Accessor<`LOADING` | LoadableValue<ViewOf<T | E>>>\nexport function useLoadable<T, E>(\n\ttoken: ReadableToken<Loadable<T>, any, E>,\n\tfallback: NoInfer<T>,\n): Accessor<LoadableValue<ViewOf<T>> & { error?: E }>\nexport function useLoadable<T, K extends Canonical, E>(\n\ttoken: ReadableFamilyToken<Loadable<T>, K, E>,\n\tkey: NoInfer<K>,\n\tfallback: NoInfer<T>,\n): Accessor<LoadableValue<ViewOf<T>> & { error?: E }>\nexport function useLoadable(\n\t...params:\n\t\t| [ReadableToken<any, any, any>]\n\t\t| [ReadableToken<any, any, any>, unknown]\n\t\t| [ReadableFamilyToken<any, Canonical, any>, Canonical]\n\t\t| [ReadableFamilyToken<any, Canonical, any>, Canonical, unknown]\n): Accessor<`LOADING` | (LoadableValue<unknown> & { error?: unknown })> {\n\tconst store = owner!._root._store\n\tconst [token] = params\n\tconst family = token.type.endsWith(`_family`)\n\tconst selected = resolveStateToken(token, params[1] as Canonical)\n\tconst getValue = useGetter(selected)\n\tconst fallbackIndex = family ? 2 : 1\n\tconst fallback = params[fallbackIndex]\n\tconst hasFallback = params.length > fallbackIndex\n\tlet available = hasFallback\n\tlet previous = fallback\n\tlet error: unknown\n\treturn () => {\n\t\tconst value = getValue()\n\t\tconst loading = value instanceof Promise\n\t\tif (!loading) {\n\t\t\tprevious = value\n\t\t\tavailable = true\n\t\t\tconst state = withdraw(store, selected)\n\t\t\terror =\n\t\t\t\thasFallback &&\n\t\t\t\t`catch` in state &&\n\t\t\t\tstate.catch.some((ErrorType) => value instanceof ErrorType)\n\t\t\t\t\t? value\n\t\t\t\t\t: undefined\n\t\t}\n\t\tif (!available) return `LOADING`\n\t\treturn error\n\t\t\t? { loading, value: fallback, error }\n\t\t\t: { loading, value: previous }\n\t}\n}\n"],"mappings":";;;AA6BA,SAAgB,YACf,GAAG,QAKoE;CACvE,MAAM,QAAQ,MAAO,MAAM;CAC3B,MAAM,CAAC,SAAS;CAChB,MAAM,SAAS,MAAM,KAAK,SAAS,SAAS;CAC5C,MAAM,WAAW,kBAAkB,OAAO,OAAO,EAAe;CAChE,MAAM,WAAW,UAAU,QAAQ;CACnC,MAAM,gBAAgB,SAAS,IAAI;CACnC,MAAM,WAAW,OAAO;CACxB,MAAM,cAAc,OAAO,SAAS;CACpC,IAAI,YAAY;CAChB,IAAI,WAAW;CACf,IAAI;CACJ,aAAa;EACZ,MAAM,QAAQ,SAAS;EACvB,MAAM,UAAU,iBAAiB;EACjC,IAAI,CAAC,SAAS;GACb,WAAW;GACX,YAAY;GACZ,MAAM,QAAQ,SAAS,OAAO,QAAQ;GACtC,QACC,eACA,WAAW,SACX,MAAM,MAAM,MAAM,cAAc,iBAAiB,SAAS,IACvD,QACA,KAAA;EACL;EACA,IAAI,CAAC,WAAW,OAAO;EACvB,OAAO,QACJ;GAAE;GAAS,OAAO;GAAU;EAAM,IAClC;GAAE;GAAS,OAAO;EAAS;CAC/B;AACD"}
@@ -1,265 +0,0 @@
1
- import { decode } from "html-entities";
2
- import MagicString from "magic-string";
3
- import { parseSync, visitorKeys } from "oxc-parser";
4
- // src/compiler.ts
5
- const decodeJsx = (value) => decode(value, {
6
- level: `html4`,
7
- scope: `strict`
8
- });
9
- /** Match JSX's multiline whitespace rules without reprinting JavaScript. */
10
- function text(value) {
11
- const lines = value.split(/\r\n|\n|\r/);
12
- let last = 0;
13
- for (let i = 0; i < lines.length; i++) if (/[^ \t]/.test(lines[i])) last = i;
14
- return lines.map((line, i) => {
15
- line = line.replace(/\t/g, ` `);
16
- if (i > 0) line = line.replace(/^ +/, ``);
17
- if (i < lines.length - 1) line = line.replace(/ +$/, ``);
18
- return line && i < last ? `${line} ` : line;
19
- }).join(``);
20
- }
21
- function eager(node, allowJsx = false) {
22
- if (node.type === `ParenthesizedExpression`) return eager(node.expression, allowJsx);
23
- return node.type === `Literal` || node.type === `FunctionExpression` || node.type === `ArrowFunctionExpression` || allowJsx && (node.type === `JSXElement` || node.type === `JSXFragment`) || node.type === `TemplateLiteral` && node.expressions.length === 0;
24
- }
25
- function compile(code, filename) {
26
- const parsed = parseSync(filename, code, {
27
- lang: `tsx`,
28
- preserveParens: true
29
- });
30
- if (parsed.errors.length) {
31
- const error = parsed.errors[0];
32
- throw new SyntaxError([`${filename}: ${error.message}`, error.codeframe].filter(Boolean).join(`\n`));
33
- }
34
- const output = new MagicString(code);
35
- const parents = /* @__PURE__ */ new WeakMap();
36
- const identifiers = /* @__PURE__ */ new Set();
37
- const elements = [];
38
- const functions = /* @__PURE__ */ new Set();
39
- function walk(node, parent, outerFunction) {
40
- if (parent) parents.set(node, parent);
41
- output.addSourcemapLocation(node.start);
42
- output.addSourcemapLocation(node.end);
43
- if (node.type === `Identifier` || node.type === `JSXIdentifier`) identifiers.add(node.name);
44
- if (!outerFunction && (node.type === `FunctionDeclaration` || node.type === `FunctionExpression` || node.type === `ArrowFunctionExpression`)) outerFunction = node;
45
- if (node.type === `JSXElement` || node.type === `JSXFragment`) {
46
- elements.push(node);
47
- if (outerFunction) functions.add(outerFunction);
48
- }
49
- for (const key of visitorKeys[node.type]) {
50
- const value = node[key];
51
- if (Array.isArray(value)) {
52
- for (const child of value) if (child) walk(child, node, outerFunction);
53
- } else if (value) walk(value, node, outerFunction);
54
- }
55
- }
56
- walk(parsed.program);
57
- function uid(base) {
58
- let name = `_${base}`;
59
- let suffix = 1;
60
- while (identifiers.has(name)) name = `_${base}${++suffix}`;
61
- identifiers.add(name);
62
- return name;
63
- }
64
- const create = uid(`spa`);
65
- const merge = uid(`props`);
66
- const join = (parts, separator) => parts.flatMap((part, i) => i ? [separator, ...part] : part);
67
- const expression = (node) => eager(node, true) ? [
68
- `(`,
69
- node,
70
- `)`
71
- ] : [
72
- `() => (`,
73
- node,
74
- `)`
75
- ];
76
- function tag(node) {
77
- if (node.type === `JSXNamespacedName`) return JSON.stringify(`${node.namespace.name}:${node.name.name}`);
78
- if (node.type === `JSXMemberExpression`) return code.slice(node.start, node.end);
79
- return /^[a-z]/.test(node.name) || node.name.includes(`-`) ? JSON.stringify(node.name) : node.name;
80
- }
81
- /** Rewrite syntax around untouched expression spans, including nested JSX. */
82
- function rewrite(node, parts) {
83
- let cursor = node.start;
84
- let replacement = ``;
85
- for (const part of parts) {
86
- if (typeof part === `string`) {
87
- replacement += part;
88
- continue;
89
- }
90
- if (cursor < part.start) output.update(cursor, part.start, replacement);
91
- else output.appendLeft(cursor, replacement);
92
- cursor = part.end;
93
- replacement = ``;
94
- }
95
- output.update(cursor, node.end, replacement);
96
- }
97
- for (const node of elements) {
98
- const chunks = [];
99
- let properties = [];
100
- const flush = () => {
101
- if (properties.length) chunks.push([
102
- `{`,
103
- ...join(properties, `, `),
104
- `}`
105
- ]);
106
- properties = [];
107
- };
108
- if (node.type === `JSXElement`) for (const attribute of node.openingElement.attributes) {
109
- if (attribute.type === `JSXSpreadAttribute`) {
110
- flush();
111
- chunks.push([
112
- `() => (`,
113
- attribute.argument,
114
- `)`
115
- ]);
116
- continue;
117
- }
118
- const key = JSON.stringify(attribute.name.type === `JSXNamespacedName` ? `${attribute.name.namespace.name}:${attribute.name.name.name}` : attribute.name.name);
119
- const value = attribute.value;
120
- if (!value) properties.push([`${key}: true`]);
121
- else if (value.type === `Literal`) properties.push([`${key}: ${JSON.stringify(decodeJsx(value.value))}`]);
122
- else {
123
- const expr = value.type === `JSXExpressionContainer` ? value.expression : value;
124
- properties.push(key === `"key"` || eager(expr) ? [
125
- `${key}: (`,
126
- expr,
127
- `)`
128
- ] : [
129
- `get ${key}(){ return (`,
130
- expr,
131
- `); }`
132
- ]);
133
- }
134
- }
135
- const component = node.type === `JSXElement` && !tag(node.openingElement.name).startsWith(`"`);
136
- const children = [];
137
- let lazyChildren = false;
138
- for (const child of node.children) if (child.type === `JSXText`) {
139
- const value = text(decodeJsx(child.value));
140
- if (value) children.push([JSON.stringify(value)]);
141
- } else if (child.type === `JSXElement` || child.type === `JSXFragment`) children.push([child]);
142
- else if (child.type === `JSXExpressionContainer`) {
143
- if (child.expression.type !== `JSXEmptyExpression`) {
144
- if (component) {
145
- children.push([
146
- `(`,
147
- child.expression,
148
- `)`
149
- ]);
150
- if (!eager(child.expression, true)) lazyChildren = true;
151
- } else children.push(expression(child.expression));
152
- }
153
- } else throw new SyntaxError(`${filename}: JSX spread children are unsupported`);
154
- if (children.length) {
155
- const value = children.length === 1 ? children[0] : [
156
- `[`,
157
- ...join(children, `, `),
158
- `]`
159
- ];
160
- if (lazyChildren) {
161
- const read = uid(`children`);
162
- properties.push([`get children(){ return ${read}(); }`]);
163
- chunks.push([
164
- `((${read}) => ({`,
165
- ...join(properties, `, `),
166
- `}))(() => (`,
167
- ...value,
168
- `))`
169
- ]);
170
- properties = [];
171
- } else properties.push([`children: `, ...value]);
172
- }
173
- flush();
174
- const props = node.type === `JSXElement` && node.openingElement.attributes.some((attr) => attr.type === `JSXSpreadAttribute`) ? [
175
- `${merge}(`,
176
- ...join(chunks, `, `),
177
- `)`
178
- ] : chunks[0] ?? [`{}`];
179
- rewrite(node, [
180
- `${create}(${node.type === `JSXElement` ? tag(node.openingElement.name) : `null`}, `,
181
- ...props,
182
- `)`
183
- ]);
184
- }
185
- const components = /* @__PURE__ */ new Set();
186
- for (const fn of functions) {
187
- let node = fn;
188
- let parent = parents.get(node);
189
- while (parent?.type === `ParenthesizedExpression`) {
190
- node = parent;
191
- parent = parents.get(node);
192
- }
193
- if (fn.type === `FunctionDeclaration` && fn.id) components.add(fn.id.name);
194
- else if (parent?.type === `VariableDeclarator` && parent.id.type === `Identifier`) components.add(parent.id.name);
195
- else if (parent?.type === `ExportDefaultDeclaration`) {
196
- const name = uid(`Component`);
197
- if (fn.type === `FunctionDeclaration`) {
198
- const token = [...code.slice(fn.start, fn.body.start).matchAll(/\/\*[\s\S]*?\*\/|\/\/[^\r\n]*|\bfunction\b|\*/g)].find((match) => match[0] === (fn.generator ? `*` : `function`));
199
- output.appendLeft(fn.start + token.index + token[0].length, ` ${name}`);
200
- } else {
201
- const prefix = code.slice(parent.start, node.start);
202
- for (const token of prefix.matchAll(/\/\*[\s\S]*?\*\/|\/\/[^\r\n]*|\b(?:export|default)\b/g)) {
203
- if (token[0] !== `export` && token[0] !== `default`) continue;
204
- output.update(parent.start + token.index, parent.start + token.index + token[0].length, token[0] === `export` ? `const ${name} =` : ``);
205
- }
206
- output.appendLeft(parent.end, `;\nexport default ${name};`);
207
- }
208
- components.add(name);
209
- }
210
- }
211
- if (elements.length) {
212
- let position = parsed.program.hashbang?.end ?? 0;
213
- for (const statement of parsed.program.body) {
214
- if (statement.type !== `ExpressionStatement` || !statement.directive) break;
215
- position = statement.end;
216
- }
217
- output.appendLeft(position, `\nimport { jsx as ${create}, merge as ${merge} } from "@atom.io/spa/jsx-runtime";\n`);
218
- for (const component of components) output.append(`\n;${component}.spa = true;`);
219
- }
220
- return {
221
- code: output.toString(),
222
- map: output.generateMap({
223
- source: filename,
224
- includeContent: true,
225
- hires: true
226
- })
227
- };
228
- }
229
- // src/vite.ts
230
- function spa(options = {}) {
231
- const include = options.include ?? /\.[jt]sx$/;
232
- const matches = (id) => {
233
- include.lastIndex = 0;
234
- return !id.includes(`/node_modules/`) && include.test(id.split(`?`)[0]);
235
- };
236
- return {
237
- name: `spa`,
238
- enforce: `pre`,
239
- config() {
240
- return {
241
- resolve: { dedupe: [`@atom.io/spa`, `atom.io`] },
242
- optimizeDeps: { exclude: [`@atom.io/spa`, `atom.io`] }
243
- };
244
- },
245
- configEnvironment: {
246
- order: `post`,
247
- handler(_name, config) {
248
- if (config.optimizeDeps?.include) config.optimizeDeps.include = config.optimizeDeps.include.filter((id) => !/^(@atom\.io\/spa|atom\.io)(\/|$)/.test(id));
249
- }
250
- },
251
- transform(code, id) {
252
- if (!matches(id)) return;
253
- return compile(code, id);
254
- },
255
- handleHotUpdate({ server, file }) {
256
- if (matches(file)) {
257
- server.ws.send({ type: `full-reload` });
258
- return [];
259
- }
260
- }
261
- };
262
- }
263
- export { spa as t };
264
-
265
- //# sourceMappingURL=vite-Bmyb6P5w.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-Bmyb6P5w.js","names":[],"sources":["../src/compiler.ts","../src/vite.ts"],"sourcesContent":["import { decode } from \"html-entities\"\nimport type { SourceMap } from \"magic-string\"\nimport MagicString from \"magic-string\"\nimport type {\n\tExpression,\n\tJSXElement,\n\tJSXElementName,\n\tJSXFragment,\n\tNode,\n} from \"oxc-parser\"\nimport { parseSync, visitorKeys } from \"oxc-parser\"\n\ntype Part = string | Node\n\nconst decodeJsx = (value: string): string =>\n\tdecode(value, { level: `html4`, scope: `strict` })\n\n/** Match JSX's multiline whitespace rules without reprinting JavaScript. */\nfunction text(value: string): string {\n\tconst lines = value.split(/\\r\\n|\\n|\\r/)\n\tlet last = 0\n\tfor (let i = 0; i < lines.length; i++) if (/[^ \\t]/.test(lines[i])) last = i\n\treturn lines\n\t\t.map((line, i) => {\n\t\t\tline = line.replace(/\\t/g, ` `)\n\t\t\tif (i > 0) line = line.replace(/^ +/, ``)\n\t\t\tif (i < lines.length - 1) line = line.replace(/ +$/, ``)\n\t\t\treturn line && i < last ? `${line} ` : line\n\t\t})\n\t\t.join(``)\n}\n\nfunction eager(node: Node, allowJsx = false): boolean {\n\tif (node.type === `ParenthesizedExpression`)\n\t\treturn eager(node.expression, allowJsx)\n\treturn (\n\t\tnode.type === `Literal` ||\n\t\tnode.type === `FunctionExpression` ||\n\t\tnode.type === `ArrowFunctionExpression` ||\n\t\t(allowJsx && (node.type === `JSXElement` || node.type === `JSXFragment`)) ||\n\t\t(node.type === `TemplateLiteral` && node.expressions.length === 0)\n\t)\n}\n\nexport function compile(\n\tcode: string,\n\tfilename: string,\n): { code: string; map: SourceMap } {\n\tconst parsed = parseSync(filename, code, {\n\t\tlang: `tsx`,\n\t\tpreserveParens: true,\n\t})\n\tif (parsed.errors.length) {\n\t\tconst error = parsed.errors[0]\n\t\tthrow new SyntaxError(\n\t\t\t[`${filename}: ${error.message}`, error.codeframe]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(`\\n`),\n\t\t)\n\t}\n\tconst output = new MagicString(code)\n\tconst parents = new WeakMap<Node, Node>()\n\tconst identifiers = new Set<string>()\n\tconst elements: (JSXElement | JSXFragment)[] = []\n\tconst functions = new Set<Node>()\n\tfunction walk(node: Node, parent?: Node, outerFunction?: Node): void {\n\t\tif (parent) parents.set(node, parent)\n\t\toutput.addSourcemapLocation(node.start)\n\t\toutput.addSourcemapLocation(node.end)\n\t\tif (node.type === `Identifier` || node.type === `JSXIdentifier`)\n\t\t\tidentifiers.add(node.name)\n\t\tif (\n\t\t\t!outerFunction &&\n\t\t\t(node.type === `FunctionDeclaration` ||\n\t\t\t\tnode.type === `FunctionExpression` ||\n\t\t\t\tnode.type === `ArrowFunctionExpression`)\n\t\t)\n\t\t\touterFunction = node\n\t\tif (node.type === `JSXElement` || node.type === `JSXFragment`) {\n\t\t\telements.push(node)\n\t\t\tif (outerFunction) functions.add(outerFunction)\n\t\t}\n\t\tfor (const key of visitorKeys[node.type]) {\n\t\t\tconst value = (node as unknown as Record<string, unknown>)[key]\n\t\t\tif (Array.isArray(value)) {\n\t\t\t\tfor (const child of value) if (child) walk(child, node, outerFunction)\n\t\t\t} else if (value) walk(value as Node, node, outerFunction)\n\t\t}\n\t}\n\twalk(parsed.program)\n\tfunction uid(base: string): string {\n\t\tlet name = `_${base}`\n\t\tlet suffix = 1\n\t\twhile (identifiers.has(name)) name = `_${base}${++suffix}`\n\t\tidentifiers.add(name)\n\t\treturn name\n\t}\n\tconst create = uid(`spa`)\n\tconst merge = uid(`props`)\n\tconst join = (parts: Part[][], separator: string): Part[] =>\n\t\tparts.flatMap((part, i) => (i ? [separator, ...part] : part))\n\tconst expression = (node: Expression): Part[] =>\n\t\teager(node, true) ? [`(`, node, `)`] : [`() => (`, node, `)`]\n\tfunction tag(node: JSXElementName): string {\n\t\tif (node.type === `JSXNamespacedName`)\n\t\t\treturn JSON.stringify(`${node.namespace.name}:${node.name.name}`)\n\t\tif (node.type === `JSXMemberExpression`)\n\t\t\treturn code.slice(node.start, node.end)\n\t\treturn /^[a-z]/.test(node.name) || node.name.includes(`-`)\n\t\t\t? JSON.stringify(node.name)\n\t\t\t: node.name\n\t}\n\t/** Rewrite syntax around untouched expression spans, including nested JSX. */\n\tfunction rewrite(node: JSXElement | JSXFragment, parts: Part[]): void {\n\t\tlet cursor = node.start\n\t\tlet replacement = ``\n\t\tfor (const part of parts) {\n\t\t\tif (typeof part === `string`) {\n\t\t\t\treplacement += part\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (cursor < part.start) output.update(cursor, part.start, replacement)\n\t\t\telse output.appendLeft(cursor, replacement)\n\t\t\tcursor = part.end\n\t\t\treplacement = ``\n\t\t}\n\t\t// Every JSX node ends with closing syntax after its last expression span.\n\t\toutput.update(cursor, node.end, replacement)\n\t}\n\tfor (const node of elements) {\n\t\tconst chunks: Part[][] = []\n\t\tlet properties: Part[][] = []\n\t\tconst flush = () => {\n\t\t\tif (properties.length) chunks.push([`{`, ...join(properties, `, `), `}`])\n\t\t\tproperties = []\n\t\t}\n\t\tif (node.type === `JSXElement`) {\n\t\t\tfor (const attribute of node.openingElement.attributes) {\n\t\t\t\tif (attribute.type === `JSXSpreadAttribute`) {\n\t\t\t\t\tflush()\n\t\t\t\t\tchunks.push([`() => (`, attribute.argument, `)`])\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst key = JSON.stringify(\n\t\t\t\t\tattribute.name.type === `JSXNamespacedName`\n\t\t\t\t\t\t? `${attribute.name.namespace.name}:${attribute.name.name.name}`\n\t\t\t\t\t\t: attribute.name.name,\n\t\t\t\t)\n\t\t\t\tconst value = attribute.value\n\t\t\t\tif (!value) properties.push([`${key}: true`])\n\t\t\t\telse if (value.type === `Literal`)\n\t\t\t\t\tproperties.push([`${key}: ${JSON.stringify(decodeJsx(value.value))}`])\n\t\t\t\telse {\n\t\t\t\t\tconst expr =\n\t\t\t\t\t\tvalue.type === `JSXExpressionContainer` ? value.expression : value\n\t\t\t\t\tproperties.push(\n\t\t\t\t\t\tkey === `\"key\"` || eager(expr)\n\t\t\t\t\t\t\t? [`${key}: (`, expr, `)`]\n\t\t\t\t\t\t\t: [`get ${key}(){ return (`, expr, `); }`],\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst component =\n\t\t\tnode.type === `JSXElement` &&\n\t\t\t!tag(node.openingElement.name).startsWith(`\"`)\n\t\tconst children: Part[][] = []\n\t\tlet lazyChildren = false\n\t\tfor (const child of node.children) {\n\t\t\tif (child.type === `JSXText`) {\n\t\t\t\tconst value = text(decodeJsx(child.value))\n\t\t\t\tif (value) children.push([JSON.stringify(value)])\n\t\t\t} else if (child.type === `JSXElement` || child.type === `JSXFragment`)\n\t\t\t\tchildren.push([child])\n\t\t\telse if (child.type === `JSXExpressionContainer`) {\n\t\t\t\tif (child.expression.type !== `JSXEmptyExpression`) {\n\t\t\t\t\tif (component) {\n\t\t\t\t\t\t// Component props expose their declared values, including callbacks.\n\t\t\t\t\t\tchildren.push([`(`, child.expression, `)`])\n\t\t\t\t\t\tif (!eager(child.expression, true)) lazyChildren = true\n\t\t\t\t\t} else children.push(expression(child.expression))\n\t\t\t\t}\n\t\t\t} else\n\t\t\t\tthrow new SyntaxError(`${filename}: JSX spread children are unsupported`)\n\t\t}\n\t\tif (children.length) {\n\t\t\tconst value =\n\t\t\t\tchildren.length === 1 ? children[0] : [`[`, ...join(children, `, `), `]`]\n\t\t\tif (lazyChildren) {\n\t\t\t\t// Capture the computation outside the getter's method scope.\n\t\t\t\tconst read = uid(`children`)\n\t\t\t\tproperties.push([`get children(){ return ${read}(); }`])\n\t\t\t\tchunks.push([\n\t\t\t\t\t`((${read}) => ({`,\n\t\t\t\t\t...join(properties, `, `),\n\t\t\t\t\t`}))(() => (`,\n\t\t\t\t\t...value,\n\t\t\t\t\t`))`,\n\t\t\t\t])\n\t\t\t\tproperties = []\n\t\t\t} else properties.push([`children: `, ...value])\n\t\t}\n\t\tflush()\n\t\tconst spreads =\n\t\t\tnode.type === `JSXElement` &&\n\t\t\tnode.openingElement.attributes.some(\n\t\t\t\t(attr) => attr.type === `JSXSpreadAttribute`,\n\t\t\t)\n\t\tconst props = spreads\n\t\t\t? [`${merge}(`, ...join(chunks, `, `), `)`]\n\t\t\t: (chunks[0] ?? [`{}`])\n\t\trewrite(node, [\n\t\t\t`${create}(${node.type === `JSXElement` ? tag(node.openingElement.name) : `null`}, `,\n\t\t\t...props,\n\t\t\t`)`,\n\t\t])\n\t}\n\tconst components = new Set<string>()\n\tfor (const fn of functions) {\n\t\tlet node = fn\n\t\tlet parent = parents.get(node)\n\t\twhile (parent?.type === `ParenthesizedExpression`) {\n\t\t\tnode = parent\n\t\t\tparent = parents.get(node)\n\t\t}\n\t\tif (fn.type === `FunctionDeclaration` && fn.id) components.add(fn.id.name)\n\t\telse if (\n\t\t\tparent?.type === `VariableDeclarator` &&\n\t\t\tparent.id.type === `Identifier`\n\t\t)\n\t\t\tcomponents.add(parent.id.name)\n\t\telse if (parent?.type === `ExportDefaultDeclaration`) {\n\t\t\tconst name = uid(`Component`)\n\t\t\tif (fn.type === `FunctionDeclaration`) {\n\t\t\t\t// Keep anonymous default function declarations hoisted.\n\t\t\t\tconst token = [\n\t\t\t\t\t...code\n\t\t\t\t\t\t.slice(fn.start, fn.body!.start)\n\t\t\t\t\t\t.matchAll(/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*|\\bfunction\\b|\\*/g),\n\t\t\t\t].find((match) => match[0] === (fn.generator ? `*` : `function`))!\n\t\t\t\toutput.appendLeft(fn.start + token.index + token[0].length, ` ${name}`)\n\t\t\t} else {\n\t\t\t\t// Replace only keywords so intervening comments and annotations survive.\n\t\t\t\tconst prefix = code.slice(parent.start, node.start)\n\t\t\t\tfor (const token of prefix.matchAll(\n\t\t\t\t\t/\\/\\*[\\s\\S]*?\\*\\/|\\/\\/[^\\r\\n]*|\\b(?:export|default)\\b/g,\n\t\t\t\t)) {\n\t\t\t\t\tif (token[0] !== `export` && token[0] !== `default`) continue\n\t\t\t\t\toutput.update(\n\t\t\t\t\t\tparent.start + token.index,\n\t\t\t\t\t\tparent.start + token.index + token[0].length,\n\t\t\t\t\t\ttoken[0] === `export` ? `const ${name} =` : ``,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\toutput.appendLeft(parent.end, `;\\nexport default ${name};`)\n\t\t\t}\n\t\t\tcomponents.add(name)\n\t\t}\n\t}\n\tif (elements.length) {\n\t\t// Keep hashbangs and directive prologues ahead of generated imports.\n\t\tlet position = parsed.program.hashbang?.end ?? 0\n\t\tfor (const statement of parsed.program.body) {\n\t\t\tif (statement.type !== `ExpressionStatement` || !statement.directive) break\n\t\t\tposition = statement.end\n\t\t}\n\t\toutput.appendLeft(\n\t\t\tposition,\n\t\t\t`\\nimport { jsx as ${create}, merge as ${merge} } from \"@atom.io/spa/jsx-runtime\";\\n`,\n\t\t)\n\t\tfor (const component of components)\n\t\t\toutput.append(`\\n;${component}.spa = true;`)\n\t}\n\treturn {\n\t\tcode: output.toString(),\n\t\tmap: output.generateMap({\n\t\t\tsource: filename,\n\t\t\tincludeContent: true,\n\t\t\thires: true,\n\t\t}),\n\t}\n}\n","import type { Plugin } from \"vite\"\n\nimport { compile } from \"./compiler.ts\"\n\nexport interface SpaPluginOptions {\n\tinclude?: RegExp\n}\nexport default function spa(options: SpaPluginOptions = {}): Plugin {\n\tconst include = options.include ?? /\\.[jt]sx$/\n\tconst matches = (id: string): boolean => {\n\t\tinclude.lastIndex = 0\n\t\treturn !id.includes(`/node_modules/`) && include.test(id.split(`?`)[0])\n\t}\n\treturn {\n\t\tname: `spa`,\n\t\tenforce: `pre`,\n\t\tconfig() {\n\t\t\treturn {\n\t\t\t\tresolve: { dedupe: [`@atom.io/spa`, `atom.io`] },\n\t\t\t\toptimizeDeps: { exclude: [`@atom.io/spa`, `atom.io`] },\n\t\t\t}\n\t\t},\n\t\tconfigEnvironment: {\n\t\t\torder: `post`,\n\t\t\thandler(_name, config) {\n\t\t\t\t// Astro and its adapters force renderer entries into the optimizer.\n\t\t\t\t// Vite processes explicit includes even when their package is excluded.\n\t\t\t\t// Keep the renderer, hooks, and store in one unbundled module graph.\n\t\t\t\tif (config.optimizeDeps?.include) {\n\t\t\t\t\tconfig.optimizeDeps.include = config.optimizeDeps.include.filter(\n\t\t\t\t\t\t(id) => !/^(@atom\\.io\\/spa|atom\\.io)(\\/|$)/.test(id),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\ttransform(code, id) {\n\t\t\tif (!matches(id)) return\n\t\t\treturn compile(code, id)\n\t\t},\n\t\t// A reload disposes the whole document. No state-preserving HMR is promised.\n\t\thandleHotUpdate({ server, file }) {\n\t\t\tif (matches(file)) {\n\t\t\t\tserver.ws.send({ type: `full-reload` })\n\t\t\t\treturn []\n\t\t\t}\n\t\t},\n\t}\n}\n"],"mappings":";;;;AAcA,MAAM,aAAa,UAClB,OAAO,OAAO;CAAE,OAAO;CAAS,OAAO;AAAS,CAAC;;AAGlD,SAAS,KAAK,OAAuB;CACpC,MAAM,QAAQ,MAAM,MAAM,YAAY;CACtC,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK,IAAI,SAAS,KAAK,MAAM,EAAE,GAAG,OAAO;CAC3E,OAAO,MACL,KAAK,MAAM,MAAM;EACjB,OAAO,KAAK,QAAQ,OAAO,GAAG;EAC9B,IAAI,IAAI,GAAG,OAAO,KAAK,QAAQ,OAAO,EAAE;EACxC,IAAI,IAAI,MAAM,SAAS,GAAG,OAAO,KAAK,QAAQ,OAAO,EAAE;EACvD,OAAO,QAAQ,IAAI,OAAO,GAAG,KAAK,KAAK;CACxC,CAAC,CAAC,CACD,KAAK,EAAE;AACV;AAEA,SAAS,M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