@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
package/src/lib/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { AnyCraftException, ComponentDepsCarrier, CraftComponentDependencies, CraftServiceProvider, ExtractCraftGenExceptions, ResolveGeneratorResult, Yieldable, YieldableMethod, NamedYieldableValue, CatchTagExhaustiveCodesCheck, CraftRegistrationTarget, CraftNodeDirectiveMount, CRAFT_FIELD_VALIDATION_CASES, CraftFieldValidationCasesCarrier, ReactiveReadRequest, DEEP_YIELDABLE, YIELDABLE_DEPENDENCY, YieldableReactiveValue } from '@craft-ts/core';
|
|
2
2
|
import { CRAFT_SERVICE_PROVIDER_BRAND } from '@craft-ts/core';
|
|
3
|
-
import type { ɵRAW_REACTIVE_VALUE as RAW_REACTIVE_VALUE, REACTIVE_VALUE_TYPE, YIELDABLE_VALUE } from '@craft-ts/core';
|
|
4
|
-
import type { HostProps } from './hyperscript';
|
|
5
|
-
import type { StaticLocatorCriteria } from './locator';
|
|
6
|
-
import type { CraftNodeChildren, CraftNodeChildrenDependencies, CraftNodeChildrenCssVars, CraftNodeChildrenPendingSources, CraftNodeChildrenHeadingNeed, CraftNodeChildrenSettledExceptions, CraftNodeChildrenExceptions, CraftNodeChildrenRawFieldExceptions, CraftNodeChildrenHandledExceptionCodes, CraftNodeDepsCarrier, ComponentNode, ContentDependenciesFromProps, ElementNodeBase } from './render/vnode';
|
|
7
|
-
import type { CssVarContract, CssVarsAfterCall, CssVarsCallProps, CssVarsContractOfMeta, CssVarsMetaDeclaration, MergeCssVarContracts } from './css-vars.type';
|
|
8
|
-
import type {
|
|
3
|
+
import type { CraftChannels, EmptyChannels, ɵRAW_REACTIVE_VALUE as RAW_REACTIVE_VALUE, REACTIVE_VALUE_TYPE, YIELDABLE_VALUE } from '@craft-ts/core';
|
|
4
|
+
import type { HostProps } from './hyperscript.js';
|
|
5
|
+
import type { StaticLocatorCriteria } from './locator.js';
|
|
6
|
+
import type { CraftNodeChildren, CraftNodeChildrenDependencies, CraftNodeChildrenCssVars, CraftNodeChildrenPendingSources, CraftNodeChildrenHeadingNeed, CraftNodeChildrenSettledExceptions, CraftNodeChildrenExceptions, CraftNodeChildrenRawFieldExceptions, CraftNodeChildrenHandledExceptionCodes, CraftNodeDepsCarrier, ComponentNode, ComponentTemplateChannels, ContentDependenciesFromProps, ElementNodeBase } from './render/vnode.js';
|
|
7
|
+
import type { CssVarContract, CssVarsAfterCall, CssVarsCallProps, CssVarsContractOfMeta, CssVarsMetaDeclaration, MergeCssVarContracts } from './css-vars.type.js';
|
|
8
|
+
import type { FieldErrorDirective, FieldErrorExhaustiveCheck, FieldErrorPartialCheck, FieldErrorOptions, FieldExceptionHandlerFieldExceptions, FieldExceptionHandlerChildren, FieldExceptionHandlers, ResidualFieldValidationCases, ResidualFieldValidationCasesByIdentity, FieldValidationHandledIdentitiesOf, UnhandledFieldValidationCases } from './field-error-node.js';
|
|
9
9
|
export type CraftProvider = unknown;
|
|
10
10
|
type HostReader<T> = () => T;
|
|
11
11
|
type HostSignal<T> = HostReader<T> & Omit<YieldableReactiveValue<T, string>, typeof RAW_REACTIVE_VALUE | typeof REACTIVE_VALUE_TYPE | typeof YIELDABLE_VALUE>;
|
|
@@ -150,8 +150,8 @@ export type ComponentTemplateNameOf<Template> = Template extends {
|
|
|
150
150
|
readonly [COMPONENT_TEMPLATE_NAME]?: infer Name extends string;
|
|
151
151
|
} ? Name : string;
|
|
152
152
|
export type TemplateDependencies<Template> = Template extends (...args: any[]) => infer Output ? CraftNodeChildrenDependencies<Output> : {};
|
|
153
|
-
export type TemplateCssVars<Template> = Template extends (...args: any[]) => infer Output ? CraftNodeChildrenCssVars<Output> : import('./css-vars.type').EmptyCssVarContract;
|
|
154
|
-
/** Async sources a template renders without covering them with a `
|
|
153
|
+
export type TemplateCssVars<Template> = Template extends (...args: any[]) => infer Output ? CraftNodeChildrenCssVars<Output> : import('./css-vars.type.js').EmptyCssVarContract;
|
|
154
|
+
/** Async sources a template renders without covering them with a `pendingNode`. */
|
|
155
155
|
export type TemplatePendingSources<Template> = Template extends (...args: any[]) => infer Output ? CraftNodeChildrenPendingSources<Output> : never;
|
|
156
156
|
/**
|
|
157
157
|
* Heading outline a template still exposes. Local `heading()` is `'heading'`.
|
|
@@ -160,7 +160,7 @@ export type TemplatePendingSources<Template> = Template extends (...args: any[])
|
|
|
160
160
|
export type TemplateHeadingNeed<Template> = Template extends (...args: any[]) => infer Output ? CraftNodeChildrenHeadingNeed<Output> : never;
|
|
161
161
|
/**
|
|
162
162
|
* Exception codes a template can reach through a settled read without covering
|
|
163
|
-
* them with a `
|
|
163
|
+
* them with a `catchNode`.
|
|
164
164
|
*/
|
|
165
165
|
export type TemplateSettledExceptions<Template> = Template extends (...args: any[]) => infer Output ? CraftNodeChildrenSettledExceptions<Output> : never;
|
|
166
166
|
export type HostRequiredLogic<Context extends object> = (...args: any[]) => Context;
|
|
@@ -202,6 +202,19 @@ export interface ComponentMeta<Providers extends readonly ComponentProvider[] =
|
|
|
202
202
|
readonly cssVars?: CssVarsMetaDeclaration;
|
|
203
203
|
/** Styles exposed explicitly to opted-in projected fragments, by slot. */
|
|
204
204
|
readonly contentStyles?: ContentStyles<SlotName>;
|
|
205
|
+
/**
|
|
206
|
+
* Closes the tree for context requirements: from here up, nobody will answer.
|
|
207
|
+
*
|
|
208
|
+
* Until a component seals, an unmet requirement travels — an ancestor still
|
|
209
|
+
* has the right to satisfy it, and complaining early would be wrong. Sealing
|
|
210
|
+
* is what turns "still open" into an error, and it belongs on the component
|
|
211
|
+
* that owns the region, which is the only one that knows nothing above it
|
|
212
|
+
* will help.
|
|
213
|
+
*
|
|
214
|
+
* The value is opaque here on purpose: what a requirement *means* is written
|
|
215
|
+
* in the vocabulary that produced it, never in the component layer.
|
|
216
|
+
*/
|
|
217
|
+
readonly seals?: readonly unknown[];
|
|
205
218
|
}
|
|
206
219
|
export interface DirectiveMeta {
|
|
207
220
|
readonly styles?: string | readonly string[];
|
|
@@ -247,16 +260,16 @@ export type ComponentCompositionDefinition = {
|
|
|
247
260
|
readonly providers?: readonly CraftServiceProvider[];
|
|
248
261
|
readonly catchHandlers?: Readonly<Record<string, ComponentExceptionHandlerEntry>>;
|
|
249
262
|
readonly catchTagHandlers?: Readonly<Record<string, ComponentExceptionGenerator>>;
|
|
250
|
-
readonly
|
|
263
|
+
readonly catchNodePosition?: 'before' | 'after';
|
|
251
264
|
readonly fieldExceptionHandlers?: FieldExceptionHandlers;
|
|
252
|
-
readonly fieldExceptionOptions?: Required<Pick<
|
|
265
|
+
readonly fieldExceptionOptions?: Required<Pick<FieldErrorOptions, 'mode' | 'position'>> & Pick<FieldErrorOptions, 'visibility'>;
|
|
253
266
|
};
|
|
254
267
|
export type ComponentOperatorDefinition = ComponentCompositionDefinition;
|
|
255
268
|
/** Internal marker carried by operators that alter component composition. */
|
|
256
269
|
export declare const COMPONENT_OPERATOR: unique symbol;
|
|
257
|
-
export declare const
|
|
258
|
-
export declare const
|
|
259
|
-
export declare const
|
|
270
|
+
export declare const COMPONENT_CATCH_NODE: unique symbol;
|
|
271
|
+
export declare const COMPONENT_FIELD_ERROR_NODE: unique symbol;
|
|
272
|
+
export declare const FIELD_ERROR_NODE_DIRECTIVE: unique symbol;
|
|
260
273
|
export type ComponentOperator<Providers extends readonly CraftServiceProvider[] = readonly CraftServiceProvider[], Codes extends string = never> = CraftDirective & {
|
|
261
274
|
readonly [COMPONENT_OPERATOR_PROVIDERS]: Providers;
|
|
262
275
|
readonly [COMPONENT_OPERATOR_CODES]: Codes;
|
|
@@ -267,9 +280,9 @@ export type ComponentOperator<Providers extends readonly CraftServiceProvider[]
|
|
|
267
280
|
readonly kind: 'catchTag';
|
|
268
281
|
readonly catchTagHandlers: Record<Codes, ComponentExceptionGenerator>;
|
|
269
282
|
} | {
|
|
270
|
-
readonly kind: '
|
|
283
|
+
readonly kind: 'catchNode';
|
|
271
284
|
readonly catchHandlers: Record<Codes, ComponentExceptionHandlerEntry>;
|
|
272
|
-
readonly
|
|
285
|
+
readonly catchNodePosition?: 'before' | 'after';
|
|
273
286
|
});
|
|
274
287
|
};
|
|
275
288
|
type PublicComponentProps<Props extends object> = {
|
|
@@ -314,11 +327,11 @@ type ComponentOperatorFallbackExceptionCodes<Operator> = Operator extends {
|
|
|
314
327
|
type ComponentExceptionsBeforeOperator<Factory extends ComponentFactory, Meta extends ComponentMeta, Operator, ExistingExceptions extends string> = ExistingExceptions | ComponentInitializationExceptionCodes<Factory, ProvidersFromMeta<Meta>> | ComponentOperatorExceptionCodes<Operator>;
|
|
315
328
|
type ComponentExceptionsAfterOperator<Factory extends ComponentFactory, Meta extends ComponentMeta, Operator, ExistingExceptions extends string = never> = [ComponentOperatorHandlers<Operator>] extends [never] ? ComponentExceptionsBeforeOperator<Factory, Meta, Operator, ExistingExceptions> : Exclude<ComponentExceptionsBeforeOperator<Factory, Meta, Operator, ExistingExceptions>, ComponentOperatorHandlers<Operator>> | ComponentOperatorFallbackExceptionCodes<Operator>;
|
|
316
329
|
type ComponentOperatorExhaustiveCheck<Factory extends ComponentFactory, Meta extends ComponentMeta, Operator, ExistingExceptions extends string, HandledByTemplate extends string = never> = [ComponentOperatorHandlers<Operator>] extends [never] ? unknown : CatchTagExhaustiveCodesCheck<ComponentExceptionsBeforeOperator<Factory, Meta, Operator, ExistingExceptions>, Record<Extract<ComponentOperatorHandlers<Operator>, string>, unknown>> & (Operator extends {
|
|
317
|
-
readonly [
|
|
330
|
+
readonly [COMPONENT_CATCH_NODE]: true;
|
|
318
331
|
} ? [
|
|
319
332
|
Extract<ComponentOperatorHandlers<Operator>, HandledByTemplate>
|
|
320
333
|
] extends [never] ? unknown : {
|
|
321
|
-
'
|
|
334
|
+
'catchNode.exhaustive has handlers for codes already handled by the template': Extract<ComponentOperatorHandlers<Operator>, HandledByTemplate>;
|
|
322
335
|
} : unknown);
|
|
323
336
|
type ComponentTemplateHandledExceptionCodes<Template extends ComponentTemplate<any>> = Extract<CraftNodeChildrenHandledExceptionCodes<ReturnType<Template>>, string>;
|
|
324
337
|
type NextContentSelectorDepth<Depth extends readonly unknown[]> = [
|
|
@@ -338,7 +351,7 @@ type VisitProjectedContent<Node, Depth extends readonly unknown[] = []> = Depth[
|
|
|
338
351
|
readonly whenTrue: () => infer TrueChildren;
|
|
339
352
|
readonly whenFalse?: () => infer FalseChildren;
|
|
340
353
|
} ? VisitProjectedContent<TrueChildren | FalseChildren, NextContentSelectorDepth<Depth>> : Node extends {
|
|
341
|
-
readonly kind: '
|
|
354
|
+
readonly kind: 'for';
|
|
342
355
|
readonly itemTemplate: (...args: any[]) => infer ItemChildren;
|
|
343
356
|
readonly empty?: () => infer EmptyChildren;
|
|
344
357
|
} ? VisitProjectedContent<ItemChildren | EmptyChildren, NextContentSelectorDepth<Depth>> : Node extends {
|
|
@@ -386,12 +399,12 @@ export type ProjectionSlot<Contract> = readonly ProjectionUnit<Contract>[];
|
|
|
386
399
|
export type ProjectionOf<Component> = [
|
|
387
400
|
ProjectionContractOf<Component>
|
|
388
401
|
] extends [never] ? never : ProjectionUnit<ProjectionContractOf<Component>, ProjectionKeyOf<Component>>;
|
|
389
|
-
type ComponentCallNode<CallProps extends object, ComponentDeps extends object, Component extends CraftComponent<any, ComponentDeps>, Factory extends ComponentFactory, InputProps extends object = {}, CssVars extends CssVarContract = import('./css-vars.type').EmptyCssVarContract> = ComponentInputExceptionsOf<Pick<CallProps, keyof InputProps & keyof CallProps>> extends infer InputExceptions extends string ? FactoryContext<Factory> extends {
|
|
402
|
+
type ComponentCallNode<CallProps extends object, ComponentDeps extends object, Component extends CraftComponent<any, ComponentDeps>, Factory extends ComponentFactory, InputProps extends object = {}, CssVars extends CssVarContract = import('./css-vars.type.js').EmptyCssVarContract, Channels extends CraftChannels = EmptyChannels> = ComponentInputExceptionsOf<Pick<CallProps, keyof InputProps & keyof CallProps>> extends infer InputExceptions extends string ? FactoryContext<Factory> extends {
|
|
390
403
|
readonly contract: infer Contract;
|
|
391
404
|
readonly key: infer Key extends PropertyKey;
|
|
392
|
-
} ? ComponentNode<CallProps, ComponentDeps, Component, ContentDependenciesFromProps<CallProps>, InputExceptions, CssVars> & ProjectionUnit<Contract, Key> : ComponentNode<CallProps, ComponentDeps, Component, ContentDependenciesFromProps<CallProps>, InputExceptions, CssVars> : never;
|
|
405
|
+
} ? ComponentNode<CallProps, ComponentDeps, Component, ContentDependenciesFromProps<CallProps>, InputExceptions, CssVars, never, never, Channels> & ProjectionUnit<Contract, Key> : ComponentNode<CallProps, ComponentDeps, Component, ContentDependenciesFromProps<CallProps>, InputExceptions, CssVars, never, never, Channels> : never;
|
|
393
406
|
type AppliedDirectiveFactory<Factory extends ComponentFactory, Directive extends CraftDirective> = Directive extends {
|
|
394
|
-
readonly [
|
|
407
|
+
readonly [COMPONENT_FIELD_ERROR_NODE]: true;
|
|
395
408
|
} ? Factory : Directive extends ComponentOperator<any, any> ? Factory : Directive extends CraftDirective<infer Logic, any> ? ReturnType<Logic> extends ComponentFactory ? ReturnType<Logic> : Factory : Factory;
|
|
396
409
|
type MissingProviderMap<Dependencies> = Dependencies extends {
|
|
397
410
|
missingProvider: infer Missing extends object;
|
|
@@ -399,16 +412,16 @@ type MissingProviderMap<Dependencies> = Dependencies extends {
|
|
|
399
412
|
type MergePipedComponentDependencies<Existing extends object, Recomputed extends object> = Simplify<Omit<Recomputed, 'missingProvider'> & {
|
|
400
413
|
missingProvider: Simplify<MissingProviderMap<Existing> & MissingProviderMap<Recomputed>>;
|
|
401
414
|
}>;
|
|
402
|
-
type ComponentFieldExceptionsAfterOperator<ExistingFieldExceptions, Directive> = Directive extends
|
|
403
|
-
type ComponentFieldExceptionOperatorCheck<ExistingFieldExceptions, Directive> = Directive extends
|
|
404
|
-
type ComponentFieldExceptionFallbackExceptionCodes<Directive> = Directive extends
|
|
415
|
+
type ComponentFieldExceptionsAfterOperator<ExistingFieldExceptions, Directive> = Directive extends FieldErrorDirective<infer Handlers extends FieldExceptionHandlers, boolean> ? ResidualFieldValidationCases<ExistingFieldExceptions, Handlers> | FieldExceptionHandlerFieldExceptions<Handlers> : ExistingFieldExceptions;
|
|
416
|
+
type ComponentFieldExceptionOperatorCheck<ExistingFieldExceptions, Directive> = Directive extends FieldErrorDirective<infer Handlers extends FieldExceptionHandlers, infer Exhaustive extends boolean> ? Exhaustive extends true ? FieldErrorExhaustiveCheck<ExistingFieldExceptions, Handlers> : FieldErrorPartialCheck<ExistingFieldExceptions, Handlers> : unknown;
|
|
417
|
+
type ComponentFieldExceptionFallbackExceptionCodes<Directive> = Directive extends FieldErrorDirective<infer Handlers extends FieldExceptionHandlers, boolean> ? CraftNodeChildrenExceptions<FieldExceptionHandlerChildren<Handlers[keyof Handlers]>> : never;
|
|
405
418
|
type PipedComponent<Factory extends ComponentFactory, Meta extends ComponentMeta, Directive extends CraftDirective, RootFactory extends ComponentFactory, ExistingComponentDeps extends object, ExistingExceptions extends string, ExistingFieldExceptions, TemplateDependencies extends object, Template extends ComponentTemplate<FactoryContext<Factory>> = ComponentTemplate<FactoryContext<Factory>>, Name extends string = string> = AppliedDirectiveFactory<Factory, Directive> extends infer NextFactory extends ComponentFactory ? CraftComponent<PropsFromFactory<NextFactory>, MergePipedComponentDependencies<ExistingComponentDeps, CraftComponentDependencies<FactoryYielded<RootFactory> | FactoryYielded<NextFactory>, FactoryContext<NextFactory>, ProvidersFromMeta<Meta> | ComponentOperatorProviders<Directive>, PropsFromFactory<NextFactory>, TemplateDependencies | CraftDirectiveTemplateDependencies<Directive>>>, NextFactory, Meta, RootFactory, TemplateDependencies | CraftDirectiveTemplateDependencies<Directive>, Template & ComponentTemplate<FactoryContext<NextFactory>, ReturnType<Template>>, Name, (ComponentExceptionsAfterOperator<Factory, Meta, Directive, ExistingExceptions> | ComponentFieldExceptionFallbackExceptionCodes<Directive>) & ComponentOperatorExhaustiveCheck<Factory, Meta, Directive, ExistingExceptions>, ContentRequirementsOfFactory<NextFactory>, ComponentFieldExceptionsAfterOperator<ExistingFieldExceptions, Directive>> : never;
|
|
406
419
|
export interface CraftComponent<Props extends object = Record<never, never>, ComponentDeps extends object = Record<never, never>, Factory extends ComponentFactory = ComponentFactory, Meta extends ComponentMeta = ComponentMeta, RootFactory extends ComponentFactory = Factory, TemplateDependencies extends object = never, Template extends ComponentTemplate<FactoryContext<Factory>> = ComponentTemplate<FactoryContext<Factory>>, Name extends string = string, InitializationExceptions extends string = string, ContentRequirements extends object = {}, FieldExceptions = any> extends ComponentDepsCarrier<ComponentDeps>, CraftRegistrationTarget<Name, 'component', FactoryContext<Factory>> {
|
|
407
420
|
<CallProps extends ComponentCallProps<Props, ComponentCssVars<Meta, Template>> = ComponentCallProps<Props, ComponentCssVars<Meta, Template>>>(...args: keyof Props extends never ? [
|
|
408
421
|
props?: CallProps & ContentConditionsCheck<NoInfer<CallProps>, ContentRequirements>
|
|
409
422
|
] : [
|
|
410
423
|
props: CallProps & ContentConditionsCheck<NoInfer<CallProps>, ContentRequirements>
|
|
411
|
-
]): ComponentCallNode<CallProps, ComponentDeps, CraftComponent<Props, ComponentDeps, Factory, Meta, RootFactory, TemplateDependencies, Template, Name, InitializationExceptions, ContentRequirements, FieldExceptions>, Factory, Props, CssVarsAfterCall<ComponentCssVars<Meta, Template>, CallProps>>;
|
|
424
|
+
]): ComponentCallNode<CallProps, ComponentDeps, CraftComponent<Props, ComponentDeps, Factory, Meta, RootFactory, TemplateDependencies, Template, Name, InitializationExceptions, ContentRequirements, FieldExceptions>, Factory, Props, CssVarsAfterCall<ComponentCssVars<Meta, Template>, CallProps>, ComponentTemplateChannels<Template>>;
|
|
412
425
|
readonly [CRAFT_COMPONENT]: ComponentDefinition<unknown> & {
|
|
413
426
|
readonly name: Name;
|
|
414
427
|
readonly factory: Factory;
|
|
@@ -422,7 +435,7 @@ export interface CraftComponent<Props extends object = Record<never, never>, Com
|
|
|
422
435
|
(...directives: readonly [CraftDirective, CraftDirective]): CraftComponent<any, any>;
|
|
423
436
|
};
|
|
424
437
|
}
|
|
425
|
-
export type ComponentCssVarsOf<Component> = Component extends CraftComponent<any, any, any, infer Meta, any, any, infer Template, any, any, any, any> ? ComponentCssVars<Meta, Template> : import('./css-vars.type').EmptyCssVarContract;
|
|
438
|
+
export type ComponentCssVarsOf<Component> = Component extends CraftComponent<any, any, any, infer Meta, any, any, infer Template, any, any, any, any> ? ComponentCssVars<Meta, Template> : import('./css-vars.type.js').EmptyCssVarContract;
|
|
426
439
|
export type ComponentNameOf<Component> = Component extends CraftComponent<any, any, any, any, any, any, any, infer Name, any, any, any> ? Name : string;
|
|
427
440
|
export type ComponentInitializationExceptionsOf<Component> = Component extends {
|
|
428
441
|
readonly [COMPONENT_INITIALIZATION_EXCEPTIONS]: infer Exceptions extends string;
|
|
@@ -439,4 +452,3 @@ export type ComponentTemplateOf<Component> = Component extends CraftComponent<an
|
|
|
439
452
|
export type PropsOf<Component> = Component extends CraftComponent<infer Props, any> ? Props : never;
|
|
440
453
|
export declare function isCraftComponent(value: unknown): value is CraftComponent<object>;
|
|
441
454
|
export {};
|
|
442
|
-
//# sourceMappingURL=types.d.ts.map
|
package/src/lib/types.js
CHANGED
|
@@ -13,10 +13,9 @@ export function isCraftDirective(value) {
|
|
|
13
13
|
export const CRAFT_COMPONENT = Symbol('craft-component');
|
|
14
14
|
/** Internal marker carried by operators that alter component composition. */
|
|
15
15
|
export const COMPONENT_OPERATOR = Symbol('craft-component-operator');
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
16
|
+
export const COMPONENT_CATCH_NODE = Symbol('craft-component-catch-node');
|
|
17
|
+
export const COMPONENT_FIELD_ERROR_NODE = Symbol('craft-component-field-error-node');
|
|
18
|
+
export const FIELD_ERROR_NODE_DIRECTIVE = Symbol('craft-field-error-node-directive');
|
|
19
19
|
export function isCraftComponent(value) {
|
|
20
20
|
return typeof value === 'function' && CRAFT_COMPONENT in value;
|
|
21
21
|
}
|
|
22
|
-
//# sourceMappingURL=types.js.map
|
package/testing/public-api.d.ts
CHANGED
package/testing/public-api.js
CHANGED
package/src/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../libs/component/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnE,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAIjE,OAAO,sBAAsB,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,g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,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,2BAA2B,EAC3B,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,iCAAiC,EACjC,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,uBAAuB,GACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/component/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAoB,MAAM,iBAAiB,CAAC;AACnE,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,yEAAyE;AACzE,yEAAyE;AACzE,sEAAsE;AACtE,OAAO,sBAAsB,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAO/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAW9B,cAAc,yBAAyB,CAAC;AAkExC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export * from './lib/ai/ai-context-menu';\nexport * from './lib/ai/ai-send-dialog';\nexport * from './lib/ai/send-context-to-ai';\nexport * from './lib/assert-defined-input';\nexport * from './lib/bridge';\nexport { bootstrapCraft, type CraftAppRef } from './lib/bootstrap';\nexport * from './lib/server-render';\nexport * from './lib/hydrate';\nexport * from './lib/start';\nexport * from './lib/render/hydration';\nexport { createStringDomAdapter } from './lib/render/string-dom';\n// Registers Craft's default pending loader and lazy-route recovery host.\n// Side-effect only: nothing needs to name them, the router resolves them\n// through CRAFT_PENDING_COMPONENT / CRAFT_ROUTE_LOAD_ERROR_COMPONENT.\nimport './lib/craft-defaults';\nexport * from './lib/component';\nexport * from './lib/css-vars';\nexport type {\n CssVarContract,\n CssVarsOf,\n CssVarsContractOfMeta,\n CssVarsAfterCall,\n} from './lib/css-vars.type';\nexport * from './lib/composition';\nexport * from './lib/block';\nexport * from './lib/pending-block';\nexport * from './lib/field-exception-block';\nexport * from './lib/match-block';\nexport * from './lib/directive';\nexport * from './lib/craft-router-outlet';\nexport * from './lib/defer';\nexport * from './lib/each';\nexport * from './lib/each-scheduling';\nexport * from './lib/if-block';\nexport * from './lib/project';\nexport * from './lib/template';\nexport * from './lib/hyperscript';\nexport * from './lib/a11y';\nexport * from './lib/a11y-control';\nexport * from './lib/render/style-registry';\nexport * from './lib/testing';\nexport type {\n CraftLocatorResult,\n CraftTemplateLocatorApi,\n LocatorCriteria,\n LocatorCriteriaFor,\n LocatorContentNamesFor,\n MaybeDefined,\n StaticLocatorCriteria,\n TemplateLocatorCandidates,\n} from './lib/locator';\nexport * from './lib/template-contract';\nexport type {\n ComponentFactory,\n ComponentTemplate,\n CraftDirective,\n CraftComponent,\n HostRequiredLogic,\n HostTemplate,\n Input,\n InputValue,\n LogicDecorator,\n Output,\n PropsOf,\n TemplateDecorator,\n ComponentMeta,\n DirectiveMeta,\n CraftDirectiveTemplateDependencies,\n ComponentTemplateOf,\n ComponentTemplateNameOf,\n ComponentLogicOutputOf,\n YieldableTemplateCallback,\n YieldableTemplateContext,\n TemplateMethodUse,\n TemplateCssVars,\n ComponentCssVars,\n ComponentCssVarsOf,\n ComponentNameOf,\n ComponentInitializationExceptionsOf,\n ComponentFieldExceptionsOf,\n ComponentInitializationExceptionCodes,\n ContentOptions,\n ContentSlot,\n ContentRequirement,\n ContentRequirementOf,\n ContentRequirementsOfContext,\n ContentSelector,\n ContentSelectorCondition,\n ContentStyles,\n ContentStylePolicy,\n RequiredContent,\n RenderableContent,\n ProjectionContractOf,\n ProjectionOf,\n ProjectionSlot,\n ProjectionUnit,\n CraftTemplate,\n ContentDependencies,\n PropsFromFactory,\n CraftInputExceptionsCarrier,\n ComponentInputExceptionsOf,\n} from './lib/types';\nexport type {\n TemplateRenderAvailableActionWhen,\n TemplateRendersNamedElementWhen,\n TemplateRendersStateWhen,\n} from './lib/template-contract';\nexport type {\n CraftNode,\n CraftNodeChild,\n CraftNodeChildren,\n IfBlockNode,\n CatchBlockNode,\n MatchBlockNode,\n TemplateNode,\n CraftNodeCssVarsCarrier,\n} from './lib/render/vnode';\nexport { CRAFT_NODE_CSS_VARS } from './lib/render/vnode';\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"a11y-control.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/a11y-control.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,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;gBACpE,CAAC,CAAC,EAAE,CAAC;SACR;QACD,KAAK,EAAE;YACL,EAAE,EAAE,OAAO;YACX,GAAG,SAAS;YACZ,GAAG,CAAC,MAAM;gBACR,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,aAAa,EAAE,IAAa,EAAE,MAAM,EAAE,IAAa,EAAE,CAAC;SAC7D;KACF,CAAC;AACJ,CAAC;AASD,MAAM,UAAU,aAAa,CAAC,OAI7B;IACC,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,QAAQ,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,EAAE,CAAC;IAClB,CAAC;IACD,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,OAAO;YACL,IAAI;YACJ,eAAe,EAAE,IAAI;YACrB,eAAe,EAAE,IAAI;SACtB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,IAAI;KACtB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,QAAgB,EAChB,OAA+B;IAE/B,OAAO,CAAC,KAAQ,EAAE,EAAE;QAClB,MAAM,IAAI,GAAI,KAAK,CAAC,aAAgC,EAAE,aAAa,IAAI,QAAQ,CAAC;QAChF,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAc,QAAQ,CAAC,CAAC;QACzD,MAAM,EAAE,KAAK,EAAE,CAAC;QAChB,OAAO,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["export type FieldIds = {\n readonly inputId: string;\n readonly descriptionId: string;\n};\n\nexport function fieldIds(id: string): FieldIds {\n return {\n inputId: id,\n descriptionId: `${id}-description`,\n };\n}\n\nexport type FieldControl = {\n readonly ids: FieldIds;\n readonly input: {\n readonly id: string;\n readonly 'aria-describedby': string;\n readonly 'aria-invalid'?: true;\n readonly 'data-invalid'?: true;\n };\n readonly label: { readonly htmlFor: string };\n readonly description: { readonly id: string };\n};\n\nexport function fieldControl(\n id: string,\n options?: { readonly invalid?: boolean },\n): FieldControl {\n const ids = fieldIds(id);\n return {\n ids,\n input: {\n id: ids.inputId,\n 'aria-describedby': ids.descriptionId,\n ...(options?.invalid\n ? { 'aria-invalid': true as const, 'data-invalid': true as const }\n : {}),\n },\n label: { htmlFor: ids.inputId },\n description: { id: ids.descriptionId },\n };\n}\n\nexport type DisclosureControl = {\n readonly buttonId: string;\n readonly panelId: string;\n readonly button: {\n readonly type: 'button';\n readonly id: string;\n readonly 'aria-expanded': boolean;\n readonly 'aria-controls': string;\n readonly 'data-open'?: true;\n readonly 'aria-disabled'?: true;\n readonly 'data-disabled'?: true;\n };\n readonly panel: {\n readonly id: string;\n readonly 'data-open'?: true;\n readonly 'aria-hidden'?: true;\n readonly hidden?: true;\n };\n};\n\nexport function disclosureControl(\n id: string,\n isOpen: boolean,\n options?: { readonly disabled?: boolean },\n): DisclosureControl {\n const buttonId = `${id}-button`;\n const panelId = `${id}-panel`;\n const openAttrs = isOpen ? ({ 'data-open': true as const } as const) : {};\n return {\n buttonId,\n panelId,\n button: {\n type: 'button',\n id: buttonId,\n 'aria-expanded': isOpen,\n 'aria-controls': panelId,\n ...openAttrs,\n ...(options?.disabled\n ? { 'aria-disabled': true as const, 'data-disabled': true as const }\n : {}),\n },\n panel: {\n id: panelId,\n ...openAttrs,\n ...(isOpen\n ? {}\n : { 'aria-hidden': true as const, hidden: true as const }),\n },\n };\n}\n\nexport type ButtonControl = {\n readonly type: 'button' | 'submit' | 'reset';\n readonly disabled?: true;\n readonly 'aria-disabled'?: true;\n readonly 'data-disabled'?: true;\n};\n\nexport function buttonControl(options?: {\n readonly type?: 'button' | 'submit' | 'reset';\n readonly disabled?: boolean;\n readonly keepFocusable?: boolean;\n}): ButtonControl {\n const type = options?.type ?? 'button';\n if (!options?.disabled) {\n return { type };\n }\n if (options.keepFocusable) {\n return {\n type,\n 'aria-disabled': true,\n 'data-disabled': true,\n };\n }\n return {\n type,\n disabled: true,\n 'data-disabled': true,\n };\n}\n\nexport function clickFocus<E extends MouseEvent>(\n selector: string,\n handler?: (event: E) => unknown,\n): (event: E) => unknown {\n return (event: E) => {\n const root = (event.currentTarget as Element | null)?.ownerDocument ?? document;\n const target = root.querySelector<HTMLElement>(selector);\n target?.focus();\n return handler?.(event);\n };\n}\n"]}
|
package/src/lib/a11y.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/a11y.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,6BAA6B,EAClC,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAExB,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CACvC,CAAC;AAaF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,KAAK,CAAC,QAAQ,SAAS,iBAAiB,EAC9D,QAAQ,CAAC,EAAE,QAAQ,GAClB,WAAW,CAAC,6BAA6B,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;AAC3F,wBAAgB,OAAO,CAAC,KAAK,CAAC,QAAQ,SAAS,iBAAiB,EA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,QAAQ,GAClB,WAAW,CACZ,6BAA6B,CAAC,QAAQ,CAAC,EACvC,MAAM,EACN,MAAM,EACN,QAAQ,CACT,CAAC"}
|
package/src/lib/a11y.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"a11y.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/a11y.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EACL,aAAa,GAMd,MAAM,gBAAgB,CAAC;AASxB,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,IAAK,KAAgB;YAC1B,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC,CAC1D,CAAC;AACJ,CAAC;AAoCD,MAAM,UAAU,OAAO,CACrB,eAAyD,EACzD,aAAiC;IAEjC,MAAM,KAAK,GAAG,iBAAiB,CAAC,eAAe,CAAC;QAC9C,CAAC,CAAC,EAAE;QACJ,CAAC,CAAE,CAAC,eAAe,IAAI,EAAE,CAAkB,CAAC;IAC9C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,eAAe,CAAC;QACjD,CAAC,CAAE,eAAqC;QACxC,CAAC,CAAC,aAAa,CAAC;IAClB,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,SAAkB;QACxB,KAAK;QACL,QAAQ,EAAE,QAAQ,IAAI,EAAE;KACzB,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;QAClC,KAAK,EAAE,CAAC,SAAkB,EAAE,EAAE,CAC5B,aAAa,CAAC,IAAa,EAAE,SAAkB,CAAC;QAClD,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,OAAO,IAAsD,CAAC;AACh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IAAI,EAAE,UAAU,KAAK,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;KAC/D,EACD,QAAQ,CACT,CAAC;AACJ,CAAC","sourcesContent":["import type { Yieldable } from '@craft-ts/core';\nimport { a, span } from './hyperscript';\nimport {\n pipeCraftNode,\n type CraftNodeChildren,\n type CraftNodeChildrenDependencies,\n type ElementNode,\n type HeadingNode,\n type HeadingSectionNode,\n} from './render/vnode';\n\ntype HeadingProps = {\n readonly class?: unknown;\n readonly style?: unknown;\n readonly id?: string | (() => string) | Yieldable<[], string, unknown>;\n readonly [attribute: 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 as object) &&\n typeof (value as { kind?: unknown }).kind === 'string')\n );\n}\n\n/**\n * Renders a heading whose rank comes from the current outline (`h1`–`h6`).\n * The title does not pick `h2` vs `h3` — the parent outline does.\n *\n * A local `heading()` is allowed in this template (route page title = `h1`).\n * A child component that renders `heading()` must be wrapped by **this**\n * parent in {@link headingSection} (same DNA as `pendingBlock`). Otherwise\n * the call does not compile:\n * `ERROR_child_heading_rendered_outside_a_headingSection`.\n *\n * Prefer this over `h1()`…`h6()` inside a `craftComponent`.\n *\n * @example\n * heading('Liste des tâches');\n * headingSection([\n * heading('Détail'),\n * TaskCard(), // child's heading() becomes hN+1\n * ]);\n *\n * @see headingSection\n * @see headingRoot\n */\nexport function heading<const Children extends CraftNodeChildren>(\n children?: Children,\n): HeadingNode<CraftNodeChildrenDependencies<Children>, Children, HeadingProps, 'heading'>;\nexport function heading<const Children extends CraftNodeChildren>(\n props: HeadingProps | null,\n children?: Children,\n): HeadingNode<\n CraftNodeChildrenDependencies<Children>,\n Children,\n HeadingProps,\n 'heading'\n>;\nexport function heading(\n propsOrChildren?: HeadingProps | CraftNodeChildren | null,\n maybeChildren?: CraftNodeChildren,\n): HeadingNode<any, any, HeadingProps, 'heading'> {\n const props = looksLikeChildren(propsOrChildren)\n ? {}\n : ((propsOrChildren ?? {}) as HeadingProps);\n const children = looksLikeChildren(propsOrChildren)\n ? (propsOrChildren as CraftNodeChildren)\n : maybeChildren;\n const node = {\n kind: 'heading' as const,\n props,\n children: children ?? [],\n };\n Object.defineProperty(node, 'pipe', {\n value: (directive: unknown) =>\n pipeCraftNode(node as never, directive as never),\n enumerable: false,\n });\n return node as HeadingNode<any, any, HeadingProps, 'heading'>;\n}\n\n/**\n * Increments the heading outline by one rank for the subtree.\n *\n * Not a visual box and not a `<section>`: comment-bounded fragment, no extra\n * DOM node (same as `ifBlock`). Nested {@link heading} calls become\n * `hN+1`. Also absorbs a child's heading need so the parent compiles.\n *\n * Nest to build the document outline: page `heading()` → `h1`, first\n * `headingSection` → `h2`, nested `headingSection` → `h3`, clamped at `h6`.\n *\n * @example\n * heading('Page');\n * headingSection([\n * heading('Section'),\n * headingSection([heading('Subsection')]),\n * ]);\n *\n * @see heading\n * @see headingRoot\n */\nexport function headingSection<const Children extends CraftNodeChildren>(\n children?: Children,\n): HeadingSectionNode<CraftNodeChildrenDependencies<Children>, Children> {\n return {\n kind: 'heading-section',\n children: (children ?? []) as Children,\n };\n}\n\n/**\n * Starts the heading outline at level 1 for the subtree. Absorbs children's\n * heading need. Use for a route page, or a nested root (a `<dialog>` already\n * resets via the native element — its title is `h1` **inside** the dialog).\n *\n * Unlike {@link headingSection}, this does not increment: every {@link heading}\n * below is `h1` again.\n *\n * @see heading\n * @see headingSection\n */\nexport function headingRoot<const Children extends CraftNodeChildren>(\n children?: Children,\n): HeadingSectionNode<CraftNodeChildrenDependencies<Children>, Children> {\n return {\n kind: 'heading-section',\n reset: true,\n children: (children ?? []) as Children,\n };\n}\n\n/**\n * Skip link for the application shell. Pair with `main({ id: targetId }, …)`.\n */\nexport function skipLink(\n targetId = 'main',\n label = 'Skip to main content',\n) {\n return a({ href: `#${targetId}`, class: 'skip-link' }, label);\n}\n\n/**\n * Announces dynamic text to assistive technology (toasts, \"Copied\").\n */\ntype LiveRegionProps = {\n readonly politeness?: 'polite' | 'assertive';\n readonly label?: string;\n};\n\nexport function liveRegion<const Children extends CraftNodeChildren>(\n children?: Children,\n): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n 'span',\n { readonly 'aria-live': 'polite'; readonly 'aria-atomic': 'true'; readonly role: 'status' },\n Children\n>;\nexport function liveRegion<const Children extends CraftNodeChildren>(\n props: LiveRegionProps | null,\n children?: Children,\n): ElementNode<\n CraftNodeChildrenDependencies<Children>,\n 'span',\n object,\n Children\n>;\nexport function liveRegion(\n propsOrChildren?:\n | LiveRegionProps\n | CraftNodeChildren\n | null,\n maybeChildren?: CraftNodeChildren,\n): unknown {\n const props = looksLikeChildren(propsOrChildren)\n ? { politeness: 'polite' as const }\n : ((propsOrChildren ?? {}) as LiveRegionProps);\n const children = looksLikeChildren(propsOrChildren)\n ? (propsOrChildren as CraftNodeChildren)\n : maybeChildren;\n const politeness = props.politeness ?? 'polite';\n const label = props.label;\n return span(\n {\n 'aria-live': politeness,\n 'aria-atomic': 'true',\n ...(label !== undefined\n ? { role: 'region' as const, 'aria-label': label }\n : { role: politeness === 'assertive' ? 'alert' : 'status' }),\n },\n children,\n );\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-context-menu.d.ts","sourceRoot":"","sources":["../../../../../../libs/component/src/lib/ai/ai-context-menu.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,aAAa;;;oBAwCC,IAAI;qBACH,IAAI;;;;;;;;wBADL,IAAI;yBACH,IAAI;;;OAHzB,KAAK,CAAC,MAAM,CAAC,KACb,KAAK,CAAC,MAAM,CAAC,YACN,MAAM,CAAC,MAAM,IAAI,CAAC,aACjB,MAAM,CAAC,MAAM,IAAI,CAAC;;;2BADN,IAAI;4BACH,IAAI;;;OAHzB,KAAK,CAAC,MAAM,CAAC,KACb,KAAK,CAAC,MAAM,CAAC,YACN,MAAM,CAAC,MAAM,IAAI,CAAC,aACjB,MAAM,CAAC,MAAM,IAAI,CAAC;;;2BADN,IAAI;4BACH,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;4BA0BT,UAAU;kCACJ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BADhB,UAAU;kCACJ,UAAU;;;;;;;;;;;;;;;;;;;;;;;;oDAatC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-context-menu.js","sourceRoot":"","sources":["../../../../../../libs/component/src/lib/ai/ai-context-menu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,cAAc,CACzC,eAAe,EACf;IACE,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgCP;CACF,EACD,CACE,CAAgB,EAChB,CAAgB,EAChB,QAA4B,EAC5B,SAA6B,EAC7B,EAAE;IACF,oEAAoE;IACpE,gCAAgC;IAChC,kBAAkB,CAAa,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,GAAG,EAAE,CAC/D,SAAS,EAAE,CACZ,CAAC;IACF,kBAAkB,CAAgB,QAAQ,EAAE,SAAS,CAAC,CAAC,SAAS,CAC9D,CAAC,KAAK,EAAE,EAAE;QACR,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC3B,SAAS,EAAE,CAAC;QACd,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC,EACD,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACrB,GAAG,CACD,eAAe,EACf;IACE,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,CAAC,CAAC;IACZ,YAAY,EAAE,mBAAmB;IACjC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IACpD,KAAK,EAAE,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK,CAAC,eAAe,EAAE;IACrD,WAAW,EAAE,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE;CAC3D,EACD,MAAM,CACJ,YAAY,EACZ;IACE,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,oBAAoB;IAC3B,KAAK,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE;CACxB,EACD,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAC3D,CACF,CACJ,CAAC","sourcesContent":["import { fromEventToSource$ } from '@craft-ts/core';\nimport { craftComponent } from '../component';\nimport { button, div, span } from '../hyperscript';\nimport type { Input, Output } from '../types';\n\n/**\n * Context menu shown at the pointer position when a component is\n * right-clicked. Mounted imperatively by the AI overlay controller.\n */\nexport const AiContextMenu = craftComponent(\n 'AiContextMenu',\n {\n styles: `\n .craft-ai-menu {\n position: fixed;\n min-width: 180px;\n background: #ffffff;\n border: 1px solid #d1d5db;\n border-radius: 6px;\n box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);\n padding: 4px;\n pointer-events: auto;\n font-family:\n system-ui,\n -apple-system,\n sans-serif;\n font-size: 13px;\n color: #111827;\n }\n .craft-ai-menu-item {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n padding: 6px 10px;\n background: transparent;\n border: none;\n text-align: left;\n cursor: pointer;\n border-radius: 4px;\n }\n .craft-ai-menu-item:hover {\n background: #f3f4f6;\n }\n `,\n },\n (\n x: Input<number>,\n y: Input<number>,\n onSelect: Output<() => void>,\n onDismiss: Output<() => void>,\n ) => {\n // Clicks inside the menu stop propagating, so anything reaching the\n // document is an outside click.\n fromEventToSource$<MouseEvent>(document, 'click').subscribe(() =>\n onDismiss(),\n );\n fromEventToSource$<KeyboardEvent>(document, 'keydown').subscribe(\n (event) => {\n if (event.key === 'Escape') {\n onDismiss();\n }\n },\n );\n\n return { x, y, onSelect, onDismiss };\n },\n ({ x, y, onSelect }) =>\n div(\n 'aiContextMenu',\n {\n class: 'craft-ai-menu',\n role: 'menu',\n tabIndex: -1,\n 'aria-label': 'Component actions',\n style: () => ({ left: `${x()}px`, top: `${y()}px` }),\n click: (event: MouseEvent) => event.stopPropagation(),\n contextmenu: (event: MouseEvent) => event.preventDefault(),\n },\n button(\n 'aiSendToIa',\n {\n type: 'button',\n role: 'menuitem',\n class: 'craft-ai-menu-item',\n click: () => onSelect(),\n },\n [span({ 'aria-hidden': 'true' }, '✨'), span('Send to IA')],\n ),\n ),\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-send-dialog.d.ts","sourceRoot":"","sources":["../../../../../../libs/component/src/lib/ai/ai-send-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAgBxB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AA6C9C;;;GAGG;AACH,eAAO,MAAM,YAAY;;mBA4H8C,IAAI;;;;;;;uBAAJ,IAAI;;;aAArD,KAAK,CAAC,kBAAkB,CAAC,WAAW,MAAM,CAA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,UAAU,CACR,EAAE,UAAU,EAAE,QAAQ,EAAE,EACxB,GAAG,CACD;QACE,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;KACrD,EACD,+BAA+B,CAChC,CACF;IAED,MAAM,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE;QACnC,MAAM,CACJ,gBAAgB,EAChB;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,iBAAiB;YACxB,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;SACvB,EACD,QAAQ,CACT;QACD,MAAM,CACJ,cAAc,EACd;YACE,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,GAAG,EAAE,CAAC;gBACX,eAAe;gBACf,MAAM,EAAE,IAAI,qBAAqB;aAClC;YACD,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE;YACrC,KAAK,EAAE,IAAI;SACZ,EACD,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAC1C;KACF,CAAC;CACH,CACF,CACF,CACJ,CAAC","sourcesContent":["import {\n CRAFT_TEMPORAL_RUNTIME,\n craftMethod,\n craftUse,\n fromEventToSource$,\n state,\n type CraftTemporalRuntime as CraftTemporalRuntimeApi,\n type TemporalTaskHandle,\n type SendContextPayload,\n} from '@craft-ts/core';\nimport { ɵtoCraftService as toCraftService } from '@craft-ts/core';\nimport { liveRegion } from '../a11y';\nimport { craftComponent } from '../component';\nimport {\n button,\n dialog,\n div,\n footer,\n header,\n label,\n section,\n span,\n strong,\n textarea,\n} from '../hyperscript';\nimport type { Input, Output } from '../types';\n\nconst { CraftTemporalRuntime } = toCraftService({\n name: 'CraftTemporalRuntime',\n providedIn: 'global',\n token: CRAFT_TEMPORAL_RUNTIME,\n}) as unknown as {\n CraftTemporalRuntime: () => Generator<\n never,\n CraftTemporalRuntimeApi,\n unknown\n >;\n};\n\nfunction formatPrompt(\n payload: SendContextPayload & { instruction: string },\n): string {\n const snapshotJson = (() => {\n try {\n return JSON.stringify(payload.snapshot, null, 2);\n } catch {\n return '[unserializable snapshot]';\n }\n })();\n return [\n `# Instruction`,\n payload.instruction,\n ``,\n `# Component clicked`,\n `- hostName: ${payload.hostName}`,\n `- tagList: ${JSON.stringify(payload.tagList)}`,\n `- coords: (${payload.coords.x}, ${payload.coords.y})`,\n ``,\n `# Element outerHTML (truncated)`,\n '```html',\n payload.outerHTML,\n '```',\n ``,\n `# App snapshot (${payload.snapshot.length} reports)`,\n '```json',\n snapshotJson,\n '```',\n ].join('\\n');\n}\n\n/**\n * Modal that collects an instruction and copies the formatted prompt, with the\n * captured component context and app snapshot, to the clipboard.\n */\nexport const AiSendDialog = craftComponent(\n 'AiSendDialog',\n {\n styles: `\n .craft-ai-overlay {\n position: fixed;\n inset: unset;\n border: none;\n background: transparent;\n padding: 24px;\n font-family:\n system-ui,\n -apple-system,\n sans-serif;\n font-size: 13px;\n color: #111827;\n }\n .craft-ai-overlay::backdrop {\n background: rgba(15, 23, 42, 0.5);\n }\n .craft-ai-card {\n background: #ffffff;\n border-radius: 8px;\n box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);\n width: min(560px, 100%);\n max-height: 90vh;\n overflow: auto;\n padding: 16px 20px 20px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n .craft-ai-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 14px;\n }\n .craft-ai-close {\n background: transparent;\n border: none;\n font-size: 20px;\n line-height: 1;\n cursor: pointer;\n color: #6b7280;\n }\n .craft-ai-context {\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n border-radius: 6px;\n padding: 8px 10px;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12px;\n display: grid;\n gap: 4px;\n }\n .craft-ai-context .label {\n color: #6b7280;\n margin-right: 4px;\n }\n .craft-ai-label {\n font-weight: 600;\n }\n .craft-ai-textarea {\n width: 100%;\n box-sizing: border-box;\n font-family: inherit;\n font-size: 13px;\n padding: 8px 10px;\n border: 1px solid #d1d5db;\n border-radius: 6px;\n resize: vertical;\n min-height: 96px;\n }\n .craft-ai-textarea:focus {\n outline: 2px solid #3b82f6;\n outline-offset: -1px;\n }\n .craft-ai-success {\n background: #ecfdf5;\n border: 1px solid #a7f3d0;\n color: #065f46;\n padding: 8px 10px;\n border-radius: 6px;\n }\n .craft-ai-footer {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n }\n .craft-ai-cancel {\n background: #ffffff;\n border: 1px solid #d1d5db;\n padding: 6px 12px;\n border-radius: 6px;\n cursor: pointer;\n }\n .craft-ai-copy {\n display: flex;\n align-items: center;\n gap: 6px;\n background: #2563eb;\n color: #ffffff;\n border: none;\n padding: 6px 14px;\n border-radius: 6px;\n cursor: pointer;\n font-weight: 500;\n transition: background 0.15s;\n }\n @media (prefers-reduced-motion: reduce) {\n .craft-ai-copy {\n transition: none;\n }\n }\n .craft-ai-copy--done {\n background: #059669;\n }\n .craft-ai-copy:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n `,\n },\n function* (payload: Input<SendContextPayload>, onClose: Output<() => void>) {\n const temporalRuntime = yield* CraftTemporalRuntime();\n type InstructionState = (() => string) & {\n setInstruction: (value: string) => Generator<unknown, unknown, unknown>;\n };\n type CopiedState = (() => boolean) & {\n setCopied: (value: boolean) => Generator<unknown, unknown, unknown>;\n };\n\n // This component ships in a published package, so its inferred type goes\n // through declaration emit. Reactive values (craft `state()`, Angular\n // signals) carry `unique symbol`s that the emitter cannot name (TS4023),\n // so the signals stay local and the context exposes plain accessors only.\n const instruction = yield* state('instruction', '', ({ set }) => ({\n setInstruction: (value: string) => set(value),\n })) as unknown as Generator<never, InstructionState, unknown>;\n const copied = yield* state('copied', false, ({ set }) => ({\n setCopied: (value: boolean) => set(value),\n })) as unknown as Generator<never, CopiedState, unknown>;\n\n const setInstruction: (value: string) => void = craftMethod(\n 'setInstruction',\n function* (value: string) {\n yield* instruction.setInstruction(value);\n },\n );\n const setCopied: (value: boolean) => void = craftMethod(\n 'setCopied',\n function* (value: boolean) {\n yield* copied.setCopied(value);\n },\n );\n\n let copiedTimer: TemporalTaskHandle | null = null;\n\n fromEventToSource$<KeyboardEvent>(document, 'keydown').subscribe(\n (event) => {\n if (event.key === 'Escape') {\n onClose();\n }\n },\n );\n\n const copy = () => {\n const text = instruction().trim();\n if (!text) return;\n\n const content = formatPrompt({\n ...craftUse(payload()),\n instruction: text,\n });\n void navigator.clipboard.writeText(content).then(() => {\n setCopied(true);\n copiedTimer?.cancel();\n copiedTimer = temporalRuntime.schedule(\n () => {\n setCopied(false);\n },\n 2500,\n {\n kind: 'ai-copy-feedback',\n owner: 'ai-send-dialog',\n },\n );\n });\n };\n\n return {\n payload,\n onClose,\n instruction: (): string => instruction(),\n writeInstruction: (value: string): void => {\n setInstruction(value);\n },\n copied: (): boolean => copied(),\n copy,\n };\n },\n ({ payload, onClose, instruction, writeInstruction, copied, copy }) =>\n dialog(\n {\n class: 'craft-ai-overlay',\n open: true,\n labelledBy: 'craft-ai-dialog-title',\n onClose: () => onClose(),\n },\n div(\n {\n class: 'craft-ai-card',\n },\n [\n header({ class: 'craft-ai-header' }, [\n strong({ id: 'craft-ai-dialog-title' }, 'Send context to AI'),\n button(\n 'aiDialogClose',\n {\n type: 'button',\n class: 'craft-ai-close',\n 'aria-label': 'Close',\n click: () => onClose(),\n },\n '×',\n ),\n ]),\n\n section({ class: 'craft-ai-context' }, [\n div([\n span({ class: 'label' }, 'Component:'),\n function* () {\n return (yield* payload()).hostName;\n },\n ]),\n div([\n span({ class: 'label' }, 'Coords:'),\n function* () {\n const value = yield* payload();\n return `(${value.coords.x}, ${value.coords.y})`;\n },\n ]),\n div([\n span({ class: 'label' }, 'Snapshot:'),\n function* () {\n return `${(yield* payload()).snapshot.length} report(s)`;\n },\n ]),\n ]),\n\n label(\n { class: 'craft-ai-label', htmlFor: 'craft-ai-instruction' },\n 'Instruction',\n ),\n textarea('aiDialogInstruction', {\n id: 'craft-ai-instruction',\n class: 'craft-ai-textarea',\n rows: 6,\n value: instruction,\n placeholder: 'Describe what you want the AI to do…',\n input: (event: Event) =>\n writeInstruction((event.target as HTMLTextAreaElement).value),\n }),\n\n // Toggled by style rather than `ifBlock`, which needs a *named* craft\n // value and would leak the same internal symbols into the type.\n liveRegion(\n { politeness: 'polite' },\n div(\n {\n class: 'craft-ai-success',\n style: () => (copied() ? null : { display: 'none' }),\n },\n 'Copié dans le presse-papier ✓',\n ),\n ),\n\n footer({ class: 'craft-ai-footer' }, [\n button(\n 'aiDialogCancel',\n {\n type: 'button',\n class: 'craft-ai-cancel',\n click: () => onClose(),\n },\n 'Fermer',\n ),\n button(\n 'aiDialogCopy',\n {\n type: 'button',\n class: () => [\n 'craft-ai-copy',\n copied() && 'craft-ai-copy--done',\n ],\n disabled: () => !instruction().trim(),\n click: copy,\n },\n () => (copied() ? '✓ Copié' : '⧉ Copier'),\n ),\n ]),\n ],\n ),\n ),\n);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-context-to-ai.d.ts","sourceRoot":"","sources":["../../../../../../libs/component/src/lib/ai/send-context-to-ai.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,QAAQ,EAER,KAAK,QAAQ,EAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAUL,qBAAqB,EACrB,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAuCxB,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF,eAAO,MAAM,0BAA0B,qCAEtC,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,EAC5C,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,eAAe,EACf,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,eAAe,EAAE;QACf,QAAQ,CACN,QAAQ,EAAE,MAAM,IAAI,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,UAAU,EAAE,UAAU,CAAC;SACxB,GACA,kBAAkB,CAAC;KACvB,CAAC;IACF,UAAU,EAAE,UAAU,CAAC;CACxB,GAAG,uBAAuB,CAiE1B;AAMD,wBAAgB,sBAAsB,IAAI,QAAQ,EAAE,CA+CnD;AAED,MAAM,MAAM,+BAA+B,GAAG,OAAO,CAAC;IACpD,IAAI,EAAE,EAAE,CAAC;IACT,QAAQ,EAAE,EAAE,CAAC;IACb,eAAe,EAAE;QACf,QAAQ,EAAE,QAAQ,CAAC;QACnB,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;KAC7C,CAAC;CACH,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"send-context-to-ai.js","sourceRoot":"","sources":["../../../../../../libs/component/src/lib/ai/send-context-to-ai.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,MAAM,EACN,QAAQ,EACR,qBAAqB,GAGtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,2BAA2B,EAC3B,kBAAkB,EAClB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,0BAA0B,EAC1B,yBAAyB,EAEzB,iBAAiB,GAKlB,MAAM,gBAAgB,CAAC;AACxB,OAAO,E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AC,CAAC;YAElD,kBAAkB,CAAa,EAAE,EAAE,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;gBACpE,MAAM,OAAO,GAAG,KAAqB,CAAC;gBACtC,IAAI,OAAO,CAAC,YAAY,CAAC;oBAAE,OAAO;gBAClC,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC;gBAE7B,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,KAAK,CAAC,eAAe,EAAE,CAAC;gBAExB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACnC,MAAM,QAAQ,GAAG,cAAc,EAAE,CAAC;oBAClC,MAAM,SAAS,GAAG,CAAC,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;oBACtD,UAAU,CAAC,IAAI,CAAC;wBACd,QAAQ;wBACR,OAAO;wBACP,MAAM,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE;wBAC9C,SAAS;qBACV,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import {\n DestroyRef,\n ElementRef,\n inject,\n Injector,\n runInInjectionContext,\n type Provider,\n type ProviderToken,\n} from '../host-runtime';\nimport {\n APP_SNAPSHOT_REGISTRY,\n craftToken,\n createSendContextToAiBuffer,\n fromEventToSource$,\n HOST_TAG_LIST,\n CRAFT_TEMPORAL_RUNTIME,\n injectHostName,\n provideComponentMonitoring,\n SEND_CONTEXT_TO_AI_BUFFER,\n SendContextToAiBuffer,\n TAKE_APP_SNAPSHOT,\n type CraftToken,\n type GetDeps,\n type SendContextPayload,\n type TemporalTaskHandle,\n} from '@craft-ts/core';\nimport { mountCraftComponent } from '../bridge';\nimport { AiContextMenu } from './ai-context-menu';\nimport { AiSendDialog } from './ai-send-dialog';\n\nconst HANDLED_FLAG = Symbol('craft-ai-contextmenu-handled');\ntype HandledEvent = MouseEvent & { [HANDLED_FLAG]?: true };\n\ntype Overlay = {\n readonly host: HTMLElement;\n readonly mount: { destroy(): void };\n};\n\n/**\n * Creates the full-screen host element the craft overlay is mounted into.\n * These are the styles the components used to carry on their `:host`.\n */\nfunction openOverlay(\n zIndex: number,\n pointerEvents: 'none' | 'auto',\n mount: (host: HTMLElement) => { destroy(): void },\n): Overlay {\n const host = document.createElement('div');\n host.style.position = 'fixed';\n host.style.inset = '0';\n host.style.zIndex = String(zIndex);\n host.style.pointerEvents = pointerEvents;\n document.body.appendChild(host);\n return { host, mount: mount(host) };\n}\n\nfunction closeOverlay(overlay: Overlay | null): null {\n if (overlay) {\n overlay.mount.destroy();\n overlay.host.remove();\n }\n return null;\n}\n\nexport type AiContextMenuController = {\n open(ctx: Omit<SendContextPayload, 'snapshot'>): void;\n};\n\nexport const AI_CONTEXT_MENU_CONTROLLER = craftToken<AiContextMenuController>(\n 'AiContextMenuController',\n);\n\nexport function createAiContextMenuController({\n injector,\n buffer,\n takeSnapshot,\n temporalRuntime,\n destroyRef,\n}: {\n injector: Injector;\n buffer: SendContextToAiBuffer;\n takeSnapshot: () => void;\n temporalRuntime: {\n schedule(\n callback: () => void,\n delay: number,\n options: {\n kind: string;\n owner: string;\n destroyRef: DestroyRef;\n },\n ): TemporalTaskHandle;\n };\n destroyRef: DestroyRef;\n}): AiContextMenuController {\n let menu: Overlay | null = null;\n let dialog: Overlay | null = null;\n let dialogTimer: TemporalTaskHandle | null = null;\n\n function closeMenu(): void {\n menu = closeOverlay(menu);\n }\n\n function closeDialog(): void {\n dialog = closeOverlay(dialog);\n }\n\n function openDialog(payload: SendContextPayload): void {\n dialog = openOverlay(99999, 'auto', (host) =>\n mountCraftComponent(AiSendDialog, host, injector, {\n payload: function* () {\n return payload;\n },\n onClose: closeDialog,\n }),\n );\n }\n\n function onSelect(ctx: Omit<SendContextPayload, 'snapshot'>): void {\n closeMenu();\n // Wait for the snapshot buffer's debounceTime(500ms) to settle.\n dialogTimer = temporalRuntime.schedule(\n () => {\n dialogTimer = null;\n openDialog({ ...ctx, snapshot: buffer.latestReports });\n },\n 550,\n {\n kind: 'ai-context-debounce',\n owner: 'ai-context-menu',\n destroyRef,\n },\n );\n }\n\n return {\n open(ctx: Omit<SendContextPayload, 'snapshot'>): void {\n dialogTimer?.cancel();\n dialogTimer = null;\n closeMenu();\n closeDialog();\n // Trigger a snapshot collection now so the buffer is populated\n // by the time the user submits the dialog.\n takeSnapshot();\n\n menu = openOverlay(99998, 'none', (host) =>\n mountCraftComponent(AiContextMenu, host, injector, {\n x: function* () {\n return ctx.coords.x;\n },\n y: function* () {\n return ctx.coords.y;\n },\n onSelect: () => onSelect(ctx),\n onDismiss: closeMenu,\n }),\n );\n },\n };\n}\n\nfunction asAngularToken<T>(token: CraftToken<T>): ProviderToken<T> {\n return token as unknown as ProviderToken<T>;\n}\n\nexport function provideSendContextToAi(): Provider[] {\n return [\n {\n provide: asAngularToken(SEND_CONTEXT_TO_AI_BUFFER),\n useFactory: () =>\n createSendContextToAiBuffer(inject(APP_SNAPSHOT_REGISTRY)),\n },\n {\n provide: asAngularToken(AI_CONTEXT_MENU_CONTROLLER),\n useFactory: () =>\n createAiContextMenuController({\n injector: inject(Injector),\n buffer: inject(asAngularToken(SEND_CONTEXT_TO_AI_BUFFER)),\n takeSnapshot: inject(TAKE_APP_SNAPSHOT),\n temporalRuntime: inject(CRAFT_TEMPORAL_RUNTIME),\n destroyRef: inject(DestroyRef),\n }),\n },\n provideComponentMonitoring(() => {\n const el = inject(ElementRef).nativeElement as HTMLElement;\n const tagList = inject(HOST_TAG_LIST, { optional: true }) as unknown;\n const injector = inject(Injector);\n const controller = inject(asAngularToken(AI_CONTEXT_MENU_CONTROLLER));\n // Eagerly instantiate the buffer so snapshot reports start being collected.\n inject(asAngularToken(SEND_CONTEXT_TO_AI_BUFFER));\n\n fromEventToSource$<MouseEvent>(el, 'contextmenu').subscribe((event) => {\n const handled = event as HandledEvent;\n if (handled[HANDLED_FLAG]) return;\n handled[HANDLED_FLAG] = true;\n\n event.preventDefault();\n event.stopPropagation();\n\n runInInjectionContext(injector, () => {\n const hostName = injectHostName();\n const outerHTML = (el.outerHTML ?? '').slice(0, 2000);\n controller.open({\n hostName,\n tagList,\n coords: { x: event.clientX, y: event.clientY },\n outerHTML,\n });\n });\n });\n }),\n ];\n}\n\nexport type GenDeps_AiContextMenuController = GetDeps<{\n deps: {};\n provided: {};\n missingProvider: {\n Injector: Injector;\n TAKE_APP_SNAPSHOT: typeof TAKE_APP_SNAPSHOT;\n };\n}>;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assert-defined-input.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/assert-defined-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,2BAA2B,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAElE,eAAO,MAAM,uCAAuC,EAClD,iCAA0C,CAAC;AAE7C,MAAM,MAAM,+BAA+B,GAAG,oBAAoB,CAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,uCAAuC,CAAA;CAAE,EACjE;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAC/B,CAAC;AAEF,KAAK,iBAAiB,CAAC,WAAW,EAAE,WAAW,IAAI,CACjD,MAAM,EAAE,KAAK,CAAC,WAAW,CAAC,KACvB,KAAK,CAAC,WAAW,CAAC,CAAC;AAExB,MAAM,MAAM,aAAa,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG;IAChD,IAAI,CAAC,WAAW,EACd,QAAQ,EAAE,iBAAiB,CAAC,KAAK,EAAE,WAAW,CAAC,GAC9C,aAAa,CAAC,WAAW,C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AAO,CACL,MAAoB,EAGpB,EAAE,CACF,aAAa,CAAC,QAAQ,CAAC;YACrB,IAAI,CAAC;gBACH,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAA8B,CAAC;YACxD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC;oBACnC,MAAM,KAAK,CAAC;gBACd,CAAC;gBAED,IACE,KAAK,CAAC,SAAS,CAAC,IAAI;oBACpB,uCAAuC,EACvC,CAAC;oBACD,MAAM,KAAK,CAAC;gBACd,CAAC;gBAED,OAAO,QAAQ,CAAC,uCAAuC,CAAC,CACtD,KAAK,CAAC,SAA4C,CACI,CAAC;YAC3D,CAAC;QACH,CAA+D,CAAC,CAAC;IACrE,CAAC;CACF,CAAC","sourcesContent":["import {\n CraftGenShortCircuit,\n craftException,\n isCraftGenShortCircuit,\n type CatchTagExhaustiveCodesCheck,\n type CraftExceptionResult,\n} from '@craft-ts/core';\nimport type { CraftInputExceptionsCarrier, Input } from './types';\n\nexport const CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE =\n 'CraftUndefinedPropertyException' as const;\n\nexport type CraftUndefinedPropertyException = CraftExceptionResult<\n { readonly _tag: typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE },\n { readonly property?: string }\n>;\n\ntype InputPipeOperator<SourceValue, OutputValue> = (\n source: Input<SourceValue>,\n) => Input<OutputValue>;\n\nexport type PipeableInput<Value> = Input<Value> & {\n pipe<OutputValue>(\n operator: InputPipeOperator<Value, OutputValue>,\n ): PipeableInput<OutputValue>;\n};\n\ntype AssertDefinedInputHandler = (\n exception: CraftUndefinedPropertyException,\n) => unknown;\n\ntype AssertDefinedInputHandlers = Record<\n typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE,\n AssertDefinedInputHandler\n>;\n\ntype HandlerOutput<Handlers extends AssertDefinedInputHandlers> = ReturnType<\n Handlers[typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE]\n>;\n\nexport function craftUndefinedPropertyException(\n property?: string,\n): CraftUndefinedPropertyException {\n const payload: { readonly property?: string } =\n property === undefined ? {} : { property };\n\n return craftException(\n { _tag: CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE },\n payload,\n );\n}\n\nexport type AssertDefinedInput<Value> = Input<Exclude<Value, undefined>> &\n CraftInputExceptionsCarrier<typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE> &\n Pick<PipeableInput<Exclude<Value, undefined>>, 'pipe'>;\n\nfunction pipeableInput<Value>(source: Input<Value>): PipeableInput<Value> {\n const input = source as PipeableInput<Value>;\n if (Object.prototype.hasOwnProperty.call(input, 'pipe')) {\n return input;\n }\n\n Object.defineProperty(input, 'pipe', {\n value: <OutputValue>(\n operator: InputPipeOperator<Value, OutputValue>,\n ): PipeableInput<OutputValue> => pipeableInput(operator(input)),\n enumerable: false,\n });\n return input;\n}\n\n/** Creates an input which narrows away undefined and short-circuits when absent. */\nexport function assertDefinedInput<Value>(\n source: Input<Value | undefined>,\n options: { readonly property?: string } = {},\n): AssertDefinedInput<Value> {\n return pipeableInput(function* () {\n const value = yield* source();\n if (value !== undefined) {\n return value as Exclude<Value, undefined>;\n }\n\n throw new CraftGenShortCircuit(\n craftUndefinedPropertyException(options.property),\n );\n } as Input<Exclude<Value, undefined>>) as AssertDefinedInput<Value>;\n}\n\nexport const catchInput = {\n exhaustive<const Handlers extends AssertDefinedInputHandlers>(\n handlers: Handlers &\n CatchTagExhaustiveCodesCheck<\n typeof CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE,\n Handlers\n >,\n ) {\n return <Value>(\n source: Input<Value>,\n ): PipeableInput<\n Exclude<Value, undefined> | HandlerOutput<Handlers>\n > =>\n pipeableInput(function* () {\n try {\n return (yield* source()) as Exclude<Value, undefined>;\n } catch (error) {\n if (!isCraftGenShortCircuit(error)) {\n throw error;\n }\n\n if (\n error.exception._tag !==\n CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE\n ) {\n throw error;\n }\n\n return handlers[CRAFT_UNDEFINED_PROPERTY_EXCEPTION_CODE](\n error.exception as CraftUndefinedPropertyException,\n ) as Exclude<Value, undefined> | HandlerOutput<Handlers>;\n }\n } as Input<Exclude<Value, undefined> | HandlerOutput<Handlers>>);\n },\n};\n"]}
|
package/src/lib/block.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { AnyCraftException } from '@craft-ts/core';
|
|
2
|
-
import { COMPONENT_CATCH_BLOCK, type ComponentOperator, type ComponentExceptionHandler, type ComponentExceptionHandlerDefinition, type ComponentExceptionHandlerEntry, type ComponentExceptionHandlerOptions, type CraftDirective } from './types';
|
|
3
|
-
import type { CraftNodeChildren } from './render/vnode';
|
|
4
|
-
export declare const CATCH_BLOCK_DIRECTIVE: unique symbol;
|
|
5
|
-
export type CatchBlockPosition = 'before' | 'after';
|
|
6
|
-
export declare class CraftUnhandledExceptionError extends Error {
|
|
7
|
-
readonly _tag: string;
|
|
8
|
-
constructor(exception: AnyCraftException);
|
|
9
|
-
}
|
|
10
|
-
export type CatchBlockHandler = ComponentExceptionHandler;
|
|
11
|
-
export type CatchBlockHandlerOptions = ComponentExceptionHandlerOptions;
|
|
12
|
-
export type CatchBlockHandlerDefinition = ComponentExceptionHandlerDefinition;
|
|
13
|
-
export type CatchBlockHandlerEntry = ComponentExceptionHandlerEntry;
|
|
14
|
-
export type CatchBlockHandlers = Record<string, CatchBlockHandlerEntry>;
|
|
15
|
-
export type CatchBlockHandlerChildren<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 resolveCatchBlockHandler(handler: CatchBlockHandlerEntry, exception: AnyCraftException, defaultShowSource: boolean, defaultPosition: CatchBlockPosition): {
|
|
19
|
-
readonly children: CraftNodeChildren;
|
|
20
|
-
readonly showSource: boolean;
|
|
21
|
-
readonly position: CatchBlockPosition;
|
|
22
|
-
};
|
|
23
|
-
export type CatchBlockDirective<Handlers extends CatchBlockHandlers> = CraftDirective & ComponentOperator<readonly [], Extract<keyof Handlers, string>> & {
|
|
24
|
-
readonly [COMPONENT_CATCH_BLOCK]: true;
|
|
25
|
-
readonly [CATCH_BLOCK_DIRECTIVE]: {
|
|
26
|
-
readonly handlers: Handlers;
|
|
27
|
-
readonly position: CatchBlockPosition;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
/** A template boundary which keeps its source block and inserts a fallback. */
|
|
31
|
-
export declare const catchBlock: {
|
|
32
|
-
exhaustive<const Handlers extends CatchBlockHandlers>(handlers: Handlers, options?: {
|
|
33
|
-
readonly position?: CatchBlockPosition;
|
|
34
|
-
}): CatchBlockDirective<Handlers>;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=block.d.ts.map
|
package/src/lib/block.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAEL,qBAAqB,EACrB,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,8BAA8B,EACnC,KAAK,gCAAgC,EACrC,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,eAAO,MAAM,qBAAqB,eAAwC,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEpD,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,SAAS,EAAE,iBAAiB;C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AAM,UAAU,GAAG;IACxB,UAAU,CACR,QAAkB,EAClB,UAAsD,EAAE;QAExD,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;QAC7C,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,CACtB,SAAS,CAA6C,CAAC;QACzD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE;YAChD,KAAK,EAAE;gBACL,IAAI,EAAE,uBAAuB;gBAC7B,IAAI,EAAE,EAAE;gBACR,KAAK,EAAE,CAAC,SAAkC,EAAE,EAAE,CAAC,SAAS;gBACxD,QAAQ,EAAE,CAAC,YAAmC,EAAE,EAAE,CAAC,YAAY;gBAC/D,iBAAiB,EAAE;oBACjB,IAAI,EAAE,YAAY;oBAClB,aAAa,EAAE,QAAQ;oBACvB,kBAAkB,EAAE,QAAQ;iBAC7B;aACF;YACD,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,qBAAqB,EAAE;YACtD,KAAK,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;YAC7B,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,qBAAqB,EAAE;YACtD,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,KAAK;SAClB,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF,CAAC","sourcesContent":["import type { AnyCraftException } from '@craft-ts/core';\nimport {\n CRAFT_DIRECTIVE,\n COMPONENT_CATCH_BLOCK,\n type ComponentOperator,\n type ComponentExceptionHandler,\n type ComponentExceptionHandlerDefinition,\n type ComponentExceptionHandlerEntry,\n type ComponentExceptionHandlerOptions,\n type CraftDirective,\n} from './types';\nimport type { CraftNodeChildren } from './render/vnode';\n\nexport const CATCH_BLOCK_DIRECTIVE = Symbol('craft-catch-block-directive');\n\nexport type CatchBlockPosition = 'before' | 'after';\n\nexport class CraftUnhandledExceptionError extends Error {\n readonly _tag: string;\n\n constructor(exception: AnyCraftException) {\n super(\n `Unhandled Craft exception \"${exception._tag}\" escaped every block boundary.`,\n );\n this.name = 'CraftUnhandledExceptionError';\n this._tag = exception._tag;\n }\n}\n\nexport type CatchBlockHandler = ComponentExceptionHandler;\nexport type CatchBlockHandlerOptions = ComponentExceptionHandlerOptions;\nexport type CatchBlockHandlerDefinition = ComponentExceptionHandlerDefinition;\nexport type CatchBlockHandlerEntry = ComponentExceptionHandlerEntry;\nexport type CatchBlockHandlers = Record<string, CatchBlockHandlerEntry>;\nexport type CatchBlockHandlerChildren<Handler> =\n Handler extends ComponentExceptionHandlerEntry\n ? Handler extends (...args: any[]) => infer Children\n ? Children\n : Handler extends { readonly render: (...args: any[]) => infer Children }\n ? Children\n : never\n : never;\n\nexport function resolveCatchBlockHandler(\n handler: CatchBlockHandlerEntry,\n exception: AnyCraftException,\n defaultShowSource: boolean,\n defaultPosition: CatchBlockPosition,\n): {\n readonly children: CraftNodeChildren;\n readonly showSource: boolean;\n readonly position: CatchBlockPosition;\n} {\n if (typeof handler === 'function') {\n return {\n children: handler(exception),\n showSource: defaultShowSource,\n position: defaultPosition,\n };\n }\n\n return {\n children: handler.render(exception),\n showSource: handler.showSource ?? defaultShowSource,\n position: handler.position ?? defaultPosition,\n };\n}\n\nexport type CatchBlockDirective<Handlers extends CatchBlockHandlers> =\n CraftDirective &\n ComponentOperator<readonly [], Extract<keyof Handlers, string>> & {\n readonly [COMPONENT_CATCH_BLOCK]: true;\n readonly [CATCH_BLOCK_DIRECTIVE]: {\n readonly handlers: Handlers;\n readonly position: CatchBlockPosition;\n };\n };\n\n/** A template boundary which keeps its source block and inserts a fallback. */\nexport const catchBlock = {\n exhaustive<const Handlers extends CatchBlockHandlers>(\n handlers: Handlers,\n options: { readonly position?: CatchBlockPosition } = {},\n ): CatchBlockDirective<Handlers> {\n const position = options.position ?? 'after';\n const directive = (() =>\n undefined) as unknown as CatchBlockDirective<Handlers>;\n Object.defineProperty(directive, CRAFT_DIRECTIVE, {\n value: {\n name: 'catchBlock.exhaustive',\n meta: {},\n logic: (baseLogic: (...args: any[]) => any) => baseLogic,\n template: (baseTemplate: (context: any) => any) => baseTemplate,\n componentOperator: {\n kind: 'catchBlock',\n catchHandlers: handlers,\n catchBlockPosition: position,\n },\n },\n enumerable: false,\n });\n Object.defineProperty(directive, CATCH_BLOCK_DIRECTIVE, {\n value: { handlers, position },\n enumerable: false,\n });\n Object.defineProperty(directive, COMPONENT_CATCH_BLOCK, {\n value: true,\n enumerable: false,\n });\n return directive;\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,OAAO,IAAI,MAAM,EAEjB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAKxB,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,OAAO,EAAE,CAAA;KAAE,CAAC;IAC5D;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC;IACjC,OAAO,IAAI,IAAI,CAAC;CACjB,CAAC;AAOF,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC,EACvC,mBAAmB,GAAE,SAAS,OAAO,EAAO,GAC3C,aAAa,CAkBf;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,GACtB,SAAS,OAAO,EAAE,CAMpB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,WAAW,CA+B1E;AAED,8EAA8E;AAC9E,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,CAAC"}
|
package/src/lib/bootstrap.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,0BAA0B,IAAI,yBAAyB,EACvD,6BAA6B,IAAI,4BAA4B,EAC7D,OAAO,IAAI,MAAM,EACjB,sBAAsB,IAAI,qBAAqB,GAEhD,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAqB3D,SAAS,WAAW,CAAC,IAAyB;IAC5C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC;IACtB,OAAO,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,MAAuC,EACvC,sBAA0C,EAAE;IAE5C,OAAO,yBAAyB,CAC9B;QACE,GAAG,4BAA4B,EAAE;QACjC;YACE,OAAO,EAAE,kBAAkB;YAC3B,QAAQ,EAAE,uBAAuB,EAAE;SACpC;QACD;YACE,OAAO,EAAE,wBAAwB;YACjC,QAAQ,EAAE,IAAI,sBAAsB,EAAE;SACvC;QACD,GAAG,MAAM,CAAC,SAAS;QACnB,GAAG,mBAAmB;KACvB,EACD,mBAAmB,CAAC,EAAE,CAAC,EACvB,UAAU,CACX,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,QAAuB;IAEvB,OAAO,QAAQ;SACZ,GAAG,CAAC,eAAe,EAAE,EAAE,CAAC;SACxB,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACnB,qBAAqB,CAAC,QAAQ,EAAE,WAA4B,CAAC,CAC9D,CAAC;AACN,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,QAAQ,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,+BAA+B,CAAC,OAAO,CAAC,MAAM,EAAE;QAC/D,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE;KAChD,CAAC,CAAC;IAEH,4EAA4E;IAC5E,uDAAuD;IACvD,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAEnC,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,oBAAoB,CAAwB,CAAC;IACvE,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,mBAAmB,CACjC,IAAI,EACJ,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EACzB,QAAQ,CACT,CAAC;IAEF,OAAO;QACL,QAAQ;QACR,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,8EAA8E;AAC9E,OAAO,EAAE,MAAM,IAAI,gBAAgB,EAAE,CAAC","sourcesContent":["import {\n APP_INITIALIZER,\n COMPONENT_REGISTER,\n CRAFT_PLATFORM,\n CRAFT_PRIMITIVE_REGISTRY,\n CraftPrimitiveRegistry,\n createBrowserPlatform,\n createComponentRegister,\n createCraftInjector,\n ɵcreateEnvironmentInjector as createEnvironmentInjector,\n ɵgetCraftRootDefaultProviders as getCraftRootDefaultProviders,\n ɵinject as inject,\n ɵrunInInjectionContext as runInInjectionContext,\n type CraftInjector,\n} from '@craft-ts/core';\nimport { mountCraftComponent } from './bridge';\nimport { CRAFT_ROOT_COMPONENT } from './craft-host-tokens';\nimport type { CraftComponent } from './types';\n\nexport type BootstrapCraftOptions = {\n /**\n * The result of `craftAppConfig(...)`. Its `providers` already carry the\n * root component, the router and one APP_INITIALIZER per appStart service.\n */\n readonly config: { readonly providers: readonly unknown[] };\n /**\n * Where to mount. Defaults to the first `<craft-root>` in the document, or\n * `document.body` when there is none.\n */\n readonly host?: Element;\n};\n\nexport type CraftAppRef = {\n readonly injector: CraftInjector;\n destroy(): void;\n};\n\nfunction resolveHost(host: Element | undefined): Element {\n if (host) return host;\n return document.querySelector('craft-root') ?? document.body;\n}\n\nexport function ɵcreateCraftApplicationInjector(\n config: BootstrapCraftOptions['config'],\n additionalProviders: readonly unknown[] = [],\n): CraftInjector {\n return createEnvironmentInjector(\n [\n ...getCraftRootDefaultProviders(),\n {\n provide: COMPONENT_REGISTER,\n useValue: createComponentRegister(),\n },\n {\n provide: CRAFT_PRIMITIVE_REGISTRY,\n useValue: new CraftPrimitiveRegistry(),\n },\n ...config.providers,\n ...additionalProviders,\n ],\n createCraftInjector([]),\n 'CraftApp',\n );\n}\n\nexport function ɵrunCraftAppInitializers(\n injector: CraftInjector,\n): readonly unknown[] {\n return injector\n .get(APP_INITIALIZER, [])\n .map((initializer) =>\n runInInjectionContext(injector, initializer as () => unknown),\n );\n}\n\n/**\n * Boots a Craft application: builds the root injector, runs the app-start\n * hooks, then mounts the root component.\n *\n * This replaces Angular's `bootstrapApplication`. There is no platform to\n * create and no zone to enter — an injector and a mount is the whole of it.\n */\nexport function bootstrapCraft(options: BootstrapCraftOptions): CraftAppRef {\n const platform = createBrowserPlatform(window);\n const injector = ɵcreateCraftApplicationInjector(options.config, [\n { provide: CRAFT_PLATFORM, useValue: platform },\n ]);\n\n // appStart hooks run before the first render, so a service that seeds state\n // has done so by the time the root component reads it.\n ɵrunCraftAppInitializers(injector);\n\n const root = injector.get(CRAFT_ROOT_COMPONENT) as CraftComponent<any>;\n if (!root) {\n throw new Error(\n 'bootstrapCraft found no root component. Add provideCraftRootComponent(App) to your app config.',\n );\n }\n\n const mounted = mountCraftComponent(\n root,\n resolveHost(options.host),\n injector,\n );\n\n return {\n injector,\n destroy() {\n mounted.destroy();\n platform.history.dispose();\n (injector as { destroy?(): void }).destroy?.();\n },\n };\n}\n\n/** Re-exported so apps can reach the boot injector without importing core. */\nexport { inject as ɵbootstrapInject };\n"]}
|
package/src/lib/bridge.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,yBAAyB,EAC/B,MAAM,gBAAgB,CAAC;AAQxB,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EACV,0BAA0B,EAC1B,mCAAmC,EACnC,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,OAAO,EACR,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,MAAM,IAAI,qBAAqB,CAAC,KAAK,CAAC,CAAC;AAE/E,KAAK,KAAK,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AAEvD,KAAK,kCAAkC,CAAC,SAAS,IAC/C,KAAK,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,SAAS,IAAI,GACrD,OAAO,GACP,OAAO,SAAS,0BAA0B,CAAC,SAAS,CAAC,GACnD,OAAO,GACP,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GACrD,OAAO,GACP;I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
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GAKjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,oBAAoB,EACpB,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,yBAAyB,GAE1B,MAAM,sBAAsB,CAAC;AA0B9B,MAAM,UAAU,mBAAmB,CACjC,SAAoE,EACpE,WAAoB,EACpB,QAAgB,EAChB,QAA4B,EAAwB;IAEpD,OAAO,yBAAyB,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC5E,CAAC;AAcD,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,oBAAoB,EACpB,gCAAgC,EAChC,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,UAAU,qBAAqB,CACnC,SAA8B;IAE9B,OAAO;QACL,OAAO,EAAE,sBAAsB;QAC/B,QAAQ,EAAE,SAAS;KACpB,CAAC;AACJ,CAAC;AAiDD,6EAA6E;AAC7E,MAAM,UAAU,sBAAsB,CACpC,MAA+C;IAE/C,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,MACwD,EACxD,sBAAuD,EAAE;IAYzD,IAAI,eAAsC,CAAC;IAE3C,MAAM,QAAQ,GAAG;QACf,aAAa,EAAE,KAAK,EAAE,OAAkC,EAAE,EAAE;YAC1D,eAAe,GAAG,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,CAAc,CAAC;YACvD,yEAAyE;YACzE,sEAAsE;YACtE,OAAO,eAA2C,CAAC;QACrD,CAAC;QACD,SAAS,EAAE;YACT;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,CAAC,eAAe,EAAE,CAAC;wBACrB,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;oBACJ,CAAC;oBACD,OAAO,gBAAgB,CAAC,eAAe,CAAC,CAAC;gBAC3C,CAAC;aACF;YACD;gBACE,OAAO,EAAE,sBAAsB;gBAC/B,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,CAAC,eAAe,EAAE,CAAC;wBACrB,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;oBACJ,CAAC;oBACD,OAAO,eAAe,CAAC;gBACzB,CAAC;aACF;YACD,GAAG,mBAAmB;SACvB;KACF,CAAC;IAEF,OAAO,QAEqE,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,SAA8B;IAE9B,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,SAA8B;IAE9B,OAAO;QACL,OAAO,EAAE,oBAAoB;QAC7B,QAAQ,EAAE,SAAS;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,SAA8B;IAE9B,OAAO;QACL,OAAO,EAAE,4BAA4B;QACrC,QAAQ,EAAE,SAAS;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,SAA8B;IAE9B,OAAO;QACL,OAAO,EAAE,gCAAgC;QACzC,QAAQ,EAAE,SAAS;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,SAA8B;IAE9B,OAAO;QACL,OAAO,EAAE,uBAAuB;QAChC,QAAQ,EAAE,SAAS;KACpB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAC5C,SAA8B;IAE9B,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["import {\n CRAFT_ROUTE_TARGET,\n craftRouteTarget,\n type ComponentDepsCarrier,\n type ComponentDepsOf,\n type ComponentExceptionsCarrier,\n type CraftRouteLazyLoadHelpers,\n} from '@craft-ts/core';\nimport {\n CRAFT_GLOBAL_ERROR_COMPONENT,\n CRAFT_PENDING_COMPONENT,\n CRAFT_ROOT_COMPONENT,\n CRAFT_ROUTE_LOAD_ERROR_COMPONENT,\n CRAFT_ROUTED_COMPONENT,\n} from './craft-host-tokens';\nimport {\n mountInterpretedComponent,\n type MountedCraftComponent,\n} from './render/interpreter';\nimport type {\n ComponentFieldExceptionsOf,\n ComponentInitializationExceptionsOf,\n ComponentCssVarsOf,\n ComponentNameOf,\n CraftComponent,\n PropsOf,\n} from './types';\nimport type { CssVarContract } from './css-vars.type';\n\nexport type CraftMountRef<Props extends object> = MountedCraftComponent<Props>;\n\ntype IsAny<Value> = 0 extends 1 & Value ? true : false;\n\ntype RequireHandledMountFieldExceptions<Component> =\n IsAny<ComponentFieldExceptionsOf<Component>> extends true\n ? unknown\n : unknown extends ComponentFieldExceptionsOf<Component>\n ? unknown\n : [ComponentFieldExceptionsOf<Component>] extends [never]\n ? unknown\n : {\n 'fieldExceptionBlock.exhaustive is required before mounting component field exceptions': ComponentFieldExceptionsOf<Component>;\n };\n\nexport function mountCraftComponent<Component extends CraftComponent<any>>(\n component: Component & RequireHandledMountFieldExceptions<Component>,\n hostElement: Element,\n injector: object,\n props: PropsOf<Component> = {} as PropsOf<Component>,\n): CraftMountRef<PropsOf<Component>> {\n return mountInterpretedComponent(component, hostElement, injector, props);\n}\n\ntype ValueProvider = {\n provide: object;\n useValue: unknown;\n multi?: boolean;\n};\n\ntype Route = {\n providers?: readonly unknown[];\n};\n\ntype Type<T> = new (...args: never[]) => T;\n\nexport {\n CRAFT_GLOBAL_ERROR_COMPONENT,\n CRAFT_PENDING_COMPONENT,\n CRAFT_ROOT_COMPONENT,\n CRAFT_ROUTE_LOAD_ERROR_COMPONENT,\n CRAFT_ROUTED_COMPONENT,\n} from './craft-host-tokens';\n\nexport function provideCraftComponent(\n component: CraftComponent<any>,\n): ValueProvider {\n return {\n provide: CRAFT_ROUTED_COMPONENT,\n useValue: component,\n };\n}\n\ntype RequireHandledRouteFieldExceptions<Component> =\n IsAny<ComponentFieldExceptionsOf<Component>> extends true\n ? unknown\n : unknown extends ComponentFieldExceptionsOf<Component>\n ? unknown\n : [ComponentFieldExceptionsOf<Component>] extends [never]\n ? unknown\n : {\n 'fieldExceptionBlock.exhaustive is required before routing component field exceptions': ComponentFieldExceptionsOf<Component>;\n };\n\nexport type CraftRouteCssVarsCarrier<\n Contract extends CssVarContract = CssVarContract,\n Name extends string = string,\n> = {\n readonly __craftRouteCssVars__?: {\n readonly component: Name;\n readonly contract: Contract;\n };\n};\n\ntype RouteCssVarErrors<Value> = Value extends {\n readonly _routes: infer Routes;\n}\n ? RouteCssVarErrors<Routes>\n : Value extends readonly (infer Route)[]\n ? RouteCssVarErrors<Route>\n : Value extends CraftRouteCssVarsCarrier<\n infer Contract,\n infer Name extends string\n >\n ? [Contract['required']] extends [never]\n ? never\n : {\n readonly component: Name;\n readonly missing: Contract['required'];\n }\n : Value extends { readonly children?: infer Children }\n ? RouteCssVarErrors<NonNullable<Children>>\n : never;\n\ntype AssertCssVarsSatisfied<Routes> = [RouteCssVarErrors<Routes>] extends [\n never,\n]\n ? unknown\n : { readonly ERROR_unsatisfied_css_vars: RouteCssVarErrors<Routes> };\n\n/** Compile-time proof that no required CSS variable reaches a route root. */\nexport function assertCssVarsSatisfied<Routes>(\n routes: Routes & AssertCssVarsSatisfied<Routes>,\n): Routes {\n return routes;\n}\n\nexport function loadCraftComponent<const Component extends CraftComponent<any>>(\n loader: ((helpers: CraftRouteLazyLoadHelpers) => Promise<Component>) &\n RequireHandledRouteFieldExceptions<NoInfer<Component>>,\n additionalProviders: NonNullable<Route['providers']> = [],\n): {\n loadComponent: (\n helpers: CraftRouteLazyLoadHelpers,\n ) => Promise<Type<unknown>>;\n providers: NonNullable<Route['providers']>;\n} & ComponentDepsCarrier<ComponentDepsOf<Component>> &\n ComponentExceptionsCarrier<ComponentInitializationExceptionsOf<Component>> &\n CraftRouteCssVarsCarrier<\n ComponentCssVarsOf<Component>,\n ComponentNameOf<Component>\n > {\n let loadedComponent: Component | undefined;\n\n const fragment = {\n loadComponent: async (helpers: CraftRouteLazyLoadHelpers) => {\n loadedComponent = (await loader(helpers)) as Component;\n // The Angular host used to stand in here and read the component back out\n // of CRAFT_ROUTE_TARGET. The outlet mounts Craft components directly.\n return loadedComponent as unknown as Type<unknown>;\n },\n providers: [\n {\n provide: CRAFT_ROUTE_TARGET,\n useFactory: () => {\n if (!loadedComponent) {\n throw new Error(\n 'loadCraftComponent() must finish loading before its route target is resolved.',\n );\n }\n return craftRouteTarget(loadedComponent);\n },\n },\n {\n provide: CRAFT_ROUTED_COMPONENT,\n useFactory: () => {\n if (!loadedComponent) {\n throw new Error(\n 'loadCraftComponent() must finish loading before the route host is created.',\n );\n }\n return loadedComponent;\n },\n },\n ...additionalProviders,\n ],\n };\n\n return fragment as unknown as typeof fragment &\n ComponentDepsCarrier<ComponentDepsOf<Component>> &\n ComponentExceptionsCarrier<ComponentInitializationExceptionsOf<Component>>;\n}\n\nexport function craftComponentRouteData(\n component: CraftComponent<any>,\n): Readonly<Record<string, unknown>> {\n return { craftComponent: component };\n}\n\nexport function provideCraftRootComponent(\n component: CraftComponent<any>,\n): ValueProvider {\n return {\n provide: CRAFT_ROOT_COMPONENT,\n useValue: component,\n };\n}\n\nexport function provideCraftGlobalErrorComponent(\n component: CraftComponent<any>,\n): ValueProvider {\n return {\n provide: CRAFT_GLOBAL_ERROR_COMPONENT,\n useValue: component,\n };\n}\n\nexport function provideCraftRouteLoadErrorComponent(\n component: CraftComponent<any>,\n): ValueProvider {\n return {\n provide: CRAFT_ROUTE_LOAD_ERROR_COMPONENT,\n useValue: component,\n };\n}\n\nexport function provideCraftPendingComponent(\n component: CraftComponent<any>,\n): ValueProvider {\n return {\n provide: CRAFT_PENDING_COMPONENT,\n useValue: component,\n };\n}\n\nexport function craftPendingComponentRouteData(\n component: CraftComponent<any>,\n): Readonly<Record<string, unknown>> {\n return { craftPendingComponent: component };\n}\n\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAElB,KAAK,gDAAgD,EACrD,KAAK,iBAAiB,EACtB,KAAK,gCAAgC,EACrC,KAAK,4BAA4B,EACjC,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EAErB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAW7D,KAAK,iBAAiB,CAAC,IAAI,SAAS,aAAa,IAAI,IAAI,SAAS;IAChE,QAAQ,CAAC,SAAS,EAAE,MAAM,SAAS,CAAC;CACrC,GACG,SAAS,GACT,SAAS,EAAE,CAAC;AAUhB,KAAK,0BAA0B,CAAC,OAAO,SAAS,gBAAgB,IAAI;KACjE,GAAG,IAAI,MAAM,gBAAgB,CAAC,OAAO,CAAC,GAAG,WAAW,CACnD,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAC/B,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAC7B,GAAG,GACH,KAAK;CACV,CAAC,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAChC,MAAM,CAAC;AAET,KAAK,kBAAkB,CACrB,IAAI,SAAS,aAAa,EAC1B,OAAO,SAAS,gBAAgB,IAC9B,IAAI,SAAS;IAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;C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ACzB,oBAAoB,CAAC,QAAQ,CAAC,CAC/B,EACD,OAAO,EACP,IAAI,EACJ,OAAO,EACP,oBAAoB,CAAC,QAAQ,CAAC,EAC9B,QAAQ,EACR,IAAI,EACJ,gDAAgD,CAC9C,OAAO,EACP,iBAAiB,CAAC,IAAI,CAAC,EACvB,QAAQ,CACT,EACD,4BAA4B,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACrD,gCAAgC,CAAC,OAAO,EAAE,QAAQ,CAAC,CACpD,CASA"}
|
package/src/lib/component.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,GAE1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,eAAe,GAkBhB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,cAAc,EACd,aAAa,GACd,MAAM,gBAAgB,CAAC;AAQxB,SAAS,WAAW,CAClB,GAAG,OAA4D;IAE/D,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAChC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CACvD,CAAC;AACJ,CAAC;AA4FD,MAAM,UAAU,cAAc,CAM5B,IAAU,EACV,IAA8C,EAC9C,OAAgB,EAChB,QAIqC;IAwBrC,OAAO,oBAAoB,CAAgC;QACzD,IAAI;QACJ,IAAI;QACJ,OAAO;QACP,QAAQ;QACR,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACzE,eAAe,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AgB,IAAI,QAAQ,EAAE,gBAAgB,CAAC;IAC9E,MAAM,kBAAkB,GACtB,IAAI,EAAE,kBAAkB,IAAI,QAAQ,EAAE,kBAAkB,CAAC;IAC3D,MAAM,sBAAsB,GAC1B,IAAI,EAAE,sBAAsB,IAAI,QAAQ,EAAE,sBAAsB,CAAC;IACnE,MAAM,qBAAqB,GACzB,IAAI,EAAE,qBAAqB,IAAI,QAAQ,EAAE,qBAAqB,CAAC;IAEjE,OAAO;QACL,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1C,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACrD,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7D,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC","sourcesContent":["import {\n CRAFT_REGISTRATION_TARGET,\n type CraftComponentDependencies,\n} from '@craft-ts/core';\nimport {\n CRAFT_COMPONENT,\n CRAFT_DIRECTIVE,\n type ComponentFactory,\n type ComponentMeta,\n type ComponentCompositionDefinition,\n type ComponentInitializationExceptionCodesForTemplate,\n type ComponentTemplate,\n type ComponentResidualFieldExceptions,\n type ContentRequirementsOfContext,\n type CraftComponent,\n type FactoryContext,\n type FactoryYielded,\n type PropsFromFactory,\n type StyleOwner,\n type TemplateDependencies,\n type TemplateCssVars,\n type TemplateHeadingNeed,\n type TemplatePendingSources,\n type TemplateSettledExceptions,\n} from './types';\nimport type { CssVarsContractOfMeta } from './css-vars.type';\nimport { forwardedCssVarStyles } from './css-vars';\nimport type { HostProps } from './hyperscript';\nimport type { ComponentNode } from './render/vnode';\nimport {\n applyHostPropsToChildren,\n currentCraftRenderContext,\n mergeHostProps,\n pipeCraftNode,\n} from './render/vnode';\n\ntype ProvidersFromMeta<Meta extends ComponentMeta> = Meta extends {\n readonly providers: infer Providers;\n}\n ? Providers\n : readonly [];\n\nfunction mergeStyles(\n ...sources: readonly (string | readonly string[] | undefined)[]\n): readonly string[] {\n return sources.flatMap((source) =>\n typeof source === 'string' ? [source] : (source ?? []),\n );\n}\n\ntype ContentSlotNamesForFactory<Factory extends ComponentFactory> = {\n [Key in keyof PropsFromFactory<Factory>]: NonNullable<\n PropsFromFactory<Factory>[Key]\n > extends (...args: any[]) => any\n ? Key\n : never;\n}[keyof PropsFromFactory<Factory>] &\n string;\n\ntype ValidContentStyles<\n Meta extends ComponentMeta,\n Factory extends ComponentFactory,\n> = Meta extends { readonly contentStyles?: infer Styles }\n ? Exclude<\n keyof NonNullable<Styles>,\n ContentSlotNamesForFactory<NoInfer<Factory>>\n > extends never\n ? unknown\n : never\n : unknown;\n\ntype IsAny<Value> = 0 extends 1 & Value ? true : false;\n\n/**\n * A template may only render an async source (`settledValue`, or a\n * `craftComputed` that consumed one with `yield* settled(...)`) from inside a\n * `pendingBlock` boundary. Anything left uncovered fails here, on the template\n * argument, naming the sources that have nowhere to show their loading state.\n */\ntype ValidPendingSources<Template> =\n IsAny<TemplatePendingSources<Template>> extends true\n ? unknown\n : // `string` means the template's children were not narrowed at all (a\n // broadly typed template): there is no source to point at.\n string extends TemplatePendingSources<Template>\n ? unknown\n : [TemplatePendingSources<Template>] extends [never]\n ? unknown\n : {\n readonly ERROR_async_source_rendered_outside_a_pendingBlock: TemplatePendingSources<Template>;\n };\n\n/**\n * A template may only render a value whose settled read can raise an exception\n * from inside a `catchBlock`. Anything left uncovered fails here, on the\n * template argument, naming the codes with nowhere to be handled.\n */\ntype ValidSettledExceptions<Template> =\n IsAny<TemplateSettledExceptions<Template>> extends true\n ? unknown\n : string extends TemplateSettledExceptions<Template>\n ? unknown\n : [TemplateSettledExceptions<Template>] extends [never]\n ? unknown\n : {\n readonly ERROR_settled_read_exception_not_caught_by_a_catchBlock: TemplateSettledExceptions<Template>;\n };\n\n/**\n * A reusable child may render `heading()` without a local `headingSection` —\n * the need bubbles. The *parent* that calls that child must wrap the call in\n * `headingSection` (same DNA as `pendingBlock` on the parent, not the child).\n */\ntype ValidHeadingNeed<Template> =\n IsAny<TemplateHeadingNeed<Template>> extends true\n ? unknown\n : string extends TemplateHeadingNeed<Template>\n ? unknown\n : [Extract<TemplateHeadingNeed<Template>, 'heading-from-child'>] extends [\n never,\n ]\n ? unknown\n : {\n readonly ERROR_child_heading_rendered_outside_a_headingSection: 'heading-from-child';\n };\n\ntype ValidInheritedCssVars<Meta extends ComponentMeta, Template> =\n IsAny<TemplateCssVars<Template>['inherited']> extends true\n ? unknown\n : Exclude<\n TemplateCssVars<Template>['inherited'],\n CssVarsContractOfMeta<Meta>['declared']\n > extends infer Missing\n ? [Missing] extends [never]\n ? unknown\n : {\n readonly ERROR_css_var_marked_inherit_is_not_declared_here: Missing;\n }\n : never;\n\nexport function craftComponent<\n const Name extends string,\n const Meta extends ComponentMeta,\n Factory extends ComponentFactory,\n Template extends ComponentTemplate<FactoryContext<Factory>>,\n>(\n name: Name,\n meta: Meta & ValidContentStyles<Meta, Factory>,\n factory: Factory,\n template: Template &\n ValidInheritedCssVars<Meta, NoInfer<Template>> &\n ValidPendingSources<NoInfer<Template>> &\n ValidSettledExceptions<NoInfer<Template>> &\n ValidHeadingNeed<NoInfer<Template>>,\n): CraftComponent<\n PropsFromFactory<Factory>,\n CraftComponentDependencies<\n FactoryYielded<Factory>,\n FactoryContext<Factory>,\n ProvidersFromMeta<Meta>,\n PropsFromFactory<Factory>,\n TemplateDependencies<Template>\n >,\n Factory,\n Meta,\n Factory,\n TemplateDependencies<Template>,\n Template,\n Name,\n ComponentInitializationExceptionCodesForTemplate<\n Factory,\n ProvidersFromMeta<Meta>,\n Template\n >,\n ContentRequirementsOfContext<FactoryContext<Factory>>,\n ComponentResidualFieldExceptions<Factory, Template>\n> {\n return createCraftComponent<Name, Meta, Factory, Template>({\n name,\n meta,\n factory,\n template,\n styleOwners: [{ name, styles: mergeStyles(meta.styles, meta.stylesUrl) }],\n scopeDefinition: undefined,\n });\n}\n\nfunction createCraftComponent<\n const Name extends string,\n const Meta extends ComponentMeta,\n Factory extends ComponentFactory,\n Template extends ComponentTemplate<FactoryContext<Factory>>,\n>(definition: {\n readonly name: Name;\n readonly meta: Meta;\n readonly factory: Factory;\n readonly template: Template;\n readonly styleOwners: readonly StyleOwner[];\n readonly scopeDefinition: object | undefined;\n readonly composition?: ComponentCompositionDefinition;\n}): CraftComponent<\n PropsFromFactory<Factory>,\n CraftComponentDependencies<\n FactoryYielded<Factory>,\n FactoryContext<Factory>,\n ProvidersFromMeta<Meta>,\n PropsFromFactory<Factory>,\n TemplateDependencies<Template>\n >,\n Factory,\n Meta,\n Factory,\n TemplateDependencies<Template>,\n Template,\n Name,\n ComponentInitializationExceptionCodesForTemplate<\n Factory,\n ProvidersFromMeta<Meta>,\n Template\n >,\n ContentRequirementsOfContext<FactoryContext<Factory>>,\n ComponentResidualFieldExceptions<Factory, Template>\n> {\n type Props = PropsFromFactory<Factory>;\n type ComponentDeps = CraftComponentDependencies<\n FactoryYielded<Factory>,\n FactoryContext<Factory>,\n ProvidersFromMeta<Meta>,\n Props,\n TemplateDependencies<Template>\n >;\n\n // Keep host props in the template pipeline. This lets a directive pass\n // additional host props to its base template while preserving props that\n // were already supplied by the component caller.\n const hostAwareTemplate: ComponentTemplate<FactoryContext<Factory>> = (\n context,\n hostProps,\n ) => {\n const children = definition.template(context, hostProps);\n const forwardedStyles = forwardedCssVarStyles(children);\n const withForwardedDefaults = mergeHostProps(definition.meta.host ?? {}, {\n style: forwardedStyles,\n });\n const effectiveHostProps = mergeHostProps(\n withForwardedDefaults,\n hostProps ?? {},\n );\n return applyHostPropsToChildren(children, effectiveHostProps);\n };\n\n const craftComponent = ((\n props: Props & HostProps = {} as Props & HostProps,\n ): ComponentNode<Props & HostProps, ComponentDeps> => {\n const node = {\n kind: 'component',\n component: craftComponent as unknown as CraftComponent<\n any,\n ComponentDeps\n >,\n props,\n declarationContext: currentCraftRenderContext(),\n } as unknown as ComponentNode<Props & HostProps, ComponentDeps>;\n if ('key' in props) {\n Object.defineProperty(node, 'key', {\n configurable: false,\n enumerable: false,\n get: () => (props as Record<string, unknown>)['key'],\n });\n }\n Object.defineProperty(node, 'pipe', {\n value: (directive: unknown) => pipeCraftNode(node, directive as never),\n enumerable: false,\n });\n return node;\n }) as unknown as CraftComponent<\n Props,\n ComponentDeps,\n Factory,\n Meta,\n Factory,\n TemplateDependencies<Template>,\n Template,\n Name,\n ComponentInitializationExceptionCodesForTemplate<\n Factory,\n ProvidersFromMeta<Meta>,\n Template\n >,\n ContentRequirementsOfContext<FactoryContext<Factory>>,\n ComponentResidualFieldExceptions<Factory, Template>\n >;\n\n const scopeDefinition = definition.scopeDefinition ?? {};\n const styleOwners = definition.styleOwners.map((owner, index) =>\n index === 0 && !owner.definition\n ? { ...owner, definition: scopeDefinition }\n : owner,\n );\n\n Object.defineProperty(craftComponent, CRAFT_COMPONENT, {\n value: {\n ...definition,\n template: hostAwareTemplate,\n scopeDefinition,\n styleOwners,\n },\n enumerable: false,\n });\n\n Object.defineProperty(craftComponent, CRAFT_REGISTRATION_TARGET, {\n value: { kind: 'component', name: definition.name },\n enumerable: false,\n });\n\n Object.defineProperty(craftComponent, 'pipe', {\n value: (\n ...directives: {\n readonly [CRAFT_DIRECTIVE]?: {\n readonly name: string;\n readonly meta: {\n readonly styles?: string | readonly string[];\n readonly stylesUrl?: string | readonly string[];\n };\n readonly logic: (baseLogic: ComponentFactory) => ComponentFactory;\n readonly template: (\n baseTemplate: ComponentTemplate<any>,\n ) => ComponentTemplate<any>;\n readonly componentOperator?: ComponentCompositionDefinition;\n };\n (...args: any[]): unknown;\n }[]\n ) =>\n directives.reduce<unknown>((current, directive) => {\n const currentComponent = current as CraftComponent<any>;\n const resolvedDirective = (\n CRAFT_DIRECTIVE in directive ? directive : directive(currentComponent)\n ) as {\n readonly [CRAFT_DIRECTIVE]: {\n readonly name: string;\n readonly meta: {\n readonly styles?: string | readonly string[];\n readonly stylesUrl?: string | readonly string[];\n };\n readonly logic: (baseLogic: ComponentFactory) => ComponentFactory;\n readonly template: (\n baseTemplate: ComponentTemplate<any>,\n ) => ComponentTemplate<any>;\n readonly componentOperator?: ComponentCompositionDefinition;\n };\n };\n const currentDefinition = currentComponent[CRAFT_COMPONENT];\n const currentTemplate = currentDefinition.template;\n return createCraftComponent<any, any, any, any>({\n name: currentDefinition.name,\n meta: currentDefinition.meta,\n factory: resolvedDirective[CRAFT_DIRECTIVE].logic(\n currentDefinition.factory,\n ),\n template:\n resolvedDirective[CRAFT_DIRECTIVE].template(currentTemplate),\n styleOwners: [\n ...currentDefinition.styleOwners,\n {\n name: resolvedDirective[CRAFT_DIRECTIVE].name,\n styles: mergeStyles(\n resolvedDirective[CRAFT_DIRECTIVE].meta.styles,\n resolvedDirective[CRAFT_DIRECTIVE].meta.stylesUrl,\n ),\n definition: resolvedDirective[CRAFT_DIRECTIVE],\n registrationTarget: resolvedDirective,\n },\n ],\n scopeDefinition: currentDefinition.scopeDefinition,\n composition: mergeComponentComposition(\n currentDefinition.composition,\n resolvedDirective[CRAFT_DIRECTIVE].componentOperator,\n ),\n });\n }, craftComponent),\n enumerable: false,\n });\n\n return craftComponent;\n}\n\nfunction mergeComponentComposition(\n existing: ComponentCompositionDefinition | undefined,\n next: ComponentCompositionDefinition | undefined,\n): ComponentCompositionDefinition | undefined {\n if (!existing && !next) {\n return undefined;\n }\n\n const providers = [\n ...(existing?.providers ?? []),\n ...(next?.providers ?? []),\n ];\n const catchHandlers = next?.catchHandlers ?? existing?.catchHandlers;\n const catchTagHandlers = next?.catchTagHandlers ?? existing?.catchTagHandlers;\n const catchBlockPosition =\n next?.catchBlockPosition ?? existing?.catchBlockPosition;\n const fieldExceptionHandlers =\n next?.fieldExceptionHandlers ?? existing?.fieldExceptionHandlers;\n const fieldExceptionOptions =\n next?.fieldExceptionOptions ?? existing?.fieldExceptionOptions;\n\n return {\n ...(providers.length ? { providers } : {}),\n ...(catchHandlers ? { catchHandlers } : {}),\n ...(catchTagHandlers ? { catchTagHandlers } : {}),\n ...(catchBlockPosition ? { catchBlockPosition } : {}),\n ...(fieldExceptionHandlers ? { fieldExceptionHandlers } : {}),\n ...(fieldExceptionOptions ? { fieldExceptionOptions } : {}),\n };\n}\n"]}
|