@vertz/ui 0.2.11 → 0.2.12

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.
@@ -6,10 +6,10 @@ import {
6
6
  globalCss,
7
7
  s,
8
8
  variants
9
- } from "../shared/chunk-qacth5ah.js";
10
- import"../shared/chunk-ryb49346.js";
9
+ } from "../shared/chunk-kg898f92.js";
10
+ import"../shared/chunk-662f9zrb.js";
11
11
  import"../shared/chunk-g4rch80a.js";
12
- import"../shared/chunk-hrd0mft1.js";
12
+ import"../shared/chunk-2rs8a26p.js";
13
13
  import"../shared/chunk-prj7nm08.js";
14
14
  export {
15
15
  variants,
@@ -3,8 +3,8 @@ import {
3
3
  form,
4
4
  formDataToObject,
5
5
  validate
6
- } from "../shared/chunk-q6cpe5k7.js";
7
- import"../shared/chunk-hrd0mft1.js";
6
+ } from "../shared/chunk-55tgkc7s.js";
7
+ import"../shared/chunk-2rs8a26p.js";
8
8
  export {
9
9
  validate,
10
10
  formDataToObject,
package/dist/index.d.ts CHANGED
@@ -151,7 +151,7 @@ declare function onMount2(callback: () => (() => void) | void): void;
151
151
  interface ListTransitionProps<T> {
152
152
  each: T[];
153
153
  keyFn: (item: T, index: number) => string | number;
154
- children: (item: T) => HTMLElement;
154
+ children: (item: T) => HTMLElement | SVGElement;
155
155
  }
156
156
  /**
157
157
  * ListTransition component for animated list item enter/exit.
@@ -749,7 +749,7 @@ interface MountHandle {
749
749
  * @param options - Mount options (theme, styles, onMount, etc.)
750
750
  * @returns MountHandle with unmount function and root element
751
751
  */
752
- declare function mount<AppFn extends () => Element>(app: AppFn, selector: string | HTMLElement, options?: MountOptions): MountHandle;
752
+ declare function mount<AppFn extends () => Element | DocumentFragment>(app: AppFn, selector: string | HTMLElement, options?: MountOptions): MountHandle;
753
753
  import { QueryDescriptor as QueryDescriptor2 } from "@vertz/fetch";
754
754
  import { isQueryDescriptor } from "@vertz/fetch";
755
755
  /**
@@ -1188,8 +1188,9 @@ declare class DisposalScopeError extends Error {
1188
1188
  declare function batch(fn: () => void): void;
1189
1189
  /**
1190
1190
  * Create a reactive signal with an initial value.
1191
+ * Optional key is used by HMR to match signals by name across re-mounts.
1191
1192
  */
1192
- declare function signal<T>(initial: T): Signal<T>;
1193
+ declare function signal<T>(initial: T, key?: string): Signal<T>;
1193
1194
  /**
1194
1195
  * Create a computed (derived) reactive value.
1195
1196
  * The function is lazily evaluated and cached.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  slideOutToTop,
21
21
  zoomIn,
22
22
  zoomOut
23
- } from "./shared/chunk-n91rwj2r.js";
23
+ } from "./shared/chunk-bjcpcq5j.js";
24
24
  import {
25
25
  Outlet,
26
26
  OutletContext,
@@ -31,11 +31,11 @@ import {
31
31
  useParams,
32
32
  useRouter,
33
33
  useSearchParams
34
- } from "./shared/chunk-0xcmwgdb.js";
35
- import"./shared/chunk-v3yyf79g.js";
34
+ } from "./shared/chunk-18jzqefd.js";
35
+ import"./shared/chunk-wn4gv1qd.js";
36
36
  import {
37
37
  createRouter
38
- } from "./shared/chunk-ka5ked7n.js";
38
+ } from "./shared/chunk-g1gf16fz.js";
39
39
  import {
40
40
  defineRoutes
41
41
  } from "./shared/chunk-9e92w0wt.js";
@@ -44,11 +44,11 @@ import {
44
44
  form,
45
45
  formDataToObject,
46
46
  validate
47
- } from "./shared/chunk-q6cpe5k7.js";
47
+ } from "./shared/chunk-55tgkc7s.js";
48
48
  import {
49
49
  query,
50
50
  queryMatch
51
- } from "./shared/chunk-rjjjvmcf.js";
51
+ } from "./shared/chunk-9k2z3jfx.js";
52
52
  import"./shared/chunk-jrtrk5z4.js";
53
53
  import {
54
54
  ThemeProvider,
@@ -63,7 +63,7 @@ import {
63
63
  resolveChildren,
64
64
  s,
65
65
  variants
66
- } from "./shared/chunk-qacth5ah.js";
66
+ } from "./shared/chunk-kg898f92.js";
67
67
  import {
68
68
  __append,
69
69
  __element,
@@ -72,7 +72,7 @@ import {
72
72
  __staticText,
73
73
  endHydration,
74
74
  startHydration
75
- } from "./shared/chunk-ryb49346.js";
75
+ } from "./shared/chunk-662f9zrb.js";
76
76
  import {
77
77
  RENDER_NODE_BRAND,
78
78
  createDOMAdapter,
@@ -95,7 +95,7 @@ import {
95
95
  signal,
96
96
  untrack,
97
97
  useContext
98
- } from "./shared/chunk-hrd0mft1.js";
98
+ } from "./shared/chunk-2rs8a26p.js";
99
99
  import"./shared/chunk-prj7nm08.js";
100
100
  // src/component/error-boundary-context.ts
101
101
  var handlerStack = [];
@@ -466,7 +466,7 @@ function Suspense(props) {
466
466
  }
467
467
  }
468
468
  // src/dialog/dialog-stack.ts
469
- var DialogStackContext = createContext();
469
+ var DialogStackContext = createContext(undefined, "@vertz/ui::DialogStackContext");
470
470
  function useDialogStack() {
471
471
  const stack = useContext(DialogStackContext);
472
472
  if (!stack) {
@@ -605,6 +605,11 @@ function createDialogStack(container) {
605
605
  }
606
606
  }
607
607
  // src/mount.ts
608
+ var MOUNTED_KEY = Symbol.for("vertz:mounted-roots");
609
+ var _global = globalThis;
610
+ if (!_global[MOUNTED_KEY])
611
+ _global[MOUNTED_KEY] = new WeakMap;
612
+ var mountedRoots = _global[MOUNTED_KEY];
608
613
  function mount(app, selector, options) {
609
614
  if (typeof selector !== "string" && !(selector instanceof HTMLElement)) {
610
615
  throw new Error(`mount(): selector must be a string or HTMLElement, got ${typeof selector}`);
@@ -613,6 +618,9 @@ function mount(app, selector, options) {
613
618
  if (!root) {
614
619
  throw new Error(`mount(): root element "${selector}" not found`);
615
620
  }
621
+ const existingHandle = mountedRoots.get(root);
622
+ if (existingHandle)
623
+ return existingHandle;
616
624
  if (options?.theme) {
617
625
  const { css: css2 } = compileTheme(options.theme);
618
626
  injectCSS(css2);
@@ -630,13 +638,16 @@ function mount(app, selector, options) {
630
638
  endHydration();
631
639
  popScope();
632
640
  options?.onMount?.(root);
633
- return {
641
+ const handle2 = {
634
642
  unmount: () => {
643
+ mountedRoots.delete(root);
635
644
  runCleanups(scope2);
636
645
  root.textContent = "";
637
646
  },
638
647
  root
639
648
  };
649
+ mountedRoots.set(root, handle2);
650
+ return handle2;
640
651
  } catch (e) {
641
652
  endHydration();
642
653
  popScope();
@@ -652,13 +663,16 @@ function mount(app, selector, options) {
652
663
  root.appendChild(appElement);
653
664
  popScope();
654
665
  options?.onMount?.(root);
655
- return {
666
+ const handle = {
656
667
  unmount: () => {
668
+ mountedRoots.delete(root);
657
669
  runCleanups(scope);
658
670
  root.textContent = "";
659
671
  },
660
672
  root
661
673
  };
674
+ mountedRoots.set(root, handle);
675
+ return handle;
662
676
  }
663
677
  // src/store/merge.ts
664
678
  function shallowMerge(existing, incoming) {
@@ -195,7 +195,7 @@ declare function setAdapter(adapter: RenderAdapter | null): void;
195
195
  * If no animations are running, calls back immediately.
196
196
  * Respects prefers-reduced-motion by skipping the wait.
197
197
  */
198
- declare function onAnimationsComplete(el: HTMLElement, callback: () => void): void;
198
+ declare function onAnimationsComplete(el: Element, callback: () => void): void;
199
199
  /**
200
200
  * Create a reactive attribute binding.
201
201
  * When the value returned by `fn` changes, the attribute is updated.
package/dist/internals.js CHANGED
@@ -2,13 +2,13 @@ import {
2
2
  deserializeProps,
3
3
  onAnimationsComplete,
4
4
  resolveComponent
5
- } from "./shared/chunk-n91rwj2r.js";
5
+ } from "./shared/chunk-bjcpcq5j.js";
6
6
  import {
7
7
  __attr,
8
8
  __classList,
9
9
  __on,
10
10
  __show
11
- } from "./shared/chunk-v3yyf79g.js";
11
+ } from "./shared/chunk-wn4gv1qd.js";
12
12
  import {
13
13
  executeLoaders,
14
14
  matchPath,
@@ -17,7 +17,7 @@ import {
17
17
  import {
18
18
  MemoryCache,
19
19
  deriveKey
20
- } from "./shared/chunk-rjjjvmcf.js";
20
+ } from "./shared/chunk-9k2z3jfx.js";
21
21
  import"./shared/chunk-jrtrk5z4.js";
22
22
  import {
23
23
  ALIGNMENT_MAP,
@@ -38,7 +38,7 @@ import {
38
38
  SIZE_KEYWORDS,
39
39
  SPACING_SCALE,
40
40
  compileTheme
41
- } from "./shared/chunk-qacth5ah.js";
41
+ } from "./shared/chunk-kg898f92.js";
42
42
  import {
43
43
  __append,
44
44
  __child,
@@ -51,7 +51,7 @@ import {
51
51
  claimComment,
52
52
  claimText,
53
53
  getIsHydrating
54
- } from "./shared/chunk-ryb49346.js";
54
+ } from "./shared/chunk-662f9zrb.js";
55
55
  import {
56
56
  RENDER_NODE_BRAND,
57
57
  createDOMAdapter,
@@ -72,9 +72,24 @@ import {
72
72
  signal,
73
73
  startSignalCollection,
74
74
  stopSignalCollection
75
- } from "./shared/chunk-hrd0mft1.js";
75
+ } from "./shared/chunk-2rs8a26p.js";
76
76
  import"./shared/chunk-prj7nm08.js";
77
77
  // src/dom/conditional.ts
78
+ function normalizeNode(branchResult) {
79
+ if (branchResult == null || typeof branchResult === "boolean") {
80
+ return getAdapter().createComment("empty");
81
+ }
82
+ if (isRenderNode(branchResult)) {
83
+ if (branchResult.nodeType === 11) {
84
+ const wrap = getAdapter().createElement("span");
85
+ wrap.style.display = "contents";
86
+ wrap.appendChild(branchResult);
87
+ return wrap;
88
+ }
89
+ return branchResult;
90
+ }
91
+ return getAdapter().createTextNode(String(branchResult));
92
+ }
78
93
  function __conditional(condFn, trueFn, falseFn) {
79
94
  if (getIsHydrating()) {
80
95
  return hydrateConditional(condFn, trueFn, falseFn);
@@ -110,14 +125,7 @@ function hydrateConditional(condFn, trueFn, falseFn) {
110
125
  const branchResult = show ? trueFn() : falseFn();
111
126
  popScope();
112
127
  branchCleanups = scope;
113
- let newNode;
114
- if (branchResult == null || typeof branchResult === "boolean") {
115
- newNode = getAdapter().createComment("empty");
116
- } else if (isRenderNode(branchResult)) {
117
- newNode = branchResult;
118
- } else {
119
- newNode = getAdapter().createTextNode(String(branchResult));
120
- }
128
+ const newNode = normalizeNode(branchResult);
121
129
  if (currentNode?.parentNode) {
122
130
  currentNode.parentNode.replaceChild(newNode, currentNode);
123
131
  } else if (anchor.parentNode) {
@@ -148,14 +156,7 @@ function csrConditional(condFn, trueFn, falseFn) {
148
156
  const branchResult = show ? trueFn() : falseFn();
149
157
  popScope();
150
158
  branchCleanups = scope;
151
- let newNode;
152
- if (branchResult == null || typeof branchResult === "boolean") {
153
- newNode = getAdapter().createComment("empty");
154
- } else if (isRenderNode(branchResult)) {
155
- newNode = branchResult;
156
- } else {
157
- newNode = getAdapter().createTextNode(String(branchResult));
158
- }
159
+ const newNode = normalizeNode(branchResult);
159
160
  if (currentNode?.parentNode) {
160
161
  currentNode.parentNode.replaceChild(newNode, currentNode);
161
162
  } else if (anchor.parentNode) {
@@ -3,7 +3,7 @@
3
3
  * to understand intrinsic element types and component types.
4
4
  */
5
5
  declare namespace JSX {
6
- type Element = HTMLElement | SVGElement;
6
+ type Element = HTMLElement | SVGElement | DocumentFragment;
7
7
  type JSXComponent = (props: Record<string, unknown>) => Element;
8
8
  interface HTMLAttributes {
9
9
  [key: string]: unknown;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  query,
3
3
  queryMatch
4
- } from "../shared/chunk-rjjjvmcf.js";
4
+ } from "../shared/chunk-9k2z3jfx.js";
5
5
  import"../shared/chunk-jrtrk5z4.js";
6
6
  import"../shared/chunk-g4rch80a.js";
7
- import"../shared/chunk-hrd0mft1.js";
7
+ import"../shared/chunk-2rs8a26p.js";
8
8
 
9
9
  // src/query/public.ts
10
10
  import { isQueryDescriptor } from "@vertz/fetch";
@@ -8,18 +8,18 @@ import {
8
8
  useParams,
9
9
  useRouter,
10
10
  useSearchParams
11
- } from "../shared/chunk-0xcmwgdb.js";
12
- import"../shared/chunk-v3yyf79g.js";
11
+ } from "../shared/chunk-18jzqefd.js";
12
+ import"../shared/chunk-wn4gv1qd.js";
13
13
  import {
14
14
  createRouter
15
- } from "../shared/chunk-ka5ked7n.js";
15
+ } from "../shared/chunk-g1gf16fz.js";
16
16
  import {
17
17
  defineRoutes
18
18
  } from "../shared/chunk-9e92w0wt.js";
