@vertz/ui 0.2.17 → 0.2.19

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.
@@ -3,7 +3,7 @@ import {
3
3
  __element,
4
4
  __enterChildren,
5
5
  __exitChildren
6
- } from "./chunk-vndfjfdy.js";
6
+ } from "./chunk-mgfrrrjq.js";
7
7
  import {
8
8
  getSSRContext
9
9
  } from "./chunk-4fwcwxn6.js";
@@ -9,7 +9,7 @@ import {
9
9
  __exitChildren,
10
10
  __staticText,
11
11
  getIsHydrating
12
- } from "./chunk-vndfjfdy.js";
12
+ } from "./chunk-mgfrrrjq.js";
13
13
  import {
14
14
  RouterContext
15
15
  } from "./chunk-mtsvrj9e.js";
@@ -147,7 +147,9 @@ var OutletContext = createContext(undefined, "@vertz/ui::OutletContext");
147
147
  function Outlet() {
148
148
  const ctx = useContext(OutletContext);
149
149
  if (!ctx) {
150
- return document.createComment("outlet:empty");
150
+ const el = __element("span");
151
+ el.style.display = "contents";
152
+ return el;
151
153
  }
152
154
  const container = __element("div");
153
155
  let childCleanups = [];
@@ -254,6 +254,11 @@ function __child(fn) {
254
254
  if (isRenderNode(value) && wrapper.childNodes.length === 1 && wrapper.firstChild === value) {
255
255
  return;
256
256
  }
257
+ if (!isRenderNode(value) && value != null && typeof value !== "boolean" && wrapper.childNodes.length === 1 && wrapper.firstChild.nodeType === 3) {
258
+ const text = typeof value === "string" ? value : String(value);
259
+ wrapper.firstChild.data = text;
260
+ return;
261
+ }
257
262
  while (wrapper.firstChild) {
258
263
  wrapper.removeChild(wrapper.firstChild);
259
264
  }
@@ -272,6 +277,11 @@ function __child(fn) {
272
277
  if (isRenderNode(value) && wrapper.childNodes.length === 1 && wrapper.firstChild === value) {
273
278
  return;
274
279
  }
280
+ if (!isRenderNode(value) && value != null && typeof value !== "boolean" && typeof value !== "function" && wrapper.childNodes.length === 1 && wrapper.firstChild.nodeType === 3) {
281
+ const text = typeof value === "string" ? value : String(value);
282
+ wrapper.firstChild.data = text;
283
+ return;
284
+ }
275
285
  while (wrapper.firstChild) {
276
286
  wrapper.removeChild(wrapper.firstChild);
277
287
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  injectCSS
3
- } from "./chunk-dhehvmj0.js";
3
+ } from "./chunk-c3r237f0.js";
4
4
 
5
5
  // src/dom/animation.ts
6
6
  function onAnimationsComplete(el, callback) {
@@ -121,6 +121,17 @@ interface EntitlementRegistry {}
121
121
  /** Entitlement type — narrows to literal union when codegen populates EntitlementRegistry. */
122
122
  type Entitlement = keyof EntitlementRegistry extends never ? string : Extract<keyof EntitlementRegistry, string>;
123
123
  /**
124
+ * @internal Signal-backed version of AccessCheck — actual runtime type of can() return.
125
+ * Use with canSignals() when framework code needs reactive signal access without compiler transforms.
126
+ */
127
+ interface RawAccessCheck {
128
+ readonly allowed: ReadonlySignal<boolean>;
129
+ readonly reasons: ReadonlySignal<DenialReason[]>;
130
+ readonly reason: ReadonlySignal<DenialReason | undefined>;
131
+ readonly meta: ReadonlySignal<DenialMeta | undefined>;
132
+ readonly loading: ReadonlySignal<boolean>;
133
+ }
134
+ /**
124
135
  * Check if the current user has a specific entitlement.
125
136
  *
126
137
  * Must be called in the component body (like query()/form()).
@@ -136,6 +147,19 @@ type Entitlement = keyof EntitlementRegistry extends never ? string : Extract<ke
136
147
  declare function can(entitlement: Entitlement, entity?: {
137
148
  __access?: Record<string, AccessCheckData>;
138
149
  }): AccessCheck;
150
+ /**
151
+ * @internal Framework use only.
152
+ * Same as can() but returns raw ReadonlySignal properties.
153
+ * Use when framework code needs reactive signal access without compiler transforms.
154
+ *
155
+ * Must NOT be added to the signal-api-registry — the compiler must not auto-unwrap these.
156
+ *
157
+ * @param entitlement - The entitlement to check
158
+ * @param entity - Optional entity with pre-computed `__access` metadata
159
+ */
160
+ declare function canSignals(entitlement: Entitlement, entity?: {
161
+ __access?: Record<string, AccessCheckData>;
162
+ }): RawAccessCheck;
139
163
  /** Client-side access events (no orgId/userId — server scopes the broadcast) */
140
164
  type ClientAccessEvent = {
141
165
  type: "access:flag_toggled";
@@ -329,4 +353,4 @@ declare function getUserInitials(user: User | null | undefined): string;
329
353
  * Returns an inline SVG string — no external requests, works in SSR.
330
354
  */
331
355
  declare function getUserIcon(size: number): string;
332
- export { useAuth, useAccessContext, getUserInitials, getUserIcon, getUserDisplayName, getProviderIcon, createAccessProvider, createAccessEventClient, can, User, SignUpInput, SignOutOptions, SignInInput, ResetInput, OAuthProviderInfo, MfaInput, ForgotInput, EntitlementRegistry, Entitlement, DenialReason, DenialMeta, ClientAccessEvent, AuthStatus, AuthResponse, AuthProviderProps, AuthProvider, AuthErrorCode, AuthContextValue, AuthContext, AuthClientError, AccessSet, AccessEventClientOptions, AccessEventClient, AccessContextValue, AccessContext, AccessCheckData, AccessCheck };
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 };
@@ -22,25 +22,18 @@ function useAccessContext() {
22
22
  }
23
23
  return ctx;
24
24
  }
25
- function createFallbackDenied() {
26
- return {
27
- allowed: computed(() => false),
28
- reasons: computed(() => ["not_authenticated"]),
29
- reason: computed(() => "not_authenticated"),
30
- meta: computed(() => {
31
- return;
32
- }),
33
- loading: computed(() => false)
34
- };
35
- }
36
25
  var __DEV__ = typeof process !== "undefined" && true;
37
- function can(entitlement, entity) {
38
- const ctx = useContext(AccessContext);
26
+ function createAccessCheckRaw(ctx, entitlement, entity) {
39
27
  if (!ctx) {
40
- if (__DEV__) {
41
- console.warn("can() called without AccessContext.Provider — all checks denied");
42
- }
43
- return createFallbackDenied();
28
+ return {
29
+ allowed: computed(() => false),
30
+ reasons: computed(() => ["not_authenticated"]),
31
+ reason: computed(() => "not_authenticated"),
32
+ meta: computed(() => {
33
+ return;
34
+ }),
35
+ loading: computed(() => false)
36
+ };
44
37
  }
45
38
  const accessData = computed(() => {
46
39
  if (entity?.__access?.[entitlement])
@@ -61,6 +54,20 @@ function can(entitlement, entity) {
61
54
  })
62
55
  };
63
56
  }
57
+ function can(entitlement, entity) {
58
+ const ctx = useContext(AccessContext);
59
+ if (!ctx && __DEV__) {
60
+ console.warn("can() called without AccessContext.Provider — all checks denied");
61
+ }
62
+ return createAccessCheckRaw(ctx, entitlement, entity);
63
+ }
64
+ function canSignals(entitlement, entity) {
65
+ const ctx = useContext(AccessContext);
66
+ if (!ctx && __DEV__) {
67
+ console.warn("canSignals() called without AccessContext.Provider — all checks denied");
68
+ }
69
+ return createAccessCheckRaw(ctx, entitlement, entity);
70
+ }
64
71
  // src/auth/access-event-client.ts
65
72
  var BASE_BACKOFF_MS = 1000;
66
73
  var MAX_BACKOFF_MS = 30000;
@@ -852,6 +859,7 @@ export {
852
859
  getProviderIcon,
853
860
  createAccessProvider,
854
861
  createAccessEventClient,
862
+ canSignals,
855
863
  can,
856
864
  AuthProvider,
857
865
  AuthContext,
@@ -8,8 +8,8 @@ import {
8
8
  globalCss,
9
9
  s,
10
10
  variants
11
- } from "../../shared/chunk-dhehvmj0.js";
12
- import"../../shared/chunk-vndfjfdy.js";
11
+ } from "../../shared/chunk-c3r237f0.js";
12
+ import"../../shared/chunk-mgfrrrjq.js";
13
13
  import"../../shared/chunk-prj7nm08.js";
14
14
  import"../../shared/chunk-afawz764.js";
15
15
  import"../../shared/chunk-4fwcwxn6.js";
@@ -117,12 +117,14 @@ declare function createContext<T>(defaultValue?: T, __stableId?: string): Contex
117
117
  * Returns the default value if no Provider is active.
118
118
  */
119
119
  declare function useContext<T>(ctx: Context<T>): UnwrapSignals<T> | undefined;
120
+ /** DOM element types accepted by JSX (mirrors JSX.Element). */
121
+ type JsxElement = HTMLElement | SVGElement | DocumentFragment;
120
122
  /** Props for the ErrorBoundary component. */
121
123
  interface ErrorBoundaryProps {
122
124
  /** Function that returns the children to render. */
123
- children: () => Node;
125
+ children: () => JsxElement;
124
126
  /** Fallback renderer that receives the caught error and a retry function. */
125
- fallback: (error: Error, retry: () => void) => Node;
127
+ fallback: (error: Error, retry: () => void) => JsxElement;
126
128
  }
127
129
  /**
128
130
  * ErrorBoundary component.
@@ -135,7 +137,7 @@ interface ErrorBoundaryProps {
135
137
  * Also registers an async error handler so that nested Suspense components
136
138
  * can propagate async errors to this boundary.
137
139
  */
138
- declare function ErrorBoundary(props: ErrorBoundaryProps): Node;
140
+ declare function ErrorBoundary(props: ErrorBoundaryProps): JsxElement;
139
141
  /**
140
142
  * Runs callback once on mount. Never re-executes.
141
143
  * Return a function to register cleanup that runs on unmount.
@@ -184,12 +186,14 @@ interface Ref<T> {
184
186
  * `ref.current` will hold the DOM element.
185
187
  */
186
188
  declare function ref<T>(): Ref<T>;
189
+ /** DOM element types accepted by JSX (mirrors JSX.Element). */
190
+ type JsxElement2 = HTMLElement | SVGElement | DocumentFragment;
187
191
  /** Props for the Suspense component. */
188
192
  interface SuspenseProps {
189
193
  /** Function that returns the children to render (may throw a Promise). */
190
- children: () => Node;
194
+ children: () => JsxElement2;
191
195
  /** Fallback renderer shown while children are pending. */
192
- fallback: () => Node;
196
+ fallback: () => JsxElement2;
193
197
  }
194
198
  /**
195
199
  * Suspense component for async boundaries.
@@ -202,7 +206,7 @@ interface SuspenseProps {
202
206
  * to the nearest ErrorBoundary. If no ErrorBoundary exists, the error is surfaced
203
207
  * globally via queueMicrotask to avoid silent swallowing.
204
208
  */
205
- declare function Suspense(props: SuspenseProps): Node;
209
+ declare function Suspense(props: SuspenseProps): JsxElement2;
206
210
  declare const ANIMATION_DURATION: string;
207
211
  declare const ANIMATION_EASING: string;
208
212
  declare const fadeIn: string;
@@ -1395,7 +1399,7 @@ declare const OutletContext: Context<OutletContextValue>;
1395
1399
  * Must be called inside a layout component rendered by RouterView.
1396
1400
  * Reads from OutletContext to determine which child to render.
1397
1401
  */
1398
- declare function Outlet(): Node;
1402
+ declare function Outlet(): HTMLElement;
1399
1403
  declare const RouterContext: Context<Router>;
1400
1404
  declare function useRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>(): UnwrapSignals<Router<T>>;
1401
1405
  /**
package/dist/src/index.js CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  slideOutToTop,
22
22
  zoomIn,
23
23
  zoomOut
24
- } from "../shared/chunk-6jyt4ycw.js";
24
+ } from "../shared/chunk-yjs76c7v.js";
25
25
  import {
26
26
  Link,
27
27
  Outlet,
@@ -30,7 +30,7 @@ import {
30
30
  createLink,
31
31
  parseSearchParams,
32
32
  useSearchParams
33
- } from "../shared/chunk-2wtb9x81.js";
33
+ } from "../shared/chunk-j5qtsm0b.js";
34
34
  import"../shared/chunk-07bh4m1e.js";
35
35
  import {
36
36
  createRouter
@@ -74,7 +74,7 @@ import {
74
74
  resolveChildren,
75
75
  s,
76
76
  variants
77
- } from "../shared/chunk-dhehvmj0.js";
77
+ } from "../shared/chunk-c3r237f0.js";
78
78
  import {
79
79
  __append,
80
80
  __element,
@@ -87,7 +87,7 @@ import {
87
87
  exitChildren,
88
88
  getIsHydrating,
89
89
  startHydration
90
- } from "../shared/chunk-vndfjfdy.js";
90
+ } from "../shared/chunk-mgfrrrjq.js";
91
91
  import"../shared/chunk-prj7nm08.js";
92
92
  import {
93
93
  RENDER_NODE_BRAND,
@@ -2,7 +2,7 @@ import {
2
2
  deserializeProps,
3
3
  onAnimationsComplete,
4
4
  resolveComponent
5
- } from "../shared/chunk-6jyt4ycw.js";
5
+ } from "../shared/chunk-yjs76c7v.js";
6
6
  import {
7
7
  __attr,
8
8
  __classList,
@@ -40,7 +40,7 @@ import {
40
40
  SIZE_KEYWORDS,
41
41
  SPACING_SCALE,
42
42
  compileTheme
43
- } from "../shared/chunk-dhehvmj0.js";
43
+ } from "../shared/chunk-c3r237f0.js";
44
44
  import {
45
45
  __append,
46
46
  __child,
@@ -53,7 +53,7 @@ import {
53
53
  claimComment,
54
54
  claimText,
55
55
  getIsHydrating
56
- } from "../shared/chunk-vndfjfdy.js";
56
+ } from "../shared/chunk-mgfrrrjq.js";
57
57
  import"../shared/chunk-prj7nm08.js";
58
58
  import {
59
59
  RENDER_NODE_BRAND,
@@ -388,7 +388,7 @@ declare const OutletContext: Context<OutletContextValue>;
388
388
  * Must be called inside a layout component rendered by RouterView.
389
389
  * Reads from OutletContext to determine which child to render.
390
390
  */
391
- declare function Outlet(): Node;
391
+ declare function Outlet(): HTMLElement;
392
392
  declare const RouterContext: Context<Router>;
393
393
  declare function useRouter<T extends Record<string, RouteConfigLike> = RouteDefinitionMap>(): UnwrapSignals<Router<T>>;
394
394
  /**
@@ -6,7 +6,7 @@ import {
6
6
  createLink,
7
7
  parseSearchParams,
8
8
  useSearchParams
9
- } from "../../shared/chunk-2wtb9x81.js";
9
+ } from "../../shared/chunk-j5qtsm0b.js";
10
10
  import"../../shared/chunk-07bh4m1e.js";
11
11
  import {
12
12
  createRouter
@@ -15,7 +15,7 @@ import {
15
15
  defineRoutes
16
16
  } from "../../shared/chunk-6wd36w21.js";
17
17
  import"../../shared/chunk-jrtrk5z4.js";
18
- import"../../shared/chunk-vndfjfdy.js";
18
+ import"../../shared/chunk-mgfrrrjq.js";
19
19
  import"../../shared/chunk-prj7nm08.js";
20
20
  import"../../shared/chunk-afawz764.js";
21
21
  import {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vertz UI framework — signals, components, JSX runtime",
@@ -69,11 +69,11 @@
69
69
  "typecheck": "tsc --noEmit"
70
70
  },
71
71
  "dependencies": {
72
- "@vertz/fetch": "^0.2.16"
72
+ "@vertz/fetch": "^0.2.18"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@happy-dom/global-registrator": "^20.7.0",
76
- "@vertz/schema": "^0.2.16",
76
+ "@vertz/schema": "^0.2.18",
77
77
  "bunup": "^0.16.31",
78
78
  "happy-dom": "^20.7.0",
79
79
  "typescript": "^5.7.0"