@grapesjs/studio-sdk-plugins 1.0.7 → 1.0.8

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.
@@ -1,4 +1,4 @@
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.7",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";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:`
2
2
  .${p} {
3
3
  list-style: none;
4
4
  margin: 0;
@@ -41,7 +41,7 @@ const V = "page://", r = "list-pages", u = "list-pages-item", l = "list-pages-li
41
41
  const e = _() && window.location.hostname;
42
42
  return !!e && (A.includes(e) || A.some((s) => e.endsWith(s)));
43
43
  }, W = () => (_() && window.location.hostname) === b;
44
- var B = { NODE_ENV: "production", NPM_PACKAGE_VERSION: "1.0.7", STUDIO_NPM_PACKAGE_VERSION: "1.0.25" };
44
+ var B = { NODE_ENV: "production", NPM_PACKAGE_VERSION: "1.0.8", STUDIO_NPM_PACKAGE_VERSION: "1.0.25" };
45
45
  const K = B.NODE_ENV !== "production";
46
46
  async function U({
47
47
  path: e,
@@ -1,4 +1,4 @@
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.7",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:`
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
2
  .${d} {
3
3
  list-style: none;
4
4
  margin: 0;