19
19
  import"../shared/chunk-jrtrk5z4.js";
20
- import"../shared/chunk-ryb49346.js";
20
+ import"../shared/chunk-662f9zrb.js";
21
21
  import"../shared/chunk-g4rch80a.js";
22
- import"../shared/chunk-hrd0mft1.js";
22
+ import"../shared/chunk-2rs8a26p.js";
23
23
  import"../shared/chunk-prj7nm08.js";
24
24
  export {
25
25
  useSearchParams,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __classList,
3
3
  __on
4
- } from "./chunk-v3yyf79g.js";
4
+ } from "./chunk-wn4gv1qd.js";
5
5
  import {
6
6
  __append,
7
7
  __element,
@@ -9,7 +9,7 @@ import {
9
9
  __exitChildren,
10
10
  __staticText,
11
11
  getIsHydrating
12
- } from "./chunk-ryb49346.js";
12
+ } from "./chunk-662f9zrb.js";
13
13
  import {
14
14
  _tryOnCleanup,
15
15
  createContext,
@@ -20,7 +20,7 @@ import {
20
20
  signal,
21
21
  untrack,
22
22
  useContext
23
- } from "./chunk-hrd0mft1.js";
23
+ } from "./chunk-2rs8a26p.js";
24
24
 
25
25
  // src/router/link.ts
