@passui/tanstack 0.1.2 → 0.2.0

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 CHANGED
@@ -1,53 +1,77 @@
1
- # Passui TanStack integrations
1
+ # @passui/tanstack
2
2
 
3
- Optional TanStack Form, Table and Router integrations for Passui's native
4
- React controls. Passui itself works without this package.
3
+ Optional TanStack Form, Query, Table and Router integrations for Passui.
4
+ One package supports native React and native SolidJS through separate
5
+ entry points. Shared helpers have no UI runtime dependency.
5
6
 
6
- ## Install
7
+ ## SolidJS
7
8
 
8
9
  ```bash
9
- bun add @passui/react @passui/tanstack @tanstack/react-query
10
+ bunx @passui/cli@latest init --framework solid --integration tanstack
11
+ # Manual alternative
12
+ bun add @passui/solid @passui/tanstack solid-js tailwindcss @tanstack/solid-form @tanstack/solid-query @tanstack/solid-router @tanstack/solid-table
10
13
  ```
11
14
 
12
- Use React 19 and Tailwind CSS 4. Import this stylesheet once; it includes
13
- Passui's styles:
14
-
15
15
  ```css
16
- @import "@passui/tanstack/styles.css";
16
+ @import "@passui/tanstack/solid/styles.css";
17
17
  ```
18
18
 
19
- Import an integration from its own entry point:
20
-
21
- ```tsx
22
- import { useAppForm } from "@passui/tanstack/forms"
23
- import { useAppMutation } from "@passui/tanstack/mutation"
24
- import { ComposeViewport } from "@passui/tanstack/document"
19
+ ```ts
20
+ import { createAppForm } from "@passui/tanstack/solid/forms"
21
+ import { createAppMutation } from "@passui/tanstack/solid/mutation"
22
+ import { DataTable, selectColumn } from "@passui/tanstack/solid/tables"
23
+ import { ComposeViewport } from "@passui/tanstack/solid/document"
24
+ import { AuthShell } from "@passui/tanstack/solid/auth-shell"
25
+ import { SettingList } from "@passui/tanstack/solid/settings"
26
+ import { DefaultBoundary, DefaultLoader, NotFound } from "@passui/tanstack/solid/route-boundary"
25
27
  ```
26
28
 
27
- The package exports TypeScript and TSX source. Your app's bundler must
28
- process those files and its stylesheet through Tailwind CSS 4. Query
29
- integrations use your app's QueryClientProvider.
29
+ Solid form and mutation options are accessors: `createAppForm(() => ({
30
+ defaultValues, onSubmit }))` and `createAppMutation(() => ({ mutationFn }))`.
31
+ `useAppForm` and `useAppMutation` aliases are also exported. Field contexts
32
+ return an accessor; use `field().state.value`. Bound fields include input,
33
+ checkbox, textarea, switch, radioCard, multiselect, avatar and otp.
34
+ Mount Solid QueryClientProvider around mutation consumers.
30
35
 
31
- ## Publishing
36
+ Use SolidJS 1.9.17+ and compile this package's TSX through Solid. In Vite 8,
37
+ exclude `@passui/solid` and `@passui/tanstack` from `optimizeDeps`, include
38
+ `solid` in `resolve.conditions`, and put both packages plus
39
+ `/@tanstack\/solid-/` in `ssr.noExternal`. SSR conditions should include
40
+ `solid`, `module`, `node` and `development|production`. This compiles the
41
+ Solid framework source for the right server runtime. See the complete
42
+ config in `@passui/solid`'s README or use the generated starter.
32
43
 
33
- From the Pherus checkout:
44
+ ## React
34
45
 
35
46
  ```bash
