@takazudo/zfb 2.22.1 → 3.1.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.
Files changed (88) hide show
  1. package/README.md +13 -16
  2. package/dist/config.d.ts +77 -25
  3. package/dist/config.js +27 -6
  4. package/dist/config.js.map +1 -1
  5. package/dist/content.d.ts +8 -22
  6. package/dist/content.js +6 -28
  7. package/dist/content.js.map +1 -1
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.js +1 -1
  10. package/dist/index.js.map +1 -1
  11. package/dist/island-boundary.d.ts +4 -0
  12. package/dist/island-boundary.js +42 -0
  13. package/dist/island-boundary.js.map +1 -0
  14. package/dist/island.d.ts +2 -118
  15. package/dist/island.js +4 -284
  16. package/dist/island.js.map +1 -1
  17. package/dist/jsx-types.d.ts +2 -38
  18. package/dist/jsx-types.js +3 -10
  19. package/dist/jsx-types.js.map +1 -1
  20. package/dist/plugins.d.ts +40 -0
  21. package/dist/plugins.js.map +1 -1
  22. package/dist/runtime.d.ts +26 -77
  23. package/dist/runtime.js +307 -340
  24. package/dist/runtime.js.map +1 -1
  25. package/dist/zudo-react/client.d.ts +3 -0
  26. package/dist/zudo-react/client.js +3 -0
  27. package/dist/zudo-react/client.js.map +1 -0
  28. package/dist/zudo-react/description.d.ts +16 -0
  29. package/dist/zudo-react/description.js +64 -0
  30. package/dist/zudo-react/description.js.map +1 -0
  31. package/dist/zudo-react/dom-bindings.d.ts +13 -0
  32. package/dist/zudo-react/dom-bindings.js +58 -0
  33. package/dist/zudo-react/dom-bindings.js.map +1 -0
  34. package/dist/zudo-react/escape.d.ts +2 -0
  35. package/dist/zudo-react/escape.js +7 -0
  36. package/dist/zudo-react/escape.js.map +1 -0
  37. package/dist/zudo-react/forms.d.ts +29 -0
  38. package/dist/zudo-react/forms.js +371 -0
  39. package/dist/zudo-react/forms.js.map +1 -0
  40. package/dist/zudo-react/hydrate.d.ts +4 -0
  41. package/dist/zudo-react/hydrate.js +912 -0
  42. package/dist/zudo-react/hydrate.js.map +1 -0
  43. package/dist/zudo-react/index.d.ts +47 -0
  44. package/dist/zudo-react/index.js +13 -0
  45. package/dist/zudo-react/index.js.map +1 -0
  46. package/dist/zudo-react/island-root-type.d.ts +1 -0
  47. package/dist/zudo-react/island-root-type.js +2 -0
  48. package/dist/zudo-react/island-root-type.js.map +1 -0
  49. package/dist/zudo-react/jsx-dev-runtime.d.ts +8 -0
  50. package/dist/zudo-react/jsx-dev-runtime.js +6 -0
  51. package/dist/zudo-react/jsx-dev-runtime.js.map +1 -0
  52. package/dist/zudo-react/jsx-runtime.d.ts +5 -0
  53. package/dist/zudo-react/jsx-runtime.js +7 -0
  54. package/dist/zudo-react/jsx-runtime.js.map +1 -0
  55. package/dist/zudo-react/jsx-types.d.ts +216 -0
  56. package/dist/zudo-react/jsx-types.js +2 -0
  57. package/dist/zudo-react/jsx-types.js.map +1 -0
  58. package/dist/zudo-react/props-transport.d.ts +2 -0
  59. package/dist/zudo-react/props-transport.js +95 -0
  60. package/dist/zudo-react/props-transport.js.map +1 -0
  61. package/dist/zudo-react/reactive-types.d.ts +8 -0
  62. package/dist/zudo-react/reactive-types.js +2 -0
  63. package/dist/zudo-react/reactive-types.js.map +1 -0
  64. package/dist/zudo-react/reactive.d.ts +20 -0
  65. package/dist/zudo-react/reactive.js +176 -0
  66. package/dist/zudo-react/reactive.js.map +1 -0
  67. package/dist/zudo-react/render-html.d.ts +3 -0
  68. package/dist/zudo-react/render-html.js +535 -0
  69. package/dist/zudo-react/render-html.js.map +1 -0
  70. package/dist/zudo-react/root.d.ts +20 -0
  71. package/dist/zudo-react/root.js +74 -0
  72. package/dist/zudo-react/root.js.map +1 -0
  73. package/dist/zudo-react/scheduler.d.ts +12 -0
  74. package/dist/zudo-react/scheduler.js +113 -0
  75. package/dist/zudo-react/scheduler.js.map +1 -0
  76. package/dist/zudo-react/scope.d.ts +42 -0
  77. package/dist/zudo-react/scope.js +220 -0
  78. package/dist/zudo-react/scope.js.map +1 -0
  79. package/dist/zudo-react/server.d.ts +15 -0
  80. package/dist/zudo-react/server.js +11 -0
  81. package/dist/zudo-react/server.js.map +1 -0
  82. package/dist/zudo-react/structure.d.ts +16 -0
  83. package/dist/zudo-react/structure.js +49 -0
  84. package/dist/zudo-react/structure.js.map +1 -0
  85. package/dist/zudo-react/vocabulary.d.ts +12 -0
  86. package/dist/zudo-react/vocabulary.js +96 -0
  87. package/dist/zudo-react/vocabulary.js.map +1 -0
  88. package/package.json +28 -24
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/zudo-react/scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAqB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,OAAO,EAAY,MAAM,gBAAgB,CAAC;AAGnD,IAAI,YAAY,GAAwB,IAAI,CAAC;AAC7C,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,SAAS,SAAS,CAAC,KAAc;IAC/B,OAAO,CACL,KAAK,KAAK,IAAI;QACd,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;QAC1D,OAAQ,KAA4B,CAAC,IAAI,KAAK,UAAU,CACzD,CAAC;AACJ,CAAC;AAWD,MAAM,OAAO,YAAY;IACd,EAAE,GAAG,EAAE,WAAW,CAAC;IACnB,SAAS,CAAS;IAClB,MAAM,CAA2B;IACzB,QAAQ,CAAuB;IAC/B,IAAI,CAAS;IACb,QAAQ,CAAS;IACjB,KAAK,CAAS;IACd,QAAQ,GAAmB,EAAE,CAAC;IAC9B,QAAQ,GAAc,EAAE,CAAC;IACzB,WAAW,GAAgC,EAAE,CAAC;IAC9C,OAAO,GAAsD,EAAE,CAAC;IACzE,UAAU,CAA8B;IACxC,IAAI,GAAG,IAAI,CAAC;IACZ,SAAS,GAAG,KAAK,CAAC;IACT,WAAW,GAAG,CAAC,IAAY,EAAE,MAAc,EAAQ,EAA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SAAS,CAAC,OAAO,CAAC,CAAC;gBAC3C,IAAI,SAAS,CAAC,MAAM,CAAC;oBACnB,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,SAAS,EAAE,4BAA4B,CAAC,CAAC;YAC7E,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,OAAqB;IAC/C,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AACD,MAAM,UAAU,SAAS,CAAI,KAAmB,EAAE,EAAW;IAC3D,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,YAAY,CAAC;IAC9B,YAAY,GAAG,KAAK,CAAC;IACrB,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;YAAS,CAAC;QACT,YAAY,GAAG,QAAQ,CAAC;IAC1B,CAAC;AACH,CAAC;AACD,MAAM,UAAU,QAAQ;IACtB,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,WAAW;QACnE,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,OAAO,YAAY,CAAC;AACtB,CAAC","sourcesContent":["import { subscribe, untracked, type Subscription } from \"./reactive.js\";\nimport { enqueue, type Job } from \"./scheduler.js\";\nimport type { Cleanup, Diagnostic, Reporter, Scope } from \"./index.js\";\n\nlet currentScope: RuntimeScope | null = null;\nlet nextScopeId = 0;\n\nfunction isPromise(value: unknown): value is PromiseLike<unknown> {\n return (\n value !== null &&\n (typeof value === \"object\" || typeof value === \"function\") &&\n typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\nexport interface ScopeOptions {\n component: string;\n reporter?: Reporter;\n parent?: RuntimeScope;\n path?: string;\n protocol?: string;\n build?: string;\n}\n\nexport class RuntimeScope implements Scope {\n readonly id = ++nextScopeId;\n readonly component: string;\n readonly parent: RuntimeScope | undefined;\n private readonly reporter: Reporter | undefined;\n private readonly path: string;\n private readonly protocol: string;\n private readonly build: string;\n private readonly children: RuntimeScope[] = [];\n private readonly cleanups: Cleanup[] = [];\n private readonly activations: Array<() => void | Cleanup> = [];\n private readonly effects: Array<{ start: () => void; dispose: () => void }> = [];\n private controller: AbortController | undefined;\n private live = true;\n private activated = false;\n private readonly jobReporter = (code: string, actual: string): void => {\n this.report(code, \"update\", actual);\n };\n private root(): RuntimeScope {\n return this.parent?.root() ?? this;\n }\n\n constructor(options: ScopeOptions) {\n this.component = options.component;\n this.parent = options.parent;\n this.reporter = options.reporter ?? options.parent?.reporter;\n this.path = options.path ?? options.parent?.path ?? \"\";\n this.protocol = options.protocol ?? options.parent?.protocol ?? \"zudo-react.v1\";\n this.build = options.build ?? options.parent?.build ?? \"\";\n this.parent?.children.push(this);\n }\n get active(): boolean {\n return this.live;\n }\n get isActivated(): boolean {\n return this.activated;\n }\n get abortSignal(): AbortSignal {\n this.controller ??= new AbortController();\n if (!this.live && !this.controller.signal.aborted) this.controller.abort();\n return this.controller.signal;\n }\n private ensureSetup(): void {\n if (!this.live || this.activated || currentScope !== this)\n throw new Error(\"ZR_SCOPE_SETUP: registration requires active setup\");\n }\n report(code: string, phase: Diagnostic[\"phase\"], actual: string): void {\n const stack: string[] = [];\n for (let scope: RuntimeScope | undefined = this; scope; scope = scope.parent)\n stack.unshift(scope.component);\n try {\n this.reporter?.({\n code,\n phase,\n component: this.component,\n componentStack: stack,\n path: this.path,\n expected: \"\",\n actual,\n protocol: this.protocol,\n build: this.build,\n });\n } catch {\n /* Reporter failures must not stop resource cleanup. */\n }\n }\n onCleanup(fn: Cleanup): void {\n this.ensureSetup();\n this.cleanups.push(fn);\n }\n onActivate(fn: () => void | Cleanup): void {\n this.ensureSetup();\n this.activations.push(fn);\n }\n effect(fn: () => void | Cleanup): void {\n this.ensureSetup();\n let cleanup: Cleanup | undefined;\n const subscription: Subscription = subscribe(\n () => {\n if (cleanup) {\n try {\n const result: unknown = untracked(cleanup);\n if (isPromise(result))\n this.report(\"ZR_ASYNC_CLEANUP\", \"cleanup\", \"effect cleanup returned a promise\");\n } catch (error) {\n this.report(\"ZR_EFFECT_CLEANUP\", \"cleanup\", String(error));\n }\n cleanup = undefined;\n }\n try {\n const result = fn();\n if (isPromise(result))\n this.report(\"ZR_ASYNC_CLEANUP\", \"update\", \"effect returned a promise\");\n else if (typeof result === \"function\") cleanup = result;\n } catch (error) {\n this.report(\"ZR_EFFECT_ERROR\", \"update\", String(error));\n }\n },\n {\n phase: \"effect\",\n id: `${this.component}:effect:${this.id}:${this.effects.length}`,\n active: () => this.live && this.activated,\n report: this.root().jobReporter,\n },\n );\n const job: Job = {\n id: subscription.id,\n phase: \"effect\",\n active: () => this.live && this.activated,\n run: () => subscription.run(),\n report: this.root().jobReporter,\n };\n this.effects.push({\n start: () => enqueue(job),\n dispose: () => {\n subscription.dispose();\n if (cleanup) {\n try {\n const result: unknown = untracked(cleanup);\n if (isPromise(result))\n this.report(\"ZR_ASYNC_CLEANUP\", \"cleanup\", \"effect cleanup returned a promise\");\n } catch (error) {\n this.report(\"ZR_EFFECT_CLEANUP\", \"cleanup\", String(error));\n }\n cleanup = undefined;\n }\n },\n });\n }\n child(component: string): RuntimeScope {\n if (!this.live) throw new Error(\"ZR_SCOPE_DISPOSED\");\n return new RuntimeScope({ component, parent: this });\n }\n activate(): void {\n if (!this.live || this.activated) return;\n try {\n for (const child of this.children) child.activate();\n } catch (error) {\n this.dispose();\n throw error;\n }\n this.activated = true;\n for (const fn of this.activations) {\n try {\n const result = fn();\n if (isPromise(result)) throw new Error(\"ZR_ASYNC_CLEANUP: activation returned a promise\");\n if (typeof result === \"function\") this.cleanups.push(result);\n } catch (error) {\n this.report(\"ZR_ACTIVATION_ERROR\", \"activation\", String(error));\n this.dispose();\n throw error;\n }\n }\n for (const effect of this.effects) effect.start();\n }\n dispose(): void {\n if (!this.live) return;\n this.live = false;\n this.controller?.abort();\n for (const child of [...this.children].reverse()) child.dispose();\n this.children.length = 0;\n for (const effect of this.effects) effect.dispose();\n this.effects.length = 0;\n for (const cleanup of [...this.cleanups].reverse()) {\n try {\n const result: unknown = untracked(cleanup);\n if (isPromise(result))\n this.report(\"ZR_ASYNC_CLEANUP\", \"cleanup\", \"cleanup returned a promise\");\n } catch (error) {\n this.report(\"ZR_CLEANUP_ERROR\", \"cleanup\", String(error));\n }\n }\n this.cleanups.length = 0;\n this.activations.length = 0;\n }\n}\n\nexport function createScope(options: ScopeOptions): RuntimeScope {\n return new RuntimeScope(options);\n}\nexport function withScope<T>(scope: RuntimeScope, fn: () => T): T {\n if (!scope.active) throw new Error(\"ZR_SCOPE_DISPOSED\");\n const previous = currentScope;\n currentScope = scope;\n try {\n return fn();\n } finally {\n currentScope = previous;\n }\n}\nexport function getScope(): Scope {\n if (!currentScope || !currentScope.active || currentScope.isActivated)\n throw new Error(\"ZR_NO_SCOPE: getScope requires synchronous setup\");\n return currentScope;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { Child, Description } from "./description.js";
2
+ import type { IslandIdentity } from "./index.js";
3
+ export { serializeProps } from "./props-transport.js";
4
+ export interface RenderOptions {
5
+ island?: IslandIdentity | undefined;
6
+ }
7
+ export interface IslandOptions {
8
+ identity: IslandIdentity;
9
+ when?: "load" | "idle" | "visible" | "media" | undefined;
10
+ media?: string | undefined;
11
+ skipSsr?: boolean | undefined;
12
+ fallback?: Child;
13
+ }
14
+ export declare function islandRoot(child: Description, options: IslandOptions): Description;
15
+ export declare function renderToString(node: Child, options?: RenderOptions): string;
@@ -0,0 +1,11 @@
1
+ import { createDescription } from "./description.js";
2
+ import { islandRootType } from "./island-root-type.js";
3
+ import { renderHtml } from "./render-html.js";
4
+ export { serializeProps } from "./props-transport.js";
5
+ export function islandRoot(child, options) {
6
+ return createDescription(islandRootType, { child, options });
7
+ }
8
+ export function renderToString(node, options = {}) {
9
+ return renderHtml(node, options);
10
+ }
11
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/zudo-react/server.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAYtD,MAAM,UAAU,UAAU,CAAC,KAAkB,EAAE,OAAsB;IACnE,OAAO,iBAAiB,CAAC,cAAuB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AACxE,CAAC;AACD,MAAM,UAAU,cAAc,CAAC,IAAW,EAAE,UAAyB,EAAE;IACrE,OAAO,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { Child, Description } from \"./description.js\";\nimport type { IslandIdentity } from \"./index.js\";\nimport { createDescription } from \"./description.js\";\nimport { islandRootType } from \"./island-root-type.js\";\nimport { renderHtml } from \"./render-html.js\";\n\nexport { serializeProps } from \"./props-transport.js\";\n\nexport interface RenderOptions {\n island?: IslandIdentity | undefined;\n}\nexport interface IslandOptions {\n identity: IslandIdentity;\n when?: \"load\" | \"idle\" | \"visible\" | \"media\" | undefined;\n media?: string | undefined;\n skipSsr?: boolean | undefined;\n fallback?: Child;\n}\nexport function islandRoot(child: Description, options: IslandOptions): Description {\n return createDescription(islandRootType as never, { child, options });\n}\nexport function renderToString(node: Child, options: RenderOptions = {}): string {\n return renderHtml(node, options);\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import { type Child, type Description, type Key } from "./description.js";
2
+ import type { ReadonlySignal } from "./reactive-types.js";
3
+ import type { ShowProps, ForProps } from "./index.js";
4
+ export declare function Show(props: ShowProps): Description;
5
+ export declare function For<T>(props: ForProps<T>): Description;
6
+ export declare function isShowType(type: unknown): type is typeof Show;
7
+ export declare function isForType(type: unknown): type is typeof For;
8
+ export declare function showProps(description: Description): ShowProps;
9
+ export declare function forProps<T>(description: Description): ForProps<T>;
10
+ export declare function keyed<T>(items: readonly T[], by: (item: T) => Key, path: string): Key[];
11
+ export declare function keyPayload(key: Key): string;
12
+ export declare function view<T>(initial: T): {
13
+ readonly value: ReadonlySignal<T>;
14
+ write(next: T): void;
15
+ };
16
+ export type Factory = () => Child;
@@ -0,0 +1,49 @@
1
+ import { createDescription } from "./description.js";
2
+ import { computed, signal } from "./reactive.js";
3
+ export function Show(props) {
4
+ return createDescription(Show, props);
5
+ }
6
+ export function For(props) {
7
+ return createDescription(For, props);
8
+ }
9
+ // The renderer and an island component can resolve separate copies of this
10
+ // module when a package manager preserves dependency symlinks. Recognize the
11
+ // component by a shared marker so rendering does not recursively call Show/For
12
+ // as ordinary function components.
13
+ const showMarker = Symbol.for("@takazudo/zfb/zudo-react/Show");
14
+ const forMarker = Symbol.for("@takazudo/zfb/zudo-react/For");
15
+ Object.defineProperty(Show, showMarker, { value: true });
16
+ Object.defineProperty(For, forMarker, { value: true });
17
+ export function isShowType(type) {
18
+ return typeof type === "function" && showMarker in type;
19
+ }
20
+ export function isForType(type) {
21
+ return typeof type === "function" && forMarker in type;
22
+ }
23
+ export function showProps(description) {
24
+ return description.props;
25
+ }
26
+ export function forProps(description) {
27
+ return description.props;
28
+ }
29
+ export function keyed(items, by, path) {
30
+ const seen = new Set();
31
+ return items.map((item) => {
32
+ const key = by(item);
33
+ if (typeof key !== "string" && !(typeof key === "number" && Number.isFinite(key)))
34
+ throw new TypeError(`ZR_KEY_TYPE: For at ${path}, key ${String(key)}`);
35
+ if (seen.has(key))
36
+ throw new TypeError(`ZR_DUPLICATE_KEY: For at ${path}, key ${String(key)}`);
37
+ seen.add(key);
38
+ return key;
39
+ });
40
+ }
41
+ export function keyPayload(key) {
42
+ const bytes = new TextEncoder().encode(String(key));
43
+ return `${typeof key === "number" ? "n" : "s"}${Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
44
+ }
45
+ export function view(initial) {
46
+ const source = signal(initial);
47
+ return { value: computed(() => source.value), write: (next) => (source.value = next) };
48
+ }
49
+ //# sourceMappingURL=structure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structure.js","sourceRoot":"","sources":["../../src/zudo-react/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA0C,MAAM,kBAAkB,CAAC;AAC7F,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIjD,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,OAAO,iBAAiB,CAAC,IAAI,EAAE,KAA2C,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,GAAG,CAAI,KAAkB;IACvC,OAAO,iBAAiB,CAAC,GAAG,EAAE,KAA2C,CAAC,CAAC;AAC7E,CAAC;AAED,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,mCAAmC;AACnC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;AAC/D,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC;AAC7D,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACzD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAEvD,MAAM,UAAU,UAAU,CAAC,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AK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CACzE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACnC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;AACf,CAAC;AAED,MAAM,UAAU,IAAI,CAAI,OAAU;IAChC,MAAM,MAAM,GAAc,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC;AACzF,CAAC","sourcesContent":["import { createDescription, type Child, type Description, type Key } from \"./description.js\";\nimport { computed, signal } from \"./reactive.js\";\nimport type { ReadonlySignal, Signal } from \"./reactive-types.js\";\nimport type { ShowProps, ForProps } from \"./index.js\";\n\nexport function Show(props: ShowProps): Description {\n return createDescription(Show, props as unknown as Record<string, unknown>);\n}\n\nexport function For<T>(props: ForProps<T>): Description {\n return createDescription(For, props as unknown as Record<string, unknown>);\n}\n\n// The renderer and an island component can resolve separate copies of this\n// module when a package manager preserves dependency symlinks. Recognize the\n// component by a shared marker so rendering does not recursively call Show/For\n// as ordinary function components.\nconst showMarker = Symbol.for(\"@takazudo/zfb/zudo-react/Show\");\nconst forMarker = Symbol.for(\"@takazudo/zfb/zudo-react/For\");\nObject.defineProperty(Show, showMarker, { value: true });\nObject.defineProperty(For, forMarker, { value: true });\n\nexport function isShowType(type: unknown): type is typeof Show {\n return typeof type === \"function\" && showMarker in type;\n}\n\nexport function isForType(type: unknown): type is typeof For {\n return typeof type === \"function\" && forMarker in type;\n}\n\nexport function showProps(description: Description): ShowProps {\n return description.props as unknown as ShowProps;\n}\n\nexport function forProps<T>(description: Description): ForProps<T> {\n return description.props as unknown as ForProps<T>;\n}\n\nexport function keyed<T>(items: readonly T[], by: (item: T) => Key, path: string): Key[] {\n const seen = new Set<Key>();\n return items.map((item) => {\n const key = by(item);\n if (typeof key !== \"string\" && !(typeof key === \"number\" && Number.isFinite(key)))\n throw new TypeError(`ZR_KEY_TYPE: For at ${path}, key ${String(key)}`);\n if (seen.has(key)) throw new TypeError(`ZR_DUPLICATE_KEY: For at ${path}, key ${String(key)}`);\n seen.add(key);\n return key;\n });\n}\n\nexport function keyPayload(key: Key): string {\n const bytes = new TextEncoder().encode(String(key));\n return `${typeof key === \"number\" ? \"n\" : \"s\"}${Array.from(bytes, (byte) =>\n byte.toString(16).padStart(2, \"0\"),\n ).join(\"\")}`;\n}\n\nexport function view<T>(initial: T): { readonly value: ReadonlySignal<T>; write(next: T): void } {\n const source: Signal<T> = signal(initial);\n return { value: computed(() => source.value), write: (next) => (source.value = next) };\n}\n\nexport type Factory = () => Child;\n"]}
@@ -0,0 +1,12 @@
1
+ export declare const voidTags: Set<string>;
2
+ export declare const booleanAttrs: Set<string>;
3
+ export declare const commonAttrs: Set<string>;
4
+ export declare const htmlAttrs: Set<string>;
5
+ export declare const svgAttrs: Set<string>;
6
+ export declare const svgTags: Set<string>;
7
+ export declare const htmlTags: Set<string>;
8
+ export type Namespace = "html" | "svg";
9
+ export declare function isDialectProp(name: string, namespace: Namespace, custom: boolean): boolean;
10
+ export declare function dialectSuggestion(name: string, namespace: Namespace, custom: boolean): string | undefined;
11
+ export declare function reactiveModelSuggestion(tag: string, name: string, inputType: string, custom: boolean): "modelValue" | "modelChecked" | undefined;
12
+ export declare const formProps: Set<string>;
@@ -0,0 +1,96 @@
1
+ const words = (value) => new Set(value.split(" "));
2
+ export const voidTags = words("area base br col embed hr img input link meta param source track wbr");
3
+ export const booleanAttrs = words("hidden inert readonly autofocus required disabled checked selected multiple open controls muted loop autoplay novalidate formnovalidate allowfullscreen reversed");
4
+ export const commonAttrs = words("id class title lang dir slot role style hidden inert contenteditable draggable spellcheck tabindex accesskey translate onclick onload onerror");
5
+ 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");
6
+ export const svgAttrs = words("width height viewBox preserveAspectRatio gradientUnits gradientTransform markerWidth markerHeight refX refY xlink:href xml:lang stroke-width fill-rule clip-rule stroke-linecap stroke-linejoin stop-color stop-opacity fill stroke d x y x1 x2 y1 y2 cx cy r rx ry points transform opacity offset");
7
+ 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");
8
+ 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 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");
9
+ const propAliases = {
10
+ className: { spelling: "class" },
11
+ htmlFor: { spelling: "for" },
12
+ charSet: { spelling: "charset" },
13
+ dateTime: { spelling: "datetime" },
14
+ tabIndex: { spelling: "tabindex" },
15
+ readOnly: { spelling: "readonly" },
16
+ autoComplete: { spelling: "autocomplete" },
17
+ autoFocus: { spelling: "autofocus" },
18
+ maxLength: { spelling: "maxlength" },
19
+ minLength: { spelling: "minlength" },
20
+ crossOrigin: { spelling: "crossorigin" },
21
+ srcSet: { spelling: "srcset" },
22
+ acceptCharset: { spelling: "accept-charset" },
23
+ httpEquiv: { spelling: "http-equiv" },
24
+ encType: { spelling: "enctype" },
25
+ noValidate: { spelling: "novalidate" },
26
+ formNoValidate: { spelling: "formnovalidate" },
27
+ colSpan: { spelling: "colspan" },
28
+ rowSpan: { spelling: "rowspan" },
29
+ referrerPolicy: { spelling: "referrerpolicy" },
30
+ allowFullScreen: { spelling: "allowfullscreen" },
31
+ autoPlay: { spelling: "autoplay" },
32
+ contentEditable: { spelling: "contenteditable" },
33
+ spellCheck: { spelling: "spellcheck" },
34
+ accessKey: { spelling: "accesskey" },
35
+ dangerouslySetInnerHTML: { spelling: "rawHtml" },
36
+ strokeWidth: { spelling: "stroke-width", namespace: "svg" },
37
+ fillRule: { spelling: "fill-rule", namespace: "svg" },
38
+ clipRule: { spelling: "clip-rule", namespace: "svg" },
39
+ strokeLinecap: { spelling: "stroke-linecap", namespace: "svg" },
40
+ strokeLinejoin: { spelling: "stroke-linejoin", namespace: "svg" },
41
+ stopColor: { spelling: "stop-color", namespace: "svg" },
42
+ stopOpacity: { spelling: "stop-opacity", namespace: "svg" },
43
+ xlinkHref: { spelling: "xlink:href", namespace: "svg" },
44
+ xmlLang: { spelling: "xml:lang", namespace: "svg" },
45
+ };
46
+ const legacyDialect = words("className htmlFor charSet dateTime tabIndex readOnly strokeWidth dangerouslySetInnerHTML");
47
+ function allowedAliasTarget(spelling, namespace) {
48
+ if (spelling === "rawHtml")
49
+ return namespace === "html";
50
+ return (commonAttrs.has(spelling) ||
51
+ (namespace === "svg" ? svgAttrs.has(spelling) : htmlAttrs.has(spelling)));
52
+ }
53
+ function eventSuggestion(name) {
54
+ const event = name.slice(2);
55
+ return `on:${event === "DoubleClick" ? "dblclick" : event.toLowerCase()}`;
56
+ }
57
+ export function isDialectProp(name, namespace, custom) {
58
+ if (/^on[A-Z]/.test(name) || legacyDialect.has(name))
59
+ return true;
60
+ if (custom)
61
+ return false;
62
+ const alias = propAliases[name];
63
+ return (alias !== undefined &&
64
+ (!alias.namespace || alias.namespace === namespace) &&
65
+ allowedAliasTarget(alias.spelling, namespace));
66
+ }
67
+ export function dialectSuggestion(name, namespace, custom) {
68
+ if (/^on[A-Z]/.test(name))
69
+ return eventSuggestion(name);
70
+ if (custom && !legacyDialect.has(name))
71
+ return undefined;
72
+ const alias = propAliases[name];
73
+ if (!alias || (alias.namespace && alias.namespace !== namespace))
74
+ return undefined;
75
+ return allowedAliasTarget(alias.spelling, namespace) ? alias.spelling : undefined;
76
+ }
77
+ export function reactiveModelSuggestion(tag, name, inputType, custom) {
78
+ if (custom)
79
+ return undefined;
80
+ if (name === "checked" && tag === "input") {
81
+ if (inputType === "radio")
82
+ return "modelValue";
83
+ if (inputType === "checkbox")
84
+ return "modelChecked";
85
+ }
86
+ if (name === "value") {
87
+ if (tag === "textarea" || tag === "select")
88
+ return "modelValue";
89
+ if (tag === "input" &&
90
+ ["text", "search", "email", "url", "tel", "password"].includes(inputType))
91
+ return "modelValue";
92
+ }
93
+ return undefined;
94
+ }
95
+ export const formProps = words("modelValue modelChecked defaultValue defaultChecked");
96
+ //# sourceMappingURL=vocabulary.js.map
@@ -0,0 +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,kKAAkK,CACnK,CAAC;AACF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAC9B,+IAA+I,CAChJ,CAAC;AACF,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,CAC5B,weAAwe,CACze,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAC3B,qSAAqS,CACtS,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,CAC1B,2JAA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AC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,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\",\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\",\n);\nexport const svgAttrs = words(\n \"width height viewBox preserveAspectRatio gradientUnits gradientTransform markerWidth markerHeight refX refY xlink:href xml:lang stroke-width fill-rule clip-rule stroke-linecap stroke-linejoin stop-color stop-opacity 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\",\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 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\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": "2.22.1",
3
+ "version": "3.1.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.",
@@ -11,8 +11,6 @@
11
11
  "islands",
