@next-bricks/visual-builder 1.20.0 → 1.20.1

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/types.json CHANGED
@@ -1765,232 +1765,6 @@
1765
1765
  }
1766
1766
  ]
1767
1767
  },
1768
- "visual-builder.inject-preview-agent": {
1769
- "type": "provider",
1770
- "params": [
1771
- {
1772
- "name": "previewFromOrigin",
1773
- "annotation": {
1774
- "type": "keyword",
1775
- "value": "string"
1776
- }
1777
- },
1778
- {
1779
- "name": "options",
1780
- "annotation": {
1781
- "type": "reference",
1782
- "typeName": {
1783
- "type": "identifier",
1784
- "name": "PreviewStartOptions"
1785
- }
1786
- }
1787
- }
1788
- ],
1789
- "returns": {
1790
- "annotation": {
1791
- "type": "reference",
1792
- "typeName": {
1793
- "type": "identifier",
1794
- "name": "Promise"
1795
- },
1796
- "typeParameters": {
1797
- "type": "typeParameterInstantiation",
1798
- "params": [
1799
- {
1800
- "type": "keyword",
1801
- "value": "unknown"
1802
- }
1803
- ]
1804
- }
1805
- }
1806
- },
1807
- "types": [
1808
- {
1809
- "type": "interface",
1810
- "name": "PreviewStartOptions",
1811
- "body": [
1812
- {
1813
- "type": "propertySignature",
1814
- "key": {
1815
- "type": "identifier",
1816
- "name": "appId"
1817
- },
1818
- "annotation": {
1819
- "type": "keyword",
1820
- "value": "string"
1821
- },
1822
- "computed": false
1823
- },
1824
- {
1825
- "type": "propertySignature",
1826
- "key": {
1827
- "type": "identifier",
1828
- "name": "routeId"
1829
- },
1830
- "annotation": {
1831
- "type": "keyword",
1832
- "value": "string"
1833
- },
1834
- "optional": true,
1835
- "computed": false
1836
- },
1837
- {
1838
- "type": "propertySignature",
1839
- "key": {
1840
- "type": "identifier",
1841
- "name": "templateId"
1842
- },
1843
- "annotation": {
1844
- "type": "keyword",
1845
- "value": "string"
1846
- },
1847
- "optional": true,
1848
- "computed": false
1849
- },
1850
- {
1851
- "type": "propertySignature",
1852
- "key": {
1853
- "type": "identifier",
1854
- "name": "formId"
1855
- },
1856
- "annotation": {
1857
- "type": "keyword",
1858
- "value": "string"
1859
- },
1860
- "optional": true,
1861
- "computed": false
1862
- },
1863
- {
1864
- "type": "propertySignature",
1865
- "key": {
1866
- "type": "identifier",
1867
- "name": "snippetData"
1868
- },
1869
- "annotation": {
1870
- "type": "keyword",
1871
- "value": "any"
1872
- },
1873
- "optional": true,
1874
- "computed": false
1875
- },
1876
- {
1877
- "type": "propertySignature",
1878
- "key": {
1879
- "type": "identifier",
1880
- "name": "routePath"
1881
- },
1882
- "annotation": {
1883
- "type": "keyword",
1884
- "value": "string"
1885
- },
1886
- "optional": true,
1887
- "computed": false
1888
- },
1889
- {
1890
- "type": "propertySignature",
1891
- "key": {
1892
- "type": "identifier",
1893
- "name": "routeExact"
1894
- },
1895
- "annotation": {
1896
- "type": "keyword",
1897
- "value": "boolean"
1898
- },
1899
- "optional": true,
1900
- "computed": false
1901
- },
1902
- {
1903
- "type": "propertySignature",
1904
- "key": {
1905
- "type": "identifier",
1906
- "name": "settings"
1907
- },
1908
- "annotation": {
1909
- "type": "reference",
1910
- "typeName": {
1911
- "type": "identifier",
1912
- "name": "PreviewSettings"
1913
- }
1914
- },
1915
- "optional": true,
1916
- "computed": false
1917
- },
1918
- {
1919
- "type": "propertySignature",
1920
- "key": {
1921
- "type": "identifier",
1922
- "name": "updateStoryboardType"
1923
- },
1924
- "annotation": {
1925
- "type": "reference",
1926
- "typeName": {
1927
- "type": "identifier",
1928
- "name": "UpdateStoryboardType"
1929
- }
1930
- },
1931
- "optional": true,
1932
- "computed": false
1933
- }
1934
- ]
1935
- },
1936
- {
1937
- "type": "interface",
1938
- "name": "PreviewSettings",
1939
- "body": [
1940
- {
1941
- "type": "propertySignature",
1942
- "key": {
1943
- "type": "identifier",
1944
- "name": "properties"
1945
- },
1946
- "annotation": {
1947
- "type": "reference",
1948
- "typeName": {
1949
- "type": "identifier",
1950
- "name": "Record"
1951
- },
1952
- "typeParameters": {
1953
- "type": "typeParameterInstantiation",
1954
- "params": [
1955
- {
1956
- "type": "keyword",
1957
- "value": "string"
1958
- },
1959
- {
1960
- "type": "keyword",
1961
- "value": "unknown"
1962
- }
1963
- ]
1964
- }
1965
- },
1966
- "optional": true,
1967
- "computed": false
1968
- }
1969
- ]
1970
- },
1971
- {
1972
- "type": "typeAlias",
1973
- "name": "UpdateStoryboardType",
1974
- "annotation": {
1975
- "type": "union",
1976
- "types": [
1977
- {
1978
- "type": "jsLiteral",
1979
- "value": "route"
1980
- },
1981
- {
1982
- "type": "jsLiteral",
1983
- "value": "template"
1984
- },
1985
- {
1986
- "type": "jsLiteral",
1987
- "value": "snippet"
1988
- }
1989
- ]
1990
- }
1991
- }
1992
- ]
1993
- },
1994
1768
  "visual-builder.workbench-tree": {
1995
1769
  "properties": [
1996
1770
  {
@@ -2744,5 +2518,251 @@
2744
2518
  ]
2745
2519
  }
2746
2520
  ]
