@symbo.ls/scratch 2.34.27 → 2.34.30

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/dist/cjs/index.js CHANGED
@@ -1710,6 +1710,46 @@ ${element}` : ""
1710
1710
  }
1711
1711
  return element;
1712
1712
  };
1713
+ function getRootState(param) {
1714
+ var _a, _b;
1715
+ let state2 = null;
1716
+ const hasRootState = (obj) => {
1717
+ var _a2;
1718
+ return obj.__element && ((_a2 = obj.root) == null ? void 0 : _a2.isRootState);
1719
+ };
1720
+ if (!this) {
1721
+ state2 = window.platformState || ((_a = window.smblsApp) == null ? void 0 : _a.state);
1722
+ } else if (hasRootState(this)) {
1723
+ state2 = this.root;
1724
+ } else if (this.__ref && this.__ref.path) {
1725
+ const hasPlatformState = this.state && hasRootState(this.state);
1726
+ const hasPlatformStateOnParent = this.call("isFunction", this.state) && this.parent.state && hasRootState(this.parent.state);
1727
+ if (hasPlatformState || hasPlatformStateOnParent) {
1728
+ state2 = this.state.root || this.parent.state.root;
1729
+ }
1730
+ }
1731
+ if (!state2) {
1732
+ state2 = window.platformState || ((_b = window.smblsApp) == null ? void 0 : _b.state);
1733
+ }
1734
+ return param ? state2[param] : state2;
1735
+ }
1736
+ function getRoot(key) {
1737
+ var _a;
1738
+ const rootElem = (_a = this.getRootState()) == null ? void 0 : _a.__element;
1739
+ return rootElem && Object.keys(rootElem).length > 0 && key ? rootElem[key] : rootElem;
1740
+ }
1741
+ function getRootData(key) {
1742
+ return this.getRoot("data") && Object.keys(this.getRoot("data")).length > 0 && key ? this.getRoot("data")[key] : this.getRoot("data");
1743
+ }
1744
+ function getRootContext(key) {
1745
+ var _a;
1746
+ const ctx = (_a = this.getRoot()) == null ? void 0 : _a.context;
1747
+ return key ? ctx[key] : ctx;
1748
+ }
1749
+ function getContext(key) {
1750
+ const ctx = this.context;
1751
+ return key ? ctx[key] : ctx;
1752
+ }
1713
1753
  var ROOT = {
1714
1754
  key: ":root",
1715
1755
  node: document22 ? document22.body : report("DocumentNotDefined", document22)
@@ -2000,6 +2040,11 @@ ${element}` : ""
2000
2040
  "getRef",
2001
2041
  "getChildren",
2002
2042
  "getPath",
2043
+ "getRootState",
2044
+ "getRoot",
2045
+ "getRootData",
2046
+ "getRootContext",
2047
+ "getContext",
2003
2048
  "setNodeStyles",
2004
2049
  "spotByPath",
2005
2050
  "keys",
