what-core 0.6.2 → 0.7.0

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.
@@ -1,8 +1,21 @@
1
1
  // packages/core/src/h.js
2
2
  var EMPTY_OBJ = /* @__PURE__ */ Object.create(null);
3
- function h(tag, props, ...children) {
3
+ var EMPTY_ARR = [];
4
+ function h(tag, props) {
4
5
  props = props || EMPTY_OBJ;
5
- const flat = flattenChildren(children);
6
+ const argLen = arguments.length;
7
+ let flat;
8
+ if (argLen <= 2) {
9
+ flat = EMPTY_ARR;
10
+ } else if (argLen === 3) {
11
+ flat = _flattenSingle(arguments[2]);
12
+ } else {
13
+ const out = [];
14
+ for (let i = 2; i < argLen; i++) {
15
+ _flattenInto(arguments[i], out);
16
+ }
17
+ flat = out;
18
+ }
6
19
  const key = props.key ?? null;
7
20
  if (props.key !== void 0) {
8
21
  props = { ...props };
@@ -13,22 +26,30 @@ function h(tag, props, ...children) {
13
26
  function Fragment({ children }) {
14
27
  return children;
15
28
  }
16
- function flattenChildren(children) {
17
- const out = [];
18
- for (let i = 0; i < children.length; i++) {
19
- const child = children[i];
20
- if (child == null || child === false || child === true) continue;
21
- if (Array.isArray(child)) {
22
- out.push(...flattenChildren(child));
23
- } else if (typeof child === "object" && child._vnode) {
24
- out.push(child);
25
- } else if (typeof child === "function") {
26
- out.push(child);
27
- } else {
28
- out.push(String(child));
29
+ function _flattenSingle(child) {
30
+ if (child == null || child === false || child === true) return EMPTY_ARR;
31
+ if (Array.isArray(child)) {
32
+ const out = [];
33
+ _flattenInto(child, out);
34
+ return out;
35
+ }
36
+ if (typeof child === "object" && child._vnode) return [child];
37
+ if (typeof child === "function") return [child];
38
+ return [String(child)];
39
+ }
40
+ function _flattenInto(child, out) {
41
+ if (child == null || child === false || child === true) return;
42
+ if (Array.isArray(child)) {
43
+ for (let i = 0; i < child.length; i++) {
44
+ _flattenInto(child[i], out);
29
45
  }
46
+ } else if (typeof child === "object" && child._vnode) {
47
+ out.push(child);
48
+ } else if (typeof child === "function") {
49
+ out.push(child);
50
+ } else {
51
+ out.push(String(child));
30
52
  }
31
- return out;
32
53
  }
33
54
 
34
55
  // packages/core/src/jsx-dev-runtime.js
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/h.js", "../src/jsx-dev-runtime.js"],
4
- "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props, ...children) {\n props = props || EMPTY_OBJ;\n const flat = flattenChildren(children);\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\nfunction flattenChildren(children) {\n const out = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child == null || child === false || child === true) continue;\n if (Array.isArray(child)) {\n out.push(...flattenChildren(child));\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n // Reactive child \u2014 preserve function for fine-grained DOM updates\n out.push(child);\n } else {\n // Text node\n out.push(String(child));\n }\n }\n return out;\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Dev Runtime\n// Same as jsx-runtime but used in development mode by Vite.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\nexport function jsxDEV(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// Also export jsx/jsxs for compatibility \u2014 some bundlers use these even in dev\nexport const jsx = jsxDEV;\nexport const jsxs = jsxDEV;\n"],
5
- "mappings": ";AAOA,IAAM,YAAY,uBAAO,OAAO,IAAI;AAG7B,SAAS,EAAE,KAAK,UAAU,UAAU;AACzC,UAAQ,SAAS;AACjB,QAAM,OAAO,gBAAgB,QAAQ;AACrC,QAAM,MAAM,MAAM,OAAO;AAGzB,MAAI,MAAM,QAAQ,QAAW;AAC3B,YAAQ,EAAE,GAAG,MAAM;AACnB,WAAO,MAAM;AAAA,EACf;AAEA,SAAO,EAAE,KAAK,OAAO,UAAU,MAAM,KAAK,QAAQ,KAAK;AACzD;AAGO,SAAS,SAAS,EAAE,SAAS,GAAG;AACrC,SAAO;AACT;AAEA,SAAS,gBAAgB,UAAU;AACjC,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,UAAM,QAAQ,SAAS,CAAC;AACxB,QAAI,SAAS,QAAQ,UAAU,SAAS,UAAU,KAAM;AACxD,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAI,KAAK,GAAG,gBAAgB,KAAK,CAAC;AAAA,IACpC,WAAW,OAAO,UAAU,YAAY,MAAM,QAAQ;AACpD,UAAI,KAAK,KAAK;AAAA,IAChB,WAAW,OAAO,UAAU,YAAY;AAEtC,UAAI,KAAK,KAAK;AAAA,IAChB,OAAO;AAEL,UAAI,KAAK,OAAO,KAAK,CAAC;AAAA,IACxB;AAAA,EACF;AACA,SAAO;AACT;;;ACxCO,SAAS,OAAO,MAAM,OAAO,KAAK;AACvC,MAAI,SAAS,KAAM,QAAO,EAAE,MAAM,IAAI;AACtC,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,MAAI,QAAQ,OAAW,MAAK,MAAM;AAClC,MAAI,aAAa,OAAW,QAAO,EAAE,MAAM,IAAI;AAC/C,MAAI,MAAM,QAAQ,QAAQ,EAAG,QAAO,EAAE,MAAM,MAAM,GAAG,QAAQ;AAC7D,SAAO,EAAE,MAAM,MAAM,QAAQ;AAC/B;AAGO,IAAM,MAAM;AACZ,IAAM,OAAO;",
4
+ "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props) {\n props = props || EMPTY_OBJ;\n // Collect children from arguments[2..n] without rest args \u2014 avoids array allocation\n // when there are 0-1 children (common case: leaf elements, text nodes).\n const argLen = arguments.length;\n let flat;\n if (argLen <= 2) {\n flat = EMPTY_ARR;\n } else if (argLen === 3) {\n flat = _flattenSingle(arguments[2]);\n } else {\n // Multiple children: flatten all arguments from position 2 onward\n const out = [];\n for (let i = 2; i < argLen; i++) {\n _flattenInto(arguments[i], out);\n }\n flat = out;\n }\n\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\n// Fast path for single child (most common case)\nfunction _flattenSingle(child) {\n if (child == null || child === false || child === true) return EMPTY_ARR;\n if (Array.isArray(child)) {\n const out = [];\n _flattenInto(child, out);\n return out;\n }\n if (typeof child === 'object' && child._vnode) return [child];\n if (typeof child === 'function') return [child];\n return [String(child)];\n}\n\n// Flatten a child (or array of children) into the output array\nfunction _flattenInto(child, out) {\n if (child == null || child === false || child === true) return;\n if (Array.isArray(child)) {\n for (let i = 0; i < child.length; i++) {\n _flattenInto(child[i], out);\n }\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n out.push(child);\n } else {\n out.push(String(child));\n }\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Dev Runtime\n// Same as jsx-runtime but used in development mode by Vite.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\nexport function jsxDEV(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// Also export jsx/jsxs for compatibility \u2014 some bundlers use these even in dev\nexport const jsx = jsxDEV;\nexport const jsxs = jsxDEV;\n"],
5
+ "mappings": ";AAOA,IAAM,YAAY,uBAAO,OAAO,IAAI;AACpC,IAAM,YAAY,CAAC;AAEZ,SAAS,EAAE,KAAK,OAAO;AAC5B,UAAQ,SAAS;AAGjB,QAAM,SAAS,UAAU;AACzB,MAAI;AACJ,MAAI,UAAU,GAAG;AACf,WAAO;AAAA,EACT,WAAW,WAAW,GAAG;AACvB,WAAO,eAAe,UAAU,CAAC,CAAC;AAAA,EACpC,OAAO;AAEL,UAAM,MAAM,CAAC;AACb,aAAS,IAAI,GAAG,IAAI,QAAQ,KAAK;AAC/B,mBAAa,UAAU,CAAC,GAAG,GAAG;AA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AO,EAAE,MAAM,IAAI;AAC/C,MAAI,MAAM,QAAQ,QAAQ,EAAG,QAAO,EAAE,MAAM,MAAM,GAAG,QAAQ;AAC7D,SAAO,EAAE,MAAM,MAAM,QAAQ;AAC/B;AAGO,IAAM,MAAM;AACZ,IAAM,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var f=Object.create(null);function h(n,t,...l){t=t||f;let e=o(l),i=t.key??null;return t.key!==void 0&&(t={...t},delete t.key),{tag:n,props:t,children:e,key:i,_vnode:!0}}function r({children:n}){return n}function o(n){let t=[];for(let l=0;l<n.length;l++){let e=n[l];e==null||e===!1||e===!0||(Array.isArray(e)?t.push(...o(e)):typeof e=="object"&&e._vnode||typeof e=="function"?t.push(e):t.push(String(e)))}return t}function u(n,t,l){if(t==null)return h(n,null);let{children:e,...i}=t;return l!==void 0&&(i.key=l),e===void 0?h(n,i):Array.isArray(e)?h(n,i,...e):h(n,i,e)}var a=u,x=u;export{r as Fragment,a as jsx,u as jsxDEV,x as jsxs};
1
+ var h=Object.create(null),a=[];function o(e,t){t=t||h;let n=arguments.length,l;if(n<=2)l=a;else if(n===3)l=x(arguments[2]);else{let r=[];for(let u=2;u<n;u++)f(arguments[u],r);l=r}let i=t.key??null;return t.key!==void 0&&(t={...t},delete t.key),{tag:e,props:t,children:l,key:i,_vnode:!0}}function s({children:e}){return e}function x(e){if(e==null||e===!1||e===!0)return a;if(Array.isArray(e)){let t=[];return f(e,t),t}return typeof e=="object"&&e._vnode?[e]:typeof e=="function"?[e]:[String(e)]}function f(e,t){if(!(e==null||e===!1||e===!0))if(Array.isArray(e))for(let n=0;n<e.length;n++)f(e[n],t);else typeof e=="object"&&e._vnode||typeof e=="function"?t.push(e):t.push(String(e))}function g(e,t,n){if(t==null)return o(e,null);let{children:l,...i}=t;return n!==void 0&&(i.key=n),l===void 0?o(e,i):Array.isArray(l)?o(e,i,...l):o(e,i,l)}var b=g,d=g;export{s as Fragment,b as jsx,g as jsxDEV,d as jsxs};
2
2
  //# sourceMappingURL=jsx-dev-runtime.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/h.js", "../src/jsx-dev-runtime.js"],
4
- "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props, ...children) {\n props = props || EMPTY_OBJ;\n const flat = flattenChildren(children);\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\nfunction flattenChildren(children) {\n const out = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child == null || child === false || child === true) continue;\n if (Array.isArray(child)) {\n out.push(...flattenChildren(child));\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n // Reactive child \u2014 preserve function for fine-grained DOM updates\n out.push(child);\n } else {\n // Text node\n out.push(String(child));\n }\n }\n return out;\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Dev Runtime\n// Same as jsx-runtime but used in development mode by Vite.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\nexport function jsxDEV(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// Also export jsx/jsxs for compatibility \u2014 some bundlers use these even in dev\nexport const jsx = jsxDEV;\nexport const jsxs = jsxDEV;\n"],
5
- "mappings": "AAOA,IAAMA,EAAY,OAAO,OAAO,IAAI,EAG7B,SAAS,EAAEC,EAAKC,KAAUC,EAAU,CACzCD,EAAQA,GAASE,EACjB,IAAMC,EAAOC,EAAgBH,CAAQ,EAC/BI,EAAML,EAAM,KAAO,KAGzB,OAAIA,EAAM,MAAQ,SAChBA,EAAQ,CAAE,GAAGA,CAAM,EACnB,OAAOA,EAAM,KAGR,CAAE,IAAAD,EAAK,MAAAC,EAAO,SAAUG,EAAM,IAAAE,EAAK,OAAQ,EAAK,CACzD,CAGO,SAASC,EAAS,CAAE,SAAAL,CAAS,EAAG,CACrC,OAAOA,CACT,CAEA,SAASG,EAAgBH,EAAU,CACjC,IAAMM,EAAM,CAAC,EACb,QAASC,EAAI,EAAGA,EAAIP,EAAS,OAAQO,IAAK,CACxC,IAAMC,EAAQR,EAASO,CAAC,EACpBC,GAAS,MAAQA,IAAU,IAASA,IAAU,KAC9C,MAAM,QAAQA,CAAK,EACrBF,EAAI,KAAK,GAAGH,EAAgBK,CAAK,CAAC,EACzB,OAAOA,GAAU,UAAYA,EAAM,QAEnC,OAAOA,GAAU,WAD1BF,EAAI,KAAKE,CAAK,EAMdF,EAAI,KAAK,OAAOE,CAAK,CAAC,EAE1B,CACA,OAAOF,CACT,CCxCO,SAASG,EAAOC,EAAMC,EAAOC,EAAK,CACvC,GAAID,GAAS,KAAM,OAAO,EAAED,EAAM,IAAI,EACtC,GAAM,CAAE,SAAAG,EAAU,GAAGC,CAAK,EAAIH,EAE9B,OADIC,IAAQ,SAAWE,EAAK,IAAMF,GAC9BC,IAAa,OAAkB,EAAEH,EAAMI,CAAI,EAC3C,MAAM,QAAQD,CAAQ,EAAU,EAAEH,EAAMI,EAAM,GAAGD,CAAQ,EACtD,EAAEH,EAAMI,EAAMD,CAAQ,CAC/B,CAGO,IAAME,EAAMN,EACNO,EAAOP",
6
- "names": ["EMPTY_OBJ", "tag", "props", "children", "EMPTY_OBJ", "flat", "flattenChildren", "key", "Fragment", "out", "i", "child", "jsxDEV", "type", "props", "key", "children", "rest", "jsx", "jsxs"]
4
+ "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props) {\n props = props || EMPTY_OBJ;\n // Collect children from arguments[2..n] without rest args \u2014 avoids array allocation\n // when there are 0-1 children (common case: leaf elements, text nodes).\n const argLen = arguments.length;\n let flat;\n if (argLen <= 2) {\n flat = EMPTY_ARR;\n } else if (argLen === 3) {\n flat = _flattenSingle(arguments[2]);\n } else {\n // Multiple children: flatten all arguments from position 2 onward\n const out = [];\n for (let i = 2; i < argLen; i++) {\n _flattenInto(arguments[i], out);\n }\n flat = out;\n }\n\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\n// Fast path for single child (most common case)\nfunction _flattenSingle(child) {\n if (child == null || child === false || child === true) return EMPTY_ARR;\n if (Array.isArray(child)) {\n const out = [];\n _flattenInto(child, out);\n return out;\n }\n if (typeof child === 'object' && child._vnode) return [child];\n if (typeof child === 'function') return [child];\n return [String(child)];\n}\n\n// Flatten a child (or array of children) into the output array\nfunction _flattenInto(child, out) {\n if (child == null || child === false || child === true) return;\n if (Array.isArray(child)) {\n for (let i = 0; i < child.length; i++) {\n _flattenInto(child[i], out);\n }\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n out.push(child);\n } else {\n out.push(String(child));\n }\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Dev Runtime\n// Same as jsx-runtime but used in development mode by Vite.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\nexport function jsxDEV(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// Also export jsx/jsxs for compatibility \u2014 some bundlers use these even in dev\nexport const jsx = jsxDEV;\nexport const jsxs = jsxDEV;\n"],
5
+ "mappings": "AAOA,IAAMA,EAAY,OAAO,OAAO,IAAI,EAC9BC,EAAY,CAAC,EAEZ,SAASC,EAAEC,EAAKC,EAAO,CAC5BA,EAAQA,GAASJ,EAGjB,IAAMK,EAAS,UAAU,OACrBC,EACJ,GAAID,GAAU,EACZC,EAAOL,UACEI,IAAW,EACpBC,EAAOC,EAAe,UAAU,CAAC,CAAC,MAC7B,CAEL,IAAMC,EAAM,CAAC,EACb,QAASC,EAAI,EAAGA,EAAIJ,EAAQI,IAC1BC,EAAa,UAAUD,CAAC,EAAGD,CAAG,EAEhCF,EAAOE,CACT,CAEA,IAAMG,EAAMP,EAAM,KAAO,KAGzB,OAAIA,EAAM,MAAQ,SAChBA,E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Y_OBJ", "EMPTY_ARR", "h", "tag", "props", "argLen", "flat", "_flattenSingle", "out", "i", "_flattenInto", "key", "Fragment", "children", "child", "jsxDEV", "type", "props", "key", "h", "children", "rest", "jsx", "jsxs"]
7
7
  }
@@ -1,8 +1,21 @@
1
1
  // packages/core/src/h.js
2
2
  var EMPTY_OBJ = /* @__PURE__ */ Object.create(null);
3
- function h(tag, props, ...children) {
3
+ var EMPTY_ARR = [];
4
+ function h(tag, props) {
4
5
  props = props || EMPTY_OBJ;
5
- const flat = flattenChildren(children);
6
+ const argLen = arguments.length;
7
+ let flat;
8
+ if (argLen <= 2) {
9
+ flat = EMPTY_ARR;
10
+ } else if (argLen === 3) {
11
+ flat = _flattenSingle(arguments[2]);
12
+ } else {
13
+ const out = [];
14
+ for (let i = 2; i < argLen; i++) {
15
+ _flattenInto(arguments[i], out);
16
+ }
17
+ flat = out;
18
+ }
6
19
  const key = props.key ?? null;
7
20
  if (props.key !== void 0) {
8
21
  props = { ...props };
@@ -13,22 +26,30 @@ function h(tag, props, ...children) {
13
26
  function Fragment({ children }) {
14
27
  return children;
15
28
  }
16
- function flattenChildren(children) {
17
- const out = [];
18
- for (let i = 0; i < children.length; i++) {
19
- const child = children[i];
20
- if (child == null || child === false || child === true) continue;
21
- if (Array.isArray(child)) {
22
- out.push(...flattenChildren(child));
23
- } else if (typeof child === "object" && child._vnode) {
24
- out.push(child);
25
- } else if (typeof child === "function") {
26
- out.push(child);
27
- } else {
28
- out.push(String(child));
29
+ function _flattenSingle(child) {
30
+ if (child == null || child === false || child === true) return EMPTY_ARR;
31
+ if (Array.isArray(child)) {
32
+ const out = [];
33
+ _flattenInto(child, out);
34
+ return out;
35
+ }
36
+ if (typeof child === "object" && child._vnode) return [child];
37
+ if (typeof child === "function") return [child];
38
+ return [String(child)];
39
+ }
40
+ function _flattenInto(child, out) {
41
+ if (child == null || child === false || child === true) return;
42
+ if (Array.isArray(child)) {
43
+ for (let i = 0; i < child.length; i++) {
44
+ _flattenInto(child[i], out);
29
45
  }
46
+ } else if (typeof child === "object" && child._vnode) {
47
+ out.push(child);
48
+ } else if (typeof child === "function") {
49
+ out.push(child);
50
+ } else {
51
+ out.push(String(child));
30
52
  }
31
- return out;
32
53
  }
33
54
 
34
55
  // packages/core/src/jsx-runtime.js
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/h.js", "../src/jsx-runtime.js"],
4
- "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props, ...children) {\n props = props || EMPTY_OBJ;\n const flat = flattenChildren(children);\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\nfunction flattenChildren(children) {\n const out = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child == null || child === false || child === true) continue;\n if (Array.isArray(child)) {\n out.push(...flattenChildren(child));\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n // Reactive child \u2014 preserve function for fine-grained DOM updates\n out.push(child);\n } else {\n // Text node\n out.push(String(child));\n }\n }\n return out;\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Automatic Runtime\n// Used by: jsxImportSource: \"what-framework\" (or \"what-core\")\n// Vite/esbuild import this automatically when using the \"react-jsx\" transform.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\n// Automatic JSX transform signature: jsx(type, { children, ...props }, key)\n// What's h() signature: h(type, props, ...children)\nexport function jsx(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// jsxs = jsx for static children (multiple). Same behavior for What.\nexport const jsxs = jsx;\n"],
5
- "mappings": ";AAOA,IAAM,YAAY,uBAAO,OAAO,IAAI;AAG7B,SAAS,EAAE,KAAK,UAAU,UAAU;AACzC,UAAQ,SAAS;AACjB,QAAM,OAAO,gBAAgB,QAAQ;AACrC,QAAM,MAAM,MAAM,OAAO;AAGzB,MAAI,MAAM,QAAQ,QAAW;AAC3B,YAAQ,EAAE,GAAG,MAAM;AACnB,WAAO,MAAM;AAAA,EACf;AAEA,SAAO,EAAE,KAAK,OAAO,UAAU,MAAM,KAAK,QAAQ,KAAK;AACzD;AAGO,SAAS,SAAS,EAAE,SAAS,GAAG;AACrC,SAAO;AACT;AAEA,SAAS,gBAAgB,UAAU;AACjC,QAAM,MAAM,CAAC;AACb,WAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,UAAM,QAAQ,SAAS,CAAC;AACxB,QAAI,SAAS,QAAQ,UAAU,SAAS,UAAU,KAAM;AACxD,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,UAAI,KAAK,GAAG,gBAAgB,KAAK,CAAC;AAAA,IACpC,WAAW,OAAO,UAAU,YAAY,MAAM,QAAQ;AACpD,UAAI,KAAK,KAAK;AAAA,IAChB,WAAW,OAAO,UAAU,YAAY;AAEtC,UAAI,KAAK,KAAK;AAAA,IAChB,OAAO;AAEL,UAAI,KAAK,OAAO,KAAK,CAAC;AAAA,IACxB;AAAA,EACF;AACA,SAAO;AACT;;;ACrCO,SAAS,IAAI,MAAM,OAAO,KAAK;AACpC,MAAI,SAAS,KAAM,QAAO,EAAE,MAAM,IAAI;AACtC,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,MAAI,QAAQ,OAAW,MAAK,MAAM;AAClC,MAAI,aAAa,OAAW,QAAO,EAAE,MAAM,IAAI;AAC/C,MAAI,MAAM,QAAQ,QAAQ,EAAG,QAAO,EAAE,MAAM,MAAM,GAAG,QAAQ;AAC7D,SAAO,EAAE,MAAM,MAAM,QAAQ;AAC/B;AAGO,IAAM,OAAO;",
4
+ "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props) {\n props = props || EMPTY_OBJ;\n // Collect children from arguments[2..n] without rest args \u2014 avoids array allocation\n // when there are 0-1 children (common case: leaf elements, text nodes).\n const argLen = arguments.length;\n let flat;\n if (argLen <= 2) {\n flat = EMPTY_ARR;\n } else if (argLen === 3) {\n flat = _flattenSingle(arguments[2]);\n } else {\n // Multiple children: flatten all arguments from position 2 onward\n const out = [];\n for (let i = 2; i < argLen; i++) {\n _flattenInto(arguments[i], out);\n }\n flat = out;\n }\n\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\n// Fast path for single child (most common case)\nfunction _flattenSingle(child) {\n if (child == null || child === false || child === true) return EMPTY_ARR;\n if (Array.isArray(child)) {\n const out = [];\n _flattenInto(child, out);\n return out;\n }\n if (typeof child === 'object' && child._vnode) return [child];\n if (typeof child === 'function') return [child];\n return [String(child)];\n}\n\n// Flatten a child (or array of children) into the output array\nfunction _flattenInto(child, out) {\n if (child == null || child === false || child === true) return;\n if (Array.isArray(child)) {\n for (let i = 0; i < child.length; i++) {\n _flattenInto(child[i], out);\n }\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n out.push(child);\n } else {\n out.push(String(child));\n }\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Automatic Runtime\n// Used by: jsxImportSource: \"what-framework\" (or \"what-core\")\n// Vite/esbuild import this automatically when using the \"react-jsx\" transform.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\n// Automatic JSX transform signature: jsx(type, { children, ...props }, key)\n// What's h() signature: h(type, props, ...children)\nexport function jsx(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// jsxs = jsx for static children (multiple). Same behavior for What.\nexport const jsxs = jsx;\n"],
5
+ "mappings": ";AAOA,IAAM,YAAY,uBAAO,OAAO,IAAI;AACpC,IAAM,YAAY,CAAC;AAEZ,SAAS,EAAE,KAAK,OAAO;AAC5B,UAAQ,SAAS;AAGjB,QAAM,SAAS,UAAU;AACzB,MAAI;AACJ,MAAI,UAAU,GAAG;AACf,WAAO;AAAA,EACT,WAAW,WAAW,GAA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O,KAAK;AACpC,MAAI,SAAS,KAAM,QAAO,EAAE,MAAM,IAAI;AACtC,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,MAAI,QAAQ,OAAW,MAAK,MAAM;AAClC,MAAI,aAAa,OAAW,QAAO,EAAE,MAAM,IAAI;AAC/C,MAAI,MAAM,QAAQ,QAAQ,EAAG,QAAO,EAAE,MAAM,MAAM,GAAG,QAAQ;AAC7D,SAAO,EAAE,MAAM,MAAM,QAAQ;AAC/B;AAGO,IAAM,OAAO;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var u=Object.create(null);function h(n,t,...l){t=t||u;let e=o(l),i=t.key??null;return t.key!==void 0&&(t={...t},delete t.key),{tag:n,props:t,children:e,key:i,_vnode:!0}}function f({children:n}){return n}function o(n){let t=[];for(let l=0;l<n.length;l++){let e=n[l];e==null||e===!1||e===!0||(Array.isArray(e)?t.push(...o(e)):typeof e=="object"&&e._vnode||typeof e=="function"?t.push(e):t.push(String(e)))}return t}function r(n,t,l){if(t==null)return h(n,null);let{children:e,...i}=t;return l!==void 0&&(i.key=l),e===void 0?h(n,i):Array.isArray(e)?h(n,i,...e):h(n,i,e)}var a=r;export{f as Fragment,r as jsx,a as jsxs};
1
+ var g=Object.create(null),a=[];function u(e,t){t=t||g;let n=arguments.length,l;if(n<=2)l=a;else if(n===3)l=s(arguments[2]);else{let r=[];for(let f=2;f<n;f++)o(arguments[f],r);l=r}let i=t.key??null;return t.key!==void 0&&(t={...t},delete t.key),{tag:e,props:t,children:l,key:i,_vnode:!0}}function h({children:e}){return e}function s(e){if(e==null||e===!1||e===!0)return a;if(Array.isArray(e)){let t=[];return o(e,t),t}return typeof e=="object"&&e._vnode?[e]:typeof e=="function"?[e]:[String(e)]}function o(e,t){if(!(e==null||e===!1||e===!0))if(Array.isArray(e))for(let n=0;n<e.length;n++)o(e[n],t);else typeof e=="object"&&e._vnode||typeof e=="function"?t.push(e):t.push(String(e))}function x(e,t,n){if(t==null)return u(e,null);let{children:l,...i}=t;return n!==void 0&&(i.key=n),l===void 0?u(e,i):Array.isArray(l)?u(e,i,...l):u(e,i,l)}var b=x;export{h as Fragment,x as jsx,b as jsxs};
2
2
  //# sourceMappingURL=jsx-runtime.min.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/h.js", "../src/jsx-runtime.js"],
4
- "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props, ...children) {\n props = props || EMPTY_OBJ;\n const flat = flattenChildren(children);\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\nfunction flattenChildren(children) {\n const out = [];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child == null || child === false || child === true) continue;\n if (Array.isArray(child)) {\n out.push(...flattenChildren(child));\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n // Reactive child \u2014 preserve function for fine-grained DOM updates\n out.push(child);\n } else {\n // Text node\n out.push(String(child));\n }\n }\n return out;\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Automatic Runtime\n// Used by: jsxImportSource: \"what-framework\" (or \"what-core\")\n// Vite/esbuild import this automatically when using the \"react-jsx\" transform.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\n// Automatic JSX transform signature: jsx(type, { children, ...props }, key)\n// What's h() signature: h(type, props, ...children)\nexport function jsx(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// jsxs = jsx for static children (multiple). Same behavior for What.\nexport const jsxs = jsx;\n"],
5
- "mappings": "AAOA,IAAMA,EAAY,OAAO,OAAO,IAAI,EAG7B,SAAS,EAAEC,EAAKC,KAAUC,EAAU,CACzCD,EAAQA,GAASE,EACjB,IAAMC,EAAOC,EAAgBH,CAAQ,EAC/BI,EAAML,EAAM,KAAO,KAGzB,OAAIA,EAAM,MAAQ,SAChBA,EAAQ,CAAE,GAAGA,CAAM,EACnB,OAAOA,EAAM,KAGR,CAAE,IAAAD,EAAK,MAAAC,EAAO,SAAUG,EAAM,IAAAE,EAAK,OAAQ,EAAK,CACzD,CAGO,SAASC,EAAS,CAAE,SAAAL,CAAS,EAAG,CACrC,OAAOA,CACT,CAEA,SAASG,EAAgBH,EAAU,CACjC,IAAMM,EAAM,CAAC,EACb,QAASC,EAAI,EAAGA,EAAIP,EAAS,OAAQO,IAAK,CACxC,IAAMC,EAAQR,EAASO,CAAC,EACpBC,GAAS,MAAQA,IAAU,IAASA,IAAU,KAC9C,MAAM,QAAQA,CAAK,EACrBF,EAAI,KAAK,GAAGH,EAAgBK,CAAK,CAAC,EACzB,OAAOA,GAAU,UAAYA,EAAM,QAEnC,OAAOA,GAAU,WAD1BF,EAAI,KAAKE,CAAK,EAMdF,EAAI,KAAK,OAAOE,CAAK,CAAC,EAE1B,CACA,OAAOF,CACT,CCrCO,SAASG,EAAIC,EAAMC,EAAOC,EAAK,CACpC,GAAID,GAAS,KAAM,OAAO,EAAED,EAAM,IAAI,EACtC,GAAM,CAAE,SAAAG,EAAU,GAAGC,CAAK,EAAIH,EAE9B,OADIC,IAAQ,SAAWE,EAAK,IAAMF,GAC9BC,IAAa,OAAkB,EAAEH,EAAMI,CAAI,EAC3C,MAAM,QAAQD,CAAQ,EAAU,EAAEH,EAAMI,EAAM,GAAGD,CAAQ,EACtD,EAAEH,EAAMI,EAAMD,CAAQ,CAC/B,CAGO,IAAME,EAAON",
6
- "names": ["EMPTY_OBJ", "tag", "props", "children", "EMPTY_OBJ", "flat", "flattenChildren", "key", "Fragment", "out", "i", "child", "jsx", "type", "props", "key", "children", "rest", "jsxs"]
4
+ "sourcesContent": ["// What Framework - Element Descriptors\n// Minimal element descriptor objects. No classes, no fibers, just plain objects.\n\n// h(tag, props, ...children) -> VNode\n// h(Component, props, ...children) -> VNode\n// VNode = { tag, props, children, key }\n\nconst EMPTY_OBJ = Object.create(null);\nconst EMPTY_ARR = [];\n\nexport function h(tag, props) {\n props = props || EMPTY_OBJ;\n // Collect children from arguments[2..n] without rest args \u2014 avoids array allocation\n // when there are 0-1 children (common case: leaf elements, text nodes).\n const argLen = arguments.length;\n let flat;\n if (argLen <= 2) {\n flat = EMPTY_ARR;\n } else if (argLen === 3) {\n flat = _flattenSingle(arguments[2]);\n } else {\n // Multiple children: flatten all arguments from position 2 onward\n const out = [];\n for (let i = 2; i < argLen; i++) {\n _flattenInto(arguments[i], out);\n }\n flat = out;\n }\n\n const key = props.key ?? null;\n\n // Strip key from props passed to component/element\n if (props.key !== undefined) {\n props = { ...props };\n delete props.key;\n }\n\n return { tag, props, children: flat, key, _vnode: true };\n}\n\n// Fragment \u2014 just returns children\nexport function Fragment({ children }) {\n return children;\n}\n\n// Fast path for single child (most common case)\nfunction _flattenSingle(child) {\n if (child == null || child === false || child === true) return EMPTY_ARR;\n if (Array.isArray(child)) {\n const out = [];\n _flattenInto(child, out);\n return out;\n }\n if (typeof child === 'object' && child._vnode) return [child];\n if (typeof child === 'function') return [child];\n return [String(child)];\n}\n\n// Flatten a child (or array of children) into the output array\nfunction _flattenInto(child, out) {\n if (child == null || child === false || child === true) return;\n if (Array.isArray(child)) {\n for (let i = 0; i < child.length; i++) {\n _flattenInto(child[i], out);\n }\n } else if (typeof child === 'object' && child._vnode) {\n out.push(child);\n } else if (typeof child === 'function') {\n out.push(child);\n } else {\n out.push(String(child));\n }\n}\n\n// JSX-like tagged template alternative (no build step needed)\n// html`<div class=\"foo\">${content}</div>`\n// Uses a simple parser, not full HTML \u2014 good enough for most cases.\n\nexport function html(strings, ...values) {\n const src = strings.reduce((acc, str, i) =>\n acc + str + (i < values.length ? `\\x00${i}\\x00` : ''), '');\n return parseTemplate(src, values);\n}\n\nfunction parseTemplate(src, values) {\n // Lightweight tagged template parser\n // Supports: <tag attr=\"val\">, <tag ...${spread}>, ${children}, self-closing\n src = src.trim();\n const nodes = [];\n let i = 0;\n\n while (i < src.length) {\n if (src[i] === '<') {\n const result = parseElement(src, i, values);\n if (result) {\n nodes.push(result.node);\n i = result.end;\n continue;\n }\n }\n // Text or interpolation\n const result = parseText(src, i, values);\n if (result.text) nodes.push(result.text);\n i = result.end;\n }\n\n return nodes.length === 1 ? nodes[0] : nodes;\n}\n\nfunction parseElement(src, start, values) {\n // Opening tag\n const openMatch = src.slice(start).match(/^<([a-zA-Z][a-zA-Z0-9-]*|[A-Z]\\w*)/);\n if (!openMatch) return null;\n\n const tag = openMatch[1];\n let i = start + openMatch[0].length;\n const props = {};\n\n // Parse attributes\n while (i < src.length) {\n // Skip whitespace\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Self-closing or end of opening tag\n if (src.slice(i, i + 2) === '/>') {\n return { node: h(tag, Object.keys(props).length ? props : null), end: i + 2 };\n }\n if (src[i] === '>') {\n i++;\n break;\n }\n\n // Spread: ...${obj}\n if (src.slice(i, i + 3) === '...') {\n const placeholder = src.slice(i + 3).match(/^\\x00(\\d+)\\x00/);\n if (placeholder) {\n Object.assign(props, values[Number(placeholder[1])]);\n i += 3 + placeholder[0].length;\n continue;\n }\n }\n\n // Attribute: name=${val} or name=\"val\" or name\n const attrMatch = src.slice(i).match(/^([a-zA-Z_@:][a-zA-Z0-9_:.-]*)/);\n if (!attrMatch) break;\n\n const attrName = attrMatch[1];\n i += attrMatch[0].length;\n\n // Skip whitespace around =\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n if (src[i] === '=') {\n i++;\n while (i < src.length && /\\s/.test(src[i])) i++;\n\n // Value is a placeholder\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n props[attrName] = values[Number(ph[1])];\n i += ph[0].length;\n } else if (src[i] === '\"' || src[i] === \"'\") {\n const q = src[i];\n i++;\n let val = '';\n while (i < src.length && src[i] !== q) {\n const tph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (tph) {\n val += String(values[Number(tph[1])]);\n i += tph[0].length;\n } else {\n val += src[i];\n i++;\n }\n }\n i++; // closing quote\n props[attrName] = val;\n }\n } else {\n props[attrName] = true;\n }\n }\n\n // Parse children until closing tag\n const children = [];\n const closeTag = `</${tag}>`;\n\n while (i < src.length) {\n if (src.slice(i, i + closeTag.length) === closeTag) {\n i += closeTag.length;\n break;\n }\n\n if (src[i] === '<') {\n const child = parseElement(src, i, values);\n if (child) {\n children.push(child.node);\n i = child.end;\n continue;\n }\n }\n\n const text = parseText(src, i, values);\n if (text.text != null) children.push(text.text);\n i = text.end;\n }\n\n return {\n node: h(tag, Object.keys(props).length ? props : null, ...children),\n end: i,\n };\n}\n\nfunction parseText(src, start, values) {\n let i = start;\n let text = '';\n\n while (i < src.length && src[i] !== '<') {\n const ph = src.slice(i).match(/^\\x00(\\d+)\\x00/);\n if (ph) {\n if (text.trim()) {\n return { text: text.trim(), end: i };\n }\n return { text: values[Number(ph[1])], end: i + ph[0].length };\n }\n text += src[i];\n i++;\n }\n\n return { text: text.trim() || null, end: i };\n}\n", "// What Framework \u2014 JSX Automatic Runtime\n// Used by: jsxImportSource: \"what-framework\" (or \"what-core\")\n// Vite/esbuild import this automatically when using the \"react-jsx\" transform.\n\nimport { h, Fragment } from './h.js';\n\nexport { Fragment };\n\n// Automatic JSX transform signature: jsx(type, { children, ...props }, key)\n// What's h() signature: h(type, props, ...children)\nexport function jsx(type, props, key) {\n if (props == null) return h(type, null);\n const { children, ...rest } = props;\n if (key !== undefined) rest.key = key;\n if (children === undefined) return h(type, rest);\n if (Array.isArray(children)) return h(type, rest, ...children);\n return h(type, rest, children);\n}\n\n// jsxs = jsx for static children (multiple). Same behavior for What.\nexport const jsxs = jsx;\n"],
5
+ "mappings": "AAOA,IAAMA,EAAY,OAAO,OAAO,IAAI,EAC9BC,EAAY,CAAC,EAEZ,SAASC,EAAEC,EAAKC,EAAO,CAC5BA,EAAQA,GAASJ,EAGjB,IAAMK,EAAS,UAAU,OACrBC,EACJ,GAAID,GAAU,EACZC,EAAOL,UACEI,IAAW,EACpBC,EAA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,SAAWG,EAAK,IAAMH,GAC9BE,IAAa,OAAkBD,EAAEH,EAAMK,CAAI,EAC3C,MAAM,QAAQD,CAAQ,EAAUD,EAAEH,EAAMK,EAAM,GAAGD,CAAQ,EACtDD,EAAEH,EAAMK,EAAMD,CAAQ,CAC/B,CAGO,IAAME,EAAOP",
6
+ "names": ["EMPTY_OBJ", "EMPTY_ARR", "h", "tag", "props", "argLen", "flat", "_flattenSingle", "out", "i", "_flattenInto", "key", "Fragment", "children", "child", "jsx", "type", "props", "key", "h", "children", "rest", "jsxs"]
7
7
  }