@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33
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/accordionComponent/index.cjs.js +7 -7
- package/dist/accordionComponent/index.es.js +161 -156
- package/dist/accordionComponent/index.umd.js +9 -9
- package/dist/aiChat/chatManager.d.ts +15 -0
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
- package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
- package/dist/aiChat/components/AiChatError.d.ts +2 -1
- package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
- package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
- package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
- package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
- package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
- package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
- package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
- package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
- package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
- package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
- package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
- package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
- package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
- package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
- package/dist/aiChat/components/index.d.ts +24 -25
- package/dist/aiChat/components/utils.d.ts +12 -4
- package/dist/aiChat/index.cjs.d.ts +5 -0
- package/dist/aiChat/index.cjs.js +453 -0
- package/dist/aiChat/index.d.ts +4 -3
- package/dist/aiChat/index.es.d.ts +5 -0
- package/dist/aiChat/index.es.js +30930 -0
- package/dist/aiChat/index.js +453 -0
- package/dist/aiChat/index.umd.js +453 -0
- package/dist/aiChat/locales/en.d.ts +64 -0
- package/dist/aiChat/server/index.cjs.d.ts +4 -0
- package/dist/aiChat/server/index.cjs.js +309 -0
- package/dist/aiChat/server/index.d.ts +0 -50
- package/dist/aiChat/server/index.es.d.ts +4 -0
- package/dist/aiChat/server/index.es.js +876 -0
- package/dist/aiChat/server/index.js +309 -0
- package/dist/aiChat/server/index.umd.js +309 -0
- package/dist/aiChat/server/stream.d.ts +0 -6
- package/dist/aiChat/server/tools.d.ts +157 -51
- package/dist/aiChat/server/types.d.ts +108 -64
- package/dist/aiChat/types.d.ts +148 -108
- package/dist/aiChat/typesSchema.d.ts +238 -25
- package/dist/animationComponent/index.cjs.js +3 -3
- package/dist/animationComponent/index.es.js +174 -169
- package/dist/animationComponent/index.umd.js +3 -3
- package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
- package/dist/canvasAbsoluteMode/index.es.js +161 -156
- package/dist/canvasAbsoluteMode/index.umd.js +1 -1
- package/dist/canvasEmptyState/index.cjs.js +1 -1
- package/dist/canvasEmptyState/index.es.js +113 -108
- package/dist/canvasEmptyState/index.umd.js +1 -1
- package/dist/canvasFullSize/index.cjs.js +9 -9
- package/dist/canvasFullSize/index.es.js +137 -132
- package/dist/canvasFullSize/index.umd.js +9 -9
- package/dist/canvasGridMode/index.cjs.js +4 -4
- package/dist/canvasGridMode/index.es.js +168 -163
- package/dist/canvasGridMode/index.umd.js +8 -8
- package/dist/canvasScreenshot/index.cjs.js +1 -1
- package/dist/canvasScreenshot/index.es.js +132 -127
- package/dist/canvasScreenshot/index.umd.js +1 -1
- package/dist/dataSourceEjs/index.cjs.js +5 -5
- package/dist/dataSourceEjs/index.es.js +151 -146
- package/dist/dataSourceEjs/index.umd.js +5 -5
- package/dist/dataSourceHandlebars/index.cjs.js +4 -4
- package/dist/dataSourceHandlebars/index.es.js +91 -86
- package/dist/dataSourceHandlebars/index.umd.js +5 -5
- package/dist/dialogComponent/index.cjs.js +16 -16
- package/dist/dialogComponent/index.es.js +117 -112
- package/dist/dialogComponent/index.umd.js +16 -16
- package/dist/flexComponent/index.cjs.js +11 -11
- package/dist/flexComponent/index.es.js +416 -411
- package/dist/flexComponent/index.umd.js +11 -11
- package/dist/fsLightboxComponent/index.cjs.js +3 -3
- package/dist/fsLightboxComponent/index.es.js +152 -147
- package/dist/fsLightboxComponent/index.umd.js +3 -3
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +127 -122
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +170 -165
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +27 -22
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +156 -151
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/lightGalleryComponent/index.cjs.js +1 -1
- package/dist/lightGalleryComponent/index.es.js +197 -192
- package/dist/lightGalleryComponent/index.umd.js +1 -1
- package/dist/linkImageComponent/index.cjs.js +2 -2
- package/dist/linkImageComponent/index.es.js +86 -81
- package/dist/linkImageComponent/index.umd.js +2 -2
- package/dist/listPagesComponent/index.cjs.js +5 -5
- package/dist/listPagesComponent/index.es.js +121 -116
- package/dist/listPagesComponent/index.umd.js +5 -5
- package/dist/presetPrintable/index.cjs.js +4 -4
- package/dist/presetPrintable/index.es.js +180 -175
- package/dist/presetPrintable/index.umd.js +4 -4
- package/dist/prosemirror/index.cjs.js +6 -6
- package/dist/prosemirror/index.es.js +128 -123
- package/dist/prosemirror/index.umd.js +8 -8
- package/dist/rendererReact/index.cjs.js +1 -1
- package/dist/rendererReact/index.es.js +127 -122
- package/dist/rendererReact/index.js +1 -1
- package/dist/rendererReact/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +160 -155
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/shapeDividerComponent/index.cjs.js +25 -25
- package/dist/shapeDividerComponent/index.es.js +127 -122
- package/dist/shapeDividerComponent/index.umd.js +25 -25
- package/dist/swiperComponent/index.cjs.js +9 -9
- package/dist/swiperComponent/index.es.js +197 -192
- package/dist/swiperComponent/index.umd.js +9 -9
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +227 -222
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils.d.ts +12 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +124 -119
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +5 -2
- package/dist/aiChat/components/AiChatInput.d.ts +0 -17
- package/dist/aiChat/server/stream-utils.d.ts +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(u,
|
|
1
|
+
(function(u,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(u=typeof globalThis<"u"?globalThis:u||self,u.StudioSdkPlugins_youtubeAssetProvider=g())})(this,function(){"use strict";var u=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(u||{}),g=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(g||{});const v="app.grapesjs.com",P="app-stage.grapesjs.com",T=[v,"app2.grapesjs.com",P,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],x="license:check:start",D="license:check:end",R=()=>typeof window<"u",G=({isDev:e,isStage:o,isPlatform:n})=>`${e?"":`https://${o?P:v}`}/${n?"platform-api":"api"}`,O=()=>{const e=R()&&window.location.hostname;return!!e&&(T.includes(e)||T.some(o=>e.endsWith(o)))};async function L({path:e,baseApiUrl:o,method:n="GET",headers:r={},params:i,body:d}){const s=`${o||G({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...r}};d&&(l.body=JSON.stringify(d));const c=i?new URLSearchParams(i).toString():"",a=c?`?${c}`:"",t=await fetch(`${s}${a}`,l);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const A={[u.free]:0,[u.startup]:10,[u.business]:20,[u.enterprise]:30};function U(e){const o=e;return o.init=n=>r=>e(r,n),o}const E=e=>U(e);async function M({editor:e,plan:o,pluginName:n,licenseKey:r,onLicenseCheckResponse:i,cleanup:d}){let p="",s=!1;const l=O(),c=t=>{console.warn("Cleanup plugin:",n,"Reason:",t),d()},a=(t={})=>{var I;const{error:f,sdkLicense:b}=t,y=(I=t.plan)==null?void 0:I.category;if(!(b||t.license)||f)c(f||"Invalid license");else if(y){const W=A[o],Y=A[y];W>Y&&c({pluginRequiredPlan:o,licensePlan:y})}};e.on(x,t=>{p=t==null?void 0:t.baseApiUrl,s=!0}),e.on(D,t=>{i==null||i(t),a(t)}),setTimeout(async()=>{if(!s){if(l)return;if(r){const t=await $({licenseKey:r,pluginName:n,baseApiUrl:p});i==null||i(t),t&&a(t)}else c("The `licenseKey` option not provided")}},2e3)}async function $(e){const{licenseKey:o,pluginName:n,baseApiUrl:r}=e;try{return(await L({baseApiUrl:r,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const k=e=>{const o={};for(const n of Object.keys(e)){let r=e[n];r&&(Array.isArray(r)?r=r.map(i=>i.toString()).join(","):r=r.toString(),o[n]=r)}return new URLSearchParams(o)},w="youtube-video",N=e=>{const{apiKey:o,searchParams:n,thumbnailQuality:r="high"}=e,i=(s={})=>{const c="https://www.googleapis.com/youtube/v3/search",a=k(s);return`${c}?${a}`},d=s=>{var l,c,a;return((l=s[r])==null?void 0:l.url)||((c=s.high)==null?void 0:c.url)||((a=s.medium)==null?void 0:a.url)||s.default.url},p=s=>{const l=d(s.snippet.thumbnails);return{id:s.id.videoId,src:`https://www.youtube.com/watch?v=${s.id.videoId}`,name:s.snippet.title,type:w,customData:{thumbnailUrl:l,videoItem:s}}};return{id:"youtube",types:[w],label:({editor:s})=>s.I18n.t("youtubeAssetProvider.providerLabel"),search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:s,pageCustomData:l}){var h;const c={maxResults:25,q:s,pageToken:l==null?void 0:l.token,type:["video"],key:o},a=n==null?void 0:n({searchValue:s}),t={...c,...a};t.part?t.part.includes("snippet")||t.part.push("snippet"):t.part=["snippet"];const b=await(await fetch(i(t))).json();return(h=b.items)!=null&&h.length?{items:b.items.map(p),nextPageCustomData:{token:b.nextPageToken},isLastPage:!b.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:s,onSelect:l})=>({type:"column",onClick:()=>l(s),htmlAttrs:{title:s.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=s.customData)==null?void 0:c.thumbnailUrl}" alt="${s.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:s.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},j={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},B="youtubeAssetProvider",_=u.startup;return E(function(e,o){var c;const{skipVideoComponent:n,i18n:r={}}=o,i=N(o);e.runCommand(g.assetProviderAdd,{provider:i});const d="search-on-youtube",p="video",s=(c=e.Components.getType(p))==null?void 0:c.model.prototype,l=a=>{e.Assets.open({modalTitle:e.I18n.t("youtubeAssetProvider.modalTitle"),providerId:i.id,typeId:i.types[0],providers:[],types:[],select:t=>{e.Assets.close(),a.set({videoId:t.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!n&&s&&e.Components.addType(p,{model:{getYoutubeTraits(){const[a,...t]=s.getYoutubeTraits.apply(this);return[a,{id:d,type:"button",label:e.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>l(this)},...t]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:a}=this,t=a.get("provider")||"";t!=null&&t.startsWith("yt")&&l(a)}}}),e.I18n.addMessages({en:j,...r}),M({editor:e,licenseKey:o.licenseKey,plan:_,pluginName:B,cleanup:()=>{e.runCommand(g.assetProviderRemove,{id:i.id}),!n&&s&&e.Components.addType(p,{model:{getYoutubeTraits(){return s.getYoutubeTraits.apply(this).filter(a=>a.id!==d)}}})}})})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grapesjs/studio-sdk-plugins",
|
|
3
|
-
"version": "1.0.33
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org"
|
|
6
6
|
},
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"@ai-sdk/react": "^3.0.35",
|
|
66
66
|
"ai": "^6.0.33",
|
|
67
67
|
"handlebars": "^4.7.8",
|
|
68
|
+
"marked": "^17.0.1",
|
|
68
69
|
"prosemirror-commands": "^1.6.2",
|
|
69
70
|
"prosemirror-history": "^1.4.1",
|
|
70
71
|
"prosemirror-inputrules": "^1.4.0",
|
|
@@ -74,7 +75,9 @@
|
|
|
74
75
|
"prosemirror-state": "^1.4.3",
|
|
75
76
|
"prosemirror-tables": "^1.6.1",
|
|
76
77
|
"prosemirror-view": "^1.37.0",
|
|
77
|
-
"
|
|
78
|
+
"react-markdown": "^10.1.0",
|
|
79
|
+
"remark-gfm": "^4.0.0",
|
|
80
|
+
"zod": "^4.3.6"
|
|
78
81
|
},
|
|
79
82
|
"peerDependencies": {
|
|
80
83
|
"@ai-sdk/anthropic": ">=3.0.0",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CommonComponentProps, UploadedAsset } from '../types';
|
|
2
|
-
export interface AiChatInputProps extends CommonComponentProps {
|
|
3
|
-
/**
|
|
4
|
-
* Maximum number of images per message. Set to 0 to disable images.
|
|
5
|
-
* @default 5
|
|
6
|
-
*/
|
|
7
|
-
maxImages?: number;
|
|
8
|
-
/**
|
|
9
|
-
* Upload project assets (images) to server.
|
|
10
|
-
* If not provided and files are added, they will be sent directly to the chat.
|
|
11
|
-
*/
|
|
12
|
-
uploadProjectAssets?: (props: {
|
|
13
|
-
files: File[];
|
|
14
|
-
}) => Promise<UploadedAsset[]>;
|
|
15
|
-
}
|
|
16
|
-
export declare const AiChatInput: React.FC<AiChatInputProps>;
|
|
17
|
-
export default AiChatInput;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ModelMessage } from 'ai';
|
|
2
|
-
import { ToolCallInfo } from './types';
|
|
3
|
-
export declare function injectImagesIntoMessages(messages: ModelMessage[], imageUrls: string[]): ModelMessage[];
|
|
4
|
-
export declare function handleTextChunk(chunk: {
|
|
5
|
-
type: 'text-delta';
|
|
6
|
-
text?: string;
|
|
7
|
-
}, onText?: (text: string) => void | Promise<void>): Promise<void>;
|
|
8
|
-
export declare function handleToolCallChunk(chunk: {
|
|
9
|
-
type: 'tool-call';
|
|
10
|
-
toolCallId: string;
|
|
11
|
-
toolName: string;
|
|
12
|
-
input?: unknown;
|
|
13
|
-
}, toolCalls: ToolCallInfo[], onToolCall?: (toolCall: ToolCallInfo) => void | Promise<void>): Promise<void>;
|
|
14
|
-
export declare function processStreamChunk(chunk: {
|
|
15
|
-
type: string;
|
|
16
|
-
}, toolCalls: ToolCallInfo[], onText?: (text: string) => void | Promise<void>, onToolCall?: (toolCall: ToolCallInfo) => void | Promise<void>): Promise<void>;
|