@sitecore-feaas/clientside 0.1.1 → 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 -1
- package/dist/node/basic.js +1 -1
- package/dist/node/index.cjs +113 -40
- package/dist/node/index.js +113 -40
- package/package.json +4 -3
- package/src/components/FEAASBase.tsx +1 -1
- 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,10 +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(
|
|
1286
|
+
return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(React2.Fragment, null, target.invokeReactRendering()), target.getReactRoot());
|
|
1287
1287
|
} else {
|
|
1288
1288
|
return target.render();
|
|
1289
1289
|
}
|
|
@@ -1688,32 +1688,95 @@ var FEAASEditor = class extends FEAASBase {
|
|
|
1688
1688
|
}, [observedVersions]);
|
|
1689
1689
|
if (!component)
|
|
1690
1690
|
return;
|
|
1691
|
-
return useSlots(children, ({ picker, children: children2 }) =>
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
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 }) => ({
|
|
1697
1710
|
after: children2,
|
|
1698
1711
|
picker,
|
|
1699
|
-
chrome: editor &&
|
|
1712
|
+
chrome: editor && /* @__PURE__ */ React.createElement(Chrome, null),
|
|
1700
1713
|
children: component.reduceVersionRevisions(versions).filter((snapshot) => {
|
|
1701
1714
|
var _a;
|
|
1702
1715
|
return isArchivedDisplayed || !((_a = snapshot.saved || snapshot.draft) == null ? void 0 : _a.deletedAt);
|
|
1703
|
-
}).map((snapshot, index) =>
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
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
|
+
})))));
|
|
1717
1780
|
}
|
|
1718
1781
|
isReadyToLoad() {
|
|
1719
1782
|
return this.props.component != null && this.props.version != null;
|
|
@@ -1742,8 +1805,12 @@ var FEAASPicker = class extends FEAASBase {
|
|
|
1742
1805
|
load() {
|
|
1743
1806
|
return import(this.formatURL(this.props.src, this.props.frontend));
|
|
1744
1807
|
}
|
|
1745
|
-
renderReact({ context, mode, children }, { Picker, React, ReactDOM }) {
|
|
1746
|
-
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);
|
|
1747
1814
|
}
|
|
1748
1815
|
};
|
|
1749
1816
|
FEAASPicker.register("feaas-picker");
|
|
@@ -1842,19 +1909,25 @@ var FEAASContext = class extends FEAASBase {
|
|
|
1842
1909
|
containerRef: { current: this.getRoot() }
|
|
1843
1910
|
}
|
|
1844
1911
|
};
|
|
1845
|
-
return
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
cssVarsRoot: ":host",
|
|
1851
|
-
resetCSS: true,
|
|
1852
|
-
toastOptions: {
|
|
1912
|
+
return /* @__PURE__ */ React.createElement(AppContext, {
|
|
1913
|
+
libraryId: this.props.library,
|
|
1914
|
+
container: this.getRoot(),
|
|
1915
|
+
getTheme: this.getTheme,
|
|
1916
|
+
modalProps: {
|
|
1853
1917
|
portalProps: {
|
|
1854
1918
|
containerRef: { current: this.getRoot() }
|
|
1855
1919
|
}
|
|
1920
|
+
},
|
|
1921
|
+
chakraProps: {
|
|
1922
|
+
cssVarsRoot: ":host",
|
|
1923
|
+
resetCSS: true,
|
|
1924
|
+
toastOptions: {
|
|
1925
|
+
portalProps: {
|
|
1926
|
+
containerRef: { current: this.getRoot() }
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1856
1929
|
}
|
|
1857
|
-
}
|
|
1930
|
+
}, children);
|
|
1858
1931
|
}
|
|
1859
1932
|
};
|
|
1860
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,10 +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(
|
|
1235
|
+
return ReactDOM.createPortal(/* @__PURE__ */ React2.createElement(React2.Fragment, null, target.invokeReactRendering()), target.getReactRoot());
|
|
1236
1236
|
} else {
|
|
1237
1237
|
return target.render();
|
|
1238
1238
|
}
|
|
@@ -1637,32 +1637,95 @@ var FEAASEditor = class extends FEAASBase {
|
|
|
1637
1637
|
}, [observedVersions]);
|
|
1638
1638
|
if (!component)
|
|
1639
1639
|
return;
|
|
1640
|
-
return useSlots(children, ({ picker, children: children2 }) =>
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
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 }) => ({
|
|
1646
1659
|
after: children2,
|
|
1647
1660
|
picker,
|
|
1648
|
-
chrome: editor &&
|
|
1661
|
+
chrome: editor && /* @__PURE__ */ React.createElement(Chrome, null),
|
|
1649
1662
|
children: component.reduceVersionRevisions(versions).filter((snapshot) => {
|
|
1650
1663
|
var _a;
|
|
1651
1664
|
return isArchivedDisplayed || !((_a = snapshot.saved || snapshot.draft) == null ? void 0 : _a.deletedAt);
|
|
1652
|
-
}).map((snapshot, index) =>
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
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
|
+
})))));
|
|
1666
1729
|
}
|
|
1667
1730
|
isReadyToLoad() {
|
|
1668
1731
|
return this.props.component != null && this.props.version != null;
|
|
@@ -1691,8 +1754,12 @@ var FEAASPicker = class extends FEAASBase {
|
|
|
1691
1754
|
load() {
|
|
1692
1755
|
return import(this.formatURL(this.props.src, this.props.frontend));
|
|
1693
1756
|
}
|
|
1694
|
-
renderReact({ context, mode, children }, { Picker, React, ReactDOM }) {
|
|
1695
|
-
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);
|
|
1696
1763
|
}
|
|
1697
1764
|
};
|
|
1698
1765
|
FEAASPicker.register("feaas-picker");
|
|
@@ -1791,19 +1858,25 @@ var FEAASContext = class extends FEAASBase {
|
|
|
1791
1858
|
containerRef: { current: this.getRoot() }
|
|
1792
1859
|
}
|
|
1793
1860
|
};
|
|
1794
|
-
return
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
cssVarsRoot: ":host",
|
|
1800
|
-
resetCSS: true,
|
|
1801
|
-
toastOptions: {
|
|
1861
|
+
return /* @__PURE__ */ React.createElement(AppContext, {
|
|
1862
|
+
libraryId: this.props.library,
|
|
1863
|
+
container: this.getRoot(),
|
|
1864
|
+
getTheme: this.getTheme,
|
|
1865
|
+
modalProps: {
|
|
1802
1866
|
portalProps: {
|
|
1803
1867
|
containerRef: { current: this.getRoot() }
|
|
1804
1868
|
}
|
|
1869
|
+
},
|
|
1870
|
+
chakraProps: {
|
|
1871
|
+
cssVarsRoot: ":host",
|
|
1872
|
+
resetCSS: true,
|
|
1873
|
+
toastOptions: {
|
|
1874
|
+
portalProps: {
|
|
1875
|
+
containerRef: { current: this.getRoot() }
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1805
1878
|
}
|
|
1806
|
-
}
|
|
1879
|
+
}, children);
|
|
1807
1880
|
}
|
|
1808
1881
|
};
|
|
1809
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,7 +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(
|
|
189
|
+
return ReactDOM.createPortal(<>{target.invokeReactRendering()}</>, target.getReactRoot())
|
|
190
190
|
} else {
|
|
191
191
|
return target.render()
|
|
192
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;
|