@@ -3118,6 +3163,11 @@ ${element}` : ""
3118
3163
  lookdown,
3119
3164
  lookdownAll,
3120
3165
  getRef,
3166
+ getRootState,
3167
+ getRoot,
3168
+ getRootData,
3169
+ getRootContext,
3170
+ getContext,
3121
3171
  getPath,
3122
3172
  setNodeStyles,
3123
3173
  spotByPath,
@@ -4048,6 +4098,7 @@ __export(index_exports, {
4048
4098
  hexToRgbArray: () => hexToRgbArray,
4049
4099
  hexToRgba: () => hexToRgba,
4050
4100
  hslToRgb: () => hslToRgb,
4101
+ isGoogleFontsUrl: () => isGoogleFontsUrl,
4051
4102
  isScalingUnit: () => isScalingUnit,
4052
4103
  mixTwoColors: () => mixTwoColors,
4053
4104
  mixTwoRgb: () => mixTwoRgb,
@@ -4069,6 +4120,7 @@ __export(index_exports, {
4069
4120
  setEach: () => setEach,
4070
4121
  setFont: () => setFont,
4071
4122
  setFontFamily: () => setFontFamily,
4123
+ setFontImport: () => setFontImport,
4072
4124
  setGradient: () => setGradient,
4073
4125
  setInCustomFontMedia: () => setInCustomFontMedia,
4074
4126
  setMediaTheme: () => setMediaTheme,
@@ -4129,6 +4181,7 @@ __export(utils_exports, {
4129
4181
  hexToRgbArray: () => hexToRgbArray,
4130
4182
  hexToRgba: () => hexToRgba,
4131
4183
  hslToRgb: () => hslToRgb,
4184
+ isGoogleFontsUrl: () => isGoogleFontsUrl,
4132
4185
  isScalingUnit: () => isScalingUnit,
4133
4186
  mixTwoColors: () => mixTwoColors,
4134
4187
  mixTwoRgb: () => mixTwoRgb,
@@ -4141,6 +4194,7 @@ __export(utils_exports, {
4141
4194
  rgbToHex: () => rgbToHex,
4142
4195
  setCustomFont: () => setCustomFont,
4143
4196
  setCustomFontMedia: () => setCustomFontMedia,
4197
+ setFontImport: () => setFontImport,
4144
4198
  setInCustomFontMedia: () => setInCustomFontMedia,
4145
4199
  setScalingVar: () => setScalingVar,
4146
4200
  setSubScalingVar: () => setSubScalingVar,
@@ -4534,15 +4588,26 @@ var getDefaultOrFirstKey = (LIBRARY, key) => {
4534
4588
  const hasValue = Object.keys(LIBRARY)[0];
4535
4589
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
4536
4590
  };
4537
- var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
4591
+ var getFontFormat = (url) => {
4592
+ const ext = url.split(/[#?]/)[0].split(".").pop().trim();
4593
+ if (["woff2", "woff", "ttf", "otf", "eot"].includes(ext)) return ext;
4594
+ return null;
4595
+ };
4596
+ var isGoogleFontsUrl = (url) => url && (url.includes("fonts.googleapis.com") || url.includes("fonts.gstatic.com"));
4597
+ var setFontImport = (url) => `@import url('${url}');`;
4538
4598
  var setInCustomFontMedia = (str) => `@font-face { ${str} }`;
4539
- var setCustomFont = (name, url, weight) => `
4599
+ var setCustomFont = (name, url, weight, options = {}) => {
4600
+ const format = getFontFormat(url);
4601
+ const formatStr = format ? ` format('${format}')` : "";
4602
+ return `
4540
4603
  font-family: '${name}';
4541
- font-style: normal;
4542
- ${weight && `font-weight: ${weight};`}
4543
- src: url('${url}') format('${getFontFormat(url)}');`;
4544
- var setCustomFontMedia = (name, url, weight) => `@font-face {
4545
- ${setCustomFont(name, url, weight)}
4604
+ font-style: normal;${weight ? `
4605
+ font-weight: ${weight};` : ""}${options.fontStretch ? `
4606
+ font-stretch: ${options.fontStretch};` : ""}${options.fontDisplay ? `
4607
+ font-display: ${options.fontDisplay};` : ""}
4608
+ src: url('${url}')${formatStr};`;
4609
+ };
4610
+ var setCustomFontMedia = (name, url, weight, options) => `@font-face {${setCustomFont(name, url, weight, options)}
4546
4611
  }`;
