@makeswift/runtime 0.12.3 → 0.12.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 (45) hide show
  1. package/dist/LiveProvider.es.js +1 -1
  2. package/dist/PreviewProvider.es.js +1 -1
  3. package/dist/ReadOnlyText.es.js +1 -1
  4. package/dist/ReadOnlyTextV2.es.js +1 -1
  5. package/dist/control-serialization.es.js +1 -1
  6. package/dist/controls.cjs.js +8 -1
  7. package/dist/controls.cjs.js.map +1 -1
  8. package/dist/controls.es.js +2 -2
  9. package/dist/index.cjs.js +14 -6
  10. package/dist/index.cjs.js.map +1 -1
  11. package/dist/index.es.js +16 -8
  12. package/dist/index.es.js.map +1 -1
  13. package/dist/index.es2.js +1 -1
  14. package/dist/index.es5.js +1 -1
  15. package/dist/index.es6.js +1 -1
  16. package/dist/index.es8.js +1 -1
  17. package/dist/index.es9.js +1 -1
  18. package/dist/number.cjs.js +11 -2
  19. package/dist/number.cjs.js.map +1 -1
  20. package/dist/number.es.js +8 -3
  21. package/dist/number.es.js.map +1 -1
  22. package/dist/react-page.cjs.js +11 -3
  23. package/dist/react-page.cjs.js.map +1 -1
  24. package/dist/react-page.es.js +8 -4
  25. package/dist/react-page.es.js.map +1 -1
  26. package/dist/slate.es.js +1 -1
  27. package/dist/toText.es.js +1 -1
  28. package/dist/types/src/controls/checkbox.d.ts +9 -1
  29. package/dist/types/src/controls/checkbox.d.ts.map +1 -1
  30. package/dist/types/src/controls/color.d.ts +1 -2
  31. package/dist/types/src/controls/color.d.ts.map +1 -1
  32. package/dist/types/src/controls/control-data-type-key.d.ts +2 -0
  33. package/dist/types/src/controls/control-data-type-key.d.ts.map +1 -0
  34. package/dist/types/src/controls/number.d.ts +9 -1
  35. package/dist/types/src/controls/number.d.ts.map +1 -1
  36. package/dist/types/src/controls/text-area.d.ts +9 -1
  37. package/dist/types/src/controls/text-area.d.ts.map +1 -1
  38. package/dist/types/src/controls/text-input.d.ts +10 -1
  39. package/dist/types/src/controls/text-input.d.ts.map +1 -1
  40. package/dist/types/src/runtimes/react/controls/checkbox.d.ts.map +1 -1
  41. package/dist/types/src/runtimes/react/controls/number.d.ts +2 -2
  42. package/dist/types/src/runtimes/react/controls/number.d.ts.map +1 -1
  43. package/dist/types/src/runtimes/react/controls/text-area.d.ts.map +1 -1
  44. package/dist/types/src/runtimes/react/controls/text-input.d.ts.map +1 -1
  45. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -38,10 +38,10 @@ import * as React from "react";
38
38
  import { useEffect, createContext, useContext, useState, useMemo, useRef, Children, createElement, forwardRef, memo, useId, useCallback, useImperativeHandle, Component, Suspense } from "react";
39
39
  import { useSyncExternalStoreWithSelector } from "use-sync-external-store/shim/with-selector";
40
40
  import dynamic from "next/dynamic";
41
- import { f as deepEqual, g as createDocumentReference, h as getPropControllerDescriptors, j as isElementReference, k as getSwatchIds, l as getFileIds, m as getTypographyIds, n as getTableIds, o as getPageIds, p as getElementChildren, E as ElementID, B as Backgrounds, W as Width, q as ResponsiveIconRadioGroup, M as Margin, P as Padding, r as Border, s as BorderRadius, S as Shadows, G as GapY, t as GapX, u as ResponsiveSelect, v as ResponsiveNumber, w as Checkbox, x as Grid, y as TextInput, L as Link, z as ResponsiveColor, A as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, H as ResponsiveLength, J as TextArea, K as Table, O as TableFormFields, Q as Image, U as ResponsiveOpacity, V as NavigationLinks, X as SocialLinks, Y as RichText, Z as Video, _ as useStyle, $ as getBorderSwatchIds, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as isRichTextV1Data, a6 as isNonNullable$1, a7 as TypographyControlType, a8 as StyleControlType, a9 as RichTextV2ControlType, aa as RichTextControlType, ab as SlotControlType, ac as StyleV2ControlType, ad as ListControlType, ae as ShapeControlType, af as LinkControlType, ag as ImageControlType, ah as IconRadioGroupControlType, ai as ColorControlType, aj as SelectControlType, ak as TextAreaControlType, al as TextInputControlType, am as getComponentPropControllerDescriptors, an as getPropControllers, ao as Types, ap as BorderPropControllerFormat, aq as ShadowsPropControllerFormat, ar as BorderRadiusPropControllerFormat, as as MarginPropControllerFormat, at as PaddingPropControllerFormat, au as WidthPropControllerFormat, av as configureStore$1, aw as copyElementTree, ax as getBreakpoints, ay as getElementTreeTranslatableData, az as mergeElementTreeTranslatedData, aA as getDocument, aB as getElementId, aC as getIsInBuilder, aD as getReactComponent, aE as getBuilderEditMode, aF as getIsPreview } from "./react-page.es.js";
41
+ import { f as deepEqual, g as createDocumentReference, h as getPropControllerDescriptors, j as isElementReference, k as getSwatchIds, l as getFileIds, m as getTypographyIds, n as getTableIds, o as getPageIds, p as getElementChildren, E as ElementID, B as Backgrounds, W as Width, q as ResponsiveIconRadioGroup, M as Margin, P as Padding, r as Border, s as BorderRadius, S as Shadows, G as GapY, t as GapX, u as ResponsiveSelect, v as ResponsiveNumber, w as Checkbox, x as Grid, y as TextInput, L as Link, z as ResponsiveColor, A as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, H as ResponsiveLength, J as TextArea, K as Table, O as TableFormFields, Q as Image, U as ResponsiveOpacity, V as NavigationLinks, X as SocialLinks, Y as RichText, Z as Video, _ as useStyle, $ as getBorderSwatchIds, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as isRichTextV1Data, a6 as TextAreaControlDataTypeKey, a7 as TextAreaControlDataTypeValueV1, a8 as TextInputControlDataTypeKey, a9 as TextInputControlDataTypeValueV1, aa as isNonNullable$1, ab as TypographyControlType, ac as StyleControlType, ad as RichTextV2ControlType, ae as RichTextControlType, af as SlotControlType, ag as StyleV2ControlType, ah as ListControlType, ai as ShapeControlType, aj as LinkControlType, ak as ImageControlType, al as IconRadioGroupControlType, am as ColorControlType, an as SelectControlType, ao as TextAreaControlType, ap as TextInputControlType, aq as getComponentPropControllerDescriptors, ar as getPropControllers, as as Types, at as BorderPropControllerFormat, au as ShadowsPropControllerFormat, av as BorderRadiusPropControllerFormat, aw as MarginPropControllerFormat, ax as PaddingPropControllerFormat, ay as WidthPropControllerFormat, az as configureStore$1, aA as copyElementTree, aB as getBreakpoints, aC as getElementTreeTranslatableData, aD as mergeElementTreeTranslatedData, aE as getDocument, aF as getElementId, aG as getIsInBuilder, aH as getReactComponent, aI as getBuilderEditMode, aJ as getIsPreview } from "./react-page.es.js";
42
42
  import { A as ActionTypes, n as apiResourceFulfilled, o as registerComponentEffect, p as registerReactComponentEffect, q as registerComponentHandleEffect, t as mountComponentEffect } from "./actions.es.js";
