@pithyjs/core 0.1.0-beta.1 → 0.1.0-beta.11
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/README.md +12 -6
- package/dist/a11y/focus-trap.d.ts.map +1 -1
- package/dist/a11y/focus-trap.js +2 -0
- package/dist/a11y/focus-trap.js.map +1 -1
- package/dist/a11y/index.d.ts +4 -4
- package/dist/a11y/index.js +4 -4
- package/dist/a11y/index.js.map +1 -1
- package/dist/a11y/keyboard-utils.js.map +1 -1
- package/dist/a11y/roving-tabindex.js.map +1 -1
- package/dist/a11y/skip-link.js.map +1 -1
- package/dist/compile/bindSwitchCases.d.ts +8 -3
- package/dist/compile/bindSwitchCases.d.ts.map +1 -1
- package/dist/compile/bindSwitchCases.js +114 -181
- package/dist/compile/bindSwitchCases.js.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.d.ts +1 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.js +47 -2
- package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
- package/dist/compile/binds/bindClassDirectives.d.ts +3 -2
- package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindClassDirectives.js +53 -18
- package/dist/compile/binds/bindClassDirectives.js.map +1 -1
- package/dist/compile/binds/bindComponentsTags.d.ts +2 -0
- package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
- package/dist/compile/binds/bindComponentsTags.js +86 -46
- package/dist/compile/binds/bindComponentsTags.js.map +1 -1
- package/dist/compile/binds/bindConditionals.d.ts +2 -2
- package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
- package/dist/compile/binds/bindConditionals.js +22 -5
- package/dist/compile/binds/bindConditionals.js.map +1 -1
- package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
- package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
- package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.js +4 -4
- package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.js +8 -3
- package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
- package/dist/compile/binds/bindEventHandlers.js +2 -2
- package/dist/compile/binds/bindEventHandlers.js.map +1 -1
- package/dist/compile/binds/bindRefDirectives.js.map +1 -1
- package/dist/compile/binds/bindStyleDirectives.d.ts +17 -0
- package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -0
- package/dist/compile/binds/bindStyleDirectives.js +47 -0
- package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
- package/dist/compile/binds/bindTextInterpolations.d.ts +2 -1
- package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
- package/dist/compile/binds/bindTextInterpolations.js +55 -17
- package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
- package/dist/compile/binds/directiveRegistry.js.map +1 -1
- package/dist/compile/binds/forwardedAttrs.js.map +1 -1
- package/dist/compile/binds/propNames.d.ts +14 -0
- package/dist/compile/binds/propNames.d.ts.map +1 -0
- package/dist/compile/binds/propNames.js +116 -0
- package/dist/compile/binds/propNames.js.map +1 -0
- package/dist/compile/compileExpression.js.map +1 -1
- package/dist/compile/compileNodes.d.ts.map +1 -1
- package/dist/compile/compileNodes.js +6 -3
- package/dist/compile/compileNodes.js.map +1 -1
- package/dist/compile/compileTemplate.d.ts +3 -4
- package/dist/compile/compileTemplate.d.ts.map +1 -1
- package/dist/compile/compileTemplate.js +28 -31
- package/dist/compile/compileTemplate.js.map +1 -1
- package/dist/compile/componentResult.js.map +1 -1
- package/dist/compile/contentProjection.d.ts +1 -1
- package/dist/compile/contentProjection.d.ts.map +1 -1
- package/dist/compile/contentProjection.js +32 -15
- package/dist/compile/contentProjection.js.map +1 -1
- package/dist/compile/forLoops/bindForLoops.d.ts +2 -2
- package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
- package/dist/compile/forLoops/bindForLoops.js +9 -22
- package/dist/compile/forLoops/bindForLoops.js.map +1 -1
- package/dist/compile/forLoops/createLoopManager.d.ts +3 -3
- package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
- package/dist/compile/forLoops/createLoopManager.js +40 -38
- package/dist/compile/forLoops/createLoopManager.js.map +1 -1
- package/dist/compile/forLoops/index.d.ts +5 -5
- package/dist/compile/forLoops/index.js +5 -5
- package/dist/compile/forLoops/index.js.map +1 -1
- package/dist/compile/forLoops/loopHelpers.d.ts +6 -0
- package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -1
- package/dist/compile/forLoops/loopHelpers.js +17 -0
- package/dist/compile/forLoops/loopHelpers.js.map +1 -1
- package/dist/compile/forLoops/loopSignals.js +2 -2
- package/dist/compile/forLoops/loopSignals.js.map +1 -1
- package/dist/compile/forLoops/loopTraversal.js +2 -2
- package/dist/compile/forLoops/loopTraversal.js.map +1 -1
- package/dist/compile/handleConditionalChain.d.ts +2 -2
- package/dist/compile/handleConditionalChain.d.ts.map +1 -1
- package/dist/compile/handleConditionalChain.js +22 -87
- package/dist/compile/handleConditionalChain.js.map +1 -1
- package/dist/compile/index.d.ts +17 -17
- package/dist/compile/index.js +14 -14
- package/dist/compile/index.js.map +1 -1
- package/dist/compile/injectScopedStyle.js.map +1 -1
- package/dist/compile/nodeExpando.d.ts +6 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -1
- package/dist/compile/nodeExpando.js.map +1 -1
- package/dist/compile/parseHtml.d.ts.map +1 -1
- package/dist/compile/parseHtml.js +2 -2
- package/dist/compile/parseHtml.js.map +1 -1
- package/dist/compile/pithyTreeToDom.js +1 -1
- package/dist/compile/pithyTreeToDom.js.map +1 -1
- package/dist/compile/renderBranch.d.ts +13 -0
- package/dist/compile/renderBranch.d.ts.map +1 -0
- package/dist/compile/renderBranch.js +65 -0
- package/dist/compile/renderBranch.js.map +1 -0
- package/dist/compile/renderChildren.d.ts +2 -2
- package/dist/compile/renderChildren.js +2 -2
- package/dist/compile/renderChildren.js.map +1 -1
- package/dist/compile/ssrCrashes.d.ts +1 -1
- package/dist/compile/ssrCrashes.js +3 -3
- package/dist/compile/ssrCrashes.js.map +1 -1
- package/dist/compile/ssrMode.js +1 -1
- package/dist/compile/ssrMode.js.map +1 -1
- package/dist/compile/textValue.js.map +1 -1
- package/dist/compile/trimBlankEdges.d.ts +2 -0
- package/dist/compile/trimBlankEdges.d.ts.map +1 -0
- package/dist/compile/trimBlankEdges.js +15 -0
- package/dist/compile/trimBlankEdges.js.map +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/ref-signal.interface.js.map +1 -1
- package/dist/interfaces/ref.interface.js.map +1 -1
- package/dist/runtime/applyBindings.d.ts +3 -3
- package/dist/runtime/applyBindings.d.ts.map +1 -1
- package/dist/runtime/applyBindings.js +74 -22
- package/dist/runtime/applyBindings.js.map +1 -1
- package/dist/runtime/bindings/applyComponent.d.ts +2 -2
- package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
- package/dist/runtime/bindings/applyComponent.js +41 -32
- package/dist/runtime/bindings/applyComponent.js.map +1 -1
- package/dist/runtime/bindings/applyDefer.d.ts +1 -1
- package/dist/runtime/bindings/applyDefer.js +6 -6
- package/dist/runtime/bindings/applyDefer.js.map +1 -1
- package/dist/runtime/bindings/applySimple.d.ts +1 -1
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
- package/dist/runtime/bindings/applySimple.js +45 -13
- package/dist/runtime/bindings/applySimple.js.map +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
- package/dist/runtime/bindings/applyStructural.js +58 -68
- package/dist/runtime/bindings/applyStructural.js.map +1 -1
- package/dist/runtime/bindings/helpers.d.ts +1 -1
- package/dist/runtime/bindings/helpers.js +1 -1
- package/dist/runtime/bindings/helpers.js.map +1 -1
- package/dist/runtime/bindings/index.d.ts +6 -6
- package/dist/runtime/bindings/index.d.ts.map +1 -1
- package/dist/runtime/bindings/index.js +5 -5
- package/dist/runtime/bindings/index.js.map +1 -1
- package/dist/runtime/bindings/types.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +1 -1
- package/dist/runtime/bootstrap.js +1 -1
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/createContextProxy.js.map +1 -1
- package/dist/runtime/deferHelpers.d.ts +1 -1
- package/dist/runtime/deferHelpers.js.map +1 -1
- package/dist/runtime/html.d.ts.map +1 -1
- package/dist/runtime/html.js +6 -5
- package/dist/runtime/html.js.map +1 -1
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.js +6 -6
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/lazy.js +1 -1
- package/dist/runtime/lazy.js.map +1 -1
- package/dist/runtime/module-cache.js.map +1 -1
- package/dist/runtime/onDestroy.d.ts +7 -0
- package/dist/runtime/onDestroy.d.ts.map +1 -1
- package/dist/runtime/onDestroy.js +16 -1
- package/dist/runtime/onDestroy.js.map +1 -1
- package/dist/runtime/parseIdentifiersFromTemplate.js +1 -1
- package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -1
- package/dist/runtime/resource/createAction.d.ts +1 -1
- package/dist/runtime/resource/createAction.js +1 -1
- package/dist/runtime/resource/createAction.js.map +1 -1
- package/dist/runtime/resource/createResource.d.ts +1 -1
- package/dist/runtime/resource/createResource.d.ts.map +1 -1
- package/dist/runtime/resource/createResource.js +3 -4
- package/dist/runtime/resource/createResource.js.map +1 -1
- package/dist/runtime/resource/engine.d.ts +1 -1
- package/dist/runtime/resource/engine.js.map +1 -1
- package/dist/runtime/resource/index.d.ts +3 -3
- package/dist/runtime/resource/index.js +2 -2
- package/dist/runtime/resource/index.js.map +1 -1
- package/dist/runtime/resource/types.js.map +1 -1
- package/dist/types/globals.d.ts +2 -2
- package/dist/types/globals.js.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/index.d.ts +2 -2
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/ref-signal.utility.d.ts +1 -1
- package/dist/utilities/ref-signal.utility.js.map +1 -1
- package/dist/utilities/ref.untility.d.ts +1 -1
- package/dist/utilities/ref.untility.js.map +1 -1
- package/package.json +11 -6
|
@@ -6,13 +6,16 @@
|
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
8
|
import { effect } from '@pithyjs/signals';
|
|
9
|
-
import { compileExpression } from '../compileExpression';
|
|
10
|
-
import { nodeExpando } from '../nodeExpando';
|
|
9
|
+
import { compileExpression } from '../compileExpression.js';
|
|
10
|
+
import { nodeExpando } from '../nodeExpando.js';
|
|
11
|
+
import { bindStyleProperties, declaredName } from './bindStyleDirectives.js';
|
|
12
|
+
const TOGGLE_PREFIX = 'data-class-toggle-';
|
|
11
13
|
/**
|
|
12
14
|
* Binds class directives like:
|
|
13
15
|
* • [class.active]="isActive"
|
|
14
16
|
* • [classes]="{ active: isActive() }"
|
|
15
17
|
* • [classes]="['a', 'b']"
|
|
18
|
+
* • [classes]="'a b'"
|
|
16
19
|
*
|
|
17
20
|
* @param root - The root node to search for class bindings
|
|
18
21
|
* @param ctx - Context object containing reactive variables and functions
|
|
@@ -24,11 +27,18 @@ export function bindClassDirectives(root, ctx, disposers) {
|
|
|
24
27
|
// Use element's own __pithyCtx when available (projected slot content
|
|
25
28
|
// carries the parent component's context via this property).
|
|
26
29
|
const elCtx = nodeExpando(el).__pithyCtx || ctx;
|
|
27
|
-
|
|
30
|
+
let declared;
|
|
28
31
|
for (const attr of Array.from(el.attributes)) {
|
|
29
|
-
if (!attr.name.startsWith(
|
|
32
|
+
if (!attr.name.startsWith(TOGGLE_PREFIX))
|
|
33
|
+
continue;
|
|
34
|
+
const expando = nodeExpando(el);
|
|
35
|
+
declared ?? (declared = [
|
|
36
|
+
...(expando.__classToggles ?? []),
|
|
37
|
+
...Object.keys(expando.__pithyNode?.directives?.classMap ?? {}),
|
|
38
|
+
]);
|
|
39
|
+
const className = declaredName(attr.name.slice(TOGGLE_PREFIX.length), declared);
|
|
40
|
+
if (!className)
|
|
30
41
|
continue;
|
|
31
|
-
const className = attr.name.slice('data-class-toggle-'.length);
|
|
32
42
|
const expression = attr.value;
|
|
33
43
|
// Remove directive attribute after capturing to prevent double-processing
|
|
34
44
|
// when component subtrees are inserted into an outer DOM that re-runs binders
|
|
@@ -52,7 +62,6 @@ export function bindClassDirectives(root, ctx, disposers) {
|
|
|
52
62
|
});
|
|
53
63
|
disposers.push(stop);
|
|
54
64
|
}
|
|
55
|
-
// Handle [classes]="{ active: isActive() }" or [classes]="['a', 'b']"
|
|
56
65
|
const classGroupExpr = el.getAttribute('data-classes');
|
|
57
66
|
if (classGroupExpr) {
|
|
58
67
|
// Remove directive attribute after capturing to prevent double-processing
|
|
@@ -65,9 +74,10 @@ export function bindClassDirectives(root, ctx, disposers) {
|
|
|
65
74
|
console.warn(`[PithyJS] ⚠️ Failed to compile [classes]="${classGroupExpr}"`, err);
|
|
66
75
|
return;
|
|
67
76
|
}
|
|
77
|
+
const owned = new Set();
|
|
68
78
|
const stop = effect(() => {
|
|
69
79
|
try {
|
|
70
|
-
applyClassGroup(el, evaluate());
|
|
80
|
+
applyClassGroup(el, evaluate(), owned);
|
|
71
81
|
}
|
|
72
82
|
catch (err) {
|
|
73
83
|
console.warn('[PithyJS] ⚠️ Failed to evaluate [classes]:', err);
|
|
@@ -75,23 +85,48 @@ export function bindClassDirectives(root, ctx, disposers) {
|
|
|
75
85
|
});
|
|
76
86
|
disposers.push(stop);
|
|
77
87
|
}
|
|
88
|
+
// After the classes, so the attributes serialise in the build's order.
|
|
89
|
+
bindStyleProperties(el, elCtx, disposers);
|
|
78
90
|
});
|
|
79
91
|
}
|
|
80
|
-
/** @codexApi {"parent":"pithy.runtime.classes","name":"applyClassGroup","stability":"internal","signature":"(el: Element, result: unknown) => void"} */
|
|
81
|
-
export function applyClassGroup(el, result) {
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
/** @codexApi {"parent":"pithy.runtime.classes","name":"applyClassGroup","stability":"internal","signature":"(el: Element, result: unknown, owned: Set<string>) => void"} */
|
|
93
|
+
export function applyClassGroup(el, result, owned) {
|
|
94
|
+
const named = new Map();
|
|
95
|
+
const name = (classes, on) => {
|
|
96
|
+
for (const c of classes.split(/[\t\n\f\r ]+/))
|
|
97
|
+
if (c)
|
|
98
|
+
named.set(c, on);
|
|
99
|
+
};
|
|
100
|
+
if (typeof result === 'string') {
|
|
101
|
+
name(result, true);
|
|
102
|
+
}
|
|
103
|
+
else if (Array.isArray(result)) {
|
|
104
|
+
for (const cls of result)
|
|
84
105
|
if (typeof cls === 'string')
|
|
85
|
-
|
|
86
|
-
}
|
|
106
|
+
name(cls, true);
|
|
87
107
|
}
|
|
88
108
|
else if (result && typeof result === 'object') {
|
|
89
|
-
for (const [cls, on] of Object.entries(result))
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
109
|
+
for (const [cls, on] of Object.entries(result))
|
|
110
|
+
name(cls, !!on);
|
|
111
|
+
}
|
|
112
|
+
else if (import.meta.env?.DEV && result) {
|
|
113
|
+
console.warn(`[PithyJS] ⚠️ [classes] expects a string, an array or an object, got ${typeof result}; the classes it added are removed.`);
|
|
114
|
+
}
|
|
115
|
+
// `owned` is this binding's own record, not the element's: a component's
|
|
116
|
+
// root `[classes]` and one forwarded from its tag share the element, and
|
|
117
|
+
// each may only remove the classes it added.
|
|
118
|
+
const previous = new Set(owned);
|
|
119
|
+
owned.clear();
|
|
120
|
+
for (const [c, on] of named) {
|
|
121
|
+
if (!on)
|
|
122
|
+
el.classList.remove(c);
|
|
123
|
+
else if (previous.has(c) || !el.classList.contains(c)) {
|
|
124
|
+
el.classList.add(c);
|
|
125
|
+
owned.add(c);
|
|
94
126
|
}
|
|
95
127
|
}
|
|
128
|
+
for (const c of previous)
|
|
129
|
+
if (!named.has(c))
|
|
130
|
+
el.classList.remove(c);
|
|
96
131
|
}
|
|
97
132
|
//# sourceMappingURL=bindClassDirectives.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindClassDirectives.js","sourceRoot":"","sources":["../../../src/compile/binds/bindClassDirectives.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"bindClassDirectives.js","sourceRoot":"","sources":["../../../src/compile/binds/bindClassDirectives.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1E,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAE3C;;;;;;;;;;GAUG;AACH,uNAAuN;AACvN,MAAM,UAAU,mBAAmB,CACjC,IAAgC,EAChC,GAA4B,EAC5B,SAAyB;IAEzB,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE;QACtC,sEAAsE;QACtE,6DAA6D;QAC7D,MAAM,KAAK,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC,UAAU,IAAI,GAAG,CAAC;QAEhD,IAAI,QAA8B,CAAC;QACnC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC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AAG,CAAC,CAAC,CAAC,CAAC;QACf,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.classes\",\n \"title\": \"Class Directive Binding System\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { effect } from '@pithyjs/signals';\nimport { compileExpression } from '../compileExpression';\nimport { nodeExpando } from '../nodeExpando';\nimport { bindStyleProperties, declaredName } from './bindStyleDirectives';\n\nconst TOGGLE_PREFIX = 'data-class-toggle-';\n\n/**\n * Binds class directives like:\n * • [class.active]=\"isActive\"\n * • [classes]=\"{ active: isActive() }\"\n * • [classes]=\"['a', 'b']\"\n * • [classes]=\"'a b'\"\n *\n * @param root - The root node to search for class bindings\n * @param ctx - Context object containing reactive variables and functions\n * @param disposers - Cleanup functions to remove subscriptions\n */\n/** @codexApi {\"parent\":\"pithy.runtime.classes\",\"name\":\"bindClassDirectives\",\"stability\":\"stable\",\"signature\":\"(root: Element | DocumentFragment, ctx: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function bindClassDirectives(\n root: Element | DocumentFragment,\n ctx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n root.querySelectorAll('*').forEach(el => {\n // Use element's own __pithyCtx when available (projected slot content\n // carries the parent component's context via this property).\n const elCtx = nodeExpando(el).__pithyCtx || ctx;\n\n let declared: string[] | undefined;\n for (const attr of Array.from(el.attributes)) {\n if (!attr.name.startsWith(TOGGLE_PREFIX)) continue;\n const expando = nodeExpando(el);\n declared ??= [\n ...(expando.__classToggles ?? []),\n ...Object.keys(expando.__pithyNode?.directives?.classMap ?? {}),\n ];\n const className = declaredName(\n attr.name.slice(TOGGLE_PREFIX.length),\n declared\n );\n if (!className) continue;\n const expression = attr.value;\n\n // Remove directive attribute after capturing to prevent double-processing\n // when component subtrees are inserted into an outer DOM that re-runs binders\n el.removeAttribute(attr.name);\n\n let evaluate: () => unknown;\n\n try {\n evaluate = compileExpression(expression, elCtx);\n } catch (err) {\n console.warn(\n `[PithyJS] ⚠️ Failed to compile [class.${className}]=\"${expression}\"`,\n err\n );\n return;\n }\n\n const stop = effect(() => {\n try {\n const result = evaluate();\n el.classList.toggle(className, !!result);\n } catch {\n /* ignore */\n }\n });\n\n disposers.push(stop);\n }\n\n const classGroupExpr = el.getAttribute('data-classes');\n if (classGroupExpr) {\n // Remove directive attribute after capturing to prevent double-processing\n el.removeAttribute('data-classes');\n\n let evaluate: () => unknown;\n\n try {\n evaluate = compileExpression(classGroupExpr, elCtx);\n } catch (err) {\n console.warn(\n `[PithyJS] ⚠️ Failed to compile [classes]=\"${classGroupExpr}\"`,\n err\n );\n return;\n }\n\n const owned = new Set<string>();\n const stop = effect(() => {\n try {\n applyClassGroup(el, evaluate(), owned);\n } catch (err) {\n console.warn('[PithyJS] ⚠️ Failed to evaluate [classes]:', err);\n }\n });\n\n disposers.push(stop);\n }\n\n // After the classes, so the attributes serialise in the build's order.\n bindStyleProperties(el, elCtx, disposers);\n });\n}\n\n/** @codexApi {\"parent\":\"pithy.runtime.classes\",\"name\":\"applyClassGroup\",\"stability\":\"internal\",\"signature\":\"(el: Element, result: unknown, owned: Set<string>) => void\"} */\nexport function applyClassGroup(\n el: Element,\n result: unknown,\n owned: Set<string>\n): void {\n const named = new Map<string, boolean>();\n const name = (classes: string, on: boolean) => {\n for (const c of classes.split(/[\\t\\n\\f\\r ]+/)) if (c) named.set(c, on);\n };\n if (typeof result === 'string') {\n name(result, true);\n } else if (Array.isArray(result)) {\n for (const cls of result) if (typeof cls === 'string') name(cls, true);\n } else if (result && typeof result === 'object') {\n for (const [cls, on] of Object.entries(result)) name(cls, !!on);\n } else if (import.meta.env?.DEV && result) {\n console.warn(\n `[PithyJS] ⚠️ [classes] expects a string, an array or an object, got ${typeof result}; the classes it added are removed.`\n );\n }\n\n // `owned` is this binding's own record, not the element's: a component's\n // root `[classes]` and one forwarded from its tag share the element, and\n // each may only remove the classes it added.\n const previous = new Set(owned);\n owned.clear();\n for (const [c, on] of named) {\n if (!on) el.classList.remove(c);\n else if (previous.has(c) || !el.classList.contains(c)) {\n el.classList.add(c);\n owned.add(c);\n }\n }\n for (const c of previous) if (!named.has(c)) el.classList.remove(c);\n}\n"]}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
+
/** Test-only: forget which tags were warned about, so each render warns as a fresh process would. */
|
|
9
|
+
export declare function __resetComponentTagWarnings(): void;
|
|
8
10
|
/**
|
|
9
11
|
* Replace custom component tags (<Counter/>, <NestedComponent/>) with rendered output.
|
|
10
12
|
* - Skips anything under a pending nested loop host (bind after loop expansion)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindComponentsTags.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindComponentsTags.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;
|
|
1
|
+
{"version":3,"file":"bindComponentsTags.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindComponentsTags.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AA+BF,qGAAqG;AACrG,wBAAgB,2BAA2B,IAAI,IAAI,CAElD;AAsJD;;;;;;GAMG;AACH,4NAA4N;AAC5N,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,OAAO,GAAG,gBAAgB,EAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAkWN"}
|
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
-
import { compileExpression } from '../compileExpression';
|
|
9
|
-
import { boundaryForElement, runWithBoundary } from './bindErrorBoundary';
|
|
10
|
-
import { collectSlotMap } from '../contentProjection';
|
|
8
|
+
import { compileExpression } from '../compileExpression.js';
|
|
9
|
+
import { boundaryForElement, runWithBoundary } from './bindErrorBoundary.js';
|
|
10
|
+
import { collectSlotMap } from '../contentProjection.js';
|
|
11
11
|
import { nativeTags } from '@pithyjs/compiler';
|
|
12
|
-
import { collectForwardedAttrs, applyForwardedAttrs } from './forwardedAttrs';
|
|
12
|
+
import { collectForwardedAttrs, applyForwardedAttrs } from './forwardedAttrs.js';
|
|
13
13
|
import { createRoot, untrack } from '@pithyjs/signals';
|
|
14
|
-
import { nodeExpando } from '../nodeExpando';
|
|
15
|
-
import { pithyGlobals } from '../../types/globals';
|
|
16
|
-
import { isSSRMode } from '../ssrMode';
|
|
17
|
-
import { clearSSRRenderCrash, reportComponentFailure } from '../ssrCrashes';
|
|
18
|
-
import { isRenderableComponentEl } from '../componentResult';
|
|
14
|
+
import { nodeExpando } from '../nodeExpando.js';
|
|
15
|
+
import { pithyGlobals } from '../../types/globals.js';
|
|
16
|
+
import { isSSRMode } from '../ssrMode.js';
|
|
17
|
+
import { clearSSRRenderCrash, reportComponentFailure } from '../ssrCrashes.js';
|
|
18
|
+
import { isRenderableComponentEl } from '../componentResult.js';
|
|
19
|
+
import { parsePropNames } from './propNames.js';
|
|
19
20
|
/**
|
|
20
21
|
* Find the closest element-scoped context we attach in createLoopItem().
|
|
21
22
|
* This is what exposes item(), gIdx(), count(), etc.
|
|
@@ -24,6 +25,10 @@ import { isRenderableComponentEl } from '../componentResult';
|
|
|
24
25
|
// (e.g. a panel importing Button while using a native <button>), and
|
|
25
26
|
// repeating the warning drowns out real ones.
|
|
26
27
|
const warnedComponentTags = new Set();
|
|
28
|
+
/** Test-only: forget which tags were warned about, so each render warns as a fresh process would. */
|
|
29
|
+
export function __resetComponentTagWarnings() {
|
|
30
|
+
warnedComponentTags.clear();
|
|
31
|
+
}
|
|
27
32
|
function nearestCtx(el, rootCtx) {
|
|
28
33
|
let n = el;
|
|
29
34
|
while (n) {
|
|
@@ -77,37 +82,52 @@ function evalInCtx(expr, ctx) {
|
|
|
77
82
|
return fn(...vals);
|
|
78
83
|
}
|
|
79
84
|
const propNameCache = new WeakMap();
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
let result;
|
|
86
|
-
try {
|
|
87
|
-
const src = componentFn.toString();
|
|
88
|
-
const m = src.match(/\(\s*\{\s*([^}]*)\s*\}/);
|
|
89
|
-
if (!m) {
|
|
90
|
-
result = [];
|
|
85
|
+
function readPropNames(componentFn) {
|
|
86
|
+
let cached = propNameCache.get(componentFn);
|
|
87
|
+
if (!cached) {
|
|
88
|
+
try {
|
|
89
|
+
cached = parsePropNames(componentFn.toString());
|
|
91
90
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
.split(',')
|
|
95
|
-
.map(s => s.trim())
|
|
96
|
-
.filter(Boolean)
|
|
97
|
-
.filter(s => !s.startsWith('...'))
|
|
98
|
-
.map(s => s.split(/[:=]/)[0].trim());
|
|
91
|
+
catch {
|
|
92
|
+
cached = { names: [], fromParam: false, exhaustive: false };
|
|
99
93
|
}
|
|
94
|
+
propNameCache.set(componentFn, cached);
|
|
100
95
|
}
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
return cached;
|
|
97
|
+
}
|
|
98
|
+
function extractExpectedPropNames(componentFn) {
|
|
99
|
+
return readPropNames(componentFn).names;
|
|
100
|
+
}
|
|
101
|
+
const warnedBoundProps = new Set();
|
|
102
|
+
const GLOBAL_ATTRS = new Set([
|
|
103
|
+
'id',
|
|
104
|
+
'class',
|
|
105
|
+
'style',
|
|
106
|
+
'title',
|
|
107
|
+
'role',
|
|
108
|
+
'tabindex',
|
|
109
|
+
'hidden',
|
|
110
|
+
]);
|
|
111
|
+
function warnBoundProps(componentFn, el, componentName) {
|
|
112
|
+
const expected = extractExpectedPropNames(componentFn);
|
|
113
|
+
for (const attr of Array.from(el.attributes)) {
|
|
114
|
+
if (!attr.name.startsWith('data-bind-'))
|
|
115
|
+
continue;
|
|
116
|
+
const bound = attr.name.slice('data-bind-'.length);
|
|
117
|
+
if (GLOBAL_ATTRS.has(bound))
|
|
118
|
+
continue;
|
|
119
|
+
const prop = expected.find(p => p.toLowerCase() === bound);
|
|
120
|
+
const key = `${componentName} ${bound}`;
|
|
121
|
+
if (!prop || warnedBoundProps.has(key))
|
|
122
|
+
continue;
|
|
123
|
+
warnedBoundProps.add(key);
|
|
124
|
+
console.warn(`[PithyJS] <${componentName}> [${bound}] sets an attribute on the rendered root, not the \`${prop}\` prop. Write ${prop}="…" without brackets to set the prop; for a live value pass a signal or () => … if the prop accepts one.`);
|
|
103
125
|
}
|
|
104
|
-
propNameCache.set(componentFn, result);
|
|
105
|
-
return result;
|
|
106
126
|
}
|
|
107
127
|
/** Dev warnings for unexpected props (only if destructuring is present). */
|
|
108
128
|
function validateComponentProps(componentFn, props, componentName) {
|
|
109
|
-
const allNames =
|
|
110
|
-
if (allNames.length === 0)
|
|
129
|
+
const { names: allNames, exhaustive } = readPropNames(componentFn);
|
|
130
|
+
if (!exhaustive || allNames.length === 0)
|
|
111
131
|
return;
|
|
112
132
|
const passed = Object.keys(props);
|
|
113
133
|
const expectedSet = new Set(allNames);
|
|
@@ -123,10 +143,11 @@ function validateComponentProps(componentFn, props, componentName) {
|
|
|
123
143
|
}
|
|
124
144
|
/** Map lowercased DOM attr name to expected prop name (case-insensitive). */
|
|
125
145
|
function normalizePropName(authoredName, expectedProps) {
|
|
126
|
-
if (expectedProps.
|
|
146
|
+
if (expectedProps.includes(authoredName))
|
|
127
147
|
return authoredName;
|
|
128
|
-
const
|
|
129
|
-
|
|
148
|
+
const lower = authoredName.toLowerCase();
|
|
149
|
+
const matches = expectedProps.filter(p => p.toLowerCase() === lower);
|
|
150
|
+
return matches.length === 1 ? matches[0] : authoredName;
|
|
130
151
|
}
|
|
131
152
|
/**
|
|
132
153
|
* Replace custom component tags (<Counter/>, <NestedComponent/>) with rendered output.
|
|
@@ -158,6 +179,15 @@ export function bindComponentTags(root, rootCtx, disposers) {
|
|
|
158
179
|
// Defer components inside not-yet-expanded loops
|
|
159
180
|
if (isInsidePendingLoopZone(el))
|
|
160
181
|
continue;
|
|
182
|
+
// A build's placeholder carries no AST: its children are DOM, which only
|
|
183
|
+
// the AOT binder reads.
|
|
184
|
+
const aotMount = nodeExpando(el).__pithyAotMount;
|
|
185
|
+
if (aotMount) {
|
|
186
|
+
// Marked as below, so the text pass skips what the component rendered.
|
|
187
|
+
for (const node of aotMount(disposers))
|
|
188
|
+
nodeExpando(node).__pithyComponentDom = true;
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
161
191
|
const tag = el.tagName.toLowerCase();
|
|
162
192
|
// Check if the parser marked this element as a component
|
|
163
193
|
// This is the authoritative source - it checks originalTagName starts with uppercase
|
|
@@ -211,7 +241,8 @@ export function bindComponentTags(root, rootCtx, disposers) {
|
|
|
211
241
|
const localCtx = nearestCtx(el, rootCtx); // crucial for item(), gIdx(), etc.
|
|
212
242
|
// Extract expected props for validation (DEV) and prop name normalization (always)
|
|
213
243
|
// This ensures case-insensitive matching works even when originalAttrs is unavailable
|
|
214
|
-
const
|
|
244
|
+
const { names, fromParam } = readPropNames(componentFn);
|
|
245
|
+
const expectedProps = fromParam ? names : [];
|
|
215
246
|
// Preserve originally-authored attribute names/casing from the parsed template
|
|
216
247
|
// (pithyNode already extracted above for isComponent check)
|
|
217
248
|
const originalAttrs = pithyNode?.originalAttrs;
|
|
@@ -245,6 +276,7 @@ export function bindComponentTags(root, rootCtx, disposers) {
|
|
|
245
276
|
if (import.meta.env?.DEV) {
|
|
246
277
|
const displayTag = pithyNode?.originalTagName || tag;
|
|
247
278
|
validateComponentProps(componentFn, props, displayTag);
|
|
279
|
+
warnBoundProps(componentFn, el, displayTag);
|
|
248
280
|
}
|
|
249
281
|
// Collect content projection SlotMap from component children
|
|
250
282
|
const pithyChildren = pithyNode?.children || [];
|
|
@@ -353,28 +385,30 @@ export function bindComponentTags(root, rootCtx, disposers) {
|
|
|
353
385
|
// data-classes, data-style-*) plus any author-written data-* attribute.
|
|
354
386
|
const forwardedClass = el.getAttribute('class');
|
|
355
387
|
const forwardedAttrs = collectForwardedAttrs(el);
|
|
388
|
+
const isFragment = renderedEl.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
356
389
|
let forwardTarget = null;
|
|
357
390
|
const hasForwardables = !!(forwardedClass || forwardedAttrs.length > 0);
|
|
358
391
|
if (hasForwardables) {
|
|
359
|
-
if (
|
|
360
|
-
forwardTarget = renderedEl
|
|
392
|
+
if (isFragment) {
|
|
393
|
+
forwardTarget = renderedEl
|
|
394
|
+
.firstElementChild;
|
|
361
395
|
if (import.meta.env?.DEV && !forwardTarget) {
|
|
362
396
|
const displayTag = pithyNode?.originalTagName || tag;
|
|
363
397
|
console.warn(`[PithyJS] <${displayTag}> has class or data-* attributes but returns a fragment with no element children — forwarding skipped.`);
|
|
364
398
|
}
|
|
365
399
|
}
|
|
366
|
-
else if (renderedEl
|
|
400
|
+
else if (renderedEl.nodeType === Node.ELEMENT_NODE) {
|
|
367
401
|
forwardTarget = renderedEl;
|
|
368
402
|
}
|
|
369
403
|
}
|
|
404
|
+
const renderedNodes = isFragment
|
|
405
|
+
? Array.from(renderedEl.childNodes)
|
|
406
|
+
: [renderedEl];
|
|
407
|
+
for (const node of renderedNodes)
|
|
408
|
+
nodeExpando(node).__pithyComponentDom = true;
|
|
370
409
|
let replaced = true;
|
|
371
410
|
try {
|
|
372
|
-
|
|
373
|
-
el.replaceWith(...Array.from(renderedEl.childNodes));
|
|
374
|
-
}
|
|
375
|
-
else {
|
|
376
|
-
el.replaceWith(renderedEl);
|
|
377
|
-
}
|
|
411
|
+
el.replaceWith(...renderedNodes);
|
|
378
412
|
}
|
|
379
413
|
catch (err) {
|
|
380
414
|
// A failed replacement leaves the raw <${tag}> exactly where a crash
|
|
@@ -400,6 +434,12 @@ export function bindComponentTags(root, rootCtx, disposers) {
|
|
|
400
434
|
// Forward captured attributes so subsequent binders can attach the bindings
|
|
401
435
|
if (forwardedAttrs.length > 0 && forwardTarget) {
|
|
402
436
|
applyForwardedAttrs(forwardTarget, forwardedAttrs, tag);
|
|
437
|
+
const styleProps = Object.keys(pithyNode?.directives?.styleMap ?? {});
|
|
438
|
+
if (styleProps.length)
|
|
439
|
+
nodeExpando(forwardTarget).__styleProps = styleProps;
|
|
440
|
+
const classToggles = Object.keys(pithyNode?.directives?.classMap ?? {});
|
|
441
|
+
if (classToggles.length)
|
|
442
|
+
nodeExpando(forwardTarget).__classToggles = classToggles;
|
|
403
443
|
}
|
|
404
444
|
if (disposeSetup) {
|
|
405
445
|
disposers.push(disposeSetup);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindComponentsTags.js","sourceRoot":"","sources":["../../../src/compile/binds/bindComponentsTags.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAkB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAS7D;;;GAGG;AACH,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C,SAAS,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;YACtE,IAAI,UAAU,CAAC,MAAM;gBACnB,WAAW,CAAC,aAAa,CAAC,CAAC,YAAY,GAAG,UAAU,CAAC;YACvD,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC;YACxE,IAAI,YAAY,CAAC,MAAM;gBACrB,WAAW,CAAC,aAAa,CAAC,CAAC,cAAc,GAAG,YAAY,CAAC;QAC7D,CAAC;QAED,IAAI,YAAY,EAAE,CAAC;YACjB,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC/B,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;YAClC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.components\",\n \"title\": \"Component Tag Binding System\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { compileExpression } from '../compileExpression';\nimport { boundaryForElement, runWithBoundary } from './bindErrorBoundary';\nimport { collectSlotMap } from '../contentProjection';\nimport { nativeTags, type PithyNode } from '@pithyjs/compiler';\nimport { collectForwardedAttrs, applyForwardedAttrs } from './forwardedAttrs';\nimport { createRoot, untrack } from '@pithyjs/signals';\nimport { nodeExpando } from '../nodeExpando';\nimport { pithyGlobals } from '../../types/globals';\nimport { isSSRMode } from '../ssrMode';\nimport { clearSSRRenderCrash, reportComponentFailure } from '../ssrCrashes';\nimport { isRenderableComponentEl } from '../componentResult';\nimport { parsePropNames, type PropNames } from './propNames';\n\ninterface ComponentResult {\n /** Any DOM node — see the `Component` type for why this is not narrower. */\n el: Node;\n destroy?: () => void;\n}\ntype ComponentFn = (props: Record<string, unknown>) => ComponentResult;\n\n/**\n * Find the closest element-scoped context we attach in createLoopItem().\n * This is what exposes item(), gIdx(), count(), etc.\n */\n// Warn once per component/tag pair — the same idiom re-renders constantly\n// (e.g. a panel importing Button while using a native <button>), and\n// repeating the warning drowns out real ones.\nconst warnedComponentTags = new Set<string>();\n\n/** Test-only: forget which tags were warned about, so each render warns as a fresh process would. */\nexport function __resetComponentTagWarnings(): void {\n warnedComponentTags.clear();\n}\n\nfunction nearestCtx(\n el: Element,\n rootCtx: Record<string, unknown>\n): Record<string, unknown> {\n let n: Element | null = el;\n while (n) {\n const local = nodeExpando(n).__pithyCtx;\n if (local) return local;\n n = n.parentElement;\n }\n return rootCtx;\n}\n\n/**\n * Detect whether a node is inside a subtree that represents a NOT-YET-EXPANDED nested loop.\n * Those hosts are tagged in createLoopManager.createLoopItem() via `__pithySkipText`,\n * and real templates may also still carry @for / data-for before expansion.\n * We must *defer* binding for anything under such a host, otherwise expressions like item()\n * will throw ReferenceError (because inner loop ctx isn’t created yet).\n */\nfunction isInsidePendingLoopZone(node: Element): boolean {\n let p: Element | null = node;\n while (p) {\n if (nodeExpando(p).__pithySkipText) return true;\n if (\n p.hasAttribute &&\n (p.hasAttribute('@for') || p.hasAttribute('data-for'))\n ) {\n return true;\n }\n p = p.parentElement;\n }\n return false;\n}\n\n/** Evaluate `expr` in `ctx`. Try engine compiler first, then args-style fallback. */\nfunction evalInCtx(expr: string, ctx: Record<string, unknown>): unknown {\n // 1) Preferred: compileExpression uses `with(ctx) { return (...) }`\n try {\n const f = compileExpression(expr, ctx);\n try {\n return f();\n } catch {\n /* fall through to fallback */\n }\n } catch {\n /* fall through to fallback */\n }\n\n // 2) Fallback: args-style evaluator (robust even if compileExpression throws)\n const keys = Object.keys(ctx);\n const vals = keys.map(k => ctx[k]);\n // eslint-disable-next-line no-new-func -- args-style template expression evaluation is a core framework feature\n const fn = new Function(...keys, `return (${expr});`) as (\n ...args: unknown[]\n ) => unknown;\n return fn(...vals);\n}\n\nconst propNameCache = new WeakMap<ComponentFn, PropNames>();\n\nfunction readPropNames(componentFn: ComponentFn): PropNames {\n let cached = propNameCache.get(componentFn);\n if (!cached) {\n try {\n cached = parsePropNames(componentFn.toString());\n } catch {\n cached = { names: [], fromParam: false, exhaustive: false };\n }\n propNameCache.set(componentFn, cached);\n }\n return cached;\n}\n\nfunction extractExpectedPropNames(componentFn: ComponentFn): string[] {\n return readPropNames(componentFn).names;\n}\n\nconst warnedBoundProps = new Set<string>();\nconst GLOBAL_ATTRS = new Set([\n 'id',\n 'class',\n 'style',\n 'title',\n 'role',\n 'tabindex',\n 'hidden',\n]);\n\nfunction warnBoundProps(\n componentFn: ComponentFn,\n el: Element,\n componentName: string\n): void {\n const expected = extractExpectedPropNames(componentFn);\n for (const attr of Array.from(el.attributes)) {\n if (!attr.name.startsWith('data-bind-')) continue;\n const bound = attr.name.slice('data-bind-'.length);\n if (GLOBAL_ATTRS.has(bound)) continue;\n const prop = expected.find(p => p.toLowerCase() === bound);\n const key = `${componentName} ${bound}`;\n if (!prop || warnedBoundProps.has(key)) continue;\n warnedBoundProps.add(key);\n console.warn(\n `[PithyJS] <${componentName}> [${bound}] sets an attribute on the rendered root, not the \\`${prop}\\` prop. Write ${prop}=\"…\" without brackets to set the prop; for a live value pass a signal or () => … if the prop accepts one.`\n );\n }\n}\n\n/** Dev warnings for unexpected props (only if destructuring is present). */\nfunction validateComponentProps(\n componentFn: ComponentFn,\n props: Record<string, unknown>,\n componentName: string\n): void {\n const { names: allNames, exhaustive } = readPropNames(componentFn);\n if (!exhaustive || allNames.length === 0) return;\n\n const passed = Object.keys(props);\n const expectedSet = new Set(allNames);\n\n const unexpected = passed.filter(p => !expectedSet.has(p));\n if (unexpected.length) {\n console.warn(\n `[PithyJS] 🔍 Component <${componentName}> received unexpected props: ${unexpected.join(\n ', '\n )}\\nExpected props: ${allNames.join(', ')}\\nPassed props: ${passed.join(', ')}`\n );\n }\n\n // NOTE: We intentionally do NOT warn about \"missing\" props here.\n // In template-driven usage, props are assembled at runtime by\n // bindComponentTags(), so TypeScript cannot catch missing required\n // props in this path. Components should self-validate critical\n // props where appropriate (e.g. Toggle warns on empty label).\n}\n\n/** Map lowercased DOM attr name to expected prop name (case-insensitive). */\nfunction normalizePropName(\n authoredName: string,\n expectedProps: string[]\n): string {\n if (expectedProps.includes(authoredName)) return authoredName;\n const lower = authoredName.toLowerCase();\n const matches = expectedProps.filter(p => p.toLowerCase() === lower);\n return matches.length === 1 ? matches[0] : authoredName;\n}\n\n/**\n * Replace custom component tags (<Counter/>, <NestedComponent/>) with rendered output.\n * - Skips anything under a pending nested loop host (bind after loop expansion)\n * - Evaluates prop expressions in nearest loop ctx\n * - Case-insensitive prop name normalization\n * - No raw-string fallback (prevents things like calling count() on a string)\n */\n/** @codexApi {\"parent\":\"pithy.runtime.components\",\"name\":\"bindComponentTags\",\"stability\":\"stable\",\"signature\":\"(root: Element | DocumentFragment, rootCtx: Record<string, unknown>, disposers: (() => void)[]) => void\"} */\nexport function bindComponentTags(\n root: Element | DocumentFragment,\n rootCtx: Record<string, unknown>,\n disposers: (() => void)[]\n): void {\n // case-insensitive tag lookup from context\n const tagMap = new Map<string, unknown>(\n Object.keys(rootCtx).map(k => [k.toLowerCase(), rootCtx[k]])\n );\n\n const scope =\n root instanceof Element ? (root as Element) : (root as DocumentFragment);\n const elements = Array.from(scope.querySelectorAll('*'));\n\n for (const el of elements) {\n // Skip elements removed from the tree by a parent component's render, or\n // hidden by an `@error-boundary` that has since activated.\n if (!scope.contains(el)) {\n // An element that has left the tree contributes nothing to the output, so\n // a crash recorded for it on an earlier DETACHED pass is stale. Leaving it\n // fails a route that rendered correctly: with two crashing components\n // under one boundary inside an `@if`, the detached pass records both, the\n // retry lets the boundary accept the first, and accepting synchronously\n // hides the second — which then never gets a retry to retract it.\n if (isSSRMode()) clearSSRRenderCrash(el);\n continue;\n }\n\n // Defer components inside not-yet-expanded loops\n if (isInsidePendingLoopZone(el)) continue;\n\n // A build's placeholder carries no AST: its children are DOM, which only\n // the AOT binder reads.\n const aotMount = nodeExpando(el).__pithyAotMount;\n if (aotMount) {\n // Marked as below, so the text pass skips what the component rendered.\n for (const node of aotMount(disposers))\n nodeExpando(node).__pithyComponentDom = true;\n continue;\n }\n\n const tag = el.tagName.toLowerCase();\n\n // Check if the parser marked this element as a component\n // This is the authoritative source - it checks originalTagName starts with uppercase\n // AND the tag name exists in importedIdentifiers\n const pithyNode = nodeExpando(el).__pithyNode;\n if (pithyNode) {\n // Parser processed this element - use its isComponent flag\n if (!pithyNode.isComponent) {\n // DEV: Warn if there's a component that matches case-insensitively\n // This helps developers catch typos like <button> when they meant <Button>\n // Skip warning if we're inside a component's render (the component might\n // legitimately use native elements like <button> in its implementation)\n const isInsideComponentRender =\n !!pithyGlobals().__pithyRenderingComponent;\n if (import.meta.env?.DEV && !isInsideComponentRender) {\n const matchingComponent = tagMap.get(tag);\n if (matchingComponent && typeof matchingComponent === 'function') {\n // Find the actual component name from context\n const componentName = Object.keys(rootCtx).find(\n k => k.toLowerCase() === tag && rootCtx[k] === matchingComponent\n );\n const warnKey = `${componentName}:${pithyNode.originalTagName}`;\n if (\n componentName &&\n componentName !== pithyNode.originalTagName &&\n !warnedComponentTags.has(warnKey)\n ) {\n warnedComponentTags.add(warnKey);\n console.warn(\n `[PithyJS] ⚠️ Component '${componentName}' is imported but used as '<${pithyNode.originalTagName}>'. ` +\n `Components must use PascalCase. Use '<${componentName}>' instead.`\n );\n }\n }\n }\n continue;\n }\n } else {\n // Fallback for elements not processed by our parser:\n // Skip native HTML elements to prevent <button> matching Button component\n if (nativeTags.has(tag)) continue;\n }\n\n let candidate = tagMap.get(tag);\n\n if (!candidate) continue;\n\n // Support default exports\n if (\n candidate &&\n typeof candidate === 'object' &&\n 'default' in candidate &&\n typeof candidate.default === 'function'\n ) {\n candidate = candidate.default;\n }\n if (typeof candidate !== 'function') continue;\n\n const componentFn = candidate as ComponentFn;\n const localCtx = nearestCtx(el, rootCtx); // crucial for item(), gIdx(), etc.\n\n // Extract expected props for validation (DEV) and prop name normalization (always)\n // This ensures case-insensitive matching works even when originalAttrs is unavailable\n const { names, fromParam } = readPropNames(componentFn);\n const expectedProps = fromParam ? names : [];\n\n // Preserve originally-authored attribute names/casing from the parsed template\n // (pithyNode already extracted above for isComponent check)\n const originalAttrs: Record<string, string> | undefined =\n pithyNode?.originalAttrs;\n\n const props: Record<string, unknown> = {};\n\n // Evaluate attributes as expressions in localCtx\n for (const attr of Array.from(el.attributes)) {\n const name = attr.name;\n const raw = attr.value;\n\n // Skip internal/behavioral attributes\n if (name.startsWith('data-')) continue;\n if (name === 'class' || name === 'style') continue;\n\n // Prefer originally-authored name (preserve casing), else DOM name\n const authored = originalAttrs?.[name] ?? name;\n const propName = normalizePropName(authored, expectedProps);\n\n try {\n const value = untrack(() => evalInCtx(raw, localCtx));\n props[propName] = value; // only set when evaluation succeeds\n } catch (err) {\n if (import.meta.env?.DEV) {\n console.warn(\n `[PithyJS] ⚠️ Failed to evaluate prop \"${propName}\" = \"${raw}\"`,\n err\n );\n }\n // IMPORTANT: do NOT set a raw string fallback here.\n // Leaving it undefined lets the child use defaults and avoids count()-on-string.\n }\n }\n\n // Validate props for all components in DEV mode.\n // Native elements are already filtered out earlier (line 197 for fallback, line 171 for parser).\n if (import.meta.env?.DEV) {\n const displayTag = pithyNode?.originalTagName || tag;\n validateComponentProps(componentFn, props, displayTag);\n warnBoundProps(componentFn, el, displayTag);\n }\n\n // Collect content projection SlotMap from component children\n const pithyChildren: PithyNode[] = pithyNode?.children || [];\n const slotMap = collectSlotMap(pithyChildren, localCtx);\n\n // Create enhanced context with SlotMap for content projection\n const componentContext = {\n ...localCtx,\n __slotMap: slotMap,\n __childAstNodes: pithyChildren,\n __childFactory: undefined,\n };\n\n // Find nearest error boundary for this component\n const boundaryEl = el.closest('[data-error]') as Element | null;\n const boundary = boundaryForElement(boundaryEl);\n\n // Invoke component under boundary context; expect { el, destroy }\n let out: ComponentResult | undefined;\n let disposeSetup: (() => void) | undefined;\n try {\n out = runWithBoundary(boundary, () => {\n // Store the enhanced context globally for the component's html() calls to access.\n // This per-component context contains __slotMap for content projection.\n //\n // In SSR, there are TWO context sources that html() merges:\n // 1. AsyncLocalStorage context (__getComponentContext) - request-level isolation\n // 2. This global context (__pithyComponentContext) - per-component __slotMap\n //\n // Both are needed: AsyncLocalStorage provides request isolation, while this\n // global provides the __slotMap that changes for each component render.\n const g = pithyGlobals();\n const originalContext = g.__pithyComponentContext;\n const wasRendering = g.__pithyRenderingComponent;\n g.__pithyComponentContext = componentContext;\n // Mark that we're rendering a component to suppress casing warnings for\n // native elements used in component implementations (e.g., <button> in Button)\n g.__pithyRenderingComponent = true;\n\n try {\n const result = createRoot(disposeRoot => {\n disposeSetup = disposeRoot;\n return componentFn(props);\n });\n return result;\n } finally {\n // Restore original context\n g.__pithyComponentContext = originalContext;\n g.__pithyRenderingComponent = wasRendering;\n }\n });\n } catch (err) {\n // Route sync render errors to the nearest boundary with escalation\n if (boundary) {\n const error = err instanceof Error ? err : new Error(String(err));\n // A boundary being in scope does not mean it accepted the error: an\n // already-active boundary with no free ancestor drops it (React's\n // first-error-wins). A component inside that boundary's `@fallback` is\n // the everyday case, and the fallback is what the user actually sees.\n const accepted = reportComponentFailure(el, tag, error, boundary);\n if (import.meta.env?.DEV) {\n // Say which of the two actually happened. \"Captured\" on a rejected\n // error reports the opposite of the truth, and this branch exists\n // precisely because the two are not the same.\n console.log(\n accepted\n ? `[ErrorBoundary] Captured sync render error in <${tag}>:`\n : `[ErrorBoundary] Boundary already active — error from <${tag}> was NOT captured:`,\n error.message\n );\n }\n continue;\n }\n\n // No boundary in scope *yet*. Degrading is still the right call here in\n // both modes: throwing would pre-empt the retry pass that gives an\n // `@error-boundary` its only chance to claim a crash raised while the\n // subtree was detached.\n //\n // A static/server render additionally records the crash. Nobody reads a\n // console during `pithy-ssg`, so this used to leave the raw <${tag}> in\n // the emitted HTML while the route still counted as rendered and the CLI\n // exited 0 (BUG-018). Anything still recorded when the render finishes\n // makes the SSR renderer throw, and the per-route catch in `vite-ssg.ts`\n // fails that route.\n reportComponentFailure(\n el,\n tag,\n err instanceof Error ? err : new Error(String(err)),\n null\n );\n\n console.error(`❌ Component <${tag}> crashed during render:`, err);\n continue;\n }\n\n if (\n !out ||\n typeof out !== 'object' ||\n !('el' in out) ||\n !isRenderableComponentEl(out.el, el)\n ) {\n console.warn(\n `❌ Invalid render result from <${tag}>. Expected { el, destroy }`\n );\n // Not a throw, but the same outcome as one: the raw <${tag}> is left in\n // the document and the subtree never renders. Under SSR that is content\n // silently missing from the emitted HTML, so it is recorded exactly like\n // a crash (BUG-018). Recorded rather than merely left in place, because\n // this attempt may also be retracting an earlier attempt's record.\n // Same funnel as a throw: a boundary above this component gets the\n // chance to claim it and render its fallback, and only an unclaimed\n // failure is recorded. Bypassing this meant a component under\n // `@error-boundary` that returned garbage failed the route with the\n // boundary signal still null.\n reportComponentFailure(\n el,\n tag,\n new Error(\n `Invalid render result from <${tag}>; expected { el, destroy }`\n ),\n boundary\n );\n disposeSetup?.();\n continue;\n }\n\n const { el: renderedEl, destroy } = out;\n\n // Capture class and data-* attributes for forwarding to rendered root:\n // directive bindings (data-on-*, data-bind-*, data-class-toggle-*,\n // data-classes, data-style-*) plus any author-written data-* attribute.\n const forwardedClass = el.getAttribute('class');\n const forwardedAttrs = collectForwardedAttrs(el);\n\n const isFragment = renderedEl.nodeType === Node.DOCUMENT_FRAGMENT_NODE;\n let forwardTarget: HTMLElement | null = null;\n const hasForwardables = !!(forwardedClass || forwardedAttrs.length > 0);\n if (hasForwardables) {\n if (isFragment) {\n forwardTarget = (renderedEl as DocumentFragment)\n .firstElementChild as HTMLElement | null;\n if (import.meta.env?.DEV && !forwardTarget) {\n const displayTag = pithyNode?.originalTagName || tag;\n console.warn(\n `[PithyJS] <${displayTag}> has class or data-* attributes but returns a fragment with no element children — forwarding skipped.`\n );\n }\n } else if (renderedEl.nodeType === Node.ELEMENT_NODE) {\n forwardTarget = renderedEl as HTMLElement;\n }\n }\n\n const renderedNodes = isFragment\n ? Array.from(renderedEl.childNodes)\n : [renderedEl];\n for (const node of renderedNodes)\n nodeExpando(node).__pithyComponentDom = true;\n\n let replaced = true;\n try {\n el.replaceWith(...renderedNodes);\n } catch (err) {\n // A failed replacement leaves the raw <${tag}> exactly where a crash\n // would have, so it is the same content loss and is recorded the same way.\n replaced = false;\n reportComponentFailure(\n el,\n tag,\n err instanceof Error ? err : new Error(String(err)),\n boundary\n );\n console.error(`❌ Failed to replace <${tag}> with rendered DOM:`, err);\n }\n\n // Retracted only here, and in the boundary catch above — never eagerly at\n // the top of an attempt, where any early `continue` added later would\n // silently drop a real record. This is the point at which the component is\n // known to have produced a usable node AND to have reached the document, so\n // an earlier detached attempt's crash is genuinely no longer the outcome.\n if (isSSRMode() && replaced) clearSSRRenderCrash(el);\n\n // Forward class from component tag onto the rendered root element\n if (forwardedClass && forwardTarget) {\n for (const cls of forwardedClass.split(/\\s+/)) {\n if (cls) forwardTarget.classList.add(cls);\n }\n }\n\n // Forward captured attributes so subsequent binders can attach the bindings\n if (forwardedAttrs.length > 0 && forwardTarget) {\n applyForwardedAttrs(forwardTarget, forwardedAttrs, tag);\n const styleProps = Object.keys(pithyNode?.directives?.styleMap ?? {});\n if (styleProps.length)\n nodeExpando(forwardTarget).__styleProps = styleProps;\n const classToggles = Object.keys(pithyNode?.directives?.classMap ?? {});\n if (classToggles.length)\n nodeExpando(forwardTarget).__classToggles = classToggles;\n }\n\n if (disposeSetup) {\n disposers.push(disposeSetup);\n }\n\n if (typeof destroy === 'function') {\n disposers.push(destroy);\n }\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ import { type PithyNode } from '@pithyjs/compiler';
|
|
|
10
10
|
* Processes conditional directives (@if, @else-if, @else) in the template.
|
|
11
11
|
* Identifies conditional chains and delegates their handling to handleConditionalChain.
|
|
12
12
|
*/
|
|
13
|
-
/** @codexApi {"parent":"pithy.directive.if","name":"bindConditionals","stability":"stable","signature":"(nodes: PithyNode[], rootEl:
|
|
14
|
-
export declare function bindConditionals(nodes: PithyNode[], rootEl:
|
|
13
|
+
/** @codexApi {"parent":"pithy.directive.if","name":"bindConditionals","stability":"stable","signature":"(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, disposers?: (() => void)[]) => Set<string>"} */
|
|
14
|
+
export declare function bindConditionals(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, // Track already processed nodes
|
|
15
15
|
disposers?: (() => void)[]): Set<string>;
|
|
16
16
|
//# sourceMappingURL=bindConditionals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindConditionals.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindConditionals.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"bindConditionals.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindConditionals.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAMnE;;;GAGG;AACH,+QAA+Q;AAC/Q,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,EAAE,EAClB,MAAM,EAAE,OAAO,GAAG,gBAAgB,EAClC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,gBAAgB,GAAE,GAAG,CAAC,MAAM,CAAa,EAAE,gCAAgC;AAC3E,SAAS,GAAE,CAAC,MAAM,IAAI,CAAC,EAAO,GAC7B,GAAG,CAAC,MAAM,CAAC,CAgIb"}
|
|
@@ -6,20 +6,21 @@
|
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
8
|
import { collectIfChain } from '@pithyjs/compiler';
|
|
9
|
-
import { handleConditionalChain } from '../handleConditionalChain';
|
|
10
|
-
import { findAllNestedLoopNodes } from '../forLoops/loopTraversal';
|
|
9
|
+
import { handleConditionalChain } from '../handleConditionalChain.js';
|
|
10
|
+
import { findAllNestedLoopNodes } from '../forLoops/loopTraversal.js';
|
|
11
|
+
const warnedOrphans = new WeakSet();
|
|
11
12
|
/**
|
|
12
13
|
* Processes conditional directives (@if, @else-if, @else) in the template.
|
|
13
14
|
* Identifies conditional chains and delegates their handling to handleConditionalChain.
|
|
14
15
|
*/
|
|
15
|
-
/** @codexApi {"parent":"pithy.directive.if","name":"bindConditionals","stability":"stable","signature":"(nodes: PithyNode[], rootEl:
|
|
16
|
+
/** @codexApi {"parent":"pithy.directive.if","name":"bindConditionals","stability":"stable","signature":"(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, disposers?: (() => void)[]) => Set<string>"} */
|
|
16
17
|
export function bindConditionals(nodes, rootEl, ctx, processedNodeIds = new Set(), // Track already processed nodes
|
|
17
18
|
disposers = [] // Collect disposers for cleanup
|
|
18
19
|
) {
|
|
19
20
|
// Performance optimization: Create a Map of all elements by data-pid
|
|
20
21
|
// This makes element lookups O(1) instead of O(n) with querySelector
|
|
21
22
|
const elMap = new Map();
|
|
22
|
-
if (rootEl instanceof
|
|
23
|
+
if (rootEl instanceof Element || rootEl instanceof DocumentFragment) {
|
|
23
24
|
const elements = rootEl.querySelectorAll('[data-pid]');
|
|
24
25
|
elements.forEach(el => {
|
|
25
26
|
const pid = el.getAttribute('data-pid');
|
|
@@ -37,6 +38,18 @@ disposers = [] // Collect disposers for cleanup
|
|
|
37
38
|
chains.push({ chain, startIndex: i });
|
|
38
39
|
i += chain.length - 1; // Skip consumed siblings
|
|
39
40
|
}
|
|
41
|
+
else if (node.type === 'element' &&
|
|
42
|
+
(node.directives?.elseIf !== undefined ||
|
|
43
|
+
node.directives?.else !== undefined) &&
|
|
44
|
+
node.nodeId &&
|
|
45
|
+
!processedNodeIds.has(node.nodeId)) {
|
|
46
|
+
processedNodeIds.add(node.nodeId);
|
|
47
|
+
elMap.get(node.nodeId)?.remove();
|
|
48
|
+
if (import.meta.env?.DEV && !warnedOrphans.has(node)) {
|
|
49
|
+
warnedOrphans.add(node);
|
|
50
|
+
console.warn(`[bindConditionals] ${node.directives.elseIf !== undefined ? '@else-if' : '@else'} has no @if directly before it; <${node.originalTagName ?? node.tagName}> is dropped, as in a build`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
40
53
|
}
|
|
41
54
|
// Process each chain and track processed nodes
|
|
42
55
|
chains.forEach(({ chain }) => {
|
|
@@ -88,10 +101,14 @@ disposers = [] // Collect disposers for cleanup
|
|
|
88
101
|
if (node.directives?.for !== undefined) {
|
|
89
102
|
continue;
|
|
90
103
|
}
|
|
104
|
+
// A component's children are bound where the component renders them
|
|
105
|
+
// (slot projection, renderChildren); the tag's own DOM is discarded.
|
|
106
|
+
if (node.isComponent)
|
|
107
|
+
continue;
|
|
91
108
|
if (node.type === 'element' && node.children?.length) {
|
|
92
109
|
// Use the Map for O(1) lookup
|
|
93
110
|
const element = node.nodeId ? elMap.get(node.nodeId) : null;
|
|
94
|
-
if (element instanceof
|
|
111
|
+
if (element instanceof Element) {
|
|
95
112
|
// Pass the processedNodeIds Set and disposers to avoid duplicate processing
|
|
96
113
|
bindConditionals(node.children, element, ctx, processedNodeIds, disposers);
|
|
97
114
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindConditionals.js","sourceRoot":"","sources":["../../../src/compile/binds/bindConditionals.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,cAAc,EAAkB,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE;;;GAGG;AACH
|
|
1
|
+
{"version":3,"file":"bindConditionals.js","sourceRoot":"","sources":["../../../src/compile/binds/bindConditionals.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,cAAc,EAA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AAS;QACX,CAAC;QAED,8EAA8E;QAC9E,wFAAwF;QACxF,IAAI,IAAI,CAAC,UAAU,EAAE,GAAG,KAAK,SAAS,EAAE,CAAC;YACvC,SAAS;QACX,CAAC;QAED,oEAAoE;QACpE,qEAAqE;QACrE,IAAI,IAAI,CAAC,WAAW;YAAE,SAAS;QAE/B,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;YACrD,8BAA8B;YAC9B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;YAE5D,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;gBAC/B,4EAA4E;gBAC5E,gBAAgB,CACd,IAAI,CAAC,QAAQ,EACb,OAAO,EACP,GAAG,EACH,gBAAgB,EAChB,SAAS,CACV,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.directive.if\",\n \"title\": \"@if conditional directive\",\n \"category\": \"directive\"\n}\n*/\n\nimport { collectIfChain, type PithyNode } from '@pithyjs/compiler';\nimport { handleConditionalChain } from '../handleConditionalChain';\nimport { findAllNestedLoopNodes } from '../forLoops/loopTraversal';\n\nconst warnedOrphans = new WeakSet<PithyNode>();\n\n/**\n * Processes conditional directives (@if, @else-if, @else) in the template.\n * Identifies conditional chains and delegates their handling to handleConditionalChain.\n */\n/** @codexApi {\"parent\":\"pithy.directive.if\",\"name\":\"bindConditionals\",\"stability\":\"stable\",\"signature\":\"(nodes: PithyNode[], rootEl: Element | DocumentFragment, ctx: Record<string, unknown>, processedNodeIds?: Set<string>, disposers?: (() => void)[]) => Set<string>\"} */\nexport function bindConditionals(\n nodes: PithyNode[],\n rootEl: Element | DocumentFragment,\n ctx: Record<string, unknown>,\n processedNodeIds: Set<string> = new Set(), // Track already processed nodes\n disposers: (() => void)[] = [] // Collect disposers for cleanup\n): Set<string> {\n // Performance optimization: Create a Map of all elements by data-pid\n // This makes element lookups O(1) instead of O(n) with querySelector\n const elMap = new Map<string, Element>();\n if (rootEl instanceof Element || rootEl instanceof DocumentFragment) {\n const elements = rootEl.querySelectorAll('[data-pid]');\n elements.forEach(el => {\n const pid = el.getAttribute('data-pid');\n if (pid) {\n elMap.set(pid, el as Element);\n }\n });\n }\n\n // Identify all conditional chains using shared utility from @pithyjs/compiler\n const chains: { chain: PithyNode[]; startIndex: number }[] = [];\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node.type === 'element' && node.directives?.if !== undefined) {\n const chain = collectIfChain(nodes, i);\n chains.push({ chain, startIndex: i });\n i += chain.length - 1; // Skip consumed siblings\n } else if (\n node.type === 'element' &&\n (node.directives?.elseIf !== undefined ||\n node.directives?.else !== undefined) &&\n node.nodeId &&\n !processedNodeIds.has(node.nodeId)\n ) {\n processedNodeIds.add(node.nodeId);\n elMap.get(node.nodeId)?.remove();\n if (import.meta.env?.DEV && !warnedOrphans.has(node)) {\n warnedOrphans.add(node);\n console.warn(\n `[bindConditionals] ${node.directives.elseIf !== undefined ? '@else-if' : '@else'} has no @if directly before it; <${node.originalTagName ?? node.tagName}> is dropped, as in a build`\n );\n }\n }\n }\n\n // Process each chain and track processed nodes\n chains.forEach(({ chain }) => {\n chain.forEach(node => {\n // Mark this node as processed\n if (node.nodeId) {\n processedNodeIds.add(node.nodeId);\n }\n\n // Also mark all loops inside this conditional as processed\n // They will be bound by handleConditionalChain when the condition is true\n const nestedLoops = findAllNestedLoopNodes(node);\n for (const loopNode of nestedLoops) {\n if (loopNode.nodeId) {\n processedNodeIds.add(loopNode.nodeId);\n }\n }\n });\n\n // Find the DOM elements for this chain using our optimized Map\n const domElements = chain\n .map(node => {\n if (!node.nodeId) {\n return null;\n }\n\n // Use the Map for O(1) lookup instead of querySelector\n const element = elMap.get(node.nodeId);\n\n if (!element) {\n return null;\n }\n return element;\n })\n .filter((el): el is Element => el !== null);\n\n // Verify we found all DOM elements\n if (domElements.length !== chain.length) {\n return;\n }\n\n // Handle the chain and collect all processed node IDs\n // Pass disposers array so effects can be properly cleaned up\n handleConditionalChain(\n domElements,\n chain,\n ctx,\n processedNodeIds,\n disposers\n );\n });\n\n // Recursively process children of all nodes, skipping those already processed in chains\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n // Skip nodes that were already processed as part of a conditional chain\n if (node.nodeId && processedNodeIds.has(node.nodeId)) {\n continue;\n }\n\n // Skip @for nodes - their children (including conditionals) will be processed\n // by the loop manager's createLoopItem with the proper loop context (item, index, etc.)\n if (node.directives?.for !== undefined) {\n continue;\n }\n\n // A component's children are bound where the component renders them\n // (slot projection, renderChildren); the tag's own DOM is discarded.\n if (node.isComponent) continue;\n\n if (node.type === 'element' && node.children?.length) {\n // Use the Map for O(1) lookup\n const element = node.nodeId ? elMap.get(node.nodeId) : null;\n\n if (element instanceof Element) {\n // Pass the processedNodeIds Set and disposers to avoid duplicate processing\n bindConditionals(\n node.children,\n element,\n ctx,\n processedNodeIds,\n disposers\n );\n }\n }\n }\n\n return processedNodeIds;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindDefaultTwoWay.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindDefaultTwoWay.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,qOAAqO;AACrO,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,gBAAgB,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,
|
|
1
|
+
{"version":3,"file":"bindDefaultTwoWay.d.ts","sourceRoot":"","sources":["../../../src/compile/binds/bindDefaultTwoWay.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAqBF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,qOAAqO;AACrO,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,GAAG,gBAAgB,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,GACxB,IAAI,CAwDN"}
|