@soroush.design/cli 0.3.0-alpha.0 → 0.3.0-alpha.2

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 (128) hide show
  1. package/README.md +6 -4
  2. package/dist/bin.mjs +2 -9
  3. package/dist/index.d.mts +19 -27
  4. package/dist/index.mjs +1 -1
  5. package/dist/init-C32LggZ7.mjs +1279 -0
  6. package/dist/{io-BFbf4S_u.mjs → io-BevxSPoR.mjs} +105 -883
  7. package/dist/migrate-Bhkz8pnP.mjs +22239 -0
  8. package/package.json +23 -22
  9. package/templates/astro/js/base/README.md +4 -3
  10. package/templates/astro/js/base/astro.config.mjs +16 -1
  11. package/templates/astro/js/base/src/components/About.jsx +2 -2
  12. package/templates/astro/js/base/src/components/Counter.jsx +3 -3
  13. package/templates/astro/js/base/src/components/Greeting.jsx +1 -1
  14. package/templates/astro/js/base/src/components/Header.jsx +6 -6
  15. package/templates/astro/js/base/src/components/Home.jsx +6 -6
  16. package/templates/astro/js/base/src/components/Home.test.jsx +5 -1
  17. package/templates/astro/js/base/src/components/NotFound.jsx +3 -3
  18. package/templates/astro/js/base/src/components/SchemeSwitch.jsx +4 -4
  19. package/templates/astro/js/base/src/theme/Island.jsx +1 -1
  20. package/templates/astro/js/sample-data/src/components/ItemDetails.jsx +3 -3
  21. package/templates/astro/js/sample-data/src/components/ItemList.jsx +3 -3
  22. package/templates/astro/js/sample-data/src/components/StatusChip.jsx +1 -1
  23. package/templates/astro/js/with/jotai/src/components/Counter.jsx +3 -3
  24. package/templates/astro/js/with/react-hook-form/src/components/Form.jsx +4 -4
  25. package/templates/astro/js/with/redux-toolkit/src/components/Counter.jsx +3 -3
  26. package/templates/astro/js/with/zustand/src/components/Counter.jsx +3 -3
  27. package/templates/astro/ts/base/README.md +4 -3
  28. package/templates/astro/ts/base/astro.config.mjs +16 -1
  29. package/templates/astro/ts/base/src/components/About.tsx +2 -2
  30. package/templates/astro/ts/base/src/components/Counter.tsx +3 -3
  31. package/templates/astro/ts/base/src/components/Greeting.tsx +1 -1
  32. package/templates/astro/ts/base/src/components/Header.tsx +6 -6
  33. package/templates/astro/ts/base/src/components/Home.test.tsx +5 -1
  34. package/templates/astro/ts/base/src/components/Home.tsx +6 -6
  35. package/templates/astro/ts/base/src/components/NotFound.tsx +3 -3
  36. package/templates/astro/ts/base/src/components/SchemeSwitch.tsx +4 -4
  37. package/templates/astro/ts/base/src/theme/Island.tsx +1 -1
  38. package/templates/astro/ts/sample-data/src/components/ItemDetails.tsx +3 -3
  39. package/templates/astro/ts/sample-data/src/components/ItemList.tsx +3 -3
  40. package/templates/astro/ts/sample-data/src/components/StatusChip.tsx +1 -1
  41. package/templates/astro/ts/with/jotai/src/components/Counter.tsx +3 -3
  42. package/templates/astro/ts/with/react-hook-form/src/components/Form.tsx +4 -4
  43. package/templates/astro/ts/with/redux-toolkit/src/components/Counter.tsx +3 -3
  44. package/templates/astro/ts/with/zustand/src/components/Counter.tsx +3 -3
  45. package/templates/react-router/js/base/README.md +4 -3
  46. package/templates/react-router/js/base/src/components/Header.jsx +5 -5
  47. package/templates/react-router/js/base/src/components/RouterLink.jsx +2 -2
  48. package/templates/react-router/js/base/src/components/SchemeSwitch.jsx +4 -4
  49. package/templates/react-router/js/base/src/main.jsx +5 -0
  50. package/templates/react-router/js/base/src/pages/ErrorPage.jsx +2 -2
  51. package/templates/react-router/js/base/src/pages/Layout.jsx +1 -1
  52. package/templates/react-router/js/base/src/pages/about/Page.jsx +2 -2
  53. package/templates/react-router/js/base/src/pages/index/Counter.jsx +3 -3
  54. package/templates/react-router/js/base/src/pages/index/Greeting.jsx +1 -1
  55. package/templates/react-router/js/base/src/pages/index/Page.jsx +6 -6
  56. package/templates/react-router/js/base/src/pages/index/Page.test.jsx +5 -1
  57. package/templates/react-router/js/sample-data/src/pages/item/Page.jsx +2 -2
  58. package/templates/react-router/js/sample-data/src/pages/items/Page.jsx +2 -2
  59. package/templates/react-router/js/sample-data/src/pages/items/StatusChip.jsx +1 -1
  60. package/templates/react-router/js/with/jotai/src/pages/index/Counter.jsx +3 -3
  61. package/templates/react-router/js/with/react-hook-form/src/pages/form/Page.jsx +4 -4
  62. package/templates/react-router/js/with/redux-toolkit/src/pages/index/Counter.jsx +3 -3
  63. package/templates/react-router/js/with/zustand/src/pages/index/Counter.jsx +3 -3
  64. package/templates/react-router/ts/base/README.md +4 -3
  65. package/templates/react-router/ts/base/src/components/Header.tsx +5 -5
  66. package/templates/react-router/ts/base/src/components/RouterLink.tsx +2 -2
  67. package/templates/react-router/ts/base/src/components/SchemeSwitch.tsx +4 -4
  68. package/templates/react-router/ts/base/src/main.tsx +5 -0
  69. package/templates/react-router/ts/base/src/pages/ErrorPage.tsx +2 -2
  70. package/templates/react-router/ts/base/src/pages/Layout.tsx +1 -1
  71. package/templates/react-router/ts/base/src/pages/about/Page.tsx +2 -2
  72. package/templates/react-router/ts/base/src/pages/index/Counter.tsx +3 -3
  73. package/templates/react-router/ts/base/src/pages/index/Greeting.tsx +1 -1
  74. package/templates/react-router/ts/base/src/pages/index/Page.test.tsx +5 -1
  75. package/templates/react-router/ts/base/src/pages/index/Page.tsx +6 -6
  76. package/templates/react-router/ts/sample-data/src/pages/item/Page.tsx +2 -2
  77. package/templates/react-router/ts/sample-data/src/pages/items/Page.tsx +2 -2
  78. package/templates/react-router/ts/sample-data/src/pages/items/StatusChip.tsx +1 -1
  79. package/templates/react-router/ts/with/jotai/src/pages/index/Counter.tsx +3 -3
  80. package/templates/react-router/ts/with/react-hook-form/src/pages/form/Page.tsx +4 -4
  81. package/templates/react-router/ts/with/redux-toolkit/src/pages/index/Counter.tsx +3 -3
  82. package/templates/react-router/ts/with/zustand/src/pages/index/Counter.tsx +3 -3
  83. package/templates/vike/js/base/README.md +3 -2
  84. package/templates/vike/js/base/src/components/Header.jsx +6 -6
  85. package/templates/vike/js/base/src/components/SchemeSwitch.jsx +4 -4
  86. package/templates/vike/js/base/src/pages/+Layout.jsx +1 -1
  87. package/templates/vike/js/base/src/pages/+onCreateGlobalContext.js +7 -0
  88. package/templates/vike/js/base/src/pages/+onRenderHtml.jsx +2 -3
  89. package/templates/vike/js/base/src/pages/PageShell.jsx +2 -2
  90. package/templates/vike/js/base/src/pages/_error/+Page.jsx +3 -3
  91. package/templates/vike/js/base/src/pages/about/+Page.jsx +2 -2
  92. package/templates/vike/js/base/src/pages/index/+Page.jsx +6 -6
  93. package/templates/vike/js/base/src/pages/index/Counter.jsx +3 -3
  94. package/templates/vike/js/base/src/pages/index/Greeting.jsx +1 -1
  95. package/templates/vike/js/base/src/pages/index/Page.test.jsx +5 -1
  96. package/templates/vike/js/sample-data/src/pages/items/+Page.jsx +3 -3
  97. package/templates/vike/js/sample-data/src/pages/items/@id/+Page.jsx +3 -3
  98. package/templates/vike/js/sample-data/src/pages/items/StatusChip.jsx +1 -1
  99. package/templates/vike/js/ssg/src/pages/about/+Page.jsx +2 -2
  100. package/templates/vike/js/ssr/src/pages/+onRenderHtml.jsx +2 -3
  101. package/templates/vike/js/ssr/src/pages/about/+Page.jsx +2 -2
  102. package/templates/vike/js/with/jotai/src/pages/index/Counter.jsx +3 -3
  103. package/templates/vike/js/with/react-hook-form/src/pages/form/+Page.jsx +4 -4
  104. package/templates/vike/js/with/redux-toolkit/src/pages/index/Counter.jsx +3 -3
  105. package/templates/vike/js/with/zustand/src/pages/index/Counter.jsx +3 -3
  106. package/templates/vike/ts/base/README.md +3 -2
  107. package/templates/vike/ts/base/src/components/Header.tsx +6 -6
  108. package/templates/vike/ts/base/src/components/SchemeSwitch.tsx +4 -4
  109. package/templates/vike/ts/base/src/pages/+Layout.tsx +1 -1
  110. package/templates/vike/ts/base/src/pages/+onCreateGlobalContext.ts +7 -0
  111. package/templates/vike/ts/base/src/pages/+onRenderHtml.tsx +2 -3
  112. package/templates/vike/ts/base/src/pages/PageShell.tsx +2 -2
  113. package/templates/vike/ts/base/src/pages/_error/+Page.tsx +3 -3
  114. package/templates/vike/ts/base/src/pages/about/+Page.tsx +2 -2
  115. package/templates/vike/ts/base/src/pages/index/+Page.tsx +6 -6
  116. package/templates/vike/ts/base/src/pages/index/Counter.tsx +3 -3
  117. package/templates/vike/ts/base/src/pages/index/Greeting.tsx +1 -1
  118. package/templates/vike/ts/base/src/pages/index/Page.test.tsx +5 -1
  119. package/templates/vike/ts/sample-data/src/pages/items/+Page.tsx +3 -3
  120. package/templates/vike/ts/sample-data/src/pages/items/@id/+Page.tsx +3 -3
  121. package/templates/vike/ts/sample-data/src/pages/items/StatusChip.tsx +1 -1
  122. package/templates/vike/ts/ssg/src/pages/about/+Page.tsx +2 -2
  123. package/templates/vike/ts/ssr/src/pages/+onRenderHtml.tsx +2 -3
  124. package/templates/vike/ts/ssr/src/pages/about/+Page.tsx +2 -2
  125. package/templates/vike/ts/with/jotai/src/pages/index/Counter.tsx +3 -3
  126. package/templates/vike/ts/with/react-hook-form/src/pages/form/+Page.tsx +4 -4
  127. package/templates/vike/ts/with/redux-toolkit/src/pages/index/Counter.tsx +3 -3
  128. package/templates/vike/ts/with/zustand/src/pages/index/Counter.tsx +3 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soroush.design/cli",
