@nexxtmove/ui 1.40.1 → 1.42.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.
- package/dist/components/editor/molecules/EditorFontSize/EditorFontSize.vue.d.ts +117 -0
- package/dist/components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.vue.d.ts +40 -24
- package/dist/components/editor/molecules/EditorLineHeight/EditorLineHeight.vue.d.ts +64 -36
- package/dist/components/molecules/PickerList/PickerList.vue.d.ts +14 -2
- package/dist/components/organisms/FontPicker/FontPicker.vue.d.ts +125 -0
- package/dist/components/organisms/FontPicker/useFontPreviewLoader.d.ts +20 -0
- package/dist/components/organisms/PickerPanel/PickerPanel.vue.d.ts +11 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +2659 -2106
- package/dist/nuxt.js +2 -0
- package/package.json +1 -1
- package/src/components/atoms/Skeleton/Skeleton.vue +1 -1
- package/src/components/editor/molecules/EditorFontSize/EditorFontSize.vue +253 -0
- package/src/components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.vue +102 -28
- package/src/components/editor/molecules/EditorLineHeight/EditorLineHeight.vue +140 -47
- package/src/components/molecules/PickerList/PickerList.vue +50 -10
- package/src/components/organisms/FontPicker/FontPicker.vue +576 -0
- package/src/components/organisms/FontPicker/useFontPreviewLoader.ts +118 -0
- package/src/components/organisms/PickerPanel/PickerPanel.vue +16 -1
- package/src/components.json +2 -0
- package/src/index.ts +20 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The steps the slider can land on, as the font-size class they are stored as and the pixels that
|
|
3
|
+
* class is: every `--text-*` size of the theme, `text-xs` to `text-9xl`, with the px taken from
|
|
4
|
+
* `tailwind/nexxtmove.tailwind.theme.css` at 16px a rem. The size is absolute: a step replaces
|
|
5
|
+
* the size the text had.
|
|
6
|
+
*
|
|
7
|
+
* The consumer stores these classes and lists them in an `@source inline` rule, so adding or
|
|
8
|
+
* renaming a token is a breaking change even though the component API stays the same.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EDITOR_FONT_SIZE_STEPS: readonly [{
|
|
11
|
+
readonly token: "text-xs";
|
|
12
|
+
readonly px: 12;
|
|
13
|
+
}, {
|
|
14
|
+
readonly token: "text-sm";
|
|
15
|
+
readonly px: 14;
|
|
16
|
+
}, {
|
|
17
|
+
readonly token: "text-base";
|
|
18
|
+
readonly px: 16;
|
|
19
|
+
}, {
|
|
20
|
+
readonly token: "text-lg";
|
|
21
|
+
readonly px: 18;
|
|
22
|
+
}, {
|
|
23
|
+
readonly token: "text-xl";
|
|
24
|
+
readonly px: 20;
|
|
25
|
+
}, {
|
|
26
|
+
readonly token: "text-2xl";
|
|
27
|
+
readonly px: 24;
|
|
28
|
+
}, {
|
|
29
|
+
readonly token: "text-3xl";
|
|
30
|
+
readonly px: 30;
|
|
31
|
+
}, {
|
|
32
|
+
readonly token: "text-4xl";
|
|
33
|
+
readonly px: 36;
|
|
34
|
+
}, {
|
|
35
|
+
readonly token: "text-5xl";
|
|
36
|
+
readonly px: 48;
|
|
37
|
+
}, {
|
|
38
|
+
readonly token: "text-6xl";
|
|
39
|
+
readonly px: 60;
|
|
40
|
+
}, {
|
|
41
|
+
readonly token: "text-7xl";
|
|
42
|
+
readonly px: 72;
|
|
43
|
+
}, {
|
|
44
|
+
readonly token: "text-8xl";
|
|
45
|
+
readonly px: 96;
|
|
46
|
+
}, {
|
|
47
|
+
readonly token: "text-9xl";
|
|
48
|
+
readonly px: 128;
|
|
49
|
+
}];
|
|
50
|
+
/**
|
|
51
|
+
* The font size as the editor needs it: the Tailwind class itself, so the consumer can put the
|
|
52
|
+
* model value straight on the element it styles. "No size of its own" is `null` on the model, not
|
|
53
|
+
* a member of this type.
|
|
54
|
+
*/
|
|
55
|
+
export type EditorFontSizeValue = (typeof EDITOR_FONT_SIZE_STEPS)[number]['token'];
|
|
56
|
+
/** Overridable copy of the readout and the reset button. Every key is optional. */
|
|
57
|
+
export interface EditorFontSizeMessages {
|
|
58
|
+
/** Unit behind the pixel size. Defaults to `'px'`. */
|
|
59
|
+
unit?: string;
|
|
60
|
+
/** Accessible name and tooltip of the reset button. Defaults to the Dutch `'Terug naar standaard'`. */
|
|
61
|
+
reset?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface NexxtEditorFontSizeProps {
|
|
64
|
+
/**
|
|
65
|
+
* The size the text has without a class of its own; the slider sits on its step while the
|
|
66
|
+
* model is `null`. Defaults to `text-sm`, the app's text base. Pass a token from
|
|
67
|
+
* `EDITOR_FONT_SIZE_STEPS`: one that is not on the list falls back to `text-sm`, and a
|
|
68
|
+
* development build warns once per value. The fallback is for existing or faulty data, not a
|
|
69
|
+
* feature to rely on.
|
|
70
|
+
*/
|
|
71
|
+
defaultToken?: EditorFontSizeValue;
|
|
72
|
+
/**
|
|
73
|
+
* Header text of the settings block. Defaults to the Dutch `'Grootte'`; the library has no i18n
|
|
74
|
+
* layer, so a consumer in another language passes its own copy in.
|
|
75
|
+
*/
|
|
76
|
+
label?: string;
|
|
77
|
+
/**
|
|
78
|
+
* Copy of the readout and the reset button. Merged per key, so overriding one key keeps the
|
|
79
|
+
* defaults of the others. Copy is never translated inside the component.
|
|
80
|
+
*/
|
|
81
|
+
messages?: EditorFontSizeMessages;
|
|
82
|
+
}
|
|
83
|
+
declare const _default: typeof __VLS_export;
|
|
84
|
+
export default _default;
|
|
85
|
+
declare const __VLS_export: import('vue').DefineComponent<NexxtEditorFontSizeProps & {
|
|
86
|
+
/**
|
|
87
|
+
* The chosen size, as the Tailwind class to apply. `null` -- also what an unset model is -- is no
|
|
88
|
+
* class of its own: the element keeps `defaultToken`. Moving the slider always writes a token,
|
|
89
|
+
* the default step included; only the reset button writes `null`.
|
|
90
|
+
*
|
|
91
|
+
* The app should only write tokens from `EDITOR_FONT_SIZE_STEPS`. A value that is not on the list
|
|
92
|
+
* (existing or faulty data, `text-[15px]` say) is shown on the default step, keeps the reset
|
|
93
|
+
* button visible so the user can get back to a clean `null`, and makes a development build warn
|
|
94
|
+
* once per value. It is never rewritten until the user picks a step.
|
|
95
|
+
*/
|
|
96
|
+
modelValue?: EditorFontSizeValue | null;
|
|
97
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
98
|
+
"update:modelValue": (value: "text-xs" | "text-4xl" | "text-3xl" | "text-2xl" | "text-xl" | "text-lg" | "text-base" | "text-sm" | "text-5xl" | "text-6xl" | "text-7xl" | "text-8xl" | "text-9xl" | null) => any;
|
|
99
|
+
reset: () => any;
|
|
100
|
+
pointerup: (event: PointerEvent) => any;
|
|
101
|
+
}, string, import('vue').PublicProps, Readonly<NexxtEditorFontSizeProps & {
|
|
102
|
+
/**
|
|
103
|
+
* The chosen size, as the Tailwind class to apply. `null` -- also what an unset model is -- is no
|
|
104
|
+
* class of its own: the element keeps `defaultToken`. Moving the slider always writes a token,
|
|
105
|
+
* the default step included; only the reset button writes `null`.
|
|
106
|
+
*
|
|
107
|
+
* The app should only write tokens from `EDITOR_FONT_SIZE_STEPS`. A value that is not on the list
|
|
108
|
+
* (existing or faulty data, `text-[15px]` say) is shown on the default step, keeps the reset
|
|
109
|
+
* button visible so the user can get back to a clean `null`, and makes a development build warn
|
|
110
|
+
* once per value. It is never rewritten until the user picks a step.
|
|
111
|
+
*/
|
|
112
|
+
modelValue?: EditorFontSizeValue | null;
|
|
113
|
+
}> & Readonly<{
|
|
114
|
+
"onUpdate:modelValue"?: ((value: "text-xs" | "text-4xl" | "text-3xl" | "text-2xl" | "text-xl" | "text-lg" | "text-base" | "text-sm" | "text-5xl" | "text-6xl" | "text-7xl" | "text-8xl" | "text-9xl" | null) => any) | undefined;
|
|
115
|
+
onReset?: (() => any) | undefined;
|
|
116
|
+
onPointerup?: ((event: PointerEvent) => any) | undefined;
|
|
117
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,45 +1,46 @@
|
|
|
1
|
+
import { EditorFontSizeValue } from '../EditorFontSize/EditorFontSize.vue';
|
|
1
2
|
/**
|
|
2
|
-
* The steps the slider can land on, as the class they are stored as and the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* The steps the slider can land on, as the class they are stored as and the em that class is.
|
|
4
|
+
* In em, so the spacing moves with the font size: a fixed 2px does nothing at 128px. Not a scale
|
|
5
|
+
* Tailwind has names for (`tracking-wide` is 0.025em, but there is no -0.01em), so every step is
|
|
6
|
+
* an arbitrary-value class.
|
|
6
7
|
*
|
|
7
8
|
* The middle step is no class at all: zero is what the text already does, and
|
|
8
9
|
* storing nothing for it keeps the "no class means default" every other
|
|
9
10
|
* setting has. The negative side is there on purpose: tightening a large
|
|
10
11
|
* heading is a real need.
|
|
11
12
|
*
|
|
12
|
-
* The consumer stores these classes and lists them in an `@source inline` rule
|
|
13
|
-
* so adding or renaming a token is a breaking change even though the
|
|
14
|
-
* API stays the same.
|
|
13
|
+
* The consumer stores these classes and lists them in an `@source inline` rule (and the back end
|
|
14
|
+
* allows exactly these), so adding or renaming a token is a breaking change even though the
|
|
15
|
+
* component API stays the same.
|
|
15
16
|
*/
|
|
16
17
|
export declare const EDITOR_LETTER_SPACING_STEPS: readonly [{
|
|
17
|
-
readonly token: "tracking-[-
|
|
18
|
-
readonly
|
|
18
|
+
readonly token: "tracking-[-0.05em]";
|
|
19
|
+
readonly em: -0.05;
|
|
19
20
|
}, {
|
|
20
|
-
readonly token: "tracking-[-0.
|
|
21
|
-
readonly
|
|
21
|
+
readonly token: "tracking-[-0.025em]";
|
|
22
|
+
readonly em: -0.025;
|
|
22
23
|
}, {
|
|
23
|
-
readonly token: "tracking-[-0.
|
|
24
|
-
readonly
|
|
24
|
+
readonly token: "tracking-[-0.01em]";
|
|
25
|
+
readonly em: -0.01;
|
|
25
26
|
}, {
|
|
26
27
|
readonly token: null;
|
|
27
|
-
readonly
|
|
28
|
+
readonly em: 0;
|
|
28
29
|
}, {
|
|
29
|
-
readonly token: "tracking-[0.
|
|
30
|
-
readonly
|
|
30
|
+
readonly token: "tracking-[0.01em]";
|
|
31
|
+
readonly em: 0.01;
|
|
31
32
|
}, {
|
|
32
|
-
readonly token: "tracking-[0.
|
|
33
|
-
readonly
|
|
33
|
+
readonly token: "tracking-[0.025em]";
|
|
34
|
+
readonly em: 0.025;
|
|
34
35
|
}, {
|
|
35
|
-
readonly token: "tracking-[
|
|
36
|
-
readonly
|
|
36
|
+
readonly token: "tracking-[0.05em]";
|
|
37
|
+
readonly em: 0.05;
|
|
37
38
|
}, {
|
|
38
|
-
readonly token: "tracking-[
|
|
39
|
-
readonly
|
|
39
|
+
readonly token: "tracking-[0.075em]";
|
|
40
|
+
readonly em: 0.075;
|
|
40
41
|
}, {
|
|
41
|
-
readonly token: "tracking-[
|
|
42
|
-
readonly
|
|
42
|
+
readonly token: "tracking-[0.1em]";
|
|
43
|
+
readonly em: 0.1;
|
|
43
44
|
}];
|
|
44
45
|
/**
|
|
45
46
|
* The letter spacing as the editor needs it: the Tailwind class itself, so the
|
|
@@ -55,6 +56,13 @@ export interface EditorLetterSpacingMessages {
|
|
|
55
56
|
decimalSeparator?: string;
|
|
56
57
|
}
|
|
57
58
|
export interface NexxtEditorLetterSpacingProps {
|
|
59
|
+
/**
|
|
60
|
+
* The `text-*` token the text renders at on the screen on show (for a heading, the token of
|
|
61
|
+
* its heading type): the base the readout turns the em into px with. Defaults to `text-sm`,
|
|
62
|
+
* the app's text base. A token that is not in `EDITOR_FONT_SIZE_STEPS` falls back to
|
|
63
|
+
* `text-sm`, and a development build warns once per value.
|
|
64
|
+
*/
|
|
65
|
+
fontSize?: EditorFontSizeValue;
|
|
58
66
|
/**
|
|
59
67
|
* Header text of the settings block. Defaults to the Dutch
|
|
60
68
|
* `'Letterafstand'`; the library has no i18n layer, so a consumer in another
|
|
@@ -73,6 +81,10 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorLetterSpaci
|
|
|
73
81
|
/**
|
|
74
82
|
* The selected letter spacing, as the Tailwind class to apply. `null` -- also
|
|
75
83
|
* what an unset model is -- is the default step: no class at all, zero.
|
|
84
|
+
*
|
|
85
|
+
* A value that is not on the list (an old px class such as `tracking-[1px]`, say) is shown on
|
|
86
|
+
* the default step and makes a development build warn once per value; the first change writes a
|
|
87
|
+
* valid class back.
|
|
76
88
|
*/
|
|
77
89
|
modelValue?: EditorLetterSpacingValue | null;
|
|
78
90
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -82,6 +94,10 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorLetterSpaci
|
|
|
82
94
|
/**
|
|
83
95
|
* The selected letter spacing, as the Tailwind class to apply. `null` -- also
|
|
84
96
|
* what an unset model is -- is the default step: no class at all, zero.
|
|
97
|
+
*
|
|
98
|
+
* A value that is not on the list (an old px class such as `tracking-[1px]`, say) is shown on
|
|
99
|
+
* the default step and makes a development build warn once per value; the first change writes a
|
|
100
|
+
* valid class back.
|
|
85
101
|
*/
|
|
86
102
|
modelValue?: EditorLetterSpacingValue | null;
|
|
87
103
|
}> & Readonly<{
|
|
@@ -1,57 +1,70 @@
|
|
|
1
|
+
import { EditorFontSizeValue } from '../EditorFontSize/EditorFontSize.vue';
|
|
1
2
|
/**
|
|
2
|
-
* The steps the slider can land on, as the class they are stored as and the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* line height set here does not scale with the font size; that is the deal the
|
|
6
|
-
* fixed steps make, and nothing here tries to compensate for it.
|
|
3
|
+
* The steps the slider can land on, as the class they are stored as and the factor of the font
|
|
4
|
+
* size that class is. Every class is a unitless arbitrary value (`leading-[1.5]`), so the line
|
|
5
|
+
* height scales with the text: at 128px a fixed `leading-9` (36px) would make the lines overlap.
|
|
7
6
|
*
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
7
|
+
* The factors run from 0.8 to 2. Below 1 the lines are tighter than the text is tall: meant for
|
|
8
|
+
* large display headings, where ascenders and descenders may touch or clip.
|
|
10
9
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* The first step is no class at all: the element keeps the line height of its `text-*` token,
|
|
11
|
+
* see `EDITOR_TEXT_LINE_HEIGHT_RATIOS`. Its `factor` is `null` because it depends on that token.
|
|
12
|
+
*
|
|
13
|
+
* The consumer stores these classes and lists them in an `@source inline` rule (and the back end
|
|
14
|
+
* allows exactly these), so adding or renaming a token is a breaking change even though the
|
|
15
|
+
* component API stays the same.
|
|
14
16
|
*/
|
|
15
17
|
export declare const EDITOR_LINE_HEIGHT_STEPS: readonly [{
|
|
16
18
|
readonly token: null;
|
|
17
|
-
readonly
|
|
19
|
+
readonly factor: null;
|
|
20
|
+
}, {
|
|
21
|
+
readonly token: "leading-[0.8]";
|
|
22
|
+
readonly factor: 0.8;
|
|
18
23
|
}, {
|
|
19
|
-
readonly token: "leading-
|
|
20
|
-
readonly
|
|
24
|
+
readonly token: "leading-[0.85]";
|
|
25
|
+
readonly factor: 0.85;
|
|
21
26
|
}, {
|
|
22
|
-
readonly token: "leading-
|
|
23
|
-
readonly
|
|
27
|
+
readonly token: "leading-[0.9]";
|
|
28
|
+
readonly factor: 0.9;
|
|
24
29
|
}, {
|
|
25
|
-
readonly token: "leading-
|
|
26
|
-
readonly
|
|
30
|
+
readonly token: "leading-[0.95]";
|
|
31
|
+
readonly factor: 0.95;
|
|
27
32
|
}, {
|
|
28
|
-
readonly token: "leading-
|
|
29
|
-
readonly
|
|
33
|
+
readonly token: "leading-[1]";
|
|
34
|
+
readonly factor: 1;
|
|
30
35
|
}, {
|
|
31
|
-
readonly token: "leading-
|
|
32
|
-
readonly
|
|
36
|
+
readonly token: "leading-[1.1]";
|
|
37
|
+
readonly factor: 1.1;
|
|
33
38
|
}, {
|
|
34
|
-
readonly token: "leading-
|
|
35
|
-
readonly
|
|
39
|
+
readonly token: "leading-[1.2]";
|
|
40
|
+
readonly factor: 1.2;
|
|
36
41
|
}, {
|
|
37
|
-
readonly token: "leading-
|
|
38
|
-
readonly
|
|
42
|
+
readonly token: "leading-[1.3]";
|
|
43
|
+
readonly factor: 1.3;
|
|
39
44
|
}, {
|
|
40
|
-
readonly token: "leading-
|
|
41
|
-
readonly
|
|
45
|
+
readonly token: "leading-[1.4]";
|
|
46
|
+
readonly factor: 1.4;
|
|
42
47
|
}, {
|
|
43
|
-
readonly token: "leading-
|
|
44
|
-
readonly
|
|
48
|
+
readonly token: "leading-[1.5]";
|
|
49
|
+
readonly factor: 1.5;
|
|
45
50
|
}, {
|
|
46
|
-
readonly token: "leading-
|
|
47
|
-
readonly
|
|
51
|
+
readonly token: "leading-[1.6]";
|
|
52
|
+
readonly factor: 1.6;
|
|
48
53
|
}, {
|
|
49
|
-
readonly token: "leading-
|
|
50
|
-
readonly
|
|
54
|
+
readonly token: "leading-[1.75]";
|
|
55
|
+
readonly factor: 1.75;
|
|
51
56
|
}, {
|
|
52
|
-
readonly token: "leading-
|
|
53
|
-
readonly
|
|
57
|
+
readonly token: "leading-[2]";
|
|
58
|
+
readonly factor: 2;
|
|
54
59
|
}];
|
|
60
|
+
/**
|
|
61
|
+
* The line height each `text-*` token carries by itself, as a factor of its size: Tailwind v4's
|
|
62
|
+
* default `--text-*--line-height`, written as the same fractions. The theme of this library sets
|
|
63
|
+
* the sizes but not these, so the defaults are what renders. This is what the first step of
|
|
64
|
+
* `EDITOR_LINE_HEIGHT_STEPS`, no class, looks like; exported so a consumer that needs the
|
|
65
|
+
* default line height in px does not keep a copy of its own.
|
|
66
|
+
*/
|
|
67
|
+
export declare const EDITOR_TEXT_LINE_HEIGHT_RATIOS: Readonly<Record<EditorFontSizeValue, number>>;
|
|
55
68
|
/**
|
|
56
69
|
* The line height as the editor needs it: the Tailwind class itself, so the
|
|
57
70
|
* consumer can put the model value straight on the element it styles. The
|
|
@@ -63,12 +76,19 @@ export interface EditorLineHeightMessages {
|
|
|
63
76
|
/** Unit shown behind the value. Defaults to `'px'`. */
|
|
64
77
|
unit?: string;
|
|
65
78
|
/**
|
|
66
|
-
*
|
|
79
|
+
* Name of the first step, no class, shown before its px as `Standaard · 20 px`. Defaults to
|
|
67
80
|
* the Dutch `'Standaard'`.
|
|
68
81
|
*/
|
|
69
82
|
default?: string;
|
|
70
83
|
}
|
|
71
84
|
export interface NexxtEditorLineHeightProps {
|
|
85
|
+
/**
|
|
86
|
+
* The `text-*` token the text renders at on the screen on show (for a heading, the token of
|
|
87
|
+
* its heading type): the base the readout turns the factor into px with. Defaults to
|
|
88
|
+
* `text-sm`, the app's text base. A token that is not in `EDITOR_FONT_SIZE_STEPS` falls back
|
|
89
|
+
* to `text-sm`, and a development build warns once per value.
|
|
90
|
+
*/
|
|
91
|
+
fontSize?: EditorFontSizeValue;
|
|
72
92
|
/**
|
|
73
93
|
* Header text of the settings block. Defaults to the Dutch
|
|
74
94
|
* `'Regelafstand'`; the library has no i18n layer, so a consumer in another
|
|
@@ -87,6 +107,10 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorLineHeightP
|
|
|
87
107
|
/**
|
|
88
108
|
* The selected line height, as the Tailwind class to apply. `null` -- also
|
|
89
109
|
* what an unset model is -- is the default step: no class at all.
|
|
110
|
+
*
|
|
111
|
+
* A value that is not on the list (an old px class such as `leading-6`, say) is shown on the
|
|
112
|
+
* default step and makes a development build warn once per value; the first change writes a
|
|
113
|
+
* valid class back.
|
|
90
114
|
*/
|
|
91
115
|
modelValue?: EditorLineHeightValue | null;
|
|
92
116
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
@@ -96,6 +120,10 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorLineHeightP
|
|
|
96
120
|
/**
|
|
97
121
|
* The selected line height, as the Tailwind class to apply. `null` -- also
|
|
98
122
|
* what an unset model is -- is the default step: no class at all.
|
|
123
|
+
*
|
|
124
|
+
* A value that is not on the list (an old px class such as `leading-6`, say) is shown on the
|
|
125
|
+
* default step and makes a development build warn once per value; the first change writes a
|
|
126
|
+
* valid class back.
|
|
99
127
|
*/
|
|
100
128
|
modelValue?: EditorLineHeightValue | null;
|
|
101
129
|
}> & Readonly<{
|
|
@@ -4,8 +4,8 @@ export interface NexxtPickerItemData {
|
|
|
4
4
|
id: string;
|
|
5
5
|
/** Visible label and accessible name of the option; searched and matched by type-ahead. */
|
|
6
6
|
label: string;
|
|
7
|
-
/** Icon in front of the label, also passed to the `preview` slot. */
|
|
8
|
-
icon
|
|
7
|
+
/** Icon in front of the label, also passed to the `preview` slot. Without it the row has no icon. */
|
|
8
|
+
icon?: NexxtIconName;
|
|
9
9
|
/** Id of a group in `groups`. Missing, or not in `groups`: ungrouped, rendered at the top. */
|
|
10
10
|
group?: string;
|
|
11
11
|
/** Extra search terms (synonyms, old names). Matched, never shown. */
|
|
@@ -48,6 +48,12 @@ interface NexxtPickerListProps {
|
|
|
48
48
|
* `(n) => \`${n} resultaten\``. Without it the region stays empty.
|
|
49
49
|
*/
|
|
50
50
|
resultsAnnouncement?: (count: number) => string;
|
|
51
|
+
/**
|
|
52
|
+
* More items are on their way. Sets `aria-busy` on the listbox and holds back the empty state,
|
|
53
|
+
* so a search that finds nothing yet does not claim there is nothing. Pair it with placeholder
|
|
54
|
+
* rows in the `append` slot.
|
|
55
|
+
*/
|
|
56
|
+
busy?: boolean;
|
|
51
57
|
}
|
|
52
58
|
type __VLS_Props = NexxtPickerListProps;
|
|
53
59
|
type __VLS_Slots = {
|
|
@@ -61,6 +67,11 @@ type __VLS_Slots = {
|
|
|
61
67
|
search: string;
|
|
62
68
|
clear: () => void;
|
|
63
69
|
}): unknown;
|
|
70
|
+
/**
|
|
71
|
+
* Inside the listbox, after the last group: placeholder rows while `busy`, say. Not an option and
|
|
72
|
+
* never reached by the keyboard, so mark it `aria-hidden`.
|
|
73
|
+
*/
|
|
74
|
+
append?(): unknown;
|
|
64
75
|
};
|
|
65
76
|
type __VLS_ModelProps = {
|
|
66
77
|
/**
|
|
@@ -96,6 +107,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
96
107
|
search: string;
|
|
97
108
|
collapsible: boolean;
|
|
98
109
|
groups: NexxtPickerGroupData[];
|
|
110
|
+
busy: boolean;
|
|
99
111
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
100
112
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
101
113
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/** One family in the catalogue the consumer hands in. */
|
|
2
|
+
export interface NexxtFontPickerFont {
|
|
3
|
+
/** The family name: shown, searched, stored on the model and used as `font-family`. */
|
|
4
|
+
family: string;
|
|
5
|
+
/**
|
|
6
|
+
* Decides the group and with it the order: `web-safe` is "Standaard", listed first, `google` is
|
|
7
|
+
* "Google Fonts" after it; within a group `fonts` keeps its own order. Deliberately this narrow:
|
|
8
|
+
* this is a font picker, not a generic picker with free-form groups.
|
|
9
|
+
*/
|
|
10
|
+
source: 'web-safe' | 'google';
|
|
11
|
+
}
|
|
12
|
+
/** The "Huisstijl" option at the top of the list. */
|
|
13
|
+
export interface NexxtFontPickerInherit {
|
|
14
|
+
/** Text of the option, e.g. `'Huisstijl'`. */
|
|
15
|
+
label: string;
|
|
16
|
+
/**
|
|
17
|
+
* The family the option points at, shown behind the label in that font. Empty: the option
|
|
18
|
+
* renders in `font-sans` and shows no family name.
|
|
19
|
+
*/
|
|
20
|
+
family?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Overridable copy. Every key is optional and merged per key with the Dutch defaults. */
|
|
23
|
+
export interface NexxtFontPickerMessages {
|
|
24
|
+
/** Placeholder of the search field. Defaults to `'Lettertype zoeken'`. */
|
|
25
|
+
searchPlaceholder?: string;
|
|
26
|
+
/** Accessible name of the search field. Defaults to `'Lettertype zoeken'`. */
|
|
27
|
+
searchLabel?: string;
|
|
28
|
+
/** Accessible name of the listbox. Defaults to `'Lettertypes'`. */
|
|
29
|
+
listLabel?: string;
|
|
30
|
+
/** Heading of the web-safe group. Defaults to `'Standaard'`. */
|
|
31
|
+
groupWebSafe?: string;
|
|
32
|
+
/** Heading of the Google group. Defaults to `'Google Fonts'`. */
|
|
33
|
+
groupGoogle?: string;
|
|
34
|
+
/** Description read out on the current choice. Defaults to `'Huidige keuze'`. */
|
|
35
|
+
current?: string;
|
|
36
|
+
/** Description read out on the inherit option. Defaults to `'Volgt de huisstijl, ook als die later verandert'`. */
|
|
37
|
+
inheritDescription?: string;
|
|
38
|
+
/** Heading of the empty search state. Defaults to `'Geen lettertypes gevonden'`. */
|
|
39
|
+
emptyTitle?: string;
|
|
40
|
+
/** Line under the empty heading; receives the trimmed search term. */
|
|
41
|
+
emptyDescription?: (search: string) => string;
|
|
42
|
+
/** Button in the empty state that clears the search. Defaults to `'Zoekopdracht wissen'`. */
|
|
43
|
+
clearSearch?: string;
|
|
44
|
+
/** Notice under the list when the catalogue could not be loaded. */
|
|
45
|
+
catalogueError?: string;
|
|
46
|
+
/** Button in that notice. Defaults to `'Opnieuw proberen'`. */
|
|
47
|
+
retry?: string;
|
|
48
|
+
/** Announced 500ms after the search changes; receives the number of results. */
|
|
49
|
+
results?: (count: number) => string;
|
|
50
|
+
}
|
|
51
|
+
export interface NexxtFontPickerProps {
|
|
52
|
+
/**
|
|
53
|
+
* The catalogue: web-safe and Google families together, in display order (web-safe in their
|
|
54
|
+
* own order, Google by popularity). The component fetches nothing itself.
|
|
55
|
+
*/
|
|
56
|
+
fonts: NexxtFontPickerFont[];
|
|
57
|
+
/**
|
|
58
|
+
* State of fetching the Google catalogue. It only adds to the list: `loading` marks the listbox
|
|
59
|
+
* busy and, while `fonts` holds no Google family yet, shows skeleton rows under "Google Fonts";
|
|
60
|
+
* `error` shows a notice with a retry button. Whatever is in `fonts` is listed in every state,
|
|
61
|
+
* so a refresh or a failed retry never takes a catalogue away that is already there.
|
|
62
|
+
*/
|
|
63
|
+
catalogueStatus?: 'loading' | 'ready' | 'error';
|
|
64
|
+
/**
|
|
65
|
+
* Loads the face for the preview. Called for rows that come within 150px of view (debounced
|
|
66
|
+
* 100ms after scrolling) and for the current value on mount. A family that loaded is never
|
|
67
|
+
* asked for again. After a failure (a rejection or a throw) the component asks again once the
|
|
68
|
+
* row has been out of view and comes back, or when the panel opens again; typing a search or a
|
|
69
|
+
* new loader function does not, so a loader that keeps failing is not called per keystroke.
|
|
70
|
+
* The loader needs no cache or retry of its own; meanwhile the row keeps its fallback font and
|
|
71
|
+
* stays choosable.
|
|
72
|
+
*/
|
|
73
|
+
loadFont?: (family: string) => Promise<void> | void;
|
|
74
|
+
/** Show the inherit option at the top of the list; `null` on the model is then that option. */
|
|
75
|
+
inherit?: NexxtFontPickerInherit;
|
|
76
|
+
/**
|
|
77
|
+
* Visible label above the trigger, for a form. Give this or `ariaLabel`: without either the
|
|
78
|
+
* trigger has no name for the field, and a development build warns in the console.
|
|
79
|
+
*/
|
|
80
|
+
label?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Accessible name when there is no visible label, as in the editor, where the settings block
|
|
83
|
+
* around the picker is the label. The trigger reads it followed by its value. Give this or
|
|
84
|
+
* `label`: without either a development build warns in the console.
|
|
85
|
+
*/
|
|
86
|
+
ariaLabel?: string;
|
|
87
|
+
/** Text in the trigger while nothing is chosen. Defaults to `'Kies een lettertype'`. */
|
|
88
|
+
placeholder?: string;
|
|
89
|
+
/** The trigger is dimmed and does not open. */
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Copy of the panel. One object on purpose, following the editor components
|
|
93
|
+
* (`NexxtEditorLineHeight` and the like) rather than the separate copy props of
|
|
94
|
+
* `NexxtPickerPanel`. Merged per key with the Dutch defaults, so overriding one key keeps the
|
|
95
|
+
* others. Copy is never translated inside the component.
|
|
96
|
+
*/
|
|
97
|
+
messages?: NexxtFontPickerMessages;
|
|
98
|
+
}
|
|
99
|
+
declare const _default: typeof __VLS_export;
|
|
100
|
+
export default _default;
|
|
101
|
+
declare const __VLS_export: import('vue').DefineComponent<NexxtFontPickerProps & {
|
|
102
|
+
/**
|
|
103
|
+
* The chosen family. `null` is the inherit option when `inherit` is given, and "nothing chosen"
|
|
104
|
+
* otherwise. `''` means the same, and is accepted only for existing stored values; the component
|
|
105
|
+
* itself always writes `null`. Only a choice writes the model; moving the highlight never does.
|
|
106
|
+
*/
|
|
107
|
+
modelValue?: string | null;
|
|
108
|
+
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
109
|
+
close: () => any;
|
|
110
|
+
"update:modelValue": (value: string | null) => any;
|
|
111
|
+
open: () => any;
|
|
112
|
+
retry: () => any;
|
|
113
|
+
}, string, import('vue').PublicProps, Readonly<NexxtFontPickerProps & {
|
|
114
|
+
/**
|
|
115
|
+
* The chosen family. `null` is the inherit option when `inherit` is given, and "nothing chosen"
|
|
116
|
+
* otherwise. `''` means the same, and is accepted only for existing stored values; the component
|
|
117
|
+
* itself always writes `null`. Only a choice writes the model; moving the highlight never does.
|
|
118
|
+
*/
|
|
119
|
+
modelValue?: string | null;
|
|
120
|
+
}> & Readonly<{
|
|
121
|
+
onClose?: (() => any) | undefined;
|
|
122
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
123
|
+
onOpen?: (() => any) | undefined;
|
|
124
|
+
onRetry?: (() => any) | undefined;
|
|
125
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { WatchSource } from 'vue';
|
|
2
|
+
export interface FontPreviewLoaderOptions {
|
|
3
|
+
/** The consumer's loader; nothing is requested without one. */
|
|
4
|
+
loadFont: () => ((family: string) => Promise<void> | void) | undefined;
|
|
5
|
+
/** Element holding the listbox; `null` while the panel is closed. */
|
|
6
|
+
container: () => HTMLElement | null;
|
|
7
|
+
/** Anything whose change re-renders the rows, so they are observed afresh. */
|
|
8
|
+
rows: WatchSource[];
|
|
9
|
+
/** Family requested as soon as the component is mounted: the one the trigger shows. */
|
|
10
|
+
current: () => string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Requests the face of every family that comes into view in the listbox. Rows mark their family
|
|
14
|
+
* with `data-font-family`. A request that succeeded (or is still on its way) is never repeated.
|
|
15
|
+
* One that failed is held back until its row has really been out of view, or until the panel
|
|
16
|
+
* opens again; re-observing the rows (a search, new items, a new loader) does not count, so a
|
|
17
|
+
* loader that keeps failing is not called on every keystroke. Meanwhile the row keeps its
|
|
18
|
+
* fallback font and stays choosable, so there is nothing to report.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useFontPreviewLoader: ({ loadFont, container, rows, current, }: FontPreviewLoaderOptions) => void;
|
|
@@ -20,6 +20,11 @@ interface NexxtPickerPanelProps {
|
|
|
20
20
|
height?: number | string;
|
|
21
21
|
/** Below this height of the column row (the panel minus the header), in pixels, the preview column is left out and the list takes the full width. */
|
|
22
22
|
hidePreviewBelow?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Render the preview column. `false` leaves it out at any height, so the list always takes the
|
|
25
|
+
* full width: for a picker whose rows are their own preview.
|
|
26
|
+
*/
|
|
27
|
+
preview?: boolean;
|
|
23
28
|
/** Whether group headings fold their group. */
|
|
24
29
|
collapsible?: boolean;
|
|
25
30
|
/** Heading of the empty state, shown when the search has no results. */
|
|
@@ -32,6 +37,8 @@ interface NexxtPickerPanelProps {
|
|
|
32
37
|
previewEmptyText?: string;
|
|
33
38
|
/** Text announced 500ms after the search changes, e.g. `(n) => \`${n} resultaten\``. */
|
|
34
39
|
resultsAnnouncement?: (count: number) => string;
|
|
40
|
+
/** More items are on their way: `aria-busy` on the listbox, and no empty state meanwhile. */
|
|
41
|
+
busy?: boolean;
|
|
35
42
|
}
|
|
36
43
|
type __VLS_Props = NexxtPickerPanelProps;
|
|
37
44
|
type __VLS_Slots = {
|
|
@@ -53,6 +60,8 @@ type __VLS_Slots = {
|
|
|
53
60
|
search: string;
|
|
54
61
|
clear: () => void;
|
|
55
62
|
}): unknown;
|
|
63
|
+
/** Inside the listbox, after the last group, e.g. placeholder rows while `busy`. */
|
|
64
|
+
append?(): unknown;
|
|
56
65
|
};
|
|
57
66
|
type __VLS_ModelProps = {
|
|
58
67
|
/** Id of the highlighted item; the list keeps it on a visible item. Drives the preview. */
|
|
@@ -77,8 +86,10 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {
|
|
|
77
86
|
"onUpdate:search"?: ((value: string) => any) | undefined;
|
|
78
87
|
}>, {
|
|
79
88
|
width: number | string;
|
|
89
|
+
preview: boolean;
|
|
80
90
|
collapsible: boolean;
|
|
81
91
|
groups: NexxtPickerGroupData[];
|
|
92
|
+
busy: boolean;
|
|
82
93
|
height: number | string;
|
|
83
94
|
searchable: boolean;
|
|
84
95
|
hidePreviewBelow: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -32,10 +32,13 @@ export { EDITOR_JUSTIFY_CONTENT_OPTIONS } from './components/editor/molecules/Ed
|
|
|
32
32
|
export type { EditorJustifyContentMessages, EditorJustifyContentValue, } from './components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue';
|
|
33
33
|
export { EDITOR_MAX_WIDTH_STEPS } from './components/editor/molecules/EditorMaxWidth/EditorMaxWidth.vue';
|
|
34
34
|
export type { EditorMaxWidthMessages, EditorMaxWidthValue, } from './components/editor/molecules/EditorMaxWidth/EditorMaxWidth.vue';
|
|
35
|
-
export { EDITOR_LINE_HEIGHT_STEPS } from './components/editor/molecules/EditorLineHeight/EditorLineHeight.vue';
|
|
36
|
-
export type { EditorLineHeightMessages, EditorLineHeightValue, } from './components/editor/molecules/EditorLineHeight/EditorLineHeight.vue';
|
|
35
|
+
export { EDITOR_LINE_HEIGHT_STEPS, EDITOR_TEXT_LINE_HEIGHT_RATIOS, } from './components/editor/molecules/EditorLineHeight/EditorLineHeight.vue';
|
|
36
|
+
export type { EditorLineHeightMessages, EditorLineHeightValue, NexxtEditorLineHeightProps, } from './components/editor/molecules/EditorLineHeight/EditorLineHeight.vue';
|
|
37
37
|
export { EDITOR_LETTER_SPACING_STEPS } from './components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.vue';
|
|
38
|
-
export type { EditorLetterSpacingMessages, EditorLetterSpacingValue, } from './components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.vue';
|
|
38
|
+
export type { EditorLetterSpacingMessages, EditorLetterSpacingValue, NexxtEditorLetterSpacingProps, } from './components/editor/molecules/EditorLetterSpacing/EditorLetterSpacing.vue';
|
|
39
|
+
export { EDITOR_FONT_SIZE_STEPS } from './components/editor/molecules/EditorFontSize/EditorFontSize.vue';
|
|
40
|
+
export type { EditorFontSizeMessages, EditorFontSizeValue, NexxtEditorFontSizeProps, } from './components/editor/molecules/EditorFontSize/EditorFontSize.vue';
|
|
41
|
+
export type { NexxtFontPickerFont, NexxtFontPickerInherit, NexxtFontPickerMessages, NexxtFontPickerProps, } from './components/organisms/FontPicker/FontPicker.vue';
|
|
39
42
|
export { EDITOR_PADDING_STEPS } from './components/editor/molecules/EditorPadding/EditorPadding.vue';
|
|
40
43
|
export type { EditorPaddingMessages, EditorPaddingStep, } from './components/editor/molecules/EditorPadding/EditorPadding.vue';
|
|
41
44
|
export type { NexxtTemplateCardContentFeature, NexxtTemplateCardProps, NexxtTemplateCardSlots, } from './components/molecules/TemplateCard/TemplateCard.vue';
|
|
@@ -61,6 +64,7 @@ export { default as NexxtEditorBackgroundSize } from './components/editor/molecu
|
|
|
61
64
|
export { default as NexxtEditorBorder } from './components/editor/molecules/EditorBorder/EditorBorder.vue';
|
|
62
65
|
export { default as NexxtEditorColor } from './components/editor/molecules/EditorColor/EditorColor.vue';
|
|
63
66
|
export { default as NexxtEditorFlexDirection } from './components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue';
|
|
67
|
+
export { default as NexxtEditorFontSize } from './components/editor/molecules/EditorFontSize/EditorFontSize.vue';
|
|
64
68
|
export { default as NexxtEditorGap } from './components/editor/molecules/EditorGap/EditorGap.vue';
|
|
65
69
|
export { default as NexxtEditorHeadingType } from './components/editor/molecules/EditorHeadingType/EditorHeadingType.vue';
|
|
66
70
|
export { default as NexxtEditorJustifyContent } from './components/editor/molecules/EditorJustifyContent/EditorJustifyContent.vue';
|
|
@@ -73,6 +77,7 @@ export { default as NexxtEditorSettingsBlock } from './components/editor/atoms/E
|
|
|
73
77
|
export { default as NexxtEditorTextAlign } from './components/editor/molecules/EditorTextAlign/EditorTextAlign.vue';
|
|
74
78
|
export { default as NexxtEnergyLabel } from './components/atoms/EnergyLabel/EnergyLabel.vue';
|
|
75
79
|
export { default as NexxtFloatingPanel } from './components/atoms/FloatingPanel/FloatingPanel.vue';
|
|
80
|
+
export { default as NexxtFontPicker } from './components/organisms/FontPicker/FontPicker.vue';
|
|
76
81
|
export { default as NexxtHeader } from './components/organisms/Header/Header.vue';
|
|
77
82
|
export { default as NexxtIcon } from './components/atoms/Icon/Icon.vue';
|
|
78
83
|
export { default as NexxtInfoBlock } from './components/molecules/InfoBlock/InfoBlock.vue';
|