2521
+ },
2522
+ "visual-builder.inject-preview-agent": {
2523
+ "type": "provider",
2524
+ "params": [
2525
+ {
2526
+ "name": "previewFromOrigin",
2527
+ "annotation": {
2528
+ "type": "keyword",
2529
+ "value": "string"
2530
+ }
2531
+ },
2532
+ {
2533
+ "name": "options",
2534
+ "annotation": {
2535
+ "type": "reference",
2536
+ "typeName": {
2537
+ "type": "identifier",
2538
+ "name": "PreviewStartOptions"
2539
+ }
2540
+ }
2541
+ }
2542
+ ],
2543
+ "returns": {
2544
+ "annotation": {
2545
+ "type": "reference",
2546
+ "typeName": {
2547
+ "type": "identifier",
2548
+ "name": "Promise"
2549
+ },
2550
+ "typeParameters": {
2551
+ "type": "typeParameterInstantiation",
2552
+ "params": [
2553
+ {
2554
+ "type": "keyword",
2555
+ "value": "unknown"
2556
+ }
2557
+ ]
2558
+ }
2559
+ }
2560
+ },
2561
+ "types": [
2562
+ {
2563
+ "type": "interface",
2564
+ "name": "PreviewStartOptions",
2565
+ "body": [
2566
+ {
2567
+ "type": "propertySignature",
2568
+ "key": {
2569
+ "type": "identifier",
2570
+ "name": "appId"
2571
+ },
2572
+ "annotation": {
2573
+ "type": "keyword",
2574
+ "value": "string"
2575
+ },
2576
+ "computed": false
2577
+ },
2578
+ {
2579
+ "type": "propertySignature",
2580
+ "key": {
2581
+ "type": "identifier",
2582
+ "name": "routeId"
2583
+ },
2584
+ "annotation": {
2585
+ "type": "keyword",
2586
+ "value": "string"
2587
+ },
2588
+ "optional": true,
2589
+ "computed": false
2590
+ },
2591
+ {
2592
+ "type": "propertySignature",
2593
+ "key": {
2594
+ "type": "identifier",
2595
+ "name": "templateId"
2596
+ },
2597
+ "annotation": {
2598
+ "type": "keyword",
2599
+ "value": "string"
2600
+ },
2601
+ "optional": true,
2602
+ "computed": false
2603
+ },
2604
+ {
2605
+ "type": "propertySignature",
2606
+ "key": {
2607
+ "type": "identifier",
2608
+ "name": "formId"
2609
+ },
2610
+ "annotation": {
2611
+ "type": "keyword",
2612
+ "value": "string"
2613
+ },
2614
+ "optional": true,
2615
+ "computed": false
2616
+ },
2617
+ {
2618
+ "type": "propertySignature",
2619
+ "key": {
2620
+ "type": "identifier",
2621
+ "name": "formData"
2622
+ },
2623
+ "annotation": {
2624
+ "type": "reference",
2625
+ "typeName": {
2626
+ "type": "identifier",
2627
+ "name": "FormData"
2628
+ }
2629
+ },
2630
+ "optional": true,
2631
+ "computed": false
2632
+ },
2633
+ {
2634
+ "type": "propertySignature",
2635
+ "key": {
2636
+ "type": "identifier",
2637
+ "name": "snippetData"
2638
+ },
2639
+ "annotation": {
2640
+ "type": "keyword",
2641
+ "value": "any"
2642
+ },
2643
+ "optional": true,
2644
+ "computed": false
2645
+ },
2646
+ {
2647
+ "type": "propertySignature",
2648
+ "key": {
2649
+ "type": "identifier",
2650
+ "name": "routePath"
2651
+ },
2652
+ "annotation": {
2653
+ "type": "keyword",
2654
+ "value": "string"
2655
+ },
2656
+ "optional": true,
2657
+ "computed": false
2658
+ },
2659
+ {
2660
+ "type": "propertySignature",
2661
+ "key": {
2662
+ "type": "identifier",
2663
+ "name": "routeExact"
2664
+ },
2665
+ "annotation": {
2666
+ "type": "keyword",
2667
+ "value": "boolean"
2668
+ },
2669
+ "optional": true,
2670
+ "computed": false
2671
+ },
2672
+ {
2673
+ "type": "propertySignature",
2674
+ "key": {
2675
+ "type": "identifier",
2676
+ "name": "settings"
2677
+ },
2678
+ "annotation": {
2679
+ "type": "reference",
2680
+ "typeName": {
2681
+ "type": "identifier",
2682
+ "name": "PreviewSettings"
2683
+ }
2684
+ },
2685
+ "optional": true,
2686
+ "computed": false
2687
+ },
2688
+ {
2689
+ "type": "propertySignature",
2690
+ "key": {
2691
+ "type": "identifier",
2692
+ "name": "updateStoryboardType"
2693
+ },
2694
+ "annotation": {
2695
+ "type": "reference",
2696
+ "typeName": {
2697
+ "type": "identifier",
2698
+ "name": "UpdateStoryboardType"
2699
+ }
2700
+ },
2701
+ "optional": true,
2702
+ "computed": false
2703
+ }
2704
+ ]
2705
+ },
2706
+ {
2707
+ "type": "interface",
2708
+ "name": "PreviewSettings",
2709
+ "body": [
2710
+ {
2711
+ "type": "propertySignature",
2712
+ "key": {
2713
+ "type": "identifier",
2714
+ "name": "properties"
2715
+ },
2716
+ "annotation": {
2717
+ "type": "reference",
2718
+ "typeName": {
2719
+ "type": "identifier",
2720
+ "name": "Record"
2721
+ },
2722
+ "typeParameters": {
2723
+ "type": "typeParameterInstantiation",
2724
+ "params": [
2725
+ {
2726
+ "type": "keyword",
2727
+ "value": "string"
2728
+ },
2729
+ {
2730
+ "type": "keyword",
2731
+ "value": "unknown"
2732
+ }
2733
+ ]
2734
+ }
2735
+ },
2736
+ "optional": true,
2737
+ "computed": false
2738
+ }
2739
+ ]
2740
+ },
2741
+ {
2742
+ "type": "typeAlias",
2743
+ "name": "UpdateStoryboardType",
2744
+ "annotation": {
2745
+ "type": "union",
2746
+ "types": [
2747
+ {
2748
+ "type": "jsLiteral",
2749
+ "value": "route"
2750
+ },
2751
+ {
2752
+ "type": "jsLiteral",
2753
+ "value": "template"
2754
+ },
2755
+ {
2756
+ "type": "jsLiteral",
2757
+ "value": "snippet"
2758
+ },
2759
+ {
2760
+ "type": "jsLiteral",
2761
+ "value": "form"
2762
+ }
2763
+ ]
2764
+ }
2765
+ }
2766
+ ]
2747
2767
  }