3
- "version": "0.3.0-alpha.0",
4
- "description": "The command line of the @soroush.tech design system: init sets it up in an existing React app, and create starts a new one, each showing every change first.",
3
+ "version": "0.3.0-alpha.2",
4
+ "description": "The command line of Gild UI: init sets it up in an existing React app, and create starts a new one, each showing every change first.",
5
5
  "keywords": [
6
6
  "cli",
7
7
  "init",
@@ -11,14 +11,14 @@
11
11
  ],
12
12
  "author": "Masoud Soroush <masoud@soroush.tech>",
13
13
  "license": "MIT",
14
- "homepage": "https://docs.soroush.tech",
14
+ "homepage": "https://gild-ui.soroush.design/cli/",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "git+https://github.com/soroush-tech/design-system.git",
17
+ "url": "git+https://github.com/soroush-tech/gild-ui.git",
18
18
  "directory": "packages/cli"
19
19
  },
20
20
  "bugs": {
21
- "url": "https://github.com/soroush-tech/design-system/issues"
21
+ "url": "https://github.com/soroush-tech/gild-ui/issues"
22
22
  },
23
23
  "type": "module",
24
24
  "sideEffects": false,
@@ -41,37 +41,38 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@astrojs/check": "^0.9.12",
44
- "@astrojs/node": "^11.1.13",
44
+ "@astrojs/node": "^11.1.14",
45
45
  "@astrojs/react": "^7.1.9",
