@zeus-js/zeus 0.0.2 → 0.1.0-beta.1

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,9 +1,9 @@
1
1
  /**
2
- * zeus v0.0.2
2
+ * zeus v0.1.0-beta.1
3
3
  * (c) 2026 baicie
4
4
  * Released under the MIT License.
5
5
  **/
6
- //#region packages/shared/src/makeMap.ts
6
+ //#region packages/core/shared/src/makeMap.ts
7
7
  /**
8
8
  * Make a map and return a function for checking if a key
9
9
  * is in that map.
@@ -18,7 +18,7 @@ function makeMap(str) {
18
18
  return (val) => val in map;
19
19
  }
20
20
  //#endregion
21
- //#region packages/shared/src/general.ts
21
+ //#region packages/core/shared/src/general.ts
22
22
  const EMPTY_OBJ = Object.freeze({});
23
23
  Object.freeze([]);
24
24
  const NOOP = () => {};
@@ -57,12 +57,12 @@ const capitalize = cacheStringFunction((str) => {
57
57
  });
58
58
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
59
59
  //#endregion
60
- //#region packages/signal/src/warning.ts
60
+ //#region packages/core/signal/src/warning.ts
61
61
  function warn(msg, ...args) {
62
62
  console.warn(`[Zeus warn] ${msg}`, ...args);
63
63
  }
64
64
  //#endregion
65
- //#region packages/signal/src/effectScope.ts
65
+ //#region packages/core/signal/src/effectScope.ts
66
66
  let activeEffectScope;
67
67
  var EffectScope = class {
68
68
  constructor(detached = false) {
@@ -202,7 +202,7 @@ function onScopeDispose(fn, failSilently = false) {
202
202
  else if (!failSilently) warn("onScopeDispose() is called when there is no active effect scope to be associated with.");
203
203
  }
204
204
  //#endregion
205
- //#region packages/signal/src/effect.ts
205
+ //#region packages/core/signal/src/effect.ts
206
206
  let activeSub;
207
207
  const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
208
208
  var ReactiveEffect = class {
@@ -527,7 +527,7 @@ function getCurrentEffect() {
527
527
  return activeSub instanceof ReactiveEffect ? activeSub : void 0;
528
528
  }
529
529
  //#endregion
530
- //#region packages/signal/src/dep.ts
530
+ //#region packages/core/signal/src/dep.ts
531
531
  /**
532
532
  * Incremented every time a reactive change happens
533
533
  * This is used to give computed a fast path to avoid re-compute when nothing
@@ -718,7 +718,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
718
718
  endBatch();
719
719
  }
720
720
  //#endregion
721
- //#region packages/signal/src/arrayInstrumentations.ts
721
+ //#region packages/core/signal/src/arrayInstrumentations.ts
722
722
  /**
723
723
  * Track array iteration and return:
724
724
  * - if input is reactive: a cloned raw array with reactive values
@@ -903,7 +903,7 @@ function noTracking(self, method, args = []) {
903
903
  return res;
904
904
  }
905
905
  //#endregion
906
- //#region packages/signal/src/ref.ts
906
+ //#region packages/core/signal/src/ref.ts
907
907
  let _ReactiveFlags$IS_REF, _ReactiveFlags$IS_SHA;
908
908
  /*@__NO_SIDE_EFFECTS__*/
909
909
  function isRef(r) {
@@ -957,7 +957,7 @@ var RefImpl = class {
957
957
  }
958
958
  };
959
959
  //#endregion
960
- //#region packages/signal/src/baseHandlers.ts
960
+ //#region packages/core/signal/src/baseHandlers.ts
961
961
  const isNonTrackableKeys = /*@__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
962
962
  const builtInSymbols = new Set(/*@__PURE__*/ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
