@craft-ts/component 0.7.0-beta.13 → 0.7.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +7 -2
- package/src/index.d.ts +40 -40
- package/src/index.js +35 -35
- package/src/lib/a11y-control.d.ts +0 -1
- package/src/lib/a11y-control.js +0 -1
- package/src/lib/a11y.d.ts +4 -5
- package/src/lib/a11y.js +3 -4
- package/src/lib/ai/ai-context-menu.d.ts +24 -25
- package/src/lib/ai/ai-context-menu.js +2 -3
- package/src/lib/ai/ai-send-dialog.d.ts +277 -278
- package/src/lib/ai/ai-send-dialog.js +4 -5
- package/src/lib/ai/send-context-to-ai.d.ts +1 -2
- package/src/lib/ai/send-context-to-ai.js +4 -5
- package/src/lib/assert-defined-input.d.ts +1 -2
- package/src/lib/assert-defined-input.js +0 -1
- package/src/lib/bootstrap.d.ts +4 -3
- package/src/lib/bootstrap.js +6 -8
- package/src/lib/bridge.d.ts +9 -10
- package/src/lib/bridge.js +3 -4
- package/src/lib/catch-node.d.ts +35 -0
- package/src/lib/{block.js → catch-node.js} +9 -10
- package/src/lib/component.d.ts +23 -10
- package/src/lib/component.js +5 -6
- package/src/lib/composition.d.ts +1 -2
- package/src/lib/composition.js +2 -3
- package/src/lib/craft-defaults.d.ts +0 -1
- package/src/lib/craft-defaults.js +4 -5
- package/src/lib/craft-host-tokens.d.ts +0 -1
- package/src/lib/craft-host-tokens.js +0 -1
- package/src/lib/craft-router-outlet.d.ts +1 -2
- package/src/lib/craft-router-outlet.js +1 -2
- package/src/lib/css-vars.d.ts +0 -1
- package/src/lib/css-vars.js +0 -1
- package/src/lib/css-vars.type.d.ts +1 -2
- package/src/lib/css-vars.type.js +0 -1
- package/src/lib/{defer.d.ts → defer-node.d.ts} +4 -5
- package/src/lib/{defer.js → defer-node.js} +1 -2
- package/src/lib/directive.d.ts +1 -2
- package/src/lib/directive.js +1 -2
- package/src/lib/factory-runtime.d.ts +1 -2
- package/src/lib/factory-runtime.js +0 -1
- package/src/lib/{field-exception-block.d.ts → field-error-node.d.ts} +22 -23
- package/src/lib/{field-exception-block.js → field-error-node.js} +8 -9
- package/src/lib/for-node.d.ts +28 -0
- package/src/lib/{each.js → for-node.js} +4 -5
- package/src/lib/for-scheduling.d.ts +58 -0
- package/src/lib/{each-scheduling.js → for-scheduling.js} +14 -15
- package/src/lib/host-runtime.d.ts +0 -1
- package/src/lib/host-runtime.js +0 -1
- package/src/lib/hydrate.d.ts +2 -3
- package/src/lib/hydrate.js +57 -18
- package/src/lib/hyperscript.d.ts +1 -2
- package/src/lib/hyperscript.js +1 -2
- package/src/lib/if-node.d.ts +7 -0
- package/src/lib/{if-block.js → if-node.js} +2 -3
- package/src/lib/locator.d.ts +5 -6
- package/src/lib/locator.js +1 -2
- package/src/lib/{match-block.d.ts → match-node.d.ts} +8 -9
- package/src/lib/{match-block.js → match-node.js} +3 -4
- package/src/lib/{pending-block.d.ts → pending-node.d.ts} +28 -29
- package/src/lib/{pending-block.js → pending-node.js} +12 -13
- package/src/lib/project.d.ts +2 -3
- package/src/lib/project.js +2 -3
- package/src/lib/render/hydration-metadata.d.ts +0 -1
- package/src/lib/render/hydration-metadata.js +0 -1
- package/src/lib/render/hydration.d.ts +0 -1
- package/src/lib/render/hydration.js +0 -1
- package/src/lib/render/interpreter.d.ts +9 -8
- package/src/lib/render/interpreter.js +156 -81
- package/src/lib/render/server-style-collector.d.ts +0 -1
- package/src/lib/render/server-style-collector.js +0 -1
- package/src/lib/render/ssr-coordinator.d.ts +4 -2
- package/src/lib/render/ssr-coordinator.js +14 -3
- package/src/lib/render/string-dom.d.ts +0 -1
- package/src/lib/render/string-dom.js +48 -7
- package/src/lib/render/style-registry.d.ts +3 -2
- package/src/lib/render/style-registry.js +3 -2
- package/src/lib/render/style-scope.d.ts +0 -1
- package/src/lib/render/style-scope.js +0 -1
- package/src/lib/render/vnode.d.ts +117 -54
- package/src/lib/render/vnode.js +26 -27
- package/src/lib/security.d.ts +54 -0
- package/src/lib/security.js +502 -0
- package/src/lib/server-render.d.ts +12 -3
- package/src/lib/server-render.js +76 -17
- package/src/lib/start.d.ts +2 -3
- package/src/lib/start.js +3 -3
- package/src/lib/template-contract.d.ts +22 -23
- package/src/lib/template-contract.js +0 -1
- package/src/lib/template.d.ts +2 -3
- package/src/lib/template.js +2 -3
- package/src/lib/testing.d.ts +3 -4
- package/src/lib/testing.js +5 -6
- package/src/lib/types.d.ts +40 -28
- package/src/lib/types.js +3 -4
- package/testing/public-api.d.ts +0 -1
- package/testing/public-api.js +0 -1
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/a11y-control.d.ts.map +0 -1
- package/src/lib/a11y-control.js.map +0 -1
- package/src/lib/a11y.d.ts.map +0 -1
- package/src/lib/a11y.js.map +0 -1
- package/src/lib/ai/ai-context-menu.d.ts.map +0 -1
- package/src/lib/ai/ai-context-menu.js.map +0 -1
- package/src/lib/ai/ai-send-dialog.d.ts.map +0 -1
- package/src/lib/ai/ai-send-dialog.js.map +0 -1
- package/src/lib/ai/send-context-to-ai.d.ts.map +0 -1
- package/src/lib/ai/send-context-to-ai.js.map +0 -1
- package/src/lib/assert-defined-input.d.ts.map +0 -1
- package/src/lib/assert-defined-input.js.map +0 -1
- package/src/lib/block.d.ts +0 -36
- package/src/lib/block.d.ts.map +0 -1
- package/src/lib/block.js.map +0 -1
- package/src/lib/bootstrap.d.ts.map +0 -1
- package/src/lib/bootstrap.js.map +0 -1
- package/src/lib/bridge.d.ts.map +0 -1
- package/src/lib/bridge.js.map +0 -1
- package/src/lib/component.d.ts.map +0 -1
- package/src/lib/component.js.map +0 -1
- package/src/lib/composition.d.ts.map +0 -1
- package/src/lib/composition.js.map +0 -1
- package/src/lib/craft-defaults.d.ts.map +0 -1
- package/src/lib/craft-defaults.js.map +0 -1
- package/src/lib/craft-host-tokens.d.ts.map +0 -1
- package/src/lib/craft-host-tokens.js.map +0 -1
- package/src/lib/craft-router-outlet.d.ts.map +0 -1
- package/src/lib/craft-router-outlet.js.map +0 -1
- package/src/lib/css-vars.d.ts.map +0 -1
- package/src/lib/css-vars.js.map +0 -1
- package/src/lib/css-vars.type.d.ts.map +0 -1
- package/src/lib/css-vars.type.js.map +0 -1
- package/src/lib/defer.d.ts.map +0 -1
- package/src/lib/defer.js.map +0 -1
- package/src/lib/directive.d.ts.map +0 -1
- package/src/lib/directive.js.map +0 -1
- package/src/lib/each-scheduling.d.ts +0 -59
- package/src/lib/each-scheduling.d.ts.map +0 -1
- package/src/lib/each-scheduling.js.map +0 -1
- package/src/lib/each.d.ts +0 -29
- package/src/lib/each.d.ts.map +0 -1
- package/src/lib/each.js.map +0 -1
- package/src/lib/factory-runtime.d.ts.map +0 -1
- package/src/lib/factory-runtime.js.map +0 -1
- package/src/lib/field-exception-block.d.ts.map +0 -1
- package/src/lib/field-exception-block.js.map +0 -1
- package/src/lib/host-runtime.d.ts.map +0 -1
- package/src/lib/host-runtime.js.map +0 -1
- package/src/lib/hydrate.d.ts.map +0 -1
- package/src/lib/hydrate.js.map +0 -1
- package/src/lib/hyperscript.d.ts.map +0 -1
- package/src/lib/hyperscript.js.map +0 -1
- package/src/lib/if-block.d.ts +0 -8
- package/src/lib/if-block.d.ts.map +0 -1
- package/src/lib/if-block.js.map +0 -1
- package/src/lib/locator.d.ts.map +0 -1
- package/src/lib/locator.js.map +0 -1
- package/src/lib/match-block.d.ts.map +0 -1
- package/src/lib/match-block.js.map +0 -1
- package/src/lib/pending-block.d.ts.map +0 -1
- package/src/lib/pending-block.js.map +0 -1
- package/src/lib/project.d.ts.map +0 -1
- package/src/lib/project.js.map +0 -1
- package/src/lib/render/hydration-metadata.d.ts.map +0 -1
- package/src/lib/render/hydration-metadata.js.map +0 -1
- package/src/lib/render/hydration.d.ts.map +0 -1
- package/src/lib/render/hydration.js.map +0 -1
- package/src/lib/render/interpreter.d.ts.map +0 -1
- package/src/lib/render/interpreter.js.map +0 -1
- package/src/lib/render/server-style-collector.d.ts.map +0 -1
- package/src/lib/render/server-style-collector.js.map +0 -1
- package/src/lib/render/ssr-coordinator.d.ts.map +0 -1
- package/src/lib/render/ssr-coordinator.js.map +0 -1
- package/src/lib/render/string-dom.d.ts.map +0 -1
- package/src/lib/render/string-dom.js.map +0 -1
- package/src/lib/render/style-registry.d.ts.map +0 -1
- package/src/lib/render/style-registry.js.map +0 -1
- package/src/lib/render/style-scope.d.ts.map +0 -1
- package/src/lib/render/style-scope.js.map +0 -1
- package/src/lib/render/vnode.d.ts.map +0 -1
- package/src/lib/render/vnode.js.map +0 -1
- package/src/lib/server-render.d.ts.map +0 -1
- package/src/lib/server-render.js.map +0 -1
- package/src/lib/start.d.ts.map +0 -1
- package/src/lib/start.js.map +0 -1
- package/src/lib/template-contract.d.ts.map +0 -1
- package/src/lib/template-contract.js.map +0 -1
- package/src/lib/template.d.ts.map +0 -1
- package/src/lib/template.js.map +0 -1
- package/src/lib/testing.d.ts.map +0 -1
- package/src/lib/testing.js.map +0 -1
- package/src/lib/types.d.ts.map +0 -1
- package/src/lib/types.js.map +0 -1
- package/testing/public-api.d.ts.map +0 -1
- package/testing/public-api.js.map +0 -1
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { CRAFT_SERVICE_PROVIDER_BRAND, CRAFT_DOM_EVENT_HOOK, CRAFT_NODE_DIRECTIVE, CRAFT_NODE_EFFECT_FACTORY, CRAFT_FIELD_EXCEPTION_BOUNDARY, CRAFT_FIELD_EXCEPTION_SOURCE, CRAFT_TEMPORAL_RUNTIME, COMPONENT_REGISTER, craftEffect, craftLazy, createBrowserDomAdapter, registerCraftSyncTemplateFlush, executeYieldable, HOST_TAG_LIST, executeTemplateTrace, isCraftException, isCraftGenShortCircuit, isCraftNotSettled, ɵwithSettledReadObserver, isGeneratorFunction, isCraftField, isGenerator, markYieldableValue, markYieldableMethod, isYieldableValue, isYieldableMethod, isYieldableReactiveValue, DEEP_YIELDABLE, provideHostName, rawReactiveFacade, rawReactiveValue, toYieldable, yieldableInvocation, ɵfallbackComponentRegister, ɵregisterCraftTarget, ɵcraftInjectorFromHost, fieldExceptionVisibilityMatches, YIELDABLE_VALUE, RealCraftTemporalRuntime, CRAFT_HYDRATION_ID, childCraftRenderIdentity, createCraftRenderIdentity, CRAFT_SSR_POLICY, CRAFT_MATCH, } from '@craft-ts/core';
|
|
2
|
-
import { executeCraftComponentFactory } from '../factory-runtime';
|
|
3
|
-
import { computed, createEnvironmentInjector, ElementRef, EnvironmentInjector, Injector, runInInjectionContext, signal, untracked, } from '../host-runtime';
|
|
4
|
-
import { CRAFT_COMPONENT, CRAFT_DIRECTIVE, CONTENT_DECLARATION_CONTEXT, } from '../types';
|
|
5
|
-
import { cssVarStyles } from '../css-vars';
|
|
6
|
-
import { normalizeChildren, mergeHostProps, withCraftRenderContext, CRAFT_NODE_DIRECTIVES, } from './vnode';
|
|
7
|
-
import { CraftUnhandledPendingError,
|
|
8
|
-
import { CraftUnhandledExceptionError,
|
|
9
|
-
import {
|
|
10
|
-
import { executeCraftComponentFactoryAsync } from '../factory-runtime';
|
|
11
|
-
import { CRAFT_STYLE_REGISTRY,
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
1
|
+
import { CRAFT_SERVICE_PROVIDER_BRAND, CRAFT_DOM_EVENT_HOOK, CRAFT_NODE_DIRECTIVE, CRAFT_NODE_EFFECT_FACTORY, CRAFT_FIELD_EXCEPTION_BOUNDARY, CRAFT_FIELD_EXCEPTION_SOURCE, CRAFT_TEMPORAL_RUNTIME, COMPONENT_REGISTER, craftEffect, craftLazy, createBrowserDomAdapter, registerCraftSyncTemplateFlush, executeYieldable, HOST_TAG_LIST, executeTemplateTrace, isCraftException, isCraftGenShortCircuit, isCraftNotSettled, ɵwithSettledReadObserver, isGeneratorFunction, isCraftField, isGenerator, markYieldableValue, markYieldableMethod, isYieldableValue, isYieldableMethod, isYieldableReactiveValue, DEEP_YIELDABLE, provideHostName, rawReactiveFacade, rawReactiveValue, toYieldable, yieldableInvocation, ɵfallbackComponentRegister, ɵregisterCraftTarget, ɵcraftInjectorFromHost, fieldExceptionVisibilityMatches, YIELDABLE_VALUE, RealCraftTemporalRuntime, CRAFT_HYDRATION_ID, childCraftRenderIdentity, createCraftRenderIdentity, CRAFT_SSR_POLICY, CRAFT_SECURITY_POLICY, CraftCspNonce, CRAFT_MATCH, } from '@craft-ts/core';
|
|
2
|
+
import { executeCraftComponentFactory } from '../factory-runtime.js';
|
|
3
|
+
import { computed, createEnvironmentInjector, ElementRef, EnvironmentInjector, Injector, runInInjectionContext, signal, untracked, } from '../host-runtime.js';
|
|
4
|
+
import { CRAFT_COMPONENT, CRAFT_DIRECTIVE, CONTENT_DECLARATION_CONTEXT, } from '../types.js';
|
|
5
|
+
import { cssVarStyles } from '../css-vars.js';
|
|
6
|
+
import { normalizeChildren, mergeHostProps, withCraftRenderContext, CRAFT_NODE_DIRECTIVES, } from './vnode.js';
|
|
7
|
+
import { CraftUnhandledPendingError, resolvePendingHandler, } from '../pending-node.js';
|
|
8
|
+
import { CraftUnhandledExceptionError, resolveCatchHandler, } from '../catch-node.js';
|
|
9
|
+
import { FOR_SCHEDULER, createForScheduler, } from '../for-scheduling.js';
|
|
10
|
+
import { executeCraftComponentFactoryAsync } from '../factory-runtime.js';
|
|
11
|
+
import { CRAFT_STYLE_REGISTRY, createCraftStyleRegistry, } from './style-registry.js';
|
|
12
|
+
import { isCraftMultiUrlAttribute, isCraftResourceUrlAttribute, isCraftSafeHtml, isCraftUnsafeHtml, isCraftUrlAttribute, safeResourceUrl, safeUrl, safeUrlList, CraftDomSecurityError, } from '../security.js';
|
|
13
|
+
import { scopeCss, scopeIdFor, validateStyleScope } from './style-scope.js';
|
|
14
|
+
import { CRAFT_LOCATOR_CONTENT_NAMES, directCraftContentNames, findCraftTemplateLocator, } from '../locator.js';
|
|
15
|
+
import { HydrationMismatchError } from './hydration.js';
|
|
16
|
+
import { setNodeHydrationKey } from './hydration-metadata.js';
|
|
16
17
|
let templateGeneratorDepth = 0;
|
|
17
18
|
function childContext(context, overrides = {}) {
|
|
18
19
|
return { ...context, ...overrides };
|
|
@@ -20,8 +21,8 @@ function childContext(context, overrides = {}) {
|
|
|
20
21
|
function childNodeContext(context, node, index) {
|
|
21
22
|
const segments = node.kind === 'component'
|
|
22
23
|
? [node.component[CRAFT_COMPONENT].name, index]
|
|
23
|
-
: node.kind === '
|
|
24
|
-
? [`
|
|
24
|
+
: node.kind === 'for'
|
|
25
|
+
? [`for:${node.sourceName ?? index}`]
|
|
25
26
|
: node.kind === 'if'
|
|
26
27
|
? [`if:${node.conditionName}`]
|
|
27
28
|
: [index];
|
|
@@ -251,7 +252,7 @@ function createRenderEffect(context, name, effectFn) {
|
|
|
251
252
|
if (!isCraftGenShortCircuit(error))
|
|
252
253
|
throw error;
|
|
253
254
|
// A settled read whose source carries a business exception: route it to
|
|
254
|
-
// the nearest
|
|
255
|
+
// the nearest catchNode, exactly like a component initialization one.
|
|
255
256
|
context.pendingBoundary?.resume(token);
|
|
256
257
|
if (!context.exceptionBoundary?.(error.exception, token)) {
|
|
257
258
|
throw new CraftUnhandledExceptionError(error.exception);
|
|
@@ -447,7 +448,10 @@ function sameCraftNodeDirectives(left, right) {
|
|
|
447
448
|
left.every((descriptor, index) => descriptor.directive === right[index]?.directive));
|
|
448
449
|
}
|
|
449
450
|
function insertBefore(renderer, parent, node, before) {
|
|
450
|
-
|
|
451
|
+
// A route replacement can resolve after its previous view was torn down.
|
|
452
|
+
// Ignore a stale anchor and append instead of forwarding an invalid DOM
|
|
453
|
+
// reference to insertBefore.
|
|
454
|
+
renderer.insertBefore(parent, node, before && before.parentNode === parent ? before : null);
|
|
451
455
|
}
|
|
452
456
|
function removeNode(renderer, node) {
|
|
453
457
|
const parent = node.parentNode;
|
|
@@ -740,6 +744,7 @@ const PROPERTY_NAMES = new Set([
|
|
|
740
744
|
'multiple',
|
|
741
745
|
'selected',
|
|
742
746
|
'value',
|
|
747
|
+
'innerHTML',
|
|
743
748
|
]);
|
|
744
749
|
function eventNameFor(key, value) {
|
|
745
750
|
if (typeof value !== 'function') {
|
|
@@ -858,6 +863,8 @@ function sameStyleValue(left, right) {
|
|
|
858
863
|
}
|
|
859
864
|
function setStyleValue(_renderer, element, key, value, context) {
|
|
860
865
|
value = resolveTemplateValue(value, context);
|
|
866
|
+
ɵassertSafeStyleValue(value, context.injector.get(CRAFT_SECURITY_POLICY, null)?.dom
|
|
867
|
+
.allowedResourceOrigins ?? []);
|
|
861
868
|
const style = element
|
|
862
869
|
.style;
|
|
863
870
|
if (value === null || value === undefined || value === false) {
|
|
@@ -889,6 +896,8 @@ function applyStyles(renderer, element, previous, next, context) {
|
|
|
889
896
|
renderer.removeAttribute(element, 'style');
|
|
890
897
|
}
|
|
891
898
|
if (typeof next === 'string') {
|
|
899
|
+
ɵassertSafeStyleValue(next, context.injector.get(CRAFT_SECURITY_POLICY, null)?.dom
|
|
900
|
+
.allowedResourceOrigins ?? []);
|
|
892
901
|
renderer.setAttribute(element, 'style', next);
|
|
893
902
|
}
|
|
894
903
|
else if (typeof next === 'object' && next !== null) {
|
|
@@ -921,6 +930,36 @@ function flattenAttributes(props) {
|
|
|
921
930
|
}
|
|
922
931
|
function applyAttribute(renderer, element, key, value, context) {
|
|
923
932
|
value = resolveTemplateValue(value, context);
|
|
933
|
+
const normalizedKey = key.toLowerCase();
|
|
934
|
+
if (value === null || value === undefined) {
|
|
935
|
+
if (normalizedKey === 'srcdoc' || normalizedKey.startsWith('on')) {
|
|
936
|
+
renderer.removeAttribute(element, key);
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (key === 'innerHTML') {
|
|
940
|
+
renderer.setProperty(element, key, '');
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
if (normalizedKey === 'srcdoc') {
|
|
945
|
+
throw new CraftDomSecurityError('CRAFT_DOM_SRCDOC_BLOCKED', 'srcdoc is not supported by the secure renderer.');
|
|
946
|
+
}
|
|
947
|
+
if (normalizedKey.startsWith('on')) {
|
|
948
|
+
throw new CraftDomSecurityError('CRAFT_DOM_EVENT_ATTRIBUTE_BLOCKED', `Inline event attribute "${key}" is not allowed.`);
|
|
949
|
+
}
|
|
950
|
+
if (isCraftUrlAttribute(normalizedKey) && value !== null && value !== undefined) {
|
|
951
|
+
const policy = context.injector.get(CRAFT_SECURITY_POLICY, null);
|
|
952
|
+
const urlOptions = {
|
|
953
|
+
allowedOrigins: policy?.dom.allowedResourceOrigins ?? [],
|
|
954
|
+
allowedSchemes: policy?.dom.allowedUrlSchemes ?? undefined,
|
|
955
|
+
};
|
|
956
|
+
const resource = isCraftResourceUrlAttribute(normalizedKey);
|
|
957
|
+
value = isCraftMultiUrlAttribute(normalizedKey)
|
|
958
|
+
? safeUrlList(value, resource, urlOptions)
|
|
959
|
+
: resource
|
|
960
|
+
? safeResourceUrl(value, urlOptions)
|
|
961
|
+
: safeUrl(value, urlOptions);
|
|
962
|
+
}
|
|
924
963
|
if (key.startsWith('data-craft-')) {
|
|
925
964
|
const dev = typeof ngDevMode === 'undefined' || ngDevMode;
|
|
926
965
|
if (dev) {
|
|
@@ -934,6 +973,19 @@ function applyAttribute(renderer, element, key, value, context) {
|
|
|
934
973
|
}
|
|
935
974
|
return;
|
|
936
975
|
}
|
|
976
|
+
if (key === 'innerHTML') {
|
|
977
|
+
const security = context.injector.get(CRAFT_SECURITY_POLICY, null);
|
|
978
|
+
if (isCraftSafeHtml(value)) {
|
|
979
|
+
renderer.setProperty(element, key, value.value);
|
|
980
|
+
}
|
|
981
|
+
else if (isCraftUnsafeHtml(value) && security?.dom.allowUnsafeHtml) {
|
|
982
|
+
renderer.setProperty(element, key, value.value);
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
throw new CraftDomSecurityError('CRAFT_DOM_RAW_HTML_BLOCKED', 'Use sanitizedHtml(...) or an explicit, audited unsafeHtml(...) policy.');
|
|
986
|
+
}
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
937
989
|
if (PROPERTY_NAMES.has(key)) {
|
|
938
990
|
renderer.setProperty(element, key, value ?? false);
|
|
939
991
|
if (value === null || value === undefined || value === false) {
|
|
@@ -954,6 +1006,26 @@ function applyAttribute(renderer, element, key, value, context) {
|
|
|
954
1006
|
renderer.setAttribute(element, key, value === true ? '' : String(value));
|
|
955
1007
|
}
|
|
956
1008
|
}
|
|
1009
|
+
/** Exporté pour la suite de non-régression sécurité. */
|
|
1010
|
+
export function ɵassertSafeStyleValue(value, resourceOrigins = []) {
|
|
1011
|
+
if (value === null || value === undefined || value === false)
|
|
1012
|
+
return;
|
|
1013
|
+
if (typeof value !== 'string' && typeof value !== 'number') {
|
|
1014
|
+
throw new CraftDomSecurityError('CRAFT_DOM_STYLE_INVALID', 'Style values must be strings or numbers.');
|
|
1015
|
+
}
|
|
1016
|
+
const text = String(value);
|
|
1017
|
+
if (/expression\s*\(|behaviou?r\s*:|-moz-binding|@import|<\s*\/style/i.test(text)) {
|
|
1018
|
+
throw new CraftDomSecurityError('CRAFT_DOM_STYLE_BLOCKED', 'Potentially executable CSS is not allowed.');
|
|
1019
|
+
}
|
|
1020
|
+
// Chaque url() passe par le même garde-fou que les attributs d'URL, ce qui
|
|
1021
|
+
// écarte les schémas exécutables comme les chargements protocol-relative.
|
|
1022
|
+
for (const match of text.matchAll(/url\s*\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*))\)/gi)) {
|
|
1023
|
+
const url = (match[1] ?? match[2] ?? match[3] ?? '').trim();
|
|
1024
|
+
if (url === '')
|
|
1025
|
+
continue;
|
|
1026
|
+
safeResourceUrl(url, { allowedOrigins: resourceOrigins });
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
957
1029
|
class ElementRenderedNode {
|
|
958
1030
|
kind = 'element';
|
|
959
1031
|
children = [];
|
|
@@ -1407,8 +1479,8 @@ function createFragment(parent, before, context, children, label) {
|
|
|
1407
1479
|
const end = mountComment(parent, `${label}:end`, before, context);
|
|
1408
1480
|
return new FragmentRenderedNode(parent, start, end, context, children);
|
|
1409
1481
|
}
|
|
1410
|
-
class
|
|
1411
|
-
kind = '
|
|
1482
|
+
class ForRenderedNode {
|
|
1483
|
+
kind = 'for';
|
|
1412
1484
|
entries = new Map();
|
|
1413
1485
|
ordered = [];
|
|
1414
1486
|
emptyView;
|
|
@@ -1431,14 +1503,14 @@ class EachRenderedNode {
|
|
|
1431
1503
|
this.start = start;
|
|
1432
1504
|
this.end = end;
|
|
1433
1505
|
this.context = context;
|
|
1434
|
-
this.scheduler =
|
|
1506
|
+
this.scheduler = createForScheduler({
|
|
1435
1507
|
enabled: false,
|
|
1436
1508
|
strategy: 'sync',
|
|
1437
1509
|
frameBudgetMs: 4,
|
|
1438
1510
|
});
|
|
1439
1511
|
this.configureScheduler(node.schedule);
|
|
1440
1512
|
this.descriptor = signal(node);
|
|
1441
|
-
this.effectRef = createRenderEffect(context, '
|
|
1513
|
+
this.effectRef = createRenderEffect(context, 'for-node', () => {
|
|
1442
1514
|
const previousItemTemplate = this.node.itemTemplate;
|
|
1443
1515
|
this.node = this.descriptor();
|
|
1444
1516
|
this.configureScheduler(this.node.schedule);
|
|
@@ -1452,7 +1524,7 @@ class EachRenderedNode {
|
|
|
1452
1524
|
return this.end;
|
|
1453
1525
|
}
|
|
1454
1526
|
patch(node) {
|
|
1455
|
-
if (node.kind !== '
|
|
1527
|
+
if (node.kind !== 'for') {
|
|
1456
1528
|
return false;
|
|
1457
1529
|
}
|
|
1458
1530
|
this.descriptor.set(node);
|
|
@@ -1465,7 +1537,7 @@ class EachRenderedNode {
|
|
|
1465
1537
|
const seenKeys = new Set();
|
|
1466
1538
|
keys.forEach((key) => {
|
|
1467
1539
|
if (seenKeys.has(key)) {
|
|
1468
|
-
throw new Error(`
|
|
1540
|
+
throw new Error(`forNode() received the duplicate key "${String(key)}".`);
|
|
1469
1541
|
}
|
|
1470
1542
|
seenKeys.add(key);
|
|
1471
1543
|
});
|
|
@@ -1525,7 +1597,7 @@ class EachRenderedNode {
|
|
|
1525
1597
|
index,
|
|
1526
1598
|
traceState,
|
|
1527
1599
|
rendered: false,
|
|
1528
|
-
view: createFragment(this.parent, this.end, entryContext, [], `craft-
|
|
1600
|
+
view: createFragment(this.parent, this.end, entryContext, [], `craft-for:${String(key)}`),
|
|
1529
1601
|
};
|
|
1530
1602
|
entriesToRender.push(entry);
|
|
1531
1603
|
}
|
|
@@ -1558,13 +1630,13 @@ class EachRenderedNode {
|
|
|
1558
1630
|
this.schedulePolicy = policy;
|
|
1559
1631
|
this.schedulerConfigured = true;
|
|
1560
1632
|
this.cancelPendingTasks();
|
|
1561
|
-
const injected = this.context.injector.get(
|
|
1633
|
+
const injected = this.context.injector.get(FOR_SCHEDULER, null);
|
|
1562
1634
|
if (injected) {
|
|
1563
1635
|
this.scheduler = injected;
|
|
1564
1636
|
this.ownsScheduler = false;
|
|
1565
1637
|
return;
|
|
1566
1638
|
}
|
|
1567
|
-
this.scheduler =
|
|
1639
|
+
this.scheduler = createForScheduler(policy ?? { enabled: false, strategy: 'sync', frameBudgetMs: 4 });
|
|
1568
1640
|
this.ownsScheduler = true;
|
|
1569
1641
|
}
|
|
1570
1642
|
scheduleEntryRender(entry) {
|
|
@@ -1581,7 +1653,7 @@ class EachRenderedNode {
|
|
|
1581
1653
|
return;
|
|
1582
1654
|
}
|
|
1583
1655
|
entry.renderEffect?.destroy();
|
|
1584
|
-
entry.renderEffect = createRenderEffect(this.context, '
|
|
1656
|
+
entry.renderEffect = createRenderEffect(this.context, 'for-item', () => entry.view.patchChildren(this.renderItem(entry.traceState, entry.item, entry.index, entry.key)));
|
|
1585
1657
|
entry.rendered = true;
|
|
1586
1658
|
});
|
|
1587
1659
|
scheduled.handle = handle;
|
|
@@ -1597,7 +1669,7 @@ class EachRenderedNode {
|
|
|
1597
1669
|
return renderBlockChildren(childContext(this.context, {
|
|
1598
1670
|
traceState,
|
|
1599
1671
|
identity: childCraftRenderIdentity(this.context.identity, `item:${String(key)}`),
|
|
1600
|
-
}), '
|
|
1672
|
+
}), 'for', this.node.itemTemplate, [
|
|
1601
1673
|
function* () {
|
|
1602
1674
|
return item;
|
|
1603
1675
|
},
|
|
@@ -1619,7 +1691,7 @@ class EachRenderedNode {
|
|
|
1619
1691
|
removeNode(this.context.renderer, this.end);
|
|
1620
1692
|
}
|
|
1621
1693
|
}
|
|
1622
|
-
class
|
|
1694
|
+
class IfRenderedNode {
|
|
1623
1695
|
kind = 'if';
|
|
1624
1696
|
view;
|
|
1625
1697
|
active;
|
|
@@ -1632,7 +1704,7 @@ class IfBlockRenderedNode {
|
|
|
1632
1704
|
this.context = context;
|
|
1633
1705
|
this.descriptor = signal(node);
|
|
1634
1706
|
this.view = createFragment(parent, before, context, [], `craft-if:${node.conditionName}`);
|
|
1635
|
-
this.effectRef = createRenderEffect(context, 'if-
|
|
1707
|
+
this.effectRef = createRenderEffect(context, 'if-node', () => {
|
|
1636
1708
|
this.node = this.descriptor();
|
|
1637
1709
|
this.active = this.isTrue();
|
|
1638
1710
|
this.view.patchChildren(this.children());
|
|
@@ -1666,8 +1738,8 @@ class IfBlockRenderedNode {
|
|
|
1666
1738
|
this.view.destroy();
|
|
1667
1739
|
}
|
|
1668
1740
|
}
|
|
1669
|
-
class
|
|
1670
|
-
kind = 'match
|
|
1741
|
+
class MatchRenderedNode {
|
|
1742
|
+
kind = 'match';
|
|
1671
1743
|
view;
|
|
1672
1744
|
handledExceptionCode;
|
|
1673
1745
|
descriptor;
|
|
@@ -1678,8 +1750,8 @@ class MatchBlockRenderedNode {
|
|
|
1678
1750
|
this.node = node;
|
|
1679
1751
|
this.context = context;
|
|
1680
1752
|
this.descriptor = signal(node);
|
|
1681
|
-
this.view = createFragment(parent, before, context, [], 'craft-match-
|
|
1682
|
-
this.effectRef = createRenderEffect(context, 'match-
|
|
1753
|
+
this.view = createFragment(parent, before, context, [], 'craft-match-node');
|
|
1754
|
+
this.effectRef = createRenderEffect(context, 'match-node', () => {
|
|
1683
1755
|
this.node = this.descriptor();
|
|
1684
1756
|
this.view.patchChildren(this.children());
|
|
1685
1757
|
});
|
|
@@ -1691,7 +1763,7 @@ class MatchBlockRenderedNode {
|
|
|
1691
1763
|
return this.view.lastNode();
|
|
1692
1764
|
}
|
|
1693
1765
|
patch(node) {
|
|
1694
|
-
if (node.kind !== 'match
|
|
1766
|
+
if (node.kind !== 'match' || node.key !== this.node.key) {
|
|
1695
1767
|
return false;
|
|
1696
1768
|
}
|
|
1697
1769
|
this.descriptor.set(node);
|
|
@@ -1763,8 +1835,8 @@ function reattachRange(renderer, holder, anchor, fallbackParent) {
|
|
|
1763
1835
|
}
|
|
1764
1836
|
/** Stands in for reporters that do not identify themselves (component renders). */
|
|
1765
1837
|
const ANONYMOUS_EXCEPTION_REPORTER = {};
|
|
1766
|
-
class
|
|
1767
|
-
kind = 'catch
|
|
1838
|
+
class CatchRenderedNode {
|
|
1839
|
+
kind = 'catch';
|
|
1768
1840
|
start;
|
|
1769
1841
|
end;
|
|
1770
1842
|
sourceView;
|
|
@@ -1783,8 +1855,8 @@ class CatchBlockRenderedNode {
|
|
|
1783
1855
|
this.parent = parent;
|
|
1784
1856
|
this.context = context;
|
|
1785
1857
|
this.fallbackPosition = node.position;
|
|
1786
|
-
this.start = mountComment(parent, 'craft-catch-
|
|
1787
|
-
this.end = mountComment(parent, 'craft-catch-
|
|
1858
|
+
this.start = mountComment(parent, 'craft-catch-node:start', before, context);
|
|
1859
|
+
this.end = mountComment(parent, 'craft-catch-node:end', before, context);
|
|
1788
1860
|
// The fallback renders in the OUTER context: an exception thrown by a
|
|
1789
1861
|
// fallback belongs to the next boundary up, never to this one.
|
|
1790
1862
|
const createFallback = () => createFragment(parent, this.end, this.context, [], 'craft-catch-fallback');
|
|
@@ -1813,7 +1885,7 @@ class CatchBlockRenderedNode {
|
|
|
1813
1885
|
return this.end;
|
|
1814
1886
|
}
|
|
1815
1887
|
patch(node) {
|
|
1816
|
-
if (node.kind !== 'catch
|
|
1888
|
+
if (node.kind !== 'catch' || node.position !== this.node.position) {
|
|
1817
1889
|
return false;
|
|
1818
1890
|
}
|
|
1819
1891
|
this.node = node;
|
|
@@ -1852,7 +1924,7 @@ class CatchBlockRenderedNode {
|
|
|
1852
1924
|
this.handling = true;
|
|
1853
1925
|
this.fallbackVisible = true;
|
|
1854
1926
|
try {
|
|
1855
|
-
const resolved =
|
|
1927
|
+
const resolved = resolveCatchHandler(handler, exception, true, this.node.position);
|
|
1856
1928
|
this.applyPosition(resolved.position);
|
|
1857
1929
|
this.fallbackView.patchChildren(hasLiveRegion(resolved.children)
|
|
1858
1930
|
? resolved.children
|
|
@@ -1995,7 +2067,7 @@ function hasLiveRegion(children) {
|
|
|
1995
2067
|
live === 'assertive');
|
|
1996
2068
|
}
|
|
1997
2069
|
/**
|
|
1998
|
-
* The `
|
|
2070
|
+
* The `pendingNode` boundary.
|
|
1999
2071
|
*
|
|
2000
2072
|
* Layout is fixed at construction — a fallback fragment and a source fragment,
|
|
2001
2073
|
* ordered by `position` — so showing or hiding the fallback never reconciles
|
|
@@ -2007,8 +2079,8 @@ function hasLiveRegion(children) {
|
|
|
2007
2079
|
* the suspended bindings stay subscribed to their source's `status`, so they
|
|
2008
2080
|
* re-run — and release their token — the moment the data arrives.
|
|
2009
2081
|
*/
|
|
2010
|
-
class
|
|
2011
|
-
kind = 'pending
|
|
2082
|
+
class PendingRenderedNode {
|
|
2083
|
+
kind = 'pending';
|
|
2012
2084
|
start;
|
|
2013
2085
|
end;
|
|
2014
2086
|
sourceView;
|
|
@@ -2037,7 +2109,7 @@ class PendingBlockRenderedNode {
|
|
|
2037
2109
|
node.ssr === 'client' &&
|
|
2038
2110
|
!node.handlers &&
|
|
2039
2111
|
!node.fallback) {
|
|
2040
|
-
throw new Error('
|
|
2112
|
+
throw new Error('pendingNode({ ssr: "client" }) requires an explicit fallback or shell.');
|
|
2041
2113
|
}
|
|
2042
2114
|
this.start = mountComment(parent, 'craft-pending:start', before, context);
|
|
2043
2115
|
this.end = mountComment(parent, 'craft-pending:end', before, context);
|
|
@@ -2085,7 +2157,7 @@ class PendingBlockRenderedNode {
|
|
|
2085
2157
|
return this.end;
|
|
2086
2158
|
}
|
|
2087
2159
|
patch(node) {
|
|
2088
|
-
if (node.kind !== 'pending
|
|
2160
|
+
if (node.kind !== 'pending') {
|
|
2089
2161
|
return false;
|
|
2090
2162
|
}
|
|
2091
2163
|
const next = node;
|
|
@@ -2205,7 +2277,7 @@ class PendingBlockRenderedNode {
|
|
|
2205
2277
|
}
|
|
2206
2278
|
const handler = handlers[source];
|
|
2207
2279
|
const inner = handler
|
|
2208
|
-
?
|
|
2280
|
+
? resolvePendingHandler(handler, suspended ? 'pending' : 'reloading')
|
|
2209
2281
|
: [];
|
|
2210
2282
|
return this.announceFallback(inner, true);
|
|
2211
2283
|
}
|
|
@@ -2284,8 +2356,8 @@ class PendingBlockRenderedNode {
|
|
|
2284
2356
|
this.focused = undefined;
|
|
2285
2357
|
}
|
|
2286
2358
|
}
|
|
2287
|
-
class
|
|
2288
|
-
kind = 'field-
|
|
2359
|
+
class FieldErrorRenderedNode {
|
|
2360
|
+
kind = 'field-error';
|
|
2289
2361
|
boundaryId = nextFieldExceptionBoundaryId++;
|
|
2290
2362
|
descriptor;
|
|
2291
2363
|
sourcesVersion = signal(0);
|
|
@@ -2299,9 +2371,9 @@ class FieldExceptionBlockRenderedNode {
|
|
|
2299
2371
|
this.node = node;
|
|
2300
2372
|
this.context = context;
|
|
2301
2373
|
this.descriptor = signal(node);
|
|
2302
|
-
this.view = createFragment(parent, before, this.boundaryContext(), [node.source], 'craft-field-
|
|
2374
|
+
this.view = createFragment(parent, before, this.boundaryContext(), [node.source], 'craft-field-error-node');
|
|
2303
2375
|
this.componentSourceCleanups = componentFieldExceptionSources(context.componentContext).map((source) => this.register(source));
|
|
2304
|
-
this.effectRef = createRenderEffect(context, 'field-
|
|
2376
|
+
this.effectRef = createRenderEffect(context, 'field-error-node', () => {
|
|
2305
2377
|
this.node = this.descriptor();
|
|
2306
2378
|
this.sourcesVersion();
|
|
2307
2379
|
const fallbacks = this.renderFallbacks();
|
|
@@ -2317,7 +2389,7 @@ class FieldExceptionBlockRenderedNode {
|
|
|
2317
2389
|
return this.view.lastNode();
|
|
2318
2390
|
}
|
|
2319
2391
|
patch(node) {
|
|
2320
|
-
if (node.kind !== 'field-
|
|
2392
|
+
if (node.kind !== 'field-error')
|
|
2321
2393
|
return false;
|
|
2322
2394
|
this.descriptor.set(node);
|
|
2323
2395
|
return true;
|
|
@@ -2693,7 +2765,7 @@ class ComponentRenderedNode {
|
|
|
2693
2765
|
typeof factoryContext === 'object' &&
|
|
2694
2766
|
factoryContext !== null &&
|
|
2695
2767
|
'then' in factoryContext) {
|
|
2696
|
-
throw new Error('Async component factories are not renderable directly. Move asynchronous work behind
|
|
2768
|
+
throw new Error('Async component factories are not renderable directly. Move asynchronous work behind deferNode().');
|
|
2697
2769
|
}
|
|
2698
2770
|
this.factoryContext = factoryContext;
|
|
2699
2771
|
if (!composition) {
|
|
@@ -2798,7 +2870,7 @@ class ComponentRenderedNode {
|
|
|
2798
2870
|
let factoryContext;
|
|
2799
2871
|
let renderContext;
|
|
2800
2872
|
const handledResourceExceptionCodes = new Set();
|
|
2801
|
-
const componentBoundary = composition.
|
|
2873
|
+
const componentBoundary = composition.catchNodePosition
|
|
2802
2874
|
? (exception) => {
|
|
2803
2875
|
if (!composition.catchHandlers?.[exception._tag]) {
|
|
2804
2876
|
return context.exceptionBoundary?.(exception) ?? false;
|
|
@@ -2840,7 +2912,7 @@ class ComponentRenderedNode {
|
|
|
2840
2912
|
if (typeof factoryContext === 'object' &&
|
|
2841
2913
|
factoryContext !== null &&
|
|
2842
2914
|
'then' in factoryContext) {
|
|
2843
|
-
throw new Error('Async component factories are not renderable directly. Move asynchronous work behind
|
|
2915
|
+
throw new Error('Async component factories are not renderable directly. Move asynchronous work behind deferNode().');
|
|
2844
2916
|
}
|
|
2845
2917
|
this.registerRuntimeTargets(definition, factoryContext, renderInjector);
|
|
2846
2918
|
}
|
|
@@ -2860,7 +2932,7 @@ class ComponentRenderedNode {
|
|
|
2860
2932
|
}
|
|
2861
2933
|
this.composedTemplateEffect = untracked(() => runInInjectionContext(renderInjector, () => craftEffect('component-template', () => {
|
|
2862
2934
|
this.renderComposedTemplate(definition, factoryContext, renderInjector, renderContext, context, hostTarget);
|
|
2863
|
-
if (composition.
|
|
2935
|
+
if (composition.catchNodePosition &&
|
|
2864
2936
|
!this.componentExceptionEffect) {
|
|
2865
2937
|
this.installComponentExceptionEffect(definition, factoryContext, renderInjector, renderContext, context, hostTarget);
|
|
2866
2938
|
}
|
|
@@ -2871,7 +2943,7 @@ class ComponentRenderedNode {
|
|
|
2871
2943
|
});
|
|
2872
2944
|
}
|
|
2873
2945
|
installComponentExceptionEffect(definition, factoryContext, renderInjector, renderContext, context, hostTarget) {
|
|
2874
|
-
this.componentExceptionEffect = untracked(() => runInInjectionContext(renderInjector, () => craftEffect('component-catch-
|
|
2946
|
+
this.componentExceptionEffect = untracked(() => runInInjectionContext(renderInjector, () => craftEffect('component-catch-node-resource-exceptions', () => {
|
|
2875
2947
|
const exception = findResourceException(factoryContext);
|
|
2876
2948
|
if (exception) {
|
|
2877
2949
|
if (renderContext.handledResourceExceptionCodes?.has(exception._tag)) {
|
|
@@ -2914,7 +2986,7 @@ class ComponentRenderedNode {
|
|
|
2914
2986
|
try {
|
|
2915
2987
|
this.traceState.renderCount += 1;
|
|
2916
2988
|
const rendered = this.composedTemplateChildren(definition, factoryContext, renderContext);
|
|
2917
|
-
const children = this.
|
|
2989
|
+
const children = this.withComponentFieldError(definition, rendered.children);
|
|
2918
2990
|
this.latestTemplate = children;
|
|
2919
2991
|
this.view.patchChildren(children);
|
|
2920
2992
|
this.hostBindings?.patch(rendered.hostProps);
|
|
@@ -2939,13 +3011,13 @@ class ComponentRenderedNode {
|
|
|
2939
3011
|
hostProps,
|
|
2940
3012
|
};
|
|
2941
3013
|
}
|
|
2942
|
-
|
|
3014
|
+
withComponentFieldError(definition, children) {
|
|
2943
3015
|
const handlers = definition.composition?.fieldExceptionHandlers;
|
|
2944
3016
|
const options = definition.composition?.fieldExceptionOptions;
|
|
2945
3017
|
if (!handlers || !options)
|
|
2946
3018
|
return children;
|
|
2947
3019
|
return {
|
|
2948
|
-
kind: 'field-
|
|
3020
|
+
kind: 'field-error',
|
|
2949
3021
|
source: children,
|
|
2950
3022
|
handlers,
|
|
2951
3023
|
options,
|
|
@@ -2981,17 +3053,17 @@ class ComponentRenderedNode {
|
|
|
2981
3053
|
this.view.patchChildren([]);
|
|
2982
3054
|
}
|
|
2983
3055
|
else {
|
|
2984
|
-
const resolved = runInInjectionContext(environmentInjector, () =>
|
|
3056
|
+
const resolved = runInInjectionContext(environmentInjector, () => resolveCatchHandler(blockHandler, exception, false, definition.composition?.catchNodePosition ?? 'after'));
|
|
2985
3057
|
if (preserveFactoryContext && resolved.showSource) {
|
|
2986
3058
|
try {
|
|
2987
3059
|
const source = untracked(() => this.composedTemplateChildren(definition, this.factoryContext, renderContext));
|
|
2988
3060
|
const children = resolved.position === 'before'
|
|
2989
3061
|
? [
|
|
2990
3062
|
resolved.children,
|
|
2991
|
-
this.
|
|
3063
|
+
this.withComponentFieldError(definition, source.children),
|
|
2992
3064
|
]
|
|
2993
3065
|
: [
|
|
2994
|
-
this.
|
|
3066
|
+
this.withComponentFieldError(definition, source.children),
|
|
2995
3067
|
resolved.children,
|
|
2996
3068
|
];
|
|
2997
3069
|
this.view.patchChildren(children);
|
|
@@ -3365,13 +3437,13 @@ function mountNode(node, parent, before, context) {
|
|
|
3365
3437
|
: context, undefined, undefined, [], node.declarationContext);
|
|
3366
3438
|
case 'directive':
|
|
3367
3439
|
return new CraftDirectiveRenderedNode(node, parent, before, context);
|
|
3368
|
-
case '
|
|
3369
|
-
const start = mountComment(parent, 'craft-
|
|
3370
|
-
const end = mountComment(parent, 'craft-
|
|
3371
|
-
return new
|
|
3440
|
+
case 'for': {
|
|
3441
|
+
const start = mountComment(parent, 'craft-for:start', before, context);
|
|
3442
|
+
const end = mountComment(parent, 'craft-for:end', before, context);
|
|
3443
|
+
return new ForRenderedNode(node, parent, start, end, context);
|
|
3372
3444
|
}
|
|
3373
3445
|
case 'if': {
|
|
3374
|
-
return new
|
|
3446
|
+
return new IfRenderedNode(node, parent, before, context);
|
|
3375
3447
|
}
|
|
3376
3448
|
case 'heading': {
|
|
3377
3449
|
return new HeadingRenderedNode(node, parent, before, context);
|
|
@@ -3379,17 +3451,17 @@ function mountNode(node, parent, before, context) {
|
|
|
3379
3451
|
case 'heading-section': {
|
|
3380
3452
|
return new HeadingSectionRenderedNode(node, parent, before, context);
|
|
3381
3453
|
}
|
|
3382
|
-
case 'pending
|
|
3383
|
-
return new
|
|
3454
|
+
case 'pending': {
|
|
3455
|
+
return new PendingRenderedNode(node, parent, before, context);
|
|
3384
3456
|
}
|
|
3385
|
-
case 'catch
|
|
3386
|
-
return new
|
|
3457
|
+
case 'catch': {
|
|
3458
|
+
return new CatchRenderedNode(node, parent, before, context);
|
|
3387
3459
|
}
|
|
3388
|
-
case 'field-
|
|
3389
|
-
return new
|
|
3460
|
+
case 'field-error': {
|
|
3461
|
+
return new FieldErrorRenderedNode(node, parent, before, context);
|
|
3390
3462
|
}
|
|
3391
|
-
case 'match
|
|
3392
|
-
return new
|
|
3463
|
+
case 'match': {
|
|
3464
|
+
return new MatchRenderedNode(node, parent, before, context);
|
|
3393
3465
|
}
|
|
3394
3466
|
case 'defer':
|
|
3395
3467
|
return new DeferRenderedNode(node, parent, before, context);
|
|
@@ -3507,7 +3579,9 @@ export function mountInterpretedComponent(component, host, injector, props) {
|
|
|
3507
3579
|
(typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot)
|
|
3508
3580
|
? rootNode
|
|
3509
3581
|
: (host.ownerDocument ?? document);
|
|
3510
|
-
const styles = craftInjector.get(CRAFT_STYLE_REGISTRY,
|
|
3582
|
+
const styles = craftInjector.get(CRAFT_STYLE_REGISTRY, createCraftStyleRegistry({
|
|
3583
|
+
nonce: craftInjector.get(CraftCspNonce, null) ?? undefined,
|
|
3584
|
+
}));
|
|
3511
3585
|
return mountInterpretedComponentWithOptions(component, host, craftInjector, props, { renderer, styleRoot, styles });
|
|
3512
3586
|
}
|
|
3513
3587
|
export function mountInterpretedComponentWithOptions(component, host, injector, props, options) {
|
|
@@ -3552,7 +3626,9 @@ export function mountInterpretedComponentTemplate(component, host, injector, con
|
|
|
3552
3626
|
(typeof ShadowRoot !== 'undefined' && rootNode instanceof ShadowRoot)
|
|
3553
3627
|
? rootNode
|
|
3554
3628
|
: (host.ownerDocument ?? document);
|
|
3555
|
-
const styles = craftInjector.get(CRAFT_STYLE_REGISTRY,
|
|
3629
|
+
const styles = craftInjector.get(CRAFT_STYLE_REGISTRY, createCraftStyleRegistry({
|
|
3630
|
+
nonce: craftInjector.get(CraftCspNonce, null) ?? undefined,
|
|
3631
|
+
}));
|
|
3556
3632
|
let instance;
|
|
3557
3633
|
try {
|
|
3558
3634
|
instance = new ComponentRenderedNode(component, {}, host, null, {
|
|
@@ -3585,4 +3661,3 @@ export function mountInterpretedComponentTemplate(component, host, injector, con
|
|
|
3585
3661
|
},
|
|
3586
3662
|
};
|
|
3587
3663
|
}
|
|
3588
|
-
//# sourceMappingURL=interpreter.js.map
|
|
@@ -4,7 +4,8 @@ export declare class CraftSsrCoordinator implements CraftSsrRuntime {
|
|
|
4
4
|
private readonly listeners;
|
|
5
5
|
private failure;
|
|
6
6
|
private readonly decideResource;
|
|
7
|
-
|
|
7
|
+
private readonly defaultTimeoutMs;
|
|
8
|
+
constructor(decideResource?: (source: string, mode: SsrMode) => void, defaultTimeoutMs?: number);
|
|
8
9
|
suspend(token: object, source: string, mode: SsrMode | undefined, options?: Readonly<{
|
|
9
10
|
route?: string;
|
|
10
11
|
timeoutMs?: number;
|
|
@@ -14,7 +15,8 @@ export declare class CraftSsrCoordinator implements CraftSsrRuntime {
|
|
|
14
15
|
unhandled(source: string, route?: string): never;
|
|
15
16
|
untilSettled(timeoutMs: number, signal?: AbortSignal): Promise<void>;
|
|
16
17
|
sources(): readonly string[];
|
|
18
|
+
/** Releases source timers and waiters when the request is aborted. */
|
|
19
|
+
dispose(): void;
|
|
17
20
|
private throwFailure;
|
|
18
21
|
private nextChange;
|
|
19
22
|
}
|
|
20
|
-
//# sourceMappingURL=ssr-coordinator.d.ts.map
|