@makeswift/runtime 0.9.2 → 0.9.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 (197) hide show
  1. package/dist/Box.cjs.js +1 -3
  2. package/dist/Box.cjs.js.map +1 -1
  3. package/dist/Box.es.js +2 -4
  4. package/dist/Box.es.js.map +1 -1
  5. package/dist/Button.cjs.js +1 -3
  6. package/dist/Button.cjs.js.map +1 -1
  7. package/dist/Button.es.js +2 -4
  8. package/dist/Button.es.js.map +1 -1
  9. package/dist/Carousel.cjs.js +1 -3
  10. package/dist/Carousel.cjs.js.map +1 -1
  11. package/dist/Carousel.es.js +2 -4
  12. package/dist/Carousel.es.js.map +1 -1
  13. package/dist/Countdown.cjs.js +1 -3
  14. package/dist/Countdown.cjs.js.map +1 -1
  15. package/dist/Countdown.es.js +2 -4
  16. package/dist/Countdown.es.js.map +1 -1
  17. package/dist/Divider.cjs.js +1 -3
  18. package/dist/Divider.cjs.js.map +1 -1
  19. package/dist/Divider.es.js +2 -4
  20. package/dist/Divider.es.js.map +1 -1
  21. package/dist/Embed.es.js +1 -1
  22. package/dist/Form.cjs.js +1 -3
  23. package/dist/Form.cjs.js.map +1 -1
  24. package/dist/Form.es.js +2 -4
  25. package/dist/Form.es.js.map +1 -1
  26. package/dist/Image.cjs.js +1 -3
  27. package/dist/Image.cjs.js.map +1 -1
  28. package/dist/Image.es.js +2 -4
  29. package/dist/Image.es.js.map +1 -1
  30. package/dist/LiveProvider.cjs.js +1 -3
  31. package/dist/LiveProvider.cjs.js.map +1 -1
  32. package/dist/LiveProvider.es.js +2 -4
  33. package/dist/LiveProvider.es.js.map +1 -1
  34. package/dist/Navigation.cjs.js +1 -3
  35. package/dist/Navigation.cjs.js.map +1 -1
  36. package/dist/Navigation.es.js +2 -4
  37. package/dist/Navigation.es.js.map +1 -1
  38. package/dist/PreviewProvider.cjs.js +3 -5
  39. package/dist/PreviewProvider.cjs.js.map +1 -1
  40. package/dist/PreviewProvider.es.js +3 -5
  41. package/dist/PreviewProvider.es.js.map +1 -1
  42. package/dist/ReadOnlyText.cjs.js +4 -7
  43. package/dist/ReadOnlyText.cjs.js.map +1 -1
  44. package/dist/ReadOnlyText.es.js +4 -7
  45. package/dist/ReadOnlyText.es.js.map +1 -1
  46. package/dist/ReadOnlyTextV2.cjs.js +11 -14
  47. package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
  48. package/dist/ReadOnlyTextV2.es.js +10 -13
  49. package/dist/ReadOnlyTextV2.es.js.map +1 -1
  50. package/dist/Root.cjs.js +1 -3
  51. package/dist/Root.cjs.js.map +1 -1
  52. package/dist/Root.es.js +2 -4
  53. package/dist/Root.es.js.map +1 -1
  54. package/dist/SocialLinks.cjs.js +1 -3
  55. package/dist/SocialLinks.cjs.js.map +1 -1
  56. package/dist/SocialLinks.es.js +2 -4
  57. package/dist/SocialLinks.es.js.map +1 -1
  58. package/dist/Text.cjs.js +2 -4
  59. package/dist/Text.cjs.js.map +1 -1
  60. package/dist/Text.es.js +2 -4
  61. package/dist/Text.es.js.map +1 -1
  62. package/dist/Video.es.js +1 -1
  63. package/dist/components.cjs.js +1 -3
  64. package/dist/components.cjs.js.map +1 -1
  65. package/dist/components.es.js +1 -3
  66. package/dist/components.es.js.map +1 -1
  67. package/dist/control-serialization.es.js +1 -1
  68. package/dist/controls.cjs.js +18 -15
  69. package/dist/controls.cjs.js.map +1 -1
  70. package/dist/controls.es.js +2 -3
  71. package/dist/controls.es.js.map +1 -1
  72. package/dist/index.cjs.js +205 -57
  73. package/dist/index.cjs.js.map +1 -1
  74. package/dist/index.cjs10.js +261 -172
  75. package/dist/index.cjs10.js.map +1 -1
  76. package/dist/index.cjs5.js +99 -5
  77. package/dist/index.cjs5.js.map +1 -1
  78. package/dist/index.cjs6.js +23 -700
  79. package/dist/index.cjs6.js.map +1 -1
  80. package/dist/index.cjs7.js +13 -37
  81. package/dist/index.cjs7.js.map +1 -1
  82. package/dist/index.cjs8.js +39 -17
  83. package/dist/index.cjs8.js.map +1 -1
  84. package/dist/index.cjs9.js +269 -16
  85. package/dist/index.cjs9.js.map +1 -1
  86. package/dist/index.es.js +187 -41
  87. package/dist/index.es.js.map +1 -1
  88. package/dist/index.es10.js +262 -173
  89. package/dist/index.es10.js.map +1 -1
  90. package/dist/index.es2.js +1 -1
  91. package/dist/index.es4.js +1 -1
  92. package/dist/index.es5.js +91 -2
  93. package/dist/index.es5.js.map +1 -1
  94. package/dist/index.es6.js +23 -695
  95. package/dist/index.es6.js.map +1 -1
  96. package/dist/index.es7.js +14 -33
  97. package/dist/index.es7.js.map +1 -1
  98. package/dist/index.es8.js +37 -17
  99. package/dist/index.es8.js.map +1 -1
  100. package/dist/index.es9.js +264 -15
  101. package/dist/index.es9.js.map +1 -1
  102. package/dist/next.cjs.js +1 -3
  103. package/dist/next.cjs.js.map +1 -1
  104. package/dist/next.es.js +2 -4
  105. package/dist/next.es.js.map +1 -1
  106. package/dist/react-page.cjs.js +97 -9
  107. package/dist/react-page.cjs.js.map +1 -1
  108. package/dist/react-page.es.js +95 -9
  109. package/dist/react-page.es.js.map +1 -1
  110. package/dist/react.cjs.js +1 -3
  111. package/dist/react.cjs.js.map +1 -1
  112. package/dist/react.es.js +1 -3
  113. package/dist/react.es.js.map +1 -1
  114. package/dist/slate.cjs.js +260 -97
  115. package/dist/slate.cjs.js.map +1 -1
  116. package/dist/slate.es.js +249 -92
  117. package/dist/slate.es.js.map +1 -1
  118. package/dist/types/src/components/builtin/Button/Button.d.ts +1 -1
  119. package/dist/types/src/components/builtin/Form/components/Field/components/Checkbox/index.d.ts +1 -1
  120. package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +1 -1
  121. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts +0 -17
  122. package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +1 -1
  123. package/dist/types/src/controls/control.d.ts +3 -2
  124. package/dist/types/src/controls/control.d.ts.map +1 -1
  125. package/dist/types/src/controls/icon-radio-group.d.ts +5 -2
  126. package/dist/types/src/controls/icon-radio-group.d.ts.map +1 -1
  127. package/dist/types/src/controls/index.d.ts +1 -0
  128. package/dist/types/src/controls/index.d.ts.map +1 -1
  129. package/dist/types/src/controls/list.d.ts +2 -0
  130. package/dist/types/src/controls/list.d.ts.map +1 -1
  131. package/dist/types/src/controls/shape.d.ts +2 -0
  132. package/dist/types/src/controls/shape.d.ts.map +1 -1
  133. package/dist/types/src/controls/style-v2.d.ts.map +1 -1
  134. package/dist/types/src/controls/typography.d.ts +31 -0
  135. package/dist/types/src/controls/typography.d.ts.map +1 -0
  136. package/dist/types/src/next/client.d.ts.map +1 -1
  137. package/dist/types/src/prop-controllers/descriptors.d.ts +6 -3
  138. package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
  139. package/dist/types/src/prop-controllers/introspection.d.ts +1 -1
  140. package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
  141. package/dist/types/src/runtimes/react/controls/control.d.ts +3 -2
  142. package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
  143. package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
  144. package/dist/types/src/runtimes/react/controls/typography.d.ts +21 -0
  145. package/dist/types/src/runtimes/react/controls/typography.d.ts.map +1 -0
  146. package/dist/types/src/runtimes/react/controls.d.ts.map +1 -1
  147. package/dist/types/src/slate/InlinePlugin/getValue.d.ts +5 -0
  148. package/dist/types/src/slate/InlinePlugin/getValue.d.ts.map +1 -0
  149. package/dist/types/src/slate/InlinePlugin/index.d.ts +16 -0
  150. package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -0
  151. package/dist/types/src/slate/InlinePlugin/onChange.d.ts +4 -0
  152. package/dist/types/src/slate/InlinePlugin/onChange.d.ts.map +1 -0
  153. package/dist/types/src/slate/InlinePlugin/types.d.ts +9 -0
  154. package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -0
  155. package/dist/types/src/slate/LinkPlugin/getValue.d.ts +5 -0
  156. package/dist/types/src/slate/LinkPlugin/getValue.d.ts.map +1 -0
  157. package/dist/types/src/slate/LinkPlugin/index.d.ts +15 -0
  158. package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -0
  159. package/dist/types/src/slate/LinkPlugin/onChange.d.ts +4 -0
  160. package/dist/types/src/slate/LinkPlugin/onChange.d.ts.map +1 -0
  161. package/dist/types/src/slate/LinkPlugin/types.d.ts +5 -0
  162. package/dist/types/src/slate/LinkPlugin/types.d.ts.map +1 -0
  163. package/dist/types/src/slate/TextAlignPlugin/index.d.ts +2 -0
  164. package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
  165. package/dist/types/src/slate/TypographyPlugin/index.d.ts +9 -0
  166. package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
  167. package/dist/types/src/slate/index.d.ts +2 -0
  168. package/dist/types/src/slate/index.d.ts.map +1 -1
  169. package/dist/types.cjs2.js +753 -0
  170. package/dist/types.cjs2.js.map +1 -0
  171. package/dist/types.es2.js +736 -0
  172. package/dist/types.es2.js.map +1 -0
  173. package/dist/typography.cjs.js +56 -0
  174. package/dist/typography.cjs.js.map +1 -0
  175. package/dist/typography.es.js +41 -0
  176. package/dist/typography.es.js.map +1 -0
  177. package/package.json +1 -1
  178. package/dist/deepEqual.cjs.js +0 -40
  179. package/dist/deepEqual.cjs.js.map +0 -1
  180. package/dist/deepEqual.es.js +0 -39
  181. package/dist/deepEqual.es.js.map +0 -1
  182. package/dist/index.cjs11.js +0 -375
  183. package/dist/index.cjs11.js.map +0 -1
  184. package/dist/index.es11.js +0 -368
  185. package/dist/index.es11.js.map +0 -1
  186. package/dist/leaf.cjs.js +0 -182
  187. package/dist/leaf.cjs.js.map +0 -1
  188. package/dist/leaf.es.js +0 -179
  189. package/dist/leaf.es.js.map +0 -1
  190. package/dist/select.cjs.js +0 -21
  191. package/dist/select.cjs.js.map +0 -1
  192. package/dist/select.es.js +0 -16
  193. package/dist/select.es.js.map +0 -1
  194. package/dist/text-input.cjs.js +0 -26
  195. package/dist/text-input.cjs.js.map +0 -1
  196. package/dist/text-input.es.js +0 -18
  197. package/dist/text-input.es.js.map +0 -1
