create-auto-app 1.34.0 → 1.36.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.
Files changed (156) hide show
  1. package/package.json +2 -2
  2. package/templates/typical/.gitignore +1 -1
  3. package/templates/typical/auto.config.ts +85 -80
  4. package/templates/typical/client/.gitignore +0 -4
  5. package/templates/typical/client/.storybook/main.ts +0 -66
  6. package/templates/typical/client/.storybook/manager-head.html +0 -154
  7. package/templates/typical/client/.storybook/manager.ts +0 -164
  8. package/templates/typical/client/.storybook/preview-head.html +0 -31
  9. package/templates/typical/client/.storybook/preview.tsx +0 -120
  10. package/templates/typical/client/codegen.ts +0 -17
  11. package/templates/typical/client/components.json +0 -29
  12. package/templates/typical/client/index.html +0 -12
  13. package/templates/typical/client/package.json +0 -69
  14. package/templates/typical/client/pnpm-lock.yaml +0 -7868
  15. package/templates/typical/client/public/blank.svg +0 -1
  16. package/templates/typical/client/public/mockServiceWorker.js +0 -336
  17. package/templates/typical/client/src/App.tsx +0 -29
  18. package/templates/typical/client/src/components/.gitkeep +0 -0
  19. package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -49
  20. package/templates/typical/client/src/components/ui/Accordion.tsx +0 -55
  21. package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -29
  22. package/templates/typical/client/src/components/ui/Alert.tsx +0 -56
  23. package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -67
  24. package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -178
  25. package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -35
  26. package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -13
  27. package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -45
  28. package/templates/typical/client/src/components/ui/Avatar.tsx +0 -98
  29. package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -41
  30. package/templates/typical/client/src/components/ui/Badge.tsx +0 -45
  31. package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -54
  32. package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -104
  33. package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -102
  34. package/templates/typical/client/src/components/ui/Button.tsx +0 -67
  35. package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -32
  36. package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -81
  37. package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -40
  38. package/templates/typical/client/src/components/ui/Calendar.tsx +0 -165
  39. package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -44
  40. package/templates/typical/client/src/components/ui/Card.tsx +0 -66
  41. package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -56
  42. package/templates/typical/client/src/components/ui/Carousel.tsx +0 -225
  43. package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -39
  44. package/templates/typical/client/src/components/ui/Chart.tsx +0 -305
  45. package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -35
  46. package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -30
  47. package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -58
  48. package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -18
  49. package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -75
  50. package/templates/typical/client/src/components/ui/Combobox.tsx +0 -296
  51. package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -71
  52. package/templates/typical/client/src/components/ui/Command.tsx +0 -157
  53. package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -68
  54. package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -231
  55. package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
  56. package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
  57. package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
  58. package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
  59. package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
  60. package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
  61. package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
  62. package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -74
  63. package/templates/typical/client/src/components/ui/Dialog.tsx +0 -154
  64. package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -38
  65. package/templates/typical/client/src/components/ui/Direction.tsx +0 -24
  66. package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -70
  67. package/templates/typical/client/src/components/ui/Drawer.tsx +0 -124
  68. package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -74
  69. package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -239
  70. package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -37
  71. package/templates/typical/client/src/components/ui/Empty.tsx +0 -98
  72. package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -50
  73. package/templates/typical/client/src/components/ui/Field.tsx +0 -251
  74. package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -45
  75. package/templates/typical/client/src/components/ui/Form.tsx +0 -148
  76. package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -49
  77. package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -39
  78. package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -42
  79. package/templates/typical/client/src/components/ui/Input.tsx +0 -22
  80. package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -53
  81. package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -153
  82. package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -42
  83. package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -72
  84. package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -64
  85. package/templates/typical/client/src/components/ui/Item.tsx +0 -168
  86. package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -59
  87. package/templates/typical/client/src/components/ui/Kbd.tsx +0 -22
  88. package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -90
  89. package/templates/typical/client/src/components/ui/Label.tsx +0 -44
  90. package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -78
  91. package/templates/typical/client/src/components/ui/Menubar.tsx +0 -251
  92. package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -45
  93. package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -50
  94. package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -80
  95. package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -152
  96. package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -77
  97. package/templates/typical/client/src/components/ui/Pagination.tsx +0 -108
  98. package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -53
  99. package/templates/typical/client/src/components/ui/Popover.tsx +0 -57
  100. package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -32
  101. package/templates/typical/client/src/components/ui/Progress.tsx +0 -25
  102. package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -50
  103. package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -36
  104. package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -72
  105. package/templates/typical/client/src/components/ui/Resizable.tsx +0 -54
  106. package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -45
  107. package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -51
  108. package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -59
  109. package/templates/typical/client/src/components/ui/Select.tsx +0 -171
  110. package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -42
  111. package/templates/typical/client/src/components/ui/Separator.tsx +0 -27
  112. package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -68
  113. package/templates/typical/client/src/components/ui/Sheet.tsx +0 -115
  114. package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -96
  115. package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -695
  116. package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -40
  117. package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -11
  118. package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -24
  119. package/templates/typical/client/src/components/ui/Slider.tsx +0 -55
  120. package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -45
  121. package/templates/typical/client/src/components/ui/Sonner.tsx +0 -38
  122. package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -26
  123. package/templates/typical/client/src/components/ui/Spinner.tsx +0 -13
  124. package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -39
  125. package/templates/typical/client/src/components/ui/Switch.tsx +0 -35
  126. package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -67
  127. package/templates/typical/client/src/components/ui/Table.tsx +0 -86
  128. package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -53
  129. package/templates/typical/client/src/components/ui/Tabs.tsx +0 -75
  130. package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -27
  131. package/templates/typical/client/src/components/ui/Textarea.tsx +0 -22
  132. package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -116
  133. package/templates/typical/client/src/components/ui/Toast.tsx +0 -123
  134. package/templates/typical/client/src/components/ui/Toaster.tsx +0 -32
  135. package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -44
  136. package/templates/typical/client/src/components/ui/Toggle.tsx +0 -42
  137. package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -61
  138. package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -83
  139. package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -42
  140. package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -48
  141. package/templates/typical/client/src/gql/execute.ts +0 -11
  142. package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
  143. package/templates/typical/client/src/gql/gql.ts +0 -9
  144. package/templates/typical/client/src/gql/graphql.ts +0 -182
  145. package/templates/typical/client/src/gql/index.ts +0 -2
  146. package/templates/typical/client/src/graphql/mutations.ts +0 -0
  147. package/templates/typical/client/src/graphql/queries.ts +0 -0
  148. package/templates/typical/client/src/hooks/.gitkeep +0 -0
  149. package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
  150. package/templates/typical/client/src/hooks/use-toast.ts +0 -186
  151. package/templates/typical/client/src/index.css +0 -121
  152. package/templates/typical/client/src/lib/utils.ts +0 -6
  153. package/templates/typical/client/src/main.tsx +0 -5
  154. package/templates/typical/client/tsconfig.app.json +0 -26
  155. package/templates/typical/client/tsconfig.json +0 -10
  156. package/templates/typical/client/vite.config.ts +0 -50
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-auto-app",
3
- "version": "1.34.0",
3
+ "version": "1.36.0",
4
4
  "description": "Create Auto Engineer apps with no configuration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "fs-extra": "^11.2.0",