46
- "@hookform/resolvers": "^7.0.6",
47
- "@reduxjs/toolkit": "^2.14.0",
48
- "@tanstack/react-query": "^5.107.1",
46
+ "@babel/parser": "^8.1.3",
47
+ "@babel/types": "^8.1.3",
48
+ "@hookform/resolvers": "^7.0.10",
49
+ "@reduxjs/toolkit": "^2.16.0",
50
+ "@tanstack/react-query": "^5.108.4",
49
51
  "@testing-library/dom": "^10.4.2",
50
52
  "@testing-library/react": "^16.3.3",
51
- "@types/node": "^26.6.6",
52
- "@types/react": "^19.3.0",
53
+ "@types/node": "^26.6.11",
54
+ "@types/react": "^19.3.3",
53
55
  "@types/react-dom": "^19.3.0",
54
- "@umber-style/server": "0.3.0",
55
56
  "@vitejs/plugin-react": "^6.3.0",
56
- "@vitest/coverage-v8": "^5.1.0",
57
- "astro": "^7.4.12",
58
- "jotai": "^3.0.2",
57
+ "@vitest/coverage-v8": "^5.1.2",
58
+ "astro": "^7.4.13",
59
+ "jotai": "^3.1.0",
59
60
  "jsdom": "^31.0.1",
60
- "msw": "^3.0.5",
61
- "oxlint": "^1.93.0",
61
+ "msw": "^3.0.8",
62
+ "oxlint": "^1.96.0",
62
63
  "react": "^19.3.1",
63
64
  "react-dom": "^19.3.1",
64
65
  "react-hook-form": "^7.92.0",
65
66
  "react-redux": "^9.3.1",
66
- "react-router": "^8.5.1",
67
+ "react-router": "^8.5.3",
67
68
  "swr": "^2.5.1",
68
- "ts-blank-space": "^0.9.0",
69
+ "ts-blank-space": "^0.10.1",
69
70
  "tsdown": "^0.23.7",
70
71
  "typescript": "~7.0.2",
71
72
  "typescript-astro": "npm:typescript@^6.0.3",
72
73
  "vike": "0.4.270",
