@emailmaker/filemanager 0.0.6 → 0.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.
@@ -19,6 +19,8 @@ See the Apache Version 2.0 License for specific language governing permissions
19
19
  and limitations under the License.
20
20
  ***************************************************************************** */
21
21
 
22
+ /*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */
23
+
22
24
  /**
23
25
  * @license
24
26
  * Lodash <https://lodash.com/>
@@ -58,6 +60,16 @@ and limitations under the License.
58
60
  * LICENSE file in the root directory of this source tree.
59
61
  */
60
62
 
63
+ /**
64
+ * @license React
65
+ * react-jsx-runtime.production.min.js
66
+ *
67
+ * Copyright (c) Facebook, Inc. and its affiliates.
68
+ *
69
+ * This source code is licensed under the MIT license found in the
70
+ * LICENSE file in the root directory of this source tree.
71
+ */
72
+
61
73
  /**
62
74
  * @license React
63
75
  * scheduler.production.js
@@ -68,6 +80,81 @@ and limitations under the License.
68
80
  * LICENSE file in the root directory of this source tree.
69
81
  */
70
82
 
83
+ /**
84
+ * @license React
85
+ * use-sync-external-store-shim.production.min.js
86
+ *
87
+ * Copyright (c) Facebook, Inc. and its affiliates.
88
+ *
89
+ * This source code is licensed under the MIT license found in the
90
+ * LICENSE file in the root directory of this source tree.
91
+ */
92
+
93
+ /**
94
+ * @license React
95
+ * use-sync-external-store-shim/with-selector.production.min.js
96
+ *
97
+ * Copyright (c) Facebook, Inc. and its affiliates.
98
+ *
99
+ * This source code is licensed under the MIT license found in the
100
+ * LICENSE file in the root directory of this source tree.
101
+ */
102
+
103
+ /**
104
+ * @remix-run/router v1.0.1
105
+ *
106
+ * Copyright (c) Remix Software Inc.
107
+ *
108
+ * This source code is licensed under the MIT license found in the
109
+ * LICENSE.md file in the root directory of this source tree.
110
+ *
111
+ * @license MIT
112
+ */
113
+
114
+ /**
115
+ * React Router DOM v6.4.1
116
+ *
117
+ * Copyright (c) Remix Software Inc.
118
+ *
119
+ * This source code is licensed under the MIT license found in the
120
+ * LICENSE.md file in the root directory of this source tree.
121
+ *
122
+ * @license MIT
123
+ */
124
+
125
+ /**
126
+ * React Router v6.4.1
127
+ *
128
+ * Copyright (c) Remix Software Inc.
129
+ *
130
+ * This source code is licensed under the MIT license found in the
131
+ * LICENSE.md file in the root directory of this source tree.
132
+ *
133
+ * @license MIT
134
+ */
135
+
136
+ /**
137
+ * react-virtual
138
+ *
139
+ * Copyright (c) TanStack
140
+ *
141
+ * This source code is licensed under the MIT license found in the
142
+ * LICENSE.md file in the root directory of this source tree.
143
+ *
144
+ * @license MIT
145
+ */
146
+
147
+ /**
148
+ * virtual-core
149
+ *
150
+ * Copyright (c) TanStack
151
+ *
152
+ * This source code is licensed under the MIT license found in the
153
+ * LICENSE.md file in the root directory of this source tree.
154
+ *
155
+ * @license MIT
156
+ */
157
+
71
158
  /**![appstore](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQ2NCAxNDRIMTYwYy04LjggMC0xNiA3LjItMTYgMTZ2MzA0YzAgOC44IDcuMiAxNiAxNiAxNmgzMDRjOC44IDAgMTYtNy4yIDE2LTE2VjE2MGMwLTguOC03LjItMTYtMTYtMTZ6bS01MiAyNjhIMjEyVjIxMmgyMDB2MjAwem00NTItMjY4SDU2MGMtOC44IDAtMTYgNy4yLTE2IDE2djMwNGMwIDguOCA3LjIgMTYgMTYgMTZoMzA0YzguOCAwIDE2LTcuMiAxNi0xNlYxNjBjMC04LjgtNy4yLTE2LTE2LTE2em0tNTIgMjY4SDYxMlYyMTJoMjAwdjIwMHpNNDY0IDU0NEgxNjBjLTguOCAwLTE2IDcuMi0xNiAxNnYzMDRjMCA4LjggNy4yIDE2IDE2IDE2aDMwNGM4LjggMCAxNi03LjIgMTYtMTZWNTYwYzAtOC44LTcuMi0xNi0xNi0xNnptLTUyIDI2OEgyMTJWNjEyaDIwMHYyMDB6bTQ1Mi0yNjhINTYwYy04LjggMC0xNiA3LjItMTYgMTZ2MzA0YzAgOC44IDcuMiAxNiAxNiAxNmgzMDRjOC44IDAgMTYtNy4yIDE2LTE2VjU2MGMwLTguOC03LjItMTYtMTYtMTZ6bS01MiAyNjhINjEyVjYxMmgyMDB2MjAweiIgLz48L3N2Zz4=) */
