@skyroc/scripts 2.5.2 → 2.5.3

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 (32) hide show
  1. package/dist/cli.mjs +2 -2
  2. package/dist/{config-Cj9IzlRz.mjs → config-DWrHl2hS.mjs} +1 -0
  3. package/dist/index.mjs +1 -1
  4. package/package.json +3 -3
  5. package/templates/admin/README.md +1 -2
  6. package/templates/admin/package.json +4 -1
  7. package/templates/admin/src/App.tsx +2 -2
  8. package/templates/admin/src/config.ts +1 -1
  9. package/templates/admin/src/main.tsx +1 -1
  10. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/charts.csv +26 -26
  11. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/colors.csv +97 -97
  12. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/landing.csv +28 -28
  13. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/products.csv +96 -96
  14. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -53
  15. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -56
  16. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -53
  17. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -52
  18. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/react.csv +54 -54
  19. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -54
  20. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -51
  21. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -50
  22. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/styles.csv +68 -68
  23. package/templates/admin-root/.agents/skills/ui-ux-pro-max/data/ux-guidelines.csv +99 -99
  24. package/templates/admin-root/.agents/skills/ui-ux-pro-max/scripts/search.py +114 -114
  25. package/templates/admin-root/.claude/skills/migrate-oxfmt +1 -0
  26. package/templates/admin-root/.claude/skills/migrate-oxlint +1 -0
  27. package/templates/admin-root.manifest.json +1 -1
  28. package/templates/admin-shell/devtools/AdminDevtools.css +27 -0
  29. package/templates/admin-shell/devtools/AdminDevtools.tsx +253 -0
  30. package/templates/admin-shell/devtools/index.ts +7 -0
  31. package/templates/admin-shell/devtools/jotai.ts +2 -0
  32. package/templates/admin.meta.json +5 -2