package/dist/index.es.js CHANGED
@@ -38,19 +38,17 @@ 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 { a as createDocumentReference, g as getPropControllerDescriptors, b as isElementReference, e as getElementSwatchIds, f as getFileIds, h as getTypographyIds, j as getTableIds, k as getPageIds, l as getElementChildren, S as ShapeControlType, L as ListControlType, m as Types, E as ElementID, B as Backgrounds, W as Width, n as ResponsiveIconRadioGroup, M as Margin, P as Padding, o as Border, p as BorderRadius, q as Shadows, G as GapY, r as GapX, s as ResponsiveSelect, t as ResponsiveNumber, u as Checkbox, v as Grid, w as TextInput, x as Link, y as ResponsiveColor, z as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, A as ResponsiveLength, H as TextArea, J as Table, K as TableFormFields, O as Image, Q as ResponsiveOpacity, U as NavigationLinks, V as SocialLinks, X as RichText, Y as Video, Z as useStyle, _ as getBorderSwatchIds, $ as isNonNullable, a0 as getBoxShadowsSwatchIds, a1 as getResponsiveColorSwatchIds, a2 as StyleControlProperty, a3 as ImageControlValueFormat, a4 as isPropControllersHandle, a5 as StyleControlType, a6 as RichTextV2ControlType, a7 as RichTextControlType, a8 as SlotControlType, a9 as StyleV2ControlType, aa as LinkControlType, ab as ImageControlType, ac as ColorControlType, ad as getComponentPropControllerDescriptors, ae as getPropControllers, af as BorderPropControllerFormat, ag as ShadowsPropControllerFormat, ah as BorderRadiusPropControllerFormat, ai as MarginPropControllerFormat, aj as PaddingPropControllerFormat, ak as WidthPropControllerFormat, al as configureStore$1, am as copyElementTree, an as getBreakpoints, ao as getDocument, ap as getElementId, aq as getIsPreview, ar as getIsInBuilder, as as getReactComponent, at as getBuilderEditMode } from "./react-page.es.js";
41
+ import { a as createDocumentReference, g as getPropControllerDescriptors, b as isElementReference, e as getSwatchIds, f as getFileIds, h as getTypographyIds, j as getTableIds, k as getPageIds, l as getElementChildren, E as ElementID, B as Backgrounds, W as Width, m as ResponsiveIconRadioGroup, M as Margin, P as Padding, n as Border, o as BorderRadius, S as Shadows, G as GapY, p as GapX, q as ResponsiveSelect, r as ResponsiveNumber, s as Checkbox, t as Grid, u as TextInput, L as Link, v as ResponsiveColor, w as TextStyle, C as ComponentIcon, I as Images, N as Number$1, D as Date$1, F as Font, x as ResponsiveLength, y as TextArea, z as Table, A as TableFormFields, H as Image, J as ResponsiveOpacity, K as NavigationLinks, O as SocialLinks, Q as RichText, V as Video, U as useStyle, X as getBorderSwatchIds, Y as isNonNullable$1, Z as getBoxShadowsSwatchIds, _ as getResponsiveColorSwatchIds, $ as StyleControlProperty, a0 as ImageControlValueFormat, a1 as isPropControllersHandle, a2 as StyleControlType, a3 as RichTextV2ControlType, a4 as RichTextControlType, a5 as SlotControlType, a6 as StyleV2ControlType, a7 as ListControlType, a8 as ShapeControlType, a9 as LinkControlType, aa as ImageControlType, ab as ColorControlType, ac as getComponentPropControllerDescriptors, ad as getPropControllers, ae as Types, af as BorderPropControllerFormat, ag as ShadowsPropControllerFormat, ah as BorderRadiusPropControllerFormat, ai as MarginPropControllerFormat, aj as PaddingPropControllerFormat, ak as WidthPropControllerFormat, al as configureStore$1, am as copyElementTree, an as getBreakpoints, ao as getDocument, ap as getElementId, aq as getIsPreview, ar as getIsInBuilder, as as getReactComponent, at as getBuilderEditMode } 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 { T as TextAreaControlType, a as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./text-input.es.js";
44
+ import { T as TypographyControlType, I as IconRadioGroupControlType, S as SelectControlType, a as TextAreaControlType, b as TextInputControlType, N as NumberControlType, C as CheckboxControlType } from "./typography.es.js";
45
45
  import { C as ComboboxControlType } from "./combobox.es.js";
46
- import { I as IconRadioGroupControlType, S as SelectControlType } from "./select.es.js";
47
46
  import "slate";
48
47
  import { useSyncExternalStore } from "use-sync-external-store/shim";
49
48
  import { createStore, applyMiddleware } from "redux";
50
49
  import thunk from "redux-thunk";
51
50
  import { A as APIResourceType } from "./types.es.js";
52
- import { d as deepEqual } from "./deepEqual.es.js";
53
- import { getBaseBreakpoint, findBreakpointOverride, DefaultBreakpointID, join, getBreakpoint, getBreakpointMediaQuery, parseBreakpointsInput } from "./state/breakpoints.es.js";
51
+ import { getBaseBreakpoint, findBreakpointOverride, DefaultBreakpointID, join, getBreakpoint, getBreakpointMediaQuery, shallowMergeFallbacks, parseBreakpointsInput } from "./state/breakpoints.es.js";
54
52
  import { g as getBox, i as isMeasurable, m as measure } from "./box-models.es.js";
55
53
  import ColorHelper from "color";
56
54
  import { cache, cx } from "@emotion/css";
@@ -115,6 +113,43 @@ function BodySnippet({
115
113
  }, [code, cleanup]);
116
114
  return null;
117
115
  }