72
159
 
73
160
  /**![arrow-left](data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAiIGhlaWdodD0iNTAiIGZpbGw9IiNjYWNhY2EiIHZpZXdCb3g9IjY0IDY0IDg5NiA4OTYiIGZvY3VzYWJsZT0iZmFsc2UiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTg3MiA0NzRIMjg2LjlsMzUwLjItMzA0YzUuNi00LjkgMi4yLTE0LTUuMi0xNGgtODguNWMtMy45IDAtNy42IDEuNC0xMC41IDMuOUwxNTUgNDg3LjhhMzEuOTYgMzEuOTYgMCAwMDAgNDguM0w1MzUuMSA4NjZjMS41IDEuMyAzLjMgMiA1LjIgMmg5MS41YzcuNCAwIDEwLjgtOS4yIDUuMi0xNEwyODYuOSA1NTBIODcyYzQuNCAwIDgtMy42IDgtOHYtNjBjMC00LjQtMy42LTgtOC04eiIgLz48L3N2Zz4=) */
@@ -13,6 +13,9 @@ export interface UseFilesModalsActions {
13
13
  showCopyModal: () => void;
14
14
  handleCopyCancel: () => void;
15
15
  handleCopyOk: () => Promise<void>;
16
+ showDeleteConfirm: () => void;
17
+ handleDeleteConfirmCancel: () => void;
18
+ handleDeleteConfirmOk: () => Promise<void>;
16
19
  }