963
963
  function hasOwnProperty(key) {
@@ -1061,7 +1061,7 @@ var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
1061
1061
  const mutableHandlers = /*@__PURE__*/ new MutableReactiveHandler();
1062
1062
  const readonlyHandlers = /*@__PURE__*/ new ReadonlyReactiveHandler();
1063
1063
  //#endregion
1064
- //#region packages/signal/src/collectionHandlers.ts
1064
+ //#region packages/core/signal/src/collectionHandlers.ts
1065
1065
  const toShallow = (value) => value;
1066
1066
  const getProto = (v) => Reflect.getPrototypeOf(v);
1067
1067
  function createIterableMethod(method, isReadonly, isShallow) {
@@ -1220,7 +1220,7 @@ function checkIdentityKeys(target, has, key) {
1220
1220
  }
1221
1221
  }
1222
1222
  //#endregion
1223
- //#region packages/signal/src/reactive.ts
1223
+ //#region packages/core/signal/src/reactive.ts
1224
1224
  const reactiveMap = /* @__PURE__ */ new WeakMap();
1225
1225
  const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
1226
1226
  const readonlyMap = /* @__PURE__ */ new WeakMap();
@@ -1389,7 +1389,7 @@ const toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value)
1389
1389
  */
1390
1390
  const toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
1391
1391
  //#endregion
