@sitecore-feaas/clientside 0.1.2 → 0.1.3
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/{browser → browser--tsconfig}/basic.cjs +1 -1
- package/dist/{browser → browser--tsconfig}/basic.js +1 -1
- package/dist/{browser → browser--tsconfig}/index.cjs +1 -1
- package/dist/{browser → browser--tsconfig}/index.js +1 -1
- package/dist/node/basic.cjs +1 -4
- package/dist/node/basic.js +1 -4
- package/dist/node/index.cjs +113 -43
- package/dist/node/index.js +113 -43
- package/package.json +4 -3
- package/src/components/FEAASBase.tsx +1 -4
- package/tsconfig.tsup.json +18 -0
- package/types/components/FEAASStylesheet.d.ts +2 -2
- package/types/tsbuildinfo +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -1252,13 +1252,13 @@ var FEAASBase = class extends HTMLElement {
|
|
|
1252
1252
|
console.log("FEAAS: React", this.tagName, this.payload);
|
|
1253
1253
|
if (this.payload == null)
|
|
1254
1254
|
return;
|
|
1255
|
-
const { React, ReactDOM } = this.payload || {};
|
|
1256
|
-
if (!
|
|
1255
|
+
const { React: React2, ReactDOM } = this.payload || {};
|
|
1256
|
+
if (!React2)
|
|
1257
1257
|
throw new Error(`${this.tagName}: React is not present in payload`);
|
|
1258
1258
|
if (!ReactDOM)
|
|
1259
1259
|
throw new Error(`${this.tagName}: ReactDOM is not present in payload`);
|
|
1260
1260
|
if (!this.refs.topReact && !this.forceUpdateReact) {
|
|
1261
|
-
ReactDOM.render(
|
|
1261
|
+
ReactDOM.render(React2.createElement(this.getReactWrapper()), this.getReactRoot());
|
|
1262
1262
|
} else if (this.forceUpdateReact) {
|
|
1263
1263
|
(_a = this.forceUpdateReact) == null ? void 0 : _a.call(this);
|
|
1264
1264
|
} else {
|
|
@@ -1266,11 +1266,11 @@ var FEAASBase = class extends HTMLElement {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
}
|
|
1268
1268
|
invokeReactRendering() {
|
|
1269
|
-
const { React, ReactDOM } = this.payload || {};
|
|
1269
|
+
const { React: React2, ReactDOM } = this.payload || {};
|
|
1270
1270
|
const children = this.descendants.filter((r) => {
|
|
1271
1271
|
return r.refs.parentReact == this && r.payload;
|
|
1272
1272
|
}).map((child, index) => {
|
|
1273
|
-
return
|
|
1273
|
+
return React2.createElement(this.getReactWrapper(child), {
|
|
1274
1274
|
key: this.tagName + "-" + index,
|
|
1275
1275
|
slot: child.getAttribute("slot")
|
|
1276
1276
|
});
|
|
@@ -1280,13 +1280,10 @@ var FEAASBase = class extends HTMLElement {
|
|
|
1280
1280
|
getReactWrapper(target = this, displayName = target.tagName) {
|
|
1281
1281
|
const Wrapper = target.reactWrapper || (target.reactWrapper = (props) => {
|
|
1282
1282
|
if (target.renderReact) {
|
|
1283
|
-
const { React, ReactDOM } = target.payload || {};
|
|
1284
|
-
const [value, forceUpdateReact] =
|
|
1283
|
+
const { React: React2, ReactDOM } = target.payload || {};
|
|
1284
|
+
const [value, forceUpdateReact] = React2.useReducer((r) => r + 1, 0);
|
|
1285
1285
|
target.forceUpdateReact = forceUpdateReact;
|
|
1286
|
-
return ReactDOM.createPortal(
|
|
1287
|
-
React.createElement(React.Fragment, null, target.invokeReactRendering()),
|
|
1288
|
-
target.getReactRoot()
|
|
1289
|
-
);
|
|
1286
|
+
return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(React2.Fragment, null, target.invokeReactRendering()), target.getReactRoot());
|
|
1290
1287
|
} else {
|
|
1291
1288
|
return target.render();
|
|
1292
1289
|
}
|
|
@@ -1691,32 +1688,95 @@ var FEAASEditor = class extends FEAASBase {
|
|
|
1691
1688
|
}, [observedVersions]);
|
|
1692
1689
|
if (!component)
|
|
1693
1690
|
return;
|
|
1694
|
-
return useSlots(children, ({ picker, children: children2 }) =>
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1691
|
+
return useSlots(children, ({ picker, children: children2 }) => /* @__PURE__ */ React.createElement(Box, {
|
|
1692
|
+
ref: (el) => this.wrapper = el
|
|
1693
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
|
1694
|
+
className: "editor-wrapper",
|
|
1695
|
+
position: "absolute",
|
|
1696
|
+
left: 0,
|
|
1697
|
+
top: 0
|
|
1698
|
+
}, /* @__PURE__ */ React.createElement(Editor, {
|
|
1699
|
+
sdk,
|
|
1700
|
+
library: sdk.library,
|
|
1701
|
+
component,
|
|
1702
|
+
versions,
|
|
1703
|
+
context: {
|
|
1704
|
+
onChromeMeasure: this.onMeasure,
|
|
1705
|
+
onChromeBeforeMeasure: this.onBeforeMeasure,
|
|
1706
|
+
onChromeMeasureElement: this.onChromeMeasureElement,
|
|
1707
|
+
onChromePosition: this.onPosition
|
|
1708
|
+
}
|
|
1709
|
+
}, ({ editor, status, isArchivedDisplayed }) => ({
|
|
1700
1710
|
after: children2,
|
|
1701
1711
|
picker,
|
|
1702
|
-
chrome: editor &&
|
|
1712
|
+
chrome: editor && /* @__PURE__ */ React.createElement(Chrome, null),
|
|
1703
1713
|
children: component.reduceVersionRevisions(versions).filter((snapshot) => {
|
|
1704
1714
|
var _a;
|
|
1705
1715
|
return isArchivedDisplayed || !((_a = snapshot.saved || snapshot.draft) == null ? void 0 : _a.deletedAt);
|
|
1706
|
-
}).map((snapshot, index) =>
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1716
|
+
}).map((snapshot, index) => /* @__PURE__ */ React.createElement(Box, {
|
|
1717
|
+
key: snapshot.head.id,
|
|
1718
|
+
position: "absolute",
|
|
1719
|
+
left: 0,
|
|
1720
|
+
top: 0,
|
|
1721
|
+
className: "editor-chrome",
|
|
1722
|
+
p: 4,
|
|
1723
|
+
boxShadow: "2xl",
|
|
1724
|
+
pointerEvents: "none"
|
|
1725
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
|
1726
|
+
className: "borders",
|
|
1727
|
+
pointerEvents: "none",
|
|
1728
|
+
left: 0,
|
|
1729
|
+
width: "4",
|
|
1730
|
+
top: 0,
|
|
1731
|
+
bottom: 0,
|
|
1732
|
+
backdropFilter: "blur(2px)",
|
|
1733
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1734
|
+
position: "absolute"
|
|
1735
|
+
}), /* @__PURE__ */ React.createElement(Box, {
|
|
1736
|
+
className: "borders",
|
|
1737
|
+
pointerEvents: "none",
|
|
1738
|
+
right: 0,
|
|
1739
|
+
width: "4",
|
|
1740
|
+
top: 0,
|
|
1741
|
+
bottom: 0,
|
|
1742
|
+
backdropFilter: "blur(2px)",
|
|
1743
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1744
|
+
position: "absolute"
|
|
1745
|
+
}), /* @__PURE__ */ React.createElement(Box, {
|
|
1746
|
+
className: "borders",
|
|
1747
|
+
pointerEvents: "none",
|
|
1748
|
+
top: 0,
|
|
1749
|
+
height: "16",
|
|
1750
|
+
left: 0,
|
|
1751
|
+
right: 0,
|
|
1752
|
+
backdropFilter: "blur(2px)",
|
|
1753
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1754
|
+
position: "absolute"
|
|
1755
|
+
}), /* @__PURE__ */ React.createElement(Box, {
|
|
1756
|
+
className: "borders",
|
|
1757
|
+
pointerEvents: "none",
|
|
1758
|
+
bottom: 0,
|
|
1759
|
+
height: "4",
|
|
1760
|
+
left: 0,
|
|
1761
|
+
right: 0,
|
|
1762
|
+
backdropFilter: "blur(2px)",
|
|
1763
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1764
|
+
position: "absolute"
|
|
1765
|
+
}), /* @__PURE__ */ React.createElement(Version, {
|
|
1766
|
+
version: snapshot.head,
|
|
1767
|
+
node: target
|
|
1768
|
+
}, {
|
|
1769
|
+
left: /* @__PURE__ */ React.createElement(HStack, {
|
|
1770
|
+
justifyContent: "space-between"
|
|
1771
|
+
}, /* @__PURE__ */ React.createElement(EditorUIUndo, {
|
|
1772
|
+
size: "sm",
|
|
1773
|
+
editor: status == "ready" ? editor : null
|
|
1774
|
+
}), /* @__PURE__ */ React.createElement(EditorUIMode, {
|
|
1775
|
+
size: "sm"
|
|
1776
|
+
})),
|
|
1777
|
+
middle: /* @__PURE__ */ React.createElement(VersionStatusList, null)
|
|
1778
|
+
})))
|
|
1779
|
+
})))));
|
|
1720
1780
|
}
|
|
1721
1781
|
isReadyToLoad() {
|
|
1722
1782
|
return this.props.component != null && this.props.version != null;
|
|
@@ -1745,8 +1805,12 @@ var FEAASPicker = class extends FEAASBase {
|
|
|
1745
1805
|
load() {
|
|
1746
1806
|
return import(this.formatURL(this.props.src, this.props.frontend));
|
|
1747
1807
|
}
|
|
1748
|
-
renderReact({ context, mode, children }, { Picker, React, ReactDOM }) {
|
|
1749
|
-
return
|
|
1808
|
+
renderReact({ context, mode, children }, { Picker, React: React2, ReactDOM }) {
|
|
1809
|
+
return /* @__PURE__ */ React2.createElement(Picker, {
|
|
1810
|
+
mode: mode || void 0,
|
|
1811
|
+
onClose: this.props.onClose,
|
|
1812
|
+
context
|
|
1813
|
+
}, children);
|
|
1750
1814
|
}
|
|
1751
1815
|
};
|
|
1752
1816
|
FEAASPicker.register("feaas-picker");
|
|
@@ -1845,19 +1909,25 @@ var FEAASContext = class extends FEAASBase {
|
|
|
1845
1909
|
containerRef: { current: this.getRoot() }
|
|
1846
1910
|
}
|
|
1847
1911
|
};
|
|
1848
|
-
return
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
cssVarsRoot: ":host",
|
|
1854
|
-
resetCSS: true,
|
|
1855
|
-
toastOptions: {
|
|
1912
|
+
return /* @__PURE__ */ React.createElement(AppContext, {
|
|
1913
|
+
libraryId: this.props.library,
|
|
1914
|
+
container: this.getRoot(),
|
|
1915
|
+
getTheme: this.getTheme,
|
|
1916
|
+
modalProps: {
|
|
1856
1917
|
portalProps: {
|
|
1857
1918
|
containerRef: { current: this.getRoot() }
|
|
1858
1919
|
}
|
|
1920
|
+
},
|
|
1921
|
+
chakraProps: {
|
|
1922
|
+
cssVarsRoot: ":host",
|
|
1923
|
+
resetCSS: true,
|
|
1924
|
+
toastOptions: {
|
|
1925
|
+
portalProps: {
|
|
1926
|
+
containerRef: { current: this.getRoot() }
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1859
1929
|
}
|
|
1860
|
-
}
|
|
1930
|
+
}, children);
|
|
1861
1931
|
}
|
|
1862
1932
|
};
|
|
1863
1933
|
FEAASContext.observedAttributes = ["library", "component", "version", "revision", "hostname", "template"];
|
package/dist/node/index.js
CHANGED
|
@@ -1201,13 +1201,13 @@ var FEAASBase = class extends HTMLElement {
|
|
|
1201
1201
|
console.log("FEAAS: React", this.tagName, this.payload);
|
|
1202
1202
|
if (this.payload == null)
|
|
1203
1203
|
return;
|
|
1204
|
-
const { React, ReactDOM } = this.payload || {};
|
|
1205
|
-
if (!
|
|
1204
|
+
const { React: React2, ReactDOM } = this.payload || {};
|
|
1205
|
+
if (!React2)
|
|
1206
1206
|
throw new Error(`${this.tagName}: React is not present in payload`);
|
|
1207
1207
|
if (!ReactDOM)
|
|
1208
1208
|
throw new Error(`${this.tagName}: ReactDOM is not present in payload`);
|
|
1209
1209
|
if (!this.refs.topReact && !this.forceUpdateReact) {
|
|
1210
|
-
ReactDOM.render(
|
|
1210
|
+
ReactDOM.render(React2.createElement(this.getReactWrapper()), this.getReactRoot());
|
|
1211
1211
|
} else if (this.forceUpdateReact) {
|
|
1212
1212
|
(_a = this.forceUpdateReact) == null ? void 0 : _a.call(this);
|
|
1213
1213
|
} else {
|
|
@@ -1215,11 +1215,11 @@ var FEAASBase = class extends HTMLElement {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
1217
|
invokeReactRendering() {
|
|
1218
|
-
const { React, ReactDOM } = this.payload || {};
|
|
1218
|
+
const { React: React2, ReactDOM } = this.payload || {};
|
|
1219
1219
|
const children = this.descendants.filter((r) => {
|
|
1220
1220
|
return r.refs.parentReact == this && r.payload;
|
|
1221
1221
|
}).map((child, index) => {
|
|
1222
|
-
return
|
|
1222
|
+
return React2.createElement(this.getReactWrapper(child), {
|
|
1223
1223
|
key: this.tagName + "-" + index,
|
|
1224
1224
|
slot: child.getAttribute("slot")
|
|
1225
1225
|
});
|
|
@@ -1229,13 +1229,10 @@ var FEAASBase = class extends HTMLElement {
|
|
|
1229
1229
|
getReactWrapper(target = this, displayName = target.tagName) {
|
|
1230
1230
|
const Wrapper = target.reactWrapper || (target.reactWrapper = (props) => {
|
|
1231
1231
|
if (target.renderReact) {
|
|
1232
|
-
const { React, ReactDOM } = target.payload || {};
|
|
1233
|
-
const [value, forceUpdateReact] =
|
|
1232
|
+
const { React: React2, ReactDOM } = target.payload || {};
|
|
1233
|
+
const [value, forceUpdateReact] = React2.useReducer((r) => r + 1, 0);
|
|
1234
1234
|
target.forceUpdateReact = forceUpdateReact;
|
|
1235
|
-
return ReactDOM.createPortal(
|
|
1236
|
-
React.createElement(React.Fragment, null, target.invokeReactRendering()),
|
|
1237
|
-
target.getReactRoot()
|
|
1238
|
-
);
|
|
1235
|
+
return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(React2.Fragment, null, target.invokeReactRendering()), target.getReactRoot());
|
|
1239
1236
|
} else {
|
|
1240
1237
|
return target.render();
|
|
1241
1238
|
}
|
|
@@ -1640,32 +1637,95 @@ var FEAASEditor = class extends FEAASBase {
|
|
|
1640
1637
|
}, [observedVersions]);
|
|
1641
1638
|
if (!component)
|
|
1642
1639
|
return;
|
|
1643
|
-
return useSlots(children, ({ picker, children: children2 }) =>
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1640
|
+
return useSlots(children, ({ picker, children: children2 }) => /* @__PURE__ */ React.createElement(Box, {
|
|
1641
|
+
ref: (el) => this.wrapper = el
|
|
1642
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
|
1643
|
+
className: "editor-wrapper",
|
|
1644
|
+
position: "absolute",
|
|
1645
|
+
left: 0,
|
|
1646
|
+
top: 0
|
|
1647
|
+
}, /* @__PURE__ */ React.createElement(Editor, {
|
|
1648
|
+
sdk,
|
|
1649
|
+
library: sdk.library,
|
|
1650
|
+
component,
|
|
1651
|
+
versions,
|
|
1652
|
+
context: {
|
|
1653
|
+
onChromeMeasure: this.onMeasure,
|
|
1654
|
+
onChromeBeforeMeasure: this.onBeforeMeasure,
|
|
1655
|
+
onChromeMeasureElement: this.onChromeMeasureElement,
|
|
1656
|
+
onChromePosition: this.onPosition
|
|
1657
|
+
}
|
|
1658
|
+
}, ({ editor, status, isArchivedDisplayed }) => ({
|
|
1649
1659
|
after: children2,
|
|
1650
1660
|
picker,
|
|
1651
|
-
chrome: editor &&
|
|
1661
|
+
chrome: editor && /* @__PURE__ */ React.createElement(Chrome, null),
|
|
1652
1662
|
children: component.reduceVersionRevisions(versions).filter((snapshot) => {
|
|
1653
1663
|
var _a;
|
|
1654
1664
|
return isArchivedDisplayed || !((_a = snapshot.saved || snapshot.draft) == null ? void 0 : _a.deletedAt);
|
|
1655
|
-
}).map((snapshot, index) =>
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1665
|
+
}).map((snapshot, index) => /* @__PURE__ */ React.createElement(Box, {
|
|
1666
|
+
key: snapshot.head.id,
|
|
1667
|
+
position: "absolute",
|
|
1668
|
+
left: 0,
|
|
1669
|
+
top: 0,
|
|
1670
|
+
className: "editor-chrome",
|
|
1671
|
+
p: 4,
|
|
1672
|
+
boxShadow: "2xl",
|
|
1673
|
+
pointerEvents: "none"
|
|
1674
|
+
}, /* @__PURE__ */ React.createElement(Box, {
|
|
1675
|
+
className: "borders",
|
|
1676
|
+
pointerEvents: "none",
|
|
1677
|
+
left: 0,
|
|
1678
|
+
width: "4",
|
|
1679
|
+
top: 0,
|
|
1680
|
+
bottom: 0,
|
|
1681
|
+
backdropFilter: "blur(2px)",
|
|
1682
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1683
|
+
position: "absolute"
|
|
1684
|
+
}), /* @__PURE__ */ React.createElement(Box, {
|
|
1685
|
+
className: "borders",
|
|
1686
|
+
pointerEvents: "none",
|
|
1687
|
+
right: 0,
|
|
1688
|
+
width: "4",
|
|
1689
|
+
top: 0,
|
|
1690
|
+
bottom: 0,
|
|
1691
|
+
backdropFilter: "blur(2px)",
|
|
1692
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1693
|
+
position: "absolute"
|
|
1694
|
+
}), /* @__PURE__ */ React.createElement(Box, {
|
|
1695
|
+
className: "borders",
|
|
1696
|
+
pointerEvents: "none",
|
|
1697
|
+
top: 0,
|
|
1698
|
+
height: "16",
|
|
1699
|
+
left: 0,
|
|
1700
|
+
right: 0,
|
|
1701
|
+
backdropFilter: "blur(2px)",
|
|
1702
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1703
|
+
position: "absolute"
|
|
1704
|
+
}), /* @__PURE__ */ React.createElement(Box, {
|
|
1705
|
+
className: "borders",
|
|
1706
|
+
pointerEvents: "none",
|
|
1707
|
+
bottom: 0,
|
|
1708
|
+
height: "4",
|
|
1709
|
+
left: 0,
|
|
1710
|
+
right: 0,
|
|
1711
|
+
backdropFilter: "blur(2px)",
|
|
1712
|
+
background: "rgb(244 244 244 / 80%)",
|
|
1713
|
+
position: "absolute"
|
|
1714
|
+
}), /* @__PURE__ */ React.createElement(Version, {
|
|
1715
|
+
version: snapshot.head,
|
|
1716
|
+
node: target
|
|
1717
|
+
}, {
|
|
1718
|
+
left: /* @__PURE__ */ React.createElement(HStack, {
|
|
1719
|
+
justifyContent: "space-between"
|
|
1720
|
+
}, /* @__PURE__ */ React.createElement(EditorUIUndo, {
|
|
1721
|
+
size: "sm",
|
|
1722
|
+
editor: status == "ready" ? editor : null
|
|
1723
|
+
}), /* @__PURE__ */ React.createElement(EditorUIMode, {
|
|
1724
|
+
size: "sm"
|
|
1725
|
+
})),
|
|
1726
|
+
middle: /* @__PURE__ */ React.createElement(VersionStatusList, null)
|
|
1727
|
+
})))
|
|
1728
|
+
})))));
|
|
1669
1729
|
}
|
|
1670
1730
|
isReadyToLoad() {
|
|
1671
1731
|
return this.props.component != null && this.props.version != null;
|
|
@@ -1694,8 +1754,12 @@ var FEAASPicker = class extends FEAASBase {
|
|
|
1694
1754
|
load() {
|
|
1695
1755
|
return import(this.formatURL(this.props.src, this.props.frontend));
|
|
1696
1756
|
}
|
|
1697
|
-
renderReact({ context, mode, children }, { Picker, React, ReactDOM }) {
|
|
1698
|
-
return
|
|
1757
|
+
renderReact({ context, mode, children }, { Picker, React: React2, ReactDOM }) {
|
|
1758
|
+
return /* @__PURE__ */ React2.createElement(Picker, {
|
|
1759
|
+
mode: mode || void 0,
|
|
1760
|
+
onClose: this.props.onClose,
|
|
1761
|
+
context
|
|
1762
|
+
}, children);
|
|
1699
1763
|
}
|
|
1700
1764
|
};
|
|
1701
1765
|
FEAASPicker.register("feaas-picker");
|
|
@@ -1794,19 +1858,25 @@ var FEAASContext = class extends FEAASBase {
|
|
|
1794
1858
|
containerRef: { current: this.getRoot() }
|
|
1795
1859
|
}
|
|
1796
1860
|
};
|
|
1797
|
-
return
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
cssVarsRoot: ":host",
|
|
1803
|
-
resetCSS: true,
|
|
1804
|
-
toastOptions: {
|
|
1861
|
+
return /* @__PURE__ */ React.createElement(AppContext, {
|
|
1862
|
+
libraryId: this.props.library,
|
|
1863
|
+
container: this.getRoot(),
|
|
1864
|
+
getTheme: this.getTheme,
|
|
1865
|
+
modalProps: {
|
|
1805
1866
|
portalProps: {
|
|
1806
1867
|
containerRef: { current: this.getRoot() }
|
|
1807
1868
|
}
|
|
1869
|
+
},
|
|
1870
|
+
chakraProps: {
|
|
1871
|
+
cssVarsRoot: ":host",
|
|
1872
|
+
resetCSS: true,
|
|
1873
|
+
toastOptions: {
|
|
1874
|
+
portalProps: {
|
|
1875
|
+
containerRef: { current: this.getRoot() }
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1808
1878
|
}
|
|
1809
|
-
}
|
|
1879
|
+
}, children);
|
|
1810
1880
|
}
|
|
1811
1881
|
};
|
|
1812
1882
|
FEAASContext.observedAttributes = ["library", "component", "version", "revision", "hostname", "template"];
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-feaas/clientside",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "webpack serve --open",
|
|
6
6
|
"build": "rm -rf dist; npm run build:node; npm run build:browser;",
|
|
7
|
-
"build:node": "tsc --build; tsup --entry.index src/index.ts --entry.basic src/basic.ts --target es6 --format cjs,esm -d dist/node",
|
|
8
|
-
"build:browser": "tsc --build; tsup --entry.index src/index.ts --entry.basic src/basic.ts --target es6 --format cjs,esm -d dist/browser --minify",
|
|
7
|
+
"build:node": "tsc --build; tsup --entry.index src/index.ts --entry.basic src/basic.ts --target es6 --format cjs,esm -d dist/node --tsconfig tsconfig.tsup.json",
|
|
8
|
+
"build:browser": "tsc --build; tsup --entry.index src/index.ts --entry.basic src/basic.ts --target es6 --format cjs,esm -d dist/browser--tsconfig tsconfig.tsup.json --minify",
|
|
9
9
|
"watch": "tsup --entry.index src/index.ts --entry.basic src/basic.ts --target es6 --format esm -d dist/node --watch",
|
|
10
10
|
"test": "npx vitest --config ../frontend/vite.config.ts $FLAGS",
|
|
11
11
|
"test:watch": "npx vitest --config ../frontend/vite.config.ts",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"tsup": {
|
|
25
25
|
"platform": "browser",
|
|
26
26
|
"dts": false,
|
|
27
|
+
"jsx": "React",
|
|
27
28
|
"splitting": false,
|
|
28
29
|
"external": [
|
|
29
30
|
"node-fetch"
|
|
@@ -186,10 +186,7 @@ export class FEAASBase<Props = any, Payload = any> extends HTMLElement {
|
|
|
186
186
|
const { React, ReactDOM } = (target.payload as ReactPayload) || {}
|
|
187
187
|
const [value, forceUpdateReact] = React.useReducer((r) => r + 1, 0)
|
|
188
188
|
target.forceUpdateReact = forceUpdateReact
|
|
189
|
-
return ReactDOM.createPortal(
|
|
190
|
-
React.createElement(React.Fragment, null, target.invokeReactRendering()),
|
|
191
|
-
target.getReactRoot()
|
|
192
|
-
)
|
|
189
|
+
return ReactDOM.createPortal(<>{target.invokeReactRendering()}</>, target.getReactRoot())
|
|
193
190
|
} else {
|
|
194
191
|
return target.render()
|
|
195
192
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"jsx": "react",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"tsBuildInfoFile": "./types/tsbuildinfo",
|
|
9
|
+
"declarationDir": "./types"
|
|
10
|
+
},
|
|
11
|
+
"references": [
|
|
12
|
+
{
|
|
13
|
+
"path": "../sdk"
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
17
|
+
"exclude": ["scripts/**", "test/**", "types/**", "build/**", "dist/**", "node_modules/**"]
|
|
18
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FEAASBase } from './FEAASBase.js';
|
|
2
2
|
export declare function FEAASStylesheetProps(element?: FEAASBase): {
|
|
3
3
|
library: string;
|
|
4
|
-
revision: number | "
|
|
4
|
+
revision: number | "staging" | "published" | "saved";
|
|
5
5
|
cdn: string;
|
|
6
6
|
};
|
|
7
7
|
export declare type FEAASStylesheetProps = ReturnType<typeof FEAASStylesheetProps>;
|
|
@@ -9,7 +9,7 @@ export declare class FEAASStylesheet extends FEAASBase<FEAASStylesheetProps, str
|
|
|
9
9
|
stylesheet: HTMLStyleElement;
|
|
10
10
|
getProps(): {
|
|
11
11
|
library: string;
|
|
12
|
-
revision: number | "
|
|
12
|
+
revision: number | "staging" | "published" | "saved";
|
|
13
13
|
cdn: string;
|
|
14
14
|
};
|
|
15
15
|
isReadyToLoad(): boolean;
|