@craft-ts/component 0.7.0-beta.13 → 0.7.0-beta.16
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/package.json +7 -2
- package/src/index.d.ts +40 -40
- package/src/index.js +35 -35
- package/src/lib/a11y-control.d.ts +0 -1
- package/src/lib/a11y-control.js +0 -1
- package/src/lib/a11y.d.ts +4 -5
- package/src/lib/a11y.js +3 -4
- package/src/lib/ai/ai-context-menu.d.ts +24 -25
- package/src/lib/ai/ai-context-menu.js +2 -3
- package/src/lib/ai/ai-send-dialog.d.ts +277 -278
- package/src/lib/ai/ai-send-dialog.js +4 -5
- package/src/lib/ai/send-context-to-ai.d.ts +1 -2
- package/src/lib/ai/send-context-to-ai.js +4 -5
- package/src/lib/assert-defined-input.d.ts +1 -2
- package/src/lib/assert-defined-input.js +0 -1
- package/src/lib/bootstrap.d.ts +4 -3
- package/src/lib/bootstrap.js +6 -8
- package/src/lib/bridge.d.ts +9 -10
- package/src/lib/bridge.js +3 -4
- package/src/lib/catch-node.d.ts +35 -0
- package/src/lib/{block.js → catch-node.js} +9 -10
- package/src/lib/component.d.ts +23 -10
- package/src/lib/component.js +5 -6
- package/src/lib/composition.d.ts +1 -2
- package/src/lib/composition.js +2 -3
- package/src/lib/craft-defaults.d.ts +0 -1
- package/src/lib/craft-defaults.js +4 -5
- package/src/lib/craft-host-tokens.d.ts +0 -1
- package/src/lib/craft-host-tokens.js +0 -1
- package/src/lib/craft-router-outlet.d.ts +1 -2
- package/src/lib/craft-router-outlet.js +1 -2
- package/src/lib/css-vars.d.ts +0 -1
- package/src/lib/css-vars.js +0 -1
- package/src/lib/css-vars.type.d.ts +1 -2
- package/src/lib/css-vars.type.js +0 -1
- package/src/lib/{defer.d.ts → defer-node.d.ts} +4 -5
- package/src/lib/{defer.js → defer-node.js} +1 -2
- package/src/lib/directive.d.ts +1 -2
- package/src/lib/directive.js +1 -2
- package/src/lib/factory-runtime.d.ts +1 -2
- package/src/lib/factory-runtime.js +0 -1
- package/src/lib/{field-exception-block.d.ts → field-error-node.d.ts} +22 -23
- package/src/lib/{field-exception-block.js → field-error-node.js} +8 -9
- package/src/lib/for-node.d.ts +28 -0
- package/src/lib/{each.js → for-node.js} +4 -5
- package/src/lib/for-scheduling.d.ts +58 -0
- package/src/lib/{each-scheduling.js → for-scheduling.js} +14 -15
- package/src/lib/host-runtime.d.ts +0 -1
- package/src/lib/host-runtime.js +0 -1
- package/src/lib/hydrate.d.ts +2 -3
- package/src/lib/hydrate.js +57 -18
- package/src/lib/hyperscript.d.ts +1 -2
- package/src/lib/hyperscript.js +1 -2
- package/src/lib/if-node.d.ts +7 -0
- package/src/lib/{if-block.js → if-node.js} +2 -3
- package/src/lib/locator.d.ts +5 -6
- package/src/lib/locator.js +1 -2
- package/src/lib/{match-block.d.ts → match-node.d.ts} +8 -9
- package/src/lib/{match-block.js → match-node.js} +3 -4
- package/src/lib/{pending-block.d.ts → pending-node.d.ts} +28 -29
- package/src/lib/{pending-block.js → pending-node.js} +12 -13
- package/src/lib/project.d.ts +2 -3
- package/src/lib/project.js +2 -3
- package/src/lib/render/hydration-metadata.d.ts +0 -1
- package/src/lib/render/hydration-metadata.js +0 -1
- package/src/lib/render/hydration.d.ts +0 -1
- package/src/lib/render/hydration.js +0 -1
- package/src/lib/render/interpreter.d.ts +9 -8
- package/src/lib/render/interpreter.js +156 -81
- package/src/lib/render/server-style-collector.d.ts +0 -1
- package/src/lib/render/server-style-collector.js +0 -1
- package/src/lib/render/ssr-coordinator.d.ts +4 -2
- package/src/lib/render/ssr-coordinator.js +14 -3
- package/src/lib/render/string-dom.d.ts +0 -1
- package/src/lib/render/string-dom.js +48 -7
- package/src/lib/render/style-registry.d.ts +3 -2
- package/src/lib/render/style-registry.js +3 -2
- package/src/lib/render/style-scope.d.ts +0 -1
- package/src/lib/render/style-scope.js +0 -1
- package/src/lib/render/vnode.d.ts +117 -54
- package/src/lib/render/vnode.js +26 -27
- package/src/lib/security.d.ts +54 -0
- package/src/lib/security.js +502 -0
- package/src/lib/server-render.d.ts +12 -3
- package/src/lib/server-render.js +76 -17
- package/src/lib/start.d.ts +2 -3
- package/src/lib/start.js +3 -3
- package/src/lib/template-contract.d.ts +22 -23
- package/src/lib/template-contract.js +0 -1
- package/src/lib/template.d.ts +2 -3
- package/src/lib/template.js +2 -3
- package/src/lib/testing.d.ts +3 -4
- package/src/lib/testing.js +5 -6
- package/src/lib/types.d.ts +40 -28
- package/src/lib/types.js +3 -4
- package/testing/public-api.d.ts +0 -1
- package/testing/public-api.js +0 -1
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/a11y-control.d.ts.map +0 -1
- package/src/lib/a11y-control.js.map +0 -1
- package/src/lib/a11y.d.ts.map +0 -1
- package/src/lib/a11y.js.map +0 -1
- package/src/lib/ai/ai-context-menu.d.ts.map +0 -1
- package/src/lib/ai/ai-context-menu.js.map +0 -1
- package/src/lib/ai/ai-send-dialog.d.ts.map +0 -1
- package/src/lib/ai/ai-send-dialog.js.map +0 -1
- package/src/lib/ai/send-context-to-ai.d.ts.map +0 -1
- package/src/lib/ai/send-context-to-ai.js.map +0 -1
- package/src/lib/assert-defined-input.d.ts.map +0 -1
- package/src/lib/assert-defined-input.js.map +0 -1
- package/src/lib/block.d.ts +0 -36
- package/src/lib/block.d.ts.map +0 -1
- package/src/lib/block.js.map +0 -1
- package/src/lib/bootstrap.d.ts.map +0 -1
- package/src/lib/bootstrap.js.map +0 -1
- package/src/lib/bridge.d.ts.map +0 -1
- package/src/lib/bridge.js.map +0 -1
- package/src/lib/component.d.ts.map +0 -1
- package/src/lib/component.js.map +0 -1
- package/src/lib/composition.d.ts.map +0 -1
- package/src/lib/composition.js.map +0 -1
- package/src/lib/craft-defaults.d.ts.map +0 -1
- package/src/lib/craft-defaults.js.map +0 -1
- package/src/lib/craft-host-tokens.d.ts.map +0 -1
- package/src/lib/craft-host-tokens.js.map +0 -1
- package/src/lib/craft-router-outlet.d.ts.map +0 -1
- package/src/lib/craft-router-outlet.js.map +0 -1
- package/src/lib/css-vars.d.ts.map +0 -1
- package/src/lib/css-vars.js.map +0 -1
- package/src/lib/css-vars.type.d.ts.map +0 -1
- package/src/lib/css-vars.type.js.map +0 -1
- package/src/lib/defer.d.ts.map +0 -1
- package/src/lib/defer.js.map +0 -1
- package/src/lib/directive.d.ts.map +0 -1
- package/src/lib/directive.js.map +0 -1
- package/src/lib/each-scheduling.d.ts +0 -59
- package/src/lib/each-scheduling.d.ts.map +0 -1
- package/src/lib/each-scheduling.js.map +0 -1
- package/src/lib/each.d.ts +0 -29
- package/src/lib/each.d.ts.map +0 -1
- package/src/lib/each.js.map +0 -1
- package/src/lib/factory-runtime.d.ts.map +0 -1
- package/src/lib/factory-runtime.js.map +0 -1
- package/src/lib/field-exception-block.d.ts.map +0 -1
- package/src/lib/field-exception-block.js.map +0 -1
- package/src/lib/host-runtime.d.ts.map +0 -1
- package/src/lib/host-runtime.js.map +0 -1
- package/src/lib/hydrate.d.ts.map +0 -1
- package/src/lib/hydrate.js.map +0 -1
- package/src/lib/hyperscript.d.ts.map +0 -1
- package/src/lib/hyperscript.js.map +0 -1
- package/src/lib/if-block.d.ts +0 -8
- package/src/lib/if-block.d.ts.map +0 -1
- package/src/lib/if-block.js.map +0 -1
- package/src/lib/locator.d.ts.map +0 -1
- package/src/lib/locator.js.map +0 -1
- package/src/lib/match-block.d.ts.map +0 -1
- package/src/lib/match-block.js.map +0 -1
- package/src/lib/pending-block.d.ts.map +0 -1
- package/src/lib/pending-block.js.map +0 -1
- package/src/lib/project.d.ts.map +0 -1
- package/src/lib/project.js.map +0 -1
- package/src/lib/render/hydration-metadata.d.ts.map +0 -1
- package/src/lib/render/hydration-metadata.js.map +0 -1
- package/src/lib/render/hydration.d.ts.map +0 -1
- package/src/lib/render/hydration.js.map +0 -1
- package/src/lib/render/interpreter.d.ts.map +0 -1
- package/src/lib/render/interpreter.js.map +0 -1
- package/src/lib/render/server-style-collector.d.ts.map +0 -1
- package/src/lib/render/server-style-collector.js.map +0 -1
- package/src/lib/render/ssr-coordinator.d.ts.map +0 -1
- package/src/lib/render/ssr-coordinator.js.map +0 -1
- package/src/lib/render/string-dom.d.ts.map +0 -1
- package/src/lib/render/string-dom.js.map +0 -1
- package/src/lib/render/style-registry.d.ts.map +0 -1
- package/src/lib/render/style-registry.js.map +0 -1
- package/src/lib/render/style-scope.d.ts.map +0 -1
- package/src/lib/render/style-scope.js.map +0 -1
- package/src/lib/render/vnode.d.ts.map +0 -1
- package/src/lib/render/vnode.js.map +0 -1
- package/src/lib/server-render.d.ts.map +0 -1
- package/src/lib/server-render.js.map +0 -1
- package/src/lib/start.d.ts.map +0 -1
- package/src/lib/start.js.map +0 -1
- package/src/lib/template-contract.d.ts.map +0 -1
- package/src/lib/template-contract.js.map +0 -1
- package/src/lib/template.d.ts.map +0 -1
- package/src/lib/template.js.map +0 -1
- package/src/lib/testing.d.ts.map +0 -1
- package/src/lib/testing.js.map +0 -1
- package/src/lib/types.d.ts.map +0 -1
- package/src/lib/types.js.map +0 -1
- package/testing/public-api.d.ts.map +0 -1
- package/testing/public-api.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CRAFT_TEMPORAL_RUNTIME, craftMethod, craftUse, fromEventToSource$, state, } from '@craft-ts/core';
|
|
2
2
|
import { ɵtoCraftService as toCraftService } from '@craft-ts/core';
|
|
3
|
-
import { liveRegion } from '../a11y';
|
|
4
|
-
import { craftComponent } from '../component';
|
|
5
|
-
import { button, dialog, div, footer, header, label, section, span, strong, textarea, } from '../hyperscript';
|
|
3
|
+
import { liveRegion } from '../a11y.js';
|
|
4
|
+
import { craftComponent } from '../component.js';
|
|
5
|
+
import { button, dialog, div, footer, header, label, section, span, strong, textarea, } from '../hyperscript.js';
|
|
6
6
|
const { CraftTemporalRuntime } = toCraftService({
|
|
7
7
|
name: 'CraftTemporalRuntime',
|
|
8
8
|
providedIn: 'global',
|
|
@@ -262,7 +262,7 @@ export const AiSendDialog = craftComponent('AiSendDialog', {
|
|
|
262
262
|
placeholder: 'Describe what you want the AI to do…',
|
|
263
263
|
input: (event) => writeInstruction(event.target.value),
|
|
264
264
|
}),
|
|
265
|
-
// Toggled by style rather than `
|
|
265
|
+
// Toggled by style rather than `ifNode`, which needs a *named* craft
|
|
266
266
|
// value and would leak the same internal symbols into the type.
|
|
267
267
|
liveRegion({ politeness: 'polite' }, div({
|
|
268
268
|
class: 'craft-ai-success',
|
|
@@ -285,4 +285,3 @@ export const AiSendDialog = craftComponent('AiSendDialog', {
|
|
|
285
285
|
}, () => (copied() ? '✓ Copié' : '⧉ Copier')),
|
|
286
286
|
]),
|
|
287
287
|
])));
|
|
288
|
-
//# sourceMappingURL=ai-send-dialog.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DestroyRef, Injector, type Provider } from '../host-runtime';
|
|
1
|
+
import { DestroyRef, Injector, type Provider } from '../host-runtime.js';
|
|
2
2
|
import { SendContextToAiBuffer, TAKE_APP_SNAPSHOT, type CraftToken, type GetDeps, type SendContextPayload, type TemporalTaskHandle } from '@craft-ts/core';
|
|
3
3
|
export type AiContextMenuController = {
|
|
4
4
|
open(ctx: Omit<SendContextPayload, 'snapshot'>): void;
|
|
@@ -26,4 +26,3 @@ export type GenDeps_AiContextMenuController = GetDeps<{
|
|
|
26
26
|
TAKE_APP_SNAPSHOT: typeof TAKE_APP_SNAPSHOT;
|
|
27
27
|
};
|
|
28
28
|
}>;
|
|
29
|
-
//# sourceMappingURL=send-context-to-ai.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DestroyRef, ElementRef, inject, Injector, runInInjectionContext, } from '../host-runtime';
|
|
1
|
+
import { DestroyRef, ElementRef, inject, Injector, runInInjectionContext, } from '../host-runtime.js';
|
|
2
2
|
import { APP_SNAPSHOT_REGISTRY, craftToken, createSendContextToAiBuffer, fromEventToSource$, HOST_TAG_LIST, CRAFT_TEMPORAL_RUNTIME, injectHostName, provideComponentMonitoring, SEND_CONTEXT_TO_AI_BUFFER, TAKE_APP_SNAPSHOT, } from '@craft-ts/core';
|
|
3
|
-
import { mountCraftComponent } from '../bridge';
|
|
4
|
-
import { AiContextMenu } from './ai-context-menu';
|
|
5
|
-
import { AiSendDialog } from './ai-send-dialog';
|
|
3
|
+
import { mountCraftComponent } from '../bridge.js';
|
|
4
|
+
import { AiContextMenu } from './ai-context-menu.js';
|
|
5
|
+
import { AiSendDialog } from './ai-send-dialog.js';
|
|
6
6
|
const HANDLED_FLAG = Symbol('craft-ai-contextmenu-handled');
|
|
7
7
|
/**
|
|
8
8
|
* Creates the full-screen host element the craft overlay is mounted into.
|
|
@@ -124,4 +124,3 @@ export function provideSendContextToAi() {
|
|
|
124
124
|
}),
|
|
125
125
|
];
|
|
126
126
|
}
|
|
127
|
-
//# sourceMappingURL=send-context-to-ai.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CatchTagExhaustiveCodesCheck, type CraftExceptionResult } from '@craft-ts/core';
|
|
2
|
-
import type { CraftInputExceptionsCarrier, Input } from './types';
|
|
2
|
+
import type { CraftInputExceptionsCarrier, Input } from './types.js';
|
|
3
3
|
export declare const CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE: "CraftUndefinedPropertyException";
|
|
4
4
|
export type CraftUndefinedPropertyException = CraftExceptionResult<{
|
|
5
5
|
readonly _tag: typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE;
|
|
@@ -23,4 +23,3 @@ export declare const catchInput: {
|
|
|
23
23
|
exhaustive<const Handlers extends AssertDefinedInputHandlers>(handlers: Handlers & CatchTagExhaustiveCodesCheck<typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE, Handlers>): <Value>(source: Input<Value>) => PipeableInput<Exclude<Value, undefined> | HandlerOutput<Handlers>>;
|
|
24
24
|
};
|
|
25
25
|
export {};
|
|
26
|
-
//# sourceMappingURL=assert-defined-input.d.ts.map
|
package/src/lib/bootstrap.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ɵinject as inject, type CraftInjector } from '@craft-ts/core';
|
|
1
|
+
import { ɵinject as inject, type CraftInjector, type CraftRuntimeMode } from '@craft-ts/core';
|
|
2
2
|
export type BootstrapCraftOptions = {
|
|
3
3
|
/**
|
|
4
4
|
* The result of `craftAppConfig(...)`. Its `providers` already carry the
|
|
@@ -12,12 +12,14 @@ export type BootstrapCraftOptions = {
|
|
|
12
12
|
* `document.body` when there is none.
|
|
13
13
|
*/
|
|
14
14
|
readonly host?: Element;
|
|
15
|
+
/** Runtime mode for optional diagnostics and development tooling. */
|
|
16
|
+
readonly mode?: CraftRuntimeMode;
|
|
15
17
|
};
|
|
16
18
|
export type CraftAppRef = {
|
|
17
19
|
readonly injector: CraftInjector;
|
|
18
20
|
destroy(): void;
|
|
19
21
|
};
|
|
20
|
-
export declare function ɵcreateCraftApplicationInjector(config: BootstrapCraftOptions['config'], additionalProviders?: readonly unknown[]): CraftInjector;
|
|
22
|
+
export declare function ɵcreateCraftApplicationInjector(config: BootstrapCraftOptions['config'], additionalProviders?: readonly unknown[], mode?: CraftRuntimeMode): CraftInjector;
|
|
21
23
|
export declare function ɵrunCraftAppInitializers(injector: CraftInjector): readonly unknown[];
|
|
22
24
|
/**
|
|
23
25
|
* Boots a Craft application: builds the root injector, runs the app-start
|
|
@@ -29,4 +31,3 @@ export declare function ɵrunCraftAppInitializers(injector: CraftInjector): read
|
|
|
29
31
|
export declare function bootstrapCraft(options: BootstrapCraftOptions): CraftAppRef;
|
|
30
32
|
/** Re-exported so apps can reach the boot injector without importing core. */
|
|
31
33
|
export { inject as ɵbootstrapInject };
|
|
32
|
-
//# sourceMappingURL=bootstrap.d.ts.map
|
package/src/lib/bootstrap.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { APP_INITIALIZER, COMPONENT_REGISTER, CRAFT_PLATFORM, CRAFT_PRIMITIVE_REGISTRY, CraftPrimitiveRegistry, createBrowserPlatform, createComponentRegister, createCraftInjector, ɵcreateEnvironmentInjector as createEnvironmentInjector, ɵgetCraftRootDefaultProviders as getCraftRootDefaultProviders, ɵinject as inject, ɵrunInInjectionContext as runInInjectionContext, } from '@craft-ts/core';
|
|
2
|
-
import { mountCraftComponent } from './bridge';
|
|
3
|
-
import { CRAFT_ROOT_COMPONENT } from './craft-host-tokens';
|
|
1
|
+
import { APP_INITIALIZER, COMPONENT_REGISTER, CRAFT_PLATFORM, CRAFT_PRIMITIVE_REGISTRY, CRAFT_RUNTIME_MODE, CraftPrimitiveRegistry, createBrowserPlatform, createComponentRegister, createCraftInjector, ɵcreateEnvironmentInjector as createEnvironmentInjector, ɵgetCraftRootDefaultProviders as getCraftRootDefaultProviders, ɵinject as inject, ɵrunInInjectionContext as runInInjectionContext, } from '@craft-ts/core';
|
|
2
|
+
import { mountCraftComponent } from './bridge.js';
|
|
3
|
+
import { CRAFT_ROOT_COMPONENT } from './craft-host-tokens.js';
|
|
4
4
|
function resolveHost(host) {
|
|
5
5
|
if (host)
|
|
6
6
|
return host;
|
|
7
7
|
return document.querySelector('craft-root') ?? document.body;
|
|
8
8
|
}
|
|
9
|
-
export function ɵcreateCraftApplicationInjector(config, additionalProviders = []) {
|
|
9
|
+
export function ɵcreateCraftApplicationInjector(config, additionalProviders = [], mode = 'production') {
|
|
10
10
|
return createEnvironmentInjector([
|
|
11
11
|
...getCraftRootDefaultProviders(),
|
|
12
|
+
{ provide: CRAFT_RUNTIME_MODE, useValue: mode },
|
|
12
13
|
{
|
|
13
14
|
provide: COMPONENT_REGISTER,
|
|
14
15
|
useValue: createComponentRegister(),
|
|
@@ -35,9 +36,7 @@ export function ɵrunCraftAppInitializers(injector) {
|
|
|
35
36
|
*/
|
|
36
37
|
export function bootstrapCraft(options) {
|
|
37
38
|
const platform = createBrowserPlatform(window);
|
|
38
|
-
const injector = ɵcreateCraftApplicationInjector(options.config, [
|
|
39
|
-
{ provide: CRAFT_PLATFORM, useValue: platform },
|
|
40
|
-
]);
|
|
39
|
+
const injector = ɵcreateCraftApplicationInjector(options.config, [{ provide: CRAFT_PLATFORM, useValue: platform }], options.mode);
|
|
41
40
|
// appStart hooks run before the first render, so a service that seeds state
|
|
42
41
|
// has done so by the time the root component reads it.
|
|
43
42
|
ɵrunCraftAppInitializers(injector);
|
|
@@ -57,4 +56,3 @@ export function bootstrapCraft(options) {
|
|
|
57
56
|
}
|
|
58
57
|
/** Re-exported so apps can reach the boot injector without importing core. */
|
|
59
58
|
export { inject as ɵbootstrapInject };
|
|
60
|
-
//# sourceMappingURL=bootstrap.js.map
|
package/src/lib/bridge.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type ComponentDepsCarrier, type ComponentDepsOf, type ComponentExceptionsCarrier, type CraftRouteLazyLoadHelpers } from '@craft-ts/core';
|
|
2
|
-
import { type MountedCraftComponent } from './render/interpreter';
|
|
3
|
-
import type { ComponentFieldExceptionsOf, ComponentInitializationExceptionsOf, ComponentCssVarsOf, ComponentNameOf, CraftComponent, PropsOf } from './types';
|
|
4
|
-
import type { CssVarContract } from './css-vars.type';
|
|
1
|
+
import { type ComponentDepsCarrier, type ComponentDepsOf, type ComponentExceptionsCarrier, type CraftRouteAdditionalProvidersCarrier, type CraftRouteLazyLoadHelpers } from '@craft-ts/core';
|
|
2
|
+
import { type MountedCraftComponent } from './render/interpreter.js';
|
|
3
|
+
import type { ComponentFieldExceptionsOf, ComponentInitializationExceptionsOf, ComponentCssVarsOf, ComponentNameOf, CraftComponent, PropsOf } from './types.js';
|
|
4
|
+
import type { CssVarContract } from './css-vars.type.js';
|
|
5
5
|
export type CraftMountRef<Props extends object> = MountedCraftComponent<Props>;
|
|
6
6
|
type IsAny<Value> = 0 extends 1 & Value ? true : false;
|
|
7
7
|
type RequireHandledMountFieldExceptions<Component> = IsAny<ComponentFieldExceptionsOf<Component>> extends true ? unknown : unknown extends ComponentFieldExceptionsOf<Component> ? unknown : [ComponentFieldExceptionsOf<Component>] extends [never] ? unknown : {
|
|
8
|
-
'
|
|
8
|
+
'fieldErrorNode.exhaustive is required before mounting component field exceptions': ComponentFieldExceptionsOf<Component>;
|
|
9
9
|
};
|
|
10
10
|
export declare function mountCraftComponent<Component extends CraftComponent<any>>(component: Component & RequireHandledMountFieldExceptions<Component>, hostElement: Element, injector: object, props?: PropsOf<Component>): CraftMountRef<PropsOf<Component>>;
|
|
11
11
|
type ValueProvider = {
|
|
@@ -17,10 +17,10 @@ type Route = {
|
|
|
17
17
|
providers?: readonly unknown[];
|
|
18
18
|
};
|
|
19
19
|
type Type<T> = new (...args: never[]) => T;
|
|
20
|
-
export { CRAFT_GLOBAL_ERROR_COMPONENT, CRAFT_PENDING_COMPONENT, CRAFT_ROOT_COMPONENT, CRAFT_ROUTE_LOAD_ERROR_COMPONENT, CRAFT_ROUTED_COMPONENT, } from './craft-host-tokens';
|
|
20
|
+
export { CRAFT_GLOBAL_ERROR_COMPONENT, CRAFT_PENDING_COMPONENT, CRAFT_ROOT_COMPONENT, CRAFT_ROUTE_LOAD_ERROR_COMPONENT, CRAFT_ROUTED_COMPONENT, } from './craft-host-tokens.js';
|
|
21
21
|
export declare function provideCraftComponent(component: CraftComponent<any>): ValueProvider;
|
|
22
22
|
type RequireHandledRouteFieldExceptions<Component> = IsAny<ComponentFieldExceptionsOf<Component>> extends true ? unknown : unknown extends ComponentFieldExceptionsOf<Component> ? unknown : [ComponentFieldExceptionsOf<Component>] extends [never] ? unknown : {
|
|
23
|
-
'
|
|
23
|
+
'fieldErrorNode.exhaustive is required before routing component field exceptions': ComponentFieldExceptionsOf<Component>;
|
|
24
24
|
};
|
|
25
25
|
export type CraftRouteCssVarsCarrier<Contract extends CssVarContract = CssVarContract, Name extends string = string> = {
|
|
26
26
|
readonly __craftRouteCssVars__?: {
|
|
@@ -43,14 +43,13 @@ type AssertCssVarsSatisfied<Routes> = [RouteCssVarErrors<Routes>] extends [
|
|
|
43
43
|
};
|
|
44
44
|
/** Compile-time proof that no required CSS variable reaches a route root. */
|
|
45
45
|
export declare function assertCssVarsSatisfied<Routes>(routes: Routes & AssertCssVarsSatisfied<Routes>): Routes;
|
|
46
|
-
export declare function loadCraftComponent<const Component extends CraftComponent<any
|
|
46
|
+
export declare function loadCraftComponent<const Component extends CraftComponent<any>, const AdditionalProviders extends NonNullable<Route['providers']> = readonly []>(loader: ((helpers: CraftRouteLazyLoadHelpers) => Promise<Component>) & RequireHandledRouteFieldExceptions<NoInfer<Component>>, additionalProviders?: AdditionalProviders): {
|
|
47
47
|
loadComponent: (helpers: CraftRouteLazyLoadHelpers) => Promise<Type<unknown>>;
|
|
48
48
|
providers: NonNullable<Route['providers']>;
|
|
49
|
-
} & ComponentDepsCarrier<ComponentDepsOf<Component>> & ComponentExceptionsCarrier<ComponentInitializationExceptionsOf<Component>> & CraftRouteCssVarsCarrier<ComponentCssVarsOf<Component>, ComponentNameOf<Component>>;
|
|
49
|
+
} & ComponentDepsCarrier<ComponentDepsOf<Component>> & ComponentExceptionsCarrier<ComponentInitializationExceptionsOf<Component>> & CraftRouteAdditionalProvidersCarrier<AdditionalProviders> & CraftRouteCssVarsCarrier<ComponentCssVarsOf<Component>, ComponentNameOf<Component>>;
|
|
50
50
|
export declare function craftComponentRouteData(component: CraftComponent<any>): Readonly<Record<string, unknown>>;
|
|
51
51
|
export declare function provideCraftRootComponent(component: CraftComponent<any>): ValueProvider;
|
|
52
52
|
export declare function provideCraftGlobalErrorComponent(component: CraftComponent<any>): ValueProvider;
|
|
53
53
|
export declare function provideCraftRouteLoadErrorComponent(component: CraftComponent<any>): ValueProvider;
|
|
54
54
|
export declare function provideCraftPendingComponent(component: CraftComponent<any>): ValueProvider;
|
|
55
55
|
export declare function craftPendingComponentRouteData(component: CraftComponent<any>): Readonly<Record<string, unknown>>;
|
|
56
|
-
//# sourceMappingURL=bridge.d.ts.map
|
package/src/lib/bridge.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CRAFT_ROUTE_TARGET, craftRouteTarget, } from '@craft-ts/core';
|
|
2
|
-
import { CRAFT_GLOBAL_ERROR_COMPONENT, CRAFT_PENDING_COMPONENT, CRAFT_ROOT_COMPONENT, CRAFT_ROUTE_LOAD_ERROR_COMPONENT, CRAFT_ROUTED_COMPONENT, } from './craft-host-tokens';
|
|
3
|
-
import { mountInterpretedComponent, } from './render/interpreter';
|
|
2
|
+
import { CRAFT_GLOBAL_ERROR_COMPONENT, CRAFT_PENDING_COMPONENT, CRAFT_ROOT_COMPONENT, CRAFT_ROUTE_LOAD_ERROR_COMPONENT, CRAFT_ROUTED_COMPONENT, } from './craft-host-tokens.js';
|
|
3
|
+
import { mountInterpretedComponent, } from './render/interpreter.js';
|
|
4
4
|
export function mountCraftComponent(component, hostElement, injector, props = {}) {
|
|
5
5
|
return mountInterpretedComponent(component, hostElement, injector, props);
|
|
6
6
|
}
|
|
7
|
-
export { CRAFT_GLOBAL_ERROR_COMPONENT, CRAFT_PENDING_COMPONENT, CRAFT_ROOT_COMPONENT, CRAFT_ROUTE_LOAD_ERROR_COMPONENT, CRAFT_ROUTED_COMPONENT, } from './craft-host-tokens';
|
|
7
|
+
export { CRAFT_GLOBAL_ERROR_COMPONENT, CRAFT_PENDING_COMPONENT, CRAFT_ROOT_COMPONENT, CRAFT_ROUTE_LOAD_ERROR_COMPONENT, CRAFT_ROUTED_COMPONENT, } from './craft-host-tokens.js';
|
|
8
8
|
export function provideCraftComponent(component) {
|
|
9
9
|
return {
|
|
10
10
|
provide: CRAFT_ROUTED_COMPONENT,
|
|
@@ -78,4 +78,3 @@ export function provideCraftPendingComponent(component) {
|
|
|
78
78
|
export function craftPendingComponentRouteData(component) {
|
|
79
79
|
return { craftPendingComponent: component };
|
|
80
80
|
}
|
|
81
|
-
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AnyCraftException } from '@craft-ts/core';
|
|
2
|
+
import { COMPONENT_CATCH_NODE, type ComponentOperator, type ComponentExceptionHandler, type ComponentExceptionHandlerDefinition, type ComponentExceptionHandlerEntry, type ComponentExceptionHandlerOptions, type CraftDirective } from './types.js';
|
|
3
|
+
import type { CraftNodeChildren } from './render/vnode.js';
|
|
4
|
+
export declare const CATCH_NODE_DIRECTIVE: unique symbol;
|
|
5
|
+
export type CatchPosition = 'before' | 'after';
|
|
6
|
+
export declare class CraftUnhandledExceptionError extends Error {
|
|
7
|
+
readonly _tag: string;
|
|
8
|
+
constructor(exception: AnyCraftException);
|
|
9
|
+
}
|
|
10
|
+
export type CatchHandler = ComponentExceptionHandler;
|
|
11
|
+
export type CatchHandlerOptions = ComponentExceptionHandlerOptions;
|
|
12
|
+
export type CatchHandlerDefinition = ComponentExceptionHandlerDefinition;
|
|
13
|
+
export type CatchHandlerEntry = ComponentExceptionHandlerEntry;
|
|
14
|
+
export type CatchHandlers = Record<string, CatchHandlerEntry>;
|
|
15
|
+
export type CatchHandlerChildren<Handler> = Handler extends ComponentExceptionHandlerEntry ? Handler extends (...args: any[]) => infer Children ? Children : Handler extends {
|
|
16
|
+
readonly render: (...args: any[]) => infer Children;
|
|
17
|
+
} ? Children : never : never;
|
|
18
|
+
export declare function resolveCatchHandler(handler: CatchHandlerEntry, exception: AnyCraftException, defaultShowSource: boolean, defaultPosition: CatchPosition): {
|
|
19
|
+
readonly children: CraftNodeChildren;
|
|
20
|
+
readonly showSource: boolean;
|
|
21
|
+
readonly position: CatchPosition;
|
|
22
|
+
};
|
|
23
|
+
export type CatchDirective<Handlers extends CatchHandlers> = CraftDirective & ComponentOperator<readonly [], Extract<keyof Handlers, string>> & {
|
|
24
|
+
readonly [COMPONENT_CATCH_NODE]: true;
|
|
25
|
+
readonly [CATCH_NODE_DIRECTIVE]: {
|
|
26
|
+
readonly handlers: Handlers;
|
|
27
|
+
readonly position: CatchPosition;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/** A template boundary which keeps its source block and inserts a fallback. */
|
|
31
|
+
export declare const catchNode: {
|
|
32
|
+
exhaustive<const Handlers extends CatchHandlers>(handlers: Handlers, options?: {
|
|
33
|
+
readonly position?: CatchPosition;
|
|
34
|
+
}): CatchDirective<Handlers>;
|
|
35
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CRAFT_DIRECTIVE,
|
|
2
|
-
export const
|
|
1
|
+
import { CRAFT_DIRECTIVE, COMPONENT_CATCH_NODE, } from './types.js';
|
|
2
|
+
export const CATCH_NODE_DIRECTIVE = Symbol('craft-catch-node-directive');
|
|
3
3
|
export class CraftUnhandledExceptionError extends Error {
|
|
4
4
|
_tag;
|
|
5
5
|
constructor(exception) {
|
|
@@ -8,7 +8,7 @@ export class CraftUnhandledExceptionError extends Error {
|
|
|
8
8
|
this._tag = exception._tag;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export function
|
|
11
|
+
export function resolveCatchHandler(handler, exception, defaultShowSource, defaultPosition) {
|
|
12
12
|
if (typeof handler === 'function') {
|
|
13
13
|
return {
|
|
14
14
|
children: handler(exception),
|
|
@@ -23,33 +23,32 @@ export function resolveCatchBlockHandler(handler, exception, defaultShowSource,
|
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
/** A template boundary which keeps its source block and inserts a fallback. */
|
|
26
|
-
export const
|
|
26
|
+
export const catchNode = {
|
|
27
27
|
exhaustive(handlers, options = {}) {
|
|
28
28
|
const position = options.position ?? 'after';
|
|
29
29
|
const directive = (() => undefined);
|
|
30
30
|
Object.defineProperty(directive, CRAFT_DIRECTIVE, {
|
|
31
31
|
value: {
|
|
32
|
-
name: '
|
|
32
|
+
name: 'catchNode.exhaustive',
|
|
33
33
|
meta: {},
|
|
34
34
|
logic: (baseLogic) => baseLogic,
|
|
35
35
|
template: (baseTemplate) => baseTemplate,
|
|
36
36
|
componentOperator: {
|
|
37
|
-
kind: '
|
|
37
|
+
kind: 'catchNode',
|
|
38
38
|
catchHandlers: handlers,
|
|
39
|
-
|
|
39
|
+
catchNodePosition: position,
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
enumerable: false,
|
|
43
43
|
});
|
|
44
|
-
Object.defineProperty(directive,
|
|
44
|
+
Object.defineProperty(directive, CATCH_NODE_DIRECTIVE, {
|
|
45
45
|
value: { handlers, position },
|
|
46
46
|
enumerable: false,
|
|
47
47
|
});
|
|
48
|
-
Object.defineProperty(directive,
|
|
48
|
+
Object.defineProperty(directive, COMPONENT_CATCH_NODE, {
|
|
49
49
|
value: true,
|
|
50
50
|
enumerable: false,
|
|
51
51
|
});
|
|
52
52
|
return directive;
|
|
53
53
|
},
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=block.js.map
|
package/src/lib/component.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type CraftComponentDependencies } from '@craft-ts/core';
|
|
2
|
-
import { type ComponentFactory, type ComponentMeta, type ComponentInitializationExceptionCodesForTemplate, type ComponentTemplate, type ComponentResidualFieldExceptions, type ContentRequirementsOfContext, type CraftComponent, type FactoryContext, type FactoryYielded, type PropsFromFactory, type TemplateDependencies, type TemplateCssVars, type TemplateHeadingNeed, type TemplatePendingSources, type TemplateSettledExceptions } from './types';
|
|
3
|
-
import type { CssVarsContractOfMeta } from './css-vars.type';
|
|
1
|
+
import { type CraftComponentDependencies, type UnmetRequirements } from '@craft-ts/core';
|
|
2
|
+
import { type ComponentFactory, type ComponentMeta, type ComponentInitializationExceptionCodesForTemplate, type ComponentTemplate, type ComponentResidualFieldExceptions, type ContentRequirementsOfContext, type CraftComponent, type FactoryContext, type FactoryYielded, type PropsFromFactory, type TemplateDependencies, type TemplateCssVars, type TemplateHeadingNeed, type TemplatePendingSources, type TemplateSettledExceptions } from './types.js';
|
|
3
|
+
import type { CssVarsContractOfMeta } from './css-vars.type.js';
|
|
4
|
+
import type { ComponentTemplateChannels } from './render/vnode.js';
|
|
4
5
|
type ProvidersFromMeta<Meta extends ComponentMeta> = Meta extends {
|
|
5
6
|
readonly providers: infer Providers;
|
|
6
7
|
} ? Providers : readonly [];
|
|
@@ -14,25 +15,38 @@ type IsAny<Value> = 0 extends 1 & Value ? true : false;
|
|
|
14
15
|
/**
|
|
15
16
|
* A template may only render an async source (`settledValue`, or a
|
|
16
17
|
* `craftComputed` that consumed one with `yield* settled(...)`) from inside a
|
|
17
|
-
* `
|
|
18
|
+
* `pendingNode` boundary. Anything left uncovered fails here, on the template
|
|
18
19
|
* argument, naming the sources that have nowhere to show their loading state.
|
|
19
20
|
*/
|
|
20
21
|
type ValidPendingSources<Template> = IsAny<TemplatePendingSources<Template>> extends true ? unknown : string extends TemplatePendingSources<Template> ? unknown : [TemplatePendingSources<Template>] extends [never] ? unknown : {
|
|
21
|
-
readonly
|
|
22
|
+
readonly ERROR_async_source_rendered_outside_a_pendingNode: TemplatePendingSources<Template>;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* A template may only render a value whose settled read can raise an exception
|
|
25
|
-
* from inside a `
|
|
26
|
+
* from inside a `catchNode`. Anything left uncovered fails here, on the
|
|
26
27
|
* template argument, naming the codes with nowhere to be handled.
|
|
27
28
|
*/
|
|
28
29
|
type ValidSettledExceptions<Template> = IsAny<TemplateSettledExceptions<Template>> extends true ? unknown : string extends TemplateSettledExceptions<Template> ? unknown : [TemplateSettledExceptions<Template>] extends [never] ? unknown : {
|
|
29
|
-
readonly
|
|
30
|
+
readonly ERROR_settled_read_exception_not_caught_by_a_catchNode: TemplateSettledExceptions<Template>;
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
33
|
* A reusable child may render `heading()` without a local `headingSection` —
|
|
33
34
|
* the need bubbles. The *parent* that calls that child must wrap the call in
|
|
34
|
-
* `headingSection` (same DNA as `
|
|
35
|
+
* `headingSection` (same DNA as `pendingNode` on the parent, not the child).
|
|
35
36
|
*/
|
|
37
|
+
/**
|
|
38
|
+
* A sealing component must leave no context requirement open.
|
|
39
|
+
*
|
|
40
|
+
* The message is composed from the payload itself — an id and a sentence the
|
|
41
|
+
* vocabulary wrote — so this layer names the thing precisely while knowing
|
|
42
|
+
* nothing about what it is. The requester is named because the id is the
|
|
43
|
+
* requester's own, and the sentence says where to declare the answer.
|
|
44
|
+
*/
|
|
45
|
+
type ValidSeals<Meta, Template> = Meta extends {
|
|
46
|
+
readonly seals: unknown;
|
|
47
|
+
} ? [UnmetRequirements<ComponentTemplateChannels<Template>>] extends [never] ? unknown : {
|
|
48
|
+
readonly ERROR_unmet_context_requirement: UnmetRequirements<ComponentTemplateChannels<Template>>;
|
|
49
|
+
} : unknown;
|
|
36
50
|
type ValidHeadingNeed<Template> = IsAny<TemplateHeadingNeed<Template>> extends true ? unknown : string extends TemplateHeadingNeed<Template> ? unknown : [Extract<TemplateHeadingNeed<Template>, 'heading-from-child'>] extends [
|
|
37
51
|
never
|
|
38
52
|
] ? unknown : {
|
|
@@ -41,6 +55,5 @@ type ValidHeadingNeed<Template> = IsAny<TemplateHeadingNeed<Template>> extends t
|
|
|
41
55
|
type ValidInheritedCssVars<Meta extends ComponentMeta, Template> = IsAny<TemplateCssVars<Template>['inherited']> extends true ? unknown : Exclude<TemplateCssVars<Template>['inherited'], CssVarsContractOfMeta<Meta>['declared']> extends infer Missing ? [Missing] extends [never] ? unknown : {
|
|
42
56
|
readonly ERROR_css_var_marked_inherit_is_not_declared_here: Missing;
|
|
43
57
|
} : never;
|
|
44
|
-
export declare function craftComponent<const Name extends string, const Meta extends ComponentMeta, Factory extends ComponentFactory, Template extends ComponentTemplate<FactoryContext<Factory>>>(name: Name, meta: Meta & ValidContentStyles<Meta, Factory>, factory: Factory, template: Template & ValidInheritedCssVars<Meta, NoInfer<Template>> & ValidPendingSources<NoInfer<Template>> & ValidSettledExceptions<NoInfer<Template>> & ValidHeadingNeed<NoInfer<Template>>): CraftComponent<PropsFromFactory<Factory>, CraftComponentDependencies<FactoryYielded<Factory>, FactoryContext<Factory>, ProvidersFromMeta<Meta>, PropsFromFactory<Factory>, TemplateDependencies<Template>>, Factory, Meta, Factory, TemplateDependencies<Template>, Template, Name, ComponentInitializationExceptionCodesForTemplate<Factory, ProvidersFromMeta<Meta>, Template>, ContentRequirementsOfContext<FactoryContext<Factory>>, ComponentResidualFieldExceptions<Factory, Template>>;
|
|
58
|
+
export declare function craftComponent<const Name extends string, const Meta extends ComponentMeta, Factory extends ComponentFactory, Template extends ComponentTemplate<FactoryContext<Factory>>>(name: Name, meta: Meta & ValidContentStyles<Meta, Factory>, factory: Factory, template: Template & ValidInheritedCssVars<Meta, NoInfer<Template>> & ValidPendingSources<NoInfer<Template>> & ValidSettledExceptions<NoInfer<Template>> & ValidHeadingNeed<NoInfer<Template>> & ValidSeals<Meta, NoInfer<Template>>): CraftComponent<PropsFromFactory<Factory>, CraftComponentDependencies<FactoryYielded<Factory>, FactoryContext<Factory>, ProvidersFromMeta<Meta>, PropsFromFactory<Factory>, TemplateDependencies<Template>>, Factory, Meta, Factory, TemplateDependencies<Template>, Template, Name, ComponentInitializationExceptionCodesForTemplate<Factory, ProvidersFromMeta<Meta>, Template>, ContentRequirementsOfContext<FactoryContext<Factory>>, ComponentResidualFieldExceptions<Factory, Template>>;
|
|
45
59
|
export {};
|
|
46
|
-
//# sourceMappingURL=component.d.ts.map
|
package/src/lib/component.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CRAFT_REGISTRATION_TARGET, } from '@craft-ts/core';
|
|
2
|
-
import { CRAFT_COMPONENT, CRAFT_DIRECTIVE, } from './types';
|
|
3
|
-
import { forwardedCssVarStyles } from './css-vars';
|
|
4
|
-
import { applyHostPropsToChildren, currentCraftRenderContext, mergeHostProps, pipeCraftNode, } from './render/vnode';
|
|
2
|
+
import { CRAFT_COMPONENT, CRAFT_DIRECTIVE, } from './types.js';
|
|
3
|
+
import { forwardedCssVarStyles } from './css-vars.js';
|
|
4
|
+
import { applyHostPropsToChildren, currentCraftRenderContext, mergeHostProps, pipeCraftNode, } from './render/vnode.js';
|
|
5
5
|
function mergeStyles(...sources) {
|
|
6
6
|
return sources.flatMap((source) => typeof source === 'string' ? [source] : (source ?? []));
|
|
7
7
|
}
|
|
@@ -103,16 +103,15 @@ function mergeComponentComposition(existing, next) {
|
|
|
103
103
|
];
|
|
104
104
|
const catchHandlers = next?.catchHandlers ?? existing?.catchHandlers;
|
|
105
105
|
const catchTagHandlers = next?.catchTagHandlers ?? existing?.catchTagHandlers;
|
|
106
|
-
const
|
|
106
|
+
const catchNodePosition = next?.catchNodePosition ?? existing?.catchNodePosition;
|
|
107
107
|
const fieldExceptionHandlers = next?.fieldExceptionHandlers ?? existing?.fieldExceptionHandlers;
|
|
108
108
|
const fieldExceptionOptions = next?.fieldExceptionOptions ?? existing?.fieldExceptionOptions;
|
|
109
109
|
return {
|
|
110
110
|
...(providers.length ? { providers } : {}),
|
|
111
111
|
...(catchHandlers ? { catchHandlers } : {}),
|
|
112
112
|
...(catchTagHandlers ? { catchTagHandlers } : {}),
|
|
113
|
-
...(
|
|
113
|
+
...(catchNodePosition ? { catchNodePosition } : {}),
|
|
114
114
|
...(fieldExceptionHandlers ? { fieldExceptionHandlers } : {}),
|
|
115
115
|
...(fieldExceptionOptions ? { fieldExceptionOptions } : {}),
|
|
116
116
|
};
|
|
117
117
|
}
|
|
118
|
-
//# sourceMappingURL=component.js.map
|
package/src/lib/composition.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyCraftException, CraftServiceProvider } from '@craft-ts/core';
|
|
2
|
-
import { type ComponentOperator, type ComponentInitializationExceptionsOf, type CraftComponent } from './types';
|
|
2
|
+
import { type ComponentOperator, type ComponentInitializationExceptionsOf, type CraftComponent } from './types.js';
|
|
3
3
|
/** Adds a component-local provider scope to the component invocation. */
|
|
4
4
|
export declare function withProviders<const Providers extends readonly CraftServiceProvider[]>(providers: Providers): ComponentOperator<Providers>;
|
|
5
5
|
export type CatchTagHandlers<Codes extends string> = {
|
|
@@ -14,4 +14,3 @@ interface CatchTag {
|
|
|
14
14
|
}
|
|
15
15
|
export declare const catchTag: CatchTag;
|
|
16
16
|
export {};
|
|
17
|
-
//# sourceMappingURL=composition.d.ts.map
|
package/src/lib/composition.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { craftDirective } from './directive';
|
|
2
|
-
import { COMPONENT_OPERATOR, } from './types';
|
|
1
|
+
import { craftDirective } from './directive.js';
|
|
2
|
+
import { COMPONENT_OPERATOR, } from './types.js';
|
|
3
3
|
/** Adds a component-local provider scope to the component invocation. */
|
|
4
4
|
export function withProviders(providers) {
|
|
5
5
|
const operator = craftDirective('withProviders', {}, (baseLogic) => baseLogic, (baseTemplate) => baseTemplate, { providers });
|
|
@@ -25,4 +25,3 @@ function createCatchTagOperator(handlers) {
|
|
|
25
25
|
});
|
|
26
26
|
return operator;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=composition.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CRAFT_LOADING_TEXT, craftRouteTarget, ɵregisterDefaultCraftPendingComponent, ɵsetCraftTestMounter, } from '@craft-ts/core';
|
|
2
|
-
import { mountCraftComponent } from './bridge';
|
|
3
|
-
import { inject } from './host-runtime';
|
|
4
|
-
import { craftComponent } from './component';
|
|
5
|
-
import { div } from './hyperscript';
|
|
2
|
+
import { mountCraftComponent } from './bridge.js';
|
|
3
|
+
import { inject } from './host-runtime.js';
|
|
4
|
+
import { craftComponent } from './component.js';
|
|
5
|
+
import { div } from './hyperscript.js';
|
|
6
6
|
/**
|
|
7
7
|
* The loader shown once a route's guard/resolve chain outruns both
|
|
8
8
|
* `CRAFT_STAY_MS` and `CRAFT_BLANK_MS`. Override it globally with
|
|
@@ -38,4 +38,3 @@ const DefaultCraftPendingComponent = craftComponent('craftPending', {
|
|
|
38
38
|
destroy: () => mounted.destroy(),
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
|
-
//# sourceMappingURL=craft-defaults.js.map
|
|
@@ -3,4 +3,3 @@ export declare const CRAFT_ROOT_COMPONENT: import("@craft-ts/core").CraftToken<u
|
|
|
3
3
|
export declare const CRAFT_GLOBAL_ERROR_COMPONENT: import("@craft-ts/core").CraftToken<unknown>;
|
|
4
4
|
export declare const CRAFT_ROUTE_LOAD_ERROR_COMPONENT: import("@craft-ts/core").CraftToken<unknown>;
|
|
5
5
|
export declare const CRAFT_PENDING_COMPONENT: import("@craft-ts/core").CraftToken<unknown>;
|
|
6
|
-
//# sourceMappingURL=craft-host-tokens.d.ts.map
|
|
@@ -4,4 +4,3 @@ export const CRAFT_ROOT_COMPONENT = craftToken('CRAFT_ROOT_COMPONENT');
|
|
|
4
4
|
export const CRAFT_GLOBAL_ERROR_COMPONENT = craftToken('CRAFT_GLOBAL_ERROR_COMPONENT');
|
|
5
5
|
export const CRAFT_ROUTE_LOAD_ERROR_COMPONENT = craftToken('CRAFT_ROUTE_LOAD_ERROR_COMPONENT');
|
|
6
6
|
export const CRAFT_PENDING_COMPONENT = craftToken('CRAFT_PENDING_COMPONENT');
|
|
7
|
-
//# sourceMappingURL=craft-host-tokens.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CraftRouterOutletController } from '@craft-ts/core';
|
|
2
|
-
import type { CraftComponent } from './types';
|
|
2
|
+
import type { CraftComponent } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Functional non-blocking router outlet.
|
|
5
5
|
*
|
|
@@ -12,4 +12,3 @@ type CraftRouterOutletFactory = () => {
|
|
|
12
12
|
};
|
|
13
13
|
export declare const CraftRouterOutlet: CraftComponent<Record<never, never>, Record<never, never>, CraftRouterOutletFactory>;
|
|
14
14
|
export {};
|
|
15
|
-
//# sourceMappingURL=craft-router-outlet.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCraftRouterOutletController, } from '@craft-ts/core';
|
|
2
|
-
import { craftComponent } from './component';
|
|
2
|
+
import { craftComponent } from './component.js';
|
|
3
3
|
export const CraftRouterOutlet = craftComponent('CraftRouterOutlet', {}, () => ({ outlet: createCraftRouterOutletController() }), ({ outlet }) => {
|
|
4
4
|
const target = outlet.displayedTarget();
|
|
5
5
|
if (!target)
|
|
@@ -7,4 +7,3 @@ export const CraftRouterOutlet = craftComponent('CraftRouterOutlet', {}, () => (
|
|
|
7
7
|
const node = target.component(outlet.displayedProps());
|
|
8
8
|
return Object.assign(node, { injector: outlet.displayedInjector() });
|
|
9
9
|
});
|
|
10
|
-
//# sourceMappingURL=craft-router-outlet.js.map
|
package/src/lib/css-vars.d.ts
CHANGED
|
@@ -28,4 +28,3 @@ export declare function isForwardCssVar(value: unknown): value is ForwardCssVar;
|
|
|
28
28
|
export declare function cssVarStyles(cssVars: Readonly<Record<`--${string}`, CssVarDisposition>> | undefined): Readonly<Record<`--${string}`, CssVarValue>>;
|
|
29
29
|
export declare function forwardedCssVarStyles(value: unknown, seen?: Set<object>): Readonly<Record<`--${string}`, CssVarValue>>;
|
|
30
30
|
export {};
|
|
31
|
-
//# sourceMappingURL=css-vars.d.ts.map
|
package/src/lib/css-vars.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CssVarDisposition, CssVarValue, ForwardCssVar, InheritCssVar, RequiredCssVar } from './css-vars';
|
|
1
|
+
import type { CssVarDisposition, CssVarValue, ForwardCssVar, InheritCssVar, RequiredCssVar } from './css-vars.js';
|
|
2
2
|
export type CssVarContract = {
|
|
3
3
|
readonly required: string;
|
|
4
4
|
readonly optional: string;
|
|
@@ -148,4 +148,3 @@ export type CssVarsCallProps<Contract extends CssVarContract> = [
|
|
|
148
148
|
};
|
|
149
149
|
export type CssVarsMetaDeclaration = Readonly<Record<`--${string}`, CssVarValue | RequiredCssVar>>;
|
|
150
150
|
export {};
|
|
151
|
-
//# sourceMappingURL=css-vars.type.d.ts.map
|
package/src/lib/css-vars.type.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=css-vars.type.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { CraftComponent, PropsOf } from './types';
|
|
1
|
+
import type { CraftComponent, PropsOf } from './types.js';
|
|
2
2
|
import type { ComponentDepsOf, CraftLazyLoadHelpers } from '@craft-ts/core';
|
|
3
|
-
import type { CraftNodeChildrenDependencies, CraftNodeChildren, DeferNode, DeferTrigger } from './render/vnode';
|
|
3
|
+
import type { CraftNodeChildrenDependencies, CraftNodeChildren, DeferNode, DeferTrigger } from './render/vnode.js';
|
|
4
4
|
export interface DeferOptions<Loaded> {
|
|
5
5
|
readonly trigger?: DeferTrigger;
|
|
6
6
|
readonly resolve?: (loaded: Loaded) => CraftNodeChildren;
|
|
@@ -19,13 +19,12 @@ type DeferOptionsDependencies<Options> = Options extends object ? CallbackDepend
|
|
|
19
19
|
} ? Loading : never> | CallbackDependencies<Options extends {
|
|
20
20
|
error?: infer Error;
|
|
21
21
|
} ? Error : never> : {};
|
|
22
|
-
export declare function
|
|
22
|
+
export declare function deferNode<Loaded, Options extends DeferOptions<Loaded> & {
|
|
23
23
|
readonly resolve: (loaded: Loaded) => CraftNodeChildren;
|
|
24
24
|
}>(loader: DeferLoader<Loaded>, options: Options): DeferNode<Loaded, DeferOptionsDependencies<Options>>;
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function deferNode<Component extends CraftComponent<any>, Options extends Omit<DeferOptions<Component>, 'resolve'> & {
|
|
26
26
|
readonly props?: PropsOf<Component>;
|
|
27
27
|
} = Omit<DeferOptions<Component>, 'resolve'> & {
|
|
28
28
|
readonly props?: PropsOf<Component>;
|
|
29
29
|
}>(loader: DeferLoader<Component>, options?: Options): DeferNode<Component, ComponentDepsOf<Component> | DeferOptionsDependencies<Options>>;
|
|
30
30
|
export {};
|
|
31
|
-
//# sourceMappingURL=defer.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function deferNode(loader, options = {}) {
|
|
2
2
|
const resolve = options.resolve ??
|
|
3
3
|
((loaded) => {
|
|
4
4
|
if (typeof loaded !== 'function') {
|
|
@@ -16,4 +16,3 @@ export function defer(loader, options = {}) {
|
|
|
16
16
|
error: options.error,
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=defer.js.map
|
package/src/lib/directive.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CraftDirective, type ComponentOperatorDefinition, type DirectiveMeta, type LogicDecorator, type TemplateDependencies, type TemplateDecorator } from './types';
|
|
1
|
+
import { type CraftDirective, type ComponentOperatorDefinition, type DirectiveMeta, type LogicDecorator, type TemplateDependencies, type TemplateDecorator } from './types.js';
|
|
2
2
|
type DirectiveTemplateDependencies<Template> = Template extends (...args: any[]) => infer DecoratedTemplate ? TemplateDependencies<DecoratedTemplate> : {};
|
|
3
3
|
/**
|
|
4
4
|
* Decorates a Craft component's factory and template as one reusable unit.
|
|
@@ -6,4 +6,3 @@ type DirectiveTemplateDependencies<Template> = Template extends (...args: any[])
|
|
|
6
6
|
*/
|
|
7
7
|
export declare function craftDirective<const Name extends string, const Meta extends DirectiveMeta, Logic extends LogicDecorator, const Template extends TemplateDecorator>(name: Name, meta: Meta, logic: Logic, template: Template, componentOperator?: ComponentOperatorDefinition): CraftDirective<Logic, Template, DirectiveTemplateDependencies<Template>>;
|
|
8
8
|
export {};
|
|
9
|
-
//# sourceMappingURL=directive.d.ts.map
|
package/src/lib/directive.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CRAFT_DIRECTIVE, } from './types';
|
|
1
|
+
import { CRAFT_DIRECTIVE, } from './types.js';
|
|
2
2
|
import { CRAFT_REGISTRATION_TARGET } from '@craft-ts/core';
|
|
3
3
|
import { CRAFT_NODE_DIRECTIVE } from '@craft-ts/core';
|
|
4
4
|
/**
|
|
@@ -28,4 +28,3 @@ export function craftDirective(name, meta, logic, template, componentOperator) {
|
|
|
28
28
|
}
|
|
29
29
|
return directive;
|
|
30
30
|
}
|
|
31
|
-
//# sourceMappingURL=directive.js.map
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { type CraftInjector, type CraftProgramSettledStep, type ResolveGeneratorResult } from '@craft-ts/core';
|
|
2
|
-
import type { ComponentFactory } from './types';
|
|
2
|
+
import type { ComponentFactory } from './types.js';
|
|
3
3
|
export declare function executeCraftComponentFactory<Factory extends ComponentFactory>(factory: Factory, args: Parameters<Factory>, injector: CraftInjector | object): ResolveGeneratorResult<ReturnType<Factory>>;
|
|
4
4
|
export declare function executeCraftComponentFactoryAsync<Factory extends ComponentFactory>(factory: Factory, args: Parameters<Factory>, injector: CraftInjector | object): Promise<CraftProgramSettledStep>;
|
|
5
|
-
//# sourceMappingURL=factory-runtime.d.ts.map
|