@vobs/transition 1.2.0 → 1.2.2

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/dist/index.cjs CHANGED
@@ -1,535 +1,41 @@
1
- 'use strict';
2
-
1
+ var __VOBS_CJS_FILE_URL = require("url").pathToFileURL(__filename).href;
2
+ "use strict";
3
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
7
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
-
6
- // packages/reactivity/src/debug.ts
7
- var activeDebugHooks = null;
8
- var signalNames = /* @__PURE__ */ new WeakMap();
9
- function hasDebugHooks() {
10
- return activeDebugHooks !== null;
11
- }
12
- __name(hasDebugHooks, "hasDebugHooks");
13
- function setSignalDebugName(signal, name) {
14
- signalNames.set(signal, name);
15
- invokeDebug("signalNamed", signal, name);
16
- }
17
- __name(setSignalDebugName, "setSignalDebugName");
18
- function invokeDebug(name, ...args) {
19
- return;
20
- }
21
- __name(invokeDebug, "invokeDebug");
22
-
23
- // packages/reactivity/src/owner.ts
24
- var currentOwner = null;
25
- var nextOwnerId = 1;
26
- var ownerNames = /* @__PURE__ */ new WeakMap();
27
- function createOwner() {
28
- const parent = currentOwner;
29
- let disposed = parent?.disposed ?? false;
30
- const children = [];
31
- const cleanups = [];
32
- const errorHandlers = /* @__PURE__ */ new Set();
33
- const owner = {
34
- id: `owner-${nextOwnerId++}`,
35
- parent,
36
- children,
37
- depth: (parent?.depth ?? -1) + 1,
38
- get disposed() {
39
- return disposed;
40
- },
41
- run(fn) {
42
- if (disposed) throw new Error("Vobs: \u5DF2\u9500\u6BC1\u7684 Owner \u4E0D\u80FD\u7EE7\u7EED\u8FD0\u884C");
43
- const previous = currentOwner;
44
- currentOwner = owner;
45
- try {
46
- return fn();
47
- } finally {
48
- currentOwner = previous;
49
- }
50
- },
51
- addCleanup(cleanup) {
52
- if (disposed) {
53
- cleanup();
54
- return;
55
- }
56
- cleanups.push(cleanup);
57
- },
58
- onDispose(cleanup) {
59
- owner.addCleanup(cleanup);
60
- },
61
- onError(handler) {
62
- errorHandlers.add(handler);
63
- const remove = /* @__PURE__ */ __name(() => errorHandlers.delete(handler), "remove");
64
- owner.addCleanup(remove);
65
- return remove;
66
- },
67
- handleError(error) {
68
- for (const handler of [...errorHandlers].reverse()) {
69
- try {
70
- handler(error);
71
- return true;
72
- } catch (handlerError) {
73
- return parent?.handleError(handlerError) ?? false;
74
- }
75
- }
76
- return parent?.handleError(error) ?? false;
77
- },
78
- dispose() {
79
- if (disposed) return;
80
- disposed = true;
81
- for (const child of [...children]) child.dispose();
82
- children.length = 0;
83
- let firstError;
84
- for (let index = cleanups.length - 1; index >= 0; index--) {
85
- try {
86
- cleanups[index]();
87
- } catch (error) {
88
- firstError ?? (firstError = error);
89
- }
90
- }
91
- cleanups.length = 0;
92
- if (parent) {
93
- const index = parent.children.indexOf(owner);
94
- if (index >= 0) parent.children.splice(index, 1);
95
- }
96
- if (firstError) throw firstError;
97
- }
98
- };
99
- if (parent && !parent.disposed) parent.children.push(owner);
100
- return owner;
101
- }
102
- __name(createOwner, "createOwner");
103
- function setOwnerDebugName(owner, name) {
104
- ownerNames.set(owner, name);
105
- }
106
- __name(setOwnerDebugName, "setOwnerDebugName");
107
- function getCurrentOwner() {
108
- return currentOwner;
109
- }
110
- __name(getCurrentOwner, "getCurrentOwner");
111
- function onDispose(cleanup) {
112
- const owner = getCurrentOwner();
113
- if (!owner) throw new Error("Vobs: onDispose \u5FC5\u987B\u5728 Owner \u4F5C\u7528\u57DF\u5185\u8C03\u7528");
114
- owner.onDispose(cleanup);
115
- }
116
- __name(onDispose, "onDispose");
117
-
118
- // packages/reactivity/src/signal.ts
119
- var currentSubscriber = null;
120
- function getCurrentSubscriber() {
121
- return currentSubscriber;
122
- }
123
- __name(getCurrentSubscriber, "getCurrentSubscriber");
124
- function setCurrentSubscriber(subscriber) {
125
- currentSubscriber = subscriber;
126
- }
127
- __name(setCurrentSubscriber, "setCurrentSubscriber");
128
- function trackDependency(dependency) {
129
- if (!currentSubscriber || currentSubscriber.disposed) return;
130
- !currentSubscriber.dependencies.has(dependency);
131
- currentSubscriber.dependencies.add(dependency);
132
- }
133
- __name(trackDependency, "trackDependency");
134
- function state(initialValue, debugName) {
135
- let value = initialValue;
136
- let disposed = false;
137
- const subscribers = /* @__PURE__ */ new Set();
138
- const signalInstance = {
139
- get value() {
140
- const subscriber = getCurrentSubscriber();
141
- if (subscriber && !subscriber.disposed) {
142
- subscribers.add(subscriber);
143
- trackDependency(signalInstance);
144
- }
145
- return value;
146
- },
147
- set value(nextValue) {
148
- if (disposed || Object.is(value, nextValue)) return;
149
- value = nextValue;
150
- for (const subscriber of [...subscribers]) subscriber.notify();
151
- },
152
- unsubscribe(subscriber) {
153
- subscribers.delete(subscriber);
154
- },
155
- // 与 `.value =` 赋值同一条路径:判等短路、debug hook、notify 全部一致。
156
- // 以闭包实现,可安全地作为回调直接传递(无 this 绑定问题)。
157
- set(next) {
158
- signalInstance.value = next;
159
- },
160
- dispose() {
161
- if (disposed) return;
162
- disposed = true;
163
- subscribers.clear();
164
- }
165
- };
166
- const owner = getCurrentOwner();
167
- owner?.addCleanup(signalInstance.dispose);
168
- if (debugName?.trim()) setSignalDebugName(signalInstance, debugName.trim());
169
- return signalInstance;
170
- }
171
- __name(state, "state");
172
-
173
- // packages/reactivity/src/scheduler.ts
174
- var _Scheduler = class _Scheduler {
175
- constructor() {
176
- this.dirtyEffects = /* @__PURE__ */ new Set();
177
- this.lowPriorityEffects = /* @__PURE__ */ new Set();
178
- // flush 不可重入(flushing 标志保证),缓冲数组可在轮次间安全复用,避免每轮分配。
179
- this.normalBuffer = [];
180
- this.lowBuffer = [];
181
- this.flushing = false;
182
- this.scheduled = false;
183
- this.batchDepth = 0;
184
- }
185
- schedule(effect2) {
186
- if (effect2.disposed) return;
187
- this.dirtyEffects.add(effect2);
188
- this.lowPriorityEffects.delete(effect2);
189
- this.ensureScheduled();
190
- }
191
- /** Queue an effect behind normal updates while preserving deterministic order. */
192
- scheduleLow(effect2) {
193
- if (effect2.disposed) return;
194
- if (!this.dirtyEffects.has(effect2)) this.lowPriorityEffects.add(effect2);
195
- this.ensureScheduled();
196
- }
197
- ensureScheduled() {
198
- if (this.batchDepth === 0 && !this.flushing && !this.scheduled) {
199
- this.scheduled = true;
200
- queueMicrotask(() => {
201
- this.scheduled = false;
202
- this.flush();
203
- });
204
- }
205
- }
206
- remove(effect2) {
207
- this.dirtyEffects.delete(effect2);
208
- this.lowPriorityEffects.delete(effect2);
209
- }
210
- batch(fn) {
211
- this.batchDepth++;
212
- try {
213
- return fn();
214
- } finally {
215
- this.batchDepth--;
216
- if (this.batchDepth === 0) this.flush();
217
- }
218
- }
219
- flush() {
220
- if (this.flushing || this.batchDepth > 0) return;
221
- this.flushing = true;
222
- let rounds = 0;
223
- let firstError;
224
- let hasError = false;
225
- try {
226
- while (this.dirtyEffects.size > 0 || this.lowPriorityEffects.size > 0) {
227
- if (++rounds > 100) {
228
- this.dirtyEffects.clear();
229
- this.lowPriorityEffects.clear();
230
- throw new Error("Vobs: \u54CD\u5E94\u5F0F\u66F4\u65B0\u8D85\u8FC7 100 \u8F6E\uFF0C\u53EF\u80FD\u5B58\u5728\u5FAA\u73AF\u4F9D\u8D56");
231
- }
232
- this.collectRunnable(this.dirtyEffects, this.normalBuffer);
233
- this.collectRunnable(this.lowPriorityEffects, this.lowBuffer);
234
- sortEffects(this.normalBuffer);
235
- sortEffects(this.lowBuffer);
236
- for (const effect2 of this.normalBuffer) {
237
- try {
238
- effect2.run();
239
- } catch (error) {
240
- if (!hasError) {
241
- firstError = error;
242
- hasError = true;
243
- }
244
- }
245
- }
246
- for (const effect2 of this.lowBuffer) {
247
- try {
248
- effect2.run();
249
- } catch (error) {
250
- if (!hasError) {
251
- firstError = error;
252
- hasError = true;
253
- }
254
- }
255
- }
256
- this.normalBuffer.length = 0;
257
- this.lowBuffer.length = 0;
258
- }
259
- } finally {
260
- this.normalBuffer.length = 0;
261
- this.lowBuffer.length = 0;
262
- this.flushing = false;
263
- }
264
- if (hasError) throw firstError;
265
- }
266
- /** 收集未 disposed 的 effect 并清空源集合;run() 期间新调度的 effect 留给下一轮。 */
267
- collectRunnable(source, target) {
268
- for (const effect2 of source) {
269
- if (!effect2.disposed) target.push(effect2);
270
- }
271
- source.clear();
272
- }
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
273
11
  };