116
+ function is(x, y) {
117
+ if (x === y)
118
+ return x !== 0 || y !== 0 || 1 / x === 1 / y;
119
+ return x !== x && y !== y;
120
+ }
121
+ const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
122
+ const shallowEqual = (a, b) => {
123
+ if (is(a, b))
124
+ return true;
125
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
126
+ return false;
127
+ const keysA = Object.keys(a);
128
+ const keysB = Object.keys(b);
129
+ if (keysA.length !== keysB.length)
130
+ return false;
131
+ for (let i = 0; i < keysA.length; i += 1) {
132
+ if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
133
+ return false;
134
+ }
135
+ return true;
136
+ };
137
+ const { hasOwnProperty } = Object.prototype;
138
+ const deepEqual = (a, b) => {
139
+ if (shallowEqual(a, b))
140
+ return true;
141
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
142
+ return false;
143
+ const keysA = Object.keys(a);
144
+ const keysB = Object.keys(b);
145
+ if (keysA.length !== keysB.length)
146
+ return false;
147
+ for (let i = 0; i < keysA.length; i += 1) {
148
+ if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
149
+ return false;
150
+ }
151
+ return true;
152
+ };
118
153
  function getInitialState(serializedState = {
119
154
  Swatch: [],
120
155
  File: [],
@@ -890,7 +925,7 @@ Received "${apiKey}" instead.`);
890
925
  while (current = remaining.pop()) {
891
926
  let getResourcesFromElementDescriptors = function(elementDescriptors2, props) {
892
927
  Object.entries(elementDescriptors2).forEach(([propName, descriptor]) => {
893
- getElementSwatchIds(descriptor, props[propName]).forEach((swatchId) => {
928
+ getSwatchIds(descriptor, props[propName]).forEach((swatchId) => {
894
929
  swatchIds.add(swatchId);
895
930
  });
896
931
  getFileIds(descriptor, props[propName]).forEach((fileId) => fileIds.add(fileId));
@@ -903,34 +938,6 @@ Received "${apiKey}" instead.`);
903
938
  remaining.push(child);
904
939
  }
