@makeswift/runtime 0.0.7 → 0.0.10

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.
@@ -33,6 +33,7 @@ require("polished");
33
33
  require("react-player");
34
34
  require("slate-hotkeys");
35
35
  require("corporate-ipsum");
36
+ require("is-hotkey");
36
37
  require("slate-react");
37
38
  require("@convertkit/slate-lists");
38
39
  require("./text-input.cjs.js");
@@ -1 +1 @@
1
- {"version":3,"file":"components.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -31,6 +31,7 @@ import "polished";
31
31
  import "react-player";
32
32
  import "slate-hotkeys";
33
33
  import "corporate-ipsum";
34
+ import "is-hotkey";
34
35
  import "slate-react";
35
36
  import "@convertkit/slate-lists";
36
37
  import "./text-input.es.js";
@@ -1 +1 @@
1
- {"version":3,"file":"components.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"components.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.cjs.js CHANGED
@@ -62,6 +62,7 @@ var polished = require("polished");
62
62
  var ReactPlayer = require("react-player");
63
63
  var Hotkeys = require("slate-hotkeys");
64
64
  var ipsum = require("corporate-ipsum");
65
+ var isHotkey = require("is-hotkey");
65
66
  var slateReact = require("slate-react");
66
67
  var Lists = require("@convertkit/slate-lists");
67
68
  var textInput = require("./text-input.cjs.js");
@@ -7612,7 +7613,7 @@ const Text = React.forwardRef(function Text2({
7612
7613
  (_a = lastController.current) == null ? void 0 : _a.focus();
7613
7614
  }, []);
7614
7615
  const handleKeyDown = React.useCallback((event, _editor, next) => {
7615
- var _a, _b;
7616
+ var _a, _b, _c;
7616
7617
  if (Hotkeys__default["default"].isUndo(event)) {
7617
7618
  (_a = lastController.current) == null ? void 0 : _a.undo();
7618
7619
  return true;
@@ -7621,6 +7622,10 @@ const Text = React.forwardRef(function Text2({
7621
7622
  (_b = lastController.current) == null ? void 0 : _b.redo();
7622
7623
  return true;
7623
7624
  }
7625
+ if (isHotkey.isHotkey("escape")(event)) {
7626
+ (_c = lastController.current) == null ? void 0 : _c.blur();
7627
+ return true;
7628
+ }
7624
7629
  return next();
7625
7630
  }, []);
7626
7631
  const isInBuilder = useIsInBuilder();
@@ -7633,7 +7638,8 @@ const Text = React.forwardRef(function Text2({
7633
7638
  value,
7634
7639
  onChange: handleChange,
7635
7640
  onFocus: handleFocus,
7636
- onKeyDown: handleKeyDown
7641
+ onKeyDown: handleKeyDown,
7642
+ onBlur: (e) => e.preventDefault()
7637
7643
  });
7638
7644
  });
7639
7645
  function registerComponent$1(runtime) {
@@ -8203,7 +8209,8 @@ function useStyleControlCssObject(style$1, controlDefinition) {
8203
8209
  return `${borderRadius.value}${borderRadius.unit}`;
8204
8210
  }
8205
8211
  }
8206
- const useInsertionEffect = (_ea = React__namespace.useInsertionEffect) != null ? _ea : React__namespace.useLayoutEffect;
8212
+ const useInsertionEffectSpecifier = "useInsertionEffect";
8213
+ const useInsertionEffect = (_ea = React__namespace[useInsertionEffectSpecifier]) != null ? _ea : React__namespace.useLayoutEffect;
8207
8214
  function useFormattedStyle(styleControlData, controlDefinition) {
8208
8215
  const style2 = useStyleControlCssObject(styleControlData, controlDefinition);
8209
8216
  const serialized = serializeStyles([style2], css.cache.registered);
@@ -8613,6 +8620,7 @@ const ElementData = React.memo(React.forwardRef(function ElementData2({
8613
8620
  })
8614
8621
  });
8615
8622
  }));
8623
+ const DisableRegisterElement = React.createContext(false);
8616
8624
  const ElementReference = React.memo(React.forwardRef(function ElementReference2({
8617
8625
  elementReference
8618
8626
  }, ref) {
@@ -8649,9 +8657,12 @@ const ElementReference = React.memo(React.forwardRef(function ElementReference2(
8649
8657
  return elementReferenceDocument != null ? /* @__PURE__ */ jsxRuntime.jsx(Document, {
8650
8658
  document: elementReferenceDocument,
8651
8659
  ref
8652
- }) : /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
8653
- elementData: globalElementData,
8654
- ref
8660
+ }) : /* @__PURE__ */ jsxRuntime.jsx(DisableRegisterElement.Provider, {
8661
+ value: true,
8662
+ children: /* @__PURE__ */ jsxRuntime.jsx(ElementData, {
8663
+ elementData: globalElementData,
8664
+ ref
8665
+ })
8655
8666
  });
8656
8667
  }));
8657
8668
  const Element$1 = React.memo(React.forwardRef(function Element2({
@@ -8661,17 +8672,18 @@ const Element$1 = React.memo(React.forwardRef(function Element2({
8661
8672
  const dispatch = useDispatch();
8662
8673
  const documentKey = useDocumentKey();
8663
8674
  const [handle, setHandle] = React.useState(null);
8675
+ const isRegisterElementDisabled = React.useContext(DisableRegisterElement);
8664
8676
  React.useImperativeHandle(ref, () => handle, [handle]);
8665
8677
  React.useEffect(() => {
8666
- if (documentKey == null)
8678
+ if (documentKey == null || isRegisterElementDisabled)
8667
8679
  return;
8668
8680
  return dispatch(actions.registerComponentHandleEffect(documentKey, elementKey, handle));
8669
- }, [dispatch, documentKey, elementKey, handle]);
8681
+ }, [dispatch, documentKey, elementKey, handle, isRegisterElementDisabled]);
8670
8682
  React.useEffect(() => {
8671
- if (documentKey == null)
8683
+ if (documentKey == null || isRegisterElementDisabled)
8672
8684
  return;
8673
8685
  return dispatch(actions.mountComponentEffect(documentKey, elementKey));
8674
- }, [dispatch, documentKey, elementKey]);
8686
+ }, [dispatch, documentKey, elementKey, isRegisterElementDisabled]);
8675
8687
  return reactPage.isElementReference(element) ? /* @__PURE__ */ jsxRuntime.jsx(ElementReference, {
8676
8688
  ref: setHandle,
8677
8689
  elementReference: element