@makeswift/runtime 0.28.3-canary.2 → 0.28.3-canary.3
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/cjs/api-handler/handlers/manifest.js +1 -1
- package/dist/cjs/client/index.js +3 -3
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js +8 -3
- package/dist/cjs/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
- package/dist/esm/api-handler/handlers/manifest.js +1 -1
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js +8 -3
- package/dist/esm/state/middleware/read-write/builder-api/initialize-connection.js.map +1 -1
- package/dist/types/state/middleware/read-write/builder-api/initialize-connection.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -28,7 +28,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
|
|
|
28
28
|
return import_request_response.ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
|
|
29
29
|
}
|
|
30
30
|
return import_request_response.ApiResponse.json({
|
|
31
|
-
version: "0.28.3-canary.
|
|
31
|
+
version: "0.28.3-canary.3",
|
|
32
32
|
interactionMode: true,
|
|
33
33
|
clientSideNavigation: false,
|
|
34
34
|
elementFromPoint: false,
|
package/dist/cjs/client/index.js
CHANGED
|
@@ -211,7 +211,7 @@ Received "${apiKey}" instead.`
|
|
|
211
211
|
}
|
|
212
212
|
this.apiKey = apiKey;
|
|
213
213
|
this.graphqlClient = new import_client.GraphQLClient(new URL("graphql", runtime.apiOrigin).href, {
|
|
214
|
-
"makeswift-runtime-version": "0.28.3-canary.
|
|
214
|
+
"makeswift-runtime-version": "0.28.3-canary.3"
|
|
215
215
|
});
|
|
216
216
|
this.runtime = runtime;
|
|
217
217
|
}
|
|
@@ -223,7 +223,7 @@ Received "${apiKey}" instead.`
|
|
|
223
223
|
const requestHeaders = new Headers({
|
|
224
224
|
"x-api-key": this.apiKey,
|
|
225
225
|
"makeswift-site-api-key": this.apiKey,
|
|
226
|
-
"makeswift-runtime-version": "0.28.3-canary.
|
|
226
|
+
"makeswift-runtime-version": "0.28.3-canary.3"
|
|
227
227
|
});
|
|
228
228
|
if (siteVersion?.token) {
|
|
229
229
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -681,7 +681,7 @@ Received "${apiKey}" instead.`
|
|
|
681
681
|
headers: {
|
|
682
682
|
"x-api-key": this.apiKey,
|
|
683
683
|
"makeswift-site-api-key": this.apiKey,
|
|
684
|
-
"makeswift-runtime-version": "0.28.3-canary.
|
|
684
|
+
"makeswift-runtime-version": "0.28.3-canary.3",
|
|
685
685
|
"content-type": "application/json"
|
|
686
686
|
},
|
|
687
687
|
body: JSON.stringify({ token }),
|
|
@@ -96,13 +96,18 @@ function startMeasuringElements() {
|
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function setDocumentScroll() {
|
|
100
100
|
return (dispatch) => {
|
|
101
101
|
const lastDocumentOverflow = window.document.documentElement.style.overflow;
|
|
102
102
|
window.document.documentElement.style.overflow = "hidden";
|
|
103
|
+
const styleTag = window.document.createElement("style");
|
|
104
|
+
styleTag.setAttribute("data-makeswift-scroll-override", "");
|
|
105
|
+
styleTag.textContent = "html, body { scroll-behavior: auto !important; }";
|
|
106
|
+
window.document.head.appendChild(styleTag);
|
|
103
107
|
window.document.documentElement.addEventListener("wheel", handleWheelEvent);
|
|
104
108
|
return () => {
|
|
105
109
|
window.document.documentElement.style.overflow = lastDocumentOverflow;
|
|
110
|
+
styleTag.remove();
|
|
106
111
|
window.document.documentElement.removeEventListener("wheel", handleWheelEvent);
|
|
107
112
|
};
|
|
108
113
|
function handleWheelEvent({ deltaX, deltaY }) {
|
|
@@ -250,7 +255,7 @@ function initializeBuilderConnection(builderProxy) {
|
|
|
250
255
|
const stopMeasuringElements = dispatch(startMeasuringElements());
|
|
251
256
|
const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement());
|
|
252
257
|
const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents());
|
|
253
|
-
const
|
|
258
|
+
const unsetDocumentScroll = dispatch(setDocumentScroll());
|
|
254
259
|
const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent());
|
|
255
260
|
const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint());
|
|
256
261
|
const unregisterBuilderComponents = dispatch(registerBuilderComponents());
|
|
@@ -263,7 +268,7 @@ function initializeBuilderConnection(builderProxy) {
|
|
|
263
268
|
stopMeasuringElements();
|
|
264
269
|
stopMeasuringDocumentElement();
|
|
265
270
|
stopHandlingFocusEvent();
|
|
266
|
-
|
|
271
|
+
unsetDocumentScroll();
|
|
267
272
|
stopHandlingPointerMoveEvent();
|
|
268
273
|
stopPollingElementFromPoint();
|
|
269
274
|
unregisterBuilderComponents();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/state/middleware/read-write/builder-api/initialize-connection.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport deepEqual from '../../../../utils/deepEqual'\n\nimport * as BoxModels from '../../../modules/read-write/box-models'\nimport * as BuilderEditMode from '../../../modules/builder-edit-mode'\n\nimport { type Action } from '../../../actions'\n\nimport * as ReadOnly from '../../../actions/internal/read-only-actions'\nimport * as Builder from '../../../builder-api/actions'\n\nimport { serializeControls } from '../../../../builder'\nimport { type BuilderAPIProxy } from '../../../builder-api/proxy'\n\nimport * as ReadOnlyState from '../../../read-only-state'\nimport {\n type State,\n getDocuments,\n getMeasurables,\n getBoxModels,\n getBoxModel,\n getElementImperativeHandlesContainingElement,\n getPointer,\n} from '../../../read-write-state'\n\nimport { type ElementSize, getElementSize } from './element-size'\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(Builder.changeElementBoxModels(changedBoxModels))\n }\n}\n\nfunction 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\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(Builder.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(Builder.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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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: ElementSize\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(Builder.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 ascendingDepthDocumentKeys = ReadOnlyState.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = ascendingDepthDocumentKeys.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(Builder.elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction registerBuilderComponents(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const state = getState()\n const componentsMeta = ReadOnlyState.getComponentsMeta(state)\n\n componentsMeta.forEach((meta, type) => {\n const descriptors = ReadOnlyState.getComponentPropControllerDescriptors(state, type)\n if (descriptors != null) {\n const [serializedControls, transferables] = serializeControls(descriptors)\n dispatch(\n Builder.registerBuilderComponent({ type, meta, serializedControls }, transferables),\n )\n }\n })\n\n return () => {\n componentsMeta.forEach((_, type) => {\n dispatch(Builder.unregisterBuilderComponent({ type }))\n })\n }\n }\n}\n\nfunction registerBuilderDocuments(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const documents = getDocuments(getState())\n\n documents.forEach(document => {\n dispatch(Builder.registerBuilderDocument(document))\n })\n\n return () => {\n documents.forEach((_document, documentKey) => {\n dispatch(Builder.unregisterBuilderDocument(documentKey))\n })\n }\n }\n}\n\nexport function initializeBuilderConnection(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const unregisterBuilderDocuments = dispatch(registerBuilderDocuments())\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 const unregisterBuilderComponents = dispatch(registerBuilderComponents())\n\n const breakpoints = ReadOnlyState.getBreakpoints(getState())\n dispatch(Builder.setBreakpoints(breakpoints))\n dispatch(ReadOnly.setIsInBuilder(true))\n builderProxy.dispatchBuffered()\n\n return () => {\n unregisterBuilderDocuments()\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n unregisterBuilderComponents()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BAAa,iBAAiB;AAE9B,WAAO,MAAM;AACX,iCAA2B;AAC3B,4BAAsB;AACtB,mCAA6B;AAC7B,6BAAuB;AACvB,2BAAqB;AACrB,mCAA6B;AAC7B,kCAA4B;AAC5B,kCAA4B;AAC5B,eAAS,SAAS,eAAe,KAAK,CAAC;AAAA,IACzC;AAAA,EACF;AACF;","names":["deepEqual","document"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/state/middleware/read-write/builder-api/initialize-connection.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport deepEqual from '../../../../utils/deepEqual'\n\nimport * as BoxModels from '../../../modules/read-write/box-models'\nimport * as BuilderEditMode from '../../../modules/builder-edit-mode'\n\nimport { type Action } from '../../../actions'\n\nimport * as ReadOnly from '../../../actions/internal/read-only-actions'\nimport * as Builder from '../../../builder-api/actions'\n\nimport { serializeControls } from '../../../../builder'\nimport { type BuilderAPIProxy } from '../../../builder-api/proxy'\n\nimport * as ReadOnlyState from '../../../read-only-state'\nimport {\n type State,\n getDocuments,\n getMeasurables,\n getBoxModels,\n getBoxModel,\n getElementImperativeHandlesContainingElement,\n getPointer,\n} from '../../../read-write-state'\n\nimport { type ElementSize, getElementSize } from './element-size'\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(Builder.changeElementBoxModels(changedBoxModels))\n }\n}\n\nfunction 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\nfunction setDocumentScroll(): 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 // Override scroll behavior to prevent scroll jank/lag when in the builder.\n const styleTag = window.document.createElement('style')\n styleTag.setAttribute('data-makeswift-scroll-override', '')\n styleTag.textContent = 'html, body { scroll-behavior: auto !important; }'\n window.document.head.appendChild(styleTag)\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n styleTag.remove()\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(Builder.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(Builder.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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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: ElementSize\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(Builder.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 ascendingDepthDocumentKeys = ReadOnlyState.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = ascendingDepthDocumentKeys.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(Builder.elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction registerBuilderComponents(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const state = getState()\n const componentsMeta = ReadOnlyState.getComponentsMeta(state)\n\n componentsMeta.forEach((meta, type) => {\n const descriptors = ReadOnlyState.getComponentPropControllerDescriptors(state, type)\n if (descriptors != null) {\n const [serializedControls, transferables] = serializeControls(descriptors)\n dispatch(\n Builder.registerBuilderComponent({ type, meta, serializedControls }, transferables),\n )\n }\n })\n\n return () => {\n componentsMeta.forEach((_, type) => {\n dispatch(Builder.unregisterBuilderComponent({ type }))\n })\n }\n }\n}\n\nfunction registerBuilderDocuments(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const documents = getDocuments(getState())\n\n documents.forEach(document => {\n dispatch(Builder.registerBuilderDocument(document))\n })\n\n return () => {\n documents.forEach((_document, documentKey) => {\n dispatch(Builder.unregisterBuilderDocument(documentKey))\n })\n }\n }\n}\n\nexport function initializeBuilderConnection(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const unregisterBuilderDocuments = dispatch(registerBuilderDocuments())\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents())\n const unsetDocumentScroll = dispatch(setDocumentScroll())\n const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent())\n const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint())\n const unregisterBuilderComponents = dispatch(registerBuilderComponents())\n\n const breakpoints = ReadOnlyState.getBreakpoints(getState())\n dispatch(Builder.setBreakpoints(breakpoints))\n dispatch(ReadOnly.setIsInBuilder(true))\n builderProxy.dispatchBuffered()\n\n return () => {\n unregisterBuilderDocuments()\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unsetDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n unregisterBuilderComponents()\n dispatch(ReadOnly.setIsInBuilder(false))\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAsB;AAEtB,gBAA2B;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C,iBAAa,iBAAiB;AAE9B,WAAO,MAAM;AACX,iCAA2B;AAC3B,4BAAsB;AACtB,mCAA6B;AAC7B,6BAAuB;AACvB,0BAAoB;AACpB,mCAA6B;AAC7B,kCAA4B;AAC5B,kCAA4B;AAC5B,eAAS,SAAS,eAAe,KAAK,CAAC;AAAA,IACzC;AAAA,EACF;AACF;","names":["deepEqual","document"]}
|
|
@@ -8,7 +8,7 @@ async function manifestHandler(req, { apiKey, manifest }) {
|
|
|
8
8
|
return ApiResponse.json({ message: "Unauthorized" }, { status: 401 });
|
|
9
9
|
}
|
|
10
10
|
return ApiResponse.json({
|
|
11
|
-
version: "0.28.3-canary.
|
|
11
|
+
version: "0.28.3-canary.3",
|
|
12
12
|
interactionMode: true,
|
|
13
13
|
clientSideNavigation: false,
|
|
14
14
|
elementFromPoint: false,
|
package/dist/esm/client/index.js
CHANGED
|
@@ -195,7 +195,7 @@ Received "${apiKey}" instead.`
|
|
|
195
195
|
}
|
|
196
196
|
this.apiKey = apiKey;
|
|
197
197
|
this.graphqlClient = new GraphQLClient(new URL("graphql", runtime.apiOrigin).href, {
|
|
198
|
-
"makeswift-runtime-version": "0.28.3-canary.
|
|
198
|
+
"makeswift-runtime-version": "0.28.3-canary.3"
|
|
199
199
|
});
|
|
200
200
|
this.runtime = runtime;
|
|
201
201
|
}
|
|
@@ -207,7 +207,7 @@ Received "${apiKey}" instead.`
|
|
|
207
207
|
const requestHeaders = new Headers({
|
|
208
208
|
"x-api-key": this.apiKey,
|
|
209
209
|
"makeswift-site-api-key": this.apiKey,
|
|
210
|
-
"makeswift-runtime-version": "0.28.3-canary.
|
|
210
|
+
"makeswift-runtime-version": "0.28.3-canary.3"
|
|
211
211
|
});
|
|
212
212
|
if (siteVersion?.token) {
|
|
213
213
|
requestUrl.searchParams.set("version", siteVersion.version);
|
|
@@ -665,7 +665,7 @@ Received "${apiKey}" instead.`
|
|
|
665
665
|
headers: {
|
|
666
666
|
"x-api-key": this.apiKey,
|
|
667
667
|
"makeswift-site-api-key": this.apiKey,
|
|
668
|
-
"makeswift-runtime-version": "0.28.3-canary.
|
|
668
|
+
"makeswift-runtime-version": "0.28.3-canary.3",
|
|
669
669
|
"content-type": "application/json"
|
|
670
670
|
},
|
|
671
671
|
body: JSON.stringify({ token }),
|
|
@@ -70,13 +70,18 @@ function startMeasuringElements() {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function setDocumentScroll() {
|
|
74
74
|
return (dispatch) => {
|
|
75
75
|
const lastDocumentOverflow = window.document.documentElement.style.overflow;
|
|
76
76
|
window.document.documentElement.style.overflow = "hidden";
|
|
77
|
+
const styleTag = window.document.createElement("style");
|
|
78
|
+
styleTag.setAttribute("data-makeswift-scroll-override", "");
|
|
79
|
+
styleTag.textContent = "html, body { scroll-behavior: auto !important; }";
|
|
80
|
+
window.document.head.appendChild(styleTag);
|
|
77
81
|
window.document.documentElement.addEventListener("wheel", handleWheelEvent);
|
|
78
82
|
return () => {
|
|
79
83
|
window.document.documentElement.style.overflow = lastDocumentOverflow;
|
|
84
|
+
styleTag.remove();
|
|
80
85
|
window.document.documentElement.removeEventListener("wheel", handleWheelEvent);
|
|
81
86
|
};
|
|
82
87
|
function handleWheelEvent({ deltaX, deltaY }) {
|
|
@@ -224,7 +229,7 @@ function initializeBuilderConnection(builderProxy) {
|
|
|
224
229
|
const stopMeasuringElements = dispatch(startMeasuringElements());
|
|
225
230
|
const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement());
|
|
226
231
|
const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents());
|
|
227
|
-
const
|
|
232
|
+
const unsetDocumentScroll = dispatch(setDocumentScroll());
|
|
228
233
|
const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent());
|
|
229
234
|
const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint());
|
|
230
235
|
const unregisterBuilderComponents = dispatch(registerBuilderComponents());
|
|
@@ -237,7 +242,7 @@ function initializeBuilderConnection(builderProxy) {
|
|
|
237
242
|
stopMeasuringElements();
|
|
238
243
|
stopMeasuringDocumentElement();
|
|
239
244
|
stopHandlingFocusEvent();
|
|
240
|
-
|
|
245
|
+
unsetDocumentScroll();
|
|
241
246
|
stopHandlingPointerMoveEvent();
|
|
242
247
|
stopPollingElementFromPoint();
|
|
243
248
|
unregisterBuilderComponents();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/state/middleware/read-write/builder-api/initialize-connection.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport deepEqual from '../../../../utils/deepEqual'\n\nimport * as BoxModels from '../../../modules/read-write/box-models'\nimport * as BuilderEditMode from '../../../modules/builder-edit-mode'\n\nimport { type Action } from '../../../actions'\n\nimport * as ReadOnly from '../../../actions/internal/read-only-actions'\nimport * as Builder from '../../../builder-api/actions'\n\nimport { serializeControls } from '../../../../builder'\nimport { type BuilderAPIProxy } from '../../../builder-api/proxy'\n\nimport * as ReadOnlyState from '../../../read-only-state'\nimport {\n type State,\n getDocuments,\n getMeasurables,\n getBoxModels,\n getBoxModel,\n getElementImperativeHandlesContainingElement,\n getPointer,\n} from '../../../read-write-state'\n\nimport { type ElementSize, getElementSize } from './element-size'\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(Builder.changeElementBoxModels(changedBoxModels))\n }\n}\n\nfunction 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\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(Builder.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(Builder.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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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: ElementSize\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(Builder.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 ascendingDepthDocumentKeys = ReadOnlyState.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = ascendingDepthDocumentKeys.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(Builder.elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction registerBuilderComponents(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const state = getState()\n const componentsMeta = ReadOnlyState.getComponentsMeta(state)\n\n componentsMeta.forEach((meta, type) => {\n const descriptors = ReadOnlyState.getComponentPropControllerDescriptors(state, type)\n if (descriptors != null) {\n const [serializedControls, transferables] = serializeControls(descriptors)\n dispatch(\n Builder.registerBuilderComponent({ type, meta, serializedControls }, transferables),\n )\n }\n })\n\n return () => {\n componentsMeta.forEach((_, type) => {\n dispatch(Builder.unregisterBuilderComponent({ type }))\n })\n }\n }\n}\n\nfunction registerBuilderDocuments(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const documents = getDocuments(getState())\n\n documents.forEach(document => {\n dispatch(Builder.registerBuilderDocument(document))\n })\n\n return () => {\n documents.forEach((_document, documentKey) => {\n dispatch(Builder.unregisterBuilderDocument(documentKey))\n })\n }\n }\n}\n\nexport function initializeBuilderConnection(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const unregisterBuilderDocuments = dispatch(registerBuilderDocuments())\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 const unregisterBuilderComponents = dispatch(registerBuilderComponents())\n\n const breakpoints = ReadOnlyState.getBreakpoints(getState())\n dispatch(Builder.setBreakpoints(breakpoints))\n dispatch(ReadOnly.setIsInBuilder(true))\n builderProxy.dispatchBuffered()\n\n return () => {\n unregisterBuilderDocuments()\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unlockDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n unregisterBuilderComponents()\n dispatch(ReadOnly.setIsInBuilder(false))\n }\n }\n}\n"],"mappings":"AAEA,OAAO,eAAe;AAEtB,YAAY,eAAe;AAC3B,YAAY,qBAAqB;AAIjC,YAAY,cAAc;AAC1B,YAAY,aAAa;AAEzB,SAAS,yBAAyB;AAGlC,YAAY,mBAAmB;AAC/B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;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../../../../../src/state/middleware/read-write/builder-api/initialize-connection.ts"],"sourcesContent":["import { type ThunkAction } from '@reduxjs/toolkit'\n\nimport deepEqual from '../../../../utils/deepEqual'\n\nimport * as BoxModels from '../../../modules/read-write/box-models'\nimport * as BuilderEditMode from '../../../modules/builder-edit-mode'\n\nimport { type Action } from '../../../actions'\n\nimport * as ReadOnly from '../../../actions/internal/read-only-actions'\nimport * as Builder from '../../../builder-api/actions'\n\nimport { serializeControls } from '../../../../builder'\nimport { type BuilderAPIProxy } from '../../../builder-api/proxy'\n\nimport * as ReadOnlyState from '../../../read-only-state'\nimport {\n type State,\n getDocuments,\n getMeasurables,\n getBoxModels,\n getBoxModel,\n getElementImperativeHandlesContainingElement,\n getPointer,\n} from '../../../read-write-state'\n\nimport { type ElementSize, getElementSize } from './element-size'\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(Builder.changeElementBoxModels(changedBoxModels))\n }\n}\n\nfunction 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\nfunction setDocumentScroll(): 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 // Override scroll behavior to prevent scroll jank/lag when in the builder.\n const styleTag = window.document.createElement('style')\n styleTag.setAttribute('data-makeswift-scroll-override', '')\n styleTag.textContent = 'html, body { scroll-behavior: auto !important; }'\n window.document.head.appendChild(styleTag)\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n styleTag.remove()\n window.document.documentElement.removeEventListener('wheel', handleWheelEvent)\n }\n\n function handleWheelEvent({ deltaX, deltaY }: WheelEvent) {\n dispatch(Builder.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(Builder.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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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 (\n ReadOnlyState.getBuilderEditMode(getState()) === BuilderEditMode.BuilderEditMode.INTERACT\n ) {\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: ElementSize\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(Builder.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 ascendingDepthDocumentKeys = ReadOnlyState.getDocumentKeysSortedByDepth(getState())\n const descendingDepthDocumentKeys = ascendingDepthDocumentKeys.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(Builder.elementFromPointChange(keys))\n }\n\n animationFrameRequestId = requestAnimationFrame(handleAnimationFrameRequest)\n }\n }\n}\n\nfunction registerBuilderComponents(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const state = getState()\n const componentsMeta = ReadOnlyState.getComponentsMeta(state)\n\n componentsMeta.forEach((meta, type) => {\n const descriptors = ReadOnlyState.getComponentPropControllerDescriptors(state, type)\n if (descriptors != null) {\n const [serializedControls, transferables] = serializeControls(descriptors)\n dispatch(\n Builder.registerBuilderComponent({ type, meta, serializedControls }, transferables),\n )\n }\n })\n\n return () => {\n componentsMeta.forEach((_, type) => {\n dispatch(Builder.unregisterBuilderComponent({ type }))\n })\n }\n }\n}\n\nfunction registerBuilderDocuments(): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const documents = getDocuments(getState())\n\n documents.forEach(document => {\n dispatch(Builder.registerBuilderDocument(document))\n })\n\n return () => {\n documents.forEach((_document, documentKey) => {\n dispatch(Builder.unregisterBuilderDocument(documentKey))\n })\n }\n }\n}\n\nexport function initializeBuilderConnection(\n builderProxy: BuilderAPIProxy,\n): ThunkAction<() => void, State, unknown, Action> {\n return (dispatch, getState) => {\n const unregisterBuilderDocuments = dispatch(registerBuilderDocuments())\n const stopMeasuringElements = dispatch(startMeasuringElements())\n const stopMeasuringDocumentElement = dispatch(startMeasuringDocumentElement())\n const stopHandlingFocusEvent = dispatch(startHandlingFocusEvents())\n const unsetDocumentScroll = dispatch(setDocumentScroll())\n const stopHandlingPointerMoveEvent = dispatch(startHandlingPointerMoveEvent())\n const stopPollingElementFromPoint = dispatch(startPollingElementFromPoint())\n const unregisterBuilderComponents = dispatch(registerBuilderComponents())\n\n const breakpoints = ReadOnlyState.getBreakpoints(getState())\n dispatch(Builder.setBreakpoints(breakpoints))\n dispatch(ReadOnly.setIsInBuilder(true))\n builderProxy.dispatchBuffered()\n\n return () => {\n unregisterBuilderDocuments()\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()\n unsetDocumentScroll()\n stopHandlingPointerMoveEvent()\n stopPollingElementFromPoint()\n unregisterBuilderComponents()\n dispatch(ReadOnly.setIsInBuilder(false))\n }\n }\n}\n"],"mappings":"AAEA,OAAO,eAAe;AAEtB,YAAY,eAAe;AAC3B,YAAY,qBAAqB;AAIjC,YAAY,cAAc;AAC1B,YAAY,aAAa;AAEzB,SAAS,yBAAyB;AAGlC,YAAY,mBAAmB;AAC/B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAA2B,sBAAsB;AAEjD,SAAS,kBAA6D;AACpE,SAAO,CAAC,UAAU,aAAa;AAC7B,UAAM,cAAc,eAAe,SAAS,CAAC;AAC7C,UAAM,mBAAm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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize-connection.d.ts","sourceRoot":"","sources":["../../../../../../src/state/middleware/read-write/builder-api/initialize-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAOnD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAM9C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EACL,KAAK,KAAK,EAOX,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"initialize-connection.d.ts","sourceRoot":"","sources":["../../../../../../src/state/middleware/read-write/builder-api/initialize-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAOnD,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAM9C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EACL,KAAK,KAAK,EAOX,MAAM,2BAA2B,CAAA;AAuRlC,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,eAAe,GAC5B,WAAW,CAAC,MAAM,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CA4BjD"}
|