73
- "vite": "~8.3.8",
74
- "vitest": "^5.1.0",
74
+ "vite": "~8.4.0",
75
+ "vitest": "^5.1.2",
75
76
  "zod": "^4.6.7",
76
77
  "zustand": "^5.1.0",
77
78
  "@soroush.tech/eslint-config": "0.0.0"
@@ -82,7 +83,7 @@
82
83
  "typecheck": "tsc --noEmit",
83
84
  "test": "vitest run",
84
85
  "test:coverage": "vitest run --coverage",
85
- "test:types": "pnpm --filter @soroush.tech/design-system build && tsc -p type-tests/init/tsconfig.json && tsc -p type-tests/tsconfig.create-vike.json && tsc -p type-tests/tsconfig.create-vike-ssg.json && tsc -p type-tests/tsconfig.create-vike-ssr.json && tsc -p type-tests/tsconfig.create-vike-libraries.json && tsc -p type-tests/tsconfig.create-vike-jotai.json && tsc -p type-tests/tsconfig.create-vike-more.json && tsc -p type-tests/tsconfig.create-astro-ssg.json && tsc -p type-tests/tsconfig.create-astro-ssr.json && tsc -p type-tests/tsconfig.create-astro-libraries.json && tsc -p type-tests/tsconfig.create-astro-more.json && tsc -p type-tests/tsconfig.create-react-router.json && tsc -p type-tests/tsconfig.create-react-router-libraries.json && tsc -p type-tests/tsconfig.create-react-router-more.json && tsc -p type-tests/tsconfig.create-react-router-jotai.json",
86
+ "test:types": "pnpm --filter @gild-ui/core build && pnpm --filter @gild-ui/hooks build && pnpm --filter @gild-ui/react build && tsc -p type-tests/init/tsconfig.json && tsc -p src/migrate/steps/gild-ui-0.1.0/fixtures/init-templates/tsconfig.after.json && tsc -p src/migrate/steps/gild-ui-0.1.0/fixtures/docs-app/tsconfig.after.json && tsc -p type-tests/tsconfig.create-vike.json && tsc -p type-tests/tsconfig.create-vike-ssg.json && tsc -p type-tests/tsconfig.create-vike-ssr.json && tsc -p type-tests/tsconfig.create-vike-libraries.json && tsc -p type-tests/tsconfig.create-vike-jotai.json && tsc -p type-tests/tsconfig.create-vike-more.json && tsc -p type-tests/tsconfig.create-astro-ssg.json && tsc -p type-tests/tsconfig.create-astro-ssr.json && tsc -p type-tests/tsconfig.create-astro-libraries.json && tsc -p type-tests/tsconfig.create-astro-more.json && tsc -p type-tests/tsconfig.create-react-router.json && tsc -p type-tests/tsconfig.create-react-router-libraries.json && tsc -p type-tests/tsconfig.create-react-router-more.json && tsc -p type-tests/tsconfig.create-react-router-jotai.json",
86
87
  "gen:templates": "node scripts/gen-templates.mjs"
87
88
  },
88
89
  "module": "./dist/index.mjs"
@@ -1,6 +1,6 @@
1
1
  # __TITLE__
2
2
 