43
43
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
44
- import { N as NumberControlType, C as CheckboxControlType } from "./number.es.js";
44
+ import { C as CheckboxControlDataTypeKey, a as CheckboxControlDataTypeValueV1, N as NumberControlDataTypeKey, b as NumberControlDataTypeValueV1, c as NumberControlType, d as CheckboxControlType } from "./number.es.js";
45
45
  import { C as ComboboxControlType } from "./combobox.es.js";
46
46
  import { match as match$1, P } from "ts-pattern";
47
47
  import { v4 } from "uuid";
@@ -1218,7 +1218,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1218
1218
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1219
1219
  return res.json(fonts2);
1220
1220
  }
1221
- const version = "0.12.3";
1221
+ const version = "0.12.4";
1222
1222
  async function handler(req, res, { apiKey, siteVersions }) {
1223
1223
  if (req.query.secret !== apiKey) {
1224
1224
  return res.status(401).json({ message: "Unauthorized" });
@@ -3063,7 +3063,9 @@ function RenderHook({
3063
3063
  return children(useHook(...parameters));
3064
3064
  }
3065
3065
  function useCheckboxControlValue(data, definition) {
3066
- return data != null ? data : definition.config.defaultValue;
3066
+ var _a;
3067
+ const value = (_a = match$1(data).with({ [CheckboxControlDataTypeKey]: CheckboxControlDataTypeValueV1 }, (val) => val.value).otherwise((val) => val)) != null ? _a : definition.config.defaultValue;
3068
+ return value;
3067
3069
  }
3068
3070
  function useColorValue(data, definition) {
3069
3071
  var _a, _b;
@@ -3196,8 +3198,10 @@ function ListControlValue({
3196
3198
  children: (value) => renderFn([value, ...listControlValue])
3197
3199
  }), children)([]);
3198
3200
  }
3199
- function useNumber(numberControlData, controlDefinition) {
3200
- return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
3201
+ function useNumber(data, definition) {
3202
+ var _a;
3203
+ const value = (_a = match$1(data).with({ [NumberControlDataTypeKey]: NumberControlDataTypeValueV1 }, (val) => val.value).otherwise((val) => val)) != null ? _a : definition.config.defaultValue;
3204
+ return value;
3201
3205
  }
3202
3206
  const EditableText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
3203
3207
  const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyText.es.js"))));
@@ -3455,10 +3459,14 @@ function StyleV2ControlValue({
3455
3459
  })([]);
3456
3460
  }
3457
3461
  function useTextAreaValue(data, definition) {
3458
- return data != null ? data : definition.config.defaultValue;
3462
+ var _a;
3463
+ const value = (_a = match$1(data).with({ [TextAreaControlDataTypeKey]: TextAreaControlDataTypeValueV1 }, (val) => val.value).otherwise((val) => val)) != null ? _a : definition.config.defaultValue;
3464
+ return value;
3459
3465
  }
3460
3466
  function useTextInputValue(data, definition) {
3461
- return data != null ? data : definition.config.defaultValue;
3467
+ var _a;
3468
+ const value = (_a = match$1(data).with({ [TextInputControlDataTypeKey]: TextInputControlDataTypeValueV1 }, (val) => val.value).otherwise((val) => val)) != null ? _a : definition.config.defaultValue;
3469
+ return value;
3462
3470
  }
3463
3471
  function typographyFragementToTypographyControlData(typography) {
3464
3472
  if (typography == null)