@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
|
|
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
|
|
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};
|