274
- __name(_Scheduler, "Scheduler");
275
- var Scheduler = _Scheduler;
276
- function sortEffects(effects) {
277
- if (effects.length > 1) {
278
- effects.sort((a, b) => b.depth - a.depth || a.order - b.order);
279
- }
280
- }
281
- __name(sortEffects, "sortEffects");
282
- var scheduler = new Scheduler();
283
-
284
- // packages/reactivity/src/effect.ts
285
- var nextEffectOrder = 1;
286
- function cleanupDependencies(subscriber) {
287
- for (const dependency of subscriber.dependencies) {
288
- dependency.unsubscribe(subscriber);
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
289
17
  }
290
- subscriber.dependencies.clear();
291
- }
292
- __name(cleanupDependencies, "cleanupDependencies");
293
- function effect(callback) {
294
- const owner = getCurrentOwner();
295
- let cleanup;
296
- let dirty = true;
297
- let disposed = false;
298
- const eff = {
299
- order: nextEffectOrder++,
300
- depth: owner?.depth ?? 0,
301
- dependencies: /* @__PURE__ */ new Set(),
302
- get disposed() {
303
- return disposed;
304
- },
305
- notify() {
306
- if (disposed || dirty) return;
307
- dirty = true;
308
- scheduler.schedule(eff);
309
- },
310
- run() {
311
- if (disposed || !dirty) return;
312
- dirty = false;
313
- const previousCleanup = cleanup;
314
- cleanup = void 0;
315
- let cleanupError;
316
- if (previousCleanup) {
317
- try {
318
- previousCleanup();
319
- } catch (error) {
320
- const handled2 = owner?.handleError(error) ?? false;
321
- if (!handled2) cleanupError = error;
322
- }
323
- }
324
- cleanupDependencies(eff);
325
- const previous = getCurrentSubscriber();
326
- setCurrentSubscriber(eff);
327
- let thrown;
328
- let handled = false;
329
- try {
330
- const result = owner ? owner.run(callback) : callback();
331
- cleanup = typeof result === "function" ? result : void 0;
332
- } catch (error) {
333
- thrown = error;
334
- handled = owner?.handleError(error) ?? false;
335
- if (!handled) throw error;
336
- } finally {
337
- setCurrentSubscriber(previous);
338
- }
339
- if (cleanupError && !thrown) throw cleanupError;
340
- },
341
- scheduleLow() {
342
- if (disposed || dirty) return;
343
- dirty = true;
344
- scheduler.scheduleLow(eff);
345
- },
346
- dispose() {
347
- if (disposed) return;
348
- disposed = true;
349
- dirty = false;
350
- scheduler.remove(eff);
351
- const previousCleanup = cleanup;
352
- cleanup = void 0;
353
- let cleanupError;
354
- if (previousCleanup) {
355
- try {
356
- previousCleanup();
357
- } catch (error) {
358
- const handled = owner?.handleError(error) ?? false;
359
- if (!handled) cleanupError = error;
360
- }
361
- }
362
- cleanupDependencies(eff);
363
- if (cleanupError) throw cleanupError;
364
- }
365
- };
366
- owner?.addCleanup(eff.dispose);
367
- eff.run();
368
- return eff;
369
- }
370
- __name(effect, "effect");
18
+ return to;
19
+ };
20
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
371
21
 
