@makeswift/runtime 0.9.11 → 0.10.0
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/Box.cjs.js +4 -1
- package/dist/Box.cjs.js.map +1 -1
- package/dist/Box.es.js +5 -2
- package/dist/Box.es.js.map +1 -1
- package/dist/Button.cjs.js +4 -3
- package/dist/Button.cjs.js.map +1 -1
- package/dist/Button.es.js +5 -4
- package/dist/Button.es.js.map +1 -1
- package/dist/Carousel.cjs.js +4 -3
- package/dist/Carousel.cjs.js.map +1 -1
- package/dist/Carousel.es.js +5 -4
- package/dist/Carousel.es.js.map +1 -1
- package/dist/Countdown.cjs.js +4 -1
- package/dist/Countdown.cjs.js.map +1 -1
- package/dist/Countdown.es.js +5 -2
- package/dist/Countdown.es.js.map +1 -1
- package/dist/Divider.cjs.js +4 -1
- package/dist/Divider.cjs.js.map +1 -1
- package/dist/Divider.es.js +5 -2
- package/dist/Divider.es.js.map +1 -1
- package/dist/Embed.cjs.js +1 -0
- package/dist/Embed.cjs.js.map +1 -1
- package/dist/Embed.es.js +2 -1
- package/dist/Embed.es.js.map +1 -1
- package/dist/Form.cjs.js +14 -13
- package/dist/Form.cjs.js.map +1 -1
- package/dist/Form.es.js +6 -5
- package/dist/Form.es.js.map +1 -1
- package/dist/Image.cjs.js +12 -11
- package/dist/Image.cjs.js.map +1 -1
- package/dist/Image.es.js +12 -11
- package/dist/Image.es.js.map +1 -1
- package/dist/LiveProvider.cjs.js +4 -1
- package/dist/LiveProvider.cjs.js.map +1 -1
- package/dist/LiveProvider.es.js +6 -3
- package/dist/LiveProvider.es.js.map +1 -1
- package/dist/Navigation.cjs.js +12 -11
- package/dist/Navigation.cjs.js.map +1 -1
- package/dist/Navigation.es.js +12 -11
- package/dist/Navigation.es.js.map +1 -1
- package/dist/PreviewProvider.cjs.js +7 -4
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +6 -3
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.cjs.js +34 -26
- package/dist/ReadOnlyText.cjs.js.map +1 -1
- package/dist/ReadOnlyText.es.js +30 -22
- package/dist/ReadOnlyText.es.js.map +1 -1
- package/dist/ReadOnlyTextV2.cjs.js +125 -246
- package/dist/ReadOnlyTextV2.cjs.js.map +1 -1
- package/dist/ReadOnlyTextV2.es.js +126 -246
- package/dist/ReadOnlyTextV2.es.js.map +1 -1
- package/dist/Root.cjs.js +4 -1
- package/dist/Root.cjs.js.map +1 -1
- package/dist/Root.es.js +5 -2
- package/dist/Root.es.js.map +1 -1
- package/dist/SocialLinks.cjs.js +7 -6
- package/dist/SocialLinks.cjs.js.map +1 -1
- package/dist/SocialLinks.es.js +8 -7
- package/dist/SocialLinks.es.js.map +1 -1
- package/dist/Text.cjs.js +12 -71
- package/dist/Text.cjs.js.map +1 -1
- package/dist/Text.es.js +13 -64
- package/dist/Text.es.js.map +1 -1
- package/dist/Video.cjs.js +1 -0
- package/dist/Video.cjs.js.map +1 -1
- package/dist/Video.es.js +2 -1
- package/dist/Video.es.js.map +1 -1
- package/dist/builder.cjs.js +2 -0
- package/dist/builder.cjs.js.map +1 -1
- package/dist/builder.es.js +2 -0
- package/dist/builder.es.js.map +1 -1
- package/dist/components.cjs.js +4 -3
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +4 -3
- package/dist/components.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.cjs.js +31 -21
- package/dist/controls.cjs.js.map +1 -1
- package/dist/controls.es.js +4 -2
- package/dist/controls.es.js.map +1 -1
- package/dist/index.cjs.js +307 -243
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs2.js +3 -3
- package/dist/index.cjs2.js.map +1 -1
- package/dist/index.cjs3.js +21 -107
- package/dist/index.cjs3.js.map +1 -1
- package/dist/index.cjs4.js +16 -57
- package/dist/index.cjs4.js.map +1 -1
- package/dist/index.cjs5.js +53 -243
- package/dist/index.cjs5.js.map +1 -1
- package/dist/index.cjs6.js +16 -37
- package/dist/index.cjs6.js.map +1 -1
- package/dist/index.cjs7.js +376 -14
- package/dist/index.cjs7.js.map +1 -1
- package/dist/index.cjs8.js +276 -12
- package/dist/index.cjs8.js.map +1 -1
- package/dist/index.es.js +279 -215
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +2 -2
- package/dist/index.es3.js +22 -103
- package/dist/index.es3.js.map +1 -1
- package/dist/index.es4.js +16 -57
- package/dist/index.es4.js.map +1 -1
- package/dist/index.es5.js +53 -241
- package/dist/index.es5.js.map +1 -1
- package/dist/index.es6.js +16 -32
- package/dist/index.es6.js.map +1 -1
- package/dist/index.es7.js +372 -16
- package/dist/index.es7.js.map +1 -1
- package/dist/index.es8.js +271 -11
- package/dist/index.es8.js.map +1 -1
- package/dist/main.cjs.js +2 -0
- package/dist/main.cjs.js.map +1 -1
- package/dist/main.es.js +2 -0
- package/dist/main.es.js.map +1 -1
- package/dist/next.cjs.js +4 -1
- package/dist/next.cjs.js.map +1 -1
- package/dist/next.es.js +5 -2
- package/dist/next.es.js.map +1 -1
- package/dist/prop-controllers.cjs.js +2 -0
- package/dist/prop-controllers.cjs.js.map +1 -1
- package/dist/prop-controllers.es.js +2 -0
- package/dist/prop-controllers.es.js.map +1 -1
- package/dist/react-page.cjs.js +1731 -183
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +1694 -182
- package/dist/react-page.es.js.map +1 -1
- package/dist/react.cjs.js +4 -1
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.es.js +4 -1
- package/dist/react.es.js.map +1 -1
- package/dist/slate.cjs.js +32 -377
- package/dist/slate.cjs.js.map +1 -1
- package/dist/slate.es.js +14 -363
- package/dist/slate.es.js.map +1 -1
- package/dist/text-input.cjs.js +26 -0
- package/dist/text-input.cjs.js.map +1 -0
- package/dist/text-input.es.js +18 -0
- package/dist/text-input.es.js.map +1 -0
- package/dist/types/src/components/builtin/Text/Text.d.ts +3 -4
- package/dist/types/src/components/builtin/Text/Text.d.ts.map +1 -1
- package/dist/types/src/components/builtin/Text/register.d.ts.map +1 -1
- package/dist/types/src/controls/list.d.ts +5 -2
- package/dist/types/src/controls/list.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/fixtures/v2-data-types.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/introspection.d.ts +5 -0
- package/dist/types/src/controls/rich-text/introspection.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/introspection.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text/rich-text.d.ts +0 -1
- package/dist/types/src/controls/rich-text/rich-text.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text/translation.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/introspection.d.ts +5 -0
- package/dist/types/src/controls/rich-text-v2/introspection.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts +2 -0
- package/dist/types/src/controls/rich-text-v2/introspection.test.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts +29 -0
- package/dist/types/src/controls/rich-text-v2/plugin.d.ts.map +1 -0
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts +32 -34
- package/dist/types/src/controls/rich-text-v2/rich-text-v2.d.ts.map +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts +1 -1
- package/dist/types/src/controls/rich-text-v2/translation.d.ts.map +1 -1
- package/dist/types/src/controls/shape.d.ts +5 -2
- package/dist/types/src/controls/shape.d.ts.map +1 -1
- package/dist/types/src/controls/typography.d.ts +2 -0
- package/dist/types/src/controls/typography.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts +11 -1
- package/dist/types/src/prop-controllers/descriptors.d.ts.map +1 -1
- package/dist/types/src/prop-controllers/introspection.d.ts +0 -2
- package/dist/types/src/prop-controllers/introspection.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/control.d.ts.map +1 -1
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/editable-text.d.ts +4 -3
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/editable-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncDOMSelection.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncWithBuilder.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/EditableText/useSyncWithBuilder.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/ReadOnlyText.d.ts +2 -2
- package/dist/types/src/runtimes/react/controls/rich-text/ReadOnlyText.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/block.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/block.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/element.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/index.d.ts.map +1 -0
- package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/inline.d.ts +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/components/Element/inline.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/Leaf/leaf.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/components/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts +2 -0
- package/dist/types/src/runtimes/react/controls/rich-text/index.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/{rich-text.d.ts → rich-text/rich-text.d.ts} +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text/rich-text.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/editable-text-v2.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts +3 -2
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-element.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts +2 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/render-leaf.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts +4 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/EditableTextV2/useRemoteChanges.d.ts.map +1 -0
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts +8 -16
- package/dist/types/src/runtimes/react/controls/rich-text-v2/ReadOnlyTextV2.d.ts.map +1 -1
- package/dist/types/src/slate/BlockPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/BlockPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlineModePlugin/index.d.ts +6 -4
- package/dist/types/src/slate/InlineModePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/index.d.ts +3 -3
- package/dist/types/src/slate/InlinePlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts +1 -1
- package/dist/types/src/slate/InlinePlugin/types.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/LinkPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts +16 -0
- package/dist/types/src/slate/LinkPlugin/linkPluginWithoutRenderElement.d.ts.map +1 -0
- package/dist/types/src/slate/LocalChangesPlugin/index.d.ts +16 -0
- package/dist/types/src/slate/LocalChangesPlugin/index.d.ts.map +1 -0
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TextAlignPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/TypographyPlugin/index.d.ts +3 -3
- package/dist/types/src/slate/TypographyPlugin/index.d.ts.map +1 -1
- package/dist/types/src/slate/index.d.ts +1 -0
- package/dist/types/src/slate/index.d.ts.map +1 -1
- package/dist/types/src/slate/types.d.ts +3 -12
- package/dist/types/src/slate/types.d.ts.map +1 -1
- package/dist/types/src/slate/utils/element.d.ts.map +1 -1
- package/dist/types/src/state/modules/locales.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/index.cjs10.js +0 -390
- package/dist/index.cjs10.js.map +0 -1
- package/dist/index.cjs9.js +0 -299
- package/dist/index.cjs9.js.map +0 -1
- package/dist/index.es10.js +0 -383
- package/dist/index.es10.js.map +0 -1
- package/dist/index.es9.js +0 -292
- package/dist/index.es9.js.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/editable-text.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncDOMSelection.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/EditableText/useSyncWithBuilder.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/ReadOnlyText.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/block.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/element.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Element/inline.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/index.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/Leaf/leaf.d.ts.map +0 -1
- package/dist/types/src/components/builtin/Text/components/index.d.ts.map +0 -1
- package/dist/types/src/runtimes/react/controls/rich-text.d.ts.map +0 -1
- package/dist/types.cjs2.js +0 -746
- package/dist/types.cjs2.js.map +0 -1
- package/dist/types.es2.js +0 -729
- package/dist/types.es2.js.map +0 -1
- package/dist/typography.cjs.js +0 -56
- package/dist/typography.cjs.js.map +0 -1
- package/dist/typography.es.js +0 -41
- package/dist/typography.es.js.map +0 -1
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/EditableText/useSyncDOMSelection.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/element.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Element/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/index.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/Leaf/leaf.d.ts +0 -0
- /package/dist/types/src/{components/builtin/Text → runtimes/react/controls/rich-text}/components/index.d.ts +0 -0
package/dist/index.cjs.js
CHANGED
|
@@ -41,7 +41,7 @@ var dynamic = require("next/dynamic");
|
|
|
41
41
|
var reactPage = require("./react-page.cjs.js");
|
|
42
42
|
var actions = require("./actions.cjs.js");
|
|
43
43
|
var jsxRuntime = require("react/jsx-runtime");
|
|
44
|
-
var
|
|
44
|
+
var textInput = require("./text-input.cjs.js");
|
|
45
45
|
var combobox = require("./combobox.cjs.js");
|
|
46
46
|
require("slate");
|
|
47
47
|
var shim = require("use-sync-external-store/shim");
|
|
@@ -67,6 +67,9 @@ var setCookieParser = require("set-cookie-parser");
|
|
|
67
67
|
var constants = require("./constants.cjs.js");
|
|
68
68
|
var uuid = require("uuid");
|
|
69
69
|
var ipsum = require("corporate-ipsum");
|
|
70
|
+
require("is-hotkey");
|
|
71
|
+
require("slate-react");
|
|
72
|
+
var NextLink = require("next/link");
|
|
70
73
|
function _interopDefaultLegacy(e) {
|
|
71
74
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
72
75
|
}
|
|
@@ -101,6 +104,7 @@ var createEmotionServer__default = /* @__PURE__ */ _interopDefaultLegacy(createE
|
|
|
101
104
|
var NextDocument__default = /* @__PURE__ */ _interopDefaultLegacy(NextDocument);
|
|
102
105
|
var Cors__default = /* @__PURE__ */ _interopDefaultLegacy(Cors);
|
|
103
106
|
var ipsum__default = /* @__PURE__ */ _interopDefaultLegacy(ipsum);
|
|
107
|
+
var NextLink__default = /* @__PURE__ */ _interopDefaultLegacy(NextLink);
|
|
104
108
|
const SCRIPT_TAG = "script";
|
|
105
109
|
function BodySnippet({
|
|
106
110
|
code,
|
|
@@ -145,43 +149,6 @@ function BodySnippet({
|
|
|
145
149
|
}, [code, cleanup]);
|
|
146
150
|
return null;
|
|
147
151
|
}
|
|
148
|
-
function is(x, y) {
|
|
149
|
-
if (x === y)
|
|
150
|
-
return x !== 0 || y !== 0 || 1 / x === 1 / y;
|
|
151
|
-
return x !== x && y !== y;
|
|
152
|
-
}
|
|
153
|
-
const { hasOwnProperty: hasOwnProperty$1 } = Object.prototype;
|
|
154
|
-
const shallowEqual = (a, b) => {
|
|
155
|
-
if (is(a, b))
|
|
156
|
-
return true;
|
|
157
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
158
|
-
return false;
|
|
159
|
-
const keysA = Object.keys(a);
|
|
160
|
-
const keysB = Object.keys(b);
|
|
161
|
-
if (keysA.length !== keysB.length)
|
|
162
|
-
return false;
|
|
163
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
164
|
-
if (!hasOwnProperty$1.call(b, keysA[i]) || !is(a[keysA[i]], b[keysA[i]]))
|
|
165
|
-
return false;
|
|
166
|
-
}
|
|
167
|
-
return true;
|
|
168
|
-
};
|
|
169
|
-
const { hasOwnProperty } = Object.prototype;
|
|
170
|
-
const deepEqual = (a, b) => {
|
|
171
|
-
if (shallowEqual(a, b))
|
|
172
|
-
return true;
|
|
173
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null)
|
|
174
|
-
return false;
|
|
175
|
-
const keysA = Object.keys(a);
|
|
176
|
-
const keysB = Object.keys(b);
|
|
177
|
-
if (keysA.length !== keysB.length)
|
|
178
|
-
return false;
|
|
179
|
-
for (let i = 0; i < keysA.length; i += 1) {
|
|
180
|
-
if (!hasOwnProperty.call(b, keysA[i]) || !deepEqual(a[keysA[i]], b[keysA[i]]))
|
|
181
|
-
return false;
|
|
182
|
-
}
|
|
183
|
-
return true;
|
|
184
|
-
};
|
|
185
152
|
function getInitialState(serializedState = {
|
|
186
153
|
Swatch: [],
|
|
187
154
|
File: [],
|
|
@@ -216,7 +183,7 @@ function reducer$1(state = getInitialState(), action) {
|
|
|
216
183
|
}
|
|
217
184
|
case actions.ActionTypes.CHANGE_API_RESOURCE: {
|
|
218
185
|
const existingApiResource = getAPIResource$1(state, action.payload.resource.__typename, action.payload.resource.id);
|
|
219
|
-
if (deepEqual(existingApiResource, action.payload.resource))
|
|
186
|
+
if (reactPage.deepEqual(existingApiResource, action.payload.resource))
|
|
220
187
|
return state;
|
|
221
188
|
return new Map(state).set(action.payload.resource.__typename, new Map(state.get(action.payload.resource.__typename)).set(action.payload.resource.id, action.payload.resource));
|
|
222
189
|
}
|
|
@@ -657,7 +624,7 @@ function Page$1({
|
|
|
657
624
|
return;
|
|
658
625
|
const oldSnippets = snippets.map(filterUsedSnippetProperties);
|
|
659
626
|
const newSnippets = cachedPage.snippets.map(filterUsedSnippetProperties);
|
|
660
|
-
if (deepEqual(newSnippets, oldSnippets))
|
|
627
|
+
if (reactPage.deepEqual(newSnippets, oldSnippets))
|
|
661
628
|
return;
|
|
662
629
|
setSnippets(cachedPage.snippets);
|
|
663
630
|
}, [cachedPage]);
|
|
@@ -1053,8 +1020,8 @@ Received "${apiKey}" instead.`);
|
|
|
1053
1020
|
getResourcesFromElementDescriptors(elementDescriptors, element2.props);
|
|
1054
1021
|
}
|
|
1055
1022
|
const typographies = await this.getTypographies([...typographyIds]);
|
|
1056
|
-
typographies.forEach((
|
|
1057
|
-
|
|
1023
|
+
typographies.forEach((typography) => {
|
|
1024
|
+
typography == null ? void 0 : typography.style.forEach((style) => {
|
|
1058
1025
|
var _a;
|
|
1059
1026
|
const swatchId = (_a = style.value.color) == null ? void 0 : _a.swatchId;
|
|
1060
1027
|
if (swatchId != null)
|
|
@@ -1089,7 +1056,7 @@ Received "${apiKey}" instead.`);
|
|
|
1089
1056
|
var _a;
|
|
1090
1057
|
return {
|
|
1091
1058
|
id,
|
|
1092
|
-
value: (_a = typographies.find((
|
|
1059
|
+
value: (_a = typographies.find((typography) => (typography == null ? void 0 : typography.id) === id)) != null ? _a : null
|
|
1093
1060
|
};
|
|
1094
1061
|
}),
|
|
1095
1062
|
[types.APIResourceType.Table]: [...tableIds].map((id) => {
|
|
@@ -1121,12 +1088,19 @@ Received "${apiKey}" instead.`);
|
|
|
1121
1088
|
preview: previewOverride = false,
|
|
1122
1089
|
unstable_locale
|
|
1123
1090
|
} = {}) {
|
|
1124
|
-
var _a;
|
|
1091
|
+
var _a, _b;
|
|
1125
1092
|
const isUsingVersioning = this.siteVersion != null;
|
|
1126
1093
|
const siteVersion = (_a = this.siteVersion) != null ? _a : previewOverride ? MakeswiftSiteVersion.Working : MakeswiftSiteVersion.Live;
|
|
1094
|
+
const defaultLocale = (_b = reactPage.getDefaultLocale(this.runtime.store.getState())) == null ? void 0 : _b.toString();
|
|
1095
|
+
const locale = unstable_locale === defaultLocale ? null : unstable_locale;
|
|
1127
1096
|
const searchParams = new URLSearchParams();
|
|
1128
|
-
if (
|
|
1129
|
-
|
|
1097
|
+
if (locale) {
|
|
1098
|
+
const locales = reactPage.getLocales(this.runtime.store.getState()).map((locale2) => locale2.toString());
|
|
1099
|
+
if (!locales.includes(locale)) {
|
|
1100
|
+
throw new Error(`Locale "${locale}" is not included in the locales: ${locales}. Please add the locale to the locales on the ReactRuntime.`);
|
|
1101
|
+
}
|
|
1102
|
+
searchParams.set("locale", locale);
|
|
1103
|
+
}
|
|
1130
1104
|
const response = await this.fetch(`/${isUsingVersioning ? "v3" : "v2"}/pages/${encodeURIComponent(pathname)}/document?${searchParams.toString()}`, {
|
|
1131
1105
|
headers: { "Makeswift-Site-Version": siteVersion }
|
|
1132
1106
|
});
|
|
@@ -1146,7 +1120,7 @@ Received "${apiKey}" instead.`);
|
|
|
1146
1120
|
apiOrigin,
|
|
1147
1121
|
preview,
|
|
1148
1122
|
localizedResourcesMap,
|
|
1149
|
-
locale:
|
|
1123
|
+
locale: locale != null ? locale : null
|
|
1150
1124
|
};
|
|
1151
1125
|
}
|
|
1152
1126
|
async getSwatch(swatchId) {
|
|
@@ -1240,7 +1214,7 @@ async function fonts(_req, res, { getFonts } = {}) {
|
|
|
1240
1214
|
const fonts2 = (_a = await (getFonts == null ? void 0 : getFonts())) != null ? _a : [];
|
|
1241
1215
|
return res.json(fonts2);
|
|
1242
1216
|
}
|
|
1243
|
-
const version = "0.
|
|
1217
|
+
const version = "0.10.0";
|
|
1244
1218
|
async function handler(req, res, { apiKey, unstable_siteVersions }) {
|
|
1245
1219
|
if (req.query.secret !== apiKey) {
|
|
1246
1220
|
return res.status(401).json({ message: "Unauthorized" });
|
|
@@ -2416,6 +2390,211 @@ function registerComponent$2(runtime) {
|
|
|
2416
2390
|
}
|
|
2417
2391
|
});
|
|
2418
2392
|
}
|
|
2393
|
+
function useSwatch(swatchId) {
|
|
2394
|
+
const client = useMakeswiftClient();
|
|
2395
|
+
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2396
|
+
const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2397
|
+
React.useEffect(() => {
|
|
2398
|
+
if (swatchId != null)
|
|
2399
|
+
client.fetchSwatch(swatchId).catch(console.error);
|
|
2400
|
+
}, [client, swatchId]);
|
|
2401
|
+
return swatch;
|
|
2402
|
+
}
|
|
2403
|
+
function useSwatches(swatchIds) {
|
|
2404
|
+
const client = useMakeswiftClient();
|
|
2405
|
+
const lastSnapshot = React.useRef();
|
|
2406
|
+
function getSnapshot() {
|
|
2407
|
+
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2408
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2409
|
+
return lastSnapshot.current;
|
|
2410
|
+
}
|
|
2411
|
+
return lastSnapshot.current = swatches2;
|
|
2412
|
+
}
|
|
2413
|
+
const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2414
|
+
React.useEffect(() => {
|
|
2415
|
+
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2416
|
+
}, [client, swatchIds]);
|
|
2417
|
+
return swatches;
|
|
2418
|
+
}
|
|
2419
|
+
function useFile(fileId) {
|
|
2420
|
+
const client = useMakeswiftClient();
|
|
2421
|
+
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2422
|
+
const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2423
|
+
React.useEffect(() => {
|
|
2424
|
+
if (fileId != null)
|
|
2425
|
+
client.fetchFile(fileId);
|
|
2426
|
+
}, [client, fileId]);
|
|
2427
|
+
return file;
|
|
2428
|
+
}
|
|
2429
|
+
function useFiles(fileIds) {
|
|
2430
|
+
const client = useMakeswiftClient();
|
|
2431
|
+
const lastSnapshot = React.useRef();
|
|
2432
|
+
function getSnapshot() {
|
|
2433
|
+
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2434
|
+
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2435
|
+
return lastSnapshot.current;
|
|
2436
|
+
}
|
|
2437
|
+
return lastSnapshot.current = files2;
|
|
2438
|
+
}
|
|
2439
|
+
const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2440
|
+
React.useEffect(() => {
|
|
2441
|
+
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2442
|
+
}, [client, fileIds]);
|
|
2443
|
+
return files;
|
|
2444
|
+
}
|
|
2445
|
+
function useTypography(typographyId) {
|
|
2446
|
+
const client = useMakeswiftClient();
|
|
2447
|
+
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2448
|
+
const typography = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2449
|
+
React.useEffect(() => {
|
|
2450
|
+
if (typographyId != null)
|
|
2451
|
+
client.fetchTypography(typographyId).catch(console.error);
|
|
2452
|
+
}, [client, typographyId]);
|
|
2453
|
+
return typography;
|
|
2454
|
+
}
|
|
2455
|
+
function useGlobalElement(globalElementId) {
|
|
2456
|
+
const client = useMakeswiftClient();
|
|
2457
|
+
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2458
|
+
const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2459
|
+
React.useEffect(() => {
|
|
2460
|
+
if (globalElementId != null)
|
|
2461
|
+
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2462
|
+
}, [client, globalElementId]);
|
|
2463
|
+
return globalElement;
|
|
2464
|
+
}
|
|
2465
|
+
function useLocalizedGlobalElement(globalElementId) {
|
|
2466
|
+
const client = useMakeswiftClient();
|
|
2467
|
+
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2468
|
+
const localizedGlobalElement = shim.useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2469
|
+
React.useEffect(() => {
|
|
2470
|
+
if (globalElementId != null) {
|
|
2471
|
+
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2472
|
+
}
|
|
2473
|
+
}, [client, globalElementId]);
|
|
2474
|
+
return localizedGlobalElement;
|
|
2475
|
+
}
|
|
2476
|
+
function usePagePathnameSlice(pageId) {
|
|
2477
|
+
const client = useMakeswiftClient();
|
|
2478
|
+
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2479
|
+
const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2480
|
+
React.useEffect(() => {
|
|
2481
|
+
if (pageId != null)
|
|
2482
|
+
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2483
|
+
}, [client, pageId]);
|
|
2484
|
+
return pagePathnameSlice;
|
|
2485
|
+
}
|
|
2486
|
+
function useTable(tableId) {
|
|
2487
|
+
const client = useMakeswiftClient();
|
|
2488
|
+
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2489
|
+
const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2490
|
+
React.useEffect(() => {
|
|
2491
|
+
if (tableId != null)
|
|
2492
|
+
client.fetchTable(tableId).catch(console.error);
|
|
2493
|
+
}, [client, tableId]);
|
|
2494
|
+
return table;
|
|
2495
|
+
}
|
|
2496
|
+
const Link = React.forwardRef(function Link2(_e, ref) {
|
|
2497
|
+
var _f = _e, {
|
|
2498
|
+
link,
|
|
2499
|
+
onClick = () => {
|
|
2500
|
+
}
|
|
2501
|
+
} = _f, restOfProps = __objRest(_f, [
|
|
2502
|
+
"link",
|
|
2503
|
+
"onClick"
|
|
2504
|
+
]);
|
|
2505
|
+
var _a;
|
|
2506
|
+
const pageId = link && link.type === "OPEN_PAGE" ? link.payload.pageId : null;
|
|
2507
|
+
const page = usePagePathnameSlice(pageId != null ? pageId : null);
|
|
2508
|
+
const elementKey = (link == null ? void 0 : link.type) === "SCROLL_TO_ELEMENT" ? (_a = link.payload.elementIdConfig) == null ? void 0 : _a.elementKey : null;
|
|
2509
|
+
const elementId = useElementId(elementKey);
|
|
2510
|
+
let useNextLink;
|
|
2511
|
+
let href;
|
|
2512
|
+
let target;
|
|
2513
|
+
let block;
|
|
2514
|
+
if (link) {
|
|
2515
|
+
switch (link.type) {
|
|
2516
|
+
case "OPEN_PAGE": {
|
|
2517
|
+
if (page) {
|
|
2518
|
+
useNextLink = true;
|
|
2519
|
+
href = `/${page.pathname}`;
|
|
2520
|
+
}
|
|
2521
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2522
|
+
break;
|
|
2523
|
+
}
|
|
2524
|
+
case "OPEN_URL": {
|
|
2525
|
+
useNextLink = true;
|
|
2526
|
+
href = link.payload.url;
|
|
2527
|
+
target = link.payload.openInNewTab ? "_blank" : "_self";
|
|
2528
|
+
break;
|
|
2529
|
+
}
|
|
2530
|
+
case "SEND_EMAIL": {
|
|
2531
|
+
useNextLink = false;
|
|
2532
|
+
const {
|
|
2533
|
+
to,
|
|
2534
|
+
subject = "",
|
|
2535
|
+
body = ""
|
|
2536
|
+
} = link.payload;
|
|
2537
|
+
if (to != null)
|
|
2538
|
+
href = `mailto:${to}?subject=${subject}&body=${body}`;
|
|
2539
|
+
break;
|
|
2540
|
+
}
|
|
2541
|
+
case "CALL_PHONE": {
|
|
2542
|
+
useNextLink = false;
|
|
2543
|
+
href = `tel:${link.payload.phoneNumber}`;
|
|
2544
|
+
break;
|
|
2545
|
+
}
|
|
2546
|
+
case "SCROLL_TO_ELEMENT": {
|
|
2547
|
+
useNextLink = false;
|
|
2548
|
+
href = `#${elementId != null ? elementId : ""}`;
|
|
2549
|
+
block = link.payload.block;
|
|
2550
|
+
break;
|
|
2551
|
+
}
|
|
2552
|
+
default:
|
|
2553
|
+
throw new RangeError(`Invalid link type "${link.type}."`);
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
function handleClick(event) {
|
|
2557
|
+
onClick(event);
|
|
2558
|
+
if (event.defaultPrevented)
|
|
2559
|
+
return;
|
|
2560
|
+
if (event.currentTarget.isContentEditable)
|
|
2561
|
+
return event.preventDefault();
|
|
2562
|
+
if (link && link.type === "SCROLL_TO_ELEMENT") {
|
|
2563
|
+
let hash;
|
|
2564
|
+
try {
|
|
2565
|
+
if (href != null)
|
|
2566
|
+
hash = new URL(`http://www.example.com/${href}`).hash;
|
|
2567
|
+
} catch (error) {
|
|
2568
|
+
console.error(`Link received invalid href: ${href}`, error);
|
|
2569
|
+
}
|
|
2570
|
+
if (href != null && hash != null && href === hash) {
|
|
2571
|
+
event.preventDefault();
|
|
2572
|
+
const view = event.view;
|
|
2573
|
+
scrollIntoView__default["default"](view.document.querySelector(hash), {
|
|
2574
|
+
behavior: "smooth",
|
|
2575
|
+
block
|
|
2576
|
+
});
|
|
2577
|
+
if (view.location.hash !== hash)
|
|
2578
|
+
view.history.pushState({}, "", hash);
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
if (useNextLink && href != null) {
|
|
2583
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NextLink__default["default"], __spreadProps(__spreadValues({}, restOfProps), {
|
|
2584
|
+
ref,
|
|
2585
|
+
target,
|
|
2586
|
+
onClick: handleClick,
|
|
2587
|
+
href,
|
|
2588
|
+
legacyBehavior: false
|
|
2589
|
+
}));
|
|
2590
|
+
}
|
|
2591
|
+
return /* @__PURE__ */ jsxRuntime.jsx("a", __spreadProps(__spreadValues({}, restOfProps), {
|
|
2592
|
+
ref,
|
|
2593
|
+
href,
|
|
2594
|
+
target,
|
|
2595
|
+
onClick: handleClick
|
|
2596
|
+
}));
|
|
2597
|
+
});
|
|
2419
2598
|
function registerComponent$1(runtime) {
|
|
2420
2599
|
return runtime.registerComponent(forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
2421
2600
|
return require("./Text.cjs.js");
|
|
@@ -2424,52 +2603,36 @@ function registerComponent$1(runtime) {
|
|
|
2424
2603
|
label: "Text",
|
|
2425
2604
|
props: {
|
|
2426
2605
|
id: reactPage.ElementID(),
|
|
2427
|
-
text: reactPage.RichText(
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2606
|
+
text: reactPage.RichText({
|
|
2607
|
+
unstable_defaultValue: [
|
|
2608
|
+
{
|
|
2609
|
+
type: reactPage.BlockType.Default,
|
|
2610
|
+
children: [
|
|
2432
2611
|
{
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2612
|
+
text: ipsum__default["default"](3),
|
|
2613
|
+
typography: {
|
|
2614
|
+
style: [
|
|
2615
|
+
{
|
|
2616
|
+
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2617
|
+
value: {
|
|
2618
|
+
fontWeight: 400,
|
|
2619
|
+
fontSize: { value: 18, unit: "px" },
|
|
2620
|
+
lineHeight: 1.5
|
|
2621
|
+
}
|
|
2622
|
+
},
|
|
2623
|
+
...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
|
|
2440
2624
|
{
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
data: {
|
|
2444
|
-
value: {
|
|
2445
|
-
id: null,
|
|
2446
|
-
style: [
|
|
2447
|
-
{
|
|
2448
|
-
deviceId: state_breakpoints.getBaseBreakpoint(runtime.getBreakpoints()).id,
|
|
2449
|
-
value: {
|
|
2450
|
-
fontWeight: 400,
|
|
2451
|
-
fontSize: { value: 18, unit: "px" },
|
|
2452
|
-
lineHeight: 1.5
|
|
2453
|
-
}
|
|
2454
|
-
},
|
|
2455
|
-
...runtime.getBreakpoints().some(({ id }) => id === state_breakpoints.DefaultBreakpointID.Mobile) ? [
|
|
2456
|
-
{
|
|
2457
|
-
deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
|
|
2458
|
-
value: { fontSize: { value: 16, unit: "px" } }
|
|
2459
|
-
}
|
|
2460
|
-
] : []
|
|
2461
|
-
]
|
|
2462
|
-
}
|
|
2463
|
-
}
|
|
2625
|
+
deviceId: state_breakpoints.DefaultBreakpointID.Mobile,
|
|
2626
|
+
value: { fontSize: { value: 16, unit: "px" } }
|
|
2464
2627
|
}
|
|
2465
|
-
]
|
|
2466
|
-
|
|
2467
|
-
|
|
2628
|
+
] : []
|
|
2629
|
+
]
|
|
2630
|
+
}
|
|
2468
2631
|
}
|
|
2469
2632
|
]
|
|
2470
2633
|
}
|
|
2471
|
-
|
|
2472
|
-
})
|
|
2634
|
+
]
|
|
2635
|
+
}),
|
|
2473
2636
|
width: reactPage.Width({
|
|
2474
2637
|
format: reactPage.Width.Format.ClassName,
|
|
2475
2638
|
preset: [
|
|
@@ -2597,115 +2760,15 @@ const FallbackComponent = React.forwardRef(function FallbackComponent2({
|
|
|
2597
2760
|
})]
|
|
2598
2761
|
});
|
|
2599
2762
|
});
|
|
2600
|
-
function
|
|
2601
|
-
|
|
2602
|
-
const readSwatch = () => swatchId == null ? null : client.readSwatch(swatchId);
|
|
2603
|
-
const swatch = shim.useSyncExternalStore(client.subscribe, readSwatch, readSwatch);
|
|
2604
|
-
React.useEffect(() => {
|
|
2605
|
-
if (swatchId != null)
|
|
2606
|
-
client.fetchSwatch(swatchId).catch(console.error);
|
|
2607
|
-
}, [client, swatchId]);
|
|
2608
|
-
return swatch;
|
|
2609
|
-
}
|
|
2610
|
-
function useSwatches(swatchIds) {
|
|
2611
|
-
const client = useMakeswiftClient();
|
|
2612
|
-
const lastSnapshot = React.useRef();
|
|
2613
|
-
function getSnapshot() {
|
|
2614
|
-
const swatches2 = swatchIds.map((swatchId) => client.readSwatch(swatchId));
|
|
2615
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === swatches2.length && lastSnapshot.current.every((swatch, idx) => swatches2[idx] === swatch)) {
|
|
2616
|
-
return lastSnapshot.current;
|
|
2617
|
-
}
|
|
2618
|
-
return lastSnapshot.current = swatches2;
|
|
2619
|
-
}
|
|
2620
|
-
const swatches = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2621
|
-
React.useEffect(() => {
|
|
2622
|
-
Promise.all(swatchIds.map((swatchId) => client.fetchSwatch(swatchId))).catch(console.error);
|
|
2623
|
-
}, [client, swatchIds]);
|
|
2624
|
-
return swatches;
|
|
2625
|
-
}
|
|
2626
|
-
function useFile(fileId) {
|
|
2627
|
-
const client = useMakeswiftClient();
|
|
2628
|
-
const readFile = () => fileId == null ? null : client.readFile(fileId);
|
|
2629
|
-
const file = shim.useSyncExternalStore(client.subscribe, readFile, readFile);
|
|
2630
|
-
React.useEffect(() => {
|
|
2631
|
-
if (fileId != null)
|
|
2632
|
-
client.fetchFile(fileId);
|
|
2633
|
-
}, [client, fileId]);
|
|
2634
|
-
return file;
|
|
2635
|
-
}
|
|
2636
|
-
function useFiles(fileIds) {
|
|
2637
|
-
const client = useMakeswiftClient();
|
|
2638
|
-
const lastSnapshot = React.useRef();
|
|
2639
|
-
function getSnapshot() {
|
|
2640
|
-
const files2 = fileIds.map((fileId) => client.readFile(fileId));
|
|
2641
|
-
if (lastSnapshot.current != null && lastSnapshot.current.length === files2.length && lastSnapshot.current.every((file, idx) => files2[idx] === file)) {
|
|
2642
|
-
return lastSnapshot.current;
|
|
2643
|
-
}
|
|
2644
|
-
return lastSnapshot.current = files2;
|
|
2645
|
-
}
|
|
2646
|
-
const files = shim.useSyncExternalStore(client.subscribe, getSnapshot, getSnapshot);
|
|
2647
|
-
React.useEffect(() => {
|
|
2648
|
-
Promise.all(fileIds.map((fileId) => client.fetchFile(fileId))).catch(console.error);
|
|
2649
|
-
}, [client, fileIds]);
|
|
2650
|
-
return files;
|
|
2651
|
-
}
|
|
2652
|
-
function useTypography(typographyId) {
|
|
2653
|
-
const client = useMakeswiftClient();
|
|
2654
|
-
const readTypography = () => typographyId == null ? null : client.readTypography(typographyId);
|
|
2655
|
-
const typography2 = shim.useSyncExternalStore(client.subscribe, readTypography, readTypography);
|
|
2656
|
-
React.useEffect(() => {
|
|
2657
|
-
if (typographyId != null)
|
|
2658
|
-
client.fetchTypography(typographyId).catch(console.error);
|
|
2659
|
-
}, [client, typographyId]);
|
|
2660
|
-
return typography2;
|
|
2661
|
-
}
|
|
2662
|
-
function useGlobalElement(globalElementId) {
|
|
2663
|
-
const client = useMakeswiftClient();
|
|
2664
|
-
const readGlobalElement = () => globalElementId == null ? null : client.readGlobalElement(globalElementId);
|
|
2665
|
-
const globalElement = shim.useSyncExternalStore(client.subscribe, readGlobalElement, readGlobalElement);
|
|
2666
|
-
React.useEffect(() => {
|
|
2667
|
-
if (globalElementId != null)
|
|
2668
|
-
client.fetchGlobalElement(globalElementId).catch(console.error);
|
|
2669
|
-
}, [client, globalElementId]);
|
|
2670
|
-
return globalElement;
|
|
2671
|
-
}
|
|
2672
|
-
function useLocalizedGlobalElement(globalElementId) {
|
|
2673
|
-
const client = useMakeswiftClient();
|
|
2674
|
-
const readLocalizedGlobalElement = () => globalElementId == null ? null : client.readLocalizedGlobalElement(globalElementId);
|
|
2675
|
-
const localizedGlobalElement = shim.useSyncExternalStore(client.subscribe, readLocalizedGlobalElement, readLocalizedGlobalElement);
|
|
2676
|
-
React.useEffect(() => {
|
|
2677
|
-
if (globalElementId != null) {
|
|
2678
|
-
client.fetchLocalizedGlobalElement(globalElementId).catch(console.error);
|
|
2679
|
-
}
|
|
2680
|
-
}, [client, globalElementId]);
|
|
2681
|
-
return localizedGlobalElement;
|
|
2682
|
-
}
|
|
2683
|
-
function usePagePathnameSlice(pageId) {
|
|
2684
|
-
const client = useMakeswiftClient();
|
|
2685
|
-
const readPagePathnameSlice = () => pageId == null ? null : client.readPagePathnameSlice(pageId);
|
|
2686
|
-
const pagePathnameSlice = shim.useSyncExternalStore(client.subscribe, readPagePathnameSlice, readPagePathnameSlice);
|
|
2687
|
-
React.useEffect(() => {
|
|
2688
|
-
if (pageId != null)
|
|
2689
|
-
client.fetchPagePathnameSlice(pageId).catch(console.error);
|
|
2690
|
-
}, [client, pageId]);
|
|
2691
|
-
return pagePathnameSlice;
|
|
2692
|
-
}
|
|
2693
|
-
function useTable(tableId) {
|
|
2694
|
-
const client = useMakeswiftClient();
|
|
2695
|
-
const readTable = () => tableId == null ? null : client.readTable(tableId);
|
|
2696
|
-
const table = shim.useSyncExternalStore(client.subscribe, readTable, readTable);
|
|
2697
|
-
React.useEffect(() => {
|
|
2698
|
-
if (tableId != null)
|
|
2699
|
-
client.fetchTable(tableId).catch(console.error);
|
|
2700
|
-
}, [client, tableId]);
|
|
2701
|
-
return table;
|
|
2763
|
+
function isNonNullable(value) {
|
|
2764
|
+
return value != null;
|
|
2702
2765
|
}
|
|
2703
|
-
function mapSideColor(swatches,
|
|
2704
|
-
var
|
|
2766
|
+
function mapSideColor(swatches, _g) {
|
|
2767
|
+
var _h = _g, { color } = _h, restOfSide = __objRest(_h, ["color"]);
|
|
2705
2768
|
return __spreadProps(__spreadValues({}, restOfSide), {
|
|
2706
2769
|
color: color && {
|
|
2707
2770
|
alpha: color.alpha,
|
|
2708
|
-
swatch: swatches.filter(
|
|
2771
|
+
swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId)
|
|
2709
2772
|
}
|
|
2710
2773
|
});
|
|
2711
2774
|
}
|
|
@@ -2751,7 +2814,7 @@ function useBoxShadow(value) {
|
|
|
2751
2814
|
return __spreadProps(__spreadValues({}, restOfShadow), {
|
|
2752
2815
|
payload: {
|
|
2753
2816
|
color: color != null ? {
|
|
2754
|
-
swatch: swatches.filter(
|
|
2817
|
+
swatch: swatches.filter(isNonNullable).find((s) => s && s.id === color.swatchId),
|
|
2755
2818
|
alpha: color.alpha
|
|
2756
2819
|
} : null,
|
|
2757
2820
|
inset: inset != null ? inset : ShadowDefaultValue.inset,
|
|
@@ -2775,7 +2838,7 @@ function useResponsiveColor(color) {
|
|
|
2775
2838
|
const { swatchId, alpha } = v;
|
|
2776
2839
|
const swatch = swatches.find((s) => s && s.id === swatchId);
|
|
2777
2840
|
return swatch == null ? null : __spreadProps(__spreadValues({}, rest), { value: { swatch, alpha } });
|
|
2778
|
-
}).filter(
|
|
2841
|
+
}).filter(isNonNullable);
|
|
2779
2842
|
}
|
|
2780
2843
|
const getIndexes = (spans, index) => {
|
|
2781
2844
|
const flattened = spans.reduce((a, s) => a.concat(s), []);
|
|
@@ -3081,7 +3144,7 @@ function useFormattedStyle(styleControlData, controlDefinition, control) {
|
|
|
3081
3144
|
return;
|
|
3082
3145
|
const element = document.querySelector(`.${guid}`);
|
|
3083
3146
|
const measuredBoxModel = element == null ? null : boxModels.getBox(element);
|
|
3084
|
-
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3147
|
+
if (!reactPage.deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3085
3148
|
currentBoxModel = measuredBoxModel;
|
|
3086
3149
|
control.changeBoxModel(currentBoxModel);
|
|
3087
3150
|
}
|
|
@@ -3233,8 +3296,11 @@ function ListControlValue({
|
|
|
3233
3296
|
function useNumber(numberControlData, controlDefinition) {
|
|
3234
3297
|
return numberControlData != null ? numberControlData : controlDefinition.config.defaultValue;
|
|
3235
3298
|
}
|
|
3236
|
-
const
|
|
3237
|
-
return require("./index.
|
|
3299
|
+
const EditableText$1 = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3300
|
+
return require("./index.cjs7.js");
|
|
3301
|
+
}))));
|
|
3302
|
+
const ReadOnlyText$1 = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3303
|
+
return require("./ReadOnlyText.cjs.js");
|
|
3238
3304
|
}))));
|
|
3239
3305
|
function useRichText(data, control) {
|
|
3240
3306
|
const textCallbackRef = React.useCallback((handle) => {
|
|
@@ -3244,13 +3310,17 @@ function useRichText(data, control) {
|
|
|
3244
3310
|
text: control
|
|
3245
3311
|
});
|
|
3246
3312
|
}, [control]);
|
|
3247
|
-
|
|
3313
|
+
const isPreview = useIsPreview();
|
|
3314
|
+
return isPreview ? /* @__PURE__ */ jsxRuntime.jsx(EditableText$1, {
|
|
3315
|
+
text: data,
|
|
3316
|
+
ref: textCallbackRef
|
|
3317
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText$1, {
|
|
3248
3318
|
text: data,
|
|
3249
3319
|
ref: textCallbackRef
|
|
3250
3320
|
});
|
|
3251
3321
|
}
|
|
3252
3322
|
const EditableText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3253
|
-
return require("./index.
|
|
3323
|
+
return require("./index.cjs8.js");
|
|
3254
3324
|
}))));
|
|
3255
3325
|
const ReadOnlyText = forwardNextDynamicRef((patch) => dynamic__default["default"](() => patch(Promise.resolve().then(function() {
|
|
3256
3326
|
return require("./ReadOnlyTextV2.cjs.js");
|
|
@@ -3271,7 +3341,7 @@ function useRichTextV2(data, definition, control) {
|
|
|
3271
3341
|
control
|
|
3272
3342
|
}) : /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyText, {
|
|
3273
3343
|
text: data,
|
|
3274
|
-
|
|
3344
|
+
definition
|
|
3275
3345
|
});
|
|
3276
3346
|
}
|
|
3277
3347
|
function useSelectControlValue(data, definition) {
|
|
@@ -3299,7 +3369,7 @@ function pollBoxModel({
|
|
|
3299
3369
|
let currentBoxModel = null;
|
|
3300
3370
|
const handleAnimationFrameRequest = () => {
|
|
3301
3371
|
const measuredBoxModel = boxModels.getBox(element);
|
|
3302
|
-
if (!deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3372
|
+
if (!reactPage.deepEqual(currentBoxModel, measuredBoxModel)) {
|
|
3303
3373
|
currentBoxModel = measuredBoxModel;
|
|
3304
3374
|
onBoxModelChange(currentBoxModel);
|
|
3305
3375
|
}
|
|
@@ -3329,13 +3399,13 @@ function useSlot(data, control) {
|
|
|
3329
3399
|
}, element.key))
|
|
3330
3400
|
});
|
|
3331
3401
|
}
|
|
3332
|
-
function Slot(
|
|
3333
|
-
var
|
|
3402
|
+
function Slot(_i) {
|
|
3403
|
+
var _j = _i, {
|
|
3334
3404
|
as,
|
|
3335
3405
|
control,
|
|
3336
3406
|
children,
|
|
3337
3407
|
className
|
|
3338
|
-
} =
|
|
3408
|
+
} = _j, restOfProps = __objRest(_j, [
|
|
3339
3409
|
"as",
|
|
3340
3410
|
"control",
|
|
3341
3411
|
"children",
|
|
@@ -3364,15 +3434,15 @@ function Slot(_g) {
|
|
|
3364
3434
|
}
|
|
3365
3435
|
Slot.Placeholder = SlotPlaceholder;
|
|
3366
3436
|
Slot.Item = SlotItem;
|
|
3367
|
-
function SlotItem(
|
|
3368
|
-
var
|
|
3437
|
+
function SlotItem(_k) {
|
|
3438
|
+
var _l = _k, {
|
|
3369
3439
|
as,
|
|
3370
3440
|
control,
|
|
3371
3441
|
grid,
|
|
3372
3442
|
index,
|
|
3373
3443
|
children,
|
|
3374
3444
|
className
|
|
3375
|
-
} =
|
|
3445
|
+
} = _l, restOfProps = __objRest(_l, [
|
|
3376
3446
|
"as",
|
|
3377
3447
|
"control",
|
|
3378
3448
|
"grid",
|
|
@@ -3497,15 +3567,12 @@ function useTextAreaValue(data, definition) {
|
|
|
3497
3567
|
function useTextInputValue(data, definition) {
|
|
3498
3568
|
return data != null ? data : definition.config.defaultValue;
|
|
3499
3569
|
}
|
|
3500
|
-
function
|
|
3501
|
-
|
|
3502
|
-
}
|
|
3503
|
-
function typographyFragementToTypographyControlData(typography2) {
|
|
3504
|
-
if (typography2 == null)
|
|
3570
|
+
function typographyFragementToTypographyControlData(typography) {
|
|
3571
|
+
if (typography == null)
|
|
3505
3572
|
return void 0;
|
|
3506
3573
|
return {
|
|
3507
|
-
id:
|
|
3508
|
-
style:
|
|
3574
|
+
id: typography.id,
|
|
3575
|
+
style: typography.style.map(({ deviceId, value }) => {
|
|
3509
3576
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3510
3577
|
return {
|
|
3511
3578
|
deviceId,
|
|
@@ -3531,7 +3598,7 @@ function getTypographyStyleSwatchIds(style) {
|
|
|
3531
3598
|
return (_a = style == null ? void 0 : style.map((override) => override.value).flatMap((typographyStyle) => {
|
|
3532
3599
|
var _a2;
|
|
3533
3600
|
return (_a2 = typographyStyle.color) == null ? void 0 : _a2.swatchId;
|
|
3534
|
-
}).filter(isNonNullable)) != null ? _a : [];
|
|
3601
|
+
}).filter(reactPage.isNonNullable)) != null ? _a : [];
|
|
3535
3602
|
}
|
|
3536
3603
|
const withColor = (swatches) => (deviceRawTypographyValue) => {
|
|
3537
3604
|
var _b, _c;
|
|
@@ -3559,15 +3626,15 @@ const withColor = (swatches) => (deviceRawTypographyValue) => {
|
|
|
3559
3626
|
const getDeviceId = ({ deviceId }) => deviceId;
|
|
3560
3627
|
function useEnhancedTypography(value) {
|
|
3561
3628
|
var _a, _b, _c;
|
|
3562
|
-
const
|
|
3563
|
-
const source = (_b =
|
|
3629
|
+
const typography = typographyFragementToTypographyControlData(useTypography((_a = value == null ? void 0 : value.id) != null ? _a : null));
|
|
3630
|
+
const source = (_b = typography == null ? void 0 : typography.style) != null ? _b : [];
|
|
3564
3631
|
const override = (_c = value == null ? void 0 : value.style) != null ? _c : [];
|
|
3565
3632
|
const breakpoints = useBreakpoints();
|
|
3566
3633
|
const swatchIds = [
|
|
3567
3634
|
...getTypographyStyleSwatchIds(value == null ? void 0 : value.style),
|
|
3568
|
-
...getTypographyStyleSwatchIds(
|
|
3635
|
+
...getTypographyStyleSwatchIds(typography == null ? void 0 : typography.style)
|
|
3569
3636
|
];
|
|
3570
|
-
const swatches = useSwatches(swatchIds).filter(isNonNullable);
|
|
3637
|
+
const swatches = useSwatches(swatchIds).filter(reactPage.isNonNullable);
|
|
3571
3638
|
const enhancedSource = source.map(withColor(swatches));
|
|
3572
3639
|
const enhancedOverride = override.map(withColor(swatches));
|
|
3573
3640
|
const devices = [
|
|
@@ -3594,7 +3661,7 @@ function useEnhancedTypography(value) {
|
|
|
3594
3661
|
};
|
|
3595
3662
|
}
|
|
3596
3663
|
return null;
|
|
3597
|
-
}).filter(isNonNullable);
|
|
3664
|
+
}).filter(reactPage.isNonNullable);
|
|
3598
3665
|
}
|
|
3599
3666
|
function useTypographyClassName(value) {
|
|
3600
3667
|
return reactPage.useStyle(useResponsiveStyle([value], ([value2]) => {
|
|
@@ -3636,31 +3703,31 @@ function ControlValue({
|
|
|
3636
3703
|
control
|
|
3637
3704
|
}) {
|
|
3638
3705
|
switch (definition.type) {
|
|
3639
|
-
case
|
|
3706
|
+
case textInput.CheckboxControlType:
|
|
3640
3707
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3641
3708
|
hook: useCheckboxControlValue,
|
|
3642
3709
|
parameters: [data, definition],
|
|
3643
3710
|
children: (value) => children(value)
|
|
3644
3711
|
}, definition.type);
|
|
3645
|
-
case
|
|
3712
|
+
case textInput.NumberControlType:
|
|
3646
3713
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3647
3714
|
hook: useNumber,
|
|
3648
3715
|
parameters: [data, definition],
|
|
3649
3716
|
children: (value) => children(value)
|
|
3650
3717
|
}, definition.type);
|
|
3651
|
-
case
|
|
3718
|
+
case textInput.TextInputControlType:
|
|
3652
3719
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3653
3720
|
hook: useTextInputValue,
|
|
3654
3721
|
parameters: [data, definition],
|
|
3655
3722
|
children: (value) => children(value)
|
|
3656
3723
|
}, definition.type);
|
|
3657
|
-
case
|
|
3724
|
+
case textInput.TextAreaControlType:
|
|
3658
3725
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3659
3726
|
hook: useTextAreaValue,
|
|
3660
3727
|
parameters: [data, definition],
|
|
3661
3728
|
children: (value) => children(value)
|
|
3662
3729
|
}, definition.type);
|
|
3663
|
-
case
|
|
3730
|
+
case reactPage.SelectControlType:
|
|
3664
3731
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3665
3732
|
hook: useSelectControlValue,
|
|
3666
3733
|
parameters: [data, definition],
|
|
@@ -3672,7 +3739,7 @@ function ControlValue({
|
|
|
3672
3739
|
parameters: [data, definition],
|
|
3673
3740
|
children: (value) => children(value)
|
|
3674
3741
|
}, definition.type);
|
|
3675
|
-
case
|
|
3742
|
+
case reactPage.IconRadioGroupControlType:
|
|
3676
3743
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3677
3744
|
hook: useIconRadioGroupValue,
|
|
3678
3745
|
parameters: [data, definition],
|
|
@@ -3741,7 +3808,7 @@ function ControlValue({
|
|
|
3741
3808
|
parameters: [data, definition, control],
|
|
3742
3809
|
children: (value) => children(value)
|
|
3743
3810
|
}, definition.type);
|
|
3744
|
-
case
|
|
3811
|
+
case reactPage.TypographyControlType:
|
|
3745
3812
|
return /* @__PURE__ */ jsxRuntime.jsx(RenderHook, {
|
|
3746
3813
|
hook: useTypographyValue,
|
|
3747
3814
|
parameters: [data],
|
|
@@ -3788,20 +3855,20 @@ function PropsValue({
|
|
|
3788
3855
|
return Object.entries(propControllerDescriptorsRef.current).reduceRight((renderFn, [propName, descriptor]) => (propsValue) => {
|
|
3789
3856
|
var _a2, _b, _c, _d;
|
|
3790
3857
|
switch (descriptor.type) {
|
|
3791
|
-
case
|
|
3792
|
-
case
|
|
3793
|
-
case
|
|
3794
|
-
case
|
|
3795
|
-
case
|
|
3858
|
+
case textInput.CheckboxControlType:
|
|
3859
|
+
case textInput.NumberControlType:
|
|
3860
|
+
case textInput.TextInputControlType:
|
|
3861
|
+
case textInput.TextAreaControlType:
|
|
3862
|
+
case reactPage.SelectControlType:
|
|
3796
3863
|
case reactPage.ColorControlType:
|
|
3797
|
-
case
|
|
3864
|
+
case reactPage.IconRadioGroupControlType:
|
|
3798
3865
|
case reactPage.ImageControlType:
|
|
3799
3866
|
case combobox.ComboboxControlType:
|
|
3800
3867
|
case reactPage.ShapeControlType:
|
|
3801
3868
|
case reactPage.ListControlType:
|
|
3802
3869
|
case reactPage.LinkControlType:
|
|
3803
3870
|
case reactPage.StyleV2ControlType:
|
|
3804
|
-
case
|
|
3871
|
+
case reactPage.TypographyControlType:
|
|
3805
3872
|
return /* @__PURE__ */ jsxRuntime.jsx(ControlValue, {
|
|
3806
3873
|
definition: descriptor,
|
|
3807
3874
|
data: props[propName],
|
|
@@ -4093,10 +4160,10 @@ const PreviewProvider = dynamic__default["default"](() => Promise.resolve().then
|
|
|
4093
4160
|
const LiveProvider = dynamic__default["default"](() => Promise.resolve().then(function() {
|
|
4094
4161
|
return require("./LiveProvider.cjs.js");
|
|
4095
4162
|
}));
|
|
4096
|
-
function RuntimeProvider(
|
|
4097
|
-
var
|
|
4163
|
+
function RuntimeProvider(_m) {
|
|
4164
|
+
var _n = _m, {
|
|
4098
4165
|
preview
|
|
4099
|
-
} =
|
|
4166
|
+
} = _n, props = __objRest(_n, [
|
|
4100
4167
|
"preview"
|
|
4101
4168
|
]);
|
|
4102
4169
|
return preview ? /* @__PURE__ */ jsxRuntime.jsx(PreviewProvider, __spreadValues({}, props)) : /* @__PURE__ */ jsxRuntime.jsx(LiveProvider, __spreadValues({}, props));
|
|
@@ -4313,6 +4380,7 @@ exports.Document = Document$1;
|
|
|
4313
4380
|
exports.DocumentReference = DocumentReference;
|
|
4314
4381
|
exports.Element = Element$1;
|
|
4315
4382
|
exports.ElementImperativeHandle = ElementImperativeHandle;
|
|
4383
|
+
exports.Link = Link;
|
|
4316
4384
|
exports.Makeswift = Makeswift;
|
|
4317
4385
|
exports.MakeswiftApiHandler = MakeswiftApiHandler;
|
|
4318
4386
|
exports.MakeswiftProvider = MakeswiftProvider;
|
|
@@ -4327,27 +4395,23 @@ exports.Shapes = Shapes;
|
|
|
4327
4395
|
exports.Sizes = Sizes;
|
|
4328
4396
|
exports.StoreContext = StoreContext;
|
|
4329
4397
|
exports.colorToString = colorToString;
|
|
4330
|
-
exports.deepEqual = deepEqual;
|
|
4331
4398
|
exports.forwardNextDynamicRef = forwardNextDynamicRef;
|
|
4332
4399
|
exports.getServerSideProps = getServerSideProps;
|
|
4333
4400
|
exports.getStaticPaths = getStaticPaths;
|
|
4334
4401
|
exports.getStaticProps = getStaticProps;
|
|
4402
|
+
exports.isNonNullable = isNonNullable;
|
|
4335
4403
|
exports.pollBoxModel = pollBoxModel;
|
|
4336
|
-
exports.shallowEqual = shallowEqual;
|
|
4337
4404
|
exports.useBorder = useBorder;
|
|
4338
4405
|
exports.useBoxShadow = useBoxShadow;
|
|
4339
4406
|
exports.useBreakpoints = useBreakpoints;
|
|
4340
4407
|
exports.useBuilderEditMode = useBuilderEditMode;
|
|
4341
|
-
exports.useElementId = useElementId;
|
|
4342
4408
|
exports.useEnhancedTypography = useEnhancedTypography;
|
|
4343
4409
|
exports.useFile = useFile;
|
|
4344
4410
|
exports.useFiles = useFiles;
|
|
4345
4411
|
exports.useFormContext = useFormContext;
|
|
4346
4412
|
exports.useIsInBuilder = useIsInBuilder;
|
|
4347
|
-
exports.useIsPreview = useIsPreview;
|
|
4348
4413
|
exports.useMakeswiftClient = useMakeswiftClient;
|
|
4349
4414
|
exports.usePageId = usePageId;
|
|
4350
|
-
exports.usePagePathnameSlice = usePagePathnameSlice;
|
|
4351
4415
|
exports.useResponsiveColor = useResponsiveColor;
|
|
4352
4416
|
exports.useResponsiveGridItem = useResponsiveGridItem;
|
|
4353
4417
|
exports.useResponsiveStyle = useResponsiveStyle;
|