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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { n as main, t as createNodeIo } from "./io-dfx17dYF.mjs";
2
+ import { n as main, t as createNodeIo } from "./io-BFbf4S_u.mjs";
3
3
  // ../design-system/package.json
4
4
  var name = "@soroush.tech/design-system";
5
- var version = "2.2.0";
5
+ var version = "3.0.0-alpha.0";
6
6
  var peerDependencies = {
7
- "react": "^18.0.0 || ^19.0.0",
8
- "react-dom": "^18.0.0 || ^19.0.0"
7
+ "react": "^19.2.8",
8
+ "react-dom": "^19.2.8"
9
9
  };
10
10
  // src/bin.ts
11
11
  process.exitCode = await main(process.argv.slice(2), createNodeIo(), {
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { t as createNodeIo, n as default, r as readDesignSystemPackage } from "./io-dfx17dYF.mjs";
1
+ export { t as createNodeIo, n as default, r as readDesignSystemPackage } from "./io-BFbf4S_u.mjs";
@@ -1129,7 +1129,6 @@ const VERSIONS = {
1129
1129
  "@astrojs/check": "^0.9.12",
1130
1130
  "@astrojs/node": "^11.1.13",
1131
1131
  "@astrojs/react": "^7.1.9",
1132
- "@emotion/server": "^11.11.0",
1133
1132
  "@hookform/resolvers": "^7.0.6",
1134
1133
  "@reduxjs/toolkit": "^2.14.0",
1135
1134
  "@soroush.tech/eslint-config": "workspace:*",
@@ -1139,6 +1138,7 @@ const VERSIONS = {
1139
1138
  "@types/node": "^26.6.6",
1140
1139
  "@types/react": "^19.3.0",
1141
1140
  "@types/react-dom": "^19.3.0",
1141
+ "@umber-style/server": "0.3.0",
1142
1142
  "@vitejs/plugin-react": "^6.3.0",
1143
1143
  "@vitest/coverage-v8": "^5.1.0",
1144
1144
  "astro": "^7.4.12",
@@ -1357,7 +1357,7 @@ function createPackageJson({ packageName, isTypeScript, rendering, libraries, ve
1357
1357
  dependencies: {
1358
1358
  "@soroush.tech/design-system": toRange(version),
1359
1359
  ...pickVersions([
1360
- "@emotion/server",
1360
+ "@umber-style/server",
1361
1361
  ...libraryPackages,
1362
1362
  "react",
1363
1363
  "react-dom",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soroush.design/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0-alpha.0",
4
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.",
5
5
  "keywords": [
6
6
  "cli",
@@ -43,7 +43,6 @@
43
43
  "@astrojs/check": "^0.9.12",
44
44
  "@astrojs/node": "^11.1.13",
45
45
  "@astrojs/react": "^7.1.9",
46
- "@emotion/server": "^11.11.0",
47
46
  "@hookform/resolvers": "^7.0.6",
48
47
  "@reduxjs/toolkit": "^2.14.0",
49
48
  "@tanstack/react-query": "^5.107.1",
@@ -52,6 +51,7 @@
52
51
  "@types/node": "^26.6.6",
53
52
  "@types/react": "^19.3.0",
54
53
  "@types/react-dom": "^19.3.0",
54
+ "@umber-style/server": "0.3.0",
55
55
  "@vitejs/plugin-react": "^6.3.0",
56
56
  "@vitest/coverage-v8": "^5.1.0",
57
57
  "astro": "^7.4.12",
@@ -25,25 +25,36 @@ import Header from '../components/Header'
25
25
  </main>
26
26
  {/* @if !ssg */}
27
27
  <script>
28
- // Astro's client router replaces the head on each move between pages, and with it the
29
- // styles the design system keeps there. Each of them gets an id the router keeps. The next
30
- // page's own styles, which its HTML holds next to each island, move into its head, where
31
- // the islands expect them as they hydrate - but not its base styles: the header, which
32
- // the router keeps, draws those in the scheme picked.
28
+ // Astro's client router replaces the head on each move between pages, and with it the style
29
+ // elements of the styling engine: the one its cache writes its rules into (`data-style`),
30
+ // the ones it adopted from the server (`data-umber`, and React's own, `data-precedence`),
31
+ // and its two markers (a `<meta>` named `...-options` and one named `...-global`). They must
32
+ // stay the very elements the cache holds, or it writes into one the page no longer has, so
33
+ // each gets an id the router keeps. The next page's own styles, which its HTML holds next to
34
+ // each island, move into its head, where the cache reads each element as it arrives and the
35
+ // islands expect them as they hydrate - but not its base styles (the global rules and the
36
+ // root theme): the header, which the router keeps, draws those in the scheme picked.
37
+ const engineElements =
38
+ 'style[data-style], style[data-umber], style[data-precedence], meta[name$="-global"], meta[name$="-options"]'
39
+ const nameAttributes = ['data-umber', 'data-href', 'data-style', 'name']
33
40
  document.addEventListener('astro:before-swap', ({ newDocument }) => {
34
41
  const kept = new Set()
35
- document.head.querySelectorAll('style[data-emotion]').forEach((style, index) => {
42
+ document.head.querySelectorAll(engineElements).forEach((element, index) => {
36
43
  const id = `soroush-styles-${index}`
37
- style.setAttribute('data-astro-transition-persist', id)
38
- const placeholder = newDocument.createElement('style')
44
+ element.setAttribute('data-astro-transition-persist', id)
45
+ const placeholder = newDocument.createElement(element.localName)
39
46
  placeholder.setAttribute('data-astro-transition-persist', id)
40
47
  newDocument.head.append(placeholder)
41
- kept.add(style.getAttribute('data-emotion'))
48
+ const name =
49
+ nameAttributes.map((attribute) => element.getAttribute(attribute)).find(Boolean) ?? ''
50
+ kept.add(name)
42
51
  })
43
- newDocument.body.querySelectorAll('style[data-emotion]').forEach((style) => {
44
- const name = style.getAttribute('data-emotion') ?? ''
45
- if (kept.has(name) || name.includes('-global')) style.remove()
46
- else newDocument.head.append(style)
52
+ newDocument.body.querySelectorAll(engineElements).forEach((element) => {
53
+ const name =
54
+ nameAttributes.map((attribute) => element.getAttribute(attribute)).find(Boolean) ?? ''
55
+ const isBase = name.split(' ').some((part) => part.includes('-global'))
56
+ if (kept.has(name) || isBase) element.remove()
57
+ else newDocument.head.append(element)
47
58
  })
48
59
  })
49
60
  </script>
@@ -25,25 +25,36 @@ import Header from '../components/Header'
25
25
  </main>
26
26
  {/* @if !ssg */}
27
27
  <script>
28
- // Astro's client router replaces the head on each move between pages, and with it the
29
- // styles the design system keeps there. Each of them gets an id the router keeps. The next
30
- // page's own styles, which its HTML holds next to each island, move into its head, where
31
- // the islands expect them as they hydrate - but not its base styles: the header, which
32
- // the router keeps, draws those in the scheme picked.
28
+ // Astro's client router replaces the head on each move between pages, and with it the style
29
+ // elements of the styling engine: the one its cache writes its rules into (`data-style`),
30
+ // the ones it adopted from the server (`data-umber`, and React's own, `data-precedence`),
31
+ // and its two markers (a `<meta>` named `...-options` and one named `...-global`). They must
32
+ // stay the very elements the cache holds, or it writes into one the page no longer has, so
33
+ // each gets an id the router keeps. The next page's own styles, which its HTML holds next to
34
+ // each island, move into its head, where the cache reads each element as it arrives and the
35
+ // islands expect them as they hydrate - but not its base styles (the global rules and the
36
+ // root theme): the header, which the router keeps, draws those in the scheme picked.
37
+ const engineElements =
38
+ 'style[data-style], style[data-umber], style[data-precedence], meta[name$="-global"], meta[name$="-options"]'
39
+ const nameAttributes = ['data-umber', 'data-href', 'data-style', 'name']
33
40
  document.addEventListener('astro:before-swap', ({ newDocument }) => {
34
41
  const kept = new Set()
35
- document.head.querySelectorAll('style[data-emotion]').forEach((style, index) => {
42
+ document.head.querySelectorAll(engineElements).forEach((element, index) => {
36
43
  const id = `soroush-styles-${index}`
37
- style.setAttribute('data-astro-transition-persist', id)
38
- const placeholder = newDocument.createElement('style')
44
+ element.setAttribute('data-astro-transition-persist', id)
45
+ const placeholder = newDocument.createElement(element.localName)
39
46
  placeholder.setAttribute('data-astro-transition-persist', id)
40
47
  newDocument.head.append(placeholder)
41
- kept.add(style.getAttribute('data-emotion'))
48
+ const name =
49
+ nameAttributes.map((attribute) => element.getAttribute(attribute)).find(Boolean) ?? ''
50
+ kept.add(name)
42
51
  })
43
- newDocument.body.querySelectorAll('style[data-emotion]').forEach((style) => {
44
- const name = style.getAttribute('data-emotion') ?? ''
45
- if (kept.has(name) || name.includes('-global')) style.remove()
46
- else newDocument.head.append(style)
52
+ newDocument.body.querySelectorAll(engineElements).forEach((element) => {
53
+ const name =
54
+ nameAttributes.map((attribute) => element.getAttribute(attribute)).find(Boolean) ?? ''
55
+ const isBase = name.split(' ').some((part) => part.includes('-global'))
56
+ if (kept.has(name) || isBase) element.remove()
57
+ else newDocument.head.append(element)
47
58
  })
48
59
  })
49
60
  </script>
@@ -1,4 +1,4 @@
1
- import createEmotionServer from '@emotion/server/create-instance'
1
+ import createStyleServer from '@umber-style/server/create-instance'
2
2
  import { renderToString } from 'react-dom/server'
3
3
  import { styleCache } from '@soroush.tech/design-system/engine'
4
4
  import { dangerouslySkipEscape, escapeInject } from 'vike/server'
@@ -9,7 +9,7 @@ import { PageShell } from './PageShell'
9
9
  * in the head, so it is drawn styled before any script runs.
10
10
  */
11
11
  export const onRenderHtml = (pageContext) => {
12
- const { extractCriticalToChunks, constructStyleTagsFromChunks } = createEmotionServer(styleCache)
12
+ const { extractCriticalToChunks, constructStyleTagsFromChunks } = createStyleServer(styleCache)
13
13
  const html = renderToString(<PageShell pageContext={pageContext} />)
14
14
  const styles = constructStyleTagsFromChunks(extractCriticalToChunks(html))
15
15
  return escapeInject`<!doctype html>
@@ -9,7 +9,7 @@ import { store } from '../state/store'
9
9
  import { PageContextProvider } from './usePageContext'
10
10
 
11
11
  /**
12
- * The page inside its +Layout. The Emotion cache is the design system's, so the styles the page
12
+ * The page inside its +Layout. The style cache is the design system's, so the styles the page
13
13
  * uses are found where it is drawn, and every component of the page can read its pageContext.
14
14
  */
15
15
  export function PageShell({ pageContext }) {
@@ -1,4 +1,4 @@
1
- import createEmotionServer from '@emotion/server/create-instance'
1
+ import createStyleServer from '@umber-style/server/create-instance'
2
2
  import { renderToString } from 'react-dom/server'
3
3
  import { styleCache } from '@soroush.tech/design-system/engine'
4
4
  import { dangerouslySkipEscape, escapeInject } from 'vike/server'
@@ -9,7 +9,7 @@ import { PageShell } from './PageShell'
9
9
  * head, so it is drawn styled before any script runs.
10
10
  */
11
11
  export const onRenderHtml = (pageContext) => {
12
- const { extractCriticalToChunks, constructStyleTagsFromChunks } = createEmotionServer(styleCache)
12
+ const { extractCriticalToChunks, constructStyleTagsFromChunks } = createStyleServer(styleCache)
13
13
  const html = renderToString(<PageShell pageContext={pageContext} />)
14
14
  const styles = constructStyleTagsFromChunks(extractCriticalToChunks(html))
15
15
  return escapeInject`<!doctype html>
@@ -1,4 +1,4 @@
1
- import createEmotionServer from '@emotion/server/create-instance'
1
+ import createStyleServer from '@umber-style/server/create-instance'
2
2
  import { renderToString } from 'react-dom/server'
3
3
  import { styleCache } from '@soroush.tech/design-system/engine'
4
4
  import { dangerouslySkipEscape, escapeInject } from 'vike/server'
@@ -10,7 +10,7 @@ import { PageShell } from './PageShell'
10
10
  * in the head, so it is drawn styled before any script runs.
11
11
  */
12
12
  export const onRenderHtml: OnRenderHtmlSync = (pageContext) => {
13
- const { extractCriticalToChunks, constructStyleTagsFromChunks } = createEmotionServer(styleCache)
13
+ const { extractCriticalToChunks, constructStyleTagsFromChunks } = createStyleServer(styleCache)
14
14
  const html = renderToString(<PageShell pageContext={pageContext} />)
15
15
  const styles = constructStyleTagsFromChunks(extractCriticalToChunks(html))
16
16
  return escapeInject`<!doctype html>
@@ -10,7 +10,7 @@ import { store } from '../state/store'
10
10
  import { PageContextProvider } from './usePageContext'
11
11
 
12
12
  /**
13
- * The page inside its +Layout. The Emotion cache is the design system's, so the styles the page
13
+ * The page inside its +Layout. The style cache is the design system's, so the styles the page
14
14
  * uses are found where it is drawn, and every component of the page can read its pageContext.
15
15
  */
16
16
  export function PageShell({ pageContext }: { readonly pageContext: PageContext }) {
@@ -1,4 +1,4 @@
1
- import createEmotionServer from '@emotion/server/create-instance'
1
+ import createStyleServer from '@umber-style/server/create-instance'
2
2
  import { renderToString } from 'react-dom/server'
3
3
  import { styleCache } from '@soroush.tech/design-system/engine'
4
4
  import { dangerouslySkipEscape, escapeInject } from 'vike/server'
@@ -10,7 +10,7 @@ import { PageShell } from './PageShell'
10
10
  * head, so it is drawn styled before any script runs.
11
11
  */
12
12
  export const onRenderHtml: OnRenderHtmlSync = (pageContext) => {
13
- const { extractCriticalToChunks, constructStyleTagsFromChunks } = createEmotionServer(styleCache)
13
+ const { extractCriticalToChunks, constructStyleTagsFromChunks } = createStyleServer(styleCache)
14
14
  const html = renderToString(<PageShell pageContext={pageContext} />)
15
15
  const styles = constructStyleTagsFromChunks(extractCriticalToChunks(html))
16
16
  return escapeInject`<!doctype html>