372
- // packages/runtime/src/debug.ts
373
- var activeRuntimeDebugHooks = null;
374
- function getRuntimeDebugHooks() {
375
- return activeRuntimeDebugHooks;
376
- }
377
- __name(getRuntimeDebugHooks, "getRuntimeDebugHooks");
378
- function invokeRuntimeDebug(name, ...args) {
379
- return;
380
- }
381
- __name(invokeRuntimeDebug, "invokeRuntimeDebug");
382
- function describeDebugNode(node) {
383
- if (!node || typeof node !== "object") return "node";
384
- const value = node;
385
- const name = typeof value.tagName === "string" ? value.tagName.toLowerCase() : typeof value.nodeName === "string" ? value.nodeName.toLowerCase() : "node";
386
- const id = typeof value.id === "string" && value.id ? `#${value.id}` : "";
387
- const className = typeof value.className === "string" && value.className ? `.${value.className.trim().split(/\s+/).filter(Boolean).join(".")}` : "";
388
- return `${name}${id}${className}`;
389
- }
390
- __name(describeDebugNode, "describeDebugNode");
22
+ // packages/transition/src/index.ts
23
+ var src_exports = {};
24
+ __export(src_exports, {
25
+ Transition: () => Transition,
26
+ TransitionGroup: () => TransitionGroup,
27
+ createCSSTransitionDriver: () => createCSSTransitionDriver,
28
+ cssTransitionDriver: () => cssTransitionDriver
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
391
31
 
392
- // packages/runtime/src/hmr.ts
393
- var globalTarget = globalThis;
394
- var hmrGlobal = globalTarget.__VOBS_HMR__ ?? { modules: /* @__PURE__ */ new Map() };
395
- globalTarget.__VOBS_HMR__ = hmrGlobal;
396
- function markHmrInstanceMounted(node, parent) {
397
- const instance = hmrInstances.get(node);
398
- if (instance) instance.parent = parent;
399
- }
400
- __name(markHmrInstanceMounted, "markHmrInstanceMounted");
401
- var hmrInstances = /* @__PURE__ */ new WeakMap();
402
- var nodeOwners = /* @__PURE__ */ new WeakMap();
403
- function getRenderer() {
404
- {
405
- throw new Error("\u6E32\u67D3\u5668\u672A\u521D\u59CB\u5316");
406
- }
407
- }
408
- __name(getRenderer, "getRenderer");
409
- function createText(content) {
410
- return getRenderer().createText(content);
411
- }
412
- __name(createText, "createText");
413
- function createComment(content) {
414
- return getRenderer().createComment(content);
415
- }
416
- __name(createComment, "createComment");
417
- function insertBefore(parent, child, anchor) {
418
- if (isVobsFragment(child)) {
419
- child.mount(parent, isVobsFragment(anchor) ? anchor.start : anchor);
420
- return;
421
- }
422
- getRenderer().insertBefore(parent, child, isVobsFragment(anchor) ? anchor.start : anchor);
423
- markHmrInstanceMounted(child, parent);
424
- }
425
- __name(insertBefore, "insertBefore");
426
- function removeChild(parent, child) {
427
- disposeNodeOwner(child);
428
- if (isVobsFragment(child)) {
429
- child.unmount(parent);
430
- return;
431
- }
432
- getRenderer().removeChild(parent, child);
433
- }
434
- __name(removeChild, "removeChild");
435
- function createBlock(factory) {
436
- const owner = createOwner();
437
- setOwnerDebugName(owner, "dynamic");
438
- let node;
439
- try {
440
- node = owner.run(factory);
441
- } catch (error) {
442
- owner.dispose();
443
- throw error;
444
- }
445
- if (!node) {
446
- owner.dispose();
447
- return null;
448
- }
449
- associateNodeOwner(node, owner);
450
- return node;
451
- }
452
- __name(createBlock, "createBlock");
453
- function associateNodeOwner(node, owner) {
454
- nodeOwners.set(node, owner);
455
- }
456
- __name(associateNodeOwner, "associateNodeOwner");
457
- function disposeNodeOwner(node) {
458
- const owner = nodeOwners.get(node);
459
- if (!owner) return;
460
- nodeOwners.delete(node);
461
- owner.dispose();
462
- }
463
- __name(disposeNodeOwner, "disposeNodeOwner");
464
-
465
- // packages/runtime/src/fragment.ts
466
- function createFragment(factory) {
467
- const start = createComment("vobs:fragment:start");
468
- const end = createComment("vobs:fragment:end");
469
- let parent = null;
470
- let initialized = false;
471
- const owner = getCurrentOwner();
472
- const fragment = {
473
- kind: "vobs-fragment",
474
- start,
475
- end,
476
- mount(nextParent, anchor) {
477
- if (parent && parent !== nextParent) {
478
- throw new Error("Vobs Fragment: \u4E0D\u80FD\u8DE8\u7236\u8282\u70B9\u79FB\u52A8 Fragment");
479
- }
480
- if (initialized) {
481
- moveRange(nextParent, start, end, anchor);
482
- return;
483
- }
484
- const renderer = getRenderer();
485
- renderer.insertBefore(nextParent, start, anchor);
486
- renderer.insertBefore(nextParent, end, anchor);
487
- parent = nextParent;
488
- initialized = true;
489
- if (owner) owner.run(() => factory(nextParent, end));
490
- else factory(nextParent, end);
491
- },
492
- unmount(nextParent) {
493
- if (!initialized || parent !== nextParent) {
494
- throw new Error("Vobs Fragment: Fragment \u4E0D\u5C5E\u4E8E\u6307\u5B9A\u7236\u8282\u70B9");
495
- }
496
- const renderer = getRenderer();
497
- let current = renderer.nextSibling(start);
498
- while (current && current !== end) {
499
- const next = renderer.nextSibling(current);
500
- renderer.removeChild(nextParent, current);
501
- current = next;
502
- }
503
- renderer.removeChild(nextParent, start);
504
- renderer.removeChild(nextParent, end);
505
- parent = null;
506
- initialized = false;
507
- }
508
- };
509
- return fragment;
510
- }
511
- __name(createFragment, "createFragment");
512
- function isVobsFragment(value) {
513
- return Boolean(value) && typeof value === "object" && value.kind === "vobs-fragment";
514
- }
515
- __name(isVobsFragment, "isVobsFragment");
516
- function moveRange(parent, start, end, anchor) {
517
- const renderer = getRenderer();
518
- const nodes = [start];
519
- let current = renderer.nextSibling(start);
520
- while (current) {
521
- nodes.push(current);
522
- if (current === end) break;
523
- current = renderer.nextSibling(current);
524
- }
525
- if (nodes[nodes.length - 1] !== end) {
526
- throw new Error("Vobs Fragment: \u627E\u4E0D\u5230\u7ED3\u675F\u951A\u70B9");
527
- }
528
- for (const node of nodes) renderer.insertBefore(parent, node, anchor);
529
- }
530
- __name(moveRange, "moveRange");
32
+ // packages/transition/src/transition.ts
33
+ var import_reactivity = require("@vobs/reactivity");
34
+ var import_vobs2 = require("@vobs/vobs");
35
+ var import_runtime2 = require("@vobs/runtime");
531
36
 
532
37
  // packages/transition/src/driver.ts
38
+ var import_vobs = require("@vobs/vobs");
533
39
  function runTransition(node, status, options, done) {
534
40
  const elements = getTransitionElements(node);
535
41
  if (elements.length === 0 || options.reducedMotion || !options.css && !hasStyles(options.phase)) {
@@ -614,9 +120,9 @@ __name(resolveReducedMotion, "resolveReducedMotion");
614
120
  function getTransitionElements(node) {
615
121
  const element = asTransitionElement(node);
616
122
  if (element) return [element];
617
- if (!isVobsFragment(node)) return [];
123
+ if (!(0, import_vobs.isVobsFragment)(node)) return [];
618
124
  const elements = [];
619
- const renderer = getRenderer();
125
+ const renderer = (0, import_vobs.getRenderer)();
620
126
  let current = renderer.nextSibling(node.start);
621
127
  while (current && current !== node.end) {
622
128
  const child = asTransitionElement(current);
@@ -712,11 +218,11 @@ __name(cancelFrame, "cancelFrame");
712
218
 
713
219
  // packages/transition/src/transition.ts
714
220
  function Transition(props = {}) {
715
- return createFragment((parent, anchor) => {
221
+ return (0, import_vobs2.createFragment)((parent, anchor) => {
716
222
  let current;
717
223
  let disposed = false;
718
224
  let initialized = false;
719
- const stop = effect(() => {
225
+ const stop = (0, import_reactivity.effect)(() => {
720
226
  const visible = readProp(props, "show", true) !== false;
721
227
  const initial = !initialized;
722
228
  initialized = true;
@@ -725,10 +231,10 @@ function Transition(props = {}) {
725
231
  if (current.status === "leaving") startEnter(current, props, true);
726
232
  return;
727
233
  }
728
- const node = createBlock(() => resolveChildren(readProp(props, "children", void 0)));
234
+ const node = (0, import_runtime2.createBlock)(() => resolveChildren(readProp(props, "children", void 0)));
729
235
  if (!node) return;
730
236
  current = { node, status: "entering" };
731
- insertBefore(parent, node, anchor);
237
+ (0, import_vobs2.insertBefore)(parent, node, anchor);
732
238
  startEnter(current, props, !initial || readProp(props, "appear", false));
733
239
  return;
734
240
  }
@@ -740,7 +246,7 @@ function Transition(props = {}) {
740
246
  });
741
247
  }
742
248
  });
743
- onDispose(() => {
249
+ (0, import_reactivity.onDispose)(() => {
744
250
  disposed = true;
745
251
  stop.dispose();
746
252
  current?.run?.cancel();
@@ -748,7 +254,7 @@ function Transition(props = {}) {
748
254
  function startLeave(entry, options, afterLeave) {
749
255
  startLeaveEntry(entry, options, () => {
750
256
  if (disposed || current?.node !== entry.node) return;
751
- removeChild(parent, entry.node);
257
+ (0, import_vobs2.removeChild)(parent, entry.node);
752
258
  afterLeave();
753
259
  });
754
260
  }
@@ -757,11 +263,11 @@ function Transition(props = {}) {
757
263
  }
758
264
  __name(Transition, "Transition");
759
265
  function TransitionGroup(props) {
760
- return createFragment((parent, anchor) => {
266
+ return (0, import_vobs2.createFragment)((parent, anchor) => {
761
267
  const entries = /* @__PURE__ */ new Map();
762
268
  let disposed = false;
763
269
  let initialized = false;
764
- const stop = effect(() => {
270
+ const stop = (0, import_reactivity.effect)(() => {
765
271
  const nextEntries = [];
766
272
  const initial = !initialized;
767
273
  initialized = true;
@@ -781,7 +287,7 @@ function TransitionGroup(props) {
781
287
  } else {
782
288
  entry = createGroupEntry(descriptor);
783
289
  entries.set(key, entry);
784
- insertBefore(parent, entry.node, anchor);
290
+ (0, import_vobs2.insertBefore)(parent, entry.node, anchor);
785
291
  startEnter(entry, props, !initial || readProp(props, "appear", false));
786
292
  }
787
293
  nextEntries.push(entry);
@@ -791,7 +297,7 @@ function TransitionGroup(props) {
791
297
  if (entry.status !== "leaving") {
792
298
  startLeaveEntry(entry, props, () => {
793
299
  if (disposed || entries.get(key) !== entry) return;
794
- removeChild(parent, entry.node);
300
+ (0, import_vobs2.removeChild)(parent, entry.node);
795
301
  entry.owner.dispose();
796
302
  entries.delete(key);
797
303
  });
@@ -799,11 +305,11 @@ function TransitionGroup(props) {
799
305
  }
800
306
  let reference = anchor;
801
307
  for (let index = nextEntries.length - 1; index >= 0; index--) {
802
- insertBefore(parent, nextEntries[index].node, reference);
308
+ (0, import_vobs2.insertBefore)(parent, nextEntries[index].node, reference);
803
309
  reference = nextEntries[index].node;
804
310
  }
805
311
  });
806
- onDispose(() => {
312
+ (0, import_reactivity.onDispose)(() => {
807
313
  disposed = true;
808
314
  stop.dispose();
809
315
  for (const entry of entries.values()) entry.run?.cancel();
@@ -821,12 +327,12 @@ function validateGroupDescriptors(descriptors) {
821
327
  }
822
328
  __name(validateGroupDescriptors, "validateGroupDescriptors");
823
329
  function createGroupEntry(descriptor) {
824
- const owner = createOwner();
330
+ const owner = (0, import_reactivity.createOwner)();
825
331
  let itemSignal;
826
332
  let node;
827
333
  try {
828
334
  owner.run(() => {
829
- itemSignal = state(descriptor.item);
335
+ itemSignal = (0, import_reactivity.state)(descriptor.item);
830
336
  node = renderGroupNode(itemSignal, descriptor, owner);
831
337
  });
832
338
  } catch (error) {
@@ -857,11 +363,11 @@ function refreshGroupEntry(parent, entry, descriptor) {
857
363
  entry.node = nextNode;
858
364
  entry.rawItem = descriptor.item;
859
365
  entry.index = descriptor.index;
860
- removeChild(parent, previousNode);
366
+ (0, import_vobs2.removeChild)(parent, previousNode);
861
367
  }
862
368
  __name(refreshGroupEntry, "refreshGroupEntry");
863
369
  function renderGroupNode(signal, descriptor, owner) {
864
- const node = owner.run(() => createBlock(() => resolveChildren(descriptor.render(toReactiveItem(signal, descriptor.item), descriptor.index))));
370
+ const node = owner.run(() => (0, import_runtime2.createBlock)(() => resolveChildren(descriptor.render(toReactiveItem(signal, descriptor.item), descriptor.index))));
865
371
  if (!node) throw new Error("TransitionGroup: renderItem \u5FC5\u987B\u8FD4\u56DE\u8282\u70B9");
866
372
  return node;
867
373
  }
@@ -962,12 +468,12 @@ __name(runWithDriver, "runWithDriver");
962
468
  function resolveChildren(value) {
963
469
  const resolved = typeof value === "function" ? resolveChildren(value()) : value;
964
470
  if (resolved === null || resolved === void 0 || resolved === false) return null;
965
- if (typeof resolved === "string" || typeof resolved === "number") return createText(String(resolved));
471
+ if (typeof resolved === "string" || typeof resolved === "number") return (0, import_vobs2.createText)(String(resolved));
966
472
  if (Array.isArray(resolved)) {
967
- return createFragment((parent, anchor) => {
473
+ return (0, import_vobs2.createFragment)((parent, anchor) => {
968
474
  for (const child of resolved) {
969
475
  const node = resolveChildren(child);
970
- if (node) insertBefore(parent, node, anchor);
476
+ if (node) (0, import_vobs2.insertBefore)(parent, node, anchor);
971
477
  }
972
478
  });
973
479
  }
@@ -1001,10 +507,11 @@ function toReactiveItem(signal, initialValue) {
1001
507
  });
1002
508
  }
1003
509
  __name(toReactiveItem, "toReactiveItem");
1004
-
1005
- exports.Transition = Transition;
1006
- exports.TransitionGroup = TransitionGroup;
1007
- exports.createCSSTransitionDriver = createCSSTransitionDriver;
1008
- exports.cssTransitionDriver = cssTransitionDriver;
1009
- //# sourceMappingURL=index.cjs.map
510
+ // Annotate the CommonJS export names for ESM import in node:
511
+ 0 && (module.exports = {
512
+ Transition,
513
+ TransitionGroup,
514
+ createCSSTransitionDriver,
515
+ cssTransitionDriver
516
+ });
1010
517
  //# sourceMappingURL=index.cjs.map