@@ -0,0 +1,253 @@
1
+ // oxlint-disable import/no-unassigned-import
2
+ import type { TanStackDevtoolsReactInit, TanStackDevtoolsReactPlugin } from '@tanstack/react-devtools';
3
+ import type { QueryClient } from '@tanstack/react-query';
4
+ import type { AnyRouter } from '@tanstack/react-router';
5
+ import type { DevToolsProps } from 'jotai-devtools';
6
+ import type { Store } from 'jotai/vanilla/store';
7
+ import type { CSSProperties } from 'react';
8
+
9
+ import { useAtomsDevtools } from 'jotai-devtools/utils';
10
+ import { Suspense, lazy, useMemo } from 'react';
11
+
12
+ import './AdminDevtools.css';
13
+
14
+ type TanStackDevtoolsConfig = NonNullable<TanStackDevtoolsReactInit['config']>;
15
+ type AdminDevtoolsTheme = DevToolsProps['theme'];
16
+ type AdminDevtoolsTriggerOffsetValue = number | string;
17
+
18
+ export interface AdminJotaiDevtoolsTriggerOffset {
19
+ /** Distance from the bottom viewport edge for the floating trigger. */
20
+ bottom?: AdminDevtoolsTriggerOffsetValue;
21
+
22
+ /** Distance from the left viewport edge for the floating trigger. */
23
+ left?: AdminDevtoolsTriggerOffsetValue;
24
+
25
+ /** Distance from the right viewport edge for the floating trigger. */
26
+ right?: AdminDevtoolsTriggerOffsetValue;
27
+
28
+ /** Distance from the top viewport edge for the floating trigger. */
29
+ top?: AdminDevtoolsTriggerOffsetValue;
30
+ }
31
+
32
+ type JotaiDevtoolsTriggerOffsetStyle = CSSProperties & {
33
+ '--skyroc-jotai-devtools-trigger-bottom'?: string;
34
+ '--skyroc-jotai-devtools-trigger-left'?: string;
35
+ '--skyroc-jotai-devtools-trigger-right'?: string;
36
+ '--skyroc-jotai-devtools-trigger-top'?: string;
37
+ };
38
+
39
+ export interface AdminJotaiDevtoolsConfig {
40
+ /** Redux DevTools connection name for the atom timeline. */
41
+ name?: string;
42
+
43
+ /** Whether to show the embedded Jotai inspector panel. */
44
+ panel?: boolean;
45
+
46
+ /** Jotai devtools panel position. */
47
+ position?: DevToolsProps['position'];
48
+
49
+ /** Whether to record atom changes in the Redux DevTools timeline. */
50
+ timeline?: boolean;
51
+
52
+ /** Fixed trigger offsets for avoiding app chrome such as the admin sider. */
53
+ triggerOffset?: AdminJotaiDevtoolsTriggerOffset;
54
+ }
55
+
56
+ export interface AdminDevtoolsConfig {
57
+ /** Whether any admin devtools should be rendered. */
58
+ enabled?: boolean;
59
+
60
+ /** Whether to enable Jotai devtools, or the detailed Jotai devtools options. */
61
+ jotai?: boolean | AdminJotaiDevtoolsConfig;
62
+
63
+ /** TanStack devtools trigger position. */
64
+ position?: TanStackDevtoolsConfig['position'];
65
+
66
+ /** Whether to enable the TanStack Query panel. */
67
+ query?: boolean;
68
+
69
+ /** Whether to enable the TanStack Router panel. */
70
+ router?: boolean;
71
+
72
+ /** Shared theme for all devtools panels. */
73
+ theme?: AdminDevtoolsTheme;
74
+ }
75
+
76
+ export interface AdminDevtoolsProps {
77
+ /** Devtools feature switches and shell options. */
78
+ config?: AdminDevtoolsConfig;
79
+
80
+ /** QueryClient instance used by the application. */
81
+ queryClient?: QueryClient;
82
+
83
+ /** TanStack Router instance used by the application. */
84
+ router?: AnyRouter;
85
+
86
+ /** Jotai store used by the application. */
87
+ store?: Store;
88
+ }
89
+
90
+ interface JotaiAtomsDevtoolsProps {
91
+ /** Redux DevTools connection name for the atom timeline. */
92
+ name: string;
93
+
94
+ /** Jotai store to inspect. */
95
+ store?: Store;
96
+ }
97
+
98
+ interface JotaiDevtoolsProps {
99
+ /** Jotai devtools feature switches and panel options. */
100
+ config?: boolean | AdminJotaiDevtoolsConfig;
101
+
102
+ /** Jotai store to inspect. */
103
+ store?: Store;
104
+
105
+ /** Shared theme inherited from the root devtools config. */
106
+ theme?: AdminDevtoolsTheme;
107
+ }
108
+
109
+ const TanStackDevtools = lazy(() =>
110
+ import('@tanstack/react-devtools').then(mod => ({ default: mod.TanStackDevtools }))
111
+ );
112
+
113
+ const ReactQueryDevtoolsPanel = lazy(() =>
114
+ import('@tanstack/react-query-devtools').then(mod => ({ default: mod.ReactQueryDevtoolsPanel }))
115
+ );
116
+
117
+ const TanStackRouterDevtoolsPanel = lazy(() =>
118
+ import('@tanstack/react-router-devtools').then(mod => ({ default: mod.TanStackRouterDevtoolsPanel }))
119
+ );
120
+
121
+ const JotaiDevTools = lazy(async () => {
122
+ await import('jotai-devtools/styles.css');
123
+
124
+ const mod = await import('jotai-devtools');
125
+
126
+ return { default: mod.DevTools };
127
+ });
128
+
129
+ const JotaiAtomsDevtools = (props: JotaiAtomsDevtoolsProps) => {
130
+ const { name, store } = props;
131
+
132
+ useAtomsDevtools(name, { store });
133
+
134
+ return null;
135
+ };
136
+
137
+ const JotaiDevtools = (props: JotaiDevtoolsProps) => {
138
+ const { config, store, theme } = props;
139
+
140
+ if (config === false) {
141
+ return null;
142
+ }
143
+
144
+ const jotaiConfig = typeof config === 'object' ? config : {};
145
+ const showPanel = jotaiConfig.panel !== false;
146
+ const showTimeline = jotaiConfig.timeline !== false;
147
+ const triggerOffsetStyle = createJotaiDevtoolsTriggerOffsetStyle(jotaiConfig.triggerOffset);
148
+
149
+ if (!showPanel && !showTimeline) {
150
+ return null;
151
+ }
152
+
153
+ return (
154
+ <>
155
+ {showTimeline ? <JotaiAtomsDevtools name={jotaiConfig.name ?? 'skyroc-admin'} store={store} /> : null}
156
+ {showPanel ? (
157
+ <span
158
+ className="skyroc-admin-jotai-devtools"
159
+ data-position={jotaiConfig.position ?? 'bottom-left'}
160
+ style={triggerOffsetStyle}
161
+ >
162
+ <JotaiDevTools position={jotaiConfig.position} store={store} theme={theme} />
163
+ </span>
164
+ ) : null}
165
+ </>
166
+ );
167
+ };
168
+
169
+ function isEnabled(value: boolean | undefined) {
170
+ return value !== false;
171
+ }
172
+
173
+ function formatCssSize(value: AdminDevtoolsTriggerOffsetValue | undefined) {
174
+ if (typeof value === 'number') {
175
+ return `${value}px`;
176
+ }
177
+
178
+ return value;
179
+ }
180
+
181
+ function createJotaiDevtoolsTriggerOffsetStyle(
182
+ offset: AdminJotaiDevtoolsTriggerOffset | undefined
183
+ ): JotaiDevtoolsTriggerOffsetStyle | undefined {
184
+ if (!offset) {
185
+ return undefined;
186
+ }
187
+
188
+ const { bottom, left, right, top } = offset;
189
+
190
+ return {
191
+ '--skyroc-jotai-devtools-trigger-bottom': formatCssSize(bottom),
192
+ '--skyroc-jotai-devtools-trigger-left': formatCssSize(left),
193
+ '--skyroc-jotai-devtools-trigger-right': formatCssSize(right),
194
+ '--skyroc-jotai-devtools-trigger-top': formatCssSize(top)
195
+ } satisfies JotaiDevtoolsTriggerOffsetStyle;
196
+ }
197
+
198
+ const AdminDevtools = (props: AdminDevtoolsProps) => {
199
+ const { config = {}, queryClient, router, store } = props;
200
+
201
+ const plugins = useMemo<TanStackDevtoolsReactPlugin[]>(() => {
202
+ const items: TanStackDevtoolsReactPlugin[] = [];
203
+
204
+ if (router && isEnabled(config.router)) {
205
+ items.push({
206
+ id: 'tanstack-router',
207
+ name: 'TanStack Router',
208
+ render: (
209
+ <Suspense fallback={null}>
210
+ <TanStackRouterDevtoolsPanel router={router} />
211
+ </Suspense>
212
+ )
213
+ });
214
+ }
215
+
216
+ if (queryClient && isEnabled(config.query)) {
217
+ items.push({
218
+ id: 'tanstack-query',
219
+ name: 'TanStack Query',
220
+ render: (
221
+ <Suspense fallback={null}>
222
+ <ReactQueryDevtoolsPanel client={queryClient} />
223
+ </Suspense>
224
+ )
225
+ });
226
+ }
227
+
228
+ return items;
229
+ }, [config.query, config.router, queryClient, router]);
230
+
231
+ const tanStackConfig = useMemo<TanStackDevtoolsConfig>(() => {
232
+ return {
233
+ position: config.position ?? 'bottom-right',
234
+ theme: config.theme
235
+ };
236
+ }, [config.position, config.theme]);
237
+
238
+ if (config.enabled === false) {
239
+ return null;
240
+ }
241
+
242
+ return (
243
+ <Suspense fallback={null}>
244
+ {plugins.length > 0 ? (
245
+ <TanStackDevtools config={tanStackConfig} plugins={plugins} />
246
+ ) : null}
247
+
248
+ <JotaiDevtools config={config.jotai} store={store} theme={config.theme} />
249
+ </Suspense>
250
+ );
251
+ };
252
+
253
+ export default AdminDevtools;
@@ -0,0 +1,7 @@
1
+ export { default as AdminDevtools } from './AdminDevtools';
2
+ export type {
3
+ AdminDevtoolsConfig,
4
+ AdminDevtoolsProps,
5
+ AdminJotaiDevtoolsConfig,
6
+ AdminJotaiDevtoolsTriggerOffset
7
+ } from './AdminDevtools';
@@ -0,0 +1,2 @@
1
+ // oxlint-disable import/no-unassigned-import
2
+ import 'jotai-devtools/utils';
@@ -10,10 +10,12 @@
10
10
  "@skyroc/hooks": "^1.0.0",
