@tschk/moonshine-svelte 0.0.0-stage → 0.4.49

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.
@@ -0,0 +1,129 @@
1
+ /** Explicit native directive installation; source syntax remains compiler-owned. */
2
+ import {
3
+ createComponentScope,
4
+ templateRetentionKey,
5
+ createRenderEffect,
6
+ getOwner,
7
+ getRenderScheduler,
8
+ onAfterDispose,
9
+ onCleanup,
10
+ runWithOwner,
11
+ untrack,
12
+ } from "@tschk/moonshine-dom/reactive";
13
+ import { isSSRRendering } from "@tschk/moonshine-dom/ssr-owner";
14
+ import { peekComponentContext } from "@tschk/moonshine-dom/component";
15
+ import { mapArray } from "@tschk/moonshine-dom/control";
16
+ import { createRuneEffect } from "./effect";
17
+ import { trackActionState } from "./state";
18
+ import { withHistoryCleanup } from "./history";
19
+
20
+ /** Type-only authored Svelte action contract. */
21
+ export interface ActionReturn<
22
+ Parameter = undefined,
23
+ Attributes extends object = Record<never, never>,
24
+ > {
25
+ update?: (parameter: Parameter) => void;
26
+ destroy?: () => void;
27
+ $$_attributes?: Attributes;
28
+ }
29
+ export interface Action<
30
+ Element = HTMLElement,
31
+ Parameter = undefined,
32
+ Attributes extends object = Record<never, never>,
33
+ > {
34
+ <Node extends Element>(
35
+ ...args: undefined extends Parameter
36
+ ? [node: Node, parameter?: Parameter]
37
+ : [node: Node, parameter: Parameter]
38
+ ): void | ActionReturn<Parameter, Attributes>;
39
+ }
40
+
41
+ export type ActionPayload<T> = { update?(value: T): void; destroy?(): void };
42
+ export type Attachment<E extends Element = Element> = (
43
+ element: E,
44
+ ) => void | (() => void);
45
+ function install(fn: () => void): void {
46
+ if (isSSRRendering() || peekComponentContext()?.mode === "ssr") return;
47
+ const owner = getOwner(),
48
+ scheduler = getRenderScheduler();
49
+ if (!owner || owner.disposed || !scheduler)
50
+ throw Error("Native directives require a live owner and withRuneScheduler");
51
+ createComponentScope(() => scheduler.branch(fn));
52
+ }
53
+ function cleanup(fn: () => void): void {
54
+ const finish = () => withHistoryCleanup(() => untrack(fn));
55
+ const owner = getOwner();
56
+ if (owner?.disposed) finish();
57
+ else if (owner?.context?.has(templateRetentionKey))
58
+ onCleanup(() => runWithOwner(owner, finish));
59
+ else onAfterDispose(finish);
60
+ }
61
+ function different(previous: unknown, next: unknown): boolean {
62
+ return previous !== previous
63
+ ? next === next
64
+ : previous !== next ||
65
+ (previous !== null && typeof previous === "object") ||
66
+ typeof previous === "function";
67
+ }
68
+ /** invoke is a closure: resolve a mutable action reference only when the post factory runs. */
69
+ export function installAction<E extends Element, T>(
70
+ element: E,
71
+ invoke: (element: E, value: T) => ActionPayload<T> | void | false | null,
72
+ read: () => T,
73
+ ): void;
74
+ export function installAction<E extends Element, T>(
75
+ element: E,
76
+ invoke: (element: E) => ActionPayload<T> | void | false | null,
77
+ ): void;
78
+ export function installAction<E extends Element, T>(
79
+ element: E,
80
+ invoke: (element: E, value: T) => ActionPayload<T> | void | false | null,
81
+ read?: () => T,
82
+ ): void {
83
+ install(() =>
84
+ createRuneEffect(() => {
85
+ const payload = untrack(
86
+ () =>
87
+ (read
88
+ ? invoke(element, read())
89
+ : (invoke as (element: E) => ReturnType<typeof invoke>)(element)) ||
90
+ {},
91
+ );
92
+ // Register before updater setup so a failing parameter traversal still releases the action.
93
+ if (payload.destroy) cleanup(() => payload.destroy!());
94
+ if (read && payload.update) {
95
+ let initialized = false;
96
+ let previous: unknown = {};
97
+ createRenderEffect(() => {
98
+ const next = read();
99
+ trackActionState(next);
100
+ if (initialized && different(previous, next)) {
101
+ previous = next;
102
+ payload.update!(next);
103
+ }
104
+ });
105
+ initialized = true;
106
+ }
107
+ }),
108
+ );
109
+ }
110
+ export function installAttachment<E extends Element>(
111
+ element: E,
112
+ read: () => Attachment<E> | false | null | undefined,
113
+ ): void {
114
+ install(() => {
115
+ mapArray(
116
+ () => {
117
+ const fn = read();
118
+ return fn ? [fn] : [];
119
+ },
120
+ (fn) => {
121
+ createRuneEffect(() => {
122
+ const stop = fn(element);
123
+ if (typeof stop === "function") cleanup(stop);
124
+ });
125
+ return undefined;
126
+ },
127
+ );
128
+ });
129
+ }
package/src/each.ts ADDED
@@ -0,0 +1,306 @@
1
+ /**
2
+ * Optional keyed each. Reconciliation visit/move ordering adapted from
3
+ * Svelte's MIT-licensed each.js (copyright 2016–2025 Svelte Contributors).
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8
+ * of the Software, and to permit persons to whom the Software is furnished to
9
+ * do so, subject to the following conditions:
10
+ * The above copyright notice and this permission notice shall be included in
11
+ * all copies or substantial portions of the Software.
12
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
+ * SOFTWARE.
19
+ */
20
+ import {
21
+ createInsertionRange,
22
+ insertionRangeEnd,
23
+ prepareInsertionRange,
24
+ moveInsertionRange,
25
+ type DOMChild,
26
+ } from "@tschk/moonshine-dom/dom";
27
+ import {
28
+ createRoot,
29
+ createComponentScope,
30
+ getOwner,
31
+ getRenderScheduler,
32
+ createSignal,
33
+ createRenderMemo,
34
+ onCleanup,
35
+ type Owner,
36
+ type Accessor,
37
+ type Setter,
38
+ } from "@tschk/moonshine-dom/reactive";
39
+ type Entry<T> = {
40
+ key: unknown;
41
+ node: Node;
42
+ stop: () => void;
43
+ scope: Owner;
44
+ setItem: Setter<T>;
45
+ setIndex: Setter<number>;
46
+ prev: Entry<T> | null;
47
+ next: Entry<T> | null;
48
+ fresh: boolean;
49
+ };
50
+ /** Source compiler-owned entry; no SSR dispatch or ordinary native policy. */
51
+ export function keyedEach<T>(
52
+ read: () => ArrayLike<T> | Iterable<T> | null | undefined,
53
+ key: (item: T, index: number) => unknown,
54
+ map: (item: Accessor<T>, index: Accessor<number>) => DOMChild,
55
+ fallback?: () => DOMChild,
56
+ retain?: (node: Node) => boolean,
57
+ ): Node {
58
+ const parent = getOwner();
59
+ if (!parent || parent.disposed) throw new Error("Each requires a live owner");
60
+ const group = createComponentScope(() => getOwner()!);
61
+ const scheduler = getRenderScheduler();
62
+ const entries = new Map<unknown, Entry<T>>();
63
+ let first: Entry<T> | null = null,
64
+ last: Entry<T> | null = null,
65
+ initial = true,
66
+ closed = false;
67
+ let empty: Entry<T> | undefined;
68
+ let outer!: Node;
69
+ function unlink(row: Entry<T>) {
70
+ if (row.prev) row.prev.next = row.next;
71
+ else first = row.next;
72
+ if (row.next) row.next.prev = row.prev;
73
+ else last = row.prev;
74
+ }
75
+ function link(row: Entry<T>, prev: Entry<T> | null, next: Entry<T> | null) {
76
+ row.prev = prev;
77
+ row.next = next;
78
+ if (prev) prev.next = row;
79
+ else first = row;
80
+ if (next) next.prev = row;
81
+ else last = row;
82
+ }
83
+ function destroy(rows: Iterable<Entry<T>>) {
84
+ let failed = false,
85
+ failure: unknown;
86
+ for (const row of rows) {
87
+ unlink(row);
88
+ entries.delete(row.key);
89
+ try {
90
+ row.stop();
91
+ } catch (error) {
92
+ if (!failed) failure = error;
93
+ failed = true;
94
+ }
95
+ }
96
+ if (failed) throw failure;
97
+ }
98
+ function create(
99
+ value: T,
100
+ index: number,
101
+ id: unknown,
102
+ renderRow = map,
103
+ ): Entry<T> {
104
+ let stopRow: (() => void) | undefined;
105
+ try {
106
+ return createRoot((dispose) => {
107
+ stopRow = dispose;
108
+ const scope = getOwner()!;
109
+ const [item, setItem] = createSignal(value);
110
+ const [position, setIndex] = createSignal(index);
111
+ const build = () => {
112
+ const node = createInsertionRange(
113
+ renderRow(item, position),
114
+ undefined,
115
+ retain,
116
+ );
117
+ prepareInsertionRange(node);
118
+ return node;
119
+ };
120
+ const activeScheduler = getRenderScheduler();
121
+ const node = activeScheduler
122
+ ? activeScheduler.branch(build, position)
123
+ : build();
124
+ if (closed || group.disposed) {
125
+ dispose();
126
+ throw new Error("Each disposed during row setup");
127
+ }
128
+ scope.parent = group;
129
+ group.children.add(scope);
130
+ const row: Entry<T> = {
131
+ key: id,
132
+ node,
133
+ stop: dispose,
134
+ scope,
135
+ setItem,
136
+ setIndex,
137
+ prev: null,
138
+ next: null,
139
+ fresh: true,
140
+ };
141
+ link(row, last, null);
142
+ return row;
143
+ });
144
+ } catch (error) {
145
+ try {
146
+ stopRow?.();
147
+ } catch {}
148
+ throw error;
149
+ }
150
+ }
151
+ function stop() {
152
+ if (closed) return;
153
+ closed = true;
154
+ const rows = [...entries.values()];
155
+ if (empty) rows.push(empty);
156
+ empty = undefined;
157
+ destroy(rows);
158
+ }
159
+ onCleanup(stop);
160
+ const reconcile = () => {
161
+ if (closed) return null;
162
+ const input = read();
163
+ const items = Array.isArray(input) ? input : Array.from(input ?? []);
164
+ const length = items.length;
165
+ const keys = new Set<unknown>();
166
+ const preparedKeys: unknown[] = [];
167
+ const created: Entry<T>[] = [];
168
+ try {
169
+ for (let index = 0; index < length; index++) {
170
+ const value = items[index]!,
171
+ id = key(value, index);
172
+ if (keys.has(id)) throw new Error("Duplicate each key");
173
+ keys.add(id);
174
+ preparedKeys.push(id);
175
+ const row = entries.get(id);
176
+ if (row) {
177
+ row.setItem(() => value);
178
+ row.setIndex(index);
179
+ } else {
180
+ const createdRow = create(value, index, id);
181
+ created.push(createdRow);
182
+ entries.set(id, createdRow);
183
+ }
184
+ }
185
+ if (length && empty) {
186
+ const old = empty;
187
+ empty = undefined;
188
+ unlink(old);
189
+ old.stop();
190
+ }
191
+ if (!initial && (length > 0 || !empty)) {
192
+ let current = first,
193
+ prev: Entry<T> | null = null,
194
+ seen: Set<Entry<T>> | undefined;
195
+ let matched: Entry<T>[] = [],
196
+ stashed: Entry<T>[] = [];
197
+ for (let index = 0; index < length; index++) {
198
+ const id = key(items[index]!, index);
199
+ const prepared = preparedKeys[index];
200
+ if (id !== prepared && !(id !== id && prepared !== prepared))
201
+ throw new Error("Each key changed during reconciliation");
202
+ const row = entries.get(id);
203
+ if (!row) throw new Error("Each key changed during reconciliation");
204
+ if (row.fresh) {
205
+ row.fresh = false;
206
+ if (row === current) {
207
+ moveInsertionRange(row.node, insertionRangeEnd(outer));
208
+ } else {
209
+ const next = prev ? prev.next : current;
210
+ unlink(row);
211
+ link(row, prev, next);
212
+ moveInsertionRange(
213
+ row.node,
214
+ next?.node ?? insertionRangeEnd(outer),
215
+ );
216
+ prev = row;
217
+ matched = [];
218
+ stashed = [];
219
+ current = prev.next;
220
+ continue;
221
+ }
222
+ }
223
+ if (row !== current) {
224
+ if (seen?.has(row)) {
225
+ if (matched.length < stashed.length) {
226
+ const start = stashed[0]!,
227
+ a = matched[0]!,
228
+ b = matched[matched.length - 1]!;
229
+ prev = start.prev;
230
+ for (const part of matched)
231
+ moveInsertionRange(part.node, start.node);
232
+ for (const part of stashed) seen.delete(part);
233
+ const beforeA = a.prev,
234
+ afterB = b.next;
235
+ if (beforeA) beforeA.next = afterB;
236
+ else first = afterB;
237
+ if (afterB) afterB.prev = beforeA;
238
+ else last = beforeA;
239
+ if (prev) prev.next = a;
240
+ else first = a;
241
+ a.prev = prev;
242
+ b.next = start;
243
+ start.prev = b;
244
+ current = start;
245
+ prev = b;
246
+ index--;
247
+ matched = [];
248
+ stashed = [];
249
+ } else {
250
+ seen.delete(row);
251
+ moveInsertionRange(
252
+ row.node,
253
+ current?.node ?? insertionRangeEnd(outer),
254
+ );
255
+ unlink(row);
256
+ const next = prev === null ? first : prev.next;
257
+ link(row, prev, next);
258
+ prev = row;
259
+ }
260
+ continue;
261
+ }
262
+ matched = [];
263
+ stashed = [];
264
+ while (current && current !== row) {
265
+ (seen ??= new Set()).add(current);
266
+ stashed.push(current);
267
+ current = current.next;
268
+ }
269
+ if (!current) continue;
270
+ }
271
+ if (!row.fresh) matched.push(row);
272
+ prev = row;
273
+ current = row.next;
274
+ }
275
+ const removed = [...(seen ?? [])];
276
+ while (current) {
277
+ removed.push(current);
278
+ current = current.next;
279
+ }
280
+ destroy(removed);
281
+ }
282
+ initial = false;
283
+ for (const row of entries.values()) row.fresh = false;
284
+ if (!length && fallback && !empty)
285
+ empty = create(undefined as T, 0, Symbol("fallback"), () => fallback());
286
+ const tokens: Node[] = [];
287
+ for (let row = first; row; row = row.next) tokens.push(row.node);
288
+ // Preserve current source order for child-first owner teardown.
289
+ group.children.clear();
290
+ for (let row = first; row; row = row.next) group.children.add(row.scope);
291
+ scheduler?.reorder();
292
+ return tokens;
293
+ } catch (error) {
294
+ try {
295
+ destroy(created.filter((row) => entries.get(row.key) === row));
296
+ } catch {}
297
+ throw error;
298
+ }
299
+ };
300
+ outer = createInsertionRange(
301
+ reconcile,
302
+ scheduler ? createRenderMemo : undefined,
303
+ retain,
304
+ );
305
+ return outer;
306
+ }
package/src/effect.ts ADDED
@@ -0,0 +1,250 @@
1
+ import { isSSRRendering } from "@tschk/moonshine-dom/ssr-owner";
2
+ /** Post-DOM native rune effects; opt-in pre/render phases live on /pre. */
3
+ import {
4
+ collectDeps,
5
+ subscribeInvalidation,
6
+ type Trackable,
7
+ } from "@tschk/moonshine/tracking";
8
+ import {
9
+ createRoot,
10
+ getRenderScheduler,
11
+ getOwner,
12
+ onCleanup,
13
+ runWithOwner,
14
+ untrack,
15
+ } from "@tschk/moonshine-dom/reactive";
16
+ import { peekComponentContext } from "@tschk/moonshine-dom/component";
17
+ import { flushComponentReferences } from "@tschk/moonshine-dom/component-instance";
18
+
19
+ import { holdHistory, releaseHistory, withHistoryCleanup } from "./history";
20
+ import { notifyTrackableUnsubscribe } from "./store-demand";
21
+ import { queueTickWork, removeTickWork } from "./tick-queue";
22
+
23
+ const pending = new Set<() => void>();
24
+ let scheduled = false,
25
+ epoch = 0;
26
+ function flush(): void {
27
+ removeTickWork(flush);
28
+ let failed = false,
29
+ failure: unknown;
30
+ const runs = new Map<() => void, number>();
31
+ try {
32
+ while (pending.size) {
33
+ try {
34
+ flushComponentReferences();
35
+ } catch (error) {
36
+ if (!failed) failure = error;
37
+ failed = true;
38
+ }
39
+ if (!pending.size) break;
40
+ const next = pending.values().next().value!;
41
+ pending.delete(next);
42
+ const count = (runs.get(next) ?? 0) + 1;
43
+ runs.set(next, count);
44
+ if (count > 1000) {
45
+ if (!failed)
46
+ failure = new Error("Native rune effect update limit exceeded");
47
+ failed = true;
48
+ continue;
49
+ }
50
+ try {
51
+ next();
52
+ } catch (error) {
53
+ if (!failed) failure = error;
54
+ failed = true;
55
+ }
56
+ }
57
+ } catch (error) {
58
+ if (!failed) failure = error;
59
+ failed = true;
60
+ } finally {
61
+ scheduled = false;
62
+ releaseHistory();
63
+ }
64
+ if (failed) throw failure;
65
+ }
66
+
67
+ function cancel(): void {
68
+ pending.clear();
69
+ if (scheduled) flush();
70
+ }
71
+
72
+ /** Untracked, manually disposed effect scope; deliberately independent of its caller. */
73
+ export function createRuneRoot(fn: () => void | (() => void)): () => void {
74
+ if (isSSRRendering() || peekComponentContext()?.mode === "ssr")
75
+ return () => {};
76
+ return createRoot((stop) => {
77
+ const scope = getOwner();
78
+ const cleanup = fn();
79
+ if (typeof cleanup === "function") {
80
+ if (getOwner()?.disposed) withHistoryCleanup(() => untrack(cleanup));
81
+ else onCleanup(cleanup);
82
+ }
83
+ return () => runWithOwner(scope, () => withHistoryCleanup(stop));
84
+ });
85
+ }
86
+
87
+ /** Initial and invalidated callbacks run in a deduplicated microtask after DOM updates. */
88
+ export function createRuneEffect(fn: () => void | (() => void)): void {
89
+ const owner = getOwner();
90
+ if (!owner || owner.disposed)
91
+ throw new Error("Rune effects require a live native owner");
92
+ if (isSSRRendering() || peekComponentContext()?.mode === "ssr") return;
93
+ const scheduler = getRenderScheduler();
94
+ const effectPending = scheduler ? new Set<() => void>() : pending;
95
+ const scheduledRun = scheduler
96
+ ? () => {
97
+ effectPending.delete(run);
98
+ run();
99
+ }
100
+ : run;
101
+ let disposed = false,
102
+ stopRun: (() => void) | undefined;
103
+ let subscriptions = new Map<Trackable, () => void>();
104
+ let lastVersions: Map<Trackable, number> | undefined;
105
+ let forced = false;
106
+ function enqueue(): void {
107
+ if (disposed || owner!.disposed) return;
108
+ effectPending.add(run);
109
+ if (scheduler) {
110
+ scheduler.post(scheduledRun);
111
+ return;
112
+ }
113
+ if (!scheduled) {
114
+ scheduled = true;
115
+ holdHistory();
116
+ queueTickWork(flush, cancel);
117
+ const token = ++epoch;
118
+ queueMicrotask(() => {
119
+ if (scheduled && token === epoch) flush();
120
+ });
121
+ }
122
+ }
123
+ function run(): void {
124
+ if (disposed || owner!.disposed) return;
125
+ if (lastVersions && !forced) {
126
+ let changed = false;
127
+ runWithOwner(owner, () =>
128
+ untrack(() => {
129
+ for (const [dep, version] of lastVersions!) {
130
+ dep.validate?.();
131
+ if (dep.version !== version) changed = true;
132
+ }
133
+ }),
134
+ );
135
+ if (!changed) return;
136
+ }
137
+ forced = false;
138
+ const previous = stopRun;
139
+ stopRun = undefined;
140
+ if (previous) untrack(previous);
141
+ const cleanupInvalidated = effectPending.has(run);
142
+ let failed = false,
143
+ failure: unknown;
144
+ const versions = new Map<Trackable, number>();
145
+ let dependencies: Trackable[] = [];
146
+ runWithOwner(owner, () =>
147
+ createRoot((stop) => {
148
+ const scope = getOwner();
149
+ stopRun = () => runWithOwner(scope, () => withHistoryCleanup(stop));
150
+ dependencies = collectDeps(
151
+ () => {
152
+ try {
153
+ const cleanup = fn();
154
+ if (typeof cleanup === "function") {
155
+ if (getOwner()?.disposed)
156
+ withHistoryCleanup(() => untrack(cleanup));
157
+ else onCleanup(cleanup);
158
+ }
159
+ } catch (error) {
160
+ failed = true;
161
+ failure = error;
162
+ }
163
+ },
164
+ (dependency) => versions.set(dependency, dependency.version),
165
+ );
166
+ }),
167
+ );
168
+ if (disposed || owner!.disposed) {
169
+ const cleanup = stopRun as (() => void) | undefined;
170
+ stopRun = undefined;
171
+ untrack(() => cleanup?.());
172
+ notifyTrackableUnsubscribe();
173
+ if (failed) throw failure;
174
+ return;
175
+ }
176
+ const next = new Map<Trackable, () => void>();
177
+ try {
178
+ untrack(() => {
179
+ for (const dependency of dependencies)
180
+ next.set(
181
+ dependency,
182
+ subscriptions.get(dependency) ??
183
+ subscribeInvalidation(dependency, {
184
+ invalidate() {},
185
+ notify: enqueue,
186
+ }),
187
+ );
188
+ for (const [dependency, unsubscribe] of subscriptions)
189
+ if (!next.has(dependency)) {
190
+ unsubscribe();
191
+ notifyTrackableUnsubscribe();
192
+ }
193
+ });
194
+ subscriptions = next;
195
+ } catch (error) {
196
+ for (const [dependency, unsubscribe] of next)
197
+ if (!subscriptions.has(dependency)) unsubscribe();
198
+ notifyTrackableUnsubscribe();
199
+ if (!failed) failure = error;
200
+ failed = true;
201
+ }
202
+ // Cleanup writes retain their queued rerun even if setup drops that dependency.
203
+ // Setup-only old branch invalidations are discarded; current self-writes rerun.
204
+ effectPending.delete(run);
205
+ lastVersions = versions;
206
+ if (cleanupInvalidated) forced = true;
207
+ if (
208
+ cleanupInvalidated ||
209
+ dependencies.some(
210
+ (dependency) => dependency.version !== versions.get(dependency),
211
+ )
212
+ )
213
+ enqueue();
214
+ if (failed) {
215
+ const cleanup = stopRun as (() => void) | undefined;
216
+ stopRun = undefined;
217
+ try {
218
+ cleanup?.();
219
+ } catch {
220
+ /* Preserve callback/subscription failure. */
221
+ }
222
+ throw failure;
223
+ }
224
+ }
225
+ onCleanup(() => {
226
+ disposed = true;
227
+ effectPending.delete(run);
228
+ let failed = false,
229
+ failure: unknown;
230
+ for (const cleanup of [
231
+ ...subscriptions.values(),
232
+ ...(stopRun ? [stopRun] : []),
233
+ ]) {
234
+ try {
235
+ untrack(cleanup);
236
+ } catch (error) {
237
+ if (!failed) failure = error;
238
+ failed = true;
239
+ }
240
+ }
241
+ subscriptions.clear();
242
+ stopRun = undefined;
243
+ notifyTrackableUnsubscribe();
244
+ if (failed) throw failure;
245
+ });
246
+ enqueue();
247
+ }
248
+
249
+ /** Query synchronous tracking only; ownership alone does not imply tracking. */
250
+ export { isTracking as runeTracking } from "@tschk/moonshine/tracking";
@@ -0,0 +1 @@
1
+ export { crepusRenderer } from "@tschk/moonshine-dom/framework-lazy";