@vertz/ui 0.2.20 → 0.2.22

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.
Files changed (35) hide show
  1. package/dist/shared/{chunk-4fwcwxn6.js → chunk-2qe6aqhb.js} +235 -1
  2. package/dist/shared/{chunk-mtsvrj9e.js → chunk-4cmt1ve8.js} +1 -1
  3. package/dist/shared/chunk-4xkw6h1s.js +73 -0
  4. package/dist/shared/{chunk-j5qtsm0b.js → chunk-67z8b0q8.js} +97 -21
  5. package/dist/shared/{chunk-fkbgbf3n.js → chunk-7g722pdh.js} +70 -12
  6. package/dist/shared/{chunk-6wd36w21.js → chunk-am9zaw4h.js} +3 -1
  7. package/dist/shared/{chunk-14eqne2a.js → chunk-bybgyjye.js} +1 -1
  8. package/dist/shared/{chunk-afawz764.js → chunk-c61572xp.js} +1 -1
  9. package/dist/shared/{chunk-07bh4m1e.js → chunk-kjwp5q5s.js} +10 -5
  10. package/dist/shared/chunk-mwc4v48d.js +36 -0
  11. package/dist/shared/{chunk-yjs76c7v.js → chunk-pdqr78k9.js} +1 -1
  12. package/dist/shared/{chunk-c3r237f0.js → chunk-pq8khh47.js} +32 -11
  13. package/dist/shared/{chunk-fs3eec4b.js → chunk-szk0hyjg.js} +3 -3
  14. package/dist/shared/chunk-vwz86vg9.js +208 -0
  15. package/dist/shared/{chunk-j09yyh34.js → chunk-yb4a0smw.js} +1 -1
  16. package/dist/src/auth/public.d.ts +30 -2
  17. package/dist/src/auth/public.js +95 -136
  18. package/dist/src/components/index.d.ts +70 -0
  19. package/dist/src/components/index.js +213 -0
  20. package/dist/src/css/public.d.ts +48 -14
  21. package/dist/src/css/public.js +4 -4
  22. package/dist/src/form/public.js +2 -2
  23. package/dist/src/index.d.ts +131 -20
  24. package/dist/src/index.js +45 -36
  25. package/dist/src/internals.d.ts +110 -62
  26. package/dist/src/internals.js +18 -14
  27. package/dist/src/jsx-runtime/index.d.ts +20 -0
  28. package/dist/src/jsx-runtime/index.js +13 -3
  29. package/dist/src/query/public.js +4 -4
  30. package/dist/src/router/public.d.ts +47 -1
  31. package/dist/src/router/public.js +10 -9
  32. package/dist/src/test/index.d.ts +33 -0
  33. package/dist/src/test/index.js +4 -4
  34. package/package.json +7 -3
  35. package/dist/shared/chunk-mgfrrrjq.js +0 -384
@@ -41,11 +41,13 @@ function defineRoutes(map) {
41
41
  const compiled = {
42
42
  component: config.component,
43
43
  errorComponent: config.errorComponent,
44
+ generateParams: config.generateParams,
44
45
  loader: config.loader,
45
46
  params: config.params,
46
47
  pattern,
47
48
  prerender: config.prerender,
48
- searchParams: config.searchParams
49
+ searchParams: config.searchParams,
50
+ viewTransition: config.viewTransition
49
51
  };
50
52
  if (config.children) {
51
53
  compiled.children = defineRoutes(config.children);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hasSSRResolver
3
- } from "./chunk-4fwcwxn6.js";
3
+ } from "./chunk-2qe6aqhb.js";
4
4
 
5
5
  // src/env/is-browser.ts
6
6
  function isBrowser() {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getSSRContext
3
- } from "./chunk-4fwcwxn6.js";
3
+ } from "./chunk-2qe6aqhb.js";
4
4
 
5
5
  // src/dom/dom-adapter.ts
6
6
  function createDOMAdapter() {
@@ -1,15 +1,20 @@
1
1
  import {
2
- domEffect
3
- } from "./chunk-4fwcwxn6.js";
2
+ styleObjectToString
3
+ } from "./chunk-4xkw6h1s.js";
4
+ import {
5
+ deferredDomEffect
6
+ } from "./chunk-2qe6aqhb.js";
4
7
 
