@symbo.ls/scratch 3.14.778 → 3.14.779

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
@@ -1,5 +1,21 @@
1
1
  # @symbo.ls/scratch
2
2
 
3
+ ## 3.14.779
4
+
5
+ ### Patch Changes
6
+
7
+ - shadow: add the `setShadow` idempotency guard that `setColor`/`setGradient` already had
8
+
9
+ An already-processed `{ var, value }` leaf re-entering `setShadow` now passes
10
+ through untouched instead of being wrapped a second time. Without the guard,
11
+ a re-`set()` pass (HMR, livesync, an iframe re-processing an
12
+ already-configured CONFIG) double-wraps the leaf, `getShadow` leaks the
13
+ wrapper object into a `boxShadow` slot, and the atomic engine reads its
14
+ `var`/`value` keys as nested selectors — a stray `.<class> value { box-shadow:
15
+ ... }` rule that can never match.
16
+
17
+ Reference: RELMAN-PUBLISH-SCRATCH-SHADOW-IDEMPOTENCY-GUARD-1.
18
+
3
19
  ## 3.14.774
4
20
 
5
21
  ### Patch Changes
@@ -1 +1 @@
1
- "use strict";var S=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var j=(r,o)=>{for(var i in o)S(r,i,{get:o[i],enumerable:!0})},A=(r,o,i,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of $(o))!g.call(r,t)&&t!==i&&S(r,t,{get:()=>o[t],enumerable:!(c=V(o,t))||c.enumerable});return r};var x=r=>A(S({},"__esModule",{value:!0}),r);var W={};j(W,{getShadow:()=>N,resolveShadowValue:()=>O,setShadow:()=>C});module.exports=x(W);var h=require("../factory.js"),p=require("./color.js"),b=require("./spacing.js"),s=require("../utils/color.js"),a=require("@symbo.ls/utils");const O=(r,o,i)=>!(0,a.isString)(r)||s.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,s.splitTopLevelCommas)(r).map(c=>(c=c.trim(),c.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const n=(0,p.quietColorProbe)(()=>(0,p.getColor)(t,o));if((0,s.isResolvedColor)(n))return n;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||s.COMPOUND_CSS_KEYWORDS.has(t.toLowerCase()))return t;i&&i(t);const f=(0,b.getSpacingByKey)(t,"shadow");return f&&f.shadow?f.shadow:t}).join(" "))).join(", "),C=(r,o,i,c)=>{const t=(0,h.getActiveConfig)();if((0,a.isArray)(r)){const e={"@light":C(r[0],o,"light"),"@dark":C(r[1],o,"dark")};return t.useVariable&&(0,p.setAdaptiveSchemeVar)(e,"shadow",o,t),e}if((0,a.isObject)(r)){const e={};for(const d in r)e[d]=C(r[d],o,d.startsWith("@")?d.slice(1):d);return t.useVariable&&(0,p.setAdaptiveSchemeVar)(e,"shadow",o,t),e}(0,a.isString)(r)&&!s.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=O(r));const f=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[f]=r),{var:f,value:r}},N=(r,o)=>{const i=(0,h.getActiveConfig)();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!(0,a.isString)(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if((0,s.isCSSVar)(r))return`var(${r})`;const[c]=(0,a.isArray)(r)?r:r.split(" "),n=i.shadow[c],f=(0,a.isObject)(n);if(!n)return i.verbose&&console.warn("Can't find color ",c),r;if(f&&!n.value&&i.useVariable&&n.var)return`var(${n.var})`;if(o){const e=n["@"+o]||n[o];if(e)return e.value!==void 0?e.value:e;i.verbose&&console.warn(r," - does not have ",o)}if(f&&n.value)return n.value;if(f){const e={};for(const d in n){if(d.charCodeAt(0)!==64)continue;const m=i.media[d.slice(1)];if(!m)continue;const l="@media "+(m==="print"?`${m}`:`screen and ${m}`),u=n[d],w=u&&(u.value!==void 0?u.value:u);w!==void 0&&(e[l]=w)}return e}return i.verbose&&console.warn("Can't find color",r),r};
1
+ "use strict";var w=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var $=(r,i)=>{for(var o in i)w(r,o,{get:i[o],enumerable:!0})},x=(r,i,o,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of j(i))!A.call(r,t)&&t!==o&&w(r,t,{get:()=>i[t],enumerable:!(a=l(i,t))||a.enumerable});return r};var N=r=>x(w({},"__esModule",{value:!0}),r);var _={};$(_,{getShadow:()=>W,resolveShadowValue:()=>g,setShadow:()=>h});module.exports=N(_);var b=require("../factory.js"),c=require("./color.js"),O=require("./spacing.js"),f=require("../utils/color.js"),s=require("@symbo.ls/utils");const g=(r,i,o)=>!(0,s.isString)(r)||f.CSS_NATIVE_COLOR_REGEX.test(r)?r:(0,f.splitTopLevelCommas)(r).map(a=>(a=a.trim(),a.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const e=(0,c.quietColorProbe)(()=>(0,c.getColor)(t,i));if((0,f.isResolvedColor)(e))return e;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||f.COMPOUND_CSS_KEYWORDS.has(t.toLowerCase()))return t;o&&o(t);const d=(0,O.getSpacingByKey)(t,"shadow");return d&&d.shadow?d.shadow:t}).join(" "))).join(", "),h=(r,i,o,a)=>{const t=(0,b.getActiveConfig)();if((0,s.isObject)(r)&&r.value!==void 0&&r.var!==void 0)return t.useVariable&&(t.cssVars[r.var]=r.value),r;if((0,s.isArray)(r)){const n={"@light":h(r[0],i,"light"),"@dark":h(r[1],i,"dark")};return t.useVariable&&(0,c.setAdaptiveSchemeVar)(n,"shadow",i,t),n}if((0,s.isObject)(r)){const n={};for(const m in r)n[m]=h(r[m],i,m.startsWith("@")?m.slice(1):m);return t.useVariable&&(0,c.setAdaptiveSchemeVar)(n,"shadow",i,t),n}(0,s.isString)(r)&&!f.CSS_NATIVE_COLOR_REGEX.test(r)&&(r=g(r));const d=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${i}`+(o?`-${o}`:"");return t.useVariable&&(t.cssVars[d]=r),{var:d,value:r}},W=(r,i)=>{const o=(0,b.getActiveConfig)();if(i||(i=o.globalTheme==="auto"?null:o.globalTheme),!(0,s.isString)(r)){o.verbose&&console.warn(r,"- type for color is not valid");return}if((0,f.isCSSVar)(r))return`var(${r})`;const[a]=(0,s.isArray)(r)?r:r.split(" "),e=o.shadow[a],d=(0,s.isObject)(e);if(!e)return o.verbose&&console.warn("Can't find color ",a),r;if(d&&!e.value&&o.useVariable&&e.var)return`var(${e.var})`;if(i){const n=e["@"+i]||e[i];if(n)return n.value!==void 0?n.value:n;o.verbose&&console.warn(r," - does not have ",i)}if(d&&e.value)return e.value;if(d){const n={},m=(0,c.schemeGuardSelector)(o);for(const S in e){if(S.charCodeAt(0)!==64)continue;const u=S.slice(1),p=e[S],C=p&&(p.value!==void 0?p.value:p);if(C!==void 0&&(n[`[data-theme="${u}"] &`]=C,u==="light"||u==="dark")){const V=(0,c.schemeMediaQuery)(u,o);if(!V)continue;n[V]={[m]:C}}}return n}return o.verbose&&console.warn("Can't find color",r),r};
@@ -1 +1 @@
1
- import{getActiveConfig as C}from"../factory.js";import{getColor as l,quietColorProbe as V,setAdaptiveSchemeVar as S}from"./color.js";import{getSpacingByKey as $}from"./spacing.js";import{isResolvedColor as g,isCSSVar as j,splitTopLevelCommas as A,CSS_NATIVE_COLOR_REGEX as h,COMPOUND_CSS_KEYWORDS as x}from"../utils/color.js";import{isObject as w,isString as p,isArray as b}from"@symbo.ls/utils";const N=(r,o,i)=>!p(r)||h.test(r)?r:A(r).map(f=>(f=f.trim(),f.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const n=V(()=>l(t,o));if(g(n))return n;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||x.has(t.toLowerCase()))return t;i&&i(t);const s=$(t,"shadow");return s&&s.shadow?s.shadow:t}).join(" "))).join(", "),m=(r,o,i,f)=>{const t=C();if(b(r)){const e={"@light":m(r[0],o,"light"),"@dark":m(r[1],o,"dark")};return t.useVariable&&S(e,"shadow",o,t),e}if(w(r)){const e={};for(const c in r)e[c]=m(r[c],o,c.startsWith("@")?c.slice(1):c);return t.useVariable&&S(e,"shadow",o,t),e}p(r)&&!h.test(r)&&(r=N(r));const s=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[s]=r),{var:s,value:r}},R=(r,o)=>{const i=C();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!p(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if(j(r))return`var(${r})`;const[f]=b(r)?r:r.split(" "),n=i.shadow[f],s=w(n);if(!n)return i.verbose&&console.warn("Can't find color ",f),r;if(s&&!n.value&&i.useVariable&&n.var)return`var(${n.var})`;if(o){const e=n["@"+o]||n[o];if(e)return e.value!==void 0?e.value:e;i.verbose&&console.warn(r," - does not have ",o)}if(s&&n.value)return n.value;if(s){const e={};for(const c in n){if(c.charCodeAt(0)!==64)continue;const a=i.media[c.slice(1)];if(!a)continue;const O="@media "+(a==="print"?`${a}`:`screen and ${a}`),d=n[c],u=d&&(d.value!==void 0?d.value:d);u!==void 0&&(e[O]=u)}return e}return i.verbose&&console.warn("Can't find color",r),r};export{R as getShadow,N as resolveShadowValue,m as setShadow};
1
+ import{getActiveConfig as w}from"../factory.js";import{getColor as g,quietColorProbe as l,setAdaptiveSchemeVar as b,schemeMediaQuery as j,schemeGuardSelector as A}from"./color.js";import{getSpacingByKey as $}from"./spacing.js";import{isResolvedColor as x,isCSSVar as N,splitTopLevelCommas as W,CSS_NATIVE_COLOR_REGEX as V,COMPOUND_CSS_KEYWORDS as _}from"../utils/color.js";import{isObject as p,isString as h,isArray as O}from"@symbo.ls/utils";const D=(r,o,i)=>!h(r)||V.test(r)?r:W(r).map(c=>(c=c.trim(),c.split(/\s+/).map(t=>{if(t=t.trim(),!t)return"";if(t.startsWith("--"))return`var(${t})`;const e=l(()=>g(t,o));if(x(e))return e;if(/^\d/.test(t)||t==="0"||t.includes("px")||t.slice(-2)==="em"||t==="inset"||t==="none"||_.has(t.toLowerCase()))return t;i&&i(t);const s=$(t,"shadow");return s&&s.shadow?s.shadow:t}).join(" "))).join(", "),S=(r,o,i,c)=>{const t=w();if(p(r)&&r.value!==void 0&&r.var!==void 0)return t.useVariable&&(t.cssVars[r.var]=r.value),r;if(O(r)){const n={"@light":S(r[0],o,"light"),"@dark":S(r[1],o,"dark")};return t.useVariable&&b(n,"shadow",o,t),n}if(p(r)){const n={};for(const f in r)n[f]=S(r[f],o,f.startsWith("@")?f.slice(1):f);return t.useVariable&&b(n,"shadow",o,t),n}h(r)&&!V.test(r)&&(r=D(r));const s=`--${t.varPrefix?t.varPrefix+"-":""}shadow-${o}`+(i?`-${i}`:"");return t.useVariable&&(t.cssVars[s]=r),{var:s,value:r}},L=(r,o)=>{const i=w();if(o||(o=i.globalTheme==="auto"?null:i.globalTheme),!h(r)){i.verbose&&console.warn(r,"- type for color is not valid");return}if(N(r))return`var(${r})`;const[c]=O(r)?r:r.split(" "),e=i.shadow[c],s=p(e);if(!e)return i.verbose&&console.warn("Can't find color ",c),r;if(s&&!e.value&&i.useVariable&&e.var)return`var(${e.var})`;if(o){const n=e["@"+o]||e[o];if(n)return n.value!==void 0?n.value:n;i.verbose&&console.warn(r," - does not have ",o)}if(s&&e.value)return e.value;if(s){const n={},f=A(i);for(const m in e){if(m.charCodeAt(0)!==64)continue;const a=m.slice(1),d=e[m],u=d&&(d.value!==void 0?d.value:d);if(u!==void 0&&(n[`[data-theme="${a}"] &`]=u,a==="light"||a==="dark")){const C=j(a,i);if(!C)continue;n[C]={[f]:u}}}return n}return i.verbose&&console.warn("Can't find color",r),r};export{L as getShadow,D as resolveShadowValue,S as setShadow};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@symbo.ls/scratch",
3
3
  "description": "Φ / CSS framework and methodology.",
4
4
  "author": "symbo.ls",
5
- "version": "3.14.778",
5
+ "version": "3.14.779",
6
6
  "files": [
7
7
  "dist",
8
8
  "*.js",