@takazudo/zfb 3.2.0 → 4.0.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 +1 @@
1
- {"version":3,"file":"jsx-types.js","sourceRoot":"","sources":["../../src/zudo-react/jsx-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CSSProperties } from \"./style.js\";\nexport type { CSSProperties, CssProperty } from \"./style.js\";\nimport type { Child, Component, Description, Key } from \"./description.js\";\nimport type { Listener, Ref } from \"./index.js\";\nimport type { ReadonlySignal, Signal } from \"./reactive-types.js\";\n\ntype Value<T> = T | ReadonlySignal<T> | undefined;\ntype ScalarAttribute = Value<string | number | boolean | null>;\ntype DimensionAttribute = Value<string | number | null>;\ntype StringAttribute = Value<string | null>;\ntype BooleanAttribute = Value<boolean | null>;\n// The custom-name index must also accept every mapped listener under strict function variance.\ntype AnyListener = Listener<any>;\ntype EventProps<TEl extends Element, TMap extends Record<keyof TMap, Event>> = {\n [K in keyof TMap & string as `on:${K}` | `on:${K}:capture`]?: Listener<\n TMap[K] & { currentTarget: TEl }\n >;\n} & {\n [name: `on:${string}`]: AnyListener | undefined;\n};\ntype DataAria = {\n [name: `data-${string}`]: ScalarAttribute;\n} & {\n [name: `aria-${string}`]: ScalarAttribute;\n};\n\ninterface ReservedProps<T extends Element = Element> {\n children?: Child | undefined;\n key?: Key | undefined;\n ref?: Ref<T> | undefined;\n rawHtml?: Value<string | null>;\n}\n\ninterface CommonAttributes<T extends Element = Element> extends ReservedProps<T> {\n id?: StringAttribute;\n class?: StringAttribute;\n title?: StringAttribute;\n lang?: StringAttribute;\n dir?: StringAttribute;\n slot?: StringAttribute;\n role?: StringAttribute;\n style?: Value<string | CSSProperties | null>;\n hidden?: BooleanAttribute;\n inert?: BooleanAttribute;\n contenteditable?: Value<string | boolean | null>;\n draggable?: Value<string | boolean | null>;\n spellcheck?: Value<string | boolean | null>;\n tabindex?: Value<number | null>;\n accesskey?: StringAttribute;\n translate?: StringAttribute;\n onclick?: string | undefined;\n onload?: string | undefined;\n onerror?: string | undefined;\n}\n\ninterface HtmlBaseAttributes<T extends HTMLElement = HTMLElement> extends CommonAttributes<T> {\n href?: StringAttribute;\n target?: StringAttribute;\n rel?: StringAttribute;\n download?: Value<string | boolean | null>;\n property?: StringAttribute;\n itemprop?: StringAttribute;\n hreflang?: StringAttribute;\n as?: StringAttribute;\n integrity?: StringAttribute;\n async?: BooleanAttribute;\n defer?: BooleanAttribute;\n nonce?: StringAttribute;\n popover?: StringAttribute;\n popovertarget?: StringAttribute;\n popovertargetaction?: StringAttribute;\n srcdoc?: StringAttribute;\n fetchpriority?: StringAttribute;\n inputmode?: StringAttribute;\n autocapitalize?: StringAttribute;\n form?: StringAttribute;\n label?: StringAttribute;\n preload?: StringAttribute;\n playsinline?: BooleanAttribute;\n wrap?: StringAttribute;\n closedby?: StringAttribute;\n src?: StringAttribute;\n alt?: StringAttribute;\n width?: Value<string | number | null>;\n height?: Value<string | number | null>;\n type?: StringAttribute;\n name?: StringAttribute;\n value?: string | number | null | undefined;\n placeholder?: StringAttribute;\n for?: StringAttribute;\n charset?: StringAttribute;\n datetime?: StringAttribute;\n readonly?: BooleanAttribute;\n autofocus?: BooleanAttribute;\n required?: BooleanAttribute;\n disabled?: BooleanAttribute;\n checked?: boolean | null | undefined;\n selected?: BooleanAttribute;\n multiple?: BooleanAttribute;\n reversed?: BooleanAttribute;\n open?: BooleanAttribute;\n controls?: BooleanAttribute;\n muted?: BooleanAttribute;\n loop?: BooleanAttribute;\n autoplay?: BooleanAttribute;\n novalidate?: BooleanAttribute;\n formnovalidate?: BooleanAttribute;\n maxlength?: Value<number | null>;\n minlength?: Value<number | null>;\n min?: StringAttribute;\n max?: StringAttribute;\n step?: StringAttribute;\n start?: Value<string | number | null>;\n pattern?: StringAttribute;\n autocomplete?: StringAttribute;\n accept?: StringAttribute;\n \"accept-charset\"?: StringAttribute;\n \"http-equiv\"?: StringAttribute;\n content?: StringAttribute;\n media?: StringAttribute;\n method?: StringAttribute;\n action?: StringAttribute;\n enctype?: StringAttribute;\n rows?: Value<number | null>;\n cols?: Value<number | null>;\n colspan?: Value<number | null>;\n rowspan?: Value<number | null>;\n scope?: StringAttribute;\n cite?: StringAttribute;\n poster?: StringAttribute;\n loading?: StringAttribute;\n decoding?: StringAttribute;\n sizes?: StringAttribute;\n srcset?: StringAttribute;\n crossorigin?: StringAttribute;\n referrerpolicy?: StringAttribute;\n sandbox?: StringAttribute;\n allow?: StringAttribute;\n allowfullscreen?: BooleanAttribute;\n}\n\nexport type HTMLAttributes<T extends HTMLElement = HTMLElement> = HtmlBaseAttributes<T> &\n DataAria &\n EventProps<T, HTMLElementEventMap>;\ntype RawTextProps<T extends HTMLElement = HTMLElement> = Omit<\n HtmlBaseAttributes<T>,\n \"children\" | \"rawHtml\"\n> &\n DataAria &\n EventProps<T, HTMLElementEventMap> & {\n children?: never;\n rawHtml?: string | undefined;\n };\ntype IframeProps = Omit<HtmlBaseAttributes<HTMLIFrameElement>, \"children\" | \"rawHtml\"> &\n DataAria &\n EventProps<HTMLIFrameElement, HTMLElementEventMap> & {\n children?: never;\n rawHtml?: never;\n };\ntype InputBase = Omit<HtmlBaseAttributes<HTMLInputElement>, \"type\"> &\n DataAria &\n EventProps<HTMLInputElement, HTMLElementEventMap> & {\n defaultValue?: string | undefined;\n defaultChecked?: boolean | undefined;\n };\nexport type InputProps = InputBase &\n (\n | {\n type?: \"text\" | \"search\" | \"email\" | \"url\" | \"tel\" | \"password\" | undefined;\n modelValue?: Signal<string> | undefined;\n modelChecked?: never;\n }\n | {\n type: \"checkbox\";\n modelChecked?: Signal<boolean> | undefined;\n modelValue?: never;\n }\n | {\n type: \"radio\";\n name: string;\n value: string;\n modelValue?: Signal<string | null> | undefined;\n modelChecked?: never;\n }\n | {\n type: string;\n modelValue?: never;\n modelChecked?: never;\n }\n );\nexport type TextareaProps = HTMLAttributes<HTMLTextAreaElement> & {\n modelValue?: Signal<string> | undefined;\n defaultValue?: string | undefined;\n};\nexport type SelectProps = HTMLAttributes<HTMLSelectElement> & {\n modelValue?: Signal<string> | undefined;\n defaultValue?: string | undefined;\n};\n\ninterface SvgBaseAttributes<T extends SVGElement = SVGElement> extends CommonAttributes<T> {\n width?: DimensionAttribute;\n height?: DimensionAttribute;\n viewBox?: StringAttribute;\n preserveAspectRatio?: StringAttribute;\n gradientUnits?: StringAttribute;\n gradientTransform?: StringAttribute;\n markerWidth?: ScalarAttribute;\n markerHeight?: ScalarAttribute;\n refX?: ScalarAttribute;\n refY?: ScalarAttribute;\n \"xlink:href\"?: StringAttribute;\n \"xml:lang\"?: StringAttribute;\n xmlns?: StringAttribute;\n \"xmlns:xlink\"?: StringAttribute;\n href?: StringAttribute;\n focusable?: StringAttribute;\n \"stroke-width\"?: ScalarAttribute;\n \"fill-rule\"?: StringAttribute;\n \"clip-rule\"?: StringAttribute;\n \"stroke-linecap\"?: StringAttribute;\n \"stroke-linejoin\"?: StringAttribute;\n \"stop-color\"?: StringAttribute;\n \"stop-opacity\"?: ScalarAttribute;\n \"fill-opacity\"?: ScalarAttribute;\n \"stroke-dasharray\"?: StringAttribute;\n \"text-anchor\"?: StringAttribute;\n fill?: StringAttribute;\n stroke?: StringAttribute;\n d?: StringAttribute;\n x?: ScalarAttribute;\n y?: ScalarAttribute;\n x1?: ScalarAttribute;\n x2?: ScalarAttribute;\n y1?: ScalarAttribute;\n y2?: ScalarAttribute;\n cx?: ScalarAttribute;\n cy?: ScalarAttribute;\n r?: ScalarAttribute;\n rx?: ScalarAttribute;\n ry?: ScalarAttribute;\n points?: StringAttribute;\n transform?: StringAttribute;\n opacity?: ScalarAttribute;\n offset?: ScalarAttribute;\n id?: StringAttribute;\n}\n\nexport type SVGAttributes<T extends SVGElement = SVGElement> = SvgBaseAttributes<T> &\n DataAria &\n EventProps<T, SVGElementEventMap>;\ntype CustomProps = ReservedProps &\n EventProps<HTMLElement, GlobalEventHandlersEventMap> & {\n value?: string | null | undefined;\n checked?: null | undefined;\n [attribute: string]: StringAttribute | Child | Ref<Element> | AnyListener | undefined;\n };\n\ntype HtmlTag =\n | \"html\"\n | \"head\"\n | \"body\"\n | \"title\"\n | \"base\"\n | \"link\"\n | \"meta\"\n | \"style\"\n | \"script\"\n | \"div\"\n | \"span\"\n | \"p\"\n | \"a\"\n | \"br\"\n | \"hr\"\n | \"main\"\n | \"header\"\n | \"footer\"\n | \"nav\"\n | \"section\"\n | \"article\"\n | \"aside\"\n | \"search\"\n | \"hgroup\"\n | \"menu\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"ul\"\n | \"ol\"\n | \"li\"\n | \"dl\"\n | \"dt\"\n | \"dd\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"strong\"\n | \"em\"\n | \"b\"\n | \"i\"\n | \"small\"\n | \"mark\"\n | \"time\"\n | \"figure\"\n | \"figcaption\"\n | \"img\"\n | \"picture\"\n | \"source\"\n | \"video\"\n | \"audio\"\n | \"track\"\n | \"canvas\"\n | \"form\"\n | \"label\"\n | \"input\"\n | \"button\"\n | \"textarea\"\n | \"select\"\n | \"option\"\n | \"optgroup\"\n | \"fieldset\"\n | \"legend\"\n | \"output\"\n | \"progress\"\n | \"meter\"\n | \"datalist\"\n | \"table\"\n | \"caption\"\n | \"thead\"\n | \"tbody\"\n | \"tfoot\"\n | \"tr\"\n | \"th\"\n | \"td\"\n | \"col\"\n | \"colgroup\"\n | \"details\"\n | \"summary\"\n | \"dialog\"\n | \"template\"\n | \"slot\"\n | \"iframe\"\n | \"noscript\"\n | \"address\"\n | \"abbr\"\n | \"bdi\"\n | \"bdo\"\n | \"cite\"\n | \"data\"\n | \"del\"\n | \"dfn\"\n | \"ins\"\n | \"kbd\"\n | \"map\"\n | \"area\"\n | \"object\"\n | \"param\"\n | \"q\"\n | \"rp\"\n | \"rt\"\n | \"ruby\"\n | \"s\"\n | \"samp\"\n | \"sub\"\n | \"sup\"\n | \"u\"\n | \"var\"\n | \"wbr\"\n | \"embed\";\n\ntype SvgTag =\n | \"svg\"\n | \"g\"\n | \"path\"\n | \"circle\"\n | \"ellipse\"\n | \"rect\"\n | \"line\"\n | \"polyline\"\n | \"polygon\"\n | \"text\"\n | \"tspan\"\n | \"defs\"\n | \"symbol\"\n | \"use\"\n | \"clipPath\"\n | \"mask\"\n | \"linearGradient\"\n | \"radialGradient\"\n | \"stop\"\n | \"desc\"\n | \"foreignObject\"\n | \"pattern\"\n | \"filter\"\n | \"marker\"\n | \"image\";\n\n/** DOM element corresponding to an owned intrinsic tag. */\nexport type ElementForTag<Tag extends HtmlTag | SvgTag> = Tag extends HtmlTag\n ? Tag extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[Tag]\n : HTMLElement\n : Tag extends keyof SVGElementTagNameMap\n ? SVGElementTagNameMap[Tag]\n : SVGElement;\n\nexport namespace JSX {\n export type Element = Description;\n export type HTMLAttributes<T extends HTMLElement = HTMLElement> =\n import(\"./jsx-types.js\").HTMLAttributes<T>;\n export type SVGAttributes<T extends SVGElement = SVGElement> =\n import(\"./jsx-types.js\").SVGAttributes<T>;\n export type CSSProperties = import(\"./jsx-types.js\").CSSProperties;\n export type ElementType =\n | string\n | Component<any>\n | typeof import(\"../island.js\").Island\n | typeof import(\"./description.js\").Fragment;\n export type IntrinsicElements = {\n [K in HtmlTag]: K extends \"input\"\n ? InputProps\n : K extends \"textarea\"\n ? TextareaProps\n : K extends \"select\"\n ? SelectProps\n : K extends \"iframe\"\n ? IframeProps\n : K extends \"script\" | \"style\"\n ? RawTextProps<ElementForTag<K>>\n : HTMLAttributes<ElementForTag<K>>;\n } & {\n [K in SvgTag]: SVGAttributes<ElementForTag<K>>;\n } & {\n [K in `${string}-${string}`]: CustomProps;\n };\n export interface IntrinsicAttributes {\n key?: Key | undefined;\n }\n export interface ElementChildrenAttribute {\n children: unknown;\n }\n}\n"]}
1
+ {"version":3,"file":"jsx-types.js","sourceRoot":"","sources":["../../src/zudo-react/jsx-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { CSSProperties } from \"./style.js\";\nexport type { CSSProperties, CssProperty } from \"./style.js\";\nimport type { Child, Component, Description, Key } from \"./description.js\";\nimport type { Listener, Ref } from \"./index.js\";\nimport type { ReadonlySignal, Signal } from \"./reactive-types.js\";\n\ntype Value<T> = T | ReadonlySignal<T> | undefined;\ntype ScalarAttribute = Value<string | number | boolean | null>;\ntype DimensionAttribute = Value<string | number | null>;\ntype StringAttribute = Value<string | null>;\ntype BooleanAttribute = Value<boolean | null>;\n// The custom-name index must also accept every mapped listener under strict function variance.\ntype AnyListener = Listener<any>;\ntype EventProps<TEl extends Element, TMap extends Record<keyof TMap, Event>> = {\n [K in keyof TMap & string as `on:${K}` | `on:${K}:capture`]?: Listener<\n TMap[K] & { currentTarget: TEl }\n >;\n} & {\n [name: `on:${string}`]: AnyListener | undefined;\n};\ntype DataAria = {\n [name: `data-${string}`]: ScalarAttribute;\n} & {\n [name: `aria-${string}`]: ScalarAttribute;\n};\n\ninterface ReservedProps<T extends Element = Element> {\n children?: Child | undefined;\n key?: Key | undefined;\n ref?: Ref<T> | undefined;\n rawHtml?: Value<string | null>;\n}\n\ninterface CommonAttributes<T extends Element = Element> extends ReservedProps<T> {\n id?: StringAttribute;\n class?: StringAttribute;\n title?: StringAttribute;\n lang?: StringAttribute;\n dir?: StringAttribute;\n slot?: StringAttribute;\n role?: StringAttribute;\n style?: Value<string | CSSProperties | null>;\n hidden?: BooleanAttribute;\n inert?: BooleanAttribute;\n contenteditable?: Value<string | boolean | null>;\n draggable?: Value<string | boolean | null>;\n spellcheck?: Value<string | boolean | null>;\n tabindex?: Value<number | null>;\n accesskey?: StringAttribute;\n translate?: StringAttribute;\n onclick?: string | undefined;\n onload?: string | undefined;\n onerror?: string | undefined;\n}\n\ninterface HtmlBaseAttributes<T extends HTMLElement = HTMLElement> extends CommonAttributes<T> {\n href?: StringAttribute;\n target?: StringAttribute;\n rel?: StringAttribute;\n download?: Value<string | boolean | null>;\n property?: StringAttribute;\n itemprop?: StringAttribute;\n hreflang?: StringAttribute;\n as?: StringAttribute;\n integrity?: StringAttribute;\n async?: BooleanAttribute;\n defer?: BooleanAttribute;\n nonce?: StringAttribute;\n popover?: StringAttribute;\n popovertarget?: StringAttribute;\n popovertargetaction?: StringAttribute;\n srcdoc?: StringAttribute;\n fetchpriority?: StringAttribute;\n inputmode?: StringAttribute;\n autocapitalize?: StringAttribute;\n form?: StringAttribute;\n label?: StringAttribute;\n preload?: StringAttribute;\n playsinline?: BooleanAttribute;\n wrap?: StringAttribute;\n closedby?: StringAttribute;\n src?: StringAttribute;\n alt?: StringAttribute;\n width?: Value<string | number | null>;\n height?: Value<string | number | null>;\n type?: StringAttribute;\n name?: StringAttribute;\n value?: string | number | null | undefined;\n placeholder?: StringAttribute;\n for?: StringAttribute;\n charset?: StringAttribute;\n datetime?: StringAttribute;\n readonly?: BooleanAttribute;\n autofocus?: BooleanAttribute;\n required?: BooleanAttribute;\n disabled?: BooleanAttribute;\n checked?: boolean | null | undefined;\n selected?: BooleanAttribute;\n multiple?: BooleanAttribute;\n reversed?: BooleanAttribute;\n open?: BooleanAttribute;\n controls?: BooleanAttribute;\n muted?: BooleanAttribute;\n loop?: BooleanAttribute;\n autoplay?: BooleanAttribute;\n novalidate?: BooleanAttribute;\n formnovalidate?: BooleanAttribute;\n maxlength?: Value<number | null>;\n minlength?: Value<number | null>;\n min?: StringAttribute;\n max?: StringAttribute;\n step?: StringAttribute;\n start?: Value<string | number | null>;\n pattern?: StringAttribute;\n autocomplete?: StringAttribute;\n accept?: StringAttribute;\n \"accept-charset\"?: StringAttribute;\n \"http-equiv\"?: StringAttribute;\n content?: StringAttribute;\n media?: StringAttribute;\n method?: StringAttribute;\n action?: StringAttribute;\n enctype?: StringAttribute;\n rows?: Value<number | null>;\n cols?: Value<number | null>;\n colspan?: Value<number | null>;\n rowspan?: Value<number | null>;\n scope?: StringAttribute;\n cite?: StringAttribute;\n poster?: StringAttribute;\n loading?: StringAttribute;\n decoding?: StringAttribute;\n sizes?: StringAttribute;\n srcset?: StringAttribute;\n crossorigin?: StringAttribute;\n referrerpolicy?: StringAttribute;\n sandbox?: StringAttribute;\n allow?: StringAttribute;\n allowfullscreen?: BooleanAttribute;\n}\n\nexport type HTMLAttributes<T extends HTMLElement = HTMLElement> = HtmlBaseAttributes<T> &\n DataAria &\n EventProps<T, HTMLElementEventMap>;\ntype RawTextProps<T extends HTMLElement = HTMLElement> = Omit<\n HtmlBaseAttributes<T>,\n \"children\" | \"rawHtml\"\n> &\n DataAria &\n EventProps<T, HTMLElementEventMap> & {\n children?: never;\n rawHtml?: string | undefined;\n };\ntype IframeProps = Omit<HtmlBaseAttributes<HTMLIFrameElement>, \"children\" | \"rawHtml\"> &\n DataAria &\n EventProps<HTMLIFrameElement, HTMLElementEventMap> & {\n children?: never;\n rawHtml?: never;\n };\ntype InputBase = Omit<HtmlBaseAttributes<HTMLInputElement>, \"type\"> &\n DataAria &\n EventProps<HTMLInputElement, HTMLElementEventMap>;\nexport type InputProps = InputBase &\n (\n | {\n type?: \"text\" | \"search\" | \"email\" | \"url\" | \"tel\" | \"password\" | undefined;\n defaultValue?: string | undefined;\n defaultChecked?: never;\n modelValue?: Signal<string> | undefined;\n modelChecked?: never;\n }\n | {\n type: \"checkbox\";\n defaultValue?: never;\n defaultChecked?: boolean | undefined;\n modelChecked?: Signal<boolean> | undefined;\n modelValue?: never;\n }\n | {\n type: \"radio\";\n name: string;\n value: string;\n defaultValue?: never;\n defaultChecked?: boolean | undefined;\n modelValue: Signal<string | null>;\n modelChecked?: never;\n }\n | {\n type: \"radio\";\n defaultValue?: never;\n defaultChecked?: boolean | undefined;\n modelValue?: undefined;\n modelChecked?: never;\n }\n | {\n type: string;\n defaultValue?: never;\n defaultChecked?: never;\n modelValue?: never;\n modelChecked?: never;\n }\n );\nexport type TextareaProps = HTMLAttributes<HTMLTextAreaElement> & {\n modelValue?: Signal<string> | undefined;\n defaultValue?: string | undefined;\n};\nexport type SelectProps = HTMLAttributes<HTMLSelectElement> & {\n modelValue?: Signal<string> | undefined;\n defaultValue?: string | undefined;\n};\n\ninterface SvgBaseAttributes<T extends SVGElement = SVGElement> extends CommonAttributes<T> {\n width?: DimensionAttribute;\n height?: DimensionAttribute;\n viewBox?: StringAttribute;\n preserveAspectRatio?: StringAttribute;\n gradientUnits?: StringAttribute;\n gradientTransform?: StringAttribute;\n markerWidth?: ScalarAttribute;\n markerHeight?: ScalarAttribute;\n refX?: ScalarAttribute;\n refY?: ScalarAttribute;\n \"xlink:href\"?: StringAttribute;\n \"xml:lang\"?: StringAttribute;\n xmlns?: StringAttribute;\n \"xmlns:xlink\"?: StringAttribute;\n href?: StringAttribute;\n focusable?: StringAttribute;\n \"stroke-width\"?: ScalarAttribute;\n \"fill-rule\"?: StringAttribute;\n \"clip-rule\"?: StringAttribute;\n \"stroke-linecap\"?: StringAttribute;\n \"stroke-linejoin\"?: StringAttribute;\n \"stop-color\"?: StringAttribute;\n \"stop-opacity\"?: ScalarAttribute;\n \"fill-opacity\"?: ScalarAttribute;\n \"stroke-dasharray\"?: StringAttribute;\n \"text-anchor\"?: StringAttribute;\n fill?: StringAttribute;\n stroke?: StringAttribute;\n d?: StringAttribute;\n x?: ScalarAttribute;\n y?: ScalarAttribute;\n x1?: ScalarAttribute;\n x2?: ScalarAttribute;\n y1?: ScalarAttribute;\n y2?: ScalarAttribute;\n cx?: ScalarAttribute;\n cy?: ScalarAttribute;\n r?: ScalarAttribute;\n rx?: ScalarAttribute;\n ry?: ScalarAttribute;\n points?: StringAttribute;\n transform?: StringAttribute;\n opacity?: ScalarAttribute;\n offset?: ScalarAttribute;\n id?: StringAttribute;\n}\n\nexport type SVGAttributes<T extends SVGElement = SVGElement> = SvgBaseAttributes<T> &\n DataAria &\n EventProps<T, SVGElementEventMap>;\ntype CustomProps = ReservedProps &\n EventProps<HTMLElement, GlobalEventHandlersEventMap> & {\n value?: string | null | undefined;\n checked?: null | undefined;\n [attribute: string]: StringAttribute | Child | Ref<Element> | AnyListener | undefined;\n };\n\ntype HtmlTag =\n | \"html\"\n | \"head\"\n | \"body\"\n | \"title\"\n | \"base\"\n | \"link\"\n | \"meta\"\n | \"style\"\n | \"script\"\n | \"div\"\n | \"span\"\n | \"p\"\n | \"a\"\n | \"br\"\n | \"hr\"\n | \"main\"\n | \"header\"\n | \"footer\"\n | \"nav\"\n | \"section\"\n | \"article\"\n | \"aside\"\n | \"search\"\n | \"hgroup\"\n | \"menu\"\n | \"h1\"\n | \"h2\"\n | \"h3\"\n | \"h4\"\n | \"h5\"\n | \"h6\"\n | \"ul\"\n | \"ol\"\n | \"li\"\n | \"dl\"\n | \"dt\"\n | \"dd\"\n | \"blockquote\"\n | \"pre\"\n | \"code\"\n | \"strong\"\n | \"em\"\n | \"b\"\n | \"i\"\n | \"small\"\n | \"mark\"\n | \"time\"\n | \"figure\"\n | \"figcaption\"\n | \"img\"\n | \"picture\"\n | \"source\"\n | \"video\"\n | \"audio\"\n | \"track\"\n | \"canvas\"\n | \"form\"\n | \"label\"\n | \"input\"\n | \"button\"\n | \"textarea\"\n | \"select\"\n | \"option\"\n | \"optgroup\"\n | \"fieldset\"\n | \"legend\"\n | \"output\"\n | \"progress\"\n | \"meter\"\n | \"datalist\"\n | \"table\"\n | \"caption\"\n | \"thead\"\n | \"tbody\"\n | \"tfoot\"\n | \"tr\"\n | \"th\"\n | \"td\"\n | \"col\"\n | \"colgroup\"\n | \"details\"\n | \"summary\"\n | \"dialog\"\n | \"template\"\n | \"slot\"\n | \"iframe\"\n | \"noscript\"\n | \"address\"\n | \"abbr\"\n | \"bdi\"\n | \"bdo\"\n | \"cite\"\n | \"data\"\n | \"del\"\n | \"dfn\"\n | \"ins\"\n | \"kbd\"\n | \"map\"\n | \"area\"\n | \"object\"\n | \"param\"\n | \"q\"\n | \"rp\"\n | \"rb\"\n | \"rt\"\n | \"ruby\"\n | \"s\"\n | \"samp\"\n | \"sub\"\n | \"sup\"\n | \"u\"\n | \"var\"\n | \"wbr\"\n | \"embed\";\n\ntype SvgTag =\n | \"svg\"\n | \"g\"\n | \"path\"\n | \"circle\"\n | \"ellipse\"\n | \"rect\"\n | \"line\"\n | \"polyline\"\n | \"polygon\"\n | \"text\"\n | \"tspan\"\n | \"defs\"\n | \"symbol\"\n | \"use\"\n | \"clipPath\"\n | \"mask\"\n | \"linearGradient\"\n | \"radialGradient\"\n | \"stop\"\n | \"desc\"\n | \"foreignObject\"\n | \"pattern\"\n | \"filter\"\n | \"marker\"\n | \"image\";\n\n/** DOM element corresponding to an owned intrinsic tag. */\nexport type ElementForTag<Tag extends HtmlTag | SvgTag> = Tag extends HtmlTag\n ? Tag extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[Tag]\n : HTMLElement\n : Tag extends keyof SVGElementTagNameMap\n ? SVGElementTagNameMap[Tag]\n : SVGElement;\n\nexport namespace JSX {\n export type Element = Description;\n export type HTMLAttributes<T extends HTMLElement = HTMLElement> =\n import(\"./jsx-types.js\").HTMLAttributes<T>;\n export type SVGAttributes<T extends SVGElement = SVGElement> =\n import(\"./jsx-types.js\").SVGAttributes<T>;\n export type CSSProperties = import(\"./jsx-types.js\").CSSProperties;\n export type ElementType =\n | string\n | Component<any>\n | typeof import(\"../island.js\").Island\n | typeof import(\"./description.js\").Fragment;\n export type IntrinsicElements = {\n [K in HtmlTag]: K extends \"input\"\n ? InputProps\n : K extends \"textarea\"\n ? TextareaProps\n : K extends \"select\"\n ? SelectProps\n : K extends \"iframe\"\n ? IframeProps\n : K extends \"script\" | \"style\"\n ? RawTextProps<ElementForTag<K>>\n : HTMLAttributes<ElementForTag<K>>;\n } & {\n [K in SvgTag]: SVGAttributes<ElementForTag<K>>;\n } & {\n [K in `${string}-${string}`]: CustomProps;\n };\n export interface IntrinsicAttributes {\n key?: Key | undefined;\n }\n export interface ElementChildrenAttribute {\n children: unknown;\n }\n}\n"]}
@@ -15,9 +15,9 @@
15
15
  // `zr:1:` occurrence: `noscript`/`xmp`/`noembed`/`noframes`/`plaintext` hosts,
