@sealpixel/vue 1.0.0-rc.21 → 1.0.0-rc.22

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.d.ts CHANGED
@@ -3,6 +3,7 @@ import { type EditorSession, type ExportResult, type SealpixelError, type Sessio
3
3
  import '@sealpixel/element';
4
4
  import type { AnyPlugin, AssetResolver, OutputOptions, Renderer } from '@sealpixel/core';
5
5
  import type { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';
6
+ import type { UiTool } from '@sealpixel/ui';
6
7
  import { type App, type PropType, type ShallowRef } from 'vue';
7
8
  export type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';
8
9
  export interface EditLogState {
@@ -85,6 +86,10 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
85
86
  type: PropType<Record<string, string> | null>;
86
87
  default: null;
87
88
  };
89
+ tools: {
90
+ type: PropType<Record<string, UiTool> | null>;
91
+ default: null;
92
+ };
88
93
  activeTool: {
89
94
  type: PropType<string | null>;
90
95
  default: null;
@@ -175,6 +180,10 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
175
180
  type: PropType<Record<string, string> | null>;
176
181
  default: null;
177
182
  };
183
+ tools: {
184
+ type: PropType<Record<string, UiTool> | null>;
185
+ default: null;
186
+ };
178
187
  activeTool: {
179
188
  type: PropType<string | null>;
180
189
  default: null;
@@ -207,6 +216,7 @@ export declare const SealpixelEditor: import("vue").DefineComponent<import("vue"
207
216
  downloadLabel: string | null;
208
217
  locale: string;
209
218
  dictionary: Record<string, string> | null;
219
+ tools: Record<string, UiTool> | null;
210
220
  activeTool: string | null;
211
221
  }, {}, {}, {}, "element" | "getSession" | "getEditLog" | "undo" | "redo" | "export" | "download", import("vue").ComponentProvideOptions, true, {}, any>;
212
222
  /** Headless composable: a session whose state is a shallow ref, disposed with the scope. */
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export const SealpixelEditor = defineComponent({
29
29
  downloadLabel: { type: String, default: null },
30
30
  locale: { type: String, default: 'en' },
31
31
  dictionary: { type: Object, default: null },
32
+ tools: { type: Object, default: null },
32
33
  activeTool: { type: String, default: null },
33
34
  },
34
35
  emits: {
@@ -77,6 +78,7 @@ export const SealpixelEditor = defineComponent({
77
78
  '.output': this.output,
78
79
  '.locale': this.locale,
79
80
  '.dictionary': this.dictionary,
81
+ '.tools': this.tools,
80
82
  '.activeTool': this.activeTool,
81
83
  'onSealpixel:change': (e) => {
82
84
  this.$emit('update:editLog', e.detail);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,GAOpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,oBAAoB,CAAC;AAG5B,OAAO,EAEL,eAAe,EACf,CAAC,EACD,cAAc,EAGd,UAAU,GACX,MAAM,KAAK,CAAC;AASb;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;IAC7C,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE;QACL,GAAG,EAAE;YACH,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAuD;YAC5E,OAAO,EAAE,IAAI;SACd;QACD,OAAO,EAAE,EAAE,IAAI,EAAE,MAAuC,EAAE,OAAO,EAAE,SAAS,EAAE;QAC9E,cAAc,EAAE,EAAE,IAAI,EAAE,MAAuC,EAAE,OAAO,EAAE,SAAS,EAAE;QACrF,OAAO,EAAE,EAAE,IAAI,EAAE,KAA8C,EAAE,OAAO,EAAE,IAAI,EAAE;QAChF,aAAa,EAAE,EAAE,IAAI,EAAE,MAA2C,EAAE,OAAO,EAAE,IAAI,EAAE;QACnF,QAAQ,EAAE,EAAE,IAAI,EAAE,MAAmC,EAAE,OAAO,EAAE,IAAI,EAAE;QACtE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAwC,EAAE,OAAO,EAAE,IAAI,EAAE;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AuB;IAIlD,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;QAC1C,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;IACH,cAAc,CAAC,GAAG,EAAE;QAClB,WAAW,EAAE,CAAC;QACd,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AACD,sBAAsB;AAEtB,mEAAmE;AACnE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,CAAC,GAAQ;QACd,GAAG,CAAC,SAAS,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;CACF,CAAC","sourcesContent":["import type { PluginOptionsMap } from '@sealpixel/core';\nimport {\n createEditorSession,\n type EditorSession,\n type ExportResult,\n type SealpixelError,\n type SessionOptions,\n type SessionState,\n type SourceDescriptor,\n} from '@sealpixel/core';\nimport '@sealpixel/element';\nimport type { AnyPlugin, AssetResolver, OutputOptions, Renderer } from '@sealpixel/core';\nimport type { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';\nimport {\n type App,\n defineComponent,\n h,\n onScopeDispose,\n type PropType,\n type ShallowRef,\n shallowRef,\n} from 'vue';\n\nexport type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';\n\nexport interface EditLogState {\n log: unknown;\n index: number;\n}\n\n/**\n * `<SealpixelEditor>` for Vue 3. `v-model:editLog` gives controlled mode; without\n * it the editor owns the log and emits `change`. Add `sealpixel-editor` to your\n * compiler's `isCustomElement` when you also use the raw tag in templates.\n */\nexport const SealpixelEditor = defineComponent({\n name: 'SealpixelEditor',\n props: {\n src: {\n type: [Object, String] as PropType<File | Blob | Uint8Array | string | null>,\n default: null,\n },\n editLog: { type: Object as PropType<EditLogState | null>, default: undefined },\n defaultEditLog: { type: Object as PropType<EditLogState | null>, default: undefined },\n plugins: { type: Array as PropType<readonly AnyPlugin[] | null>, default: null },\n pluginOptions: { type: Object as PropType<PluginOptionsMap | null>, default: null },\n renderer: { type: Object as PropType<Renderer | null>, default: null },\n assets: { type: Object as PropType<AssetResolver | null>, default: null },\n session: { type: Object as PropType<EditorSession | null>, default: null },\n limits: { type: Object as PropType<SessionOptions['limits'] | null>, default: null },\n output: { type: Object as PropType<OutputOptions>, default: () => ({ format: 'image/png' }) },\n theme: { type: String as PropType<'dark' | 'light' | 'auto'>, default: 'dark' },\n showExport: { type: String as PropType<'auto' | 'always' | 'never'>, default: 'auto' },\n showDownload: { type: String as PropType<'always' | 'never'>, default: 'always' },\n showHistory: { type: String as PropType<'all' | 'buttons' | 'none'>, default: 'all' },\n downloadLabel: { type: String as PropType<string | null>, default: null },\n locale: { type: String, default: 'en' },\n dictionary: { type: Object as PropType<Record<string, string> | null>, default: null },\n activeTool: { type: String as PropType<string | null>, default: null },\n },\n emits: {\n 'update:editLog': (_state: EditLogState) => true,\n change: (_state: EditLogState) => true,\n process: (_result: ExportResult) => true,\n error: (_error: SealpixelError) => true,\n ready: () => true,\n load: (_descriptor: SourceDescriptor) => true,\n },\n // The `expose` option, unlike an `expose()` call, types the template ref.\n expose: ['element', 'getSession', 'getEditLog', 'undo', 'redo', 'export', 'download'],\n setup() {\n const element = shallowRef<SealpixelEditorElement | null>(null);\n return {\n element,\n getSession: (): EditorSession | undefined => element.value?.getSession(),\n getEditLog: (): ReturnType<EditorSession['getEditLog']> | undefined =>\n element.value?.getEditLog(),\n undo: (): void => element.value?.undo(),\n redo: (): void => element.value?.redo(),\n export: (output?: OutputOptions): Promise<ExportResult> | undefined =>\n element.value?.export(output),\n download: (\n options?: Parameters<SealpixelEditorElement['download']>[0],\n ): ReturnType<SealpixelEditorElement['download']> | undefined =>\n element.value?.download(options),\n };\n },\n render() {\n // The element shows Export in `auto` mode while a `sealpixel:process`\n // listener exists, so listen only when the parent listens to `process`.\n const parent = this.$.vnode.props as { onProcess?: unknown; onProcessOnce?: unknown } | null;\n const listensToProcess = Boolean(parent?.onProcess || parent?.onProcessOnce);\n return h('sealpixel-editor', {\n ref: 'element',\n theme: this.theme,\n 'show-export': this.showExport,\n 'show-download': this.showDownload,\n 'show-history': this.showHistory,\n 'download-label': this.downloadLabel ?? undefined,\n '.src': this.src,\n '.editLog': this.editLog,\n '.defaultEditLog': this.defaultEditLog,\n '.plugins': this.plugins,\n '.pluginOptions': this.pluginOptions,\n '.renderer': this.renderer,\n '.assets': this.assets,\n '.session': this.session,\n '.limits': this.limits,\n '.output': this.output,\n '.locale': this.locale,\n '.dictionary': this.dictionary,\n '.activeTool': this.activeTool,\n 'onSealpixel:change': (e: CustomEvent<EditLogState>) => {\n this.$emit('update:editLog', e.detail);\n this.$emit('change', e.detail);\n },\n ...(listensToProcess\n ? {\n 'onSealpixel:process': (e: CustomEvent<ExportResult>) =>\n this.$emit('process', e.detail),\n }\n : {}),\n 'onSealpixel:error': (e: CustomEvent<SealpixelError>) => this.$emit('error', e.detail),\n 'onSealpixel:ready': () => this.$emit('ready'),\n 'onSealpixel:load': (e: CustomEvent<SourceDescriptor>) => this.$emit('load', e.detail),\n });\n },\n});\n\n// #region headless\n/** Headless composable: a session whose state is a shallow ref, disposed with the scope. */\nexport function useSealpixel(options: SessionOptions): {\n session: EditorSession;\n state: ShallowRef<SessionState>;\n} {\n const session = createEditorSession(options);\n const state = shallowRef(session.getState());\n const unsubscribe = session.subscribe((s) => {\n state.value = s;\n });\n onScopeDispose(() => {\n unsubscribe();\n session.dispose();\n });\n return { session, state };\n}\n// #endregion headless\n\n/** `app.use(Sealpixel)` registers `<SealpixelEditor>` globally. */\nexport const Sealpixel = {\n install(app: App) {\n app.component('SealpixelEditor', SealpixelEditor);\n },\n};\n"]}
1
+ {"version":3,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AC,CAAC;IACH,cAAc,CAAC,GAAG,EAAE;QAClB,WAAW,EAAE,CAAC;QACd,OAAO,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AACD,sBAAsB;AAEtB,mEAAmE;AACnE,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,CAAC,GAAQ;QACd,GAAG,CAAC,SAAS,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IACpD,CAAC;CACF,CAAC","sourcesContent":["import type { PluginOptionsMap } from '@sealpixel/core';\nimport {\n createEditorSession,\n type EditorSession,\n type ExportResult,\n type SealpixelError,\n type SessionOptions,\n type SessionState,\n type SourceDescriptor,\n} from '@sealpixel/core';\nimport '@sealpixel/element';\nimport type { AnyPlugin, AssetResolver, OutputOptions, Renderer } from '@sealpixel/core';\nimport type { SealpixelEditor as SealpixelEditorElement } from '@sealpixel/element';\nimport type { UiTool } from '@sealpixel/ui';\nimport {\n type App,\n defineComponent,\n h,\n onScopeDispose,\n type PropType,\n type ShallowRef,\n shallowRef,\n} from 'vue';\n\nexport type { EditorSession, SessionOptions, SessionState } from '@sealpixel/core';\n\nexport interface EditLogState {\n log: unknown;\n index: number;\n}\n\n/**\n * `<SealpixelEditor>` for Vue 3. `v-model:editLog` gives controlled mode; without\n * it the editor owns the log and emits `change`. Add `sealpixel-editor` to your\n * compiler's `isCustomElement` when you also use the raw tag in templates.\n */\nexport const SealpixelEditor = defineComponent({\n name: 'SealpixelEditor',\n props: {\n src: {\n type: [Object, String] as PropType<File | Blob | Uint8Array | string | null>,\n default: null,\n },\n editLog: { type: Object as PropType<EditLogState | null>, default: undefined },\n defaultEditLog: { type: Object as PropType<EditLogState | null>, default: undefined },\n plugins: { type: Array as PropType<readonly AnyPlugin[] | null>, default: null },\n pluginOptions: { type: Object as PropType<PluginOptionsMap | null>, default: null },\n renderer: { type: Object as PropType<Renderer | null>, default: null },\n assets: { type: Object as PropType<AssetResolver | null>, default: null },\n session: { type: Object as PropType<EditorSession | null>, default: null },\n limits: { type: Object as PropType<SessionOptions['limits'] | null>, default: null },\n output: { type: Object as PropType<OutputOptions>, default: () => ({ format: 'image/png' }) },\n theme: { type: String as PropType<'dark' | 'light' | 'auto'>, default: 'dark' },\n showExport: { type: String as PropType<'auto' | 'always' | 'never'>, default: 'auto' },\n showDownload: { type: String as PropType<'always' | 'never'>, default: 'always' },\n showHistory: { type: String as PropType<'all' | 'buttons' | 'none'>, default: 'all' },\n downloadLabel: { type: String as PropType<string | null>, default: null },\n locale: { type: String, default: 'en' },\n dictionary: { type: Object as PropType<Record<string, string> | null>, default: null },\n tools: { type: Object as PropType<Record<string, UiTool> | null>, default: null },\n activeTool: { type: String as PropType<string | null>, default: null },\n },\n emits: {\n 'update:editLog': (_state: EditLogState) => true,\n change: (_state: EditLogState) => true,\n process: (_result: ExportResult) => true,\n error: (_error: SealpixelError) => true,\n ready: () => true,\n load: (_descriptor: SourceDescriptor) => true,\n },\n // The `expose` option, unlike an `expose()` call, types the template ref.\n expose: ['element', 'getSession', 'getEditLog', 'undo', 'redo', 'export', 'download'],\n setup() {\n const element = shallowRef<SealpixelEditorElement | null>(null);\n return {\n element,\n getSession: (): EditorSession | undefined => element.value?.getSession(),\n getEditLog: (): ReturnType<EditorSession['getEditLog']> | undefined =>\n element.value?.getEditLog(),\n undo: (): void => element.value?.undo(),\n redo: (): void => element.value?.redo(),\n export: (output?: OutputOptions): Promise<ExportResult> | undefined =>\n element.value?.export(output),\n download: (\n options?: Parameters<SealpixelEditorElement['download']>[0],\n ): ReturnType<SealpixelEditorElement['download']> | undefined =>\n element.value?.download(options),\n };\n },\n render() {\n // The element shows Export in `auto` mode while a `sealpixel:process`\n // listener exists, so listen only when the parent listens to `process`.\n const parent = this.$.vnode.props as { onProcess?: unknown; onProcessOnce?: unknown } | null;\n const listensToProcess = Boolean(parent?.onProcess || parent?.onProcessOnce);\n return h('sealpixel-editor', {\n ref: 'element',\n theme: this.theme,\n 'show-export': this.showExport,\n 'show-download': this.showDownload,\n 'show-history': this.showHistory,\n 'download-label': this.downloadLabel ?? undefined,\n '.src': this.src,\n '.editLog': this.editLog,\n '.defaultEditLog': this.defaultEditLog,\n '.plugins': this.plugins,\n '.pluginOptions': this.pluginOptions,\n '.renderer': this.renderer,\n '.assets': this.assets,\n '.session': this.session,\n '.limits': this.limits,\n '.output': this.output,\n '.locale': this.locale,\n '.dictionary': this.dictionary,\n '.tools': this.tools,\n '.activeTool': this.activeTool,\n 'onSealpixel:change': (e: CustomEvent<EditLogState>) => {\n this.$emit('update:editLog', e.detail);\n this.$emit('change', e.detail);\n },\n ...(listensToProcess\n ? {\n 'onSealpixel:process': (e: CustomEvent<ExportResult>) =>\n this.$emit('process', e.detail),\n }\n : {}),\n 'onSealpixel:error': (e: CustomEvent<SealpixelError>) => this.$emit('error', e.detail),\n 'onSealpixel:ready': () => this.$emit('ready'),\n 'onSealpixel:load': (e: CustomEvent<SourceDescriptor>) => this.$emit('load', e.detail),\n });\n },\n});\n\n// #region headless\n/** Headless composable: a session whose state is a shallow ref, disposed with the scope. */\nexport function useSealpixel(options: SessionOptions): {\n session: EditorSession;\n state: ShallowRef<SessionState>;\n} {\n const session = createEditorSession(options);\n const state = shallowRef(session.getState());\n const unsubscribe = session.subscribe((s) => {\n state.value = s;\n });\n onScopeDispose(() => {\n unsubscribe();\n session.dispose();\n });\n return { session, state };\n}\n// #endregion headless\n\n/** `app.use(Sealpixel)` registers `<SealpixelEditor>` globally. */\nexport const Sealpixel = {\n install(app: App) {\n app.component('SealpixelEditor', SealpixelEditor);\n },\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealpixel/vue",
3
- "version": "1.0.0-rc.21",
3
+ "version": "1.0.0-rc.22",
4
4
  "description": "Vue 3 bindings for the Sealpixel image editor: <SealpixelEditor> with v-model:editLog and the useSealpixel composable.",
5
5
  "license": "BUSL-1.1",
6
6
  "repository": {
@@ -24,9 +24,9 @@
24
24
  "./package.json": "./package.json"
25
25
  },
26
26
  "dependencies": {
27
- "@sealpixel/core": "1.0.0-rc.21",
28
- "@sealpixel/element": "1.0.0-rc.21",
29
- "@sealpixel/ui": "1.0.0-rc.21"
27
+ "@sealpixel/core": "1.0.0-rc.22",
28
+ "@sealpixel/element": "1.0.0-rc.22",
29
+ "@sealpixel/ui": "1.0.0-rc.22"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "vue": "^3.4.0"