@vertz/ui 0.2.21 → 0.2.23

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.
@@ -2,13 +2,17 @@ import {
2
2
  deserializeProps,
3
3
  onAnimationsComplete,
4
4
  resolveComponent
5
- } from "../shared/chunk-pdqr78k9.js";
5
+ } from "../shared/chunk-p3fz6qqp.js";
6
6
  import {
7
7
  __attr,
8
8
  __classList,
9
+ __discardMountFrame,
10
+ __flushMountFrame,
9
11
  __on,
12
+ __prop,
13
+ __pushMountFrame,
10
14
  __show
11
- } from "../shared/chunk-kjwp5q5s.js";
15
+ } from "../shared/chunk-2kyhn86t.js";
12
16
  import {
13
17
  styleObjectToString
14
18
  } from "../shared/chunk-4xkw6h1s.js";
@@ -22,7 +26,7 @@ import {
22
26
  MemoryCache,
23
27
  QueryEnvelopeStore,
24
28
  deriveKey
25
- } from "../shared/chunk-szk0hyjg.js";
29
+ } from "../shared/chunk-g6fb5yc2.js";
26
30
  import"../shared/chunk-jrtrk5z4.js";
27
31
  import {
28
32
  ALIGNMENT_MAP,
@@ -43,7 +47,7 @@ import {
43
47
  SIZE_KEYWORDS,
44
48
  SPACING_SCALE,
45
49
  compileTheme
46
- } from "../shared/chunk-pq8khh47.js";
50
+ } from "../shared/chunk-xhc7arn9.js";
47
51
  import {
48
52
  __append,
49
53
  __child,
@@ -53,7 +57,7 @@ import {
53
57
  __insert,
54
58
  __staticText,
55
59
  __text
56
- } from "../shared/chunk-vwz86vg9.js";
60
+ } from "../shared/chunk-13tvh4wq.js";
57
61
  import"../shared/chunk-prj7nm08.js";
58
62
  import {
59
63
  RENDER_NODE_BRAND,
@@ -61,10 +65,10 @@ import {
61
65
  getAdapter,
62
66
  isRenderNode,
63
67
  setAdapter
64
- } from "../shared/chunk-c61572xp.js";
68
+ } from "../shared/chunk-2y9f9j62.js";
65
69
  import {
66
70
  isBrowser
67
- } from "../shared/chunk-bybgyjye.js";
71
+ } from "../shared/chunk-da2w7j7w.js";
68
72
  import {
69
73
  _tryOnCleanup,
70
74
  claimComment,
@@ -84,7 +88,7 @@ import {
84
88
  signal,
85
89
  startSignalCollection,
86
90
  stopSignalCollection
87
- } from "../shared/chunk-2qe6aqhb.js";
91
+ } from "../shared/chunk-656n0x6y.js";
88
92
  // src/dom/conditional.ts