11
11
  "@skyroc/service": "^1.0.0",
12
12
  "@skyroc/utils": "^4.0.0",
13
- "@skyroc/web-admin-devtools": "^0.1.0",
14
13
  "@skyroc/web-ui": "^0.1.4",
14
+ "@tanstack/react-devtools": "^0.8.4",
15
15
  "@tanstack/react-query": "^5.90.12",
16
+ "@tanstack/react-query-devtools": "^5.91.1",
16
17
  "@tanstack/react-router": "^1.140.0",
18
+ "@tanstack/react-router-devtools": "^1.140.0",
17
19
  "ahooks": "^3.9.6",
18
20
  "antd": "6.5.3",
19
21
  "clsx": "^2.1.1",
@@ -21,6 +23,7 @@
21
23
  "defu": "^6.1.4",
22
24
  "i18next": "25.7.2",
23
25
  "jotai": "2.20.3",
26
+ "jotai-devtools": "0.14.0",
24
27
  "motion": "^12.23.26",
25
28
  "nprogress": "^0.2.0",
26
29
  "react": "19.1.0",
@@ -33,7 +36,7 @@
33
36
  "@iconify/json": "^2.2.416",
34
37
  "@iconify/react": "^6.0.2",
35
38
  "@iconify/types": "^2.0.0",
36
- "@skyroc/scripts": "^2.5.1",
39
+ "@skyroc/scripts": "^2.5.2",
37
40
  "@skyroc/uno-config": "^1.0.0",
38
41
  "@skyroc/web-admin-vite": "^0.1.0",
39
42
  "@svgr/core": "^8.1.0",