@skdx/tokens 0.32.0 → 0.34.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.
@@ -1,10 +1,11 @@
1
- "use strict";var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var l=(o,e)=>{for(var s in e)i(o,s,{get:e[s],enumerable:!0})},C=(o,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of f(e))!T.call(o,t)&&t!==s&&i(o,t,{get:()=>e[t],enumerable:!(n=u(e,t))||n.enumerable});return o};var h=o=>C(i({},"__esModule",{value:!0}),o);var V={};l(V,{applyTheme:()=>x,themeToCss:()=>y,themeToCssVars:()=>a});module.exports=h(V);var r=require("./cssVars.cjs"),m=require("./theme.cjs");function a(o){return(0,r.sectionsToCssVars)([["color",o.colors],["shadow",o.shadow],["font",o.typography],["motion",o.motion?{...m.defaultMotion,...o.motion}:void 0]])}function y(o,e={}){let s=e.selector??`[data-skdx-theme="${o.name}"]`,n=a(o),t=`${s} {
2
- ${(0,r.varsToDeclarations)(n)}
1
+ "use strict";var i=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var y=(o,e)=>{for(var s in e)i(o,s,{get:e[s],enumerable:!0})},h=(o,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of C(e))!$.call(o,t)&&t!==s&&i(o,t,{get:()=>e[t],enumerable:!(n=T(e,t))||n.enumerable});return o};var x=o=>h(i({},"__esModule",{value:!0}),o);var g={};y(g,{applyTheme:()=>k,themeToCss:()=>V,themeToCssVars:()=>c});module.exports=x(g);var p=require("./aliases.cjs"),r=require("./cssVars.cjs"),u=require("./theme.cjs");function c(o){return(0,r.sectionsToCssVars)([["color",o.colors],["shadow",o.shadow],["font",o.typography],["motion",o.motion?{...u.defaultMotion,...o.motion}:void 0]])}function V(o,e={}){let s=e.selector??`[data-skdx-theme="${o.name}"]`,n=c(o),t=o.mode==="dark"?p.darkColorAliases.map(([a,l])=>`
2
+ ${a}: ${l};`):[],m=`${s} {
3
+ ${(0,r.varsToDeclarations)(n)}${t.join("")}
3
4
  }
4
- `,c=(0,r.reducedMotionVarNames)(n);if(c.length===0)return t;let d=c.map(p=>` ${p}: 0ms;`);return t+`@media (prefers-reduced-motion: reduce) {
5
+ `,d=(0,r.reducedMotionVarNames)(n);if(d.length===0)return m;let f=d.map(a=>` ${a}: 0ms;`);return m+`@media (prefers-reduced-motion: reduce) {
5
6
  ${s} {
6
- ${d.join(`
7
+ ${f.join(`
7
8
  `)}
8
9
  }
9
10
  }
10
- `}function x(o,e=document.documentElement){let s=a(o);for(let[n,t]of Object.entries(s))e.style.setProperty(n,t);e.setAttribute("data-skdx-theme",o.name),e.setAttribute("data-skdx-mode",o.mode)}0&&(module.exports={applyTheme,themeToCss,themeToCssVars});
11
+ `}function k(o,e=document.documentElement){let s=c(o);for(let[n,t]of Object.entries(s))e.style.setProperty(n,t);e.setAttribute("data-skdx-theme",o.name),e.setAttribute("data-skdx-mode",o.mode)}0&&(module.exports={applyTheme,themeToCss,themeToCssVars});
@@ -21,7 +21,8 @@ export interface ThemeToCssOptions {
21
21
  }
22
22
  /**
23
23
  * Render {@link Theme} as CSS rule block (build-time counterpart to {@link applyTheme}).
24
- * Colors only; `foundationToCss()` required for complete stylesheet. Emits
24
+ * Colors only; `foundationToCss()` required for complete stylesheet. A dark theme's
25
+ * block also carries {@link darkColorAliases}, so its aliases stay legible under any selector. Emits
25
26
  * `@media (prefers-reduced-motion: reduce)` if theme retunes motion (re-declares
26
27
  * as `0ms` to preserve WCAG 2.3.3 guarantee across higher specificity).
27
28
  *
@@ -21,7 +21,8 @@ export interface ThemeToCssOptions {
21
21
  }
22
22
  /**
23
23
  * Render {@link Theme} as CSS rule block (build-time counterpart to {@link applyTheme}).
24
- * Colors only; `foundationToCss()` required for complete stylesheet. Emits
24
+ * Colors only; `foundationToCss()` required for complete stylesheet. A dark theme's
25
+ * block also carries {@link darkColorAliases}, so its aliases stay legible under any selector. Emits
25
26
  * `@media (prefers-reduced-motion: reduce)` if theme retunes motion (re-declares
26
27
  * as `0ms` to preserve WCAG 2.3.3 guarantee across higher specificity).
27
28
  *
@@ -1,10 +1,11 @@
1
- import{reducedMotionVarNames as m,sectionsToCssVars as d,varsToDeclarations as p}from"./cssVars.js";import{defaultMotion as u}from"./theme.js";function i(o){return d([["color",o.colors],["shadow",o.shadow],["font",o.typography],["motion",o.motion?{...u,...o.motion}:void 0]])}function l(o,e={}){let t=e.selector??`[data-skdx-theme="${o.name}"]`,s=i(o),n=`${t} {
2
- ${p(s)}
1
+ import{darkColorAliases as p}from"./aliases.js";import{reducedMotionVarNames as u,sectionsToCssVars as f,varsToDeclarations as l}from"./cssVars.js";import{defaultMotion as T}from"./theme.js";function c(o){return f([["color",o.colors],["shadow",o.shadow],["font",o.typography],["motion",o.motion?{...T,...o.motion}:void 0]])}function h(o,e={}){let s=e.selector??`[data-skdx-theme="${o.name}"]`,t=c(o),n=o.mode==="dark"?p.map(([r,d])=>`
2
+ ${r}: ${d};`):[],a=`${s} {
3
+ ${l(t)}${n.join("")}
3
4
  }
4
- `,r=m(s);if(r.length===0)return n;let a=r.map(c=>` ${c}: 0ms;`);return n+`@media (prefers-reduced-motion: reduce) {
5
- ${t} {
6
- ${a.join(`
5
+ `,i=u(t);if(i.length===0)return a;let m=i.map(r=>` ${r}: 0ms;`);return a+`@media (prefers-reduced-motion: reduce) {
6
+ ${s} {
7
+ ${m.join(`
7
8
  `)}
8
9
  }
9
10
  }
10
- `}function C(o,e=document.documentElement){let t=i(o);for(let[s,n]of Object.entries(t))e.style.setProperty(s,n);e.setAttribute("data-skdx-theme",o.name),e.setAttribute("data-skdx-mode",o.mode)}export{C as applyTheme,l as themeToCss,i as themeToCssVars};
11
+ `}function x(o,e=document.documentElement){let s=c(o);for(let[t,n]of Object.entries(s))e.style.setProperty(t,n);e.setAttribute("data-skdx-theme",o.name),e.setAttribute("data-skdx-mode",o.mode)}export{x as applyTheme,h as themeToCss,c as themeToCssVars};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@skdx/tokens",
3
- "version": "0.32.0",
3
+ "version": "0.34.0",
4
4
  "description": "Theme contract and design tokens for the SkandaDX design system",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
- "homepage": "https://github.com/SkandaDX/ui.skdx/tree/main/packages/tokens#readme",
9
+ "homepage": "https://github.com/SkandaDX/ui.skdx/tree/main/packages/core/tokens#readme",
10
10
  "repository": {
11
- "directory": "packages/tokens",
11
+ "directory": "packages/core/tokens",
12
12
  "type": "git",
13
13
  "url": "git+https://github.com/SkandaDX/ui.skdx.git"
14
14
  },
@@ -62,7 +62,7 @@
62
62
  },
63
63
  "scripts": {
64
64
  "lint": "eslint . --cache --cache-location node_modules/.cache/eslint/",
65
- "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsup && tsc --emitDeclarationOnly -p tsconfig.build.json && node ../../scripts/declarations-cjs.mjs && node scripts/build-css.mjs && node scripts/build-dtcg.mjs && node ../../scripts/minify-css.mjs dist",
65
+ "build": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\" && tsup && tsc --emitDeclarationOnly -p tsconfig.build.json && node ../../../scripts/declarations-cjs.mjs && node scripts/build-css.mjs && node scripts/build-dtcg.mjs && node ../../../scripts/minify-css.mjs dist",
66
66
  "typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo",
67
67
  "test": "vitest run",
68
68
  "test:watch": "vitest",