905
940
  });
906
- if (descriptor.type === ShapeControlType) {
907
- const prop = props[propName];
908
- if (prop == null)
909
- return;
910
- getResourcesFromElementDescriptors(descriptor.config.type, prop);
911
- }
912
- if (descriptor.type === ListControlType) {
913
- const prop = props[propName];
914
- if (prop == null)
915
- return;
916
- prop.forEach((item) => {
917
- getResourcesFromElementDescriptors({ propName: descriptor.config.type }, { propName: item.value });
918
- });
919
- }
920
- if (descriptor.type === Types.Shape) {
921
- const prop = props[propName];
922
- if (prop == null)
923
- return;
924
- getResourcesFromElementDescriptors(descriptor.options.type, prop);
925
- }
926
- if (descriptor.type === Types.List) {
927
- const prop = props[propName];
928
- if (prop == null)
929
- return;
930
- prop.forEach((item) => {
931
- getResourcesFromElementDescriptors({ propName: descriptor.options.type }, { propName: item.value });
932
- });
933
- }
934
941
  });
935
942
  };
936
943
  let element2;
@@ -1113,7 +1120,7 @@ async function fonts(_req, res, { getFonts } = {}) {
1113
1120
  const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
1114
1121
  return res.json(fonts2);
1115
1122
  }
