@webority/theme 0.83.2 → 0.83.3
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 +2 -3
- package/dist/postcss/forced-states.mjs +1 -0
- package/dist/purge-safelist.json +1 -0
- package/dist/webority-theme.css +1 -1
- package/package.json +7 -2
- package/scss/wui/_shell-parts.scss +10 -0
- package/scss/wui/_shell.scss +19 -0
package/README.md
CHANGED
|
@@ -168,9 +168,8 @@ The classes `wui-force-hover`, `wui-force-focus` and `wui-force-active` make an
|
|
|
168
168
|
pressed look without a pointer.
|
|
169
169
|
|
|
170
170
|
They exist in the compiled stylesheets, `@webority/theme/css` and `@webority/theme/css/brand-signal`, not in a
|
|
171
|
-
product's own SCSS build. A product that
|
|
172
|
-
|
|
173
|
-
published package yet, so products use the compiled stylesheets.
|
|
171
|
+
product's own SCSS build. A product that builds the theme SCSS itself adds `forcedStatesPlugin()`, imported from
|
|
172
|
+
`@webority/theme/postcss/forced-states`, to its PostCSS plugins to get the same classes.
|
|
174
173
|
|
|
175
174
|
A class forces only the element that carries it, so a design tool sets it on a part's root and on its first
|
|
176
175
|
focusable child. The purge safelist keeps these three classes.
|
|
@@ -0,0 +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};
|