@zeus-js/zeus 0.1.0-beta.7 → 0.1.0-beta.9

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * zeus v0.1.0-beta.7
2
+ * zeus v0.1.0-beta.9
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
@@ -19,21 +19,13 @@ var Zeus = (function(exports) {
19
19
  for (const key of str.split(",")) map[key] = 1;
20
20
  return (val) => val in map;
21
21
  }
22
- //#endregion
23
- //#region packages/core/shared/src/general.ts
24
- const EMPTY_OBJ = Object.freeze({});
22
+ Object.freeze({});
25
23
  Object.freeze([]);
26
- const NOOP = () => {};
27
24
  const extend = Object.assign;
28
- const remove = (arr, el) => {
29
- const i = arr.indexOf(el);
30
- if (i > -1) arr.splice(i, 1);
31
- };
32
25
  const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
33
26
  const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
34
27
  const isArray = Array.isArray;
35
28
  const isMap = (val) => toTypeString(val) === "[object Map]";
36
- const isSet = (val) => toTypeString(val) === "[object Set]";
37
29
  const isFunction = (val) => typeof val === "function";
38
30
  const isString = (val) => typeof val === "string";
39
31
  const isSymbol = (val) => typeof val === "symbol";
@@ -43,7 +35,6 @@ var Zeus = (function(exports) {
43
35
  const toRawType = (value) => {
44
36
  return toTypeString(value).slice(8, -1);
45
37
  };
46
- const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
47
38
  const isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
48
39
  const cacheStringFunction = (fn) => {
49
40
  const cache = Object.create(null);
@@ -214,8 +205,9 @@ var Zeus = (function(exports) {
214
205
  this.depsTail = void 0;
215
206
  this.flags = 5;
216
207
  this.next = void 0;
217
- this.cleanup = void 0;
208
+ this.cleanups = void 0;
218
209
  this.scheduler = void 0;
210
+ this.scope = activeEffectScope;
219
211
  if (activeEffectScope) if (activeEffectScope.active) activeEffectScope.effects.push(this);
220
212
  else this.flags &= -2;
221
213
  }
@@ -480,17 +472,26 @@ var Zeus = (function(exports) {
480
472
  * an active effect.
481
473
  */
482
474
  function onEffectCleanup(fn, failSilently = false) {
483
- if (activeSub instanceof ReactiveEffect) activeSub.cleanup = fn;
484
- else if (!failSilently) warn("onEffectCleanup() was called when there was no active effect to associate with.");
475
+ if (activeSub instanceof ReactiveEffect) {
476
+ var _activeSub, _activeSub$cleanups;
477
+ ((_activeSub$cleanups = (_activeSub = activeSub).cleanups) !== null && _activeSub$cleanups !== void 0 ? _activeSub$cleanups : _activeSub.cleanups = []).push(fn);
478
+ } else if (!failSilently) warn("onEffectCleanup() was called when there was no active effect to associate with.");
485
479
  }
486
480
  function cleanupEffect(e) {
487
- const { cleanup } = e;
488
- e.cleanup = void 0;
489
- if (cleanup) {
481
+ const cleanups = e.cleanups;
482
+ e.cleanups = void 0;
483
+ if (cleanups) {
490
484
  const prevSub = activeSub;
491
485
  activeSub = void 0;
492
486
  try {
493
- cleanup();
487
+ let error;
488
+ for (const cleanup of cleanups) try {
489
+ cleanup();
490
+ } catch (cleanupError) {
491
+ var _error;
492
+ (_error = error) !== null && _error !== void 0 || (error = cleanupError);
493
+ }
494
+ if (error) throw error;
494
495
  } finally {
495
496
  activeSub = prevSub;
496
497
  }
@@ -510,18 +511,6 @@ var Zeus = (function(exports) {
510
511
  }
511
512
  }
512
513
  /**
513
- * Executes the given function without tracking reactive dependencies.
514
- * Any reactive reads inside `fn` will not trigger effect re-runs.
515
- */
516
- function untrack(fn) {
517
- pauseTracking();
518
- try {
519
- return fn();
520
- } finally {
521
- resetTracking();
522
- }
523
- }
524
- /**
525
514
  * Returns the currently executing reactive effect, if any.
526
515
  */
527
516
  function getCurrentEffect() {
@@ -719,6 +708,87 @@ var Zeus = (function(exports) {
719
708
  endBatch();
720
709
  }
721
710
  //#endregion
711
+ //#region packages/core/signal/src/computed.ts
712
+ /**
713
+ * @private exported by @vue/reactivity for Vue core use, but not exported from
714
+ * the main vue package
715
+ */
716
+ var ComputedRefImpl = class {
717
+ constructor(fn, setter, isSSR) {
718
+ this.fn = fn;
719
+ this.setter = setter;
720
+ this._value = void 0;
721
+ this.dep = new Dep(this);
722
+ this.__v_isRef = true;
723
+ this.deps = void 0;
724
+ this.depsTail = void 0;
725
+ this.flags = 16;
726
+ this.globalVersion = globalVersion - 1;
727
+ this.next = void 0;
728
+ this["__v_isReadonly"] = !setter;
729
+ this.isSSR = isSSR;
730
+ }
731
+ /**
732
+ * @internal
733
+ */
734
+ notify() {
735
+ this.flags |= 16;
736
+ if (!(this.flags & 8) && activeSub !== this) {
737
+ queueSubscriber(this, true);
738
+ return true;
739
+ }
740
+ }
741
+ get value() {
742
+ const link = this.dep.track({
743
+ target: this,
744
+ type: "get",
745
+ key: "value"
746
+ });
747
+ refreshComputed(this);
748
+ if (link) link.version = this.dep.version;
749
+ return this._value;
750
+ }
751
+ set value(newValue) {
752
+ if (this.setter) this.setter(newValue);
753
+ else warn("Write operation failed: computed value is readonly");
754
+ }
755
+ };
756
+ /*@__NO_SIDE_EFFECTS__*/
757
+ function computed(getterOrOptions, debugOptions, isSSR = false) {
758
+ let getter;
759
+ let setter;
760
+ if (isFunction(getterOrOptions)) getter = getterOrOptions;
761
+ else {
762
+ getter = getterOrOptions.get;
763
+ setter = getterOrOptions.set;
764
+ }
765
+ const cRef = new ComputedRefImpl(getter, setter, isSSR);
766
+ if (debugOptions && !isSSR) {
767
+ cRef.onTrack = debugOptions.onTrack;
768
+ cRef.onTrigger = debugOptions.onTrigger;
769
+ }
770
+ return cRef;
771
+ }
772
+ //#endregion
773
+ //#region packages/core/signal/src/lifecycle.ts
774
+ function onCleanup(fn) {
775
+ const effect = getCurrentEffect();
776
+ const scope = getCurrentScope();
777
+ if (scope && (effect === null || effect === void 0 ? void 0 : effect.scope) !== scope) {
778
+ onScopeDispose(fn, true);
779
+ return;
780
+ }
781
+ if (effect) {
782
+ onEffectCleanup(fn, true);
783
+ return;
784
+ }
785
+ if (scope) {
786
+ onScopeDispose(fn, true);
787
+ return;
788
+ }
789
+ warn("onCleanup() was called without active effect or scope.");
790
+ }
791
+ //#endregion
722
792
  //#region packages/core/signal/src/arrayInstrumentations.ts
723
793
  /**
724
794
  * Track array iteration and return:
@@ -904,60 +974,6 @@ var Zeus = (function(exports) {
904
974
  return res;
905
975
  }
906
976
  //#endregion
907
- //#region packages/core/signal/src/ref.ts
908
- let _ReactiveFlags$IS_REF, _ReactiveFlags$IS_SHA;
909
- /*@__NO_SIDE_EFFECTS__*/
910
- function isRef(r) {
911
- return r ? r["__v_isRef"] === true : false;
912
- }
913
- /*@__NO_SIDE_EFFECTS__*/
914
- function ref(value) {
915
- return createRef(value, false);
916
- }
917
- function createRef(rawValue, shallow) {
918
- if (/* @__PURE__ */ isRef(rawValue)) return rawValue;
919
- return new RefImpl(rawValue, shallow);
920
- }
921
- _ReactiveFlags$IS_REF = "__v_isRef";
922
- _ReactiveFlags$IS_SHA = "__v_isShallow";
923
- /**
924
- * @internal
925
- */
926
- var RefImpl = class {
927
- constructor(value, isShallow) {
928
- this.dep = new Dep();
929
- this[_ReactiveFlags$IS_REF] = true;
930
- this[_ReactiveFlags$IS_SHA] = false;
931
- this._rawValue = isShallow ? value : /* @__PURE__ */ toRaw(value);
932
- this._value = isShallow ? value : toReactive(value);
933
- this["__v_isShallow"] = isShallow;
934
- }
935
- get value() {
936
- this.dep.track({
937
- target: this,
938
- type: "get",
939
- key: "value"
940
- });
941
- return this._value;
942
- }
943
- set value(newValue) {
944
- const oldValue = this._rawValue;
945
- const useDirectValue = this["__v_isShallow"] || /* @__PURE__ */ isShallow(newValue) || /* @__PURE__ */ isReadonly(newValue);
946
- newValue = useDirectValue ? newValue : /* @__PURE__ */ toRaw(newValue);
947
- if (hasChanged(newValue, oldValue)) {
948
- this._rawValue = newValue;
949
- this._value = useDirectValue ? newValue : toReactive(newValue);
950
- this.dep.trigger({
951
- target: this,
952
- type: "set",
953
- key: "value",
954
- newValue,
955
- oldValue
956
- });
957
- }
958
- }
959
- };
960
- //#endregion
961
977
  //#region packages/core/signal/src/baseHandlers.ts
962
978
  const isNonTrackableKeys = /*@__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
963
979
  const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
@@ -1390,256 +1406,152 @@ var Zeus = (function(exports) {
1390
1406
  */
1391
1407
  const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
1392
1408
  //#endregion
1393
- //#region packages/core/signal/src/state.ts
1394
- function state(value) {
1395
- if (arguments.length === 0) return /* @__PURE__ */ ref();
1396
- return isProxyable(value) ? /* @__PURE__ */ reactive(value) : /* @__PURE__ */ ref(value);
1409
+ //#region packages/core/signal/src/ref.ts
1410
+ let _ReactiveFlags$IS_REF, _ReactiveFlags$IS_SHA;
1411
+ /*@__NO_SIDE_EFFECTS__*/
1412
+ function isRef(r) {
1413
+ return r ? r["__v_isRef"] === true : false;
1397
1414
  }
1398
- function isProxyable(value) {
1399
- if (value === null || typeof value !== "object") return false;
1400
- if (Array.isArray(value)) return true;
1401
- if (value instanceof Map || value instanceof Set || value instanceof WeakMap || value instanceof WeakSet) return true;
1402
- return isPlainObject(value);
1415
+ /*@__NO_SIDE_EFFECTS__*/
1416
+ function ref(value) {
1417
+ return createRef(value, false);
1403
1418
  }
1404
- function isPlainObject(value) {
1405
- const proto = Object.getPrototypeOf(value);
1406
- return proto === Object.prototype || proto === null;
1419
+ /*@__NO_SIDE_EFFECTS__*/
1420
+ function shallowRef(value) {
1421
+ return createRef(value, true);
1407
1422
  }
1408
- //#endregion
1409
- //#region packages/core/signal/src/computed.ts
1423
+ function createRef(rawValue, shallow) {
1424
+ if (/* @__PURE__ */ isRef(rawValue)) return rawValue;
1425
+ return new RefImpl(rawValue, shallow);
1426
+ }
1427
+ _ReactiveFlags$IS_REF = "__v_isRef";
1428
+ _ReactiveFlags$IS_SHA = "__v_isShallow";
1410
1429
  /**
1411
- * @private exported by @vue/reactivity for Vue core use, but not exported from
1412
- * the main vue package
1430
+ * @internal
1413
1431
  */
1414
- var ComputedRefImpl = class {
1415
- constructor(fn, setter, isSSR) {
1416
- this.fn = fn;
1417
- this.setter = setter;
1418
- this._value = void 0;
1419
- this.dep = new Dep(this);
1420
- this.__v_isRef = true;
1421
- this.deps = void 0;
1422
- this.depsTail = void 0;
1423
- this.flags = 16;
1424
- this.globalVersion = globalVersion - 1;
1425
- this.next = void 0;
1426
- this["__v_isReadonly"] = !setter;
1427
- this.isSSR = isSSR;
1428
- }
1429
- /**
1430
- * @internal
1431
- */
1432
- notify() {
1433
- this.flags |= 16;
1434
- if (!(this.flags & 8) && activeSub !== this) {
1435
- queueSubscriber(this, true);
1436
- return true;
1437
- }
1432
+ var RefImpl = class {
1433
+ constructor(value, isShallow) {
1434
+ this.dep = new Dep();
1435
+ this[_ReactiveFlags$IS_REF] = true;
1436
+ this[_ReactiveFlags$IS_SHA] = false;
1437
+ this._rawValue = isShallow ? value : /* @__PURE__ */ toRaw(value);
1438
+ this._value = isShallow ? value : toReactive(value);
1439
+ this["__v_isShallow"] = isShallow;
1438
1440
  }
1439
1441
  get value() {
1440
- const link = this.dep.track({
1442
+ this.dep.track({
1441
1443
  target: this,
1442
1444
  type: "get",
1443
1445
  key: "value"
1444
1446
  });
1445
- refreshComputed(this);
1446
- if (link) link.version = this.dep.version;
1447
1447
  return this._value;
1448
1448
  }
1449
1449
  set value(newValue) {
1450
- if (this.setter) this.setter(newValue);
1451
- else warn("Write operation failed: computed value is readonly");
1450
+ const oldValue = this._rawValue;
1451
+ const useDirectValue = this["__v_isShallow"] || /* @__PURE__ */ isShallow(newValue) || /* @__PURE__ */ isReadonly(newValue);
1452
+ newValue = useDirectValue ? newValue : /* @__PURE__ */ toRaw(newValue);
1453
+ if (hasChanged(newValue, oldValue)) {
1454
+ this._rawValue = newValue;
1455
+ this._value = useDirectValue ? newValue : toReactive(newValue);
1456
+ this.dep.trigger({
1457
+ target: this,
1458
+ type: "set",
1459
+ key: "value",
1460
+ newValue,
1461
+ oldValue
1462
+ });
1463
+ }
1452
1464
  }
1453
1465
  };
1454
- /*@__NO_SIDE_EFFECTS__*/
1455
- function computed(getterOrOptions, debugOptions, isSSR = false) {
1456
- let getter;
1457
- let setter;
1458
- if (isFunction(getterOrOptions)) getter = getterOrOptions;
1459
- else {
1460
- getter = getterOrOptions.get;
1461
- setter = getterOrOptions.set;
1462
- }
1463
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1464
- if (debugOptions && !isSSR) {
1465
- cRef.onTrack = debugOptions.onTrack;
1466
- cRef.onTrigger = debugOptions.onTrigger;
1466
+ //#endregion
1467
+ //#region packages/core/signal/src/primitives.ts
1468
+ function createSignal(initialValue) {
1469
+ const source = /* @__PURE__ */ shallowRef(initialValue);
1470
+ const read = () => source.value;
1471
+ const write = (value) => {
1472
+ const next = typeof value === "function" ? value(source.value) : value;
1473
+ source.value = next;
1474
+ return next;
1475
+ };
1476
+ return [read, write];
1477
+ }
1478
+ function createMemo(compute) {
1479
+ const memo = /* @__PURE__ */ computed(compute);
1480
+ return () => memo.value;
1481
+ }
1482
+ function createEffect(run) {
1483
+ effect(run);
1484
+ }
1485
+ function createRoot(run) {
1486
+ const root = effectScope(true);
1487
+ let disposed = false;
1488
+ const dispose = () => {
1489
+ if (disposed) return;
1490
+ disposed = true;
1491
+ root.stop();
1492
+ };
1493
+ try {
1494
+ return root.run(() => run(dispose));
1495
+ } catch (error) {
1496
+ dispose();
1497
+ throw error;
1467
1498
  }
1468
- return cRef;
1469
1499
  }
1470
1500
  //#endregion
1471
- //#region packages/core/signal/src/scheduler.ts
1472
- function nextTick() {
1473
- return Promise.resolve();
1501
+ //#region packages/core/signal/src/state.ts
1502
+ function state(value) {
1503
+ if (arguments.length === 0) return /* @__PURE__ */ ref();
1504
+ return isProxyable(value) ? /* @__PURE__ */ reactive(value) : /* @__PURE__ */ ref(value);
1505
+ }
1506
+ function isProxyable(value) {
1507
+ if (value === null || typeof value !== "object") return false;
1508
+ if (Array.isArray(value)) return true;
1509
+ if (value instanceof Map || value instanceof Set || value instanceof WeakMap || value instanceof WeakSet) return true;
1510
+ return isPlainObject(value);
1511
+ }
1512
+ function isPlainObject(value) {
1513
+ const proto = Object.getPrototypeOf(value);
1514
+ return proto === Object.prototype || proto === null;
1474
1515
  }
1475
1516
  //#endregion
1476
- //#region packages/core/signal/src/watch.ts
1477
- const INITIAL_WATCHER_VALUE = {};
1478
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1479
- let activeWatcher = void 0;
1480
- /**
1481
- * Registers a cleanup callback on the current active effect. This
1482
- * registered cleanup callback will be invoked right before the
1483
- * associated effect re-runs.
1484
- *
1485
- * @param cleanupFn - The callback function to attach to the effect's cleanup.
1486
- * @param failSilently - if `true`, will not throw warning when called without
1487
- * an active effect.
1488
- * @param owner - The effect that this cleanup function should be attached to.
1489
- * By default, the current active effect.
1490
- */
1491
- function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1492
- if (owner) {
1493
- let cleanups = cleanupMap.get(owner);
1494
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1495
- cleanups.push(cleanupFn);
1496
- } else if (!failSilently) warn("onWatcherCleanup() was called when there was no active watcher to associate with.");
1497
- }
1498
- function watch(source, cb, options = EMPTY_OBJ) {
1499
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1500
- const warnInvalidSource = (s) => {
1501
- (options.onWarn || warn)(`Invalid watch source: `, s, "A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.");
1502
- };
1503
- const reactiveGetter = (source) => {
1504
- if (deep) return source;
1505
- if (/* @__PURE__ */ isShallow(source) || deep === false || deep === 0) return traverse(source, 1);
1506
- return traverse(source);
1507
- };
1508
- let effect;
1509
- let getter;
1510
- let cleanup;
1511
- let boundCleanup;
1512
- let forceTrigger = false;
1513
- let isMultiSource = false;
1514
- if (/* @__PURE__ */ isRef(source)) {
1515
- getter = () => source.value;
1516
- forceTrigger = /* @__PURE__ */ isShallow(source);
1517
- } else if (/* @__PURE__ */ isReactive(source)) {
1518
- getter = () => reactiveGetter(source);
1519
- forceTrigger = true;
1520
- } else if (isArray(source)) {
1521
- isMultiSource = true;
1522
- forceTrigger = source.some((s) => /* @__PURE__ */ isReactive(s) || /* @__PURE__ */ isShallow(s));
1523
- getter = () => source.map((s) => {
1524
- if (/* @__PURE__ */ isRef(s)) return s.value;
1525
- else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s);
1526
- else if (isFunction(s)) return call ? call(s, 2) : s();
1527
- else warnInvalidSource(s);
1528
- });
1529
- } else if (isFunction(source)) if (cb) getter = call ? () => call(source, 2) : source;
1530
- else getter = () => {
1531
- if (cleanup) {
1532
- pauseTracking();
1533
- try {
1534
- cleanup();
1535
- } finally {
1536
- resetTracking();
1537
- }
1538
- }
1539
- const currentEffect = activeWatcher;
1540
- activeWatcher = effect;
1541
- try {
1542
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1543
- } finally {
1544
- activeWatcher = currentEffect;
1545
- }
1546
- };
1547
- else {
1548
- getter = NOOP;
1549
- warnInvalidSource(source);
1550
- }
1551
- if (cb && deep) {
1552
- const baseGetter = getter;
1553
- const depth = deep === true ? Infinity : deep;
1554
- getter = () => traverse(baseGetter(), depth);
1555
- }
1556
- const scope = getCurrentScope();
1557
- const watchHandle = () => {
1558
- effect.stop();
1559
- if (scope && scope.active) remove(scope.effects, effect);
1560
- };
1561
- if (once && cb) {
1562
- const _cb = cb;
1563
- cb = (...args) => {
1564
- _cb(...args);
1565
- watchHandle();
1566
- };
1567
- }
1568
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1569
- const job = (immediateFirstRun) => {
1570
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) return;
1571
- if (cb) {
1572
- const newValue = effect.run();
1573
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1574
- if (cleanup) cleanup();
1575
- const currentWatcher = activeWatcher;
1576
- activeWatcher = effect;
1577
- try {
1578
- const args = [
1579
- newValue,
1580
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1581
- boundCleanup
1582
- ];
1583
- oldValue = newValue;
1584
- call ? call(cb, 3, args) : cb(...args);
1585
- } finally {
1586
- activeWatcher = currentWatcher;
1587
- }
1588
- }
1589
- } else effect.run();
1590
- };
1591
- if (augmentJob) augmentJob(job);
1592
- effect = new ReactiveEffect(getter);
1593
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1594
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1595
- cleanup = effect.onStop = () => {
1596
- const cleanups = cleanupMap.get(effect);
1597
- if (cleanups) {
1598
- if (call) call(cleanups, 4);
1599
- else for (const cleanup of cleanups) cleanup();
1600
- cleanupMap.delete(effect);
1601
- }
1517
+ //#region packages/core/runtime-dom/src/domOwnership.ts
1518
+ const activeLightDomHosts = /* @__PURE__ */ new WeakMap();
1519
+ const runtimeOwnedNodes = /* @__PURE__ */ new WeakSet();
1520
+ function registerLightDomHost(host, lightChildren) {
1521
+ const ownership = { lightChildren };
1522
+ activeLightDomHosts.set(host, ownership);
1523
+ return () => {
1524
+ if (activeLightDomHosts.get(host) === ownership) activeLightDomHosts.delete(host);
1602
1525
  };
1603
- effect.onTrack = options.onTrack;
1604
- effect.onTrigger = options.onTrigger;
1605
- if (cb) if (immediate) job(true);
1606
- else oldValue = effect.run();
1607
- else if (scheduler) scheduler(job.bind(null, true), true);
1608
- else effect.run();
1609
- watchHandle.pause = effect.pause.bind(effect);
1610
- watchHandle.resume = effect.resume.bind(effect);
1611
- watchHandle.stop = watchHandle;
1612
- return watchHandle;
1613
- }
1614
- function traverse(value, depth = Infinity, seen) {
1615
- if (depth <= 0 || !isObject(value) || value["__v_skip"]) return value;
1616
- seen = seen || /* @__PURE__ */ new Map();
1617
- if ((seen.get(value) || 0) >= depth) return value;
1618
- seen.set(value, depth);
1619
- depth--;
1620
- if (/* @__PURE__ */ isRef(value)) traverse(value.value, depth, seen);
1621
- else if (isArray(value)) for (let i = 0; i < value.length; i++) traverse(value[i], depth, seen);
1622
- else if (isSet(value) || isMap(value)) value.forEach((v) => {
1623
- traverse(v, depth, seen);
1624
- });
1625
- else if (isPlainObject$1(value)) {
1626
- for (const key in value) traverse(value[key], depth, seen);
1627
- for (const key of Object.getOwnPropertySymbols(value)) if (Object.prototype.propertyIsEnumerable.call(value, key)) traverse(value[key], depth, seen);
1628
- }
1629
- return value;
1630
1526
  }
1631
- //#endregion
1632
- //#region packages/core/signal/src/lifecycle.ts
1633
- function onCleanup(fn) {
1634
- if (getCurrentEffect()) {
1635
- onEffectCleanup(fn, true);
1527
+ function trackRuntimeDomInsertion(parent, node) {
1528
+ const ownership = activeLightDomHosts.get(parent);
1529
+ if (!ownership) return;
1530
+ if (node.nodeType === 11) {
1531
+ for (const child of node.childNodes) trackRuntimeNode(ownership, child);
1636
1532
  return;
1637
1533
  }
1638
- if (getCurrentScope()) {
1639
- onScopeDispose(fn, true);
1640
- return;
1534
+ trackRuntimeNode(ownership, node);
1535
+ }
1536
+ function isRuntimeOwnedNode(node) {
1537
+ return runtimeOwnedNodes.has(node);
1538
+ }
1539
+ function trackRuntimeNode(ownership, node) {
1540
+ if (!ownership.lightChildren.includes(node)) runtimeOwnedNodes.add(node);
1541
+ }
1542
+ //#endregion
1543
+ //#region packages/core/runtime-dom/src/range.ts
1544
+ function insertTracked(parent, value, marker = null) {
1545
+ if (value === void 0 || value == null || value === false || value === true) return [];
1546
+ if (Array.isArray(value)) {
1547
+ const nodes = [];
1548
+ for (const item of value) nodes.push(...insertTracked(parent, item, marker));
1549
+ return nodes;
1641
1550
  }
1642
- warn("onCleanup() was called without active effect or scope.");
1551
+ const node = value instanceof Node ? value : document.createTextNode(String(value));
1552
+ trackRuntimeDomInsertion(parent, node);
1553
+ parent.insertBefore(node, marker);
1554
+ return [node];
1643
1555
  }
1644
1556
  //#endregion
1645
1557
  //#region packages/core/runtime-dom/src/hostContext.ts
@@ -1657,19 +1569,6 @@ var Zeus = (function(exports) {
1657
1569
  }
1658
1570
  }
1659
1571
  //#endregion
1660
- //#region packages/core/runtime-dom/src/range.ts
1661
- function insertTracked(parent, value, marker = null) {
1662
- if (value === void 0 || value == null || value === false || value === true) return [];
1663
- if (Array.isArray(value)) {
1664
- const nodes = [];
1665
- for (const item of value) nodes.push(...insertTracked(parent, item, marker));
1666
- return nodes;
1667
- }
1668
- const node = value instanceof Node ? value : document.createTextNode(String(value));
1669
- parent.insertBefore(node, marker);
1670
- return [node];
1671
- }
1672
- //#endregion
1673
1572
  //#region packages/core/runtime-dom/src/insert.ts
1674
1573
  function insert(parent, value, marker = null) {
1675
1574
  if (value === void 0) {
@@ -1926,11 +1825,11 @@ var Zeus = (function(exports) {
1926
1825
  function patchStyle(el, prev, next) {
1927
1826
  const style = el.style;
1928
1827
  if (prev) {
1929
- for (const key in prev) if (!(key in next)) style.setProperty(toKebabCase$1(key), "");
1828
+ for (const key in prev) if (!(key in next)) style.setProperty(toKebabCase$2(key), "");
1930
1829
  }
1931
1830
  for (const key in next) {
1932
1831
  const value = next[key];
1933
- const name = toKebabCase$1(key);
1832
+ const name = toKebabCase$2(key);
1934
1833
  if (value == null) style.setProperty(name, "");
1935
1834
  else style.setProperty(name, normalizeStyleValue(key, value));
1936
1835
  }
@@ -1952,7 +1851,7 @@ var Zeus = (function(exports) {
1952
1851
  function isUnitlessNumber(key) {
1953
1852
  return unitlessNumbers.has(key);
1954
1853
  }
1955
- function toKebabCase$1(value) {
1854
+ function toKebabCase$2(value) {
1956
1855
  return value.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
1957
1856
  }
1958
1857
  //#endregion
@@ -1974,6 +1873,248 @@ var Zeus = (function(exports) {
1974
1873
  return (_props$each$map = (_props$each = props.each) === null || _props$each === void 0 ? void 0 : _props$each.map((item, index) => props.children(item, index))) !== null && _props$each$map !== void 0 ? _props$each$map : null;
1975
1874
  }
1976
1875
  //#endregion
1876
+ //#region packages/core/runtime-dom/src/customElementContract.ts
1877
+ function getCustomElementAttributeName(prop) {
1878
+ var _prop$attrName;
1879
+ if (prop.attrName === false) return void 0;
1880
+ if (!isAttributeBackedType(prop.type) && !prop.deserialize) return;
1881
+ return normalizeAttributeName((_prop$attrName = prop.attrName) !== null && _prop$attrName !== void 0 ? _prop$attrName : toKebabCase$1(prop.name));
1882
+ }
1883
+ function getCustomElementObservedAttributes(props) {
1884
+ const attributes = /* @__PURE__ */ new Set();
1885
+ for (const prop of props) {
1886
+ const attrName = getCustomElementAttributeName(prop);
1887
+ if (attrName) attributes.add(attrName);
1888
+ }
1889
+ return Array.from(attributes);
1890
+ }
1891
+ function coerceCustomElementAttribute(prop, value) {
1892
+ if (typeof prop.deserialize === "function") return prop.deserialize(value);
1893
+ if (prop.deserialize === true) return value;
1894
+ switch (prop.type) {
1895
+ case "boolean": return value !== null;
1896
+ case "number": return value === null ? void 0 : Number(value);
1897
+ case "string": return value !== null && value !== void 0 ? value : void 0;
1898
+ case "object":
1899
+ case "array": return coerceStructuredAttribute(prop, value);
1900
+ case "function": return;
1901
+ default: return value;
1902
+ }
1903
+ }
1904
+ function reflectCustomElementProperty(element, prop, value, reflectingAttrs) {
1905
+ const attrName = getCustomElementAttributeName(prop);
1906
+ if (!attrName || prop.serialize === true) return;
1907
+ reflectingAttrs === null || reflectingAttrs === void 0 || reflectingAttrs.add(attrName);
1908
+ try {
1909
+ const serialized = serializeCustomElementProperty(prop, value);
1910
+ if (serialized == null) element.removeAttribute(attrName);
1911
+ else element.setAttribute(attrName, serialized);
1912
+ } finally {
1913
+ reflectingAttrs === null || reflectingAttrs === void 0 || reflectingAttrs.delete(attrName);
1914
+ }
1915
+ }
1916
+ function createCustomElementMountLifecycle(mount) {
1917
+ let mounted;
1918
+ return {
1919
+ connect() {
1920
+ var _mounted;
1921
+ (_mounted = mounted) !== null && _mounted !== void 0 || (mounted = mount());
1922
+ return mounted;
1923
+ },
1924
+ disconnect() {
1925
+ const current = mounted;
1926
+ mounted = void 0;
1927
+ current === null || current === void 0 || current.dispose();
1928
+ },
1929
+ current() {
1930
+ return mounted;
1931
+ }
1932
+ };
1933
+ }
1934
+ function serializeCustomElementProperty(prop, value) {
1935
+ if (typeof prop.serialize === "function") return prop.serialize(value);
1936
+ if (prop.type === "boolean") return value ? "" : null;
1937
+ if (value == null) return null;
1938
+ if (prop.type === "object" || prop.type === "array") return JSON.stringify(value);
1939
+ if (prop.type === "function") return void 0;
1940
+ return String(value);
1941
+ }
1942
+ function coerceStructuredAttribute(prop, value) {
1943
+ if (value === null) return void 0;
1944
+ try {
1945
+ return JSON.parse(value);
1946
+ } catch (_unused) {
1947
+ console.warn(`[Zeus custom-element] Failed to parse JSON attribute "${getCustomElementAttributeName(prop)}".`);
1948
+ return prop.type === "array" ? [] : {};
1949
+ }
1950
+ }
1951
+ function isAttributeBackedType(type) {
1952
+ return type === "string" || type === "number" || type === "boolean";
1953
+ }
1954
+ function normalizeAttributeName(value) {
1955
+ return value.toLowerCase();
1956
+ }
1957
+ function toKebabCase$1(value) {
1958
+ return value.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
1959
+ }
1960
+ //#endregion
1961
+ //#region packages/core/runtime-dom/src/slot.ts
1962
+ function createSlot(name, fallback) {
1963
+ const context = getCurrentHostContext();
1964
+ if (!context) return createNativeSlot(name, fallback);
1965
+ if (context.mode === "shadow") return createNativeSlot(name, fallback);
1966
+ if (context.projection) return context.projection.createSlot(name, fallback);
1967
+ const assigned = findLightSlotNodes(context.lightChildren, name);
1968
+ if (assigned.length > 0) return Array.from(assigned);
1969
+ return fallback ? fallback() : null;
1970
+ }
1971
+ function createLightDomProjection(host, lightChildren) {
1972
+ const outlets = [];
1973
+ let observer;
1974
+ let unregisterHost;
1975
+ const observe = () => {
1976
+ observer === null || observer === void 0 || observer.observe(host, {
1977
+ attributes: true,
1978
+ attributeFilter: ["slot"],
1979
+ childList: true,
1980
+ subtree: true
1981
+ });
1982
+ for (const node of lightChildren) {
1983
+ if (node.nodeType !== Node.ELEMENT_NODE || host.contains(node)) continue;
1984
+ observer === null || observer === void 0 || observer.observe(node, {
1985
+ attributes: true,
1986
+ attributeFilter: ["slot"]
1987
+ });
1988
+ }
1989
+ };
1990
+ const reconcile = () => {
1991
+ observer === null || observer === void 0 || observer.disconnect();
1992
+ const claimed = /* @__PURE__ */ new Set();
1993
+ for (const outlet of outlets) {
1994
+ const assigned = lightChildren.filter((node) => {
1995
+ if (claimed.has(node) || !matchesLightSlot(node, outlet.name)) return false;
1996
+ claimed.add(node);
1997
+ return true;
1998
+ });
1999
+ replaceOutletNodes(outlet, assigned.length > 0 ? assigned : outlet.fallbackNodes);
2000
+ }
2001
+ for (const node of lightChildren) if (!claimed.has(node) && host.contains(node)) {
2002
+ var _node$parentNode;
2003
+ (_node$parentNode = node.parentNode) === null || _node$parentNode === void 0 || _node$parentNode.removeChild(node);
2004
+ }
2005
+ observer === null || observer === void 0 || observer.takeRecords();
2006
+ observe();
2007
+ };
2008
+ const handleMutations = (records) => {
2009
+ const added = /* @__PURE__ */ new Set();
2010
+ const removed = /* @__PURE__ */ new Set();
2011
+ let changed = false;
2012
+ for (const record of records) {
2013
+ if (record.type === "attributes") {
2014
+ if (lightChildren.includes(record.target)) changed = true;
2015
+ continue;
2016
+ }
2017
+ for (const node of record.removedNodes) if (lightChildren.includes(node)) removed.add(node);
2018
+ if (record.target !== host) continue;
2019
+ const additions = Array.from(record.addedNodes).filter((node) => {
2020
+ return !isRuntimeOwnedNode(node);
2021
+ });
2022
+ if (additions.length === 0) continue;
2023
+ for (const node of additions) added.add(node);
2024
+ insertLightChildren(lightChildren, additions, record);
2025
+ changed = true;
2026
+ }
2027
+ for (const node of removed) {
2028
+ if (added.has(node) || host.contains(node)) continue;
2029
+ const index = lightChildren.indexOf(node);
2030
+ if (index >= 0) {
2031
+ lightChildren.splice(index, 1);
2032
+ changed = true;
2033
+ }
2034
+ }
2035
+ if (changed) reconcile();
2036
+ };
2037
+ return {
2038
+ createSlot(name, fallback) {
2039
+ const fragment = document.createDocumentFragment();
2040
+ const start = document.createComment(name ? `zeus-slot:${name}` : "zeus-slot");
2041
+ const end = document.createComment("/zeus-slot");
2042
+ fragment.append(start, end);
2043
+ const outlet = {
2044
+ name,
2045
+ start,
2046
+ end,
2047
+ fallbackNodes: fallback ? insertTracked(fragment, fallback(), end) : []
2048
+ };
2049
+ outlets.push(outlet);
2050
+ reconcile();
2051
+ return fragment;
2052
+ },
2053
+ connect() {
2054
+ var _host$ownerDocument$d;
2055
+ if (observer) return;
2056
+ const Observer = (_host$ownerDocument$d = host.ownerDocument.defaultView) === null || _host$ownerDocument$d === void 0 ? void 0 : _host$ownerDocument$d.MutationObserver;
2057
+ if (!Observer) return;
2058
+ unregisterHost = registerLightDomHost(host, lightChildren);
2059
+ observer = new Observer(handleMutations);
2060
+ observe();
2061
+ },
2062
+ disconnect() {
2063
+ observer === null || observer === void 0 || observer.disconnect();
2064
+ observer = void 0;
2065
+ unregisterHost === null || unregisterHost === void 0 || unregisterHost();
2066
+ unregisterHost = void 0;
2067
+ }
2068
+ };
2069
+ }
2070
+ function replaceOutletNodes(outlet, nextNodes) {
2071
+ const parent = outlet.end.parentNode;
2072
+ if (!parent || parent !== outlet.start.parentNode) return;
2073
+ let current = outlet.start.nextSibling;
2074
+ while (current && current !== outlet.end) {
2075
+ const next = current.nextSibling;
2076
+ parent.removeChild(current);
2077
+ current = next;
2078
+ }
2079
+ for (const node of nextNodes) parent.insertBefore(node, outlet.end);
2080
+ }
2081
+ function insertLightChildren(lightChildren, additions, record) {
2082
+ for (const node of additions) {
2083
+ const currentIndex = lightChildren.indexOf(node);
2084
+ if (currentIndex >= 0) lightChildren.splice(currentIndex, 1);
2085
+ }
2086
+ let insertionIndex = lightChildren.length;
2087
+ const previousIndex = record.previousSibling ? lightChildren.indexOf(record.previousSibling) : -1;
2088
+ const nextIndex = record.nextSibling ? lightChildren.indexOf(record.nextSibling) : -1;
2089
+ if (previousIndex >= 0) insertionIndex = previousIndex + 1;
2090
+ else if (nextIndex >= 0) insertionIndex = nextIndex;
2091
+ else if (record.previousSibling === null) insertionIndex = 0;
2092
+ lightChildren.splice(insertionIndex, 0, ...additions);
2093
+ }
2094
+ function createNativeSlot(name, fallback) {
2095
+ const slot = document.createElement("slot");
2096
+ if (name) slot.setAttribute("name", name);
2097
+ const fallbackValue = fallback === null || fallback === void 0 ? void 0 : fallback();
2098
+ if (fallbackValue != null) insert(slot, fallbackValue);
2099
+ return slot;
2100
+ }
2101
+ function findLightSlotNodes(nodes, name) {
2102
+ return nodes.filter((node) => matchesLightSlot(node, name));
2103
+ }
2104
+ function matchesLightSlot(node, name) {
2105
+ if (name) {
2106
+ if (node.nodeType !== Node.ELEMENT_NODE) return false;
2107
+ return node.getAttribute("slot") === name;
2108
+ }
2109
+ if (node.nodeType === Node.ELEMENT_NODE) return !node.hasAttribute("slot");
2110
+ return isMeaningfulTextNode(node);
2111
+ }
2112
+ function isMeaningfulTextNode(node) {
2113
+ var _node$textContent;
2114
+ if (node.nodeType !== Node.TEXT_NODE) return false;
2115
+ return Boolean((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.trim());
2116
+ }
2117
+ //#endregion
1977
2118
  //#region packages/core/runtime-dom/src/defineElement.ts
1978
2119
  const ZEUS_ELEMENT_DEFINITION = Symbol.for("zeus.element.definition");
1979
2120
  function prop(input, options = {}) {
@@ -2015,8 +2156,8 @@ var Zeus = (function(exports) {
2015
2156
  const props = {};
2016
2157
  for (const def of defs) {
2017
2158
  const slot = state();
2018
- slots.set(def.key, slot);
2019
- Object.defineProperty(props, def.key, {
2159
+ slots.set(def.name, slot);
2160
+ Object.defineProperty(props, def.name, {
2020
2161
  configurable: false,
2021
2162
  enumerable: true,
2022
2163
  get() {
@@ -2055,7 +2196,7 @@ var Zeus = (function(exports) {
2055
2196
  setup,
2056
2197
  propDefs
2057
2198
  };
2058
- const observedAttributes = propDefs.filter((def) => def.attr !== false).map((def) => def.attr);
2199
+ const observedAttributes = getCustomElementObservedAttributes(propDefs);
2059
2200
  class ZeusElement extends HTMLElement {
2060
2201
  static get observedAttributes() {
2061
2202
  return observedAttributes;
@@ -2064,7 +2205,8 @@ var Zeus = (function(exports) {
2064
2205
  super();
2065
2206
  this.lightChildren = [];
2066
2207
  this.capturedLightChildren = false;
2067
- this.reflecting = false;
2208
+ this.attributeProps = /* @__PURE__ */ new Set();
2209
+ this.reflectingAttrs = /* @__PURE__ */ new Set();
2068
2210
  this.propStore = createPropStore(propDefs);
2069
2211
  this.props = this.propStore.props;
2070
2212
  applyPropDefaults(this.propStore, propDefs);
@@ -2076,17 +2218,23 @@ var Zeus = (function(exports) {
2076
2218
  emit: createEmitApi(this, options.emits),
2077
2219
  expose: createExpose(this)
2078
2220
  };
2221
+ this.mountLifecycle = createCustomElementMountLifecycle(() => this.mountElement());
2079
2222
  }
2080
2223
  connectedCallback() {
2224
+ this.mountLifecycle.connect();
2225
+ }
2226
+ disconnectedCallback() {
2227
+ this.mountLifecycle.disconnect();
2228
+ }
2229
+ mountElement() {
2081
2230
  var _options$shadow, _options$consumes;
2082
- if (this.dispose) return;
2083
2231
  const shadow = (_options$shadow = options.shadow) !== null && _options$shadow !== void 0 ? _options$shadow : false;
2084
2232
  const mode = shadow ? "shadow" : "light";
2085
2233
  if (mode === "light" && !this.capturedLightChildren) {
2086
2234
  this.lightChildren = Array.from(this.childNodes);
2087
2235
  this.capturedLightChildren = true;
2088
2236
  }
2089
- this.syncAttributesToProps(propDefs);
2237
+ const projection = mode === "light" ? createLightDomProjection(this, this.lightChildren) : void 0;
2090
2238
  const owner = createOwner();
2091
2239
  for (const context of (_options$consumes = options.consumes) !== null && _options$consumes !== void 0 ? _options$consumes : []) {
2092
2240
  const resolved = resolveDOMContext(this, context);
@@ -2097,18 +2245,19 @@ var Zeus = (function(exports) {
2097
2245
  const hostContext = {
2098
2246
  host: this,
2099
2247
  mode,
2100
- lightChildren: this.lightChildren
2248
+ lightChildren: this.lightChildren,
2249
+ projection
2101
2250
  };
2102
- this.dispose = render(() => runWithOwner(owner, () => withHostContext(hostContext, () => {
2251
+ const dispose = render(() => runWithOwner(owner, () => withHostContext(hostContext, () => {
2103
2252
  syncFormValue(this.props, this.setupContext, options.form);
2104
2253
  return setup(this.props, this.setupContext);
2105
2254
  })), target, { owner });
2106
2255
  mountStyles(target, options.styles);
2107
- }
2108
- disconnectedCallback() {
2109
- var _this$dispose;
2110
- (_this$dispose = this.dispose) === null || _this$dispose === void 0 || _this$dispose.call(this);
2111
- this.dispose = void 0;
2256
+ projection === null || projection === void 0 || projection.connect();
2257
+ return { dispose() {
2258
+ projection === null || projection === void 0 || projection.disconnect();
2259
+ dispose();
2260
+ } };
2112
2261
  }
2113
2262
  formAssociatedCallback(form) {
2114
2263
  var _options$form, _options$form$associa;
@@ -2127,10 +2276,11 @@ var Zeus = (function(exports) {
2127
2276
  (_options$form4 = options.form) === null || _options$form4 === void 0 || (_options$form4$stateR = _options$form4.stateRestore) === null || _options$form4$stateR === void 0 || _options$form4$stateR.call(_options$form4, state, mode, this.props, this.setupContext);
2128
2277
  }
2129
2278
  attributeChangedCallback(name, oldValue, newValue) {
2130
- if (oldValue === newValue || this.reflecting) return;
2131
- const def = propDefs.find((item) => item.attr === name);
2279
+ if (oldValue === newValue || this.reflectingAttrs.has(name)) return;
2280
+ const def = propDefs.find((item) => item.attrName === name);
2132
2281
  if (!def) return;
2133
- this.propStore.set(def.key, castAttributeValue(newValue, def));
2282
+ this.attributeProps.add(def.name);
2283
+ this.propStore.set(def.name, coerceCustomElementAttribute(def, newValue));
2134
2284
  }
2135
2285
  resolveRenderTarget(shadow) {
2136
2286
  if (this.target) return this.target;
@@ -2141,24 +2291,11 @@ var Zeus = (function(exports) {
2141
2291
  this.target = this.attachShadow(typeof shadow === "object" ? shadow : { mode: "open" });
2142
2292
  return this.target;
2143
2293
  }
2144
- syncAttributesToProps(defs) {
2145
- for (const def of defs) {
2146
- if (def.attr === false) continue;
2147
- const value = this.getAttribute(def.attr);
2148
- if (value !== null || def.type === Boolean) this.propStore.set(def.key, castAttributeValue(value, def));
2149
- }
2150
- }
2151
2294
  _writePropFromProperty(key, value) {
2152
- const def = propDefs.find((item) => item.key === key);
2295
+ const def = propDefs.find((item) => item.name === key);
2296
+ this.attributeProps.delete(key);
2153
2297
  this.propStore.set(key, value);
2154
- if ((def === null || def === void 0 ? void 0 : def.reflect) && def.attr !== false) {
2155
- this.reflecting = true;
2156
- try {
2157
- reflectPropToAttribute(this, def, value);
2158
- } finally {
2159
- this.reflecting = false;
2160
- }
2161
- }
2298
+ if (def === null || def === void 0 ? void 0 : def.reflect) reflectCustomElementProperty(this, def, value, this.reflectingAttrs);
2162
2299
  }
2163
2300
  }
2164
2301
  ZeusElement.formAssociated = Boolean(options.formAssociated);
@@ -2176,18 +2313,18 @@ var Zeus = (function(exports) {
2176
2313
  if (typeof input === "function") {
2177
2314
  const type = input;
2178
2315
  return {
2179
- key: propKey,
2180
- attr: isAttributeBackedConstructor(type) ? toKebabCase(propKey) : false,
2181
- type,
2316
+ name: propKey,
2317
+ attrName: isAttributeBackedConstructor(type) ? toKebabCase(propKey) : false,
2318
+ type: normalizePropType(type),
2182
2319
  reflect: false
2183
2320
  };
2184
2321
  }
2185
2322
  const type = input === null || input === void 0 ? void 0 : input.type;
2186
2323
  const defaultAttr = isAttributeBackedConstructor(type) ? toKebabCase(propKey) : false;
2187
2324
  return {
2188
- key: propKey,
2189
- attr: (input === null || input === void 0 ? void 0 : input.attr) === void 0 ? defaultAttr : input.attr,
2190
- type,
2325
+ name: propKey,
2326
+ attrName: (input === null || input === void 0 ? void 0 : input.attr) === void 0 ? defaultAttr : input.attr,
2327
+ type: normalizePropType(type),
2191
2328
  reflect: Boolean(input === null || input === void 0 ? void 0 : input.reflect),
2192
2329
  default: input === null || input === void 0 ? void 0 : input.default,
2193
2330
  serialize: input === null || input === void 0 ? void 0 : input.serialize,
@@ -2199,12 +2336,12 @@ var Zeus = (function(exports) {
2199
2336
  for (const def of defs) {
2200
2337
  if (!("default" in def)) continue;
2201
2338
  const value = typeof def.default === "function" ? def.default() : def.default;
2202
- store.set(def.key, value);
2339
+ store.set(def.name, value);
2203
2340
  }
2204
2341
  }
2205
2342
  function definePropAccessors(element, store, defs) {
2206
2343
  for (const def of defs) {
2207
- const key = def.key;
2344
+ const key = def.name;
2208
2345
  const hadOwnValue = Object.prototype.hasOwnProperty.call(element, key);
2209
2346
  const ownValue = hadOwnValue ? element[key] : void 0;
2210
2347
  if (hadOwnValue) delete element[key];
@@ -2226,44 +2363,6 @@ var Zeus = (function(exports) {
2226
2363
  if (hadOwnValue) element._writePropFromProperty(key, ownValue);
2227
2364
  }
2228
2365
  }
2229
- function castAttributeValue(value, def) {
2230
- if (def.deserialize) return def.deserialize(value);
2231
- if (def.type === Boolean) return value !== null;
2232
- if (value === null) return;
2233
- if (def.type === Number) return Number(value);
2234
- if (def.type === Object || def.type === Array) try {
2235
- return JSON.parse(value);
2236
- } catch (_unused) {
2237
- console.warn(`[Zeus custom-element] Failed to parse JSON attribute "${def.attr}".`);
2238
- return def.type === Array ? [] : {};
2239
- }
2240
- if (def.type === Function) return;
2241
- return value;
2242
- }
2243
- function reflectPropToAttribute(element, def, value) {
2244
- if (def.attr === false) return;
2245
- if (def.serialize) {
2246
- const serialized = def.serialize(value);
2247
- if (serialized == null) element.removeAttribute(def.attr);
2248
- else element.setAttribute(def.attr, serialized);
2249
- return;
2250
- }
2251
- if (def.type === Boolean) {
2252
- if (value) element.setAttribute(def.attr, "");
2253
- else element.removeAttribute(def.attr);
2254
- return;
2255
- }
2256
- if (value == null) {
2257
- element.removeAttribute(def.attr);
2258
- return;
2259
- }
2260
- if (def.type === Object || def.type === Array) {
2261
- element.setAttribute(def.attr, JSON.stringify(value));
2262
- return;
2263
- }
2264
- if (def.type === Function) return;
2265
- element.setAttribute(def.attr, String(value));
2266
- }
2267
2366
  function syncFormValue(props, context, form) {
2268
2367
  const valueResolver = form === null || form === void 0 ? void 0 : form.value;
2269
2368
  const stateResolver = form === null || form === void 0 ? void 0 : form.state;
@@ -2325,6 +2424,15 @@ var Zeus = (function(exports) {
2325
2424
  function isAttributeBackedConstructor(type) {
2326
2425
  return type === String || type === Number || type === Boolean;
2327
2426
  }
2427
+ function normalizePropType(type) {
2428
+ if (type === String) return "string";
2429
+ if (type === Number) return "number";
2430
+ if (type === Boolean) return "boolean";
2431
+ if (type === Object) return "object";
2432
+ if (type === Array) return "array";
2433
+ if (type === Function) return "function";
2434
+ return "unknown";
2435
+ }
2328
2436
  function mountStyles(target, styles) {
2329
2437
  if (!styles) return;
2330
2438
  const list = Array.isArray(styles) ? styles : [styles];
@@ -2362,38 +2470,6 @@ var Zeus = (function(exports) {
2362
2470
  }, true);
2363
2471
  }
2364
2472
  //#endregion
2365
- //#region packages/core/runtime-dom/src/slot.ts
2366
- function createSlot(name, fallback) {
2367
- const context = getCurrentHostContext();
2368
- if (!context) return createNativeSlot(name, fallback);
2369
- if (context.mode === "shadow") return createNativeSlot(name, fallback);
2370
- const assigned = findLightSlotNodes(context.lightChildren, name);
2371
- if (assigned.length > 0) return Array.from(assigned);
2372
- return fallback ? fallback() : null;
2373
- }
2374
- function createNativeSlot(name, fallback) {
2375
- const slot = document.createElement("slot");
2376
- if (name) slot.setAttribute("name", name);
2377
- const fallbackValue = fallback === null || fallback === void 0 ? void 0 : fallback();
2378
- if (fallbackValue != null) insert(slot, fallbackValue);
2379
- return slot;
2380
- }
2381
- function findLightSlotNodes(nodes, name) {
2382
- if (name) return nodes.filter((node) => {
2383
- if (node.nodeType !== Node.ELEMENT_NODE) return false;
2384
- return node.getAttribute("slot") === name;
2385
- });
2386
- return nodes.filter((node) => {
2387
- if (node.nodeType === Node.ELEMENT_NODE) return !node.hasAttribute("slot");
2388
- return isMeaningfulTextNode(node);
2389
- });
2390
- }
2391
- function isMeaningfulTextNode(node) {
2392
- var _node$textContent;
2393
- if (node.nodeType !== Node.TEXT_NODE) return false;
2394
- return Boolean((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.trim());
2395
- }
2396
- //#endregion
2397
2473
  //#region packages/core/runtime-dom/src/webComponents.ts
2398
2474
  const HOST_RESERVED_KEYS = /* @__PURE__ */ new Set([
2399
2475
  "children",
@@ -2540,24 +2616,21 @@ var Zeus = (function(exports) {
2540
2616
  exports.Show = Show;
2541
2617
  exports.Slot = Slot;
2542
2618
  exports.batch = batch;
2543
- exports.computed = computed;
2544
2619
  exports.createContext = createContext;
2620
+ exports.createEffect = createEffect;
2621
+ exports.createMemo = createMemo;
2622
+ exports.createRoot = createRoot;
2623
+ exports.createSignal = createSignal;
2545
2624
  exports.defineElement = defineElement;
2546
- exports.effect = effect;
2547
2625
  exports.event = event;
2548
2626
  exports.inject = inject;
2549
2627
  exports.jsx = jsx;
2550
2628
  exports.jsxDEV = jsxDEV;
2551
2629
  exports.jsxs = jsxs;
2552
- exports.nextTick = nextTick;
2553
2630
  exports.onCleanup = onCleanup;
2554
2631
  exports.prop = prop;
2555
2632
  exports.provide = provide;
2556
2633
  exports.render = render;
2557
- exports.scope = effectScope;
2558
- exports.state = state;
2559
- exports.untrack = untrack;
2560
2634
  exports.useContext = useContext;
2561
- exports.watch = watch;
2562
2635
  return exports;
2563
2636
  })({});