@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.
- package/README.md +1 -1
- package/dist/foundation.css +1 -1
- package/dist/themes.css +1 -1
- package/dist/tokens.css +1 -1
- package/dist/utils/toCss.cjs +6 -5
- package/dist/utils/toCss.d.cts +2 -1
- package/dist/utils/toCss.d.ts +2 -1
- package/dist/utils/toCss.js +7 -6
- package/package.json +4 -4
package/dist/utils/toCss.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
"use strict";var i=Object.defineProperty;var
|
|
2
|
-
${
|
|
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
|
-
`,
|
|
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
|
-
${
|
|
7
|
+
${f.join(`
|
|
7
8
|
`)}
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
`}function
|
|
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});
|
package/dist/utils/toCss.d.cts
CHANGED
|
@@ -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.
|
|
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
|
*
|
package/dist/utils/toCss.d.ts
CHANGED
|
@@ -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.
|
|
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
|
*
|
package/dist/utils/toCss.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import{reducedMotionVarNames as
|
|
2
|
-
${
|
|
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
|
-
`,
|
|
5
|
-
${
|
|
6
|
-
${
|
|
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
|
|
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.
|
|
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
|
|
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",
|