2748
2768
  }
@@ -294,12 +294,13 @@ export interface BrickOutline {
294
294
  alias?: string;
295
295
  hasContentScroll?: boolean;
296
296
  }
297
- export type UpdateStoryboardType = "route" | "template" | "snippet";
297
+ export type UpdateStoryboardType = "route" | "template" | "snippet" | "form";
298
298
  export interface PreviewStartOptions {
299
299
  appId: string;
300
300
  routeId?: string;
301
301
  templateId?: string;
302
302
  formId?: string;
303
+ formData?: FormData;
303
304
  snippetData?: any;
304
305
  routePath?: string;
305
306
  routeExact?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/visual-builder",
3
- "version": "1.20.0",
3
+ "version": "1.20.1",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/visual-builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,5 +44,5 @@
44
44
  "@next-bricks/icons": "*",
45
45
  "@next-bricks/vs": "*"
46
46
  },
47
- "gitHead": "48e92ad7862b54607c92698bb577c643910724d0"
47
+ "gitHead": "cb9295ae1aa0f2973e49623abbdd49899fcf7b54"
48
48
  }
@@ -1,2 +0,0 @@
1
- "use strict";(globalThis.webpackChunk_next_bricks_visual_builder=globalThis.webpackChunk_next_bricks_visual_builder||[]).push([[9027],{6788:(e,t,o)=>{o.d(t,{b:()=>i});var n=o(9991),a=o(2153),r=o(6946);function i(e){const t=function(e){const t=new Set;return(0,a.h)(e,(e=>{switch(e.type){case"Resolvable":case"EventHandler":{var o;const n=null===(o=e.raw)||void 0===o?void 0:o.useProvider;n&&t.add(n)}}})),t}((0,r.lN)(e)),o=[];for(const e of t)e.includes("@")&&o.push(e);return o}customElements.define("visual-builder.collect-used-contracts",(0,n.createProviderClass)(i))},9027:(e,t,o)=>{o.d(t,{A:()=>D,w:()=>A});var n=o(936),a=o(3688),r=o(6055),i=o(1030),s=o(8317),d=o.n(s);let l;function c(e){e.preventDefault(),e.stopPropagation(),function(e){const t=m(e);t.length>0&&window.parent.postMessage({sender:"previewer",type:"select-brick",iidList:t},l)}(e.composedPath())}function p(e){e.preventDefault(),e.stopPropagation()}const u=(0,i.throttle)((e=>{const t=m(e);t.length>0&&window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:t},l)}),100,{leading:!1});function v(e){e.preventDefault(),e.stopPropagation(),u(e.composedPath())}function w(e){e.preventDefault(),e.stopPropagation(),u(e.composedPath())}function h(e){e.preventDefault(),e.stopPropagation(),window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:[]},l)}function g(e){e.preventDefault(),e.stopPropagation(),function(e,t){const o=m(e);o.length>0&&window.parent.postMessage({sender:"previewer",type:"context-menu-on-brick",iidList:o,position:t},l)}(e.composedPath(),{x:e.clientX,y:e.clientY})}function m(e){const t=[];for(const o of e)o instanceof HTMLElement&&"string"==typeof o.dataset.iid&&t.push(o.dataset.iid);return t}var y=o(6788);function b(e){const t=typeof e;switch(t){case"string":case"boolean":case"number":return{type:t,value:e};case"undefined":return{type:t}}return null===e?{type:"null"}:Array.isArray(e)?{type:"array",length:e.length}:{type:"object"}}let f=!1,S=n.getHistory,I=n.matchPath,E=n.__secret_internals,L=r.flowApi,k=!1;try{var x;const e=window.dll;if(e&&null!==(x=window.BRICK_NEXT_VERSIONS)&&void 0!==x&&null!==(x=x["brick-container"])&&void 0!==x&&x.startsWith("2.")){const{getHistory:t,developHelper:o,collectDebugContract:n}=e("tYg3"),{matchPath:a}=e("A+yw");S=t,I=a,E={...o,getContextValue(e,t){let{tplStateStoreId:n}=t;return o.getContextValue(e,{tplContextId:n})},getAllContextValues(e){let{tplStateStoreId:t}=e;const n=o.getAllContextValues({tplContextId:t});return Object.fromEntries([...n].map((e=>{let[t,o]=e;return[t,o.value]})))},debugDataValue(e,t){let{tplStateStoreId:n}=t;return o.debugDataValue(e,{tplContextId:n})}},L={collectDebugContract:n},k=!0}}catch(e){console.error("Try to use v2 runtime APIs failed:",e)}let P=null,C=null;async function D(e,t){var o,r;if(f)return;f=!0;const s=t=>{window.parent.postMessage({sender:"previewer",...t},e)};let u,m,k,x;s({type:"preview-started"}),l=e;const D=(e,t,o)=>{const n=T(t);s({type:"highlight-brick",highlightType:e,outlines:n,iid:t,alias:o})};let A;t.templateId&&(A=t.settings);const N=()=>{E.updateTemplatePreviewSettings(t.appId,t.templateId,A),S().reload()},_=()=>{E.updateSnippetPreviewSettings(t.appId,JSON.parse(t.snippetData)),S().reload()},O=S();window.addEventListener("message",(async o=>{var r,b;let{data:f,origin:I}=o;if(I===e&&f&&"preview-container"===f.sender)if("builder"===f.forwardedFor)switch(f.type){case"hover-on-brick":u=f.iid,m=f.alias,D("hover",f.iid,f.alias);break;case"hover-on-main":D("hover","#main-mount-point","root");break;case"hover-on-context":(e=>{const t=e.map((e=>T(e.iid,e.alias))).flat();s({type:"highlight-context",outlines:t})})(f.highlightNodes);break;case"select-brick":k=f.iid,x=f.alias,D("active",f.iid,f.alias);break;case"hover-on-iframe":(e=>{const t=document.elementFromPoint(e.x,e.y);if("BODY"===(null==t?void 0:t.tagName))window.parent.postMessage({sender:"previewer",type:"hover-on-main",isDirection:!0,position:{x:e.x,y:e.y}},l);else{const o=function(e){const t=[];let o=e;for(;o;)"string"==typeof o.dataset.iid&&t.push(o.dataset.iid),o=o.parentElement;return t}(t);window.parent.postMessage({sender:"previewer",type:"hover-on-brick",iidList:o,isDirection:!0,position:{x:e.x,y:e.y}},l)}})(f.position)}else switch(f.type){case"toggle-inspecting":f.enabled?(window.addEventListener("click",c,!0),window.addEventListener("mousedown",p,!0),window.addEventListener("mouseover",p,!0),window.addEventListener("mouseup",p,!0),window.addEventListener("pointerdown",v,!0),window.addEventListener("pointermove",w,!0),window.addEventListener("pointerup",p,!0),window.addEventListener("pointerleave",h,!0),window.addEventListener("contextmenu",g,!0)):(window.removeEventListener("click",c,!0),window.removeEventListener("mousedown",p,!0),window.removeEventListener("mouseover",p,!0),window.removeEventListener("mouseup",p,!0),window.removeEventListener("pointerdown",v,!0),window.removeEventListener("pointermove",w,!0),window.removeEventListener("pointerup",p,!0),window.removeEventListener("pointerleave",h,!0),window.removeEventListener("contextmenu",g,!0));break;case"refresh":if(null!==(r=f.options)&&void 0!==r&&r.updateStoryboardType){var P,C;"route"===f.options.updateStoryboardType?E.updateStoryboardByRoute(t.appId,f.storyboardPatch):"template"===f.options.updateStoryboardType?E.updateStoryboardByTemplate(t.appId,f.storyboardPatch,f.options.settings):"snippet"===f.options.updateStoryboardType&&E.updateStoryboardBySnippet(t.appId,f.storyboardPatch);const e=await(null===(P=(C=E).getAddedContracts)||void 0===P?void 0:P.call(C,f.storyboardPatch,{appId:t.appId,updateStoryboardType:f.options.updateStoryboardType,formId:t.formId,collectUsedContracts:y.b}));(0,i.isEmpty)(e)?S().reload():s({type:"contract-update",data:{add:e}});break}E.updateStoryboard(t.appId,f.storyboardPatch),t.templateId?(A=f.settings,N()):null!==(b=f.options)&&void 0!==b&&b.snippetData?(t.snippetData=f.options.snippetData,_()):S().reload();break;case"reload":location.reload();break;case"back":O.goBack();break;case"forward":O.goForward();break;case"capture":(async function(e,t){const o=await d()(document.body,{logging:!1,scale:1,width:window.innerWidth,height:window.innerHeight,foreignObjectRendering:!0}),n=document.createElement("canvas");var a;return function(e,t,o,n){const a=o/n,{width:r,height:i}=e,s=r/i,d=s>=a,l=d?o:n*s,c=d?o/s:n;t.width=l,t.height=c,t.getContext("2d").drawImage(e,0,0,r,i,0,0,l,c),t.toDataURL()}(o,n,e,t),await(a=n,new Promise((function(e,t){a.toBlob((function(o){o?e(o):t()}))})))})(f.maxWidth,f.maxHeight).then((e=>{s({type:"capture-ok",screenshot:e})}),(()=>{s({type:"capture-failed"})}));break;case"inspect-data-value":((e,t)=>{try{const{dataType:o}=t;let n,a,r;if("state"===o&&(n=R(),!n))return void s({type:"inspect-data-value-error",data:{error:{message:"tplStateStoreId not found, unable to preview STATE value"}}});if(e)r="inspect-single-data-value-success",a=E.getContextValue(e,{tplStateStoreId:n});else{r="inspect-all-data-values-success";const e=E.getAllContextValues({tplStateStoreId:n});a=Object.entries(e).map((e=>{let[t,o]=e;return{name:t,value:o}}))}s({type:r,data:{name:e,value:a}})}catch(e){s({type:"inspect-data-value-error",data:{message:e.message}})}})(f.name,f.option);break;case"update-preview-url":{const e=f.previewUrl.startsWith(window.origin)?f.previewUrl.substring(window.origin.length):f.previewUrl,t=(0,n.getBasePath)(),o=e.startsWith(t)?e.substring(t.length-1):e;S().push(o);break}case"update-preview-route":t.routePath=f.routePath,t.routeExact=f.routeExact,V();break;case"debug-data-value":(async(e,o,n)=>{try{o&&L.collectDebugContract([o]);const a=await E.debugDataValue(e,{tplStateStoreId:"state"===n.dataType?R():void 0,routeId:t.routeId});s({type:"debug-data-value-success",data:{debugConf:e,value:a}})}catch(e){s({type:"debug-data-value-error",data:e instanceof a.HttpResponseError?e.responseJson:{message:e.message}})}})(f.debugData,f.contractData,f.options)}})),window.addEventListener("scroll",(()=>{s({type:"scroll",scroll:{x:window.scrollX,y:window.scrollY}})}));let q,H=!0;const M=e=>{s({type:"url-change",url:location.origin+O.createHref(e)}),q=e,V()};function V(){if(t.routePath){const e=!!I(q.pathname,{path:t.routePath,exact:t.routeExact});if(s({type:"route-match-change",match:e}),t.templateId&&!H&&e){const e=document.querySelector("#main-mount-point"),t=new MutationObserver((()=>{1===e.childNodes.length&&"SPAN"===e.firstChild.tagName&&0===e.firstChild.childNodes.length&&(N(),t.disconnect())}));t.observe(e,{childList:!0})}if(t.snippetData&&!H&&e){const e=document.querySelector("#main-mount-point"),t=new MutationObserver((()=>{1===e.childNodes.length&&"SPAN"===e.firstChild.tagName&&0===e.firstChild.childNodes.length&&(_(),t.disconnect())}));t.observe(e,{childList:!0})}H=e}}function B(){var e;const t=document.querySelector("eo-page-view"),o=(null==t||null===(e=t.shadowRoot)||void 0===e?void 0:e.querySelector(".content"))??null;var n;o!==P&&(null===(n=P)||void 0===n||n.removeEventListener("scroll",j),null==o||o.addEventListener("scroll",j),P=o,C=t)}function j(){s({type:"content-scroll",scroll:{x:this.scrollLeft,y:this.scrollTop}})}M(O.location),O.listen(M),t.templateId&&N(),t.snippetData&&_();const U=()=>{var e;const o=t.routeId,n=E.getLegalRuntimeValue({routeId:o});s({type:"inspect-runtime-data-value",data:{...(0,i.omit)(n,"query"),query:n.query?Object.fromEntries(n.query.entries()):{},path:null===(e=n.match)||void 0===e?void 0:e.params}})};let W;function Y(e){const o=t.templateId?R():void 0;var n,a;(W!==o||e)&&(W=o,null===(n=(a=E).setRealTimeDataInspectRoot)||void 0===n||n.call(a,{tplStateStoreId:o}))}null===(o=(r=E).addRealTimeDataInspectHook)||void 0===o||o.call(r,(e=>{let{changeType:t,tplStateStoreId:o,detail:n}=e;s({type:"real-time-data-inspect-change",changeType:t,tplStateStoreId:o,detail:"update"===t?{name:n.name,annotation:b(n.value)}:{data:Object.fromEntries(Object.entries(n.data).map((e=>{let[t,o]=e;return[t,b(o)]})))}})})),window.addEventListener("route.render",(()=>{Y(!0),U()})),B(),Y(!0),U(),new MutationObserver((0,i.throttle)((()=>{B(),Y(),u&&D("hover",u,m),k&&D("active",k,x)}),100,{leading:!1})).observe(document.body,{subtree:!0,childList:!0})}function T(e,t){if(!e)return[];const o=e.includes("#"),n=function(e,t){return e.map((e=>{var o;const n=null===(o=C)||void 0===o?void 0:o.contains(e),{width:a,height:r,left:i,top:s}=e.getBoundingClientRect();return{width:a,height:r,left:i+window.scrollX+(n?P.scrollLeft:0),top:s+window.scrollY+(n?P.scrollTop:0),alias:t,hasContentScroll:n}}))}(A(e,o),t);return o?n.map((e=>({...e,height:window.innerHeight-e.top}))):n}function A(e,t){const o=[];return function n(a){const r=a.querySelectorAll(t?e:`[data-iid="${e}"]`);if(o.push(...r),!(a===document&&r.length>0))for(const e of a.querySelectorAll("*"))e.shadowRoot&&n(e.shadowRoot)}(document),o}function R(){var e;const t=document.querySelector("#main-mount-point");return null==t||null===(e=t.firstChild)||void 0===e?void 0:e.dataset[k?"tplContextId":"tplStateStoreId"]}}}]);
2
- //# sourceMappingURL=9027.bf52b946.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunks/9027.bf52b946.js","mappings":"yMAgCO,SAASA,EAAqBC,GACnC,MAAMC,EArBR,SAAiBC,GACf,MAAMD,EAAa,IAAIE,IAgBvB,OAdAC,EAAAA,EAAAA,GAASF,GAAcG,IACrB,OAAQA,EAAKC,MACX,IAAK,aACL,IAAK,eAAgB,KAAAC,EACnB,MAAMC,EACI,QADOD,EACfF,EAAKI,WAAG,IAAAF,OAAA,EADUA,EAEjBC,YACCA,GACFP,EAAWS,IAAIF,EAEnB,EACF,IAGKP,CACT,CAGqBU,EAAQC,EAAAA,EAAAA,IAAgBZ,IAErCa,EAAY,GAElB,IAAK,MAAMC,KAAQb,EACba,EAAKC,SAAS,MAChBF,EAAUG,KAAKF,GAInB,OAAOD,CACT,CAEAI,eAAeC,OACb,yCACAC,EAAAA,EAAAA,qBAAoBpB,G,wGCvCf,IAAIqB,EAsCX,SAASC,EAAQC,GACfA,EAAMC,iBACND,EAAME,kBAmFR,SAAqBC,GACnB,MAAMC,EAAUC,EAAwBF,GACpCC,EAAQE,OAAS,GACnBC,OAAOC,OAAOC,YACZ,CACEC,OAAQ,YACR1B,KAAM,eACNoB,WAEFN,EAGN,CA9FEa,CAAYX,EAAMY,eACpB,CAEA,SAASC,EAAab,GACpBA,EAAMC,iBACND,EAAME,iBACR,CAEA,MAAMY,GAAeC,EAAAA,EAAAA,WAClBZ,IACC,MAAMC,EAAUC,EAAwBF,GAEpCC,EAAQE,OAAS,GACnBC,OAAOC,OAAOC,YACZ,CACEC,OAAQ,YACR1B,KAAM,iBACNoB,WAEFN,EAEJ,GAEF,IACA,CAAEkB,SAAS,IAGb,SAASC,EAAcjB,GACrBA,EAAMC,iBACND,EAAME,k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,CAuBA,SAASxE,IAA6C,IAAAqF,EACpD,MAAMrD,EAAiB9F,SAAS+F,cAAc,qBAE9C,OAAQD,SAA0B,QAAZqD,EAAdrD,EAAgBK,kBAAU,IAAAgD,OAAA,EAA3BA,EAA6C1O,QAClDe,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/realTimeDataInspect.ts","webpack:///./src/data-providers/preview/connect.ts","webpack:///./src/data-providers/preview/capture.ts","webpack:///./src/data-providers/preview/resizeScreenshot.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","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 { HttpResponseError } from \"@next-core/http\";\nimport { flowApi as _flowAPi } from \"@next-core/easyops-runtime\";\nimport type {\n BrickConf,\n Contract,\n CustomTemplate,\n RouteConf,\n} from \"@next-core/types\";\nimport { isEmpty, throttle, omit } from \"lodash\";\nimport type {\n BrickOutline,\n HighLightNode,\n Position,\n PreviewDataOption,\n PreviewMessageFromPreviewer,\n PreviewMessagePreviewContractUpdate,\n PreviewMessagePreviewDataValueError,\n PreviewMessagePreviewDataValueSuccess,\n PreviewMessagePreviewDebugValueSuccess,\n PreviewMessagePreviewDebugValueError,\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 PreviewDebugData,\n PreviewMessagePreviewInspectRuntimeValue,\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 collectDebugContract: typeof flowApi.collectDebugContract;\n };\n (moduleId: \"A+yw\"): {\n matchPath: typeof _matchPath;\n };\n}\n\nlet getHistory = _getHistory;\nlet matchPath = _matchPath;\nlet __secret_internals = _internals;\nlet flowApi = _flowAPi;\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 {\n getHistory: getHistoryV2,\n developHelper: developHelperV2,\n collectDebugContract,\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 debugDataValue(data, { tplStateStoreId }) {\n return developHelperV2.debugDataValue(data, {\n tplContextId: tplStateStoreId,\n } as any);\n },\n };\n\n flowApi = {\n collectDebugContract,\n } as any;\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 debugDataValue = async (\n data: PreviewDebugData,\n contractData: Contract,\n previewOption: PreviewDataOption\n ) => {\n try {\n if (contractData) {\n flowApi.collectDebugContract([contractData]);\n }\n const value = await __secret_internals.debugDataValue(data, {\n tplStateStoreId:\n previewOption.dataType === \"state\"\n ? getRootTplStateStoreId()\n : undefined,\n routeId: options.routeId,\n });\n\n sendMessage<PreviewMessagePreviewDebugValueSuccess>({\n type: \"debug-data-value-success\",\n data: {\n debugConf: data,\n value,\n },\n });\n } catch (error) {\n sendMessage<PreviewMessagePreviewDebugValueError>({\n type: \"debug-data-value-error\",\n data:\n error instanceof HttpResponseError\n ? error.responseJson\n : { message: (error as Error).message },\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 \"debug-data-value\":\n debugDataValue(data.debugData, data.contractData, data.options);\n break;\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 const setupRuntimeValueInspect = () => {\n const routeId = options.routeId;\n\n const data = __secret_internals.getLegalRuntimeValue({ routeId });\n sendMessage<PreviewMessagePreviewInspectRuntimeValue>({\n type: \"inspect-runtime-data-value\",\n data: {\n ...omit(data, \"query\"),\n query: data.query ? Object.fromEntries(data.query.entries()) : {},\n path: data.match?.params,\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 setupRuntimeValueInspect();\n });\n\n setupContentScroll();\n setupRealTimeDataInspect(true);\n setupRuntimeValueInspect();\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","// 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"],"names":["collectUsedContracts","storyboard","collection","nodeOrNodes","Set","traverse","node","type","_node$raw","useProvider","raw","add","collect","parseStoryboard","contracts","item","includes","push","customElements","define","createProviderClass","previewProxyOrigin","onClick","event","preventDefault","stopPropagation","eventTargets","iidList","getPossibleBrickTargets","length","window","parent","postMessage","sender","selectBrick","composedPath","onMouseEvent","hoverOnBrick","throttle","leading","onPointerDown","onPointerMove","onPointerLeave","onContextMenu","position","contextMenuOnBrick","x","clientX","y","clientY","targets","target","HTMLElement","dataset","iid","getRealTimeDataAnnotation","value","Array","isArray","connected","getHistory","_getHistory","matchPath","_matchPath","__secret_internals","_internals","flowApi","_flowAPi","isV2","_window$BRICK_NEXT_VE","dll","BRICK_NEXT_VERSIONS","startsWith","getHistoryV2","developHelper","developHelperV2","collectDebugContract","matchPathV2","getContextValue","name","_ref","tplStateStoreId","tplContextId","getAllContextValues","_ref2","v2Map","Object","fromEntries","map","_ref3","k","v","debugDataValue","data","_ref4","e","console","error","contentScrollElement","contentScrollHost","async","connect","previewFromOrigin","options","_secret_internals$ad","_secret_internals","sendMessage","message","hoverIid","hoverAlias","activeIid","activeAlias","sendHighlightBrickOutlines","alias","outlines","getBrickOutlines","highlightType","lastTemplatePreviewSettings","templateId","settings","updateTemplatePreviewSettings","appId","reload","updateSnippetPreviewSettings","JSON","parse","snippetData","history","addEventListener","_data$options","_data$options2","origin","_ref6","forwardedFor","nodes","flat","sendHighlightBricksOutlines","highlightNodes","pos","element","document","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","maxWidth","maxHeight","sourceCanvas","html2canvas","body","logging","scale","width","innerWidth","height","innerHeight","foreignObjectRendering","targetCanvas","createElement","canvas","targetRatio","ratio","wider","finalWidth","finalHeight","getContext","drawImage","toDataURL","resizeScreenshot","Promise","resolve","reject","toBlob","blob","capture","then","screenshot","handlePreviewData","option","dataType","getRootTplStateStoreId","entries","_ref5","url","previewUrl","substring","basePath","getBasePath","to","routePath","routeExact","syncRouteMatch","contractData","previewOption","undefined","routeId","debugConf","HttpResponseError","responseJson","debugData","scroll","scrollX","scrollY","currentLocation","previewPageMatch","sendLocationChange","loc","createHref","match","pathname","path","exact","mainMountPoint","querySelector","placeholderLoadObserver","MutationObserver","childNodes","firstChild","disconnect","observe","childList","setupContentScroll","_host$shadowRoot","host","shadowRoot","_contentScrollElement","onContentScroll","this","scrollLeft","scrollTop","listen","setupRuntimeValueInspect","_data$match","getLegalRuntimeValue","omit","query","params","memoizedRootTplStateStoreId","setupRealTimeDataInspect","force","_secret_internals$se","_secret_internals2","setRealTimeDataInspectRoot","addRealTimeDataInspectHook","_ref8","changeType","detail","annotation","_ref9","mutationCallback","subtree","isRoot","elements","_contentScrollHost","hasContentScroll","contains","left","top","getBoundingClientRect","getOutlines","getElementsIncludingInShadowDOM","walk","root","candidates","querySelectorAll","_mainMountPoint$first"],"sourceRoot":""}