12
12
  "mdx",
13
13
  "content-collections",
14
- "preact",
15
- "react",
16
14
  "rust"
17
15
  ],
18
16
  "license": "MIT",
@@ -61,7 +59,27 @@
61
59
  "types": "./dist/slugify.d.ts",
62
60
  "default": "./dist/slugify.js"
63
61
  },
64
- "./package.json": "./package.json"
62
+ "./package.json": "./package.json",
63
+ "./zudo-react": {
64
+ "types": "./dist/zudo-react/index.d.ts",
65
+ "default": "./dist/zudo-react/index.js"
66
+ },
67
+ "./zudo-react/jsx-runtime": {
68
+ "types": "./dist/zudo-react/jsx-runtime.d.ts",
69
+ "default": "./dist/zudo-react/jsx-runtime.js"
70
+ },
71
+ "./zudo-react/jsx-dev-runtime": {
72
+ "types": "./dist/zudo-react/jsx-dev-runtime.d.ts",
73
+ "default": "./dist/zudo-react/jsx-dev-runtime.js"
74
+ },
75
+ "./zudo-react/server": {
76
+ "types": "./dist/zudo-react/server.d.ts",
77
+ "default": "./dist/zudo-react/server.js"
78
+ },
79
+ "./zudo-react/client": {
80
+ "types": "./dist/zudo-react/client.d.ts",
81
+ "default": "./dist/zudo-react/client.js"
82
+ }
65
83
  },