3
- An [Astro](https://astro.build) app on the [@soroush.tech design system](https://docs.soroush.tech):
3
+ An [Astro](https://astro.build) app on [Gild UI](https://gild-ui.soroush.design):
4
4
  <!-- @if ssr -->
5
5
  every page is rendered on the server, on each request, with its styles, and its parts are
6
6
  React islands that hydrate in the browser. Astro's client router moves between pages with no
@@ -27,10 +27,11 @@ React parts render at build time only.
27
27
  `src/theme/scheme.js`, not context.
28
28
  - The home page's counter is an island of its own, which renders in the browser only
29
29
  (`client:only`), so the count it shows is the one in memory, not the build's.
30
- - `src/layouts/Layout.astro` keeps the design system's styles as the client router moves
30
+ - `src/layouts/Layout.astro` keeps Gild UI's styles as the client router moves
31
31
  between pages.
32
32
  <!-- @endif -->
33
33
  - `src/theme/themes.js` holds the light and the dark theme: make them your own.
34
+ - `src/theme/setup.js` configures the engine once, with the theme the app starts in; the integration in `astro.config.mjs` runs it in the browser, before the islands hydrate, and on the server.
34
35
  <!-- @if sample-data && ssr -->
35
36
  - `src/pages/items/` lists the sample items of `src/data/items.js`, with a page for each,
36
37
  read on each request: make them fetch your own.
@@ -87,4 +88,4 @@ React parts render at build time only.
87
88
  <!-- @endif -->
88
89
 
89
90
  Fonts: the theme names Space Grotesk and JetBrains Mono, and does not load them. See
90
- https://docs.soroush.tech/design-system/getting-started/installation/#fonts
91
+ https://gild-ui.soroush.design/react/installation/#fonts
@@ -7,6 +7,21 @@ import { msw } from 'msw/vite'
7
7
  // @endif
8
8
  import { defineConfig } from 'astro/config'
9
9
 
10
+ // Configures the engine once for the whole program (src/theme/setup.js): in the browser before the
11
+ // islands hydrate, and on the server before a page is rendered.
12
+ function setupEngine() {
13
+ const run = "import { setup } from '/src/theme/setup.js'; setup()"
14
+ return {
15
+ name: 'setup-engine',
16
+ hooks: {
17
+ 'astro:config:setup': ({ injectScript }) => {
18
+ injectScript('before-hydration', run)
19
+ injectScript('page-ssr', run)
20
+ },
21
+ },
22
+ }
23
+ }
24
+
10
25
  // The settings of the app: https://docs.astro.build/en/reference/configuration-reference/
11
26
  export default defineConfig({
12
27
  // @if ssr
@@ -15,7 +30,7 @@ export default defineConfig({
15
30
  output: 'server',
16
31
  adapter: node({ mode: 'standalone' }),
17
32
  // @endif
18
- integrations: [react()],
33
+ integrations: [setupEngine(), react()],
19
34
  // @if msw
20
35
  // msw's plugin serves the mock API's worker, in development and in the build.
21
36
  vite: { plugins: [msw({ mode: 'worker-only' })] },
@@ -1,5 +1,5 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Typography } from '@gild-ui/react/Typography'
3
3
  import { withIsland } from '../theme/Island'
4
4
 
5
5
  function About() {
@@ -1,8 +1,8 @@
1
1
  // @if !ssg
2
2
  import { useState } from 'react'
3
- import { Button } from '@soroush.tech/design-system/Button'
4
- import { Flex } from '@soroush.tech/design-system/Flex'
5
- import { Typography } from '@soroush.tech/design-system/Typography'
3
+ import { Button } from '@gild-ui/react/Button'
4
+ import { Flex } from '@gild-ui/react/Flex'
5
+ import { Typography } from '@gild-ui/react/Typography'
6
6
  import { withIsland } from '../theme/Island'
7
7
 
8
8
  /**
@@ -6,7 +6,7 @@ import useSWR from 'swr'
6
6
  // @else
7
7
  import { useEffect, useState } from 'react'
8
8
  // @endif
9
- import { Typography } from '@soroush.tech/design-system/Typography'
9
+ import { Typography } from '@gild-ui/react/Typography'
10
10
  // @if !tanstack-query && !swr
11
11
  // @endif
12
12
  import { fetchGreeting } from '../data/api'
@@ -1,9 +1,9 @@
1
- import { AppBar } from '@soroush.tech/design-system/AppBar'
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Link } from '@soroush.tech/design-system/Link'
4
- import { useTheme } from '@soroush.tech/design-system/theme'
5
- import { Typography } from '@soroush.tech/design-system/Typography'
6
- import { alpha } from '@soroush.tech/design-system/utils'
1
+ import { AppBar } from '@gild-ui/react/AppBar'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Link } from '@gild-ui/react/Link'
4
+ import { useTheme } from '@gild-ui/react'
5
+ import { Typography } from '@gild-ui/react/Typography'
6
+ import { alpha } from '@gild-ui/core/utils'
7
7
  import { Providers } from '../theme/Providers'
8
8
  // @if !ssg
9
9
  import { setScheme, useScheme } from '../theme/scheme'
@@ -1,6 +1,6 @@
1
- import { Button } from '@soroush.tech/design-system/Button'
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Button } from '@gild-ui/react/Button'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
 
6
6
  // @if ssg
@@ -15,12 +15,12 @@ function Home({ children }) {
15
15
  <Flex gap={2} alignItems="flex-start" px={3} py={4}>
16
16
  <Typography variant="h2">__TITLE__</Typography>
17
17
  <Typography color="secondary">
18
- An Astro app on the design system. Edit src/components/Home.jsx, and make the themes your
19
- own in src/theme/themes.js.
18
+ An Astro app on Gild UI. Edit src/components/Home.jsx, and make the themes your own in
19
+ src/theme/themes.js.
20
20
  </Typography>
21
21
  {children}
22
22
  <Flex flexDirection="row" gap={1}>
23
- <Button href="https://docs.soroush.tech">Components</Button>
23
+ <Button href="https://gild-ui.soroush.design">Components</Button>
24
24
  <Button href="https://astro.build" variant="outlined">
25
25
  Astro
26
26
  </Button>
@@ -3,7 +3,7 @@ import { cleanup, render, screen } from '@testing-library/react'
3
3
  // @else
4
4
  import { cleanup, fireEvent, render, screen } from '@testing-library/react'
5
5
  // @endif
6
- import { afterEach, describe, expect, it } from 'vitest'
6
+ import { afterEach, beforeAll, describe, expect, it } from 'vitest'
7
7
  // @if !ssg
8
8
  import Counter from './Counter'
9
9
  // @endif
@@ -11,9 +11,13 @@ import Counter from './Counter'
11
11
  import Greeting from './Greeting'
12
12
  // @endif
13
13
  import Home from './Home'
14
+ import { setup } from '../theme/setup'
14
15
 
15
16
  // Each island renders inside its own providers, so a test renders it as it is.
16
17
  describe('the home page', () => {
18
+ // The engine is configured once, as the app does it, before any island renders.
19
+ beforeAll(setup)
20
+
17
21
  // Vitest has no globals here, so Testing Library cannot clean up on its own.
18
22
  afterEach(cleanup)
19
23
 
@@ -1,6 +1,6 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Link } from '@soroush.tech/design-system/Link'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Link } from '@gild-ui/react/Link'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
 
6
6
  /** Shown for a page that does not exist. */
@@ -1,8 +1,8 @@
1
1
  // @if !ssg
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Icon } from '@soroush.tech/design-system/Icon'
4
- import { Switch } from '@soroush.tech/design-system/Switch'
5
- import { Typography } from '@soroush.tech/design-system/Typography'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Icon } from '@gild-ui/react/Icon'
4
+ import { Switch } from '@gild-ui/react/Switch'
5
+ import { Typography } from '@gild-ui/react/Typography'
6
6
 
7
7
  /** The switch between the light and the dark theme, on when dark, with the scheme's icon. */
8
8
  export function SchemeSwitch({ scheme, onSchemeChange }) {
@@ -6,7 +6,7 @@ import { QueryClientProvider } from '@tanstack/react-query'
6
6
  // @if redux-toolkit
7
7
  import { Provider as StoreProvider } from 'react-redux'
8
8
  // @endif
9
- import { ThemeProvider } from '@soroush.tech/design-system/theme'
9
+ import { ThemeProvider } from '@gild-ui/react'
10
10
  // @if tanstack-query
11
11
  import { getQueryClient } from '../data/queryClient'
12
12
  // @endif
@@ -1,6 +1,6 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Link } from '@soroush.tech/design-system/Link'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Link } from '@gild-ui/react/Link'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  // @if tanstack-query
5
5
  import { useQuery } from '@tanstack/react-query'
6
6
  import { fetchItem } from '../data/api'
@@ -1,6 +1,6 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Link } from '@soroush.tech/design-system/Link'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Link } from '@gild-ui/react/Link'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  // @if tanstack-query
5
5
  import { useQuery } from '@tanstack/react-query'
6
6
  import { fetchItems } from '../data/api'
@@ -1,4 +1,4 @@
1
- import { Chip } from '@soroush.tech/design-system/Chip'
1
+ import { Chip } from '@gild-ui/react/Chip'
2
2
 
3
3
  const COLORS = { todo: 'default', doing: 'primary', done: 'success' }
4
4
 
@@ -1,6 +1,6 @@
1
- import { Button } from '@soroush.tech/design-system/Button'
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Button } from '@gild-ui/react/Button'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
  import { useAtom } from 'jotai'
