@webority/theme 0.95.0 → 0.98.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 CHANGED
@@ -129,36 +129,20 @@ The full `wui-components` chain stays the default and renders as before. Each on
129
129
  Caution: an on-demand partial loaded after the core sheet comes after the shared focus ring and pressed
130
130
  wash (`wui/interaction`, `wui/menu-motion`), so check its hover and press states in the showcase.
131
131
 
132
- ## Signal brand layer (opt-in)
133
-
134
- `dist/webority-brand-signal.css` (export `@webority/theme/css/brand-signal`, source `scss/_brand-signal.scss`)
135
- re-points the theme to the Webority company palette: violet #4A0FBF primary, ink #16093A headings, tint
136
- #F1EBFF, pink #B517C8 for unread counts only, muted text #6A6A6A, a dark set on pure black #000 with neutral
137
- grey surfaces and violet #A98BFF kept for accents, and the Webority Serif 600 face for page and result titles at 24px and above. It is never imported by
138
- the default theme (check-theme-exports asserts the default dist has no #4A0FBF).
139
-
140
- Load it once, after the theme: React `import "@webority/theme/css/brand-signal"`; Razor
141
- `_content/Webority.Ui.Razor/css/webority-brand-signal.css`; SCSS `@import "@webority/theme/scss/brand-signal"`
142
- after the components. Dark mode is emitted under `[data-theme=dark]`, `[data-bs-theme=dark]` and the
143
- `data-theme=auto` media query. Contrast of every brand text and surface pair is held at 4.5:1 by check-contrast.
144
- `_brand-signal.scss` owns brand values only; no component CSS.
145
-
146
132
  ## Runtime brand from a product's token file (opt-in)
147
133
 
148
134
  A product's look can be applied to the precompiled theme at runtime, which is how the hosted showcase shows
149
135
  every component in a product's design language.
150
136
 
151
- - `webority-theme-export <compiled.css>... --product <name> --out tokens.json` (a bin of this package) writes
152
- the token file, format `webority-theme-tokens/1`: `{ format, product, light, dark, bootstrapDark }`, each a
153
- map of custom property to value. It reads the product's compiled CSS, not its SCSS, because Bootstrap's rgb
154
- triplets and subtle and emphasis mixes only exist after compilation. `light` is the top-level `:root`,
155
- `dark` the theme's `:root[data-theme=dark]` rule, `bootstrapDark` Bootstrap's `[data-bs-theme=dark]` rule.
137
+ - `webority brand` (the `webority` command of `@webority/tokens`) writes a product's token file, `webority-web.json`,
138
+ format `webority-theme-tokens/2`: `{ format, source, colors: { light, dark }, space, radius, text, fonts, shadow }`.
156
139
  - `dist/webority-runtime-brand.css` (export `@webority/theme/css/runtime-brand`, source
157
140
  `scss/_runtime-brand.scss`) re-points the few component rules Bootstrap compiles from `$primary` as literals
158
141
  (primary buttons, nav pills, pagination, list group, progress, range thumb, mouse focus border, `.link-primary`
159
142
  hover, `.table-primary`) at `--bs-primary`. It holds no colour of its own (check-theme-exports asserts it).
160
- - Load order: the theme, then the runtime brand layer, then the token file's values on `:root`, under the dark
161
- selectors for `dark`, and under `[data-bs-theme=dark]` for `bootstrapDark`.
143
+ - Load order: the theme, then the runtime brand layer, then the token file's values: light on `:root`, dark under
144
+ `:root[data-theme=dark]` and `:root[data-bs-theme=dark]`, and the Bootstrap primary and link triplets under
145
+ `[data-bs-theme=dark]`.
162
146
  - Each product serves its file at `/theme/tokens.json` with `Access-Control-Allow-Origin` for the showcase host.
163
147
  - A font the token file names renders only when the page has its face: the theme's own families do.
164
148
 
@@ -167,10 +151,12 @@ every component in a product's design language.
167
151
  The classes `wui-force-hover`, `wui-force-focus` and `wui-force-active` make an element show its hover, focus or
168
152
  pressed look without a pointer.
169
153
 
170
- They exist in the compiled stylesheets, `@webority/theme/css` and `@webority/theme/css/brand-signal`, not in a
154
+ They exist in the compiled stylesheet `@webority/theme/css`, not in a
171
155
  product's own SCSS build. A product that builds the theme SCSS itself adds `forcedStatesPlugin()`, imported from
172
156
  `@webority/theme/postcss/forced-states`, to its PostCSS plugins to get the same classes.
173
157
 
158
+ Code that sets the classes imports their names from `@webority/theme/runtime` as `FORCED_STATE_CLASSES` (`hover`, `focus`, `active`). The export has no dependencies, so it runs in a browser bundle or in Node.
159
+
174
160
  A class forces only the element that carries it, so a design tool sets it on a part's root and on its first
175
161
  focusable child. The purge safelist keeps these three classes.
176
162
 
@@ -1 +1 @@
1
- import e from"postcss";import t from"postcss-selector-parser";var n=Object.freeze({hover:`wui-force-hover`,focus:`wui-force-focus`,active:`wui-force-active`}),r=new Map([[`:hover`,n.hover],[`:focus`,n.focus],[`:focus-visible`,n.focus],[`:focus-within`,n.focus],[`:active`,n.active]]),i=new Set(Object.values(n)),a=t();function o(e){for(let t=e.parent;t;t=t.parent)if(t.type===`atrule`&&/keyframes$/i.test(t.name))return!0;return!1}function s(e,t){let n=e.parent?.parent;return n?.type!==`pseudo`||n.value.toLowerCase()!==`:is`?!1:n.nodes.some(e=>e.nodes.some(e=>e.type===`class`&&e.value===t))}function c(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 l(e){let n=[];e.walkPseudos(e=>{let t=r.get(e.value.toLowerCase());t&&!s(e,t)&&!c(e)&&n.push({pseudo:e,cls:t})});for(let{pseudo:e,cls:r}of n){let n=t.selector({value:``});n.append(e.clone());let i=t.selector({value:``});i.append(t.className({value:r}));let a=t.pseudo({value:`:is`});a.append(n),a.append(i),e.replaceWith(a)}return n.length}function u(e){let t=!1;return e.walkClasses(e=>{t||=i.has(e.value)}),t}function d(e){let t=0,n=0;return e.walkRules(e=>{if(o(e))return;let r=a.astSync(e.selector),i=!1;for(let e of r.nodes)l(e)>0&&(t++,i=!0),u(e)&&n++;i&&(e.selector=r.toString())}),{rewritten:t,carrying:n}}function f(t){let n=e.parse(t);return d(n),n.toString()}function p(){return{postcssPlugin:`wui-forced-states`,OnceExit(e){d(e)}}}p.postcss=!0;export{n as FORCED_STATE_CLASSES,f as addForcedStates,p as forcedStatesPlugin,d as rewriteRoot};
1
+ import{FORCED_STATE_CLASSES as e}from"../runtime.mjs";import t from"postcss";import n from"postcss-selector-parser";var r=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.type===`atrule`&&/keyframes$/i.test(t.name))return!0;return!1}function s(e,t){let n=e.parent?.parent;return n?.type!==`pseudo`||n.value.toLowerCase()!==`:is`?!1:n.nodes.some(e=>e.nodes.some(e=>e.type===`class`&&e.value===t))}function c(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 l(e){let t=[];e.walkPseudos(e=>{let n=r.get(e.value.toLowerCase());n&&!s(e,n)&&!c(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 u(e){let t=!1;return e.walkClasses(e=>{t||=i.has(e.value)}),t}function d(e){let t=0,n=0;return e.walkRules(e=>{if(o(e))return;let r=a.astSync(e.selector),i=!1;for(let e of r.nodes)l(e)>0&&(t++,i=!0),u(e)&&n++;i&&(e.selector=r.toString())}),{rewritten:t,carrying:n}}function f(e){let n=t.parse(e);return d(n),n.toString()}function p(){return{postcssPlugin:`wui-forced-states`,OnceExit(e){d(e)}}}p.postcss=!0;export{f as addForcedStates,p as forcedStatesPlugin,d as rewriteRoot};
@@ -85,7 +85,7 @@
85
85
  "dark": "#2a2f3a"
86
86
  },
87
87
  "chart-label": {
88
- "light": "#687088",
88
+ "light": "#626A82",
89
89
  "dark": "#8a90a0"
90
90
  },
91
91
  "chart-neutral": {
@@ -169,8 +169,8 @@
169
169
  "dark": "#4B5675"
170
170
  },
171
171
  "fg-4": {
172
- "light": "#687088",
173
- "dark": "#687088"
172
+ "light": "#626A82",
173
+ "dark": "#626A82"
174
174
  },
175
175
  "fg-5": {
176
176
  "light": "#C4CADA",
@@ -361,8 +361,8 @@
361
361
  "dark": "#4B5675"
362
362
  },
363
363
  "text-3": {
364
- "light": "#687088",
365
- "dark": "#687088"
364
+ "light": "#626A82",
365
+ "dark": "#626A82"
366
366
  },
367
367
  "text-4": {
368
368
  "light": "#99A1B7",
@@ -1438,6 +1438,7 @@
1438
1438
  "wui-struct-card-no-check",
1439
1439
  "wui-struct-card-sm",
1440
1440
  "wui-struct-card-stacked",
1441
+ "wui-tab-label",
1441
1442
  "wui-tabbar",
1442
1443
  "wui-tabbar-badge",
1443
1444
  "wui-tabbar-icon",
@@ -0,0 +1 @@
1
+ var e=Object.freeze({hover:`wui-force-hover`,focus:`wui-force-focus`,active:`wui-force-active`});export{e as FORCED_STATE_CLASSES};