@nadicodeai/ui 12.1.118 → 12.1.120
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.
|
@@ -67,6 +67,10 @@ export declare function PageActionsRow({ period, primary, secondary, menu }: Pag
|
|
|
67
67
|
* Holds the place on the title's row where the open page puts its actions. The
|
|
68
68
|
* product's chrome draws the row (`PageHeader`) and the page below draws its
|
|
69
69
|
* commands (`PageActions`), so the two meet here rather than through props.
|
|
70
|
+
*
|
|
71
|
+
* The context's value never changes: a changed context value above a page whose
|
|
72
|
+
* server HTML is still streaming makes React render that page again in the
|
|
73
|
+
* browser, beside the server's copy.
|
|
70
74
|
*/
|
|
71
75
|
export declare function PageActionsHostProvider({ children }: {
|
|
72
76
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-actions.d.ts","sourceRoot":"","sources":["../../src/components/page-actions.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"page-actions.d.ts","sourceRoot":"","sources":["../../src/components/page-actions.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GACzB;IAAE,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE;AACrF;;;GAGG;GACD;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,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,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,KAAK,EACL,IAAI,EACJ,OAAO,GACR,EAAE;IACD,OAAO,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,EAAE,cAAc,CAAC;CACzB,+BA+BA;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,gBAAgB,sCAUpF;AAwBD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAG5E;AAED,yFAAyF;AACzF,wBAAgB,eAAe,gCAS9B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,sCAyBlD"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowUpRight } from "lucide-react";
|
|
4
|
-
import { createContext,
|
|
4
|
+
import { createContext, useContext, useEffect, useId, useState, } from "react";
|
|
5
5
|
import { createPortal } from "react-dom";
|
|
6
|
+
import { createStore, useStore } from "zustand";
|
|
6
7
|
import { ActionMenu } from "./action-menu.js";
|
|
7
8
|
import { Button, ButtonLink } from "./button.js";
|
|
8
9
|
export function PageCommandButton({ command, shape, size, variant, }) {
|
|
@@ -31,23 +32,34 @@ export function PageActionsRow({ period, primary, secondary, menu }) {
|
|
|
31
32
|
return null;
|
|
32
33
|
return (_jsxs("div", { "data-slot": "page-actions", className: "flex max-w-full min-w-0 flex-wrap items-center gap-2", children: [period, secondary ? _jsx(PageCommandButton, { command: secondary, variant: "outline" }) : null, primary ? _jsx(PageCommandButton, { command: primary, variant: "default" }) : null, menu ? _jsx(ActionMenu, { ...menu }) : null] }));
|
|
33
34
|
}
|
|
35
|
+
function createHost() {
|
|
36
|
+
return createStore((set) => ({
|
|
37
|
+
element: null,
|
|
38
|
+
owner: null,
|
|
39
|
+
attach: (element) => set({ element }),
|
|
40
|
+
claim: (owner) => set({ owner }),
|
|
41
|
+
release: (owner) => set((state) => (state.owner === owner ? { owner: null } : state)),
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
const unhosted = createHost();
|
|
34
45
|
const PageActionsHostContext = createContext(null);
|
|
35
46
|
/**
|
|
36
47
|
* Holds the place on the title's row where the open page puts its actions. The
|
|
37
48
|
* product's chrome draws the row (`PageHeader`) and the page below draws its
|
|
38
49
|
* commands (`PageActions`), so the two meet here rather than through props.
|
|
50
|
+
*
|
|
51
|
+
* The context's value never changes: a changed context value above a page whose
|
|
52
|
+
* server HTML is still streaming makes React render that page again in the
|
|
53
|
+
* browser, beside the server's copy.
|
|
39
54
|
*/
|
|
40
55
|
export function PageActionsHostProvider({ children }) {
|
|
41
|
-
const [
|
|
42
|
-
|
|
43
|
-
const claim = useCallback((next) => setOwner(next), []);
|
|
44
|
-
const release = useCallback((previous) => setOwner((current) => (current === previous ? null : current)), []);
|
|
45
|
-
return (_jsx(PageActionsHostContext, { value: { element, attach, owner, claim, release }, children: children }));
|
|
56
|
+
const [host] = useState(createHost);
|
|
57
|
+
return _jsx(PageActionsHostContext, { value: host, children: children });
|
|
46
58
|
}
|
|
47
59
|
/** The element on `PageHeader`'s title row that the page's `PageActions` render into. */
|
|
48
60
|
export function PageActionsSlot() {
|
|
49
61
|
const host = useContext(PageActionsHostContext);
|
|
50
|
-
return (_jsx("div", { "data-slot": "page-header-actions", className: "flex max-w-full min-w-0 items-center empty:hidden", ref: host?.attach }));
|
|
62
|
+
return (_jsx("div", { "data-slot": "page-header-actions", className: "flex max-w-full min-w-0 items-center empty:hidden", ref: host?.getState().attach }));
|
|
51
63
|
}
|
|
52
64
|
/**
|
|
53
65
|
* A page's actions, drawn on its title's row. Only the page shown last owns
|
|
@@ -64,8 +76,10 @@ export function PageActionsSlot() {
|
|
|
64
76
|
export function PageActions(props) {
|
|
65
77
|
const host = useContext(PageActionsHostContext);
|
|
66
78
|
const id = useId();
|
|
67
|
-
const
|
|
68
|
-
const
|
|
79
|
+
const element = useStore(host ?? unhosted, (state) => state.element);
|
|
80
|
+
const owner = useStore(host ?? unhosted, (state) => state.owner);
|
|
81
|
+
const claim = host?.getState().claim;
|
|
82
|
+
const release = host?.getState().release;
|
|
69
83
|
const hasActions = Boolean(props.period || props.primary || props.secondary || props.menu);
|
|
70
84
|
useEffect(() => {
|
|
71
85
|
if (!hasActions)
|
|
@@ -76,7 +90,7 @@ export function PageActions(props) {
|
|
|
76
90
|
if (!host) {
|
|
77
91
|
return (_jsx("div", { className: "flex justify-end empty:hidden", children: _jsx(PageActionsRow, { ...props }) }));
|
|
78
92
|
}
|
|
79
|
-
if (!
|
|
93
|
+
if (!element || owner !== id)
|
|
80
94
|
return null;
|
|
81
|
-
return createPortal(_jsx(PageActionsRow, { ...props }),
|
|
95
|
+
return createPortal(_jsx(PageActionsRow, { ...props }), element);
|
|
82
96
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadicodeai/ui",
|
|
3
|
-
"version": "12.1.
|
|
3
|
+
"version": "12.1.120",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"generate:merge-tokens": "node scripts/generate-merge-tokens.mjs",
|
|
68
68
|
"generate:usage": "node scripts/generate-usage.mjs",
|
|
69
69
|
"prepack": "npm run build",
|
|
70
|
-
"lint": "node scripts/generate-merge-tokens.mjs --check && node scripts/generate-usage.mjs --check && node ../../tools/workspace/heavy-slots.mjs -- eslint --max-warnings=0",
|
|
70
|
+
"lint": "npm run lint:oxlint && node scripts/generate-merge-tokens.mjs --check && node scripts/generate-usage.mjs --check && node ../../tools/workspace/heavy-slots.mjs -- eslint --max-warnings=0",
|
|
71
|
+
"lint:oxlint": "node ../../tools/workspace/heavy-slots.mjs -- oxlint",
|
|
71
72
|
"typecheck": "node ../../tools/workspace/heavy-slots.mjs -- node ../../node_modules/typescript-native/bin/tsc --checkers 2 --noEmit",
|
|
72
73
|
"check": "npm run lint && npm run typecheck",
|
|
73
74
|
"check:static": "npm run check",
|
|
@@ -77,12 +78,12 @@
|
|
|
77
78
|
"test:distribution": "node ../../tools/release/package-smoke-test.mjs"
|
|
78
79
|
},
|
|
79
80
|
"dependencies": {
|
|
80
|
-
"@assistant-ui/react": "0.15.
|
|
81
|
-
"@assistant-ui/react-markdown": "0.14.
|
|
81
|
+
"@assistant-ui/react": "0.15.29",
|
|
82
|
+
"@assistant-ui/react-markdown": "0.14.23",
|
|
82
83
|
"@base-ui/react": "^1.9.0",
|
|
83
84
|
"@iconify-icons/logos": "^2.0.3",
|
|
84
85
|
"@iconify/react": "^6.0.2",
|
|
85
|
-
"@nadicodeai/design-system": "12.1.
|
|
86
|
+
"@nadicodeai/design-system": "12.1.120",
|
|
86
87
|
"@tanstack/react-table": "^9.3.1",
|
|
87
88
|
"@vgpu/wgsl": "0.6.0",
|
|
88
89
|
"class-variance-authority": "^0.7.1",
|
|
@@ -91,8 +92,8 @@
|
|
|
91
92
|
"date-fns": "^4.4.0",
|
|
92
93
|
"embla-carousel-react": "^8.6.0",
|
|
93
94
|
"input-otp": "^1.5.0",
|
|
94
|
-
"lucide-react": "1.
|
|
95
|
-
"motion": "^
|
|
95
|
+
"lucide-react": "1.58.0",
|
|
96
|
+
"motion": "^14.3.0",
|
|
96
97
|
"next-themes": "^0.4.6",
|
|
97
98
|
"qrcode": "^1.5.4",
|
|
98
99
|
"react-day-picker": "^10.0.2",
|
|
@@ -115,7 +116,10 @@
|
|
|
115
116
|
"devDependencies": {
|
|
116
117
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
117
118
|
"@lobehub/icons-static-svg": "^1.95.1",
|
|
119
|
+
"@nadicodeai/eslint-config": "*",
|
|
118
120
|
"@nadicodeai/eslint-plugin": "*",
|
|
121
|
+
"@nadicodeai/oxlint-config": "*",
|
|
122
|
+
"@nadicodeai/test-support": "*",
|
|
119
123
|
"@stryker-mutator/core": "10.0.0",
|
|
120
124
|
"@stryker-mutator/vitest-runner": "10.0.0",
|
|
121
125
|
"@tailwindcss/postcss": "^4.3.3",
|
|
@@ -127,6 +131,7 @@
|
|
|
127
131
|
"esbuild": "^0.28.2",
|
|
128
132
|
"eslint": "^9.39.4",
|
|
129
133
|
"jsdom": "^30.1.3",
|
|
134
|
+
"oxlint": "1.88.0",
|
|
130
135
|
"postcss": "^8.5.30",
|
|
131
136
|
"publint": "^0.3.25",
|
|
132
137
|
"react": "19.3.1",
|
|
@@ -135,6 +140,6 @@
|
|
|
135
140
|
"tailwindcss": "^4.3.3",
|
|
136
141
|
"typescript": "^6",
|
|
137
142
|
"typescript-native": "npm:typescript@7.0.2",
|
|
138
|
-
"vitest": "^5.0.
|
|
143
|
+
"vitest": "^5.0.5"
|
|
139
144
|
}
|
|
140
145
|
}
|