@grapesjs/studio-sdk-plugins 1.0.8 → 1.0.9

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 (35) hide show
  1. package/dist/dialogComponent/index.cjs.js +4 -4
  2. package/dist/dialogComponent/index.es.js +27 -28
  3. package/dist/dialogComponent/index.umd.js +4 -4
  4. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  5. package/dist/fsLightboxComponent/index.es.js +51 -52
  6. package/dist/fsLightboxComponent/index.umd.js +2 -2
  7. package/dist/index.cjs.d.ts +1 -0
  8. package/dist/index.cjs.js +22 -22
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.d.ts +1 -0
  11. package/dist/index.es.js +5265 -4605
  12. package/dist/index.umd.js +22 -22
  13. package/dist/lightGalleryComponent/index.cjs.d.ts +3 -0
  14. package/dist/lightGalleryComponent/index.cjs.js +1 -0
  15. package/dist/lightGalleryComponent/index.d.ts +3 -0
  16. package/dist/lightGalleryComponent/index.es.d.ts +3 -0
  17. package/dist/lightGalleryComponent/index.es.js +718 -0
  18. package/dist/lightGalleryComponent/index.umd.js +1 -0
  19. package/dist/lightGalleryComponent/types.d.ts +57 -0
  20. package/dist/lightGalleryComponent/typesSchema.d.ts +3 -0
  21. package/dist/lightGalleryComponent/utils.d.ts +47 -0
  22. package/dist/listPagesComponent/index.cjs.js +3 -3
  23. package/dist/listPagesComponent/index.es.js +32 -33
  24. package/dist/listPagesComponent/index.umd.js +3 -3
  25. package/dist/prosemirror/index.cjs.js +8 -8
  26. package/dist/prosemirror/index.es.js +806 -786
  27. package/dist/prosemirror/index.umd.js +9 -9
  28. package/dist/prosemirror/schema.d.ts +1 -1
  29. package/dist/prosemirror/types.d.ts +5 -0
  30. package/dist/prosemirror/utils.d.ts +3 -1
  31. package/dist/tableComponent/index.cjs.js +1 -1
  32. package/dist/tableComponent/index.es.js +35 -36
  33. package/dist/tableComponent/index.umd.js +1 -1
  34. package/dist/utils.d.ts +1 -0
  35. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ (function(f,k){typeof exports=="object"&&typeof module<"u"?module.exports=k():typeof define=="function"&&define.amd?define(k):(f=typeof globalThis<"u"?globalThis:f||self,f.StudioSdkPlugins_lightGalleryComponent=k())})(this,function(){"use strict";const f="app.grapesjs.com",k="app-stage.grapesjs.com",q=[f,k,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ce="license:check:start",pe="license:check:end",Q=()=>typeof window<"u",ue=({isDev:e,isStage:o})=>`${e?"":`https://${o?k:f}`}/api`,he=()=>{const e=Q()&&window.location.hostname;return!!e&&(q.includes(e)||q.some(o=>e.endsWith(o)))},de=()=>(Q()&&window.location.hostname)===f;var ge={};const be=ge.NODE_ENV!=="production";async function me({path:e,method:o="GET",headers:a={},body:n}){const c=`${ue({isDev:be,isStage:!de()})}${e}`,i={method:o,headers:{"Content-Type":"application/json",...a}};n&&(i.body=JSON.stringify(n));const r=await fetch(c,i);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}function ye(e){const o=e;return o.init=a=>n=>e(n,a),o}const fe=e=>ye(e);async function ve({editor:e,pluginName:o,licenseKey:a,cleanup:n}){let s=!1;const c=he();e.on(ce,()=>{s=!0}),e.on(pe,({sdkLicense:i})=>{i||n()}),setTimeout(async()=>{if(!s){if(c)return;a&&await Te({licenseKey:a,pluginName:o})||n()}},2e3)}async function Te({licenseKey:e,pluginName:o}){try{const a=await me({path:`/sdk/${e}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:o})}),{license:n}=a.result||{};return!!n}catch(a){return console.error("Error during SDK license check:",a),!1}}const $=(e,o)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,o))};var I=(e=>(e.image="image",e.video="video",e.external="external",e))(I||{});const v="lightGallery",X=`${v}-item`,C="data-lightgallery",Y=`${C}-item`,G="toggle",T={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},H={propKeys:[],props:{},traits:[]},A=(e,o={})=>{var s;const a={},n=[];for(const c in e){const{value:i,...r}=e[c];n.push({id:c,name:c,changeProp:!0,category:o.category,...r}),a[c]=i;const{subTraits:h={}}=r;for(const u in r.subTraits)(s=h[u])==null||s.forEach(P=>{const O=P.id||P.name;a[O]=P.value})}return{propKeys:Object.keys(a),props:a,traits:n}},j=(e,o)=>{const a=e.getTrait(o),n=a.get("category"),s=a.get("subTraits")||{},i=(Object.values(s).flat()||[]).map(u=>u.id||u.name);e.removeTrait(i);const r=s[a.getValue()],h=e.getTraitIndex(o)+1;r&&e.addTrait(r.map(u=>({category:n,...u})),{at:h})},D=(e,o)=>{o.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>j(e,a)),j(e,a)})},we=(e,o,a)=>{const s=e.getTrait(o).get("subTraits")||{},i=(Object.values(s).flat()||[]).map(h=>{const u=h.name||h.id;return h.changeProp?`change:${u}`:`change:attributes:${u}`}),r=Array.from(new Set(i));r.length&&e.on(r.join(" "),a)},Se={[G]:{type:"button",label:"Toggle Gallery",command:(e,o)=>{var a,n;return(n=(a=o.target)==null?void 0:a.getView())==null?void 0:n.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},xe={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},ke={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Ie={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},g="sourceType",V="data-iframe",K={name:"href",type:"file",label:"Image Source"},_={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},z={name:"data-poster",label:"Video Poster",type:"file"},ee={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},te={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Le={[G]:{type:"button",label:"Toggle Gallery",command:(e,o)=>{var s,c;const a=o.target,n=(s=a==null?void 0:a.closestType(v))==null?void 0:s.getView();if(n&&a){const i=((c=n.getLightGallery())==null?void 0:c.items)||[],r=Array.from(i).indexOf(a.getEl());r>=0&&n.toggleGallery(r)}}},[g]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[K],video:[_,z],external:[ee]},options:[{id:"image",label:K.label||"",icon:T.image},{id:"video",label:_.label||"",icon:T.video},{id:"external",label:ee.label||"",icon:T.external}]},subHtml:te},Ae="lightGalleryComponent",ae="lgThumbnail",Pe="lgVideo",ne="lgAutoplay",oe="lgZoom",L="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return fe(function(e,o={}){const{Blocks:a,Components:n}=e,s="LightGallery",c="LightGallery Item",i={toolbarIconOpen:T.eye,block:{},lgLicenseKey:"0000-0000-000-0000",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ae,Pe,ne,oe],cdnScript:[`${L}/lightgallery.min.js`,`${L}/plugins/thumbnail/lg-thumbnail.min.js`,`${L}/plugins/video/lg-video.min.js`,`${L}/plugins/autoplay/lg-autoplay.min.js`,`${L}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${L}/css/lightgallery-bundle.min.css`,...o},{block:r,toolbarIconOpen:h,defaultSrc:u}=i,P=function(t){const l=this,p=window,{plugins:b,cdnScript:w,cdnStyle:E,inline:ie,lgLicenseKey:Ee,...m}=t||{},S=d=>isNaN(d)?void 0:parseInt(d,10),se=()=>{var M;const d={...m,licenseKey:Ee,speed:S(m.speed),startAnimationDuration:S(m.startAnimationDuration),thumbMargin:S(m.thumbMargin),thumbWidth:S(m.thumbWidth),slideShowInterval:S(m.slideShowInterval),scale:S(m.scale),enableZoomAfter:S(m.enableZoomAfter),plugins:(b||[]).map(N=>p[N])};ie&&(d.container=l,d.closable=!1);const J=(M=p.lightGallery)==null?void 0:M.call(p,l,d);ie&&J.openGallery()};if(p.lightGallery)se();else{const{head:d}=document,J=Array.isArray(w)?[...w]:[w],M=Array.isArray(E)?[...E]:[E],N=x=>{if(x.length){const y=document.createElement("link");y.href=x.shift(),y.rel="stylesheet",d.appendChild(y),N(x)}},re=x=>{if(x.length){const y=document.createElement("script");y.src=x.shift(),y.onerror=y.onload=re.bind(null,x),d.appendChild(y)}else se()};N(M),re(J)}},O=t=>{const l=t.getTrait(G);if(!h||!l)return;const{toolbar:p}=t,b={id:G,label:h,command:()=>setTimeout(()=>l.runCommand(),100)};!p.find(E=>E.id===b.id)&&(p==null||p.unshift(b))};let U=[];const W=i.plugins||[],Z=A(Se),B=W.includes(ae)?A(xe):H,R=W.includes(ne)?A(ke):H,F=W.includes(oe)?A(Ie):H;n.addType(v,{block:r&&{label:s,media:T.gallery,category:"Extra",select:!0,...i.block},isComponent:t=>$(t,C),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:T.gallery,draggable:(t,l)=>!l.is(v),attributes:{[C]:!0},components:{type:X},script:P,selector:"",exThumbImage:"",cdnScript:i.cdnScript,cdnStyle:i.cdnStyle,plugins:i.plugins,lgLicenseKey:i.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...Z.propKeys,...B.propKeys,...R.propKeys,...F.propKeys],...Z.props,...B.props,...R.props,...F.props,traits:[...Z.traits,...B.traits,...R.traits,...F.traits]},init(){D(this,["thumbnail"]),D(this,["autoplay"]),D(this,["zoom"])},initToolbar(){O(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const t=n.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var l;const t=this.getLightGallery();return((l=t==null?void 0:t.settings)==null?void 0:l.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:l}=t,p=this.getLightGallery();U=l.getSpots(),setTimeout(()=>l.removeSpots()),p.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();U.forEach(l=>this.em.Canvas.addSpot(l.attributes)),U=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const l=this.getLightGallery();if(l.__lgOpened)return l.closeGallery(!0);l.lgOpened=!1,l.openGallery(t)}}});const le=A(Le);n.addType(X,{isComponent:t=>$(t,Y)||t.tagName==="A"&&$(t.parentElement,C),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:c,icon:T.galleryItem,attributes:{[Y]:!0,href:u},components:{type:"image",attributes:{alt:"Image",src:u}},...le.props,traits:[...le.traits]},init(){const t=[g].map(l=>`change:${l}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),we(this,g,this.triggerGalleryUpdate)},initToolbar(){O(this)},initScriptUpdate(){const t=[te.name].map(l=>`change:attributes:${l}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var l;(l=this.closestType(v))==null||l.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:l}=this,{init:p}=t;if(l[g]||p){j(this,g);const b=this.getTrait(g).getValue();if(b===I.image){this.removeAttributes([_.name,z.name,V]);const w=this.getTrait(K.name);w.setValue(w.getValue()||u)}else b===I.video?this.removeAttributes([V]):b===I.external&&this.addAttributes({[V]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[V]?this.set(g,I.external):(t[_.name]||t[z.name])&&this.set(g,I.video)}}}),ve({editor:e,licenseKey:i.licenseKey,pluginName:Ae,cleanup:()=>{a.remove(v),n.removeType(v)}})})});
@@ -0,0 +1,57 @@
1
+ import { SDKPluginOptions } from '../utils';
2
+ export interface lightGalleryComponentOptions extends SDKPluginOptions {
3
+ /**
4
+ * Block options for the component. See https://grapesjs.com/docs/api/block.html#properties for more information.
5
+ * @example
6
+ * { category: 'Extra', label: 'My label' }
7
+ */
8
+ block?: object | false;
9
+ /**
10
+ * If you have already the lightGallery license and you want to use it, you can pass it here.
11
+ * @example
12
+ * '0000-0000-000-0000'
13
+ */
14
+ lgLicenseKey?: string;
15
+ /**
16
+ * SVG toolbar button icon for opening the gallery.
17
+ * You can pass an empty string to avoid adding the toolbar button.
18
+ * @example
19
+ * '<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0...'
20
+ */
21
+ toolbarIconOpen?: string;
22
+ /**
23
+ * Default source for the inner image component.
24
+ * @default
25
+ * 'https://placehold.co/200/777/white.png?text=Image'
26
+ */
27
+ defaultSrc?: string;
28
+ /**
29
+ * CDN scripts to load dynamically in case the library is not available.
30
+ * @default
31
+ * [
32
+ * 'https://cdn.jsdelivr.net/npm/lightgallery@2.8.2/lightgallery.min.js',
33
+ * 'https://cdn.jsdelivr.net/npm/lightgallery@2.8.2/plugins/thumbnail/lg-thumbnail.min.js',
34
+ * 'https://cdn.jsdelivr.net/npm/lightgallery@2.8.2/plugins/video/lg-video.min.js',
35
+ * 'https://cdn.jsdelivr.net/npm/lightgallery@2.8.2/plugins/autoplay/lg-autoplay.min.js',
36
+ * 'https://cdn.jsdelivr.net/npm/lightgallery@2.8.2/plugins/zoom/lg-zoom.min.j'
37
+ * ]
38
+ */
39
+ cdnScript?: string | string[];
40
+ /**
41
+ * CDN styles to load dynamically.
42
+ * @default
43
+ * 'https://cdn.jsdelivr.net/npm/lightgallery@2.8.2/css/lightgallery-bundle.min.css'
44
+ */
45
+ cdnStyle?: string | string[];
46
+ /**
47
+ * Plugins to include.
48
+ * You have to ensure to load the required plugins in the `cdnScript` option.
49
+ * Check the list of available plugins here: https://www.lightgalleryjs.com/docs/getting-started/#plugins
50
+ * @default
51
+ * ['lgThumbnail', 'lgVideo', 'lgAutoplay', 'lgZoom']
52
+ */
53
+ plugins?: string[];
54
+ }
55
+ export interface ComponentWindow extends Window {
56
+ lightGallery?: (...args: any) => any;
57
+ }
@@ -0,0 +1,3 @@
1
+ import { lightGalleryComponentOptions } from './types';
2
+ export interface lightGalleryComponentOptionsSchema extends lightGalleryComponentOptions {
3
+ }
@@ -0,0 +1,47 @@
1
+ import { StudioTraitProperties } from '@studio/editor/src/typeConfigs/components';
2
+ import { Component, TraitProperties } from 'grapesjs';
3
+ type TraitProps = Record<string, Partial<StudioTraitProperties>>;
4
+ export declare enum SourceTypes {
5
+ image = "image",
6
+ video = "video",
7
+ external = "external"
8
+ }
9
+ export declare const typeMain = "lightGallery";
10
+ export declare const typeItem = "lightGallery-item";
11
+ export declare const ATTR_CMP = "data-lightgallery";
12
+ export declare const ATTR_CMP_ITEM = "data-lightgallery-item";
13
+ export declare const TOGGLE_BTN_ID = "toggle";
14
+ export declare const customIcons: {
15
+ image: string;
16
+ video: string;
17
+ gallery: string;
18
+ galleryItem: string;
19
+ external: string;
20
+ eye: string;
21
+ };
22
+ export declare const emptyTraitProps: ReturnType<typeof getTraitProps>;
23
+ export declare const getTraitProps: (traitProps: TraitProps, opts?: {
24
+ category?: StudioTraitProperties["category"];
25
+ }) => {
26
+ propKeys: string[];
27
+ props: Record<string, any>;
28
+ traits: StudioTraitProperties[];
29
+ };
30
+ export declare const updateSubTraits: (cmp: Component, traitId: string) => void;
31
+ export declare const initTraitsWithSubTraits: (cmp: Component, traitIds: string[]) => void;
32
+ export declare const initScriptUpdateOnSubTraitChanges: (cmp: Component, traitId: string, upFn: () => void) => void;
33
+ export declare const coreTraits: Record<string, Partial<StudioTraitProperties>>;
34
+ export declare const thumbnailsTraits: Record<string, Partial<StudioTraitProperties>>;
35
+ export declare const autoplayTraits: Record<string, Partial<StudioTraitProperties>>;
36
+ export declare const zoomTraits: Record<string, Partial<StudioTraitProperties>>;
37
+ export declare const itemSourceTypeName = "sourceType";
38
+ export declare const itemCustomThumbName = "data-external-thumb-image";
39
+ export declare const itemExternalName = "data-iframe";
40
+ export declare const traitSourceImage: TraitProperties;
41
+ export declare const traitSourceVideo: TraitProperties;
42
+ export declare const traitPoster: TraitProperties;
43
+ export declare const traitSourceExternal: TraitProperties;
44
+ export declare const traitCaption: TraitProperties;
45
+ export declare const traitCustomThumb: TraitProperties;
46
+ export declare const itemTraits: Record<string, Partial<StudioTraitProperties>>;
47
+ export {};
@@ -1,11 +1,11 @@
1
- "use strict";require("react");function v(e,s,n){let t,o,i,a,c;const d=s;function g(){const m=Date.now()-a;m<d&&m>=0?t=setTimeout(g,d-m):(t=null,c=e.apply(i,o),i=o=null)}const p=function(){return i=this,o=arguments,a=Date.now(),t||(t=setTimeout(g,d)),c};return p.clear=function(){t&&(clearTimeout(t),t=null)},p.flush=function(){t&&(c=e.apply(i,o),i=o=null,clearTimeout(t),t=null)},p}const V="page://",r="list-pages",u="list-pages-item",l="list-pages-link",D=e=>e.components().reduce((s,n)=>{var a;const t=n.findFirstType(l),o=(a=t==null?void 0:t.attributes.attributes)==null?void 0:a.href,i=o!=null&&o.startsWith(V)?o.replace(V,""):"";if(i&&t){const c=s[i];c?c.push(t):s[i]=[t]}return s},{}),b="app.grapesjs.com",C="app-stage.grapesjs.com",A=[b,C,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",$="license:check:end",_=()=>typeof window<"u",x=({isDev:e,isStage:s})=>`${e?"":`https://${s?C:b}`}/api`,R=()=>{const e=_()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(s=>e.endsWith(s)))},W=()=>(_()&&window.location.hostname)===b;var B={NODE_ENV:"production",NPM_PACKAGE_VERSION:"1.0.8",STUDIO_NPM_PACKAGE_VERSION:"1.0.25"};const K=B.NODE_ENV!=="production";async function U({path:e,method:s="GET",headers:n={},body:t}){const i=`${x({isDev:K,isStage:!W()})}${e}`,a={method:s,headers:{"Content-Type":"application/json",...n}};t&&(a.body=JSON.stringify(t));const c=await fetch(i,a);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}function G(e){const s=e;return s.init=n=>t=>e(t,n),s}const j=e=>G(e);async function F({editor:e,pluginName:s,licenseKey:n,cleanup:t}){let o=!1;const i=R();e.on(O,()=>{o=!0}),e.on($,({sdkLicense:a})=>{a||t()}),setTimeout(async()=>{if(!o){if(i)return;n&&await J({licenseKey:n,pluginName:s})||t()}},2e3)}async function J({licenseKey:e,pluginName:s}){try{const n=await U({path:`/sdk/${e}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:s})}),{license:t}=n.result||{};return!!t}catch(n){return console.error("Error during SDK license check:",n),!1}}const H="gjs-plg-",X="listPagesComponent",f="data-type-role",Y="page_root",Z=e=>s=>s.is(e),q=e=>(s,n)=>n.is(e),T=e=>s=>{var n;return((n=s.getAttribute)==null?void 0:n.call(s,f))===e},z=function(e,s={}){const{Blocks:n,Components:t,Pages:o}=e,{licenseKey:i,block:a={}}=s,c="List Pages",d="List Pages Item",g="Link",p=`${H}${r}`,m=`${H}${l}`,w='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',N='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';t.addType(r,{block:a&&{label:c,media:w,category:"Extra",select:!0,...s.block},isComponent:T(r),model:{defaults:{tagName:"ul",name:c,[Y]:"",classes:p,attributes:{[f]:r},droppable:Z(u),styles:`
1
+ "use strict";function v(e,s,n){let t,o,i,a,c;const d=s;function g(){const m=Date.now()-a;m<d&&m>=0?t=setTimeout(g,d-m):(t=null,c=e.apply(i,o),i=o=null)}const p=function(){return i=this,o=arguments,a=Date.now(),t||(t=setTimeout(g,d)),c};return p.clear=function(){t&&(clearTimeout(t),t=null)},p.flush=function(){t&&(c=e.apply(i,o),i=o=null,clearTimeout(t),t=null)},p}const V="page://",r="list-pages",u="list-pages-item",l="list-pages-link",$=e=>e.components().reduce((s,n)=>{var a;const t=n.findFirstType(l),o=(a=t==null?void 0:t.attributes.attributes)==null?void 0:a.href,i=o!=null&&o.startsWith(V)?o.replace(V,""):"";if(i&&t){const c=s[i];c?c.push(t):s[i]=[t]}return s},{}),b="app.grapesjs.com",w="app-stage.grapesjs.com",C=[b,w,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],D="license:check:start",x="license:check:end",A=()=>typeof window<"u",O=({isDev:e,isStage:s})=>`${e?"":`https://${s?w:b}`}/api`,W=()=>{const e=A()&&window.location.hostname;return!!e&&(C.includes(e)||C.some(s=>e.endsWith(s)))},R=()=>(A()&&window.location.hostname)===b;var B={};const U=B.NODE_ENV!=="production";async function j({path:e,method:s="GET",headers:n={},body:t}){const i=`${O({isDev:U,isStage:!R()})}${e}`,a={method:s,headers:{"Content-Type":"application/json",...n}};t&&(a.body=JSON.stringify(t));const c=await fetch(i,a);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}function K(e){const s=e;return s.init=n=>t=>e(t,n),s}const F=e=>K(e);async function G({editor:e,pluginName:s,licenseKey:n,cleanup:t}){let o=!1;const i=W();e.on(D,()=>{o=!0}),e.on(x,({sdkLicense:a})=>{a||t()}),setTimeout(async()=>{if(!o){if(i)return;n&&await J({licenseKey:n,pluginName:s})||t()}},2e3)}async function J({licenseKey:e,pluginName:s}){try{const n=await j({path:`/sdk/${e}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:s})}),{license:t}=n.result||{};return!!t}catch(n){return console.error("Error during SDK license check:",n),!1}}const E="gjs-plg-",X="listPagesComponent",f="data-type-role",Y="page_root",Z=e=>s=>s.is(e),q=e=>(s,n)=>n.is(e),T=e=>s=>{var n;return((n=s.getAttribute)==null?void 0:n.call(s,f))===e},z=function(e,s={}){const{Blocks:n,Components:t,Pages:o}=e,{licenseKey:i,block:a={}}=s,c="List Pages",d="List Pages Item",g="Link",p=`${E}${r}`,m=`${E}${l}`,k='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',_='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';t.addType(r,{block:a&&{label:c,media:k,category:"Extra",select:!0,...s.block},isComponent:T(r),model:{defaults:{tagName:"ul",name:c,[Y]:"",classes:p,attributes:{[f]:r},droppable:Z(u),styles:`
2
2
  .${p} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
6
6
  }
7
- `},init(){this.syncPageItems=v(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const y=this.em.Pages.getAll(),k=this.components(),M=D(this);y.forEach((E,S)=>{const I=E.id,P=E.getName(),h=M[I];h?h==null||h.forEach(L=>{L.getInnerHTML()!==P&&L.components(P)}):k.add({type:u,components:[{type:l,attributes:{href:`page://${I}`},components:{type:"textnode",content:P}}]},{at:S})})}}}),t.addType(u,{isComponent:T(u),model:{defaults:{name:d,tagName:"li",icon:N,attributes:{[f]:u},components:{type:l},draggable:q(r)}}}),t.addType(l,{extend:"link",isComponent:T(l),model:{defaults:{removable:!1,copyable:!1,delegate:{move:y=>y.closestType(u)},name:g,classes:m,attributes:{[f]:l},components:{type:"textnode",content:"Item"},styles:`
7
+ `},init(){this.syncPageItems=v(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const y=this.em.Pages.getAll(),M=this.components(),N=$(this);y.forEach((L,S)=>{const H=L.id,P=L.getName(),h=N[H];h?h==null||h.forEach(I=>{I.getInnerHTML()!==P&&I.components(P)}):M.add({type:u,components:[{type:l,attributes:{href:`page://${H}`},components:{type:"textnode",content:P}}]},{at:S})})}}}),t.addType(u,{isComponent:T(u),model:{defaults:{name:d,tagName:"li",icon:_,attributes:{[f]:u},components:{type:l},draggable:q(r)}}}),t.addType(l,{extend:"link",isComponent:T(l),model:{defaults:{removable:!1,copyable:!1,delegate:{move:y=>y.closestType(u)},name:g,classes:m,attributes:{[f]:l},components:{type:"textnode",content:"Item"},styles:`
8
8
  .${m} {
9
9
  text-decoration: none;
10
10
  }
11
- `}}}),F({editor:e,licenseKey:i,pluginName:X,cleanup:()=>{n.remove(r),t.removeType(r)}})},Q=j(z);module.exports=Q;
11
+ `}}}),G({editor:e,licenseKey:i,pluginName:X,cleanup:()=>{n.remove(r),t.removeType(r)}})},Q=F(z);module.exports=Q;
@@ -1,4 +1,3 @@
1
- import "react";
2
1
  function v(e, s, n) {
3
2
  let t, o, i, a, c;
4
3
  const d = s;
@@ -15,7 +14,7 @@ function v(e, s, n) {
15
14
  t && (c = e.apply(i, o), i = o = null, clearTimeout(t), t = null);
16
15
  }, p;
17
16
  }
