@makeswift/runtime 0.0.3 → 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.
Files changed (30) hide show
  1. package/dist/components.cjs.js +2 -0
  2. package/dist/components.cjs.js.map +1 -1
  3. package/dist/components.es.js +2 -0
  4. package/dist/components.es.js.map +1 -1
  5. package/dist/descriptors.cjs.js.map +1 -1
  6. package/dist/descriptors.es.js.map +1 -1
  7. package/dist/index.cjs.js +96 -8
  8. package/dist/index.cjs.js.map +1 -1
  9. package/dist/index.es.js +99 -11
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/next.cjs.js +2 -0
  12. package/dist/next.cjs.js.map +1 -1
  13. package/dist/next.es.js +2 -0
  14. package/dist/next.es.js.map +1 -1
  15. package/dist/react.cjs.js +2 -0
  16. package/dist/react.cjs.js.map +1 -1
  17. package/dist/react.es.js +2 -0
  18. package/dist/react.es.js.map +1 -1
  19. package/dist/types/components/builtin/Navigation/Navigation.d.ts.map +1 -1
  20. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts +1 -1
  21. package/dist/types/components/builtin/Navigation/components/DropDownButton/index.d.ts.map +1 -1
  22. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts +1 -1
  23. package/dist/types/components/builtin/Navigation/components/MobileMenu/components/MobileDropDownButton/index.d.ts.map +1 -1
  24. package/dist/types/components/builtin/Navigation/components/MobileMenu/index.d.ts.map +1 -1
  25. package/dist/types/prop-controllers/descriptors.d.ts +1 -1
  26. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -1
  27. package/dist/types/runtimes/react/find-dom-node.d.ts +7 -0
  28. package/dist/types/runtimes/react/find-dom-node.d.ts.map +1 -0
  29. package/dist/types/runtimes/react/index.d.ts.map +1 -1
  30. package/package.json +3 -1
package/dist/index.es.js CHANGED
@@ -34,7 +34,8 @@ var __publicField = (obj, key, value) => {
34
34
  return value;
35
35
  };
36
36
  import * as React from "react";
37
- import { forwardRef, createContext, useContext, useMemo, useState, useLayoutEffect, useCallback, useEffect, useRef, useImperativeHandle, Children, createElement, Fragment as Fragment$1, memo } from "react";
37
+ import { forwardRef, createContext, useContext, useMemo, useState, useLayoutEffect, useCallback, useEffect, useRef, useImperativeHandle, Children, createElement, Fragment as Fragment$1, Component, memo } from "react";
38
+ import { isForwardRef } from "react-is";
38
39
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
39
40
  import { gql, useQuery as useQuery$1, useMutation as useMutation$1, ApolloClient, InMemoryCache } from "@apollo/client";
40
41
  import { a as createDocumentReference, g as getComponentPropControllerDescriptors, b as getIsInBuilder, d as configureStore, e as getElementId, f as getReactComponent, h as getDocument, i as isElementReference, c as createDocument } from "./react-page.es.js";
@@ -64,6 +65,7 @@ import ipsum from "corporate-ipsum";
64
65
  import { Editor } from "slate-react";
65
66
  import Lists from "@convertkit/slate-lists";
66
67
  import { a as StyleControlProperty, S as StyleControlType } from "./style.es.js";
68
+ import { findDOMNode } from "react-dom";
67
69
  const PlaceholderBase$1 = styled.div`
68
70
  width: 100%;
69
71
  background: rgba(161, 168, 194, 0.18);
@@ -5628,11 +5630,15 @@ function DropDownButton(_U) {
5628
5630
  var _V = _U, {
5629
5631
  label,
5630
5632
  caret = "caret",
5631
- links: links2 = []
5633
+ links: links2 = [],
5634
+ textColor,
5635
+ color
5632
5636
  } = _V, restOfProps = __objRest(_V, [
5633
5637
  "label",
5634
5638
  "caret",
5635
- "links"
5639
+ "links",
5640
+ "textColor",
5641
+ "color"
5636
5642
  ]);
5637
5643
  const container = useRef(null);
5638
5644
  const [position, setPosition] = useState("left");
@@ -5646,6 +5652,8 @@ function DropDownButton(_U) {
5646
5652
  return /* @__PURE__ */ jsxs(DropDownContainer, {
5647
5653
  ref: container,
5648
5654
  children: [/* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
5655
+ textColor: useColor(textColor),
5656
+ color: useColor(color),
5649
5657
  children: /* @__PURE__ */ jsxs("div", {
5650
5658
  style: {
5651
5659
  display: "flex",
@@ -5735,16 +5743,22 @@ function MobileDropDownButton(_Y) {
5735
5743
  caret,
5736
5744
  links: links2 = [],
5737
5745
  onClose = () => {
5738
- }
5746
+ },
5747
+ color,
5748
+ textColor
5739
5749
  } = _Z, restOfProps = __objRest(_Z, [
5740
5750
  "label",
5741
5751
  "caret",
5742
5752
  "links",
5743
- "onClose"
5753
+ "onClose",
5754
+ "color",
5755
+ "textColor"
5744
5756
  ]);
5745
5757
  const [isOpen, setIsOpen] = useState(false);
5746
5758
  return /* @__PURE__ */ jsxs(Fragment, {
5747
5759
  children: [/* @__PURE__ */ jsx(ButtonLink$1, __spreadProps(__spreadValues({}, restOfProps), {
5760
+ textColor: useColor(textColor),
5761
+ color: useColor(color),
5748
5762
  onPointerDown: () => setIsOpen((prev) => !prev),
5749
5763
  children: /* @__PURE__ */ jsxs("div", {
5750
5764
  style: {
@@ -5778,7 +5792,20 @@ function MobileDropDownButton(_Y) {
5778
5792
  })]
5779
5793
  });
5780
5794
  }
5781
- const ButtonLink = styled(Button$1)`
5795
+ function NavigationButton$1(props) {
5796
+ const _a = props, {
5797
+ textColor,
5798
+ color
5799
+ } = _a, restOfProps = __objRest(_a, [
5800
+ "textColor",
5801
+ "color"
5802
+ ]);
5803
+ return /* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
5804
+ textColor: useColor(textColor),
5805
+ color: useColor(color)
5806
+ }));
5807
+ }
5808
+ const ButtonLink = styled(NavigationButton$1)`
5782
5809
  margin: 8px 0;
5783
5810
  `;
5784
5811
  const Container$3 = styled.div`
@@ -5891,6 +5918,19 @@ const OpenIconContainer = styled.button`
5891
5918
  color: ${color == null ? "rgba(161, 168, 194, 0.5)" : colorToString(color)};
5892
5919
  `)}
5893
5920
  `;
5921
+ function NavigationButton(props) {
5922
+ const _a = props, {
5923
+ textColor,
5924
+ color
5925
+ } = _a, restOfProps = __objRest(_a, [
5926
+ "textColor",
5927
+ "color"
5928
+ ]);
5929
+ return /* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, restOfProps), {
5930
+ textColor: useColor(textColor),
5931
+ color: useColor(color)
5932
+ }));
5933
+ }
5894
5934
  const placeholder = {
5895
5935
  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",
5896
5936
  dimensions: {
@@ -5942,7 +5982,7 @@ const Navigation = forwardRef(function Navigation2({
5942
5982
  gutter,
5943
5983
  first: i === 0,
5944
5984
  last: i === links2.length - 1,
5945
- children: [link.type === "button" && /* @__PURE__ */ jsx(Button$1, __spreadProps(__spreadValues({}, link.payload), {
5985
+ children: [link.type === "button" && /* @__PURE__ */ jsx(NavigationButton, __spreadProps(__spreadValues({}, link.payload), {
5946
5986
  children: link.payload.label
5947
5987
  })), link.type === "dropdown" && /* @__PURE__ */ jsx(DropDownButton, __spreadValues({}, link.payload))]
5948
5988
  }, link.id)) : /* @__PURE__ */ jsx(LinksPlaceholder, {
@@ -7871,6 +7911,48 @@ function useProps(element) {
7871
7911
  }
7872
7912
  }));
