@imgly/plugin-ai-text-generation-web 0.2.7 → 0.2.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.
- package/CHANGELOG.md +11 -0
- package/README.md +7 -7
- package/dist/.tsbuildinfo +1 -0
- package/dist/anthropic/index.mjs +10 -18
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/index.mjs +11 -34
- package/dist/index.mjs.map +1 -1
- package/dist/open-ai/index.mjs +10 -18
- package/dist/open-ai/index.mjs.map +1 -1
- package/package.json +8 -18
package/dist/index.mjs
CHANGED
|
@@ -310,41 +310,18 @@ ${t}
|
|
|
310
310
|
</change_text_to>
|
|
311
311
|
|
|
312
312
|
Please modify the original text according to the "Change Text to..." prompt. Only return the new, modified text without any additional commentary or explanation. Your entire response should be the modified text itself, with no other content.
|
|
313
|
-
`}var Yr=fd;var Fe="changeTextTo",O=`ly.img.${Fe}`,Wr=`ly.img.plugin-ai-text-generation-web.quickAction.${Fe}`,Kr=`ly.img.plugin-ai-text-generation-web.defaults.quickAction.${Fe}`;function dt(e,t){let r="ly.img.plugin-ai-text-generation-web",i=`quickAction.${Fe}`,n=t?`${i}.${t}`:i;return[`${r}.${e}.${n}`,`${r}.${n}`,`${r}.${e}.defaults.${n}`,`${r}.defaults.${n}`]}var md=({cesdk:e})=>(e.feature.enable("ly.img.plugin-ai-text-generation-web.quickAction.changeTextTo",!0),e.i18n.setTranslations({en:{[`${Kr}`]:"Change Text to...",[`${Kr}.prompt`]:"Change Text to...",[`${Wr}.prompt.placeholder`]:'e.g. "a list of bullet points", "a formal announcement"'}}),{id:O,type:"quick",kind:"text",scopes:["text/edit"],label:`${Wr}`,enable:({engine:r})=>{let i=r.block.findAllSelected();if(i==null||i.length!==1)return!1;let[n]=i;return r.block.getType(n)==="//ly.img.ubq/text"},render:({builder:r,experimental:i,isExpanded:n,toggleExpand:a,generate:o,engine:s,state:c,close:l,providerId:u})=>{if(n){let d=c(`${O}.prompt`,"");r.TextArea(`${O}.prompt`,{inputLabel:dt(u,"prompt"),placeholder:dt(u,"prompt.placeholder")[1],...d}),r.Separator(`${O}.separator`),i.builder.ButtonRow(`${O}.footer`,{justifyContent:"space-between",children:()=>{r.Button(`${O}.footer.cancel`,{label:"common.back",icon:"@imgly/ChevronLeft",onClick:a}),r.Button(`${O}.footer.apply`,{label:"common.apply",icon:"@imgly/MagicWand",color:"accent",isDisabled:d.value.length===0,onClick:async()=>{try{let g=d.value;if(!g)return;let[p]=s.block.findAllSelected(),h=s.block.getString(p,"text/text");await o({prompt:Yr(h,g),customPrompt:g}),a(),l()}catch(g){console.error("Generation error:",g),e.ui.showNotification({type:"error",message:g.message||"Failed to change text. Please try again.",duration:"medium"})}}})}})}else r.Button(`${O}.button`,{label:dt(u),icon:"@imgly/MagicWand",labelAlignment:"left",variant:"plain",onClick:a})}}),Xr=md;var Ie="@imgly/plugin-ai-text-generation-web",Re=["ly.img.improve","ly.img.fix","ly.img.shorter","ly.img.longer","ly.img.separator","ly.img.changeTone","ly.img.translate","ly.img.separator","ly.img.changeTextTo"];function hd(e){return{async initialize({cesdk:t}){if(t==null)return;Gt(t,Ie,"0.2.
|
|
313
|
+
`}var Yr=fd;var Fe="changeTextTo",O=`ly.img.${Fe}`,Wr=`ly.img.plugin-ai-text-generation-web.quickAction.${Fe}`,Kr=`ly.img.plugin-ai-text-generation-web.defaults.quickAction.${Fe}`;function dt(e,t){let r="ly.img.plugin-ai-text-generation-web",i=`quickAction.${Fe}`,n=t?`${i}.${t}`:i;return[`${r}.${e}.${n}`,`${r}.${n}`,`${r}.${e}.defaults.${n}`,`${r}.defaults.${n}`]}var md=({cesdk:e})=>(e.feature.enable("ly.img.plugin-ai-text-generation-web.quickAction.changeTextTo",!0),e.i18n.setTranslations({en:{[`${Kr}`]:"Change Text to...",[`${Kr}.prompt`]:"Change Text to...",[`${Wr}.prompt.placeholder`]:'e.g. "a list of bullet points", "a formal announcement"'}}),{id:O,type:"quick",kind:"text",scopes:["text/edit"],label:`${Wr}`,enable:({engine:r})=>{let i=r.block.findAllSelected();if(i==null||i.length!==1)return!1;let[n]=i;return r.block.getType(n)==="//ly.img.ubq/text"},render:({builder:r,experimental:i,isExpanded:n,toggleExpand:a,generate:o,engine:s,state:c,close:l,providerId:u})=>{if(n){let d=c(`${O}.prompt`,"");r.TextArea(`${O}.prompt`,{inputLabel:dt(u,"prompt"),placeholder:dt(u,"prompt.placeholder")[1],...d}),r.Separator(`${O}.separator`),i.builder.ButtonRow(`${O}.footer`,{justifyContent:"space-between",children:()=>{r.Button(`${O}.footer.cancel`,{label:"common.back",icon:"@imgly/ChevronLeft",onClick:a}),r.Button(`${O}.footer.apply`,{label:"common.apply",icon:"@imgly/MagicWand",color:"accent",isDisabled:d.value.length===0,onClick:async()=>{try{let g=d.value;if(!g)return;let[p]=s.block.findAllSelected(),h=s.block.getString(p,"text/text");await o({prompt:Yr(h,g),customPrompt:g}),a(),l()}catch(g){console.error("Generation error:",g),e.ui.showNotification({type:"error",message:g.message||"Failed to change text. Please try again.",duration:"medium"})}}})}})}else r.Button(`${O}.button`,{label:dt(u),icon:"@imgly/MagicWand",labelAlignment:"left",variant:"plain",onClick:a})}}),Xr=md;var Ie="@imgly/plugin-ai-text-generation-web",Re=["ly.img.improve","ly.img.fix","ly.img.shorter","ly.img.longer","ly.img.separator","ly.img.changeTone","ly.img.translate","ly.img.separator","ly.img.changeTextTo"];function hd(e){return{async initialize({cesdk:t}){if(t==null)return;Gt(t,Ie,"0.2.8"),t.feature.enable("ly.img.plugin-ai-text-generation-web.providerSelect",!0),t.feature.enable("ly.img.plugin-ai-text-generation-web.quickAction",!0),t.feature.enable("ly.img.plugin-ai-text-generation-web.quickAction.providerSelect",!0),t.ui.addIconSet(gt,pt),t.i18n.setTranslations({en:{"common.apply":"Apply","common.back":"Back"}}),yd(e);let r=Ee.get();r.register(Tr({cesdk:t})),r.register(Pr({cesdk:t})),r.register(Or({cesdk:t})),r.register(zr({cesdk:t})),r.register(Br({cesdk:t})),r.register(Zr({cesdk:t})),r.register(Xr({cesdk:t}));let i=e.providers?.text2text??e.provider,n=await Promise.all(Er(i).map(c=>c({cesdk:t})));if(!(n.length>0))return;let o=await ir("text",{fromText:n,fromImage:[]},{cesdk:t},e),s=await ar({kind:"text",providerInitializationResults:o.providerInitializationResults,cesdk:t,engine:t.engine,debug:e.debug,dryRun:e.dryRun,defaultOrder:Re});s.renderFunction!=null&&(t.ui.registerComponent("ly.img.ai.text.canvasMenu",s.renderFunction),t.ui.setCanvasMenuOrder(["ly.img.ai.text.canvasMenu"],{editMode:fe}))}}}function yd(e){e.debug&&e.providers?.text2text!=null&&e.provider!=null&&console.warn("[TextGeneration]: Both `providers.text2text` and `provider` configuration is provided. Since `provider` is deprecated, only `providers.text2text` will be used.")}var Jr=hd;var bd=e=>({name:Ie,version:"0.2.8",...Jr(e)}),zg=bd;export{Re as DEFAULT_TEXT_QUICK_ACTION_ORDER,zg as default};
|
|
314
314
|
/*! Bundled license information:
|
|
315
315
|
|
|
316
|
-
|
|
317
|
-
(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
* Build: `lodash modularize exports="es" -o ./`
|
|
327
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
328
|
-
* Released under MIT license <https://lodash.com/license>
|
|
329
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
330
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
331
|
-
*)
|
|
332
|
-
*)
|
|
333
|
-
*)
|
|
334
|
-
|
|
335
|
-
@imgly/plugin-utils/dist/index.mjs:
|
|
336
|
-
(*! Bundled license information:
|
|
337
|
-
|
|
338
|
-
lodash-es/lodash.js:
|
|
339
|
-
(**
|
|
340
|
-
* @license
|
|
341
|
-
* Lodash (Custom Build) <https://lodash.com/>
|
|
342
|
-
* Build: `lodash modularize exports="es" -o ./`
|
|
343
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
344
|
-
* Released under MIT license <https://lodash.com/license>
|
|
345
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
346
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
347
|
-
*)
|
|
348
|
-
*)
|
|
316
|
+
lodash-es/lodash.js:
|
|
317
|
+
(**
|
|
318
|
+
* @license
|
|
319
|
+
* Lodash (Custom Build) <https://lodash.com/>
|
|
320
|
+
* Build: `lodash modularize exports="es" -o ./`
|
|
321
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
322
|
+
* Released under MIT license <https://lodash.com/license>
|
|
323
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
324
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
325
|
+
*)
|
|
349
326
|
*/
|
|
350
327
|
//# sourceMappingURL=index.mjs.map
|