1116
- const version = "0.9.2";
1123
+ const version = "0.9.4";
1117
1124
  async function handler(req, res, { apiKey, unstable_siteVersions }) {
1118
1125
  if (req.query.secret !== apiKey) {
1119
1126
  return res.status(401).json({ message: "Unauthorized" });
@@ -2533,7 +2540,7 @@ function mapSideColor(swatches, _e) {
2533
2540
  return __spreadProps(__spreadValues({}, restOfSide), {
2534
2541
  color: color && {
2535
2542
  alpha: color.alpha,
2536
- swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId)
2543
+ swatch: swatches.filter(isNonNullable$1).find((s) => s && s.id === color.swatchId)
2537
2544
  }
2538
2545
  });
2539
2546
  }
@@ -2579,7 +2586,7 @@ function useBoxShadow(value) {
2579
2586
  return __spreadProps(__spreadValues({}, restOfShadow), {
2580
2587
  payload: {
2581
2588
  color: color != null ? {
2582
- swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId),
2589
+ swatch: swatches.filter(isNonNullable$1).find((s) => s && s.id === color.swatchId),
2583
2590
  alpha: color.alpha
2584
2591
  } : null,
2585
2592
  inset: inset != null ? inset : ShadowDefaultValue.inset,
@@ -2603,7 +2610,7 @@ function useResponsiveColor(color) {
2603
2610
  const { swatchId, alpha } = v;
2604
2611
  const swatch = swatches.find((s) => s && s.id === swatchId);
2605
2612
  return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
2606
- }).filter(isNonNullable);
2613
+ }).filter(isNonNullable$1);
2607
2614
  }