6
6
  import { countAtom } from '../state/counter'
@@ -10,10 +10,10 @@ import { Controller, useForm } from 'react-hook-form'
10
10
  import useSWRMutation from 'swr/mutation'
11
11
  // @endif
12
12
  import { z } from 'zod'
13
- import { Button } from '@soroush.tech/design-system/Button'
14
- import { Flex } from '@soroush.tech/design-system/Flex'
15
- import { TextInput } from '@soroush.tech/design-system/TextInput'
16
- import { Typography } from '@soroush.tech/design-system/Typography'
13
+ import { Button } from '@gild-ui/react/Button'
14
+ import { Flex } from '@gild-ui/react/Flex'
15
+ import { TextInput } from '@gild-ui/react/TextInput'
16
+ import { Typography } from '@gild-ui/react/Typography'
17
17
  import { withIsland } from '../theme/Island'
18
18
  // @if tanstack-query || swr || msw
19
19
  import { sendMessage } from '../data/api'
@@ -1,6 +1,6 @@
1
- import { Button } from '@soroush.tech/design-system/Button'
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Button } from '@gild-ui/react/Button'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
  import { useDispatch, useSelector } from 'react-redux'
6
6
  import { incremented } from '../state/store'
@@ -1,6 +1,6 @@
1
- import { Button } from '@soroush.tech/design-system/Button'
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Button } from '@gild-ui/react/Button'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
  import { useCounter } from '../state/counter'
6
6
 
@@ -1,6 +1,6 @@
1
1
  # __TITLE__
2
2
 