26
26
  var DANGEROUS_SCHEMES = ["javascript:", "data:", "vbscript:"];
@@ -90,7 +90,7 @@ function createLink(currentPath, navigate, factoryOptions) {
90
90
  }
91
91
 
92
92
  // src/router/router-context.ts
93
- var RouterContext = createContext();
93
+ var RouterContext = createContext(undefined, "@vertz/ui::RouterContext");
94
94
  function useRouter() {
95
95
  const router = useContext(RouterContext);
96
96
  if (!router) {
@@ -107,7 +107,7 @@ function useParams() {
107
107
  }
108
108
 
109
109
  // src/router/outlet.ts
110
- var OutletContext = createContext();
110
+ var OutletContext = createContext(undefined, "@vertz/ui::OutletContext");
111
111
  function Outlet() {
112
112
  const ctx = useContext(OutletContext);
113
113
  if (!ctx) {
@@ -220,7 +220,11 @@ function isSSR() {
220
220
  const check = typeof globalThis !== "undefined" && globalThis.__VERTZ_IS_SSR__;
221
221
  return typeof check === "function" ? check() : false;
222
222
  }
223
- var signalCollectorStack = [];
223
+ var COLLECTOR_KEY = Symbol.for("vertz:signal-collector-stack");
224
+ var _global = globalThis;
225
+ if (!_global[COLLECTOR_KEY])
226
+ _global[COLLECTOR_KEY] = [];
227
+ var signalCollectorStack = _global[COLLECTOR_KEY];
224
228
  function startSignalCollection() {
225
229
  signalCollectorStack.push([]);
226
230
  }
@@ -232,8 +236,10 @@ var nextId = 0;
232
236
  class SignalImpl {
233
237
  _value;
234
238
  _subscribers = new Set;
235
- constructor(initial) {
239
+ _hmrKey;
240
+ constructor(initial, key) {
236
241
  this._value = initial;
242
+ this._hmrKey = key;
237
243
  }
238
244
  get value() {
239
245
  const sub = getSubscriber();
@@ -267,8 +273,8 @@ class SignalImpl {
267
273
  });
268
274
  }
269
275
  }
270
- function signal(initial) {
271
- const s = new SignalImpl(initial);
276
+ function signal(initial, key) {
277
+ const s = new SignalImpl(initial, key);
272
278
  const collector = signalCollectorStack[signalCollectorStack.length - 1];
273
279
  if (collector) {
274
280
  collector.push(s);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  computed,
3
3
  signal
4
- } from "./chunk-hrd0mft1.js";
4
+ } from "./chunk-2rs8a26p.js";
5
5
 
6
6
  // src/form/field-state.ts
7
7
  function createFieldState(_name, initialValue) {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-g4rch80a.js";
5
5
  import {
6
6
  domEffect
7
- } from "./chunk-hrd0mft1.js";
7
+ } from "./chunk-2rs8a26p.js";
8
8
  import {
9
9
  SVG_NS,
10
10
  isSVGTag,
@@ -16,7 +16,7 @@ import {
16
16
  setReadValueCallback,
17
17
  signal,
18
18
  untrack
19
- } from "./chunk-hrd0mft1.js";
19
+ } from "./chunk-2rs8a26p.js";
20
20
 
21
21
  // src/query/cache.ts
22
22
  class MemoryCache {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  injectCSS
3
- } from "./chunk-qacth5ah.js";
3
+ } from "./chunk-kg898f92.js";
4
4
 
5
5
  // src/dom/animation.ts
6
6
  function onAnimationsComplete(el, callback) {
@@ -8,7 +8,9 @@ function onAnimationsComplete(el, callback) {
8
8
  callback();
9
9
  return;
10
10
  }
11
- el.offsetHeight;
11
+ if ("offsetHeight" in el) {
12
+ el.offsetHeight;
13
+ }
12
14
  if (typeof el.getAnimations === "function") {
13
15
  const animations = el.getAnimations();
14
16
  if (animations.length > 0) {
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-jrtrk5z4.js";
8
8
  import {
9
9
  signal
10
- } from "./chunk-hrd0mft1.js";
10
+ } from "./chunk-2rs8a26p.js";
11
11
 
12
12
  // src/router/navigate.ts
13
13
  var DEFAULT_NAV_THRESHOLD_MS = 500;
@@ -3,7 +3,7 @@ import {
3
3
  __element,
4
4
  __enterChildren,
5
5
  __exitChildren
6
- } from "./chunk-ryb49346.js";
6
+ } from "./chunk-662f9zrb.js";
7
7
 
8
8
  // src/component/children.ts
9
9
  var MAX_RESOLVE_DEPTH = 100;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  domEffect
3
- } from "./chunk-hrd0mft1.js";
3
+ } from "./chunk-2rs8a26p.js";
4
4
 
5
5
  // src/dom/attributes.ts
6
6
  function __attr(el, name, fn) {
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  createRouter
3
- } from "../shared/chunk-ka5ked7n.js";
3
+ } from "../shared/chunk-g1gf16fz.js";
4
4
  import {
5
5
  defineRoutes
6
6
  } from "../shared/chunk-9e92w0wt.js";
7
7
  import"../shared/chunk-jrtrk5z4.js";
8
- import"../shared/chunk-hrd0mft1.js";
8
+ import"../shared/chunk-2rs8a26p.js";
9
9
 
10
10
  // src/test/interactions.ts
11
11
  async function click(el) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vertz UI framework — signals, components, JSX runtime",