17
20
  export declare const useFilesModals: (fetchFiles: (params?: FilesQueryParams) => Promise<void>) => {
18
21
  state: UseFilesModalsState;
@@ -26,6 +26,7 @@ export interface FileManagerState {
26
26
  isMoveModalVisible: boolean;
27
27
  isRenameFolderModalVisible: boolean;
28
28
  isCopyModalVisible: boolean;
29
+ isDeleteConfirmVisible: boolean;
29
30
  form: FormInstance;
30
31
  urlForm: FormInstance;
31
32
  renameForm: FormInstance;
@@ -54,6 +55,7 @@ export interface FileManagerActions {
54
55
  setIsMoveModalVisible: (visible: boolean) => void;
55
56
  setIsRenameFolderModalVisible: (visible: boolean) => void;
56
57
  setIsCopyModalVisible: (visible: boolean) => void;
58
+ setIsDeleteConfirmVisible: (visible: boolean) => void;
57
59
  setFileToRename: (fileId: string | null) => void;
58
60
  setActiveLibraryItem: (item: LibraryMenuKey) => void;
59
61
  setFolderToRename: (folderId: string | null) => void;
@@ -81,6 +83,9 @@ export interface FileManagerActions {
81
83
  showCopyModal: () => void;
82
84
  handleCopyCancel: () => void;
83
85
  handleCopyOk: () => Promise<void>;
86
+ showDeleteConfirm?: () => void;
87
+ handleDeleteConfirmCancel?: () => void;
88
+ handleDeleteConfirmOk?: () => Promise<void>;
84
89
  }
85
90
  export interface FileManagerContext {
86
91
  apiEndpoints: Record<string, string | undefined>;
@@ -31,6 +31,9 @@ export interface UseFilesActions {
31
31
  handleCopyCancel: () => void;
32
32
  handleCopyOk: () => Promise<void>;
33
33
  uploadFileWithProvider: (file: globalThis.File) => Promise<AppFile | void>;
34
+ showDeleteConfirm: () => void;
35
+ handleDeleteConfirmCancel: () => void;
36
+ handleDeleteConfirmOk: () => Promise<void>;
34
37
  }
35
38
  export declare const useFiles: () => FileManagerHookBase & {
36
39
  state: UseFilesState;
@@ -8,9 +8,10 @@ interface UseFileActionsProps {
8
8
  showCopyModal: () => void;
9
9
  handleDeleteFile: (fileId: string) => void;
10
10
  handleDeleteFolder: (folderId: string) => void;
11
+ showDeleteConfirm?: () => void;
11
12
  onEdit: (file?: AppFile | ThumbnailFile) => void;
12
13
  }
13
- export declare const useFileActions: ({ files, selectedFiles, toggleFileSelection, showRenameModal, showMoveModal, showCopyModal, handleDeleteFile, handleDeleteFolder, onEdit, }: UseFileActionsProps) => {
14
+ export declare const useFileActions: ({ files, selectedFiles, toggleFileSelection, showRenameModal, showMoveModal, showCopyModal, handleDeleteFile, handleDeleteFolder, showDeleteConfirm, onEdit, }: UseFileActionsProps) => {
14
15
  handleClearSelection: () => void;
15
16
  handleRename: () => void;
16
17
  handleDeleteSelected: () => void;
@@ -1,8 +1,8 @@
1
1
  export declare const useNotifications: () => {
2
- error: (args: import("antd").NotificationArgsProps) => void;
3
- open: (args: import("antd").NotificationArgsProps) => void;
4
2
  success: (args: import("antd").NotificationArgsProps) => void;
3
+ error: (args: import("antd").NotificationArgsProps) => void;
5
4
  info: (args: import("antd").NotificationArgsProps) => void;
6
5
  warning: (args: import("antd").NotificationArgsProps) => void;
6
+ open: (args: import("antd").NotificationArgsProps) => void;
7
7
  destroy(key?: React.Key): void;
8
8
  };
package/index.d.ts CHANGED
@@ -1,8 +1,15 @@
1
- import { init, unmount, FileManagerAppWithContext } from './file-manager';
2
- export { init, unmount, FileManagerAppWithContext };
1
+ import { init, unmount, FileManagerAppWithContext, initPixieEditor, unmountPixieEditor, initFileManager, PixieOnlyApp } from './file-manager';
2
+ export { init, unmount, FileManagerAppWithContext, PixieOnlyApp, initPixieEditor, unmountPixieEditor, initFileManager };
3
3
  declare const _default: {
4
4
  init: (containerOrOptions: HTMLElement | import("./file-manager").Options, config?: import("./types").Config) => void;
5
5
  unmount: (container: HTMLElement) => void;
6
+ initPixieEditor: (options: import("./file-manager").InitPixieEditorOptions) => void;
7
+ unmountPixieEditor: (container: HTMLElement) => void;
8
+ initFileManager: (options: import("./file-manager").UniversalInitOptions) => {
9
+ unmount: () => void;
10
+ unmountFileManager?: () => void;
11
+ unmountPixieEditor?: () => void;
12
+ };
6
13
  };
7
14
  export default _default;
8
15
  export { FileManagerApp } from './components/FileManagerApp/FileManagerApp';
@@ -11,3 +18,4 @@ export { FileModals } from './components/FileModals/FileModals';
11
18
  export { FolderSidebar } from './components/FolderSidebar/FolderSidebar';
12
19
  export { installResizeObserverErrorHandler, uninstallResizeObserverErrorHandler } from './utils/resizeObserverHandler';
13
20
  export { type Folder, type File, type PathItem, type MenuItem, type FileManagerOptions, type FileManagerHookReturn, } from './types';
21
+ export { type InitPixieEditorOptions, type Options as FileManagerInitOptions, type UniversalInitOptions, } from './file-manager';
@@ -1 +1 @@
1
- const PACKAGE_VERSION="2.10.4",INTEGRITY_CHECKSUM="f5825c521429caf22a4dd13b66e243af",IS_MOCKED_RESPONSE=Symbol("isMockedResponse"),activeClientIds=new Set;async function handleRequest(e,t){const n=await resolveMainClient(e),s=e.request.clone(),i=await getResponse(e,n,t);if(n&&activeClientIds.has(n.id)){const e=await serializeRequest(s),a=i.clone();sendToClient(n,{type:"RESPONSE",payload:{isMockedResponse:IS_MOCKED_RESPONSE in i,request:{id:t,...e},response:{type:a.type,status:a.status,statusText:a.statusText,headers:Object.fromEntries(a.headers.entries()),body:a.body}}},a.body?[e.body,a.body]:[])}return i}async function resolveMainClient(e){const t=await self.clients.get(e.clientId);return activeClientIds.has(e.clientId)||"top-level"===t?.frameType?t:(await self.clients.matchAll({type:"window"})).filter(e=>"visible"===e.visibilityState).find(e=>activeClientIds.has(e.id))}async function getResponse(e,t,n){const s=e.request.clone();function i(){const e=new Headers(s.headers),t=e.get("accept");if(t){const n=t.split(",").map(e=>e.trim()).filter(e=>"msw/passthrough"!==e);n.length>0?e.set("accept",n.join(", ")):e.delete("accept")}return fetch(s,{headers:e})}if(!t)return i();if(!activeClientIds.has(t.id))return i();const a=await serializeRequest(e.request),r=await sendToClient(t,{type:"REQUEST",payload:{id:n,...a}},[a.body]);switch(r.type){case"MOCK_RESPONSE":return respondWithMock(r.data);case"PASSTHROUGH":return i()}return i()}function sendToClient(e,t,n=[]){return new Promise((s,i)=>{const a=new MessageChannel;a.port1.onmessage=e=>{if(e.data&&e.data.error)return i(e.data.error);s(e.data)},e.postMessage(t,[a.port2,...n.filter(Boolean)])})}function respondWithMock(e){if(0===e.status)return Response.error();const t=new Response(e.body,e);return Reflect.defineProperty(t,IS_MOCKED_RESPONSE,{value:!0,enumerable:!0}),t}async function serializeRequest(e){return{url:e.url,mode:e.mode,method:e.method,headers:Object.fromEntries(e.headers.entries()),cache:e.cache,credentials:e.credentials,destination:e.destination,integrity:e.integrity,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,body:await e.arrayBuffer(),keepalive:e.keepalive}}addEventListener("install",function(){self.skipWaiting()}),addEventListener("activate",function(e){e.waitUntil(self.clients.claim())}),addEventListener("message",async function(e){const t=Reflect.get(e.source||{},"id");if(!t||!self.clients)return;const n=await self.clients.get(t);if(!n)return;const s=await self.clients.matchAll({type:"window"});switch(e.data){case"KEEPALIVE_REQUEST":sendToClient(n,{type:"KEEPALIVE_RESPONSE"});break;case"INTEGRITY_CHECK_REQUEST":sendToClient(n,{type:"INTEGRITY_CHECK_RESPONSE",payload:{packageVersion:"2.10.4",checksum:INTEGRITY_CHECKSUM}});break;case"MOCK_ACTIVATE":activeClientIds.add(t),sendToClient(n,{type:"MOCKING_ENABLED",payload:{client:{id:n.id,frameType:n.frameType}}});break;case"MOCK_DEACTIVATE":activeClientIds.delete(t);break;case"CLIENT_CLOSED":{activeClientIds.delete(t);const e=s.filter(e=>e.id!==t);0===e.length&&self.registration.unregister();break}}}),addEventListener("fetch",function(e){if("navigate"===e.request.mode)return;if("only-if-cached"===e.request.cache&&"same-origin"!==e.request.mode)return;if(0===activeClientIds.size)return;const t=crypto.randomUUID();e.respondWith(handleRequest(e,t))});
1
+ const PACKAGE_VERSION="2.10.5",INTEGRITY_CHECKSUM="f5825c521429caf22a4dd13b66e243af",IS_MOCKED_RESPONSE=Symbol("isMockedResponse"),activeClientIds=new Set;async function handleRequest(e,t){const n=await resolveMainClient(e),s=e.request.clone(),i=await getResponse(e,n,t);if(n&&activeClientIds.has(n.id)){const e=await serializeRequest(s),a=i.clone();sendToClient(n,{type:"RESPONSE",payload:{isMockedResponse:IS_MOCKED_RESPONSE in i,request:{id:t,...e},response:{type:a.type,status:a.status,statusText:a.statusText,headers:Object.fromEntries(a.headers.entries()),body:a.body}}},a.body?[e.body,a.body]:[])}return i}async function resolveMainClient(e){const t=await self.clients.get(e.clientId);return activeClientIds.has(e.clientId)||"top-level"===t?.frameType?t:(await self.clients.matchAll({type:"window"})).filter(e=>"visible"===e.visibilityState).find(e=>activeClientIds.has(e.id))}async function getResponse(e,t,n){const s=e.request.clone();function i(){const e=new Headers(s.headers),t=e.get("accept");if(t){const n=t.split(",").map(e=>e.trim()).filter(e=>"msw/passthrough"!==e);n.length>0?e.set("accept",n.join(", ")):e.delete("accept")}return fetch(s,{headers:e})}if(!t)return i();if(!activeClientIds.has(t.id))return i();const a=await serializeRequest(e.request),r=await sendToClient(t,{type:"REQUEST",payload:{id:n,...a}},[a.body]);switch(r.type){case"MOCK_RESPONSE":return respondWithMock(r.data);case"PASSTHROUGH":return i()}return i()}function sendToClient(e,t,n=[]){return new Promise((s,i)=>{const a=new MessageChannel;a.port1.onmessage=e=>{if(e.data&&e.data.error)return i(e.data.error);s(e.data)},e.postMessage(t,[a.port2,...n.filter(Boolean)])})}function respondWithMock(e){if(0===e.status)return Response.error();const t=new Response(e.body,e);return Reflect.defineProperty(t,IS_MOCKED_RESPONSE,{value:!0,enumerable:!0}),t}async function serializeRequest(e){return{url:e.url,mode:e.mode,method:e.method,headers:Object.fromEntries(e.headers.entries()),cache:e.cache,credentials:e.credentials,destination:e.destination,integrity:e.integrity,redirect:e.redirect,referrer:e.referrer,referrerPolicy:e.referrerPolicy,body:await e.arrayBuffer(),keepalive:e.keepalive}}addEventListener("install",function(){self.skipWaiting()}),addEventListener("activate",function(e){e.waitUntil(self.clients.claim())}),addEventListener("message",async function(e){const t=Reflect.get(e.source||{},"id");if(!t||!self.clients)return;const n=await self.clients.get(t);if(!n)return;const s=await self.clients.matchAll({type:"window"});switch(e.data){case"KEEPALIVE_REQUEST":sendToClient(n,{type:"KEEPALIVE_RESPONSE"});break;case"INTEGRITY_CHECK_REQUEST":sendToClient(n,{type:"INTEGRITY_CHECK_RESPONSE",payload:{packageVersion:"2.10.5",checksum:INTEGRITY_CHECKSUM}});break;case"MOCK_ACTIVATE":activeClientIds.add(t),sendToClient(n,{type:"MOCKING_ENABLED",payload:{client:{id:n.id,frameType:n.frameType}}});break;case"MOCK_DEACTIVATE":activeClientIds.delete(t);break;case"CLIENT_CLOSED":{activeClientIds.delete(t);const e=s.filter(e=>e.id!==t);0===e.length&&self.registration.unregister();break}}}),addEventListener("fetch",function(e){if("navigate"===e.request.mode)return;if("only-if-cached"===e.request.cache&&"same-origin"!==e.request.mode)return;if(0===activeClientIds.size)return;const t=crypto.randomUUID();e.respondWith(handleRequest(e,t))});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailmaker/filemanager",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "main": "./file-manager.js",
5
5
  "module": "./file-manager.esm.js",
6
6
  "types": "./index.d.ts",
package/types.d.ts CHANGED
@@ -119,7 +119,6 @@ export interface FileManagerOptions {
119
119
  onChangeSelection?: (files: File[]) => void;
120
120
  onEditorOk?: (file: File) => void;
121
121
  config?: Config;
122
- publicPath?: string;
123
122
  customIcons?: CustomIcons;
124
123
  dragDropIcon?: string;
125
124
  notification?: Partial<Omit<NotificationInstance, 'destroy'>>;
@@ -142,6 +141,7 @@ export interface FileManagerDataProviders {
142
141
  name: string;
143
142
  parentId?: string | null;
144
143
  }) => Promise<Folder>;
144
+ renameFolder?: (folderId: string, newName: string) => Promise<Folder>;
145
145
  deleteFolder?: (folderId: string) => Promise<boolean>;
146
146
  uploadFile: (file: {
147
147
  name: string;
@@ -166,6 +166,15 @@ export interface FileManagerDataProviders {
166
166
  targetFolderId: string;
167
167
  isFolder: boolean;
168
168
  }) => Promise<boolean>;
169
+ updateFile?: (fileId: string, updates: {
170
+ name?: string;
171
+ type?: string;
172
+ data?: Blob | string;
173
+ thumbnail?: string;
174
+ dimensions?: string;
175
+ aspectRatio?: string;
176
+ extension?: string;
177
+ }) => Promise<File>;
169
178
  }
170
179
  export interface FileManagerHookReturn {
171
180
  folders: Folder[];
@@ -226,6 +235,9 @@ interface Limits {
226
235
  ai_img_limit?: number;
227
236
  ai_generator_limit?: number;
228
237
  }
238
+ export type CustomTheme = Partial<import('antd/es/theme/interface').AliasToken> & {
239
+ [key: string]: string | number | boolean | undefined;
240
+ };
229
241
  export interface Config {
230
242
  theme?: 'light' | 'dark';
231
243
  disableMockServer?: boolean;
@@ -242,33 +254,7 @@ export interface Config {
242
254
  files?: File[];
243
255
  folders?: Folder[];
244
256
  };
245
- customTheme?: {
246
- colors?: {
247
- primary?: string;
248
- secondary?: string;
249
- success?: string;
250
- warning?: string;
251
- error?: string;
252
- info?: string;
253
- textPrimary?: string;
254
- textSecondary?: string;
255
- textTertiary?: string;
256
- bgPrimary?: string;
257
- bgSecondary?: string;
258
- bgTertiary?: string;
259
- borderPrimary?: string;
260
- borderSecondary?: string;
261
- };
262
- borderRadius?: {
263
- none?: string;
264
- xs?: string;
265
- sm?: string;
266
- md?: string;
267
- lg?: string;
268
- xl?: string;
269
- full?: string;
270
- };
271
- };
257
+ customTheme?: CustomTheme;
272
258
  UNSPLASH_KEY?: string;
273
259
  APP_NAME_UNSPLASH?: string;
274
260
  pushToGTM?: boolean;
@@ -290,7 +276,6 @@ export interface Config {
290
276
  handleLimitUsageEmitter?: {
291
277
  fire: (args: object) => void;
292
278
  };
293
- token?: Partial<import('antd/es/theme/interface').AliasToken>;
294
279
  }
295
280
  export type LibraryMenuKey = typeof MY_FILES | typeof GIF | typeof STOCK_IMAGES | typeof AI | typeof EDITOR;
296
281
  export interface GifItem {
@@ -407,7 +392,6 @@ export type MessageType = {
407
392
  [key: string]: unknown;
408
393
  };
409
394
  export interface FileManagerProps {
410
- publicPath?: string;
411
395
  config?: Config;
412
396
  currentPath?: string;
413
397
  onPathChange?: (path: string[]) => void;
@@ -25,6 +25,7 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
25
25
  name: string;
26
26
  parentId?: string | null;
27
27
  }) => Promise<Folder>;
28
+ renameFolder: (folderId: string, newName: string) => Promise<Folder>;
28
29
  deleteFolder: (folderId: string) => Promise<boolean>;
29
30
  uploadFile: (file: {
30
31
  name: string;
@@ -42,6 +43,15 @@ export declare class JSONDataProvider implements FileManagerDataProviders {
42
43
  folderId?: string | null;
43
44
  noFolder?: boolean;
44
45
  }) => Promise<File>;
46
+ updateFile: (fileId: string, updates: {
47
+ name?: string;
48
+ type?: string;
49
+ data?: Blob | string;
50
+ thumbnail?: string;
51
+ dimensions?: string;
52
+ aspectRatio?: string;
53
+ extension?: string;
54
+ }) => Promise<File>;
45
55
  deleteFile: (fileId: string) => Promise<boolean>;
46
56
  renameFile: (fileId: string, newName: string) => Promise<File>;
47
57
  moveItem: (options: {
@@ -1,17 +1,8 @@
1
1
  import { Config } from '../types';
2
- /**
3
- * Применяет кастомную тему к CSS переменным
4
- */
2
+ export declare const switchThemeVariables: (token?: {}) => void;
3
+ /** Применяет кастомную тему к CSS переменным */
5
4
  export declare const applyCustomTheme: (config?: Config) => void;
6
- /**
7
- * Сбрасывает кастомную тему к значениям по умолчанию
8
- */
9
- export declare const resetCustomTheme: () => void;
10
- /**
11
- * Устанавливает тему (светлая/темная)
12
- */
5
+ /** Устанавливает тему (светлая/темная) */
13
6
  export declare const setTheme: (theme: "light" | "dark") => void;
14
- /**
15
- * Получает текущую тему
16
- */
7
+ /** Получает текущую тему */
17
8
  export declare const getCurrentTheme: () => "light" | "dark";
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { File as AppFile, ThumbnailFile } from '../../types';
3
- interface PixieEditorIframeProps {
4
- visible: boolean;
5
- onClose: () => void;
6
- file: AppFile | ThumbnailFile | null;
7
- onSave: (updatedFile: AppFile) => Promise<AppFile | void>;
8
- }
9
- export declare const PixieEditorIframe: React.FC<PixieEditorIframeProps>;
10
- export {};
package/pixie-editor.html DELETED
@@ -1,187 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="ru">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Pixie Editor</title>
7
- <style>
8
- * {
9
- margin: 0;
10
- padding: 0;
11
- box-sizing: border-box;
12
- }
13
-
14
- body {
15
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
16
- background: #f5f5f5;
17
- overflow: hidden;
18
- }
19
-
20
- #pixie-editor {
21
- width: 100vw;
22
- height: 100vh;
23
- }
24
-
25
- .loading {
26
- position: fixed;
27
- top: 50%;
28
- left: 50%;
29
- transform: translate(-50%, -50%);
30
- background: white;
31
- padding: 20px;
32
- border-radius: 8px;
33
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
34
- z-index: 1000;
35
- }
36
-
37
- .toolbar {
38
- position: fixed;
39
- bottom: 10px;
40
- right: 10px;
41
- z-index: 1001;
42
- display: flex;
43
- gap: 10px;
44
- }
45
-
46
- .toolbar button {
47
- padding: 8px 16px;
48
- border: none;
49
- border-radius: 4px;
50
- cursor: pointer;
51
- font-size: 14px;
52
- font-weight: 500;
53
- }
54
-
55
- .btn-save {
56
- background: #1890ff;
57
- color: white;
58
- }
59
-
60
- .btn-save:hover {
61
- background: #40a9ff;
62
- }
63
-
64
- .btn-cancel {
65
- background: #f5f5f5;
66
- color: #595959;
67
- }
68
-
69
- .btn-cancel:hover {
70
- background: #e6f7ff;
71
- }
72
-
73
- .btn-save:disabled {
74
- background: #d9d9d9;
75
- cursor: not-allowed;
76
- }
77
- </style>
78
- </head>
79
- <body>
80
- <div id="loading" class="loading">
81
- <div>Загрузка редактора...</div>
82
- </div>
83
-
84
- <div class="toolbar">
85
- <button id="saveBtn" class="btn-save" disabled>Сохранить</button>
86
- <button id="cancelBtn" class="btn-cancel">Отмена</button>
87
- </div>
88
-
89
- <div id="pixie-editor"></div>
90
-
91
- <script src="loacal_module/pixie/dist/pixie.umd.js"></script>
92
- <script>
93
- let pixieInstance = null;
94
- let currentFile = null;
95
-
96
- function initPixie(imageData, fileName) {
97
- try {
98
- console.log('Инициализация Pixie для файла:', fileName);
99
-
100
- const config = {
101
- selector: '#pixie-editor',
102
- image: imageData,
103
- baseUrl: "/loacal_module/pixie/assets",
104
- ui: {
105
- visible: true,
106
- mode: 'inline',
107
- toolbar: {
108
- items: ['crop', 'resize', 'filter', 'draw', 'text', 'shapes', 'frame']
109
- }
110
- },
111
- crossOrigin: true
112
- };
113
-
114
- if (window.Pixie) {
115
- pixieInstance = new window.Pixie(config);
116
-
117
- setTimeout(() => {
118
- document.getElementById('loading').style.display = 'none';
119
- document.getElementById('saveBtn').disabled = false;
120
- console.log('Pixie успешно инициализирован');
121
- }, 1000);
122
- } else {
123
- throw new Error('Pixie не загружен');
124
- }
125
- } catch (error) {
126
- console.error('Ошибка инициализации Pixie:', error);
127
- document.getElementById('loading').innerHTML = '<div>Ошибка загрузки: ' + error.message + '</div>';
128
- }
129
- }
130
- document.getElementById('saveBtn').addEventListener('click', async () => {
131
- if (!pixieInstance || !currentFile) return;
132
-
133
- try {
134
- document.getElementById('saveBtn').disabled = true;
135
- document.getElementById('saveBtn').textContent = 'Сохранение...';
136
-
137
-
138
- const dataUrl = await pixieInstance.tools.export.getDataUrl("png", 0.9);
139
- window.parent.postMessage({
140
- type: 'PIXIE_SAVE',
141
- data: {
142
- file: currentFile,
143
- imageData: dataUrl
144
- }
145
- }, '*');
146
-
147
- } catch (error) {
148
- console.error('Ошибка сохранения:', error);
149
- alert('Ошибка при сохранении изображения');
150
- document.getElementById('saveBtn').disabled = false;
151
- document.getElementById('saveBtn').textContent = 'Сохранить';
152
- }
153
- });
154
-
155
- document.getElementById('cancelBtn').addEventListener('click', () => {
156
- window.parent.postMessage({
157
- type: 'PIXIE_CANCEL'
158
- }, '*');
159
- });
160
-
161
- window.addEventListener('message', (event) => {
162
- if (event.data.type === 'INIT_PIXIE') {
163
- currentFile = event.data.file;
164
- const imageData = event.data.imageData;
165
- initPixie(imageData, currentFile.name);
166
- }
167
- });
168
-
169
- window.addEventListener('load', () => {
170
- window.parent.postMessage({
171
- type: 'PIXIE_READY'
172
- }, '*');
173
- });
174
-
175
- window.addEventListener('beforeunload', () => {
176
- if (pixieInstance) {
177
- try {
178
- pixieInstance.close?.();
179
- pixieInstance.destroy?.();
180
- } catch (error) {
181
- console.warn('Ошибка при закрытии Pixie:', error);
182
- }
183
- }
184
- });
185
- </script>
186
- </body>
187
- </html>