@nisli/core 0.56.0 → 0.57.0

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.
Files changed (114) hide show
  1. package/README.md +38 -6
  2. package/dist/bundler/component.js +409 -0
  3. package/dist/bundler/component.js.map +7 -0
  4. package/dist/bundler/context.js +27 -0
  5. package/dist/bundler/context.js.map +7 -0
  6. package/dist/bundler/diagnostics.js +55 -0
  7. package/dist/bundler/diagnostics.js.map +7 -0
  8. package/dist/bundler/disposable.js +9 -0
  9. package/dist/bundler/disposable.js.map +7 -0
  10. package/dist/bundler/element-context.js +47 -0
  11. package/dist/bundler/element-context.js.map +7 -0
  12. package/dist/bundler/emitter.js +70 -0
  13. package/dist/bundler/emitter.js.map +7 -0
  14. package/dist/bundler/hmr/registry.js +72 -0
  15. package/dist/bundler/hmr/registry.js.map +7 -0
  16. package/dist/bundler/hmr/transform.js +30 -0
  17. package/dist/bundler/hmr/transform.js.map +7 -0
  18. package/dist/bundler/index.js +103 -0
  19. package/dist/bundler/index.js.map +7 -0
  20. package/dist/bundler/injector.js +75 -0
  21. package/dist/bundler/injector.js.map +7 -0
  22. package/dist/bundler/lifecycle.js +56 -0
  23. package/dist/bundler/lifecycle.js.map +7 -0
  24. package/dist/bundler/projection.js +92 -0
  25. package/dist/bundler/projection.js.map +7 -0
  26. package/dist/bundler/query.js +302 -0
  27. package/dist/bundler/query.js.map +7 -0
  28. package/dist/bundler/ref.js +16 -0
  29. package/dist/bundler/ref.js.map +7 -0
  30. package/dist/bundler/resource.js +99 -0
  31. package/dist/bundler/resource.js.map +7 -0
  32. package/dist/bundler/settle.js +43 -0
  33. package/dist/bundler/settle.js.map +7 -0
  34. package/dist/bundler/signal.js +403 -0
  35. package/dist/bundler/signal.js.map +7 -0
  36. package/dist/bundler/template-audit.js +162 -0
  37. package/dist/bundler/template-audit.js.map +7 -0
  38. package/dist/bundler/template.js +847 -0
  39. package/dist/bundler/template.js.map +7 -0
  40. package/dist/bundler/view-transition.js +20 -0
  41. package/dist/bundler/view-transition.js.map +7 -0
  42. package/dist/bundler/vite-hmr/plugin.js +32 -0
  43. package/dist/bundler/vite-hmr/plugin.js.map +7 -0
  44. package/dist/bundler/vite-hmr/runtime.js +8 -0
  45. package/dist/bundler/vite-hmr/runtime.js.map +7 -0
  46. package/dist/index.js +2607 -47
  47. package/dist/index.js.map +7 -1
  48. package/dist/index.production.js +2 -0
  49. package/dist/index.production.js.map +6 -0
  50. package/dist/{diagnostics.d.ts → types/diagnostics.d.ts} +8 -15
  51. package/dist/{template-audit.d.ts → types/template-audit.d.ts} +4 -5
  52. package/package.json +12 -9
  53. package/dist/component.js +0 -633
  54. package/dist/component.js.map +0 -1
  55. package/dist/context.js +0 -55
  56. package/dist/context.js.map +0 -1
  57. package/dist/diagnostics.js +0 -118
  58. package/dist/diagnostics.js.map +0 -1
  59. package/dist/disposable.js +0 -8
  60. package/dist/disposable.js.map +0 -1
  61. package/dist/element-context.js +0 -108
  62. package/dist/element-context.js.map +0 -1
  63. package/dist/emitter.js +0 -91
  64. package/dist/emitter.js.map +0 -1
  65. package/dist/hmr/registry.js +0 -136
  66. package/dist/hmr/registry.js.map +0 -1
  67. package/dist/hmr/transform.js +0 -52
  68. package/dist/hmr/transform.js.map +0 -1
  69. package/dist/injector.js +0 -118
  70. package/dist/injector.js.map +0 -1
  71. package/dist/lifecycle.js +0 -117
  72. package/dist/lifecycle.js.map +0 -1
  73. package/dist/projection.js +0 -179
  74. package/dist/projection.js.map +0 -1
  75. package/dist/query.js +0 -429
  76. package/dist/query.js.map +0 -1
  77. package/dist/ref.js +0 -43
  78. package/dist/ref.js.map +0 -1
  79. package/dist/resource.js +0 -129
  80. package/dist/resource.js.map +0 -1
  81. package/dist/settle.js +0 -106
  82. package/dist/settle.js.map +0 -1
  83. package/dist/signal.js +0 -645
  84. package/dist/signal.js.map +0 -1
  85. package/dist/template-audit.js +0 -246
  86. package/dist/template-audit.js.map +0 -1
  87. package/dist/template.js +0 -1244
  88. package/dist/template.js.map +0 -1
  89. package/dist/view-transition.js +0 -98
  90. package/dist/view-transition.js.map +0 -1
  91. package/dist/vite-hmr/plugin.js +0 -62
  92. package/dist/vite-hmr/plugin.js.map +0 -1
  93. package/dist/vite-hmr/runtime.js +0 -17
  94. package/dist/vite-hmr/runtime.js.map +0 -1
  95. /package/dist/{component.d.ts → types/component.d.ts} +0 -0
  96. /package/dist/{context.d.ts → types/context.d.ts} +0 -0
  97. /package/dist/{disposable.d.ts → types/disposable.d.ts} +0 -0
  98. /package/dist/{element-context.d.ts → types/element-context.d.ts} +0 -0
  99. /package/dist/{emitter.d.ts → types/emitter.d.ts} +0 -0
  100. /package/dist/{hmr → types/hmr}/registry.d.ts +0 -0
  101. /package/dist/{hmr → types/hmr}/transform.d.ts +0 -0
  102. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  103. /package/dist/{injector.d.ts → types/injector.d.ts} +0 -0
  104. /package/dist/{lifecycle.d.ts → types/lifecycle.d.ts} +0 -0
  105. /package/dist/{projection.d.ts → types/projection.d.ts} +0 -0
  106. /package/dist/{query.d.ts → types/query.d.ts} +0 -0
  107. /package/dist/{ref.d.ts → types/ref.d.ts} +0 -0
  108. /package/dist/{resource.d.ts → types/resource.d.ts} +0 -0
  109. /package/dist/{settle.d.ts → types/settle.d.ts} +0 -0
  110. /package/dist/{signal.d.ts → types/signal.d.ts} +0 -0
  111. /package/dist/{template.d.ts → types/template.d.ts} +0 -0
  112. /package/dist/{view-transition.d.ts → types/view-transition.d.ts} +0 -0
  113. /package/dist/{vite-hmr → types/vite-hmr}/plugin.d.ts +0 -0
  114. /package/dist/{vite-hmr → types/vite-hmr}/runtime.d.ts +0 -0
