@webority/theme 0.148.0 → 0.150.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/css-import.d.ts +2 -0
- package/dist/postcss/forced-states.d.mts +11 -0
- package/dist/postcss/forced-states.mjs +1 -1
- package/dist/purge-safelist.json +4 -1
- package/dist/runtime/index.d.mts +6 -0
- package/dist/runtime/productTheme.d.mts +25 -0
- package/dist/runtime.mjs +2 -2
- package/dist/webority-theme.css +1 -1
- package/package.json +33 -11
- package/scss/_bootstrap.generated.scss +1 -1
- package/scss/_components.scss +1 -0
- package/scss/_tokens.generated.scss +1 -1
- package/scss/wui/_chart-card.scss +33 -1
- package/scss/wui/_controls.scss +4 -0
- package/scss/wui/_display.scss +24 -3
- package/scss/wui/_support.scss +1 -1
package/css-import.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Plugin, type Root } from "postcss";
|
|
2
|
+
export declare function rewriteRoot(root: Root): {
|
|
3
|
+
rewritten: number;
|
|
4
|
+
carrying: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function addForcedStates(css: string): string;
|
|
7
|
+
export declare function forcedStatesPlugin(): Plugin;
|
|
8
|
+
export declare namespace forcedStatesPlugin {
|
|
9
|
+
var _a: boolean;
|
|
10
|
+
export { _a as postcss };
|
|
11
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FORCED_STATE_CLASSES as e}from"../runtime.mjs";import t from"postcss";import n from"postcss-selector-parser";var r=/* @__PURE__ */ new Map([[`:hover`,e.hover],[`:focus`,e.focus],[`:focus-visible`,e.focus],[`:focus-within`,e.focus],[`:active`,e.active]]),i=new Set(Object.values(e)),a=n();function o(e){for(let t=e.parent;t;t=t.parent)if(t
|
|
1
|
+
import{FORCED_STATE_CLASSES as e}from"../runtime.mjs";import t from"postcss";import n from"postcss-selector-parser";var r=/* @__PURE__ */ new Map([[`:hover`,e.hover],[`:focus`,e.focus],[`:focus-visible`,e.focus],[`:focus-within`,e.focus],[`:active`,e.active]]),i=new Set(Object.values(e)),a=n();function o(e){return e.type===`atrule`}function s(e){for(let t=e.parent;t;t=t.parent)if(o(t)&&/keyframes$/i.test(t.name))return!0;return!1}function c(e,t){let n=e.parent?.parent;return n?.type!==`pseudo`||n.value.toLowerCase()!==`:is`?!1:n.nodes.some(e=>e.type===`selector`&&e.nodes.some(e=>e.type===`class`&&e.value===t))}function l(e){for(let t=e.prev();t&&t.type!==`combinator`;t=t.prev())if(t.type===`pseudo`&&t.value.startsWith(`::`))return!0;return!1}function u(e){let t=[];e.walkPseudos(e=>{let n=r.get(e.value.toLowerCase());n&&!c(e,n)&&!l(e)&&t.push({pseudo:e,cls:n})});for(let{pseudo:e,cls:r}of t){let t=n.selector({value:``});t.append(e.clone());let i=n.selector({value:``});i.append(n.className({value:r}));let a=n.pseudo({value:`:is`});a.append(t),a.append(i),e.replaceWith(a)}return t.length}function d(e){let t=!1;return e.walkClasses(e=>{t||=i.has(e.value)}),t}function f(e){let t=0,n=0;return e.walkRules(e=>{if(s(e))return;let r=a.astSync(e.selector),i=!1;for(let e of r.nodes)u(e)>0&&(t++,i=!0),d(e)&&n++;i&&(e.selector=r.toString())}),{rewritten:t,carrying:n}}function p(e){let n=t.parse(e);return f(n),n.toString()}function m(){return{postcssPlugin:`wui-forced-states`,OnceExit(e){f(e)}}}m.postcss=!0;export{p as addForcedStates,m as forcedStatesPlugin,f as rewriteRoot};
|
package/dist/purge-safelist.json
CHANGED
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
"badge",
|
|
102
102
|
"badge-dot",
|
|
103
103
|
"bg-light",
|
|
104
|
-
"bg-primary",
|
|
105
104
|
"blockquote",
|
|
106
105
|
"border",
|
|
107
106
|
"border-bottom",
|
|
@@ -549,6 +548,7 @@
|
|
|
549
548
|
"slider-track",
|
|
550
549
|
"slider-value",
|
|
551
550
|
"small",
|
|
551
|
+
"sort-icon",
|
|
552
552
|
"sortable",
|
|
553
553
|
"spinner-border",
|
|
554
554
|
"spinner-border-sm",
|
|
@@ -745,6 +745,7 @@
|
|
|
745
745
|
"wui-bell-title",
|
|
746
746
|
"wui-bell-trigger",
|
|
747
747
|
"wui-bell-when",
|
|
748
|
+
"wui-bordered",
|
|
748
749
|
"wui-brand-dark",
|
|
749
750
|
"wui-brand-has-mark",
|
|
750
751
|
"wui-brand-light",
|
|
@@ -995,6 +996,7 @@
|
|
|
995
996
|
"wui-error-summary-list",
|
|
996
997
|
"wui-error-summary-title",
|
|
997
998
|
"wui-expand-cell",
|
|
999
|
+
"wui-expand-toggle",
|
|
998
1000
|
"wui-field-busy",
|
|
999
1001
|
"wui-field-message",
|
|
1000
1002
|
"wui-file-busy",
|
|
@@ -1705,6 +1707,7 @@
|
|
|
1705
1707
|
"^card-pad-",
|
|
1706
1708
|
"^col-",
|
|
1707
1709
|
"^color-field-",
|
|
1710
|
+
"^column-",
|
|
1708
1711
|
"^descs-",
|
|
1709
1712
|
"^descs-col-",
|
|
1710
1713
|
"^dropdown-",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type Mode = "light" | "dark";
|
|
2
|
+
type Declarations = Record<string, unknown>;
|
|
3
|
+
export type TokenFile = {
|
|
4
|
+
format?: string;
|
|
5
|
+
source?: {
|
|
6
|
+
brand?: string;
|
|
7
|
+
};
|
|
8
|
+
colors?: Partial<Record<Mode, Declarations>>;
|
|
9
|
+
space?: Declarations;
|
|
10
|
+
radius?: Declarations;
|
|
11
|
+
text?: Record<string, {
|
|
12
|
+
size: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
fonts?: Record<string, {
|
|
15
|
+
family: string;
|
|
16
|
+
fallback: string;
|
|
17
|
+
}>;
|
|
18
|
+
shadow?: Declarations;
|
|
19
|
+
};
|
|
20
|
+
export declare function parseTokenFile(value: unknown): TokenFile;
|
|
21
|
+
/** Validates a parsed token file and returns the stylesheet text that applies it. */
|
|
22
|
+
export declare function productThemeCss(file: TokenFile | null | undefined): string;
|
|
23
|
+
/** Applies a token file (already parsed) to the page and returns its product name. */
|
|
24
|
+
export declare function applyProductTheme(file: TokenFile): string;
|
|
25
|
+
export {};
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e={palette:`--wui-`,color:`--color-`,effect:`--wui-`,space:`--wui-space-`,radius:`--wui-radius-`,text:`--wui-fs-`,weight:`--wui-fw-`,leading:`--wui-lh-`,"letter-spacing":`--wui-letter-spacing-`,font:`--wui-font-`,shadow:`--wui-shadow-`,motion:`--wui-`,section:`--wui-section-`,size:`--wui-`,z:`--wui-z-`,component:`--wui-`};function t(t,n){let r=e[t];if(r===void 0)throw Error(`webority-tokens: ${t} is not a token group; add it to PREFIX in names.
|
|
2
|
-
`)}function
|
|
1
|
+
var e={palette:`--wui-`,color:`--color-`,effect:`--wui-`,space:`--wui-space-`,radius:`--wui-radius-`,text:`--wui-fs-`,weight:`--wui-fw-`,leading:`--wui-lh-`,"letter-spacing":`--wui-letter-spacing-`,font:`--wui-font-`,shadow:`--wui-shadow-`,motion:`--wui-`,section:`--wui-section-`,size:`--wui-`,z:`--wui-z-`,component:`--wui-`};function t(t,n){let r=e[t];if(r===void 0)throw Error(`webority-tokens: ${t} is not a token group; add it to PREFIX in names.ts.`);return`${r}${n}`}var n=`webority-theme-tokens/2`,r=`wui-product-theme`,i=/^--[A-Za-z0-9_-]+$/,a=/[;{}<>\\]|url\s*\(|@import|expression\s*\(/i,o=500;function s(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function c(){return/* @__PURE__ */ Error(`it is not a ${n} file`)}function l(e){if(!s(e))throw c();return{...e}}function u(e){if(!s(e))throw c();if(e.brand===void 0)return{};if(typeof e.brand!=`string`)throw c();return{brand:e.brand}}function d(e){if(!s(e))throw c();let t={};return e.light!==void 0&&(t.light=l(e.light)),e.dark!==void 0&&(t.dark=l(e.dark)),t}function f(e){if(!s(e))throw c();let t={};for(let[n,r]of Object.entries(e)){if(!s(r)||!(`size`in r))throw c();t[n]={size:r.size}}return t}function p(e){if(!s(e))throw c();let t={};for(let[n,r]of Object.entries(e)){if(!s(r)||typeof r.family!=`string`||typeof r.fallback!=`string`)throw c();t[n]={family:r.family,fallback:r.fallback}}return t}function m(e){if(!s(e)||e.format!==n)throw c();let t={format:n};return e.source!==void 0&&(t.source=u(e.source)),e.colors!==void 0&&(t.colors=d(e.colors)),e.space!==void 0&&(t.space=l(e.space)),e.radius!==void 0&&(t.radius=l(e.radius)),e.text!==void 0&&(t.text=f(e.text)),e.fonts!==void 0&&(t.fonts=p(e.fonts)),e.shadow!==void 0&&(t.shadow=l(e.shadow)),t}function h(e,t){let n=Object.entries(t).map(([e,t])=>`${e}: ${t};`).join(``);return n?`${e}{${n}}`:``}function g(e,t){if(typeof e!=`object`||Array.isArray(e))throw Error(`its "${t}" section is not a list of values`);for(let[t,n]of Object.entries(e)){if(!i.test(t))throw Error(`"${t}" is not a CSS custom property`);if(typeof n!=`string`||n.length>o||a.test(n))throw Error(`the value of ${t} is not allowed`)}return e}function _(e,t){if(typeof e!=`string`||!/^#[0-9a-fA-F]{6}$/.test(e))throw Error(`the ${t} colour is not a 6-digit hex value`);return[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)).join(`, `)}function v(e,t){let n=e[t]??{};if(typeof n!=`object`||Array.isArray(n))throw Error(`its "${t}" section is not a list of values`);return Object.entries(n)}function y(e,n){let r={};for(let[i,a]of v(e.colors??{},n))r[t(`color`,i)]=a;if(n!==`light`)return r;for(let[n,i]of v(e,`space`))r[t(`space`,n)]=`${i}px`;for(let[n,i]of Object.entries(e.radius??{}))r[t(`radius`,n)]=`${i}px`;for(let[n,i]of Object.entries(e.text??{}))r[t(`text`,n)]=`${i.size}px`;for(let[n,i]of Object.entries(e.fonts??{})){if(typeof i.fallback!=`string`)throw Error(`the font "${n}" has no fallback`);r[t(`font`,n)]=`${i.family.includes(` `)?`"${i.family}"`:i.family}, ${i.fallback}`}for(let[n,i]of Object.entries(e.shadow??{}))r[t(`shadow`,n)]=i;return r}function b(e,t){let n=e.colors?.[t]?.primary,r=e.colors?.[t]?.link;if(!n)throw Error(`it has no primary colour`);if(!r)throw Error(`it has no link colour`);return{"--bs-primary":n,"--bs-primary-rgb":_(n,`primary`),"--bs-link-color-rgb":_(r,`link`)}}function x(e){if(!e||e.format!==n)throw Error(`it is not a ${n} file`);let t=g({...y(e,`light`),...b(e,`light`)},`light`),r=g(y(e,`dark`),`dark`),i=g(b(e,`dark`),`dark`);return[h(`:root`,t),h(`:root[data-theme="dark"],:root[data-bs-theme="dark"]`,r),h(`[data-bs-theme="dark"]`,i)].join(`
|
|
2
|
+
`)}function S(e){let t=x(e),n=document.getElementById(r);return n||(n=document.createElement(`style`),n.id=r,document.head.appendChild(n)),n.textContent=t,document.documentElement.setAttribute(`data-product-theme`,e.source?.brand??`file`),e.source?.brand??`file`}var C=Object.freeze({hover:`wui-force-hover`,focus:`wui-force-focus`,active:`wui-force-active`});export{C as FORCED_STATE_CLASSES,S as applyProductTheme,m as parseTokenFile,x as productThemeCss};
|