@makeswift/runtime 0.0.1 → 0.0.4
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/Page.cjs.js.map +1 -1
- package/dist/Page.es.js.map +1 -1
- package/dist/components.cjs.js +2 -0
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +2 -0
- package/dist/components.es.js.map +1 -1
- package/dist/descriptors.cjs.js.map +1 -1
- package/dist/descriptors.es.js.map +1 -1
- package/dist/index.cjs.js +97 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +100 -12
- package/dist/index.es.js.map +1 -1
- package/dist/next.cjs.js +2 -0
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +2 -0
- package/dist/next.es.js.map +1 -1
- package/dist/react.cjs.js +2 -0
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +2 -0
- package/dist/react.es.js.map +1 -1
- package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts +1 -1
- package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +1 -1
- package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
- package/dist/types/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
- package/dist/types/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts +2 -13
- package/dist/types/components/builtin/Text/components/RichTextEditor/components/Block/index.d.ts.map +1 -1
- package/dist/types/components/page/Page.d.ts +2 -2
- package/dist/types/components/page/Page.d.ts.map +1 -1
- package/dist/types/prop-controllers/descriptors.d.ts +1 -1
- package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/runtimes/react/find-dom-node.d.ts +7 -0
- package/dist/types/runtimes/react/find-dom-node.d.ts.map +1 -0
- package/dist/types/runtimes/react/index.d.ts.map +1 -1
- package/package.json +9 -8
package/dist/index.cjs.js
CHANGED
|
@@ -35,6 +35,7 @@ var __publicField = (obj, key, value) => {
|
|
|
35
35
|
return value;
|
|
36
36
|
};
|
|
37
37
|
var React = require("react");
|
|
38
|
+
var reactIs = require("react-is");
|
|
38
39
|
var withSelector = require("use-sync-external-store/shim/with-selector");
|
|
39
40
|
var client = require("@apollo/client");
|
|
40
41
|
var reactPage = require("./react-page.cjs.js");
|
|
@@ -64,6 +65,7 @@ var ipsum = require("corporate-ipsum");
|
|
|
64
65
|
var slateReact = require("slate-react");
|
|
65
66
|
var Lists = require("@convertkit/slate-lists");
|
|
66
67
|
var style = require("./style.cjs.js");
|
|
68
|
+
var reactDom = require("react-dom");
|
|
67
69
|
function _interopDefaultLegacy(e) {
|
|
68
70
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
69
71
|
}
|
|
@@ -5662,11 +5664,15 @@ function DropDownButton(_U) {
|
|
|
5662
5664
|
var _V = _U, {
|
|
5663
5665
|
label,
|
|
5664
5666
|
caret = "caret",
|
|
5665
|
-
links: links2 = []
|
|
5667
|
+
links: links2 = [],
|
|
5668
|
+
textColor,
|
|
5669
|
+
color
|
|
5666
5670
|
} = _V, restOfProps = __objRest(_V, [
|
|
5667
5671
|
"label",
|
|
5668
5672
|
"caret",
|
|
5669
|
-
"links"
|
|
5673
|
+
"links",
|
|
5674
|
+
"textColor",
|
|
5675
|
+
"color"
|
|
5670
5676
|
]);
|
|
5671
5677
|
const container = React.useRef(null);
|
|
5672
5678
|
const [position, setPosition] = React.useState("left");
|
|
@@ -5680,6 +5686,8 @@ function DropDownButton(_U) {
|
|
|
5680
5686
|
return /* @__PURE__ */ jsxRuntime.jsxs(DropDownContainer, {
|
|
5681
5687
|
ref: container,
|
|
5682
5688
|
children: [/* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
5689
|
+
textColor: useColor(textColor),
|
|
5690
|
+
color: useColor(color),
|
|
5683
5691
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
5684
5692
|
style: {
|
|
5685
5693
|
display: "flex",
|
|
@@ -5769,16 +5777,22 @@ function MobileDropDownButton(_Y) {
|
|
|
5769
5777
|
caret,
|
|
5770
5778
|
links: links2 = [],
|
|
5771
5779
|
onClose = () => {
|
|
5772
|
-
}
|
|
5780
|
+
},
|
|
5781
|
+
color,
|
|
5782
|
+
textColor
|
|
5773
5783
|
} = _Z, restOfProps = __objRest(_Z, [
|
|
5774
5784
|
"label",
|
|
5775
5785
|
"caret",
|
|
5776
5786
|
"links",
|
|
5777
|
-
"onClose"
|
|
5787
|
+
"onClose",
|
|
5788
|
+
"color",
|
|
5789
|
+
"textColor"
|
|
5778
5790
|
]);
|
|
5779
5791
|
const [isOpen, setIsOpen] = React.useState(false);
|
|
5780
5792
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5781
5793
|
children: [/* @__PURE__ */ jsxRuntime.jsx(ButtonLink$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
5794
|
+
textColor: useColor(textColor),
|
|
5795
|
+
color: useColor(color),
|
|
5782
5796
|
onPointerDown: () => setIsOpen((prev) => !prev),
|
|
5783
5797
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
5784
5798
|
style: {
|
|
@@ -5812,7 +5826,20 @@ function MobileDropDownButton(_Y) {
|
|
|
5812
5826
|
})]
|
|
5813
5827
|
});
|
|
5814
5828
|
}
|
|
5815
|
-
|
|
5829
|
+
function NavigationButton$1(props) {
|
|
5830
|
+
const _a = props, {
|
|
5831
|
+
textColor,
|
|
5832
|
+
color
|
|
5833
|
+
} = _a, restOfProps = __objRest(_a, [
|
|
5834
|
+
"textColor",
|
|
5835
|
+
"color"
|
|
5836
|
+
]);
|
|
5837
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
5838
|
+
textColor: useColor(textColor),
|
|
5839
|
+
color: useColor(color)
|
|
5840
|
+
}));
|
|
5841
|
+
}
|
|
5842
|
+
const ButtonLink = styled__default["default"](NavigationButton$1)`
|
|
5816
5843
|
margin: 8px 0;
|
|
5817
5844
|
`;
|
|
5818
5845
|
const Container$3 = styled__default["default"].div`
|
|
@@ -5925,6 +5952,19 @@ const OpenIconContainer = styled__default["default"].button`
|
|
|
5925
5952
|
color: ${color == null ? "rgba(161, 168, 194, 0.5)" : colorToString(color)};
|
|
5926
5953
|
`)}
|
|
5927
5954
|
`;
|
|
5955
|
+
function NavigationButton(props) {
|
|
5956
|
+
const _a = props, {
|
|
5957
|
+
textColor,
|
|
5958
|
+
color
|
|
5959
|
+
} = _a, restOfProps = __objRest(_a, [
|
|
5960
|
+
"textColor",
|
|
5961
|
+
"color"
|
|
5962
|
+
]);
|
|
5963
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
|
|
5964
|
+
textColor: useColor(textColor),
|
|
5965
|
+
color: useColor(color)
|
|
5966
|
+
}));
|
|
5967
|
+
}
|
|
5928
5968
|
const placeholder = {
|
|
5929
5969
|
src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='93.12' height='36' viewBox='0 0 93.12 36'%3E%3Cg id='Layer_2' data-name='Layer 2'%3E%3Cg id='Layer_1-2' data-name='Layer 1'%3E%3Cpath d='M18,0A18,18,0,1,1,0,18,18,18,0,0,1,18,0ZM49.36,21.94h6.36V24H46.8V10h2.56Zm9.06.72a4.88,4.88,0,0,1-1.64-3.72,5,5,0,0,1,1.64-3.74,5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18l-.26.26a5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Zm10,10.68,1-1.92a5.28,5.28,0,0,0,3.3,1.22,3.6,3.6,0,0,0,2.32-.72,2.73,2.73,0,0,0,.9-2.26V22.5a3.61,3.61,0,0,1-1.45,1.26,4.35,4.35,0,0,1-2,.46,4.57,4.57,0,0,1-3.58-1.54A5.48,5.48,0,0,1,69.2,18.9a5.42,5.42,0,0,1,1.36-3.74,4.64,4.64,0,0,1,3.62-1.5,4,4,0,0,1,3.44,1.72v-1.5h2.46v9a6.13,6.13,0,0,1-1.43,4.46,5.27,5.27,0,0,1-4,1.44,7.09,7.09,0,0,1-4.53-1.42Zm1.54-8.44a3.4,3.4,0,0,0,.82,2.3,2.72,2.72,0,0,0,2.17.94,3.13,3.13,0,0,0,1.21-.22,2.89,2.89,0,0,0,1-.62,3.08,3.08,0,0,0,.63-1,3.62,3.62,0,0,0,.21-1.3,4,4,0,0,0-.23-1.33,3.3,3.3,0,0,0-.63-1.05,2.74,2.74,0,0,0-1-.68,3.35,3.35,0,0,0-1.25-.24,2.92,2.92,0,0,0-1.2.24,2.58,2.58,0,0,0-.93.67,3,3,0,0,0-.59,1,3.89,3.89,0,0,0-.19,1.31ZM83.8,22.66a4.88,4.88,0,0,1-1.64-3.72A5,5,0,0,1,83.8,15.2a5.57,5.57,0,0,1,7.7,0,5.09,5.09,0,0,1,.26,7.18,3.19,3.19,0,0,1-.26.26,5.56,5.56,0,0,1-7.7,0Zm1.68-6a3.39,3.39,0,0,0,0,4.52,3,3,0,0,0,4.24.08l.08-.08a3.39,3.39,0,0,0,0-4.52,3,3,0,0,0-4.24-.08Z' fill='%23a1a8c2' opacity='0.4' style='isolation: isolate'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A",
|
|
5930
5970
|
dimensions: {
|
|
@@ -5976,7 +6016,7 @@ const Navigation = React.forwardRef(function Navigation2({
|
|
|
5976
6016
|
gutter,
|
|
5977
6017
|
first: i === 0,
|
|
5978
6018
|
last: i === links2.length - 1,
|
|
5979
|
-
children: [link.type === "button" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
6019
|
+
children: [link.type === "button" && /* @__PURE__ */ jsxRuntime.jsx(NavigationButton, __spreadProps(__spreadValues({}, link.payload), {
|
|
5980
6020
|
children: link.payload.label
|
|
5981
6021
|
})), link.type === "dropdown" && /* @__PURE__ */ jsxRuntime.jsx(DropDownButton, __spreadValues({}, link.payload))]
|
|
5982
6022
|
}, link.id)) : /* @__PURE__ */ jsxRuntime.jsx(LinksPlaceholder, {
|
|
@@ -7526,7 +7566,7 @@ const Text = React.forwardRef(function Text2({
|
|
|
7526
7566
|
}, [shouldCommit]);
|
|
7527
7567
|
function handleChange(change) {
|
|
7528
7568
|
setValue(change.value);
|
|
7529
|
-
if (change.value
|
|
7569
|
+
if (change.value !== value) {
|
|
7530
7570
|
setShouldCommit(false);
|
|
7531
7571
|
controller == null ? void 0 : controller.onChange(change);
|
|
7532
7572
|
}
|
|
@@ -7905,6 +7945,48 @@ function useProps(element) {
|
|
|
7905
7945
|
}
|
|
7906
7946
|
}));
|
|
7907
7947
|
}
|
|
7948
|
+
function suppressWarningAndFindDomNode(instance) {
|
|
7949
|
+
const error = console.error;
|
|
7950
|
+
console.error = (...args) => {
|
|
7951
|
+
const [msg, ...substitutions] = args;
|
|
7952
|
+
const text = substitutions.reduce((text2, substitution) => text2.replace("%s", substitution), msg);
|
|
7953
|
+
if (!text.includes("findDOMNode is deprecated in StrictMode.")) {
|
|
7954
|
+
error.apply(console, args);
|
|
7955
|
+
}
|
|
7956
|
+
};
|
|
7957
|
+
const foundDomNode = reactDom.findDOMNode(instance);
|
|
7958
|
+
console.error = error;
|
|
7959
|
+
return foundDomNode;
|
|
7960
|
+
}
|
|
7961
|
+
class FindDomNodeClassComponent extends React.Component {
|
|
7962
|
+
componentDidMount() {
|
|
7963
|
+
this.setInnerRef(suppressWarningAndFindDomNode(this));
|
|
7964
|
+
}
|
|
7965
|
+
componentDidUpdate() {
|
|
7966
|
+
this.setInnerRef(suppressWarningAndFindDomNode(this));
|
|
7967
|
+
}
|
|
7968
|
+
setInnerRef(current) {
|
|
7969
|
+
const {
|
|
7970
|
+
innerRef
|
|
7971
|
+
} = this.props;
|
|
7972
|
+
if (innerRef == null)
|
|
7973
|
+
return;
|
|
7974
|
+
if (typeof innerRef === "function")
|
|
7975
|
+
innerRef(current);
|
|
7976
|
+
else
|
|
7977
|
+
innerRef.current = current;
|
|
7978
|
+
}
|
|
7979
|
+
render() {
|
|
7980
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
7981
|
+
children: this.props.children
|
|
7982
|
+
});
|
|
7983
|
+
}
|
|
7984
|
+
}
|
|
7985
|
+
const FindDomNode = React.forwardRef(function FindDomNode2(props, ref) {
|
|
7986
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FindDomNodeClassComponent, __spreadProps(__spreadValues({}, props), {
|
|
7987
|
+
innerRef: ref
|
|
7988
|
+
}));
|
|
7989
|
+
});
|
|
7908
7990
|
const contextDefaultValue = reactPage.configureStore();
|
|
7909
7991
|
function createReactRuntime(store) {
|
|
7910
7992
|
return {
|
|
@@ -8051,16 +8133,22 @@ const ElementData = React.memo(React.forwardRef(function ElementData2({
|
|
|
8051
8133
|
}, ref) {
|
|
8052
8134
|
const Component = useComponent(elementData.type);
|
|
8053
8135
|
const props = useProps(elementData);
|
|
8136
|
+
const forwardsRef = React.useMemo(() => reactIs.isForwardRef(Component), [Component]);
|
|
8054
8137
|
if (Component == null) {
|
|
8055
8138
|
return /* @__PURE__ */ jsxRuntime.jsx(FallbackComponent, {
|
|
8056
8139
|
ref,
|
|
8057
8140
|
text: "Component not found"
|
|
8058
8141
|
});
|
|
8059
8142
|
}
|
|
8060
|
-
return /* @__PURE__ */ React.createElement(Component, __spreadProps(__spreadValues({}, props), {
|
|
8143
|
+
return forwardsRef ? /* @__PURE__ */ React.createElement(Component, __spreadProps(__spreadValues({}, props), {
|
|
8061
8144
|
key: elementData.key,
|
|
8062
8145
|
ref
|
|
8063
|
-
}))
|
|
8146
|
+
})) : /* @__PURE__ */ jsxRuntime.jsx(FindDomNode, {
|
|
8147
|
+
ref,
|
|
8148
|
+
children: /* @__PURE__ */ React.createElement(Component, __spreadProps(__spreadValues({}, props), {
|
|
8149
|
+
key: elementData.key
|
|
8150
|
+
}))
|
|
8151
|
+
});
|
|
8064
8152
|
}));
|
|
8065
8153
|
const ElementReference = React.memo(React.forwardRef(function ElementReference2({
|
|
8066
8154
|
elementReference
|