@makeswift/runtime 0.10.16 → 0.11.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.es.js +1 -1
- package/dist/Button.es.js +1 -1
- package/dist/Carousel.es.js +1 -1
- package/dist/Countdown.es.js +1 -1
- package/dist/Divider.es.js +1 -1
- package/dist/Embed.es.js +1 -1
- package/dist/Form.es.js +1 -1
- package/dist/Image.es.js +1 -1
- package/dist/LiveProvider.es.js +1 -1
- package/dist/Navigation.es.js +1 -1
- package/dist/PreviewProvider.cjs.js +8 -11
- package/dist/PreviewProvider.cjs.js.map +1 -1
- package/dist/PreviewProvider.es.js +10 -13
- package/dist/PreviewProvider.es.js.map +1 -1
- package/dist/ReadOnlyText.es.js +1 -1
- package/dist/ReadOnlyTextV2.es.js +1 -1
- package/dist/Root.es.js +1 -1
- package/dist/SocialLinks.es.js +1 -1
- package/dist/Video.es.js +1 -1
- package/dist/actions.cjs.js +8 -14
- package/dist/actions.cjs.js.map +1 -1
- package/dist/actions.es.js +8 -12
- package/dist/actions.es.js.map +1 -1
- package/dist/control-serialization.es.js +1 -1
- package/dist/controls.es.js +1 -1
- package/dist/index.cjs.js +18 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +20 -21
- package/dist/index.es.js.map +1 -1
- package/dist/index.es2.js +1 -1
- package/dist/index.es4.js +1 -1
- package/dist/index.es5.js +1 -1
- package/dist/index.es6.js +1 -1
- package/dist/index.es8.js +1 -1
- package/dist/index.es9.js +1 -1
- package/dist/main.cjs.js +1 -1
- package/dist/main.es.js +1 -1
- package/dist/react-page.cjs.js +38 -92
- package/dist/react-page.cjs.js.map +1 -1
- package/dist/react-page.es.js +31 -81
- package/dist/react-page.es.js.map +1 -1
- package/dist/slate.es.js +1 -1
- package/dist/toText.es.js +1 -1
- package/dist/types/src/api/react.d.ts +4 -1
- package/dist/types/src/api/react.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/next/client.d.ts +3 -2
- package/dist/types/src/next/client.d.ts.map +1 -1
- package/dist/types/src/runtimes/react/index.d.ts +1 -3
- package/dist/types/src/runtimes/react/index.d.ts.map +1 -1
- package/dist/types/src/state/actions.d.ts +10 -14
- package/dist/types/src/state/actions.d.ts.map +1 -1
- package/dist/types/src/state/react-builder-preview.d.ts +1 -3
- package/dist/types/src/state/react-builder-preview.d.ts.map +1 -1
- package/dist/types/src/state/react-page.d.ts +1 -7
- package/dist/types/src/state/react-page.d.ts.map +1 -1
- package/dist/types/types/locale.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/src/state/modules/locales.d.ts +0 -15
- package/dist/types/src/state/modules/locales.d.ts.map +0 -1
package/dist/Box.es.js
CHANGED
|
@@ -33,7 +33,7 @@ import { forwardRef, useRef, useCallback, useImperativeHandle, useState, useEffe
|
|
|
33
33
|
import { cx } from "@emotion/css";
|
|
34
34
|
import { v4 } from "uuid";
|
|
35
35
|
import { n as useResponsiveStyle, E as Element } from "./index.es.js";
|
|
36
|
-
import {
|
|
36
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
37
37
|
import { jsx } from "react/jsx-runtime";
|
|
38
38
|
import { a as useBoxAnimation, b as areBoxAnimationPropsEqual, B as BackgroundsContainer, G as GridItem } from "./index.es2.js";
|
|
39
39
|
import { p as parse, c as createBox } from "./box-models.es.js";
|
package/dist/Button.es.js
CHANGED
|
@@ -33,7 +33,7 @@ import { forwardRef } from "react";
|
|
|
33
33
|
import ColorHelper from "color";
|
|
34
34
|
import { o as useResponsiveWidth, n as useResponsiveStyle, p as useResponsiveTextStyle, q as colorToString } from "./index.es.js";
|
|
35
35
|
import { L as Link } from "./index.es3.js";
|
|
36
|
-
import {
|
|
36
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
37
37
|
import { cx } from "@emotion/css";
|
|
38
38
|
import { jsx } from "react/jsx-runtime";
|
|
39
39
|
import "use-sync-external-store/shim/with-selector";
|
package/dist/Carousel.es.js
CHANGED
|
@@ -35,7 +35,7 @@ import { useGesture } from "@use-gesture/react";
|
|
|
35
35
|
import { wrap } from "@popmotion/popcorn";
|
|
36
36
|
import { r as useBreakpoints, n as useResponsiveStyle, q as colorToString } from "./index.es.js";
|
|
37
37
|
import "use-sync-external-store/shim";
|
|
38
|
-
import {
|
|
38
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
39
39
|
import "./actions.es.js";
|
|
40
40
|
import "ts-pattern";
|
|
41
41
|
import "uuid";
|
package/dist/Countdown.es.js
CHANGED
|
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import { cx } from "@emotion/css";
|
|
33
33
|
import { forwardRef, useState, useEffect } from "react";
|
|
34
|
-
import {
|
|
34
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
35
35
|
import { n as useResponsiveStyle, q as colorToString } from "./index.es.js";
|
|
36
36
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
37
37
|
import "redux";
|
package/dist/Divider.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
2
|
import { n as useResponsiveStyle, q as colorToString } from "./index.es.js";
|
|
3
|
-
import {
|
|
3
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
4
4
|
import { cx } from "@emotion/css";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import "use-sync-external-store/shim/with-selector";
|
package/dist/Embed.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, useState, useImperativeHandle, useEffect } from "react";
|
|
2
2
|
import { u as useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.es.js";
|
|
3
|
-
import {
|
|
3
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
4
4
|
import { cx } from "@emotion/css";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import "redux";
|
package/dist/Form.es.js
CHANGED
|
@@ -33,7 +33,7 @@ import * as React from "react";
|
|
|
33
33
|
import { forwardRef, useRef, useImperativeHandle, useState, useEffect, useMemo } from "react";
|
|
34
34
|
import { Field as Field$1, getIn, Formik } from "formik";
|
|
35
35
|
import { cx, keyframes } from "@emotion/css";
|
|
36
|
-
import {
|
|
36
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
37
37
|
import { n as useResponsiveStyle, S as Shapes, s as Sizes, C as Contrasts, q as colorToString, t as useFormContext, p as useResponsiveTextStyle, u as useIsInBuilder, v as useResponsiveGridItem, w as useTable, x as useMakeswiftClient, y as Provider, A as Alignments } from "./index.es.js";
|
|
38
38
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
39
39
|
import ColorHelper from "color";
|
package/dist/Image.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { findBreakpointOverride } from "./state/breakpoints.es.js";
|
|
|
4
4
|
import { p as placeholders } from "./placeholders.es.js";
|
|
5
5
|
import { L as Link } from "./index.es3.js";
|
|
6
6
|
import { cx } from "@emotion/css";
|
|
7
|
-
import {
|
|
7
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
8
8
|
import { z as useFile, r as useBreakpoints, o as useResponsiveWidth, n as useResponsiveStyle } from "./index.es.js";
|
|
9
9
|
import { m as major } from "./next-version.es.js";
|
|
10
10
|
import { match, P } from "ts-pattern";
|
package/dist/LiveProvider.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { a as ReactRuntime, K as StoreContext, M as MakeswiftProvider } from "./index.es.js";
|
|
3
|
-
import {
|
|
3
|
+
import { av as configureStore } from "./react-page.es.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import "use-sync-external-store/shim/with-selector";
|
|
6
6
|
import "next/dynamic";
|
package/dist/Navigation.es.js
CHANGED
|
@@ -34,7 +34,7 @@ import { forwardRef, useRef, useState, createElement, Fragment as Fragment$1 } f
|
|
|
34
34
|
import { G as GutterContainer } from "./index.es4.js";
|
|
35
35
|
import ImageComponent from "./Image.es.js";
|
|
36
36
|
import Button from "./Button.es.js";
|
|
37
|
-
import {
|
|
37
|
+
import { _ as useStyle } from "./react-page.es.js";
|
|
38
38
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
39
39
|
import { l as useResponsiveColor, p as useResponsiveTextStyle, n as useResponsiveStyle, q as colorToString } from "./index.es.js";
|
|
40
40
|
import "use-sync-external-store/shim";
|
|
@@ -154,8 +154,7 @@ const reducer = redux.combineReducers({
|
|
|
154
154
|
builderEditMode: reactPage.reducer$7,
|
|
155
155
|
pointer: reducer$2,
|
|
156
156
|
elementImperativeHandles: reducer$1,
|
|
157
|
-
breakpoints: state_breakpoints.reducer
|
|
158
|
-
locales: reactPage.reducer$8
|
|
157
|
+
breakpoints: state_breakpoints.reducer
|
|
159
158
|
});
|
|
160
159
|
function getBoxModelsStateSlice(state) {
|
|
161
160
|
return state.boxModels;
|
|
@@ -426,7 +425,7 @@ function measureBoxModelsMiddleware() {
|
|
|
426
425
|
};
|
|
427
426
|
};
|
|
428
427
|
}
|
|
429
|
-
function messageChannelMiddleware() {
|
|
428
|
+
function messageChannelMiddleware(client) {
|
|
430
429
|
return ({ dispatch, getState }) => (next2) => {
|
|
431
430
|
let cleanUp = () => {
|
|
432
431
|
};
|
|
@@ -446,14 +445,8 @@ function messageChannelMiddleware() {
|
|
|
446
445
|
});
|
|
447
446
|
const breakpoints = reactPage.getBreakpoints(state);
|
|
448
447
|
messageChannel.port1.postMessage(actions.setBreakpoints(breakpoints));
|
|
449
|
-
const locales = reactPage.getLocales(state);
|
|
450
|
-
const defaultLocale = reactPage.getDefaultLocale(state);
|
|
451
448
|
const routerLocale = Router__default["default"].locale;
|
|
452
|
-
if (
|
|
453
|
-
messageChannel.port1.postMessage(actions.setLocales(locales));
|
|
454
|
-
if (defaultLocale != null)
|
|
455
|
-
messageChannel.port1.postMessage(actions.setDefaultLocale(defaultLocale));
|
|
456
|
-
if (routerLocale != null && locales.some((locale) => locale.toString() === routerLocale)) {
|
|
449
|
+
if (routerLocale != null) {
|
|
457
450
|
messageChannel.port1.postMessage(actions.setLocale(new Intl.Locale(routerLocale)));
|
|
458
451
|
}
|
|
459
452
|
Router__default["default"].events.on("routeChangeStart", () => {
|
|
@@ -507,6 +500,10 @@ function messageChannelMiddleware() {
|
|
|
507
500
|
Router__default["default"].push(pathname);
|
|
508
501
|
break;
|
|
509
502
|
}
|
|
503
|
+
case actions.ActionTypes.SET_LOCALIZED_RESOURCE_ID: {
|
|
504
|
+
client.setLocalizedResourceId(action.payload);
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
510
507
|
case actions.ActionTypes.INIT:
|
|
511
508
|
cleanUp = dispatch(initialize());
|
|
512
509
|
break;
|
|
@@ -606,7 +603,7 @@ function configureStore({
|
|
|
606
603
|
documents: getInitialState$2({ rootElements }),
|
|
607
604
|
isPreview: reactPage.getInitialState$1(true)
|
|
608
605
|
});
|
|
609
|
-
return redux.createStore(reducer, initialState, redux.applyMiddleware(thunk__default["default"], measureBoxModelsMiddleware(), messageChannelMiddleware(), propControllerHandlesMiddleware(), makeswiftApiClientSyncMiddleware(client)));
|
|
606
|
+
return redux.createStore(reducer, initialState, redux.applyMiddleware(thunk__default["default"], measureBoxModelsMiddleware(), messageChannelMiddleware(client), propControllerHandlesMiddleware(), makeswiftApiClientSyncMiddleware(client)));
|
|
610
607
|
}
|
|
611
608
|
function PreviewProvider({
|
|
612
609
|
client,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewProvider.cjs.js","sources":["../src/state/modules/read-write-documents.ts","../src/state/modules/pointer.ts","../src/state/modules/element-imperative-handles.ts","../src/state/react-builder-preview.ts","../src/runtimes/react/components/PreviewProvider.tsx"],"sourcesContent":["import { Operation } from 'ot-json0'\nimport { removeIn, setIn } from 'immutable'\n\nimport * as ReadOnlyDocuments from './read-only-documents'\nimport { Action, ActionTypes } from '../actions'\n\nexport type { Document, Element, ElementData, ElementReference } from './read-only-documents'\nexport { isElementReference } from './read-only-documents'\nexport type { Operation }\n\nfunction apply(data: ReadOnlyDocuments.Element, operation: Operation): ReadOnlyDocuments.Element {\n let applied = data\n\n operation.forEach(component => {\n // @ts-expect-error: `ld` isn't in all possible values of `component`\n if (component.ld != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `od` isn't in all possible values of `component`\n if (component.od != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `li` isn't in all possible values of `component`\n if (component.li != null) applied = setIn(applied, component.p, component.li)\n\n // @ts-expect-error: `oi` isn't in all possible values of `component`\n if (component.oi != null) applied = setIn(applied, component.p, component.oi)\n })\n\n return applied\n}\n\nexport type State = ReadOnlyDocuments.State\n\nexport function getInitialState({\n rootElements,\n}: {\n rootElements?: Map<string, ReadOnlyDocuments.Element>\n} = {}): State {\n return ReadOnlyDocuments.getInitialState({ rootElements })\n}\n\nfunction getReadOnlyDocumentsStateSlice(state: State): ReadOnlyDocuments.State {\n return state\n}\n\nexport function getDocument(state: State, documentKey: string): ReadOnlyDocuments.Document | null {\n return ReadOnlyDocuments.getDocument(getReadOnlyDocumentsStateSlice(state), documentKey)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n const nextState = ReadOnlyDocuments.reducer(state, action)\n\n switch (action.type) {\n case ActionTypes.CHANGE_DOCUMENT: {\n const currentRootElement = getDocument(nextState, action.payload.documentKey)?.rootElement\n\n if (currentRootElement == null) return nextState\n\n const nextRootElement = apply(currentRootElement, action.payload.operation)\n\n return currentRootElement === nextRootElement\n ? nextState\n : new Map(nextState).set(\n action.payload.documentKey,\n ReadOnlyDocuments.createDocument(action.payload.documentKey, nextRootElement),\n )\n }\n\n default:\n return nextState\n }\n}\n","import { Action, ActionTypes } from '../actions'\n\nexport type Point = { x: number; y: number }\n\ntype State = {\n pointer: Point | null\n}\n\nfunction getInitialState(): State {\n return { pointer: null }\n}\n\nexport function getPointer(state: State): Point | null {\n return state.pointer\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.BUILDER_POINTER_MOVE:\n return { ...state, pointer: action.payload.pointer }\n\n default:\n return state\n }\n}\n","import { ElementImperativeHandle } from '../../runtimes/react/element-imperative-handle'\nimport { Action, ActionTypes } from '../actions'\n\ntype State = Map<string, Map<string, ElementImperativeHandle>>\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return state\n}\n\nfunction getInitialState(): State {\n return new Map()\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE:\n return new Map(state).set(\n action.payload.documentKey,\n new Map(new Map(state.get(action.payload.documentKey) ?? [])).set(\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const byElementKey = new Map(state.get(action.payload.documentKey) ?? [])\n\n const deleted = byElementKey.delete(action.payload.elementKey)\n\n if (!deleted) return state\n\n return new Map(state).set(action.payload.documentKey, byElementKey)\n }\n\n default:\n return state\n }\n}\n","import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\nimport Router from 'next/router'\n\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsPreview from './modules/is-preview'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Pointer from './modules/pointer'\nimport * as ElementImperativeHandles from './modules/element-imperative-handles'\nimport * as Breakpoints from './modules/breakpoints'\nimport * as Locales from './modules/locales'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n registerDocument,\n registerComponentHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n handlePointerMove,\n changePathnameStart,\n changePathnameComplete,\n elementFromPointChange,\n setBreakpoints,\n setLocales,\n setLocale,\n setDefaultLocale,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController } from '../prop-controllers/instances'\nimport { PropController } from '../prop-controllers/base'\nimport { serializeControls } from '../builder'\nimport { MakeswiftClient } from '../api/react'\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n isPreview: IsPreview.reducer,\n builderEditMode: BuilderEditMode.reducer,\n pointer: Pointer.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n breakpoints: Breakpoints.reducer,\n locales: Locales.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nfunction getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nfunction getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nfunction getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingPointerMoveEvent(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n window.document.documentElement.addEventListener('pointermove', handlePointerMoveEvent)\n\n return () => {\n window.document.documentElement.removeEventListener('pointermove', handlePointerMoveEvent)\n }\n\n function handlePointerMoveEvent({ clientX, clientY }: PointerEvent) {\n dispatch(handlePointerMove({ clientX, clientY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): ThunkAction<() => void, State, unknown, Action> {\n return (_dispatch, getState) => {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.removeEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction elementKeysFromElementFromPoint(\n elementFromPoint: Element | null,\n): ThunkAction<{ documentKey: string; elementKey: string } | null, State, unknown, Action> {\n return (_dispatch, getState) => {\n if (elementFromPoint == null) return null\n\n const elementImperativeHandles = getElementImperativeHandlesContainingElement(\n getState(),\n elementFromPoint,\n )\n const acendingDepthDocumentKeys = ReactPage.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = acendingDepthDocumentKeys.slice().reverse()\n\n let currentElement: Element | null = elementFromPoint\n let keys = null\n\n while (currentElement != null) {\n for (const documentKey of descendingDepthDocumentKeys) {\n const byElementKey = elementImperativeHandles.get(documentKey)\n\n if (byElementKey == null) continue\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n if (elementImperativeHandle.getDomNode() === currentElement) {\n return { documentKey, elementKey }\n }\n }\n }\n\n currentElement = currentElement.parentElement\n }\n\n return keys\n }\n}\n\nfunction startPollingElementFromPoint(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n let lastElementFromPoint: Element | null = null\n let animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameRequestId)\n }\n\n function handleAnimationFrameRequest() {\n const pointer = getPointer(getState())\n const elementFromPoint =\n pointer == null ? null : document.elementFromPoint(pointer.x, pointer.y)\n\n if (elementFromPoint !== lastElementFromPoint) {\n lastElementFromPoint = elementFromPoint\n\n const keys = dispatch(elementKeysFromElementFromPoint(elementFromPoint))\n\n dispatch(elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents())\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent())\n const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n let cleanUp = () => {}\n\n if (typeof window === 'undefined') return cleanUp\n\n const messageChannel = new window.MessageChannel()\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n const breakpoints = ReactPage.getBreakpoints(state)\n messageChannel.port1.postMessage(setBreakpoints(breakpoints))\n\n const locales = ReactPage.getLocales(state)\n const defaultLocale = ReactPage.getDefaultLocale(state)\n const routerLocale = Router.locale\n if (locales.length > 0) messageChannel.port1.postMessage(setLocales(locales))\n if (defaultLocale != null) messageChannel.port1.postMessage(setDefaultLocale(defaultLocale))\n if (routerLocale != null && locales.some(locale => locale.toString() === routerLocale)) {\n messageChannel.port1.postMessage(setLocale(new Intl.Locale(routerLocale)))\n }\n\n Router.events.on('routeChangeStart', () => {\n messageChannel.port1.postMessage(changePathnameStart())\n })\n\n Router.events.on('routeChangeComplete', () => {\n messageChannel.port1.postMessage(changePathnameComplete())\n })\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n case ActionTypes.HANDLE_POINTER_MOVE:\n case ActionTypes.ELEMENT_FROM_POINT_CHANGE:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.SET_BUILDER_EDIT_MODE:\n messageChannel.port1.postMessage(action)\n window.getSelection()?.removeAllRanges()\n break\n\n case ActionTypes.SET_LOCALE: {\n const { pathname: currentPathname, query } = Router\n const pathname = (action.payload.pathname ?? currentPathname).replace(/^\\//, '/')\n\n Router.replace({ pathname, query }, undefined, { locale: action.payload.locale })\n break\n }\n\n case ActionTypes.CHANGE_PATHNAME: {\n const pathname = action.payload.pathname.replace(/^\\//, '/')\n const currentPathname = Router.asPath.replace(/^\\//, '/')\n\n if (pathname !== currentPathname) Router.push(pathname)\n break\n }\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nfunction propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey, componentHandle } = action.payload\n const element = ReactPage.getElement(getState(), documentKey, elementKey)\n const propControllers = dispatch(\n createAndRegisterPropControllers(documentKey, elementKey),\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(componentHandle)\n ) {\n dispatch(registerPropControllersHandle(documentKey, elementKey, componentHandle))\n componentHandle.setPropControllers(propControllers)\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n\n break\n }\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nif (import.meta.vitest) {\n const { describe, it, fn, expect } = import.meta.vitest\n\n describe('propControllerHandlesMiddleware', () => {\n it('registers prop controllers for element data', () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { key: 'elementKey', type: 'type', props: {} }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const setPropControllers = fn()\n const handle = new ElementImperativeHandle()\n\n handle.callback(() => ({ setPropControllers }))\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(setPropControllers).toHaveBeenCalled()\n })\n\n it(\"doesn't register prop controllers for element references\", () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { type: 'reference', key: 'elementKey', value: 'value' }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const setPropControllers = fn()\n const handle = new ElementImperativeHandle()\n\n handle.callback(() => ({ setPropControllers }))\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(setPropControllers).not.toHaveBeenCalled()\n })\n })\n}\n\nfunction makeswiftApiClientSyncMiddleware(\n client: MakeswiftClient,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n client.makeswiftApiClient.dispatch(action)\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n rootElements,\n preloadedState,\n client,\n}: {\n rootElements?: Map<string, Documents.Element>\n preloadedState?: PreloadedState<State>\n client: MakeswiftClient\n}): Store {\n const initialState: PreloadedState<State> = {\n ...preloadedState,\n documents: Documents.getInitialState({ rootElements }),\n isPreview: IsPreview.getInitialState(true),\n }\n\n return createStore(\n reducer,\n initialState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(),\n propControllerHandlesMiddleware(),\n makeswiftApiClientSyncMiddleware(client),\n ),\n )\n}\n","import { ReactNode, useEffect, useMemo } from 'react'\n\nimport { StoreContext, ReactRuntime } from '..'\nimport * as ReactBuilderPreview from '../../../state/react-builder-preview'\nimport * as ReactPage from '../../../state/react-page'\nimport { MakeswiftProvider, MakeswiftClient } from '../../../api/react'\nimport { registerDocumentEffect } from '../../../state/actions'\n\ntype Props = {\n client: MakeswiftClient\n rootElements?: Map<string, ReactPage.Element>\n children?: ReactNode\n runtime?: ReactRuntime\n}\n\nexport default function PreviewProvider({\n client,\n children,\n rootElements,\n runtime,\n}: Props): JSX.Element {\n const store = useMemo(\n () =>\n ReactBuilderPreview.configureStore({\n preloadedState: runtime ? runtime.store.getState() : ReactRuntime.store.getState(),\n rootElements,\n client,\n }),\n [client, rootElements, runtime],\n )\n\n useEffect(() => {\n const unregisterDocuments = Array.from(rootElements?.entries() ?? []).map(\n ([documentKey, rootElement]) =>\n store.dispatch(registerDocumentEffect(ReactPage.createDocument(documentKey, rootElement))),\n )\n\n return () => {\n unregisterDocuments.forEach(unregisterDocument => {\n unregisterDocument()\n })\n }\n }, [store, rootElements])\n\n return (\n <StoreContext.Provider value={store}>\n <MakeswiftProvider client={client}>{children}</MakeswiftProvider>\n </StoreContext.Provider>\n )\n}\n"],"names":["removeIn","setIn","ReadOnlyDocuments.getInitialState","ReadOnlyDocuments.getDocument","getInitialState","ReadOnlyDocuments.reducer","ActionTypes","ReadOnlyDocuments.createDocument","combineReducers","Documents.reducer","ReactComponents.reducer","BoxModels.reducer","ComponentsMeta.reducer","PropControllers.reducer","PropControllerHandles.reducer","IsInBuilder.reducer","IsPreview.reducer","BuilderEditMode.reducer","Pointer.reducer","ElementImperativeHandles.reducer","Breakpoints.reducer","Locales.reducer","BoxModels.getMeasurables","BoxModels.getBoxModels","BoxModels.getBoxModel","ComponentsMeta.getComponentsMeta","PropControllers.getComponentPropControllerDescriptors","Pointer.getPointer","ElementImperativeHandles.getElementImperativeHandles","BoxModels.measure","deepEqual","changeElementBoxModels","handleWheel","handlePointerMove","ReactPage.getBuilderEditMode","BuilderEditMode.BuilderEditMode","changeDocumentElementSize","ReactPage.getDocumentKeysSortedByDepth","elementFromPointChange","setIsInBuilder","BoxModels.isMeasurable","registerMeasurable","unregisterMeasurable","serializeControls","registerBuilderComponent","ReactPage.getBreakpoints","setBreakpoints","ReactPage.getLocales","ReactPage.getDefaultLocale","Router","setLocales","setDefaultLocale","setLocale","changePathnameStart","changePathnameComplete","unregisterBuilderComponent","ReactPage.getElementPropControllerDescriptors","createPropController","messageBuilderPropController","registerPropControllers","ReactPage.getElement","ReactPage.isElementReference","PropControllerHandles.isPropControllersHandle","registerPropControllersHandle","PropControllerHandles.getPropControllersHandle","unregisterPropControllers","PropControllerHandles.getPropController","createStore","applyMiddleware","thunk","ElementImperativeHandle","registerDocument","ReactPage.createDocument","registerComponentHandle","Documents.getInitialState","IsPreview.getInitialState","client","children","rootElements","runtime","store","useMemo","ReactBuilderPreview","preloadedState","getState","ReactRuntime","useEffect","unregisterDocuments","Array","from","entries","map","documentKey","rootElement","dispatch","registerDocumentEffect","ReactPage","forEach","unregisterDocument","_jsx","StoreContext","MakeswiftProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,eAAe,MAAiC,WAAiD;AAC/F,MAAI,UAAU;AAEd,YAAU,QAAQ,CAAa,cAAA;AAE7B,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAM,gBAAUC,UAAM,MAAA,SAAS,UAAU,GAAG,UAAU,EAAE;AAG5E,QAAI,UAAU,MAAM;AAAM,gBAAUA,UAAM,MAAA,SAAS,UAAU,GAAG,UAAU,EAAE;AAAA,EAAA,CAC7E;AAEM,SAAA;AACT;AAIgC,2BAAA;AAAA,EAC9B;AAAA,IAGE,IAAW;AACb,SAAOC,UAAkB,gBAAgB,EAAE,aAAA,CAAc;AAC3D;AAEA,wCAAwC,OAAuC;AACtE,SAAA;AACT;AAEO,qBAAqB,OAAc,aAAwD;AAChG,SAAOC,UAAkB,cAAY,+BAA+B,KA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AK5B,WAAO,MAAM;AACXN,0BAAoBU,QAAQC,CAAsB,uBAAA;AAC9B;MAAA,CADpB;AAAA,IAAA;AAAA,EADF,GAKC,CAAClB,OAAOF,YAAR,CAXM;AAcP,SAAAqB,2BAAA,IAACC,kBAAa,UAAd;AAAA,IAAuB,OAAOpB;AAAAA,IAA9B,yCACGqB,wBAAD;AAAA,MAAmB;AAAA,MAAiBxB;AAAAA,IAAAA,CAApC;AAAA,EAAA,CAFJ;AAKD;;"}
|
|
1
|
+
{"version":3,"file":"PreviewProvider.cjs.js","sources":["../src/state/modules/read-write-documents.ts","../src/state/modules/pointer.ts","../src/state/modules/element-imperative-handles.ts","../src/state/react-builder-preview.ts","../src/runtimes/react/components/PreviewProvider.tsx"],"sourcesContent":["import { Operation } from 'ot-json0'\nimport { removeIn, setIn } from 'immutable'\n\nimport * as ReadOnlyDocuments from './read-only-documents'\nimport { Action, ActionTypes } from '../actions'\n\nexport type { Document, Element, ElementData, ElementReference } from './read-only-documents'\nexport { isElementReference } from './read-only-documents'\nexport type { Operation }\n\nfunction apply(data: ReadOnlyDocuments.Element, operation: Operation): ReadOnlyDocuments.Element {\n let applied = data\n\n operation.forEach(component => {\n // @ts-expect-error: `ld` isn't in all possible values of `component`\n if (component.ld != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `od` isn't in all possible values of `component`\n if (component.od != null) applied = removeIn(applied, component.p)\n\n // @ts-expect-error: `li` isn't in all possible values of `component`\n if (component.li != null) applied = setIn(applied, component.p, component.li)\n\n // @ts-expect-error: `oi` isn't in all possible values of `component`\n if (component.oi != null) applied = setIn(applied, component.p, component.oi)\n })\n\n return applied\n}\n\nexport type State = ReadOnlyDocuments.State\n\nexport function getInitialState({\n rootElements,\n}: {\n rootElements?: Map<string, ReadOnlyDocuments.Element>\n} = {}): State {\n return ReadOnlyDocuments.getInitialState({ rootElements })\n}\n\nfunction getReadOnlyDocumentsStateSlice(state: State): ReadOnlyDocuments.State {\n return state\n}\n\nexport function getDocument(state: State, documentKey: string): ReadOnlyDocuments.Document | null {\n return ReadOnlyDocuments.getDocument(getReadOnlyDocumentsStateSlice(state), documentKey)\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n const nextState = ReadOnlyDocuments.reducer(state, action)\n\n switch (action.type) {\n case ActionTypes.CHANGE_DOCUMENT: {\n const currentRootElement = getDocument(nextState, action.payload.documentKey)?.rootElement\n\n if (currentRootElement == null) return nextState\n\n const nextRootElement = apply(currentRootElement, action.payload.operation)\n\n return currentRootElement === nextRootElement\n ? nextState\n : new Map(nextState).set(\n action.payload.documentKey,\n ReadOnlyDocuments.createDocument(action.payload.documentKey, nextRootElement),\n )\n }\n\n default:\n return nextState\n }\n}\n","import { Action, ActionTypes } from '../actions'\n\nexport type Point = { x: number; y: number }\n\ntype State = {\n pointer: Point | null\n}\n\nfunction getInitialState(): State {\n return { pointer: null }\n}\n\nexport function getPointer(state: State): Point | null {\n return state.pointer\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.BUILDER_POINTER_MOVE:\n return { ...state, pointer: action.payload.pointer }\n\n default:\n return state\n }\n}\n","import { ElementImperativeHandle } from '../../runtimes/react/element-imperative-handle'\nimport { Action, ActionTypes } from '../actions'\n\ntype State = Map<string, Map<string, ElementImperativeHandle>>\n\nexport function getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return state\n}\n\nfunction getInitialState(): State {\n return new Map()\n}\n\nexport function reducer(state: State = getInitialState(), action: Action): State {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE:\n return new Map(state).set(\n action.payload.documentKey,\n new Map(new Map(state.get(action.payload.documentKey) ?? [])).set(\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const byElementKey = new Map(state.get(action.payload.documentKey) ?? [])\n\n const deleted = byElementKey.delete(action.payload.elementKey)\n\n if (!deleted) return state\n\n return new Map(state).set(action.payload.documentKey, byElementKey)\n }\n\n default:\n return state\n }\n}\n","import {\n applyMiddleware,\n combineReducers,\n createStore,\n Dispatch as ReduxDispatch,\n Middleware,\n MiddlewareAPI,\n PreloadedState,\n Store as ReduxStore,\n} from 'redux'\nimport thunk, { ThunkAction, ThunkDispatch } from 'redux-thunk'\nimport Router from 'next/router'\n\nimport deepEqual from '../utils/deepEqual'\n\nimport * as Documents from './modules/read-write-documents'\nimport * as ReactComponents from './modules/react-components'\nimport * as BoxModels from './modules/box-models'\nimport * as ComponentsMeta from './modules/components-meta'\nimport * as PropControllers from './modules/prop-controllers'\nimport * as PropControllerHandles from './modules/prop-controller-handles'\nimport * as IsInBuilder from './modules/is-in-builder'\nimport * as IsPreview from './modules/is-preview'\nimport * as BuilderEditMode from './modules/builder-edit-mode'\nimport * as Pointer from './modules/pointer'\nimport * as ElementImperativeHandles from './modules/element-imperative-handles'\nimport * as Breakpoints from './modules/breakpoints'\nimport * as ReactPage from './react-page'\nimport {\n Action,\n changeDocumentElementSize,\n changeElementBoxModels,\n messageBuilderPropController,\n registerBuilderComponent,\n registerMeasurable,\n registerPropControllers,\n registerPropControllersHandle,\n registerDocument,\n registerComponentHandle,\n unregisterBuilderComponent,\n unregisterMeasurable,\n unregisterPropControllers,\n setIsInBuilder,\n handleWheel,\n handlePointerMove,\n changePathnameStart,\n changePathnameComplete,\n elementFromPointChange,\n setBreakpoints,\n setLocale,\n} from './actions'\nimport { ActionTypes } from './actions'\nimport { createPropController } from '../prop-controllers/instances'\nimport { PropController } from '../prop-controllers/base'\nimport { serializeControls } from '../builder'\nimport { MakeswiftClient } from '../api/react'\nimport { ElementImperativeHandle } from '../runtimes/react/element-imperative-handle'\n\nexport type { Operation } from './modules/read-write-documents'\nexport type { BoxModelHandle } from './modules/box-models'\nexport { createBox, getBox, parse } from './modules/box-models'\n\nconst reducer = combineReducers({\n documents: Documents.reducer,\n reactComponents: ReactComponents.reducer,\n boxModels: BoxModels.reducer,\n componentsMeta: ComponentsMeta.reducer,\n propControllers: PropControllers.reducer,\n propControllerHandles: PropControllerHandles.reducer,\n isInBuilder: IsInBuilder.reducer,\n isPreview: IsPreview.reducer,\n builderEditMode: BuilderEditMode.reducer,\n pointer: Pointer.reducer,\n elementImperativeHandles: ElementImperativeHandles.reducer,\n breakpoints: Breakpoints.reducer,\n})\n\nexport type State = ReturnType<typeof reducer>\n\nfunction getBoxModelsStateSlice(state: State): BoxModels.State {\n return state.boxModels\n}\n\nfunction getMeasurables(state: State): Map<string, Map<string, BoxModels.Measurable>> {\n return BoxModels.getMeasurables(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModels(state: State): Map<string, Map<string, BoxModels.BoxModel>> {\n return BoxModels.getBoxModels(getBoxModelsStateSlice(state))\n}\n\nfunction getBoxModel(\n state: State,\n documentKey: string,\n elementKey: string,\n): BoxModels.BoxModel | null {\n return BoxModels.getBoxModel(getBoxModelsStateSlice(state), documentKey, elementKey)\n}\n\nfunction getComponentsMetaStateSlice(state: State): ComponentsMeta.State {\n return state.componentsMeta\n}\n\nfunction getComponentsMeta(state: State): Map<string, ComponentsMeta.ComponentMeta> {\n return ComponentsMeta.getComponentsMeta(getComponentsMetaStateSlice(state))\n}\n\nfunction getPropControllersStateSlice(state: State): PropControllers.State {\n return state.propControllers\n}\n\nfunction getComponentPropControllerDescriptors(\n state: State,\n componentType: string,\n): Record<string, PropControllers.PropControllerDescriptor> | null {\n return PropControllers.getComponentPropControllerDescriptors(\n getPropControllersStateSlice(state),\n componentType,\n )\n}\n\nfunction getPropControllerHandlesStateSlice(state: State): PropControllerHandles.State {\n return state.propControllerHandles\n}\n\nfunction getPointer(state: State): Pointer.Point | null {\n return Pointer.getPointer(state.pointer)\n}\n\nfunction getElementImperativeHandles(\n state: State,\n): Map<string, Map<string, ElementImperativeHandle>> {\n return ElementImperativeHandles.getElementImperativeHandles(state.elementImperativeHandles)\n}\n\nfunction getElementImperativeHandlesContainingElement(\n state: State,\n element: Element,\n): Map<string, Map<string, ElementImperativeHandle>> {\n const elementImperativeHandles = getElementImperativeHandles(state)\n const filteredElementImperativeHandles = new Map<string, Map<string, ElementImperativeHandle>>()\n\n for (const [documentKey, byElementKey] of elementImperativeHandles) {\n const filteredByElementKey = new Map<string, ElementImperativeHandle>()\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n const handleElement = elementImperativeHandle.getDomNode()\n\n if (handleElement?.contains(element)) {\n filteredByElementKey.set(elementKey, elementImperativeHandle)\n }\n }\n\n if (filteredByElementKey.size > 0) {\n filteredElementImperativeHandles.set(documentKey, filteredByElementKey)\n }\n }\n\n return filteredElementImperativeHandles\n}\n\nfunction measureElements(): ThunkAction<void, State, unknown, Action> {\n return (dispatch, getState) => {\n const measurables = getMeasurables(getState())\n const currentBoxModels = getBoxModels(getState())\n const measuredBoxModels = new Map<string, Map<string, BoxModels.BoxModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxModel>()\n\n documentMeasurables.forEach((measurable, elementKey) => {\n const boxModel = BoxModels.measure(measurable)\n\n if (boxModel != null) measuredDocumentBoxModels.set(elementKey, boxModel)\n })\n\n if (measuredDocumentBoxModels.size > 0) {\n measuredBoxModels.set(documentKey, measuredDocumentBoxModels)\n }\n })\n\n const changedBoxModels = new Map<string, Map<string, BoxModels.BoxModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n currentDocumentBoxModels.forEach((_boxModel, elementKey) => {\n if (!measuredBoxModels.get(documentKey)?.has(elementKey)) {\n changedDocumentBoxModels.set(elementKey, null)\n }\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n })\n\n measuredBoxModels.forEach((measuredDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxModel | null>()\n\n measuredDocumentBoxModels.forEach((measuredBoxModel, elementKey) => {\n const currentBoxModel = getBoxModel(getState(), documentKey, elementKey)\n\n if (currentBoxModel == null || !deepEqual(currentBoxModel, measuredBoxModel)) {\n changedDocumentBoxModels.set(elementKey, measuredBoxModel)\n }\n })\n\n if (changedDocumentBoxModels.size > 0) {\n changedBoxModels.set(documentKey, changedDocumentBoxModels)\n }\n })\n\n if (changedBoxModels.size > 0) dispatch(changeElementBoxModels(changedBoxModels))\n }\n}\n\nexport function startMeasuringElements(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n dispatch(measureElements())\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport type Size = {\n offsetWidth: number\n offsetHeight: number\n clientWidth: number\n clientHeight: number\n scrollWidth: number\n scrollHeight: number\n scrollTop: number\n scrollLeft: number\n}\n\nfunction getElementSize(element: HTMLElement): Size {\n return {\n offsetWidth: element.offsetWidth,\n offsetHeight: element.offsetHeight,\n clientWidth: element.clientWidth,\n clientHeight: element.clientHeight,\n scrollWidth: element.scrollWidth,\n scrollHeight: element.scrollHeight,\n scrollTop: element.scrollTop,\n scrollLeft: element.scrollLeft,\n }\n}\n\nfunction lockDocumentScroll(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(handleWheel({ deltaX, deltaY }))\n }\n }\n}\n\nfunction startHandlingPointerMoveEvent(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n window.document.documentElement.addEventListener('pointermove', handlePointerMoveEvent)\n\n return () => {\n window.document.documentElement.removeEventListener('pointermove', handlePointerMoveEvent)\n }\n\n function handlePointerMoveEvent({ clientX, clientY }: PointerEvent) {\n dispatch(handlePointerMove({ clientX, clientY }))\n }\n }\n}\n\nfunction startHandlingFocusEvents(): ThunkAction<() => void, State, unknown, Action> {\n return (_dispatch, getState) => {\n window.addEventListener('focusin', handleFocusIn)\n window.addEventListener('focusout', handleFocusOut)\n\n return () => {\n window.removeEventListener('focusin', handleFocusIn)\n window.removeEventListener('focusout', handleFocusOut)\n }\n\n function handleFocusIn(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (!(event.target instanceof window.HTMLElement) || !event.target.isContentEditable) {\n window.parent.focus()\n }\n }\n\n function handleFocusOut(event: FocusEvent) {\n if (ReactPage.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT) {\n return\n }\n\n if (\n !(event.relatedTarget instanceof window.HTMLElement) ||\n !event.relatedTarget.isContentEditable\n ) {\n window.parent.focus()\n }\n }\n }\n}\n\nfunction startMeasuringDocumentElement(): ThunkAction<() => void, unknown, unknown, Action> {\n return dispatch => {\n let animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n let lastSize: Size\n\n return () => {\n cancelAnimationFrame(animationFrameHandle)\n }\n\n function handleAnimationFrameRequest() {\n const nextSize = getElementSize(window.document.documentElement)\n\n if (!deepEqual(lastSize, nextSize)) {\n lastSize = nextSize\n\n dispatch(changeDocumentElementSize(nextSize))\n }\n\n animationFrameHandle = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction elementKeysFromElementFromPoint(\n elementFromPoint: Element | null,\n): ThunkAction<{ documentKey: string; elementKey: string } | null, State, unknown, Action> {\n return (_dispatch, getState) => {\n if (elementFromPoint == null) return null\n\n const elementImperativeHandles = getElementImperativeHandlesContainingElement(\n getState(),\n elementFromPoint,\n )\n const acendingDepthDocumentKeys = ReactPage.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = acendingDepthDocumentKeys.slice().reverse()\n\n let currentElement: Element | null = elementFromPoint\n let keys = null\n\n while (currentElement != null) {\n for (const documentKey of descendingDepthDocumentKeys) {\n const byElementKey = elementImperativeHandles.get(documentKey)\n\n if (byElementKey == null) continue\n\n for (const [elementKey, elementImperativeHandle] of byElementKey) {\n if (elementImperativeHandle.getDomNode() === currentElement) {\n return { documentKey, elementKey }\n }\n }\n }\n\n currentElement = currentElement.parentElement\n }\n\n return keys\n }\n}\n\nfunction startPollingElementFromPoint(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n let lastElementFromPoint: Element | null = null\n let animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n\n return () => {\n cancelAnimationFrame(animationFrameRequestId)\n }\n\n function handleAnimationFrameRequest() {\n const pointer = getPointer(getState())\n const elementFromPoint =\n pointer == null ? null : document.elementFromPoint(pointer.x, pointer.y)\n\n if (elementFromPoint !== lastElementFromPoint) {\n lastElementFromPoint = elementFromPoint\n\n const keys = dispatch(elementKeysFromElementFromPoint(elementFromPoint))\n\n dispatch(elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nexport function initialize(): ThunkAction<() => void, State, unknown, Action> {\n return dispatch => {\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents())\n const unlockDocumentScroll = dispatch(lockDocumentScroll())\n const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent())\n const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint())\n dispatch(setIsInBuilder(true))\n\n return () => {\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n dispatch(setIsInBuilder(false))\n }\n }\n}\n\nexport type Dispatch = ThunkDispatch<State, unknown, Action>\n\nfunction measureBoxModelsMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch }: MiddlewareAPI<Dispatch>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n if (BoxModels.isMeasurable(action.payload.componentHandle)) {\n dispatch(\n registerMeasurable(\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.componentHandle,\n ),\n )\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE:\n dispatch(unregisterMeasurable(action.payload.documentKey, action.payload.elementKey))\n break\n }\n\n return next(action)\n }\n }\n}\n\nexport function messageChannelMiddleware(\n client: MakeswiftClient,\n): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n let cleanUp = () => {}\n\n if (typeof window === 'undefined') return cleanUp\n\n const messageChannel = new window.MessageChannel()\n\n window.parent.postMessage(messageChannel.port2, '*', [messageChannel.port2])\n\n messageChannel.port1.onmessage = (event: MessageEvent<Action>) => dispatch(event.data)\n\n const state = getState()\n const registeredComponentsMeta = getComponentsMeta(state)\n\n registeredComponentsMeta.forEach((componentMeta, componentType) => {\n const propControllerDescriptors = getComponentPropControllerDescriptors(\n state,\n componentType,\n )\n\n if (propControllerDescriptors != null) {\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(componentType, componentMeta, serializedControls),\n transferables,\n )\n }\n })\n\n const breakpoints = ReactPage.getBreakpoints(state)\n messageChannel.port1.postMessage(setBreakpoints(breakpoints))\n\n const routerLocale = Router.locale\n if (routerLocale != null) {\n messageChannel.port1.postMessage(setLocale(new Intl.Locale(routerLocale)))\n }\n\n Router.events.on('routeChangeStart', () => {\n messageChannel.port1.postMessage(changePathnameStart())\n })\n\n Router.events.on('routeChangeComplete', () => {\n messageChannel.port1.postMessage(changePathnameComplete())\n })\n\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.CHANGE_ELEMENT_BOX_MODELS:\n case ActionTypes.MOUNT_COMPONENT:\n case ActionTypes.UNMOUNT_COMPONENT:\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SIZE:\n case ActionTypes.MESSAGE_BUILDER_PROP_CONTROLLER:\n case ActionTypes.HANDLE_WHEEL:\n case ActionTypes.HANDLE_POINTER_MOVE:\n case ActionTypes.ELEMENT_FROM_POINT_CHANGE:\n messageChannel.port1.postMessage(action)\n break\n\n case ActionTypes.REGISTER_COMPONENT: {\n const { type, meta, propControllerDescriptors } = action.payload\n const [serializedControls, transferables] = serializeControls(propControllerDescriptors)\n\n messageChannel.port1.postMessage(\n registerBuilderComponent(type, meta, serializedControls),\n transferables,\n )\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT:\n messageChannel.port1.postMessage(unregisterBuilderComponent(action.payload.type))\n break\n\n case ActionTypes.CHANGE_DOCUMENT_ELEMENT_SCROLL_TOP:\n window.document.documentElement.scrollTop = action.payload.scrollTop\n break\n\n case ActionTypes.SCROLL_DOCUMENT_ELEMENT:\n window.document.documentElement.scrollTop += action.payload.scrollTopDelta\n break\n\n case ActionTypes.SET_BUILDER_EDIT_MODE:\n messageChannel.port1.postMessage(action)\n window.getSelection()?.removeAllRanges()\n break\n\n case ActionTypes.SET_LOCALE: {\n const { pathname: currentPathname, query } = Router\n const pathname = (action.payload.pathname ?? currentPathname).replace(/^\\//, '/')\n\n Router.replace({ pathname, query }, undefined, { locale: action.payload.locale })\n break\n }\n\n case ActionTypes.CHANGE_PATHNAME: {\n const pathname = action.payload.pathname.replace(/^\\//, '/')\n const currentPathname = Router.asPath.replace(/^\\//, '/')\n\n if (pathname !== currentPathname) Router.push(pathname)\n break\n }\n\n case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {\n client.setLocalizedResourceId(action.payload)\n break\n }\n\n case ActionTypes.INIT:\n cleanUp = dispatch(initialize())\n break\n\n case ActionTypes.CLEAN_UP:\n cleanUp()\n break\n }\n\n return next(action)\n }\n }\n}\n\nfunction createAndRegisterPropControllers(\n documentKey: string,\n elementKey: string,\n): ThunkAction<Record<string, PropController> | null, State, unknown, Action> {\n return (dispatch, getState) => {\n const descriptors = ReactPage.getElementPropControllerDescriptors(\n getState(),\n documentKey,\n elementKey,\n )\n\n if (descriptors == null) return null\n\n const propControllers = Object.entries(descriptors).reduce((acc, [propName, descriptor]) => {\n const propController = createPropController(descriptor, message =>\n dispatch(messageBuilderPropController(documentKey, elementKey, propName, message)),\n ) as PropController\n\n return { ...acc, [propName]: propController }\n }, {} as Record<string, PropController>)\n\n dispatch(registerPropControllers(documentKey, elementKey, propControllers))\n\n return propControllers\n }\n}\n\nfunction propControllerHandlesMiddleware(): Middleware<Dispatch, State, Dispatch> {\n return ({ dispatch, getState }: MiddlewareAPI<Dispatch, State>) =>\n (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n switch (action.type) {\n case ActionTypes.REGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey, componentHandle } = action.payload\n const element = ReactPage.getElement(getState(), documentKey, elementKey)\n const propControllers = dispatch(\n createAndRegisterPropControllers(documentKey, elementKey),\n )\n\n if (\n element != null &&\n !ReactPage.isElementReference(element) &&\n PropControllerHandles.isPropControllersHandle(componentHandle)\n ) {\n dispatch(registerPropControllersHandle(documentKey, elementKey, componentHandle))\n componentHandle.setPropControllers(propControllers)\n }\n\n break\n }\n\n case ActionTypes.UNREGISTER_COMPONENT_HANDLE: {\n const { documentKey, elementKey } = action.payload\n const handle = PropControllerHandles.getPropControllersHandle(\n getPropControllerHandlesStateSlice(getState()),\n documentKey,\n elementKey,\n )\n\n handle?.setPropControllers(null)\n\n dispatch(unregisterPropControllers(documentKey, elementKey))\n\n break\n }\n\n case ActionTypes.MESSAGE_HOST_PROP_CONTROLLER: {\n const propController = PropControllerHandles.getPropController(\n getPropControllerHandlesStateSlice(getState()),\n action.payload.documentKey,\n action.payload.elementKey,\n action.payload.propName,\n )\n\n if (propController) propController.recv(action.payload.message)\n }\n }\n\n return next(action)\n }\n }\n}\n\nif (import.meta.vitest) {\n const { describe, it, fn, expect } = import.meta.vitest\n\n describe('propControllerHandlesMiddleware', () => {\n it('registers prop controllers for element data', () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { key: 'elementKey', type: 'type', props: {} }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const setPropControllers = fn()\n const handle = new ElementImperativeHandle()\n\n handle.callback(() => ({ setPropControllers }))\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(setPropControllers).toHaveBeenCalled()\n })\n\n it(\"doesn't register prop controllers for element references\", () => {\n // Arrange\n const documentKey = 'documentKey'\n const element: ReactPage.Element = { type: 'reference', key: 'elementKey', value: 'value' }\n const store = createStore(reducer, applyMiddleware(thunk, propControllerHandlesMiddleware()))\n const setPropControllers = fn()\n const handle = new ElementImperativeHandle()\n\n handle.callback(() => ({ setPropControllers }))\n\n store.dispatch(registerDocument(ReactPage.createDocument(documentKey, element)))\n\n // Act\n store.dispatch(registerComponentHandle(documentKey, element.key, handle))\n\n // Assert\n expect(setPropControllers).not.toHaveBeenCalled()\n })\n })\n}\n\nfunction makeswiftApiClientSyncMiddleware(\n client: MakeswiftClient,\n): Middleware<Dispatch, State, Dispatch> {\n return () => (next: ReduxDispatch<Action>) => {\n return (action: Action): Action => {\n client.makeswiftApiClient.dispatch(action)\n\n return next(action)\n }\n }\n}\n\nexport type Store = ReduxStore<State, Action> & { dispatch: Dispatch }\n\nexport function configureStore({\n rootElements,\n preloadedState,\n client,\n}: {\n rootElements?: Map<string, Documents.Element>\n preloadedState?: PreloadedState<State>\n client: MakeswiftClient\n}): Store {\n const initialState: PreloadedState<State> = {\n ...preloadedState,\n documents: Documents.getInitialState({ rootElements }),\n isPreview: IsPreview.getInitialState(true),\n }\n\n return createStore(\n reducer,\n initialState,\n applyMiddleware(\n thunk,\n measureBoxModelsMiddleware(),\n messageChannelMiddleware(client),\n propControllerHandlesMiddleware(),\n makeswiftApiClientSyncMiddleware(client),\n ),\n )\n}\n","import { ReactNode, useEffect, useMemo } from 'react'\n\nimport { StoreContext, ReactRuntime } from '..'\nimport * as ReactBuilderPreview from '../../../state/react-builder-preview'\nimport * as ReactPage from '../../../state/react-page'\nimport { MakeswiftProvider, MakeswiftClient } from '../../../api/react'\nimport { registerDocumentEffect } from '../../../state/actions'\n\ntype Props = {\n client: MakeswiftClient\n rootElements?: Map<string, ReactPage.Element>\n children?: ReactNode\n runtime?: ReactRuntime\n}\n\nexport default function PreviewProvider({\n client,\n children,\n rootElements,\n runtime,\n}: Props): JSX.Element {\n const store = useMemo(\n () =>\n ReactBuilderPreview.configureStore({\n preloadedState: runtime ? runtime.store.getState() : ReactRuntime.store.getState(),\n rootElements,\n client,\n }),\n [client, rootElements, runtime],\n )\n\n useEffect(() => {\n const unregisterDocuments = Array.from(rootElements?.entries() ?? []).map(\n ([documentKey, rootElement]) =>\n store.dispatch(registerDocumentEffect(ReactPage.createDocument(documentKey, rootElement))),\n )\n\n return () => {\n unregisterDocuments.forEach(unregisterDocument => {\n unregisterDocument()\n })\n }\n }, [store, rootElements])\n\n return (\n <StoreContext.Provider value={store}>\n <MakeswiftProvider client={client}>{children}</MakeswiftProvider>\n </StoreContext.Provider>\n )\n}\n"],"names":["removeIn","setIn","ReadOnlyDocuments.getInitialState","ReadOnlyDocuments.getDocument","getInitialState","ReadOnlyDocuments.reducer","ActionTypes","ReadOnlyDocuments.createDocument","combineReducers","Documents.reducer","ReactComponents.reducer","BoxModels.reducer","ComponentsMeta.reducer","PropControllers.reducer","PropControllerHandles.reducer","IsInBuilder.reducer","IsPreview.reducer","BuilderEditMode.reducer","Pointer.reducer","ElementImperativeHandles.reducer","Breakpoints.reducer","BoxModels.getMeasurables","BoxModels.getBoxModels","BoxModels.getBoxModel","ComponentsMeta.getComponentsMeta","PropControllers.getComponentPropControllerDescriptors","Pointer.getPointer","ElementImperativeHandles.getElementImperativeHandles","BoxModels.measure","deepEqual","changeElementBoxModels","handleWheel","handlePointerMove","ReactPage.getBuilderEditMode","BuilderEditMode.BuilderEditMode","changeDocumentElementSize","ReactPage.getDocumentKeysSortedByDepth","elementFromPointChange","setIsInBuilder","BoxModels.isMeasurable","registerMeasurable","unregisterMeasurable","serializeControls","registerBuilderComponent","ReactPage.getBreakpoints","setBreakpoints","Router","setLocale","changePathnameStart","changePathnameComplete","unregisterBuilderComponent","ReactPage.getElementPropControllerDescriptors","createPropController","messageBuilderPropController","registerPropControllers","ReactPage.getElement","ReactPage.isElementReference","PropControllerHandles.isPropControllersHandle","registerPropControllersHandle","PropControllerHandles.getPropControllersHandle","unregisterPropControllers","PropControllerHandles.getPropController","createStore","applyMiddleware","thunk","ElementImperativeHandle","registerDocument","ReactPage.createDocument","registerComponentHandle","Documents.getInitialState","IsPreview.getInitialState","client","children","rootElements","runtime","store","useMemo","ReactBuilderPreview","preloadedState","getState","ReactRuntime","useEffect","unregisterDocuments","Array","from","entries","map","documentKey","rootElement","dispatch","registerDocumentEffect","ReactPage","forEach","unregisterDocument","_jsx","StoreContext","MakeswiftProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,eAAe,MAAiC,WAAiD;AAC/F,MAAI,UAAU;AAEd,YAAU,QAAQ,CAAa,cAAA;AAE7B,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAgB,gBAAAA,UAAAA,SAAS,SAAS,UAAU,CAAC;AAGjE,QAAI,UAAU,MAAM;AAAM,gBAAUC,UAAM,MA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C,KAAKX,mDAAcY,cAAdZ,YAA2B,CAAA,CAAtC,EAA0Ca,IACpE,CAAC,CAACC,aAAaC,iBACbb,MAAMc,SAASC,QAAuBC,uBAAAA,yBAAyBJ,aAAaC,WAAtC,CAAD,CAArC,CAFwB;AAK5B,WAAO,MAAM;AACXN,0BAAoBU,QAAQC,CAAsB,uBAAA;AAC9B;MAAA,CADpB;AAAA,IAAA;AAAA,EADF,GAKC,CAAClB,OAAOF,YAAR,CAXM;AAcP,SAAAqB,2BAAA,IAACC,kBAAa,UAAd;AAAA,IAAuB,OAAOpB;AAAAA,IAA9B,yCACGqB,wBAAD;AAAA,MAAmB;AAAA,MAAiBxB;AAAAA,IAAAA,CAApC;AAAA,EAAA,CAFJ;AAKD;;"}
|
|
@@ -23,9 +23,9 @@ import { J as ElementImperativeHandle, a as ReactRuntime, K as StoreContext, M a
|
|
|
23
23
|
import { createStore, applyMiddleware, combineReducers } from "redux";
|
|
24
24
|
import thunk from "redux-thunk";
|
|
25
25
|
import Router from "next/router";
|
|
26
|
-
import {
|
|
26
|
+
import { c2 as getInitialState$3, c3 as reducer$4, c4 as getDocument$1, c as createDocument, c5 as getComponentsMeta$1, c6 as getComponentPropControllerDescriptors$1, ax as getBreakpoints, f as deepEqual, aD as getBuilderEditMode, c7 as BuilderEditMode, c8 as getDocumentKeysSortedByDepth, c9 as getPropController, ca as getPropControllersHandle, cb as getElement, cc as getElementPropControllerDescriptors, cd as createPropController, j as isElementReference, a4 as isPropControllersHandle, ce as reducer$5, cf as reducer$7, cg as reducer$8, ch as reducer$9, ci as reducer$a, cj as reducer$b, ck as reducer$c, cl as getInitialState$4 } from "./react-page.es.js";
|
|
27
27
|
import { removeIn, setIn } from "immutable";
|
|
28
|
-
import { A as ActionTypes,
|
|
28
|
+
import { A as ActionTypes, v as unregisterMeasurable, w as registerMeasurable, x as registerBuilderComponent, j as setBreakpoints, k as setLocale, y as changePathnameStart, z as changePathnameComplete, B as changeElementBoxModels, C as changeDocumentElementSize, D as handleWheel, E as handlePointerMove, F as elementFromPointChange, G as setIsInBuilder, H as unregisterBuilderComponent, I as unregisterPropControllers, J as registerPropControllers, K as registerPropControllersHandle, r as registerDocument, L as registerComponentHandle, M as messageBuilderPropController, N as registerDocumentEffect } from "./actions.es.js";
|
|
29
29
|
import { i as isMeasurable, a as getMeasurables$1, b as getBoxModels$1, m as measure, d as getBoxModel$1, r as reducer$6 } from "./box-models.es.js";
|
|
30
30
|
import { reducer as reducer$d } from "./state/breakpoints.es.js";
|
|
31
31
|
import { a as serializeControls } from "./control-serialization.es.js";
|
|
@@ -148,8 +148,7 @@ const reducer = combineReducers({
|
|
|
148
148
|
builderEditMode: reducer$c,
|
|
149
149
|
pointer: reducer$2,
|
|
150
150
|
elementImperativeHandles: reducer$1,
|
|
151
|
-
breakpoints: reducer$d
|
|
152
|
-
locales: reducer$e
|
|
151
|
+
breakpoints: reducer$d
|
|
153
152
|
});
|
|
154
153
|
function getBoxModelsStateSlice(state) {
|
|
155
154
|
return state.boxModels;
|
|
@@ -420,7 +419,7 @@ function measureBoxModelsMiddleware() {
|
|
|
420
419
|
};
|
|
421
420
|
};
|
|
422
421
|
}
|
|
423
|
-
function messageChannelMiddleware() {
|
|
422
|
+
function messageChannelMiddleware(client) {
|
|
424
423
|
return ({ dispatch, getState }) => (next) => {
|
|
425
424
|
let cleanUp = () => {
|
|
426
425
|
};
|
|
@@ -440,14 +439,8 @@ function messageChannelMiddleware() {
|
|
|
440
439
|
});
|
|
441
440
|
const breakpoints = getBreakpoints(state);
|
|
442
441
|
messageChannel.port1.postMessage(setBreakpoints(breakpoints));
|
|
443
|
-
const locales = getLocales(state);
|
|
444
|
-
const defaultLocale = getDefaultLocale(state);
|
|
445
442
|
const routerLocale = Router.locale;
|
|
446
|
-
if (
|
|
447
|
-
messageChannel.port1.postMessage(setLocales(locales));
|
|
448
|
-
if (defaultLocale != null)
|
|
449
|
-
messageChannel.port1.postMessage(setDefaultLocale(defaultLocale));
|
|
450
|
-
if (routerLocale != null && locales.some((locale) => locale.toString() === routerLocale)) {
|
|
443
|
+
if (routerLocale != null) {
|
|
451
444
|
messageChannel.port1.postMessage(setLocale(new Intl.Locale(routerLocale)));
|
|
452
445
|
}
|
|
453
446
|
Router.events.on("routeChangeStart", () => {
|
|
@@ -501,6 +494,10 @@ function messageChannelMiddleware() {
|
|
|
501
494
|
Router.push(pathname);
|
|
502
495
|
break;
|
|
503
496
|
}
|
|
497
|
+
case ActionTypes.SET_LOCALIZED_RESOURCE_ID: {
|
|
498
|
+
client.setLocalizedResourceId(action.payload);
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
504
501
|
case ActionTypes.INIT:
|
|
505
502
|
cleanUp = dispatch(initialize());
|
|
506
503
|
break;
|
|
@@ -600,7 +597,7 @@ function configureStore({
|
|
|
600
597
|
documents: getInitialState$2({ rootElements }),
|
|
601
598
|
isPreview: getInitialState$4(true)
|
|
602
599
|
});
|
|
603
|
-
return createStore(reducer, initialState, applyMiddleware(thunk, measureBoxModelsMiddleware(), messageChannelMiddleware(), propControllerHandlesMiddleware(), makeswiftApiClientSyncMiddleware(client)));
|
|
600
|
+
return createStore(reducer, initialState, applyMiddleware(thunk, measureBoxModelsMiddleware(), messageChannelMiddleware(client), propControllerHandlesMiddleware(), makeswiftApiClientSyncMiddleware(client)));
|
|
604
601
|
}
|
|
605
602
|
function PreviewProvider({
|
|
606
603
|
client,
|