1392
- //#region packages/signal/src/state.ts
1392
+ //#region packages/core/signal/src/state.ts
1393
1393
  function state(value) {
1394
1394
  if (arguments.length === 0) return /* @__PURE__ */ ref();
1395
1395
  return isProxyable(value) ? /* @__PURE__ */ reactive(value) : /* @__PURE__ */ ref(value);
@@ -1405,7 +1405,7 @@ function isPlainObject(value) {
1405
1405
  return proto === Object.prototype || proto === null;
1406
1406
  }
1407
1407
  //#endregion
1408
- //#region packages/signal/src/computed.ts
1408
+ //#region packages/core/signal/src/computed.ts
1409
1409
  /**
1410
1410
  * @private exported by @vue/reactivity for Vue core use, but not exported from
1411
1411
  * the main vue package
@@ -1468,12 +1468,12 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1468
1468
  return cRef;
1469
1469
  }
1470
1470
  //#endregion
1471
- //#region packages/signal/src/scheduler.ts
1471
+ //#region packages/core/signal/src/scheduler.ts
1472
1472
  function nextTick() {
1473
1473
  return Promise.resolve();
1474
1474
  }
1475
1475
  //#endregion
1476
- //#region packages/signal/src/watch.ts
1476
+ //#region packages/core/signal/src/watch.ts
1477
1477
  const INITIAL_WATCHER_VALUE = {};
1478
1478
  const cleanupMap = /* @__PURE__ */ new WeakMap();
1479
1479
  let activeWatcher = void 0;
@@ -1629,7 +1629,7 @@ function traverse(value, depth = Infinity, seen) {
1629
1629
  return value;
1630
1630
  }
1631
1631
  //#endregion
1632
- //#region packages/signal/src/lifecycle.ts
1632
+ //#region packages/core/signal/src/lifecycle.ts
1633
1633
  function onCleanup(fn) {
1634
1634
  if (getCurrentEffect()) {
1635
1635
  onEffectCleanup(fn, true);
@@ -1642,7 +1642,7 @@ function onCleanup(fn) {
1642
1642
  warn("onCleanup() was called without active effect or scope.");
1643
1643
  }
1644
1644
  //#endregion
1645
- //#region packages/runtime-dom/src/hostContext.ts
1645
+ //#region packages/core/runtime-dom/src/hostContext.ts
1646
1646
  let currentHostContext;
1647
1647
  function getCurrentHostContext() {
1648
1648
  return currentHostContext;
@@ -1657,8 +1657,8 @@ function withHostContext(context, fn) {
1657
1657
  }
1658
1658
  }
1659
1659
  //#endregion
1660
- //#region packages/runtime-dom/src/range.ts
1661
- function insertTracked(parent, value, marker) {
1660
+ //#region packages/core/runtime-dom/src/range.ts
1661
+ function insertTracked(parent, value, marker = null) {
1662
1662
  if (value === void 0 || value == null || value === false || value === true) return [];
1663
1663
  if (Array.isArray(value)) {
1664
1664
  const nodes = [];
@@ -1670,7 +1670,7 @@ function insertTracked(parent, value, marker) {
1670
1670
  return [node];
1671
1671
  }
1672
1672
  //#endregion
1673
- //#region packages/runtime-dom/src/insert.ts
1673
+ //#region packages/core/runtime-dom/src/insert.ts
1674
1674
  function insert(parent, value, marker = null) {
1675
1675
  if (value === void 0) {
1676
1676
  console.warn("[Zeus runtime] insert received `undefined`, which is ignored. Use `null` or a fallback value explicitly if you want to suppress this warning.");
@@ -1679,7 +1679,7 @@ function insert(parent, value, marker = null) {
1679
1679
  insertTracked(parent, value, marker);
1680
1680
  }
1681
1681
  //#endregion
1682
- //#region packages/runtime-dom/src/context.ts
1682
+ //#region packages/core/runtime-dom/src/context.ts
1683
1683
  let currentOwner;
1684
1684
  function createOwner(parent = currentOwner) {
1685
1685
  return {
@@ -1805,14 +1805,14 @@ function resolveValue$3(value) {
1805
1805
  return typeof value === "function" ? value() : value !== null && value !== void 0 ? value : null;
1806
1806
  }
1807
1807
  //#endregion
1808
- //#region packages/runtime-dom/src/devtools.ts
1808
+ //#region packages/core/runtime-dom/src/devtools.ts
1809
1809
  function emitDevtoolsEvent(event) {
1810
1810
  var _window$__ZEUS_DEVTOO;
1811
1811
  if (typeof window === "undefined") return;
1812
1812
  (_window$__ZEUS_DEVTOO = window.__ZEUS_DEVTOOLS_HOOK__) === null || _window$__ZEUS_DEVTOO === void 0 || _window$__ZEUS_DEVTOO.emit(event);
1813
1813
  }
1814
1814
  //#endregion
1815
- //#region packages/runtime-dom/src/render.ts
1815
+ //#region packages/core/runtime-dom/src/render.ts
1816
1816
  function render(value, container, options = {}) {
1817
1817
  var _options$owner;
1818
1818
  const renderScope = effectScope();
@@ -1839,12 +1839,153 @@ function resolveValue$2(value) {
1839
1839
  return typeof value === "function" ? value() : value !== null && value !== void 0 ? value : null;
1840
1840
  }
1841
1841
  //#endregion
1842
- //#region packages/runtime-dom/src/component.ts
1842
+ //#region packages/core/runtime-dom/src/bindings.ts
1843
+ function setAttr(el, name, value) {
1844
+ const attrName = normalizeAttrName(name);
1845
+ const propName = getBooleanDomPropertyName(name);
1846
+ if (propName && el instanceof HTMLElement) {
1847
+ el[propName] = Boolean(value);
1848
+ if (value == null || value === false) el.removeAttribute(attrName);
1849
+ else if (value === true) el.setAttribute(attrName, "");
1850
+ else el.setAttribute(attrName, String(value));
1851
+ return;
1852
+ }
1853
+ if (value == null || value === false) {
1854
+ el.removeAttribute(attrName);
1855
+ return;
1856
+ }
1857
+ if (value === true) {
1858
+ el.setAttribute(attrName, "");
1859
+ return;
1860
+ }
1861
+ el.setAttribute(attrName, String(value));
1862
+ }
1863
+ function getBooleanDomPropertyName(name) {
1864
+ return BOOLEAN_DOM_PROPERTY_NAME[name];
1865
+ }
1866
+ const BOOLEAN_DOM_PROPERTY_NAME = {
1867
+ hidden: "hidden",
1868
+ disabled: "disabled",
1869
+ readonly: "readOnly",
1870
+ readOnly: "readOnly",
1871
+ multiple: "multiple",
1872
+ selected: "selected",
1873
+ checked: "checked",
1874
+ open: "open",
1875
+ autofocus: "autofocus",
1876
+ autoFocus: "autofocus",
1877
+ indeterminate: "indeterminate",
1878
+ noValidate: "noValidate",
1879
+ novalidate: "noValidate"
1880
+ };
1881
+ function normalizeAttrName(name) {
1882
+ return name === "className" ? "class" : name;
1883
+ }
1884
+ function bindAttr(el, name, value) {
1885
+ effect(() => {
1886
+ setAttr(el, name, value());
1887
+ });
1888
+ }
1889
+ function bindProp(el, name, value) {
1890
+ effect(() => {
1891
+ el[name] = value();
1892
+ });
1893
+ }
1894
+ function bindClass(el, value) {
1895
+ effect(() => {
1896
+ const next = normalizeClass(value());
1897
+ if (next) el.setAttribute("class", next);
1898
+ else el.removeAttribute("class");
1899
+ });
1900
+ }
1901
+ function normalizeClass(value) {
1902
+ if (!value) return "";
1903
+ if (typeof value === "string") return value;
1904
+ if (Array.isArray(value)) return value.map(normalizeClass).filter(Boolean).join(" ");
1905
+ if (typeof value === "object") return Object.keys(value).filter((key) => value[key]).join(" ");
1906
+ return "";
1907
+ }
1908
+ function bindStyle(el, value) {
1909
+ let prev;
1910
+ effect(() => {
1911
+ const next = value();
1912
+ if (next == null) {
1913
+ el.removeAttribute("style");
1914
+ prev = void 0;
1915
+ return;
1916
+ }
1917
+ if (typeof next === "string") {
1918
+ el.setAttribute("style", next);
1919
+ prev = void 0;
1920
+ return;
1921
+ }
1922
+ patchStyle(el, prev, next);
1923
+ prev = next;
1924
+ });
1925
+ }
1926
+ function patchStyle(el, prev, next) {
1927
+ const style = el.style;
1928
+ if (prev) {
1929
+ for (const key in prev) if (!(key in next)) style.setProperty(toKebabCase$1(key), "");
1930
+ }
1931
+ for (const key in next) {
1932
+ const value = next[key];
1933
+ const name = toKebabCase$1(key);
1934
+ if (value == null) style.setProperty(name, "");
1935
+ else style.setProperty(name, normalizeStyleValue(key, value));
1936
+ }
1937
+ }
1938
+ function normalizeStyleValue(key, value) {
1939
+ if (typeof value === "number" && value !== 0 && !isUnitlessNumber(key)) return `${value}px`;
1940
+ return String(value);
1941
+ }
1942
+ const unitlessNumbers = new Set([
1943
+ "opacity",
1944
+ "zIndex",
1945
+ "fontWeight",
1946
+ "lineHeight",
1947
+ "flex",
1948
+ "flexGrow",
1949
+ "flexShrink",
1950
+ "order"
1951
+ ]);
1952
+ function isUnitlessNumber(key) {
1953
+ return unitlessNumbers.has(key);
1954
+ }
1955
+ function toKebabCase$1(value) {
1956
+ return value.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
1957
+ }
1958
+ //#endregion
1959
+ //#region packages/core/runtime-dom/src/refs.ts
1960
+ function setRef(target, value) {
1961
+ if (target == null) return;
1962
+ if (typeof target === "function") {
1963
+ target(value);
1964
+ return;
1965
+ }
1966
+ if ("value" in target) {
1967
+ target.value = value;
1968
+ return;
1969
+ }
1970
+ if ("current" in target) {
1971
+ target.current = value;
1972
+ return;
1973
+ }
1974
+ console.warn("[Zeus runtime] Invalid ref target:", target);
1975
+ }
1976
+ function bindRef(el, target) {
1977
+ setRef(target, el);
1978
+ if (getCurrentScope()) onScopeDispose(() => {
1979
+ setRef(target, null);
1980
+ }, true);
1981
+ }
1982
+ //#endregion
1983
+ //#region packages/core/runtime-dom/src/component.ts
1843
1984
  function createComponent(component, props) {
1844
1985
  return runWithOwner(createOwner(), () => component(props));
1845
1986
  }
1846
1987
  //#endregion
1847
- //#region packages/runtime-dom/src/controlFlow.ts
1988
+ //#region packages/core/runtime-dom/src/controlFlow.ts
1848
1989
  function Show(props) {
1849
1990
  return resolveValue$1(props.when ? props.children : props.fallback);
1850
1991
  }
@@ -1918,7 +2059,43 @@ function _objectSpread2(e) {
1918
2059
  return e;
1919
2060
  }
1920
2061
  //#endregion
1921
- //#region packages/runtime-dom/src/defineElement.ts
2062
+ //#region packages/core/runtime-dom/src/defineElement.ts
2063
+ function createPropStore(defs) {
2064
+ const slots = /* @__PURE__ */ new Map();
2065
+ const props = {};
2066
+ for (const def of defs) {
2067
+ const slot = state();
2068
+ slots.set(def.key, slot);
2069
+ Object.defineProperty(props, def.key, {
2070
+ configurable: false,
2071
+ enumerable: true,
2072
+ get() {
2073
+ return slot.value;
2074
+ },
2075
+ set(value) {
2076
+ slot.value = value;
2077
+ }
2078
+ });
2079
+ }
2080
+ return {
2081
+ props,
2082
+ get(key) {
2083
+ var _slots$get;
2084
+ return (_slots$get = slots.get(key)) === null || _slots$get === void 0 ? void 0 : _slots$get.value;
2085
+ },
2086
+ set(key, value) {
2087
+ const slot = slots.get(key);
2088
+ if (!slot) {
2089
+ console.warn(`[Zeus custom-element] Unknown prop "${key}" was written.`);
2090
+ return;
2091
+ }
2092
+ slot.value = value;
2093
+ },
2094
+ has(key) {
2095
+ return slots.has(key);
2096
+ }
2097
+ };
2098
+ }
1922
2099
  function defineElement(tagName, options, setup) {
1923
2100
  var _options$props;
1924
2101
  const propDefs = normalizePropDefinitions((_options$props = options.props) !== null && _options$props !== void 0 ? _options$props : {});
@@ -1929,12 +2106,13 @@ function defineElement(tagName, options, setup) {
1929
2106
  }
1930
2107
  constructor() {
1931
2108
  super();
1932
- this.props = state({});
1933
2109
  this.lightChildren = [];
1934
2110
  this.capturedLightChildren = false;
1935
2111
  this.reflecting = false;
1936
- applyPropDefaults(this.props, propDefs);
1937
- definePropAccessors(this, this.props, propDefs);
2112
+ this.propStore = createPropStore(propDefs);
2113
+ this.props = this.propStore.props;
2114
+ applyPropDefaults(this.propStore, propDefs);
2115
+ definePropAccessors(this, this.propStore, propDefs);
1938
2116
  }
1939
2117
  connectedCallback() {
1940
2118
  var _options$shadow, _options$consumes;
@@ -1970,22 +2148,17 @@ function defineElement(tagName, options, setup) {
1970
2148
  };
1971
2149
  this.dispose = render(() => runWithOwner(owner, () => withHostContext(hostContext, () => setup(this.props, setupContext))), target, { owner });
1972
2150
  mountStyles(target, options.styles);
1973
- onScopeDispose(() => {
1974
- var _this$dispose;
1975
- (_this$dispose = this.dispose) === null || _this$dispose === void 0 || _this$dispose.call(this);
1976
- this.dispose = void 0;
1977
- }, true);
1978
2151
  }
1979
2152
  disconnectedCallback() {
1980
- var _this$dispose2;
1981
- (_this$dispose2 = this.dispose) === null || _this$dispose2 === void 0 || _this$dispose2.call(this);
2153
+ var _this$dispose;
2154
+ (_this$dispose = this.dispose) === null || _this$dispose === void 0 || _this$dispose.call(this);
1982
2155
  this.dispose = void 0;
1983
2156
  }
1984
2157
  attributeChangedCallback(name, oldValue, newValue) {
1985
2158
  if (oldValue === newValue || this.reflecting) return;
1986
2159
  const def = propDefs.find((item) => item.attr === name);
1987
2160
  if (!def) return;
1988
- this.props[def.key] = castAttributeValue(newValue, def);
2161
+ this.propStore.set(def.key, castAttributeValue(newValue, def));
1989
2162
  }
1990
2163
  resolveRenderTarget(shadow) {
1991
2164
  if (this.target) return this.target;
@@ -2000,12 +2173,12 @@ function defineElement(tagName, options, setup) {
2000
2173
  for (const def of defs) {
2001
2174
  if (def.attr === false) continue;
2002
2175
  const value = this.getAttribute(def.attr);
2003
- if (value !== null || def.type === Boolean) this.props[def.key] = castAttributeValue(value, def);
2176
+ if (value !== null || def.type === Boolean) this.propStore.set(def.key, castAttributeValue(value, def));
2004
2177
  }
2005
2178
  }
2006
2179
  _writePropFromProperty(key, value) {
2007
2180
  const def = propDefs.find((item) => item.key === key);
2008
- this.props[key] = value;
2181
+ this.propStore.set(key, value);
2009
2182
  if ((def === null || def === void 0 ? void 0 : def.reflect) && def.attr !== false) {
2010
2183
  this.reflecting = true;
2011
2184
  try {
@@ -2037,26 +2210,35 @@ function normalizePropDefinitions(props) {
2037
2210
  };
2038
2211
  });
2039
2212
  }
2040
- function applyPropDefaults(props, defs) {
2213
+ function applyPropDefaults(store, defs) {
2041
2214
  for (const def of defs) {
2042
2215
  if (!("default" in def)) continue;
2043
2216
  const value = typeof def.default === "function" ? def.default() : def.default;
2044
- props[def.key] = value;
2217
+ store.set(def.key, value);
2045
2218
  }
2046
2219
  }
2047
- function definePropAccessors(element, props, defs) {
2220
+ function definePropAccessors(element, store, defs) {
2048
2221
  for (const def of defs) {
2049
- if (def.key in element) continue;
2050
- Object.defineProperty(element, def.key, {
2222
+ const key = def.key;
2223
+ const hadOwnValue = Object.prototype.hasOwnProperty.call(element, key);
2224
+ const ownValue = hadOwnValue ? element[key] : void 0;
2225
+ if (hadOwnValue) delete element[key];
2226
+ const existing = Object.getOwnPropertyDescriptor(element, key);
2227
+ if (existing && existing.configurable === false) {
2228
+ console.warn(`[Zeus custom-element] Cannot define prop "${key}" because an own non-configurable property already exists.`);
2229
+ continue;
2230
+ }
2231
+ Object.defineProperty(element, key, {
2051
2232
  configurable: true,
2052
2233
  enumerable: true,
2053
2234
  get() {
2054
- return props[def.key];
2235
+ return store.get(key);
2055
2236
  },
2056
2237
  set(value) {
2057
- element._writePropFromProperty(def.key, value);
2238
+ element._writePropFromProperty(key, value);
2058
2239
  }
2059
2240
  });
2241
+ if (hadOwnValue) element._writePropFromProperty(key, ownValue);
2060
2242
  }
2061
2243
  }
2062
2244
  function castAttributeValue(value, def) {
@@ -2101,7 +2283,7 @@ function toKebabCase(value) {
2101
2283
  return value.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
2102
2284
  }
2103
2285
  //#endregion
2104
- //#region packages/runtime-dom/src/slot.ts
2286
+ //#region packages/core/runtime-dom/src/slot.ts
2105
2287
  function createSlot(name, fallback) {
2106
2288
  const context = getCurrentHostContext();
2107
2289
  if (!context) return createNativeSlot(name, fallback);
@@ -2133,18 +2315,98 @@ function isMeaningfulTextNode(node) {
2133
2315
  return Boolean((_node$textContent = node.textContent) === null || _node$textContent === void 0 ? void 0 : _node$textContent.trim());
2134
2316
  }
2135
2317
  //#endregion
2136
- //#region packages/runtime-dom/src/webComponents.ts
2318
+ //#region packages/core/runtime-dom/src/webComponents.ts
2319
+ const HOST_RESERVED_KEYS = new Set([
2320
+ "children",
2321
+ "ref",
2322
+ "class",
2323
+ "className",
2324
+ "style",
2325
+ "_elements"
2326
+ ]);
2137
2327
  function Host(props) {
2328
+ const context = getCurrentHostContext();
2329
+ if (context) bindHostProps(context.host, props);
2138
2330
  return resolveValue(props.children);
2139
2331
  }
2140
2332
  function Slot(props) {
2141
2333
  return createSlot(props.name, () => resolveValue(props.children));
2142
2334
  }
2335
+ function bindHostProps(host, props) {
2336
+ bindHostRef(host, props);
2337
+ bindHostClass(host, props);
2338
+ bindHostStyle(host, props);
2339
+ bindHostAttributes(host, props);
2340
+ if ("_elements" in props) bindHostElementBindings(host, props);
2341
+ }
2342
+ function bindHostRef(host, props) {
2343
+ if (!("ref" in props)) return;
2344
+ bindRef(host, props.ref);
2345
+ }
2346
+ function bindHostClass(host, props) {
2347
+ if (!("class" in props) && !("className" in props)) return;
2348
+ const value = props.className !== void 0 ? props.className : props.class;
2349
+ bindClass(host, () => {
2350
+ return resolveHostValue(value);
2351
+ });
2352
+ }
2353
+ function bindHostStyle(host, props) {
2354
+ if (!("style" in props)) return;
2355
+ bindStyle(host, () => {
2356
+ return resolveHostValue(props.style);
2357
+ });
2358
+ }
2359
+ function bindHostAttributes(host, props) {
2360
+ for (const key of Object.keys(props)) {
2361
+ if (HOST_RESERVED_KEYS.has(key)) continue;
2362
+ if (isEventLikeProp(key)) continue;
2363
+ const value = props[key];
2364
+ bindAttr(host, normalizeHostAttrName(key), () => {
2365
+ return resolveHostValue(value);
2366
+ });
2367
+ }
2368
+ }
2369
+ function bindHostElementBindings(host, props) {
2370
+ const elements = props._elements;
2371
+ for (const _key of Object.keys(elements)) {
2372
+ const getEl = elements[_key];
2373
+ const el = getEl();
2374
+ if (!el) continue;
2375
+ for (const attrKey of Object.keys(props)) {
2376
+ if (HOST_RESERVED_KEYS.has(attrKey)) continue;
2377
+ if (isEventLikeProp(attrKey)) continue;
2378
+ const value = props[attrKey];
2379
+ bindAttr(el, normalizeHostAttrName(attrKey), () => {
2380
+ return resolveHostValue(value);
2381
+ });
2382
+ }
2383
+ }
2384
+ }
2385
+ function resolveHostValue(value) {
2386
+ if (typeof value === "function") return value();
2387
+ return value;
2388
+ }
2143
2389
  function resolveValue(value) {
2144
2390
  return typeof value === "function" ? value() : value;
2145
2391
  }
2392
+ function isEventLikeProp(key) {
2393
+ /**
2394
+ * Host Phase 1 does not bind event listeners.
2395
+ * Keep event handling inside component template + emit().
2396
+ */
2397
+ return /^on[A-Z]/.test(key) || key.startsWith("on:");
2398
+ }
2399
+ function normalizeHostAttrName(name) {
2400
+ switch (name) {
2401
+ case "className": return "class";
2402
+ case "htmlFor": return "for";
2403
+ case "tabIndex": return "tabindex";
2404
+ case "readOnly": return "readonly";
2405
+ default: return name;
2406
+ }
2407
+ }
2146
2408
  //#endregion
2147
- //#region packages/zeus/src/jsx-runtime.ts
2409
+ //#region packages/core/zeus/src/jsx-runtime.ts
2148
2410
  const Fragment = Symbol.for("zeus.fragment");
2149
2411
  function jsx(type, props) {
2150
2412
  return createJSXNode(type, props);
@@ -2156,6 +2418,7 @@ function jsxDEV(type, props) {
2156
2418
  return createJSXNode(type, props);
2157
2419
  }
2158
2420
  function createJSXNode(type, props) {
2421
+ if (type === Fragment) return props === null || props === void 0 ? void 0 : props.children;
2159
2422
  if (typeof type === "function") return createComponent(type, props !== null && props !== void 0 ? props : {});
2160
2423
  if (typeof type !== "string") return null;
2161
2424
  const el = document.createElement(type);
@@ -2166,6 +2429,11 @@ function createJSXNode(type, props) {
2166
2429
  const value = props[key];
2167
2430
  if (key.startsWith("on") && typeof value === "function") el.addEventListener(key.slice(2).toLowerCase(), value);
2168
2431
  else if (key === "ref") setFallbackRef(value, el);
2432
+ else if (key.startsWith("prop:")) {
2433
+ const propName = key.slice(5);
2434
+ if (typeof value === "function") bindProp(el, propName, value);
2435
+ else el[propName] = value;
2436
+ } else if (typeof value === "function") bindAttr(el, key, value);
2169
2437
  else if (value != null && value !== false) el.setAttribute(key === "className" ? "class" : key, String(value));
2170
2438
  }
2171
2439
  if (children !== void 0) insert(el, children);