89
93
  function normalizeNode(branchResult) {
90
94
  if (branchResult == null || typeof branchResult === "boolean") {
@@ -108,9 +112,14 @@ function __conditional(condFn, trueFn, falseFn) {
108
112
  return csrConditional(condFn, trueFn, falseFn);
109
113
  }
110
114
  function hydrateConditional(condFn, trueFn, falseFn) {
111
- const anchor = claimComment() ?? getAdapter().createComment("conditional");
115
+ const claimed = claimComment();
116
+ if (!claimed) {
117
+ return csrConditional(condFn, trueFn, falseFn);
118
+ }
119
+ const anchor = claimed;
112
120
  let currentNode = null;
113
121
  let branchCleanups = [];
122
+ let resultNode = anchor;
114
123
  const outerScope = pushScope();
115
124
  let isFirstRun = true;
116
125
  domEffect(() => {
@@ -121,13 +130,29 @@ function hydrateConditional(condFn, trueFn, falseFn) {
121
130
  const branchResult2 = show ? trueFn() : falseFn();
122
131
  popScope();
123
132
  branchCleanups = scope2;
133
+ let contentNode = null;
124
134
  if (branchResult2 == null || typeof branchResult2 === "boolean") {
125
- currentNode = getAdapter().createComment("empty");
135
+ contentNode = null;
126
136
  } else if (isRenderNode(branchResult2)) {
127
- currentNode = branchResult2;
137
+ contentNode = branchResult2;
138
+ } else {
139
+ const claimed2 = claimText();
140
+ contentNode = claimed2 ?? getAdapter().createTextNode(String(branchResult2));
141
+ }
142
+ const anchorParent = anchor.parentNode;
143
+ if (anchorParent) {
144
+ const wrap = getAdapter().createElement("span");
145
+ wrap.style.display = "contents";
146
+ anchorParent.insertBefore(wrap, anchor);
147
+ wrap.appendChild(anchor);
148
+ if (contentNode?.parentNode && contentNode.parentNode !== wrap) {
149
+ wrap.appendChild(contentNode);
150
+ }
151
+ currentNode = wrap;
152
+ resultNode = wrap;
128
153
  } else {
129
- const claimed = claimText();
130
- currentNode = claimed ?? getAdapter().createTextNode(String(branchResult2));
154
+ currentNode = contentNode ?? getAdapter().createComment("empty");
155
+ resultNode = currentNode;
131
156
  }
132
157
  return;
133
158
  }
@@ -145,13 +170,13 @@ function hydrateConditional(condFn, trueFn, falseFn) {
145
170
  currentNode = newNode;
146
171
  });
147
172
  popScope();
148
- const wrapper = () => {
173
+ const disposeFn = () => {
149
174
  runCleanups(branchCleanups);
150
175
  runCleanups(outerScope);
151
176
  };
152
- _tryOnCleanup(wrapper);
153
- const result = Object.assign(anchor, {
154
- dispose: wrapper
177
+ _tryOnCleanup(disposeFn);
178
+ const result = Object.assign(resultNode, {
179
+ dispose: disposeFn
155
180
  });
156
181
  return result;
157
182
  }
@@ -203,10 +228,11 @@ function clearChildren(container) {
203
228
  }
204
229
  // src/dom/list.ts
205
230
  function createItemProxy(itemSignal) {
206
- if (typeof itemSignal.peek() !== "object" || itemSignal.peek() == null) {
207
- return itemSignal.peek();
231
+ const initial = itemSignal.peek();
232
+ if (typeof initial !== "object" || initial == null) {
233
+ return initial;
208
234
  }
209
- return new Proxy({}, {
235
+ return new Proxy(initial, {
210
236
  get(_target, prop, receiver) {
211
237
  const current = itemSignal.value;
212
238
  if (current == null)
@@ -217,6 +243,9 @@ function createItemProxy(itemSignal) {
217
243
  }
218
244
  return value;
219
245
  },
246
+ set() {
247
+ return false;
248
+ },
220
249
  has(_target, prop) {
221
250
  const current = itemSignal.value;
222
251
  if (current == null)
@@ -234,6 +263,12 @@ function createItemProxy(itemSignal) {
234
263
  if (current == null)
235
264
  return;
236
265
  return Reflect.getOwnPropertyDescriptor(current, prop);
266
+ },
267
+ getPrototypeOf() {
268
+ const current = itemSignal.value;
269
+ if (current == null)
270
+ return null;
271
+ return Object.getPrototypeOf(current);
237
272
  }
238
273
  });
239
274
  }
@@ -243,6 +278,7 @@ function __list(container, items, keyFn, renderFn) {
243
278
  const scopeMap = new Map;
244
279
  const itemSignalMap = new Map;
245
280
  const isHydrationRun = getIsHydrating();
281
+ let startOffset = isHydrationRun ? -1 : container.childNodes.length;
246
282
  const outerScope = pushScope();
247
283
  let isFirstRun = true;
248
284
  domEffect(() => {
@@ -260,6 +296,7 @@ function __list(container, items, keyFn, renderFn) {
260
296
  scopeMap.set(key, scope);
261
297
  itemSignalMap.set(key, itemSig);
262
298
  }
299
+ startOffset = container.childNodes.length - nodeMap.size;
263
300
  return;
264
301
  }
265
302
  isFirstRun = false;
@@ -298,11 +335,17 @@ function __list(container, items, keyFn, renderFn) {
298
335
  desiredNodes.push(node);
299
336
  }
300
337
  for (const [i, desiredNode] of desiredNodes.entries()) {
301
- const currentChild = container.childNodes[i];
338
+ const currentChild = container.childNodes[startOffset + i];
302
339
  if (currentChild !== desiredNode) {
303
340
  container.insertBefore(desiredNode, currentChild ?? null);
304
341
  }
305
342
  }
343
+ if (container.tagName === "SELECT") {
344
+ const selected = container.querySelector("option[selected]");
345
+ if (selected) {
346
+ Reflect.set(container, "value", selected.value);
347
+ }
348
+ }
306
349
  });
307
350
  popScope();
308
351
  const wrapper = () => {
@@ -350,12 +393,16 @@ export {
350
393
  styleObjectToString as __styleStr,
351
394
  __staticText,
352
395
  __show,
396
+ __pushMountFrame,
397
+ __prop,
353
398
  __on,
354
399
  __list,
355
400
  __insert,
401
+ __flushMountFrame,
356
402
  __exitChildren,
357
403
  __enterChildren,
358
404
  __element,
405
+ __discardMountFrame,
359
406
  __conditional,
360
407
  __classList,
361
408
  __child,
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  query,
3
3
  queryMatch
4
- } from "../../shared/chunk-szk0hyjg.js";
4
+ } from "../../shared/chunk-g6fb5yc2.js";
5
5
  import"../../shared/chunk-jrtrk5z4.js";
6
- import"../../shared/chunk-c61572xp.js";
7
- import"../../shared/chunk-bybgyjye.js";
8
- import"../../shared/chunk-2qe6aqhb.js";
6
+ import"../../shared/chunk-2y9f9j62.js";
7
+ import"../../shared/chunk-da2w7j7w.js";
8
+ import"../../shared/chunk-656n0x6y.js";
9
9
 
10
10
  // src/query/public.ts
11
11
  import { isQueryDescriptor } from "@vertz/fetch";
@@ -6,26 +6,26 @@ import {
6
6
  createLink,
7
7
  parseSearchParams,
8
8
  useSearchParams
9
- } from "../../shared/chunk-67z8b0q8.js";
10
- import"../../shared/chunk-kjwp5q5s.js";
9
+ } from "../../shared/chunk-016m1fq0.js";
10
+ import"../../shared/chunk-2kyhn86t.js";
11
11
  import"../../shared/chunk-4xkw6h1s.js";
12
12
  import {
13
13
  createRouter
14
- } from "../../shared/chunk-7g722pdh.js";
14
+ } from "../../shared/chunk-jtma4sh4.js";
15
15
  import {
16
16
  defineRoutes
17
17
  } from "../../shared/chunk-am9zaw4h.js";
18
18
  import"../../shared/chunk-jrtrk5z4.js";
19
- import"../../shared/chunk-vwz86vg9.js";
19
+ import"../../shared/chunk-13tvh4wq.js";
20
20
  import"../../shared/chunk-prj7nm08.js";
21
- import"../../shared/chunk-c61572xp.js";
21
+ import"../../shared/chunk-2y9f9j62.js";
22
22
  import {
23
23
  RouterContext,
24
24
  useParams,
25
25
  useRouter
26
- } from "../../shared/chunk-4cmt1ve8.js";
27
- import"../../shared/chunk-bybgyjye.js";
28
- import"../../shared/chunk-2qe6aqhb.js";
26
+ } from "../../shared/chunk-f4d5nphq.js";
27
+ import"../../shared/chunk-da2w7j7w.js";
28
+ import"../../shared/chunk-656n0x6y.js";
29
29
  export {
30
30
  useSearchParams,
31
31
  useRouter,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createRouter
3
- } from "../../shared/chunk-7g722pdh.js";
3
+ } from "../../shared/chunk-jtma4sh4.js";
4
4
  import {
5
5
  defineRoutes
6
6
  } from "../../shared/chunk-am9zaw4h.js";
7
7
  import"../../shared/chunk-jrtrk5z4.js";
8
- import"../../shared/chunk-bybgyjye.js";
9
- import"../../shared/chunk-2qe6aqhb.js";
8
+ import"../../shared/chunk-da2w7j7w.js";
9
+ import"../../shared/chunk-656n0x6y.js";
10
10
 
11
11
  // src/test/interactions.ts
12
12
  async function click(el) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vertz UI framework — signals, components, JSX runtime",
@@ -73,11 +73,11 @@
73
73
  "typecheck": "tsc --noEmit"
74
74
  },
75
75
  "dependencies": {
76
- "@vertz/fetch": "^0.2.20"
76
+ "@vertz/fetch": "^0.2.22"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@happy-dom/global-registrator": "^20.7.0",
80
- "@vertz/schema": "^0.2.20",
80
+ "@vertz/schema": "^0.2.22",
81
81
  "bunup": "^0.16.31",
82
82
  "happy-dom": "^20.7.0",
83
83
  "typescript": "^5.7.0"
@@ -1,53 +0,0 @@
1
- import {
2
- styleObjectToString
3
- } from "./chunk-4xkw6h1s.js";
4
- import {
5
- deferredDomEffect
6
- } from "./chunk-2qe6aqhb.js";
7
-
8
- // src/dom/attributes.ts
9
- function __attr(el, name, fn) {
10
- return deferredDomEffect(() => {
11
- const value = fn();
12
- if (value == null || value === false) {
13
- el.removeAttribute(name);
14
- } else if (value === true) {
15
- el.setAttribute(name, "");
16
- } else if (name === "style" && typeof value === "object") {
17
- el.setAttribute(name, styleObjectToString(value));
18
- } else {
19
- el.setAttribute(name, value);
20
- }
21
- });
22
- }
23
- function __show(el, fn) {
24
- const originalDisplay = el.style.display;
25
- return deferredDomEffect(() => {
26
- el.style.display = fn() ? originalDisplay : "none";
27
- });
28
- }
29
- function __classList(el, classMap) {
30
- const disposers = [];
31
- for (const [className, fn] of Object.entries(classMap)) {
32
- disposers.push(deferredDomEffect(() => {
33
- if (fn()) {
34
- el.classList.add(className);
35
- } else {
36
- el.classList.remove(className);
37
- }
38
- }));
39
- }
40
- return () => {
41
- for (const dispose of disposers) {
42
- dispose();
43
- }
44
- };
45
- }
46
-
47
- // src/dom/events.ts
48
- function __on(el, event, handler) {
49
- el.addEventListener(event, handler);
50
- return () => el.removeEventListener(event, handler);
51
- }
52
-
53
- export { __attr, __show, __classList, __on };