@ox-content/vite-plugin 2.87.0 → 2.89.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.
- package/dist/index.cjs +2677 -2752
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +829 -855
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +829 -855
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2670 -2745
- package/dist/index.mjs.map +1 -1
- package/dist/jsx-dev-runtime.cjs +34 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.cts +18 -0
- package/dist/jsx-dev-runtime.d.cts.map +1 -0
- package/dist/jsx-dev-runtime.d.mts +18 -0
- package/dist/jsx-dev-runtime.d.mts.map +1 -0
- package/dist/jsx-dev-runtime.mjs +29 -0
- package/dist/jsx-dev-runtime.mjs.map +1 -0
- package/dist/jsx-html.cjs +207 -0
- package/dist/jsx-html.cjs.map +1 -0
- package/dist/jsx-html.d.cts +731 -0
- package/dist/jsx-html.d.cts.map +1 -0
- package/dist/jsx-html.d.mts +731 -0
- package/dist/jsx-html.d.mts.map +1 -0
- package/dist/jsx-html.mjs +166 -0
- package/dist/jsx-html.mjs.map +1 -0
- package/dist/jsx-runtime.cjs +6 -0
- package/dist/jsx-runtime.d.cts +2 -0
- package/dist/jsx-runtime.d.mts +2 -0
- package/dist/jsx-runtime.mjs +2 -0
- package/package.json +12 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("./vitepress.cjs");
|
|
3
|
+
const require_jsx_html = require("./jsx-html.cjs");
|
|
4
|
+
//#region src/jsx-dev-runtime.ts
|
|
5
|
+
/**
|
|
6
|
+
* Development-runtime entry point for the static HTML JSX transform.
|
|
7
|
+
*
|
|
8
|
+
* TypeScript's `react-jsxdev` transform (and Vite's dev-mode JSX transform)
|
|
9
|
+
* import from `<jsxImportSource>/jsx-dev-runtime` and call `jsxDEV` with the
|
|
10
|
+
* extra debug arguments below. This runtime renders static HTML, so there is
|
|
11
|
+
* nothing useful to do with them — they are accepted and ignored so the same
|
|
12
|
+
* templates compile in both dev and build.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```json
|
|
16
|
+
* { "compilerOptions": { "jsx": "react-jsxdev", "jsxImportSource": "@ox-content/vite-plugin" } }
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Creates a JSX element in development mode.
|
|
21
|
+
*
|
|
22
|
+
* The transform passes `isStaticChildren`, `source` and `self` for React's
|
|
23
|
+
* dev warnings; static HTML generation has no use for them.
|
|
24
|
+
*/
|
|
25
|
+
function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
|
|
26
|
+
return require_jsx_html.jsx(type, props, key);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.Fragment = require_jsx_html.Fragment;
|
|
30
|
+
exports.jsx = require_jsx_html.jsx;
|
|
31
|
+
exports.jsxDEV = jsxDEV;
|
|
32
|
+
exports.jsxs = require_jsx_html.jsxs;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=jsx-dev-runtime.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.cjs","names":["jsx"],"sources":["../src/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * Development-runtime entry point for the static HTML JSX transform.\n *\n * TypeScript's `react-jsxdev` transform (and Vite's dev-mode JSX transform)\n * import from `<jsxImportSource>/jsx-dev-runtime` and call `jsxDEV` with the\n * extra debug arguments below. This runtime renders static HTML, so there is\n * nothing useful to do with them — they are accepted and ignored so the same\n * templates compile in both dev and build.\n *\n * @example\n * ```json\n * { \"compilerOptions\": { \"jsx\": \"react-jsxdev\", \"jsxImportSource\": \"@ox-content/vite-plugin\" } }\n * ```\n */\n\nimport { jsx } from \"./jsx-html\";\nimport type { JSXElementType, JSXNode, JSXProps } from \"./jsx-html\";\n\nexport { Fragment, jsx, jsxs } from \"./jsx-html\";\nexport type { JSX } from \"./jsx-html\";\nexport type { JSXChild, JSXElementType, JSXNode, JSXProps } from \"./jsx-html\";\n\n/** Source position the dev transform attaches to each element. */\nexport interface JSXSource {\n fileName?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\n/**\n * Creates a JSX element in development mode.\n *\n * The transform passes `isStaticChildren`, `source` and `self` for React's\n * dev warnings; static HTML generation has no use for them.\n */\nexport function jsxDEV(\n type: JSXElementType,\n props: JSXProps,\n key?: string,\n _isStaticChildren?: boolean,\n _source?: JSXSource,\n _self?: unknown,\n): JSXNode {\n return jsx(type, props, key);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,OACd,MACA,OACA,KACA,mBACA,SACA,OACS;CACT,OAAOA,iBAAAA,IAAI,MAAM,OAAO,GAAG;AAC7B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { a as JSXProps, c as jsxs, f as JSX, i as JSXNode, n as JSXChild, r as JSXElementType, s as jsx, t as Fragment } from "./jsx-html.cjs";
|
|
2
|
+
//#region src/jsx-dev-runtime.d.ts
|
|
3
|
+
/** Source position the dev transform attaches to each element. */
|
|
4
|
+
interface JSXSource {
|
|
5
|
+
fileName?: string;
|
|
6
|
+
lineNumber?: number;
|
|
7
|
+
columnNumber?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a JSX element in development mode.
|
|
11
|
+
*
|
|
12
|
+
* The transform passes `isStaticChildren`, `source` and `self` for React's
|
|
13
|
+
* dev warnings; static HTML generation has no use for them.
|
|
14
|
+
*/
|
|
15
|
+
declare function jsxDEV(type: JSXElementType, props: JSXProps, key?: string, _isStaticChildren?: boolean, _source?: JSXSource, _self?: unknown): JSXNode;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Fragment, type JSX, type JSXChild, type JSXElementType, type JSXNode, type JSXProps, JSXSource, jsx, jsxDEV, jsxs };
|
|
18
|
+
//# sourceMappingURL=jsx-dev-runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.cts","names":[],"sources":["../src/jsx-dev-runtime.ts"],"mappings":";;;UAuBiB;EACf;EACA;EACA;;;;;;;;iBASc,OACd,MAAM,gBACN,OAAO,UACP,cACA,6BACA,UAAU,WACV,kBACC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { a as JSXProps, c as jsxs, f as JSX, i as JSXNode, n as JSXChild, r as JSXElementType, s as jsx, t as Fragment } from "./jsx-html.mjs";
|
|
2
|
+
//#region src/jsx-dev-runtime.d.ts
|
|
3
|
+
/** Source position the dev transform attaches to each element. */
|
|
4
|
+
interface JSXSource {
|
|
5
|
+
fileName?: string;
|
|
6
|
+
lineNumber?: number;
|
|
7
|
+
columnNumber?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Creates a JSX element in development mode.
|
|
11
|
+
*
|
|
12
|
+
* The transform passes `isStaticChildren`, `source` and `self` for React's
|
|
13
|
+
* dev warnings; static HTML generation has no use for them.
|
|
14
|
+
*/
|
|
15
|
+
declare function jsxDEV(type: JSXElementType, props: JSXProps, key?: string, _isStaticChildren?: boolean, _source?: JSXSource, _self?: unknown): JSXNode;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Fragment, type JSX, type JSXChild, type JSXElementType, type JSXNode, type JSXProps, JSXSource, jsx, jsxDEV, jsxs };
|
|
18
|
+
//# sourceMappingURL=jsx-dev-runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.mts","names":[],"sources":["../src/jsx-dev-runtime.ts"],"mappings":";;;UAuBiB;EACf;EACA;EACA;;;;;;;;iBASc,OACd,MAAM,gBACN,OAAO,UACP,cACA,6BACA,UAAU,WACV,kBACC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { i as jsxs, r as jsx, t as Fragment } from "./jsx-html.mjs";
|
|
2
|
+
//#region src/jsx-dev-runtime.ts
|
|
3
|
+
/**
|
|
4
|
+
* Development-runtime entry point for the static HTML JSX transform.
|
|
5
|
+
*
|
|
6
|
+
* TypeScript's `react-jsxdev` transform (and Vite's dev-mode JSX transform)
|
|
7
|
+
* import from `<jsxImportSource>/jsx-dev-runtime` and call `jsxDEV` with the
|
|
8
|
+
* extra debug arguments below. This runtime renders static HTML, so there is
|
|
9
|
+
* nothing useful to do with them — they are accepted and ignored so the same
|
|
10
|
+
* templates compile in both dev and build.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```json
|
|
14
|
+
* { "compilerOptions": { "jsx": "react-jsxdev", "jsxImportSource": "@ox-content/vite-plugin" } }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Creates a JSX element in development mode.
|
|
19
|
+
*
|
|
20
|
+
* The transform passes `isStaticChildren`, `source` and `self` for React's
|
|
21
|
+
* dev warnings; static HTML generation has no use for them.
|
|
22
|
+
*/
|
|
23
|
+
function jsxDEV(type, props, key, _isStaticChildren, _source, _self) {
|
|
24
|
+
return jsx(type, props, key);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { Fragment, jsx, jsxDEV, jsxs };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=jsx-dev-runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.mjs","names":[],"sources":["../src/jsx-dev-runtime.ts"],"sourcesContent":["/**\n * Development-runtime entry point for the static HTML JSX transform.\n *\n * TypeScript's `react-jsxdev` transform (and Vite's dev-mode JSX transform)\n * import from `<jsxImportSource>/jsx-dev-runtime` and call `jsxDEV` with the\n * extra debug arguments below. This runtime renders static HTML, so there is\n * nothing useful to do with them — they are accepted and ignored so the same\n * templates compile in both dev and build.\n *\n * @example\n * ```json\n * { \"compilerOptions\": { \"jsx\": \"react-jsxdev\", \"jsxImportSource\": \"@ox-content/vite-plugin\" } }\n * ```\n */\n\nimport { jsx } from \"./jsx-html\";\nimport type { JSXElementType, JSXNode, JSXProps } from \"./jsx-html\";\n\nexport { Fragment, jsx, jsxs } from \"./jsx-html\";\nexport type { JSX } from \"./jsx-html\";\nexport type { JSXChild, JSXElementType, JSXNode, JSXProps } from \"./jsx-html\";\n\n/** Source position the dev transform attaches to each element. */\nexport interface JSXSource {\n fileName?: string;\n lineNumber?: number;\n columnNumber?: number;\n}\n\n/**\n * Creates a JSX element in development mode.\n *\n * The transform passes `isStaticChildren`, `source` and `self` for React's\n * dev warnings; static HTML generation has no use for them.\n */\nexport function jsxDEV(\n type: JSXElementType,\n props: JSXProps,\n key?: string,\n _isStaticChildren?: boolean,\n _source?: JSXSource,\n _self?: unknown,\n): JSXNode {\n return jsx(type, props, key);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAgB,OACd,MACA,OACA,KACA,mBACA,SACA,OACS;CACT,OAAO,IAAI,MAAM,OAAO,GAAG;AAC7B"}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
//#region src/jsx-html.ts
|
|
2
|
+
const VOID_ELEMENTS = /* @__PURE__ */ new Set([
|
|
3
|
+
"area",
|
|
4
|
+
"base",
|
|
5
|
+
"br",
|
|
6
|
+
"col",
|
|
7
|
+
"embed",
|
|
8
|
+
"hr",
|
|
9
|
+
"img",
|
|
10
|
+
"input",
|
|
11
|
+
"link",
|
|
12
|
+
"meta",
|
|
13
|
+
"param",
|
|
14
|
+
"source",
|
|
15
|
+
"track",
|
|
16
|
+
"wbr"
|
|
17
|
+
]);
|
|
18
|
+
const BOOLEAN_ATTRS = /* @__PURE__ */ new Set([
|
|
19
|
+
"allowfullscreen",
|
|
20
|
+
"async",
|
|
21
|
+
"autofocus",
|
|
22
|
+
"autoplay",
|
|
23
|
+
"checked",
|
|
24
|
+
"controls",
|
|
25
|
+
"default",
|
|
26
|
+
"defer",
|
|
27
|
+
"disabled",
|
|
28
|
+
"formnovalidate",
|
|
29
|
+
"hidden",
|
|
30
|
+
"inert",
|
|
31
|
+
"ismap",
|
|
32
|
+
"itemscope",
|
|
33
|
+
"loop",
|
|
34
|
+
"multiple",
|
|
35
|
+
"muted",
|
|
36
|
+
"nomodule",
|
|
37
|
+
"novalidate",
|
|
38
|
+
"open",
|
|
39
|
+
"playsinline",
|
|
40
|
+
"readonly",
|
|
41
|
+
"required",
|
|
42
|
+
"reversed",
|
|
43
|
+
"selected"
|
|
44
|
+
]);
|
|
45
|
+
/**
|
|
46
|
+
* Escapes HTML special characters to prevent XSS.
|
|
47
|
+
*/
|
|
48
|
+
function escapeHtml(str) {
|
|
49
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Converts a camelCase attribute name to kebab-case for HTML.
|
|
53
|
+
* Special handling for data-* and aria-* attributes.
|
|
54
|
+
*/
|
|
55
|
+
function toHtmlAttr(name) {
|
|
56
|
+
if (name === "className") return "class";
|
|
57
|
+
if (name === "htmlFor") return "for";
|
|
58
|
+
if (name.startsWith("data") || name.startsWith("aria")) return name.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
59
|
+
return name;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Renders an attribute value to a string.
|
|
63
|
+
*/
|
|
64
|
+
function renderAttr(name, value) {
|
|
65
|
+
const htmlName = toHtmlAttr(name);
|
|
66
|
+
if (value === void 0 || value === null || value === false) return "";
|
|
67
|
+
if (BOOLEAN_ATTRS.has(htmlName)) return value ? ` ${htmlName}` : "";
|
|
68
|
+
if (name === "style" && typeof value === "object") return ` style="${escapeHtml(Object.entries(value).map(([k, v]) => {
|
|
69
|
+
return `${k.replace(/([A-Z])/g, "-$1").toLowerCase()}:${v}`;
|
|
70
|
+
}).join(";"))}"`;
|
|
71
|
+
return ` ${htmlName}="${escapeHtml(String(value))}"`;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Renders children to HTML string.
|
|
75
|
+
*/
|
|
76
|
+
function renderChildren(children) {
|
|
77
|
+
if (children === null || children === void 0 || children === false) return "";
|
|
78
|
+
if (children === true) return "";
|
|
79
|
+
if (typeof children === "string") return escapeHtml(children);
|
|
80
|
+
if (typeof children === "number") return String(children);
|
|
81
|
+
if (Array.isArray(children)) return children.map(renderChildren).join("");
|
|
82
|
+
if (typeof children === "object" && "__html" in children) return children.__html;
|
|
83
|
+
return "";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Creates a JSX element.
|
|
87
|
+
* This is the core function called by the JSX transform.
|
|
88
|
+
*/
|
|
89
|
+
function jsx(type, props, _key) {
|
|
90
|
+
const { children, ...restProps } = props;
|
|
91
|
+
if (typeof type === "function") return type({
|
|
92
|
+
...restProps,
|
|
93
|
+
children
|
|
94
|
+
});
|
|
95
|
+
const tag = type;
|
|
96
|
+
let html = `<${tag}`;
|
|
97
|
+
for (const [name, value] of Object.entries(restProps)) {
|
|
98
|
+
if (name === "key" || name === "ref") continue;
|
|
99
|
+
html += renderAttr(name, value);
|
|
100
|
+
}
|
|
101
|
+
if (VOID_ELEMENTS.has(tag)) {
|
|
102
|
+
html += " />";
|
|
103
|
+
return { __html: html };
|
|
104
|
+
}
|
|
105
|
+
html += ">";
|
|
106
|
+
if (children !== void 0) html += renderChildren(children);
|
|
107
|
+
html += `</${tag}>`;
|
|
108
|
+
return { __html: html };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Creates a JSX element with static children.
|
|
112
|
+
* Called by the JSX transform for elements with multiple children.
|
|
113
|
+
*/
|
|
114
|
+
function jsxs(type, props, key) {
|
|
115
|
+
return jsx(type, props, key);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Fragment component - renders children without a wrapper element.
|
|
119
|
+
*/
|
|
120
|
+
function Fragment({ children }) {
|
|
121
|
+
return { __html: renderChildren(children) };
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Renders a JSX node to an HTML string.
|
|
125
|
+
*/
|
|
126
|
+
function renderToString(node) {
|
|
127
|
+
return node.__html;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates raw HTML without escaping.
|
|
131
|
+
* Use with caution - only for trusted content.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```tsx
|
|
135
|
+
* <div>{raw('<strong>Bold</strong>')}</div>
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
function raw(html) {
|
|
139
|
+
return { __html: html };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Conditionally renders content.
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```tsx
|
|
146
|
+
* {when(isLoggedIn, <UserMenu />)}
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
function when(condition, content) {
|
|
150
|
+
return condition ? content : { __html: "" };
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Maps over an array and renders each item.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```tsx
|
|
157
|
+
* {each(items, (item) => <li>{item.name}</li>)}
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
function each(items, render) {
|
|
161
|
+
return { __html: items.map((item, i) => render(item, i).__html).join("") };
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
Object.defineProperty(exports, "Fragment", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function() {
|
|
167
|
+
return Fragment;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "each", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function() {
|
|
173
|
+
return each;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
Object.defineProperty(exports, "jsx", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function() {
|
|
179
|
+
return jsx;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, "jsxs", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function() {
|
|
185
|
+
return jsxs;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, "raw", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function() {
|
|
191
|
+
return raw;
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
Object.defineProperty(exports, "renderToString", {
|
|
195
|
+
enumerable: true,
|
|
196
|
+
get: function() {
|
|
197
|
+
return renderToString;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
Object.defineProperty(exports, "when", {
|
|
201
|
+
enumerable: true,
|
|
202
|
+
get: function() {
|
|
203
|
+
return when;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
//# sourceMappingURL=jsx-html.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-html.cjs","names":[],"sources":["../src/jsx-html.ts"],"sourcesContent":["/**\n * Custom JSX Runtime for Static HTML Generation\n *\n * This module provides a JSX runtime that outputs static HTML strings.\n * No React, no hydration, no client-side JavaScript - just pure HTML.\n *\n * This is the implementation. The JSX transform imports it through the\n * ./jsx-runtime and ./jsx-dev-runtime entry points, which are the subpaths\n * `jsxImportSource` resolves. Keeping the implementation under its own name\n * keeps those two entries from colliding with the shared bundle chunk.\n *\n * @example\n * ```tsx\n * // tsconfig.json or vite.config.ts\n * {\n * \"compilerOptions\": {\n * \"jsx\": \"react-jsx\",\n * \"jsxImportSource\": \"@ox-content/vite-plugin\"\n * }\n * }\n *\n * // MyComponent.tsx\n * export function Hero({ title }: { title: string }) {\n * return (\n * <section class=\"hero\">\n * <h1>{title}</h1>\n * </section>\n * );\n * }\n * ```\n */\n\n// `jsxImportSource` makes TypeScript look for the element types in\n// `<source>/jsx-runtime` itself, so the namespace has to travel with the\n// runtime exports and not only be declared globally in ./jsx.d.ts.\nexport type { JSX } from \"./jsx\";\n\n// Self-closing tags that don't need closing tags\nconst VOID_ELEMENTS = new Set([\n \"area\",\n \"base\",\n \"br\",\n \"col\",\n \"embed\",\n \"hr\",\n \"img\",\n \"input\",\n \"link\",\n \"meta\",\n \"param\",\n \"source\",\n \"track\",\n \"wbr\",\n]);\n\n// Attributes that should be rendered as boolean\nconst BOOLEAN_ATTRS = new Set([\n \"allowfullscreen\",\n \"async\",\n \"autofocus\",\n \"autoplay\",\n \"checked\",\n \"controls\",\n \"default\",\n \"defer\",\n \"disabled\",\n \"formnovalidate\",\n \"hidden\",\n \"inert\",\n \"ismap\",\n \"itemscope\",\n \"loop\",\n \"multiple\",\n \"muted\",\n \"nomodule\",\n \"novalidate\",\n \"open\",\n \"playsinline\",\n \"readonly\",\n \"required\",\n \"reversed\",\n \"selected\",\n]);\n\n/**\n * Escapes HTML special characters to prevent XSS.\n */\nfunction escapeHtml(str: string): string {\n return str\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\n/**\n * Converts a camelCase attribute name to kebab-case for HTML.\n * Special handling for data-* and aria-* attributes.\n */\nfunction toHtmlAttr(name: string): string {\n // className -> class\n if (name === \"className\") return \"class\";\n // htmlFor -> for\n if (name === \"htmlFor\") return \"for\";\n // Keep data-* and aria-* as-is\n if (name.startsWith(\"data\") || name.startsWith(\"aria\")) {\n return name.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n }\n return name;\n}\n\n/**\n * Renders an attribute value to a string.\n */\nfunction renderAttr(name: string, value: unknown): string {\n const htmlName = toHtmlAttr(name);\n\n // Skip undefined, null, and false values\n if (value === undefined || value === null || value === false) {\n return \"\";\n }\n\n // Boolean attributes\n if (BOOLEAN_ATTRS.has(htmlName)) {\n return value ? ` ${htmlName}` : \"\";\n }\n\n // Style object to string\n if (name === \"style\" && typeof value === \"object\") {\n const styleStr = Object.entries(value as Record<string, string | number>)\n .map(([k, v]) => {\n const prop = k.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n return `${prop}:${v}`;\n })\n .join(\";\");\n return ` style=\"${escapeHtml(styleStr)}\"`;\n }\n\n // Regular attribute\n return ` ${htmlName}=\"${escapeHtml(String(value as string | number | boolean))}\"`;\n}\n\n/**\n * JSX element type - either a string (intrinsic) or a function component.\n */\nexport type JSXElementType = string | ((props: Record<string, unknown>) => JSXNode);\n\n/**\n * Valid JSX child types.\n */\nexport type JSXChild = string | number | boolean | null | undefined | JSXNode | JSXChild[];\n\n/**\n * JSX node - the result of JSX expressions.\n */\nexport interface JSXNode {\n __html: string;\n}\n\n/**\n * Props with children.\n */\nexport interface JSXProps {\n children?: JSXChild;\n [key: string]: unknown;\n}\n\n/**\n * Renders children to HTML string.\n */\nfunction renderChildren(children: JSXChild): string {\n if (children === null || children === undefined || children === false) {\n return \"\";\n }\n\n if (children === true) {\n return \"\";\n }\n\n if (typeof children === \"string\") {\n return escapeHtml(children);\n }\n\n if (typeof children === \"number\") {\n return String(children);\n }\n\n if (Array.isArray(children)) {\n return children.map(renderChildren).join(\"\");\n }\n\n if (typeof children === \"object\" && \"__html\" in children) {\n return children.__html;\n }\n\n return \"\";\n}\n\n/**\n * Creates a JSX element.\n * This is the core function called by the JSX transform.\n */\nexport function jsx(type: JSXElementType, props: JSXProps, _key?: string): JSXNode {\n const { children, ...restProps } = props;\n\n // Function component\n if (typeof type === \"function\") {\n return type({ ...restProps, children });\n }\n\n // Intrinsic element (HTML tag)\n const tag = type;\n let html = `<${tag}`;\n\n // Render attributes\n for (const [name, value] of Object.entries(restProps)) {\n // Skip internal props\n if (name === \"key\" || name === \"ref\") continue;\n html += renderAttr(name, value);\n }\n\n // Self-closing tags\n if (VOID_ELEMENTS.has(tag)) {\n html += \" />\";\n return { __html: html };\n }\n\n html += \">\";\n\n // Render children\n if (children !== undefined) {\n html += renderChildren(children);\n }\n\n html += `</${tag}>`;\n\n return { __html: html };\n}\n\n/**\n * Creates a JSX element with static children.\n * Called by the JSX transform for elements with multiple children.\n */\nexport function jsxs(type: JSXElementType, props: JSXProps, key?: string): JSXNode {\n return jsx(type, props, key);\n}\n\n/**\n * Fragment component - renders children without a wrapper element.\n */\nexport function Fragment({ children }: { children?: JSXChild }): JSXNode {\n return { __html: renderChildren(children) };\n}\n\n/**\n * Renders a JSX node to an HTML string.\n */\nexport function renderToString(node: JSXNode): string {\n return node.__html;\n}\n\n/**\n * Creates raw HTML without escaping.\n * Use with caution - only for trusted content.\n *\n * @example\n * ```tsx\n * <div>{raw('<strong>Bold</strong>')}</div>\n * ```\n */\nexport function raw(html: string): JSXNode {\n return { __html: html };\n}\n\n/**\n * Conditionally renders content.\n *\n * @example\n * ```tsx\n * {when(isLoggedIn, <UserMenu />)}\n * ```\n */\nexport function when(condition: boolean, content: JSXNode): JSXNode {\n return condition ? content : { __html: \"\" };\n}\n\n/**\n * Maps over an array and renders each item.\n *\n * @example\n * ```tsx\n * {each(items, (item) => <li>{item.name}</li>)}\n * ```\n */\nexport function each<T>(items: T[], render: (item: T, index: number) => JSXNode): JSXNode {\n const html = items.map((item, i) => render(item, i).__html).join(\"\");\n return { __html: html };\n}\n\n// Default export for convenience\nexport default {\n jsx,\n jsxs,\n Fragment,\n renderToString,\n raw,\n when,\n each,\n};\n"],"mappings":";AAsCA,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAM,gCAAgB,IAAI,IAAI;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;AAKD,SAAS,WAAW,KAAqB;CACvC,OAAO,IACJ,QAAQ,MAAM,OAA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