66
84
  "bin": {
67
85
  "zfb": "./bin/zfb.mjs"
@@ -74,11 +92,11 @@
74
92
  "LICENSE"
75
93
  ],
76
94
  "optionalDependencies": {
77
- "@takazudo/zfb-darwin-arm64": "2.22.1",
78
- "@takazudo/zfb-darwin-x64": "2.22.1",
79
- "@takazudo/zfb-linux-arm64-gnu": "2.22.1",
80
- "@takazudo/zfb-linux-x64-gnu": "2.22.1",
81
- "@takazudo/zfb-win32-x64-msvc": "2.22.1"
95
+ "@takazudo/zfb-darwin-arm64": "3.1.0",
96
+ "@takazudo/zfb-darwin-x64": "3.1.0",
97
+ "@takazudo/zfb-linux-arm64-gnu": "3.1.0",
98
+ "@takazudo/zfb-linux-x64-gnu": "3.1.0",
99
+ "@takazudo/zfb-win32-x64-msvc": "3.1.0"
82
100
  },
83
101
  "publishConfig": {
84
102
  "access": "public"
@@ -87,29 +105,15 @@
87
105
  "node": ">=22.0.0",
88
106
  "pnpm": ">=10.0.0"
89
107
  },
90
- "peerDependencies": {
91
- "react": "^19.2.3"
92
- },
93
- "peerDependenciesMeta": {
94
- "react": {
95
- "optional": true
96
- }
97
- },
98
108
  "devDependencies": {
99
109
  "@types/node": "^22.0.0",
100
- "@types/react": "^19.0.0",
101
- "@types/react-dom": "^19.2.4",
102
110
  "happy-dom": "^15.7.4",
103
- "preact": "^10.29.0",
104
- "preact-render-to-string": "^6.6.7",
105
- "react": "^19.2.3",
106
- "react-dom": "19.2.6",
107
111
  "typescript": "^5.9.0",
108
112
  "vitest": "^2.1.9"
109
113
  },
110
114
  "scripts": {
111
115
  "build": "tsc",
112
- "test": "vitest run && tsc -p tsconfig.preact-fixture.json",
116
+ "test": "vitest run && tsc -p tsconfig.zudo-react-fixture.json && tsc -p tsconfig.zudo-react-dev-fixture.json && tsc -p tsconfig.zudo-react-sdk-fixture.json",
113
117
  "test:watch": "vitest",
114
118
  "typecheck": "tsc --noEmit"
115
119
  }