@reqvire-org/ads 0.3.44 → 0.3.46
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/README.md +29 -9
- package/dist/a11y.mjs +100 -0
- package/dist/assets.mjs +29 -5
- package/dist/brand-assets.mjs +41 -7
- package/dist/capture/worker.mjs +1 -1
- package/dist/capture-store.mjs +2 -1
- package/dist/capture.mjs +5 -2
- package/dist/check.mjs +2 -1
- package/dist/cli.mjs +33 -9
- package/dist/config.mjs +22 -10
- package/dist/contracts/tokens.json +1 -1
- package/dist/create.mjs +48 -0
- package/dist/design-values.mjs +8 -2
- package/dist/foundation.mjs +3 -0
- package/dist/image-size.mjs +28 -0
- package/dist/index.mjs +1 -0
- package/dist/init.mjs +4 -5
- package/dist/mcp/apps.mjs +1 -1
- package/dist/mcp/preview-widget.bundle.js +19 -13
- package/dist/mcp/project-widget.bundle.js +26 -26
- package/dist/mcp/server.mjs +6 -5
- package/dist/mcp/skills.mjs +1 -1
- package/dist/mcp/widget.bundle.js +15 -15
- package/dist/preview-resources.mjs +2 -2
- package/dist/scenario-groups.mjs +2 -2
- package/dist/scenario-registry.mjs +3 -3
- package/dist/scenarios-compiler.mjs +1 -1
- package/dist/scenarios.mjs +6 -11
- package/dist/showcase/client.bundle.js +27 -27
- package/dist/showcase/draft-navigation.js +1 -1
- package/dist/showcase/index.html +2 -1
- package/dist/skills/ads-break-ui/SKILL.md +1 -1
- package/dist/skills/ads-break-ui/references/captures.md +3 -2
- package/dist/skills/ads-break-ui/references/design-data.md +89 -0
- package/dist/skills/ads-designer/README.md +2 -2
- package/dist/skills/ads-designer/SKILL.md +47 -56
- package/dist/skills/ads-designer/references/accessibility.md +43 -0
- package/dist/skills/ads-designer/references/branding.md +52 -9
- package/dist/skills/ads-designer/references/captures.md +3 -2
- package/dist/skills/ads-designer/references/cli.md +5 -4
- package/dist/skills/ads-designer/references/design-data.md +89 -0
- package/dist/skills/ads-import/SKILL.md +1 -1
- package/dist/skills/ads-import/references/branding.md +4 -3
- package/dist/skills/ads-import/references/captures.md +3 -2
- package/dist/skills/ads-import/references/cli.md +5 -4
- package/dist/skills/ads-import/references/design-data.md +89 -0
- package/dist/skills/ads-motion/SKILL.md +1 -1
- package/dist/skills/ads-motion/references/build.md +33 -0
- package/dist/skills/ads-motion/references/captures.md +3 -2
- package/dist/skills/ads-motion/references/design-data.md +89 -0
- package/dist/skills/ads-motion/references/motion-review.md +2 -2
- package/dist/skills/ads-port/SKILL.md +1 -1
- package/dist/skills/ads-port/references/captures.md +3 -2
- package/dist/skills/ads-port/references/cli.md +5 -4
- package/dist/skills/ads-port/references/design-data.md +89 -0
- package/dist/starters/preact/design-system/components/Layout/Grid/Grid.tsx +76 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds-preact → starters/preact}/design-system/review/token-preview/TokenPreview.tsx +10 -1
- package/dist/starters/preact/ds.config.json +32 -0
- package/dist/{bootstrap-ds → starters/react}/README.md +65 -24
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/design-system/assets/brand/README.md +1 -1
- package/dist/starters/react/design-system/assets/glyphs/README.md +12 -0
- package/dist/starters/react/design-system/assets/glyphs/aliases.json +1 -0
- package/dist/starters/react/design-system/assets/glyphs/check.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/chevron-down.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/chevron-right.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/close.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/external-link.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/info.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/menu.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/plus.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/search.svg +1 -0
- package/dist/starters/react/design-system/assets/glyphs/warning.svg +1 -0
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +7 -0
- package/dist/{bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx → starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx} +2 -2
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +7 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.scenario.tsx → starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx} +2 -2
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.tsx +11 -4
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.fixture.ts +9 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.ads.scenario.tsx +16 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/IconButton.tsx +44 -0
- package/dist/starters/react/design-system/components/Actions/IconButton/README.md +14 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.fixture.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.ads.scenario.tsx +15 -0
- package/dist/starters/react/design-system/components/Content/Icon/Icon.tsx +42 -0
- package/dist/starters/react/design-system/components/Content/Icon/README.md +16 -0
- package/dist/starters/react/design-system/components/Content/Icon/glyphs.ts +17 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.tsx +9 -5
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.fixture.ts +12 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.ads.scenario.tsx +17 -0
- package/dist/starters/react/design-system/components/Layout/Grid/Grid.tsx +75 -0
- package/dist/starters/react/design-system/components/Layout/Grid/README.md +21 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/index.ts +3 -0
- package/dist/starters/react/design-system/review/grid-cell/GridCell.tsx +18 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/review/index.ts +1 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/design-system/review/token-preview/TokenPreview.tsx +10 -1
- package/dist/starters/react/design-system/tokens/Color.ads.fixture.ts +124 -0
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +23 -0
- package/dist/{bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx → starters/react/design-system/tokens/Layout.ads.scenario.tsx} +1 -1
- package/dist/starters/react/design-system/tokens/Motion.ads.fixture.ts +18 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx → starters/react/design-system/tokens/Motion.ads.scenario.tsx} +1 -1
- package/dist/starters/react/design-system/tokens/Shape.ads.fixture.ts +30 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.scenario.tsx → starters/react/design-system/tokens/Shape.ads.scenario.tsx} +1 -1
- package/dist/starters/react/design-system/tokens/Space.ads.fixture.ts +37 -0
- package/dist/starters/react/design-system/tokens/Space.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/tokens/Type.ads.fixture.ts +29 -0
- package/dist/starters/react/design-system/tokens/Type.ads.scenario.tsx +4 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/tokens/base.css +6 -3
- package/dist/starters/react/design-system/tokens/colors.css +223 -0
- package/dist/starters/react/design-system/tokens/elevation.css +60 -0
- package/dist/starters/react/design-system/tokens/spacing.css +79 -0
- package/dist/starters/react/design-system/tokens/typography.css +31 -0
- package/dist/starters/react/ds.config.json +32 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/tsconfig.build.json +2 -1
- package/dist/task-cache.mjs +1 -1
- package/dist/themes.mjs +106 -0
- package/dist/token-export.mjs +58 -0
- package/dist/token-fixtures.mjs +1 -1
- package/dist/token-quality.mjs +109 -0
- package/dist/tokens.mjs +9 -2
- package/dist/units.mjs +6 -6
- package/dist/validation.mjs +1 -1
- package/docs/ADS.md +38 -9
- package/docs/ARCHITECTURE.md +50 -5
- package/docs/CHANGELOG.md +88 -12
- package/docs/GUIDE.md +56 -25
- package/docs/MCP.md +13 -4
- package/package.json +3 -5
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +0 -36
- package/dist/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +0 -49
- package/dist/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/bootstrap-ds/design-system/tokens/Brand.ads.fixture.ts +0 -12
- package/dist/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +0 -18
- package/dist/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
- package/dist/bootstrap-ds/design-system/tokens/colors.css +0 -29
- package/dist/bootstrap-ds/design-system/tokens/elevation.css +0 -15
- package/dist/bootstrap-ds/design-system/tokens/spacing.css +0 -15
- package/dist/bootstrap-ds/design-system/tokens/typography.css +0 -13
- package/dist/bootstrap-ds/ds.config.json +0 -20
- package/dist/bootstrap-ds/tsconfig.build.json +0 -19
- package/dist/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/bootstrap-ds-preact/ds.config.json +0 -20
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +0 -258
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +0 -122
- package/dist/skills/ads-designer/assets/bootstrap-ds/biome.css.json +0 -21
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/app-icon.svg +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.dark.svg +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/logo.svg +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/fonts/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/Logo.tsx +0 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Content/Logo/README.md +0 -10
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +0 -14
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +0 -57
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/controllers/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/brand-preview/BrandPreview.tsx +0 -115
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/index.html +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/main.tsx +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/styles.css +0 -5
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Brand.ads.fixture.ts +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +0 -18
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/base.css +0 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/colors.css +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/elevation.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/spacing.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/typography.css +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +0 -20
- package/dist/skills/ads-designer/assets/bootstrap-ds/gitignore.template +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/package-lock.json +0 -4660
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +0 -42
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +0 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.json +0 -35
- package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +0 -23
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +0 -20
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +0 -38
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +0 -23
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/package.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/vite.config.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/ADS.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/biome.css.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/brand/app-icon.svg +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/brand/logo.dark.svg +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/brand/logo.svg +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/fonts/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/Logo.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/Logo.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/Logo.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Content/Logo/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/controllers/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/brand-preview/BrandPreview.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/index.html +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/styles.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/gitignore.template +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package-lock.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/scripts/build-mcp-previews.mjs +0 -0
- /package/dist/{bootstrap-ds → starters/react}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/vite.config.ts +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* Layered shadows at low opacity, softer-looking but stronger in the dark theme; fixed
|
|
2
|
+
stacking layers; motion durations and easing for staying, entering and leaving elements. */
|
|
3
|
+
:root, [data-theme="light"] {
|
|
4
|
+
--shadow-xs: 0 1px 2px 0 rgb(16 24 40 / 0.06);
|
|
5
|
+
--shadow-sm: 0 1px 3px 0 rgb(16 24 40 / 0.1), 0 1px 2px -1px rgb(16 24 40 / 0.1);
|
|
6
|
+
--shadow-md: 0 4px 8px -2px rgb(16 24 40 / 0.1), 0 2px 4px -2px rgb(16 24 40 / 0.06);
|
|
7
|
+
--shadow-lg: 0 12px 16px -4px rgb(16 24 40 / 0.08), 0 4px 6px -2px rgb(16 24 40 / 0.04);
|
|
8
|
+
--shadow-xl: 0 20px 24px -4px rgb(16 24 40 / 0.1), 0 8px 8px -4px rgb(16 24 40 / 0.04);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* Re-resolved on themed sections, like the color roles. */
|
|
12
|
+
:root, [data-theme] {
|
|
13
|
+
--shadow-raised: var(--shadow-md);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:root {
|
|
17
|
+
--z-base: 0;
|
|
18
|
+
--z-dropdown: 1000;
|
|
19
|
+
--z-sticky: 1100;
|
|
20
|
+
--z-overlay: 1300;
|
|
21
|
+
--z-modal: 1400;
|
|
22
|
+
--z-toast: 1500;
|
|
23
|
+
--z-tooltip: 1600;
|
|
24
|
+
|
|
25
|
+
/* Durations grow with distance and size: control states, fades, small expansions and
|
|
26
|
+
short moves, expansions and toasts, large changes, background dimming. */
|
|
27
|
+
--dur-instant: 70ms;
|
|
28
|
+
--dur-fast: 110ms;
|
|
29
|
+
--dur-moderate: 150ms;
|
|
30
|
+
--dur-normal: 240ms;
|
|
31
|
+
--dur-slow: 400ms;
|
|
32
|
+
--dur-slower: 700ms;
|
|
33
|
+
/* Everyday curves, and strong ones for rare important moments. Standard moves between
|
|
34
|
+
visible places, enter decelerates in, exit accelerates out. */
|
|
35
|
+
--ease-standard: cubic-bezier(0.2, 0, 0.38, 0.9);
|
|
36
|
+
--ease-enter: cubic-bezier(0, 0, 0.38, 0.9);
|
|
37
|
+
--ease-exit: cubic-bezier(0.2, 0, 1, 0.9);
|
|
38
|
+
--ease-strong: cubic-bezier(0.4, 0.14, 0.3, 1);
|
|
39
|
+
--ease-enter-strong: cubic-bezier(0, 0, 0.3, 1);
|
|
40
|
+
--ease-exit-strong: cubic-bezier(0.4, 0.14, 1, 1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-theme="dark"] {
|
|
44
|
+
--shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
|
|
45
|
+
--shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.35), 0 1px 2px -1px rgb(0 0 0 / 0.35);
|
|
46
|
+
--shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
|
|
47
|
+
--shadow-lg: 0 12px 16px -4px rgb(0 0 0 / 0.45), 0 4px 6px -2px rgb(0 0 0 / 0.3);
|
|
48
|
+
--shadow-xl: 0 20px 24px -4px rgb(0 0 0 / 0.5), 0 8px 8px -4px rgb(0 0 0 / 0.3);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@media (prefers-reduced-motion: reduce) {
|
|
52
|
+
:root {
|
|
53
|
+
--dur-instant: 0ms;
|
|
54
|
+
--dur-fast: 0ms;
|
|
55
|
+
--dur-moderate: 0ms;
|
|
56
|
+
--dur-normal: 0ms;
|
|
57
|
+
--dur-slow: 0ms;
|
|
58
|
+
--dur-slower: 0ms;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/* One rhythm: --space-N is N × 2 px. 0–8 px inside components, 12–24 px between related
|
|
2
|
+
elements, 32–80 px between sections, 96–160 px around hero and page sections. Values do
|
|
3
|
+
not change by screen size; step down a size at narrow widths instead. */
|
|
4
|
+
:root {
|
|
5
|
+
--space-0: 0;
|
|
6
|
+
--space-1: 2px;
|
|
7
|
+
--space-2: 4px;
|
|
8
|
+
--space-3: 6px;
|
|
9
|
+
--space-4: 8px;
|
|
10
|
+
--space-6: 12px;
|
|
11
|
+
--space-8: 16px;
|
|
12
|
+
--space-10: 20px;
|
|
13
|
+
--space-12: 24px;
|
|
14
|
+
--space-16: 32px;
|
|
15
|
+
--space-20: 40px;
|
|
16
|
+
--space-24: 48px;
|
|
17
|
+
--space-32: 64px;
|
|
18
|
+
--space-40: 80px;
|
|
19
|
+
--space-48: 96px;
|
|
20
|
+
--space-80: 160px;
|
|
21
|
+
|
|
22
|
+
/* Gaps between stacked items and between prose blocks. */
|
|
23
|
+
--space-stack-sm: var(--space-4);
|
|
24
|
+
--space-stack-md: var(--space-8);
|
|
25
|
+
--space-stack-lg: var(--space-12);
|
|
26
|
+
--space-flow-paragraph: var(--space-8);
|
|
27
|
+
--space-flow-heading: var(--space-16);
|
|
28
|
+
|
|
29
|
+
/* Controls line up across buttons, inputs and selects; the smallest is 32 px (WCAG 2.5.8 asks 24). */
|
|
30
|
+
--control-height-sm: 32px;
|
|
31
|
+
--control-height-md: 40px;
|
|
32
|
+
--control-height-lg: 48px;
|
|
33
|
+
--control-padding-sm: 10px;
|
|
34
|
+
--control-padding-md: 14px;
|
|
35
|
+
--control-padding-lg: 18px;
|
|
36
|
+
|
|
37
|
+
/* Icons pair with text: 16 px beside sm/base text, 20 px beside lg, 24 and 32 px stand alone. */
|
|
38
|
+
--icon-sm: 16px;
|
|
39
|
+
--icon-md: 20px;
|
|
40
|
+
--icon-lg: 24px;
|
|
41
|
+
--icon-xl: 32px;
|
|
42
|
+
|
|
43
|
+
--radius-xs: 2px;
|
|
44
|
+
--radius-sm: 4px;
|
|
45
|
+
--radius-md: 6px;
|
|
46
|
+
--radius-lg: 8px;
|
|
47
|
+
--radius-xl: 12px;
|
|
48
|
+
--radius-2xl: 16px;
|
|
49
|
+
--radius-full: 9999px;
|
|
50
|
+
|
|
51
|
+
--border-w: 1px;
|
|
52
|
+
--border-w-thick: 2px;
|
|
53
|
+
--focus-w: 2px;
|
|
54
|
+
--focus-offset: 3px;
|
|
55
|
+
|
|
56
|
+
/* Layout. Breakpoints cannot be CSS variables; use 640, 768, 1024 and 1280 px in media
|
|
57
|
+
queries, or container queries against these widths. */
|
|
58
|
+
/* The column grid: 4, 8 and 16 columns from 0, 768 and 1024 px of container
|
|
59
|
+
width; gutters 32 px (wide), 16 px (narrow) or 1 px (condensed); margins 0, 16 and
|
|
60
|
+
24 px from 0, 768 and 1280 px. Every length is a spacing step. */
|
|
61
|
+
--grid-columns-sm: 4;
|
|
62
|
+
--grid-columns-md: 8;
|
|
63
|
+
--grid-columns-lg: 16;
|
|
64
|
+
--grid-gutter: var(--space-16);
|
|
65
|
+
--grid-gutter-narrow: var(--space-8);
|
|
66
|
+
--grid-gutter-condensed: var(--border-w);
|
|
67
|
+
--grid-margin-sm: var(--space-0);
|
|
68
|
+
--grid-margin-md: var(--space-8);
|
|
69
|
+
--grid-margin-lg: var(--space-12);
|
|
70
|
+
|
|
71
|
+
--content-max: 72ch;
|
|
72
|
+
--container-sm: 40rem;
|
|
73
|
+
--container-md: 48rem;
|
|
74
|
+
--container-lg: 64rem;
|
|
75
|
+
--container-xl: 80rem;
|
|
76
|
+
--app-header-height: 56px;
|
|
77
|
+
--side-pane-width: 280px;
|
|
78
|
+
--navigation-rail-width: 64px;
|
|
79
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* A 16 px body on a modular ladder. Sizes from 3xl up are fluid; line height tightens and
|
|
2
|
+
letter spacing turns negative as size grows. */
|
|
3
|
+
:root {
|
|
4
|
+
--font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
5
|
+
--font-mono: ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
|
|
6
|
+
|
|
7
|
+
--text-xs: 0.75rem;
|
|
8
|
+
--text-sm: 0.875rem;
|
|
9
|
+
--text-base: 1rem;
|
|
10
|
+
--text-lg: 1.125rem;
|
|
11
|
+
--text-xl: 1.25rem;
|
|
12
|
+
--text-2xl: 1.5rem;
|
|
13
|
+
--text-3xl: clamp(1.75rem, 1.6rem + 0.6vw, 2rem);
|
|
14
|
+
--text-4xl: clamp(2rem, 1.7rem + 1.3vw, 2.5rem);
|
|
15
|
+
--text-5xl: clamp(2.5rem, 2rem + 2.2vw, 3.25rem);
|
|
16
|
+
|
|
17
|
+
--weight-normal: 400;
|
|
18
|
+
--weight-medium: 500;
|
|
19
|
+
--weight-semibold: 600;
|
|
20
|
+
--weight-bold: 700;
|
|
21
|
+
|
|
22
|
+
--leading-none: 1;
|
|
23
|
+
--leading-tight: 1.2;
|
|
24
|
+
--leading-snug: 1.35;
|
|
25
|
+
--leading-normal: 1.5;
|
|
26
|
+
--leading-relaxed: 1.7;
|
|
27
|
+
|
|
28
|
+
--tracking-tight: -0.02em;
|
|
29
|
+
--tracking-normal: 0em;
|
|
30
|
+
--tracking-wide: 0.04em;
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"framework": "react",
|
|
3
|
+
"themes": [{ "name": "light", "scheme": "light" }, { "name": "dark", "scheme": "dark" }],
|
|
4
|
+
"behaviorLibraries": [],
|
|
5
|
+
"acceptance": { "checks": [], "behaviorChecks": false },
|
|
6
|
+
"validation": { "checks": [], "behaviorChecks": true, "inputs": [] },
|
|
7
|
+
"mcp": {
|
|
8
|
+
"previewManifest": ".ds/preview/manifest.json"
|
|
9
|
+
},
|
|
10
|
+
"boundaries": {
|
|
11
|
+
"styleWrites": [
|
|
12
|
+
{
|
|
13
|
+
"file": "design-system/components/Layout/Grid/Grid.tsx",
|
|
14
|
+
"properties": ["--ds-grid-span-sm", "--ds-grid-span-md", "--ds-grid-span-lg"]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"file": "design-system/review/token-preview/TokenPreview.tsx",
|
|
18
|
+
"properties": [
|
|
19
|
+
"--ux-token-preview-value"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"assets": {
|
|
25
|
+
"iconSource": "assets/brand/app-icon.svg",
|
|
26
|
+
"glyphs": {
|
|
27
|
+
"source": "assets/glyphs",
|
|
28
|
+
"output": "components/Content/Icon/glyphs.ts",
|
|
29
|
+
"attributes": { "fill": "none", "stroke": "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/dist/task-cache.mjs
CHANGED
|
@@ -28,7 +28,7 @@ function toolInputs() {
|
|
|
28
28
|
function visit(directory) {
|
|
29
29
|
for (const entry of readdirSync(directory,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name))) {
|
|
30
30
|
const file=path.join(directory,entry.name);
|
|
31
|
-
if (entry.isDirectory() && !["skills","
|
|
31
|
+
if (entry.isDirectory() && !["skills","starters","showcase"].includes(entry.name)) visit(file);
|
|
32
32
|
else if(entry.isFile() && /\.(?:mjs|js|cjs|json)$/.test(entry.name)) rows.push([path.relative(toolRoot,file),hash(readFileSync(file))]);
|
|
33
33
|
}
|
|
34
34
|
}
|
package/dist/themes.mjs
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import selectorParser from "postcss-selector-parser";
|
|
2
|
+
|
|
3
|
+
// A theme is a named set of token values: roles keep their names, values change. The first
|
|
4
|
+
// declared theme is the default and lives on :root; every other theme overrides values under
|
|
5
|
+
// [data-theme="<name>"], on the document root or on any element (a dark section in a light page).
|
|
6
|
+
|
|
7
|
+
export const defaultThemes = [{ name: "light", scheme: "light" }, { name: "dark", scheme: "dark" }];
|
|
8
|
+
|
|
9
|
+
export function validateThemes(themes) {
|
|
10
|
+
if (!Array.isArray(themes) || !themes.length || themes.length > 8) throw new Error("themes must list 1–8 themes; the first is the default.");
|
|
11
|
+
const names = new Set();
|
|
12
|
+
for (const [index, theme] of themes.entries()) {
|
|
13
|
+
const field = `themes[${index}]`;
|
|
14
|
+
if (!theme || typeof theme !== "object" || Array.isArray(theme)) throw new Error(`${field} must be an object with name and scheme.`);
|
|
15
|
+
const unknown = Object.keys(theme).filter(key => !["name", "scheme"].includes(key));
|
|
16
|
+
if (unknown.length) throw new Error(`${field} has unknown keys: ${unknown.join(", ")}.`);
|
|
17
|
+
if (typeof theme.name !== "string" || !/^[a-z][a-z0-9-]{0,31}$/.test(theme.name)) throw new Error(`${field}.name must be a lowercase name such as "dark" or "high-contrast".`);
|
|
18
|
+
if (!["light", "dark"].includes(theme.scheme)) throw new Error(`${field}.scheme must be "light" or "dark": the color scheme browsers use for native controls.`);
|
|
19
|
+
if (names.has(theme.name)) throw new Error(`Theme "${theme.name}" is declared twice.`);
|
|
20
|
+
names.add(theme.name);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const cache = new Map();
|
|
25
|
+
/** What a token definition's scope applies to: every theme ({ base }), named themes
|
|
26
|
+
* ({ themes }), or null for conditions (@media) and selectors that are not themes. */
|
|
27
|
+
export function scopeTheme(scope) {
|
|
28
|
+
if (cache.has(scope)) return cache.get(scope);
|
|
29
|
+
let result = null;
|
|
30
|
+
if (!scope.includes("@") && !scope.includes(" > ")) {
|
|
31
|
+
try {
|
|
32
|
+
let base = false, other = false;
|
|
33
|
+
const themes = new Set();
|
|
34
|
+
selectorParser(root => {
|
|
35
|
+
for (const selector of root.nodes) {
|
|
36
|
+
const nodes = selector.nodes.filter(node => node.type !== "comment");
|
|
37
|
+
const rootNode = node => node.type === "pseudo" && node.value.toLowerCase() === ":root" || node.type === "tag" && node.value.toLowerCase() === "html";
|
|
38
|
+
const themeNode = node => node.type === "attribute" && node.attribute === "data-theme" && (!node.operator || node.operator === "=");
|
|
39
|
+
const rest = nodes.filter(node => !rootNode(node));
|
|
40
|
+
if (rest.length === 0 && nodes.length === 1) base = true;
|
|
41
|
+
else if (rest.length === 1 && themeNode(rest[0]) && nodes.length <= 2) {
|
|
42
|
+
if (rest[0].value === undefined) base = true;
|
|
43
|
+
else themes.add(rest[0].value.replace(/^["']|["']$/g, ""));
|
|
44
|
+
} else other = true;
|
|
45
|
+
}
|
|
46
|
+
}).processSync(scope);
|
|
47
|
+
if (!other) result = base ? { base: true, themes: [...themes] } : themes.size ? { base: false, themes: [...themes] } : null;
|
|
48
|
+
} catch { result = null; }
|
|
49
|
+
}
|
|
50
|
+
cache.set(scope, result);
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Theme names a scope mentions, conditional or not, for the declaration check. */
|
|
55
|
+
export const mentionedThemes = scope => [...scope.matchAll(/data-theme\s*=\s*["']?([\w-]+)/g)].map(match => match[1]);
|
|
56
|
+
|
|
57
|
+
/** A token's definition for every theme, if any. */
|
|
58
|
+
export const baseDefinition = token => token.definitions.findLast(definition => scopeTheme(definition.scope)?.base);
|
|
59
|
+
|
|
60
|
+
/** A token's definition in one theme: its own override, else the base one. */
|
|
61
|
+
export function themeDefinition(token, theme) {
|
|
62
|
+
return token.definitions.findLast(definition => { const applies = scopeTheme(definition.scope); return applies && !applies.base && applies.themes.includes(theme); })
|
|
63
|
+
?? baseDefinition(token);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const colorLiteral = /^(?:#[\da-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\()/i;
|
|
67
|
+
|
|
68
|
+
/** Themes are declared, add no roles of their own, and override whole color ramps. */
|
|
69
|
+
export function themeFindings(tokens, themes, { dsDir } = {}) {
|
|
70
|
+
const declared = new Set(themes.map(theme => theme.name));
|
|
71
|
+
const diagnostics = [], advisories = [];
|
|
72
|
+
const warn = (rule, at, message, names) => advisories.push({ rule, severity: "warning", file: at.file, line: at.line, column: at.column, ...(names ? { tokens: names } : {}), guidanceUri: "ads://guides/tokens", message });
|
|
73
|
+
const reported = new Set();
|
|
74
|
+
for (const token of tokens) for (const definition of token.definitions) for (const name of mentionedThemes(definition.scope)) {
|
|
75
|
+
if (declared.has(name) || reported.has(`${definition.file}:${definition.line}:${name}`)) continue;
|
|
76
|
+
reported.add(`${definition.file}:${definition.line}:${name}`);
|
|
77
|
+
diagnostics.push({ rule: "theme-undeclared", file: definition.file, line: definition.line, column: definition.column, message: `${token.name} is set for theme "${name}", which ds.config.json does not declare (themes: ${[...declared].join(", ")}). Declare it or fix the name.` });
|
|
78
|
+
}
|
|
79
|
+
for (const token of tokens) {
|
|
80
|
+
if (baseDefinition(token)) continue;
|
|
81
|
+
const themed = token.definitions.find(definition => scopeTheme(definition.scope)?.themes.length);
|
|
82
|
+
if (themed) warn("theme-new-token", themed, `${token.name} exists only in a theme; every theme shares one set of roles, so define it for all themes and change only its value per theme.`, [token.name]);
|
|
83
|
+
}
|
|
84
|
+
// A theme that redefines part of a color ramp mixes two ramps in one theme.
|
|
85
|
+
const ramps = new Map();
|
|
86
|
+
for (const token of tokens) {
|
|
87
|
+
const match = token.name.match(/^(--[\w-]+?)-(\d+)$/), base = baseDefinition(token);
|
|
88
|
+
if (!match || !base || !colorLiteral.test(base.value.trim())) continue;
|
|
89
|
+
if (!ramps.has(match[1])) ramps.set(match[1], []);
|
|
90
|
+
ramps.get(match[1]).push(token);
|
|
91
|
+
}
|
|
92
|
+
for (const theme of themes.slice(1)) {
|
|
93
|
+
const own = token => token.definitions.find(definition => { const applies = scopeTheme(definition.scope); return applies && !applies.base && applies.themes.includes(theme.name); });
|
|
94
|
+
if (!tokens.some(own)) {
|
|
95
|
+
if (dsDir) warn("theme-empty", { file: dsDir, line: 1, column: 1 }, `Theme "${theme.name}" is declared but sets no token values; give it values under [data-theme="${theme.name}"] or remove it from ds.config.json.`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
for (const [ramp, steps] of ramps) {
|
|
99
|
+
const set = steps.filter(own);
|
|
100
|
+
if (!set.length || set.length === steps.length) continue;
|
|
101
|
+
const missing = steps.filter(step => !own(step)).map(step => step.name).sort((a, b) => Number(a.match(/\d+$/)[0]) - Number(b.match(/\d+$/)[0]));
|
|
102
|
+
warn("theme-coverage", own(set[0]), `Theme "${theme.name}" sets ${set.length} of ${steps.length} ${ramp}-* steps; it also needs ${missing.join(", ")}, or the ramp mixes two themes.`, missing);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return { diagnostics, advisories };
|
|
106
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { inspectTokens } from "./tokens.mjs";
|
|
2
|
+
import { parseColor } from "./token-quality.mjs";
|
|
3
|
+
import { baseDefinition, themeDefinition } from "./themes.mjs";
|
|
4
|
+
|
|
5
|
+
// The W3C Design Tokens Community Group format (draft): JSON groups of tokens with $value,
|
|
6
|
+
// $type and {group.token} references. The format has no themes yet: a document holds one
|
|
7
|
+
// theme's values, and the other definitions travel in this tool's $extensions entry, as do
|
|
8
|
+
// CSS values the format cannot express.
|
|
9
|
+
const extension = "org.reqvire.ads";
|
|
10
|
+
|
|
11
|
+
/** A token's path in the export: its family, then the rest of its name. */
|
|
12
|
+
function tokenPath(name) {
|
|
13
|
+
const bare = name.slice(2), dash = bare.indexOf("-");
|
|
14
|
+
return dash < 0 ? [bare, "$root"] : [bare.slice(0, dash), bare.slice(dash + 1)];
|
|
15
|
+
}
|
|
16
|
+
const reference = name => `{${tokenPath(name).join(".")}}`;
|
|
17
|
+
|
|
18
|
+
/** A CSS value as a DTCG value and type, or null when the format cannot express it. */
|
|
19
|
+
function typed(name, value) {
|
|
20
|
+
const text = value.trim();
|
|
21
|
+
const alias = text.match(/^var\(\s*(--[\w-]+)\s*\)$/);
|
|
22
|
+
if (alias) return { $value: reference(alias[1]) };
|
|
23
|
+
const color = parseColor(text);
|
|
24
|
+
if (color && !/^(?:--font-|--weight-|--leading-|--z-)/.test(name)) {
|
|
25
|
+
const hex = `#${color.slice(0, 3).map(channel => Math.round(channel).toString(16).padStart(2, "0")).join("")}`;
|
|
26
|
+
return { $type: "color", $value: { colorSpace: "srgb", components: color.slice(0, 3).map(channel => Number((channel / 255).toFixed(4))), ...(color[3] < 1 ? { alpha: color[3] } : {}), hex } };
|
|
27
|
+
}
|
|
28
|
+
let match = text.match(/^(-?\d*\.?\d+)(px|rem)$/);
|
|
29
|
+
if (match) return { $type: "dimension", $value: { value: Number(match[1]), unit: match[2] } };
|
|
30
|
+
match = text.match(/^(\d*\.?\d+)(ms|s)$/);
|
|
31
|
+
if (match) return { $type: "duration", $value: { value: Number(match[1]), unit: match[2] } };
|
|
32
|
+
match = text.match(/^cubic-bezier\(([^)]*)\)$/);
|
|
33
|
+
if (match) return { $type: "cubicBezier", $value: match[1].split(",").map(Number) };
|
|
34
|
+
if (name.startsWith("--font-")) return { $type: "fontFamily", $value: text.split(",").map(family => family.trim().replace(/^["']|["']$/g, "")) };
|
|
35
|
+
if (name.startsWith("--weight-") && /^\d+$/.test(text)) return { $type: "fontWeight", $value: Number(text) };
|
|
36
|
+
if (/^-?\d*\.?\d+$/.test(text)) return { $type: "number", $value: Number(text) };
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The project's tokens as one DTCG document, with the values of one theme (default: the first). */
|
|
41
|
+
export function exportTokensDtcg(directory, { theme } = {}) {
|
|
42
|
+
const { tokens, themes } = inspectTokens(directory);
|
|
43
|
+
if (theme !== undefined && !themes.some(item => item.name === theme)) throw new Error(`Unknown theme "${theme}"; the project declares ${themes.map(item => item.name).join(", ")}.`);
|
|
44
|
+
const document = {};
|
|
45
|
+
for (const token of tokens) {
|
|
46
|
+
const base = theme === undefined ? baseDefinition(token) : themeDefinition(token, theme);
|
|
47
|
+
if (!base) continue;
|
|
48
|
+
const entry = typed(token.name, base.value) ?? { $value: base.value.trim() };
|
|
49
|
+
if (!("$type" in entry) && !entry.$value.toString().startsWith("{")) entry.$extensions = { [extension]: { css: base.value.trim() } };
|
|
50
|
+
if (token.meaning) entry.$description = token.meaning;
|
|
51
|
+
const themes = Object.fromEntries(token.definitions.filter(definition => definition !== base).map(definition => [definition.scope, (typed(token.name, definition.value) ?? { $value: definition.value.trim() }).$value]));
|
|
52
|
+
if (Object.keys(themes).length) entry.$extensions = { ...entry.$extensions, [extension]: { ...entry.$extensions?.[extension], scopes: themes } };
|
|
53
|
+
const [group, key] = tokenPath(token.name);
|
|
54
|
+
document[group] ??= {};
|
|
55
|
+
document[group][key] = entry;
|
|
56
|
+
}
|
|
57
|
+
return document;
|
|
58
|
+
}
|
package/dist/token-fixtures.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { textDiff } from "./mcp/text-diff.mjs";
|
|
|
8
8
|
export function reconcileTokenSamples(options, {id, bindings = []}) {
|
|
9
9
|
if (bindings.length && !validTokenSamples(bindings)) throw new Error("Bindings need distinct {token, property, probe} CSS samples.");
|
|
10
10
|
const inventory = inspectTokens(options.root), registry = inspectScenarios(options), units = inspectUnits(options);
|
|
11
|
-
const scenario = registry.scenarios.find(entry => entry.id === id && entry.kind === "tokens"
|
|
11
|
+
const scenario = registry.scenarios.find(entry => entry.id === id && entry.kind === "tokens");
|
|
12
12
|
if (!scenario) throw new Error("Select an exact token scenario ID from ads_scenarios.");
|
|
13
13
|
const owner = units.owner(units.relative(scenario.file));
|
|
14
14
|
const owned = new Set(inventory.tokens.filter(token => token.owner === owner).map(token => token.name));
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { defaultThemes, themeDefinition } from "./themes.mjs";
|
|
2
|
+
|
|
3
|
+
/** Accessibility and rhythm reviews of token values: WCAG contrast between the roles that
|
|
4
|
+
* meet on screen, in every theme, and spacing steps on the 2 px grid. Both are advisories. */
|
|
5
|
+
|
|
6
|
+
const named = { white: [255, 255, 255, 1], black: [0, 0, 0, 1] };
|
|
7
|
+
|
|
8
|
+
/** sRGB channels and alpha of a hex, rgb()/rgba() or hsl()/hsla() color; null otherwise. */
|
|
9
|
+
export function parseColor(value) {
|
|
10
|
+
const text = value.trim().toLowerCase();
|
|
11
|
+
if (named[text]) return named[text];
|
|
12
|
+
let match = text.match(/^#([0-9a-f]{3,8})$/);
|
|
13
|
+
if (match) {
|
|
14
|
+
let hex = match[1];
|
|
15
|
+
if (hex.length === 3 || hex.length === 4) hex = [...hex].map(digit => digit + digit).join("");
|
|
16
|
+
if (hex.length !== 6 && hex.length !== 8) return null;
|
|
17
|
+
const channels = [0, 2, 4].map(index => parseInt(hex.slice(index, index + 2), 16));
|
|
18
|
+
return [...channels, hex.length === 8 ? parseInt(hex.slice(6), 16) / 255 : 1];
|
|
19
|
+
}
|
|
20
|
+
match = text.match(/^(rgba?|hsla?)\((.*)\)$/);
|
|
21
|
+
if (!match) return null;
|
|
22
|
+
const parts = match[2].split(/[\s,/]+/).filter(Boolean);
|
|
23
|
+
if (parts.length < 3) return null;
|
|
24
|
+
const alpha = parts[3] === undefined ? 1 : parts[3].endsWith("%") ? parseFloat(parts[3]) / 100 : parseFloat(parts[3]);
|
|
25
|
+
if (match[1].startsWith("rgb")) {
|
|
26
|
+
const channels = parts.slice(0, 3).map(part => part.endsWith("%") ? parseFloat(part) * 2.55 : parseFloat(part));
|
|
27
|
+
return channels.some(Number.isNaN) ? null : [...channels, alpha];
|
|
28
|
+
}
|
|
29
|
+
const [h, s, l] = [parseFloat(parts[0]), parseFloat(parts[1]) / 100, parseFloat(parts[2]) / 100];
|
|
30
|
+
if ([h, s, l].some(Number.isNaN)) return null;
|
|
31
|
+
const k = n => (n + h / 30) % 12, a = s * Math.min(l, 1 - l);
|
|
32
|
+
const f = n => 255 * (l - a * Math.max(-1, Math.min(k(n) - 3, 9 - k(n), 1)));
|
|
33
|
+
return [f(0), f(8), f(4), alpha];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const luminance = ([r, g, b]) => {
|
|
37
|
+
const channel = value => { value /= 255; return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4; };
|
|
38
|
+
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
|
39
|
+
};
|
|
40
|
+
const over = (top, bottom) => [0, 1, 2].map(index => top[index] * top[3] + bottom[index] * (1 - top[3])).concat(1);
|
|
41
|
+
/** WCAG 2 contrast ratio of a foreground over an opaque background. */
|
|
42
|
+
export function contrastRatio(foreground, background) {
|
|
43
|
+
const [a, b] = [luminance(over(foreground, background)), luminance(background)];
|
|
44
|
+
return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const textBackgrounds = ["--bg-canvas", "--bg-surface", "--bg-raised", "--bg-field", "--bg-hover"];
|
|
48
|
+
/** The roles that meet on screen. Text needs 4.5:1 (WCAG 1.4.3); focus indicators and the
|
|
49
|
+
* borders that identify controls need 3:1 (1.4.11). */
|
|
50
|
+
function contrastPairs(names) {
|
|
51
|
+
const pairs = [];
|
|
52
|
+
for (const text of ["--text-strong", "--text-body", "--text-muted", "--text-link", "--accent-text"]) for (const background of textBackgrounds) pairs.push([text, background, 4.5]);
|
|
53
|
+
pairs.push(["--accent-fg", "--accent", 4.5], ["--accent-fg", "--accent-hover", 4.5]);
|
|
54
|
+
for (const status of ["success", "warning", "danger", "info"]) pairs.push([`--${status}-fg`, `--${status}`, 4.5], [`--${status}-text`, `--${status}-bg`, 4.5]);
|
|
55
|
+
for (const ui of ["--border-focus", "--border-strong"]) for (const background of ["--bg-canvas", "--bg-surface"]) pairs.push([ui, background, 3]);
|
|
56
|
+
return pairs.filter(([foreground, background]) => names.has(foreground) && names.has(background));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function tokenContrastAdvisories(tokens, themes = defaultThemes) {
|
|
60
|
+
const byName = new Map(tokens.map(token => [token.name, token]));
|
|
61
|
+
const definition = (name, theme) => byName.has(name) ? themeDefinition(byName.get(name), theme) : undefined;
|
|
62
|
+
// A theme value follows var() references, each resolved in the same theme.
|
|
63
|
+
const resolve = (name, theme, seen = new Set()) => {
|
|
64
|
+
if (seen.has(name)) return null;
|
|
65
|
+
const value = definition(name, theme)?.value?.trim();
|
|
66
|
+
const reference = value?.match(/^var\(\s*(--[\w-]+)\s*(?:,[^)]*)?\)$/);
|
|
67
|
+
return reference ? resolve(reference[1], theme, new Set([...seen, name])) : value ?? null;
|
|
68
|
+
};
|
|
69
|
+
const advisories = [];
|
|
70
|
+
for (const { name: scope } of themes) {
|
|
71
|
+
for (const [foreground, background, minimum] of contrastPairs(new Set(byName.keys()))) {
|
|
72
|
+
const front = parseColor(resolve(foreground, scope) ?? ""), back = parseColor(resolve(background, scope) ?? "");
|
|
73
|
+
if (!front || !back) continue;
|
|
74
|
+
const ratio = contrastRatio(front, back[3] < 1 ? over(back, [255, 255, 255, 1]) : back);
|
|
75
|
+
if (ratio + 1e-9 >= minimum) continue;
|
|
76
|
+
const at = definition(foreground, scope);
|
|
77
|
+
if (!at) continue;
|
|
78
|
+
const { file, line, column } = at;
|
|
79
|
+
advisories.push({ rule: "token-contrast", severity: "warning", file, line, column, tokens: [foreground, background], guidanceUri: "ads://guides/tokens",
|
|
80
|
+
message: `${foreground} on ${background} is ${ratio.toFixed(2)}:1 in the ${scope} theme; ${minimum === 4.5 ? "text needs 4.5:1 (WCAG 1.4.3)" : "focus indicators and control borders need 3:1 (WCAG 1.4.11)"}.` });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return advisories;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Pixels of a px/rem/0 length, or null. */
|
|
87
|
+
const pixels = value => {
|
|
88
|
+
const match = value.trim().match(/^(-?\d*\.?\d+)(px|rem)?$/);
|
|
89
|
+
if (!match || (!match[2] && Number(match[1]) !== 0)) return null;
|
|
90
|
+
return Number(match[1]) * (match[2] === "rem" ? 16 : 1);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** Numbered spacing steps sit on the 2 px grid, --space-N at N × 2 px. */
|
|
94
|
+
export function tokenRhythmAdvisories(tokens) {
|
|
95
|
+
const advisories = [];
|
|
96
|
+
for (const token of tokens) {
|
|
97
|
+
const step = token.name.match(/^--space-(\d+)$/)?.[1];
|
|
98
|
+
if (step === undefined) continue;
|
|
99
|
+
for (const { file, line, column, value, scope } of token.definitions) {
|
|
100
|
+
const size = pixels(value);
|
|
101
|
+
if (size === null) continue;
|
|
102
|
+
const expected = Number(step) * 2;
|
|
103
|
+
if (size % 2 === 0 && size === expected) continue;
|
|
104
|
+
advisories.push({ rule: "token-rhythm", severity: "warning", file, line, column, tokens: [token.name], guidanceUri: "ads://guides/tokens",
|
|
105
|
+
message: `${token.name} is ${size}px${scope === ":root" ? "" : ` in ${scope}`}; the spacing scale is --space-N = N × 2 px (${expected}px), on a 2 px grid.` });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return advisories;
|
|
109
|
+
}
|
package/dist/tokens.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
|
+
import { tokenContrastAdvisories, tokenRhythmAdvisories } from "./token-quality.mjs";
|
|
3
|
+
import { a11yTokenAdvisories } from "./a11y.mjs";
|
|
4
|
+
import { scopeTheme, themeFindings } from "./themes.mjs";
|
|
2
5
|
import path from "node:path";
|
|
3
6
|
import postcss from "postcss";
|
|
4
7
|
import valueParser from "postcss-value-parser";
|
|
@@ -79,7 +82,7 @@ export function inspectTokens(directory, suppliedOptions) {
|
|
|
79
82
|
const scopes = new Map();
|
|
80
83
|
for (const [name, entries] of definitions) {
|
|
81
84
|
for (const entry of entries) {
|
|
82
|
-
if (entry.scope
|
|
85
|
+
if (scopeTheme(entry.scope)?.base) base.set(name, entry);
|
|
83
86
|
else {
|
|
84
87
|
if (!scopes.has(entry.scope)) scopes.set(entry.scope, new Map());
|
|
85
88
|
scopes.get(entry.scope).set(name, entry);
|
|
@@ -138,10 +141,14 @@ export function inspectTokens(directory, suppliedOptions) {
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
const tokens = [...definitions].sort(([a], [b]) => a.localeCompare(b)).map(([name, entries]) => ({ name, ...tokenContract.tokens[name], owner:"tokens", definitions: entries }));
|
|
144
|
+
const themes = themeFindings(tokens, config.themes, { dsDir: config.dsDir });
|
|
145
|
+
diagnostics.push(...themes.diagnostics);
|
|
141
146
|
return options.tokenInventory = {
|
|
142
147
|
contractVersion: tokenContract.version,
|
|
148
|
+
themes: config.themes,
|
|
143
149
|
tokens,
|
|
144
|
-
advisories: tokenOverlapAdvisories(tokens),
|
|
150
|
+
advisories: [...tokenOverlapAdvisories(tokens), ...tokenContrastAdvisories(tokens, config.themes), ...tokenRhythmAdvisories(tokens), ...themes.advisories,
|
|
151
|
+
...a11yTokenAdvisories(tokens, { root, foundationFile: path.join(dsRoot, config.tokenDir, "base.css") })],
|
|
145
152
|
diagnostics,
|
|
146
153
|
};
|
|
147
154
|
}
|
package/dist/units.mjs
CHANGED
|
@@ -154,14 +154,14 @@ export function inspectUnits(options) {
|
|
|
154
154
|
if(directory.includes("/")&&sameName(path.basename(file).split(".")[0])===sameName(path.posix.basename(directory))&&!flatFamilies.has(directory))directories.add(directory);
|
|
155
155
|
}
|
|
156
156
|
for (const file of files) {
|
|
157
|
-
if (!/^(?:components|patterns|controllers|composition|review)\//.test(file) || !source.test(file)) continue;
|
|
157
|
+
if (!/^(?:components|patterns|controllers|composition|review|brand)\//.test(file) || !source.test(file)) continue;
|
|
158
158
|
const directory = slash(path.dirname(file)), name = path.basename(file).replace(source, "");
|
|
159
159
|
if (!directory.includes("/") || adsFileRole(file) || /\.(?:scenario|fixture|scenario-adapter)$/.test(name)) continue;
|
|
160
160
|
if (flatFamilies.has(directory)) continue;
|
|
161
161
|
if (name === "index" || sameName(name) === sameName(path.posix.basename(directory)) || name === "fixture") directories.add(directory);
|
|
162
162
|
}
|
|
163
163
|
const directoryUnits = [...directories].sort((a, b) => b.length - a.length);
|
|
164
|
-
const flatUnits = [...new Set(files.filter(file => /^(?:components|patterns|controllers|composition|review)\//.test(file) && source.test(file) && !directoryUnits.some(directory => file.startsWith(directory + "/"))).map(file => {
|
|
164
|
+
const flatUnits = [...new Set(files.filter(file => /^(?:components|patterns|controllers|composition|review|brand)\//.test(file) && source.test(file) && !directoryUnits.some(directory => file.startsWith(directory + "/"))).map(file => {
|
|
165
165
|
const base = path.basename(file).split(".")[0];
|
|
166
166
|
return slash(path.join(path.dirname(file), base));
|
|
167
167
|
}))].sort((a, b) => b.length - a.length);
|
|
@@ -178,7 +178,7 @@ export function inspectUnits(options) {
|
|
|
178
178
|
if (relative.startsWith("assets/")) return relative.split("/").length > 2 ? relative.split("/").slice(0, 2).join("/") : "assets";
|
|
179
179
|
if (isProjectDocument(relative)) return "documentation";
|
|
180
180
|
if (!relative.includes("/")) return /(?:\.(?:md|txt)$|^LICENSE$)/i.test(relative) ? "documentation" : "foundation";
|
|
181
|
-
if (!/^(?:components|patterns|controllers|composition|review)\//.test(relative)) return relative.split("/")[0] === "documentation" ? null : relative.split("/")[0];
|
|
181
|
+
if (!/^(?:components|patterns|controllers|composition|review|brand)\//.test(relative)) return relative.split("/")[0] === "documentation" ? null : relative.split("/")[0];
|
|
182
182
|
for (const directory of directoryUnits) if (relative.startsWith(directory + "/")) return directory;
|
|
183
183
|
for (const unit of flatUnits) if (relative.startsWith(unit + "/") || relative.startsWith(unit + ".")) return unit;
|
|
184
184
|
const base = path.basename(relative).split(".")[0];
|
|
@@ -203,7 +203,7 @@ export function inspectUnits(options) {
|
|
|
203
203
|
if(contracts.length===1)unit.contractFile=contracts[0];
|
|
204
204
|
if (unit.id.startsWith("review/")) (unit.companionFiles ??= []).push({ path: slash(path.relative(root, path.join(dsRoot, reviewEntry))), allowedChanges: "Only this review owner's re-exports in the separate development entry; never the production public entry." });
|
|
205
205
|
(unit.companionFiles ??= []).push({ path: "ds.config.json", allowedChanges: "Only this owner's inlineStyleFiles and boundaries.styleWrites entries, together with its source change; preserve all other configuration and peer permissions." });
|
|
206
|
-
if (/^(?:components|patterns|controllers|composition|review)\//.test(unit.id)) {
|
|
206
|
+
if (/^(?:components|patterns|controllers|composition|review|brand)\//.test(unit.id)) {
|
|
207
207
|
for (let directory = unit.id; directory !== "."; directory = path.posix.dirname(directory)) {
|
|
208
208
|
const marker = path.join(dsRoot, directory, ".gitkeep");
|
|
209
209
|
if (existsSync(marker) && readFileSync(marker).length === 0) (unit.companionFiles ??= []).push({ path: slash(path.relative(root, marker)), allowedChanges: "Delete this empty placeholder only while adding real source in the selected owner below it." });
|
|
@@ -217,7 +217,7 @@ export function inspectUnits(options) {
|
|
|
217
217
|
function boundaryCompanion(unit) { return !["configuration", "documentation", "assets"].includes(unit.split("/")[0]); }
|
|
218
218
|
|
|
219
219
|
export function validateUnitId(unit) {
|
|
220
|
-
if (typeof unit !== "string" || unit.length > 256 || !/^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/.test(unit) || ["components", "patterns", "controllers", "composition", "review"].includes(unit)) throw fail("Select one ADS unit ID from ads_units or an unoccupied owner path following its colocation convention.");
|
|
220
|
+
if (typeof unit !== "string" || unit.length > 256 || !/^[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/.test(unit) || ["components", "patterns", "controllers", "composition", "review", "brand"].includes(unit)) throw fail("Select one ADS unit ID from ads_units or an unoccupied owner path following its colocation convention.");
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/** Reject arbitrary file batches, even when every path is inside the ADS. */
|
|
@@ -227,7 +227,7 @@ export function checkUnitFiles(options, unit, changes, inventory = inspectUnits(
|
|
|
227
227
|
const relative = inventory.relative(change.path);
|
|
228
228
|
if (path.posix.basename(relative) === ".gitkeep") {
|
|
229
229
|
const directory = path.posix.dirname(relative);
|
|
230
|
-
if (change.originalContent !== "" || change.content !== null || !/^(?:components|patterns|controllers|composition|review)\//.test(relative)
|
|
230
|
+
if (change.originalContent !== "" || change.content !== null || !/^(?:components|patterns|controllers|composition|review|brand)\//.test(relative)
|
|
231
231
|
|| !(unit === directory || unit.startsWith(directory + "/"))
|
|
232
232
|
|| !changes.some(item => item.originalContent === null && item.content !== null && source.test(item.path)
|
|
233
233
|
&& (inventory.relative(item.path).startsWith(unit + "/") || inventory.relative(item.path).startsWith(unit + ".")))) throw fail("Only delete an existing empty .gitkeep while adding source in the selected owner beneath it. Other hidden-file changes are not allowed.", change.path);
|
package/dist/validation.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import { inspectBuildStatus } from "./mcp/build-status.mjs";
|
|
|
16
16
|
const hash = value => createHash("sha256").update(value).digest("hex");
|
|
17
17
|
function toolInputs() {
|
|
18
18
|
const root=path.dirname(fileURLToPath(import.meta.url)),rows=[];
|
|
19
|
-
function visit(directory){for(const entry of readdirSync(directory,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name))){const file=path.join(directory,entry.name);if(entry.isDirectory()&&!["skills","
|
|
19
|
+
function visit(directory){for(const entry of readdirSync(directory,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name))){const file=path.join(directory,entry.name);if(entry.isDirectory()&&!["skills","starters","showcase"].includes(entry.name))visit(file);else if(entry.isFile()&&/\.(?:mjs|js|cjs|json)$/.test(file))rows.push([path.relative(root,file),hash(readFileSync(file))]);}}
|
|
20
20
|
visit(root);return rows;
|
|
21
21
|
}
|
|
22
22
|
const toolRevision = hash(JSON.stringify([toolInputs(),process.versions.bun??process.version,process.platform,process.arch]));
|