3
- An [Astro](https://astro.build) app on the [@soroush.tech design system](https://docs.soroush.tech):
3
+ An [Astro](https://astro.build) app on [Gild UI](https://gild-ui.soroush.design):
4
4
  <!-- @if ssr -->
5
5
  every page is rendered on the server, on each request, with its styles, and its parts are
6
6
  React islands that hydrate in the browser. Astro's client router moves between pages with no
@@ -27,10 +27,11 @@ React parts render at build time only.
27
27
  `src/theme/scheme.ts`, not context.
28
28
  - The home page's counter is an island of its own, which renders in the browser only
29
29
  (`client:only`), so the count it shows is the one in memory, not the build's.
30
- - `src/layouts/Layout.astro` keeps the design system's styles as the client router moves
30
+ - `src/layouts/Layout.astro` keeps Gild UI's styles as the client router moves
31
31
  between pages.
32
32
  <!-- @endif -->
33
33
  - `src/theme/themes.ts` holds the light and the dark theme: make them your own.
34
+ - `src/theme/setup.ts` configures the engine once, with the theme the app starts in; the integration in `astro.config.mjs` runs it in the browser, before the islands hydrate, and on the server.
34
35
  <!-- @if sample-data && ssr -->
35
36
  - `src/pages/items/` lists the sample items of `src/data/items.ts`, with a page for each,
36
37
  read on each request: make them fetch your own.
@@ -87,4 +88,4 @@ React parts render at build time only.
87
88
  <!-- @endif -->
88
89
 
89
90
  Fonts: the theme names Space Grotesk and JetBrains Mono, and does not load them. See
90
- https://docs.soroush.tech/design-system/getting-started/installation/#fonts
91
+ https://gild-ui.soroush.design/react/installation/#fonts
@@ -7,6 +7,21 @@ import { msw } from 'msw/vite'
7
7
  // @endif
8
8
  import { defineConfig } from 'astro/config'
9
9
 
10
+ // Configures the engine once for the whole program (src/theme/setup.ts): in the browser before the
11
+ // islands hydrate, and on the server before a page is rendered.
12
+ function setupEngine() {
13
+ const run = "import { setup } from '/src/theme/setup.ts'; setup()"
14
+ return {
15
+ name: 'setup-engine',
16
+ hooks: {
17
+ 'astro:config:setup': ({ injectScript }) => {
18
+ injectScript('before-hydration', run)
19
+ injectScript('page-ssr', run)
20
+ },
21
+ },
22
+ }
23
+ }
24
+
10
25
  // The settings of the app: https://docs.astro.build/en/reference/configuration-reference/
11
26
  export default defineConfig({
12
27
  // @if ssr
@@ -15,7 +30,7 @@ export default defineConfig({
15
30
  output: 'server',
16
31
  adapter: node({ mode: 'standalone' }),
17
32
  // @endif
18
- integrations: [react()],
33
+ integrations: [setupEngine(), react()],
19
34
  // @if msw
20
35
  // msw's plugin serves the mock API's worker, in development and in the build.
21
36
  vite: { plugins: [msw({ mode: 'worker-only' })] },
@@ -1,5 +1,5 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Typography } from '@gild-ui/react/Typography'
3
3
  import { withIsland } from '../theme/Island'
4
4
 
5
5
  function About() {
@@ -1,8 +1,8 @@
1
1
  // @if !ssg
2
2
  import { useState } from 'react'
3
- import { Button } from '@soroush.tech/design-system/Button'
4
- import { Flex } from '@soroush.tech/design-system/Flex'
5
- import { Typography } from '@soroush.tech/design-system/Typography'
3
+ import { Button } from '@gild-ui/react/Button'
4
+ import { Flex } from '@gild-ui/react/Flex'
5
+ import { Typography } from '@gild-ui/react/Typography'
6
6
  import { withIsland } from '../theme/Island'
7
7
 
8
8
  /**
@@ -6,7 +6,7 @@ import useSWR from 'swr'
6
6
  // @else
7
7
  import { useEffect, useState } from 'react'
8
8
  // @endif
9
- import { Typography } from '@soroush.tech/design-system/Typography'
9
+ import { Typography } from '@gild-ui/react/Typography'
10
10
  // @if !tanstack-query && !swr
11
11
  import type { Greeting as Reply } from '../data/api'
12
12
  // @endif
@@ -1,10 +1,10 @@
1
1
  import type { ReactNode } from 'react'
2
- import { AppBar } from '@soroush.tech/design-system/AppBar'
3
- import { Flex } from '@soroush.tech/design-system/Flex'
4
- import { Link } from '@soroush.tech/design-system/Link'
5
- import { useTheme } from '@soroush.tech/design-system/theme'
6
- import { Typography } from '@soroush.tech/design-system/Typography'
7
- import { alpha } from '@soroush.tech/design-system/utils'
2
+ import { AppBar } from '@gild-ui/react/AppBar'
3
+ import { Flex } from '@gild-ui/react/Flex'
4
+ import { Link } from '@gild-ui/react/Link'
5
+ import { useTheme } from '@gild-ui/react'
6
+ import { Typography } from '@gild-ui/react/Typography'
7
+ import { alpha } from '@gild-ui/core/utils'
8
8
  import { Providers } from '../theme/Providers'
9
9
  // @if !ssg
10
10
  import { setScheme, useScheme } from '../theme/scheme'
@@ -3,7 +3,7 @@ import { cleanup, render, screen } from '@testing-library/react'
3
3
  // @else
4
4
  import { cleanup, fireEvent, render, screen } from '@testing-library/react'
5
5
  // @endif
6
- import { afterEach, describe, expect, it } from 'vitest'
6
+ import { afterEach, beforeAll, describe, expect, it } from 'vitest'
7
7
  // @if !ssg
8
8
  import Counter from './Counter'
9
9
  // @endif
@@ -11,9 +11,13 @@ import Counter from './Counter'
11
11
  import Greeting from './Greeting'
12
12
  // @endif
13
13
  import Home from './Home'
14
+ import { setup } from '../theme/setup'
14
15
 
15
16
  // Each island renders inside its own providers, so a test renders it as it is.
16
17
  describe('the home page', () => {
18
+ // The engine is configured once, as the app does it, before any island renders.
19
+ beforeAll(setup)
20
+
17
21
  // Vitest has no globals here, so Testing Library cannot clean up on its own.
18
22
  afterEach(cleanup)
19
23
 
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react'
2
- import { Button } from '@soroush.tech/design-system/Button'
3
- import { Flex } from '@soroush.tech/design-system/Flex'
4
- import { Typography } from '@soroush.tech/design-system/Typography'
2
+ import { Button } from '@gild-ui/react/Button'
3
+ import { Flex } from '@gild-ui/react/Flex'
4
+ import { Typography } from '@gild-ui/react/Typography'
5
5
  import { withIsland } from '../theme/Island'
6
6
 
7
7
  // @if ssg
@@ -16,12 +16,12 @@ function Home({ children }: { readonly children?: ReactNode }) {
16
16
  <Flex gap={2} alignItems="flex-start" px={3} py={4}>
17
17
  <Typography variant="h2">__TITLE__</Typography>
18
18
  <Typography color="secondary">
19
- An Astro app on the design system. Edit src/components/Home.tsx, and make the themes your
20
- own in src/theme/themes.ts.
19
+ An Astro app on Gild UI. Edit src/components/Home.tsx, and make the themes your own in
20
+ src/theme/themes.ts.
21
21
  </Typography>
22
22
  {children}
23
23
  <Flex flexDirection="row" gap={1}>
24
- <Button href="https://docs.soroush.tech">Components</Button>
24
+ <Button href="https://gild-ui.soroush.design">Components</Button>
25
25
  <Button href="https://astro.build" variant="outlined">
26
26
  Astro
27
27
  </Button>
@@ -1,6 +1,6 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Link } from '@soroush.tech/design-system/Link'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Link } from '@gild-ui/react/Link'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
 
6
6
  /** Shown for a page that does not exist. */
@@ -1,8 +1,8 @@
1
1
  // @if !ssg
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Icon } from '@soroush.tech/design-system/Icon'
4
- import { Switch } from '@soroush.tech/design-system/Switch'
5
- import { Typography } from '@soroush.tech/design-system/Typography'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Icon } from '@gild-ui/react/Icon'
4
+ import { Switch } from '@gild-ui/react/Switch'
5
+ import { Typography } from '@gild-ui/react/Typography'
6
6
 
7
7
  type Scheme = 'light' | 'dark'
8
8
 
@@ -7,7 +7,7 @@ import type { ComponentType, ReactNode } from 'react'
7
7
  // @if redux-toolkit
8
8
  import { Provider as StoreProvider } from 'react-redux'
9
9
  // @endif
10
- import { ThemeProvider } from '@soroush.tech/design-system/theme'
10
+ import { ThemeProvider } from '@gild-ui/react'
11
11
  // @if tanstack-query
12
12
  import { getQueryClient } from '../data/queryClient'
13
13
  // @endif
@@ -1,6 +1,6 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Link } from '@soroush.tech/design-system/Link'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Link } from '@gild-ui/react/Link'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  // @if tanstack-query
5
5
  import { useQuery } from '@tanstack/react-query'
6
6
  import { fetchItem } from '../data/api'
@@ -1,6 +1,6 @@
1
- import { Flex } from '@soroush.tech/design-system/Flex'
2
- import { Link } from '@soroush.tech/design-system/Link'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Flex } from '@gild-ui/react/Flex'
2
+ import { Link } from '@gild-ui/react/Link'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  // @if tanstack-query
5
5
  import { useQuery } from '@tanstack/react-query'
6
6
  import { fetchItems } from '../data/api'
@@ -1,4 +1,4 @@
1
- import { Chip } from '@soroush.tech/design-system/Chip'
1
+ import { Chip } from '@gild-ui/react/Chip'
2
2
  import type { Item } from '../data/items'
3
3
 
4
4
  const COLORS = { todo: 'default', doing: 'primary', done: 'success' } as const
@@ -1,6 +1,6 @@
1
- import { Button } from '@soroush.tech/design-system/Button'
2
- import { Flex } from '@soroush.tech/design-system/Flex'
3
- import { Typography } from '@soroush.tech/design-system/Typography'
1
+ import { Button } from '@gild-ui/react/Button'
2
+ import { Flex } from '@gild-ui/react/Flex'
3
+ import { Typography } from '@gild-ui/react/Typography'
4
4
  import { withIsland } from '../theme/Island'
5
5
  import { useAtom } from 'jotai'
6
6
  import { countAtom } from '../state/counter'