@makeswift/runtime 0.28.8-canary.22 → 0.28.8-canary.23

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.
@@ -27,7 +27,7 @@ class MakeswiftGraphQLApiClient {
27
27
  graphqlClient;
28
28
  constructor({ endpoint }) {
29
29
  this.graphqlClient = new import_client.GraphQLClient(endpoint, {
30
- "makeswift-runtime-version": "0.28.8-canary.22"
30
+ "makeswift-runtime-version": "0.28.8-canary.23"
31
31
  });
32
32
  }
33
33
  async createTableRecord(tableId, columns) {
@@ -147,7 +147,7 @@ class MakeswiftRestAPIClient {
147
147
  const requestHeaders = new Headers({
148
148
  "x-api-key": this.apiKey,
149
149
  "makeswift-site-api-key": this.apiKey,
150
- "makeswift-runtime-version": "0.28.8-canary.22"
150
+ "makeswift-runtime-version": "0.28.8-canary.23"
151
151
  });
152
152
  if (siteVersion?.token) {
153
153
  requestUrl.searchParams.set("version", siteVersion.version);
@@ -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.8-canary.22",
31
+ version: "0.28.8-canary.23",
32
32
  interactionMode: true,
33
33
  clientSideNavigation: false,
34
34
  elementFromPoint: false,
@@ -689,7 +689,7 @@ Received "${apiKey}" instead.`
689
689
  headers: {
690
690
  "x-api-key": this.apiKey,
691
691
  "makeswift-site-api-key": this.apiKey,
692
- "makeswift-runtime-version": "0.28.8-canary.22",
692
+ "makeswift-runtime-version": "0.28.8-canary.23",
693
693
  "content-type": "application/json"
694
694
  },
695
695
  body: JSON.stringify({ token }),
@@ -100,9 +100,12 @@ function lockDocumentScroll() {
100
100
  return (dispatch) => {
101
101
  const lastDocumentOverflow = window.document.documentElement.style.overflow;
102
102
  window.document.documentElement.style.overflow = "hidden";
103
+ const lastBodyOverflow = window.document.body.style.overflow;
104
+ window.document.body.style.overflow = "initial";
103
105
  window.document.documentElement.addEventListener("wheel", handleWheelEvent);
104
106
  return () => {
105
107
  window.document.documentElement.style.overflow = lastDocumentOverflow;
108
+ window.document.body.style.overflow = lastBodyOverflow;
106
109
  window.document.documentElement.removeEventListener("wheel", handleWheelEvent);
107
110
  };
108
111
  function handleWheelEvent({ deltaX, deltaY }) {
@@ -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.BoxDisplayModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel>()\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.BoxDisplayModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel | 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.BoxDisplayModel | 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\n const locale = ReadOnlyState.getLocale(getState())\n if (locale != null) dispatch(Builder.setLocale(new Intl.Locale(locale)))\n\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,uBAAsB;AAEtB,gBAA2B;AAC3B,sBAAiC;AAIjC,eAA0B;AAC1B,cAAyB;AAEzB,qBAAkC;AAGlC,oB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vB,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.BoxDisplayModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel>()\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.BoxDisplayModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel | 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.BoxDisplayModel | 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 // Adjust root HTML styles so the page is scrollable in the builder.\n // Specifically, we make two adjustments:\n //\n // 1. Set the root element's overflow to hidden. Otherwise, you'll see two\n // scrollbars in the builder when viewing the page: one being the native\n // scrollbar of the page, and the other being the builder's scrollbar.\n //\n // 2. Set the root body element's overflow to initial. There's cases where\n // if the body has an overflow property set on it, then the body\n // overflow-y property will become auto. This, combined with the\n // body/html having a 100% height means that the overflowing content of\n // the body won't count towards the scroll height of the root element,\n // thus preventing scrolling from the builder.\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n const lastBodyOverflow = window.document.body.style.overflow\n window.document.body.style.overflow = 'initial'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.body.style.overflow = lastBodyOverflow\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\n const locale = ReadOnlyState.getLocale(getState())\n if (locale != null) dispatch(Builder.setLocale(new Intl.Locale(locale)))\n\n dispatch(ReadOnly.setIsInBuilder(true))\n builderProxy.dispatchBuffered()\n\n return () => {\n unregisterBuilderDocuments()\n stopMeasuringElements()\n stopMeasuringDocumentElement()\n stopHandlingFocusEvent()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,SAAS,6BAA6B,CAAC;AAC3E,UAAM,8BAA8B,SAAS,0BAA0B,CAAC;AAExE,UAAM,cAAc,cAAc,eAAe,SAAS,CAAC;AAC3D,aAAS,QAAQ,eAAe,WAAW,CAAC;AAE5C,UAAM,SAAS,cAAc,UAAU,SAAS,CAAC;AACjD,QAAI,UAAU;AAAM,eAAS,QAAQ,UAAU,IAAI,KAAK,OAAO,MAAM,CAAC,CAAC;AAEvE,aAAS,SAAS,eAAe,IAAI,CAAC;AACtC,iBAAa,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"]}
@@ -9,7 +9,7 @@ class MakeswiftGraphQLApiClient {
9
9
  graphqlClient;
10
10
  constructor({ endpoint }) {
11
11
  this.graphqlClient = new GraphQLClient(endpoint, {
12
- "makeswift-runtime-version": "0.28.8-canary.22"
12
+ "makeswift-runtime-version": "0.28.8-canary.23"
13
13
  });
14
14
  }
15
15
  async createTableRecord(tableId, columns) {
@@ -113,7 +113,7 @@ class MakeswiftRestAPIClient {
113
113
  const requestHeaders = new Headers({
114
114
  "x-api-key": this.apiKey,
115
115
  "makeswift-site-api-key": this.apiKey,
116
- "makeswift-runtime-version": "0.28.8-canary.22"
116
+ "makeswift-runtime-version": "0.28.8-canary.23"
117
117
  });
118
118
  if (siteVersion?.token) {
119
119
  requestUrl.searchParams.set("version", siteVersion.version);
@@ -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.8-canary.22",
11
+ version: "0.28.8-canary.23",
12
12
  interactionMode: true,
13
13
  clientSideNavigation: false,
14
14
  elementFromPoint: false,
@@ -669,7 +669,7 @@ Received "${apiKey}" instead.`
669
669
  headers: {
670
670
  "x-api-key": this.apiKey,
671
671
  "makeswift-site-api-key": this.apiKey,
672
- "makeswift-runtime-version": "0.28.8-canary.22",
672
+ "makeswift-runtime-version": "0.28.8-canary.23",
673
673
  "content-type": "application/json"
674
674
  },
675
675
  body: JSON.stringify({ token }),
@@ -74,9 +74,12 @@ function lockDocumentScroll() {
74
74
  return (dispatch) => {
75
75
  const lastDocumentOverflow = window.document.documentElement.style.overflow;
76
76
  window.document.documentElement.style.overflow = "hidden";
77
+ const lastBodyOverflow = window.document.body.style.overflow;
78
+ window.document.body.style.overflow = "initial";
77
79
  window.document.documentElement.addEventListener("wheel", handleWheelEvent);
78
80
  return () => {
79
81
  window.document.documentElement.style.overflow = lastDocumentOverflow;
82
+ window.document.body.style.overflow = lastBodyOverflow;
80
83
  window.document.documentElement.removeEventListener("wheel", handleWheelEvent);
81
84
  };
82
85
  function handleWheelEvent({ deltaX, deltaY }) {
@@ -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.BoxDisplayModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel>()\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.BoxDisplayModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel | 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.BoxDisplayModel | 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\n const locale = ReadOnlyState.getLocale(getState())\n if (locale != null) dispatch(Builder.setLocale(new Intl.Locale(locale)))\n\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;AAEP,SAA2B,sBAAsB;AAEjD,SAAS,kBAA6D;AACpE,SAAO,CAAC,UAAU,aAAa;AAC7B,UAAM,cAAc,eAAe,SAAS,CAAC;AAC7C,UAAM,mBAAmB,aAAa,SAAS,CAAC;AAChD,UAAM,oBAAoB,oBAAI,IAAoD;AAElF,gBAAY,QAAQ,CAAC,qBAAqB,gBAAgB;AACxD,YAAM,4BAA4B,oBAAI,IAAuC;AAE7E,0BAAoB,QAAQ,CAAC,YAAY,eAAe;AACtD,cAAM,WAAW,UAAU,QAAQ,UAAU;AAE7C,YAAI,YAAY;AAAM,oCAA0B,IAAI,YAAY,QAAQ;AAAA,MAC1E,CAAC;AAED,UAAI,0BAA0B,OAAO,GAAG;AACtC,0BAAkB,IAAI,aAAa,yBAAyB;AAAA,MAC9D;AAAA,IACF,CAAC;AAED,UAAM,mBAAmB,oBAAI,IAA2D;AAExF,qBAAiB,QAAQ,CAAC,0BAA0B,gBAAgB;AAClE,YAAM,2BAA2B,oBAAI,IAA8C;AAEnF,+BAAyB,QAAQ,CAAC,WAAW,eAAe;AAC1D,YAAI,CAAC,kBAAkB,IAAI,WAAW,GAAG,IAAI,UAAU,GAAG;AACxD,mCAAyB,IAAI,YAAY,IAAI;AAAA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AAC7E,UAAM,8BAA8B,SAAS,6BAA6B,CAAC;AAC3E,UAAM,8BAA8B,SAAS,0BAA0B,CAAC;AAExE,UAAM,cAAc,cAAc,eAAe,SAAS,CAAC;AAC3D,aAAS,QAAQ,eAAe,WAAW,CAAC;AAE5C,UAAM,SAAS,cAAc,UAAU,SAAS,CAAC;AACjD,QAAI,UAAU;AAAM,eAAS,QAAQ,UAAU,IAAI,KAAK,OAAO,MAAM,CAAC,CAAC;AAEvE,aAAS,SAAS,eAAe,IAAI,CAAC;AACtC,iBAAa,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":["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.BoxDisplayModel>>()\n\n measurables.forEach((documentMeasurables, documentKey) => {\n const measuredDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel>()\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.BoxDisplayModel | null>>()\n\n currentBoxModels.forEach((currentDocumentBoxModels, documentKey) => {\n const changedDocumentBoxModels = new Map<string, BoxModels.BoxDisplayModel | 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.BoxDisplayModel | 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 // Adjust root HTML styles so the page is scrollable in the builder.\n // Specifically, we make two adjustments:\n //\n // 1. Set the root element's overflow to hidden. Otherwise, you'll see two\n // scrollbars in the builder when viewing the page: one being the native\n // scrollbar of the page, and the other being the builder's scrollbar.\n //\n // 2. Set the root body element's overflow to initial. There's cases where\n // if the body has an overflow property set on it, then the body\n // overflow-y property will become auto. This, combined with the\n // body/html having a 100% height means that the overflowing content of\n // the body won't count towards the scroll height of the root element,\n // thus preventing scrolling from the builder.\n const lastDocumentOverflow = window.document.documentElement.style.overflow\n window.document.documentElement.style.overflow = 'hidden'\n\n const lastBodyOverflow = window.document.body.style.overflow\n window.document.body.style.overflow = 'initial'\n\n window.document.documentElement.addEventListener('wheel', handleWheelEvent)\n\n return () => {\n window.document.documentElement.style.overflow = lastDocumentOverflow\n window.document.body.style.overflow = lastBodyOverflow\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\n const locale = ReadOnlyState.getLocale(getState())\n if (locale != null) dispatch(Builder.setLocale(new Intl.Locale(locale)))\n\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;AAEP,SAA2B,sBAAsB;AAEjD,SAAS,kBAA6D;AACpE,SAAO,CAAC,UAAU,aAAa;AAC7B,UAAM,cAAc,eAAe,SAAS,CAAC;AAC7C,UAAM,mBAAmB,aAAa,SAAS,CAAC;AAChD,UAAM,oBAAoB,oBAAI,IAAoD;AAElF,gBAAY,QAAQ,CAAC,qBAAqB,gBAAgB;AACxD,YAAM,4BAA4B,oBAAI,IAAuC;AAE7E,0BAAoB,QAAQ,CAAC,YAAY,eAAe;AACtD,cAAM,WAAW,UAAU,QAAQ,UAAU;AAE7C,YAAI,YAAY;AAAM,oCAA0B,IAAI,YAAY,QAAQ;AAAA,MAC1E,CAAC;AAED,UAAI,0BAA0B,OAAO,GAAG;AACtC,0BAAkB,IA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AU,QAAQ,CAAC,WAAW,gBAAgB;AAC5C,iBAAS,QAAQ,0BAA0B,WAAW,CAAC;AAAA,MACzD,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,SAAS,4BACd,cACiD;AACjD,SAAO,CAAC,UAAU,aAAa;AAC7B,UAAM,6BAA6B,SAAS,yBAAyB,CAAC;AACtE,UAAM,wBAAwB,SAAS,uBAAuB,CAAC;AAC/D,UAAM,+BAA+B,SAAS,8BAA8B,CAAC;AAC7E,UAAM,yBAAyB,SAAS,yBAAyB,CAAC;AAClE,UAAM,uBAAuB,SAAS,mBAAmB,CAAC;AAC1D,UAAM,+BAA+B,SAAS,8BAA8B,CAAC;AAC7E,UAAM,8BAA8B,SAAS,6BAA6B,CAAC;AAC3E,UAAM,8BAA8B,SAAS,0BAA0B,CAAC;AAExE,UAAM,cAAc,cAAc,eAAe,SAAS,CAAC;AAC3D,aAAS,QAAQ,eAAe,WAAW,CAAC;AAE5C,UAAM,SAAS,cAAc,UAAU,SAAS,CAAC;AACjD,QAAI,UAAU;AAAM,eAAS,QAAQ,UAAU,IAAI,KAAK,OAAO,MAAM,CAAC,CAAC;AAEvE,aAAS,SAAS,eAAe,IAAI,CAAC;AACtC,iBAAa,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":["document"]}
@@ -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;AAgRlC,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,eAAe,GAC5B,WAAW,CAAC,MAAM,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAgCjD"}
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;AAiSlC,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,eAAe,GAC5B,WAAW,CAAC,MAAM,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAgCjD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@makeswift/runtime",
3
- "version": "0.28.8-canary.22",
3
+ "version": "0.28.8-canary.23",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "url": "makeswift/makeswift",