16
16
  // and payloads naming a RAWTEXT/RCDATA/script/PLAINTEXT element (its end tag may
17
17
  // also close a raw-text ancestor) or a CDATA section (foreign content).
18
- // `script`/`style` hosts are raw text: their payload cannot form markup, and
19
- // they keep the documented contract (no protocol comment or island attribute
20
- // text; the callers reject `</script` / `</style`).
18
+ // `script`/`style` hosts keep the documented marker and closing-tag rules.
19
+ // Script additionally checks whether HTML tokenization consumes its renderer
20
+ // closing tag; style is RAWTEXT and has no script escape states.
21
21
  const reservedAttributes = new Set(["data-zfb-island", "data-zfb-island-skip-ssr"]);
22
22
  const rawTextHosts = new Set(["noscript", "xmp", "noembed", "noframes", "plaintext"]);
23
23
  const unmodeled = /<\/?(?:script|style|textarea|title|xmp|iframe|noembed|noframes|noscript|plaintext)|<!\[cdata\[/i;
@@ -26,7 +26,8 @@ const nameEnd = /[\t\n\f\r />=]/;
26
26
  const unquotedEnd = /[\t\n\f\r >]/;
27
27
  export function rawHtmlReserved(payload, tag) {
28
28
  if (tag === "script" || tag === "style")
29
- return /<!--\/?zr:1:|data-zfb-island(?:-skip-ssr)?\s*=/.test(payload);
29
+ return (/\x3c!--\/?zr:1:|data-zfb-island(?:-skip-ssr)?\s*=/.test(payload) ||
30
+ (tag === "script" && scriptConsumesClosingTag(payload)));
30
31
  if (rawTextHosts.has(tag) || unmodeled.test(payload))
31
32
  return /data-zfb-island|zr:1:/i.test(payload);
32
33
  let i = 0;
@@ -80,6 +81,145 @@ export function rawHtmlReserved(payload, tag) {
80
81
  i = end;
81
82
  }
82
83
  }
84
+ // Walk the WHATWG script-data escape states with the exact suffix emitted by
85
+ // the renderer. A `</script>` in double-escaped text only exits that state;
86
+ // it does not close the element. Incomplete names and `<!--` tails must be
87
+ // evaluated with the suffix attached, rather than classified by payload alone.
88
+ function scriptConsumesClosingTag(payload) {
89
+ // The HTML input stream normalizes CR and CRLF to LF before tokenization.
90
+ const source = `${payload.replace(/\r\n?/g, "\n")}</script>`;
91
+ let state = "data";
92
+ let endFallback = "data";
93
+ let buffer = "";
94
+ for (let i = 0; i < source.length; i++) {
95
+ const c = source[i];
96
+ const alpha = /[a-zA-Z]/.test(c);
97
+ const delimiter = c === "/" || c === ">" || /[\t\n\f ]/.test(c);
98
+ switch (state) {
99
+ case "data":
100
+ if (c === "<")
101
+ state = "less";
102
+ break;
103
+ case "less":
104
+ if (c === "/") {
105
+ endFallback = "data";
106
+ state = "endOpen";
107
+ }
108
+ else if (c === "!")
109
+ state = "escapeStart";
110
+ else {
111
+ state = "data";
112
+ i--;
113
+ }
114
+ break;
115
+ case "escapeStart":
116
+ if (c === "-")
117
+ state = "escapeStartDash";
118
+ else {
119
+ state = "data";
120
+ i--;
121
+ }
122
+ break;
123
+ case "escapeStartDash":
124
+ if (c === "-")
125
+ state = "escapedDashDash";
126
+ else {
127
+ state = "data";
128
+ i--;
129
+ }
130
+ break;
131
+ case "escaped":
132
+ case "escapedDash":
133
+ case "escapedDashDash":
134
+ if (c === "<")
135
+ state = "escapedLess";
136
+ else if (state === "escapedDashDash" && c === ">")
137
+ state = "data";
138
+ else if (c === "-")
139
+ state = state === "escaped" ? "escapedDash" : "escapedDashDash";
140
+ else
141
+ state = "escaped";
142
+ break;
143
+ case "escapedLess":
144
+ if (c === "/") {
145
+ endFallback = "escaped";
146
+ state = "endOpen";
147
+ }
148
+ else if (alpha) {
149
+ buffer = "";
150
+ state = "doubleStart";
151
+ i--;
152
+ }
153
+ else {
154
+ state = "escaped";
155
+ i--;
156
+ }
157
+ break;
158
+ case "endOpen":
159
+ if (alpha) {
160
+ buffer = "";
161
+ state = "endName";
162
+ i--;
163
+ }
164
+ else {
165
+ state = endFallback;
166
+ i--;
167
+ }
168
+ break;
169
+ case "endName":
170
+ if (alpha)
171
+ buffer = buffer.length < 7 ? buffer + c.toLowerCase() : "!";
172
+ else if (delimiter && buffer === "script" && c === ">")
173
+ return false;
174
+ else {
175
+ state = endFallback;
176
+ i--;
177
+ }
178
+ break;
179
+ case "doubleStart":
180
+ case "doubleEnd":
181
+ if (alpha)
182
+ buffer = buffer.length < 7 ? buffer + c.toLowerCase() : "!";
183
+ else if (delimiter)
184
+ state =
185
+ buffer === "script"
186
+ ? state === "doubleStart"
187
+ ? "double"
188
+ : "escaped"
189
+ : state === "doubleStart"
190
+ ? "escaped"
191
+ : "double";
192
+ else {
193
+ state = state === "doubleStart" ? "escaped" : "double";
194
+ i--;
195
+ }
196
+ break;
197
+ case "double":
198
+ case "doubleDash":
199
+ case "doubleDashDash":
200
+ if (c === "<")
201
+ state = "doubleLess";
202
+ else if (state === "doubleDashDash" && c === ">")
203
+ state = "data";
204
+ else if (c === "-")
205
+ state = state === "double" ? "doubleDash" : "doubleDashDash";
206
+ else
207
+ state = "double";
208
+ break;
209
+ case "doubleLess":
210
+ if (c === "/") {
211
+ buffer = "";
212
+ state = "doubleEnd";
213
+ }
214
+ else {
215
+ state = "double";
216
+ i--;
217
+ }
218
+ break;
219
+ }
220
+ }
221
+ return true;
222
+ }
83
223
  // Returns the index just past the tag's `>`, or -1 when the tag is unterminated
84
224
  // or carries a reserved attribute.
85
225
  function tagEnd(s, j) {
@@ -1 +1 @@
1
- {"version":3,"file":"raw-html.js","sourceRoot":"","sources":["../../src/zudo-react/raw-html.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,yCAAyC;AACzC,6EAA6E;AAC7E,+EAA+E;AAC/E,6EAA6E;AAC7E,+EAA+E;AAC/E,iFAAiF;AACjF,wEAAwE;AACxE,6EAA6E;AAC7E,6EAA6E;AAC7E,oDAAoD;AAEpD,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,EAAE,0BAA0B,CAAC,CAAC,CAAC;AACpF,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,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BAAkB,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;YAAE,CAAC,EAAE,CAAC;QACvC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;YAAE,SAAS;QAC3B,CAAC,EAAE,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;YAAE,CAAC,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,GAAG,EAAE,CAAC;YACnC,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,IAAI,KAAK,GAAG,CAAC;gBAAE,OAAO,CAAC,CAAC,CAAC;YACzB,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QAChB,CAAC;;YAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;gBAAE,CAAC,EAAE,CAAC;IACvD,CAAC;AACH,CAAC","sourcesContent":["// Reserved-boundary guard for rawHtml payloads, shared by the server renderer\n// and the client runtime so both accept exactly the same payloads.\n//\n// Rule: a payload is rejected when it can create a reserved boundary, decided\n// by an HTML-tokenizer pass (WHATWG tokenization, data state), not a text regex:\n// - a start or end tag carrying an attribute whose ASCII-lowercased name is\n// `data-zfb-island` or `data-zfb-island-skip-ssr` (any value form, or none);\n// - a comment, including a bogus `<!…>`, `<?…>` or `</…>` comment, whose data\n// contains `zr:1:` (hydration matches `zr:1:` / `/zr:1:` comment prefixes);\n// - a payload that ends inside a tag, comment or `</`, which would absorb the\n// renderer's closing boundary marker.\n// Marker-like text in character data or quoted attribute values is inert and\n// renders as written. The tokenizer models the data state only, so payloads it\n// cannot model take the textual rule, which rejects any `data-zfb-island` or\n// `zr:1:` occurrence: `noscript`/`xmp`/`noembed`/`noframes`/`plaintext` hosts,\n// and payloads naming a RAWTEXT/RCDATA/script/PLAINTEXT element (its end tag may\n// also close a raw-text ancestor) or a CDATA section (foreign content).\n// `script`/`style` hosts are raw text: their payload cannot form markup, and\n// they keep the documented contract (no protocol comment or island attribute\n// text; the callers reject `</script` / `</style`).\n\nconst reservedAttributes = new Set([\"data-zfb-island\", \"data-zfb-island-skip-ssr\"]);\nconst rawTextHosts = new Set([\"noscript\", \"xmp\", \"noembed\", \"noframes\", \"plaintext\"]);\nconst unmodeled =\n /<\\/?(?:script|style|textarea|title|xmp|iframe|noembed|noframes|noscript|plaintext)|<!\\[cdata\\[/i;\nconst space = /[\\t\\n\\f\\r ]/;\nconst nameEnd = /[\\t\\n\\f\\r />=]/;\nconst unquotedEnd = /[\\t\\n\\f\\r >]/;\n\nexport function rawHtmlReserved(payload: string, tag: string): boolean {\n if (tag === \"script\" || tag === \"style\")\n return /<!--\\/?zr:1:|data-zfb-island(?:-skip-ssr)?\\s*=/.test(payload);\n if (rawTextHosts.has(tag) || unmodeled.test(payload))\n return /data-zfb-island|zr:1:/i.test(payload);\n let i = 0;\n for (;;) {\n const lt = payload.indexOf(\"<\", i);\n if (lt < 0) return false;\n const c = payload[lt + 1];\n let start: number;\n if (c === undefined) return false;\n if (/[a-z]/i.test(c) || (c === \"/\" && /[a-z]/i.test(payload[lt + 2] ?? \"\"))) {\n i = tagEnd(payload, c === \"/\" ? lt + 2 : lt + 1);\n if (i < 0) return true;\n continue;\n }\n if (c === \"!\" && payload.startsWith(\"--\", lt + 2)) {\n start = lt + 4;\n if (payload[start] === \">\" || payload.startsWith(\"->\", start)) {\n i = start;\n continue;\n }\n const dashes = payload.indexOf(\"-->\", start);\n const bang = payload.indexOf(\"--!>\", start);\n const end = dashes < 0 || (bang >= 0 && bang < dashes) ? bang : dashes;\n if (end < 0 || payload.slice(start, end).includes(\"zr:1:\")) return true;\n i = end;\n continue;\n }\n if (c === \"/\") {\n // `</` followed by the closing marker's `<` would open a bogus comment.\n if (lt + 2 >= payload.length) return true;\n if (payload[lt + 2] === \">\") {\n i = lt + 3;\n continue;\n }\n start = lt + 2;\n } else if (c === \"!\" || c === \"?\") start = lt + 1;\n else {\n i = lt + 1;\n continue;\n }\n const end = payload.indexOf(\">\", start);\n if (end < 0 || payload.slice(start, end).includes(\"zr:1:\")) return true;\n i = end;\n }\n}\n\n// Returns the index just past the tag's `>`, or -1 when the tag is unterminated\n// or carries a reserved attribute.\nfunction tagEnd(s: string, j: number): number {\n const n = s.length;\n while (j < n && !space.test(s[j]!) && s[j] !== \"/\" && s[j] !== \">\") j++;\n for (;;) {\n while (j < n && (space.test(s[j]!) || s[j] === \"/\")) j++;\n if (j >= n) return -1;\n if (s[j] === \">\") return j + 1;\n const start = j++;\n while (j < n && !nameEnd.test(s[j]!)) j++;\n if (reservedAttributes.has(s.slice(start, j).toLowerCase())) return -1;\n while (j < n && space.test(s[j]!)) j++;\n if (s[j] !== \"=\") continue;\n j++;\n while (j < n && space.test(s[j]!)) j++;\n const quote = s[j];\n if (quote === '\"' || quote === \"'\") {\n const close = s.indexOf(quote, j + 1);\n if (close < 0) return -1;\n j = close + 1;\n } else while (j < n && !unquotedEnd.test(s[j]!)) j++;\n }\n}\n"]}
1
+ {"version":3,"file":"raw-html.js","sourceRoot":"","sources":["../../src/zudo-react/raw-html.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,mEAAmE;AACnE,EAAE;AACF,8EAA8E;AAC9E,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,yCAAyC;AACzC,6EAA6E;AAC7E,+EAA+E;AA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AAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YACtC,IAAI,KAAK,GAAG,CAAC;gBAAE,OAAO,CAAC,CAAC,CAAC;YACzB,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC;QAChB,CAAC;;YAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC;gBAAE,CAAC,EAAE,CAAC;IACvD,CAAC;AACH,CAAC","sourcesContent":["// Reserved-boundary guard for rawHtml payloads, shared by the server renderer\n// and the client runtime so both accept exactly the same payloads.\n//\n// Rule: a payload is rejected when it can create a reserved boundary, decided\n// by an HTML-tokenizer pass (WHATWG tokenization, data state), not a text regex:\n// - a start or end tag carrying an attribute whose ASCII-lowercased name is\n// `data-zfb-island` or `data-zfb-island-skip-ssr` (any value form, or none);\n// - a comment, including a bogus `<!…>`, `<?…>` or `</…>` comment, whose data\n// contains `zr:1:` (hydration matches `zr:1:` / `/zr:1:` comment prefixes);\n// - a payload that ends inside a tag, comment or `</`, which would absorb the\n// renderer's closing boundary marker.\n// Marker-like text in character data or quoted attribute values is inert and\n// renders as written. The tokenizer models the data state only, so payloads it\n// cannot model take the textual rule, which rejects any `data-zfb-island` or\n// `zr:1:` occurrence: `noscript`/`xmp`/`noembed`/`noframes`/`plaintext` hosts,\n// and payloads naming a RAWTEXT/RCDATA/script/PLAINTEXT element (its end tag may\n// also close a raw-text ancestor) or a CDATA section (foreign content).\n// `script`/`style` hosts keep the documented marker and closing-tag rules.\n// Script additionally checks whether HTML tokenization consumes its renderer\n// closing tag; style is RAWTEXT and has no script escape states.\n\nconst reservedAttributes = new Set([\"data-zfb-island\", \"data-zfb-island-skip-ssr\"]);\nconst rawTextHosts = new Set([\"noscript\", \"xmp\", \"noembed\", \"noframes\", \"plaintext\"]);\nconst unmodeled =\n /<\\/?(?:script|style|textarea|title|xmp|iframe|noembed|noframes|noscript|plaintext)|<!\\[cdata\\[/i;\nconst space = /[\\t\\n\\f\\r ]/;\nconst nameEnd = /[\\t\\n\\f\\r />=]/;\nconst unquotedEnd = /[\\t\\n\\f\\r >]/;\n\nexport function rawHtmlReserved(payload: string, tag: string): boolean {\n if (tag === \"script\" || tag === \"style\")\n return (\n /\\x3c!--\\/?zr:1:|data-zfb-island(?:-skip-ssr)?\\s*=/.test(payload) ||\n (tag === \"script\" && scriptConsumesClosingTag(payload))\n );\n if (rawTextHosts.has(tag) || unmodeled.test(payload))\n return /data-zfb-island|zr:1:/i.test(payload);\n let i = 0;\n for (;;) {\n const lt = payload.indexOf(\"<\", i);\n if (lt < 0) return false;\n const c = payload[lt + 1];\n let start: number;\n if (c === undefined) return false;\n if (/[a-z]/i.test(c) || (c === \"/\" && /[a-z]/i.test(payload[lt + 2] ?? \"\"))) {\n i = tagEnd(payload, c === \"/\" ? lt + 2 : lt + 1);\n if (i < 0) return true;\n continue;\n }\n if (c === \"!\" && payload.startsWith(\"--\", lt + 2)) {\n start = lt + 4;\n if (payload[start] === \">\" || payload.startsWith(\"->\", start)) {\n i = start;\n continue;\n }\n const dashes = payload.indexOf(\"-->\", start);\n const bang = payload.indexOf(\"--!>\", start);\n const end = dashes < 0 || (bang >= 0 && bang < dashes) ? bang : dashes;\n if (end < 0 || payload.slice(start, end).includes(\"zr:1:\")) return true;\n i = end;\n continue;\n }\n if (c === \"/\") {\n // `</` followed by the closing marker's `<` would open a bogus comment.\n if (lt + 2 >= payload.length) return true;\n if (payload[lt + 2] === \">\") {\n i = lt + 3;\n continue;\n }\n start = lt + 2;\n } else if (c === \"!\" || c === \"?\") start = lt + 1;\n else {\n i = lt + 1;\n continue;\n }\n const end = payload.indexOf(\">\", start);\n if (end < 0 || payload.slice(start, end).includes(\"zr:1:\")) return true;\n i = end;\n }\n}\n\n// Walk the WHATWG script-data escape states with the exact suffix emitted by\n// the renderer. A `</script>` in double-escaped text only exits that state;\n// it does not close the element. Incomplete names and `<!--` tails must be\n// evaluated with the suffix attached, rather than classified by payload alone.\nfunction scriptConsumesClosingTag(payload: string): boolean {\n // The HTML input stream normalizes CR and CRLF to LF before tokenization.\n const source = `${payload.replace(/\\r\\n?/g, \"\\n\")}</script>`;\n type State =\n | \"data\"\n | \"less\"\n | \"endOpen\"\n | \"endName\"\n | \"escapeStart\"\n | \"escapeStartDash\"\n | \"escaped\"\n | \"escapedDash\"\n | \"escapedDashDash\"\n | \"escapedLess\"\n | \"doubleStart\"\n | \"double\"\n | \"doubleDash\"\n | \"doubleDashDash\"\n | \"doubleLess\"\n | \"doubleEnd\";\n let state: State = \"data\";\n let endFallback: \"data\" | \"escaped\" = \"data\";\n let buffer = \"\";\n for (let i = 0; i < source.length; i++) {\n const c = source[i]!;\n const alpha = /[a-zA-Z]/.test(c);\n const delimiter = c === \"/\" || c === \">\" || /[\\t\\n\\f ]/.test(c);\n switch (state) {\n case \"data\":\n if (c === \"<\") state = \"less\";\n break;\n case \"less\":\n if (c === \"/\") {\n endFallback = \"data\";\n state = \"endOpen\";\n } else if (c === \"!\") state = \"escapeStart\";\n else {\n state = \"data\";\n i--;\n }\n break;\n case \"escapeStart\":\n if (c === \"-\") state = \"escapeStartDash\";\n else {\n state = \"data\";\n i--;\n }\n break;\n case \"escapeStartDash\":\n if (c === \"-\") state = \"escapedDashDash\";\n else {\n state = \"data\";\n i--;\n }\n break;\n case \"escaped\":\n case \"escapedDash\":\n case \"escapedDashDash\":\n if (c === \"<\") state = \"escapedLess\";\n else if (state === \"escapedDashDash\" && c === \">\") state = \"data\";\n else if (c === \"-\") state = state === \"escaped\" ? \"escapedDash\" : \"escapedDashDash\";\n else state = \"escaped\";\n break;\n case \"escapedLess\":\n if (c === \"/\") {\n endFallback = \"escaped\";\n state = \"endOpen\";\n } else if (alpha) {\n buffer = \"\";\n state = \"doubleStart\";\n i--;\n } else {\n state = \"escaped\";\n i--;\n }\n break;\n case \"endOpen\":\n if (alpha) {\n buffer = \"\";\n state = \"endName\";\n i--;\n } else {\n state = endFallback;\n i--;\n }\n break;\n case \"endName\":\n if (alpha) buffer = buffer.length < 7 ? buffer + c.toLowerCase() : \"!\";\n else if (delimiter && buffer === \"script\" && c === \">\") return false;\n else {\n state = endFallback;\n i--;\n }\n break;\n case \"doubleStart\":\n case \"doubleEnd\":\n if (alpha) buffer = buffer.length < 7 ? buffer + c.toLowerCase() : \"!\";\n else if (delimiter)\n state =\n buffer === \"script\"\n ? state === \"doubleStart\"\n ? \"double\"\n : \"escaped\"\n : state === \"doubleStart\"\n ? \"escaped\"\n : \"double\";\n else {\n state = state === \"doubleStart\" ? \"escaped\" : \"double\";\n i--;\n }\n break;\n case \"double\":\n case \"doubleDash\":\n case \"doubleDashDash\":\n if (c === \"<\") state = \"doubleLess\";\n else if (state === \"doubleDashDash\" && c === \">\") state = \"data\";\n else if (c === \"-\") state = state === \"double\" ? \"doubleDash\" : \"doubleDashDash\";\n else state = \"double\";\n break;\n case \"doubleLess\":\n if (c === \"/\") {\n buffer = \"\";\n state = \"doubleEnd\";\n } else {\n state = \"double\";\n i--;\n }\n break;\n }\n }\n return true;\n}\n\n// Returns the index just past the tag's `>`, or -1 when the tag is unterminated\n// or carries a reserved attribute.\nfunction tagEnd(s: string, j: number): number {\n const n = s.length;\n while (j < n && !space.test(s[j]!) && s[j] !== \"/\" && s[j] !== \">\") j++;\n for (;;) {\n while (j < n && (space.test(s[j]!) || s[j] === \"/\")) j++;\n if (j >= n) return -1;\n if (s[j] === \">\") return j + 1;\n const start = j++;\n while (j < n && !nameEnd.test(s[j]!)) j++;\n if (reservedAttributes.has(s.slice(start, j).toLowerCase())) return -1;\n while (j < n && space.test(s[j]!)) j++;\n if (s[j] !== \"=\") continue;\n j++;\n while (j < n && space.test(s[j]!)) j++;\n const quote = s[j];\n if (quote === '\"' || quote === \"'\") {\n const close = s.indexOf(quote, j + 1);\n if (close < 0) return -1;\n j = close + 1;\n } else while (j < n && !unquotedEnd.test(s[j]!)) j++;\n }\n}\n"]}
@@ -17,4 +17,12 @@ export declare function storedRoot(container: Element): RootHandle | undefined;
17
17
  export declare function report(options: RootOptions, diagnostic: Diagnostic): void;
18
18
  export declare function diagnostic(options: RootOptions, code: string, phase: Diagnostic["phase"], path: string, expected: string, actual: string, stack?: readonly string[]): Diagnostic;
19
19
  export declare function rootPath(element: Element): string;
20
- export declare function createRoot(container: Element, options: RootOptions, scope: RuntimeScope, cleanups: Array<() => void>, owned: readonly Node[]): RootHandle;
20
+ export type RootOwned = {
21
+ readonly kind: "node";
22
+ readonly node: Node;
23
+ } | {
24
+ readonly kind: "range";
25
+ readonly start: Node;
26
+ readonly end: Node;
27
+ };
28
+ export declare function createRoot(container: Element, options: RootOptions, scope: RuntimeScope, cleanups: Array<() => void>, owned: readonly RootOwned[]): RootHandle;
@@ -84,9 +84,28 @@ export function createRoot(container, options, scope, cleanups, owned) {
84
84
  if (removed || storedRoot(container) !== handle)
85
85
  return;
86
86
  removed = true;
87
- for (const node of owned)
88
- if (node.parentNode === container)
87
+ for (const entry of owned) {
88
+ if (entry.kind === "node") {
89
+ if (entry.node.parentNode === container)
90
+ container.removeChild(entry.node);
91
+ continue;
92
+ }
93
+ const { start, end } = entry;
94
+ if (start.parentNode !== container || end.parentNode !== container)
95
+ continue;
96
+ // Dynamic children can change after the initial render. The markers bound
97
+ // only this root's range, leaving direct siblings outside it untouched.
98
+ const nodes = [];
99
+ for (let node = start; node; node = node.nextSibling) {
100
+ nodes.push(node);
101
+ if (node === end)
102
+ break;
103
+ }
104
+ if (nodes.at(-1) !== end)
105
+ continue;
106
+ for (const node of nodes)
89
107
  container.removeChild(node);
108
+ }
90
109
  if (storedRoot(container) === handle)
91
110
  delete container[ROOT_KEY];
92
111
  },
@@ -1 +1 @@
1
- {"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/zudo-react/root.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEvE,MAAM,UAA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AC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Diagnostic, IslandIdentity, Reporter } from \"./index.js\";\nimport type { RuntimeScope } from \"./scope.js\";\n\nexport interface RootOptions {\n identity: IslandIdentity;\n signal?: AbortSignal | undefined;\n report?: Reporter | undefined;\n}\nexport interface RootHandle {\n readonly protocol: \"zudo-react/1\";\n readonly identity: IslandIdentity;\n readonly disposed: boolean;\n dispose(): void;\n unmount(): void;\n}\nexport const ROOT_KEY = Symbol.for(\"@takazudo/zfb/zudo-react/root-v1\");\ntype RootElement = Element & { [ROOT_KEY]?: RootHandle };\nexport function storedRoot(container: Element): RootHandle | undefined {\n return (container as RootElement)[ROOT_KEY];\n}\nconst phaseMessages: Record<Diagnostic[\"phase\"], string> = {\n setup: \"root setup failed\",\n preflight: \"root validation failed\",\n commit: \"root commit failed\",\n activation: \"activation failed\",\n update: \"reactive update failed\",\n cleanup: \"cleanup failed\",\n};\n\nfunction diagnosticLine(value: Diagnostic): string {\n // Only runtime-shaped identifiers and DOM paths belong on the searchable line.\n // The structured object retains the full details for inspection.\n const code = /^ZR_[A-Z0-9_]+$/.test(value.code) ? value.code : \"ZR_UNKNOWN\";\n const phase = Object.hasOwn(phaseMessages, value.phase) ? value.phase : \"setup\";\n const component = /^[A-Za-z_$][\\w$.-]*$/.test(value.component) ? value.component : \"[component]\";\n const path =\n /^\\/[a-z][a-z0-9-]*:nth-child\\(\\d+\\)(?:\\/[a-z#][a-z0-9#-]*(?::nth-child\\(\\d+\\))?(?:\\[\\d+\\])?)*$/.test(\n value.path,\n )\n ? value.path\n : \"[path]\";\n const message = code === \"ZR_HYDRATION_MISMATCH\" ? \"hydration mismatch\" : phaseMessages[phase];\n return `[zudo-react] ${code} ${phase} ${component} ${path}: ${message}`;\n}\n\nexport function report(options: RootOptions, diagnostic: Diagnostic): void {\n try {\n if (options.report) options.report(diagnostic);\n else console.error(diagnosticLine(diagnostic), diagnostic);\n } catch (error) {\n console.error(error);\n }\n}\nexport function diagnostic(\n options: RootOptions,\n code: string,\n phase: Diagnostic[\"phase\"],\n path: string,\n expected: string,\n actual: string,\n stack: readonly string[] = [options.identity.component],\n): Diagnostic {\n return {\n code,\n phase,\n component: stack.at(-1) ?? options.identity.component,\n componentStack: stack,\n path,\n expected,\n actual,\n protocol: \"zudo-react/1\",\n build: options.identity.build,\n };\n}\nexport function rootPath(element: Element): string {\n const parts: string[] = [];\n for (let node: Element | null = element; node; node = node.parentElement) {\n const index = node.parentElement\n ? Array.prototype.indexOf.call(node.parentElement.children, node) + 1\n : 1;\n parts.unshift(`${node.localName}:nth-child(${index})`);\n }\n return `/${parts.join(\"/\")}`;\n}\nexport function createRoot(\n container: Element,\n options: RootOptions,\n scope: RuntimeScope,\n cleanups: Array<() => void>,\n owned: readonly Node[],\n): RootHandle {\n let disposed = false;\n let removed = false;\n const handle: RootHandle = {\n protocol: \"zudo-react/1\",\n identity: options.identity,\n get disposed() {\n return disposed;\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n for (const cleanup of [...cleanups].reverse()) {\n try {\n cleanup();\n } catch (error) {\n report(\n options,\n diagnostic(\n options,\n \"ZR_CLEANUP_ERROR\",\n \"cleanup\",\n rootPath(container),\n \"cleanup\",\n String(error),\n ),\n );\n }\n }\n scope.dispose();\n },\n unmount() {\n handle.dispose();\n if (removed || storedRoot(container) !== handle) return;\n removed = true;\n for (const node of owned) if (node.parentNode === container) container.removeChild(node);\n if (storedRoot(container) === handle) delete (container as RootElement)[ROOT_KEY];\n },\n };\n (container as RootElement)[ROOT_KEY] = handle;\n return handle;\n}\n"]}
1
+ {"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/zudo-react/root.ts"],"names":[],"mappings":"AAeA,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEvE,MAAM,UAAU,UAAU,CAAC,SAAkB;IAC3C,OAAQ,SAAyB,CAAC,QAAQ,CAAC,CAAC;AAC9C,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AC,UAAU,KAAK,SAAS;oBAAE,SAAS;gBAC7E,0EAA0E;gBAC1E,wEAAwE;gBACxE,MAAM,KAAK,GAAW,EAAE,CAAC;gBACzB,KAAK,IAAI,IAAI,GAAgB,KAAK,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;oBAClE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACjB,IAAI,IAAI,KAAK,GAAG;wBAAE,MAAM;gBAC1B,CAAC;gBACD,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG;oBAAE,SAAS;gBACnC,KAAK,MAAM,IAAI,IAAI,KAAK;oBAAE,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxD,CAAC;YACD,IAAI,UAAU,CAAC,SAAS,CAAC,KAAK,MAAM;gBAAE,OAAQ,SAAyB,CAAC,QAAQ,CAAC,CAAC;QACpF,CAAC;KACF,CAAC;IACD,SAAyB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Diagnostic, IslandIdentity, Reporter } from \"./index.js\";\nimport type { RuntimeScope } from \"./scope.js\";\n\nexport interface RootOptions {\n identity: IslandIdentity;\n signal?: AbortSignal | undefined;\n report?: Reporter | undefined;\n}\nexport interface RootHandle {\n readonly protocol: \"zudo-react/1\";\n readonly identity: IslandIdentity;\n readonly disposed: boolean;\n dispose(): void;\n unmount(): void;\n}\nexport const ROOT_KEY = Symbol.for(\"@takazudo/zfb/zudo-react/root-v1\");\ntype RootElement = Element & { [ROOT_KEY]?: RootHandle };\nexport function storedRoot(container: Element): RootHandle | undefined {\n return (container as RootElement)[ROOT_KEY];\n}\nconst phaseMessages: Record<Diagnostic[\"phase\"], string> = {\n setup: \"root setup failed\",\n preflight: \"root validation failed\",\n commit: \"root commit failed\",\n activation: \"activation failed\",\n update: \"reactive update failed\",\n cleanup: \"cleanup failed\",\n};\n\nfunction diagnosticLine(value: Diagnostic): string {\n // Only runtime-shaped identifiers and DOM paths belong on the searchable line.\n // The structured object retains the full details for inspection.\n const code = /^ZR_[A-Z0-9_]+$/.test(value.code) ? value.code : \"ZR_UNKNOWN\";\n const phase = Object.hasOwn(phaseMessages, value.phase) ? value.phase : \"setup\";\n const component = /^[A-Za-z_$][\\w$.-]*$/.test(value.component) ? value.component : \"[component]\";\n const path =\n /^\\/[a-z][a-z0-9-]*:nth-child\\(\\d+\\)(?:\\/[a-z#][a-z0-9#-]*(?::nth-child\\(\\d+\\))?(?:\\[\\d+\\])?)*$/.test(\n value.path,\n )\n ? value.path\n : \"[path]\";\n const message = code === \"ZR_HYDRATION_MISMATCH\" ? \"hydration mismatch\" : phaseMessages[phase];\n return `[zudo-react] ${code} ${phase} ${component} ${path}: ${message}`;\n}\n\nexport function report(options: RootOptions, diagnostic: Diagnostic): void {\n try {\n if (options.report) options.report(diagnostic);\n else console.error(diagnosticLine(diagnostic), diagnostic);\n } catch (error) {\n console.error(error);\n }\n}\nexport function diagnostic(\n options: RootOptions,\n code: string,\n phase: Diagnostic[\"phase\"],\n path: string,\n expected: string,\n actual: string,\n stack: readonly string[] = [options.identity.component],\n): Diagnostic {\n return {\n code,\n phase,\n component: stack.at(-1) ?? options.identity.component,\n componentStack: stack,\n path,\n expected,\n actual,\n protocol: \"zudo-react/1\",\n build: options.identity.build,\n };\n}\nexport function rootPath(element: Element): string {\n const parts: string[] = [];\n for (let node: Element | null = element; node; node = node.parentElement) {\n const index = node.parentElement\n ? Array.prototype.indexOf.call(node.parentElement.children, node) + 1\n : 1;\n parts.unshift(`${node.localName}:nth-child(${index})`);\n }\n return `/${parts.join(\"/\")}`;\n}\nexport type RootOwned =\n | { readonly kind: \"node\"; readonly node: Node }\n | { readonly kind: \"range\"; readonly start: Node; readonly end: Node };\nexport function createRoot(\n container: Element,\n options: RootOptions,\n scope: RuntimeScope,\n cleanups: Array<() => void>,\n owned: readonly RootOwned[],\n): RootHandle {\n let disposed = false;\n let removed = false;\n const handle: RootHandle = {\n protocol: \"zudo-react/1\",\n identity: options.identity,\n get disposed() {\n return disposed;\n },\n dispose() {\n if (disposed) return;\n disposed = true;\n for (const cleanup of [...cleanups].reverse()) {\n try {\n cleanup();\n } catch (error) {\n report(\n options,\n diagnostic(\n options,\n \"ZR_CLEANUP_ERROR\",\n \"cleanup\",\n rootPath(container),\n \"cleanup\",\n String(error),\n ),\n );\n }\n }\n scope.dispose();\n },\n unmount() {\n handle.dispose();\n if (removed || storedRoot(container) !== handle) return;\n removed = true;\n for (const entry of owned) {\n if (entry.kind === \"node\") {\n if (entry.node.parentNode === container) container.removeChild(entry.node);\n continue;\n }\n const { start, end } = entry;\n if (start.parentNode !== container || end.parentNode !== container) continue;\n // Dynamic children can change after the initial render. The markers bound\n // only this root's range, leaving direct siblings outside it untouched.\n const nodes: Node[] = [];\n for (let node: Node | null = start; node; node = node.nextSibling) {\n nodes.push(node);\n if (node === end) break;\n }\n if (nodes.at(-1) !== end) continue;\n for (const node of nodes) container.removeChild(node);\n }\n if (storedRoot(container) === handle) delete (container as RootElement)[ROOT_KEY];\n },\n };\n (container as RootElement)[ROOT_KEY] = handle;\n return handle;\n}\n"]}
@@ -9,7 +9,7 @@ export const commonAttrs = words("id class title lang dir slot role style hidden
9
9
  export const htmlAttrs = words("href target rel download src alt width height type name value placeholder for charset datetime readonly autofocus required disabled checked selected multiple open controls muted loop autoplay novalidate formnovalidate maxlength minlength min max step pattern autocomplete accept accept-charset http-equiv content media method action enctype rows cols colspan rowspan scope cite poster loading decoding sizes srcset crossorigin referrerpolicy sandbox allow allowfullscreen start reversed property itemprop hreflang as integrity async defer nonce popover popovertarget popovertargetaction srcdoc fetchpriority inputmode autocapitalize form label preload playsinline wrap closedby");
10
10
  export const svgAttrs = words("width height viewBox preserveAspectRatio gradientUnits gradientTransform markerWidth markerHeight refX refY xlink:href xml:lang xmlns xmlns:xlink href focusable stroke-width fill-rule clip-rule stroke-linecap stroke-linejoin stop-color stop-opacity fill-opacity stroke-dasharray text-anchor fill stroke d x y x1 x2 y1 y2 cx cy r rx ry points transform opacity offset");
11
11
  export const svgTags = words("svg g path circle ellipse rect line polyline polygon text tspan defs symbol use clipPath mask linearGradient radialGradient stop title desc foreignObject pattern filter marker image");
12
- export const htmlTags = words("html head body title base link meta style script div span p a br hr main header footer nav section article aside search hgroup menu h1 h2 h3 h4 h5 h6 ul ol li dl dt dd blockquote pre code strong em b i small mark time figure figcaption img picture source video audio track canvas form label input button textarea select option optgroup fieldset legend output progress meter datalist table caption thead tbody tfoot tr th td col colgroup details summary dialog template slot iframe noscript address abbr bdi bdo cite data del dfn ins kbd map area object param q rp rt ruby s samp sub sup u var wbr embed xmp noembed noframes plaintext");
12
+ export const htmlTags = words("html head body title base link meta style script div span p a br hr main header footer nav section article aside search hgroup menu h1 h2 h3 h4 h5 h6 ul ol li dl dt dd blockquote pre code strong em b i small mark time figure figcaption img picture source video audio track canvas form label input button textarea select option optgroup fieldset legend output progress meter datalist table caption thead tbody tfoot tr th td col colgroup details summary dialog template slot iframe noscript address abbr bdi bdo cite data del dfn ins kbd map area object param q rp rb rt ruby s samp sub sup u var wbr embed xmp noembed noframes plaintext");
13
13
  // An iframe is an owned element shell. Its fallback and foreign document are never owned children.
14
14
  export function emptyIframeChildren(value) {
15
15
  if (value == null || typeof value === "boolean" || value === "")
@@ -1 +1 @@
1
- {"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/zudo-react/vocabulary.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAC3B,sEAAsE,CACvE,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAC/B,0LAA0L,CAC3L,CAAC;AACF,MAAM,CAAC,MA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AC,QAAQ,CAAC,SAAS,CAAC;YAEzE,OAAO,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,qDAAqD,CAAC,CAAC","sourcesContent":["const words = (value: string) => new Set(value.split(\" \"));\n\nexport const voidTags = words(\n \"area base br col embed hr img input link meta param source track wbr\",\n);\nexport const booleanAttrs = words(\n \"hidden inert readonly autofocus required disabled checked selected multiple open controls muted loop autoplay novalidate formnovalidate allowfullscreen reversed async defer playsinline\",\n);\nexport const enumeratedBooleanAttrs = words(\"spellcheck contenteditable draggable\");\nexport const overloadedBooleanAttrs = words(\"download\");\nexport const numericAttrs = words(\"start\");\nconst stringAttrs = words(\n \"property itemprop hreflang as integrity nonce popover popovertarget popovertargetaction srcdoc fetchpriority inputmode autocapitalize form label preload wrap closedby xmlns xmlns:xlink href focusable stroke-dasharray text-anchor\",\n);\nexport const commonAttrs = words(\n \"id class title lang dir slot role style hidden inert contenteditable draggable spellcheck tabindex accesskey translate onclick onload onerror\",\n);\nexport const htmlAttrs = words(\n \"href target rel download src alt width height type name value placeholder for charset datetime readonly autofocus required disabled checked selected multiple open controls muted loop autoplay novalidate formnovalidate maxlength minlength min max step pattern autocomplete accept accept-charset http-equiv content media method action enctype rows cols colspan rowspan scope cite poster loading decoding sizes srcset crossorigin referrerpolicy sandbox allow allowfullscreen start reversed property itemprop hreflang as integrity async defer nonce popover popovertarget popovertargetaction srcdoc fetchpriority inputmode autocapitalize form label preload playsinline wrap closedby\",\n);\nexport const svgAttrs = words(\n \"width height viewBox preserveAspectRatio gradientUnits gradientTransform markerWidth markerHeight refX refY xlink:href xml:lang xmlns xmlns:xlink href focusable stroke-width fill-rule clip-rule stroke-linecap stroke-linejoin stop-color stop-opacity fill-opacity stroke-dasharray text-anchor fill stroke d x y x1 x2 y1 y2 cx cy r rx ry points transform opacity offset\",\n);\nexport const svgTags = words(\n \"svg g path circle ellipse rect line polyline polygon text tspan defs symbol use clipPath mask linearGradient radialGradient stop title desc foreignObject pattern filter marker image\",\n);\nexport const htmlTags = words(\n \"html head body title base link meta style script div span p a br hr main header footer nav section article aside search hgroup menu h1 h2 h3 h4 h5 h6 ul ol li dl dt dd blockquote pre code strong em b i small mark time figure figcaption img picture source video audio track canvas form label input button textarea select option optgroup fieldset legend output progress meter datalist table caption thead tbody tfoot tr th td col colgroup details summary dialog template slot iframe noscript address abbr bdi bdo cite data del dfn ins kbd map area object param q rp rt ruby s samp sub sup u var wbr embed xmp noembed noframes plaintext\",\n);\nexport type Namespace = \"html\" | \"svg\";\n\n// An iframe is an owned element shell. Its fallback and foreign document are never owned children.\nexport function emptyIframeChildren(value: unknown): boolean {\n if (value == null || typeof value === \"boolean\" || value === \"\") return true;\n return Array.isArray(value) && value.every(emptyIframeChildren);\n}\n\nexport function attributeError(name: string, value: unknown, custom: boolean): string | undefined {\n if (value == null) return undefined;\n if (custom) return typeof value === \"string\" ? undefined : \"requires a string\";\n if (name === \"style\") return undefined; // style has its own object validator.\n if (booleanAttrs.has(name)) return typeof value === \"boolean\" ? undefined : \"requires a boolean\";\n if (overloadedBooleanAttrs.has(name))\n return typeof value === \"string\" || typeof value === \"boolean\"\n ? undefined\n : \"requires a string or boolean\";\n if (enumeratedBooleanAttrs.has(name))\n return typeof value === \"string\" || typeof value === \"boolean\"\n ? undefined\n : \"requires a string or boolean\";\n if (numericAttrs.has(name))\n return typeof value === \"string\" || (typeof value === \"number\" && Number.isFinite(value))\n ? undefined\n : \"requires a string or finite number\";\n if (stringAttrs.has(name)) return typeof value === \"string\" ? undefined : \"requires a string\";\n if (/^on[a-z]/.test(name)) return typeof value === \"string\" ? undefined : \"requires a string\";\n if (\n typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value)) ||\n (typeof value === \"boolean\" && /^(data-|aria-)/.test(name))\n )\n return undefined;\n return \"requires a string or finite number\";\n}\n\nexport function attributeText(name: string, value: unknown): string | null {\n if (\n value == null ||\n (booleanAttrs.has(name) && value === false) ||\n (overloadedBooleanAttrs.has(name) && value === false)\n )\n return null;\n if ((booleanAttrs.has(name) || overloadedBooleanAttrs.has(name)) && value === true) return \"\";\n return String(value);\n}\n\nexport function attributeNamespace(name: string): string | null {\n if (name === \"xlink:href\") return \"http://www.w3.org/1999/xlink\";\n if (name === \"xml:lang\") return \"http://www.w3.org/XML/1998/namespace\";\n if (name === \"xmlns\" || name === \"xmlns:xlink\") return \"http://www.w3.org/2000/xmlns/\";\n return null;\n}\n\ntype PropAlias = {\n readonly spelling: string;\n readonly namespace?: Namespace;\n};\n\nconst propAliases: Readonly<Record<string, PropAlias>> = {\n className: { spelling: \"class\" },\n htmlFor: { spelling: \"for\" },\n charSet: { spelling: \"charset\" },\n dateTime: { spelling: \"datetime\" },\n tabIndex: { spelling: \"tabindex\" },\n readOnly: { spelling: \"readonly\" },\n autoComplete: { spelling: \"autocomplete\" },\n autoFocus: { spelling: \"autofocus\" },\n maxLength: { spelling: \"maxlength\" },\n minLength: { spelling: \"minlength\" },\n crossOrigin: { spelling: \"crossorigin\" },\n srcSet: { spelling: \"srcset\" },\n acceptCharset: { spelling: \"accept-charset\" },\n httpEquiv: { spelling: \"http-equiv\" },\n encType: { spelling: \"enctype\" },\n noValidate: { spelling: \"novalidate\" },\n formNoValidate: { spelling: \"formnovalidate\" },\n colSpan: { spelling: \"colspan\" },\n rowSpan: { spelling: \"rowspan\" },\n referrerPolicy: { spelling: \"referrerpolicy\" },\n allowFullScreen: { spelling: \"allowfullscreen\" },\n autoPlay: { spelling: \"autoplay\" },\n contentEditable: { spelling: \"contenteditable\" },\n spellCheck: { spelling: \"spellcheck\" },\n accessKey: { spelling: \"accesskey\" },\n dangerouslySetInnerHTML: { spelling: \"rawHtml\" },\n strokeWidth: { spelling: \"stroke-width\", namespace: \"svg\" },\n fillRule: { spelling: \"fill-rule\", namespace: \"svg\" },\n clipRule: { spelling: \"clip-rule\", namespace: \"svg\" },\n strokeLinecap: { spelling: \"stroke-linecap\", namespace: \"svg\" },\n strokeLinejoin: { spelling: \"stroke-linejoin\", namespace: \"svg\" },\n stopColor: { spelling: \"stop-color\", namespace: \"svg\" },\n stopOpacity: { spelling: \"stop-opacity\", namespace: \"svg\" },\n xlinkHref: { spelling: \"xlink:href\", namespace: \"svg\" },\n xmlLang: { spelling: \"xml:lang\", namespace: \"svg\" },\n};\n\nconst legacyDialect = words(\n \"className htmlFor charSet dateTime tabIndex readOnly strokeWidth dangerouslySetInnerHTML\",\n);\n\nfunction allowedAliasTarget(spelling: string, namespace: Namespace): boolean {\n if (spelling === \"rawHtml\") return namespace === \"html\";\n return (\n commonAttrs.has(spelling) ||\n (namespace === \"svg\" ? svgAttrs.has(spelling) : htmlAttrs.has(spelling))\n );\n}\n\nfunction eventSuggestion(name: string): string {\n const event = name.slice(2);\n return `on:${event === \"DoubleClick\" ? \"dblclick\" : event.toLowerCase()}`;\n}\n\nexport function isDialectProp(name: string, namespace: Namespace, custom: boolean): boolean {\n if (/^on[A-Z]/.test(name) || legacyDialect.has(name)) return true;\n if (custom) return false;\n const alias = propAliases[name];\n return (\n alias !== undefined &&\n (!alias.namespace || alias.namespace === namespace) &&\n allowedAliasTarget(alias.spelling, namespace)\n );\n}\n\nexport function dialectSuggestion(\n name: string,\n namespace: Namespace,\n custom: boolean,\n): string | undefined {\n if (/^on[A-Z]/.test(name)) return eventSuggestion(name);\n if (custom && !legacyDialect.has(name)) return undefined;\n const alias = propAliases[name];\n if (!alias || (alias.namespace && alias.namespace !== namespace)) return undefined;\n return allowedAliasTarget(alias.spelling, namespace) ? alias.spelling : undefined;\n}\n\nexport function reactiveModelSuggestion(\n tag: string,\n name: string,\n inputType: string,\n custom: boolean,\n): \"modelValue\" | \"modelChecked\" | undefined {\n if (custom) return undefined;\n if (name === \"checked\" && tag === \"input\") {\n if (inputType === \"radio\") return \"modelValue\";\n if (inputType === \"checkbox\") return \"modelChecked\";\n }\n if (name === \"value\") {\n if (tag === \"textarea\" || tag === \"select\") return \"modelValue\";\n if (\n tag === \"input\" &&\n [\"text\", \"search\", \"email\", \"url\", \"tel\", \"password\"].includes(inputType)\n )\n return \"modelValue\";\n }\n return undefined;\n}\nexport const formProps = words(\"modelValue modelChecked defaultValue defaultChecked\");\n"]}
1
+ {"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/zudo-react/vocabulary.ts"],"names":[],"mappings":"AAAA,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAC3B,sEAAsE,CACvE,CAAC;AACF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAC/B,0LAA0L,CAC3L,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,sCAAsC,CAAC,CAAC;AACpF,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;AACxD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3C,MAAM,WAAW,GAAG,KAAK,CACvB,sOAAsO,CACvO,CAAC;AACF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAC9B,+IAA+I,CAChJ,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAC5B,uqBAAuqB,CACxqB,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAC3B,gXAAgX,CACjX,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAC1B,uLAAuL,CACxL,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAC3B,8nBAA8nB,CAC/nB,CAAC;AAGF,mGAAmG;AACnG,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK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AU,uBAAuB,CACrC,GAAW,EACX,IAAY,EACZ,SAAiB,EACjB,MAAe;IAEf,IAAI,MAAM;QAAE,OAAO,SAAS,CAAC;IAC7B,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,KAAK,OAAO,EAAE,CAAC;QAC1C,IAAI,SAAS,KAAK,OAAO;YAAE,OAAO,YAAY,CAAC;QAC/C,IAAI,SAAS,KAAK,UAAU;YAAE,OAAO,cAAc,CAAC;IACtD,CAAC;IACD,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,QAAQ;YAAE,OAAO,YAAY,CAAC;QAChE,IACE,GAAG,KAAK,OAAO;YACf,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC;YAEzE,OAAO,YAAY,CAAC;IACxB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AACD,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAAC,qDAAqD,CAAC,CAAC","sourcesContent":["const words = (value: string) => new Set(value.split(\" \"));\n\nexport const voidTags = words(\n \"area base br col embed hr img input link meta param source track wbr\",\n);\nexport const booleanAttrs = words(\n \"hidden inert readonly autofocus required disabled checked selected multiple open controls muted loop autoplay novalidate formnovalidate allowfullscreen reversed async defer playsinline\",\n);\nexport const enumeratedBooleanAttrs = words(\"spellcheck contenteditable draggable\");\nexport const overloadedBooleanAttrs = words(\"download\");\nexport const numericAttrs = words(\"start\");\nconst stringAttrs = words(\n \"property itemprop hreflang as integrity nonce popover popovertarget popovertargetaction srcdoc fetchpriority inputmode autocapitalize form label preload wrap closedby xmlns xmlns:xlink href focusable stroke-dasharray text-anchor\",\n);\nexport const commonAttrs = words(\n \"id class title lang dir slot role style hidden inert contenteditable draggable spellcheck tabindex accesskey translate onclick onload onerror\",\n);\nexport const htmlAttrs = words(\n \"href target rel download src alt width height type name value placeholder for charset datetime readonly autofocus required disabled checked selected multiple open controls muted loop autoplay novalidate formnovalidate maxlength minlength min max step pattern autocomplete accept accept-charset http-equiv content media method action enctype rows cols colspan rowspan scope cite poster loading decoding sizes srcset crossorigin referrerpolicy sandbox allow allowfullscreen start reversed property itemprop hreflang as integrity async defer nonce popover popovertarget popovertargetaction srcdoc fetchpriority inputmode autocapitalize form label preload playsinline wrap closedby\",\n);\nexport const svgAttrs = words(\n \"width height viewBox preserveAspectRatio gradientUnits gradientTransform markerWidth markerHeight refX refY xlink:href xml:lang xmlns xmlns:xlink href focusable stroke-width fill-rule clip-rule stroke-linecap stroke-linejoin stop-color stop-opacity fill-opacity stroke-dasharray text-anchor fill stroke d x y x1 x2 y1 y2 cx cy r rx ry points transform opacity offset\",\n);\nexport const svgTags = words(\n \"svg g path circle ellipse rect line polyline polygon text tspan defs symbol use clipPath mask linearGradient radialGradient stop title desc foreignObject pattern filter marker image\",\n);\nexport const htmlTags = words(\n \"html head body title base link meta style script div span p a br hr main header footer nav section article aside search hgroup menu h1 h2 h3 h4 h5 h6 ul ol li dl dt dd blockquote pre code strong em b i small mark time figure figcaption img picture source video audio track canvas form label input button textarea select option optgroup fieldset legend output progress meter datalist table caption thead tbody tfoot tr th td col colgroup details summary dialog template slot iframe noscript address abbr bdi bdo cite data del dfn ins kbd map area object param q rp rb rt ruby s samp sub sup u var wbr embed xmp noembed noframes plaintext\",\n);\nexport type Namespace = \"html\" | \"svg\";\n\n// An iframe is an owned element shell. Its fallback and foreign document are never owned children.\nexport function emptyIframeChildren(value: unknown): boolean {\n if (value == null || typeof value === \"boolean\" || value === \"\") return true;\n return Array.isArray(value) && value.every(emptyIframeChildren);\n}\n\nexport function attributeError(name: string, value: unknown, custom: boolean): string | undefined {\n if (value == null) return undefined;\n if (custom) return typeof value === \"string\" ? undefined : \"requires a string\";\n if (name === \"style\") return undefined; // style has its own object validator.\n if (booleanAttrs.has(name)) return typeof value === \"boolean\" ? undefined : \"requires a boolean\";\n if (overloadedBooleanAttrs.has(name))\n return typeof value === \"string\" || typeof value === \"boolean\"\n ? undefined\n : \"requires a string or boolean\";\n if (enumeratedBooleanAttrs.has(name))\n return typeof value === \"string\" || typeof value === \"boolean\"\n ? undefined\n : \"requires a string or boolean\";\n if (numericAttrs.has(name))\n return typeof value === \"string\" || (typeof value === \"number\" && Number.isFinite(value))\n ? undefined\n : \"requires a string or finite number\";\n if (stringAttrs.has(name)) return typeof value === \"string\" ? undefined : \"requires a string\";\n if (/^on[a-z]/.test(name)) return typeof value === \"string\" ? undefined : \"requires a string\";\n if (\n typeof value === \"string\" ||\n (typeof value === \"number\" && Number.isFinite(value)) ||\n (typeof value === \"boolean\" && /^(data-|aria-)/.test(name))\n )\n return undefined;\n return \"requires a string or finite number\";\n}\n\nexport function attributeText(name: string, value: unknown): string | null {\n if (\n value == null ||\n (booleanAttrs.has(name) && value === false) ||\n (overloadedBooleanAttrs.has(name) && value === false)\n )\n return null;\n if ((booleanAttrs.has(name) || overloadedBooleanAttrs.has(name)) && value === true) return \"\";\n return String(value);\n}\n\nexport function attributeNamespace(name: string): string | null {\n if (name === \"xlink:href\") return \"http://www.w3.org/1999/xlink\";\n if (name === \"xml:lang\") return \"http://www.w3.org/XML/1998/namespace\";\n if (name === \"xmlns\" || name === \"xmlns:xlink\") return \"http://www.w3.org/2000/xmlns/\";\n return null;\n}\n\ntype PropAlias = {\n readonly spelling: string;\n readonly namespace?: Namespace;\n};\n\nconst propAliases: Readonly<Record<string, PropAlias>> = {\n className: { spelling: \"class\" },\n htmlFor: { spelling: \"for\" },\n charSet: { spelling: \"charset\" },\n dateTime: { spelling: \"datetime\" },\n tabIndex: { spelling: \"tabindex\" },\n readOnly: { spelling: \"readonly\" },\n autoComplete: { spelling: \"autocomplete\" },\n autoFocus: { spelling: \"autofocus\" },\n maxLength: { spelling: \"maxlength\" },\n minLength: { spelling: \"minlength\" },\n crossOrigin: { spelling: \"crossorigin\" },\n srcSet: { spelling: \"srcset\" },\n acceptCharset: { spelling: \"accept-charset\" },\n httpEquiv: { spelling: \"http-equiv\" },\n encType: { spelling: \"enctype\" },\n noValidate: { spelling: \"novalidate\" },\n formNoValidate: { spelling: \"formnovalidate\" },\n colSpan: { spelling: \"colspan\" },\n rowSpan: { spelling: \"rowspan\" },\n referrerPolicy: { spelling: \"referrerpolicy\" },\n allowFullScreen: { spelling: \"allowfullscreen\" },\n autoPlay: { spelling: \"autoplay\" },\n contentEditable: { spelling: \"contenteditable\" },\n spellCheck: { spelling: \"spellcheck\" },\n accessKey: { spelling: \"accesskey\" },\n dangerouslySetInnerHTML: { spelling: \"rawHtml\" },\n strokeWidth: { spelling: \"stroke-width\", namespace: \"svg\" },\n fillRule: { spelling: \"fill-rule\", namespace: \"svg\" },\n clipRule: { spelling: \"clip-rule\", namespace: \"svg\" },\n strokeLinecap: { spelling: \"stroke-linecap\", namespace: \"svg\" },\n strokeLinejoin: { spelling: \"stroke-linejoin\", namespace: \"svg\" },\n stopColor: { spelling: \"stop-color\", namespace: \"svg\" },\n stopOpacity: { spelling: \"stop-opacity\", namespace: \"svg\" },\n xlinkHref: { spelling: \"xlink:href\", namespace: \"svg\" },\n xmlLang: { spelling: \"xml:lang\", namespace: \"svg\" },\n};\n\nconst legacyDialect = words(\n \"className htmlFor charSet dateTime tabIndex readOnly strokeWidth dangerouslySetInnerHTML\",\n);\n\nfunction allowedAliasTarget(spelling: string, namespace: Namespace): boolean {\n if (spelling === \"rawHtml\") return namespace === \"html\";\n return (\n commonAttrs.has(spelling) ||\n (namespace === \"svg\" ? svgAttrs.has(spelling) : htmlAttrs.has(spelling))\n );\n}\n\nfunction eventSuggestion(name: string): string {\n const event = name.slice(2);\n return `on:${event === \"DoubleClick\" ? \"dblclick\" : event.toLowerCase()}`;\n}\n\nexport function isDialectProp(name: string, namespace: Namespace, custom: boolean): boolean {\n if (/^on[A-Z]/.test(name) || legacyDialect.has(name)) return true;\n if (custom) return false;\n const alias = propAliases[name];\n return (\n alias !== undefined &&\n (!alias.namespace || alias.namespace === namespace) &&\n allowedAliasTarget(alias.spelling, namespace)\n );\n}\n\nexport function dialectSuggestion(\n name: string,\n namespace: Namespace,\n custom: boolean,\n): string | undefined {\n if (/^on[A-Z]/.test(name)) return eventSuggestion(name);\n if (custom && !legacyDialect.has(name)) return undefined;\n const alias = propAliases[name];\n if (!alias || (alias.namespace && alias.namespace !== namespace)) return undefined;\n return allowedAliasTarget(alias.spelling, namespace) ? alias.spelling : undefined;\n}\n\nexport function reactiveModelSuggestion(\n tag: string,\n name: string,\n inputType: string,\n custom: boolean,\n): \"modelValue\" | \"modelChecked\" | undefined {\n if (custom) return undefined;\n if (name === \"checked\" && tag === \"input\") {\n if (inputType === \"radio\") return \"modelValue\";\n if (inputType === \"checkbox\") return \"modelChecked\";\n }\n if (name === \"value\") {\n if (tag === \"textarea\" || tag === \"select\") return \"modelValue\";\n if (\n tag === \"input\" &&\n [\"text\", \"search\", \"email\", \"url\", \"tel\", \"password\"].includes(inputType)\n )\n return \"modelValue\";\n }\n return undefined;\n}\nexport const formProps = words(\"modelValue modelChecked defaultValue defaultChecked\");\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zfb",
3
- "version": "3.2.0",
3
+ "version": "4.0.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Content-site engine on the web's Request/Response model — prerender to static HTML, serve on Cloudflare Workers, or run as a local content server inside your app. One Rust binary. SDK with islands, content collections, pagination, and config helpers.",
@@ -96,11 +96,11 @@
96
96
  "LICENSE"
97
97
  ],
98
98
  "optionalDependencies": {
99
- "@takazudo/zfb-darwin-arm64": "3.2.0",
100
- "@takazudo/zfb-darwin-x64": "3.2.0",
101
- "@takazudo/zfb-linux-arm64-gnu": "3.2.0",
102
- "@takazudo/zfb-linux-x64-gnu": "3.2.0",
103
- "@takazudo/zfb-win32-x64-msvc": "3.2.0"
99
+ "@takazudo/zfb-darwin-arm64": "4.0.0",
100
+ "@takazudo/zfb-darwin-x64": "4.0.0",
101
+ "@takazudo/zfb-linux-arm64-gnu": "4.0.0",
102
+ "@takazudo/zfb-linux-x64-gnu": "4.0.0",
103
+ "@takazudo/zfb-win32-x64-msvc": "4.0.0"
104
104
  },
105
105
  "publishConfig": {
106
106
  "access": "public"