@imgly/plugin-cutout-library-web 1.87.0-rc.0 → 1.87.0-rc.2
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/index.mjs +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=`@imgly/plugin-cutout-library-web.canvasMenu`,t=`${e}.button`,n=`${t}.label`,r=`ly.img.cutout`,i=`${r}.entry`,a=`@imgly/plugin-cutout-library-web.notifications.selectCutoutBlock`,o=`@imgly/plugin-cutout-library-web.notifications.cutoutBlockSelected`,s=`@imgly/plugin-cutout-library-web.notifications.differentPages`,c={en:{[`libraries.${i}.label`]:`Cutouts`,[a]:`Please select a block to cutout`,[o]:`Cutout blocks cannot be cutout from selection`,[s]:`Selected Blocks are from different pages. Please select blocks from the same page.`,[n]:`Cutout`},de:{[`libraries.${i}.label`]:`Schnittlinien`,[a]:`Bitte wählen Sie einen Block zum Ausschneiden aus`,[o]:`Schnittlinienblöcke können nicht ausgeschnitten werden`,[s]:`Ausgewählte Blöcke stammen aus verschiedenen Seiten. Bitte wählen Sie Blöcke von derselben Seite aus.`,[n]:`Ausschneiden`}};function l(r,{createCutoutFromBlocks:i}){r.ui.registerComponent(e,({builder:{Button:e},engine:a})=>{let o=[`//ly.img.ubq/group`,`//ly.img.ubq/graphic`,`//ly.img.ubq/text`],s=a.block.findAllSelected();if(s.length!==1||!o.includes(a.block.getType(s[0])))return null;e(t,{label:n,icon:({theme:e})=>`${g}/dock-${e}.svg`,onClick:()=>{m(r,i)}})})}async function u(e,t,n=``,r){let{assets:i,id:a}=t;e.asset.addLocalSource(a,void 0,r),i.forEach(t=>{t.meta&&Object.entries(t.meta).forEach(([e,r])=>{let i=r.toString();if(i.includes(`{{base_url}}`)){let r=i.replace(`{{base_url}}`,n);t.meta&&(t.meta[e]=r)}}),t.payload?.sourceSet&&t.payload.sourceSet.forEach(e=>{e.uri=e.uri.replace(`{{base_url}}`,n)}),e.asset.addAssetToSource(a,t)})}function d({assetBaseUri:t,ui:n,createCutoutFromBlocks:r}){return{initialize:({cesdk:i})=>{i!=null&&(p(i,{assetBaseUri:t,createCutoutFromBlocks:r}),f(i,{assetBaseUri:t}),l(i,{createCutoutFromBlocks:r}),n?.locations.includes(`canvasMenu`)&&i.ui.setCanvasMenuOrder([e,...i.ui.getCanvasMenuOrder()]),i.setTranslations(c))}}}function f(e,t=_){let{assetBaseUri:n}=v(t);e.ui.addAssetLibraryEntry({id:i,sourceIds:[r],icon:({theme:e})=>`${n}/dock-${e}.svg`,gridColumns:2,gridItemHeight:`square`,cardLabel:e=>e.label,cardLabelPosition:()=>`below`,cardBackgroundPreferences:[{path:`meta.thumbUri`,type:`image`}]})}async function p(e,{assetBaseUri:t,createCutoutFromBlocks:n}){let i=await fetch(`${t}/${r}/content.json`).then(e=>e.json());u(e.engine,i,`${t}/${r}/assets`,async t=>t.id===`cutout-selection`?await m(e,n):await e.engine.asset.defaultApplyAsset(t))}async function m(e,t){let n=e.engine.block.findAllSelected();if(n.length===0){e.ui.showNotification({message:a,type:`error`});return}if(n.some(t=>e.engine.block.getType(t)===`//ly.img.ubq/cutout`)){e.ui.showNotification({message:o,type:`error`});return}let r=n.map(t=>h(e.engine,t)),i=Array.from(new Set(r));if(i.length>1){e.ui.showNotification({message:s,type:`error`});return}let c=i[0],l=t(n,e.engine);return e.engine.block.appendChild(c,l),e.engine.block.setAlwaysOnTop(l,!0),e.engine.block.select(l),e.engine.editor.addUndoStep(),l}function h(e,t){let n=t;for(;n&&e.block.getType(n)!==`//ly.img.ubq/page`;){let t=e.block.getParent(n);if(!t||t===n)return n;n=t}return n}const g=`https://staticimgly.com/imgly/plugin-cutout-library-web/1.87.0-rc.
|
|
1
|
+
const e=`@imgly/plugin-cutout-library-web.canvasMenu`,t=`${e}.button`,n=`${t}.label`,r=`ly.img.cutout`,i=`${r}.entry`,a=`@imgly/plugin-cutout-library-web.notifications.selectCutoutBlock`,o=`@imgly/plugin-cutout-library-web.notifications.cutoutBlockSelected`,s=`@imgly/plugin-cutout-library-web.notifications.differentPages`,c={en:{[`libraries.${i}.label`]:`Cutouts`,[a]:`Please select a block to cutout`,[o]:`Cutout blocks cannot be cutout from selection`,[s]:`Selected Blocks are from different pages. Please select blocks from the same page.`,[n]:`Cutout`},de:{[`libraries.${i}.label`]:`Schnittlinien`,[a]:`Bitte wählen Sie einen Block zum Ausschneiden aus`,[o]:`Schnittlinienblöcke können nicht ausgeschnitten werden`,[s]:`Ausgewählte Blöcke stammen aus verschiedenen Seiten. Bitte wählen Sie Blöcke von derselben Seite aus.`,[n]:`Ausschneiden`}};function l(r,{createCutoutFromBlocks:i}){r.ui.registerComponent(e,({builder:{Button:e},engine:a})=>{let o=[`//ly.img.ubq/group`,`//ly.img.ubq/graphic`,`//ly.img.ubq/text`],s=a.block.findAllSelected();if(s.length!==1||!o.includes(a.block.getType(s[0])))return null;e(t,{label:n,icon:({theme:e})=>`${g}/dock-${e}.svg`,onClick:()=>{m(r,i)}})})}async function u(e,t,n=``,r){let{assets:i,id:a}=t;e.asset.addLocalSource(a,void 0,r),i.forEach(t=>{t.meta&&Object.entries(t.meta).forEach(([e,r])=>{let i=r.toString();if(i.includes(`{{base_url}}`)){let r=i.replace(`{{base_url}}`,n);t.meta&&(t.meta[e]=r)}}),t.payload?.sourceSet&&t.payload.sourceSet.forEach(e=>{e.uri=e.uri.replace(`{{base_url}}`,n)}),e.asset.addAssetToSource(a,t)})}function d({assetBaseUri:t,ui:n,createCutoutFromBlocks:r}){return{initialize:({cesdk:i})=>{i!=null&&(p(i,{assetBaseUri:t,createCutoutFromBlocks:r}),f(i,{assetBaseUri:t}),l(i,{createCutoutFromBlocks:r}),n?.locations.includes(`canvasMenu`)&&i.ui.setCanvasMenuOrder([e,...i.ui.getCanvasMenuOrder()]),i.setTranslations(c))}}}function f(e,t=_){let{assetBaseUri:n}=v(t);e.ui.addAssetLibraryEntry({id:i,sourceIds:[r],icon:({theme:e})=>`${n}/dock-${e}.svg`,gridColumns:2,gridItemHeight:`square`,cardLabel:e=>e.label,cardLabelPosition:()=>`below`,cardBackgroundPreferences:[{path:`meta.thumbUri`,type:`image`}]})}async function p(e,{assetBaseUri:t,createCutoutFromBlocks:n}){let i=await fetch(`${t}/${r}/content.json`).then(e=>e.json());u(e.engine,i,`${t}/${r}/assets`,async t=>t.id===`cutout-selection`?await m(e,n):await e.engine.asset.defaultApplyAsset(t))}async function m(e,t){let n=e.engine.block.findAllSelected();if(n.length===0){e.ui.showNotification({message:a,type:`error`});return}if(n.some(t=>e.engine.block.getType(t)===`//ly.img.ubq/cutout`)){e.ui.showNotification({message:o,type:`error`});return}let r=n.map(t=>h(e.engine,t)),i=Array.from(new Set(r));if(i.length>1){e.ui.showNotification({message:s,type:`error`});return}let c=i[0],l=t(n,e.engine);return e.engine.block.appendChild(c,l),e.engine.block.setAlwaysOnTop(l,!0),e.engine.block.select(l),e.engine.editor.addUndoStep(),l}function h(e,t){let n=t;for(;n&&e.block.getType(n)!==`//ly.img.ubq/page`;){let t=e.block.getParent(n);if(!t||t===n)return n;n=t}return n}const g=`https://staticimgly.com/imgly/plugin-cutout-library-web/1.87.0-rc.2/dist/assets`,_={assetBaseUri:g,createCutoutFromBlocks:(e,t)=>t.block.createCutoutFromBlocks(e,0,2,!1)};function v(e){return{..._,...e}}const y=(e=_)=>({name:`@imgly/plugin-cutout-library-web`,version:`1.87.0-rc.2`,...d({..._,...e})});export{g as DEFAULT_ASSET_BASE_URI,_ as DEFAULT_PLUGIN_CONFIGURATION,y as default,m as generateCutoutFromSelection,v as getPluginConfiguration};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imgly/plugin-cutout-library-web",
|
|
3
|
-
"version": "1.87.0-rc.
|
|
3
|
+
"version": "1.87.0-rc.2",
|
|
4
4
|
"description": "Cutout Library plugin for the CE.SDK editor",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CE.SDK",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"vitest": "^5.0.3"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"@cesdk/cesdk-js": "^1.87.0-rc.
|
|
48
|
+
"@cesdk/cesdk-js": "^1.87.0-rc.2"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"lodash": "^4.17.21"
|