34
34
  "inquirer": "^9.2.15",
35
35
  "ora": "^8.0.1",
36
- "@auto-engineer/id": "1.34.0"
36
+ "@auto-engineer/id": "1.36.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/fs-extra": "^11.0.4",
@@ -1,3 +1,3 @@
1
1
  .context
2
2
  # server*
3
- # client*
3
+ client*
@@ -1,73 +1,7 @@
1
1
  import type { Event } from "@auto-engineer/message-bus";
2
2
  import { define } from "@auto-engineer/pipeline";
3
-
4
- interface SliceGeneratedData {
5
- slicePath: string;
6
- }
7
-
8
- interface SliceImplementedData {
9
- slicePath: string;
10
- }
11
-
12
- interface CheckEventData {
13
- targetDirectory?: string;
14
- errors?: string;
15
- }
16
-
17
- const MAX_RETRIES = 4;
18
- const sliceRetryState = new Map<string, number>();
19
- let projectRoot = "";
20
-
21
- function hasAnyFailures(events: Event[]): boolean {
22
- return events.some((e) => e.type.includes("Failed"));
23
- }
24
-
25
- function collectErrors(events: Event[]): string {
26
- return events
27
- .filter((e) => e.type.includes("Failed"))
28
- .map((e) => (e.data as CheckEventData).errors ?? "")
29
- .filter((s) => s.length > 0)
30
- .join("\n");
31
- }
32
-
33
- function extractSlicePath(events: Record<string, Event[]>): string {
34
- const firstEvent =
35
- events.CheckTests?.[0] ?? events.CheckTypes?.[0] ?? events.CheckLint?.[0];
36
- const data = firstEvent?.data as CheckEventData | undefined;
37
- return data?.targetDirectory ?? "";
38
- }
39
-
40
- function gatherAllCheckEvents(events: Record<string, Event[]>): Event[] {
41
- return [
42
- ...(events.CheckTests ?? []),
43
- ...(events.CheckTypes ?? []),
44
- ...(events.CheckLint ?? []),
45
- ];
46
- }
47
-
48
- function shouldRetry(slicePath: string): boolean {
49
- const attempts = sliceRetryState.get(slicePath) ?? 0;
50
- return attempts < MAX_RETRIES;
51
- }
52
-
53
- function incrementRetryCount(slicePath: string): number {
54
- const attempts = sliceRetryState.get(slicePath) ?? 0;
55
- sliceRetryState.set(slicePath, attempts + 1);
56
- return attempts + 1;
57
- }
58
-
59
- function resolvePath(relativePath: string): string {
60
- if (projectRoot === "") {
61
- return relativePath;
62
- }
63
- if (relativePath.startsWith("/")) {
64
- return relativePath;
65
- }
66
- if (relativePath.startsWith("./")) {
67
- return `${projectRoot}/${relativePath.slice(2)}`;
68
- }
69
- return `${projectRoot}/${relativePath}`;
70
- }
3
+ import type { AllCheckFailedEvents } from "@auto-engineer/server-checks";
4
+ import type { SliceImplementedEvent } from "@auto-engineer/server-implementer";
71
5
 