2608
2615
  const getIndexes = (spans, index) => {
2609
2616
  const flattened = spans.reduce((a, s) => a.concat(s), []);
@@ -3061,7 +3068,7 @@ function ListControlValue({
3061
3068
  function useNumber(numberControlData, controlDefinition) {
3062
3069
  return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
3063
3070
  }
3064
- const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es9.js"))));
3071
+ const Text = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es8.js"))));
3065
3072
  function useRichText(data, control) {
3066
3073
  const textCallbackRef = useCallback((handle) => {
3067
3074
  var _a;
@@ -3075,7 +3082,7 @@ function useRichText(data, control) {
3075
3082
  ref: textCallbackRef
3076
3083
  });
3077
3084
  }
3078
- const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es10.js"))));
3085
+ const EditableText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./index.es9.js"))));
3079
3086
  const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic(() => patch(import("./ReadOnlyTextV2.es.js"))));
3080
3087
  function useRichTextV2(data, definition, control) {
3081
3088
  const isPreview = useIsPreview();
@@ -3311,6 +3318,138 @@ function useTextAreaValue(data, definition) {
3311
3318
  function useTextInputValue(data, definition) {
3312
3319
  return data != null ? data : definition.config.defaultValue;
3313
3320
  }
3321
+ function isNonNullable(value) {
3322
+ return value != null;
3323
+ }
3324
+ function typographyFragementToTypographyControlData(typography) {
3325
+ if (typography == null)
3326
+ return void 0;
3327
+ return {
3328
+ id: typography.id,
3329
+ style: typography.style.map(({ deviceId, value }) => {
3330
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
3331
+ return {
3332
+ deviceId,
3333
+ value: {
3334
+ fontFamily: (_a = value.fontFamily) != null ? _a : void 0,
3335
+ lineHeight: (_b = value.lineHeight) != null ? _b : void 0,
3336
+ letterSpacing: (_c = value.letterSpacing) != null ? _c : void 0,
3337
+ fontWeight: (_d = value.fontWeight) != null ? _d : void 0,
3338
+ textAlign: (_e = value.textAlign) != null ? _e : void 0,
3339
+ uppercase: (_f = value.uppercase) != null ? _f : void 0,
3340
+ underline: (_g = value.underline) != null ? _g : void 0,
3341
+ strikethrough: (_h = value.strikethrough) != null ? _h : void 0,
3342
+ italic: (_i = value.italic) != null ? _i : void 0,
3343
+ fontSize: (_j = value.fontSize) != null ? _j : void 0,
3344
+ color: (_k = value.color) != null ? _k : void 0
3345
+ }
3346
+ };
3347
+ })
3348
+ };
3349
+ }
3350
+ function getTypographyStyleSwatchIds(style) {
3351
+ var _a;
3352
+ return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
3353
+ var _a2;
3354
+ return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
3355
+ }).filter(isNonNullable)) != null ? _a : [];
3356
+ }
3357
+ const withColor = (swatches) => (deviceRawTypographyValue) => {
3358
+ var _b, _c;
3359
+ const { value, deviceId } = deviceRawTypographyValue;
3360
+ if (value.color == null) {
3361
+ const _a = value, { color } = _a, nextValue = __objRest(_a, ["color"]);
3362
+ return {
3363
+ deviceId,
3364
+ value: nextValue
3365
+ };
3366
+ }
3367
+ return {
3368
+ deviceId,
3369
+ value: __spreadProps(__spreadValues({}, value), {
3370
+ color: {
3371
+ swatch: swatches.find((s) => {
3372
+ var _a2;
3373
+ return s && s.id === ((_a2 = value.color) == null ? void 0 : _a2.swatchId);
3374
+ }),
3375
+ alpha: (_c = (_b = value.color) == null ? void 0 : _b.alpha) != null ? _c : void 0
3376
+ }
3377
+ })
3378
+ };
3379
+ };
3380
+ const getDeviceId = ({ deviceId }) => deviceId;
3381
+ function useEnhancedTypography(value) {
3382
+ var _a, _b, _c;
3383
+ const typography = typographyFragementToTypographyControlData(useTypography((_a = value == null ? void 0 : value.id) != null ? _a : null));
3384
+ const source = (_b = typography == null ? void 0 : typography.style) != null ? _b : [];
3385
+ const override = (_c = value == null ? void 0 : value.style) != null ? _c : [];
3386
+ const breakpoints = useBreakpoints();
3387
+ const swatchIds = [
3388
+ ...getTypographyStyleSwatchIds(value == null ? void 0 : value.style),
3389
+ ...getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)
3390
+ ];
3391
+ const swatches = useSwatches(swatchIds).filter(isNonNullable);
3392
+ const enhancedSource = source.map(withColor(swatches));
3393
+ const enhancedOverride = override.map(withColor(swatches));
3394
+ const devices = [
3395
+ ...new Set(enhancedSource.map(getDeviceId).concat(enhancedOverride.map(getDeviceId)))
3396
+ ];
3397
+ return devices.map((deviceId) => {
3398
+ var _a2, _b2;
3399
+ const deviceSource = (_a2 = findBreakpointOverride(breakpoints, enhancedSource, deviceId)) == null ? void 0 : _a2.value;
3400
+ const deviceOverride = (_b2 = findBreakpointOverride(breakpoints, enhancedOverride, deviceId, (v) => v)) == null ? void 0 : _b2.value;
3401
+ if (deviceSource && deviceOverride) {
3402
+ return {
3403
+ deviceId,
3404
+ value: __spreadValues(__spreadValues({}, deviceSource), deviceOverride)
3405
+ };
3406
+ } else if (deviceOverride) {
3407
+ return {
3408
+ deviceId,
3409
+ value: deviceOverride
3410
+ };
3411
+ } else if (deviceSource) {
3412
+ return {
3413
+ deviceId,
3414
+ value: deviceSource
3415
+ };
3416
+ }
3417
+ return null;
3418
+ }).filter(isNonNullable);
3419
+ }
3420
+ function useTypographyClassName(value) {
3421
+ return useStyle(useResponsiveStyle([value], ([value2]) => {
3422
+ if (value2 === void 0)
3423
+ return {};
3424
+ let styles = {};
3425
+ if (value2.color != null)
3426
+ styles.color = colorToString(value2.color);
3427
+ if (value2.fontFamily != null)
3428
+ styles.fontFamily = value2.fontFamily;
3429
+ if (value2.fontSize != null && value2.fontSize.value != null && value2.fontSize.unit != null)
3430
+ styles.fontSize = `${value2.fontSize.value}${value2.fontSize.unit}`;
3431
+ if (value2.fontWeight != null)
3432
+ styles.fontWeight = value2.fontWeight;
3433
+ if (value2.lineHeight != null)
3434
+ styles.lineHeight = value2.lineHeight;
3435
+ if (value2.letterSpacing != null)
3436
+ styles.letterSpacing = `${value2.letterSpacing / 10}em`;
3437
+ if (value2.uppercase != null)
3438
+ styles.textTransform = value2.uppercase === true ? "uppercase" : "initial";
3439
+ if (value2.underline != null || value2.strikethrough != null)
3440
+ styles.textDecoration = [
3441
+ Boolean(value2.underline) && "underline",
3442
+ Boolean(value2.strikethrough) && "line-through"
3443
+ ].filter(Boolean).join(" ");
3444
+ if (value2.italic != null)
3445
+ styles.fontStyle = value2.italic === true ? "italic" : "initial";
3446
+ return styles;
3447
+ }, shallowMergeFallbacks));
3448
+ }
3449
+ function useTypographyValue(data) {
3450
+ const enhancedTypography = useEnhancedTypography(data);
3451
+ return useTypographyClassName(enhancedTypography);
3452
+ }
3314
3453
  function ControlValue({
3315
3454
  data,
3316
3455
  definition,
@@ -3423,6 +3562,12 @@ function ControlValue({
3423
3562
  parameters: [data, definition, control],
3424
3563
  children: (value) => children(value)
3425
3564
  }, definition.type);
3565
+ case TypographyControlType:
3566
+ return /* @__PURE__ */ jsx(RenderHook, {
3567
+ hook: useTypographyValue,
3568
+ parameters: [data],
3569
+ children: (value) => children(value)
3570
+ }, definition.type);
3426
3571
  default:
3427
3572
  return children(data);
3428
3573
  }
@@ -3477,6 +3622,7 @@ function PropsValue({
3477
3622
  case ListControlType:
3478
3623
  case LinkControlType:
3479
3624
  case StyleV2ControlType:
3625
+ case TypographyControlType:
3480
3626
  return /* @__PURE__ */ jsx(ControlValue, {
3481
3627
  definition: descriptor,
3482
3628
  data: props[propName],
@@ -3970,5 +4116,5 @@ const DocumentReference = memo(forwardRef(function DocumentReference2({
3970
4116
  document: document2
3971
4117
  });
3972
4118
  }));
3973
- export { MakeswiftApiHandler as $, Alignments as A, forwardNextDynamicRef as B, Contrasts as C, DocumentReference as D, Element$1 as E, useIsPreview as F, useFiles as G, useSwatches as H, usePagePathnameSlice as I, useElementId as J, ElementImperativeHandle as K, StoreContext as L, MakeswiftProvider as M, ControlValue as N, useBuilderEditMode as O, PageProvider as P, pollBoxModel as Q, RuntimeProvider as R, Shapes as S, useTypography as T, getStaticPaths as U, getStaticProps as V, getServerSideProps as W, Page as X, Makeswift as Y, PreviewModeScript as Z, Document$1 as _, ReactRuntime as a, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, Page$1 as m, useResponsiveStyle as n, useResponsiveWidth as o, useResponsiveTextStyle as p, colorToString as q, useBreakpoints as r, Sizes as s, useFormContext as t, useIsInBuilder as u, useResponsiveGridItem as v, useTable as w, useMakeswiftClient as x, Provider as y, useFile as z };
4119
+ export { PreviewModeScript as $, Alignments as A, forwardNextDynamicRef as B, Contrasts as C, DocumentReference as D, Element$1 as E, useIsPreview as F, useFiles as G, useSwatches as H, usePagePathnameSlice as I, useElementId as J, deepEqual as K, ElementImperativeHandle as L, StoreContext as M, MakeswiftProvider as N, ControlValue as O, PageProvider as P, useBuilderEditMode as Q, RuntimeProvider as R, Shapes as S, pollBoxModel as T, useEnhancedTypography as U, useTypographyClassName as V, getStaticPaths as W, getStaticProps as X, getServerSideProps as Y, Page as Z, Makeswift as _, ReactRuntime as a, Document$1 as a0, MakeswiftApiHandler as a1, usePageId as b, DEFAULT_BOX_ANIMATE_TYPE as c, DEFAULT_BOX_ANIMATE_DELAY as d, DEFAULT_BOX_ANIMATE_DURATION as e, DEFAULT_ITEM_ANIMATE_TYPE as f, DEFAULT_ITEM_ANIMATE_DELAY as g, DEFAULT_ITEM_ANIMATE_DURATION as h, DEFAULT_ITEM_STAGGER_DURATION as i, useBorder as j, useBoxShadow as k, useResponsiveColor as l, Page$1 as m, useResponsiveStyle as n, useResponsiveWidth as o, useResponsiveTextStyle as p, colorToString as q, useBreakpoints as r, Sizes as s, useFormContext as t, useIsInBuilder as u, useResponsiveGridItem as v, useTable as w, useMakeswiftClient as x, Provider as y, useFile as z };
3974
4120
  //# sourceMappingURL=index.es.js.map