@vertz/ui 0.2.32 → 0.2.34
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.
- package/README.md +81 -85
- package/dist/shared/{chunk-gz7rj5tv.js → chunk-rdz5k67m.js} +12 -0
- package/dist/src/index.js +1 -1
- package/dist/src/internals.js +1 -1
- package/dist/src/query/public.js +1 -1
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -160,9 +160,7 @@ import { query } from '@vertz/ui';
|
|
|
160
160
|
function UserProfile() {
|
|
161
161
|
let userId = 1;
|
|
162
162
|
|
|
163
|
-
const { data, loading } = query(() =>
|
|
164
|
-
fetch(`/api/users/${userId}`).then((r) => r.json())
|
|
165
|
-
);
|
|
163
|
+
const { data, loading } = query(() => fetch(`/api/users/${userId}`).then((r) => r.json()));
|
|
166
164
|
|
|
167
165
|
return (
|
|
168
166
|
<div>
|
|
@@ -316,10 +314,12 @@ const createUser = Object.assign(
|
|
|
316
314
|
const res = await fetch('/api/users', { method: 'POST', body: JSON.stringify(body) });
|
|
317
315
|
return res.json() as Promise<{ id: string }>;
|
|
318
316
|
},
|
|
319
|
-
{ url: '/api/users', method: 'POST' }
|
|
317
|
+
{ url: '/api/users', method: 'POST' },
|
|
320
318
|
);
|
|
321
319
|
|
|
322
|
-
const userSchema = {
|
|
320
|
+
const userSchema = {
|
|
321
|
+
/* validation schema */
|
|
322
|
+
};
|
|
323
323
|
|
|
324
324
|
function CreateUser() {
|
|
325
325
|
const f = form(createUser, {
|
|
@@ -442,9 +442,7 @@ function ProjectToolbar() {
|
|
|
442
442
|
<div>
|
|
443
443
|
{deleteCheck.allowed && <button onClick={handleDelete}>Delete</button>}
|
|
444
444
|
{deleteCheck.reason === 'plan_required' && <span>Upgrade to unlock</span>}
|
|
445
|
-
{deleteCheck.meta?.limit &&
|
|
446
|
-
<span>{deleteCheck.meta.limit.remaining} uses left</span>
|
|
447
|
-
)}
|
|
445
|
+
{deleteCheck.meta?.limit && <span>{deleteCheck.meta.limit.remaining} uses left</span>}
|
|
448
446
|
</div>
|
|
449
447
|
);
|
|
450
448
|
}
|
|
@@ -471,9 +469,7 @@ function App() {
|
|
|
471
469
|
|
|
472
470
|
return (
|
|
473
471
|
<AccessContext.Provider value={accessValue}>
|
|
474
|
-
<AccessGate fallback={() => <Spinner />}>
|
|
475
|
-
{() => <Router />}
|
|
476
|
-
</AccessGate>
|
|
472
|
+
<AccessGate fallback={() => <Spinner />}>{() => <Router />}</AccessGate>
|
|
477
473
|
</AccessContext.Provider>
|
|
478
474
|
);
|
|
479
475
|
}
|
|
@@ -497,7 +493,7 @@ function Logger() {
|
|
|
497
493
|
|
|
498
494
|
watch(
|
|
499
495
|
() => count,
|
|
500
|
-
(value) => console.log('count changed to', value)
|
|
496
|
+
(value) => console.log('count changed to', value),
|
|
501
497
|
);
|
|
502
498
|
|
|
503
499
|
return <button onClick={() => count++}>Increment</button>;
|
|
@@ -545,23 +541,23 @@ unmount();
|
|
|
545
541
|
|
|
546
542
|
### Query Helpers
|
|
547
543
|
|
|
548
|
-
| Export
|
|
549
|
-
|
|
550
|
-
| `findByTestId(id)`
|
|
551
|
-
| `findByText(text)`
|
|
552
|
-
| `queryByTestId(id)`
|
|
553
|
-
| `queryByText(text)`
|
|
554
|
-
| `waitFor(fn, options?)` | Retry an assertion until it passes
|
|
544
|
+
| Export | Description |
|
|
545
|
+
| ----------------------- | ----------------------------------------------------------- |
|
|
546
|
+
| `findByTestId(id)` | Find element by `data-testid` — throws if not found |
|
|
547
|
+
| `findByText(text)` | Find element by text content — throws if not found |
|
|
548
|
+
| `queryByTestId(id)` | Find element by `data-testid` — returns `null` if not found |
|
|
549
|
+
| `queryByText(text)` | Find element by text content — returns `null` if not found |
|
|
550
|
+
| `waitFor(fn, options?)` | Retry an assertion until it passes |
|
|
555
551
|
|
|
556
552
|
### Interaction Helpers
|
|
557
553
|
|
|
558
|
-
| Export
|
|
559
|
-
|
|
560
|
-
| `click(el)`
|
|
561
|
-
| `type(el, text)`
|
|
562
|
-
| `press(key)`
|
|
563
|
-
| `fillForm(form, values)` | Fill multiple form fields
|
|
564
|
-
| `submitForm(form)`
|
|
554
|
+
| Export | Description |
|
|
555
|
+
| ------------------------ | ----------------------------- |
|
|
556
|
+
| `click(el)` | Simulate a click event |
|
|
557
|
+
| `type(el, text)` | Simulate typing into an input |
|
|
558
|
+
| `press(key)` | Simulate a key press |
|
|
559
|
+
| `fillForm(form, values)` | Fill multiple form fields |
|
|
560
|
+
| `submitForm(form)` | Submit a form |
|
|
565
561
|
|
|
566
562
|
### Route Testing
|
|
567
563
|
|
|
@@ -573,7 +569,7 @@ const { component, router, navigate } = await createTestRouter(
|
|
|
573
569
|
'/': { component: () => <Home /> },
|
|
574
570
|
'/about': { component: () => <About /> },
|
|
575
571
|
},
|
|
576
|
-
{ initialPath: '/' }
|
|
572
|
+
{ initialPath: '/' },
|
|
577
573
|
);
|
|
578
574
|
|
|
579
575
|
await navigate('/about');
|
|
@@ -638,93 +634,93 @@ onMount(() => {
|
|
|
638
634
|
|
|
639
635
|
### Lifecycle
|
|
640
636
|
|
|
641
|
-
| Export
|
|
642
|
-
|
|
637
|
+
| Export | Description |
|
|
638
|
+
| --------- | --------------------------------------------------------------------- |
|
|
643
639
|
| `onMount` | Run code once when a component mounts (return a function for cleanup) |
|
|
644
|
-
| `watch`
|
|
640
|
+
| `watch` | Watch a dependency and run a callback on change |
|
|
645
641
|
|
|
646
642
|
### Components
|
|
647
643
|
|
|
648
|
-
| Export
|
|
649
|
-
|
|
644
|
+
| Export | Description |
|
|
645
|
+
| --------------- | ----------------------------------------- |
|
|
650
646
|
| `createContext` | Create a context for dependency injection |
|
|
651
|
-
| `useContext`
|
|
652
|
-
| `children`
|
|
653
|
-
| `ref`
|
|
654
|
-
| `ErrorBoundary` | Catch errors in a component tree
|
|
655
|
-
| `Suspense`
|
|
647
|
+
| `useContext` | Read a context value |
|
|
648
|
+
| `children` | Access resolved children |
|
|
649
|
+
| `ref` | Create a ref for DOM element access |
|
|
650
|
+
| `ErrorBoundary` | Catch errors in a component tree |
|
|
651
|
+
| `Suspense` | Show fallback while async content loads |
|
|
656
652
|
|
|
657
653
|
### Mounting
|
|
658
654
|
|
|
659
|
-
| Export
|
|
660
|
-
|
|
655
|
+
| Export | Description |
|
|
656
|
+
| ------- | ----------------------------- |
|
|
661
657
|
| `mount` | Mount an app to a DOM element |
|
|
662
658
|
|
|
663
659
|
### CSS (`@vertz/ui/css`)
|
|
664
660
|
|
|
665
|
-
| Export
|
|
666
|
-
|
|
667
|
-
| `css`
|
|
668
|
-
| `variants`
|
|
669
|
-
| `s`
|
|
670
|
-
| `defineTheme`
|
|
671
|
-
| `compileTheme`
|
|
672
|
-
| `ThemeProvider` | Provide a theme to descendants
|
|
673
|
-
| `globalCss`
|
|
674
|
-
| `font`
|
|
675
|
-
| `compileFonts`
|
|
661
|
+
| Export | Description |
|
|
662
|
+
| --------------- | --------------------------------------------------------- |
|
|
663
|
+
| `css` | Create scoped styles |
|
|
664
|
+
| `variants` | Create typed variant styles |
|
|
665
|
+
| `s` | Inline dynamic styles |
|
|
666
|
+
| `defineTheme` | Define a theme |
|
|
667
|
+
| `compileTheme` | Compile a theme to CSS |
|
|
668
|
+
| `ThemeProvider` | Provide a theme to descendants |
|
|
669
|
+
| `globalCss` | Inject global CSS |
|
|
670
|
+
| `font` | Declare a font family descriptor |
|
|
671
|
+
| `compileFonts` | Compile font descriptors into CSS, vars, and preload tags |
|
|
676
672
|
|
|
677
673
|
### Forms
|
|
678
674
|
|
|
679
|
-
| Export
|
|
680
|
-
|
|
681
|
-
| `form`
|
|
682
|
-
| `formDataToObject` | Convert FormData to a plain object
|
|
683
|
-
| `validate`
|
|
675
|
+
| Export | Description |
|
|
676
|
+
| ------------------ | ------------------------------------ |
|
|
677
|
+
| `form` | Create a form bound to an SDK method |
|
|
678
|
+
| `formDataToObject` | Convert FormData to a plain object |
|
|
679
|
+
| `validate` | Run schema validation |
|
|
684
680
|
|
|
685
681
|
### Data
|
|
686
682
|
|
|
687
|
-
| Export
|
|
688
|
-
|
|
683
|
+
| Export | Description |
|
|
684
|
+
| ------- | ---------------------- |
|
|
689
685
|
| `query` | Reactive data fetching |
|
|
690
686
|
|
|
691
687
|
### Routing (`@vertz/ui/router`)
|
|
692
688
|
|
|
693
|
-
| Export
|
|
694
|
-
|
|
695
|
-
| `defineRoutes`
|
|
696
|
-
| `createRouter`
|
|
697
|
-
| `createLink`
|
|
698
|
-
| `createOutlet`
|
|
689
|
+
| Export | Description |
|
|
690
|
+
| ------------------- | --------------------------- |
|
|
691
|
+
| `defineRoutes` | Define route configuration |
|
|
692
|
+
| `createRouter` | Create a router instance |
|
|
693
|
+
| `createLink` | Create a `<Link>` component |
|
|
694
|
+
| `createOutlet` | Create a route outlet |
|
|
699
695
|
| `parseSearchParams` | Parse URL search parameters |
|
|
700
|
-
| `useSearchParams`
|
|
696
|
+
| `useSearchParams` | Reactive search parameters |
|
|
701
697
|
|
|
702
698
|
### Auth (`@vertz/ui/auth`)
|
|
703
699
|
|
|
704
|
-
| Export
|
|
705
|
-
|
|
706
|
-
| `AccessContext`
|
|
707
|
-
| `can`
|
|
708
|
-
| `AccessGate`
|
|
709
|
-
| `createAccessProvider` | Bootstrap access context from SSR data
|
|
710
|
-
| `useAccessContext`
|
|
700
|
+
| Export | Description |
|
|
701
|
+
| ---------------------- | ------------------------------------------------- |
|
|
702
|
+
| `AccessContext` | Context for access set data |
|
|
703
|
+
| `can` | Check if the user has an entitlement |
|
|
704
|
+
| `AccessGate` | Gate rendering until access set loads |
|
|
705
|
+
| `createAccessProvider` | Bootstrap access context from SSR data |
|
|
706
|
+
| `useAccessContext` | Read the access context (throws without provider) |
|
|
711
707
|
|
|
712
708
|
### Testing (`@vertz/ui/test`)
|
|
713
709
|
|
|
714
|
-
| Export
|
|
715
|
-
|
|
716
|
-
| `renderTest`
|
|
717
|
-
| `findByTestId`
|
|
718
|
-
| `findByText`
|
|
719
|
-
| `queryByTestId`
|
|
720
|
-
| `queryByText`
|
|
721
|
-
| `waitFor`
|
|
722
|
-
| `click`
|
|
723
|
-
| `type`
|
|
724
|
-
| `press`
|
|
725
|
-
| `fillForm`
|
|
726
|
-
| `submitForm`
|
|
727
|
-
| `createTestRouter` | Create a router for testing
|
|
710
|
+
| Export | Description |
|
|
711
|
+
| ------------------ | ---------------------------------------- |
|
|
712
|
+
| `renderTest` | Mount a component for testing |
|
|
713
|
+
| `findByTestId` | Find element by `data-testid` (throws) |
|
|
714
|
+
| `findByText` | Find element by text content (throws) |
|
|
715
|
+
| `queryByTestId` | Find element by `data-testid` (nullable) |
|
|
716
|
+
| `queryByText` | Find element by text content (nullable) |
|
|
717
|
+
| `waitFor` | Retry an assertion until it passes |
|
|
718
|
+
| `click` | Simulate a click |
|
|
719
|
+
| `type` | Simulate typing |
|
|
720
|
+
| `press` | Simulate a key press |
|
|
721
|
+
| `fillForm` | Fill multiple form fields |
|
|
722
|
+
| `submitForm` | Submit a form |
|
|
723
|
+
| `createTestRouter` | Create a router for testing |
|
|
728
724
|
|
|
729
725
|
---
|
|
730
726
|
|
|
@@ -1151,6 +1151,18 @@ function query(source, options = {}) {
|
|
|
1151
1151
|
disposeFn = lifecycleEffect(() => {
|
|
1152
1152
|
refetchTrigger.value;
|
|
1153
1153
|
if (isFirst && ssrHydrated) {
|
|
1154
|
+
if (!customKey) {
|
|
1155
|
+
const trackRaw = callThunkWithCapture();
|
|
1156
|
+
if (trackRaw !== null) {
|
|
1157
|
+
if (isQueryDescriptor(trackRaw)) {
|
|
1158
|
+
if (trackRaw._entity && !entityMeta) {
|
|
1159
|
+
entityMeta = trackRaw._entity;
|
|
1160
|
+
}
|
|
1161
|
+
} else {
|
|
1162
|
+
trackRaw.catch(() => {});
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1154
1166
|
isFirst = false;
|
|
1155
1167
|
return;
|
|
1156
1168
|
}
|
package/dist/src/index.js
CHANGED
package/dist/src/internals.js
CHANGED
package/dist/src/query/public.js
CHANGED
package/package.json
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertz/ui",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.2.34",
|
|
6
4
|
"description": "Vertz UI framework — signals, components, JSX runtime",
|
|
5
|
+
"license": "MIT",
|
|
7
6
|
"repository": {
|
|
8
7
|
"type": "git",
|
|
9
8
|
"url": "https://github.com/vertz-dev/vertz.git",
|
|
10
9
|
"directory": "packages/ui"
|
|
11
10
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"reactivity.json"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"dist/shared/*.js"
|
|
18
|
+
],
|
|
16
19
|
"main": "dist/src/index.js",
|
|
17
20
|
"types": "dist/src/index.d.ts",
|
|
18
21
|
"exports": {
|
|
@@ -62,10 +65,10 @@
|
|
|
62
65
|
},
|
|
63
66
|
"./reactivity.json": "./reactivity.json"
|
|
64
67
|
},
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public",
|
|
70
|
+
"provenance": true
|
|
71
|
+
},
|
|
69
72
|
"scripts": {
|
|
70
73
|
"build": "bunup",
|
|
71
74
|
"test": "bun test",
|
|
@@ -74,19 +77,16 @@
|
|
|
74
77
|
"typecheck": "tsc --noEmit"
|
|
75
78
|
},
|
|
76
79
|
"dependencies": {
|
|
77
|
-
"@vertz/fetch": "^0.2.
|
|
80
|
+
"@vertz/fetch": "^0.2.31"
|
|
78
81
|
},
|
|
79
82
|
"devDependencies": {
|
|
80
83
|
"@happy-dom/global-registrator": "^20.7.0",
|
|
81
|
-
"@vertz/schema": "^0.2.
|
|
84
|
+
"@vertz/schema": "^0.2.31",
|
|
82
85
|
"bunup": "^0.16.31",
|
|
83
86
|
"happy-dom": "^20.7.0",
|
|
84
87
|
"typescript": "^5.7.0"
|
|
85
88
|
},
|
|
86
89
|
"engines": {
|
|
87
90
|
"node": ">=22"
|
|
88
|
-
}
|
|
89
|
-
"sideEffects": [
|
|
90
|
-
"dist/shared/*.js"
|
|
91
|
-
]
|
|
91
|
+
}
|
|
92
92
|
}
|