@plexui/vue 0.16.0 → 0.18.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,8 +1,10 @@
1
1
  import { type PropType } from "vue";
2
2
  import type { Variants } from "@plexui/styles/types";
3
+ import { type MarkdownEditorFormat } from "../../lib/markdownEditorSchema.js";
3
4
  export declare const markdownEditorStyles: {
4
5
  toolbarButton: string;
5
6
  };
7
+ export type { MarkdownEditorFormat };
6
8
  declare const MarkdownEditorComponent: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
7
9
  /** Visual style of the editor. @default "outline" */
8
10
  variant: {
@@ -31,6 +33,23 @@ declare const MarkdownEditorComponent: import("vue").DefineComponent<import("vue
31
33
  type: StringConstructor;
32
34
  default: undefined;
33
35
  };
36
+ /**
37
+ * The formats the editor offers, read when the editor is created. A format left out has no toolbar button,
38
+ * shortcut or input rule; pasted and incoming content keeps its text without it, and the markdown does not write it.
39
+ * @default ["bold", "italic", "orderedList", "bulletList", "link"]
40
+ */
41
+ formats: {
42
+ type: PropType<MarkdownEditorFormat[]>;
43
+ default: undefined;
44
+ };
45
+ /**
46
+ * A single newline is a line break, read and written as one "\n", read when the editor is created. Without it a
47
+ * line break is written as a backslash and a newline, and a single newline joins the lines. @default false
48
+ */
49
+ breaks: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
34
53
  /** Minimum visible rows. @default 1 */
35
54
  rows: {
36
55
  type: NumberConstructor;
@@ -84,6 +103,23 @@ declare const MarkdownEditorComponent: import("vue").DefineComponent<import("vue
84
103
  type: StringConstructor;
85
104
  default: undefined;
86
105
  };
106
+ /**
107
+ * The formats the editor offers, read when the editor is created. A format left out has no toolbar button,
108
+ * shortcut or input rule; pasted and incoming content keeps its text without it, and the markdown does not write it.
109
+ * @default ["bold", "italic", "orderedList", "bulletList", "link"]
110
+ */
111
+ formats: {
112
+ type: PropType<MarkdownEditorFormat[]>;
113
+ default: undefined;
114
+ };
115
+ /**
116
+ * A single newline is a line break, read and written as one "\n", read when the editor is created. Without it a
117
+ * line break is written as a backslash and a newline, and a single newline joins the lines. @default false
118
+ */
119
+ breaks: {
120
+ type: BooleanConstructor;
121
+ default: boolean;
122
+ };
87
123
  /** Minimum visible rows. @default 1 */
88
124
  rows: {
89
125
  type: NumberConstructor;
@@ -113,6 +149,8 @@ declare const MarkdownEditorComponent: import("vue").DefineComponent<import("vue
113
149
  variant: "soft" | "outline";
114
150
  ariaInvalid: boolean;
115
151
  rows: number;
152
+ formats: MarkdownEditorFormat[];
153
+ breaks: boolean;
116
154
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
117
155
  /**
118
156
  * Compact rich text editor for markdown, with a formatting toolbar (bold,
@@ -146,6 +184,23 @@ export declare const MarkdownEditor: import("vue").DefineComponent<import("vue")
146
184
  type: StringConstructor;
147
185
  default: undefined;
148
186
  };
187
+ /**
188
+ * The formats the editor offers, read when the editor is created. A format left out has no toolbar button,
189
+ * shortcut or input rule; pasted and incoming content keeps its text without it, and the markdown does not write it.
190
+ * @default ["bold", "italic", "orderedList", "bulletList", "link"]
191
+ */
192
+ formats: {
193
+ type: PropType<MarkdownEditorFormat[]>;
194
+ default: undefined;
195
+ };
196
+ /**
197
+ * A single newline is a line break, read and written as one "\n", read when the editor is created. Without it a
198
+ * line break is written as a backslash and a newline, and a single newline joins the lines. @default false
199
+ */
200
+ breaks: {
201
+ type: BooleanConstructor;
202
+ default: boolean;
203
+ };
149
204
  /** Minimum visible rows. @default 1 */
150
205
  rows: {
151
206
  type: NumberConstructor;
@@ -199,6 +254,23 @@ export declare const MarkdownEditor: import("vue").DefineComponent<import("vue")
199
254
  type: StringConstructor;
200
255
  default: undefined;
201
256
  };
257
+ /**
258
+ * The formats the editor offers, read when the editor is created. A format left out has no toolbar button,
259
+ * shortcut or input rule; pasted and incoming content keeps its text without it, and the markdown does not write it.
260
+ * @default ["bold", "italic", "orderedList", "bulletList", "link"]
261
+ */
262
+ formats: {
263
+ type: PropType<MarkdownEditorFormat[]>;
264
+ default: undefined;
265
+ };
266
+ /**
267
+ * A single newline is a line break, read and written as one "\n", read when the editor is created. Without it a
268
+ * line break is written as a backslash and a newline, and a single newline joins the lines. @default false
269
+ */
270
+ breaks: {
271
+ type: BooleanConstructor;
272
+ default: boolean;
273
+ };
202
274
  /** Minimum visible rows. @default 1 */
203
275
  rows: {
204
276
  type: NumberConstructor;
@@ -228,6 +300,7 @@ export declare const MarkdownEditor: import("vue").DefineComponent<import("vue")
228
300
  variant: "soft" | "outline";
229
301
  ariaInvalid: boolean;
230
302
  rows: number;
303
+ formats: MarkdownEditorFormat[];
304
+ breaks: boolean;
231
305
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
232
306
  export type MarkdownEditorProps = InstanceType<typeof MarkdownEditorComponent>["$props"];
233
- export {};
@@ -1 +1 @@
1
- export { MarkdownEditor, markdownEditorStyles, type MarkdownEditorProps } from "./MarkdownEditor.js";
1
+ export { MarkdownEditor, markdownEditorStyles, type MarkdownEditorFormat, type MarkdownEditorProps } from "./MarkdownEditor.js";
@@ -438,12 +438,6 @@ export type SidebarTriggerProps = ButtonHTMLAttributes;
438
438
  export declare const SidebarTrigger: ReturnType<typeof part<SidebarTriggerProps>>;
439
439
  export type SidebarMobileMenuButtonProps = ButtonHTMLAttributes;
440
440
  export declare const SidebarMobileMenuButton: ReturnType<typeof part<SidebarMobileMenuButtonProps>>;
441
- /**
442
- * The phone drawer: a modal dialog while it is open. Focus moves into it and Tab goes round its controls, the page
443
- * behind is inert (SidebarInset), Escape inside it closes it after any layer over it has taken its own, and focus
444
- * goes back to the control that opened it. A swipe in from the edge it slides from opens it and a swipe back closes
445
- * it (lib/phoneDrawer).
446
- */
447
441
  declare const SidebarMobileComponent: DefineComponent<import("vue").ExtractPropTypes<{
448
442
  /** When true, drawer is positioned absolute instead of fixed (for contained demos) */
449
443
  contained: {
@@ -0,0 +1,54 @@
1
+ import type { MaskitoOptions } from "@maskito/core";
2
+ import { type MaskitoDateMode, type MaskitoTimeMode } from "@maskito/kit";
3
+ import { DateTime, type Zone } from "luxon";
4
+ export type DateInputFormat = {
5
+ mode: MaskitoDateMode;
6
+ separator: string;
7
+ /** Set for a date and time */
8
+ timeMode?: MaskitoTimeMode;
9
+ dateTimeSeparator: string;
10
+ /** Earliest allowed instant, in milliseconds */
11
+ min?: number;
12
+ /** Latest allowed instant, in milliseconds */
13
+ max?: number;
14
+ /** Zone of the value (dateInputZone): typed dates are made in it. Luxon's default zone when not set */
15
+ zone?: Zone | string;
16
+ };
17
+ /**
18
+ * The zone typed dates are made in: the value's own zone object (Luxon's default zone without a value). A zone rebuilt
19
+ * from its name can be another one: Luxon's system zone becomes the zone of its name, the zone named UTC becomes the
20
+ * fixed UTC offset, and a name like UTC+5:5 (a 5:05 offset) does not parse back. The same object for the same zone,
21
+ * so it keys a memo.
22
+ */
23
+ export declare const dateInputZone: (value: DateTime | null | undefined) => Zone | undefined;
24
+ /** The key a DateInput re-shows its value on: the instant and the zone. */
25
+ export declare const dateInputValueKey: (value: DateTime | null | undefined) => string;
26
+ /** The text a DateInput shows for a value: its wall clock in its own zone, kept within min and max. */
27
+ export declare const formatDateInput: (value: DateTime | null, format: DateInputFormat) => string;
28
+ /**
29
+ * The value for a complete text, or `null` while it is not one. A typed
30
+ * date is made in the format's zone from the typed fields, so the time is
31
+ * the one typed on a daylight saving day too. A date that does not exist is
32
+ * `null`; a time skipped by a clock change moves forward, as Luxon does, and
33
+ * a time the clocks show twice is its first pass, as the browser's Date reads
34
+ * it, unless only the second is within min and max or the text is a bound's
35
+ * own. Kept within min and max when the mode has a year, as Maskito's reading is.
36
+ */
37
+ export declare const parseDateInput: (text: string, format: DateInputFormat) => DateTime<boolean> | null;
38
+ /**
39
+ * min or max for Maskito's mask, which builds the typed dates with the
40
+ * browser's Date from their fields: the same fields, read in the value's
41
+ * zone, so the mask compares wall clocks. Only its steps for a date not yet
42
+ * complete read them, as keepTypedValue takes over the rest.
43
+ */
44
+ export declare const maskDate: (millis: number, zone: Zone | string | undefined) => Date;
45
+ /**
46
+ * Maskito's date and date-and-time masks end with a step that rebuilds a complete date with the browser's Date to keep
47
+ * it within min and max: in a zone whose clocks skipped a whole day the date moved a day, in the hour the browser's
48
+ * clocks skip a time typed for a value in another zone moved an hour, and min and max held on the browser's clock.
49
+ * This step reads a complete text in the value's zone, as the value is read (a time the clocks skip moves forward, an
50
+ * hour they repeat is its first pass or the one within min and max), and shows it kept within min and max as instants,
51
+ * so the text is the value's. A date and time without its time yet keeps its date within the dates of min and max. A
52
+ * date that does not exist, or one not yet complete, stays with Maskito's step.
53
+ */
54
+ export declare const keepTypedValue: (options: MaskitoOptions, format: DateInputFormat) => MaskitoOptions;
@@ -0,0 +1,47 @@
1
+ import type { AnyExtension } from "@tiptap/core";
2
+ export type MarkdownEditorFormat = "bold" | "italic" | "orderedList" | "bulletList" | "link";
3
+ export declare const MARKDOWN_EDITOR_FORMATS: readonly MarkdownEditorFormat[];
4
+ export type MarkdownEditorSchema = {
5
+ /** The formats the editor offers: a toolbar button, its shortcut and input rule, and a mark or node in the schema */
6
+ formats: ReadonlySet<MarkdownEditorFormat>;
7
+ /** A single newline is a line break, read and written as one "\n" */
8
+ breaks: boolean;
9
+ };
10
+ export declare const markdownEditorSchema: (formats?: readonly MarkdownEditorFormat[], breaks?: boolean) => MarkdownEditorSchema;
11
+ /**
12
+ * The editor's extensions. A format left out has no mark or node: its shortcut and input rule are gone, and pasted or
13
+ * incoming content keeps its text without it, so the markdown going out does not write it either.
14
+ */
15
+ export declare const markdownEditorExtensions: ({ formats, breaks }: MarkdownEditorSchema, placeholder?: string) => AnyExtension[];
16
+ type MarkdownNode = {
17
+ type: string;
18
+ value?: string;
19
+ position?: {
20
+ start: {
21
+ offset?: number;
22
+ };
23
+ end: {
24
+ offset?: number;
25
+ };
26
+ };
27
+ children?: MarkdownNode[];
28
+ };
29
+ type HtmlNode = {
30
+ type: string;
31
+ tagName?: string;
32
+ value?: string;
33
+ properties?: Record<string, unknown>;
34
+ children?: HtmlNode[];
35
+ };
36
+ export declare function remarkWithoutHtml(this: {
37
+ data(): object;
38
+ }): void;
39
+ export declare function remarkLineBreaks(): (tree: MarkdownNode, file: {
40
+ value?: unknown;
41
+ }) => void;
42
+ /**
43
+ * The first frame's HTML in the editor's schema. A document left with no block is the empty paragraph ProseMirror
44
+ * gives it, with the placeholder the editor would show (`placeholder` only while it can be edited).
45
+ */
46
+ export declare const rehypeEditorSchema: ({ formats }: MarkdownEditorSchema, placeholder?: string) => () => (tree: HtmlNode) => void;
47
+ export {};
@@ -32,6 +32,13 @@ export declare function attachDrawerSwipe({ root, drawer, isOpen, setOpen, enabl
32
32
  export declare const drawerTabbables: (drawer: HTMLElement) => HTMLElement[];
33
33
  /** The first control of the open drawer, or the drawer itself */
34
34
  export declare const drawerInitialFocus: (drawer: HTMLElement) => HTMLElement;
35
+ /**
36
+ * Focuses where focus goes when the drawer closes: the control that opened it, or, when that cannot take focus (it
37
+ * sat in another drawer that has closed since, it is gone, or it was the page itself), the menu button of this
38
+ * drawer's provider, then any menu button on the page. The first that takes focus; `null` when none does. A drawer
39
+ * that has already left the page has no provider around it, so `root` is the provider taken while it was open.
40
+ */
41
+ export declare const returnDrawerFocus: (opener: Element | null, drawer: HTMLElement, root?: Element | null) => HTMLElement | null;
35
42
  /**
36
43
  * Tab from the last control goes to the first and Shift+Tab from the first to the last, so focus stays in the open
37
44
  * drawer. A layer over it in a portal (a menu, a dialog) keeps its own Tab.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/vue",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "@maskito/core": "5.2.2",
78
78
  "@maskito/kit": "5.2.2",
79
79
  "@maskito/vue": "5.2.2",
80
- "@plexui/styles": "^0.1.41",
80
+ "@plexui/styles": "^0.1.43",
81
81
  "@tanstack/table-core": "8.21.3",
82
82
  "@tanstack/vue-table": "8.21.3",
83
83
  "@tiptap/core": "3.21.0",