72
6
  export const fileId = "typical-example-1";
73
7
 
@@ -84,9 +18,21 @@ export const plugins = [
84
18
 
85
19
  export const pipeline = define("typical-example")
86
20
  .on("PipelineStarted")
21
+ // should have a generate skeleton server here
22
+ .emit("InstallServerDependencies", () => ({}))
23
+ .emit("GenerateReactClient", () => ({
24
+ targetDir: resolvePath("./client"),
25
+ }))
26
+
27
+ .on("ServerDependenciesInstalled")
87
28
  .emit("StartServer", () => ({
88
29
  serverDirectory: resolvePath("./server"),
89
30
  }))
31
+
32
+ .on("ReactClientGenerated")
33
+ .emit("InstallClientDependencies", () => ({}))
34
+
35
+ .on("ClientDependenciesInstalled")
90
36
  .emit("StartClient", () => ({
91
37
  clientDirectory: resolvePath("./client"),
92
38
  command: "pnpm dev",
@@ -95,23 +41,28 @@ export const pipeline = define("typical-example")
95
41
  storybookDirectory: resolvePath("./client"),
96
42
  }))
97
43
 
44
+ .on("StorybookStarted")
45
+ .emit("BuildComponentDB", () => ({
46
+ baseDir: resolvePath("./client"),
47
+ }))
48
+
98
49
  .on("SliceGenerated")
99
- .emit("ImplementSlice", (e: { data: SliceGeneratedData }) => ({
50
+ .emit("ImplementSlice", (e: SliceImplementedEvent) => ({
100
51
  slicePath: resolvePath(e.data.slicePath),
101
52
  context: { previousOutputs: "", attemptNumber: 0 },
102
- aiOptions: { maxTokens: 2000 },
53
+ // aiOptions: { maxTokens: 2000 },
103
54
  }))
104
55
 
105
56
  .on("SliceImplemented")
106
- .emit("CheckTests", (e: { data: SliceImplementedData }) => ({
57
+ .emit("CheckTests", (e: SliceImplementedEvent) => ({
107
58
  targetDirectory: e.data.slicePath,
108
59
  scope: "slice",
109
60
  }))
110
- .emit("CheckTypes", (e: { data: SliceImplementedData }) => ({
61
+ .emit("CheckTypes", (e: SliceImplementedEvent) => ({
111
62
  targetDirectory: e.data.slicePath,
112
63
  scope: "slice",
113
64
  }))
114
- .emit("CheckLint", (e: { data: SliceImplementedData }) => ({
65
+ .emit("CheckLint", (e: SliceImplementedEvent) => ({
115
66
  targetDirectory: e.data.slicePath,
116
67
  scope: "slice",
117
68
  fix: true,
@@ -147,17 +98,13 @@ export const pipeline = define("typical-example")
147
98
  previousOutputs: collectErrors(allEvents),
148
99
  attemptNumber: retryAttempt,
149
100
  },
150
- aiOptions: { maxTokens: 2000 },
101
+ // aiOptions: { maxTokens: 2000 },
151
102
  });
152
103
  return { persist: true };
153
104
  })
154
105
 
155
- .on("ServerGenerated")
156
- .emit("GenerateReactClient", () => ({
157
- targetDir: resolvePath("./client"),
158
- }))
159
-
160
- .declare("ProcessJobGraph").accepts(["ImplementReactComponent"])
106
+ .declare("ProcessJobGraph")
107
+ .accepts(["ImplementReactComponent"])
161
108
 
162
109
  .on("GraphProcessed")
163
110
  .emit("ImplementReactApp", () => ({
@@ -178,6 +125,9 @@ export const pipeline = define("typical-example")
178
125
 
179
126
  .build();
180
127
 
128
+ // ## ------------------------------
129
+ // ## Helpers
130
+
181
131
  export function resetState(): void {
182
132
  sliceRetryState.clear();
183
133
  projectRoot = "";
@@ -195,3 +145,58 @@ export default {
195
145
  enabled: false,
196
146
  },
197
147
  };
148
+
149
+ function hasAnyFailures(events: Event[]): boolean {
150
+ return events.some((e) => e.type.includes("Failed"));
151
+ }
152
+
153
+ function collectErrors(events: Event[]): string {
154
+ return events
155
+ .filter((e) => e.type.includes("Failed"))
156
+ .map((e) => (e.data as AllCheckFailedEvents["data"]).errors ?? "")
157
+ .filter((s) => s.length > 0)
158
+ .join("\n");
159
+ }
160
+
161
+ function extractSlicePath(events: Record<string, Event[]>): string {
162
+ const firstEvent =
163
+ events.CheckTests?.[0] ?? events.CheckTypes?.[0] ?? events.CheckLint?.[0];
164
+ const data = firstEvent?.data as AllCheckFailedEvents["data"] | undefined;
165
+ return data?.targetDirectory ?? "";
166
+ }
167
+
168
+ function gatherAllCheckEvents(events: Record<string, Event[]>): Event[] {
169
+ return [
170
+ ...(events.CheckTests ?? []),
171
+ ...(events.CheckTypes ?? []),
172
+ ...(events.CheckLint ?? []),
173
+ ];
174
+ }
175
+
176
+ function shouldRetry(slicePath: string): boolean {
177
+ const attempts = sliceRetryState.get(slicePath) ?? 0;
178
+ return attempts < MAX_RETRIES;
179
+ }
180
+
181
+ function incrementRetryCount(slicePath: string): number {
182
+ const attempts = sliceRetryState.get(slicePath) ?? 0;
183
+ sliceRetryState.set(slicePath, attempts + 1);
184
+ return attempts + 1;
185
+ }
186
+
187
+ const MAX_RETRIES = 4;
188
+ const sliceRetryState = new Map<string, number>();
189
+ let projectRoot = "";
190
+
191
+ function resolvePath(relativePath: string): string {
192
+ if (projectRoot === "") {
193
+ return relativePath;
194
+ }
195
+ if (relativePath.startsWith("/")) {
196
+ return relativePath;
197
+ }
198
+ if (relativePath.startsWith("./")) {
199
+ return `${projectRoot}/${relativePath.slice(2)}`;
200
+ }
201
+ return `${projectRoot}/${relativePath}`;
202
+ }
@@ -1,4 +0,0 @@
1
- node_modules
2
- dist
3
- *.local
4
- .DS_Store
@@ -1,66 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- import type { StorybookConfig } from "@storybook/react-vite";
5
-
6
- const __dirname = dirname(fileURLToPath(import.meta.url));
7
- const managerHeadContent = readFileSync(
8
- join(__dirname, "manager-head.html"),
9
- "utf-8",
10
- );
11
-
12
- const isFastMode = process.env.STORYBOOK_FAST === "1";
13
-
14
- const config: StorybookConfig = {
15
- stories: isFastMode
16
- ? ["../src/**/*.stories.@(ts|tsx)"]
17
- : ["../src/**/*.mdx", "../src/**/*.stories.@(ts|tsx)"],
18
- addons: [
19
- ...(isFastMode ? [] : [getAbsolutePath("@storybook/addon-docs")]),
20
- {
21
- name: getAbsolutePath("@storybook/addon-mcp"),
22
- options: {
23
- toolsets: {
24
- dev: true,
25
- docs: true,
26
- },
27
- },
28
- },
29
- getAbsolutePath("@vueless/storybook-dark-mode"),
30
- ],
31
- staticDirs: ["../public"],
32
- features: {
33
- experimentalComponentsManifest: true,
34
- },
35
- core: {
36
- disableWhatsNewNotifications: true,
37
- },
38
- framework: {
39
- name: getAbsolutePath("@storybook/react-vite"),
40
- options: {},
41
- },
42
- typescript: {
43
- reactDocgen: isFastMode ? false : "react-docgen-typescript",
44
- reactDocgenTypescriptOptions: {
45
- tsconfigPath: join(__dirname, "../tsconfig.app.json"),
46
- },
47
- },
48
- viteFinal: (config) => {
49
- config.server = {
50
- ...config.server,
51
- allowedHosts: [".worker.on.auto", ".worker-dev.on.auto"],
52
- };
53
- config.define = {
54
- ...config.define,
55
- "import.meta.env.STORYBOOK_FAST": JSON.stringify(isFastMode),
56
- };
57
- return config;
58
- },
59
- managerHead: () => managerHeadContent,
60
- };
61
-
62
- export default config;
63
-
64
- function getAbsolutePath(value: string): any {
65
- return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
66
- }
@@ -1,154 +0,0 @@
1
- <script>
2
- (function() {
3
- // Check localStorage for dark mode state before anything renders
4
- var isDark = false;
5
- try {
6
- var stored = localStorage.getItem('sb-addon-themes-3');
7
- if (stored) {
8
- var parsed = JSON.parse(stored);
9
- isDark = parsed && parsed.current === 'dark';
10
- }
11
- } catch(e) {}
12
-
13
- // Also check URL parameter
14
- var urlParams = new URLSearchParams(window.location.search);
15
- var urlTheme = urlParams.get('theme');
16
- if (urlTheme) {
17
- isDark = urlTheme === 'dark';
18
- }
19
-
20
- // Apply matching theme background colors immediately (blue-tinted grays)
21
- document.documentElement.style.backgroundColor = isDark ? '#1a1f2e' : '#f0f3f9';
22
- document.documentElement.style.colorScheme = isDark ? 'dark' : 'light';
23
-
24
- // Store theme state for CSS
25
- document.documentElement.dataset.theme = isDark ? 'dark' : 'light';
26
- })();
27
- </script>
28
- <style>
29
- html, body {
30
- transition: none !important;
31
- }
32
-
33
- /* Force sidebar and nav backgrounds - target the actual container divs */
34
- #storybook-explorer-tree,
35
- [class*="sidebar"],
36
- [class*="Sidebar"],
37
- nav[class],
38
- aside[class] {
39
- background-color: #f0f3f9 !important;
40
- }
41
-
42
- html[data-theme="dark"] #storybook-explorer-tree,
43
- html[data-theme="dark"] [class*="sidebar"],
44
- html[data-theme="dark"] [class*="Sidebar"],
45
- html[data-theme="dark"] nav[class],
46
- html[data-theme="dark"] aside[class] {
47
- background-color: #1a1f2e !important;
48
- }
49
-
50
- /* Force toolbar/header backgrounds */
51
- [class*="toolbar"],
52
- [class*="Toolbar"],
53
- [class*="bar"],
54
- [class*="Bar"],
55
- header[class] {
56
- background-color: #f0f3f9 !important;
57
- }
58
-
59
- html[data-theme="dark"] [class*="toolbar"],
60
- html[data-theme="dark"] [class*="Toolbar"],
61
- html[data-theme="dark"] [class*="bar"],
62
- html[data-theme="dark"] [class*="Bar"],
63
- html[data-theme="dark"] header[class] {
64
- background-color: #1a1f2e !important;
65
- }
66
-
67
- /* Force ALL sidebar text to dark gray instead of blue */
68
- [data-nodetype],
69
- [data-nodetype] * {
70
- color: #2d3748 !important;
71
- }
72
-
73
- html[data-theme="dark"] [data-nodetype],
74
- html[data-theme="dark"] [data-nodetype] * {
75
- color: #e2e8f0 !important;
76
- }
77
-
78
- /* Sidebar selection styles - subtle background */
79
- [data-nodetype="story"][data-selected="true"],
80
- [data-nodetype="document"][data-selected="true"],
81
- [data-nodetype="component"][data-selected="true"],
82
- [data-nodetype="group"][data-selected="true"] {
83
- background-color: #e2e8f0 !important;
84
- border-radius: 0.5rem !important;
85
- }
86
-
87
- [data-nodetype="story"][data-selected="true"] *,
88
- [data-nodetype="document"][data-selected="true"] *,
89
- [data-nodetype="component"][data-selected="true"] *,
90
- [data-nodetype="group"][data-selected="true"] * {
91
- color: #1a202c !important;
92
- }
93
-
94
- /* Dark mode selected item */
95
- html[data-theme="dark"] [data-nodetype="story"][data-selected="true"],
96
- html[data-theme="dark"] [data-nodetype="document"][data-selected="true"],
97
- html[data-theme="dark"] [data-nodetype="component"][data-selected="true"],
98
- html[data-theme="dark"] [data-nodetype="group"][data-selected="true"] {
99
- background-color: #3d4663 !important;
100
- }
101
-
102
- html[data-theme="dark"] [data-nodetype="story"][data-selected="true"] *,
103
- html[data-theme="dark"] [data-nodetype="document"][data-selected="true"] *,
104
- html[data-theme="dark"] [data-nodetype="component"][data-selected="true"] *,
105
- html[data-theme="dark"] [data-nodetype="group"][data-selected="true"] * {
106
- color: #f7fafc !important;
107
- }
108
-
109
- /* Hover state */
110
- [data-nodetype="story"]:hover,
111
- [data-nodetype="document"]:hover,
112
- [data-nodetype="component"]:hover,
113
- [data-nodetype="group"]:hover {
114
- background-color: #edf2f7 !important;
115
- border-radius: 0.5rem !important;
116
- }
117
-
118
- html[data-theme="dark"] [data-nodetype="story"]:hover,
119
- html[data-theme="dark"] [data-nodetype="document"]:hover,
120
- html[data-theme="dark"] [data-nodetype="component"]:hover,
121
- html[data-theme="dark"] [data-nodetype="group"]:hover {
122
- background-color: #2d3748 !important;
123
- }
124
-
125
- /* Selected hover - keep selected state */
126
- [data-nodetype][data-selected="true"]:hover {
127
- background-color: #e2e8f0 !important;
128
- }
129
-
130
- html[data-theme="dark"] [data-nodetype][data-selected="true"]:hover {
131
- background-color: #3d4663 !important;
132
- }
133
- </style>
134
- <script>
135
- (function() {
136
- if (window.parent === window) return;
137
- function notify() {
138
- window.parent.postMessage({ type: 'iframe-url-change', url: location.href }, '*');
139
- }
140
- var pushState = history.pushState;
141
- var replaceState = history.replaceState;
142
- history.pushState = function() {
143
- pushState.apply(this, arguments);
144
- notify();
145
- };
146
- history.replaceState = function() {
147
- replaceState.apply(this, arguments);
148
- notify();
149
- };
150
- window.addEventListener('popstate', notify);
151
- window.addEventListener('hashchange', notify);
152
- notify();
153
- })();
154
- </script>
@@ -1,164 +0,0 @@
1
- import { addons } from 'storybook/manager-api';
2
- import { create } from 'storybook/theming';
3
- import { STORY_CHANGED } from 'storybook/internal/core-events';
4
- import { UPDATE_DARK_MODE_EVENT_NAME } from '@vueless/storybook-dark-mode';
5
-
6
- // Get initial theme from localStorage (dark mode addon) or URL parameter
7
- const urlParams = new URLSearchParams(window.location.search);
8
- const urlTheme = urlParams.get('theme');
9
- const getStoredDarkMode = (): boolean => {
10
- try {
11
- const stored = localStorage.getItem('sb-addon-themes-3');
12
- if (stored) {
13
- const parsed = JSON.parse(stored);
14
- return parsed?.current === 'dark';
15
- }
16
- } catch {}
17
- return false;
18
- };
19
- const initialIsDark = urlTheme ? urlTheme === 'dark' : getStoredDarkMode();
20
-
21
- // Theme colors matching app's design with subtle blue tint
22
- // Analyzed from screenshots - app has slight blue undertone in grays
23
-
24
- const lightTheme = create({
25
- base: 'light',
26
- brandTitle: ' ',
27
- brandUrl: '/',
28
- brandImage: '/blank.svg',
29
-
30
- // App background colors - matching your app's blue-tinted sidebar
31
- appBg: '#f0f3f9', // sidebar background (blue-tinted like your app)
32
- appContentBg: '#ffffff', // main content area
33
- appPreviewBg: '#ffffff', // preview/canvas background
34
- appBorderColor: '#e2e8f0', // borders (blue-tinted)
35
- appBorderRadius: 10, // 0.625rem = 10px
36
-
37
- // Text colors - dark gray, not blue
38
- textColor: '#2d3748', // dark gray text for sidebar items
39
- textMutedColor: '#718096', // muted gray text
40
- textInverseColor: '#f7fafc',// inverse text
41
-
42
- // Toolbar/UI colors
43
- barBg: '#f0f3f9', // toolbar background (blue-tinted)
44
- barTextColor: '#2d3748', // toolbar text (dark gray)
45
- barHoverColor: '#1a202c', // toolbar hover
46
- barSelectedColor: '#1a202c',// toolbar selected
47
-
48
- // Form colors
49
- inputBg: '#ffffff', // input background
50
- inputBorder: '#e2e8f0', // input border
51
- inputTextColor: '#2d3748', // input text
52
-
53
- // Button colors
54
- buttonBg: '#edf2f7', // button background
55
- buttonBorder: '#e2e8f0', // button border
56
-
57
- // Boolean inputs
58
- booleanBg: '#edf2f7',
59
- booleanSelectedBg: '#2d3748',
60
-
61
- // Grid colors for canvas
62
- gridCellSize: 10,
63
-
64
- // Color for links/interactive items - override the blue
65
- colorPrimary: '#2d3748',
66
- colorSecondary: '#4a5568',
67
- });
68
-
69
- const darkTheme = create({
70
- base: 'dark',
71
- brandTitle: ' ',
72
- brandUrl: '/',
73
- brandImage: '/blank.svg',
74
-
75
- // App background colors - matching app's dark blue-tinted theme
76
- appBg: '#1a1f2e', // sidebar background (blue-tinted dark)
77
- appContentBg: '#131620', // main content area (darker)
78
- appPreviewBg: '#131620', // preview/canvas background
79
- appBorderColor: '#2a3142', // borders (blue-tinted)
80
- appBorderRadius: 10,
81
-
82
- // Text colors - light gray, not blue
83
- textColor: '#e2e8f0', // light gray text
84
- textMutedColor: '#a0aec0', // muted gray text
85
- textInverseColor: '#1a1f2e',// inverse text
86
-
87
- // Toolbar/UI colors
88
- barBg: '#1a1f2e', // toolbar background
89
- barTextColor: '#e2e8f0', // toolbar text (light gray)
90
- barHoverColor: '#f7fafc', // toolbar hover
91
- barSelectedColor: '#f7fafc',// toolbar selected
92
-
93
- // Form colors
94
- inputBg: '#242938', // input background
95
- inputBorder: '#3d4663', // input border
96
- inputTextColor: '#e2e8f0', // input text
97
-
98
- // Button colors
99
- buttonBg: '#242938', // button background
100
- buttonBorder: '#3d4663', // button border
101
-
102
- // Boolean inputs
103
- booleanBg: '#242938',
104
- booleanSelectedBg: '#e2e8f0',
105
-
106
- // Grid colors for canvas
107
- gridCellSize: 10,
108
-
109
- // Color for links/interactive items - override the blue
110
- colorPrimary: '#e2e8f0',
111
- colorSecondary: '#a0aec0',
112
- });
113
-
114
- const customTheme = initialIsDark ? darkTheme : lightTheme;
115
-
116
- addons.setConfig({
117
- theme: customTheme,
118
- sidebar: {
119
- collapsedRoots: ['ui-components'],
120
- },
121
- showPanel: false,
122
- });
123
-
124
- // Set default story to Design System Overview if no path specified
125
- if (!urlParams.has('path')) {
126
- const newUrl = new URL(window.location.href);
127
- newUrl.searchParams.set('path', '/story/design-system-overview--default');
128
- window.history.replaceState({}, '', newUrl.toString());
129
- }
130
-
131
- // Register addon to handle navigation sync and theme after Storybook is ready
132
- addons.register('url-sync', (api) => {
133
- const channel = api.getChannel();
134
- if (!channel) return;
135
-
136
- // Set initial dark mode state (pass string "dark" or "light", not boolean)
137
- if (initialIsDark) {
138
- channel.emit(UPDATE_DARK_MODE_EVENT_NAME, 'dark');
139
- }
140
-
141
- // Report navigation changes to parent window for URL bar sync
142
- channel.on(STORY_CHANGED, (storyId: string) => {
143
- if (window.parent !== window) {
144
- window.parent.postMessage({ type: 'storybook-navigation', storyId }, '*');
145
- }
146
- });
147
-
148
- // Listen for theme changes from parent window
149
- window.addEventListener('message', (event) => {
150
- if (event.data?.type === 'storybook-theme-change' && event.data?.theme) {
151
- const isDark = event.data.theme === 'dark';
152
- // Update the dark mode addon
153
- channel.emit(UPDATE_DARK_MODE_EVENT_NAME, event.data.theme);
154
- // Update the Storybook manager theme
155
- addons.setConfig({
156
- theme: isDark ? darkTheme : lightTheme,
157
- });
158
- // Update CSS theme selector and background
159
- document.documentElement.dataset.theme = isDark ? 'dark' : 'light';
160
- document.documentElement.style.backgroundColor = isDark ? '#1a1f2e' : '#f0f3f9';
161
- document.documentElement.style.colorScheme = isDark ? 'dark' : 'light';
162
- }
163
- });
164
- });
@@ -1,31 +0,0 @@
1
- <script>
2
- (function() {
3
- var isDark = false;
4
- var stored, parsed, urlParams, urlTheme;
5
- try {
6
- stored = localStorage.getItem('sb-addon-themes-3');
7
- if (stored) {
8
- parsed = JSON.parse(stored);
9
- isDark = parsed && parsed.current === 'dark';
10
- }
11
- } catch(_) {}
12
-
13
- urlParams = new URLSearchParams(window.location.search);
14
- urlTheme = urlParams.get('theme');
15
- if (urlTheme) {
16
- isDark = urlTheme === 'dark';
17
- }
18
-
19
- if (isDark) {
20
- document.documentElement.classList.add('dark');
21
- }
22
- // Dark: appContentBg=#222325, Light: #FFFFFF
23
- document.documentElement.style.backgroundColor = isDark ? '#222325' : '#FFFFFF';
24
- document.documentElement.style.colorScheme = isDark ? 'dark' : 'light';
25
- })();
26
- </script>
27
- <style>
28
- html, body {
29
- transition: none;
30
- }
31
- </style>