microtags 0.0.13 → 0.1.1
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/README.md +567 -40
- package/dist/build.cjs +412 -0
- package/dist/build.cjs.map +7 -0
- package/dist/build.d.ts +17 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +395 -0
- package/dist/build.js.map +7 -0
- package/dist/builders.d.ts +70 -4
- package/dist/builders.d.ts.map +1 -1
- package/dist/{chunk-CCYWRJW6.js → chunk-46UEUDVX.js} +4 -26
- package/dist/chunk-46UEUDVX.js.map +7 -0
- package/dist/chunk-LS4L5QRD.js +26 -0
- package/dist/chunk-LS4L5QRD.js.map +7 -0
- package/dist/chunk-RKWPTT6P.js +69 -0
- package/dist/chunk-RKWPTT6P.js.map +7 -0
- package/dist/chunk-ZZ4ZLOQY.js +33 -0
- package/dist/chunk-ZZ4ZLOQY.js.map +7 -0
- package/dist/cli.cjs +536 -0
- package/dist/cli.cjs.map +7 -0
- package/dist/context.js +2 -1
- package/dist/esbuild.cjs +451 -0
- package/dist/esbuild.cjs.map +7 -0
- package/dist/esbuild.d.ts +7 -0
- package/dist/esbuild.d.ts.map +1 -0
- package/dist/esbuild.js +434 -0
- package/dist/esbuild.js.map +7 -0
- package/dist/factory.d.ts +7 -1
- package/dist/factory.d.ts.map +1 -1
- package/dist/htm.browser.cjs +591 -0
- package/dist/htm.browser.cjs.map +7 -0
- package/dist/htm.browser.d.ts +30 -0
- package/dist/htm.browser.d.ts.map +1 -0
- package/dist/htm.browser.js +498 -0
- package/dist/htm.browser.js.map +7 -0
- package/dist/htm.browser.min.js +3 -0
- package/dist/htm.browser.min.js.map +7 -0
- package/dist/htm.cjs +284 -0
- package/dist/htm.cjs.map +7 -0
- package/dist/htm.d.ts +14 -0
- package/dist/htm.d.ts.map +1 -0
- package/dist/htm.js +196 -0
- package/dist/htm.js.map +7 -0
- package/dist/htm.min.js +3 -0
- package/dist/htm.min.js.map +7 -0
- package/dist/index.cjs +125 -11
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +133 -17
- package/dist/index.js.map +2 -2
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +3 -3
- package/dist/meta.json +411 -26
- package/dist/preact-shared.d.ts +61 -0
- package/dist/preact-shared.d.ts.map +1 -0
- package/dist/preact.browser.d.ts +8 -0
- package/dist/preact.browser.d.ts.map +1 -0
- package/dist/preact.browser.js +45 -0
- package/dist/preact.browser.js.map +7 -0
- package/dist/preact.browser.min.js +2 -0
- package/dist/preact.browser.min.js.map +7 -0
- package/dist/preact.cjs +128 -0
- package/dist/preact.cjs.map +7 -0
- package/dist/preact.d.ts +9 -0
- package/dist/preact.d.ts.map +1 -0
- package/dist/preact.js +35 -0
- package/dist/preact.js.map +7 -0
- package/dist/render-support.cjs +86 -0
- package/dist/render-support.cjs.map +7 -0
- package/dist/render-support.d.ts +23 -0
- package/dist/render-support.d.ts.map +1 -0
- package/dist/render-support.js +12 -0
- package/dist/render-support.js.map +7 -0
- package/dist/render-support.min.js +2 -0
- package/dist/render-support.min.js.map +7 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/vite.cjs +448 -0
- package/dist/vite.cjs.map +7 -0
- package/dist/vite.d.ts +7 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +429 -0
- package/dist/vite.js.map +7 -0
- package/package.json +92 -13
- package/dist/chunk-CCYWRJW6.js.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/preact.browser.ts", "../src/preact-shared.ts"],
|
|
4
|
+
"sourcesContent": ["// `microtags/preact`, browser build. Renders the host tag only: the\n// declared props go to the host's prop accessors, mapped events become\n// `on<event-name>` listeners, and a per-instance fixed\n// `dangerouslySetInnerHTML` keeps Preact out of the host's children.\n// Never imports render support. See ADR-010.\nimport { h, type VNode } from 'preact'\nimport { useRef } from 'preact/hooks'\nimport {\n splitProps,\n type EventMap,\n type PreactComponent,\n type PreactElementClass,\n type ToPreactOptions,\n} from './preact-shared.js'\n\nexport type {\n DeclaredProps,\n EventMap,\n PassthroughProps,\n PreactComponent,\n PreactElementClass,\n PreactProps,\n ToPreactOptions,\n} from './preact-shared.js'\n\ninterface State {\n /** the host has been committed once (hydrated or mounted) */\n live:boolean\n /** the inner HTML, fixed once the host is live */\n html:string\n inner?:{ readonly __html:string }\n}\n\n/**\n * Wrap a microtags element class as a Preact component. Preact owns the\n * host and its attributes; the element owns the host's children.\n */\nexport function toPreact<\n C extends PreactElementClass,\n E extends EventMap = Record<never, never>,\n> (El:C, options?:ToPreactOptions<E>):PreactComponent<C, E> {\n const events:EventMap = options?.events ?? {}\n return (props:Record<string, unknown>):VNode<any> => {\n const { own, on, rest } = splitProps(El, events, props)\n const s = useRef<State>({ live: false, html: '' }).current!\n const vprops:Record<string, unknown> = { ...rest, ...own }\n for (const k in on) vprops['on' + k] = on[k]\n // Preact reads `__html` only outside hydration: on a client-only\n // mount (before the ref below runs), when the element's render\n // fills the host. Once live the value never changes, so Preact\n // never writes `innerHTML` over the element's children again.\n vprops.dangerouslySetInnerHTML = s.inner ??= {\n get __html () {\n if (!s.live && El.renderParts) {\n const extra:Record<string, string> = {}\n for (const k in rest) {\n if (rest[k] != null) extra[k] = String(rest[k])\n }\n s.html = El.renderParts(own, { attrs: extra }).html\n }\n return s.html\n },\n }\n // A fresh ref per render runs on every commit. Preact skips\n // non-function props while hydrating and later skips a value\n // equal to the hydrated one, so assign any the host lacks.\n vprops.ref = (el:Record<string, unknown>|null) => {\n if (!el) return\n s.live = true\n for (const k in own) {\n const v = own[k]\n if (typeof v !== 'function' && el[k] !== v) el[k] = v\n }\n }\n return h(El.TAG, vprops)\n }\n}\n", "// Types and prop mapping shared by both builds of `microtags/preact`\n// (the default server build and the browser build). Never imports\n// render support. See ADR-010.\nimport type { FunctionComponent } from 'preact'\nimport type { RenderParts } from './builders.js'\n\n/**\n * The part of a microtags element class the adapter reads. Any class\n * from `setup` fits; `renderParts` is absent at runtime when the class\n * has no render link.\n */\nexport interface PreactElementClass<P = any> {\n readonly TAG:string\n readonly props:readonly string[]\n readonly renderParts?:(\n props:P,\n options?:{ children?:string; attrs?:Record<string, string> }\n ) => RenderParts\n}\n\n/** Map from callback prop name to DOM event name. */\nexport type EventMap = Record<string, string>\n\nexport interface ToPreactOptions<E extends EventMap = EventMap> {\n /** e.g. `{ onChange: 'number-input:change' }` */\n events?:E\n}\n\ntype AttrValue = string | number | boolean | null | undefined\n\n/** Host attributes passed through to the host tag. */\nexport interface PassthroughProps {\n class?:string\n id?:string\n [aria:`aria-${string}`]:AttrValue\n [data:`data-${string}`]:AttrValue\n}\n\n/** The declared props of an element class, all optional. */\nexport type DeclaredProps<C> =\n C extends { renderParts?:(props:infer P, ...a:any[]) => any } ?\n Partial<P> :\n never\n\n/**\n * Props of the Preact component `toPreact` returns: the declared\n * props, one callback per mapped event, passthrough host attributes,\n * and no children.\n */\nexport type PreactProps<C, E extends EventMap = Record<never, never>> =\n DeclaredProps<C> &\n { [K in keyof E]?:(ev:CustomEvent) => void } &\n PassthroughProps &\n { children?:never }\n\nexport type PreactComponent<C, E extends EventMap> =\n FunctionComponent<PreactProps<C, E>>\n\n/** Props split by where they go on the host. */\nexport interface SplitProps {\n /** declared props, by name */\n own:Record<string, unknown>\n /** handlers, by DOM event name */\n on:Record<string, unknown>\n /** passthrough host attributes */\n rest:Record<string, unknown>\n}\n\n/**\n * Split adapter props into declared props, event handlers (keyed by DOM\n * event name) and passthrough attributes. Throws, naming the tag, when\n * children are passed.\n */\nexport function splitProps (\n El:PreactElementClass,\n events:EventMap,\n props:Record<string, unknown>\n):SplitProps {\n if (props.children !== undefined) {\n throw new Error(`microtags/preact: <${El.TAG}> takes no children`)\n }\n const own:Record<string, unknown> = {}\n const on:Record<string, unknown> = {}\n const rest:Record<string, unknown> = {}\n for (const k in props) {\n if (k === 'children') continue\n if (El.props.includes(k)) own[k] = props[k]\n else if (Object.hasOwn(events, k)) on[events[k]] = props[k]\n else rest[k] = props[k]\n }\n return { own, on, rest }\n}\n"],
|
|
5
|
+
"mappings": "+EAKA,OAAS,KAAAA,MAAqB,SAC9B,OAAS,UAAAC,MAAc,eCmEhB,SAASC,EACZC,EACAC,EACAC,EACS,CACT,GAAIA,EAAM,WAAa,OACnB,MAAM,IAAI,MAAM,sBAAsBF,EAAG,GAAG,qBAAqB,EAErE,IAAMG,EAA8B,CAAC,EAC/BC,EAA6B,CAAC,EAC9BC,EAA+B,CAAC,EACtC,QAAWC,KAAKJ,EACRI,IAAM,aACNN,EAAG,MAAM,SAASM,CAAC,EAAGH,EAAIG,CAAC,EAAIJ,EAAMI,CAAC,EACjC,OAAO,OAAOL,EAAQK,CAAC,EAAGF,EAAGH,EAAOK,CAAC,CAAC,EAAIJ,EAAMI,CAAC,EACrDD,EAAKC,CAAC,EAAIJ,EAAMI,CAAC,GAE1B,MAAO,CAAE,IAAAH,EAAK,GAAAC,EAAI,KAAAC,CAAK,CAC3B,CAlBgBE,EAAAR,EAAA,cDpCT,SAASS,EAGbC,EAAMC,EAAmD,CACxD,IAAMC,EAAkBD,GAAS,QAAU,CAAC,EAC5C,OAAQE,GAA6C,CACjD,GAAM,CAAE,IAAAC,EAAK,GAAAC,EAAI,KAAAC,CAAK,EAAIC,EAAWP,EAAIE,EAAQC,CAAK,EAChDK,EAAIC,EAAc,CAAE,KAAM,GAAO,KAAM,EAAG,CAAC,EAAE,QAC7CC,EAAiC,CAAE,GAAGJ,EAAM,GAAGF,CAAI,EACzD,QAAWO,KAAKN,EAAIK,EAAO,KAAOC,CAAC,EAAIN,EAAGM,CAAC,EAK3C,OAAAD,EAAO,wBAA0BF,EAAE,QAAU,CACzC,IAAI,QAAU,CACV,GAAI,CAACA,EAAE,MAAQR,EAAG,YAAa,CAC3B,IAAMY,EAA+B,CAAC,EACtC,QAAWD,KAAKL,EACRA,EAAKK,CAAC,GAAK,OAAMC,EAAMD,CAAC,EAAI,OAAOL,EAAKK,CAAC,CAAC,GAElDH,EAAE,KAAOR,EAAG,YAAYI,EAAK,CAAE,MAAOQ,CAAM,CAAC,EAAE,IACnD,CACA,OAAOJ,EAAE,IACb,CACJ,EAIAE,EAAO,IAAOG,GAAoC,CAC9C,GAAKA,EACL,CAAAL,EAAE,KAAO,GACT,QAAWG,KAAKP,EAAK,CACjB,IAAMU,EAAIV,EAAIO,CAAC,EACX,OAAOG,GAAM,YAAcD,EAAGF,CAAC,IAAMG,IAAGD,EAAGF,CAAC,EAAIG,EACxD,EACJ,EACOC,EAAEf,EAAG,IAAKU,CAAM,CAC3B,CACJ,CAvCgBM,EAAAjB,EAAA",
|
|
6
|
+
"names": ["h", "useRef", "splitProps", "El", "events", "props", "own", "on", "rest", "k", "__name", "toPreact", "El", "options", "events", "props", "own", "on", "rest", "splitProps", "s", "useRef", "vprops", "k", "extra", "el", "v", "h", "__name"]
|
|
7
|
+
}
|
package/dist/preact.cjs
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/preact.ts
|
|
22
|
+
var preact_exports = {};
|
|
23
|
+
__export(preact_exports, {
|
|
24
|
+
toPreact: () => toPreact
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(preact_exports);
|
|
27
|
+
var import_preact = require("preact");
|
|
28
|
+
|
|
29
|
+
// src/render-support.ts
|
|
30
|
+
var _esc = {
|
|
31
|
+
"&": "&",
|
|
32
|
+
'"': """,
|
|
33
|
+
"'": "'",
|
|
34
|
+
"<": "<",
|
|
35
|
+
">": ">"
|
|
36
|
+
};
|
|
37
|
+
function _escAttr(s) {
|
|
38
|
+
return s.replace(/[&"'<>]/g, (c) => _esc[c]);
|
|
39
|
+
}
|
|
40
|
+
__name(_escAttr, "_escAttr");
|
|
41
|
+
var _attrName = /^[a-z_:][-\w:.]*$/i;
|
|
42
|
+
function _serialize(m, v) {
|
|
43
|
+
if (m.kind === "prop-only" || v == null) return null;
|
|
44
|
+
if (m.kind === "boolean") return v === true ? "" : null;
|
|
45
|
+
if (m.kind === "json") return JSON.stringify(v);
|
|
46
|
+
return String(v);
|
|
47
|
+
}
|
|
48
|
+
__name(_serialize, "_serialize");
|
|
49
|
+
function _attr(k, v) {
|
|
50
|
+
return v === "" ? ` ${k}` : ` ${k}="${_escAttr(v)}"`;
|
|
51
|
+
}
|
|
52
|
+
__name(_attr, "_attr");
|
|
53
|
+
function renderParts(rec, props, options) {
|
|
54
|
+
const extra = options?.attrs ?? {};
|
|
55
|
+
const html = String(rec.f({
|
|
56
|
+
props,
|
|
57
|
+
refs: rec.r,
|
|
58
|
+
TAG: rec.t,
|
|
59
|
+
children: options?.children ?? "",
|
|
60
|
+
attrs: extra
|
|
61
|
+
}));
|
|
62
|
+
const attrs = /* @__PURE__ */ Object.create(null);
|
|
63
|
+
for (const k in rec.m) {
|
|
64
|
+
const s = k in props ? _serialize(rec.m[k], props[k]) : null;
|
|
65
|
+
if (s !== null) attrs[k] = s;
|
|
66
|
+
}
|
|
67
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
68
|
+
if (_attrName.test(k)) attrs[k] ??= v;
|
|
69
|
+
}
|
|
70
|
+
return { tag: rec.t, attrs, html };
|
|
71
|
+
}
|
|
72
|
+
__name(renderParts, "renderParts");
|
|
73
|
+
function renderHost(rec, props, options) {
|
|
74
|
+
const { tag, attrs, html } = renderParts(rec, props, options);
|
|
75
|
+
let a = "";
|
|
76
|
+
for (const k in attrs) a += _attr(k, attrs[k]);
|
|
77
|
+
return `<${tag}${a}>${html}</${tag}>`;
|
|
78
|
+
}
|
|
79
|
+
__name(renderHost, "renderHost");
|
|
80
|
+
function register() {
|
|
81
|
+
const g = globalThis;
|
|
82
|
+
g[/* @__PURE__ */ Symbol.for("microtags.render")] = renderHost;
|
|
83
|
+
g[/* @__PURE__ */ Symbol.for("microtags.renderParts")] = renderParts;
|
|
84
|
+
}
|
|
85
|
+
__name(register, "register");
|
|
86
|
+
register();
|
|
87
|
+
|
|
88
|
+
// src/preact-shared.ts
|
|
89
|
+
function splitProps(El, events, props) {
|
|
90
|
+
if (props.children !== void 0) {
|
|
91
|
+
throw new Error(`microtags/preact: <${El.TAG}> takes no children`);
|
|
92
|
+
}
|
|
93
|
+
const own = {};
|
|
94
|
+
const on = {};
|
|
95
|
+
const rest = {};
|
|
96
|
+
for (const k in props) {
|
|
97
|
+
if (k === "children") continue;
|
|
98
|
+
if (El.props.includes(k)) own[k] = props[k];
|
|
99
|
+
else if (Object.hasOwn(events, k)) on[events[k]] = props[k];
|
|
100
|
+
else rest[k] = props[k];
|
|
101
|
+
}
|
|
102
|
+
return { own, on, rest };
|
|
103
|
+
}
|
|
104
|
+
__name(splitProps, "splitProps");
|
|
105
|
+
|
|
106
|
+
// src/preact.ts
|
|
107
|
+
function toPreact(El, options) {
|
|
108
|
+
const events = options?.events ?? {};
|
|
109
|
+
return (props) => {
|
|
110
|
+
const { own, rest } = splitProps(El, events, props);
|
|
111
|
+
if (!El.renderParts) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
`microtags/preact: <${El.TAG}> has no render link. On the server, import the variant of this component that keeps its render link.`
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
const extra = {};
|
|
117
|
+
for (const k in rest) {
|
|
118
|
+
if (rest[k] != null) extra[k] = String(rest[k]);
|
|
119
|
+
}
|
|
120
|
+
const { tag, attrs, html } = El.renderParts(own, { attrs: extra });
|
|
121
|
+
const vprops = {};
|
|
122
|
+
for (const k in attrs) vprops[k] = attrs[k] === "" ? true : attrs[k];
|
|
123
|
+
vprops.dangerouslySetInnerHTML = { __html: html };
|
|
124
|
+
return (0, import_preact.h)(tag, vprops);
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
__name(toPreact, "toPreact");
|
|
128
|
+
//# sourceMappingURL=preact.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/preact.ts", "../src/render-support.ts", "../src/preact-shared.ts"],
|
|
4
|
+
"sourcesContent": ["// `microtags/preact`, default (Node and SSR) build. Renders the host\n// tag with its attributes and inner HTML from the component's render\n// parts, so `renderToString` matches the `render` static. Imports\n// render support, as the build transform does for a kept render link\n// (ADR-009). See ADR-010.\nimport { h, type VNode } from 'preact'\nimport './render-support.js'\nimport {\n splitProps,\n type EventMap,\n type PreactComponent,\n type PreactElementClass,\n type ToPreactOptions,\n} from './preact-shared.js'\n\nexport type {\n DeclaredProps,\n EventMap,\n PassthroughProps,\n PreactComponent,\n PreactElementClass,\n PreactProps,\n ToPreactOptions,\n} from './preact-shared.js'\n\n/**\n * Wrap a microtags element class as a Preact component. Preact owns the\n * host and its attributes; the element owns the host's children.\n */\nexport function toPreact<\n C extends PreactElementClass,\n E extends EventMap = Record<never, never>,\n> (El:C, options?:ToPreactOptions<E>):PreactComponent<C, E> {\n const events:EventMap = options?.events ?? {}\n return (props:Record<string, unknown>):VNode<any> => {\n const { own, rest } = splitProps(El, events, props)\n if (!El.renderParts) {\n throw new Error(\n `microtags/preact: <${El.TAG}> has no render link. On ` +\n 'the server, import the variant of this component that ' +\n 'keeps its render link.'\n )\n }\n const extra:Record<string, string> = {}\n for (const k in rest) {\n if (rest[k] != null) extra[k] = String(rest[k])\n }\n const { tag, attrs, html } = El.renderParts(own, { attrs: extra })\n const vprops:Record<string, unknown> = {}\n for (const k in attrs) vprops[k] = attrs[k] === '' ? true : attrs[k]\n vprops.dangerouslySetInnerHTML = { __html: html }\n return h(tag, vprops)\n }\n}\n", "// Server render support: the host-tag builder, prop serializers and\n// attribute escaping. Importing this module registers `renderHost`\n// under a registry symbol on `globalThis`, where a component's `render`\n// static finds it. Core never imports this module, so a bundle with\n// every render link stripped leaves it out. See ADR-009.\nimport type {\n PropMeta,\n RenderParts,\n RenderRecord,\n} from './builders.js'\n\nconst _esc:Record<string, string> = {\n '&': '&',\n '\"': '"',\n \"'\": ''',\n '<': '<',\n '>': '>',\n}\nfunction _escAttr (s:string):string {\n return s.replace(/[&\"'<>]/g, c => _esc[c])\n}\n\n// HTML attribute name grammar: a letter, `_` or `:`, then letters,\n// digits, `-`, `_`, `:` or `.`. Extra attrs may come from data.\nconst _attrName = /^[a-z_:][-\\w:.]*$/i\n\n// The kind is decided by core, so no coercer is compared here and any\n// copy of this module serves any copy of core.\nfunction _serialize (m:PropMeta, v:unknown):string | null {\n if (m.kind === 'prop-only' || v == null) return null\n if (m.kind === 'boolean') return v === true ? '' : null\n if (m.kind === 'json') return JSON.stringify(v)\n return String(v)\n}\n\nfunction _attr (k:string, v:string):string {\n return v === '' ? ` ${k}` : ` ${k}=\"${_escAttr(v)}\"`\n}\n\n/**\n * Render a component as parts: the host tag name, its serialized\n * (unescaped) attributes, declared props first, and the inner HTML.\n * `attrs` has no prototype, so a name like `__proto__` from data is a\n * plain key. A declared prop keeps its value over an extra attr of the\n * same name, as an HTML parser keeps the first of a duplicate.\n */\nexport function renderParts (\n rec:RenderRecord,\n props:Record<string, unknown>,\n options?:{ children?:string; attrs?:Record<string, string> }\n):RenderParts {\n const extra = options?.attrs ?? {}\n const html = String(rec.f({\n props,\n refs: rec.r,\n TAG: rec.t,\n children: options?.children ?? '',\n attrs: extra,\n }))\n const attrs:Record<string, string> = Object.create(null)\n for (const k in rec.m) {\n const s = k in props ? _serialize(rec.m[k], props[k]) : null\n if (s !== null) attrs[k] = s\n }\n for (const [k, v] of Object.entries(extra)) {\n if (_attrName.test(k)) attrs[k] ??= v\n }\n return { tag: rec.t, attrs, html }\n}\n\n/** Render a component's host tag around the output of its render link. */\nexport function renderHost (\n rec:RenderRecord,\n props:Record<string, unknown>,\n options?:{ children?:string; attrs?:Record<string, string> }\n):string {\n const { tag, attrs, html } = renderParts(rec, props, options)\n let a = ''\n for (const k in attrs) a += _attr(k, attrs[k])\n return `<${tag}${a}>${html}</${tag}>`\n}\n\n/**\n * Store `renderHost` and `renderParts` where the `render` and\n * `renderParts` statics look them up.\n */\nexport function register ():void {\n const g = globalThis as any\n g[Symbol.for('microtags.render')] = renderHost\n g[Symbol.for('microtags.renderParts')] = renderParts\n}\n\nregister()\n", "// Types and prop mapping shared by both builds of `microtags/preact`\n// (the default server build and the browser build). Never imports\n// render support. See ADR-010.\nimport type { FunctionComponent } from 'preact'\nimport type { RenderParts } from './builders.js'\n\n/**\n * The part of a microtags element class the adapter reads. Any class\n * from `setup` fits; `renderParts` is absent at runtime when the class\n * has no render link.\n */\nexport interface PreactElementClass<P = any> {\n readonly TAG:string\n readonly props:readonly string[]\n readonly renderParts?:(\n props:P,\n options?:{ children?:string; attrs?:Record<string, string> }\n ) => RenderParts\n}\n\n/** Map from callback prop name to DOM event name. */\nexport type EventMap = Record<string, string>\n\nexport interface ToPreactOptions<E extends EventMap = EventMap> {\n /** e.g. `{ onChange: 'number-input:change' }` */\n events?:E\n}\n\ntype AttrValue = string | number | boolean | null | undefined\n\n/** Host attributes passed through to the host tag. */\nexport interface PassthroughProps {\n class?:string\n id?:string\n [aria:`aria-${string}`]:AttrValue\n [data:`data-${string}`]:AttrValue\n}\n\n/** The declared props of an element class, all optional. */\nexport type DeclaredProps<C> =\n C extends { renderParts?:(props:infer P, ...a:any[]) => any } ?\n Partial<P> :\n never\n\n/**\n * Props of the Preact component `toPreact` returns: the declared\n * props, one callback per mapped event, passthrough host attributes,\n * and no children.\n */\nexport type PreactProps<C, E extends EventMap = Record<never, never>> =\n DeclaredProps<C> &\n { [K in keyof E]?:(ev:CustomEvent) => void } &\n PassthroughProps &\n { children?:never }\n\nexport type PreactComponent<C, E extends EventMap> =\n FunctionComponent<PreactProps<C, E>>\n\n/** Props split by where they go on the host. */\nexport interface SplitProps {\n /** declared props, by name */\n own:Record<string, unknown>\n /** handlers, by DOM event name */\n on:Record<string, unknown>\n /** passthrough host attributes */\n rest:Record<string, unknown>\n}\n\n/**\n * Split adapter props into declared props, event handlers (keyed by DOM\n * event name) and passthrough attributes. Throws, naming the tag, when\n * children are passed.\n */\nexport function splitProps (\n El:PreactElementClass,\n events:EventMap,\n props:Record<string, unknown>\n):SplitProps {\n if (props.children !== undefined) {\n throw new Error(`microtags/preact: <${El.TAG}> takes no children`)\n }\n const own:Record<string, unknown> = {}\n const on:Record<string, unknown> = {}\n const rest:Record<string, unknown> = {}\n for (const k in props) {\n if (k === 'children') continue\n if (El.props.includes(k)) own[k] = props[k]\n else if (Object.hasOwn(events, k)) on[events[k]] = props[k]\n else rest[k] = props[k]\n }\n return { own, on, rest }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,oBAA8B;;;ACM9B,IAAM,OAA8B;AAAA,EAChC,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACT;AACA,SAAS,SAAU,GAAi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MAAM,CAAC;AACjE,UAAM,SAAiC,CAAC;AACxC,eAAW,KAAK,MAAO,QAAO,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,MAAM,CAAC;AACnE,WAAO,0BAA0B,EAAE,QAAQ,KAAK;AAChD,eAAO,iBAAE,KAAK,MAAM;AAAA,EACxB;AACJ;AAxBgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/preact.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './render-support.js';
|
|
2
|
+
import { type EventMap, type PreactComponent, type PreactElementClass, type ToPreactOptions } from './preact-shared.js';
|
|
3
|
+
export type { DeclaredProps, EventMap, PassthroughProps, PreactComponent, PreactElementClass, PreactProps, ToPreactOptions, } from './preact-shared.js';
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a microtags element class as a Preact component. Preact owns the
|
|
6
|
+
* host and its attributes; the element owns the host's children.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toPreact<C extends PreactElementClass, E extends EventMap = Record<never, never>>(El: C, options?: ToPreactOptions<E>): PreactComponent<C, E>;
|
|
9
|
+
//# sourceMappingURL=preact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preact.d.ts","sourceRoot":"","sources":["../src/preact.ts"],"names":[],"mappings":"AAMA,OAAO,qBAAqB,CAAA;AAC5B,OAAO,EAEH,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACvB,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EACR,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,eAAe,GAClB,MAAM,oBAAoB,CAAA;AAE3B;;;GAGG;AACH,wBAAgB,QAAQ,CACpB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,QAAQ,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC1C,EAAE,EAAC,CAAC,EAAE,OAAO,CAAC,EAAC,eAAe,CAAC,CAAC,CAAC,GAAE,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAqB1D"}
|
package/dist/preact.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
splitProps
|
|
3
|
+
} from "./chunk-LS4L5QRD.js";
|
|
4
|
+
import "./chunk-RKWPTT6P.js";
|
|
5
|
+
import {
|
|
6
|
+
__name
|
|
7
|
+
} from "./chunk-7QVYU63E.js";
|
|
8
|
+
|
|
9
|
+
// src/preact.ts
|
|
10
|
+
import { h } from "preact";
|
|
11
|
+
function toPreact(El, options) {
|
|
12
|
+
const events = options?.events ?? {};
|
|
13
|
+
return (props) => {
|
|
14
|
+
const { own, rest } = splitProps(El, events, props);
|
|
15
|
+
if (!El.renderParts) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`microtags/preact: <${El.TAG}> has no render link. On the server, import the variant of this component that keeps its render link.`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
const extra = {};
|
|
21
|
+
for (const k in rest) {
|
|
22
|
+
if (rest[k] != null) extra[k] = String(rest[k]);
|
|
23
|
+
}
|
|
24
|
+
const { tag, attrs, html } = El.renderParts(own, { attrs: extra });
|
|
25
|
+
const vprops = {};
|
|
26
|
+
for (const k in attrs) vprops[k] = attrs[k] === "" ? true : attrs[k];
|
|
27
|
+
vprops.dangerouslySetInnerHTML = { __html: html };
|
|
28
|
+
return h(tag, vprops);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
__name(toPreact, "toPreact");
|
|
32
|
+
export {
|
|
33
|
+
toPreact
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=preact.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/preact.ts"],
|
|
4
|
+
"sourcesContent": ["// `microtags/preact`, default (Node and SSR) build. Renders the host\n// tag with its attributes and inner HTML from the component's render\n// parts, so `renderToString` matches the `render` static. Imports\n// render support, as the build transform does for a kept render link\n// (ADR-009). See ADR-010.\nimport { h, type VNode } from 'preact'\nimport './render-support.js'\nimport {\n splitProps,\n type EventMap,\n type PreactComponent,\n type PreactElementClass,\n type ToPreactOptions,\n} from './preact-shared.js'\n\nexport type {\n DeclaredProps,\n EventMap,\n PassthroughProps,\n PreactComponent,\n PreactElementClass,\n PreactProps,\n ToPreactOptions,\n} from './preact-shared.js'\n\n/**\n * Wrap a microtags element class as a Preact component. Preact owns the\n * host and its attributes; the element owns the host's children.\n */\nexport function toPreact<\n C extends PreactElementClass,\n E extends EventMap = Record<never, never>,\n> (El:C, options?:ToPreactOptions<E>):PreactComponent<C, E> {\n const events:EventMap = options?.events ?? {}\n return (props:Record<string, unknown>):VNode<any> => {\n const { own, rest } = splitProps(El, events, props)\n if (!El.renderParts) {\n throw new Error(\n `microtags/preact: <${El.TAG}> has no render link. On ` +\n 'the server, import the variant of this component that ' +\n 'keeps its render link.'\n )\n }\n const extra:Record<string, string> = {}\n for (const k in rest) {\n if (rest[k] != null) extra[k] = String(rest[k])\n }\n const { tag, attrs, html } = El.renderParts(own, { attrs: extra })\n const vprops:Record<string, unknown> = {}\n for (const k in attrs) vprops[k] = attrs[k] === '' ? true : attrs[k]\n vprops.dangerouslySetInnerHTML = { __html: html }\n return h(tag, vprops)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAKA,SAAS,SAAqB;AAwBvB,SAAS,SAGb,IAAM,SAAmD;AACxD,QAAM,SAAkB,SAAS,UAAU,CAAC;AAC5C,SAAO,CAAC,UAA6C;AACjD,UAAM,EAAE,KAAK,KAAK,IAAI,WAAW,IAAI,QAAQ,KAAK;AAClD,QAAI,CAAC,GAAG,aAAa;AACjB,YAAM,IAAI;AAAA,QACN,sBAAsB,GAAG,GAAG;AAAA,MAGhC;AAAA,IACJ;AACA,UAAM,QAA+B,CAAC;AACtC,eAAW,KAAK,MAAM;AAClB,UAAI,KAAK,CAAC,KAAK,KAAM,OAAM,CAAC,IAAI,OAAO,KAAK,CAAC,CAAC;AAAA,IAClD;AACA,UAAM,EAAE,KAAK,OAAO,KAAK,IAAI,GAAG,YAAY,KAAK,EAAE,OAAO,MAAM,CAAC;AACjE,UAAM,SAAiC,CAAC;AACxC,eAAW,KAAK,MAAO,QAAO,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,OAAO,MAAM,CAAC;AACnE,WAAO,0BAA0B,EAAE,QAAQ,KAAK;AAChD,WAAO,EAAE,KAAK,MAAM;AAAA,EACxB;AACJ;AAxBgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/render-support.ts
|
|
22
|
+
var render_support_exports = {};
|
|
23
|
+
__export(render_support_exports, {
|
|
24
|
+
register: () => register,
|
|
25
|
+
renderHost: () => renderHost,
|
|
26
|
+
renderParts: () => renderParts
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(render_support_exports);
|
|
29
|
+
var _esc = {
|
|
30
|
+
"&": "&",
|
|
31
|
+
'"': """,
|
|
32
|
+
"'": "'",
|
|
33
|
+
"<": "<",
|
|
34
|
+
">": ">"
|
|
35
|
+
};
|
|
36
|
+
function _escAttr(s) {
|
|
37
|
+
return s.replace(/[&"'<>]/g, (c) => _esc[c]);
|
|
38
|
+
}
|
|
39
|
+
__name(_escAttr, "_escAttr");
|
|
40
|
+
var _attrName = /^[a-z_:][-\w:.]*$/i;
|
|
41
|
+
function _serialize(m, v) {
|
|
42
|
+
if (m.kind === "prop-only" || v == null) return null;
|
|
43
|
+
if (m.kind === "boolean") return v === true ? "" : null;
|
|
44
|
+
if (m.kind === "json") return JSON.stringify(v);
|
|
45
|
+
return String(v);
|
|
46
|
+
}
|
|
47
|
+
__name(_serialize, "_serialize");
|
|
48
|
+
function _attr(k, v) {
|
|
49
|
+
return v === "" ? ` ${k}` : ` ${k}="${_escAttr(v)}"`;
|
|
50
|
+
}
|
|
51
|
+
__name(_attr, "_attr");
|
|
52
|
+
function renderParts(rec, props, options) {
|
|
53
|
+
const extra = options?.attrs ?? {};
|
|
54
|
+
const html = String(rec.f({
|
|
55
|
+
props,
|
|
56
|
+
refs: rec.r,
|
|
57
|
+
TAG: rec.t,
|
|
58
|
+
children: options?.children ?? "",
|
|
59
|
+
attrs: extra
|
|
60
|
+
}));
|
|
61
|
+
const attrs = /* @__PURE__ */ Object.create(null);
|
|
62
|
+
for (const k in rec.m) {
|
|
63
|
+
const s = k in props ? _serialize(rec.m[k], props[k]) : null;
|
|
64
|
+
if (s !== null) attrs[k] = s;
|
|
65
|
+
}
|
|
66
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
67
|
+
if (_attrName.test(k)) attrs[k] ??= v;
|
|
68
|
+
}
|
|
69
|
+
return { tag: rec.t, attrs, html };
|
|
70
|
+
}
|
|
71
|
+
__name(renderParts, "renderParts");
|
|
72
|
+
function renderHost(rec, props, options) {
|
|
73
|
+
const { tag, attrs, html } = renderParts(rec, props, options);
|
|
74
|
+
let a = "";
|
|
75
|
+
for (const k in attrs) a += _attr(k, attrs[k]);
|
|
76
|
+
return `<${tag}${a}>${html}</${tag}>`;
|
|
77
|
+
}
|
|
78
|
+
__name(renderHost, "renderHost");
|
|
79
|
+
function register() {
|
|
80
|
+
const g = globalThis;
|
|
81
|
+
g[/* @__PURE__ */ Symbol.for("microtags.render")] = renderHost;
|
|
82
|
+
g[/* @__PURE__ */ Symbol.for("microtags.renderParts")] = renderParts;
|
|
83
|
+
}
|
|
84
|
+
__name(register, "register");
|
|
85
|
+
register();
|
|
86
|
+
//# sourceMappingURL=render-support.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/render-support.ts"],
|
|
4
|
+
"sourcesContent": ["// Server render support: the host-tag builder, prop serializers and\n// attribute escaping. Importing this module registers `renderHost`\n// under a registry symbol on `globalThis`, where a component's `render`\n// static finds it. Core never imports this module, so a bundle with\n// every render link stripped leaves it out. See ADR-009.\nimport type {\n PropMeta,\n RenderParts,\n RenderRecord,\n} from './builders.js'\n\nconst _esc:Record<string, string> = {\n '&': '&',\n '\"': '"',\n \"'\": ''',\n '<': '<',\n '>': '>',\n}\nfunction _escAttr (s:string):string {\n return s.replace(/[&\"'<>]/g, c => _esc[c])\n}\n\n// HTML attribute name grammar: a letter, `_` or `:`, then letters,\n// digits, `-`, `_`, `:` or `.`. Extra attrs may come from data.\nconst _attrName = /^[a-z_:][-\\w:.]*$/i\n\n// The kind is decided by core, so no coercer is compared here and any\n// copy of this module serves any copy of core.\nfunction _serialize (m:PropMeta, v:unknown):string | null {\n if (m.kind === 'prop-only' || v == null) return null\n if (m.kind === 'boolean') return v === true ? '' : null\n if (m.kind === 'json') return JSON.stringify(v)\n return String(v)\n}\n\nfunction _attr (k:string, v:string):string {\n return v === '' ? ` ${k}` : ` ${k}=\"${_escAttr(v)}\"`\n}\n\n/**\n * Render a component as parts: the host tag name, its serialized\n * (unescaped) attributes, declared props first, and the inner HTML.\n * `attrs` has no prototype, so a name like `__proto__` from data is a\n * plain key. A declared prop keeps its value over an extra attr of the\n * same name, as an HTML parser keeps the first of a duplicate.\n */\nexport function renderParts (\n rec:RenderRecord,\n props:Record<string, unknown>,\n options?:{ children?:string; attrs?:Record<string, string> }\n):RenderParts {\n const extra = options?.attrs ?? {}\n const html = String(rec.f({\n props,\n refs: rec.r,\n TAG: rec.t,\n children: options?.children ?? '',\n attrs: extra,\n }))\n const attrs:Record<string, string> = Object.create(null)\n for (const k in rec.m) {\n const s = k in props ? _serialize(rec.m[k], props[k]) : null\n if (s !== null) attrs[k] = s\n }\n for (const [k, v] of Object.entries(extra)) {\n if (_attrName.test(k)) attrs[k] ??= v\n }\n return { tag: rec.t, attrs, html }\n}\n\n/** Render a component's host tag around the output of its render link. */\nexport function renderHost (\n rec:RenderRecord,\n props:Record<string, unknown>,\n options?:{ children?:string; attrs?:Record<string, string> }\n):string {\n const { tag, attrs, html } = renderParts(rec, props, options)\n let a = ''\n for (const k in attrs) a += _attr(k, attrs[k])\n return `<${tag}${a}>${html}</${tag}>`\n}\n\n/**\n * Store `renderHost` and `renderParts` where the `render` and\n * `renderParts` statics look them up.\n */\nexport function register ():void {\n const g = globalThis as any\n g[Symbol.for('microtags.render')] = renderHost\n g[Symbol.for('microtags.renderParts')] = renderParts\n}\n\nregister()\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA,IAAM,OAA8B;AAAA,EAChC,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACT;AACA,SAAS,SAAU,GAAiB;AAChC,SAAO,EAAE,QAAQ,YAAY,OAAK,KAAK,CA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IAAI,IAAI,KAAK,GAAG;AACtC;AATgB;AAeT,SAAS,WAAiB;AAC7B,QAAM,IAAI;AACV,IAAE,uBAAO,IAAI,kBAAkB,CAAC,IAAI;AACpC,IAAE,uBAAO,IAAI,uBAAuB,CAAC,IAAI;AAC7C;AAJgB;AAMhB,SAAS;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RenderParts, RenderRecord } from './builders.js';
|
|
2
|
+
/**
|
|
3
|
+
* Render a component as parts: the host tag name, its serialized
|
|
4
|
+
* (unescaped) attributes, declared props first, and the inner HTML.
|
|
5
|
+
* `attrs` has no prototype, so a name like `__proto__` from data is a
|
|
6
|
+
* plain key. A declared prop keeps its value over an extra attr of the
|
|
7
|
+
* same name, as an HTML parser keeps the first of a duplicate.
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderParts(rec: RenderRecord, props: Record<string, unknown>, options?: {
|
|
10
|
+
children?: string;
|
|
11
|
+
attrs?: Record<string, string>;
|
|
12
|
+
}): RenderParts;
|
|
13
|
+
/** Render a component's host tag around the output of its render link. */
|
|
14
|
+
export declare function renderHost(rec: RenderRecord, props: Record<string, unknown>, options?: {
|
|
15
|
+
children?: string;
|
|
16
|
+
attrs?: Record<string, string>;
|
|
17
|
+
}): string;
|
|
18
|
+
/**
|
|
19
|
+
* Store `renderHost` and `renderParts` where the `render` and
|
|
20
|
+
* `renderParts` statics look them up.
|
|
21
|
+
*/
|
|
22
|
+
export declare function register(): void;
|
|
23
|
+
//# sourceMappingURL=render-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-support.d.ts","sourceRoot":"","sources":["../src/render-support.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAER,WAAW,EACX,YAAY,EACf,MAAM,eAAe,CAAA;AA8BtB;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,GAAG,EAAC,YAAY,EAChB,KAAK,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAC;IAAE,QAAQ,CAAC,EAAC,MAAM,CAAC;IAAC,KAAK,CAAC,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9D,WAAW,CAkBZ;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CACtB,GAAG,EAAC,YAAY,EAChB,KAAK,EAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAC;IAAE,QAAQ,CAAC,EAAC,MAAM,CAAC;IAAC,KAAK,CAAC,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GAC9D,MAAM,CAKP;AAED;;;GAGG;AACH,wBAAgB,QAAQ,IAAI,IAAI,CAI/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var a=Object.defineProperty;var i=(t,r)=>a(t,"name",{value:r,configurable:!0});var d={"&":"&",'"':""","'":"'","<":"<",">":">"};function u(t){return t.replace(/[&"'<>]/g,r=>d[r])}i(u,"_escAttr");var f=/^[a-z_:][-\w:.]*$/i;function R(t,r){return t.kind==="prop-only"||r==null?null:t.kind==="boolean"?r===!0?"":null:t.kind==="json"?JSON.stringify(r):String(r)}i(R,"_serialize");function m(t,r){return r===""?` ${t}`:` ${t}="${u(r)}"`}i(m,"_attr");function l(t,r,c){let s=c?.attrs??{},g=String(t.f({props:r,refs:t.r,TAG:t.t,children:c?.children??"",attrs:s})),o=Object.create(null);for(let n in t.m){let e=n in r?R(t.m[n],r[n]):null;e!==null&&(o[n]=e)}for(let[n,e]of Object.entries(s))f.test(n)&&(o[n]??=e);return{tag:t.t,attrs:o,html:g}}i(l,"renderParts");function k(t,r,c){let{tag:s,attrs:g,html:o}=l(t,r,c),n="";for(let e in g)n+=m(e,g[e]);return`<${s}${n}>${o}</${s}>`}i(k,"renderHost");function $(){let t=globalThis;t[Symbol.for("microtags.render")]=k,t[Symbol.for("microtags.renderParts")]=l}i($,"register");$();export{$ as register,k as renderHost,l as renderParts};
|
|
2
|
+
//# sourceMappingURL=render-support.min.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/render-support.ts"],
|
|
4
|
+
"sourcesContent": ["// Server render support: the host-tag builder, prop serializers and\n// attribute escaping. Importing this module registers `renderHost`\n// under a registry symbol on `globalThis`, where a component's `render`\n// static finds it. Core never imports this module, so a bundle with\n// every render link stripped leaves it out. See ADR-009.\nimport type {\n PropMeta,\n RenderParts,\n RenderRecord,\n} from './builders.js'\n\nconst _esc:Record<string, string> = {\n '&': '&',\n '\"': '"',\n \"'\": ''',\n '<': '<',\n '>': '>',\n}\nfunction _escAttr (s:string):string {\n return s.replace(/[&\"'<>]/g, c => _esc[c])\n}\n\n// HTML attribute name grammar: a letter, `_` or `:`, then letters,\n// digits, `-`, `_`, `:` or `.`. Extra attrs may come from data.\nconst _attrName = /^[a-z_:][-\\w:.]*$/i\n\n// The kind is decided by core, so no coercer is compared here and any\n// copy of this module serves any copy of core.\nfunction _serialize (m:PropMeta, v:unknown):string | null {\n if (m.kind === 'prop-only' || v == null) return null\n if (m.kind === 'boolean') return v === true ? '' : null\n if (m.kind === 'json') return JSON.stringify(v)\n return String(v)\n}\n\nfunction _attr (k:string, v:string):string {\n return v === '' ? ` ${k}` : ` ${k}=\"${_escAttr(v)}\"`\n}\n\n/**\n * Render a component as parts: the host tag name, its serialized\n * (unescaped) attributes, declared props first, and the inner HTML.\n * `attrs` has no prototype, so a name like `__proto__` from data is a\n * plain key. A declared prop keeps its value over an extra attr of the\n * same name, as an HTML parser keeps the first of a duplicate.\n */\nexport function renderParts (\n rec:RenderRecord,\n props:Record<string, unknown>,\n options?:{ children?:string; attrs?:Record<string, string> }\n):RenderParts {\n const extra = options?.attrs ?? {}\n const html = String(rec.f({\n props,\n refs: rec.r,\n TAG: rec.t,\n children: options?.children ?? '',\n attrs: extra,\n }))\n const attrs:Record<string, string> = Object.create(null)\n for (const k in rec.m) {\n const s = k in props ? _serialize(rec.m[k], props[k]) : null\n if (s !== null) attrs[k] = s\n }\n for (const [k, v] of Object.entries(extra)) {\n if (_attrName.test(k)) attrs[k] ??= v\n }\n return { tag: rec.t, attrs, html }\n}\n\n/** Render a component's host tag around the output of its render link. */\nexport function renderHost (\n rec:RenderRecord,\n props:Record<string, unknown>,\n options?:{ children?:string; attrs?:Record<string, string> }\n):string {\n const { tag, attrs, html } = renderParts(rec, props, options)\n let a = ''\n for (const k in attrs) a += _attr(k, attrs[k])\n return `<${tag}${a}>${html}</${tag}>`\n}\n\n/**\n * Store `renderHost` and `renderParts` where the `render` and\n * `renderParts` statics look them up.\n */\nexport function register ():void {\n const g = globalThis as any\n g[Symbol.for('microtags.render')] = renderHost\n g[Symbol.for('microtags.renderParts')] = renderParts\n}\n\nregister()\n"],
|
|
5
|
+
"mappings": "+EAWA,IAAMA,EAA8B,CAChC,IAAK,QACL,IAAK,SACL,IAAK,QACL,IAAK,OACL,IAAK,MACT,EACA,SAASC,EAAUC,EAAiB,CAChC,OAAOA,EAAE,QAAQ,WAAYC,GAAKH,EAAKG,CAAC,CAAC,CAC7C,CAFSC,EAAAH,EAAA,YAMT,IAAMI,EAAY,qBAIlB,SAASC,EAAYC,EAAYC,EAAyB,CACtD,OAAID,EAAE,OAAS,aAAeC,GAAK,KAAa,KAC5CD,EAAE,OAAS,UAAkBC,IAAM,GAAO,GAAK,KAC/CD,EAAE,OAAS,OAAe,KAAK,UAAUC,CAAC,EACvC,OAAOA,CAAC,CACnB,CALSJ,EAAAE,EAAA,cAOT,SAASG,EAAOC,EAAUF,EAAiB,CACvC,OAAOA,IAAM,GAAK,IAAIE,CAAC,GAAK,IAAIA,CAAC,KAAKT,EAASO,CAAC,CAAC,GACrD,CAFSJ,EAAAK,EAAA,SAWF,SAASE,EACZC,EACAC,EACAC,EACU,CACV,IAAMC,EAAQD,GAAS,OAAS,CAAC,EAC3BE,EAAO,OAAOJ,EAAI,EAAE,CACtB,MAAAC,EACA,KAAMD,EAAI,EACV,IAAKA,EAAI,EACT,SAAUE,GAAS,UAAY,GAC/B,MAAOC,CACX,CAAC,CAAC,EACIE,EAA+B,OAAO,OAAO,IAAI,EACvD,QAAWP,KAAKE,EAAI,EAAG,CACnB,IAAMV,EAAIQ,KAAKG,EAAQP,EAAWM,EAAI,EAAEF,CAAC,EAAGG,EAAMH,CAAC,CAAC,EAAI,KACpDR,IAAM,OAAMe,EAAMP,CAAC,EAAIR,EAC/B,CACA,OAAW,CAACQ,EAAGF,CAAC,IAAK,OAAO,QAAQO,CAAK,EACjCV,EAAU,KAAKK,CAAC,IAAGO,EAAMP,CAAC,IAAMF,GAExC,MAAO,CAAE,IAAKI,EAAI,EAAG,MAAAK,EAAO,KAAAD,CAAK,CACrC,CAtBgBZ,EAAAO,EAAA,eAyBT,SAASO,EACZN,EACAC,EACAC,EACK,CACL,GAAM,CAAE,IAAAK,EAAK,MAAAF,EAAO,KAAAD,CAAK,EAAIL,EAAYC,EAAKC,EAAOC,CAAO,EACxDM,EAAI,GACR,QAAWV,KAAKO,EAAOG,GAAKX,EAAMC,EAAGO,EAAMP,CAAC,CAAC,EAC7C,MAAO,IAAIS,CAAG,GAAGC,CAAC,IAAIJ,CAAI,KAAKG,CAAG,GACtC,CATgBf,EAAAc,EAAA,cAeT,SAASG,GAAiB,CAC7B,IAAMC,EAAI,WACVA,EAAE,OAAO,IAAI,kBAAkB,CAAC,EAAIJ,EACpCI,EAAE,OAAO,IAAI,uBAAuB,CAAC,EAAIX,CAC7C,CAJgBP,EAAAiB,EAAA,YAMhBA,EAAS",
|
|
6
|
+
"names": ["_esc", "_escAttr", "s", "c", "__name", "_attrName", "_serialize", "m", "v", "_attr", "k", "renderParts", "rec", "props", "options", "extra", "html", "attrs", "renderHost", "tag", "a", "register", "g"]
|
|
7
|
+
}
|
package/dist/types.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export type Signal<T> = {
|
|
|
8
8
|
(): T;
|
|
9
9
|
(value: T): void;
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Shallow unwrap of signal-valued properties: each property that is a
|
|
13
|
+
* signal becomes its value type, other properties pass through. Use it
|
|
14
|
+
* to describe the plain data form of a state object.
|
|
15
|
+
*/
|
|
16
|
+
export type Serialized<T> = {
|
|
17
|
+
[K in keyof T]: T[K] extends Signal<infer V> ? V : T[K];
|
|
18
|
+
};
|
|
11
19
|
/** Converts a raw attribute string (or null) to T. */
|
|
12
20
|
export type Coercer<T> = (raw: string | null) => T;
|
|
13
21
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D;;;;GAIG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACpB,IAAG,CAAC,CAAA;IACJ,CAAC,KAAK,EAAC,CAAC,GAAE,IAAI,CAAA;CACjB,CAAA;AAED,sDAAsD;AACtD,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,EAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAA;AAEjD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAC,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAC,CAAC,CAAA;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IACzB,OAAO,CAAC,CAAC,CAAC,GACV,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,GAC5B,gBAAgB,CAAC,CAAC,CAAC,CAAA;AAEzB,8BAA8B;AAC9B,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,G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