@webx-ui/core 0.22.0 → 0.24.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.
@@ -23,6 +23,7 @@ declare const __VLS_component: import('vue').DefineComponent<FormItemProps, {
23
23
  labelWidth: string;
24
24
  help: string;
25
25
  reserveErrorSpace: boolean;
26
+ wide: boolean;
26
27
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
27
28
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
28
29
  export default _default;
@@ -21,4 +21,13 @@ export interface FormItemProps {
21
21
  labelWidth?: string;
22
22
  /** Renders the error slot area even when empty, so rows do not jump. */
23
23
  reserveErrorSpace?: boolean;
24
+ /**
25
+ * Lets the control take the whole width instead of stopping at the readable one.
26
+ *
27
+ * A field is read and typed into, so it stops at `--wx-field-max-width` however wide the
28
+ * screen is: an input stretched across a 2000px monitor is a line the eye cannot follow
29
+ * back to its label. What is not a field in that sense — an editor, a table, a list of
30
+ * blocks — says so with this.
31
+ */
32
+ wide?: boolean;
24
33
  }
@@ -1,7 +1,7 @@
1
- import { RichTextProps, RichTextTool } from './types';
1
+ import { RichTextLabels, RichTextModelValue, RichTextProps, RichTextTool } from './types';
2
2
  type __VLS_Props = RichTextProps;
3
3
  type __VLS_PublicProps = {
4
- modelValue?: string;
4
+ modelValue?: RichTextModelValue;
5
5
  } & __VLS_Props;
6
6
  declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
7
7
  editor: import('vue').ShallowRef<import('@tiptap/vue-3').Editor | undefined, import('@tiptap/vue-3').Editor | undefined>;
@@ -9,13 +9,13 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
9
9
  clear: () => boolean | undefined;
10
10
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
11
11
  change: (html: string) => any;
12
- "update:modelValue": (value: string) => any;
12
+ "update:modelValue": (value: RichTextModelValue) => any;
13
13
  blur: () => any;
14
14
  focus: () => any;
15
15
  uploadError: (error: unknown, file: File) => any;
16
16
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
17
  onChange?: ((html: string) => any) | undefined;
18
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ "onUpdate:modelValue"?: ((value: RichTextModelValue) => any) | undefined;
19
19
  onBlur?: (() => any) | undefined;
20
20
  onFocus?: (() => any) | undefined;
21
21
  onUploadError?: ((error: unknown, file: File) => any) | undefined;
@@ -29,9 +29,11 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
29
29
  id: string;
30
30
  readonly: boolean;
31
31
  minHeight: string;
32
+ localized: boolean;
32
33
  tools: RichTextTool[];
33
34
  pickImage: import('./types').RichTextImagePicker;
34
35
  accept: string[];
36
+ labels: RichTextLabels;
35
37
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
36
38
  fileInput: HTMLInputElement;
37
39
  }, any>;
@@ -1,4 +1,4 @@
1
- import { RichTextTool } from './types';
1
+ import { RichTextTableTool, RichTextTool } from './types';
2
2
  /**
3
3
  * Kept out of the component because `withDefaults` cannot reference a binding
4
4
  * declared inside `<script setup>` — it is hoisted out of `setup()`.
@@ -12,37 +12,9 @@ export interface ToolMeta {
12
12
  }
13
13
  export declare const TOOL_META: Record<Exclude<RichTextTool, 'divider'>, ToolMeta>;
14
14
  /** Shown as a second row while the caret sits inside a table. */
15
- export declare const TABLE_TOOLS: readonly [{
16
- readonly key: "addRowAfter";
17
- readonly label: "Row below";
18
- readonly icon: "rowAfter";
19
- }, {
20
- readonly key: "addRowBefore";
21
- readonly label: "Row above";
22
- readonly icon: "rowBefore";
23
- }, {
24
- readonly key: "addColumnAfter";
25
- readonly label: "Column after";
26
- readonly icon: "columnAfter";
27
- }, {
28
- readonly key: "addColumnBefore";
29
- readonly label: "Column before";
30
- readonly icon: "columnBefore";
31
- }, {
32
- readonly key: "deleteRow";
33
- readonly label: "Delete row";
34
- readonly icon: "deleteRow";
35
- }, {
36
- readonly key: "deleteColumn";
37
- readonly label: "Delete column";
38
- readonly icon: "deleteColumn";
39
- }, {
40
- readonly key: "mergeOrSplit";
41
- readonly label: "Merge or split cells";
42
- readonly icon: "mergeCells";
43
- }, {
44
- readonly key: "deleteTable";
45
- readonly label: "Delete table";
46
- readonly icon: "deleteTable";
47
- }];
48
- export type TableToolKey = (typeof TABLE_TOOLS)[number]['key'];
15
+ export declare const TABLE_TOOLS: {
16
+ key: RichTextTableTool;
17
+ label: string;
18
+ icon: string;
19
+ }[];
20
+ export type TableToolKey = RichTextTableTool;
@@ -1,16 +1,48 @@
1
1
  import { ControlSize, ControlStatus } from '../../composables/useFormField';