5
8
  // src/dom/attributes.ts
6
9
  function __attr(el, name, fn) {
7
- return domEffect(() => {
10
+ return deferredDomEffect(() => {
8
11
  const value = fn();
9
12
  if (value == null || value === false) {
10
13
  el.removeAttribute(name);
11
14
  } else if (value === true) {
12
15
  el.setAttribute(name, "");
16
+ } else if (name === "style" && typeof value === "object") {
17
+ el.setAttribute(name, styleObjectToString(value));
13
18
  } else {
14
19
  el.setAttribute(name, value);
15
20
  }
@@ -17,14 +22,14 @@ function __attr(el, name, fn) {
17
22
  }
18
23
  function __show(el, fn) {
19
24
  const originalDisplay = el.style.display;
20
- return domEffect(() => {
25
+ return deferredDomEffect(() => {
21
26
  el.style.display = fn() ? originalDisplay : "none";
22
27
  });
23
28
  }
24
29
  function __classList(el, classMap) {
25
30
  const disposers = [];
26
31
  for (const [className, fn] of Object.entries(classMap)) {
27
- disposers.push(domEffect(() => {
32
+ disposers.push(deferredDomEffect(() => {
28
33
  if (fn()) {
29
34
  el.classList.add(className);
30
35
  } else {
@@ -0,0 +1,36 @@
1
+ // src/theme/registry.ts
2
+ var _components = null;
3
+ var _primitives = null;
4
+ function registerTheme(resolved) {
5
+ if (!resolved || typeof resolved !== "object" || !resolved.components || typeof resolved.components !== "object") {
6
+ throw new Error(`registerTheme() expects an object with a "components" property.
7
+
8
+ ` + `Example:
9
+ ` + ` import { registerTheme } from '@vertz/ui';
10
+ ` + ` import { configureTheme } from '@vertz/theme-shadcn';
11
+ ` + ` registerTheme(configureTheme({ palette: 'zinc' }));
12
+ `);
13
+ }
14
+ _components = resolved.components;
15
+ _primitives = resolved.components.primitives ?? {};
16
+ }
17
+ function _getComponent(name) {
18
+ if (!_components) {
19
+ throw new Error(`No theme registered. Call registerTheme() before using components from @vertz/ui/components.
20
+
21
+ ` + `Example:
22
+ ` + ` import { registerTheme } from '@vertz/ui';
23
+ ` + ` import { configureTheme } from '@vertz/theme-shadcn';
24
+ ` + ` registerTheme(configureTheme({ palette: 'zinc' }));
25
+ `);
26
+ }
27
+ return Reflect.get(_components, name);
28
+ }
29
+ function _getPrimitive(name) {
30
+ if (!_primitives) {
31
+ throw new Error(`No theme registered. Call registerTheme() before using components from @vertz/ui/components.`);
32
+ }
33
+ return Reflect.get(_primitives, name);
34
+ }
35
+
36
+ export { registerTheme, _getComponent, _getPrimitive };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  injectCSS
3
- } from "./chunk-c3r237f0.js";
3
+ } from "./chunk-pq8khh47.js";
4
4
 
5
5
  // src/dom/animation.ts
6
6
  function onAnimationsComplete(el, callback) {
@@ -3,10 +3,10 @@ import {
3
3
  __element,
4
4
  __enterChildren,
5
5
  __exitChildren
6
- } from "./chunk-mgfrrrjq.js";
6
+ } from "./chunk-vwz86vg9.js";
7
7
  import {
8
8
  getSSRContext
9
- } from "./chunk-4fwcwxn6.js";
9
+ } from "./chunk-2qe6aqhb.js";
10
10
 
11
11
  // src/component/children.ts
12
12
  var MAX_RESOLVE_DEPTH = 100;
@@ -90,6 +90,8 @@ var PROPERTY_MAP = {
90
90
  opacity: { properties: ["opacity"], valueType: "raw" },
91
91
  inset: { properties: ["inset"], valueType: "raw" },
92
92
  z: { properties: ["z-index"], valueType: "raw" },
93
+ "vt-name": { properties: ["view-transition-name"], valueType: "raw" },
94
+ "view-transition-name": { properties: ["view-transition-name"], valueType: "raw" },
93
95
  content: { properties: ["content"], valueType: "content" }
94
96
  };
95
97
  var KEYWORD_MAP = {
@@ -693,15 +695,23 @@ function css(input, filePath = DEFAULT_FILE_PATH) {
693
695
  baseDeclarations.push(...resolved.declarations);
694
696
  }
695
697
  } else {
696
- for (const [selector, nestedEntries] of Object.entries(entry)) {
698
+ for (const [selector, nestedValue] of Object.entries(entry)) {
697
699
  const nestedDecls = [];
698
- for (const nestedEntry of nestedEntries) {
699
- if (typeof nestedEntry === "string") {
700
- const parsed = parseShorthand(nestedEntry);
701
- const resolved = resolveToken(parsed);
702
- nestedDecls.push(...resolved.declarations);
703
- } else if ("property" in nestedEntry && "value" in nestedEntry) {
704
- nestedDecls.push({ property: nestedEntry.property, value: nestedEntry.value });
700
+ if (Array.isArray(nestedValue)) {
701
+ for (const nestedEntry of nestedValue) {
702
+ if (typeof nestedEntry === "string") {
703
+ const parsed = parseShorthand(nestedEntry);
704
+ const resolved = resolveToken(parsed);
705
+ nestedDecls.push(...resolved.declarations);
706
+ } else {
707
+ for (const [prop, val] of Object.entries(nestedEntry)) {
708
+ nestedDecls.push({ property: prop, value: val });
709
+ }
710
+ }
711
+ }
712
+ } else {
713
+ for (const [prop, val] of Object.entries(nestedValue)) {
714
+ nestedDecls.push({ property: prop, value: val });
705
715
  }
706
716
  }
707
717
  if (selector.startsWith("@")) {
@@ -737,7 +747,18 @@ function serializeEntries(entries) {
737
747
  return entries.map((entry) => {
738
748
  if (typeof entry === "string")
739
749
  return entry;
740
- return Object.entries(entry).map(([sel, vals]) => `${sel}:{${vals.map((v) => typeof v === "string" ? v : `${v.property}=${v.value}`).join(",")}}`).join(";");
750
+ return Object.entries(entry).map(([sel, val]) => {
751
+ if (Array.isArray(val)) {
752
+ const serialized2 = val.map((v) => {
753
+ if (typeof v === "string")
754
+ return v;
755
+ return Object.keys(v).sort().map((k) => `${k}=${v[k]}`).join(",");
756
+ }).join(",");
757
+ return `${sel}:{${serialized2}}`;
758
+ }
759
+ const serialized = Object.keys(val).sort().map((k) => `${k}=${val[k]}`).join(",");
760
+ return `${sel}:{${serialized}}`;
761
+ }).join(";");
741
762
  }).join("|");
742
763
  }
743
764
  function formatRule(selector, declarations) {
@@ -4,10 +4,10 @@ import {
4
4
  import {
5
5
  getAdapter,
6
6
  isRenderNode
7
- } from "./chunk-afawz764.js";
7
+ } from "./chunk-c61572xp.js";
8
8
  import {
9
9
  isBrowser
10
- } from "./chunk-14eqne2a.js";
10
+ } from "./chunk-bybgyjye.js";
11
11
  import {
12
12
  _tryOnCleanup,
13
13
  batch,
@@ -21,7 +21,7 @@ import {
21
21
  setReadValueCallback,
22
22
  signal,
23
23
  untrack
24
- } from "./chunk-4fwcwxn6.js";
24
+ } from "./chunk-2qe6aqhb.js";
25
25
 
26
26
  // src/query/cache.ts
27
27
  class MemoryCache {
@@ -0,0 +1,208 @@
1
+ import {
2
+ SVG_NS,
3
+ isSVGTag,
4
+ normalizeSVGAttr
5
+ } from "./chunk-prj7nm08.js";
6
+ import {
7
+ getAdapter,
8
+ isRenderNode
9
+ } from "./chunk-c61572xp.js";
10
+ import {
11
+ claimElement,
12
+ claimText,
13
+ deferredDomEffect,
14
+ domEffect,
15
+ enterChildren,
16
+ exitChildren,
17
+ getIsHydrating,
18
+ pauseHydration,
19
+ resumeHydration
20
+ } from "./chunk-2qe6aqhb.js";
21
+
22
+ // src/dom/element.ts
23
+ var MAX_THUNK_DEPTH = 100;
24
+ function resolveAndAppend(parent, value, depth = 0) {
25
+ if (depth >= MAX_THUNK_DEPTH) {
26
+ throw new Error("resolveAndAppend: max recursion depth exceeded — possible circular thunk");
27
+ }
28
+ if (value == null || typeof value === "boolean") {
29
+ return;
30
+ }
31
+ if (typeof value === "function") {
32
+ resolveAndAppend(parent, value(), depth + 1);
33
+ return;
34
+ }
35
+ if (Array.isArray(value)) {
36
+ for (const item of value) {
37
+ resolveAndAppend(parent, item, depth);
38
+ }
39
+ return;
40
+ }
41
+ if (isRenderNode(value)) {
42
+ parent.appendChild(value);
43
+ return;
44
+ }
45
+ const text = typeof value === "string" ? value : String(value);
46
+ parent.appendChild(getAdapter().createTextNode(text));
47
+ }
48
+ function __text(fn) {
49
+ if (getIsHydrating()) {
50
+ const claimed = claimText();
51
+ if (claimed) {
52
+ const node2 = claimed;
53
+ node2.dispose = deferredDomEffect(() => {
54
+ node2.data = fn();
55
+ });
56
+ return node2;
57
+ }
58
+ }
59
+ const node = getAdapter().createTextNode("");
60
+ node.dispose = domEffect(() => {
61
+ node.data = fn();
62
+ });
63
+ return node;
64
+ }
65
+ function __child(fn) {
66
+ let wrapper;
67
+ if (getIsHydrating()) {
68
+ const claimed = claimElement("span");
69
+ if (claimed) {
70
+ wrapper = claimed;
71
+ while (wrapper.firstChild) {
72
+ wrapper.removeChild(wrapper.firstChild);
73
+ }
74
+ pauseHydration();
75
+ try {
76
+ wrapper.dispose = domEffect(() => {
77
+ const value = fn();
78
+ if (isRenderNode(value) && wrapper.childNodes.length === 1 && wrapper.firstChild === value) {
79
+ return;
80
+ }
81
+ if (!isRenderNode(value) && value != null && typeof value !== "boolean" && wrapper.childNodes.length === 1 && wrapper.firstChild.nodeType === 3) {
82
+ const text = typeof value === "string" ? value : String(value);
83
+ wrapper.firstChild.data = text;
84
+ return;
85
+ }
86
+ while (wrapper.firstChild) {
87
+ wrapper.removeChild(wrapper.firstChild);
88
+ }
89
+ resolveAndAppend(wrapper, value);
90
+ });
91
+ } finally {
92
+ resumeHydration();
93
+ }
94
+ return wrapper;
95
+ }
96
+ }
97
+ wrapper = getAdapter().createElement("span");
98
+ wrapper.style.display = "contents";
99
+ wrapper.dispose = domEffect(() => {
100
+ const value = fn();
101
+ if (isRenderNode(value) && wrapper.childNodes.length === 1 && wrapper.firstChild === value) {
102
+ return;
103
+ }
104
+ if (!isRenderNode(value) && value != null && typeof value !== "boolean" && typeof value !== "function" && wrapper.childNodes.length === 1 && wrapper.firstChild.nodeType === 3) {
105
+ const text = typeof value === "string" ? value : String(value);
106
+ wrapper.firstChild.data = text;
107
+ return;
108
+ }
109
+ while (wrapper.firstChild) {
110
+ wrapper.removeChild(wrapper.firstChild);
111
+ }
112
+ resolveAndAppend(wrapper, value);
113
+ });
114
+ return wrapper;
115
+ }
116
+ function resolveAndInsert(parent, value, depth = 0) {
117
+ if (depth >= MAX_THUNK_DEPTH) {
118
+ throw new Error("__insert: max recursion depth exceeded — possible circular thunk");
119
+ }
120
+ if (value == null || typeof value === "boolean") {
121
+ return;
122
+ }
123
+ if (typeof value === "function") {
124
+ resolveAndInsert(parent, value(), depth + 1);
125
+ return;
126
+ }
127
+ if (Array.isArray(value)) {
128
+ for (const item of value) {
129
+ resolveAndInsert(parent, item, depth);
130
+ }
131
+ return;
132
+ }
133
+ insertLeaf(parent, value);
134
+ }
135
+ function insertLeaf(parent, value) {
136
+ if (getIsHydrating()) {
137
+ if (isRenderNode(value)) {
138
+ return;
139
+ }
140
+ claimText();
141
+ return;
142
+ }
143
+ if (isRenderNode(value)) {
144
+ parent.appendChild(value);
145
+ return;
146
+ }
147
+ const text = typeof value === "string" ? value : String(value);
148
+ parent.appendChild(getAdapter().createTextNode(text));
149
+ }
150
+ function __insert(parent, value) {
151
+ if (value == null || typeof value === "boolean") {
152
+ return;
153
+ }
154
+ resolveAndInsert(parent, value);
155
+ }
156
+ function __element(tag, props) {
157
+ if (getIsHydrating()) {
158
+ const claimed = claimElement(tag);
159
+ if (claimed) {
160
+ if (props && typeof process !== "undefined" && true) {
161
+ for (const [key, value] of Object.entries(props)) {
162
+ if (key === "role" || key.startsWith("aria-")) {
163
+ const actual = claimed.getAttribute(key);
164
+ if (actual !== value) {
165
+ console.warn(`[hydrate] ARIA mismatch on <${tag}>: ${key}="${actual}" (expected "${value}")`);
166
+ }
167
+ }
168
+ }
169
+ }
170
+ return claimed;
171
+ }
172
+ }
173
+ const adapter = getAdapter();
174
+ const svg = isSVGTag(tag);
175
+ const el = svg ? adapter.createElementNS(SVG_NS, tag) : adapter.createElement(tag);
176
+ if (props) {
177
+ for (const [key, value] of Object.entries(props)) {
178
+ const attrName = svg ? normalizeSVGAttr(key) : key;
179
+ el.setAttribute(attrName, value);
180
+ }
181
+ }
182
+ return el;
183
+ }
184
+ function __append(parent, child) {
185
+ if (getIsHydrating())
186
+ return;
187
+ parent.appendChild(child);
188
+ }
189
+ function __staticText(text) {
190
+ if (getIsHydrating()) {
191
+ const claimed = claimText();
192
+ if (claimed)
193
+ return claimed;
194
+ }
195
+ return getAdapter().createTextNode(text);
196
+ }
197
+ function __enterChildren(el) {
198
+ if (getIsHydrating()) {
199
+ enterChildren(el);
200
+ }
201
+ }
202
+ function __exitChildren() {
203
+ if (getIsHydrating()) {
204
+ exitChildren();
205
+ }
206
+ }
207
+
208
+ export { __text, __child, __insert, __element, __append, __staticText, __enterChildren, __exitChildren };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  computed,
3
3
  signal
4
- } from "./chunk-4fwcwxn6.js";
4
+ } from "./chunk-2qe6aqhb.js";
5
5
 
6
6
  // src/form/field-state.ts
7
7
  function createFieldState(_name, initialValue) {
@@ -203,6 +203,7 @@ interface AccessEventClient {
203
203
  dispose(): void;
204
204
  }
205
205
  declare function createAccessEventClient(options: AccessEventClientOptions): AccessEventClient;
206
+ import { Result as Result2 } from "@vertz/fetch";
206
207
  import { Result } from "@vertz/fetch";
207
208
  /**
208
209
  * Minimal schema interface compatible with @vertz/schema.
@@ -291,6 +292,30 @@ interface AuthResponse {
291
292
  user: User;
292
293
  expiresAt: number;
293
294
  }
295
+ /**
296
+ * Minimal callable with endpoint metadata.
297
+ * Matches the shape generated by `@vertz/codegen`'s auth SDK.
298
+ */
299
+ interface AuthSdkMethod<
300
+ TBody,
301
+ TResult
302
+ > {
303
+ (body: TBody): PromiseLike<Result2<TResult, Error>>;
304
+ url: string;
305
+ method: string;
306
+ }
307
+ /**
308
+ * Interface for the generated auth SDK.
309
+ * AuthProvider delegates HTTP calls to these methods and wraps them
310
+ * with signal-based state management.
311
+ */
312
+ interface AuthSdk {
313
+ signIn: AuthSdkMethod<SignInInput, AuthResponse>;
314
+ signUp: AuthSdkMethod<SignUpInput, AuthResponse>;
315
+ signOut: () => PromiseLike<Result2<unknown, Error>>;
316
+ refresh: () => PromiseLike<Result2<AuthResponse, Error>>;
317
+ providers?: () => PromiseLike<Result2<OAuthProviderInfo[], Error>>;
318
+ }
294
319
  interface AuthContextValue {
295
320
  user: Signal<User | null>;
296
321
  status: Signal<AuthStatus>;
@@ -309,6 +334,9 @@ interface AuthContextValue {
309
334
  declare const AuthContext: Context<AuthContextValue>;
310
335
  declare function useAuth(): UnwrapSignals<AuthContextValue>;
311
336
  interface AuthProviderProps {
337
+ /** Generated auth SDK instance. AuthProvider delegates HTTP calls to it. */
338
+ auth: AuthSdk;
339
+ /** Base path for auth endpoints not yet in the SDK (MFA, forgot/reset password, access-set). */
312
340
  basePath?: string;
313
341
  accessControl?: boolean;
314
342
  /** Enable WebSocket-based real-time access event updates. Requires accessControl. */
@@ -319,7 +347,7 @@ interface AuthProviderProps {
319
347
  flagEntitlementMap?: Record<string, string[]>;
320
348
  children: (() => unknown) | unknown;
321
349
  }
322
- declare function AuthProvider({ basePath, accessControl, accessEvents, accessEventsUrl, flagEntitlementMap, children }: AuthProviderProps): HTMLElement;
350
+ declare function AuthProvider({ auth, basePath, accessControl, accessEvents, accessEventsUrl, flagEntitlementMap, children }: AuthProviderProps): HTMLElement;
323
351
  /**
324
352
  * Create an AccessContextValue for use with AccessContext.Provider.
325
353
  * Hydrates from `window.__VERTZ_ACCESS_SET__` when available (SSR).
@@ -353,4 +381,4 @@ declare function getUserInitials(user: User | null | undefined): string;
353
381
  * Returns an inline SVG string — no external requests, works in SSR.
354
382
  */
355
383
  declare function getUserIcon(size: number): string;
356
- export { useAuth, useAccessContext, getUserInitials, getUserIcon, getUserDisplayName, getProviderIcon, createAccessProvider, createAccessEventClient, canSignals, can, User, SignUpInput, SignOutOptions, SignInInput, ResetInput, RawAccessCheck, OAuthProviderInfo, MfaInput, ForgotInput, EntitlementRegistry, Entitlement, DenialReason, DenialMeta, ClientAccessEvent, AuthStatus, AuthResponse, AuthProviderProps, AuthProvider, AuthErrorCode, AuthContextValue, AuthContext, AuthClientError, AccessSet, AccessEventClientOptions, AccessEventClient, AccessContextValue, AccessContext, AccessCheckData, AccessCheck };
384
+ export { useAuth, useAccessContext, getUserInitials, getUserIcon, getUserDisplayName, getProviderIcon, createAccessProvider, createAccessEventClient, canSignals, can, User, SignUpInput, SignOutOptions, SignInInput, ResetInput, RawAccessCheck, OAuthProviderInfo, MfaInput, ForgotInput, EntitlementRegistry, Entitlement, DenialReason, DenialMeta, ClientAccessEvent, AuthStatus, AuthSdkMethod, AuthSdk, AuthResponse, AuthProviderProps, AuthProvider, AuthErrorCode, AuthContextValue, AuthContext, AuthClientError, AccessSet, AccessEventClientOptions, AccessEventClient, AccessContextValue, AccessContext, AccessCheckData, AccessCheck };