@webx-ui/core 0.11.0 → 0.13.0

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.
@@ -1,10 +1,14 @@
1
1
  import { ActionsProps } from './types';
2
+ type __VLS_Props = ActionsProps;
2
3
  /**
3
4
  * The row is measured against the space its container gives it. When it collapses
4
5
  * the row is not unmounted, only taken out of the flow — it keeps its natural width,
5
6
  * which is the only way to know when there is room for it again.
6
7
  */
7
8
  declare function measure(): void;
9
+ type __VLS_PublicProps = {
10
+ 'menuOpen'?: boolean;
11
+ } & __VLS_Props;
8
12
  declare function __VLS_template(): {
9
13
  attrs: Partial<{}>;
10
14
  slots: {
@@ -20,13 +24,15 @@ declare function __VLS_template(): {
20
24
  rootEl: HTMLDivElement;
21
25
  };
22
26
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
23
- declare const __VLS_component: import('vue').DefineComponent<ActionsProps, {
27
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
24
28
  collapsed: import('vue').Ref<boolean, boolean>;
25
29
  measure: typeof measure;
26
30
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
27
31
  collapse: (collapsed: boolean) => any;
28
- }, string, import('vue').PublicProps, Readonly<ActionsProps> & Readonly<{
32
+ "update:menuOpen": (value: boolean) => any;
33
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
29
34
  onCollapse?: ((collapsed: boolean) => any) | undefined;
35
+ "onUpdate:menuOpen"?: ((value: boolean) => any) | undefined;
30
36
  }>, {
31
37
  size: import('..').ActionSize;
32
38
  align: import('./types').ActionsAlign;
@@ -0,0 +1,322 @@
1
+ import { nextTick } from 'vue';
2
+ import { FileCardProps } from './types';
3
+ declare function __VLS_template(): {
4
+ attrs: Partial<{}>;
5
+ slots: Readonly<{
6
+ /** The whole preview box — a video still, a player, whatever the file really needs. */
7
+ preview?: (props: {
8
+ picture: boolean;
9
+ }) => unknown;
10
+ /** Actions of your own, after the ones the card offers. */
11
+ actions?: () => unknown;
12
+ /** Under the name: a size, a date, dimensions. */
13
+ meta?: () => unknown;
14
+ }> & {
15
+ /** The whole preview box — a video still, a player, whatever the file really needs. */
16
+ preview?: (props: {
17
+ picture: boolean;
18
+ }) => unknown;
19
+ /** Actions of your own, after the ones the card offers. */
20
+ actions?: () => unknown;
21
+ /** Under the name: a size, a date, dimensions. */
22
+ meta?: () => unknown;
23
+ };
24
+ refs: {
25
+ field: ({
26
+ $: import('vue').ComponentInternalInstance;
27
+ $data: {};
28
+ $props: {
29
+ readonly modelValue?: import('..').InputModelValue;
30
+ readonly id?: string | undefined;
31
+ readonly type?: import('..').InputNativeType | undefined;
32
+ readonly size?: import('..').InputSize | undefined;
33
+ readonly status?: import('..').InputStatus | undefined;
34
+ readonly placeholder?: string | undefined;
35
+ readonly disabled?: boolean | undefined;
36
+ readonly readonly?: boolean | undefined;
37
+ readonly clearable?: boolean | undefined;
38
+ readonly maxlength?: number | undefined;
39
+ readonly showCount?: boolean | undefined;
40
+ readonly autocomplete?: string | undefined;
41
+ readonly ariaLabel?: string | undefined;
42
+ readonly onChange?: ((value: string) => any) | undefined;
43
+ readonly "onUpdate:modelValue"?: ((value: import('..').InputModelValue) => any) | undefined;
44
+ readonly onInput?: ((value: string) => any) | undefined;
45
+ readonly onClear?: (() => any) | undefined;
46
+ readonly onBlur?: ((event: FocusEvent) => any) | undefined;
47
+ readonly onFocus?: ((event: FocusEvent) => any) | undefined;
48
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
49
+ $attrs: import('vue').Attrs;
50
+ $refs: {
51
+ [x: string]: unknown;
52
+ } & {
53
+ inputRef: HTMLInputElement;
54
+ };
55
+ $slots: Readonly<{
56
+ [name: string]: import('vue').Slot<any> | undefined;
57
+ }>;
58
+ $root: import('vue').ComponentPublicInstance | null;
59
+ $parent: import('vue').ComponentPublicInstance | null;
60
+ $host: Element | null;
61
+ $emit: ((event: "change", value: string) => void) & ((event: "update:modelValue", value: import('..').InputModelValue) => void) & ((event: "input", value: string) => void) & ((event: "clear") => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "focus", event: FocusEvent) => void);
62
+ $el: any;
63
+ $options: import('vue').ComponentOptionsBase<Readonly<{
64
+ modelValue?: import('..').InputModelValue;
65
+ } & import('..').InputProps> & Readonly<{
66
+ onChange?: ((value: string) => any) | undefined;
67
+ "onUpdate:modelValue"?: ((value: import('..').InputModelValue) => any) | undefined;
68
+ onInput?: ((value: string) => any) | undefined;
69
+ onClear?: (() => any) | undefined;
70
+ onBlur?: ((event: FocusEvent) => any) | undefined;
71
+ onFocus?: ((event: FocusEvent) => any) | undefined;
72
+ }>, {
73
+ focus: () => void | undefined;
74
+ blur: () => void | undefined;
75
+ select: () => void | undefined;
76
+ input: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
77
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
78
+ change: (value: string) => any;
79
+ "update:modelValue": (value: import('..').InputModelValue) => any;
80
+ input: (value: string) => any;
81
+ clear: () => any;
82
+ blur: (event: FocusEvent) => any;
83
+ focus: (event: FocusEvent) => any;
84
+ }, string, {
85
+ size: import('..').InputSize;
86
+ disabled: boolean;
87
+ type: import('..').InputNativeType;
88
+ placeholder: string;
89
+ ariaLabel: string;
90
+ clearable: boolean;
91
+ status: import('..').InputStatus;
92
+ id: string;
93
+ readonly: boolean;
94
+ autocomplete: string;
95
+ maxlength: number;
96
+ showCount: boolean;
97
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
98
+ beforeCreate?: (() => void) | (() => void)[];
99
+ created?: (() => void) | (() => void)[];
100
+ beforeMount?: (() => void) | (() => void)[];
101
+ mounted?: (() => void) | (() => void)[];
102
+ beforeUpdate?: (() => void) | (() => void)[];
103
+ updated?: (() => void) | (() => void)[];
104
+ activated?: (() => void) | (() => void)[];
105
+ deactivated?: (() => void) | (() => void)[];
106
+ beforeDestroy?: (() => void) | (() => void)[];
107
+ beforeUnmount?: (() => void) | (() => void)[];
108
+ destroyed?: (() => void) | (() => void)[];
109
+ unmounted?: (() => void) | (() => void)[];
110
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
111
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
112
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
113
+ };
114
+ $forceUpdate: () => void;
115
+ $nextTick: typeof nextTick;
116
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
117
+ } & Readonly<{
118
+ size: import('..').InputSize;
119
+ disabled: boolean;
120
+ type: import('..').InputNativeType;
121
+ placeholder: string;
122
+ ariaLabel: string;
123
+ clearable: boolean;
124
+ status: import('..').InputStatus;
125
+ id: string;
126
+ readonly: boolean;
127
+ autocomplete: string;
128
+ maxlength: number;
129
+ showCount: boolean;
130
+ }> & Omit<Readonly<{
131
+ modelValue?: import('..').InputModelValue;
132
+ } & import('..').InputProps> & Readonly<{
133
+ onChange?: ((value: string) => any) | undefined;
134
+ "onUpdate:modelValue"?: ((value: import('..').InputModelValue) => any) | undefined;
135
+ onInput?: ((value: string) => any) | undefined;
136
+ onClear?: (() => any) | undefined;
137
+ onBlur?: ((event: FocusEvent) => any) | undefined;
138
+ onFocus?: ((event: FocusEvent) => any) | undefined;
139
+ }>, "input" | "select" | "blur" | "focus" | ("size" | "disabled" | "type" | "placeholder" | "ariaLabel" | "clearable" | "status" | "id" | "readonly" | "autocomplete" | "maxlength" | "showCount")> & {
140
+ focus: () => void | undefined;
141
+ blur: () => void | undefined;
142
+ select: () => void | undefined;
143
+ input: HTMLInputElement | null;
144
+ } & {} & import('vue').ComponentCustomProperties & {} & {
145
+ $slots: {
146
+ prefix?(_: {}): any;
147
+ suffix?(_: {}): any;
148
+ };
149
+ }) | null;
150
+ label: HTMLSpanElement;
151
+ };
152
+ rootEl: HTMLDivElement;
153
+ };
154
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
155
+ declare const __VLS_component: import('vue').DefineComponent<FileCardProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
156
+ edit: () => any;
157
+ copy: (url: string) => any;
158
+ remove: () => any;
159
+ rename: (name: string) => any;
160
+ "copy-error": (error: unknown) => any;
161
+ }, string, import('vue').PublicProps, Readonly<FileCardProps> & Readonly<{
162
+ onEdit?: (() => any) | undefined;
163
+ onCopy?: ((url: string) => any) | undefined;
164
+ onRemove?: (() => any) | undefined;
165
+ onRename?: ((name: string) => any) | undefined;
166
+ "onCopy-error"?: ((error: unknown) => any) | undefined;
167
+ }>, {
168
+ size: import('./types').FileCardSize;
169
+ disabled: boolean;
170
+ type: string;
171
+ icon: import('..').IconName;
172
+ url: string;
173
+ selected: boolean;
174
+ thumbnail: string;
175
+ renamable: boolean;
176
+ editable: boolean;
177
+ removable: boolean;
178
+ confirmRemove: boolean;
179
+ copyable: boolean;
180
+ renameLabel: string;
181
+ saveLabel: string;
182
+ cancelLabel: string;
183
+ editLabel: string;
184
+ removeLabel: string;
185
+ removeConfirmText: string;
186
+ copyLabel: string;
187
+ copiedLabel: string;
188
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
189
+ field: ({
190
+ $: import('vue').ComponentInternalInstance;
191
+ $data: {};
192
+ $props: {
193
+ readonly modelValue?: import('..').InputModelValue;
194
+ readonly id?: string | undefined;
195
+ readonly type?: import('..').InputNativeType | undefined;
196
+ readonly size?: import('..').InputSize | undefined;
197
+ readonly status?: import('..').InputStatus | undefined;
198
+ readonly placeholder?: string | undefined;
199
+ readonly disabled?: boolean | undefined;
200
+ readonly readonly?: boolean | undefined;
201
+ readonly clearable?: boolean | undefined;
202
+ readonly maxlength?: number | undefined;
203
+ readonly showCount?: boolean | undefined;
204
+ readonly autocomplete?: string | undefined;
205
+ readonly ariaLabel?: string | undefined;
206
+ readonly onChange?: ((value: string) => any) | undefined;
207
+ readonly "onUpdate:modelValue"?: ((value: import('..').InputModelValue) => any) | undefined;
208
+ readonly onInput?: ((value: string) => any) | undefined;
209
+ readonly onClear?: (() => any) | undefined;
210
+ readonly onBlur?: ((event: FocusEvent) => any) | undefined;
211
+ readonly onFocus?: ((event: FocusEvent) => any) | undefined;
212
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps;
213
+ $attrs: import('vue').Attrs;
214
+ $refs: {
215
+ [x: string]: unknown;
216
+ } & {
217
+ inputRef: HTMLInputElement;
218
+ };
219
+ $slots: Readonly<{
220
+ [name: string]: import('vue').Slot<any> | undefined;
221
+ }>;
222
+ $root: import('vue').ComponentPublicInstance | null;
223
+ $parent: import('vue').ComponentPublicInstance | null;
224
+ $host: Element | null;
225
+ $emit: ((event: "change", value: string) => void) & ((event: "update:modelValue", value: import('..').InputModelValue) => void) & ((event: "input", value: string) => void) & ((event: "clear") => void) & ((event: "blur", event: FocusEvent) => void) & ((event: "focus", event: FocusEvent) => void);
226
+ $el: any;
227
+ $options: import('vue').ComponentOptionsBase<Readonly<{
228
+ modelValue?: import('..').InputModelValue;
229
+ } & import('..').InputProps> & Readonly<{
230
+ onChange?: ((value: string) => any) | undefined;
231
+ "onUpdate:modelValue"?: ((value: import('..').InputModelValue) => any) | undefined;
232
+ onInput?: ((value: string) => any) | undefined;
233
+ onClear?: (() => any) | undefined;
234
+ onBlur?: ((event: FocusEvent) => any) | undefined;
235
+ onFocus?: ((event: FocusEvent) => any) | undefined;
236
+ }>, {
237
+ focus: () => void | undefined;
238
+ blur: () => void | undefined;
239
+ select: () => void | undefined;
240
+ input: import('vue').Ref<HTMLInputElement | null, HTMLInputElement | null>;
241
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
242
+ change: (value: string) => any;
243
+ "update:modelValue": (value: import('..').InputModelValue) => any;
244
+ input: (value: string) => any;
245
+ clear: () => any;
246
+ blur: (event: FocusEvent) => any;
247
+ focus: (event: FocusEvent) => any;
248
+ }, string, {
249
+ size: import('..').InputSize;
250
+ disabled: boolean;
251
+ type: import('..').InputNativeType;
252
+ placeholder: string;
253
+ ariaLabel: string;
254
+ clearable: boolean;
255
+ status: import('..').InputStatus;
256
+ id: string;
257
+ readonly: boolean;
258
+ autocomplete: string;
259
+ maxlength: number;
260
+ showCount: boolean;
261
+ }, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
262
+ beforeCreate?: (() => void) | (() => void)[];
263
+ created?: (() => void) | (() => void)[];
264
+ beforeMount?: (() => void) | (() => void)[];
265
+ mounted?: (() => void) | (() => void)[];
266
+ beforeUpdate?: (() => void) | (() => void)[];
267
+ updated?: (() => void) | (() => void)[];
268
+ activated?: (() => void) | (() => void)[];
269
+ deactivated?: (() => void) | (() => void)[];
270
+ beforeDestroy?: (() => void) | (() => void)[];
271
+ beforeUnmount?: (() => void) | (() => void)[];
272
+ destroyed?: (() => void) | (() => void)[];
273
+ unmounted?: (() => void) | (() => void)[];
274
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
275
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
276
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
277
+ };
278
+ $forceUpdate: () => void;
279
+ $nextTick: typeof nextTick;
280
+ $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
281
+ } & Readonly<{
282
+ size: import('..').InputSize;
283
+ disabled: boolean;
284
+ type: import('..').InputNativeType;
285
+ placeholder: string;
286
+ ariaLabel: string;
287
+ clearable: boolean;
288
+ status: import('..').InputStatus;
289
+ id: string;
290
+ readonly: boolean;
291
+ autocomplete: string;
292
+ maxlength: number;
293
+ showCount: boolean;
294
+ }> & Omit<Readonly<{
295
+ modelValue?: import('..').InputModelValue;
296
+ } & import('..').InputProps> & Readonly<{
297
+ onChange?: ((value: string) => any) | undefined;
298
+ "onUpdate:modelValue"?: ((value: import('..').InputModelValue) => any) | undefined;
299
+ onInput?: ((value: string) => any) | undefined;
300
+ onClear?: (() => any) | undefined;
301
+ onBlur?: ((event: FocusEvent) => any) | undefined;
302
+ onFocus?: ((event: FocusEvent) => any) | undefined;
303
+ }>, "input" | "select" | "blur" | "focus" | ("size" | "disabled" | "type" | "placeholder" | "ariaLabel" | "clearable" | "status" | "id" | "readonly" | "autocomplete" | "maxlength" | "showCount")> & {
304
+ focus: () => void | undefined;
305
+ blur: () => void | undefined;
306
+ select: () => void | undefined;
307
+ input: HTMLInputElement | null;
308
+ } & {} & import('vue').ComponentCustomProperties & {} & {
309
+ $slots: {
310
+ prefix?(_: {}): any;
311
+ suffix?(_: {}): any;
312
+ };
313
+ }) | null;
314
+ label: HTMLSpanElement;
315
+ }, HTMLDivElement>;
316
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
317
+ export default _default;
318
+ type __VLS_WithTemplateSlots<T, S> = T & {
319
+ new (): {
320
+ $slots: S;
321
+ };
322
+ };
@@ -0,0 +1,22 @@
1
+ import { IconName } from '../Icon/types';
2
+ /**
3
+ * The extension of a file name, lower case and without the dot. A URL is accepted too:
4
+ * the query and the fragment are cut off first, because `photo.jpg?v=2` is a JPEG.
5
+ */
6
+ export declare function extensionOf(name: string): string;
7
+ /**
8
+ * Whether the file is a picture, and so has a preview rather than a glyph.
9
+ *
10
+ * The MIME type is asked first because it is the one that knows: an extension is a
11
+ * guess a file name makes about itself. `image/*` minus the formats no browser draws —
12
+ * a TIFF is an image and still renders as a broken picture.
13
+ */
14
+ export declare function isPicture(name: string, type?: string): boolean;
15
+ /**
16
+ * The icon for a file, by extension.
17
+ *
18
+ * The registry is what answers, not a list kept here, so `registerIcons({ 'file-dwg': … })`
19
+ * in an application is all it takes for a `.dwg` to have its own drawing — no release of
20
+ * this library, and nothing to pass per card.
21
+ */
22
+ export declare function fileIconName(name: string): IconName;
@@ -0,0 +1,3 @@
1
+ export { default as WxFileCard } from './FileCard';
2
+ export { extensionOf, fileIconName, isPicture } from './files';
3
+ export type * from './types';
@@ -0,0 +1,64 @@
1
+ import { IconName } from '../Icon/types';
2
+ export type FileCardSize = 'sm' | 'md' | 'lg';
3
+ export interface FileCardProps {
4
+ /** The file name, extension and all. It is what the card shows and what it renames. */
5
+ name: string;
6
+ /**
7
+ * Where the file is. The copy action puts this on the clipboard, and a picture with
8
+ * no `thumbnail` of its own is drawn from it.
9
+ */
10
+ url?: string;
11
+ /** A smaller picture to draw instead of `url` — the one the backend already made. */
12
+ thumbnail?: string;
13
+ /**
14
+ * MIME type. It decides picture or glyph; without it the extension decides, which is
15
+ * right often enough and wrong for a `.bin` that happens to be a JPEG.
16
+ */
17
+ type?: string;
18
+ /** Icon to draw instead of the one the extension picks. */
19
+ icon?: IconName;
20
+ /** Draws the card as chosen. The choosing itself belongs to whatever holds the cards. */
21
+ selected?: boolean;
22
+ size?: FileCardSize;
23
+ /** Nothing can be done to the file: every action goes, and the name cannot be edited. */
24
+ disabled?: boolean;
25
+ /** Offers renaming. The card edits the name in place and reports the new one. */
26
+ renamable?: boolean;
27
+ /**
28
+ * Offers the edit action, which says "open this picture in an editor" and nothing
29
+ * more — the editing itself is somebody else's component. Pictures only: there is
30
+ * nothing to open for a `.zip`.
31
+ */
32
+ editable?: boolean;
33
+ removable?: boolean;
34
+ /**
35
+ * Asks before deleting. On, because a file deleted from a grid of thumbnails is a file
36
+ * deleted by a misplaced click. Off where the screen asks its own question, or where
37
+ * the deletion is undoable.
38
+ */
39
+ confirmRemove?: boolean;
40
+ /** Offers copying `url` to the clipboard. */
41
+ copyable?: boolean;
42
+ renameLabel?: string;
43
+ /** The two buttons under the field renaming opens. */
44
+ saveLabel?: string;
45
+ cancelLabel?: string;
46
+ editLabel?: string;
47
+ removeLabel?: string;
48
+ /** The question `confirmRemove` asks. The file name is worth putting in it. */
49
+ removeConfirmText?: string;
50
+ copyLabel?: string;
51
+ /** Shown on the copy action for a moment after it worked. */
52
+ copiedLabel?: string;
53
+ }
54
+ export interface FileCardEmits {
55
+ /** A new name was committed. The file is not renamed until the caller says so. */
56
+ rename: [name: string];
57
+ /** Open this picture in an editor. */
58
+ edit: [];
59
+ remove: [];
60
+ /** The URL reached the clipboard. */
61
+ copy: [url: string];
62
+ /** It did not — no clipboard, or permission refused. */
63
+ 'copy-error': [error: unknown];
64
+ }
@@ -18,6 +18,11 @@ export declare const builtinIcons: {
18
18
  readonly copy: "<rect x=\"8.5\" y=\"8.5\" width=\"11\" height=\"11\" rx=\"2.2\"/><path d=\"M15.5 8.5v-2a2 2 0 0 0-2-2h-7a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h2\"/>";
19
19
  readonly search: "<circle cx=\"11\" cy=\"11\" r=\"6.5\"/><path d=\"m16 16 4.5 4.5\"/>";
20
20
  readonly filter: "<path d=\"M4 5.5h16l-6.2 7.2v5.1l-3.6 2v-7.1z\"/>";
21
+ readonly crop: "<path d=\"M6.5 2.5v13a2 2 0 0 0 2 2h13\"/><path d=\"M2.5 6.5h13a2 2 0 0 1 2 2v13\"/>";
22
+ readonly 'rotate-left': "<path d=\"M19.4 13.8A7.5 7.5 0 1 0 12 5\"/><path d=\"M14.3 2.9 12 5l2.3 2.1\"/>";
23
+ readonly 'rotate-right': "<path d=\"M4.6 13.8A7.5 7.5 0 1 1 12 5\"/><path d=\"M9.7 2.9 12 5l-2.3 2.1\"/>";
24
+ readonly 'flip-horizontal': "<path d=\"M12 3v18\" stroke-dasharray=\"3 3\"/><path d=\"M9.2 7.2v9.6L3.6 12z\"/><path d=\"M14.8 7.2v9.6L20.4 12z\"/>";
25
+ readonly 'flip-vertical': "<path d=\"M3 12h18\" stroke-dasharray=\"3 3\"/><path d=\"M7.2 9.2h9.6L12 3.6z\"/><path d=\"M7.2 14.8h9.6L12 20.4z\"/>";
21
26
  readonly refresh: "<path d=\"M4 12a8 8 0 0 1 13.7-5.6L20 8.5\"/><path d=\"M20 4.5v4h-4\"/><path d=\"M20 12a8 8 0 0 1-13.7 5.6L4 15.5\"/><path d=\"M4 19.5v-4h4\"/>";
22
27
  readonly upload: "<path d=\"M12 16V4m0 0-4.5 4.5M12 4l4.5 4.5\"/><path d=\"M4 15v3.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V15\"/>";
23
28
  readonly download: "<path d=\"M12 4v12m0 0-4.5-4.5M12 16l4.5-4.5\"/><path d=\"M4 15v3.5A1.5 1.5 0 0 0 5.5 20h13a1.5 1.5 0 0 0 1.5-1.5V15\"/>";
@@ -66,6 +71,81 @@ export declare const builtinIcons: {
66
71
  readonly warning: "<path d=\"M10.3 4.9a2 2 0 0 1 3.4 0l7 12.1a2 2 0 0 1-1.7 3H5a2 2 0 0 1-1.7-3z\"/><path d=\"M12 9.5v4\"/><circle cx=\"12\" cy=\"16.6\" r=\"1.05\" fill=\"currentColor\" stroke=\"none\"/>";
67
72
  readonly question: "<circle cx=\"12\" cy=\"12\" r=\"8.5\"/><path d=\"M9.6 9.4a2.5 2.5 0 0 1 4.9.6c0 1.7-2.5 2-2.5 3.5\"/><circle cx=\"12\" cy=\"16.6\" r=\"1.05\" fill=\"currentColor\" stroke=\"none\"/>";
68
73
  readonly loader: "<path d=\"M12 3.5v4M12 16.5v4M3.5 12h4M16.5 12h4M6 6l2.8 2.8M15.2 15.2 18 18M18 6l-2.8 2.8M8.8 15.2 6 18\"/>";
74
+ readonly 'file-generic': "<path d=\"M13.5 3.5H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V9zm0 0V9H19\"/>";
75
+ readonly 'file-txt': string;
76
+ readonly 'file-md': string;
77
+ readonly 'file-rtf': string;
78
+ readonly 'file-doc': string;
79
+ readonly 'file-docx': string;
80
+ readonly 'file-odt': string;
81
+ readonly 'file-pages': string;
82
+ readonly 'file-csv': string;
83
+ readonly 'file-xls': string;
84
+ readonly 'file-xlsx': string;
85
+ readonly 'file-ods': string;
86
+ readonly 'file-numbers': string;
87
+ readonly 'file-ppt': string;
88
+ readonly 'file-pptx': string;
89
+ readonly 'file-odp': string;
90
+ readonly 'file-key': string;
91
+ readonly 'file-pdf': string;
92
+ readonly 'file-zip': string;
93
+ readonly 'file-rar': string;
94
+ readonly 'file-7z': string;
95
+ readonly 'file-tar': string;
96
+ readonly 'file-gz': string;
97
+ readonly 'file-bz2': string;
98
+ readonly 'file-mp3': string;
99
+ readonly 'file-wav': string;
100
+ readonly 'file-ogg': string;
101
+ readonly 'file-flac': string;
102
+ readonly 'file-aac': string;
103
+ readonly 'file-m4a': string;
104
+ readonly 'file-mp4': string;
105
+ readonly 'file-mov': string;
106
+ readonly 'file-avi': string;
107
+ readonly 'file-webm': string;
108
+ readonly 'file-mkv': string;
109
+ readonly 'file-m4v': string;
110
+ readonly 'file-jpg': string;
111
+ readonly 'file-jpeg': string;
112
+ readonly 'file-png': string;
113
+ readonly 'file-gif': string;
114
+ readonly 'file-webp': string;
115
+ readonly 'file-avif': string;
116
+ readonly 'file-bmp': string;
117
+ readonly 'file-tiff': string;
118
+ readonly 'file-ico': string;
119
+ readonly 'file-svg': string;
120
+ readonly 'file-ai': string;
121
+ readonly 'file-eps': string;
122
+ readonly 'file-psd': string;
123
+ readonly 'file-xcf': string;
124
+ readonly 'file-fig': string;
125
+ readonly 'file-sketch': string;
126
+ readonly 'file-js': string;
127
+ readonly 'file-ts': string;
128
+ readonly 'file-jsx': string;
129
+ readonly 'file-tsx': string;
130
+ readonly 'file-vue': string;
131
+ readonly 'file-json': string;
132
+ readonly 'file-xml': string;
133
+ readonly 'file-yml': string;
134
+ readonly 'file-yaml': string;
135
+ readonly 'file-html': string;
136
+ readonly 'file-css': string;
137
+ readonly 'file-scss': string;
138
+ readonly 'file-php': string;
139
+ readonly 'file-py': string;
140
+ readonly 'file-rb': string;
141
+ readonly 'file-go': string;
142
+ readonly 'file-java': string;
143
+ readonly 'file-sh': string;
144
+ readonly 'file-sql': string;
145
+ readonly 'file-ttf': string;
146
+ readonly 'file-otf': string;
147
+ readonly 'file-woff': string;
148
+ readonly 'file-woff2': string;
69
149
  };
70
150
  /** Every name the library ships with. */
71
151
  export type BuiltinIconName = keyof typeof builtinIcons;
@@ -0,0 +1,67 @@
1
+ import { ImageEditorCrop, ImageEditorProps, ImageEditorRatio, ImageEditorRatioOption, ImageEditorResult } from './types';
2
+ /**
3
+ * Draws the result and hands it over. Exposed, so a page with a footer of its own can
4
+ * ask for it without the editor carrying one.
5
+ */
6
+ declare function apply(): Promise<ImageEditorResult | undefined>;
7
+ declare const _default: import('vue').DefineComponent<ImageEditorProps, {
8
+ /** Draws the result, emits `save` and answers with it. */
9
+ apply: typeof apply;
10
+ /** Back to the whole picture, the right way up. */
11
+ reset: () => void;
12
+ crop: import('vue').ComputedRef<ImageEditorCrop>;
13
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
14
+ crop: (crop: ImageEditorCrop) => any;
15
+ error: (error: unknown) => any;
16
+ cancel: () => any;
17
+ load: (size: {
18
+ width: number;
19
+ height: number;
20
+ }) => any;
21
+ save: (result: ImageEditorResult) => any;
22
+ }, string, import('vue').PublicProps, Readonly<ImageEditorProps> & Readonly<{
23
+ onCrop?: ((crop: ImageEditorCrop) => any) | undefined;
24
+ onError?: ((error: unknown) => any) | undefined;
25
+ onCancel?: (() => any) | undefined;
26
+ onLoad?: ((size: {
27
+ width: number;
28
+ height: number;
29
+ }) => any) | undefined;
30
+ onSave?: ((result: ImageEditorResult) => any) | undefined;
31
+ }>, {
32
+ disabled: boolean;
33
+ footer: boolean;
34
+ background: string;
35
+ format: "auto" | "image/jpeg" | "image/png" | "image/webp";
36
+ resizable: boolean;
37
+ minSize: number;
38
+ maxWidth: number;
39
+ saveLabel: string;
40
+ cancelLabel: string;
41
+ ratio: ImageEditorRatio;
42
+ fileName: string;
43
+ aspect: number;
44
+ ratios: (ImageEditorRatio | ImageEditorRatioOption)[];
45
+ rotatable: boolean;
46
+ flippable: boolean;
47
+ maxHeight: number;
48
+ quality: number;
49
+ crossOrigin: "anonymous" | "use-credentials" | "";
50
+ resetLabel: string;
51
+ rotateLeftLabel: string;
52
+ rotateRightLabel: string;
53
+ flipHorizontalLabel: string;
54
+ flipVerticalLabel: string;
55
+ ratioLabel: string;
56
+ cropLabel: string;
57
+ widthLabel: string;
58
+ freeLabel: string;
59
+ originalLabel: string;
60
+ errorText: string;
61
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
62
+ stage: HTMLDivElement;
63
+ frame: HTMLDivElement;
64
+ image: HTMLImageElement;
65
+ cropBox: HTMLDivElement;
66
+ }, HTMLDivElement>;
67
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { ImageEditorCrop } from './types';
2
+ /** The eight grips, named after the compass the way every editor names them. */
3
+ export type CropHandle = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w';
4
+ export interface CropBounds {
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export declare function clamp(value: number, min: number, max: number): number;
9
+ /** `1.7778` → `16:9`. Falls back to a decimal for a ratio that is nobody's convention. */
10
+ export declare function ratioLabelFor(value: number): string;
11
+ /** The whole picture, or the largest rectangle of `ratio` in the middle of it. */
12
+ export declare function fullCrop(bounds: CropBounds, ratio?: number): ImageEditorCrop;
13
+ /**
14
+ * The largest rectangle of `ratio` that fits inside `crop`, kept where `crop` was — used
15
+ * when the ratio changes and when a turn leaves the old crop the wrong shape.
16
+ */
17
+ export declare function fitRatio(crop: ImageEditorCrop, ratio: number, bounds: CropBounds): ImageEditorCrop;
18
+ /** Dragged from inside: the crop slides, and stops at the edges of the picture. */
19
+ export declare function moveCrop(start: ImageEditorCrop, dx: number, dy: number, bounds: CropBounds): ImageEditorCrop;
20
+ /**
21
+ * Dragged by a grip.
22
+ *
23
+ * The opposite corner — or the opposite edge, for the four in the middle — is the anchor
24
+ * and does not move; everything else follows the pointer. With a ratio the rectangle is
25
+ * brought back to that ratio before it is fitted inside the picture, so a locked crop
26
+ * cannot be nudged out of shape by dragging it into a corner.
27
+ */
28
+ export declare function resizeCrop(handle: CropHandle, point: {
29
+ x: number;
30
+ y: number;
31
+ }, start: ImageEditorCrop, bounds: CropBounds, { ratio, min }?: {
32
+ ratio?: number;
33
+ min?: number;
34
+ }): ImageEditorCrop;
35
+ /**
36
+ * The crop follows the picture through a quarter turn, so what was framed stays framed.
37
+ * `bounds` is the space *before* the turn; the space after it has its sides swapped.
38
+ */
39
+ export declare function turnCrop(crop: ImageEditorCrop, bounds: CropBounds, direction: 1 | -1): ImageEditorCrop;
40
+ /** The same, for a mirroring. */
41
+ export declare function mirrorCrop(crop: ImageEditorCrop, bounds: CropBounds, axis: 'x' | 'y'): ImageEditorCrop;
42
+ /** The largest whole-pixel size of the same shape that fits within the caps. */
43
+ export declare function fitInside(width: number, height: number, maxWidth?: number, maxHeight?: number): {
44
+ width: number;
45
+ height: number;
46
+ };
@@ -0,0 +1,3 @@
1
+ export { default as WxImageEditor } from './ImageEditor';
2
+ export { ratioLabelFor } from './crop';
3
+ export type * from './types';