2
+ import { LocalizedFieldProps, LocalizedValue } from '../../composables/useLocalized';
2
3
  export type RichTextTool = 'bold' | 'italic' | 'strike' | 'code' | 'h2' | 'h3' | 'h4' | 'bulletList' | 'orderedList' | 'blockquote' | 'hr' | 'link' | 'table' | 'image' | 'youtube' | 'undo' | 'redo'
3
4
  /** A vertical rule between groups. */
4
5
  | 'divider';
5
- export interface RichTextUploadResult {
6
+ /** The keys of the second toolbar, the one that appears inside a table. */
7
+ export type RichTextTableTool = 'addRowAfter' | 'addRowBefore' | 'addColumnAfter' | 'addColumnBefore' | 'deleteRow' | 'deleteColumn' | 'mergeOrSplit' | 'deleteTable';
8
+ /**
9
+ * Everything this editor says out loud: a tooltip on every button, the two lines of the link
10
+ * bar, and the word shown while a file is going up.
11
+ */
12
+ export type RichTextLabelKey = Exclude<RichTextTool, 'divider'> | RichTextTableTool
13
+ /** The accessible name of the toolbar itself. */
14
+ | 'toolbar' | 'linkAddress' | 'youtubeAddress' | 'apply' | 'cancel' | 'uploading';
15
+ /**
16
+ * What the editor calls its own buttons. It knows nothing about the panel it is opened in, so
17
+ * whoever opens it translates it; a key left out stays English.
18
+ */
19
+ export type RichTextLabels = Partial<Record<RichTextLabelKey, string>>;
20
+ /**
21
+ * A picture going into the document: where it is right now, and what it is filed under.
22
+ *
23
+ * `path` is the library's own key, written into the document as `data-wx-path` and kept there.
24
+ * The address is not the picture — a bucket that moves, a signed link that expires, an image
25
+ * edited in place all change the URL and none of them change the key — so whoever stores the
26
+ * document can work the address out again from the key rather than serving last month's.
27
+ * Without a `path` the picture is simply an address, which is what an external one is.
28
+ */
29
+ export interface RichTextImage {
6
30
  url: string;
31
+ path?: string;
7
32
  alt?: string;
8
33
  }
9
- /** Uploads one file and resolves with the URL it ended up at. */
10
- export type RichTextUpload = (file: File) => Promise<RichTextUploadResult>;
11
- /** Opens a media library and resolves with the chosen URL, or `null` if cancelled. */
12
- export type RichTextImagePicker = () => Promise<string | null>;
13
- export interface RichTextProps {
34
+ /** What an upload answers with. */
35
+ export type RichTextUploadResult = RichTextImage;
36
+ /** Uploads one file and resolves with where it ended up. */
37
+ export type RichTextUpload = (file: File) => Promise<RichTextImage>;
38
+ /**
39
+ * Opens a media library and resolves with what was chosen, or `null` if cancelled. A bare
40
+ * string is an address and nothing else — fine for a picker with no library behind it.
41
+ */
42
+ export type RichTextImagePicker = () => Promise<RichTextImage | string | null>;
43
+ /** One language's HTML, or every language's when the field is localized. */
44
+ export type RichTextModelValue = string | LocalizedValue;
45
+ export interface RichTextProps extends LocalizedFieldProps {
14
46
  placeholder?: string;
15
47
  disabled?: boolean;
16
48
  readonly?: boolean;
@@ -32,6 +64,8 @@ export interface RichTextProps {
32
64
  pickImage?: RichTextImagePicker;
33
65
  /** MIME types accepted for upload. */
34
66
  accept?: string[];
67
+ /** What the buttons and the link bar are called, for a panel that is not in English. */
68
+ labels?: RichTextLabels;
35
69
  }
36
70
  export interface RichTextEmits {
37
71
  change: [html: string];
@@ -0,0 +1,2 @@
1
+ import { Ref } from 'vue';
2
+ export declare function useHoverPointer(): Ref<boolean>;
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export type { ControlSize, ControlStatus, ValidationErrors } from './composables
4
4
  export { useControlAttrs, type ControlAttrs } from './composables/useControlAttrs';
5
5
  export { provideLocales, useLocales, useLocalized, localeLabel, localizedValue, localesKey, type LocaleOption, type LocalesContext, type LocalizedValue, type LocalizedFieldProps, } from './composables/useLocalized';
6
6
  export { useElementWidth } from './composables/useElementWidth';
7
+ export { useHoverPointer } from './composables/useHoverPointer';
7
8
  export { useToast, toast, toastQueue, dismissToast, removeToast, clearToasts, type ToastApi, type ToastHandle, type ToastOptions, type ToastRecord, type ToastType, type ToastAction, } from './composables/useToast';
8
9
  export { openModal, createModal, useModal, connectModals, modalKey, type ModalHandle, type ModalOptions, type ModalPromise, } from './composables/useModal';
9
10
  export { confirm, type ConfirmOptions } from './composables/confirm';