@vertz/ui 0.2.41 → 0.2.43

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,6 +1,6 @@
1
1
  import {
2
2
  injectCSS
3
- } from "./chunk-3n9teyam.js";
3
+ } from "./chunk-hgtmh07c.js";
4
4
  import {
5
5
  createContext
6
6
  } from "./chunk-2k26a794.js";
@@ -23,11 +23,13 @@ import {
23
23
  createContext,
24
24
  domEffect,
25
25
  endHydration,
26
+ getContextScope,
26
27
  getIsHydrating,
27
28
  getSSRContext,
28
29
  popScope,
29
30
  pushScope,
30
31
  runCleanups,
32
+ setContextScope,
31
33
  signal,
32
34
  startHydration,
33
35
  untrack,
@@ -221,6 +223,7 @@ function Outlet() {
221
223
  const gen = ++renderGen;
222
224
  childCleanups = pushScope();
223
225
  if (factory) {
226
+ const capturedScope = getContextScope();
224
227
  const result = factory();
225
228
  if (result instanceof Promise) {
226
229
  const router = ctx.router;
@@ -230,6 +233,7 @@ function Outlet() {
230
233
  return;
231
234
  let node;
232
235
  childCleanups = pushScope();
236
+ const prevScope = setContextScope(capturedScope);
233
237
  try {
234
238
  if (wasHydrating) {
235
239
  beginDeferringMounts();
@@ -265,9 +269,10 @@ function Outlet() {
265
269
  });
266
270
  }
267
271
  } finally {
272
+ setContextScope(prevScope);
268
273
  popScope();
269
274
  }
270
- });
275
+ }).catch(() => {});
271
276
  } else {
272
277
  __append(container, result);
273
278
  if (getIsHydrating() && !container.contains(result)) {
@@ -354,6 +359,7 @@ function RouterView({ router, fallback, errorFallback }) {
354
359
  const lazyFallback = match ? match.route.errorComponent ?? errorFallback : undefined;
355
360
  let asyncRoute = false;
356
361
  RouterContext.Provider(router, () => {
362
+ const capturedScope = getContextScope();
357
363
  const result = rootFactory();
358
364
  if (result instanceof Promise) {
359
365
  asyncRoute = true;
@@ -363,6 +369,7 @@ function RouterView({ router, fallback, errorFallback }) {
363
369
  return;
364
370
  let node;
365
371
  pageCleanups = pushScope();
372
+ const prevScope = setContextScope(capturedScope);
366
373
  try {
367
374
  if (wasHydrating) {
368
375
  beginDeferringMounts();
@@ -419,8 +426,24 @@ function RouterView({ router, fallback, errorFallback }) {
419
426
  throw thrown;
420
427
  }
421
428
  } finally {
429
+ setContextScope(prevScope);
422
430
  popScope();
423
431
  }
432
+ }).catch((thrown) => {
433
+ if (gen !== renderGen)
434
+ return;
435
+ if (lazyFallback) {
436
+ pageCleanups = pushScope();
437
+ try {
438
+ const error = thrown instanceof Error ? thrown : new Error(String(thrown));
439
+ while (container.firstChild) {
440
+ container.removeChild(container.firstChild);
441
+ }
442
+ container.appendChild(lazyFallback({ error, retry: () => {} }));
443
+ } finally {
444
+ popScope();
445
+ }
446
+ }
424
447
  });
425
448
  } else {
426
449
  if (gen !== renderGen) {
@@ -88,6 +88,12 @@ var PROPERTY_MAP = {
88
88
  overflow: { properties: ["overflow"], valueType: "raw" },
89
89
  "overflow-x": { properties: ["overflow-x"], valueType: "raw" },
90
90
  "overflow-y": { properties: ["overflow-y"], valueType: "raw" },
91
+ top: { properties: ["top"], valueType: "raw" },
92
+ right: { properties: ["right"], valueType: "raw" },
93
+ bottom: { properties: ["bottom"], valueType: "raw" },
94
+ left: { properties: ["left"], valueType: "raw" },
95
+ object: { properties: ["object-fit"], valueType: "raw" },
96
+ aspect: { properties: ["aspect-ratio"], valueType: "raw" },
91
97
  cursor: { properties: ["cursor"], valueType: "raw" },
92
98
  transition: { properties: ["transition"], valueType: "raw" },
93
99
  resize: { properties: ["resize"], valueType: "raw" },
@@ -655,12 +661,20 @@ function resolveRaw(value, property) {
655
661
  return `repeat(${num}, minmax(0, 1fr))`;
656
662
  return value;
657
663
  }
658
- if (property === "inset") {
664
+ if (property === "inset" || property === "top" || property === "right" || property === "bottom" || property === "left") {
659
665
  const spaced = SPACING_SCALE[value];
660
666
  if (spaced !== undefined)
661
667
  return spaced;
662
668
  return value;
663
669
  }
670
+ if (property === "aspect") {
671
+ const ASPECT_MAP = {
672
+ square: "1 / 1",
673
+ video: "16 / 9",
674
+ photo: "4 / 3"
675
+ };
676
+ return ASPECT_MAP[value] ?? value;
677
+ }
664
678
  return value;
665
679
  }
666
680
  function formatShorthand(parsed) {
@@ -9,7 +9,7 @@ import {
9
9
  googleFont,
10
10
  s,
11
11
  variants
12
- } from "../../shared/chunk-3n9teyam.js";
12
+ } from "../../shared/chunk-hgtmh07c.js";
13
13
  import"../../shared/chunk-29x7mbne.js";
14
14
  import"../../shared/chunk-h1fsr8kv.js";
15
15
  import"../../shared/chunk-2k26a794.js";
package/dist/src/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  slideOutToTop,
26
26
  zoomIn,
27
27
  zoomOut
28
- } from "../shared/chunk-bmcthk92.js";
28
+ } from "../shared/chunk-96hnx5jk.js";
29
29
  import {
30
30
  ErrorBoundary,
31
31
  Link,
@@ -36,7 +36,7 @@ import {
36
36
  getCurrentErrorHandler,
37
37
  parseSearchParams,
38
38
  useSearchParams
39
- } from "../shared/chunk-sb69h6ns.js";
39
+ } from "../shared/chunk-abv8ax3j.js";
40
40
  import {
41
41
  beginDeferringMounts,
42
42
  discardDeferredMounts,
@@ -83,7 +83,7 @@ import {
83
83
  resolveChildren,
84
84
  s,
85
85
  variants
86
- } from "../shared/chunk-3n9teyam.js";
86
+ } from "../shared/chunk-hgtmh07c.js";
87
87
  import {
88
88
  RENDER_NODE_BRAND,
89
89
  __append,
@@ -558,12 +558,17 @@ declare function __listValue<T>(items: Signal<T[]> | (() => T[]), keyFn: ((item:
558
558
  *
559
559
  * Compiler output target for JSX spread attributes on intrinsic elements:
560
560
  * <button {...rest} /> → __spread(el, rest)
561
+ * <button {...rest} /> → __spread(el, rest, __props) (inside components)
562
+ *
563
+ * When `source` is provided (the original __props with getter descriptors),
564
+ * keys that have getters on source get reactive effects (like __attr/__prop).
565
+ * Keys without getters are set one-shot from the `props` rest object.
561
566
  *
562
567
  * Handles event handlers (on*), ref, style, class/className, htmlFor,
563
568
  * SVG attribute normalization, and standard HTML attributes.
564
569
  * Uses replace (not merge) semantics — last-wins, matching source order.
565
570
  */
566
- declare function __spread(el: Element, props: Record<string, unknown>): void;
571
+ declare function __spread(el: Element, props: Record<string, unknown>, source?: Record<string, unknown>): void;
567
572
  declare function styleObjectToString(style: Record<string, string | number | null | undefined>): string;
568
573
  /**
569
574
  * Returns true when running in a real browser environment.
@@ -1143,13 +1148,13 @@ interface SSRRenderContext {
1143
1148
  matchedRoutePatterns?: string[];
1144
1149
  /**
1145
1150
  * Auth state resolved by the server (e.g. from session cookie).
1146
- * Set by ssrRenderToString() before Pass 1 so AuthProvider can
1151
+ * Set by the SSR pipeline before discovery so AuthProvider can
1147
1152
  * hydrate status/user synchronously during SSR.
1148
1153
  */
1149
1154
  ssrAuth?: SSRAuth;
1150
1155
  /**
1151
- * Written by ProtectedRoute during Pass 1 when the user is not
1152
- * authenticated. Signals ssrRenderToString() to skip Pass 2 and
1156
+ * Written by ProtectedRoute during discovery when the user is not
1157
+ * authenticated. Signals the SSR pipeline to skip rendering and
1153
1158
  * return a redirect response instead.
1154
1159
  */
1155
1160
  ssrRedirect?: {
@@ -1162,6 +1167,12 @@ interface SSRRenderContext {
1162
1167
  * response only includes CSS for components actually rendered.
1163
1168
  */
1164
1169
  cssTracker?: Set<string>;
1170
+ /**
1171
+ * Request cookies (from the `Cookie` header).
1172
+ * Set by the SSR handler before rendering so that `document.cookie`
1173
+ * reads the real request cookies during SSR — same as in a browser.
1174
+ */
1175
+ cookies?: string;
1165
1176
  }
1166
1177
  /** Auth state injected into SSRRenderContext by the server. */
1167
1178
  type SSRAuth = ({
@@ -3,7 +3,7 @@ import {
3
3
  deserializeProps,
4
4
  onAnimationsComplete,
5
5
  resolveComponent
6
- } from "../shared/chunk-bmcthk92.js";
6
+ } from "../shared/chunk-96hnx5jk.js";
7
7
  import {
8
8
  __discardMountFrame,
9
9
  __flushMountFrame,
@@ -41,7 +41,7 @@ import {
41
41
  SIZE_KEYWORDS,
42
42
  SPACING_SCALE,
43
43
  compileTheme
44
- } from "../shared/chunk-3n9teyam.js";
44
+ } from "../shared/chunk-hgtmh07c.js";
45
45
  import {
46
46
  RENDER_NODE_BRAND,
47
47
  __append,
@@ -74,6 +74,7 @@ import {
74
74
  _tryOnCleanup,
75
75
  claimComment,
76
76
  claimText,
77
+ deferredDomEffect,
77
78
  domEffect,
78
79
  getContextScope,
79
80
  getIsHydrating,
@@ -609,7 +610,12 @@ var PROP_ALIASES = {
609
610
  className: "class",
610
611
  htmlFor: "for"
611
612
  };
612
- function __spread(el, props) {
613
+ var IDL_PROPS = {
614
+ INPUT: new Set(["value", "checked"]),
615
+ SELECT: new Set(["value"]),
616
+ TEXTAREA: new Set(["value"])
617
+ };
618
+ function __spread(el, props, source) {
613
619
  const isSvg = el.namespaceURI === SVG_NS;
614
620
  for (const key of Object.keys(props)) {
615
621
  if (SKIP_KEYS.has(key))
@@ -626,8 +632,47 @@ function __spread(el, props) {
626
632
  el.addEventListener(eventName, value);
627
633
  continue;
628
634
  }
629
- if (value == null || value === false)
635
+ const descriptor = source && Object.getOwnPropertyDescriptor(source, key);
636
+ if (descriptor?.get) {
637
+ const getter = descriptor.get;
638
+ const isIdl = IDL_PROPS[el.tagName]?.has(key);
639
+ if (isIdl) {
640
+ deferredDomEffect(() => {
641
+ const v = getter();
642
+ if (v == null) {
643
+ Reflect.set(el, key, typeof Reflect.get(el, key) === "boolean" ? false : "");
644
+ } else {
645
+ Reflect.set(el, key, v);
646
+ }
647
+ });
648
+ } else {
649
+ const attrName2 = PROP_ALIASES[key] ?? key;
650
+ const finalName2 = isSvg ? normalizeSVGAttr(attrName2) : attrName2;
651
+ deferredDomEffect(() => {
652
+ const v = getter();
653
+ if (v == null || v === false) {
654
+ el.removeAttribute(finalName2);
655
+ } else if (v === true) {
656
+ el.setAttribute(finalName2, "");
657
+ } else if (finalName2 === "style" && typeof v === "object") {
658
+ el.setAttribute("style", styleObjectToString(v));
659
+ } else {
660
+ el.setAttribute(finalName2, String(v));
661
+ }
662
+ });
663
+ }
630
664
  continue;
665
+ }
666
+ if (value == null || value === false) {
667
+ if (value === false && IDL_PROPS[el.tagName]?.has(key)) {
668
+ Reflect.set(el, key, false);
669
+ }
670
+ continue;
671
+ }
672
+ if (IDL_PROPS[el.tagName]?.has(key)) {
673
+ Reflect.set(el, key, value);
674
+ continue;
675
+ }
631
676
  const attrName = PROP_ALIASES[key] ?? key;
632
677
  if (attrName === "style") {
633
678
  if (typeof value === "object") {
@@ -6,7 +6,7 @@ import {
6
6
  createLink,
7
7
  parseSearchParams,
8
8
  useSearchParams
9
- } from "../../shared/chunk-sb69h6ns.js";
9
+ } from "../../shared/chunk-abv8ax3j.js";
10
10
  import"../../shared/chunk-pbw64893.js";
11
11
  import {
12
12
  createRouter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui",
3
- "version": "0.2.41",
3
+ "version": "0.2.43",
4
4
  "description": "Vertz UI framework — signals, components, JSX runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -77,11 +77,11 @@
77
77
  "typecheck": "tsc --noEmit"
78
78
  },
79
79
  "dependencies": {
80
- "@vertz/fetch": "^0.2.39"
80
+ "@vertz/fetch": "^0.2.41"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@happy-dom/global-registrator": "^20.7.0",
84
- "@vertz/schema": "^0.2.39",
84
+ "@vertz/schema": "^0.2.41",
85
85
  "bunup": "^0.16.31",
86
86
  "happy-dom": "^20.7.0",
87
87
  "typescript": "^5.7.0"