@craft-ts/component 0.7.0-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/package.json +36 -0
- package/src/index.d.ts +40 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +38 -0
- package/src/index.js.map +1 -0
- package/src/lib/a11y-control.d.ts +58 -0
- package/src/lib/a11y-control.d.ts.map +1 -0
- package/src/lib/a11y-control.js +74 -0
- package/src/lib/a11y-control.js.map +1 -0
- package/src/lib/a11y.d.ts +87 -0
- package/src/lib/a11y.d.ts.map +1 -0
- package/src/lib/a11y.js +96 -0
- package/src/lib/a11y.js.map +1 -0
- package/src/lib/ai/ai-context-menu.d.ts +140 -0
- package/src/lib/ai/ai-context-menu.d.ts.map +1 -0
- package/src/lib/ai/ai-context-menu.js +66 -0
- package/src/lib/ai/ai-context-menu.js.map +1 -0
- package/src/lib/ai/ai-send-dialog.d.ts +1263 -0
- package/src/lib/ai/ai-send-dialog.d.ts.map +1 -0
- package/src/lib/ai/ai-send-dialog.js +288 -0
- package/src/lib/ai/ai-send-dialog.js.map +1 -0
- package/src/lib/ai/send-context-to-ai.d.ts +29 -0
- package/src/lib/ai/send-context-to-ai.d.ts.map +1 -0
- package/src/lib/ai/send-context-to-ai.js +127 -0
- package/src/lib/ai/send-context-to-ai.js.map +1 -0
- package/src/lib/assert-defined-input.d.ts +26 -0
- package/src/lib/assert-defined-input.d.ts.map +1 -0
- package/src/lib/assert-defined-input.js +47 -0
- package/src/lib/assert-defined-input.js.map +1 -0
- package/src/lib/block.d.ts +36 -0
- package/src/lib/block.d.ts.map +1 -0
- package/src/lib/block.js +55 -0
- package/src/lib/block.js.map +1 -0
- package/src/lib/bootstrap.d.ts +32 -0
- package/src/lib/bootstrap.d.ts.map +1 -0
- package/src/lib/bootstrap.js +60 -0
- package/src/lib/bootstrap.js.map +1 -0
- package/src/lib/bridge.d.ts +56 -0
- package/src/lib/bridge.d.ts.map +1 -0
- package/src/lib/bridge.js +81 -0
- package/src/lib/bridge.js.map +1 -0
- package/src/lib/component.d.ts +46 -0
- package/src/lib/component.d.ts.map +1 -0
- package/src/lib/component.js +118 -0
- package/src/lib/component.js.map +1 -0
- package/src/lib/composition.d.ts +17 -0
- package/src/lib/composition.d.ts.map +1 -0
- package/src/lib/composition.js +28 -0
- package/src/lib/composition.js.map +1 -0
- package/src/lib/craft-defaults.d.ts +2 -0
- package/src/lib/craft-defaults.d.ts.map +1 -0
- package/src/lib/craft-defaults.js +41 -0
- package/src/lib/craft-defaults.js.map +1 -0
- package/src/lib/craft-host-tokens.d.ts +6 -0
- package/src/lib/craft-host-tokens.d.ts.map +1 -0
- package/src/lib/craft-host-tokens.js +7 -0
- package/src/lib/craft-host-tokens.js.map +1 -0
- package/src/lib/craft-router-outlet.d.ts +15 -0
- package/src/lib/craft-router-outlet.d.ts.map +1 -0
- package/src/lib/craft-router-outlet.js +10 -0
- package/src/lib/craft-router-outlet.js.map +1 -0
- package/src/lib/css-vars.d.ts +31 -0
- package/src/lib/css-vars.d.ts.map +1 -0
- package/src/lib/css-vars.js +43 -0
- package/src/lib/css-vars.js.map +1 -0
- package/src/lib/css-vars.type.d.ts +151 -0
- package/src/lib/css-vars.type.d.ts.map +1 -0
- package/src/lib/css-vars.type.js +1 -0
- package/src/lib/css-vars.type.js.map +1 -0
- package/src/lib/defer.d.ts +31 -0
- package/src/lib/defer.d.ts.map +1 -0
- package/src/lib/defer.js +19 -0
- package/src/lib/defer.js.map +1 -0
- package/src/lib/directive.d.ts +9 -0
- package/src/lib/directive.d.ts.map +1 -0
- package/src/lib/directive.js +31 -0
- package/src/lib/directive.js.map +1 -0
- package/src/lib/each-scheduling.d.ts +59 -0
- package/src/lib/each-scheduling.d.ts.map +1 -0
- package/src/lib/each-scheduling.js +120 -0
- package/src/lib/each-scheduling.js.map +1 -0
- package/src/lib/each.d.ts +29 -0
- package/src/lib/each.d.ts.map +1 -0
- package/src/lib/each.js +23 -0
- package/src/lib/each.js.map +1 -0
- package/src/lib/factory-runtime.d.ts +5 -0
- package/src/lib/factory-runtime.d.ts.map +1 -0
- package/src/lib/factory-runtime.js +26 -0
- package/src/lib/factory-runtime.js.map +1 -0
- package/src/lib/field-exception-block.d.ts +96 -0
- package/src/lib/field-exception-block.d.ts.map +1 -0
- package/src/lib/field-exception-block.js +44 -0
- package/src/lib/field-exception-block.js.map +1 -0
- package/src/lib/host-runtime.d.ts +60 -0
- package/src/lib/host-runtime.d.ts.map +1 -0
- package/src/lib/host-runtime.js +16 -0
- package/src/lib/host-runtime.js.map +1 -0
- package/src/lib/hydrate.d.ts +15 -0
- package/src/lib/hydrate.d.ts.map +1 -0
- package/src/lib/hydrate.js +79 -0
- package/src/lib/hydrate.js.map +1 -0
- package/src/lib/hyperscript.d.ts +148 -0
- package/src/lib/hyperscript.d.ts.map +1 -0
- package/src/lib/hyperscript.js +96 -0
- package/src/lib/hyperscript.js.map +1 -0
- package/src/lib/if-block.d.ts +8 -0
- package/src/lib/if-block.d.ts.map +1 -0
- package/src/lib/if-block.js +16 -0
- package/src/lib/if-block.js.map +1 -0
- package/src/lib/locator.d.ts +170 -0
- package/src/lib/locator.d.ts.map +1 -0
- package/src/lib/locator.js +151 -0
- package/src/lib/locator.js.map +1 -0
- package/src/lib/match-block.d.ts +38 -0
- package/src/lib/match-block.d.ts.map +1 -0
- package/src/lib/match-block.js +29 -0
- package/src/lib/match-block.js.map +1 -0
- package/src/lib/pending-block.d.ts +125 -0
- package/src/lib/pending-block.d.ts.map +1 -0
- package/src/lib/pending-block.js +48 -0
- package/src/lib/pending-block.js.map +1 -0
- package/src/lib/project.d.ts +19 -0
- package/src/lib/project.d.ts.map +1 -0
- package/src/lib/project.js +56 -0
- package/src/lib/project.js.map +1 -0
- package/src/lib/render/hydration-metadata.d.ts +3 -0
- package/src/lib/render/hydration-metadata.d.ts.map +1 -0
- package/src/lib/render/hydration-metadata.js +8 -0
- package/src/lib/render/hydration-metadata.js.map +1 -0
- package/src/lib/render/hydration.d.ts +24 -0
- package/src/lib/render/hydration.d.ts.map +1 -0
- package/src/lib/render/hydration.js +181 -0
- package/src/lib/render/hydration.js.map +1 -0
- package/src/lib/render/interpreter.d.ts +32 -0
- package/src/lib/render/interpreter.d.ts.map +1 -0
- package/src/lib/render/interpreter.js +3588 -0
- package/src/lib/render/interpreter.js.map +1 -0
- package/src/lib/render/server-style-collector.d.ts +6 -0
- package/src/lib/render/server-style-collector.d.ts.map +1 -0
- package/src/lib/render/server-style-collector.js +23 -0
- package/src/lib/render/server-style-collector.js.map +1 -0
- package/src/lib/render/ssr-coordinator.d.ts +20 -0
- package/src/lib/render/ssr-coordinator.d.ts.map +1 -0
- package/src/lib/render/ssr-coordinator.js +99 -0
- package/src/lib/render/ssr-coordinator.js.map +1 -0
- package/src/lib/render/string-dom.d.ts +9 -0
- package/src/lib/render/string-dom.d.ts.map +1 -0
- package/src/lib/render/string-dom.js +377 -0
- package/src/lib/render/string-dom.js.map +1 -0
- package/src/lib/render/style-registry.d.ts +14 -0
- package/src/lib/render/style-registry.d.ts.map +1 -0
- package/src/lib/render/style-registry.js +79 -0
- package/src/lib/render/style-registry.js.map +1 -0
- package/src/lib/render/style-scope.d.ts +30 -0
- package/src/lib/render/style-scope.d.ts.map +1 -0
- package/src/lib/render/style-scope.js +261 -0
- package/src/lib/render/style-scope.js.map +1 -0
- package/src/lib/render/vnode.d.ts +330 -0
- package/src/lib/render/vnode.d.ts.map +1 -0
- package/src/lib/render/vnode.js +293 -0
- package/src/lib/render/vnode.js.map +1 -0
- package/src/lib/server-render.d.ts +34 -0
- package/src/lib/server-render.d.ts.map +1 -0
- package/src/lib/server-render.js +84 -0
- package/src/lib/server-render.js.map +1 -0
- package/src/lib/start.d.ts +13 -0
- package/src/lib/start.d.ts.map +1 -0
- package/src/lib/start.js +20 -0
- package/src/lib/start.js.map +1 -0
- package/src/lib/template-contract.d.ts +347 -0
- package/src/lib/template-contract.d.ts.map +1 -0
- package/src/lib/template-contract.js +1 -0
- package/src/lib/template-contract.js.map +1 -0
- package/src/lib/template.d.ts +11 -0
- package/src/lib/template.d.ts.map +1 -0
- package/src/lib/template.js +21 -0
- package/src/lib/template.js.map +1 -0
- package/src/lib/testing.d.ts +157 -0
- package/src/lib/testing.d.ts.map +1 -0
- package/src/lib/testing.js +416 -0
- package/src/lib/testing.js.map +1 -0
- package/src/lib/types.d.ts +442 -0
- package/src/lib/types.d.ts.map +1 -0
- package/src/lib/types.js +22 -0
- package/src/lib/types.js.map +1 -0
- package/testing/public-api.d.ts +3 -0
- package/testing/public-api.d.ts.map +1 -0
- package/testing/public-api.js +3 -0
- package/testing/public-api.js.map +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CraftDirective } from './types';
|
|
2
|
+
export type EachScheduleStrategy = 'sync' | 'frame';
|
|
3
|
+
export interface EachScheduleOptions {
|
|
4
|
+
readonly enabled?: boolean;
|
|
5
|
+
readonly strategy?: EachScheduleStrategy;
|
|
6
|
+
readonly frameBudgetMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface EachSchedulePolicy {
|
|
9
|
+
readonly enabled: boolean;
|
|
10
|
+
readonly strategy: EachScheduleStrategy;
|
|
11
|
+
readonly frameBudgetMs: number;
|
|
12
|
+
}
|
|
13
|
+
export declare const SCHEDULE_EACH_DIRECTIVE: unique symbol;
|
|
14
|
+
export type ScheduleEachDirective<Policy extends EachSchedulePolicy = EachSchedulePolicy> = CraftDirective & {
|
|
15
|
+
readonly [SCHEDULE_EACH_DIRECTIVE]: Policy;
|
|
16
|
+
};
|
|
17
|
+
type NormalizedPolicy<Options extends EachScheduleOptions> = {
|
|
18
|
+
readonly enabled: Options['enabled'] extends false ? false : true;
|
|
19
|
+
readonly strategy: Options['strategy'] extends EachScheduleStrategy ? Options['strategy'] : 'frame';
|
|
20
|
+
readonly frameBudgetMs: Options['frameBudgetMs'] extends number ? Options['frameBudgetMs'] : 4;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Adds progressive rendering metadata to an `each` block.
|
|
24
|
+
*
|
|
25
|
+
* This is registered through the normal Craft directive factory so it remains
|
|
26
|
+
* part of the directive authoring model. The renderer recognizes the marker
|
|
27
|
+
* before the generic directive path, so its identity does not imply a DOM
|
|
28
|
+
* wrapper or a CraftDirectiveRenderedNode.
|
|
29
|
+
*/
|
|
30
|
+
export declare function scheduleEach<const Options extends EachScheduleOptions>(options?: Options): ScheduleEachDirective<NormalizedPolicy<Options>>;
|
|
31
|
+
export interface CancelHandle {
|
|
32
|
+
cancel(): void;
|
|
33
|
+
}
|
|
34
|
+
export interface EachScheduler {
|
|
35
|
+
schedule(task: () => void): CancelHandle;
|
|
36
|
+
}
|
|
37
|
+
/** Injectable override used by deterministic tests and host integrations. */
|
|
38
|
+
export declare const EACH_SCHEDULER: import("../../../../dist/libs/core/src").InjectionToken<EachScheduler>;
|
|
39
|
+
export declare class SyncEachScheduler implements EachScheduler {
|
|
40
|
+
schedule(task: () => void): CancelHandle;
|
|
41
|
+
}
|
|
42
|
+
export declare class FrameEachScheduler implements EachScheduler {
|
|
43
|
+
private readonly queue;
|
|
44
|
+
private frame;
|
|
45
|
+
private destroyed;
|
|
46
|
+
private readonly frameBudgetMs;
|
|
47
|
+
constructor(frameBudgetMs?: number);
|
|
48
|
+
schedule(task: () => void): CancelHandle;
|
|
49
|
+
destroy(): void;
|
|
50
|
+
private requestFrame;
|
|
51
|
+
private flush;
|
|
52
|
+
private cancelFrame;
|
|
53
|
+
}
|
|
54
|
+
export declare function createEachScheduler(policy: EachSchedulePolicy): EachScheduler & {
|
|
55
|
+
destroy?(): void;
|
|
56
|
+
};
|
|
57
|
+
export declare function isScheduleEachDirective(value: unknown): value is ScheduleEachDirective;
|
|
58
|
+
export {};
|
|
59
|
+
//# sourceMappingURL=each-scheduling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"each-scheduling.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib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,CAAC,CAAC,CAsBlD;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,YAAY,CAAC;CAC1C;AAED,6EAA6E;AAC7E,eAAO,MAAM,cAAc,wEAE1B,CAAC;AAIF,qBAAa,iBAAkB,YAAW,aAAa;IACrD,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,YAAY;CAIzC;AAOD,qBAAa,kBAAmB,YAAW,aAAa;IACtD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,KAAK,CAAqD;IAClE,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,aAAa,SAAI;IAI7B,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,YAAY;IAaxC,OAAO,IAAI,IAAI;IASf,OAAO,CAAC,YAAY;IAoBpB,OAAO,CAAC,KAAK;IAWb,OAAO,CAAC,WAAW;CAOpB;AAQD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,GACzB,aAAa,GAAG;IAAE,OAAO,CAAC,IAAI,IAAI,CAAA;CAAE,CAKtC;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAMhC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { InjectionToken } from './host-runtime';
|
|
2
|
+
import { craftDirective } from './directive';
|
|
3
|
+
export const SCHEDULE_EACH_DIRECTIVE = Symbol('schedule-each-directive');
|
|
4
|
+
/**
|
|
5
|
+
* Adds progressive rendering metadata to an `each` block.
|
|
6
|
+
*
|
|
7
|
+
* This is registered through the normal Craft directive factory so it remains
|
|
8
|
+
* part of the directive authoring model. The renderer recognizes the marker
|
|
9
|
+
* before the generic directive path, so its identity does not imply a DOM
|
|
10
|
+
* wrapper or a CraftDirectiveRenderedNode.
|
|
11
|
+
*/
|
|
12
|
+
export function scheduleEach(options = {}) {
|
|
13
|
+
const frameBudgetMs = typeof options.frameBudgetMs === 'number' && options.frameBudgetMs > 0
|
|
14
|
+
? options.frameBudgetMs
|
|
15
|
+
: 4;
|
|
16
|
+
const policy = {
|
|
17
|
+
enabled: options.enabled !== false,
|
|
18
|
+
strategy: options.strategy ?? 'frame',
|
|
19
|
+
frameBudgetMs,
|
|
20
|
+
};
|
|
21
|
+
const directive = craftDirective('scheduleEach', {}, (baseLogic) => baseLogic, (baseTemplate) => baseTemplate);
|
|
22
|
+
Object.defineProperty(directive, SCHEDULE_EACH_DIRECTIVE, {
|
|
23
|
+
value: Object.freeze(policy),
|
|
24
|
+
enumerable: false,
|
|
25
|
+
});
|
|
26
|
+
return directive;
|
|
27
|
+
}
|
|
28
|
+
/** Injectable override used by deterministic tests and host integrations. */
|
|
29
|
+
export const EACH_SCHEDULER = new InjectionToken('EACH_SCHEDULER');
|
|
30
|
+
const NOOP_CANCEL = { cancel: () => undefined };
|
|
31
|
+
export class SyncEachScheduler {
|
|
32
|
+
schedule(task) {
|
|
33
|
+
task();
|
|
34
|
+
return NOOP_CANCEL;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class FrameEachScheduler {
|
|
38
|
+
queue = [];
|
|
39
|
+
frame;
|
|
40
|
+
destroyed = false;
|
|
41
|
+
frameBudgetMs;
|
|
42
|
+
constructor(frameBudgetMs = 4) {
|
|
43
|
+
this.frameBudgetMs = frameBudgetMs;
|
|
44
|
+
}
|
|
45
|
+
schedule(task) {
|
|
46
|
+
if (this.destroyed)
|
|
47
|
+
return NOOP_CANCEL;
|
|
48
|
+
const queued = { task, cancelled: false };
|
|
49
|
+
this.queue.push(queued);
|
|
50
|
+
this.requestFrame();
|
|
51
|
+
return {
|
|
52
|
+
cancel: () => {
|
|
53
|
+
queued.cancelled = true;
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
destroy() {
|
|
58
|
+
this.destroyed = true;
|
|
59
|
+
this.queue.length = 0;
|
|
60
|
+
if (this.frame !== undefined) {
|
|
61
|
+
this.cancelFrame(this.frame);
|
|
62
|
+
this.frame = undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
requestFrame() {
|
|
66
|
+
if (this.frame !== undefined || this.destroyed || this.queue.length === 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const request = globalThis.requestAnimationFrame;
|
|
70
|
+
if (typeof request === 'function') {
|
|
71
|
+
this.frame = request(() => {
|
|
72
|
+
this.frame = undefined;
|
|
73
|
+
this.flush();
|
|
74
|
+
});
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.frame = globalThis.setTimeout(() => {
|
|
78
|
+
this.frame = undefined;
|
|
79
|
+
this.flush();
|
|
80
|
+
}, 16);
|
|
81
|
+
}
|
|
82
|
+
flush() {
|
|
83
|
+
const started = now();
|
|
84
|
+
while (this.queue.length > 0) {
|
|
85
|
+
const queued = this.queue.shift();
|
|
86
|
+
if (!queued)
|
|
87
|
+
break;
|
|
88
|
+
if (!queued.cancelled)
|
|
89
|
+
queued.task();
|
|
90
|
+
if (now() - started >= this.frameBudgetMs)
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
this.requestFrame();
|
|
94
|
+
}
|
|
95
|
+
cancelFrame(frame) {
|
|
96
|
+
if (typeof globalThis.cancelAnimationFrame === 'function') {
|
|
97
|
+
globalThis.cancelAnimationFrame(frame);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
globalThis.clearTimeout(frame);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function now() {
|
|
105
|
+
return typeof globalThis.performance?.now === 'function'
|
|
106
|
+
? globalThis.performance.now()
|
|
107
|
+
: Date.now();
|
|
108
|
+
}
|
|
109
|
+
export function createEachScheduler(policy) {
|
|
110
|
+
if (!policy.enabled || policy.strategy === 'sync') {
|
|
111
|
+
return new SyncEachScheduler();
|
|
112
|
+
}
|
|
113
|
+
return new FrameEachScheduler(policy.frameBudgetMs);
|
|
114
|
+
}
|
|
115
|
+
export function isScheduleEachDirective(value) {
|
|
116
|
+
return ((typeof value === 'function' ||
|
|
117
|
+
(typeof value === 'object' && value !== null)) &&
|
|
118
|
+
SCHEDULE_EACH_DIRECTIVE in value);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=each-scheduling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"each-scheduling.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/each-scheduling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAiB7C,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,yBAAyB,CAAC,CAAC;AAkBzE;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAC1B,UAAmB,EAAa;IAEhC,MAAM,aAAa,GACjB,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ,IAAI,OAAO,CAAC,aAAa,GAAG,CAAC;QACpE,CAAC,CAAC,OAAO,CAAC,aAAa;QACvB,CAAC,CAAC,CAAC,CAAC;IACR,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,OAAO,CAAC,OAAO,KAAK,KAAK;QAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO;QACrC,aAAa;KACe,CAAC;IAE/B,MAAM,SAAS,GAAG,cAAc,CAC9B,cAAc,EACd,EAAE,EACF,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EACxB,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CACqB,CAAC;IACtD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,uBAAuB,EAAE;QACxD,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAA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,UAAU,CAAC,YAAY,CAAC,KAAsC,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF;AAED,SAAS,GAAG;IACV,OAAO,OAAO,UAAU,CAAC,WAAW,EAAE,GAAG,KAAK,UAAU;QACtD,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,EAAE;QAC9B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,MAA0B;IAE1B,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;QAClD,OAAO,IAAI,iBAAiB,EAAE,CAAC;IACjC,CAAC;IACD,OAAO,IAAI,kBAAkB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAc;IAEd,OAAO,CACL,CAAC,OAAO,KAAK,KAAK,UAAU;QAC1B,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC;QAChD,uBAAuB,IAAI,KAAK,CACjC,CAAC;AACJ,CAAC","sourcesContent":["import { InjectionToken } from './host-runtime';\nimport { craftDirective } from './directive';\nimport type { CraftDirective } from './types';\n\nexport type EachScheduleStrategy = 'sync' | 'frame';\n\nexport interface EachScheduleOptions {\n readonly enabled?: boolean;\n readonly strategy?: EachScheduleStrategy;\n readonly frameBudgetMs?: number;\n}\n\nexport interface EachSchedulePolicy {\n readonly enabled: boolean;\n readonly strategy: EachScheduleStrategy;\n readonly frameBudgetMs: number;\n}\n\nexport const SCHEDULE_EACH_DIRECTIVE = Symbol('schedule-each-directive');\n\nexport type ScheduleEachDirective<\n Policy extends EachSchedulePolicy = EachSchedulePolicy,\n> = CraftDirective & {\n readonly [SCHEDULE_EACH_DIRECTIVE]: Policy;\n};\n\ntype NormalizedPolicy<Options extends EachScheduleOptions> = {\n readonly enabled: Options['enabled'] extends false ? false : true;\n readonly strategy: Options['strategy'] extends EachScheduleStrategy\n ? Options['strategy']\n : 'frame';\n readonly frameBudgetMs: Options['frameBudgetMs'] extends number\n ? Options['frameBudgetMs']\n : 4;\n};\n\n/**\n * Adds progressive rendering metadata to an `each` block.\n *\n * This is registered through the normal Craft directive factory so it remains\n * part of the directive authoring model. The renderer recognizes the marker\n * before the generic directive path, so its identity does not imply a DOM\n * wrapper or a CraftDirectiveRenderedNode.\n */\nexport function scheduleEach<const Options extends EachScheduleOptions>(\n options: Options = {} as Options,\n): ScheduleEachDirective<NormalizedPolicy<Options>> {\n const frameBudgetMs =\n typeof options.frameBudgetMs === 'number' && options.frameBudgetMs > 0\n ? options.frameBudgetMs\n : 4;\n const policy = {\n enabled: options.enabled !== false,\n strategy: options.strategy ?? 'frame',\n frameBudgetMs,\n } as NormalizedPolicy<Options>;\n\n const directive = craftDirective(\n 'scheduleEach',\n {},\n (baseLogic) => baseLogic,\n (baseTemplate) => baseTemplate,\n ) as ScheduleEachDirective<NormalizedPolicy<Options>>;\n Object.defineProperty(directive, SCHEDULE_EACH_DIRECTIVE, {\n value: Object.freeze(policy),\n enumerable: false,\n });\n return directive;\n}\n\nexport interface CancelHandle {\n cancel(): void;\n}\n\nexport interface EachScheduler {\n schedule(task: () => void): CancelHandle;\n}\n\n/** Injectable override used by deterministic tests and host integrations. */\nexport const EACH_SCHEDULER = new InjectionToken<EachScheduler>(\n 'EACH_SCHEDULER',\n);\n\nconst NOOP_CANCEL: CancelHandle = { cancel: () => undefined };\n\nexport class SyncEachScheduler implements EachScheduler {\n schedule(task: () => void): CancelHandle {\n task();\n return NOOP_CANCEL;\n }\n}\n\ntype QueuedTask = {\n readonly task: () => void;\n cancelled: boolean;\n};\n\nexport class FrameEachScheduler implements EachScheduler {\n private readonly queue: QueuedTask[] = [];\n private frame: number | ReturnType<typeof setTimeout> | undefined;\n private destroyed = false;\n private readonly frameBudgetMs: number;\n\n constructor(frameBudgetMs = 4) {\n this.frameBudgetMs = frameBudgetMs;\n }\n\n schedule(task: () => void): CancelHandle {\n if (this.destroyed) return NOOP_CANCEL;\n\n const queued: QueuedTask = { task, cancelled: false };\n this.queue.push(queued);\n this.requestFrame();\n return {\n cancel: () => {\n queued.cancelled = true;\n },\n };\n }\n\n destroy(): void {\n this.destroyed = true;\n this.queue.length = 0;\n if (this.frame !== undefined) {\n this.cancelFrame(this.frame);\n this.frame = undefined;\n }\n }\n\n private requestFrame(): void {\n if (this.frame !== undefined || this.destroyed || this.queue.length === 0) {\n return;\n }\n\n const request = globalThis.requestAnimationFrame;\n if (typeof request === 'function') {\n this.frame = request(() => {\n this.frame = undefined;\n this.flush();\n });\n return;\n }\n\n this.frame = globalThis.setTimeout(() => {\n this.frame = undefined;\n this.flush();\n }, 16);\n }\n\n private flush(): void {\n const started = now();\n while (this.queue.length > 0) {\n const queued = this.queue.shift();\n if (!queued) break;\n if (!queued.cancelled) queued.task();\n if (now() - started >= this.frameBudgetMs) break;\n }\n this.requestFrame();\n }\n\n private cancelFrame(frame: number | ReturnType<typeof setTimeout>): void {\n if (typeof globalThis.cancelAnimationFrame === 'function') {\n globalThis.cancelAnimationFrame(frame as number);\n } else {\n globalThis.clearTimeout(frame as ReturnType<typeof setTimeout>);\n }\n }\n}\n\nfunction now(): number {\n return typeof globalThis.performance?.now === 'function'\n ? globalThis.performance.now()\n : Date.now();\n}\n\nexport function createEachScheduler(\n policy: EachSchedulePolicy,\n): EachScheduler & { destroy?(): void } {\n if (!policy.enabled || policy.strategy === 'sync') {\n return new SyncEachScheduler();\n }\n return new FrameEachScheduler(policy.frameBudgetMs);\n}\n\nexport function isScheduleEachDirective(\n value: unknown,\n): value is ScheduleEachDirective {\n return (\n (typeof value === 'function' ||\n (typeof value === 'object' && value !== null)) &&\n SCHEDULE_EACH_DIRECTIVE in value\n );\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CraftNodeChildrenDependencies, CraftNodeChildren, EachNode } from './render/vnode';
|
|
2
|
+
import type { InputValue } from './types';
|
|
3
|
+
import { YIELDABLE_VALUE } from '@craft-ts/core';
|
|
4
|
+
export interface EachOptions<Item, Key> {
|
|
5
|
+
readonly track: (item: Item, index: number) => Key;
|
|
6
|
+
readonly empty?: () => CraftNodeChildren;
|
|
7
|
+
}
|
|
8
|
+
type CallbackDependencies<Callback> = Callback extends (...args: any[]) => infer Output ? CraftNodeChildrenDependencies<Output> : {};
|
|
9
|
+
type EmptyDependencies<Options> = Options extends {
|
|
10
|
+
readonly empty?: infer Empty;
|
|
11
|
+
} ? CallbackDependencies<NonNullable<Empty>> : {};
|
|
12
|
+
type SourceName<Source> = Source extends {
|
|
13
|
+
readonly [YIELDABLE_VALUE]: infer Name extends string;
|
|
14
|
+
} ? Name : undefined;
|
|
15
|
+
type EachSource = readonly unknown[] | null | undefined | (() => readonly unknown[] | null | undefined) | Generator<unknown, readonly unknown[] | null | undefined, unknown> | (() => Generator<unknown, readonly unknown[] | null | undefined, unknown>);
|
|
16
|
+
type EachItemFromValue<Value> = [NonNullable<Value>] extends [never] ? never : NonNullable<Value> extends (...args: any[]) => infer Result ? EachItemFromValue<Result> : NonNullable<Value> extends Generator<any, infer Result, any> ? EachItemFromValue<Result> : NonNullable<Value> extends readonly (infer Item)[] ? Item : never;
|
|
17
|
+
type EachItem<Source> = [NonNullable<Source>] extends [never] ? unknown : EachItemFromValue<Source>;
|
|
18
|
+
type EachItemInput<Source> = InputValue<EachItem<Source>>;
|
|
19
|
+
export declare function each<Name extends string, Source extends EachSource, Key, Options extends EachOptions<NoInfer<EachItem<Source>>, Key>, ItemTemplate extends (item: NoInfer<EachItemInput<Source>>, index: number) => CraftNodeChildren>(source: Source & {
|
|
20
|
+
readonly [YIELDABLE_VALUE]: Name;
|
|
21
|
+
}, options: Options, itemTemplate: ItemTemplate): EachNode<EachItem<Source>, Key, CallbackDependencies<ItemTemplate> | EmptyDependencies<Options>, Name, ReturnType<ItemTemplate>, Options extends {
|
|
22
|
+
readonly empty?: (...args: any[]) => infer Empty;
|
|
23
|
+
} ? Empty : never>;
|
|
24
|
+
export declare function each<Source extends EachSource, Key, Options extends EachOptions<NoInfer<EachItem<Source>>, Key>, ItemTemplate extends (item: NoInfer<EachItemInput<Source>>, index: number) => CraftNodeChildren>(source: Source & EachSource, options: Options, itemTemplate: ItemTemplate): EachNode<EachItem<Source>, Key, CallbackDependencies<ItemTemplate> | EmptyDependencies<Options>, SourceName<Source>, ReturnType<ItemTemplate>, Options extends {
|
|
25
|
+
readonly empty?: (...args: any[]) => infer Empty;
|
|
26
|
+
} ? Empty : never>;
|
|
27
|
+
export type { ScheduleEachDirective } from './each-scheduling';
|
|
28
|
+
export { EACH_SCHEDULER, FrameEachScheduler, SyncEachScheduler, createEachScheduler, scheduleEach, } from './each-scheduling';
|
|
29
|
+
//# sourceMappingURL=each.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"each.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/each.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,iBAAiB,EACjB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,GAAG;IACpC,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;IACnD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,iBAAiB,CAAC;CAC1C;AAED,KAAK,oBAAoB,CAAC,QAAQ,IAAI,QAAQ,SAAS,CACrD,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,MAAM,GACb,6BAA6B,CAAC,MAAM,CAAC,GACrC,EAAE,CAAC;AAEP,KAAK,iBAAiB,CAAC,OAAO,IAAI,OAAO,SAA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,GAAG,EACH,oBAAoB,CAAC,YAAY,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,EAC/D,UAAU,CAAC,MAAM,CAAC,EAClB,UAAU,CAAC,YAAY,CAAC,EACxB,OAAO,SAAS;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,KAAK,CAAA;CAAE,GAChE,KAAK,GACL,KAAK,CACV,CAAC;AAqEF,YAAY,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAmB,CAAC"}
|
package/src/lib/each.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { pipeCraftNode } from './render/vnode';
|
|
2
|
+
import { YIELDABLE_VALUE } from '@craft-ts/core';
|
|
3
|
+
export function each(source, options, itemTemplate) {
|
|
4
|
+
const sourceName = typeof source === 'function' &&
|
|
5
|
+
typeof source[YIELDABLE_VALUE] === 'string'
|
|
6
|
+
? source[YIELDABLE_VALUE]
|
|
7
|
+
: undefined;
|
|
8
|
+
const node = {
|
|
9
|
+
kind: 'each',
|
|
10
|
+
source: source,
|
|
11
|
+
sourceName: sourceName,
|
|
12
|
+
track: options.track,
|
|
13
|
+
empty: options.empty,
|
|
14
|
+
itemTemplate: itemTemplate,
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(node, 'pipe', {
|
|
17
|
+
value: (directive) => pipeCraftNode(node, directive),
|
|
18
|
+
enumerable: false,
|
|
19
|
+
});
|
|
20
|
+
return node;
|
|
21
|
+
}
|
|
22
|
+
export { EACH_SCHEDULER, FrameEachScheduler, SyncEachScheduler, createEachScheduler, scheduleEach, } from './each-scheduling';
|
|
23
|
+
//# sourceMappingURL=each.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"each.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/each.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAgGjD,MAAM,UAAU,IAAI,CASlB,MAA2B,EAC3B,OAAgB,EAChB,YAA0B;IAW1B,MAAM,UAAU,GACd,OAAO,MAAM,KAAK,UAAU;QAC5B,OAAQ,MAAmD,CACzD,eAAe,CAChB,KAAK,QAAQ;QACZ,CAAC,CAAE,MAA4D,CAC3D,eAAe,CAChB;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,IAAI,GAAG;QACX,IAAI,EAAE,MAAe;QACrB,MAAM,EAAE,MAAmD;QAC3D,UAAU,EAAE,UAA4C;QACxD,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAMF;QACb,YAAY,EAAE,YAGe;KAC9B,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;QAClC,KAAK,EAAE,CAAC,SAAkB,EAAE,EAAE,CAC5B,aAAa,CAAC,IAA2B,EAAE,SAAkB,CAAC;QAChE,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IAEH,OAAO,IASN,CAAC;AACJ,CAAC;AAGD,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,mBAAmB,CAAC","sourcesContent":["import type {\n CraftNodeChildrenDependencies,\n CraftNodeChildren,\n EachNode,\n} from './render/vnode';\nimport { pipeCraftNode } from './render/vnode';\nimport type { InputValue } from './types';\nimport { YIELDABLE_VALUE } from '@craft-ts/core';\n\nexport interface EachOptions<Item, Key> {\n readonly track: (item: Item, index: number) => Key;\n readonly empty?: () => CraftNodeChildren;\n}\n\ntype CallbackDependencies<Callback> = Callback extends (\n ...args: any[]\n) => infer Output\n ? CraftNodeChildrenDependencies<Output>\n : {};\n\ntype EmptyDependencies<Options> = Options extends {\n readonly empty?: infer Empty;\n}\n ? CallbackDependencies<NonNullable<Empty>>\n : {};\n\ntype SourceName<Source> = Source extends {\n readonly [YIELDABLE_VALUE]: infer Name extends string;\n}\n ? Name\n : undefined;\n\ntype EachSource =\n | readonly unknown[]\n | null\n | undefined\n | (() => readonly unknown[] | null | undefined)\n | Generator<unknown, readonly unknown[] | null | undefined, unknown>\n | (() => Generator<unknown, readonly unknown[] | null | undefined, unknown>);\n\ntype EachItemFromValue<Value> = [NonNullable<Value>] extends [never]\n ? never\n : NonNullable<Value> extends (...args: any[]) => infer Result\n ? EachItemFromValue<Result>\n : NonNullable<Value> extends Generator<any, infer Result, any>\n ? EachItemFromValue<Result>\n : NonNullable<Value> extends readonly (infer Item)[]\n ? Item\n : never;\n\ntype EachItem<Source> = [NonNullable<Source>] extends [never]\n ? unknown\n : EachItemFromValue<Source>;\n\ntype EachItemInput<Source> = InputValue<EachItem<Source>>;\n\nexport function each<\n Name extends string,\n Source extends EachSource,\n Key,\n Options extends EachOptions<NoInfer<EachItem<Source>>, Key>,\n ItemTemplate extends (\n item: NoInfer<EachItemInput<Source>>,\n index: number,\n ) => CraftNodeChildren,\n>(\n source: Source & { readonly [YIELDABLE_VALUE]: Name },\n options: Options,\n itemTemplate: ItemTemplate,\n): EachNode<\n EachItem<Source>,\n Key,\n CallbackDependencies<ItemTemplate> | EmptyDependencies<Options>,\n Name,\n ReturnType<ItemTemplate>,\n Options extends { readonly empty?: (...args: any[]) => infer Empty }\n ? Empty\n : never\n>;\n\nexport function each<\n Source extends EachSource,\n Key,\n Options extends EachOptions<NoInfer<EachItem<Source>>, Key>,\n ItemTemplate extends (\n item: NoInfer<EachItemInput<Source>>,\n index: number,\n ) => CraftNodeChildren,\n>(\n source: Source & EachSource,\n options: Options,\n itemTemplate: ItemTemplate,\n): EachNode<\n EachItem<Source>,\n Key,\n CallbackDependencies<ItemTemplate> | EmptyDependencies<Options>,\n SourceName<Source>,\n ReturnType<ItemTemplate>,\n Options extends { readonly empty?: (...args: any[]) => infer Empty }\n ? Empty\n : never\n>;\n\nexport function each<\n Source extends EachSource,\n Key,\n Options extends EachOptions<EachItem<Source>, Key>,\n ItemTemplate extends (\n item: EachItemInput<Source>,\n index: number,\n ) => CraftNodeChildren,\n>(\n source: Source & EachSource,\n options: Options,\n itemTemplate: ItemTemplate,\n): EachNode<\n EachItem<Source>,\n Key,\n CallbackDependencies<ItemTemplate> | EmptyDependencies<Options>,\n SourceName<Source>,\n ReturnType<ItemTemplate>,\n Options extends { readonly empty?: (...args: any[]) => infer Empty }\n ? Empty\n : never\n> {\n const sourceName =\n typeof source === 'function' &&\n typeof (source as { readonly [YIELDABLE_VALUE]?: unknown })[\n YIELDABLE_VALUE\n ] === 'string'\n ? (source as unknown as { readonly [YIELDABLE_VALUE]: string })[\n YIELDABLE_VALUE\n ]\n : undefined;\n\n const node = {\n kind: 'each' as const,\n source: source as EachNode<EachItem<Source>, Key>['source'],\n sourceName: sourceName as SourceName<Source> | undefined,\n track: options.track,\n empty: options.empty as\n | (() => Options extends {\n readonly empty?: (...args: any[]) => infer Empty;\n }\n ? Empty\n : never)\n | undefined,\n itemTemplate: itemTemplate as unknown as (\n item: EachItemInput<Source>,\n index: number,\n ) => ReturnType<ItemTemplate>,\n };\n Object.defineProperty(node, 'pipe', {\n value: (directive: unknown) =>\n pipeCraftNode(node as unknown as EachNode, directive as never),\n enumerable: false,\n });\n\n return node as unknown as EachNode<\n EachItem<Source>,\n Key,\n CallbackDependencies<ItemTemplate> | EmptyDependencies<Options>,\n SourceName<Source>,\n ReturnType<ItemTemplate>,\n Options extends { readonly empty?: (...args: any[]) => infer Empty }\n ? Empty\n : never\n >;\n}\n\nexport type { ScheduleEachDirective } from './each-scheduling';\nexport {\n EACH_SCHEDULER,\n FrameEachScheduler,\n SyncEachScheduler,\n createEachScheduler,\n scheduleEach,\n} from './each-scheduling';\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type CraftInjector, type CraftProgramSettledStep, type ResolveGeneratorResult } from '@craft-ts/core';
|
|
2
|
+
import type { ComponentFactory } from './types';
|
|
3
|
+
export declare function executeCraftComponentFactory<Factory extends ComponentFactory>(factory: Factory, args: Parameters<Factory>, injector: CraftInjector | object): ResolveGeneratorResult<ReturnType<Factory>>;
|
|
4
|
+
export declare function executeCraftComponentFactoryAsync<Factory extends ComponentFactory>(factory: Factory, args: Parameters<Factory>, injector: CraftInjector | object): Promise<CraftProgramSettledStep>;
|
|
5
|
+
//# sourceMappingURL=factory-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-runtime.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/factory-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAE5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAShD,wBAAgB,4BAA4B,CAAC,OAAO,SAAS,gBAAgB,EAC3E,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,EACzB,QAAQ,EAAE,aAAa,GAAG,MAAM,GAC/B,sBAAsB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAa7C;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,SAAS,gBAAgB,EAEhC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,EACzB,QAAQ,EAAE,aAAa,GAAG,MAAM,GAC/B,OAAO,CAAC,uBAAuB,CAAC,CAWlC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { executeGeneratorCompatibleFactory, executeGeneratorCompatibleFactoryAsync, ɵcraftInjectorFromHost, } from '@craft-ts/core';
|
|
2
|
+
const INVALID_YIELD = 'craftComponent() factories can only yield craftService dependencies.';
|
|
3
|
+
const MULTIPLE_APP_START = 'craftComponent() factories cannot declare onAppStart(...) more than once.';
|
|
4
|
+
const APP_START_NOT_SUPPORTED = 'craftComponent() does not support onAppStart(...). Use onAppStart(...) only inside craftService({ appStart: true }, ...) generators.';
|
|
5
|
+
export function executeCraftComponentFactory(factory, args, injector) {
|
|
6
|
+
return ɵcraftInjectorFromHost(injector).run(() => executeGeneratorCompatibleFactory({
|
|
7
|
+
factory,
|
|
8
|
+
thisArg: undefined,
|
|
9
|
+
getInjector: () => ɵcraftInjectorFromHost(injector),
|
|
10
|
+
args,
|
|
11
|
+
invalidYieldErrorMessage: INVALID_YIELD,
|
|
12
|
+
multipleAppStartErrorMessage: MULTIPLE_APP_START,
|
|
13
|
+
onAppStartNotSupportedErrorMessage: APP_START_NOT_SUPPORTED,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
export function executeCraftComponentFactoryAsync(factory, args, injector) {
|
|
17
|
+
return ɵcraftInjectorFromHost(injector).run(() => executeGeneratorCompatibleFactoryAsync({
|
|
18
|
+
factory,
|
|
19
|
+
thisArg: undefined,
|
|
20
|
+
getInjector: () => ɵcraftInjectorFromHost(injector),
|
|
21
|
+
args,
|
|
22
|
+
invalidYieldErrorMessage: INVALID_YIELD,
|
|
23
|
+
appStartNotSupportedErrorMessage: APP_START_NOT_SUPPORTED,
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=factory-runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-runtime.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/factory-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,sCAAsC,EAItC,sBAAsB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,aAAa,GACjB,sEAAsE,CAAC;AACzE,MAAM,kBAAkB,GACtB,2EAA2E,CAAC;AAC9E,MAAM,uBAAuB,GAC3B,sIAAsI,CAAC;AAEzI,MAAM,UAAU,4BAA4B,CAC1C,OAAgB,EAChB,IAAyB,EACzB,QAAgC;IAEhC,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC,GAAG,CACzC,GAAG,EAAE,CACH,iCAAiC,CAAC;QAChC,OAAO;QACP,OAAO,EAAE,SAAS;QAClB,WAAW,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QACnD,IAAI;QACJ,wBAAwB,EAAE,aAAa;QACvC,4BAA4B,EAAE,kBAAkB;QAChD,kCAAkC,EAAE,uBAAuB;KAC5D,CAAgD,CACpD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iCAAiC,CAG/C,OAAgB,EAChB,IAAyB,EACzB,QAAgC;IAEhC,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAC/C,sCAAsC,CAAC;QACrC,OAAO;QACP,OAAO,EAAE,SAAS;QAChB,WAAW,EAAE,GAAG,EAAE,CAAC,sBAAsB,CAAC,QAAQ,CAAC;QACrD,IAAI;QACJ,wBAAwB,EAAE,aAAa;QACvC,gCAAgC,EAAE,uBAAuB;KAC1D,CAAC,CACH,CAAC;AACJ,CAAC","sourcesContent":["import {\n executeGeneratorCompatibleFactory,\n executeGeneratorCompatibleFactoryAsync,\n type CraftInjector,\n type CraftProgramSettledStep,\n type ResolveGeneratorResult,\n ɵcraftInjectorFromHost,\n} from '@craft-ts/core';\nimport type { ComponentFactory } from './types';\n\nconst INVALID_YIELD =\n 'craftComponent() factories can only yield craftService dependencies.';\nconst MULTIPLE_APP_START =\n 'craftComponent() factories cannot declare onAppStart(...) more than once.';\nconst APP_START_NOT_SUPPORTED =\n 'craftComponent() does not support onAppStart(...). Use onAppStart(...) only inside craftService({ appStart: true }, ...) generators.';\n\nexport function executeCraftComponentFactory<Factory extends ComponentFactory>(\n factory: Factory,\n args: Parameters<Factory>,\n injector: CraftInjector | object,\n): ResolveGeneratorResult<ReturnType<Factory>> {\n return ɵcraftInjectorFromHost(injector).run(\n () =>\n executeGeneratorCompatibleFactory({\n factory,\n thisArg: undefined,\n getInjector: () => ɵcraftInjectorFromHost(injector),\n args,\n invalidYieldErrorMessage: INVALID_YIELD,\n multipleAppStartErrorMessage: MULTIPLE_APP_START,\n onAppStartNotSupportedErrorMessage: APP_START_NOT_SUPPORTED,\n }) as ResolveGeneratorResult<ReturnType<Factory>>,\n );\n}\n\nexport function executeCraftComponentFactoryAsync<\n Factory extends ComponentFactory,\n>(\n factory: Factory,\n args: Parameters<Factory>,\n injector: CraftInjector | object,\n): Promise<CraftProgramSettledStep> {\n return ɵcraftInjectorFromHost(injector).run(() =>\n executeGeneratorCompatibleFactoryAsync({\n factory,\n thisArg: undefined,\n getInjector: () => ɵcraftInjectorFromHost(injector),\n args,\n invalidYieldErrorMessage: INVALID_YIELD,\n appStartNotSupportedErrorMessage: APP_START_NOT_SUPPORTED,\n }),\n );\n}\n"]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { AnyCraftException, CEmailException, CMaxException, CMaxLengthException, CMinException, CMinLengthException, CRequiredException, CraftField, FieldExceptionVisibility, FieldValidationCase } from '@craft-ts/core';
|
|
2
|
+
import { COMPONENT_FIELD_EXCEPTION_BLOCK, FIELD_EXCEPTION_BLOCK_DIRECTIVE, type CraftDirective } from './types';
|
|
3
|
+
import type { CraftNodeChildren, CraftNodeChildrenFieldExceptions } from './render/vnode';
|
|
4
|
+
export { FIELD_EXCEPTION_BLOCK_DIRECTIVE } from './types';
|
|
5
|
+
export type FieldExceptionBlockMode = 'first' | 'all';
|
|
6
|
+
export type FieldExceptionBlockPosition = 'before' | 'after';
|
|
7
|
+
export type FieldExceptionBlockOptions = {
|
|
8
|
+
readonly visibility?: FieldExceptionVisibility;
|
|
9
|
+
readonly mode?: FieldExceptionBlockMode;
|
|
10
|
+
readonly position?: FieldExceptionBlockPosition;
|
|
11
|
+
};
|
|
12
|
+
export type FieldExceptionHandlerContext<Field extends CraftField<any> = CraftField<any>, Path extends string = string, Exception extends AnyCraftException = AnyCraftException> = {
|
|
13
|
+
readonly field: Field;
|
|
14
|
+
readonly path: Path;
|
|
15
|
+
readonly runtimePath: ReadonlyArray<string | number>;
|
|
16
|
+
readonly validatorName: string;
|
|
17
|
+
readonly exception: Exception;
|
|
18
|
+
};
|
|
19
|
+
export type FieldExceptionHandler<Context extends FieldExceptionHandlerContext = FieldExceptionHandlerContext> = (context: Context) => CraftNodeChildren;
|
|
20
|
+
type AnyFieldExceptionHandler = (...args: any[]) => CraftNodeChildren;
|
|
21
|
+
export type FieldExceptionCodeHandlers = Readonly<Record<string, AnyFieldExceptionHandler>>;
|
|
22
|
+
export type FieldExceptionHandlers = Readonly<Record<string, AnyFieldExceptionHandler | FieldExceptionCodeHandlers>>;
|
|
23
|
+
type KnownFieldException = CRequiredException | CEmailException | CMinException | CMaxException | CMinLengthException | CMaxLengthException;
|
|
24
|
+
type KnownFieldExceptionForCode<Code extends string> = Extract<KnownFieldException, {
|
|
25
|
+
readonly _tag: Code;
|
|
26
|
+
}>;
|
|
27
|
+
type FieldExceptionForCode<Code extends string> = [
|
|
28
|
+
KnownFieldExceptionForCode<Code>
|
|
29
|
+
] extends [never] ? AnyCraftException & {
|
|
30
|
+
readonly _tag: Code;
|
|
31
|
+
} : KnownFieldExceptionForCode<Code>;
|
|
32
|
+
type LocalHandlerMap = Readonly<Record<string, AnyFieldExceptionHandler>>;
|
|
33
|
+
type GroupedHandlerMap = Readonly<Record<string, LocalHandlerMap>>;
|
|
34
|
+
type ContextualLocalHandlers<Handlers extends LocalHandlerMap> = {
|
|
35
|
+
readonly [Code in keyof Handlers]: Code extends string ? (context: FieldExceptionHandlerContext<CraftField<any>, string, FieldExceptionForCode<Code>>) => ReturnType<Handlers[Code]> : never;
|
|
36
|
+
};
|
|
37
|
+
type ContextualGroupedHandlers<Handlers extends GroupedHandlerMap> = {
|
|
38
|
+
readonly [Path in keyof Handlers]: Path extends string ? {
|
|
39
|
+
readonly [Code in keyof Handlers[Path]]: Code extends string ? (context: FieldExceptionHandlerContext<CraftField<any>, Path, FieldExceptionForCode<Code>>) => ReturnType<Handlers[Path][Code]> : never;
|
|
40
|
+
} : never;
|
|
41
|
+
};
|
|
42
|
+
export type FieldExceptionHandlerChildren<Handler> = Handler extends (...args: any[]) => infer Children ? Children : Handler extends Readonly<Record<string, infer Nested>> ? FieldExceptionHandlerChildren<Nested> : never;
|
|
43
|
+
type CaseIdentity<Case> = Case extends FieldValidationCase<infer Path, any, infer Exception> ? `${Path}.${Exception['_tag']}` : never;
|
|
44
|
+
type HandlerIdentity<Handlers> = {
|
|
45
|
+
[PathOrCode in keyof Handlers & string]: Handlers[PathOrCode] extends (...args: any[]) => any ? PathOrCode : Handlers[PathOrCode] extends Readonly<Record<string, unknown>> ? `${PathOrCode}.${keyof Handlers[PathOrCode] & string}` : never;
|
|
46
|
+
}[keyof Handlers & string];
|
|
47
|
+
/** Type-only coverage emitted by a field-exception block in a template. */
|
|
48
|
+
export declare const FIELD_VALIDATION_HANDLED_IDENTITIES: unique symbol;
|
|
49
|
+
export type FieldValidationHandledIdentitiesCarrier<Identities> = {
|
|
50
|
+
readonly [FIELD_VALIDATION_HANDLED_IDENTITIES]?: Identities;
|
|
51
|
+
};
|
|
52
|
+
export type FieldValidationHandledIdentitiesOf<Cases> = Cases extends FieldValidationHandledIdentitiesCarrier<infer Identities> ? Identities : never;
|
|
53
|
+
export type UnhandledFieldValidationCases<Cases> = Exclude<Cases, FieldValidationHandledIdentitiesCarrier<any>>;
|
|
54
|
+
type CaseCode<Case> = Case extends FieldValidationCase<any, any, infer Exception> ? Exception['_tag'] : never;
|
|
55
|
+
type CasePath<Case> = Case extends FieldValidationCase<infer Path, any, any> ? Path : never;
|
|
56
|
+
type IsUnion<Value, Whole = Value> = Value extends unknown ? [Whole] extends [Value] ? false : true : never;
|
|
57
|
+
type HasSeveralPaths<Cases> = true extends IsUnion<CasePath<Cases>> ? true : false;
|
|
58
|
+
type HandlersAreLocal<Handlers> = Handlers[keyof Handlers] extends (...args: any[]) => any ? true : false;
|
|
59
|
+
type ReachableHandlerKeys<Cases, Handlers> = HandlersAreLocal<Handlers> extends true ? HasSeveralPaths<Cases> extends true ? CaseIdentity<Cases> : CaseCode<Cases> : CaseIdentity<Cases>;
|
|
60
|
+
type ProvidedHandlerKeys<Handlers> = HandlersAreLocal<Handlers> extends true ? HandlerIdentity<Handlers> : HandlerIdentity<Handlers>;
|
|
61
|
+
export type FieldExceptionBlockExhaustiveCheck<Cases, Handlers> = [
|
|
62
|
+
Exclude<ReachableHandlerKeys<Cases, Handlers>, ProvidedHandlerKeys<Handlers>>
|
|
63
|
+
] extends [never] ? [
|
|
64
|
+
Exclude<ProvidedHandlerKeys<Handlers>, ReachableHandlerKeys<Cases, Handlers>>
|
|
65
|
+
] extends [never] ? unknown : {
|
|
66
|
+
'fieldExceptionBlock.exhaustive has handlers for unreachable field exceptions': Exclude<ProvidedHandlerKeys<Handlers>, ReachableHandlerKeys<Cases, Handlers>>;
|
|
67
|
+
} : {
|
|
68
|
+
'fieldExceptionBlock.exhaustive is missing handlers for field exceptions': Exclude<ReachableHandlerKeys<Cases, Handlers>, ProvidedHandlerKeys<Handlers>>;
|
|
69
|
+
};
|
|
70
|
+
export type FieldExceptionBlockPartialCheck<Cases, Handlers> = [
|
|
71
|
+
Exclude<ProvidedHandlerKeys<Handlers>, ReachableHandlerKeys<Cases, Handlers>>
|
|
72
|
+
] extends [never] ? unknown : {
|
|
73
|
+
'fieldExceptionBlock.partial has handlers for unreachable field exceptions': Exclude<ProvidedHandlerKeys<Handlers>, ReachableHandlerKeys<Cases, Handlers>>;
|
|
74
|
+
};
|
|
75
|
+
type HandledIdentity<Cases, Handlers> = HandlersAreLocal<Handlers> extends true ? Cases extends FieldValidationCase<infer Path, any, infer Exception> ? Exception['_tag'] extends keyof Handlers ? `${Path}.${Exception['_tag']}` : never : never : HandlerIdentity<Handlers>;
|
|
76
|
+
export type FieldValidationHandledIdentities<Cases, Handlers> = HandledIdentity<UnhandledFieldValidationCases<Cases>, Handlers> | ([UnhandledFieldValidationCases<Cases>] extends [never] ? HandlerIdentity<Handlers> : never);
|
|
77
|
+
export type ResidualFieldValidationCases<Cases, Handlers> = Cases extends unknown ? CaseIdentity<Cases> extends HandledIdentity<Cases, Handlers> ? never : Cases : never;
|
|
78
|
+
export type ResidualFieldValidationCasesByIdentity<Cases, Identities> = Cases extends unknown ? CaseIdentity<Cases> extends Identities ? never : Cases : never;
|
|
79
|
+
export type FieldExceptionHandlerFieldExceptions<Handlers> = CraftNodeChildrenFieldExceptions<FieldExceptionHandlerChildren<Handlers[keyof Handlers]>>;
|
|
80
|
+
export type FieldExceptionBlockDirective<Handlers extends FieldExceptionHandlers, Exhaustive extends boolean = boolean> = CraftDirective & {
|
|
81
|
+
readonly [COMPONENT_FIELD_EXCEPTION_BLOCK]: true;
|
|
82
|
+
readonly [FIELD_EXCEPTION_BLOCK_DIRECTIVE]: {
|
|
83
|
+
readonly handlers: Handlers;
|
|
84
|
+
readonly exhaustive: Exhaustive;
|
|
85
|
+
readonly options: Required<Pick<FieldExceptionBlockOptions, 'mode' | 'position'>> & Pick<FieldExceptionBlockOptions, 'visibility'>;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
declare function exhaustive<const Handlers extends LocalHandlerMap>(handlers: Handlers & ContextualLocalHandlers<Handlers>, options?: FieldExceptionBlockOptions): FieldExceptionBlockDirective<Handlers, true>;
|
|
89
|
+
declare function exhaustive<const Handlers extends GroupedHandlerMap>(handlers: Handlers & ContextualGroupedHandlers<Handlers>, options?: FieldExceptionBlockOptions): FieldExceptionBlockDirective<Handlers, true>;
|
|
90
|
+
declare function partial<const Handlers extends LocalHandlerMap>(handlers: Handlers & ContextualLocalHandlers<Handlers>, options?: FieldExceptionBlockOptions): FieldExceptionBlockDirective<Handlers, false>;
|
|
91
|
+
declare function partial<const Handlers extends GroupedHandlerMap>(handlers: Handlers & ContextualGroupedHandlers<Handlers>, options?: FieldExceptionBlockOptions): FieldExceptionBlockDirective<Handlers, false>;
|
|
92
|
+
export declare const fieldExceptionBlock: {
|
|
93
|
+
exhaustive: typeof exhaustive;
|
|
94
|
+
partial: typeof partial;
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=field-exception-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-exception-block.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/field-exception-block.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,+BAA+B,EAC/B,+BAA+B,EAC/B,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,iBAAiB,EACjB,gCAAgC,EACjC,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,KAAK,CAAC;AACtD,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE7D,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,wBAAwB,CAAC;IAC/C,QAAQ,CAAC,IAAI,CAAC,EAAE,uBAAuB,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,EAAE,2BAA2B,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,4BAA4B,CACtC,KAAK,SAAS,UAAU,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,EAC/C,IAAI,SAAS,MAAM,GAAG,MAAM,EAC5B,SAAS,SAAS,iBAAiB,GAAG,iBAAiB,IACrD;IACF,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CA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A0B,GACnC,4BAA4B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AACjD,iBAAS,OAAO,CAAC,KAAK,CAAC,QAAQ,SAAS,iBAAiB,EACvD,QAAQ,EAAE,QAAQ,GAAG,yBAAyB,CAAC,QAAQ,CAAC,EACxD,OAAO,CAAC,EAAE,0BAA0B,GACnC,4BAA4B,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAajD,eAAO,MAAM,mBAAmB;;;CAA0B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CRAFT_DIRECTIVE, COMPONENT_FIELD_EXCEPTION_BLOCK, FIELD_EXCEPTION_BLOCK_DIRECTIVE, } from './types';
|
|
2
|
+
export { FIELD_EXCEPTION_BLOCK_DIRECTIVE } from './types';
|
|
3
|
+
function createFieldExceptionBlockDirective(name, handlers, options, exhaustive) {
|
|
4
|
+
const definition = {
|
|
5
|
+
handlers,
|
|
6
|
+
exhaustive,
|
|
7
|
+
options: {
|
|
8
|
+
visibility: options.visibility,
|
|
9
|
+
mode: options.mode ?? 'first',
|
|
10
|
+
position: options.position ?? 'after',
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
const directive = (() => undefined);
|
|
14
|
+
Object.defineProperty(directive, CRAFT_DIRECTIVE, {
|
|
15
|
+
value: {
|
|
16
|
+
name,
|
|
17
|
+
meta: {},
|
|
18
|
+
logic: (baseLogic) => baseLogic,
|
|
19
|
+
template: (baseTemplate) => baseTemplate,
|
|
20
|
+
componentOperator: {
|
|
21
|
+
fieldExceptionHandlers: handlers,
|
|
22
|
+
fieldExceptionOptions: definition.options,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
enumerable: false,
|
|
26
|
+
});
|
|
27
|
+
Object.defineProperty(directive, FIELD_EXCEPTION_BLOCK_DIRECTIVE, {
|
|
28
|
+
value: definition,
|
|
29
|
+
enumerable: false,
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(directive, COMPONENT_FIELD_EXCEPTION_BLOCK, {
|
|
32
|
+
value: true,
|
|
33
|
+
enumerable: false,
|
|
34
|
+
});
|
|
35
|
+
return directive;
|
|
36
|
+
}
|
|
37
|
+
function exhaustive(handlers, options = {}) {
|
|
38
|
+
return createFieldExceptionBlockDirective('fieldExceptionBlock.exhaustive', handlers, options, true);
|
|
39
|
+
}
|
|
40
|
+
function partial(handlers, options = {}) {
|
|
41
|
+
return createFieldExceptionBlockDirective('fieldExceptionBlock.partial', handlers, options, false);
|
|
42
|
+
}
|
|
43
|
+
export const fieldExceptionBlock = { exhaustive, partial };
|
|
44
|
+
//# sourceMappingURL=field-exception-block.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-exception-block.js","sourceRoot":"","sources":["../../../../../libs/component/src/lib/field-exception-block.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,eAAe,EACf,+BAA+B,EAC/B,+BAA+B,GAEhC,MAAM,SAAS,CAAC;AAMjB,OAAO,EAAE,+BAA+B,EAAE,MAAM,SAAS,CAAC;AAoP1D,SAAS,kCAAkC,CAIzC,IAAuD,EACvD,QAAkB,EAClB,OAAmC,EACnC,UAAsB;IAEtB,MAAM,UAAU,GAAG;QACjB,QAAQ;QACR,UAAU;QACV,OAAO,EAAE;YACP,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO;YAC7B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO;SACtC;KACO,CAAC;IACX,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,CACtB,SAAS,CAAkE,CAAC;IAC9E,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE;QAChD,KAAK,EAAE;YACL,IAAI;YACJ,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,CAAC,SAAkC,EAAE,EAAE,CAAC,SAAS;YACxD,QAAQ,EAAE,CAAC,YAAqC,EAAE,EAAE,CAAC,YAAY;YACjE,iBAAiB,EAAE;gBACjB,sBAAsB,EAAE,QAAQ;gBAChC,qBAAqB,EAAE,UAAU,CAAC,OAAO;aAC1C;SACF;QACD,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,+BAA+B,EAAE;QAChE,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,+BAA+B,EAAE;QAChE,KAAK,EAAE,IAAI;QACX,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC;AAUD,SAAS,UAAU,CACjB,QAAgC,EAChC,UAAsC,EAAE;IAExC,OAAO,kCAAkC,CACvC,gCAAgC,EAChC,QAAQ,EACR,OAAO,EACP,IAAI,CACL,CAAC;AACJ,CAAC;AAUD,SAAS,OAAO,CACd,QAAgC,EAChC,UAAsC,EAAE;IAExC,OAAO,kCAAkC,CACvC,6BAA6B,EAC7B,QAAQ,EACR,OAAO,EACP,KAAK,CACN,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import type {\n AnyCraftException,\n CEmailException,\n CMaxException,\n CMaxLengthException,\n CMinException,\n CMinLengthException,\n CRequiredException,\n CraftField,\n FieldExceptionVisibility,\n FieldValidationCase,\n} from '@craft-ts/core';\nimport {\n CRAFT_DIRECTIVE,\n COMPONENT_FIELD_EXCEPTION_BLOCK,\n FIELD_EXCEPTION_BLOCK_DIRECTIVE,\n type CraftDirective,\n} from './types';\nimport type {\n CraftNodeChildren,\n CraftNodeChildrenFieldExceptions,\n} from './render/vnode';\n\nexport { FIELD_EXCEPTION_BLOCK_DIRECTIVE } from './types';\n\nexport type FieldExceptionBlockMode = 'first' | 'all';\nexport type FieldExceptionBlockPosition = 'before' | 'after';\n\nexport type FieldExceptionBlockOptions = {\n readonly visibility?: FieldExceptionVisibility;\n readonly mode?: FieldExceptionBlockMode;\n readonly position?: FieldExceptionBlockPosition;\n};\n\nexport type FieldExceptionHandlerContext<\n Field extends CraftField<any> = CraftField<any>,\n Path extends string = string,\n Exception extends AnyCraftException = AnyCraftException,\n> = {\n readonly field: Field;\n readonly path: Path;\n readonly runtimePath: ReadonlyArray<string | number>;\n readonly validatorName: string;\n readonly exception: Exception;\n};\n\nexport type FieldExceptionHandler<\n Context extends FieldExceptionHandlerContext = FieldExceptionHandlerContext,\n> = (context: Context) => CraftNodeChildren;\n\ntype AnyFieldExceptionHandler = (...args: any[]) => CraftNodeChildren;\n\nexport type FieldExceptionCodeHandlers = Readonly<\n Record<string, AnyFieldExceptionHandler>\n>;\nexport type FieldExceptionHandlers = Readonly<\n Record<string, AnyFieldExceptionHandler | FieldExceptionCodeHandlers>\n>;\n\ntype KnownFieldException =\n | CRequiredException\n | CEmailException\n | CMinException\n | CMaxException\n | CMinLengthException\n | CMaxLengthException;\n\ntype KnownFieldExceptionForCode<Code extends string> = Extract<\n KnownFieldException,\n { readonly _tag: Code }\n>;\n\ntype FieldExceptionForCode<Code extends string> = [\n KnownFieldExceptionForCode<Code>,\n] extends [never]\n ? AnyCraftException & { readonly _tag: Code }\n : KnownFieldExceptionForCode<Code>;\n\ntype LocalHandlerMap = Readonly<Record<string, AnyFieldExceptionHandler>>;\ntype GroupedHandlerMap = Readonly<Record<string, LocalHandlerMap>>;\n\ntype ContextualLocalHandlers<Handlers extends LocalHandlerMap> = {\n readonly [Code in keyof Handlers]: Code extends string\n ? (\n context: FieldExceptionHandlerContext<\n CraftField<any>,\n string,\n FieldExceptionForCode<Code>\n >,\n ) => ReturnType<Handlers[Code]>\n : never;\n};\n\ntype ContextualGroupedHandlers<Handlers extends GroupedHandlerMap> = {\n readonly [Path in keyof Handlers]: Path extends string\n ? {\n readonly [Code in keyof Handlers[Path]]: Code extends string\n ? (\n context: FieldExceptionHandlerContext<\n CraftField<any>,\n Path,\n FieldExceptionForCode<Code>\n >,\n ) => ReturnType<Handlers[Path][Code]>\n : never;\n }\n : never;\n};\n\nexport type FieldExceptionHandlerChildren<Handler> = Handler extends (\n ...args: any[]\n) => infer Children\n ? Children\n : Handler extends Readonly<Record<string, infer Nested>>\n ? FieldExceptionHandlerChildren<Nested>\n : never;\n\ntype CaseIdentity<Case> =\n Case extends FieldValidationCase<infer Path, any, infer Exception>\n ? `${Path}.${Exception['_tag']}`\n : never;\n\ntype HandlerIdentity<Handlers> = {\n [PathOrCode in keyof Handlers & string]: Handlers[PathOrCode] extends (\n ...args: any[]\n ) => any\n ? PathOrCode\n : Handlers[PathOrCode] extends Readonly<Record<string, unknown>>\n ? `${PathOrCode}.${keyof Handlers[PathOrCode] & string}`\n : never;\n}[keyof Handlers & string];\n\n/** Type-only coverage emitted by a field-exception block in a template. */\nexport declare const FIELD_VALIDATION_HANDLED_IDENTITIES: unique symbol;\n\nexport type FieldValidationHandledIdentitiesCarrier<Identities> = {\n readonly [FIELD_VALIDATION_HANDLED_IDENTITIES]?: Identities;\n};\n\nexport type FieldValidationHandledIdentitiesOf<Cases> =\n Cases extends FieldValidationHandledIdentitiesCarrier<infer Identities>\n ? Identities\n : never;\n\nexport type UnhandledFieldValidationCases<Cases> = Exclude<\n Cases,\n FieldValidationHandledIdentitiesCarrier<any>\n>;\n\ntype CaseCode<Case> =\n Case extends FieldValidationCase<any, any, infer Exception>\n ? Exception['_tag']\n : never;\n\ntype CasePath<Case> =\n Case extends FieldValidationCase<infer Path, any, any> ? Path : never;\n\ntype IsUnion<Value, Whole = Value> = Value extends unknown\n ? [Whole] extends [Value]\n ? false\n : true\n : never;\n\ntype HasSeveralPaths<Cases> =\n true extends IsUnion<CasePath<Cases>> ? true : false;\n\ntype HandlersAreLocal<Handlers> = Handlers[keyof Handlers] extends (\n ...args: any[]\n) => any\n ? true\n : false;\n\ntype ReachableHandlerKeys<Cases, Handlers> =\n HandlersAreLocal<Handlers> extends true\n ? HasSeveralPaths<Cases> extends true\n ? CaseIdentity<Cases>\n : CaseCode<Cases>\n : CaseIdentity<Cases>;\n\ntype ProvidedHandlerKeys<Handlers> =\n HandlersAreLocal<Handlers> extends true\n ? HandlerIdentity<Handlers>\n : HandlerIdentity<Handlers>;\n\nexport type FieldExceptionBlockExhaustiveCheck<Cases, Handlers> = [\n Exclude<ReachableHandlerKeys<Cases, Handlers>, ProvidedHandlerKeys<Handlers>>,\n] extends [never]\n ? [\n Exclude<\n ProvidedHandlerKeys<Handlers>,\n ReachableHandlerKeys<Cases, Handlers>\n >,\n ] extends [never]\n ? unknown\n : {\n 'fieldExceptionBlock.exhaustive has handlers for unreachable field exceptions': Exclude<\n ProvidedHandlerKeys<Handlers>,\n ReachableHandlerKeys<Cases, Handlers>\n >;\n }\n : {\n 'fieldExceptionBlock.exhaustive is missing handlers for field exceptions': Exclude<\n ReachableHandlerKeys<Cases, Handlers>,\n ProvidedHandlerKeys<Handlers>\n >;\n };\n\nexport type FieldExceptionBlockPartialCheck<Cases, Handlers> = [\n Exclude<ProvidedHandlerKeys<Handlers>, ReachableHandlerKeys<Cases, Handlers>>,\n] extends [never]\n ? unknown\n : {\n 'fieldExceptionBlock.partial has handlers for unreachable field exceptions': Exclude<\n ProvidedHandlerKeys<Handlers>,\n ReachableHandlerKeys<Cases, Handlers>\n >;\n };\n\ntype HandledIdentity<Cases, Handlers> =\n HandlersAreLocal<Handlers> extends true\n ? Cases extends FieldValidationCase<infer Path, any, infer Exception>\n ? Exception['_tag'] extends keyof Handlers\n ? `${Path}.${Exception['_tag']}`\n : never\n : never\n : HandlerIdentity<Handlers>;\n\nexport type FieldValidationHandledIdentities<Cases, Handlers> =\n | HandledIdentity<UnhandledFieldValidationCases<Cases>, Handlers>\n | ([UnhandledFieldValidationCases<Cases>] extends [never]\n ? HandlerIdentity<Handlers>\n : never);\n\nexport type ResidualFieldValidationCases<Cases, Handlers> =\n Cases extends unknown\n ? CaseIdentity<Cases> extends HandledIdentity<Cases, Handlers>\n ? never\n : Cases\n : never;\n\nexport type ResidualFieldValidationCasesByIdentity<Cases, Identities> =\n Cases extends unknown\n ? CaseIdentity<Cases> extends Identities\n ? never\n : Cases\n : never;\n\nexport type FieldExceptionHandlerFieldExceptions<Handlers> =\n CraftNodeChildrenFieldExceptions<\n FieldExceptionHandlerChildren<Handlers[keyof Handlers]>\n >;\n\nexport type FieldExceptionBlockDirective<\n Handlers extends FieldExceptionHandlers,\n Exhaustive extends boolean = boolean,\n> = CraftDirective & {\n readonly [COMPONENT_FIELD_EXCEPTION_BLOCK]: true;\n readonly [FIELD_EXCEPTION_BLOCK_DIRECTIVE]: {\n readonly handlers: Handlers;\n readonly exhaustive: Exhaustive;\n readonly options: Required<\n Pick<FieldExceptionBlockOptions, 'mode' | 'position'>\n > &\n Pick<FieldExceptionBlockOptions, 'visibility'>;\n };\n};\n\nfunction createFieldExceptionBlockDirective<\n Handlers extends FieldExceptionHandlers,\n Exhaustive extends boolean,\n>(\n name: `fieldExceptionBlock.${'exhaustive' | 'partial'}`,\n handlers: Handlers,\n options: FieldExceptionBlockOptions,\n exhaustive: Exhaustive,\n): FieldExceptionBlockDirective<Handlers, Exhaustive> {\n const definition = {\n handlers,\n exhaustive,\n options: {\n visibility: options.visibility,\n mode: options.mode ?? 'first',\n position: options.position ?? 'after',\n },\n } as const;\n const directive = (() =>\n undefined) as unknown as FieldExceptionBlockDirective<Handlers, Exhaustive>;\n Object.defineProperty(directive, CRAFT_DIRECTIVE, {\n value: {\n name,\n meta: {},\n logic: (baseLogic: (...args: any[]) => any) => baseLogic,\n template: (baseTemplate: (...args: any[]) => any) => baseTemplate,\n componentOperator: {\n fieldExceptionHandlers: handlers,\n fieldExceptionOptions: definition.options,\n },\n },\n enumerable: false,\n });\n Object.defineProperty(directive, FIELD_EXCEPTION_BLOCK_DIRECTIVE, {\n value: definition,\n enumerable: false,\n });\n Object.defineProperty(directive, COMPONENT_FIELD_EXCEPTION_BLOCK, {\n value: true,\n enumerable: false,\n });\n return directive;\n}\n\nfunction exhaustive<const Handlers extends LocalHandlerMap>(\n handlers: Handlers & ContextualLocalHandlers<Handlers>,\n options?: FieldExceptionBlockOptions,\n): FieldExceptionBlockDirective<Handlers, true>;\nfunction exhaustive<const Handlers extends GroupedHandlerMap>(\n handlers: Handlers & ContextualGroupedHandlers<Handlers>,\n options?: FieldExceptionBlockOptions,\n): FieldExceptionBlockDirective<Handlers, true>;\nfunction exhaustive(\n handlers: FieldExceptionHandlers,\n options: FieldExceptionBlockOptions = {},\n): FieldExceptionBlockDirective<FieldExceptionHandlers, true> {\n return createFieldExceptionBlockDirective(\n 'fieldExceptionBlock.exhaustive',\n handlers,\n options,\n true,\n );\n}\n\nfunction partial<const Handlers extends LocalHandlerMap>(\n handlers: Handlers & ContextualLocalHandlers<Handlers>,\n options?: FieldExceptionBlockOptions,\n): FieldExceptionBlockDirective<Handlers, false>;\nfunction partial<const Handlers extends GroupedHandlerMap>(\n handlers: Handlers & ContextualGroupedHandlers<Handlers>,\n options?: FieldExceptionBlockOptions,\n): FieldExceptionBlockDirective<Handlers, false>;\nfunction partial(\n handlers: FieldExceptionHandlers,\n options: FieldExceptionBlockOptions = {},\n): FieldExceptionBlockDirective<FieldExceptionHandlers, false> {\n return createFieldExceptionBlockDirective(\n 'fieldExceptionBlock.partial',\n handlers,\n options,\n false,\n );\n}\n\nexport const fieldExceptionBlock = { exhaustive, partial };\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ɵDestroyRef as CraftDestroyRef, ɵInjector as CraftInjectorToken, ɵcomputed, ɵcreateEnvironmentInjector, ɵEffectScheduler as CraftEffectScheduler, ɵElementRef, ɵEnvironmentInjector, ɵINJECTOR_SCOPE as CraftInjectorScope, ɵinject, ɵInjectionToken as CraftInjectionToken, ɵrunInInjectionContext, ɵsignal, ɵuntracked, type CraftInjector, type ɵEffectRef, type ɵProvider, type ɵProviderToken } from '@craft-ts/core';
|
|
2
|
+
export type EffectRef = ɵEffectRef;
|
|
3
|
+
export type Provider = ɵProvider;
|
|
4
|
+
export type ProviderToken<T> = ɵProviderToken<T>;
|
|
5
|
+
export type DestroyRef = InstanceType<typeof CraftDestroyRef>;
|
|
6
|
+
export type Injector = CraftInjector;
|
|
7
|
+
export type EnvironmentInjector = CraftInjector;
|
|
8
|
+
export type ElementRef<T = HTMLElement> = InstanceType<typeof ɵElementRef> & {
|
|
9
|
+
nativeElement: T;
|
|
10
|
+
};
|
|
11
|
+
type HostRuntimeApi = {
|
|
12
|
+
computed: typeof ɵcomputed;
|
|
13
|
+
createEnvironmentInjector: typeof ɵcreateEnvironmentInjector;
|
|
14
|
+
DestroyRef: typeof CraftDestroyRef;
|
|
15
|
+
ElementRef: typeof ɵElementRef;
|
|
16
|
+
EnvironmentInjector: typeof ɵEnvironmentInjector;
|
|
17
|
+
Injector: typeof CraftInjectorToken;
|
|
18
|
+
inject: typeof ɵinject;
|
|
19
|
+
reflectComponentType: (component: unknown) => {
|
|
20
|
+
selector?: string | null;
|
|
21
|
+
} | null;
|
|
22
|
+
runInInjectionContext: typeof ɵrunInInjectionContext;
|
|
23
|
+
signal: typeof ɵsignal;
|
|
24
|
+
untracked: typeof ɵuntracked;
|
|
25
|
+
ɵEffectScheduler: typeof CraftEffectScheduler;
|
|
26
|
+
ɵINJECTOR_SCOPE: typeof CraftInjectorScope;
|
|
27
|
+
AngularMount: new (component: unknown, hostElement: Element, injector: unknown, inputs: Readonly<Record<string, unknown>>, outputs: Readonly<Record<string, (value: unknown) => unknown>>, directives: readonly unknown[], context: {
|
|
28
|
+
injector: unknown;
|
|
29
|
+
resolveInput: (value: unknown) => unknown;
|
|
30
|
+
executeOutput: (callback: (value: unknown) => unknown, value: unknown) => unknown;
|
|
31
|
+
}) => {
|
|
32
|
+
update(...args: unknown[]): void;
|
|
33
|
+
destroy(): void;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export declare const computed: typeof ɵcomputed;
|
|
37
|
+
export declare const createEnvironmentInjector: typeof ɵcreateEnvironmentInjector;
|
|
38
|
+
export declare const DestroyRef: typeof CraftDestroyRef;
|
|
39
|
+
export declare const ElementRef: typeof ɵElementRef;
|
|
40
|
+
export declare const EnvironmentInjector: CraftInjectionToken<CraftInjector>;
|
|
41
|
+
export declare const Injector: CraftInjectionToken<CraftInjector> & {
|
|
42
|
+
NULL: CraftInjector;
|
|
43
|
+
create(options: {
|
|
44
|
+
providers: readonly unknown[];
|
|
45
|
+
parent?: CraftInjectorToken | CraftInjector | object | null;
|
|
46
|
+
name?: string;
|
|
47
|
+
}): CraftInjector;
|
|
48
|
+
};
|
|
49
|
+
export declare const InjectionToken: typeof CraftInjectionToken;
|
|
50
|
+
export declare const inject: typeof ɵinject;
|
|
51
|
+
export declare const reflectComponentType: HostRuntimeApi['reflectComponentType'];
|
|
52
|
+
export declare const runInInjectionContext: typeof ɵrunInInjectionContext;
|
|
53
|
+
export declare const signal: typeof ɵsignal;
|
|
54
|
+
export declare const untracked: typeof ɵuntracked;
|
|
55
|
+
export declare const ɵEffectScheduler: CraftInjectionToken<{
|
|
56
|
+
flush(): void;
|
|
57
|
+
}>;
|
|
58
|
+
export declare const ɵINJECTOR_SCOPE: CraftInjectionToken<string>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=host-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-runtime.d.ts","sourceRoot":"","sources":["../../../../../libs/component/src/lib/host-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,IAAI,eAAe,EAC9B,SAAS,IAAI,kBAAkB,EAC/B,SAAS,EACT,0BAA0B,EAC1B,gBAAgB,IAAI,oBAAoB,EACxC,WAAW,EACX,oBAAoB,EACpB,eAAe,IAAI,kBAAkB,EACrC,OAAO,EACP,eAAe,IAAI,mBAAmB,EACtC,sBAAsB,EACtB,OAAO,EACP,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,cAAc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ironmentInjector, ɵEffectScheduler as CraftEffectScheduler, ɵElementRef, ɵEnvironmentInjector, ɵINJECTOR_SCOPE as CraftInjectorScope, ɵinject, ɵInjectionToken as CraftInjectionToken, ɵrunInInjectionContext, ɵsignal, ɵuntracked, } from '@craft-ts/core';
|
|
2
|
+
export const computed = ɵcomputed;
|
|
3
|
+
export const createEnvironmentInjector = ɵcreateEnvironmentInjector;
|
|
4
|
+
export const DestroyRef = CraftDestroyRef;
|
|
5
|
+
export const ElementRef = ɵElementRef;
|
|
6
|
+
export const EnvironmentInjector = ɵEnvironmentInjector;
|
|
7
|
+
export const Injector = CraftInjectorToken;
|
|
8
|
+
export const InjectionToken = CraftInjectionToken;
|
|
9
|
+
export const inject = ɵinject;
|
|
10
|
+
export const reflectComponentType = () => null;
|
|
11
|
+
export const runInInjectionContext = ɵrunInInjectionContext;
|
|
12
|
+
export const signal = ɵsignal;
|
|
13
|
+
export const untracked = ɵuntracked;
|
|
14
|
+
export const ɵEffectScheduler = CraftEffectScheduler;
|
|
15
|
+
export const ɵINJECTOR_SCOPE = CraftInjectorScope;
|
|
16
|
+
//# sourceMappingURL=host-runtime.js.map
|