css-in-props 3.14.707 → 3.14.747
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/CHANGELOG.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var b=(s,t)=>{for(var n in t)u(s,n,{get:t[n],enumerable:!0})},k=(s,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of v(t))!g.call(s,e)&&e!==n&&u(s,e,{get:()=>t[e],enumerable:!(o=m(t,e))||o.enumerable});return s};var y=s=>k(u({},"__esModule",{value:!0}),s);var x={};b(x,{warnUnresolvedPassthroughToken:()=>j});module.exports=y(x);var l=require("@symbo.ls/utils"),w=require("@symbo.ls/scratch");const S=/^-?[A-Z][0-9]?$/,_=/^[a-z][0-9]?$/,p=/var\(\s*(--[A-Za-z0-9-]+)/g,E=s=>{const t=new Set,n=new Set;if(!s||typeof s!="object")return{knownLetters:t,knownVars:n};for(const o in s){const e=s[o];if(!(!e||typeof e!="object")){if(e.sequence&&typeof e.sequence=="object")for(const r in e.sequence)t.add(r);if(e.vars&&typeof e.vars=="object")for(const r in e.vars)n.add(r)}}return{knownLetters:t,knownVars:n}},R=(s,t)=>{if(!t.size)return[];const n=s.split(/[(),\s]+/).filter(Boolean),o=new Set;for(const e of n){if(!S.test(e))continue;const r=e.charCodeAt(0)===45?e.slice(1):e;t.has(r)&&o.add(e)}return[...o]},A=(s,t)=>{if(!t.size)return[];const n=[];p.lastIndex=0;let o;for(;o=p.exec(s);){const e=o[1];if(t.has(e))continue;const r=e.lastIndexOf("-");if(r===-1)continue;const a=e.slice(r+1);if(!_.test(a))continue;const c=e.slice(0,r+1)+a.toUpperCase();c!==e&&t.has(c)&&n.push({varName:e,corrected:c})}return n},h=new Set,j=(s,t,n)=>{if(!(0,l.isLoudDevRuntime)()||!(0,l.isString)(t)||!t)return;let o;try{o=(0,w.getActiveConfig)()}catch{return}const{knownLetters:e,knownVars:r}=E(o);if(!e.size&&!r.size)return;const a=R(t,e),c=A(t,r);if(!a.length&&!c.length)return;const f=n?.__ref?.path?n.__ref.path.join("."):n?.key||"?";for(const i of a){const d=`${f}::${s}::bare::${i}::${t}`;h.has(d)||(h.add(d),console.warn(`[smbls/css-in-props] "${s}" on <${f}> looks like it contains an un-wrapped design-system token ("${i}") \u2014 "${s}" has no registered resolver, so its value is forwarded to the browser untouched. A bare letter token there is invalid CSS, so the browser drops the ENTIRE "${s}" declaration (not just this argument). Wrap it in var(--<family>-${i.replace("-","")}) (or calc(-1 * var(--<family>-${i.replace("-","")})) for a negative). Value: "${t}"`))}for(const{varName:i,corrected:d}of c){const $=`${f}::${s}::case::${i}::${t}`;h.has($)||(h.add($),console.warn(`[smbls/css-in-props] "${s}" on <${f}> references ${i}, which the active design system never emits. CSS custom-property names are case-sensitive \u2014 the real variable is ${d}, so this reference silently never resolves. Value: "${t}"`))}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var _=(e,s)=>{for(var c in s)d(e,c,{get:s[c],enumerable:!0})},O=(e,s,c,f)=>{if(s&&typeof s=="object"||typeof s=="function")for(let o of A(s))!T.call(e,o)&&o!==c&&d(e,o,{get:()=>s[o],enumerable:!(f=v(s,o))||f.enumerable});return e};var R=e=>O(d({},"__esModule",{value:!0}),e);var I={};_(I,{exetuteClassPerComponent:()=>E,useCssInProps:()=>w,usePropsAsCSS:()=>h,useSelectorsAsCSS:()=>k});module.exports=R(I);var r=require("@symbo.ls/utils"),P=require("@symbo.ls/scratch"),b=require("../props/index.js"),g=require("../props/defaults.js"),x=require("../props/passthroughTokenWarn.js"),C=require("./transformers.js");const y=(0,r.isProduction)(),h=(e,s,c)=>{const f=s?.context?.designSystem;f&&(0,P.pushConfig)(f);try{let o={};const l={},n=(t,p)=>{if(c.unpack){o={...o,...p};return}o[t]=p};for(const t in e){const p=e[t];if(t==="class"&&s.call("isString",e.class)){const i=p.split(" ");if(i.length){const a=s.context.designSystem.class,u=i.reduce((S,j)=>(0,r.merge)(S,a[j]),{});o.designSystemClass=u}}else if(t==="true"){const i=(0,r.exec)(p,s);(0,r.merge)(o,(0,C.applyTrueProps)(i,s))}else if(s.classlist[t]){const i=s.classlist[t],a=(0,r.isFunction)(i)?i(s,s.state,s.context):i;a&&n(t,a),!y&&(0,r.isObject)(o[t])&&(o[t].label=t)}else if(b.CSS_PROPS_REGISTRY[t]){let i=(0,r.exec)(p,s);(0,r.isArray)(i)&&(i=i.reduce((u,S)=>(0,r.merge)(u,S),{}));let a=b.CSS_PROPS_REGISTRY[t](i,s,s.state,s.context);(0,r.isArray)(a)&&(a=a.reduce((u,S)=>(0,r.merge)(u,S),{})),a&&n(t,a),!y&&(0,r.isObject)(o[t])&&(o[t].label=t)}else if(g.DEFAULT_CSS_PROPERTIES_LIST.has(t)){let i=(0,r.exec)(p,s);typeof i=="string"&&i.charCodeAt(0)===45&&i.charCodeAt(1)===45&&(i=`var(${i})`),y||(0,x.warnUnresolvedPassthroughToken)(t,i,s),n(t,{[t]:i}),!y&&(0,r.isObject)(o[t])&&(o[t].label=t)}else l[t]=p}return[o,l]}finally{f&&(0,P.popConfig)()}},k=(e,s)=>{const c={};for(const f in e){const o=C.transformersByPrefix[f.slice(0,1)];if(o){const l=o(f,e[f],s);if(l)for(const n in l)Object.prototype.hasOwnProperty.call(l,n)&&(c[n]&&typeof c[n]=="object"&&typeof l[n]=="object"?(0,r.overwriteDeep)(c[n],l[n]):c[n]=l[n])}}return c},w=(e,s,c={unpack:!0})=>{const[f,o]=h(e,s,c),l=k(o,s);let n=!1;for(const t in l){n=!0;break}if(n){if(c.unpack)return(0,r.overwrite)(f,l);f._selectors=l}return f},E=(e,s)=>{const c={};if(e.class)for(const f in e.class)c[f]=e.class[f](s);return c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isString as $,isLoudDevRuntime as p}from"@symbo.ls/utils";import{getActiveConfig as w}from"@symbo.ls/scratch";const m=/^-?[A-Z][0-9]?$/,v=/^[a-z][0-9]?$/,u=/var\(\s*(--[A-Za-z0-9-]+)/g,g=s=>{const t=new Set,n=new Set;if(!s||typeof s!="object")return{knownLetters:t,knownVars:n};for(const r in s){const e=s[r];if(!(!e||typeof e!="object")){if(e.sequence&&typeof e.sequence=="object")for(const o in e.sequence)t.add(o);if(e.vars&&typeof e.vars=="object")for(const o in e.vars)n.add(o)}}return{knownLetters:t,knownVars:n}},b=(s,t)=>{if(!t.size)return[];const n=s.split(/[(),\s]+/).filter(Boolean),r=new Set;for(const e of n){if(!m.test(e))continue;const o=e.charCodeAt(0)===45?e.slice(1):e;t.has(o)&&r.add(e)}return[...r]},k=(s,t)=>{if(!t.size)return[];const n=[];u.lastIndex=0;let r;for(;r=u.exec(s);){const e=r[1];if(t.has(e))continue;const o=e.lastIndexOf("-");if(o===-1)continue;const a=e.slice(o+1);if(!v.test(a))continue;const c=e.slice(0,o+1)+a.toUpperCase();c!==e&&t.has(c)&&n.push({varName:e,corrected:c})}return n},h=new Set,_=(s,t,n)=>{if(!p()||!$(t)||!t)return;let r;try{r=w()}catch{return}const{knownLetters:e,knownVars:o}=g(r);if(!e.size&&!o.size)return;const a=b(t,e),c=k(t,o);if(!a.length&&!c.length)return;const f=n?.__ref?.path?n.__ref.path.join("."):n?.key||"?";for(const i of a){const d=`${f}::${s}::bare::${i}::${t}`;h.has(d)||(h.add(d),console.warn(`[smbls/css-in-props] "${s}" on <${f}> looks like it contains an un-wrapped design-system token ("${i}") \u2014 "${s}" has no registered resolver, so its value is forwarded to the browser untouched. A bare letter token there is invalid CSS, so the browser drops the ENTIRE "${s}" declaration (not just this argument). Wrap it in var(--<family>-${i.replace("-","")}) (or calc(-1 * var(--<family>-${i.replace("-","")})) for a negative). Value: "${t}"`))}for(const{varName:i,corrected:d}of c){const l=`${f}::${s}::case::${i}::${t}`;h.has(l)||(h.add(l),console.warn(`[smbls/css-in-props] "${s}" on <${f}> references ${i}, which the active design system never emits. CSS custom-property names are case-sensitive \u2014 the real variable is ${d}, so this reference silently never resolves. Value: "${t}"`))}};export{_ as warnUnresolvedPassthroughToken};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{exec as
|
|
1
|
+
import{exec as P,isArray as d,isFunction as x,isObject as C,isProduction as h,merge as S,overwrite as k,overwriteDeep as j}from"@symbo.ls/utils";import{pushConfig as v,popConfig as A}from"@symbo.ls/scratch";import{CSS_PROPS_REGISTRY as b}from"../props/index.js";import{DEFAULT_CSS_PROPERTIES_LIST as T}from"../props/defaults.js";import{warnUnresolvedPassthroughToken as _}from"../props/passthroughTokenWarn.js";import{applyTrueProps as O,transformersByPrefix as R}from"./transformers.js";const y=h(),w=(n,t,c)=>{const e=t?.context?.designSystem;e&&v(e);try{let o={};const f={},i=(s,a)=>{if(c.unpack){o={...o,...a};return}o[s]=a};for(const s in n){const a=n[s];if(s==="class"&&t.call("isString",n.class)){const r=a.split(" ");if(r.length){const l=t.context.designSystem.class,p=r.reduce((u,g)=>S(u,l[g]),{});o.designSystemClass=p}}else if(s==="true"){const r=P(a,t);S(o,O(r,t))}else if(t.classlist[s]){const r=t.classlist[s],l=x(r)?r(t,t.state,t.context):r;l&&i(s,l),!y&&C(o[s])&&(o[s].label=s)}else if(b[s]){let r=P(a,t);d(r)&&(r=r.reduce((p,u)=>S(p,u),{}));let l=b[s](r,t,t.state,t.context);d(l)&&(l=l.reduce((p,u)=>S(p,u),{})),l&&i(s,l),!y&&C(o[s])&&(o[s].label=s)}else if(T.has(s)){let r=P(a,t);typeof r=="string"&&r.charCodeAt(0)===45&&r.charCodeAt(1)===45&&(r=`var(${r})`),y||_(s,r,t),i(s,{[s]:r}),!y&&C(o[s])&&(o[s].label=s)}else f[s]=a}return[o,f]}finally{e&&A()}},E=(n,t)=>{const c={};for(const e in n){const o=R[e.slice(0,1)];if(o){const f=o(e,n[e],t);if(f)for(const i in f)Object.prototype.hasOwnProperty.call(f,i)&&(c[i]&&typeof c[i]=="object"&&typeof f[i]=="object"?j(c[i],f[i]):c[i]=f[i])}}return c},B=(n,t,c={unpack:!0})=>{const[e,o]=w(n,t,c),f=E(o,t);let i=!1;for(const s in f){i=!0;break}if(i){if(c.unpack)return k(e,f);e._selectors=f}return e},G=(n,t)=>{const c={};if(n.class)for(const e in n.class)c[e]=n.class[e](t);return c};export{G as exetuteClassPerComponent,B as useCssInProps,w as usePropsAsCSS,E as useSelectorsAsCSS};
|
package/package.json
CHANGED