@next-bricks/visual-builder 1.11.1 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/bricks.json +11 -11
  2. package/dist/chunks/1370.bde908f3.js +2 -0
  3. package/dist/chunks/1370.bde908f3.js.map +1 -0
  4. package/dist/chunks/2252.b9ed6aa7.js +3 -0
  5. package/dist/chunks/2252.b9ed6aa7.js.LICENSE.txt +11 -0
  6. package/dist/chunks/2252.b9ed6aa7.js.map +1 -0
  7. package/dist/chunks/4103.3bfaf833.js +2 -0
  8. package/dist/chunks/4103.3bfaf833.js.map +1 -0
  9. package/dist/chunks/5399.87d8f078.js +2 -0
  10. package/dist/chunks/{5399.9c916ecb.js.map → 5399.87d8f078.js.map} +1 -1
  11. package/dist/chunks/7115.fe57c671.js +2 -0
  12. package/dist/chunks/{7115.1aeb7468.js.map → 7115.fe57c671.js.map} +1 -1
  13. package/dist/chunks/871.bf085405.js +2 -0
  14. package/dist/chunks/{871.c4a66cce.js.map → 871.bf085405.js.map} +1 -1
  15. package/dist/chunks/8989.f2fd0c29.js +2 -0
  16. package/dist/chunks/{8989.712b21ae.js.map → 8989.f2fd0c29.js.map} +1 -1
  17. package/dist/chunks/9027.07b0de15.js +2 -0
  18. package/dist/chunks/9027.07b0de15.js.map +1 -0
  19. package/dist/chunks/9933.f2bac1e9.js +3 -0
  20. package/dist/chunks/{9933.e92bd957.js.map → 9933.f2bac1e9.js.map} +1 -1
  21. package/dist/chunks/main.9c3156f3.js +2 -0
  22. package/dist/chunks/main.9c3156f3.js.map +1 -0
  23. package/dist/chunks/workbench-history-action.dd048a97.js +3 -0
  24. package/dist/chunks/{workbench-history-action.2c208c51.js.map → workbench-history-action.dd048a97.js.map} +1 -1
  25. package/dist/examples.json +3 -3
  26. package/dist/index.e7ddac9f.js +2 -0
  27. package/dist/index.e7ddac9f.js.map +1 -0
  28. package/dist/manifest.json +63 -63
  29. package/dist/types.json +95 -95
  30. package/dist-types/data-providers/preview/interfaces.d.ts +24 -3
  31. package/package.json +2 -2
  32. package/dist/chunks/1370.38d83fd9.js +0 -2
  33. package/dist/chunks/1370.38d83fd9.js.map +0 -1
  34. package/dist/chunks/5399.9c916ecb.js +0 -2
  35. package/dist/chunks/7115.1aeb7468.js +0 -2
  36. package/dist/chunks/871.c4a66cce.js +0 -2
  37. package/dist/chunks/8989.712b21ae.js +0 -2
  38. package/dist/chunks/9027.01529a48.js +0 -2
  39. package/dist/chunks/9027.01529a48.js.map +0 -1
  40. package/dist/chunks/9933.e92bd957.js +0 -3
  41. package/dist/chunks/main.14f3a0da.js +0 -2
  42. package/dist/chunks/main.14f3a0da.js.map +0 -1
  43. package/dist/chunks/workbench-history-action.2c208c51.js +0 -3
  44. package/dist/index.fc5deba5.js +0 -2
  45. package/dist/index.fc5deba5.js.map +0 -1
  46. /package/dist/chunks/{9933.e92bd957.js.LICENSE.txt → 9933.f2bac1e9.js.LICENSE.txt} +0 -0
  47. /package/dist/chunks/{workbench-history-action.2c208c51.js.LICENSE.txt → workbench-history-action.dd048a97.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunks/9027.01529a48.js","mappings":"6LAgCO,SAASA,EAAqBC,GACnC,IAAMC,EArBR,SAAiBC,GACf,IAAMD,EAAa,IAAIE,IAgBvB,OAdAC,EAAAA,EAAAA,GAASF,GAAcG,IACrB,OAAQA,EAAKC,MACX,IAAK,aACL,IAAK,eAAgB,IAAAC,EACbC,EACI,QADOD,EACfF,EAAKI,WAAG,IAAAF,OAAA,EADUA,EAEjBC,YACCA,GACFP,EAAWS,IAAIF,GAGrB,IAGKP,CACT,CAGqBU,EAAQC,EAAAA,EAAAA,IAAgBZ,IAErCa,EAAY,GAElB,IAAK,IAAMC,KAAQb,EACba,EAAKC,SAAS,MAChBF,EAAUG,KAAKF,GAInB,OAAOD,CACT,CAEAI,eAAeC,OACb,yCACAC,EAAAA,EAAAA,qBAA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AA6C,IAAA2E,EAC9CnC,EAAiBpN,SAASqN,cAAc,qBAE9C,OAAQD,SAA0B,QAAZmC,EAAdnC,EAAgBI,kBAAU,IAAA+B,OAAA,EAA3BA,EAA6C/L,QAClDa,EAAO,eAAiB,kBAE5B,C","sources":["webpack:///./src/data-providers/collect-used-contracts.ts","webpack:///./src/data-providers/preview/inspector.ts","webpack:///./src/data-providers/preview/capture.ts","webpack:///./src/data-providers/preview/resizeScreenshot.ts","webpack:///./src/data-providers/preview/realTimeDataInspect.ts","webpack:///./src/data-providers/preview/connect.ts"],"sourcesContent":["import { createProviderClass } from \"@next-core/utils/general\";\nimport {\n type StoryboardNode,\n parseStoryboard,\n traverse,\n} from \"@next-core/storyboard\";\nimport {\n Storyboard,\n UseProviderResolveConf,\n UseProviderEventHandler,\n} from \"@next-core/types\";\n\nfunction collect(nodeOrNodes: StoryboardNode | StoryboardNode[]): Set<string> {\n const collection = new Set<string>();\n\n traverse(nodeOrNodes, (node) => {\n switch (node.type) {\n case \"Resolvable\":\n case \"EventHandler\": {\n const useProvider = (\n node.raw as UseProviderResolveConf | UseProviderEventHandler\n )?.useProvider;\n if (useProvider) {\n collection.add(useProvider);\n }\n }\n }\n });\n\n return collection;\n}\n\nexport function collectUsedContracts(storyboard: Storyboard): string[] {\n const collection = collect(parseStoryboard(storyboard as any));\n\n const contracts = [];\n\n for (const item of collection) {\n if (item.includes(\"@\")) {\n contracts.push(item);\n }\n }\n\n return contracts;\n}\n\ncustomElements.define(\n \"visual-builder.collect-used-contracts\",\n createProviderClass(collectUsedContracts)\n);\n","// istanbul ignore file: working in progress\n// https://github.com/facebook/react/blob/cae635054e17a6f107a39d328649137b83f25972/packages/react-devtools-shared/src/backend/views/Highlighter/index.js\nimport { throttle } from \"lodash\";\nimport type {\n PreviewMessagePreviewerHoverOnBrick,\n PreviewMessagePreviewerSelectBrick,\n PreviewMessagePreviewerContextMenuOnBrick,\n} from \"./interfaces.js\";\n\nexport let previewProxyOrigin: string;\n\nexport function setPreviewFromOrigin(origin: string): void {\n previewProxyOrigin = origin;\n}\n\nexport function startInspecting(): void {\n registerListeners();\n}\n\nexport function stopInspecting(): void {\n unregisterListeners();\n}\n\nfunction registerListeners(): void {\n window.addEventListener(\"click\", onClick, true);\n window.addEventListener(\"mousedown\", onMouseEvent, true);\n window.addEventListener(\"mouseover\", onMouseEvent, true);\n window.addEventListener(\"mouseup\", onMouseEvent, true);\n window.addEventListener(\"pointerdown\", onPointerDown, true);\n window.addEventListener(\"pointermove\", onPointerMove, true);\n window.addEventListener(\"pointerup\", onMouseEvent, true);\n window.addEventListener(\"pointerleave\", onPointerLeave, true);\n window.addEventListener(\"contextmenu\", onContextMenu, true);\n}\n\nfunction unregisterListeners(): void {\n window.removeEventListener(\"click\", onClick, true);\n window.removeEventListener(\"mousedown\", onMouseEvent, true);\n window.removeEventListener(\"mouseover\", onMouseEvent, true);\n window.removeEventListener(\"mouseup\", onMouseEvent, true);\n window.removeEventListener(\"pointerdown\", onPointerDown, true);\n window.removeEventListener(\"pointermove\", onPointerMove, true);\n window.removeEventListener(\"pointerup\", onMouseEvent, true);\n window.removeEventListener(\"pointerleave\", onPointerLeave, true);\n window.removeEventListener(\"contextmenu\", onContextMenu, true);\n}\n\nfunction onClick(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n selectBrick(event.composedPath());\n}\n\nfunction onMouseEvent(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst hoverOnBrick = throttle(\n (eventTargets: EventTarget[]) => {\n const iidList = getPossibleBrickTargets(eventTargets);\n\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList,\n } as PreviewMessagePreviewerHoverOnBrick,\n previewProxyOrigin\n );\n }\n },\n 100,\n { leading: false }\n);\n\nfunction onPointerDown(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n hoverOnBrick(event.composedPath());\n}\n\nfunction onPointerMove(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n hoverOnBrick(event.composedPath());\n}\n\nfunction onPointerLeave(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList: [],\n } as PreviewMessagePreviewerHoverOnBrick,\n previewProxyOrigin\n );\n}\n\nfunction onContextMenu(event: MouseEvent): void {\n event.preventDefault();\n event.stopPropagation();\n contextMenuOnBrick(event.composedPath(), {\n x: event.clientX,\n y: event.clientY,\n });\n}\n\nfunction contextMenuOnBrick(\n eventTargets: EventTarget[],\n position: {\n x: number;\n y: number;\n }\n): void {\n const iidList = getPossibleBrickTargets(eventTargets);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"context-menu-on-brick\",\n iidList,\n position,\n } as PreviewMessagePreviewerContextMenuOnBrick,\n previewProxyOrigin\n );\n }\n}\n\nfunction selectBrick(eventTargets: EventTarget[]): void {\n const iidList = getPossibleBrickTargets(eventTargets);\n if (iidList.length > 0) {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"select-brick\",\n iidList,\n } as PreviewMessagePreviewerSelectBrick,\n previewProxyOrigin\n );\n }\n}\n\nexport function getPossibleBrickIidList(brick: HTMLElement): string[] {\n const iidList: string[] = [];\n // Traverse from bottom to up, to find bricks current hover on.\n let cursor: HTMLElement | null = brick;\n while (cursor) {\n if (typeof cursor.dataset.iid === \"string\") {\n iidList.push(cursor.dataset.iid);\n }\n cursor = cursor.parentElement;\n }\n return iidList;\n}\n\nexport function getPossibleBrickTargets(eventTargets: EventTarget[]) {\n const targets: string[] = [];\n for (const target of eventTargets) {\n if (\n target instanceof HTMLElement &&\n typeof target.dataset.iid === \"string\"\n ) {\n targets.push(target.dataset.iid);\n }\n }\n return targets;\n}\n","// istanbul ignore file: nothing logical except calling html2canvas.\nimport html2canvas from \"html2canvas\";\nimport { resizeScreenshot } from \"./resizeScreenshot.js\";\n\nfunction getCanvasBlob(canvas: HTMLCanvasElement): Promise<Blob> {\n return new Promise(function (resolve, reject) {\n canvas.toBlob(function (blob: Blob | null) {\n if (blob) {\n resolve(blob);\n } else {\n reject();\n }\n });\n });\n}\n\nexport async function capture(\n maxWidth: number,\n maxHeight: number\n): Promise<Blob> {\n const sourceCanvas = await html2canvas(document.body, {\n logging: false,\n scale: 1,\n width: window.innerWidth,\n height: window.innerHeight,\n foreignObjectRendering: true,\n });\n const targetCanvas = document.createElement(\"canvas\");\n resizeScreenshot(sourceCanvas, targetCanvas, maxWidth, maxHeight);\n const blob = await getCanvasBlob(targetCanvas);\n return blob;\n}\n","export function resizeScreenshot(\n canvas: HTMLCanvasElement,\n targetCanvas: HTMLCanvasElement,\n maxWidth: number,\n maxHeight: number\n): string {\n const targetRatio = maxWidth / maxHeight;\n const { width, height } = canvas;\n const ratio = width / height;\n const wider = ratio >= targetRatio;\n const finalWidth = wider ? maxWidth : maxHeight * ratio;\n const finalHeight = wider ? maxWidth / ratio : maxHeight;\n targetCanvas.width = finalWidth;\n targetCanvas.height = finalHeight;\n\n const ctx = targetCanvas.getContext(\"2d\")!;\n ctx.drawImage(canvas, 0, 0, width, height, 0, 0, finalWidth, finalHeight);\n return targetCanvas.toDataURL();\n}\n","export function getRealTimeDataAnnotation(value: unknown) {\n const type = typeof value;\n switch (type) {\n case \"string\":\n case \"boolean\":\n case \"number\":\n return {\n type,\n value,\n };\n case \"undefined\":\n return { type };\n }\n if (value === null) {\n return { type: \"null\" };\n }\n if (Array.isArray(value)) {\n return { type: \"array\", length: value.length };\n }\n return { type: \"object\" };\n}\n","import {\n getHistory as _getHistory,\n getBasePath,\n matchPath as _matchPath,\n __secret_internals as _internals,\n type NextLocation,\n} from \"@next-core/runtime\";\nimport type { BrickConf, CustomTemplate, RouteConf } from \"@next-core/types\";\nimport { isEmpty, throttle } from \"lodash\";\nimport type {\n BrickOutline,\n HighLightNode,\n Position,\n PreviewDataOption,\n PreviewMessageFromPreviewer,\n PreviewMessagePreviewContractUpdate,\n PreviewMessagePreviewDataValueError,\n PreviewMessagePreviewDataValueSuccess,\n PreviewMessagePreviewerCaptureFailed,\n PreviewMessagePreviewerCaptureOk,\n PreviewMessagePreviewerContentScroll,\n PreviewMessagePreviewerHighlightBrick,\n PreviewMessagePreviewerHighlightContext,\n PreviewMessagePreviewerHoverOnMain,\n PreviewMessagePreviewerRealTimeDataInspectChange,\n PreviewMessagePreviewerRouteMatchChange,\n PreviewMessagePreviewerScroll,\n PreviewMessagePreviewerUrlChange,\n PreviewMessageToPreviewer,\n PreviewSettings,\n PreviewStartOptions,\n} from \"./interfaces.js\";\nimport { capture } from \"./capture.js\";\nimport {\n previewProxyOrigin,\n getPossibleBrickIidList,\n setPreviewFromOrigin,\n startInspecting,\n stopInspecting,\n} from \"./inspector.js\";\nimport { collectUsedContracts } from \"../collect-used-contracts.js\";\nimport { getRealTimeDataAnnotation } from \"./realTimeDataInspect.js\";\n\nlet connected = false;\n\ninterface DLL {\n (moduleId: \"tYg3\"): {\n getHistory: typeof _getHistory;\n developHelper: typeof _internals;\n };\n (moduleId: \"A+yw\"): {\n matchPath: typeof _matchPath;\n };\n}\n\nlet getHistory = _getHistory;\nlet matchPath = _matchPath;\nlet __secret_internals = _internals;\nlet isV2 = false;\n\n// istanbul ignore next\n// Make v3 bricks compatible with Brick Next v2.\ntry {\n const dll = (window as unknown as { dll?: DLL }).dll;\n if (\n dll &&\n window.BRICK_NEXT_VERSIONS?.[\"brick-container\"]?.startsWith(\"2.\")\n ) {\n const { getHistory: getHistoryV2, developHelper: developHelperV2 } =\n dll(\"tYg3\");\n const { matchPath: matchPathV2 } = dll(\"A+yw\");\n getHistory = getHistoryV2;\n matchPath = matchPathV2;\n // The `__secret_internals` of v3 has pretty the same API as\n // `developHelper` of v2, especially those for preview usage.\n __secret_internals = {\n ...developHelperV2,\n getContextValue(name, { tplStateStoreId }) {\n return developHelperV2.getContextValue(name, {\n tplContextId: tplStateStoreId,\n } as any);\n },\n getAllContextValues({ tplStateStoreId }) {\n // V3 returns an object of key-value.\n // While v2 returns a map of ContextItem.\n const v2Map = developHelperV2.getAllContextValues({\n tplContextId: tplStateStoreId,\n } as any) as unknown as Map<string, { value: unknown }>;\n return Object.fromEntries(\n [...v2Map].map(([k, v]) => [k, (v as any).value])\n );\n },\n };\n isV2 = true;\n }\n} catch (e) {\n // eslint-disable-next-line no-console\n console.error(\"Try to use v2 runtime APIs failed:\", e);\n}\n\nlet contentScrollElement: Element | null = null;\nlet contentScrollHost: Element | null = null;\n\nexport default async function connect(\n previewFromOrigin: string,\n options: PreviewStartOptions\n) {\n if (connected) {\n return;\n }\n connected = true;\n\n const sendMessage = <T extends PreviewMessageFromPreviewer>(\n message: Omit<T, \"sender\">\n ): void => {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n ...message,\n },\n previewFromOrigin\n );\n };\n\n sendMessage({ type: \"preview-started\" });\n setPreviewFromOrigin(previewFromOrigin);\n\n let hoverIid: string;\n let hoverAlias: string;\n let activeIid: string;\n let activeAlias: string;\n\n const handleHoverOnIframe = (pos: Position): void => {\n const element = document.elementFromPoint(pos.x, pos.y);\n if (element?.tagName === \"BODY\") {\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-main\",\n isDirection: true,\n position: {\n x: pos.x,\n y: pos.y,\n },\n } as PreviewMessagePreviewerHoverOnMain,\n previewProxyOrigin\n );\n } else {\n const iidList = getPossibleBrickIidList(element as HTMLElement);\n window.parent.postMessage(\n {\n sender: \"previewer\",\n type: \"hover-on-brick\",\n iidList,\n isDirection: true,\n position: {\n x: pos.x,\n y: pos.y,\n },\n },\n previewProxyOrigin\n );\n }\n };\n\n const sendHighlightBrickOutlines = (\n type: \"hover\" | \"active\",\n iid: string,\n alias: string\n ): void => {\n const outlines = getBrickOutlines(iid);\n sendMessage<PreviewMessagePreviewerHighlightBrick>({\n type: \"highlight-brick\",\n highlightType: type,\n outlines,\n iid: iid,\n alias: alias,\n });\n };\n\n const sendHighlightBricksOutlines = (nodes: HighLightNode[]): void => {\n const outlines = nodes\n .map((node) => getBrickOutlines(node.iid, node.alias))\n .flat();\n sendMessage<PreviewMessagePreviewerHighlightContext>({\n type: \"highlight-context\",\n outlines,\n });\n };\n\n let lastTemplatePreviewSettings: PreviewSettings | undefined;\n if (options.templateId) {\n lastTemplatePreviewSettings = options.settings;\n }\n\n const updateTemplatePreviewSettings = (): void => {\n __secret_internals.updateTemplatePreviewSettings(\n options.appId,\n options.templateId!,\n lastTemplatePreviewSettings\n );\n getHistory().reload();\n };\n\n const updateSnippetPreviewSettings = (): void => {\n __secret_internals.updateSnippetPreviewSettings(\n options.appId,\n JSON.parse(options.snippetData)\n );\n getHistory().reload();\n };\n\n /* const updateFormPreviewSettings = (): void => {\n __secret_internals.updateFormPreviewSettings(\n options.appId,\n options.formId,\n options.formData\n );\n getHistory().reload();\n }; */\n\n const handlePreviewData = (name: string, option: PreviewDataOption): void => {\n try {\n const { dataType } = option;\n let tplStateStoreId;\n\n if (dataType === \"state\") {\n tplStateStoreId = getRootTplStateStoreId();\n\n if (!tplStateStoreId) {\n sendMessage<PreviewMessagePreviewDataValueError>({\n type: \"inspect-data-value-error\",\n data: {\n error: {\n message:\n \"tplStateStoreId not found, unable to preview STATE value\",\n },\n },\n });\n\n return;\n }\n }\n\n let value, type: PreviewMessagePreviewDataValueSuccess[\"type\"];\n if (name) {\n type = \"inspect-single-data-value-success\";\n value = __secret_internals.getContextValue(name, {\n tplStateStoreId,\n });\n } else {\n type = \"inspect-all-data-values-success\";\n const data = __secret_internals.getAllContextValues({\n tplStateStoreId,\n });\n value = Object.entries(data).map(([name, value]) => ({ name, value }));\n }\n\n sendMessage<PreviewMessagePreviewDataValueSuccess>({\n type,\n data: {\n name,\n value,\n },\n });\n\n // istanbul ignore next\n } catch (error) {\n sendMessage<PreviewMessagePreviewDataValueError>({\n type: \"inspect-data-value-error\",\n data: {\n message: (error as Error).message,\n },\n });\n }\n };\n\n const history = getHistory();\n\n window.addEventListener(\n \"message\",\n async ({ data, origin }: MessageEvent<PreviewMessageToPreviewer>) => {\n if (\n origin !== previewFromOrigin ||\n !data ||\n data.sender !== \"preview-container\"\n ) {\n return;\n }\n if (data.forwardedFor === \"builder\") {\n switch (data.type) {\n case \"hover-on-brick\":\n hoverIid = data.iid;\n hoverAlias = data.alias;\n sendHighlightBrickOutlines(\"hover\", data.iid, data.alias);\n break;\n case \"hover-on-main\":\n sendHighlightBrickOutlines(\"hover\", \"#main-mount-point\", \"root\");\n break;\n case \"hover-on-context\":\n sendHighlightBricksOutlines(data.highlightNodes);\n break;\n case \"select-brick\":\n activeIid = data.iid;\n activeAlias = data.alias;\n sendHighlightBrickOutlines(\"active\", data.iid, data.alias);\n break;\n case \"hover-on-iframe\":\n handleHoverOnIframe(data.position);\n break;\n }\n } else\n switch (data.type) {\n case \"toggle-inspecting\":\n data.enabled ? startInspecting() : stopInspecting();\n break;\n case \"refresh\":\n if (data.options?.updateStoryboardType) {\n if (data.options.updateStoryboardType === \"route\") {\n __secret_internals.updateStoryboardByRoute(\n options.appId,\n data.storyboardPatch as RouteConf\n );\n } else if (data.options.updateStoryboardType === \"template\") {\n __secret_internals.updateStoryboardByTemplate(\n options.appId,\n data.storyboardPatch as CustomTemplate,\n data.options.settings\n );\n } else if (data.options.updateStoryboardType === \"snippet\") {\n __secret_internals.updateStoryboardBySnippet(\n options.appId,\n data.storyboardPatch as {\n snippetId: string;\n bricks: BrickConf[];\n }\n );\n } /* else if (data.options.updateStoryboardType === \"form\") {\n __secret_internals.updateFormPreviewSettings(\n options.appId,\n options.formId,\n data.storyboardPatch as FormDataProperties\n );\n } */\n\n const newContracts = await (\n __secret_internals as any\n ).getAddedContracts?.(data.storyboardPatch, {\n appId: options.appId,\n updateStoryboardType: data.options.updateStoryboardType,\n formId: options.formId,\n collectUsedContracts,\n });\n\n if (!isEmpty(newContracts)) {\n sendMessage<PreviewMessagePreviewContractUpdate>({\n type: \"contract-update\",\n data: {\n add: newContracts,\n },\n });\n } else {\n getHistory().reload();\n }\n\n break;\n }\n __secret_internals.updateStoryboard(\n options.appId,\n data.storyboardPatch\n );\n if (options.templateId) {\n lastTemplatePreviewSettings = data.settings;\n updateTemplatePreviewSettings();\n } /* else if (options.formId || options.formData) {\n updateFormPreviewSettings();\n } */ else if (data.options?.snippetData) {\n options.snippetData = data.options.snippetData;\n updateSnippetPreviewSettings();\n } else {\n getHistory().reload();\n }\n break;\n case \"reload\":\n location.reload();\n break;\n case \"back\":\n history.goBack();\n break;\n case \"forward\":\n history.goForward();\n break;\n case \"capture\":\n capture(data.maxWidth, data.maxHeight).then(\n (screenshot) => {\n sendMessage<PreviewMessagePreviewerCaptureOk>({\n type: \"capture-ok\",\n screenshot,\n });\n },\n () => {\n sendMessage<PreviewMessagePreviewerCaptureFailed>({\n type: \"capture-failed\",\n });\n }\n );\n break;\n case \"inspect-data-value\":\n handlePreviewData(data.name, data.option);\n break;\n case \"update-preview-url\": {\n // Remove origin first.\n const url = data.previewUrl.startsWith(window.origin)\n ? data.previewUrl.substring(window.origin.length)\n : data.previewUrl;\n // Then remove base path.\n const basePath = getBasePath();\n const to = url.startsWith(basePath)\n ? url.substring(basePath.length - 1)\n : url;\n getHistory().push(to);\n break;\n }\n case \"update-preview-route\": {\n options.routePath = data.routePath;\n options.routeExact = data.routeExact;\n syncRouteMatch();\n break;\n }\n /* case \"excute-proxy-method\": {\n const [ref, method, args = []] = data.proxyMethodArgs;\n try {\n const result = document.body.querySelector(ref)[method](...args);\n window.parent.postMessage({\n sender: \"previewer\",\n type: \"excute-proxy-method-success\",\n data: { method: method, res: result },\n });\n } catch (err) {\n window.parent.postMessage({\n sender: \"previewer\",\n type: \"excute-proxy-method-error\",\n data: { method: method, res: err.message },\n });\n }\n break;\n } */\n }\n }\n );\n\n window.addEventListener(\"scroll\", () => {\n sendMessage<PreviewMessagePreviewerScroll>({\n type: \"scroll\",\n scroll: {\n x: window.scrollX,\n y: window.scrollY,\n },\n });\n });\n\n let previewPageMatch = true;\n let currentLocation: NextLocation;\n const sendLocationChange = (loc: NextLocation): void => {\n sendMessage<PreviewMessagePreviewerUrlChange>({\n type: \"url-change\",\n url: location.origin + history.createHref(loc),\n });\n currentLocation = loc;\n syncRouteMatch();\n };\n\n function syncRouteMatch() {\n if (options.routePath) {\n const match = !!matchPath(currentLocation.pathname, {\n path: options.routePath,\n exact: options.routeExact,\n });\n sendMessage<PreviewMessagePreviewerRouteMatchChange>({\n type: \"route-match-change\",\n match,\n });\n\n // Re-update template preview settings once match route again (typically after login).\n if (options.templateId && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild!.childNodes.length === 0\n ) {\n updateTemplatePreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n }\n /* if (options.formId && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\");\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild.childNodes.length === 0\n ) {\n updateFormPreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n } */\n if (options.snippetData && !previewPageMatch && match) {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n const placeholderLoadObserver = new MutationObserver(() => {\n // We observe when the placeholder is appeared.\n if (\n mainMountPoint.childNodes.length === 1 &&\n (mainMountPoint.firstChild as HTMLElement).tagName === \"SPAN\" &&\n mainMountPoint.firstChild!.childNodes.length === 0\n ) {\n updateSnippetPreviewSettings();\n placeholderLoadObserver.disconnect();\n }\n });\n placeholderLoadObserver.observe(mainMountPoint, { childList: true });\n }\n previewPageMatch = match;\n }\n }\n\n sendLocationChange(history.location);\n\n history.listen(sendLocationChange);\n\n if (options.templateId) {\n updateTemplatePreviewSettings();\n }\n\n /* if (options.formId || options.formData) {\n updateFormPreviewSettings();\n } */\n\n if (options.snippetData) {\n updateSnippetPreviewSettings();\n }\n\n function setupContentScroll() {\n const host = document.querySelector(\"eo-page-view\");\n const element = host?.shadowRoot?.querySelector(\".content\") ?? null;\n if (element !== contentScrollElement) {\n contentScrollElement?.removeEventListener(\"scroll\", onContentScroll);\n element?.addEventListener(\"scroll\", onContentScroll);\n contentScrollElement = element;\n contentScrollHost = host;\n }\n }\n\n function onContentScroll(this: Element) {\n sendMessage<PreviewMessagePreviewerContentScroll>({\n type: \"content-scroll\",\n scroll: {\n x: this.scrollLeft,\n y: this.scrollTop,\n },\n });\n }\n\n __secret_internals.addRealTimeDataInspectHook?.(\n ({ changeType, tplStateStoreId, detail }) => {\n sendMessage<PreviewMessagePreviewerRealTimeDataInspectChange>({\n type: \"real-time-data-inspect-change\",\n changeType,\n tplStateStoreId,\n detail:\n changeType === \"update\"\n ? {\n name: detail.name,\n annotation: getRealTimeDataAnnotation(detail.value),\n }\n : {\n data: Object.fromEntries(\n Object.entries(detail.data).map(([k, v]) => [\n k,\n getRealTimeDataAnnotation(v),\n ])\n ),\n },\n });\n }\n );\n\n let memoizedRootTplStateStoreId: string | undefined;\n\n function setupRealTimeDataInspect(force?: boolean) {\n const tplStateStoreId = options.templateId\n ? getRootTplStateStoreId()\n : undefined;\n if (memoizedRootTplStateStoreId !== tplStateStoreId || force) {\n memoizedRootTplStateStoreId = tplStateStoreId;\n __secret_internals.setRealTimeDataInspectRoot?.({\n tplStateStoreId,\n });\n }\n }\n\n window.addEventListener(\"route.render\", () => {\n setupRealTimeDataInspect(true);\n });\n\n setupContentScroll();\n setupRealTimeDataInspect(true);\n\n const mutationCallback = (): void => {\n setupContentScroll();\n setupRealTimeDataInspect();\n if (hoverIid) {\n sendHighlightBrickOutlines(\"hover\", hoverIid, hoverAlias);\n }\n if (activeIid) {\n sendHighlightBrickOutlines(\"active\", activeIid, activeAlias);\n }\n };\n const mutationObserver = new MutationObserver(\n throttle(mutationCallback, 100, { leading: false })\n );\n mutationObserver.observe(document.body, { subtree: true, childList: true });\n}\n\nfunction getBrickOutlines(iid: string, alias?: string): BrickOutline[] {\n if (!iid) {\n return [];\n }\n const isRoot = iid.includes(\"#\");\n const elements = getElementsIncludingInShadowDOM(iid, isRoot);\n const outlines = getOutlines(elements, alias);\n return isRoot\n ? outlines.map((item) => ({\n ...item,\n height: window.innerHeight - item.top,\n }))\n : outlines;\n}\n\nexport function getElementsIncludingInShadowDOM(\n iid: string,\n isRoot?: boolean\n): HTMLElement[] {\n const elements: HTMLElement[] = [];\n\n function walk(root: Document | ShadowRoot) {\n const candidates = root.querySelectorAll<HTMLElement>(\n isRoot ? iid : `[data-iid=\"${iid}\"]`\n );\n elements.push(...candidates);\n\n // If elements are found in the document, we should stop searching in shadow DOM.\n if (root === document && candidates.length > 0) {\n return;\n }\n\n // These useBrick in v3 bricks will be inside shadow DOM.\n for (const item of root.querySelectorAll(\"*\")) {\n if (item.shadowRoot) {\n walk(item.shadowRoot);\n }\n }\n }\n\n walk(document);\n\n return elements;\n}\n\nfunction getOutlines(elements: HTMLElement[], alias?: string): BrickOutline[] {\n return elements.map((element) => {\n const hasContentScroll = contentScrollHost?.contains(element);\n const { width, height, left, top } = element.getBoundingClientRect();\n return {\n width,\n height,\n left:\n left +\n window.scrollX +\n (hasContentScroll ? contentScrollElement.scrollLeft : 0),\n top:\n top +\n window.scrollY +\n (hasContentScroll ? contentScrollElement.scrollTop : 0),\n alias,\n hasContentScroll,\n };\n });\n}\n\nfunction getRootTplStateStoreId(): string | undefined {\n const mainMountPoint = document.querySelector(\"#main-mount-point\")!;\n\n return (mainMountPoint?.firstChild as HTMLElement)?.dataset[\n isV2 ? \"tplContextId\" : \"tplStateStoreId\"\n ];\n}\n"],"names":["collectUsedContracts","storyboard","collection","nodeOrNodes","Set","traverse","node","type","_node$raw","useProvider","raw","add","collect","parseStoryboard","contracts","item","includes","push","customElements","define","createProviderClass","previewProxyOrigin","_capture","_asyncToGenerator","maxWidth","maxHeight","canvas","sourceCanvas","html2canvas","document","body","logging","scale","width","window","innerWidth","height","innerHeight","foreignObjectRendering","targetCanvas","createElement","targetRatio","ratio","wider","finalWidth","finalHeight","getContext","drawImage","toDataURL","resizeScreenshot","Promise","resolve","reject","toBlob","blob","apply","arguments","onClick","event","iidList","preventDefault","stopPropagation","getPossibleBrickTargets","composedPath","length","parent","postMessage","sender","onMouseEvent","hoverOnBrick","throttle","eventTargets","leading","onPointerDown","onPointerMove","onPointerLeave","onContextMenu","position","x","clientX","y","clientY","targets","target","HTMLElement","dataset","iid","getRealTimeDataAnnotation","value","Array","isArray","connected","getHistory","_getHistory","matchPath","_matchPath","__secret_internals","_internals","isV2","_window$BRICK_NEXT_VE","dll","BRICK_NEXT_VERSIONS","startsWith","getHistoryV2","developHelper","developHelperV2","matchPathV2","_objectSpread","getContextValue","name","_ref","tplStateStoreId","tplContextId","getAllContextValues","_ref2","v2Map","Object","fromEntries","map","_ref3","k","v","e","console","error","contentScrollElement","contentScrollHost","connect","_x","_x2","_connect","previewFromOrigin","options","_secret_internals$ad","_secret_internals","hoverIid","hoverAlias","activeIid","activeAlias","sendMessage","message","lastTemplatePreviewSettings","sendHighlightBrickOutlines","alias","outlines","getBrickOutlines","highlightType","templateId","settings","updateTemplatePreviewSettings","appId","reload","updateSnippetPreviewSettings","JSON","parse","snippetData","history","addEventListener","_ref6","_ref5","_data$options","_data$options2","data","origin","forwardedFor","highlightNodes","flat","pos","element","elementFromPoint","tagName","isDirection","brick","cursor","parentElement","getPossibleBrickIidList","handleHoverOnIframe","enabled","removeEventListener","updateStoryboardType","_getAddedContracts","_ref7","updateStoryboardByRoute","storyboardPatch","updateStoryboardByTemplate","updateStoryboardBySnippet","newContracts","getAddedContracts","call","formId","isEmpty","updateStoryboard","location","goBack","goForward","capture","then","screenshot","handlePreviewData","option","dataType","getRootTplStateStoreId","entries","_ref4","url","previewUrl","substring","basePath","getBasePath","to","routePath","routeExact","syncRouteMatch","_x3","scroll","scrollX","scrollY","currentLocation","memoizedRootTplStateStoreId","previewPageMatch","sendLocationChange","loc","createHref","listen","addRealTimeDataInspectHook","_ref8","changeType","detail","annotation","_ref9","setupRealTimeDataInspect","setupContentScroll","MutationObserver","mutationCallback","observe","subtree","childList","match","pathname","path","exact","mainMountPoint","querySelector","placeholderLoadObserver","childNodes","firstChild","disconnect","_host$shadowRoot$quer","_host$shadowRoot","_contentScrollElement","host","shadowRoot","onContentScroll","this","scrollLeft","scrollTop","force","_secret_internals$se","_secret_internals2","undefined","setRealTimeDataInspectRoot","isRoot","elements","_contentScrollHost","hasContentScroll","contains","left","top","getBoundingClientRect","getOutlines","getElementsIncludingInShadowDOM","walk","root","candidates","querySelectorAll","concat","_mainMountPoint$first"],"sourceRoot":""}