4547
4612
  var getFontFaceEach = (name, weights) => {
4548
4613
  const keys = Object.keys(weights);
@@ -4556,6 +4621,15 @@ var getFontFace = (LIBRARY) => {
4556
4621
  return keys.map((key) => getFontFaceEach(key, LIBRARY[key].value));
4557
4622
  };
4558
4623
  var getFontFaceEachString = (name, weights) => {
4624
+ if (weights && weights.isVariable) {
4625
+ if (isGoogleFontsUrl(weights.url)) {
4626
+ return setFontImport(weights.url);
4627
+ }
4628
+ return setCustomFontMedia(name, weights.url, weights.fontWeight, {
4629
+ fontStretch: weights.fontStretch,
4630
+ fontDisplay: weights.fontDisplay || "swap"
4631
+ });
4632
+ }
4559
4633
  const isArr = weights[0];
4560
4634
  if (isArr) return getFontFaceEach(name, weights).map(setInCustomFontMedia);
4561
4635
  return setCustomFontMedia(name, weights.url);
@@ -5584,7 +5658,21 @@ var import_utils11 = __toESM(require_cjs(), 1);
5584
5658
  var setFont = (val, key) => {
5585
5659
  const CSSvar = `--font-${key}`;
5586
5660
  if (!val || isArray(val) && !val[0]) return;
5587
- const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
5661
+ let fontFace;
5662
+ if (val.isVariable) {
5663
+ if (isGoogleFontsUrl(val.url)) {
5664
+ fontFace = setFontImport(val.url);
5665
+ } else {
5666
+ fontFace = setCustomFontMedia(key, val.url, val.fontWeight, {
5667
+ fontStretch: val.fontStretch,
5668
+ fontDisplay: val.fontDisplay || "swap"
5669
+ });
5670
+ }
5671
+ } else if (val[0]) {
5672
+ fontFace = getFontFaceEach(key, val);
5673
+ } else {
5674
+ fontFace = setCustomFontMedia(key, val.url);
5675
+ }
5588
5676
  return { var: CSSvar, value: val, fontFace };
5589
5677
  };
5590
5678
  var getFontFamily = (key, factory) => {
package/dist/cjs/set.js CHANGED
@@ -1710,6 +1710,46 @@ ${element}` : ""
1710
1710
  }
1711
1711
  return element;
1712
1712
  };
1713
+ function getRootState(param) {
1714
+ var _a, _b;
1715
+ let state2 = null;
1716
+ const hasRootState = (obj) => {
1717
+ var _a2;
1718
+ return obj.__element && ((_a2 = obj.root) == null ? void 0 : _a2.isRootState);
1719
+ };
1720
+ if (!this) {
1721
+ state2 = window.platformState || ((_a = window.smblsApp) == null ? void 0 : _a.state);
1722
+ } else if (hasRootState(this)) {
1723
+ state2 = this.root;
1724
+ } else if (this.__ref && this.__ref.path) {
1725
+ const hasPlatformState = this.state && hasRootState(this.state);
1726
+ const hasPlatformStateOnParent = this.call("isFunction", this.state) && this.parent.state && hasRootState(this.parent.state);
1727
+ if (hasPlatformState || hasPlatformStateOnParent) {
1728
+ state2 = this.state.root || this.parent.state.root;
1729
+ }
1730
+ }
1731
+ if (!state2) {
1732
+ state2 = window.platformState || ((_b = window.smblsApp) == null ? void 0 : _b.state);
1733
+ }
1734
+ return param ? state2[param] : state2;
1735
+ }
1736
+ function getRoot(key) {
1737
+ var _a;
1738
+ const rootElem = (_a = this.getRootState()) == null ? void 0 : _a.__element;
1739
+ return rootElem && Object.keys(rootElem).length > 0 && key ? rootElem[key] : rootElem;
1740
+ }
1741
+ function getRootData(key) {
1742
+ return this.getRoot("data") && Object.keys(this.getRoot("data")).length > 0 && key ? this.getRoot("data")[key] : this.getRoot("data");
1743
+ }
1744
+ function getRootContext(key) {
1745
+ var _a;
1746
+ const ctx = (_a = this.getRoot()) == null ? void 0 : _a.context;
1747
+ return key ? ctx[key] : ctx;
1748
+ }
1749
+ function getContext(key) {
1750
+ const ctx = this.context;
1751
+ return key ? ctx[key] : ctx;
1752
+ }
1713
1753
  var ROOT = {
1714
1754
  key: ":root",
1715
1755
  node: document22 ? document22.body : report("DocumentNotDefined", document22)
@@ -2000,6 +2040,11 @@ ${element}` : ""
2000
2040
  "getRef",
2001
2041
  "getChildren",
2002
2042
  "getPath",
2043
+ "getRootState",
2044
+ "getRoot",
2045
+ "getRootData",
2046
+ "getRootContext",
2047
+ "getContext",
2003
2048
  "setNodeStyles",
2004
2049
  "spotByPath",
2005
2050
  "keys",
@@ -3118,6 +3163,11 @@ ${element}` : ""
3118
3163
  lookdown,
3119
3164
  lookdownAll,
3120
3165
  getRef,
3166
+ getRootState,
3167
+ getRoot,
3168
+ getRootData,
3169
+ getRootContext,
3170
+ getContext,
3121
3171
  getPath,
3122
3172
  setNodeStyles,
3123
3173
  spotByPath,
@@ -4506,14 +4556,25 @@ var getDefaultOrFirstKey = (LIBRARY, key) => {
4506
4556
  const hasValue = Object.keys(LIBRARY)[0];
4507
4557
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
4508
4558
  };
4509
- var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
4510
- var setCustomFont = (name, url, weight) => `
4559
+ var getFontFormat = (url) => {
4560
+ const ext = url.split(/[#?]/)[0].split(".").pop().trim();
4561
+ if (["woff2", "woff", "ttf", "otf", "eot"].includes(ext)) return ext;
4562
+ return null;
4563
+ };
4564
+ var isGoogleFontsUrl = (url) => url && (url.includes("fonts.googleapis.com") || url.includes("fonts.gstatic.com"));
4565
+ var setFontImport = (url) => `@import url('${url}');`;
4566
+ var setCustomFont = (name, url, weight, options = {}) => {
4567
+ const format = getFontFormat(url);
4568
+ const formatStr = format ? ` format('${format}')` : "";
4569
+ return `
4511
4570
  font-family: '${name}';
4512
- font-style: normal;
4513
- ${weight && `font-weight: ${weight};`}
4514
- src: url('${url}') format('${getFontFormat(url)}');`;
4515
- var setCustomFontMedia = (name, url, weight) => `@font-face {
4516
- ${setCustomFont(name, url, weight)}
4571
+ font-style: normal;${weight ? `
4572
+ font-weight: ${weight};` : ""}${options.fontStretch ? `
4573
+ font-stretch: ${options.fontStretch};` : ""}${options.fontDisplay ? `
4574
+ font-display: ${options.fontDisplay};` : ""}
4575
+ src: url('${url}')${formatStr};`;
4576
+ };
4577
+ var setCustomFontMedia = (name, url, weight, options) => `@font-face {${setCustomFont(name, url, weight, options)}
4517
4578
  }`;
4518
4579
  var getFontFaceEach = (name, weights) => {
4519
4580
  const keys = Object.keys(weights);
@@ -5186,7 +5247,21 @@ var import_utils11 = __toESM(require_cjs(), 1);
5186
5247
  var setFont = (val, key) => {
5187
5248
  const CSSvar = `--font-${key}`;
5188
5249
  if (!val || isArray(val) && !val[0]) return;
5189
- const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
5250
+ let fontFace;
5251
+ if (val.isVariable) {
5252
+ if (isGoogleFontsUrl(val.url)) {
5253
+ fontFace = setFontImport(val.url);
5254
+ } else {
5255
+ fontFace = setCustomFontMedia(key, val.url, val.fontWeight, {
5256
+ fontStretch: val.fontStretch,
5257
+ fontDisplay: val.fontDisplay || "swap"
5258
+ });
5259
+ }
5260
+ } else if (val[0]) {
5261
+ fontFace = getFontFaceEach(key, val);
5262
+ } else {
5263
+ fontFace = setCustomFontMedia(key, val.url);
5264
+ }
5190
5265
  return { var: CSSvar, value: val, fontFace };
5191
5266
  };
5192
5267
  var setFontFamily = (val, key) => {
@@ -1710,6 +1710,46 @@ ${element}` : ""
1710
1710
  }
1711
1711
  return element;
1712
1712
  };
1713
+ function getRootState(param) {
1714
+ var _a, _b;
1715
+ let state2 = null;
1716
+ const hasRootState = (obj) => {
1717
+ var _a2;
1718
+ return obj.__element && ((_a2 = obj.root) == null ? void 0 : _a2.isRootState);
1719
+ };
1720
+ if (!this) {
1721
+ state2 = window.platformState || ((_a = window.smblsApp) == null ? void 0 : _a.state);
1722
+ } else if (hasRootState(this)) {
1723
+ state2 = this.root;
1724
+ } else if (this.__ref && this.__ref.path) {
1725
+ const hasPlatformState = this.state && hasRootState(this.state);
1726
+ const hasPlatformStateOnParent = this.call("isFunction", this.state) && this.parent.state && hasRootState(this.parent.state);
1727
+ if (hasPlatformState || hasPlatformStateOnParent) {
1728
+ state2 = this.state.root || this.parent.state.root;
1729
+ }
1730
+ }
1731
+ if (!state2) {
1732
+ state2 = window.platformState || ((_b = window.smblsApp) == null ? void 0 : _b.state);
1733
+ }
1734
+ return param ? state2[param] : state2;
1735
+ }
1736
+ function getRoot(key) {
1737
+ var _a;
1738
+ const rootElem = (_a = this.getRootState()) == null ? void 0 : _a.__element;
1739
+ return rootElem && Object.keys(rootElem).length > 0 && key ? rootElem[key] : rootElem;
1740
+ }
1741
+ function getRootData(key) {
1742
+ return this.getRoot("data") && Object.keys(this.getRoot("data")).length > 0 && key ? this.getRoot("data")[key] : this.getRoot("data");
1743
+ }
1744
+ function getRootContext(key) {
1745
+ var _a;
1746
+ const ctx = (_a = this.getRoot()) == null ? void 0 : _a.context;
1747
+ return key ? ctx[key] : ctx;
1748
+ }
1749
+ function getContext(key) {
1750
+ const ctx = this.context;
1751
+ return key ? ctx[key] : ctx;
1752
+ }
1713
1753
  var ROOT = {
1714
1754
  key: ":root",
1715
1755
  node: document22 ? document22.body : report("DocumentNotDefined", document22)
@@ -2000,6 +2040,11 @@ ${element}` : ""
2000
2040
  "getRef",
2001
2041
  "getChildren",
2002
2042
  "getPath",
2043
+ "getRootState",
2044
+ "getRoot",
2045
+ "getRootData",
2046
+ "getRootContext",
2047
+ "getContext",
2003
2048
  "setNodeStyles",
2004
2049
  "spotByPath",
2005
2050
  "keys",
@@ -3118,6 +3163,11 @@ ${element}` : ""
3118
3163
  lookdown,
3119
3164
  lookdownAll,
3120
3165
  getRef,
3166
+ getRootState,
3167
+ getRoot,
3168
+ getRootData,
3169
+ getRootContext,
3170
+ getContext,
3121
3171
  getPath,
3122
3172
  setNodeStyles,
3123
3173
  spotByPath,
@@ -1710,6 +1710,46 @@ ${element}` : ""
1710
1710
  }
1711
1711
  return element;
1712
1712
  };
1713
+ function getRootState(param) {
1714
+ var _a, _b;
1715
+ let state2 = null;
1716
+ const hasRootState = (obj) => {
1717
+ var _a2;
1718
+ return obj.__element && ((_a2 = obj.root) == null ? void 0 : _a2.isRootState);
1719
+ };
1720
+ if (!this) {
1721
+ state2 = window.platformState || ((_a = window.smblsApp) == null ? void 0 : _a.state);
1722
+ } else if (hasRootState(this)) {
1723
+ state2 = this.root;
1724
+ } else if (this.__ref && this.__ref.path) {
1725
+ const hasPlatformState = this.state && hasRootState(this.state);
1726
+ const hasPlatformStateOnParent = this.call("isFunction", this.state) && this.parent.state && hasRootState(this.parent.state);
1727
+ if (hasPlatformState || hasPlatformStateOnParent) {
1728
+ state2 = this.state.root || this.parent.state.root;
1729
+ }
1730
+ }
1731
+ if (!state2) {
1732
+ state2 = window.platformState || ((_b = window.smblsApp) == null ? void 0 : _b.state);
1733
+ }
1734
+ return param ? state2[param] : state2;
1735
+ }
1736
+ function getRoot(key) {
1737
+ var _a;
1738
+ const rootElem = (_a = this.getRootState()) == null ? void 0 : _a.__element;
1739
+ return rootElem && Object.keys(rootElem).length > 0 && key ? rootElem[key] : rootElem;
1740
+ }
1741
+ function getRootData(key) {
1742
+ return this.getRoot("data") && Object.keys(this.getRoot("data")).length > 0 && key ? this.getRoot("data")[key] : this.getRoot("data");
1743
+ }
1744
+ function getRootContext(key) {
1745
+ var _a;
1746
+ const ctx = (_a = this.getRoot()) == null ? void 0 : _a.context;
1747
+ return key ? ctx[key] : ctx;
1748
+ }
1749
+ function getContext(key) {
1750
+ const ctx = this.context;
1751
+ return key ? ctx[key] : ctx;
1752
+ }
1713
1753
  var ROOT = {
1714
1754
  key: ":root",
1715
1755
  node: document22 ? document22.body : report("DocumentNotDefined", document22)
@@ -2000,6 +2040,11 @@ ${element}` : ""
2000
2040
  "getRef",
2001
2041
  "getChildren",
2002
2042
  "getPath",
2043
+ "getRootState",
2044
+ "getRoot",
2045
+ "getRootData",
2046
+ "getRootContext",
2047
+ "getContext",
2003
2048
  "setNodeStyles",
2004
2049
  "spotByPath",
2005
2050
  "keys",
@@ -3118,6 +3163,11 @@ ${element}` : ""
3118
3163
  lookdown,
3119
3164
  lookdownAll,
3120
3165
  getRef,
3166
+ getRootState,
3167
+ getRoot,
3168
+ getRootData,
3169
+ getRootContext,
3170
+ getContext,
3121
3171
  getPath,
3122
3172
  setNodeStyles,
3123
3173
  spotByPath,
@@ -1710,6 +1710,46 @@ ${element}` : ""
1710
1710
  }
1711
1711
  return element;
1712
1712
  };
1713
+ function getRootState(param) {
1714
+ var _a, _b;
1715
+ let state2 = null;
1716
+ const hasRootState = (obj) => {
1717
+ var _a2;
1718
+ return obj.__element && ((_a2 = obj.root) == null ? void 0 : _a2.isRootState);
1719
+ };
1720
+ if (!this) {
1721
+ state2 = window.platformState || ((_a = window.smblsApp) == null ? void 0 : _a.state);
1722
+ } else if (hasRootState(this)) {
1723
+ state2 = this.root;
1724
+ } else if (this.__ref && this.__ref.path) {
1725
+ const hasPlatformState = this.state && hasRootState(this.state);
1726
+ const hasPlatformStateOnParent = this.call("isFunction", this.state) && this.parent.state && hasRootState(this.parent.state);
1727
+ if (hasPlatformState || hasPlatformStateOnParent) {
1728
+ state2 = this.state.root || this.parent.state.root;
1729
+ }
1730
+ }
1731
+ if (!state2) {
1732
+ state2 = window.platformState || ((_b = window.smblsApp) == null ? void 0 : _b.state);
1733
+ }
1734
+ return param ? state2[param] : state2;
1735
+ }
1736
+ function getRoot(key) {
1737
+ var _a;
1738
+ const rootElem = (_a = this.getRootState()) == null ? void 0 : _a.__element;
1739
+ return rootElem && Object.keys(rootElem).length > 0 && key ? rootElem[key] : rootElem;
1740
+ }
1741
+ function getRootData(key) {
1742
+ return this.getRoot("data") && Object.keys(this.getRoot("data")).length > 0 && key ? this.getRoot("data")[key] : this.getRoot("data");
1743
+ }
1744
+ function getRootContext(key) {
1745
+ var _a;
1746
+ const ctx = (_a = this.getRoot()) == null ? void 0 : _a.context;
1747
+ return key ? ctx[key] : ctx;
1748
+ }
1749
+ function getContext(key) {
1750
+ const ctx = this.context;
1751
+ return key ? ctx[key] : ctx;
1752
+ }
1713
1753
  var ROOT = {
1714
1754
  key: ":root",
1715
1755
  node: document22 ? document22.body : report("DocumentNotDefined", document22)
@@ -2000,6 +2040,11 @@ ${element}` : ""
2000
2040
  "getRef",
2001
2041
  "getChildren",
2002
2042
  "getPath",
2043
+ "getRootState",
2044
+ "getRoot",
2045
+ "getRootData",
2046
+ "getRootContext",
2047
+ "getContext",
2003
2048
  "setNodeStyles",
2004
2049
  "spotByPath",
2005
2050
  "keys",
@@ -3118,6 +3163,11 @@ ${element}` : ""
3118
3163
  lookdown,
3119
3164
  lookdownAll,
3120
3165
  getRef,
3166
+ getRootState,
3167
+ getRoot,
3168
+ getRootData,
3169
+ getRootContext,
3170
+ getContext,
3121
3171
  getPath,
3122
3172
  setNodeStyles,
3123
3173
  spotByPath,
@@ -4321,14 +4371,25 @@ var getDefaultOrFirstKey = (LIBRARY, key) => {
4321
4371
  const hasValue = Object.keys(LIBRARY)[0];
4322
4372
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
4323
4373
  };
4324
- var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
4325
- var setCustomFont = (name, url, weight) => `
4374
+ var getFontFormat = (url) => {
4375
+ const ext = url.split(/[#?]/)[0].split(".").pop().trim();
4376
+ if (["woff2", "woff", "ttf", "otf", "eot"].includes(ext)) return ext;
4377
+ return null;
4378
+ };
4379
+ var isGoogleFontsUrl = (url) => url && (url.includes("fonts.googleapis.com") || url.includes("fonts.gstatic.com"));
4380
+ var setFontImport = (url) => `@import url('${url}');`;
4381
+ var setCustomFont = (name, url, weight, options = {}) => {
4382
+ const format = getFontFormat(url);
4383
+ const formatStr = format ? ` format('${format}')` : "";
4384
+ return `
4326
4385
  font-family: '${name}';
4327
- font-style: normal;
4328
- ${weight && `font-weight: ${weight};`}
4329
- src: url('${url}') format('${getFontFormat(url)}');`;
4330
- var setCustomFontMedia = (name, url, weight) => `@font-face {
4331
- ${setCustomFont(name, url, weight)}
4386
+ font-style: normal;${weight ? `
4387
+ font-weight: ${weight};` : ""}${options.fontStretch ? `
4388
+ font-stretch: ${options.fontStretch};` : ""}${options.fontDisplay ? `
4389
+ font-display: ${options.fontDisplay};` : ""}
4390
+ src: url('${url}')${formatStr};`;
4391
+ };
4392
+ var setCustomFontMedia = (name, url, weight, options) => `@font-face {${setCustomFont(name, url, weight, options)}
4332
4393
  }`;
4333
4394
  var getFontFaceEach = (name, weights) => {
4334
4395
  const keys = Object.keys(weights);
@@ -4348,7 +4409,21 @@ var isDev = isNotProduction();
4348
4409
  var setFont = (val, key) => {
4349
4410
  const CSSvar = `--font-${key}`;
4350
4411
  if (!val || isArray(val) && !val[0]) return;
4351
- const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
4412
+ let fontFace;
4413
+ if (val.isVariable) {
4414
+ if (isGoogleFontsUrl(val.url)) {
4415
+ fontFace = setFontImport(val.url);
4416
+ } else {
4417
+ fontFace = setCustomFontMedia(key, val.url, val.fontWeight, {
4418
+ fontStretch: val.fontStretch,
4419
+ fontDisplay: val.fontDisplay || "swap"
4420
+ });
4421
+ }
4422
+ } else if (val[0]) {
4423
+ fontFace = getFontFaceEach(key, val);
4424
+ } else {
4425
+ fontFace = setCustomFontMedia(key, val.url);
4426
+ }
4352
4427
  return { var: CSSvar, value: val, fontFace };
4353
4428
  };
4354
4429
  var getFontFamily = (key, factory) => {