18
- const V = "page://", r = "list-pages", u = "list-pages-item", l = "list-pages-link", D = (e) => e.components().reduce(
17
+ const V = "page://", r = "list-pages", u = "list-pages-item", l = "list-pages-link", $ = (e) => e.components().reduce(
19
18
  (s, n) => {
20
19
  var a;
21
20
  const t = n.findFirstType(l), o = (a = t == null ? void 0 : t.attributes.attributes) == null ? void 0 : a.href, i = o != null && o.startsWith(V) ? o.replace(V, "") : "";
@@ -26,9 +25,9 @@ const V = "page://", r = "list-pages", u = "list-pages-item", l = "list-pages-li
26
25
  return s;
27
26
  },
28
27
  {}
29
- ), b = "app.grapesjs.com", C = "app-stage.grapesjs.com", A = [
28
+ ), b = "app.grapesjs.com", w = "app-stage.grapesjs.com", C = [
30
29
  b,
31
- C,
30
+ w,
32
31
  "localhost",
33
32
  "127.0.0.1",
34
33
  ".local-credentialless.webcontainer.io",
@@ -37,19 +36,19 @@ const V = "page://", r = "list-pages", u = "list-pages-item", l = "list-pages-li
37
36
  // For stackblitz.com demos
38
37
  "-sandpack.codesandbox.io"
39
38
  // For Sandpack demos
40
- ], O = "license:check:start", $ = "license:check:end", _ = () => typeof window < "u", x = ({ isDev: e, isStage: s }) => `${e ? "" : `https://${s ? C : b}`}/api`, R = () => {
41
- const e = _() && window.location.hostname;
42
- return !!e && (A.includes(e) || A.some((s) => e.endsWith(s)));
43
- }, W = () => (_() && window.location.hostname) === b;
44
- var B = { NODE_ENV: "production", NPM_PACKAGE_VERSION: "1.0.8", STUDIO_NPM_PACKAGE_VERSION: "1.0.25" };
45
- const K = B.NODE_ENV !== "production";
46
- async function U({
39
+ ], D = "license:check:start", x = "license:check:end", A = () => typeof window < "u", O = ({ isDev: e, isStage: s }) => `${e ? "" : `https://${s ? w : b}`}/api`, W = () => {
40
+ const e = A() && window.location.hostname;
41
+ return !!e && (C.includes(e) || C.some((s) => e.endsWith(s)));
42
+ }, R = () => (A() && window.location.hostname) === b;
43
+ var B = {};
44
+ const U = B.NODE_ENV !== "production";
45
+ async function j({
47
46
  path: e,
48
47
  method: s = "GET",
49
48
  headers: n = {},
50
49
  body: t
51
50
  }) {
52
- const i = `${x({ isDev: K, isStage: !W() })}${e}`, a = {
51
+ const i = `${O({ isDev: U, isStage: !R() })}${e}`, a = {
53
52
  method: s,
54
53
  headers: {
55
54
  "Content-Type": "application/json",
@@ -62,22 +61,22 @@ async function U({
62
61
  throw new Error(`HTTP error! status: ${c.status}`);
63
62
  return c.json();
64
63
  }
65
- function G(e) {
64
+ function K(e) {
66
65
  const s = e;
67
66
  return s.init = (n) => (t) => e(t, n), s;
68
67
  }
69
- const j = (e) => /* @__PURE__ */ G(e);
70
- async function F({
68
+ const F = (e) => /* @__PURE__ */ K(e);
69
+ async function G({
71
70
  editor: e,
72
71
  pluginName: s,
73
72
  licenseKey: n,
74
73
  cleanup: t
75
74
  }) {
76
75
  let o = !1;
77
- const i = R();
78
- e.on(O, () => {
76
+ const i = W();
77
+ e.on(D, () => {
79
78
  o = !0;
80
- }), e.on($, ({ sdkLicense: a }) => {
79
+ }), e.on(x, ({ sdkLicense: a }) => {
81
80
  a || t();
82
81
  }), setTimeout(async () => {
83
82
  if (!o) {
@@ -88,7 +87,7 @@ async function F({
88
87
  }
89
88
  async function J({ licenseKey: e, pluginName: s }) {
90
89
  try {
91
- const n = await U({
90
+ const n = await j({
92
91
  path: `/sdk/${e}`,
93
92
  method: "POST",
94
93
  body: JSON.stringify({
@@ -101,15 +100,15 @@ async function J({ licenseKey: e, pluginName: s }) {
101
100
  return console.error("Error during SDK license check:", n), !1;
102
101
  }
103
102
  }
104
- const H = "gjs-plg-", X = "listPagesComponent", f = "data-type-role", Y = "page_root", Z = (e) => (s) => s.is(e), q = (e) => (s, n) => n.is(e), T = (e) => (s) => {
103
+ const E = "gjs-plg-", X = "listPagesComponent", f = "data-type-role", Y = "page_root", Z = (e) => (s) => s.is(e), q = (e) => (s, n) => n.is(e), T = (e) => (s) => {
105
104
  var n;
106
105
  return ((n = s.getAttribute) == null ? void 0 : n.call(s, f)) === e;
107
106
  }, z = function(e, s = {}) {
108
- const { Blocks: n, Components: t, Pages: o } = e, { licenseKey: i, block: a = {} } = s, c = "List Pages", d = "List Pages Item", g = "Link", p = `${H}${r}`, m = `${H}${l}`, w = '<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>', N = '<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';
107
+ const { Blocks: n, Components: t, Pages: o } = e, { licenseKey: i, block: a = {} } = s, c = "List Pages", d = "List Pages Item", g = "Link", p = `${E}${r}`, m = `${E}${l}`, k = '<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>', _ = '<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';
109
108
  t.addType(r, {
110
109
  block: a && {
111
110
  label: c,
112
- media: w,
111
+ media: k,
113
112
  category: "Extra",
114
113
  select: !0,
115
114
  ...s.block
@@ -136,18 +135,18 @@ const H = "gjs-plg-", X = "listPagesComponent", f = "data-type-role", Y = "page_
136
135
  },
137
136
  syncPageItems() {
138
137
  if (e.Components.getSymbolInfo(this).isInstance) return;
139
- const y = this.em.Pages.getAll(), k = this.components(), M = D(this);
140
- y.forEach((E, S) => {
141
- const I = E.id, P = E.getName(), h = M[I];
142
- h ? h == null || h.forEach((L) => {
143
- L.getInnerHTML() !== P && L.components(P);
144
- }) : k.add(
138
+ const y = this.em.Pages.getAll(), M = this.components(), N = $(this);
139
+ y.forEach((L, S) => {
140
+ const H = L.id, P = L.getName(), h = N[H];
141
+ h ? h == null || h.forEach((I) => {
142
+ I.getInnerHTML() !== P && I.components(P);
143
+ }) : M.add(
145
144
  {
146
145
  type: u,
147
146
  components: [
148
147
  {
149
148
  type: l,
150
- attributes: { href: `page://${I}` },
149
+ attributes: { href: `page://${H}` },
151
150
  components: { type: "textnode", content: P }
152
151
  }
153
152
  ]
@@ -163,7 +162,7 @@ const H = "gjs-plg-", X = "listPagesComponent", f = "data-type-role", Y = "page_
163
162
  defaults: {
164
163
  name: d,
165
164
  tagName: "li",
166
- icon: N,
165
+ icon: _,
167
166
  attributes: { [f]: u },
168
167
  components: { type: l },
169
168
  draggable: q(r)
@@ -190,7 +189,7 @@ const H = "gjs-plg-", X = "listPagesComponent", f = "data-type-role", Y = "page_
190
189
  `
191
190
  }
192
191
  }
193
- }), F({
192
+ }), G({
194
193
  editor: e,
195
194
  licenseKey: i,
196
195
  pluginName: X,
@@ -198,7 +197,7 @@ const H = "gjs-plg-", X = "listPagesComponent", f = "data-type-role", Y = "page_
198
197
  n.remove(r), t.removeType(r);
199
198
  }
200
199
  });
201
- }, tt = j(z);
200
+ }, Q = F(z);
202
201
  export {
203
- tt as default
202
+ Q as default
204
203
  };
@@ -1,10 +1,10 @@
1
- (function(g,p){typeof exports=="object"&&typeof module<"u"?module.exports=p(require("react")):typeof define=="function"&&define.amd?define(["react"],p):(g=typeof globalThis<"u"?globalThis:g||self,g.StudioSdkPlugins_listPagesComponent=p())})(this,function(){"use strict";function g(t,s,n){let e,o,i,a,c;const f=s;function y(){const m=Date.now()-a;m<f&&m>=0?e=setTimeout(y,f-m):(e=null,c=t.apply(i,o),i=o=null)}const d=function(){return i=this,o=arguments,a=Date.now(),e||(e=setTimeout(y,f)),c};return d.clear=function(){e&&(clearTimeout(e),e=null)},d.flush=function(){e&&(c=t.apply(i,o),i=o=null,clearTimeout(e),e=null)},d}const p="page://",r="list-pages",u="list-pages-item",l="list-pages-link",w=t=>t.components().reduce((s,n)=>{var a;const e=n.findFirstType(l),o=(a=e==null?void 0:e.attributes.attributes)==null?void 0:a.href,i=o!=null&&o.startsWith(p)?o.replace(p,""):"";if(i&&e){const c=s[i];c?c.push(e):s[i]=[e]}return s},{}),T="app.grapesjs.com",L="app-stage.grapesjs.com",V=[T,L,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],N="license:check:start",M="license:check:end",A=()=>typeof window<"u",S=({isDev:t,isStage:s})=>`${t?"":`https://${s?L:T}`}/api`,v=()=>{const t=A()&&window.location.hostname;return!!t&&(V.includes(t)||V.some(s=>t.endsWith(s)))},D=()=>(A()&&window.location.hostname)===T;var O={NODE_ENV:"production",NPM_PACKAGE_VERSION:"1.0.8",STUDIO_NPM_PACKAGE_VERSION:"1.0.25"};const x=O.NODE_ENV!=="production";async function $({path:t,method:s="GET",headers:n={},body:e}){const i=`${S({isDev:x,isStage:!D()})}${t}`,a={method:s,headers:{"Content-Type":"application/json",...n}};e&&(a.body=JSON.stringify(e));const c=await fetch(i,a);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}function R(t){const s=t;return s.init=n=>e=>t(e,n),s}const W=t=>R(t);async function B({editor:t,pluginName:s,licenseKey:n,cleanup:e}){let o=!1;const i=v();t.on(N,()=>{o=!0}),t.on(M,({sdkLicense:a})=>{a||e()}),setTimeout(async()=>{if(!o){if(i)return;n&&await K({licenseKey:n,pluginName:s})||e()}},2e3)}async function K({licenseKey:t,pluginName:s}){try{const n=await $({path:`/sdk/${t}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:s})}),{license:e}=n.result||{};return!!e}catch(n){return console.error("Error during SDK license check:",n),!1}}const C="gjs-plg-",U="listPagesComponent",h="data-type-role",j="page_root",G=t=>s=>s.is(t),F=t=>(s,n)=>n.is(t),b=t=>s=>{var n;return((n=s.getAttribute)==null?void 0:n.call(s,h))===t};return W(function(t,s={}){const{Blocks:n,Components:e,Pages:o}=t,{licenseKey:i,block:a={}}=s,c="List Pages",f="List Pages Item",y="Link",d=`${C}${r}`,m=`${C}${l}`,J='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',X='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(r,{block:a&&{label:c,media:J,category:"Extra",select:!0,...s.block},isComponent:b(r),model:{defaults:{tagName:"ul",name:c,[j]:"",classes:d,attributes:{[h]:r},droppable:G(u),styles:`
2
- .${d} {
1
+ (function(g,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(g=typeof globalThis<"u"?globalThis:g||self,g.StudioSdkPlugins_listPagesComponent=p())})(this,function(){"use strict";function g(t,s,n){let e,o,i,a,c;const f=s;function y(){const m=Date.now()-a;m<f&&m>=0?e=setTimeout(y,f-m):(e=null,c=t.apply(i,o),i=o=null)}const u=function(){return i=this,o=arguments,a=Date.now(),e||(e=setTimeout(y,f)),c};return u.clear=function(){e&&(clearTimeout(e),e=null)},u.flush=function(){e&&(c=t.apply(i,o),i=o=null,clearTimeout(e),e=null)},u}const p="page://",r="list-pages",d="list-pages-item",l="list-pages-link",_=t=>t.components().reduce((s,n)=>{var a;const e=n.findFirstType(l),o=(a=e==null?void 0:e.attributes.attributes)==null?void 0:a.href,i=o!=null&&o.startsWith(p)?o.replace(p,""):"";if(i&&e){const c=s[i];c?c.push(e):s[i]=[e]}return s},{}),T="app.grapesjs.com",I="app-stage.grapesjs.com",V=[T,I,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],M="license:check:start",S="license:check:end",C=()=>typeof window<"u",N=({isDev:t,isStage:s})=>`${t?"":`https://${s?I:T}`}/api`,v=()=>{const t=C()&&window.location.hostname;return!!t&&(V.includes(t)||V.some(s=>t.endsWith(s)))},x=()=>(C()&&window.location.hostname)===T;var $={};const D=$.NODE_ENV!=="production";async function O({path:t,method:s="GET",headers:n={},body:e}){const i=`${N({isDev:D,isStage:!x()})}${t}`,a={method:s,headers:{"Content-Type":"application/json",...n}};e&&(a.body=JSON.stringify(e));const c=await fetch(i,a);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}function W(t){const s=t;return s.init=n=>e=>t(e,n),s}const R=t=>W(t);async function B({editor:t,pluginName:s,licenseKey:n,cleanup:e}){let o=!1;const i=v();t.on(M,()=>{o=!0}),t.on(S,({sdkLicense:a})=>{a||e()}),setTimeout(async()=>{if(!o){if(i)return;n&&await j({licenseKey:n,pluginName:s})||e()}},2e3)}async function j({licenseKey:t,pluginName:s}){try{const n=await O({path:`/sdk/${t}`,method:"POST",body:JSON.stringify({d:window.location.hostname,pn:s})}),{license:e}=n.result||{};return!!e}catch(n){return console.error("Error during SDK license check:",n),!1}}const E="gjs-plg-",U="listPagesComponent",h="data-type-role",K="page_root",F=t=>s=>s.is(t),G=t=>(s,n)=>n.is(t),b=t=>s=>{var n;return((n=s.getAttribute)==null?void 0:n.call(s,h))===t};return R(function(t,s={}){const{Blocks:n,Components:e,Pages:o}=t,{licenseKey:i,block:a={}}=s,c="List Pages",f="List Pages Item",y="Link",u=`${E}${r}`,m=`${E}${l}`,J='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',X='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(r,{block:a&&{label:c,media:J,category:"Extra",select:!0,...s.block},isComponent:b(r),model:{defaults:{tagName:"ul",name:c,[K]:"",classes:u,attributes:{[h]:r},droppable:F(d),styles:`
2
+ .${u} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
6
6
  }
7
- `},init(){this.syncPageItems=g(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const E=this.em.Pages.getAll(),Y=this.components(),Z=w(this);E.forEach((H,q)=>{const _=H.id,I=H.getName(),P=Z[_];P?P==null||P.forEach(k=>{k.getInnerHTML()!==I&&k.components(I)}):Y.add({type:u,components:[{type:l,attributes:{href:`page://${_}`},components:{type:"textnode",content:I}}]},{at:q})})}}}),e.addType(u,{isComponent:b(u),model:{defaults:{name:f,tagName:"li",icon:X,attributes:{[h]:u},components:{type:l},draggable:F(r)}}}),e.addType(l,{extend:"link",isComponent:b(l),model:{defaults:{removable:!1,copyable:!1,delegate:{move:E=>E.closestType(u)},name:y,classes:m,attributes:{[h]:l},components:{type:"textnode",content:"Item"},styles:`
7
+ `},init(){this.syncPageItems=g(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const L=this.em.Pages.getAll(),Y=this.components(),Z=_(this);L.forEach((k,q)=>{const w=k.id,H=k.getName(),P=Z[w];P?P==null||P.forEach(A=>{A.getInnerHTML()!==H&&A.components(H)}):Y.add({type:d,components:[{type:l,attributes:{href:`page://${w}`},components:{type:"textnode",content:H}}]},{at:q})})}}}),e.addType(d,{isComponent:b(d),model:{defaults:{name:f,tagName:"li",icon:X,attributes:{[h]:d},components:{type:l},draggable:G(r)}}}),e.addType(l,{extend:"link",isComponent:b(l),model:{defaults:{removable:!1,copyable:!1,delegate:{move:L=>L.closestType(d)},name:y,classes:m,attributes:{[h]:l},components:{type:"textnode",content:"Item"},styles:`
8
8
  .${m} {
9
9
  text-decoration: none;
10
10
  }