package/dist/component.js DELETED
@@ -1,633 +0,0 @@
1
- /**
2
- * component.ts — Web component shell with typed props and factory composition
3
- *
4
- * `component()` is the single entry point for defining components.
5
- * It registers a custom element and returns a typed factory function.
6
- *
7
- * Component authors write a setup function that receives typed props
8
- * (each wrapped as a Signal) and optionally the host element.
9
- * The setup function returns a TemplateResult from html`...`.
10
- *
11
- * The class internals (connectedCallback, etc.) are completely hidden.
12
- */
13
- import { signal, effect, setContextHook, isSignal, untrack } from './signal.js';
14
- import { runWithContext, hasContext, getCurrentComponent } from './context.js';
15
- import { runMountCallbacks } from './lifecycle.js';
16
- import { diag, formatDiag, isDev } from './diagnostics.js';
17
- // Wire up effect auto-disposal: when effect() is called during component setup,
18
- // auto-register the dispose function with the component host.
19
- setContextHook(() => {
20
- if (hasContext()) {
21
- const comp = getCurrentComponent();
22
- return (disposer) => comp.addDisposer(disposer);
23
- }
24
- return null;
25
- });
26
- const camelToKebab = (s) => s.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
27
- const declType = (decl) => typeof decl === 'string' ? decl : decl.type;
28
- /** The observed attribute name: an explicit `attr` override, else kebab(key). */
29
- const declAttrName = (key, decl) => typeof decl === 'object' && decl.attr ? decl.attr : camelToKebab(key);
30
- /** Resolve a raw attribute string (or null when absent) to the prop value. */
31
- function resolveAttrValue(decl, raw) {
32
- const t = declType(decl);
33
- if (t === 'boolean') {
34
- const def = typeof decl === 'object' && 'default' in decl && decl.default !== undefined
35
- ? decl.default
36
- : false;
37
- if (raw === null)
38
- return def; // absent → declared default (else false)
39
- return raw !== 'false'; // bare/any → true, literal "false" → false
40
- }
41
- if (t === 'number') {
42
- const def = typeof decl === 'object' && 'default' in decl ? decl.default : undefined;
43
- if (raw === null)
44
- return def; // absent → declared default (else undefined)
45
- const n = Number(raw);
46
- // Garbage behaves as ABSENT → the declared default (else undefined). A
47
- // default exists to guarantee non-undefined; letting garbage fall to
48
- // literal undefined would reintroduce exactly what the default prevents.
49
- return Number.isNaN(n) ? def : n;
50
- }
51
- // 'string' | 'forward'
52
- if (raw === null) {
53
- return typeof decl === 'object' && 'default' in decl ? decl.default : undefined;
54
- }
55
- return raw;
56
- }
57
- // ── Internal component host ─────────────────────────────────────────
58
- class ComponentHostImpl {
59
- element;
60
- disposers = [];
61
- setupComplete = false;
62
- constructor(element) {
63
- this.element = element;
64
- }
65
- addDisposer(fn) {
66
- this.disposers.push(fn);
67
- }
68
- dispose() {
69
- for (const fn of this.disposers) {
70
- try {
71
- fn();
72
- }
73
- catch (_) { /* swallow disposal errors */ }
74
- }
75
- this.disposers.length = 0;
76
- }
77
- }
78
- // ── Prop signal management via Proxy ────────────────────────────────
79
- /**
80
- * Creates a Proxy-based props object that lazily creates signals
81
- * for each property on first access. When a parent sets a property
82
- * on the element, the Proxy intercepts it and updates (or creates)
83
- * the backing signal.
84
- */
85
- function createPropsProxy() {
86
- const signals = new Map();
87
- // Keys the component has READ through the proxy, accumulated over the
88
- // COMPONENT LIFETIME (the proxy is constructor-owned and survives
89
- // remounts/HMR swaps, so a re-setup never false-positives). This is the
90
- // truth source for the unknown-prop echo (N202, ADR 0030.2): a post-mount
91
- // write to a never-read key is attribution noise, not state. A component
92
- // that stashes `props` and reads a key dynamically AFTER such a write gets
93
- // one stale echo — accepted; the echo is attribution-only.
94
- const readKeys = new Set();
95
- const getOrCreate = (key, initialValue) => {
96
- let s = signals.get(key);
97
- if (!s) {
98
- s = signal(initialValue);
99
- signals.set(key, s);
100
- }
101
- return s;
102
- };
103
- const props = new Proxy({}, {
104
- get(_target, key) {
105
- // Symbol probes (well-known symbols, thenable checks) are not props.
106
- if (typeof key !== 'string')
107
- return undefined;
108
- readKeys.add(key);
109
- return getOrCreate(key);
110
- },
111
- });
112
- const setProperty = (key, value) => {
113
- const s = getOrCreate(key, value);
114
- s.value = value;
115
- };
116
- return { props, setProperty, readKeys };
117
- }
118
- // ── Duplicate-define attribution (N201, dev only) ───────────────────
119
- /** First definition site per tag, captured in dev for N201 attribution. */
120
- const firstDefineSites = new Map();
121
- /**
122
- * Best-effort caller frame for N201: the first stack line that is neither the
123
- * Error header nor a frame inside this module. Dev-only; a user file that is
124
- * itself named `component.ts` gets skipped too (best-effort attribution, never
125
- * behavior).
126
- */
127
- function captureDefineSite() {
128
- const stack = new Error().stack;
129
- if (!stack)
130
- return '(site unavailable)';
131
- const lines = stack.split('\n');
132
- for (let i = 1; i < lines.length; i++) {
133
- const line = lines[i].trim();
134
- if (!line)
135
- continue;
136
- if (line.includes('captureDefineSite') || /[/\\]component\.(?:ts|js)\b/.test(line))
137
- continue;
138
- return line;
139
- }
140
- return '(site unavailable)';
141
- }
142
- // ── component() — the main entry point ──────────────────────────────
143
- /**
144
- * Define a web component with typed props and a setup function.
145
- *
146
- * Returns a typed factory function for compile-time-safe composition.
147
- *
148
- * ```ts
149
- * interface TaskItemProps {
150
- * task: Task;
151
- * selected: boolean;
152
- * }
153
- *
154
- * const TaskItem = component<TaskItemProps>('task-item', (props, host) => {
155
- * const title = computed(() => props.task.value.title);
156
- * return html`<div>${title}</div>`;
157
- * });
158
- *
159
- * // Factory usage:
160
- * TaskItem({ task: taskSignal, selected: isSelected })
161
- * ```
162
- */
163
- export function component(tagName, setup,
164
- // When `A` is explicitly given a non-empty attrs literal (the narrowing
165
- // opt-in), the options argument — carrying `attrs: A` — is REQUIRED: a
166
- // `component<P, typeof attrs>(tag, setup)` that types the props as narrowed but
167
- // never actually wires the attrs at runtime would be a compile-time lie. When
168
- // `A` is `{}` (the legacy default, no second type arg), options stays optional
169
- // exactly as before. `attrs` in that legacy branch is still validated as
170
- // `ComponentAttrs<P>` via `ComponentOptions<P>`.
171
- ...[options]) {
172
- // Attribute-reactivity wiring (ADR 0025 item 3). Computed once
173
- // per component definition; empty when no `attrs` declared (→ zero cost).
174
- const attrEntries = new Map(); // by attrName
175
- const attrEntriesByKey = new Map(); // by prop key
176
- if (options?.attrs) {
177
- for (const key of Object.keys(options.attrs)) {
178
- const decl = options.attrs[key];
179
- const attrName = declAttrName(key, decl);
180
- const entry = { key, attrName, decl };
181
- attrEntries.set(attrName, entry);
182
- attrEntriesByKey.set(key, entry);
183
- }
184
- }
185
- const observedList = Array.from(attrEntries.keys());
186
- // The custom element class
187
- class FrameworkComponent extends HTMLElement {
188
- _host = null;
189
- _propsProxy = null;
190
- _mounted = false;
191
- _templateResult = null;
192
- _errorTemplateResult = null;
193
- _teardownScheduled = false;
194
- // True once a setup cycle completed (template mounted, onMount ran).
195
- // Gates the unknown-prop echo (N202): factory writes BEFORE connect are
196
- // the normal seeding path, never noise.
197
- _setupDone = false;
198
- // N202 keys already echoed for this element — one echo per key per
199
- // element lifetime keeps a reactive binding from spamming the console.
200
- _echoed = null;
201
- // Props explicitly set via _setProp (factory / direct assignment) are
202
- // "pinned": an explicit prop wins, so attribute writes no longer overwrite
203
- // it. (Precedence ruling: prop-pins.)
204
- _pinned = new Set();
205
- // Guards our own removeAttribute() during 'forward' relocation from
206
- // re-entering attributeChangedCallback.
207
- _relocating = false;
208
- /** The browser reads this once at define time. Empty → no callbacks. */
209
- static get observedAttributes() {
210
- return observedList;
211
- }
212
- constructor() {
213
- super();
214
- this._propsProxy = createPropsProxy();
215
- }
216
- /** Write one declared attribute onto its prop signal, honoring pinning. */
217
- _applyAttr(entry, raw) {
218
- if (declType(entry.decl) === 'forward') {
219
- // Relocate off the layout-transparent host (no duplicate id/name), but
220
- // only adopt the attribute's value when no explicit prop pinned it. A
221
- // null `raw` here (absent OR already-relocated) is a NO-OP: the seed
222
- // and attributeChangedCallback must not clobber an adopted value. The
223
- // explicit unpin path (in _setProp) handles clearing.
224
- if (raw !== null) {
225
- if (!this._pinned.has(entry.key)) {
226
- this._propsProxy.setProperty(entry.key, raw);
227
- }
228
- this._relocating = true;
229
- this.removeAttribute(entry.attrName);
230
- this._relocating = false;
231
- }
232
- return;
233
- }
234
- if (this._pinned.has(entry.key))
235
- return; // explicit prop wins
236
- this._propsProxy.setProperty(entry.key, resolveAttrValue(entry.decl, raw));
237
- }
238
- /** Seed initial prop values from current attributes (incl. defaults). */
239
- _seedAttrs() {
240
- for (const entry of attrEntries.values()) {
241
- this._applyAttr(entry, this.getAttribute(entry.attrName));
242
- }
243
- }
244
- attributeChangedCallback(name, _old, next) {
245
- if (this._relocating)
246
- return;
247
- const entry = attrEntries.get(name);
248
- if (entry)
249
- this._applyAttr(entry, next);
250
- }
251
- connectedCallback() {
252
- if (this._mounted)
253
- return; // guard against re-connection
254
- this._mounted = true;
255
- // Isolate activeObserver: child component setup signal reads must NOT
256
- // leak into a parent effect's dependency set. Without this, a parent
257
- // effect running replaceChildren/appendChild triggers child
258
- // connectedCallback synchronously, and child signal reads would be
259
- // tracked as parent dependencies — causing infinite re-render loops.
260
- // See ADR 0008 Gap 1 / ADR 0009.
261
- untrack(() => {
262
- const host = new ComponentHostImpl(this);
263
- this._host = host;
264
- // Canonical pre-setup order: SEED → CAPTURE → CONTEXT (then setup).
265
- //
266
- // SEED (ADR 0025 item 3): write prop signals from current
267
- // attributes (incl. declared defaults and 'forward' relocation) so setup
268
- // sees correct initial values. No-op when no attrs are declared.
269
- if (attrEntries.size)
270
- this._seedAttrs();
271
- // CAPTURE (ADR 0025 item 1): snapshot the host's light-DOM
272
- // children so children() can project them. Snapshot only — children()
273
- // removes/projects on demand — so non-projecting components are
274
- // untouched. Zero-cost when the host has no light DOM.
275
- if (this.childNodes.length) {
276
- this.__capturedChildren =
277
- Array.from(this.childNodes);
278
- }
279
- // Phase attribution for the SHARED containment boundary (ADR 0030.2
280
- // T6): 'setup' (N401) until the template is committed, 'mount' (N402)
281
- // once onMount callbacks begin. Both phases route through the ONE
282
- // catch below — runMountCallbacks no longer swallows (lifecycle.ts).
283
- let phase = 'setup';
284
- try {
285
- // CONTEXT is established by runWithContext(host, …) below; setup then
286
- // runs with seed + capture already in place.
287
- runWithContext(host, () => {
288
- // The Proxy is runtime-untyped; the declared narrowing (A) is a
289
- // compile-time view the setup function requested (ADR 0025 (b)).
290
- this._templateResult = setup(this._propsProxy.props, this);
291
- });
292
- // Mount the template result
293
- if (this._templateResult) {
294
- mountTemplate(this, this._templateResult, host);
295
- }
296
- // PROJECTION PHASE (ADR 0030.2 §3): if setup called children(), run
297
- // its late-children sweep scheduling NOW — after the template
298
- // committed, BEFORE any onMount callback. The rendered-roots
299
- // snapshot therefore never depends on where children() sat relative
300
- // to onMount() registrations (the 0025 batch-3B ordering trap), and
301
- // the rule becomes universal: any host child appearing after this
302
- // point — late parser/innerHTML content OR an onMount host-append —
303
- // classifies as projected content.
304
- const sweepHost = this;
305
- if (sweepHost.__nisliProjectionSweep) {
306
- const sweep = sweepHost.__nisliProjectionSweep;
307
- sweepHost.__nisliProjectionSweep = undefined; // consumed once per cycle
308
- sweep();
309
- }
310
- // Run onMount() callbacks — DOM is now committed
311
- phase = 'mount';
312
- runMountCallbacks(host);
313
- this._setupDone = true;
314
- // T6: a SUCCESSFUL (re-)setup — including _remount(), the documented
315
- // boundary reset — removes the failure stamp.
316
- this.removeAttribute('data-nisli-error');
317
- }
318
- catch (err) {
319
- const error = err instanceof Error ? err : new Error(String(err));
320
- const code = phase === 'setup' ? 'N401' : 'N402';
321
- diag(code, `<${tagName}> ${phase} failed: ${error.message}`, {
322
- tag: tagName,
323
- phase,
324
- error,
325
- });
326
- // Setup may already have registered effects/lifecycle cleanup, or
327
- // mountTemplate() may have partially installed bindings before
328
- // throwing — and a mount-phase throw arrives with the whole scope
329
- // live. Tear the partial scope down BEFORE mounting the error
330
- // fallback so no hidden work survives behind it (issue 0010; the
331
- // onMount phase now shares these exact semantics per T6). An
332
- // unconsumed projection sweep hook is part of that partial scope.
333
- this.__nisliProjectionSweep =
334
- undefined;
335
- if (this._templateResult?.dispose) {
336
- this._templateResult.dispose();
337
- }
338
- this._templateResult = null;
339
- host.dispose();
340
- this._host = null;
341
- this.replaceChildren();
342
- // T6 — failure is a DOM fact. The attribute is the DURABLE channel:
343
- // `querySelectorAll('[data-nisli-error]')` answers "which component
344
- // failed" long after the fact, with no listener installed in
345
- // advance. Client-runtime only — SSG failures stay build failures.
346
- this.setAttribute('data-nisli-error', code);
347
- if (options?.onError) {
348
- try {
349
- const fallback = options.onError(error, this);
350
- if (typeof fallback === 'string') {
351
- this.innerHTML = fallback;
352
- }
353
- else {
354
- this._errorTemplateResult = fallback;
355
- mountTemplate(this, fallback);
356
- }
357
- }
358
- catch (_) {
359
- if (this._errorTemplateResult?.dispose) {
360
- this._errorTemplateResult.dispose();
361
- }
362
- this._errorTemplateResult = null;
363
- this.innerHTML = `<div style="color:red;padding:4px">Error in &lt;${tagName}&gt;</div>`;
364
- }
365
- }
366
- else {
367
- this.innerHTML = `<div style="color:red;padding:4px">Error in &lt;${tagName}&gt;</div>`;
368
- }
369
- // T6 — the EVENT is the live channel: one document-level listener
370
- // observes every contained failure as it happens. Dispatched LAST so
371
- // listeners see the settled DOM (stamp + fallback). Bubbling is a
372
- // DOM-tree walk, so CSS (display:contents transparent hosts) never
373
- // affects delivery — but a component mounted into a DETACHED
374
- // fragment has no path to document and the event is swallowed; the
375
- // attribute above is the durable record for those (ADR 0030.2 §8).
376
- this.dispatchEvent(new CustomEvent('nisli-error', {
377
- bubbles: true,
378
- composed: true,
379
- detail: { code, tag: tagName, phase, message: error.message },
380
- }));
381
- }
382
- });
383
- }
384
- disconnectedCallback() {
385
- // A same-tick remove+reinsert is a MOVE, not a removal: per WHATWG,
386
- // append-based moves fire disconnected+connected (only moveBefore()
387
- // preserves state). Moves happen routinely inside the framework —
388
- // each() keyed reorders, light-DOM projection of nested components —
389
- // and re-running setup on them duplicates rendered output and loses
390
- // state. Defer teardown one microtask and skip it if the element is
391
- // connected again; connectedCallback's _mounted guard then makes the
392
- // whole move a no-op. True removals still dispose, one microtask
393
- // later. See ADR 0023.
394
- if (this._teardownScheduled)
395
- return;
396
- this._teardownScheduled = true;
397
- queueMicrotask(() => {
398
- this._teardownScheduled = false;
399
- if (this.isConnected)
400
- return;
401
- this._teardownNow();
402
- });
403
- }
404
- /**
405
- * Atomic DOM moves preserve this component's position-independent state,
406
- * so the platform-level lifecycle is a no-op. ADR 0023's deferred
407
- * disconnect teardown remains the fallback for append-based moves.
408
- */
409
- connectedMoveCallback() { }
410
- /**
411
- * Synchronously dispose the current component scope and restore any
412
- * projected light-DOM children as direct host children. Normal disconnect
413
- * calls this after the move-detection microtask; HMR calls it directly so
414
- * reconnect cannot be defeated by the `_mounted` guard (issues 0001/0002).
415
- */
416
- _teardownNow() {
417
- this._mounted = false;
418
- this._setupDone = false;
419
- if (this._templateResult?.dispose) {
420
- this._templateResult.dispose();
421
- }
422
- this._templateResult = null;
423
- if (this._errorTemplateResult?.dispose) {
424
- this._errorTemplateResult.dispose();
425
- }
426
- this._errorTemplateResult = null;
427
- if (this._host) {
428
- this._host.dispose();
429
- this._host = null;
430
- }
431
- // children() records the plain light-DOM nodes it owns during cleanup.
432
- // Replacing the rendered tree with those nodes preserves author content
433
- // for a later true reconnect/HMR setup; components without projection
434
- // simply become empty before the fresh setup appends its new subtree.
435
- const captured = this
436
- .__capturedChildren ?? [];
437
- this.replaceChildren(...captured);
438
- }
439
- /** @internal — transport-agnostic HMR in-place remount hook. */
440
- _remount() {
441
- this._teardownScheduled = false;
442
- this._teardownNow();
443
- this.connectedCallback();
444
- }
445
- /**
446
- * Set a prop value. Called by the factory and by direct property assignment.
447
- * The Proxy intercepts and creates/updates backing signals.
448
- *
449
- * Precedence = DEFINED-write-pins (ADR 0025 item 3): a defined
450
- * value pins the key so a declared attribute no longer overwrites it. An
451
- * explicit `undefined` (e.g. a factory spreading an unset optional prop —
452
- * `{...opts}` fires _setProp(key, undefined) per the Object.entries walk)
453
- * must NOT pin; it falls back to the declared attribute/default, matching
454
- * attr()'s coalesce. For a declared attribute, that fallback re-resolves
455
- * from the current attribute, keeping declared-default booleans
456
- * non-undefined.
457
- */
458
- _setProp(key, value) {
459
- // Unknown-prop echo (N202, dev, ADR 0030.2): post-mount, a DEFINED write
460
- // to a key setup() never read is attribution noise — a misspelled prop
461
- // (`varian=`) arriving through the factory or the template
462
- // auto-resolution path (both funnel through _setProp). `undefined`
463
- // writes are exempt BY CONTRACT: a factory spreading unset optional
464
- // props fires _setProp(key, undefined) per the Object.entries walk (see
465
- // the pinning doc above). Attribution-only — the write still lands
466
- // exactly as before; deduped per key per element.
467
- if (this._setupDone
468
- && value !== undefined
469
- && isDev()
470
- // A declared attrs key is contract, not a typo — 'forward' especially,
471
- // where CORE owns the read and setup() never touches the prop. Gate
472
- // ruling on ADR 0030.2 §8 T6 Q3: declared keys are exempt.
473
- && !attrEntriesByKey.has(key)
474
- && !this._propsProxy.readKeys.has(key)
475
- && !(this._echoed ??= new Set()).has(key)) {
476
- this._echoed.add(key);
477
- diag('N202', `<${tagName}> prop '${key}' was set but setup() never read it — misspelled or unsupported prop?`, { tag: tagName, key });
478
- }
479
- if (value === undefined) {
480
- this._pinned.delete(key);
481
- const entry = attrEntriesByKey.get(key);
482
- if (entry) {
483
- const raw = this.getAttribute(entry.attrName);
484
- // A 'forward' attribute is removed from the host on adoption, so an
485
- // unpin can't re-read it — resolve the absent value directly to CLEAR
486
- // a previously pinned id/name (rev audit fix). _applyAttr's forward
487
- // branch deliberately no-ops on absent (so the seed/attr callback
488
- // never clobber an adopted value); the explicit unpin does not.
489
- if (raw === null && declType(entry.decl) === 'forward') {
490
- this._propsProxy?.setProperty(key, resolveAttrValue(entry.decl, null));
491
- }
492
- else {
493
- this._applyAttr(entry, raw);
494
- }
495
- return;
496
- }
497
- }
498
- else {
499
- this._pinned.add(key);
500
- }
501
- this._propsProxy?.setProperty(key, value);
502
- }
503
- /**
504
- * Read a prop's backing signal (framework-internal). Used by children()
505
- * to fold the factory `children` prop into the projection slot (ADR 0025
506
- * item 1) without a new public read API.
507
- */
508
- _propSignal(key) {
509
- return this._propsProxy.props[key];
510
- }
511
- /**
512
- * Whether a prop is currently pinned by a defined factory/property write
513
- * (framework-internal, like _propSignal). The attribute-as-truth open-state
514
- * pattern needs this as its controlled-mode discriminator: a declared
515
- * 'boolean' prop is never undefined (absent → false), so pin state is the
516
- * ONLY way a component can tell "parent drives this" from "the attribute
517
- * drives this" — e.g. setOpen() must not write the open attribute while a
518
- * controlled parent has it pinned, or the DOM attribute diverges from the
519
- * pinned state until the next prop write.
520
- */
521
- _isPinned(key) {
522
- return this._pinned.has(key);
523
- }
524
- }
525
- // Register the custom element. A DUPLICATE definition is a coded dev error
526
- // (N201, ADR 0030.2 §3/§8): first-wins-silently rendered the WRONG component
527
- // while the second factory typechecked against the wrong props. The error
528
- // names both definition sites and is thrown to the SECOND definer; the
529
- // first definition stays live (first-wins preserved). Exemptions:
530
- // - HMR re-evaluations arrive with the registry's marked indirection thunk
531
- // (hmr/registry.ts __register) — the live thunk already swapped setup, so
532
- // re-registration is the mechanism working, not a collision.
533
- // - Production keeps the historical SILENT first-wins: a name clash must
534
- // not take down a live page (redefine-as-swap stays HMR/dev-only because
535
- // the copy-in registry model makes genuine duplicate tags structural).
536
- if (!customElements.get(tagName)) {
537
- customElements.define(tagName, FrameworkComponent);
538
- if (isDev())
539
- firstDefineSites.set(tagName, captureDefineSite());
540
- }
541
- else if (isDev() && !setup.__nisliHmr) {
542
- const first = firstDefineSites.get(tagName)
543
- ?? '(unknown site — defined outside component(), or before dev mode was enabled)';
544
- throw new Error(formatDiag('N201', `duplicate define for <${tagName}>. First defined ${first}; the second `
545
- + `definition site is this error's own stack. The first definition stays `
546
- + `live (first-wins) — rename one of the components.`));
547
- }
548
- // Return the typed factory function
549
- const factory = (props, hostAttrs) => {
550
- return {
551
- __type: 'factory',
552
- tagName,
553
- props: props,
554
- hostAttrs,
555
- };
556
- };
557
- return factory;
558
- }
559
- /**
560
- * Ensure a value is a signal. If it already is, return as-is.
561
- * If it's a plain value, wrap it in signal().
562
- * Used by factory mount to support PropInput<T> = T | Signal<T>.
563
- */
564
- function ensureSignal(value) {
565
- if (isSignal(value))
566
- return value;
567
- return signal(value);
568
- }
569
- /**
570
- * Mount a TemplateResult into a host element.
571
- * This is the bridge between component.ts and template.ts.
572
- * Template.ts will provide the actual implementation via the
573
- * TemplateResult.mount() method.
574
- *
575
- * @param hostImpl — optional ComponentHostImpl for registering disposers
576
- */
577
- function mountTemplate(host, result, hostImpl) {
578
- if (result && typeof result === 'object' && 'mount' in result && typeof result.mount === 'function') {
579
- result.mount(host);
580
- }
581
- else if (result && typeof result === 'object' && '__type' in result) {
582
- // Factory result — create the child element
583
- const factoryResult = result;
584
- const el = document.createElement(factoryResult.tagName);
585
- // Forward props as signals (auto-wrap plain values)
586
- for (const [key, raw] of Object.entries(factoryResult.props)) {
587
- const sig = ensureSignal(raw);
588
- el._setProp(key, sig.value);
589
- // Subscribe to signal changes to update the child's props
590
- const unsub = sig.subscribe((newVal) => {
591
- el._setProp(key, newVal);
592
- });
593
- // Register unsub for cleanup on disconnect
594
- if (hostImpl) {
595
- hostImpl.addDisposer(unsub);
596
- }
597
- }
598
- // Apply host-level attributes (class)
599
- if (factoryResult.hostAttrs?.class != null) {
600
- const classSig = ensureSignal(factoryResult.hostAttrs.class);
601
- // Apply initial value
602
- applyHostClass(el, '', classSig.value);
603
- // Subscribe to reactive changes
604
- let prevClass = classSig.value;
605
- const unsub = classSig.subscribe((newClass) => {
606
- applyHostClass(el, prevClass, newClass);
607
- prevClass = newClass;
608
- });
609
- if (hostImpl) {
610
- hostImpl.addDisposer(unsub);
611
- }
612
- }
613
- host.appendChild(el);
614
- }
615
- }
616
- /**
617
- * Apply a class string to an element via classList, replacing the previous
618
- * class string's classes. Uses add/remove to avoid interfering with classes
619
- * set by the component's own template (class:name directives, etc.).
620
- */
621
- function applyHostClass(el, prev, next) {
622
- const prevClasses = prev ? prev.split(/\s+/).filter(Boolean) : [];
623
- const nextClasses = next ? next.split(/\s+/).filter(Boolean) : [];
624
- for (const cls of prevClasses) {
625
- if (!nextClasses.includes(cls))
626
- el.classList.remove(cls);
627
- }
628
- for (const cls of nextClasses) {
629
- if (!prevClasses.includes(cls))
630
- el.classList.add(cls);
631
- }
632
- }
633
- //# sourceMappingURL=component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAo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