36
- bun run typecheck
37
- bun run test
38
- bun run publish:check
39
- bun publish
47
+ bunx @passui/cli@latest init --framework react --integration tanstack
40
48
  ```
41
49
 
42
- Publish the matching Passui version first. Bun resolves the local
43
- `workspace:^` dependency to a public version range when packing. Login
44
- with an npm account that can publish under `@passui`. Credentials stay in
45
- your user npm configuration.
50
+ ```css
51
+ @import "@passui/tanstack/react/styles.css";
52
+ ```
53
+
54
+ React exports use `/react/forms`, `/react/form-fields`, `/react/mutation`,
55
+ `/react/tables`, `/react/document`, `/react/auth-shell`, `/react/settings`
56
+ and `/react/route-boundary`. Existing unprefixed paths, such as `/forms`,
57
+ remain React defaults. Existing `/styles.css` also remains available.
58
+
59
+ Starting at 0.2.0, framework dependencies are optional peers rather than
60
+ mandatory React dependencies. The CLI installs the appropriate peers
61
+ while preserving existing versions. Manual React setups must install the
62
+ React TanStack adapters they use; `/document` also imports TanStack React
63
+ devtools and their Query and Router panels. See package.json for supported
64
+ peer ranges. Solid consumers do not need React packages.
65
+
66
+ ## Shared core
46
67
 
47
- The Passui repository's `publish.yml` GitHub Actions workflow uses
48
- the `npm-publish` environment and npm OIDC authentication. Its trusted
49
- publisher must reference `phe-rus/passui`.
68
+ `@passui/tanstack/core` exports framework independent table helpers and
69
+ `shouldRestoreOptimisticSnapshot`. Both mutation adapters preserve newer
70
+ concurrent cache writes when an older optimistic request fails.
50
71
 
51
- ## License
72
+ The UI packages remain independent of this optional integration. Put
73
+ framework Scripts in ComposeViewport.Window's `after` slot, outside main.
74
+ Credentials stay outside this repository. Releases use the repository's
75
+ `publish.yml` workflow and the `npm-publish` environment with npm OIDC.
52
76
 
53
77
  MIT.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@passui/tanstack",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "repository": {
@@ -25,7 +25,13 @@
25
25
  "build": "tsc --noEmit"
26
26
  },
27
27
  "dependencies": {
28
- "@hugeicons/core-free-icons": "^4.3.5",
28
+ "@hugeicons/core-free-icons": "^4.3.5"
29
+ },
30
+ "peerDependencies": {
31
+ "react": "^19.3.0",
32
+ "react-dom": "^19.3.0",
33
+ "@tanstack/react-query": "^5.104.0",
34
+ "tailwindcss": "^4.3.3",
29
35
  "@hugeicons/react": "^1.1.10",
30
36
  "@tanstack/react-devtools": "^0.10.13",
31
37
  "@tanstack/react-form": "^1.33.5",
@@ -34,13 +40,13 @@
34
40
  "@tanstack/react-router-devtools": "^1.167.2",
35
41
  "@tanstack/react-table": "^9.2.4",
36
42
  "motion": "^13.4.4",
37
- "@passui/react": "^0.1.14"
38
- },
39
- "peerDependencies": {
40
- "react": "^19.3.0",
41
- "react-dom": "^19.3.0",
42
- "@tanstack/react-query": "^5.104.0",
43
- "tailwindcss": "^4.3.3"
43
+ "@passui/react": "^0.1.15",
44
+ "@passui/solid": "^0.1.0",
45
+ "solid-js": "^1.9.17",
46
+ "@tanstack/solid-form": "^1.33.5",
47
+ "@tanstack/solid-query": "^5.104.5",
48
+ "@tanstack/solid-router": "^1.170.43",
49
+ "@tanstack/solid-table": "^9.3.1"
44
50
  },
45
51
  "devDependencies": {
46
52
  "@types/node": "^26.6.3",
@@ -49,7 +55,26 @@
49
55
  "tailwindcss": "^4.3.3",
50
56
  "typescript": "^7.0.2",
51
57
  "vitest": "5.0.5",
52
- "vite": "8.3.5"
58
+ "vite": "8.3.5",
59
+ "@hugeicons/react": "^1.1.10",
60
+ "@tanstack/react-devtools": "^0.10.13",
61
+ "@tanstack/react-form": "^1.33.5",
62
+ "@tanstack/react-query-devtools": "^5.104.0",
63
+ "@tanstack/react-router": "^1.170.39",
64
+ "@tanstack/react-router-devtools": "^1.167.2",
65
+ "@tanstack/react-table": "^9.2.4",
66
+ "motion": "^13.4.4",
67
+ "@passui/react": "^0.1.15",
68
+ "@passui/solid": "^0.1.0",
69
+ "solid-js": "1.9.17",
70
+ "@tanstack/solid-form": "1.33.5",
71
+ "@tanstack/solid-query": "5.104.5",
72
+ "@tanstack/solid-router": "1.170.43",
73
+ "@tanstack/solid-table": "9.3.1",
74
+ "vite-plugin-solid": "2.11.14",
75
+ "react": "^19.3.0",
76
+ "react-dom": "^19.3.0",
77
+ "@tanstack/react-query": "^5.104.0"
53
78
  },
54
79
  "exports": {
55
80
  "./forms": "./src/forms/index.ts",
@@ -60,7 +85,82 @@
60
85
  "./settings": "./src/settings/index.ts",
61
86
  "./mutation": "./src/mutation/index.ts",
62
87
  "./route-boundary": "./src/route-boundary/index.ts",
63
- "./styles.css": "./src/styles.css"
88
+ "./styles.css": "./src/styles.css",
89
+ "./react/forms": "./src/forms/index.ts",
90
+ "./solid/forms": "./src/solid/forms/index.ts",
91
+ "./react/form-fields": "./src/form-fields/index.ts",
92
+ "./solid/form-fields": "./src/solid/form-fields/index.ts",
93
+ "./react/tables": "./src/tables/index.ts",
94
+ "./solid/tables": "./src/solid/tables/index.ts",
95
+ "./react/document": "./src/document/index.ts",
96
+ "./solid/document": "./src/solid/document/index.ts",
97
+ "./react/auth-shell": "./src/auth-shell/index.ts",
98
+ "./solid/auth-shell": "./src/solid/auth-shell/index.ts",
99
+ "./react/settings": "./src/settings/index.ts",
100
+ "./solid/settings": "./src/solid/settings/index.ts",
101
+ "./react/mutation": "./src/mutation/index.ts",
102
+ "./solid/mutation": "./src/solid/mutation/index.ts",
103
+ "./react/route-boundary": "./src/route-boundary/index.ts",
104
+ "./solid/route-boundary": "./src/solid/route-boundary/index.ts",
105
+ "./react/styles.css": "./src/styles.css",
106
+ "./solid/styles.css": "./src/solid/styles.css",
107
+ "./core": "./src/shared/index.ts"
64
108
  },
65
- "description": "TanStack form, table and router integrations for Passui."
109
+ "description": "TanStack form, table and router integrations for Passui.",
110
+ "peerDependenciesMeta": {
111
+ "react": {
112
+ "optional": true
113
+ },
114
+ "react-dom": {
115
+ "optional": true
116
+ },
117
+ "@tanstack/react-query": {
118
+ "optional": true
119
+ },
120
+ "@hugeicons/react": {
121
+ "optional": true
122
+ },
123
+ "@tanstack/react-devtools": {
124
+ "optional": true
125
+ },
126
+ "@tanstack/react-form": {
127
+ "optional": true
128
+ },
129
+ "@tanstack/react-query-devtools": {
130
+ "optional": true
131
+ },
132
+ "@tanstack/react-router": {
133
+ "optional": true
134
+ },
135
+ "@tanstack/react-router-devtools": {
136
+ "optional": true
137
+ },
138
+ "@tanstack/react-table": {
139
+ "optional": true
140
+ },
141
+ "motion": {
142
+ "optional": true
143
+ },
144
+ "@passui/react": {
145
+ "optional": true
146
+ },
147
+ "@passui/solid": {
148
+ "optional": true
149
+ },
150
+ "solid-js": {
151
+ "optional": true
152
+ },
153
+ "@tanstack/solid-form": {
154
+ "optional": true
155
+ },
156
+ "@tanstack/solid-query": {
157
+ "optional": true
158
+ },
159
+ "@tanstack/solid-router": {
160
+ "optional": true
161
+ },
162
+ "@tanstack/solid-table": {
163
+ "optional": true
164
+ }
165
+ }
66
166
  }
@@ -24,12 +24,8 @@ type MutationContext<TOptimisticData> =
24
24
  }
25
25
  | undefined
26
26
 
27
- export function shouldRestoreOptimisticSnapshot<T>(
28
- current: T | undefined,
29
- expected: T
30
- ) {
31
- return current === expected
32
- }
27
+ import { shouldRestoreOptimisticSnapshot } from "../shared/optimistic"
28
+ export { shouldRestoreOptimisticSnapshot } from "../shared/optimistic"
33
29
 
34
30
  type AppMutationOptions<TData, TVariables, TOptimisticData> =
35
31
  Omit<
@@ -0,0 +1,2 @@
1
+ export * from "./optimistic"
2
+ export * from "./table"
@@ -0,0 +1,7 @@
1
+ /** Restore only the snapshot this mutation wrote, preserving newer concurrent writes. */
2
+ export function shouldRestoreOptimisticSnapshot<T>(
3
+ current: T | undefined,
4
+ expected: T
5
+ ) {
6
+ return current === expected
7
+ }
@@ -0,0 +1,30 @@
1
+ export function isArrayValuedColumn<TData>(
2
+ data: TData[],
3
+ colId: string
4
+ ): boolean {
5
+ return data.some((row) =>
6
+ Array.isArray((row as Record<string, unknown>)[colId])
7
+ )
8
+ }
9
+ export function getColumnLabel(column: {
10
+ columnDef: { header?: unknown }
11
+ id: string
12
+ }) {
13
+ const header = column.columnDef.header
14
+ return typeof header === "string"
15
+ ? header
16
+ : column.id
17
+ .replace(/([A-Z])/g, " $1")
18
+ .replace(/^./, (value) => value.toUpperCase())
19
+ }
20
+ export function columnIdOf(column: {
21
+ id?: string
22
+ accessorKey?: unknown
23
+ }): string | undefined {
24
+ return (
25
+ column.id ||
26
+ (typeof column.accessorKey === "string"
27
+ ? column.accessorKey
28
+ : undefined)
29
+ )
30
+ }
@@ -0,0 +1,20 @@
1
+ /** @jsxImportSource solid-js */
2
+ import { Outlet, useLocation } from "@tanstack/solid-router"
3
+ import { Show, type JSX } from "solid-js"
4
+ export function AuthShell(props: { brand: JSX.Element }) {
5
+ const location = useLocation()
6
+ return (
7
+ <section class="relative isolate flex min-h-dvh flex-col items-center justify-center px-4 py-12">
8
+ <div class="flex w-full max-w-[26rem] flex-col items-start gap-6">
9
+ {props.brand}
10
+ <Show when={location().pathname} keyed>
11
+ {(_pathname) => (
12
+ <div class="w-full motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-right-4 motion-safe:duration-500">
13
+ <Outlet />
14
+ </div>
15
+ )}
16
+ </Show>
17
+ </div>
18
+ </section>
19
+ )
20
+ }
@@ -0,0 +1 @@
1
+ export * from "./auth-shell"
@@ -0,0 +1,69 @@
1
+ /** @jsxImportSource solid-js */
2
+ import { splitProps, type JSX } from "solid-js"
3
+ import { HydrationScript } from "solid-js/web"
4
+ import { cn } from "@passui/solid/cn"
5
+ function Window(
6
+ props: JSX.HTMLAttributes<HTMLBodyElement> & {
7
+ after?: JSX.Element
8
+ before?: JSX.Element
9
+ className?: string
10
+ }
11
+ ) {
12
+ const [local, rest] = splitProps(props, [
13
+ "children",
14
+ "after",
15
+ "before",
16
+ "class",
17
+ "className",
18
+ ])
19
+ return (
20
+ <body
21
+ {...rest}
22
+ class={cn(
23
+ "fixed h-svh w-full min-w-full bg-background overflow-x-hidden typeset wrap-anywhere flex flex-col",
24
+ local.class,
25
+ local.className
26
+ )}
27
+ >
28
+ {local.before}
29
+ <main class="flex flex-1 flex-col min-h-svh overflow-auto no-scrollbar">
30
+ {local.children}
31
+ </main>
32
+ {local.after}
33
+ </body>
34
+ )
35
+ }
36
+ export const ComposeViewport = Object.assign(
37
+ function ComposeViewport(
38
+ props: JSX.IntrinsicElements["html"] & {
39
+ className?: string
40
+ head?: JSX.Element
41
+ }
42
+ ) {
43
+ const [local, rest] = splitProps(props, [
44
+ "class",
45
+ "className",
46
+ "lang",
47
+ "head",
48
+ "children",
49
+ ])
50
+ return (
51
+ <html
52
+ {...rest}
53
+ lang={local.lang ?? "en"}
54
+ class={cn(
55
+ "antialiased blur-none",
56
+ local.class,
57
+ local.className
58
+ )}
59
+ >
60
+ <head>
61
+ <HydrationScript />
62
+ {local.head}
63
+ </head>
64
+ {local.children}
65
+ </html>
66
+ )
67
+ },
68
+ { Window }
69
+ )
@@ -0,0 +1 @@
1
+ export * from "./compose-viewport"