@emailmaker/filemanager 1.1.93 → 1.1.102
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/.build-meta.json +1 -1
- package/assets/icon-sets/lucide.json +6275 -0
- package/assets/icon-sets/tabler.json +19336 -0
- package/components/FilerobotEditor/FilerobotEditor.d.ts +1 -0
- package/components/FilerobotEditor/cornerRadius/CornerRadiusTool.d.ts +22 -0
- package/components/FilerobotEditor/cornerRadius/__tests__/cornerRadiusMath.test.d.ts +1 -0
- package/components/FilerobotEditor/cornerRadius/__tests__/cornerRadiusOutput.test.d.ts +1 -0
- package/components/FilerobotEditor/cornerRadius/__tests__/imageEditorTools.test.d.ts +1 -0
- package/components/FilerobotEditor/cornerRadius/cornerRadiusEraser.d.ts +17 -0
- package/components/FilerobotEditor/cornerRadius/cornerRadiusMath.d.ts +38 -0
- package/components/FilerobotEditor/cornerRadius/cornerRadiusOutput.d.ts +18 -0
- package/components/FilerobotEditor/cornerRadius/imageEditorTools.d.ts +11 -0
- package/components/FilerobotEditor/cornerRadius/useCornerRadiusSync.d.ts +23 -0
- package/components/ImageIcons/iconSets.d.ts +38 -0
- package/components/ImageIcons/iconSets.test.d.ts +1 -0
- package/components/ImageIcons/iconStockSearch.d.ts +3 -1
- package/components/ImageIcons/packagedIconSets.d.ts +9 -0
- package/core.d.ts +1 -0
- package/core.esm.js +272 -259
- package/core.js +1 -1
- package/file-manager-FilerobotEditor.js +576 -0
- package/file-manager-IconsTab.js +2083 -0
- package/{file-manager-ImageCodeGenerator-m06RVQr7.js → file-manager-ImageCodeGenerator.js} +8 -8
- package/{file-manager-JsBarcode-CyaffT5b.js → file-manager-JsBarcode.js} +30 -30
- package/{file-manager-browser-DDyRNDQk.js → file-manager-browser.js} +8 -8
- package/{file-manager-hooks-UP2zpv8z.js → file-manager-hooks-BDRRCedE.js} +4792 -2384
- package/file-manager-imageEditorCropPresets-en0_jYEY.js +76 -0
- package/{file-manager-rolldown-runtime-DAVfCfog.js → file-manager-rolldown-runtime-DawGUBAG.js} +2 -2
- package/{file-manager-useMediaListEngine-B9sz3gcs.js → file-manager-urls-rCuqY9r4.js} +139 -119
- package/file-manager.esm.js +2332 -2277
- package/file-manager.js +12 -12
- package/helpers/__tests__/applyImageEditorTranslations.test.d.ts +1 -0
- package/helpers/__tests__/imageEditorCropPresets.test.d.ts +1 -0
- package/helpers/__tests__/locales.test.d.ts +1 -0
- package/helpers/applyImageEditorTranslations.d.ts +6 -0
- package/helpers/imageEditorCropPresets.d.ts +8 -0
- package/index.d.ts +2 -0
- package/package.json +5 -1
- package/types.d.ts +18 -0
- package/utils/filerobotEditorConfig.d.ts +1 -0
- package/utils/generateId.d.ts +5 -0
- package/utils/imageCompression.d.ts +10 -0
- package/utils/imageCompression.editedImage.test.d.ts +1 -0
- package/utils/imageCompression.png.test.d.ts +1 -0
- package/utils/pngCompression.d.ts +23 -0
- package/utils/pngCompression.test.d.ts +1 -0
- package/file-manager-FilerobotEditor-WbM5WTct.js +0 -330
- package/file-manager-IconsTab-CCn0Q0ng.js +0 -2434
- package/file-manager-imageEditorTranslations-CtNVql-A.js +0 -38
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FilerobotSavePayload } from '../../types';
|
|
3
3
|
import { File as AppFile, ThumbnailFile } from '../../types';
|
|
4
|
+
export { useCornerRadiusSync } from './cornerRadius/useCornerRadiusSync';
|
|
4
5
|
export interface FilerobotEditorProps {
|
|
5
6
|
visible: boolean;
|
|
6
7
|
onClose?: () => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CornerRadiusState } from './cornerRadiusMath';
|
|
3
|
+
type Translate = (key: string) => string;
|
|
4
|
+
/** CornerRadiusToolConfig is the editor config entry the tool reports its state through. */
|
|
5
|
+
export interface CornerRadiusToolConfig {
|
|
6
|
+
onChange?: (state: CornerRadiusState) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* CornerRadiusItem is the toolbar button. It also reports the tool state to the editor wrapper: it is
|
|
10
|
+
* mounted for the whole adjust tab, so live slider changes, which the editor's `onModify` never sees,
|
|
11
|
+
* reach the wrapper too.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CornerRadiusItem: React.FC<{
|
|
14
|
+
selectTool: (id: string, event?: unknown) => void;
|
|
15
|
+
t: Translate;
|
|
16
|
+
isSelected?: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
/** CornerRadiusOptions is the panel above the toolbar: a slider and a pixel field bound to each other. */
|
|
19
|
+
export declare const CornerRadiusOptions: React.FC<{
|
|
20
|
+
t: Translate;
|
|
21
|
+
}>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Konva from 'konva';
|
|
2
|
+
/** CornerRadiusEraserParams describe what the eraser cuts off. */
|
|
3
|
+
export interface CornerRadiusEraserParams {
|
|
4
|
+
/** Radius in pixels of the final image; 0 erases nothing. */
|
|
5
|
+
radius: number;
|
|
6
|
+
/** Width the image is resized to, or 0 when it keeps its size. */
|
|
7
|
+
resizeWidth: number;
|
|
8
|
+
/** Hides the cut on screen (the crop tool shows the whole image); saving still applies it. */
|
|
9
|
+
suspended: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** findEditorStage returns the editor's Konva stage rendered inside the container. */
|
|
12
|
+
export declare function findEditorStage(container: Element | null | undefined): Konva.Stage | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* applyCornerRadius puts an eraser on top of both image layers and updates it. The eraser is part of
|
|
15
|
+
* the stage, so the editor's export, which clones the stage, bakes the same corners into the file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function applyCornerRadius(stage: Konva.Stage, params: CornerRadiusEraserParams): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** CORNER_RADIUS_TOOL_ID is the image editor tool id of the corner radius tool. */
|
|
2
|
+
export declare const CORNER_RADIUS_TOOL_ID = "CornerRadius";
|
|
3
|
+
/** ELLIPSE_CROP is the editor's crop ratio of the ellipse frame. */
|
|
4
|
+
export declare const ELLIPSE_CROP = "ellipse";
|
|
5
|
+
/** CORNER_RADIUS_TRANSLATION_KEYS are the editor dictionary keys the tool adds. */
|
|
6
|
+
export declare const CORNER_RADIUS_TRANSLATION_KEYS: string[];
|
|
7
|
+
/** CornerRadiusState is what the tool needs from the editor state. */
|
|
8
|
+
export interface CornerRadiusState {
|
|
9
|
+
/** Radius in pixels of the final image; 0 means square corners. */
|
|
10
|
+
radius: number;
|
|
11
|
+
isEllipse: boolean;
|
|
12
|
+
/** Width the image is resized to, or 0 when it keeps its size. */
|
|
13
|
+
resizeWidth: number;
|
|
14
|
+
/** The crop tool is open: the canvas shows the whole image, not the crop box. */
|
|
15
|
+
isCropping: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** PathContext is the part of a canvas context a corner wedge is traced with. */
|
|
18
|
+
export interface PathContext {
|
|
19
|
+
moveTo(x: number, y: number): void;
|
|
20
|
+
lineTo(x: number, y: number): void;
|
|
21
|
+
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
|
|
22
|
+
closePath(): void;
|
|
23
|
+
}
|
|
24
|
+
/** maxCornerRadius is half of the shorter side: a square turns into a circle, a rectangle into a capsule. */
|
|
25
|
+
export declare function maxCornerRadius(width: number, height: number): number;
|
|
26
|
+
/** clampCornerRadius turns any input into a whole radius between 0 and the maximum for the image. */
|
|
27
|
+
export declare function clampCornerRadius(value: unknown, width: number, height: number): number;
|
|
28
|
+
/** toLayerRadius converts a radius from final image pixels to the units of the layer showing the crop. */
|
|
29
|
+
export declare function toLayerRadius(radius: number, layerWidth: number, finalWidth: number): number;
|
|
30
|
+
/**
|
|
31
|
+
* traceCornerWedges adds to the path the four corner regions that lie between a rectangle and the
|
|
32
|
+
* same rectangle with rounded corners. Returns false when there is nothing to trace.
|
|
33
|
+
*/
|
|
34
|
+
export declare function traceCornerWedges(ctx: PathContext, x: number, y: number, width: number, height: number, radius: number): boolean;
|
|
35
|
+
/** readCornerRadiusState picks the tool's inputs out of the editor state; reset leaves `extra` undefined. */
|
|
36
|
+
export declare function readCornerRadiusState(editorState: unknown): CornerRadiusState;
|
|
37
|
+
/** insertToolAfter returns the tab's tool list with the tool right after its anchor, or at the end. */
|
|
38
|
+
export declare function insertToolAfter(tools: readonly string[], anchor: string, tool: string): string[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** CornerRadiusOutput says how an edited image is saved once its corners may be rounded. */
|
|
2
|
+
export interface CornerRadiusOutput {
|
|
3
|
+
/** Save as PNG: rounded corners are transparent, and only PNG keeps that through compression. */
|
|
4
|
+
forcePng: boolean;
|
|
5
|
+
/** The stored file may be overwritten: only when the format stays the same. */
|
|
6
|
+
canOverwrite: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* resolveCornerRadiusOutput picks the format and whether overwriting is allowed. Overwriting keeps
|
|
10
|
+
* the file's address and name; with a PNG behind a `.jpg` address storages and mail clients may
|
|
11
|
+
* show the image wrongly, so a format change is saved as a copy.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveCornerRadiusOutput(options: {
|
|
14
|
+
sourceMimeType: string;
|
|
15
|
+
isRounded: boolean;
|
|
16
|
+
}): CornerRadiusOutput;
|
|
17
|
+
/** toPngFileName swaps the file extension for `.png`, or adds it. */
|
|
18
|
+
export declare function toPngFileName(name: string): string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
/** ImageEditorToolItem is an entry of the editor's tool registry. */
|
|
3
|
+
export interface ImageEditorToolItem {
|
|
4
|
+
id: string;
|
|
5
|
+
Item: ComponentType<any>;
|
|
6
|
+
ItemOptions?: ComponentType<any>;
|
|
7
|
+
}
|
|
8
|
+
/** IMAGE_EDITOR_TOOLS is the editor's tool registry plus the corner radius tool, for the `tools` config. */
|
|
9
|
+
export declare const IMAGE_EDITOR_TOOLS: Record<string, ImageEditorToolItem>;
|
|
10
|
+
/** IMAGE_EDITOR_TABS_TOOLS lists tools per tab, corner radius right after crop; for the `tabsToolsIds` config. */
|
|
11
|
+
export declare const IMAGE_EDITOR_TABS_TOOLS: Record<string, string[]>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CORNER_RADIUS_TOOL_ID } from './cornerRadiusMath';
|
|
3
|
+
import { IMAGE_EDITOR_TABS_TOOLS, IMAGE_EDITOR_TOOLS } from './imageEditorTools';
|
|
4
|
+
import type { CornerRadiusToolConfig } from './CornerRadiusTool';
|
|
5
|
+
/** CornerRadiusEditorConfig is spread into the image editor config to enable the corner radius tool. */
|
|
6
|
+
export interface CornerRadiusEditorConfig {
|
|
7
|
+
tools: typeof IMAGE_EDITOR_TOOLS;
|
|
8
|
+
tabsToolsIds: typeof IMAGE_EDITOR_TABS_TOOLS;
|
|
9
|
+
onModify: (state: unknown) => void;
|
|
10
|
+
[CORNER_RADIUS_TOOL_ID]: CornerRadiusToolConfig;
|
|
11
|
+
}
|
|
12
|
+
/** CornerRadiusSync is what an editor wrapper needs from the corner radius tool. */
|
|
13
|
+
export interface CornerRadiusSync {
|
|
14
|
+
/** Corners will be cut on save: a radius above 0 and no ellipse crop. */
|
|
15
|
+
isRounded: boolean;
|
|
16
|
+
editorConfig: CornerRadiusEditorConfig;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* useCornerRadiusSync keeps the canvas eraser in step with the tool state. The state arrives two ways:
|
|
20
|
+
* from the tool itself during a slider gesture, and from `onModify` on undo, redo, reset and changes
|
|
21
|
+
* made on other tabs.
|
|
22
|
+
*/
|
|
23
|
+
export declare function useCornerRadiusSync(containerRef: React.RefObject<HTMLElement | null>): CornerRadiusSync;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon sets are fetched at runtime instead of being bundled.
|
|
3
|
+
*
|
|
4
|
+
* Importing `@iconify-json/*` as modules turns their JSON into string literals inside the bundle:
|
|
5
|
+
* lucide 581 kB and tabler 2.12 MB, 2.7 MB of data a bundler can neither split nor shake. Fetched
|
|
6
|
+
* as files they are cached by the browser, versioned on their own and cost nothing at build time.
|
|
7
|
+
*
|
|
8
|
+
* The tab that needs them is lazy, so the bytes reach the user at the same moment as before.
|
|
9
|
+
*/
|
|
10
|
+
import type { IconifyJSON } from '@iconify/types';
|
|
11
|
+
export declare const ICON_SET_PREFIXES: readonly ['lucide', 'tabler'];
|
|
12
|
+
export type IconSetPrefix = (typeof ICON_SET_PREFIXES)[number];
|
|
13
|
+
/** Where the host publishes the sets. Matches the copy step of the build pipeline. */
|
|
14
|
+
export declare const ICON_SETS_ASSETS_PATH = "static/media/icon-sets";
|
|
15
|
+
export interface IconSetsSource {
|
|
16
|
+
/** Application base url, same one the image editor gets. */
|
|
17
|
+
baseUrl?: string;
|
|
18
|
+
/** Directory with the set files; defaults to `ICON_SETS_ASSETS_PATH`. */
|
|
19
|
+
path?: string;
|
|
20
|
+
/** Host loader of a set; when given it is the only source and nothing is fetched. */
|
|
21
|
+
load?: (prefix: IconSetPrefix) => Promise<IconifyJSON>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Points the loader at the host assets. Changing the source drops what was already fetched:
|
|
25
|
+
* a different host means different files.
|
|
26
|
+
*/
|
|
27
|
+
export declare function configureIconSets(next: IconSetsSource): void;
|
|
28
|
+
/** Loads one set once; repeated calls share the same request. */
|
|
29
|
+
export declare function loadIconSet(prefix: IconSetPrefix): Promise<IconifyJSON | null>;
|
|
30
|
+
/** Loads every set the stock search works with. Sets that failed to load are skipped. */
|
|
31
|
+
export declare function loadIconSets(): Promise<{
|
|
32
|
+
prefix: IconSetPrefix;
|
|
33
|
+
json: IconifyJSON;
|
|
34
|
+
}[]>;
|
|
35
|
+
/** Already loaded set, or `null`. For code paths that must not await. */
|
|
36
|
+
export declare function getLoadedIconSet(prefix: string): IconifyJSON | null;
|
|
37
|
+
/** Test helper: the caches are module-level, so cases would leak into one another. */
|
|
38
|
+
export declare function resetIconSets(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { StreamlineSearchItem } from '../../types';
|
|
2
|
+
/** Test helper: индекс модульный, иначе случаи протекали бы друг в друга. */
|
|
3
|
+
export declare function resetStockIconIndex(): void;
|
|
2
4
|
/** Стабильный id вида `prefix:icon-name` для кэша и `StreamlineSearchItem.hash`. */
|
|
3
|
-
export declare function listMatchingStockIconIds(query: string): string[]
|
|
5
|
+
export declare function listMatchingStockIconIds(query: string): Promise<string[]>;
|
|
4
6
|
/** Сохраняет порядок `primary`, в конец добавляет id из `secondary`, которых ещё не было. */
|
|
5
7
|
export declare function mergeStockIconIdsOrdered(primary: string[], secondary: string[]): string[];
|
|
6
8
|
export declare function stockIconIdToItem(fullId: string): StreamlineSearchItem;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon set files shipped inside this package: the build puts them into `dist/assets/icon-sets`,
|
|
3
|
+
* next to the chunk that loads them.
|
|
4
|
+
*
|
|
5
|
+
* The URLs are literal `new URL(..., import.meta.url)` on purpose: the host bundler (webpack 5,
|
|
6
|
+
* Vite, Parcel) recognises the pattern and emits the files itself, so the host does not have to
|
|
7
|
+
* copy them by hand. Served unbundled, the URL points into the package directory directly.
|
|
8
|
+
*/
|
|
9
|
+
export declare function packagedIconSetUrl(prefix: string): string | undefined;
|
package/core.d.ts
CHANGED
|
@@ -19,3 +19,4 @@ export { PathAwareStorageAdapter } from './adapters/PathAwareStorageAdapter';
|
|
|
19
19
|
export { fetchRemoteImageBlobByUrl, type FetchRemoteImageBlobOptions, type RemoteFileFetchHandlers, type RemoteFileFetchIntent, } from './utils/remoteFileFetchPipeline';
|
|
20
20
|
export type { Folder, File, PathItem, FileManagerOptions, FileManagerErrorCode, IFileManagerApiError, SortOptionType, FileManagerItemMeta, } from './types';
|
|
21
21
|
export type { StorageProvider, StorageProviderController, FileSystemItem, FileSystemItemUpdate, GetFileDataOptions, BatchResult as StorageBatchResult, OperationResult as StorageOperationResult, FileManagerApiErrorInfo, StorageApiPaginationResponse, StorageSortState, StorageUploadFileItemInput, StorageUploadFilesRequest, MayBePromise, } from './types/storage';
|
|
22
|
+
export { PNG_COMPRESSION_COLORS, PNG_INITIAL_QUALITY, isAnimatedPng, isAnimatedPngFile, keepSmallerPng, } from './utils/pngCompression';
|