@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.
@@ -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,
@@ -4527,14 +4577,25 @@ var getDefaultOrFirstKey = (LIBRARY, key) => {
4527
4577
  const hasValue = Object.keys(LIBRARY)[0];
4528
4578
  return hasValue && LIBRARY[hasValue] && LIBRARY[hasValue].value;
4529
4579
  };
4530
- var getFontFormat = (url) => url.split(/[#?]/)[0].split(".").pop().trim();
4531
- var setCustomFont = (name, url, weight) => `
4580
+ var getFontFormat = (url) => {
4581
+ const ext = url.split(/[#?]/)[0].split(".").pop().trim();
4582
+ if (["woff2", "woff", "ttf", "otf", "eot"].includes(ext)) return ext;
4583
+ return null;
4584
+ };
4585
+ var isGoogleFontsUrl = (url) => url && (url.includes("fonts.googleapis.com") || url.includes("fonts.gstatic.com"));
4586
+ var setFontImport = (url) => `@import url('${url}');`;
4587
+ var setCustomFont = (name, url, weight, options = {}) => {
4588
+ const format = getFontFormat(url);
4589
+ const formatStr = format ? ` format('${format}')` : "";
4590
+ return `
4532
4591
  font-family: '${name}';
4533
- font-style: normal;
4534
- ${weight && `font-weight: ${weight};`}
4535
- src: url('${url}') format('${getFontFormat(url)}');`;
4536
- var setCustomFontMedia = (name, url, weight) => `@font-face {
4537
- ${setCustomFont(name, url, weight)}
4592
+ font-style: normal;${weight ? `
4593
+ font-weight: ${weight};` : ""}${options.fontStretch ? `
4594
+ font-stretch: ${options.fontStretch};` : ""}${options.fontDisplay ? `
4595
+ font-display: ${options.fontDisplay};` : ""}
4596
+ src: url('${url}')${formatStr};`;
4597
+ };
4598
+ var setCustomFontMedia = (name, url, weight, options) => `@font-face {${setCustomFont(name, url, weight, options)}
4538
4599
  }`;
4539
4600
  var getFontFaceEach = (name, weights) => {
4540
4601
  const keys = Object.keys(weights);
@@ -5246,7 +5307,21 @@ var import_utils11 = __toESM(require_cjs(), 1);
5246
5307
  var setFont = (val, key) => {
5247
5308
  const CSSvar = `--font-${key}`;
5248
5309
  if (!val || isArray(val) && !val[0]) return;
5249
- const fontFace = val[0] ? getFontFaceEach(key, val) : setCustomFontMedia(key, val.url);
5310
+ let fontFace;
5311
+ if (val.isVariable) {
5312
+ if (isGoogleFontsUrl(val.url)) {
5313
+ fontFace = setFontImport(val.url);
5314
+ } else {
5315
+ fontFace = setCustomFontMedia(key, val.url, val.fontWeight, {
5316
+ fontStretch: val.fontStretch,
5317
+ fontDisplay: val.fontDisplay || "swap"
5318
+ });
5319
+ }
5320
+ } else if (val[0]) {
5321
+ fontFace = getFontFaceEach(key, val);
5322
+ } else {
5323
+ fontFace = setCustomFontMedia(key, val.url);
5324
+ }
5250
5325
  return { var: CSSvar, value: val, fontFace };
5251
5326
  };
5252
5327
  var getFontFamily = (key, factory) => {
@@ -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,
@@ -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,
@@ -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,