@craft-ts/component 0.7.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +36 -0
- package/src/index.d.ts +40 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +38 -0
- package/src/index.js.map +1 -0
- package/src/lib/a11y-control.d.ts +58 -0
- package/src/lib/a11y-control.d.ts.map +1 -0
- package/src/lib/a11y-control.js +74 -0
- package/src/lib/a11y-control.js.map +1 -0
- package/src/lib/a11y.d.ts +87 -0
- package/src/lib/a11y.d.ts.map +1 -0
- package/src/lib/a11y.js +96 -0
- package/src/lib/a11y.js.map +1 -0
- package/src/lib/ai/ai-context-menu.d.ts +140 -0
- package/src/lib/ai/ai-context-menu.d.ts.map +1 -0
- package/src/lib/ai/ai-context-menu.js +66 -0
- package/src/lib/ai/ai-context-menu.js.map +1 -0
- package/src/lib/ai/ai-send-dialog.d.ts +1263 -0
- package/src/lib/ai/ai-send-dialog.d.ts.map +1 -0
- package/src/lib/ai/ai-send-dialog.js +288 -0
- package/src/lib/ai/ai-send-dialog.js.map +1 -0
- package/src/lib/ai/send-context-to-ai.d.ts +29 -0
- package/src/lib/ai/send-context-to-ai.d.ts.map +1 -0
- package/src/lib/ai/send-context-to-ai.js +127 -0
- package/src/lib/ai/send-context-to-ai.js.map +1 -0
- package/src/lib/assert-defined-input.d.ts +26 -0
- package/src/lib/assert-defined-input.d.ts.map +1 -0
- package/src/lib/assert-defined-input.js +47 -0
- package/src/lib/assert-defined-input.js.map +1 -0
- package/src/lib/block.d.ts +36 -0
- package/src/lib/block.d.ts.map +1 -0
- package/src/lib/block.js +55 -0
- package/src/lib/block.js.map +1 -0
- package/src/lib/bootstrap.d.ts +32 -0
- package/src/lib/bootstrap.d.ts.map +1 -0
- package/src/lib/bootstrap.js +60 -0
- package/src/lib/bootstrap.js.map +1 -0
- package/src/lib/bridge.d.ts +56 -0
- package/src/lib/bridge.d.ts.map +1 -0
- package/src/lib/bridge.js +81 -0
- package/src/lib/bridge.js.map +1 -0
- package/src/lib/component.d.ts +46 -0
- package/src/lib/component.d.ts.map +1 -0
- package/src/lib/component.js +118 -0
- package/src/lib/component.js.map +1 -0
- package/src/lib/composition.d.ts +17 -0
- package/src/lib/composition.d.ts.map +1 -0
- package/src/lib/composition.js +28 -0
- package/src/lib/composition.js.map +1 -0
- package/src/lib/craft-defaults.d.ts +2 -0
- package/src/lib/craft-defaults.d.ts.map +1 -0
- package/src/lib/craft-defaults.js +41 -0
- package/src/lib/craft-defaults.js.map +1 -0
- package/src/lib/craft-host-tokens.d.ts +6 -0
- package/src/lib/craft-host-tokens.d.ts.map +1 -0
- package/src/lib/craft-host-tokens.js +7 -0
- package/src/lib/craft-host-tokens.js.map +1 -0
- package/src/lib/craft-router-outlet.d.ts +15 -0
- package/src/lib/craft-router-outlet.d.ts.map +1 -0
- package/src/lib/craft-router-outlet.js +10 -0
- package/src/lib/craft-router-outlet.js.map +1 -0
- package/src/lib/css-vars.d.ts +31 -0
- package/src/lib/css-vars.d.ts.map +1 -0
- package/src/lib/css-vars.js +43 -0
- package/src/lib/css-vars.js.map +1 -0
- package/src/lib/css-vars.type.d.ts +151 -0
- package/src/lib/css-vars.type.d.ts.map +1 -0
- package/src/lib/css-vars.type.js +1 -0
- package/src/lib/css-vars.type.js.map +1 -0
- package/src/lib/defer.d.ts +31 -0
- package/src/lib/defer.d.ts.map +1 -0
- package/src/lib/defer.js +19 -0
- package/src/lib/defer.js.map +1 -0
- package/src/lib/directive.d.ts +9 -0
- package/src/lib/directive.d.ts.map +1 -0
- package/src/lib/directive.js +31 -0
- package/src/lib/directive.js.map +1 -0
- package/src/lib/each-scheduling.d.ts +59 -0
- package/src/lib/each-scheduling.d.ts.map +1 -0
- package/src/lib/each-scheduling.js +120 -0
- package/src/lib/each-scheduling.js.map +1 -0
- package/src/lib/each.d.ts +29 -0
- package/src/lib/each.d.ts.map +1 -0
- package/src/lib/each.js +23 -0
- package/src/lib/each.js.map +1 -0
- package/src/lib/factory-runtime.d.ts +5 -0
- package/src/lib/factory-runtime.d.ts.map +1 -0
- package/src/lib/factory-runtime.js +26 -0
- package/src/lib/factory-runtime.js.map +1 -0
- package/src/lib/field-exception-block.d.ts +96 -0
- package/src/lib/field-exception-block.d.ts.map +1 -0
- package/src/lib/field-exception-block.js +44 -0
- package/src/lib/field-exception-block.js.map +1 -0
- package/src/lib/host-runtime.d.ts +60 -0
- package/src/lib/host-runtime.d.ts.map +1 -0
- package/src/lib/host-runtime.js +16 -0
- package/src/lib/host-runtime.js.map +1 -0
- package/src/lib/hydrate.d.ts +15 -0
- package/src/lib/hydrate.d.ts.map +1 -0
- package/src/lib/hydrate.js +79 -0
- package/src/lib/hydrate.js.map +1 -0
- package/src/lib/hyperscript.d.ts +148 -0
- package/src/lib/hyperscript.d.ts.map +1 -0
- package/src/lib/hyperscript.js +96 -0
- package/src/lib/hyperscript.js.map +1 -0
- package/src/lib/if-block.d.ts +8 -0
- package/src/lib/if-block.d.ts.map +1 -0
- package/src/lib/if-block.js +16 -0
- package/src/lib/if-block.js.map +1 -0
- package/src/lib/locator.d.ts +170 -0
- package/src/lib/locator.d.ts.map +1 -0
- package/src/lib/locator.js +151 -0
- package/src/lib/locator.js.map +1 -0
- package/src/lib/match-block.d.ts +38 -0
- package/src/lib/match-block.d.ts.map +1 -0
- package/src/lib/match-block.js +29 -0
- package/src/lib/match-block.js.map +1 -0
- package/src/lib/pending-block.d.ts +125 -0
- package/src/lib/pending-block.d.ts.map +1 -0
- package/src/lib/pending-block.js +48 -0
- package/src/lib/pending-block.js.map +1 -0
- package/src/lib/project.d.ts +19 -0
- package/src/lib/project.d.ts.map +1 -0
- package/src/lib/project.js +56 -0
- package/src/lib/project.js.map +1 -0
- package/src/lib/render/hydration-metadata.d.ts +3 -0
- package/src/lib/render/hydration-metadata.d.ts.map +1 -0
- package/src/lib/render/hydration-metadata.js +8 -0
- package/src/lib/render/hydration-metadata.js.map +1 -0
- package/src/lib/render/hydration.d.ts +24 -0
- package/src/lib/render/hydration.d.ts.map +1 -0
- package/src/lib/render/hydration.js +181 -0
- package/src/lib/render/hydration.js.map +1 -0
- package/src/lib/render/interpreter.d.ts +32 -0
- package/src/lib/render/interpreter.d.ts.map +1 -0
- package/src/lib/render/interpreter.js +3588 -0
- package/src/lib/render/interpreter.js.map +1 -0
- package/src/lib/render/server-style-collector.d.ts +6 -0
- package/src/lib/render/server-style-collector.d.ts.map +1 -0
- package/src/lib/render/server-style-collector.js +23 -0
- package/src/lib/render/server-style-collector.js.map +1 -0
- package/src/lib/render/ssr-coordinator.d.ts +20 -0
- package/src/lib/render/ssr-coordinator.d.ts.map +1 -0
- package/src/lib/render/ssr-coordinator.js +99 -0
- package/src/lib/render/ssr-coordinator.js.map +1 -0
- package/src/lib/render/string-dom.d.ts +9 -0
- package/src/lib/render/string-dom.d.ts.map +1 -0
- package/src/lib/render/string-dom.js +377 -0
- package/src/lib/render/string-dom.js.map +1 -0
- package/src/lib/render/style-registry.d.ts +14 -0
- package/src/lib/render/style-registry.d.ts.map +1 -0
- package/src/lib/render/style-registry.js +79 -0
- package/src/lib/render/style-registry.js.map +1 -0
- package/src/lib/render/style-scope.d.ts +30 -0
- package/src/lib/render/style-scope.d.ts.map +1 -0
- package/src/lib/render/style-scope.js +261 -0
- package/src/lib/render/style-scope.js.map +1 -0
- package/src/lib/render/vnode.d.ts +330 -0
- package/src/lib/render/vnode.d.ts.map +1 -0
- package/src/lib/render/vnode.js +293 -0
- package/src/lib/render/vnode.js.map +1 -0
- package/src/lib/server-render.d.ts +34 -0
- package/src/lib/server-render.d.ts.map +1 -0
- package/src/lib/server-render.js +84 -0
- package/src/lib/server-render.js.map +1 -0
- package/src/lib/start.d.ts +13 -0
- package/src/lib/start.d.ts.map +1 -0
- package/src/lib/start.js +20 -0
- package/src/lib/start.js.map +1 -0
- package/src/lib/template-contract.d.ts +347 -0
- package/src/lib/template-contract.d.ts.map +1 -0
- package/src/lib/template-contract.js +1 -0
- package/src/lib/template-contract.js.map +1 -0
- package/src/lib/template.d.ts +11 -0
- package/src/lib/template.d.ts.map +1 -0
- package/src/lib/template.js +21 -0
- package/src/lib/template.js.map +1 -0
- package/src/lib/testing.d.ts +157 -0
- package/src/lib/testing.d.ts.map +1 -0
- package/src/lib/testing.js +416 -0
- package/src/lib/testing.js.map +1 -0
- package/src/lib/types.d.ts +442 -0
- package/src/lib/types.d.ts.map +1 -0
- package/src/lib/types.js +22 -0
- package/src/lib/types.js.map +1 -0
- package/testing/public-api.d.ts +3 -0
- package/testing/public-api.d.ts.map +1 -0
- package/testing/public-api.js +3 -0
- package/testing/public-api.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-runtime.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/host-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,eAAe,EAC9B,SAAS,IAAI,kBAAkB,EAC/B,SAAS,EACT,0BAA0B,EAC1B,gBAAgB,IAAI,oBAAoB,EACxC,WAAW,EACX,oBAAoB,EACpB,eAAe,IAAI,kBAAkB,EACrC,OAAO,EACP,eAAe,IAAI,mBAAmB,EACtC,sBAAsB,EACtB,OAAO,EACP,UAAU,GAKX,MAAM,gBAAgB,CAAC;AA8CxB,MAAM,CAAC,MAAM,QAAQ,GAAG,SAAS,CAAC;AAClC,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACpE,MAAM,CAAC,MAAM,UAAU,GAAG,eAAe,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,CAAC;AACtC,MAAM,CAAC,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;AAClD,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;AAC9B,MAAM,CAAC,MAAM,oBAAoB,GAA2C,GAAG,EAAE,CAC/E,IAAI,CAAC;AACP,MAAM,CAAC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAC5D,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC;AACpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,CAAC","sourcesContent":["import {\n ɵDestroyRef as CraftDestroyRef,\n ɵInjector as CraftInjectorToken,\n ɵcomputed,\n ɵcreateEnvironmentInjector,\n ɵEffectScheduler as CraftEffectScheduler,\n ɵElementRef,\n ɵEnvironmentInjector,\n ɵINJECTOR_SCOPE as CraftInjectorScope,\n ɵinject,\n ɵInjectionToken as CraftInjectionToken,\n ɵrunInInjectionContext,\n ɵsignal,\n ɵuntracked,\n type CraftInjector,\n type ɵEffectRef,\n type ɵProvider,\n type ɵProviderToken,\n} from '@craft-ts/core';\n\nexport type EffectRef = ɵEffectRef;\nexport type Provider = ɵProvider;\nexport type ProviderToken<T> = ɵProviderToken<T>;\nexport type DestroyRef = InstanceType<typeof CraftDestroyRef>;\nexport type Injector = CraftInjector;\nexport type EnvironmentInjector = CraftInjector;\nexport type ElementRef<T = HTMLElement> = InstanceType<typeof ɵElementRef> & {\n nativeElement: T;\n};\n\ntype HostRuntimeApi = {\n computed: typeof ɵcomputed;\n createEnvironmentInjector: typeof ɵcreateEnvironmentInjector;\n DestroyRef: typeof CraftDestroyRef;\n ElementRef: typeof ɵElementRef;\n EnvironmentInjector: typeof ɵEnvironmentInjector;\n Injector: typeof CraftInjectorToken;\n inject: typeof ɵinject;\n reflectComponentType: (\n component: unknown,\n ) => { selector?: string | null } | null;\n runInInjectionContext: typeof ɵrunInInjectionContext;\n signal: typeof ɵsignal;\n untracked: typeof ɵuntracked;\n ɵEffectScheduler: typeof CraftEffectScheduler;\n ɵINJECTOR_SCOPE: typeof CraftInjectorScope;\n AngularMount: new (\n component: unknown,\n hostElement: Element,\n injector: unknown,\n inputs: Readonly<Record<string, unknown>>,\n outputs: Readonly<Record<string, (value: unknown) => unknown>>,\n directives: readonly unknown[],\n context: {\n injector: unknown;\n resolveInput: (value: unknown) => unknown;\n executeOutput: (\n callback: (value: unknown) => unknown,\n value: unknown,\n ) => unknown;\n },\n ) => { update(...args: unknown[]): void; destroy(): void };\n};\n\nexport const computed = ɵcomputed;\nexport const createEnvironmentInjector = ɵcreateEnvironmentInjector;\nexport const DestroyRef = CraftDestroyRef;\nexport const ElementRef = ɵElementRef;\nexport const EnvironmentInjector = ɵEnvironmentInjector;\nexport const Injector = CraftInjectorToken;\nexport const InjectionToken = CraftInjectionToken;\nexport const inject = ɵinject;\nexport const reflectComponentType: HostRuntimeApi['reflectComponentType'] = () =>\n null;\nexport const runInInjectionContext = ɵrunInInjectionContext;\nexport const signal = ɵsignal;\nexport const untracked = ɵuntracked;\nexport const ɵEffectScheduler = CraftEffectScheduler;\nexport const ɵINJECTOR_SCOPE = CraftInjectorScope;\n\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type CraftTransferSnapshot } from '@craft-ts/core';
|
|
2
|
+
import { type CraftAppRef, type BootstrapCraftOptions } from './bootstrap';
|
|
3
|
+
import { type HydrationMismatchError } from './render/hydration';
|
|
4
|
+
export type HydrateCraftOptions = BootstrapCraftOptions & Readonly<{
|
|
5
|
+
snapshot?: CraftTransferSnapshot;
|
|
6
|
+
props?: object;
|
|
7
|
+
onMismatch?: (error: HydrationMismatchError) => void;
|
|
8
|
+
removeTransferScript?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export type HydratedCraftAppRef = CraftAppRef & Readonly<{
|
|
11
|
+
mismatches: readonly HydrationMismatchError[];
|
|
12
|
+
}>;
|
|
13
|
+
/** Claims server DOM, restores state, then attaches bindings and listeners. */
|
|
14
|
+
export declare function hydrateCraft(options: HydrateCraftOptions): HydratedCraftAppRef;
|
|
15
|
+
//# sourceMappingURL=hydrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/hydrate.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,qBAAqB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAG3B,MAAM,aAAa,CAAC;AAWrB,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAI5B,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GACrD,QAAQ,CAAC;IACP,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IACrD,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC,CAAC;AAEL,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAC3C,QAAQ,CAAC;IACP,UAAU,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAC/C,CAAC,CAAC;AAEL,+EAA+E;AAC/E,wBAAgB,YAAY,CAC1B,OAAO,EAAE,mBAAmB,GAC3B,mBAAmB,CAkFrB"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CRAFT_PLATFORM, CRAFT_PRIMITIVE_REGISTRY, createBrowserDomAdapter, createBrowserPlatform, createCraftRenderIdentity, primeCraftTransferSnapshot, } from '@craft-ts/core';
|
|
2
|
+
import { ɵcreateCraftApplicationInjector, ɵrunCraftAppInitializers, } from './bootstrap';
|
|
3
|
+
import { CRAFT_ROOT_COMPONENT } from './craft-host-tokens';
|
|
4
|
+
import { CRAFT_STYLE_REGISTRY, ɵfallbackCraftStyleRegistry, } from './render/style-registry';
|
|
5
|
+
import { mountInterpretedComponentWithOptions, } from './render/interpreter';
|
|
6
|
+
import { createHydrationCursor, } from './render/hydration';
|
|
7
|
+
import { CRAFT_TRANSFER_SCRIPT_ID } from './server-render';
|
|
8
|
+
import { CRAFT_COMPONENT } from './types';
|
|
9
|
+
/** Claims server DOM, restores state, then attaches bindings and listeners. */
|
|
10
|
+
export function hydrateCraft(options) {
|
|
11
|
+
const host = options.host ?? document.querySelector('craft-root') ?? document.body;
|
|
12
|
+
const win = host.ownerDocument.defaultView ?? window;
|
|
13
|
+
const platform = createBrowserPlatform(win, { hydrating: true });
|
|
14
|
+
const injector = ɵcreateCraftApplicationInjector(options.config, [
|
|
15
|
+
{ provide: CRAFT_PLATFORM, useValue: platform },
|
|
16
|
+
]);
|
|
17
|
+
const mismatches = [];
|
|
18
|
+
let mounted;
|
|
19
|
+
try {
|
|
20
|
+
const snapshot = options.snapshot ?? readTransferSnapshot(host.ownerDocument);
|
|
21
|
+
if (snapshot) {
|
|
22
|
+
primeCraftTransferSnapshot(injector.get(CRAFT_PRIMITIVE_REGISTRY), snapshot);
|
|
23
|
+
}
|
|
24
|
+
ɵrunCraftAppInitializers(injector);
|
|
25
|
+
const root = injector.get(CRAFT_ROOT_COMPONENT);
|
|
26
|
+
if (!root) {
|
|
27
|
+
throw new Error('hydrateCraft found no root component. Add provideCraftRootComponent(App) to your app config.');
|
|
28
|
+
}
|
|
29
|
+
const identity = createCraftRenderIdentity([root[CRAFT_COMPONENT].name, 0]);
|
|
30
|
+
const cursor = createHydrationCursor(host, (error) => {
|
|
31
|
+
mismatches.push(error);
|
|
32
|
+
options.onMismatch?.(error);
|
|
33
|
+
});
|
|
34
|
+
const rootNode = host.getRootNode();
|
|
35
|
+
const styleRoot = (typeof Document !== 'undefined' && rootNode instanceof Document) ||
|
|
36
|
+
(typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot)
|
|
37
|
+
? rootNode
|
|
38
|
+
: host.ownerDocument;
|
|
39
|
+
const styles = injector.get(CRAFT_STYLE_REGISTRY, ɵfallbackCraftStyleRegistry);
|
|
40
|
+
mounted = mountInterpretedComponentWithOptions(root, host, injector, (options.props ?? {}), {
|
|
41
|
+
renderer: createBrowserDomAdapter(host.ownerDocument),
|
|
42
|
+
mode: 'hydrate',
|
|
43
|
+
identity,
|
|
44
|
+
hydration: cursor,
|
|
45
|
+
emitHydrationKeys: true,
|
|
46
|
+
styleRoot,
|
|
47
|
+
styles,
|
|
48
|
+
});
|
|
49
|
+
cursor.finish();
|
|
50
|
+
platform.hydrating = false;
|
|
51
|
+
if (options.removeTransferScript !== false) {
|
|
52
|
+
host.ownerDocument.getElementById(CRAFT_TRANSFER_SCRIPT_ID)?.remove();
|
|
53
|
+
}
|
|
54
|
+
for (const style of host.ownerDocument.querySelectorAll('style[data-craft-ssr]')) {
|
|
55
|
+
style.remove();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
platform.history.dispose();
|
|
60
|
+
injector.destroy?.();
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
injector,
|
|
65
|
+
mismatches,
|
|
66
|
+
destroy() {
|
|
67
|
+
mounted.destroy();
|
|
68
|
+
platform.history.dispose();
|
|
69
|
+
injector.destroy?.();
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function readTransferSnapshot(documentRef) {
|
|
74
|
+
const script = documentRef.getElementById(CRAFT_TRANSFER_SCRIPT_ID);
|
|
75
|
+
if (!script?.textContent)
|
|
76
|
+
return undefined;
|
|
77
|
+
return JSON.parse(script.textContent);
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=hydrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/hydrate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,GAE3B,MAAM,gB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I,OAAO,CAAC,oBAAoB,KAAK,KAAK,EAAE,CAAC;YAC3C,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;QACxE,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,aAAa,CAAC,gBAAgB,CACrD,uBAAuB,CACxB,EAAE,CAAC;YACF,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC1B,QAAiC,CAAC,OAAO,EAAE,EAAE,CAAC;QAC/C,MAAM,KAAK,CAAC;IACd,CAAC;IAED,OAAO;QACL,QAAQ;QACR,UAAU;QACV,OAAO;YACL,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC1B,QAAiC,CAAC,OAAO,EAAE,EAAE,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAC3B,WAAqB;IAErB,MAAM,MAAM,GAAG,WAAW,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;IACpE,IAAI,CAAC,MAAM,EAAE,WAAW;QAAE,OAAO,SAAS,CAAC;IAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAA0B,CAAC;AACjE,CAAC","sourcesContent":["import {\n CRAFT_PLATFORM,\n CRAFT_PRIMITIVE_REGISTRY,\n createBrowserDomAdapter,\n createBrowserPlatform,\n createCraftRenderIdentity,\n primeCraftTransferSnapshot,\n type CraftTransferSnapshot,\n} from '@craft-ts/core';\nimport {\n type CraftAppRef,\n type BootstrapCraftOptions,\n ɵcreateCraftApplicationInjector,\n ɵrunCraftAppInitializers,\n} from './bootstrap';\nimport { CRAFT_ROOT_COMPONENT } from './craft-host-tokens';\nimport {\n CRAFT_STYLE_REGISTRY,\n ɵfallbackCraftStyleRegistry,\n type CraftStyleRegistry,\n} from './render/style-registry';\nimport {\n mountInterpretedComponentWithOptions,\n type MountedCraftComponent,\n} from './render/interpreter';\nimport {\n createHydrationCursor,\n type HydrationMismatchError,\n} from './render/hydration';\nimport { CRAFT_TRANSFER_SCRIPT_ID } from './server-render';\nimport { CRAFT_COMPONENT, type CraftComponent } from './types';\n\nexport type HydrateCraftOptions = BootstrapCraftOptions &\n Readonly<{\n snapshot?: CraftTransferSnapshot;\n props?: object;\n onMismatch?: (error: HydrationMismatchError) => void;\n removeTransferScript?: boolean;\n }>;\n\nexport type HydratedCraftAppRef = CraftAppRef &\n Readonly<{\n mismatches: readonly HydrationMismatchError[];\n }>;\n\n/** Claims server DOM, restores state, then attaches bindings and listeners. */\nexport function hydrateCraft(\n options: HydrateCraftOptions,\n): HydratedCraftAppRef {\n const host =\n options.host ?? document.querySelector('craft-root') ?? document.body;\n const win = host.ownerDocument.defaultView ?? window;\n const platform = createBrowserPlatform(win, { hydrating: true });\n const injector = ɵcreateCraftApplicationInjector(options.config, [\n { provide: CRAFT_PLATFORM, useValue: platform },\n ]);\n const mismatches: HydrationMismatchError[] = [];\n let mounted: MountedCraftComponent<object>;\n try {\n const snapshot =\n options.snapshot ?? readTransferSnapshot(host.ownerDocument);\n if (snapshot) {\n primeCraftTransferSnapshot(\n injector.get(CRAFT_PRIMITIVE_REGISTRY),\n snapshot,\n );\n }\n ɵrunCraftAppInitializers(injector);\n\n const root = injector.get(CRAFT_ROOT_COMPONENT) as CraftComponent<object>;\n if (!root) {\n throw new Error(\n 'hydrateCraft found no root component. Add provideCraftRootComponent(App) to your app config.',\n );\n }\n const identity = createCraftRenderIdentity([root[CRAFT_COMPONENT].name, 0]);\n const cursor = createHydrationCursor(host, (error) => {\n mismatches.push(error);\n options.onMismatch?.(error);\n });\n const rootNode = host.getRootNode();\n const styleRoot =\n (typeof Document !== 'undefined' && rootNode instanceof Document) ||\n (typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot)\n ? (rootNode as Document | ShadowRoot)\n : host.ownerDocument;\n const styles = injector.get(\n CRAFT_STYLE_REGISTRY,\n ɵfallbackCraftStyleRegistry,\n ) as CraftStyleRegistry;\n mounted = mountInterpretedComponentWithOptions(\n root,\n host,\n injector,\n (options.props ?? {}) as object,\n {\n renderer: createBrowserDomAdapter(host.ownerDocument),\n mode: 'hydrate',\n identity,\n hydration: cursor,\n emitHydrationKeys: true,\n styleRoot,\n styles,\n },\n );\n cursor.finish();\n (platform as { hydrating: boolean }).hydrating = false;\n if (options.removeTransferScript !== false) {\n host.ownerDocument.getElementById(CRAFT_TRANSFER_SCRIPT_ID)?.remove();\n }\n for (const style of host.ownerDocument.querySelectorAll(\n 'style[data-craft-ssr]',\n )) {\n style.remove();\n }\n } catch (error) {\n platform.history.dispose();\n (injector as { destroy?(): void }).destroy?.();\n throw error;\n }\n\n return {\n injector,\n mismatches,\n destroy() {\n mounted.destroy();\n platform.history.dispose();\n (injector as { destroy?(): void }).destroy?.();\n },\n };\n}\n\nfunction readTransferSnapshot(\n documentRef: Document,\n): CraftTransferSnapshot | undefined {\n const script = documentRef.getElementById(CRAFT_TRANSFER_SCRIPT_ID);\n if (!script?.textContent) return undefined;\n return JSON.parse(script.textContent) as CraftTransferSnapshot;\n}\n"]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import type { CraftNodeChildrenDependencies, CraftNodeChildrenCssVars, CraftNodeChildrenHandledExceptionCodes, CraftNodeChildren, ElementNode, RequireCaughtComponentExceptions } from './render/vnode';
|
|
2
|
+
import type { Yieldable } from '@craft-ts/core';
|
|
3
|
+
type ClassValueResult = string | null | undefined | false | readonly ClassValueResult[] | Readonly<Record<string, boolean | null | undefined>>;
|
|
4
|
+
/** Properties that can be supplied to a component's host element. */
|
|
5
|
+
export type HostProps = ElementProps<'div'>;
|
|
6
|
+
export type YieldableRenderCallback<Value> = Yieldable<[], Value, unknown>;
|
|
7
|
+
export type ClassValue = ClassValueResult | (() => ClassValueResult) | YieldableRenderCallback<ClassValueResult>;
|
|
8
|
+
type StyleValueResult = string | false | null | undefined | Readonly<Partial<Record<keyof CSSStyleDeclaration, string | number | null>>> | Readonly<Record<`--${string}`, string | number | null>>;
|
|
9
|
+
export type StyleValue = StyleValueResult | (() => StyleValueResult) | YieldableRenderCallback<StyleValueResult>;
|
|
10
|
+
type ElementEventHandler<E extends Event> = (event: E) => unknown | Generator<any, any, any>;
|
|
11
|
+
type TypedDomEvent<El extends EventTarget, EventName extends keyof GlobalEventHandlersEventMap> = GlobalEventHandlersEventMap[EventName] & {
|
|
12
|
+
readonly target: El;
|
|
13
|
+
readonly currentTarget: El;
|
|
14
|
+
};
|
|
15
|
+
interface CommonDomEventMethods<El extends EventTarget> {
|
|
16
|
+
input?(event: TypedDomEvent<El, 'input'>): unknown | Generator<any, any, any>;
|
|
17
|
+
change?(event: TypedDomEvent<El, 'change'>): unknown | Generator<any, any, any>;
|
|
18
|
+
keydown?(event: TypedDomEvent<El, 'keydown'>): unknown | Generator<any, any, any>;
|
|
19
|
+
keyup?(event: TypedDomEvent<El, 'keyup'>): unknown | Generator<any, any, any>;
|
|
20
|
+
keypress?(event: TypedDomEvent<El, 'keypress'>): unknown | Generator<any, any, any>;
|
|
21
|
+
click?(event: TypedDomEvent<El, 'click'>): unknown | Generator<any, any, any>;
|
|
22
|
+
submit?(event: TypedDomEvent<El, 'submit'>): unknown | Generator<any, any, any>;
|
|
23
|
+
blur?(event: TypedDomEvent<El, 'blur'>): unknown | Generator<any, any, any>;
|
|
24
|
+
focus?(event: TypedDomEvent<El, 'focus'>): unknown | Generator<any, any, any>;
|
|
25
|
+
}
|
|
26
|
+
type DomEvents<El extends EventTarget> = CommonDomEventMethods<El> & {
|
|
27
|
+
[EventName in Exclude<keyof GlobalEventHandlersEventMap, keyof CommonDomEventMethods<El>>]?: ElementEventHandler<TypedDomEvent<El, EventName>>;
|
|
28
|
+
};
|
|
29
|
+
type OnDomEvents<El extends EventTarget> = {
|
|
30
|
+
[EventName in keyof GlobalEventHandlersEventMap as `on${Capitalize<EventName>}`]?: ElementEventHandler<TypedDomEvent<El, EventName>>;
|
|
31
|
+
};
|
|
32
|
+
type PrimitivePropertyKeys<Element> = {
|
|
33
|
+
[Key in keyof Element]-?: Element[Key] extends string | number | boolean | null | undefined ? Key : never;
|
|
34
|
+
}[keyof Element];
|
|
35
|
+
type PrimitiveElementProps<Element> = {
|
|
36
|
+
[Key in PrimitivePropertyKeys<Element>]?: Element[Key] | (() => Element[Key]) | YieldableRenderCallback<Element[Key]>;
|
|
37
|
+
};
|
|
38
|
+
type HostElementOf<Tag extends keyof HTMLElementTagNameMap> = HTMLElementTagNameMap[Tag];
|
|
39
|
+
type ElementPropsContext<Tag extends keyof HTMLElementTagNameMap, El extends EventTarget = HostElementOf<Tag>> = DomEvents<El> & OnDomEvents<El> & {
|
|
40
|
+
readonly class?: ClassValue;
|
|
41
|
+
readonly style?: StyleValue;
|
|
42
|
+
readonly attrs?: Readonly<Record<string, string | number | boolean | null>>;
|
|
43
|
+
readonly [dataAttribute: `data-${string}`]: unknown;
|
|
44
|
+
readonly [ariaAttribute: `aria-${string}`]: unknown;
|
|
45
|
+
};
|
|
46
|
+
export type ElementProps<Tag extends keyof HTMLElementTagNameMap> = PrimitiveElementProps<HTMLElementTagNameMap[Tag]> & ElementPropsContext<Tag> & {
|
|
47
|
+
readonly [property: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
type HChildren<_Tag extends keyof HTMLElementTagNameMap, PropsOrChildren, MaybeChildren> = (PropsOrChildren extends CraftNodeChildren ? PropsOrChildren : MaybeChildren) extends infer Children extends CraftNodeChildren ? Children : never;
|
|
50
|
+
type HProps<PropsOrChildren> = PropsOrChildren extends object ? PropsOrChildren extends CraftNodeChildren ? Readonly<Record<never, never>> : PropsOrChildren : Readonly<Record<never, never>>;
|
|
51
|
+
export declare function h<Tag extends keyof HTMLElementTagNameMap, const PropsOrChildren extends ElementPropsContext<Tag> | CraftNodeChildren = CraftNodeChildren, const MaybeChildren extends CraftNodeChildren = CraftNodeChildren>(tag: Tag, propsOrChildren?: PropsOrChildren, maybeChildren?: MaybeChildren): ElementNode<CraftNodeChildrenDependencies<HChildren<Tag, PropsOrChildren, MaybeChildren>>, Tag, HProps<PropsOrChildren>, HChildren<Tag, PropsOrChildren, MaybeChildren>, undefined, string, CraftNodeChildrenHandledExceptionCodes<HChildren<Tag, PropsOrChildren, MaybeChildren>>, never, CraftNodeChildrenCssVars<HChildren<Tag, PropsOrChildren, MaybeChildren>>>;
|
|
52
|
+
/** Creates a typed Craft node for a custom element or Web Component tag. */
|
|
53
|
+
export declare function customElement(tag: string, propsOrChildren?: Record<string, unknown> | CraftNodeChildren | null, maybeChildren?: CraftNodeChildren): ElementNode;
|
|
54
|
+
export interface TagHelper<Tag extends keyof HTMLElementTagNameMap> {
|
|
55
|
+
<const Children extends CraftNodeChildren = CraftNodeChildren>(children?: Children & CraftNodeChildren & RequireCaughtComponentExceptions<NoInfer<Children>>): ElementNode<CraftNodeChildrenDependencies<Children>, Tag, Record<never, never>, Children, string | undefined, string, CraftNodeChildrenHandledExceptionCodes<Children>, never, CraftNodeChildrenCssVars<Children>>;
|
|
56
|
+
<const Props extends ElementPropsContext<Tag>, const Children extends CraftNodeChildren = CraftNodeChildren>(props: Props | null, children?: Children & CraftNodeChildren & RequireCaughtComponentExceptions<NoInfer<Children>>): ElementNode<CraftNodeChildrenDependencies<Children>, Tag, NoInfer<Props>, Children, string | undefined, string, CraftNodeChildrenHandledExceptionCodes<Children>, never, CraftNodeChildrenCssVars<Children>>;
|
|
57
|
+
<const Name extends string, const Props extends ElementPropsContext<Tag>>(name: Name, props: Props | null): ElementNode<CraftNodeChildrenDependencies<readonly []>, Tag, NoInfer<Props>, readonly [], Name, string, CraftNodeChildrenHandledExceptionCodes<readonly []>, never, CraftNodeChildrenCssVars<readonly []>>;
|
|
58
|
+
<const Name extends string, const Props extends ElementPropsContext<Tag>, const Children extends CraftNodeChildren>(name: Name, props: Props | null, children: Children & CraftNodeChildren & RequireCaughtComponentExceptions<NoInfer<Children>>): ElementNode<CraftNodeChildrenDependencies<Children>, Tag, NoInfer<Props>, Children, Name, string, CraftNodeChildrenHandledExceptionCodes<Children>, never, CraftNodeChildrenCssVars<Children>>;
|
|
59
|
+
}
|
|
60
|
+
type TextInputTypes = 'text' | 'search' | 'email' | 'password' | 'tel' | 'url' | 'color' | 'hidden' | 'submit' | 'button' | 'reset' | 'image';
|
|
61
|
+
type NumericInputTypes = 'number' | 'range';
|
|
62
|
+
type TemporalInputTypes = 'date' | 'time' | 'datetime-local' | 'month' | 'week';
|
|
63
|
+
type RestrictedInputElement<Type extends string, Omitted extends keyof HTMLInputElement, Extra extends object = {}> = Omit<HTMLInputElement, Omitted | 'type'> & {
|
|
64
|
+
type: Type;
|
|
65
|
+
} & Extra;
|
|
66
|
+
type TextInputElement = RestrictedInputElement<TextInputTypes, 'checked' | 'files' | 'indeterminate'>;
|
|
67
|
+
type CheckboxInputElement = RestrictedInputElement<'checkbox', 'files' | 'valueAsNumber' | 'valueAsDate'>;
|
|
68
|
+
type RadioInputElement = RestrictedInputElement<'radio', 'files' | 'valueAsNumber' | 'valueAsDate' | 'indeterminate'>;
|
|
69
|
+
type FileInputElement = RestrictedInputElement<'file', 'checked' | 'indeterminate' | 'valueAsNumber' | 'valueAsDate', {
|
|
70
|
+
files: FileList;
|
|
71
|
+
}>;
|
|
72
|
+
type NumericInputElement = RestrictedInputElement<NumericInputTypes, 'checked' | 'files' | 'indeterminate' | 'valueAsDate'>;
|
|
73
|
+
type TemporalInputElement = RestrictedInputElement<TemporalInputTypes, 'checked' | 'files' | 'indeterminate'>;
|
|
74
|
+
type InputElementForType<Type> = Type extends 'checkbox' ? CheckboxInputElement : Type extends 'radio' ? RadioInputElement : Type extends 'file' ? FileInputElement : Type extends NumericInputTypes ? NumericInputElement : Type extends TemporalInputTypes ? TemporalInputElement : Type extends TextInputTypes ? TextInputElement : HTMLInputElement;
|
|
75
|
+
type LoosePrimitiveProps<El> = {
|
|
76
|
+
[K in PrimitivePropertyKeys<El>]?: El[K] | (() => El[K]) | YieldableRenderCallback<El[K]> | object;
|
|
77
|
+
};
|
|
78
|
+
type InputTypeArg = string | (() => string) | YieldableRenderCallback<string>;
|
|
79
|
+
type InputCallProps<T extends InputTypeArg> = Omit<LoosePrimitiveProps<InputElementForType<T>>, 'type'> & ElementPropsContext<'input', InputElementForType<T>> & {
|
|
80
|
+
readonly type?: T;
|
|
81
|
+
};
|
|
82
|
+
type InputNode<Props extends object, Children extends CraftNodeChildren, Name extends string | undefined = string | undefined> = ElementNode<CraftNodeChildrenDependencies<Children>, 'input', Props, Children, Name, string, CraftNodeChildrenHandledExceptionCodes<Children>, never, CraftNodeChildrenCssVars<Children>>;
|
|
83
|
+
export interface InputTagHelper {
|
|
84
|
+
<const T extends InputTypeArg = 'text', const Name extends string | undefined = undefined>(first?: InputCallProps<T> | Name | CraftNodeChildren | null, second?: Name extends string ? InputCallProps<T> | null : CraftNodeChildren, third?: CraftNodeChildren): InputNode<InputCallProps<T>, Name extends string ? readonly [] : CraftNodeChildren, Name>;
|
|
85
|
+
}
|
|
86
|
+
type AltValue = string | (() => string) | YieldableRenderCallback<string>;
|
|
87
|
+
type WithRequiredAlt<Tag extends 'img' | 'area', Props extends object> = Props & ElementPropsContext<Tag> & {
|
|
88
|
+
readonly alt: AltValue;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* `img` / `area` must declare `alt` at the type level — including `''` for
|
|
92
|
+
* decorative images. There is no children-only overload: a missing `alt` is a
|
|
93
|
+
* compile error, not an ESLint opt-out.
|
|
94
|
+
*/
|
|
95
|
+
export interface RequiredAltTagHelper<Tag extends 'img' | 'area'> {
|
|
96
|
+
<const Props extends object, const Children extends CraftNodeChildren = CraftNodeChildren>(props: WithRequiredAlt<Tag, Props>, children?: Children & CraftNodeChildren & RequireCaughtComponentExceptions<NoInfer<Children>>): ElementNode<CraftNodeChildrenDependencies<Children>, Tag, Props, Children, string | undefined, string, CraftNodeChildrenHandledExceptionCodes<Children>, never, CraftNodeChildrenCssVars<Children>>;
|
|
97
|
+
<const Name extends string, const Props extends object>(name: Name, props: WithRequiredAlt<Tag, Props>): ElementNode<CraftNodeChildrenDependencies<readonly []>, Tag, Props, readonly [], Name, string, CraftNodeChildrenHandledExceptionCodes<readonly []>, never, CraftNodeChildrenCssVars<readonly []>>;
|
|
98
|
+
<const Name extends string, const Props extends object, const Children extends CraftNodeChildren>(name: Name, props: WithRequiredAlt<Tag, Props>, children: Children & CraftNodeChildren & RequireCaughtComponentExceptions<NoInfer<Children>>): ElementNode<CraftNodeChildrenDependencies<Children>, Tag, Props, Children, Name, string, CraftNodeChildrenHandledExceptionCodes<Children>, never, CraftNodeChildrenCssVars<Children>>;
|
|
99
|
+
}
|
|
100
|
+
export declare const a: TagHelper<"a">;
|
|
101
|
+
export declare const article: TagHelper<"article">;
|
|
102
|
+
export declare const aside: TagHelper<"aside">;
|
|
103
|
+
export declare const button: TagHelper<"button">;
|
|
104
|
+
export declare const div: TagHelper<"div">;
|
|
105
|
+
export declare const footer: TagHelper<"footer">;
|
|
106
|
+
export declare const form: TagHelper<"form">;
|
|
107
|
+
export declare const h1: TagHelper<"h1">;
|
|
108
|
+
export declare const h2: TagHelper<"h2">;
|
|
109
|
+
export declare const h3: TagHelper<"h3">;
|
|
110
|
+
export declare const h4: TagHelper<"h4">;
|
|
111
|
+
export declare const h5: TagHelper<"h5">;
|
|
112
|
+
export declare const h6: TagHelper<"h6">;
|
|
113
|
+
export declare const header: TagHelper<"header">;
|
|
114
|
+
export declare const img: RequiredAltTagHelper<"img">;
|
|
115
|
+
export declare const input: InputTagHelper;
|
|
116
|
+
export declare const label: TagHelper<"label">;
|
|
117
|
+
export declare const li: TagHelper<"li">;
|
|
118
|
+
export declare const main: TagHelper<"main">;
|
|
119
|
+
export declare const nav: TagHelper<"nav">;
|
|
120
|
+
export declare const ol: TagHelper<"ol">;
|
|
121
|
+
export declare const option: TagHelper<"option">;
|
|
122
|
+
export declare const p: TagHelper<"p">;
|
|
123
|
+
export declare const pre: TagHelper<"pre">;
|
|
124
|
+
export declare const section: TagHelper<"section">;
|
|
125
|
+
export declare const select: TagHelper<"select">;
|
|
126
|
+
export declare const small: TagHelper<"small">;
|
|
127
|
+
export declare const span: TagHelper<"span">;
|
|
128
|
+
export declare const strong: TagHelper<"strong">;
|
|
129
|
+
export declare const textarea: TagHelper<"textarea">;
|
|
130
|
+
export declare const ul: TagHelper<"ul">;
|
|
131
|
+
export declare const dialog: TagHelper<"dialog">;
|
|
132
|
+
export declare const fieldset: TagHelper<"fieldset">;
|
|
133
|
+
export declare const legend: TagHelper<"legend">;
|
|
134
|
+
export declare const table: TagHelper<"table">;
|
|
135
|
+
export declare const thead: TagHelper<"thead">;
|
|
136
|
+
export declare const tbody: TagHelper<"tbody">;
|
|
137
|
+
export declare const tr: TagHelper<"tr">;
|
|
138
|
+
export declare const th: TagHelper<"th">;
|
|
139
|
+
export declare const td: TagHelper<"td">;
|
|
140
|
+
export declare const caption: TagHelper<"caption">;
|
|
141
|
+
export declare const figure: TagHelper<"figure">;
|
|
142
|
+
export declare const figcaption: TagHelper<"figcaption">;
|
|
143
|
+
export declare const iframe: TagHelper<"iframe">;
|
|
144
|
+
export declare const area: RequiredAltTagHelper<"area">;
|
|
145
|
+
/** SVG is not an HTMLElement; the helper still produces a typed Craft element node. */
|
|
146
|
+
export declare const svg: TagHelper<keyof HTMLElementTagNameMap>;
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=hyperscript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperscript.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/hyperscript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,sCAAsC,EACtC,iBAAiB,EACjB,WAAW,EACX,gCAAgC,EACjC,MAAM,gBAAgB,CAAC;AAC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ACxC,eAAO,MAAM,EAAE,iBAAkB,CAAC;AAClC,eAAO,MAAM,EAAE,iBAAkB,CAAC;AAClC,eAAO,MAAM,EAAE,iBAAkB,CAAC;AAClC,eAAO,MAAM,OAAO,sBAAuB,CAAC;AAC5C,eAAO,MAAM,MAAM,qBAAsB,CAAC;AAC1C,eAAO,MAAM,UAAU,yBAA0B,CAAC;AAClD,eAAO,MAAM,MAAM,qBAAsB,CAAC;AAC1C,eAAO,MAAM,IAAI,EAAwB,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtE,uFAAuF;AACvF,eAAO,MAAM,GAAG,wCAAkD,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { pipeCraftNode } from './render/vnode';
|
|
2
|
+
function looksLikeChildren(value) {
|
|
3
|
+
return (value === null ||
|
|
4
|
+
value === undefined ||
|
|
5
|
+
Array.isArray(value) ||
|
|
6
|
+
typeof value !== 'object' ||
|
|
7
|
+
('kind' in value && typeof value.kind === 'string'));
|
|
8
|
+
}
|
|
9
|
+
export function h(tag, propsOrChildren, maybeChildren) {
|
|
10
|
+
const props = looksLikeChildren(propsOrChildren)
|
|
11
|
+
? {}
|
|
12
|
+
: propsOrChildren;
|
|
13
|
+
const children = looksLikeChildren(propsOrChildren)
|
|
14
|
+
? propsOrChildren
|
|
15
|
+
: maybeChildren;
|
|
16
|
+
const node = {
|
|
17
|
+
kind: 'element',
|
|
18
|
+
tag,
|
|
19
|
+
props: props,
|
|
20
|
+
children: children ?? [],
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(node, 'pipe', {
|
|
23
|
+
value: (directive) => pipeCraftNode(node, directive),
|
|
24
|
+
enumerable: false,
|
|
25
|
+
});
|
|
26
|
+
return node;
|
|
27
|
+
}
|
|
28
|
+
/** Creates a typed Craft node for a custom element or Web Component tag. */
|
|
29
|
+
export function customElement(tag, propsOrChildren, maybeChildren) {
|
|
30
|
+
return h(tag, propsOrChildren, maybeChildren);
|
|
31
|
+
}
|
|
32
|
+
function hNamed(tag, name, props, children) {
|
|
33
|
+
const node = h(tag, props, children);
|
|
34
|
+
node.localName = name;
|
|
35
|
+
return node;
|
|
36
|
+
}
|
|
37
|
+
function tagHelper(tag) {
|
|
38
|
+
return ((first, second, third) => {
|
|
39
|
+
if (typeof first === 'string' &&
|
|
40
|
+
(second === null ||
|
|
41
|
+
(typeof second === 'object' &&
|
|
42
|
+
!Array.isArray(second) &&
|
|
43
|
+
!('kind' in second)))) {
|
|
44
|
+
return hNamed(tag, first, second, third);
|
|
45
|
+
}
|
|
46
|
+
return h(tag, first, second);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export const a = tagHelper('a');
|
|
50
|
+
export const article = tagHelper('article');
|
|
51
|
+
export const aside = tagHelper('aside');
|
|
52
|
+
export const button = tagHelper('button');
|
|
53
|
+
export const div = tagHelper('div');
|
|
54
|
+
export const footer = tagHelper('footer');
|
|
55
|
+
export const form = tagHelper('form');
|
|
56
|
+
export const h1 = tagHelper('h1');
|
|
57
|
+
export const h2 = tagHelper('h2');
|
|
58
|
+
export const h3 = tagHelper('h3');
|
|
59
|
+
export const h4 = tagHelper('h4');
|
|
60
|
+
export const h5 = tagHelper('h5');
|
|
61
|
+
export const h6 = tagHelper('h6');
|
|
62
|
+
export const header = tagHelper('header');
|
|
63
|
+
export const img = tagHelper('img');
|
|
64
|
+
export const input = tagHelper('input');
|
|
65
|
+
export const label = tagHelper('label');
|
|
66
|
+
export const li = tagHelper('li');
|
|
67
|
+
export const main = tagHelper('main');
|
|
68
|
+
export const nav = tagHelper('nav');
|
|
69
|
+
export const ol = tagHelper('ol');
|
|
70
|
+
export const option = tagHelper('option');
|
|
71
|
+
export const p = tagHelper('p');
|
|
72
|
+
export const pre = tagHelper('pre');
|
|
73
|
+
export const section = tagHelper('section');
|
|
74
|
+
export const select = tagHelper('select');
|
|
75
|
+
export const small = tagHelper('small');
|
|
76
|
+
export const span = tagHelper('span');
|
|
77
|
+
export const strong = tagHelper('strong');
|
|
78
|
+
export const textarea = tagHelper('textarea');
|
|
79
|
+
export const ul = tagHelper('ul');
|
|
80
|
+
export const dialog = tagHelper('dialog');
|
|
81
|
+
export const fieldset = tagHelper('fieldset');
|
|
82
|
+
export const legend = tagHelper('legend');
|
|
83
|
+
export const table = tagHelper('table');
|
|
84
|
+
export const thead = tagHelper('thead');
|
|
85
|
+
export const tbody = tagHelper('tbody');
|
|
86
|
+
export const tr = tagHelper('tr');
|
|
87
|
+
export const th = tagHelper('th');
|
|
88
|
+
export const td = tagHelper('td');
|
|
89
|
+
export const caption = tagHelper('caption');
|
|
90
|
+
export const figure = tagHelper('figure');
|
|
91
|
+
export const figcaption = tagHelper('figcaption');
|
|
92
|
+
export const iframe = tagHelper('iframe');
|
|
93
|
+
export const area = tagHelper('area');
|
|
94
|
+
/** SVG is not an HTMLElement; the helper still produces a typed Craft element node. */
|
|
95
|
+
export const svg = tagHelper('svg');
|
|
96
|
+
//# sourceMappingURL=hyperscript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hyperscript.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/hyperscript.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAyH/C,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,KAAK,KAAK,IAAI;QACd,KAAK,KAAK,SAAS;QACnB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACpB,OAAO,KAAK,KAAK,QAAQ;QACzB,CAAC,MAAM,IAAI,KAAK,IAAI,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC,CAC5E,CAAC;AACJ,CAAC;AAkBD,MAAM,UAAU,CAAC,CAOf,GAAQ,EACR,eAAiC,EACjC,aAA6B;IAc7B,MAAM,KAAK,GAAG,iBAAiB,CAAC,eAAe,CAAC;QAC9C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAE,eAAqC,CAAC;IAC3C,MAAM,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MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AACxC,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAClC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAiC,CAAC;AACtE,uFAAuF;AACvF,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,KAAoC,CAAC,CAAC","sourcesContent":["import type {\n CraftNodeChildrenDependencies,\n CraftNodeChildrenCssVars,\n CraftNodeChildrenHandledExceptionCodes,\n CraftNodeChildren,\n ElementNode,\n RequireCaughtComponentExceptions,\n} from './render/vnode';\nimport type { Yieldable } from '@craft-ts/core';\nimport { pipeCraftNode } from './render/vnode';\n\ntype ClassValueResult =\n | string\n | null\n | undefined\n | false\n | readonly ClassValueResult[]\n | Readonly<Record<string, boolean | null | undefined>>;\n\n/** Properties that can be supplied to a component's host element. */\nexport type HostProps = ElementProps<'div'>;\n\nexport type YieldableRenderCallback<Value> = Yieldable<[], Value, unknown>;\n\nexport type ClassValue =\n | ClassValueResult\n | (() => ClassValueResult)\n | YieldableRenderCallback<ClassValueResult>;\n\ntype StyleValueResult =\n | string\n | false\n | null\n | undefined\n | Readonly<Partial<Record<keyof CSSStyleDeclaration, string | number | null>>>\n | Readonly<Record<`--${string}`, string | number | null>>;\n\nexport type StyleValue =\n | StyleValueResult\n | (() => StyleValueResult)\n | YieldableRenderCallback<StyleValueResult>;\n\ntype ElementEventHandler<E extends Event> = (\n event: E,\n) => unknown | Generator<any, any, any>;\n\ntype TypedDomEvent<\n El extends EventTarget,\n EventName extends keyof GlobalEventHandlersEventMap,\n> = GlobalEventHandlersEventMap[EventName] & {\n readonly target: El;\n readonly currentTarget: El;\n};\n\ninterface CommonDomEventMethods<El extends EventTarget> {\n input?(\n event: TypedDomEvent<El, 'input'>,\n ): unknown | Generator<any, any, any>;\n change?(\n event: TypedDomEvent<El, 'change'>,\n ): unknown | Generator<any, any, any>;\n keydown?(\n event: TypedDomEvent<El, 'keydown'>,\n ): unknown | Generator<any, any, any>;\n keyup?(event: TypedDomEvent<El, 'keyup'>): unknown | Generator<any, any, any>;\n keypress?(\n event: TypedDomEvent<El, 'keypress'>,\n ): unknown | Generator<any, any, any>;\n click?(\n event: TypedDomEvent<El, 'click'>,\n ): unknown | Generator<any, any, any>;\n submit?(\n event: TypedDomEvent<El, 'submit'>,\n ): unknown | Generator<any, any, any>;\n blur?(event: TypedDomEvent<El, 'blur'>): unknown | Generator<any, any, any>;\n focus?(event: TypedDomEvent<El, 'focus'>): unknown | Generator<any, any, any>;\n}\n\ntype DomEvents<El extends EventTarget> = CommonDomEventMethods<El> & {\n [EventName in Exclude<\n keyof GlobalEventHandlersEventMap,\n keyof CommonDomEventMethods<El>\n >]?: ElementEventHandler<TypedDomEvent<El, EventName>>;\n};\n\ntype OnDomEvents<El extends EventTarget> = {\n [EventName in keyof GlobalEventHandlersEventMap as `on${Capitalize<EventName>}`]?: ElementEventHandler<\n TypedDomEvent<El, EventName>\n >;\n};\n\ntype PrimitivePropertyKeys<Element> = {\n [Key in keyof Element]-?: Element[Key] extends\n | string\n | number\n | boolean\n | null\n | undefined\n ? Key\n : never;\n}[keyof Element];\n\ntype PrimitiveElementProps<Element> = {\n [Key in PrimitivePropertyKeys<Element>]?:\n | Element[Key]\n | (() => Element[Key])\n | YieldableRenderCallback<Element[Key]>;\n};\n\ntype HostElementOf<Tag extends keyof HTMLElementTagNameMap> =\n HTMLElementTagNameMap[Tag];\n\ntype ElementPropsContext<\n Tag extends keyof HTMLElementTagNameMap,\n El extends EventTarget = HostElementOf<Tag>,\n> = DomEvents<El> &\n OnDomEvents<El> & {\n readonly class?: ClassValue;\n readonly style?: StyleValue;\n readonly attrs?: Readonly<Record<string, string | number | boolean | null>>;\n readonly [dataAttribute: `data-${string}`]: unknown;\n readonly [ariaAttribute: `aria-${string}`]: unknown;\n };\n\nexport type ElementProps<Tag extends keyof HTMLElementTagNameMap> =\n PrimitiveElementProps<HTMLElementTagNameMap[Tag]> &\n ElementPropsContext<Tag> & {\n readonly [property: string]: unknown;\n };\n\nfunction looksLikeChildren(value: unknown): boolean {\n return (\n value === null ||\n value === undefined ||\n Array.isArray(value) ||\n typeof value !== 'object' ||\n ('kind' in value && typeof (value as { kind?: unknown }).kind === 'string')\n );\n}\n\ntype HChildren<\n _Tag extends keyof HTMLElementTagNameMap,\n PropsOrChildren,\n MaybeChildren,\n> = (\n PropsOrChildren extends CraftNodeChildren ? PropsOrChildren : MaybeChildren\n) extends infer Children extends CraftNodeChildren\n ? Children\n : never;\n\ntype HProps<PropsOrChildren> = PropsOrChildren extends object\n ? PropsOrChildren extends CraftNodeChildren\n ? Readonly<Record<never, never>>\n : PropsOrChildren\n : Readonly<Record<never, never>>;\n\nexport function h<\n Tag extends keyof HTMLElementTagNameMap,\n const PropsOrChildren extends\n | ElementPropsContext<Tag>\n | CraftNodeChildren = CraftNodeChildren,\n const MaybeChildren extends CraftNodeChildren = CraftNodeChildren,\n>(\n tag: Tag,\n propsOrChildren?: PropsOrChildren,\n maybeChildren?: MaybeChildren,\n): ElementNode<\n CraftNodeChildrenDependencies<HChildren<Tag, PropsOrChildren, MaybeChildren>>,\n Tag,\n HProps<PropsOrChildren>,\n HChildren<Tag, PropsOrChildren, MaybeChildren>,\n undefined,\n string,\n CraftNodeChildrenHandledExceptionCodes<\n HChildren<Tag, PropsOrChildren, MaybeChildren>\n >,\n never,\n CraftNodeChildrenCssVars<HChildren<Tag, PropsOrChildren, MaybeChildren>>\n> {\n const props = looksLikeChildren(propsOrChildren)\n ? {}\n : (propsOrChildren as ElementProps<Tag>);\n const children = looksLikeChildren(propsOrChildren)\n ? (propsOrChildren as CraftNodeChildren)\n : maybeChildren;\n\n const node = {\n kind: 'element',\n tag,\n props: props as Readonly<Record<string, unknown>>,\n children: children ?? [],\n } as ElementNode<\n CraftNodeChildrenDependencies<\n HChildren<Tag, PropsOrChildren, MaybeChildren>\n >,\n Tag,\n HProps<PropsOrChildren>,\n HChildren<Tag, PropsOrChildren, MaybeChildren>,\n undefined,\n string,\n CraftNodeChildrenHandledExceptionCodes<\n HChildren<Tag, PropsOrChildren, MaybeChildren>\n >,\n never,\n CraftNodeChildrenCssVars<HChildren<Tag, PropsOrChildren, MaybeChildren>>\n >;\n\n Object.defineProperty(node, 'pipe', {\n value: (directive: unknown) =>\n pipeCraftNode(node as unknown as ElementNode, directive as never),\n enumerable: false,\n });\n\n return node;\n}\n\n/** Creates a typed Craft node for a custom element or Web Component tag. */\nexport function customElement(\n tag: string,\n propsOrChildren?: Record<string, unknown> | CraftNodeChildren | null,\n maybeChildren?: CraftNodeChildren,\n): ElementNode {\n return h(\n tag as keyof HTMLElementTagNameMap,\n propsOrChildren as never,\n maybeChildren as never,\n ) as unknown as ElementNode;\n}\n\nfunction hNamed<\n Tag extends keyof HTMLElementTagNameMap,\n const Name extends string,\n const Props extends object,\n const Children extends CraftNodeChildren,\n>(\n tag: Tag,\n name: Name,\n props: Props | null,\n children?: Children,\n): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n Props,\n Children,\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n> {\n const node = h<Tag, Props & ElementPropsContext<Tag>, Children>(\n tag,\n props as Props & ElementPropsContext<Tag>,\n children,\n ) as unknown as ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n Props,\n Children,\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n >;\n (node as { localName?: Name }).localName = name;\n return node;\n}\n\nexport interface TagHelper<Tag extends keyof HTMLElementTagNameMap> {\n <const Children extends CraftNodeChildren = CraftNodeChildren>(\n children?: Children &\n CraftNodeChildren &\n RequireCaughtComponentExceptions<NoInfer<Children>>,\n ): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n Record<never, never>,\n Children,\n string | undefined,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n >;\n <\n const Props extends ElementPropsContext<Tag>,\n const Children extends CraftNodeChildren = CraftNodeChildren,\n >(\n props: Props | null,\n children?: Children &\n CraftNodeChildren &\n RequireCaughtComponentExceptions<NoInfer<Children>>,\n ): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n NoInfer<Props>,\n Children,\n string | undefined,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n >;\n <const Name extends string, const Props extends ElementPropsContext<Tag>>(\n name: Name,\n props: Props | null,\n ): ElementNode<\n CraftNodeChildrenDependencies<readonly []>,\n Tag,\n NoInfer<Props>,\n readonly [],\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<readonly []>,\n never,\n CraftNodeChildrenCssVars<readonly []>\n >;\n <\n const Name extends string,\n const Props extends ElementPropsContext<Tag>,\n const Children extends CraftNodeChildren,\n >(\n name: Name,\n props: Props | null,\n children: Children &\n CraftNodeChildren &\n RequireCaughtComponentExceptions<NoInfer<Children>>,\n ): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n NoInfer<Props>,\n Children,\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n >;\n}\n\nfunction tagHelper<Tag extends keyof HTMLElementTagNameMap>(\n tag: Tag,\n): TagHelper<Tag> {\n return ((\n first?: string | ElementPropsContext<Tag> | CraftNodeChildren | null,\n second?: ElementPropsContext<Tag> | CraftNodeChildren | null,\n third?: CraftNodeChildren,\n ) => {\n if (\n typeof first === 'string' &&\n (second === null ||\n (typeof second === 'object' &&\n !Array.isArray(second) &&\n !('kind' in second)))\n ) {\n return hNamed(tag, first, second, third);\n }\n\n return h<Tag, never, never>(tag, first as never, second as never);\n }) as unknown as TagHelper<Tag>;\n}\n\ntype TextInputTypes =\n | 'text'\n | 'search'\n | 'email'\n | 'password'\n | 'tel'\n | 'url'\n | 'color'\n | 'hidden'\n | 'submit'\n | 'button'\n | 'reset'\n | 'image';\n\ntype NumericInputTypes = 'number' | 'range';\ntype TemporalInputTypes = 'date' | 'time' | 'datetime-local' | 'month' | 'week';\n\ntype RestrictedInputElement<\n Type extends string,\n Omitted extends keyof HTMLInputElement,\n Extra extends object = {},\n> = Omit<HTMLInputElement, Omitted | 'type'> & {\n type: Type;\n} & Extra;\n\ntype TextInputElement = RestrictedInputElement<\n TextInputTypes,\n 'checked' | 'files' | 'indeterminate'\n>;\ntype CheckboxInputElement = RestrictedInputElement<\n 'checkbox',\n 'files' | 'valueAsNumber' | 'valueAsDate'\n>;\ntype RadioInputElement = RestrictedInputElement<\n 'radio',\n 'files' | 'valueAsNumber' | 'valueAsDate' | 'indeterminate'\n>;\ntype FileInputElement = RestrictedInputElement<\n 'file',\n 'checked' | 'indeterminate' | 'valueAsNumber' | 'valueAsDate',\n { files: FileList }\n>;\ntype NumericInputElement = RestrictedInputElement<\n NumericInputTypes,\n 'checked' | 'files' | 'indeterminate' | 'valueAsDate'\n>;\ntype TemporalInputElement = RestrictedInputElement<\n TemporalInputTypes,\n 'checked' | 'files' | 'indeterminate'\n>;\n\ntype InputElementForType<Type> = Type extends 'checkbox'\n ? CheckboxInputElement\n : Type extends 'radio'\n ? RadioInputElement\n : Type extends 'file'\n ? FileInputElement\n : Type extends NumericInputTypes\n ? NumericInputElement\n : Type extends TemporalInputTypes\n ? TemporalInputElement\n : Type extends TextInputTypes\n ? TextInputElement\n : HTMLInputElement;\n\ntype LoosePrimitiveProps<El> = {\n [K in PrimitivePropertyKeys<El>]?:\n | El[K]\n | (() => El[K])\n | YieldableRenderCallback<El[K]>\n | object;\n};\n\ntype InputTypeArg =\n | string\n | (() => string)\n | YieldableRenderCallback<string>;\n\ntype InputCallProps<T extends InputTypeArg> = Omit<\n LoosePrimitiveProps<InputElementForType<T>>,\n 'type'\n> &\n ElementPropsContext<'input', InputElementForType<T>> & {\n readonly type?: T;\n };\n\ntype InputNode<\n Props extends object,\n Children extends CraftNodeChildren,\n Name extends string | undefined = string | undefined,\n> = ElementNode<\n CraftNodeChildrenDependencies<Children>,\n 'input',\n Props,\n Children,\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n>;\n\nexport interface InputTagHelper {\n <\n const T extends InputTypeArg = 'text',\n const Name extends string | undefined = undefined,\n >(\n first?: InputCallProps<T> | Name | CraftNodeChildren | null,\n second?: Name extends string\n ? InputCallProps<T> | null\n : CraftNodeChildren,\n third?: CraftNodeChildren,\n ): InputNode<\n InputCallProps<T>,\n Name extends string ? readonly [] : CraftNodeChildren,\n Name\n >;\n}\n\ntype AltValue =\n | string\n | (() => string)\n | YieldableRenderCallback<string>;\n\ntype WithRequiredAlt<Tag extends 'img' | 'area', Props extends object> = Props &\n ElementPropsContext<Tag> & {\n readonly alt: AltValue;\n };\n\n/**\n * `img` / `area` must declare `alt` at the type level — including `''` for\n * decorative images. There is no children-only overload: a missing `alt` is a\n * compile error, not an ESLint opt-out.\n */\nexport interface RequiredAltTagHelper<Tag extends 'img' | 'area'> {\n <\n const Props extends object,\n const Children extends CraftNodeChildren = CraftNodeChildren,\n >(\n props: WithRequiredAlt<Tag, Props>,\n children?: Children &\n CraftNodeChildren &\n RequireCaughtComponentExceptions<NoInfer<Children>>,\n ): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n Props,\n Children,\n string | undefined,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n >;\n <const Name extends string, const Props extends object>(\n name: Name,\n props: WithRequiredAlt<Tag, Props>,\n ): ElementNode<\n CraftNodeChildrenDependencies<readonly []>,\n Tag,\n Props,\n readonly [],\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<readonly []>,\n never,\n CraftNodeChildrenCssVars<readonly []>\n >;\n <\n const Name extends string,\n const Props extends object,\n const Children extends CraftNodeChildren,\n >(\n name: Name,\n props: WithRequiredAlt<Tag, Props>,\n children: Children &\n CraftNodeChildren &\n RequireCaughtComponentExceptions<NoInfer<Children>>,\n ): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n Tag,\n Props,\n Children,\n Name,\n string,\n CraftNodeChildrenHandledExceptionCodes<Children>,\n never,\n CraftNodeChildrenCssVars<Children>\n >;\n}\n\nexport const a = tagHelper('a');\nexport const article = tagHelper('article');\nexport const aside = tagHelper('aside');\nexport const button = tagHelper('button');\nexport const div = tagHelper('div');\nexport const footer = tagHelper('footer');\nexport const form = tagHelper('form');\nexport const h1 = tagHelper('h1');\nexport const h2 = tagHelper('h2');\nexport const h3 = tagHelper('h3');\nexport const h4 = tagHelper('h4');\nexport const h5 = tagHelper('h5');\nexport const h6 = tagHelper('h6');\nexport const header = tagHelper('header');\nexport const img = tagHelper('img') as RequiredAltTagHelper<'img'>;\nexport const input = tagHelper('input') as unknown as InputTagHelper;\nexport const label = tagHelper('label');\nexport const li = tagHelper('li');\nexport const main = tagHelper('main');\nexport const nav = tagHelper('nav');\nexport const ol = tagHelper('ol');\nexport const option = tagHelper('option');\nexport const p = tagHelper('p');\nexport const pre = tagHelper('pre');\nexport const section = tagHelper('section');\nexport const select = tagHelper('select');\nexport const small = tagHelper('small');\nexport const span = tagHelper('span');\nexport const strong = tagHelper('strong');\nexport const textarea = tagHelper('textarea');\nexport const ul = tagHelper('ul');\nexport const dialog = tagHelper('dialog');\nexport const fieldset = tagHelper('fieldset');\nexport const legend = tagHelper('legend');\nexport const table = tagHelper('table');\nexport const thead = tagHelper('thead');\nexport const tbody = tagHelper('tbody');\nexport const tr = tagHelper('tr');\nexport const th = tagHelper('th');\nexport const td = tagHelper('td');\nexport const caption = tagHelper('caption');\nexport const figure = tagHelper('figure');\nexport const figcaption = tagHelper('figcaption');\nexport const iframe = tagHelper('iframe');\nexport const area = tagHelper('area') as RequiredAltTagHelper<'area'>;\n/** SVG is not an HTMLElement; the helper still produces a typed Craft element node. */\nexport const svg = tagHelper('svg' as keyof HTMLElementTagNameMap);\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type NamedYieldableValue } from '@craft-ts/core';
|
|
2
|
+
import type { CraftNodeChildren, CraftNodeChildrenDependencies, IfBlockNode } from './render/vnode';
|
|
3
|
+
type Condition<Name extends string> = NamedYieldableValue<Name, () => unknown>;
|
|
4
|
+
type BranchDependencies<Branch> = Branch extends (...args: any[]) => infer Output ? CraftNodeChildrenDependencies<Output> : {};
|
|
5
|
+
/** Creates a conditionally rendered Craft template block. */
|
|
6
|
+
export declare function ifBlock<Name extends string, TrueBranch extends () => CraftNodeChildren, FalseBranch extends (() => CraftNodeChildren) | undefined = undefined>(condition: Condition<Name>, whenTrue: TrueBranch, whenFalse?: FalseBranch): IfBlockNode<Name, BranchDependencies<TrueBranch> | BranchDependencies<FalseBranch>, ReturnType<TrueBranch>, FalseBranch extends (...args: any[]) => infer False ? False : never>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=if-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if-block.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/if-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,KAAK,EACV,iBAAiB,EACjB,6BAA6B,EAC7B,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,KAAK,SAAS,CAAC,IAAI,SAAS,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC;AAE/E,KAAK,kBAAkB,CAAC,MAAM,IAAI,MAAM,SAAS,CAC/C,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,MAAM,GACb,6BAA6B,CAAC,MAAM,CAAC,GACrC,EAAE,CAAC;AAEP,6DAA6D;AAC7D,wBAAgB,OAAO,CACrB,IAAI,SAAS,MAAM,EACnB,UAAU,SAAS,MAAM,iBAAiB,EAC1C,WAAW,SAAS,CAAC,MAAM,iBAAiB,CAAC,GAAG,SAAS,GAAG,SAAS,EAErE,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,EAC1B,QAAQ,EAAE,UAAU,EACpB,SAAS,CAAC,EAAE,WAAW,GACtB,WAAW,CACZ,IAAI,EACJ,kBAAkB,CAAC,UAAU,CAAC,GAAG,kBAAkB,CAAC,WAAW,CAAC,EAChE,UAAU,CAAC,UAAU,CAAC,EACtB,WAAW,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,KAAK,GAAG,KAAK,GAAG,KAAK,CACpE,CAuBA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { YIELDABLE_VALUE } from '@craft-ts/core';
|
|
2
|
+
/** Creates a conditionally rendered Craft template block. */
|
|
3
|
+
export function ifBlock(condition, whenTrue, whenFalse) {
|
|
4
|
+
const conditionName = condition[YIELDABLE_VALUE];
|
|
5
|
+
if (typeof conditionName !== 'string') {
|
|
6
|
+
throw new Error('ifBlock(...) requires a named Craft reactive value as its condition.');
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
kind: 'if',
|
|
10
|
+
condition: condition,
|
|
11
|
+
conditionName: conditionName,
|
|
12
|
+
whenTrue: whenTrue,
|
|
13
|
+
whenFalse: whenFalse,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=if-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if-block.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/if-block.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA4B,MAAM,gBAAgB,CAAC;AAe3E,6DAA6D;AAC7D,MAAM,UAAU,OAAO,CAKrB,SAA0B,EAC1B,QAAoB,EACpB,SAAuB;IAOvB,MAAM,aAAa,GACjB,SAGD,CAAC,eAAe,CAAC,CAAC;IACnB,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,SAAqC;QAChD,aAAa,EAAE,aAAqB;QACpC,QAAQ,EAAE,QAAmD;QAC7D,SAAS,EAAE,SAIE;KACd,CAAC;AACJ,CAAC","sourcesContent":["import { YIELDABLE_VALUE, type NamedYieldableValue } from '@craft-ts/core';\nimport type {\n CraftNodeChildren,\n CraftNodeChildrenDependencies,\n IfBlockNode,\n} from './render/vnode';\n\ntype Condition<Name extends string> = NamedYieldableValue<Name, () => unknown>;\n\ntype BranchDependencies<Branch> = Branch extends (\n ...args: any[]\n) => infer Output\n ? CraftNodeChildrenDependencies<Output>\n : {};\n\n/** Creates a conditionally rendered Craft template block. */\nexport function ifBlock<\n Name extends string,\n TrueBranch extends () => CraftNodeChildren,\n FalseBranch extends (() => CraftNodeChildren) | undefined = undefined,\n>(\n condition: Condition<Name>,\n whenTrue: TrueBranch,\n whenFalse?: FalseBranch,\n): IfBlockNode<\n Name,\n BranchDependencies<TrueBranch> | BranchDependencies<FalseBranch>,\n ReturnType<TrueBranch>,\n FalseBranch extends (...args: any[]) => infer False ? False : never\n> {\n const conditionName = (\n condition as unknown as {\n readonly [YIELDABLE_VALUE]?: unknown;\n }\n )[YIELDABLE_VALUE];\n if (typeof conditionName !== 'string') {\n throw new Error(\n 'ifBlock(...) requires a named Craft reactive value as its condition.',\n );\n }\n\n return {\n kind: 'if',\n condition: condition as unknown as () => boolean,\n conditionName: conditionName as Name,\n whenTrue: whenTrue as unknown as () => ReturnType<TrueBranch>,\n whenFalse: whenFalse as\n | (() => FalseBranch extends (...args: any[]) => infer False\n ? False\n : never)\n | undefined,\n };\n}\n"]}
|