@vertz/ui 0.2.36 → 0.2.38

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
  import {
2
2
  injectCSS
3
- } from "./chunk-zkh9sysw.js";
3
+ } from "./chunk-veqs3jgz.js";
4
4
  import {
5
5
  createContext
6
- } from "./chunk-1yd6jfw5.js";
6
+ } from "./chunk-pmyavtdp.js";
7
7
 
8
8
  // src/dom/animation.ts
9
9
  function onAnimationsComplete(el, callback) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createContext,
3
3
  useContext
4
- } from "./chunk-1yd6jfw5.js";
4
+ } from "./chunk-pmyavtdp.js";
5
5
 
6
6
  // src/router/router-context.ts
7
7
  var RouterContext = createContext(undefined, "@vertz/ui::RouterContext");
@@ -3,7 +3,7 @@ import {
3
3
  beginDeferringMounts,
4
4
  discardDeferredMounts,
5
5
  flushDeferredMounts
6
- } from "./chunk-mntc8w0g.js";
6
+ } from "./chunk-ksetw5t2.js";
7
7
  import {
8
8
  __append,
9
9
  __classList,
@@ -11,13 +11,13 @@ import {
11
11
  __enterChildren,
12
12
  __exitChildren,
13
13
  __staticText
14
- } from "./chunk-dh32wkrv.js";
14
+ } from "./chunk-xz8jq6w6.js";
15
15
  import {
16
16
  RouterContext
17
- } from "./chunk-9p84cvet.js";
17
+ } from "./chunk-4an2s6d7.js";
18
18
  import {
19
19
  isBrowser
20
- } from "./chunk-sjypbv24.js";
20
+ } from "./chunk-g5vzhext.js";
21
21
  import {
22
22
  _tryOnCleanup,
23
23
  createContext,
@@ -32,7 +32,7 @@ import {
32
32
  startHydration,
33
33
  untrack,
34
34
  useContext
35
- } from "./chunk-1yd6jfw5.js";
35
+ } from "./chunk-pmyavtdp.js";
36
36
 
37
37
  // src/component/error-boundary-context.ts
38
38
  var handlerStack = [];
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  computed,
3
3
  signal
4
- } from "./chunk-1yd6jfw5.js";
4
+ } from "./chunk-pmyavtdp.js";
5
5
 
6
6
  // src/form/field-state.ts
7
7
  function createFieldState(_name, initialValue) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getSSRContext
3
- } from "./chunk-1yd6jfw5.js";
3
+ } from "./chunk-pmyavtdp.js";
4
4
 
5
5
  // src/query/invalidate.ts
6
6
  var registry = new Set;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hasSSRResolver
3
- } from "./chunk-1yd6jfw5.js";
3
+ } from "./chunk-pmyavtdp.js";
4
4
 
5
5
  // src/env/is-browser.ts
6
6
  function isBrowser() {
@@ -3,10 +3,10 @@ import {
3
3
  } from "./chunk-jrtrk5z4.js";
4
4
  import {
5
5
  registerActiveQuery
6
- } from "./chunk-pv0apt9z.js";
6
+ } from "./chunk-dvzkge4z.js";
7
7
  import {
8
8
  isBrowser
9
- } from "./chunk-sjypbv24.js";
9
+ } from "./chunk-g5vzhext.js";
10
10
  import {
11
11
  _tryOnCleanup,
12
12
  batch,
@@ -16,7 +16,7 @@ import {
16
16
  setReadValueCallback,
17
17
  signal,
18
18
  untrack
19
- } from "./chunk-1yd6jfw5.js";
19
+ } from "./chunk-pmyavtdp.js";
20
20
 
21
21
  // src/query/cache.ts