7873
7913
  }
7914
+ function suppressWarningAndFindDomNode(instance) {
7915
+ const error = console.error;
7916
+ console.error = (...args) => {
7917
+ const [msg, ...substitutions] = args;
7918
+ const text = substitutions.reduce((text2, substitution) => text2.replace("%s", substitution), msg);
7919
+ if (!text.includes("findDOMNode is deprecated in StrictMode.")) {
7920
+ error.apply(console, args);
7921
+ }
7922
+ };
7923
+ const foundDomNode = findDOMNode(instance);
7924
+ console.error = error;
7925
+ return foundDomNode;
7926
+ }
7927
+ class FindDomNodeClassComponent extends Component {
7928
+ componentDidMount() {
7929
+ this.setInnerRef(suppressWarningAndFindDomNode(this));
7930
+ }
7931
+ componentDidUpdate() {
7932
+ this.setInnerRef(suppressWarningAndFindDomNode(this));
7933
+ }
7934
+ setInnerRef(current) {
7935
+ const {
7936
+ innerRef
7937
+ } = this.props;
7938
+ if (innerRef == null)
7939
+ return;
7940
+ if (typeof innerRef === "function")
7941
+ innerRef(current);
7942
+ else
7943
+ innerRef.current = current;
7944
+ }
7945
+ render() {
7946
+ return /* @__PURE__ */ jsx(Fragment, {
7947
+ children: this.props.children
7948
+ });
7949
+ }
7950
+ }
7951
+ const FindDomNode = forwardRef(function FindDomNode2(props, ref) {
7952
+ return /* @__PURE__ */ jsx(FindDomNodeClassComponent, __spreadProps(__spreadValues({}, props), {
7953
+ innerRef: ref
7954
+ }));
7955
+ });
7874
7956
  const contextDefaultValue = configureStore();
7875
7957
  function createReactRuntime(store) {
7876
7958
  return {
@@ -8013,18 +8095,24 @@ function useDispatch() {
8013
8095
  const ElementData = memo(forwardRef(function ElementData2({
8014
8096
  elementData
8015
8097
  }, ref) {
8016
- const Component = useComponent(elementData.type);
8098
+ const Component2 = useComponent(elementData.type);
8017
8099
  const props = useProps(elementData);
8018
- if (Component == null) {
8100
+ const forwardsRef = useMemo(() => isForwardRef(Component2), [Component2]);
8101
+ if (Component2 == null) {
8019
8102
  return /* @__PURE__ */ jsx(FallbackComponent, {
8020
8103
  ref,
8021
8104
  text: "Component not found"
8022
8105
  });
8023
8106
  }
8024
- return /* @__PURE__ */ createElement(Component, __spreadProps(__spreadValues({}, props), {
8107
+ return forwardsRef ? /* @__PURE__ */ createElement(Component2, __spreadProps(__spreadValues({}, props), {
8025
8108
  key: elementData.key,
8026
8109
  ref
8027
- }));
8110
+ })) : /* @__PURE__ */ jsx(FindDomNode, {
8111
+ ref,
8112
+ children: /* @__PURE__ */ createElement(Component2, __spreadProps(__spreadValues({}, props), {
8113
+ key: elementData.key
8114
+ }))
8115
+ });
8028
8116
  }));
8029
8117
  const ElementReference = memo(forwardRef(function ElementReference2({
8030
8118
  elementReference