22
22
  class MemoryCache {
@@ -86,6 +86,13 @@ class MemoryCache {
86
86
  this._refs.set(key, count);
87
87
  this._orphans.delete(key);
88
88
  }
89
+ findByPrefix(prefix) {
90
+ for (const [k, v] of this._store) {
91
+ if (k.startsWith(prefix))
92
+ return { key: k, value: v };
93
+ }
94
+ return;
95
+ }
89
96
  release(key) {
90
97
  const current = this._refs.get(key);
91
98
  if (current === undefined)
@@ -1028,6 +1035,7 @@ function query(source, options = {}) {
1028
1035
  if (!isSSR() && initialData === undefined) {
1029
1036
  let hydrationKey;
1030
1037
  const hasSSRData = !!globalThis.__VERTZ_SSR_DATA__;
1038
+ let initDescriptorKey;
1031
1039
  if (customKey) {
1032
1040
  hydrationKey = customKey;
1033
1041
  } else if (hasSSRData) {
@@ -1035,6 +1043,7 @@ function query(source, options = {}) {
1035
1043
  const raw = callThunkWithCapture();
1036
1044
  if (raw !== null) {
1037
1045
  if (isQueryDescriptor(raw)) {
1046
+ initDescriptorKey = raw._key;
1038
1047
  if (raw._entity && !entityMeta) {
1039
1048
  entityMeta = raw._entity;
1040
1049
  }
@@ -1066,6 +1075,25 @@ function query(source, options = {}) {
1066
1075
  loading.value = false;
1067
1076
  ssrHydrated = true;
1068
1077
  }
1078
+ } else {
1079
+ const cached = cache.get(hydrationKey);
1080
+ if (cached !== undefined) {
1081
+ retainKey(hydrationKey);
1082
+ normalizeToEntityStore(cached);
1083
+ rawData.value = cached;
1084
+ loading.value = false;
1085
+ ssrHydrated = true;
1086
+ } else if (initDescriptorKey && "findByPrefix" in cache) {
1087
+ const mc = cache;
1088
+ const found = mc.findByPrefix(initDescriptorKey + "&") ?? mc.findByPrefix(initDescriptorKey + ":");
1089
+ if (found) {
1090
+ retainKey(found.key);
1091
+ normalizeToEntityStore(found.value);
1092
+ rawData.value = found.value;
1093
+ loading.value = false;
1094
+ ssrHydrated = true;
1095
+ }
1096
+ }
1069
1097
  }
1070
1098
  }
1071
1099
  if (!ssrHydrated && ssrHydrationCleanup !== null && isNavPrefetchActive()) {
@@ -1229,6 +1257,20 @@ function query(source, options = {}) {
1229
1257
  isFirst = false;
1230
1258
  return;
1231
1259
  }
1260
+ if (descriptorKey && "findByPrefix" in cache) {
1261
+ const mc = cache;
1262
+ const found = untrack(() => mc.findByPrefix(descriptorKey + "&") ?? mc.findByPrefix(descriptorKey + ":"));
1263
+ if (found) {
1264
+ retainKey(found.key);
1265
+ untrack(() => {
1266
+ normalizeToEntityStore(found.value);
1267
+ rawData.value = found.value;
1268
+ loading.value = false;
1269
+ });
1270
+ isFirst = false;
1271
+ return;
1272
+ }
1273
+ }
1232
1274
  }
1233
1275
  isFirst = false;
1234
1276
  return;
@@ -7,11 +7,14 @@ import {
7
7
  } from "./chunk-jrtrk5z4.js";
8
8
  import {
9
9
  isBrowser
10
- } from "./chunk-sjypbv24.js";
10
+ } from "./chunk-g5vzhext.js";
11
11
  import {
12
+ batch,
13
+ getReadValueCallback,
12
14
  getSSRContext,
15
+ getSubscriber,
13
16
  signal
14
- } from "./chunk-1yd6jfw5.js";
17
+ } from "./chunk-pmyavtdp.js";
15
18
 
16
19
  // src/router/reactive-search-params.ts
17
20
  function shallowEqual(a, b) {
@@ -266,11 +269,14 @@ function createRouter(routes, initialUrlOrOptions, maybeOptions) {
266
269
  if (typeof key === "symbol")
267
270
  return;
268
271
  const ctx = getSSRContext();
269
- if (ctx) {
270
- const m = matchRoute(routes, ctx.url);
271
- return m?.search?.[key];
272
+ const search = ctx ? matchRoute(routes, ctx.url)?.search ?? {} : fallbackMatch?.search ?? {};
273
+ const sub = getSubscriber();
274
+ if (sub) {
275
+ const cb = getReadValueCallback();
276
+ if (cb)
277
+ cb(search);
272
278
  }
273
- return fallbackMatch?.search?.[key];
279
+ return search[key];
274
280
  },
275
281
  set() {
276
282
  if (true) {
@@ -336,7 +342,11 @@ function createRouter(routes, initialUrlOrOptions, maybeOptions) {
336
342
  dispose: () => {}
337
343
  };
338
344
  }
345
+ function extractPathname(rawUrl) {
346
+ return rawUrl.split("?")[0]?.split("#")[0] || "/";
347
+ }
339
348
  const url = initialUrl ?? window.location.pathname + window.location.search;
349
+ let lastPathname = extractPathname(url);
340
350
  const initialMatch = matchRoute(routes, url);
341
351
  function normalizeUrl(rawUrl) {
342
352
  const qIdx = rawUrl.indexOf("?");
@@ -466,45 +476,50 @@ function createRouter(routes, initialUrlOrOptions, maybeOptions) {
466
476
  const abort = new AbortController;
467
477
  currentAbort = abort;
468
478
  const match = preMatch !== undefined ? preMatch : matchRoute(routes, url2);
479
+ if (match) {
480
+ visitedUrls.add(normalizeUrl(url2));
481
+ }
469
482
  if (transitionConfig) {
470
483
  await withViewTransition(() => {
471
- current.value = match;
484
+ batch(() => {
485
+ searchParams.value = match?.search ?? {};
486
+ current.value = match;
487
+ });
472
488
  }, transitionConfig);
473
489
  } else {
474
- current.value = match;
490
+ batch(() => {
491
+ searchParams.value = match?.search ?? {};
492
+ current.value = match;
493
+ });
475
494
  }
476
495
  if (match) {
477
- visitedUrls.add(normalizeUrl(url2));
478
- searchParams.value = match.search;
479
496
  if (!skipLoaders) {
480
497
  await runLoaders(match, gen, abort.signal);
481
498
  }
482
- } else {
483
- searchParams.value = {};
484
- if (gen === navigationGen) {
485
- loaderData.value = [];
486
- loaderError.value = null;
487
- }
499
+ } else if (gen === navigationGen) {
500
+ loaderData.value = [];
501
+ loaderError.value = null;
488
502
  }
489
503
  }
490
504
  async function navigate(input) {
491
505
  const navUrl = buildNavigationUrl(input.to, input);
492
506
  const navMatch = matchRoute(routes, navUrl);
493
- const navPathname = navUrl.split("?")[0]?.split("#")[0] || "/";
494
- const isSearchParamOnly = window.location.pathname === navPathname;
507
+ const navPathname = extractPathname(navUrl);
508
+ const isSearchParamOnly = lastPathname === navPathname;
495
509
  const gen = ++navigateGen;
496
510
  const handle = isSearchParamOnly ? null : startPrefetch(navUrl);
497
- if (input.replace) {
498
- window.history.replaceState(null, "", navUrl);
499
- } else {
500
- window.history.pushState(null, "", navUrl);
501
- }
502
511
  const isCachedNav = visitedUrls.has(normalizeUrl(navUrl));
503
512
  if (!isCachedNav && (handle?.firstEvent || handle?.done)) {
504
513
  await awaitPrefetch(handle);
505
514
  }
506
515
  if (gen !== navigateGen)
507
516
  return;
517
+ if (input.replace) {
518
+ window.history.replaceState(null, "", navUrl);
519
+ } else {
520
+ window.history.pushState(null, "", navUrl);
521
+ }
522
+ lastPathname = navPathname;
508
523
  const transitionConfig = isSearchParamOnly ? undefined : input.viewTransition ?? navMatch?.route.viewTransition ?? options?.viewTransition;
509
524
  await applyNavigation(navUrl, navMatch, transitionConfig, isSearchParamOnly);
510
525
  }
@@ -522,10 +537,14 @@ function createRouter(routes, initialUrlOrOptions, maybeOptions) {
522
537
  }
523
538
  const onPopState = () => {
524
539
  const popUrl = window.location.pathname + window.location.search;
525
- startPrefetch(popUrl);
540
+ const popPathname = extractPathname(popUrl);
541
+ const isSearchParamOnly = lastPathname === popPathname;
542
+ lastPathname = popPathname;
543
+ if (!isSearchParamOnly)
544
+ startPrefetch(popUrl);
526
545
  const match = matchRoute(routes, popUrl);
527
- const transitionConfig = match?.route.viewTransition ?? options?.viewTransition;
528
- applyNavigation(popUrl, match, transitionConfig).catch(() => {});
546
+ const transitionConfig = isSearchParamOnly ? undefined : match?.route.viewTransition ?? options?.viewTransition;
547
+ applyNavigation(popUrl, match, transitionConfig, isSearchParamOnly).catch(() => {});
529
548
  };
530
549
  window.addEventListener("popstate", onPopState);
531
550
  function dispose() {
@@ -5,7 +5,7 @@ import {
5
5
  pushScope,
6
6
  runCleanups,
7
7
  untrack
8
- } from "./chunk-1yd6jfw5.js";
8
+ } from "./chunk-pmyavtdp.js";
9
9
 
10
10
  // src/component/lifecycle.ts
11
11
  var mountFrames = [];
@@ -729,4 +729,4 @@ function lifecycleEffect(fn) {
729
729
  return dispose;
730
730
  }
731
731
 
732
- export { registerSSRResolver, getSSRContext, hasSSRResolver, createContext, useContext, getContextScope, setContextScope, startHydration, endHydration, discardDeferredEffects, getIsHydrating, pauseHydration, resumeHydration, advanceCursor, claimElement, claimText, claimComment, enterChildren, exitChildren, DisposalScopeError, onCleanup, _tryOnCleanup, pushScope, popScope, runCleanups, batch, setReadValueCallback, untrack, startSignalCollection, stopSignalCollection, signal, computed, domEffect, deferredDomEffect, lifecycleEffect };
732
+ export { registerSSRResolver, getSSRContext, hasSSRResolver, createContext, useContext, getContextScope, setContextScope, startHydration, endHydration, discardDeferredEffects, getIsHydrating, pauseHydration, resumeHydration, advanceCursor, claimElement, claimText, claimComment, enterChildren, exitChildren, DisposalScopeError, onCleanup, _tryOnCleanup, pushScope, popScope, runCleanups, batch, getSubscriber, getReadValueCallback, setReadValueCallback, untrack, startSignalCollection, stopSignalCollection, signal, computed, domEffect, deferredDomEffect, lifecycleEffect };
@@ -4,10 +4,10 @@ import {
4
4
  __element,
5
5
  __enterChildren,
6
6
  __exitChildren
7
- } from "./chunk-dh32wkrv.js";
7
+ } from "./chunk-xz8jq6w6.js";
8
8
  import {
9
9
  getSSRContext
10
- } from "./chunk-1yd6jfw5.js";
10
+ } from "./chunk-pmyavtdp.js";
11
11
 
12
12
  // src/component/children.ts
13
13
  var MAX_RESOLVE_DEPTH = 100;
@@ -680,12 +680,15 @@ var vertzSheets = new Set;
680
680
  function injectCSS(cssText) {
681
681
  if (!cssText)
682
682
  return;
683
- const isSSR = getSSRContext() !== undefined;
683
+ const ssrCtx = getSSRContext();
684
+ const isSSR = ssrCtx !== undefined;
684
685
  if (!isSSR && injectedCSS.has(cssText))
685
686
  return;
686
687
  injectedCSS.add(cssText);
687
- if (isSSR)
688
+ if (isSSR) {
689
+ ssrCtx.cssTracker?.add(cssText);
688
690
  return;
691
+ }
689
692
  if (typeof document === "undefined")
690
693
  return;
691
694
  if (typeof CSSStyleSheet !== "undefined" && document.adoptedStyleSheets !== undefined) {
@@ -1135,56 +1138,52 @@ function variants(config) {
1135
1138
  const { base, variants: variantDefs, defaultVariants, compoundVariants } = config;
1136
1139
  const filePath = deriveConfigKey(config);
1137
1140
  const baseResult = css({ base }, filePath);
1138
- const variantResults = {};
1141
+ const variantCache = new Map;
1142
+ const variantStyles = {};
1139
1143
  for (const [variantName, options] of Object.entries(variantDefs)) {
1140
- variantResults[variantName] = {};
1144
+ variantStyles[variantName] = {};
1141
1145
  for (const [optionName, styles] of Object.entries(options)) {
1142
1146
  if (styles.length > 0) {
1143
- const blockName = `${variantName}_${optionName}`;
1144
- const result = css({ [blockName]: styles }, filePath);
1145
- const className = result[blockName];
1146
- if (className) {
1147
- variantResults[variantName][optionName] = {
1148
- className,
1149
- css: result.css
1150
- };
1151
- }
1147
+ variantStyles[variantName][optionName] = styles;
1152
1148
  }
1153
1149
  }
1154
1150
  }
1155
- const compoundResults = [];
1156
- if (compoundVariants) {
1157
- for (let i = 0;i < compoundVariants.length; i++) {
1158
- const compound = compoundVariants[i];
1159
- if (!compound)
1160
- continue;
1161
- const { styles, ...conditions } = compound;
1162
- if (styles.length > 0) {
1163
- const blockName = `compound_${i}`;
1164
- const result = css({ [blockName]: styles }, filePath);
1165
- const className = result[blockName];
1166
- if (className) {
1167
- compoundResults.push({
1168
- conditions,
1169
- className,
1170
- css: result.css
1171
- });
1172
- }
1173
- }
1151
+ const compoundCache = new Map;
1152
+ function ensureVariantOption(variantName, optionName) {
1153
+ const cacheKey = `${variantName}::${optionName}`;
1154
+ const cached = variantCache.get(cacheKey);
1155
+ if (cached)
1156
+ return cached.className;
1157
+ const styles = variantStyles[variantName]?.[optionName];
1158
+ if (!styles)
1159
+ return;
1160
+ const blockName = cacheKey;
1161
+ const result = css({ [blockName]: styles }, filePath);
1162
+ const className = result[blockName];
1163
+ if (className) {
1164
+ variantCache.set(cacheKey, { className, css: result.css });
1165
+ return className;
1174
1166
  }
1167
+ return;
1175
1168
  }
1176
- const allCss = [];
1177
- if (baseResult.css)
1178
- allCss.push(baseResult.css);
1179
- for (const options of Object.values(variantResults)) {
1180
- for (const result of Object.values(options)) {
1181
- if (result.css)
1182
- allCss.push(result.css);
1169
+ function ensureCompoundVariant(index, compound, resolved) {
1170
+ const { styles, ...conditions } = compound;
1171
+ const matches = Object.entries(conditions).every(([key, value]) => resolved[key] === String(value));
1172
+ if (!matches)
1173
+ return;
1174
+ const cached = compoundCache.get(index);
1175
+ if (cached)
1176
+ return cached.className;
1177
+ if (styles.length === 0)
1178
+ return;
1179
+ const blockName = `compound_${index}`;
1180
+ const result = css({ [blockName]: styles }, filePath);
1181
+ const className = result[blockName];
1182
+ if (className) {
1183
+ compoundCache.set(index, { className, css: result.css });
1184
+ return className;
1183
1185
  }
1184
- }
1185
- for (const result of compoundResults) {
1186
- if (result.css)
1187
- allCss.push(result.css);
1186
+ return;
1188
1187
  }
1189
1188
  const fn = (props) => {
1190
1189
  const classNames = [];
@@ -1208,26 +1207,43 @@ function variants(config) {
1208
1207
  }
1209
1208
  }
1210
1209
  for (const [variantName, optionName] of Object.entries(resolved)) {
1211
- const variantGroup = variantResults[variantName];
1212
- if (variantGroup) {
1213
- const result = variantGroup[optionName];
1214
- if (result) {
1215
- classNames.push(result.className);
1216
- }
1210
+ const className = ensureVariantOption(variantName, optionName);
1211
+ if (className) {
1212
+ classNames.push(className);
1217
1213
  }
1218
1214
  }
1219
- for (const compound of compoundResults) {
1220
- const matches = Object.entries(compound.conditions).every(([key, value]) => {
1221
- return resolved[key] === String(value);
1222
- });
1223
- if (matches) {
1224
- classNames.push(compound.className);
1215
+ if (compoundVariants) {
1216
+ for (let i = 0;i < compoundVariants.length; i++) {
1217
+ const compound = compoundVariants[i];
1218
+ if (!compound)
1219
+ continue;
1220
+ const className = ensureCompoundVariant(i, compound, resolved);
1221
+ if (className) {
1222
+ classNames.push(className);
1223
+ }
1225
1224
  }
1226
1225
  }
1227
1226
  return classNames.join(" ");
1228
1227
  };
1229
- fn.css = allCss.join(`
1228
+ Object.defineProperty(fn, "css", {
1229
+ get() {
1230
+ const parts = [];
1231
+ if (baseResult.css)
1232
+ parts.push(baseResult.css);
1233
+ for (const entry of variantCache.values()) {
1234
+ if (entry.css)
1235
+ parts.push(entry.css);
1236
+ }
1237
+ for (const entry of compoundCache.values()) {
1238
+ if (entry.css)
1239
+ parts.push(entry.css);
1240
+ }
1241
+ return parts.join(`
1230
1242
  `);
1243
+ },
1244
+ enumerable: false,
1245
+ configurable: false
1246
+ });
1231
1247
  return fn;
1232
1248
  }
1233
1249
 
@@ -20,7 +20,7 @@ import {
20
20
  pushScope,
21
21
  resumeHydration,
22
22
  runCleanups
23
- } from "./chunk-1yd6jfw5.js";
23
+ } from "./chunk-pmyavtdp.js";
24
24
 
25
25
  // src/dom/dom-adapter.ts
26
26
  function createDOMAdapter() {
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  RouterContext
3
- } from "../../shared/chunk-9p84cvet.js";
3
+ } from "../../shared/chunk-4an2s6d7.js";
4
4
  import {
5
5
  invalidateTenantQueries
6
- } from "../../shared/chunk-pv0apt9z.js";
6
+ } from "../../shared/chunk-dvzkge4z.js";
7
7
  import {
8
8
  isBrowser
9
- } from "../../shared/chunk-sjypbv24.js";
9
+ } from "../../shared/chunk-g5vzhext.js";
10
10
  import {
11
11
  _tryOnCleanup,
12
12
  computed,
@@ -14,7 +14,7 @@ import {
14
14
  getSSRContext,
15
15
  signal,
16
16
  useContext
17
- } from "../../shared/chunk-1yd6jfw5.js";
17
+ } from "../../shared/chunk-pmyavtdp.js";
18
18
 
19
19
  // src/auth/access-context.ts
20
20
  var AccessContext = createContext(undefined, "@vertz/ui::AccessContext");
@@ -287,12 +287,16 @@ interface VariantsConfig<V extends VariantDefinitions> {
287
287
  /** The function returned by variants(). Takes optional variant props and returns a className string. */
288
288
  interface VariantFunction<V extends VariantDefinitions> {
289
289
  (props?: VariantProps<V>): string;
290
- /** The extracted CSS for all variant combinations. */
290
+ /** @internal The extracted CSS for variant combinations compiled so far. */
291
291
  css: string;
292
292
  }
293
293
  /**
294
294
  * Create a typed variant function from a config object.
295
295
  *
296
+ * Variant option CSS is compiled lazily on first use — only the base styles
297
+ * are compiled eagerly. This ensures unused variant options never produce CSS,
298
+ * reducing SSR response size for pages that use a subset of available variants.
299
+ *
296
300
  * @param config - Variant configuration (base, variants, defaultVariants, compoundVariants).
297
301
  * @returns A function that accepts variant props and returns a className string.
298
302
  */
@@ -8,10 +8,10 @@ import {
8
8
  globalCss,
9
9
  s,
10
10
  variants
11
- } from "../../shared/chunk-zkh9sysw.js";
12
- import"../../shared/chunk-dh32wkrv.js";
11
+ } from "../../shared/chunk-veqs3jgz.js";
12
+ import"../../shared/chunk-xz8jq6w6.js";
13
13
  import"../../shared/chunk-h1fsr8kv.js";
14
- import"../../shared/chunk-1yd6jfw5.js";
14
+ import"../../shared/chunk-pmyavtdp.js";
15
15
  export {
16
16
  variants,
17
17
  s,
@@ -3,8 +3,8 @@ import {
3
3
  form,
4
4
  formDataToObject,
5
5
  validate
6
- } from "../../shared/chunk-hcgnfw27.js";
7
- import"../../shared/chunk-1yd6jfw5.js";
6
+ } from "../../shared/chunk-9cbb9fbs.js";
7
+ import"../../shared/chunk-pmyavtdp.js";
8
8
  export {
9
9
  validate,
10
10
  formDataToObject,
@@ -632,12 +632,16 @@ interface VariantsConfig<V extends VariantDefinitions> {
632
632
  /** The function returned by variants(). Takes optional variant props and returns a className string. */
633
633
  interface VariantFunction<V extends VariantDefinitions> {
634
634
  (props?: VariantProps<V>): string;
635
- /** The extracted CSS for all variant combinations. */
635
+ /** @internal The extracted CSS for variant combinations compiled so far. */
636
636
  css: string;
637
637
  }
638
638
  /**
639
639
  * Create a typed variant function from a config object.
640
640
  *
641
+ * Variant option CSS is compiled lazily on first use — only the base styles
642
+ * are compiled eagerly. This ensures unused variant options never produce CSS,
643
+ * reducing SSR response size for pages that use a subset of available variants.
644
+ *
641
645
  * @param config - Variant configuration (base, variants, defaultVariants, compoundVariants).
642
646
  * @returns A function that accepts variant props and returns a className string.
643
647
  */
package/dist/src/index.js CHANGED
@@ -25,7 +25,7 @@ import {
25
25
  slideOutToTop,
26
26
  zoomIn,
27
27
  zoomOut
28
- } from "../shared/chunk-xyg724n1.js";
28
+ } from "../shared/chunk-14vwqf7c.js";
29
29
  import {
30
30
  ErrorBoundary,
31
31
  Link,
@@ -36,16 +36,16 @@ import {
36
36
  getCurrentErrorHandler,
37
37
  parseSearchParams,
38
38
  useSearchParams
39
- } from "../shared/chunk-jt34jcfg.js";
39
+ } from "../shared/chunk-5eszqmat.js";
40
40
  import {
41
41
  beginDeferringMounts,
42
42
  discardDeferredMounts,
43
43
  flushDeferredMounts,
44
44
  onMount
45
- } from "../shared/chunk-mntc8w0g.js";
45
+ } from "../shared/chunk-ksetw5t2.js";
46
46
  import {
47
47
  createRouter
48
- } from "../shared/chunk-pkhyqntn.js";
48
+ } from "../shared/chunk-khtsbadc.js";
49
49
  import {
50
50
  defineRoutes
51
51
  } from "../shared/chunk-ah86rm07.js";
@@ -54,7 +54,7 @@ import {
54
54
  form,
55
55
  formDataToObject,
56
56
  validate
57
- } from "../shared/chunk-hcgnfw27.js";
57
+ } from "../shared/chunk-9cbb9fbs.js";
58
58
  import {
59
59
  EntityStore,
60
60
  FieldSelectionTracker,
@@ -66,7 +66,7 @@ import {
66
66
  query,
67
67
  registerRelationSchema,
68
68
  resetRelationSchemas_TEST_ONLY
69
- } from "../shared/chunk-7dngshyk.js";
69
+ } from "../shared/chunk-ka8jeq0f.js";
70
70
  import"../shared/chunk-jrtrk5z4.js";
71
71
  import {
72
72
  ThemeProvider,
@@ -83,7 +83,7 @@ import {
83
83
  resolveChildren,
84
84
  s,
85
85
  variants
86
- } from "../shared/chunk-zkh9sysw.js";
86
+ } from "../shared/chunk-veqs3jgz.js";
87
87
  import {
88
88
  RENDER_NODE_BRAND,
89
89
  __append,
@@ -96,20 +96,20 @@ import {
96
96
  getAdapter,
97
97
  isRenderNode,
98
98
  setAdapter
99
- } from "../shared/chunk-dh32wkrv.js";
99
+ } from "../shared/chunk-xz8jq6w6.js";
100
100
  import"../shared/chunk-h1fsr8kv.js";
101
101
  import {
102
102
  RouterContext,
103
103
  useParams,
104
104
  useRouter
105
- } from "../shared/chunk-9p84cvet.js";
105
+ } from "../shared/chunk-4an2s6d7.js";
106
106
  import {
107
107
  invalidate,
108
108
  invalidateTenantQueries
109
- } from "../shared/chunk-pv0apt9z.js";
109
+ } from "../shared/chunk-dvzkge4z.js";
110
110
  import {
111
111
  isBrowser
112
- } from "../shared/chunk-sjypbv24.js";
112
+ } from "../shared/chunk-g5vzhext.js";
113
113
  import {
114
114
  DisposalScopeError,
115
115
  _tryOnCleanup,
@@ -134,7 +134,7 @@ import {
134
134
  startHydration,
135
135
  untrack,
136
136
  useContext
137
- } from "../shared/chunk-1yd6jfw5.js";
137
+ } from "../shared/chunk-pmyavtdp.js";
138
138
  // src/component/default-error-fallback.ts
139
139
  function DefaultErrorFallback({ error, retry }) {
140
140
  const container = document.createElement("div");
@@ -609,6 +609,11 @@ declare class MemoryCache<T = unknown> implements CacheStore<T> {
609
609
  clear(): void;
610
610
  /** Mark a cache key as actively used by a query instance. */
611
611
  retain(key: string): void;
612
+ /** Find the first entry whose key starts with `prefix`. */
613
+ findByPrefix(prefix: string): {
614
+ key: string;
615
+ value: T;
616
+ } | undefined;
612
617
  /** Release a cache key when a query instance disposes or changes key. */
613
618
  release(key: string): void;
614
619
  }
@@ -1134,6 +1139,13 @@ interface SSRRenderContext {
1134
1139
  ssrRedirect?: {
1135
1140
  to: string;
1136
1141
  };
1142
+ /**
1143
+ * Per-request CSS tracker for render-scoped collection.
1144
+ * Populated by injectCSS() during SSR render. collectCSS() reads
1145
+ * from this Set instead of the global injectedCSS to ensure each
1146
+ * response only includes CSS for components actually rendered.
1147
+ */
1148
+ cssTracker?: Set<string>;
1137
1149
  }
1138
1150
  /** Auth state injected into SSRRenderContext by the server. */
1139
1151
  type SSRAuth = ({
@@ -3,13 +3,13 @@ import {
3
3
  deserializeProps,
4
4
  onAnimationsComplete,
5
5
  resolveComponent
6
- } from "../shared/chunk-xyg724n1.js";
6
+ } from "../shared/chunk-14vwqf7c.js";
7
7
  import {
8
8
  __discardMountFrame,
9
9
  __flushMountFrame,
10
10
  __on,
11
11
  __pushMountFrame
12
- } from "../shared/chunk-mntc8w0g.js";
12
+ } from "../shared/chunk-ksetw5t2.js";
13
13
  import {
14
14
  executeLoaders,
15
15
  matchPath,
@@ -20,7 +20,7 @@ import {
20
20
  MemoryCache,
21
21
  QueryEnvelopeStore,
22
22
  deriveKey
23
- } from "../shared/chunk-7dngshyk.js";
23
+ } from "../shared/chunk-ka8jeq0f.js";
24
24
  import"../shared/chunk-jrtrk5z4.js";
25
25
  import {
26
26
  ALIGNMENT_MAP,
@@ -41,7 +41,7 @@ import {
41
41
  SIZE_KEYWORDS,
42
42
  SPACING_SCALE,
43
43
  compileTheme
44
- } from "../shared/chunk-zkh9sysw.js";
44
+ } from "../shared/chunk-veqs3jgz.js";
45
45
  import {
46
46
  RENDER_NODE_BRAND,
47
47
  __append,
@@ -60,16 +60,16 @@ import {
60
60
  getAdapter,
61
61
  isRenderNode,
62
62
  setAdapter
63
- } from "../shared/chunk-dh32wkrv.js";
63
+ } from "../shared/chunk-xz8jq6w6.js";
64
64
  import {
65
65
  SVG_NS,
66
66
  normalizeSVGAttr,
67
67
  styleObjectToString
68
68
  } from "../shared/chunk-h1fsr8kv.js";
69
- import"../shared/chunk-pv0apt9z.js";
69
+ import"../shared/chunk-dvzkge4z.js";
70
70
  import {
71
71
  isBrowser
72
- } from "../shared/chunk-sjypbv24.js";
72
+ } from "../shared/chunk-g5vzhext.js";
73
73
  import {
74
74
  _tryOnCleanup,
75
75
  claimComment,
@@ -90,7 +90,7 @@ import {
90
90
  startSignalCollection,
91
91
  stopSignalCollection,
92
92
  useContext
93
- } from "../shared/chunk-1yd6jfw5.js";
93
+ } from "../shared/chunk-pmyavtdp.js";
94
94
  // src/dom/conditional.ts
95
95
  function clearBetween(start, end) {
96
96
  let current = start.nextSibling;
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  query
3
- } from "../../shared/chunk-7dngshyk.js";
3
+ } from "../../shared/chunk-ka8jeq0f.js";
4
4
  import"../../shared/chunk-jrtrk5z4.js";
5
- import"../../shared/chunk-pv0apt9z.js";
6
- import"../../shared/chunk-sjypbv24.js";
7
- import"../../shared/chunk-1yd6jfw5.js";
5
+ import"../../shared/chunk-dvzkge4z.js";
6
+ import"../../shared/chunk-g5vzhext.js";
7
+ import"../../shared/chunk-pmyavtdp.js";
8
8
 
9
9
  // src/query/public.ts
10
10
  import { isQueryDescriptor } from "@vertz/fetch";
@@ -6,24 +6,24 @@ import {
6
6
  createLink,
7
7
  parseSearchParams,
8
8
  useSearchParams
9
- } from "../../shared/chunk-jt34jcfg.js";
10
- import"../../shared/chunk-mntc8w0g.js";
9
+ } from "../../shared/chunk-5eszqmat.js";
10
+ import"../../shared/chunk-ksetw5t2.js";
11
11
  import {
12
12
  createRouter
13
- } from "../../shared/chunk-pkhyqntn.js";
13
+ } from "../../shared/chunk-khtsbadc.js";
14
14
  import {
15
15
  defineRoutes
16
16
  } from "../../shared/chunk-ah86rm07.js";
17
17
  import"../../shared/chunk-jrtrk5z4.js";
18
- import"../../shared/chunk-dh32wkrv.js";
18
+ import"../../shared/chunk-xz8jq6w6.js";
19
19
  import"../../shared/chunk-h1fsr8kv.js";
20
20
  import {
21
21
  RouterContext,
22
22
  useParams,
23
23
  useRouter
24
- } from "../../shared/chunk-9p84cvet.js";
25
- import"../../shared/chunk-sjypbv24.js";
26
- import"../../shared/chunk-1yd6jfw5.js";
24
+ } from "../../shared/chunk-4an2s6d7.js";
25
+ import"../../shared/chunk-g5vzhext.js";
26
+ import"../../shared/chunk-pmyavtdp.js";
27
27
  export {
28
28
  useSearchParams,
29
29
  useRouter,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createRouter
3
- } from "../../shared/chunk-pkhyqntn.js";
3
+ } from "../../shared/chunk-khtsbadc.js";
4
4
  import {
5
5
  defineRoutes
6
6
  } from "../../shared/chunk-ah86rm07.js";
7
7
  import"../../shared/chunk-jrtrk5z4.js";
8
- import"../../shared/chunk-sjypbv24.js";
9
- import"../../shared/chunk-1yd6jfw5.js";
8
+ import"../../shared/chunk-g5vzhext.js";
9
+ import"../../shared/chunk-pmyavtdp.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.36",
3
+ "version": "0.2.38",
4
4
  "description": "Vertz UI framework — signals, components, JSX runtime",
5
5
  "license": "MIT",
6
6
  "repository": {