@nexxtmove/ui 2.2.0 → 2.4.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/EditorBackgroundSize/EditorBackgroundSize.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorBlur/EditorBlur.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorColor/EditorColor.vue.d.ts +44 -20
- package/dist/components/editor/molecules/EditorColor/_ColorField.vue.d.ts +66 -0
- package/dist/components/editor/molecules/EditorColor/colorClass.d.ts +46 -0
- package/dist/components/editor/molecules/EditorColor/gradientClass.d.ts +80 -0
- package/dist/components/editor/molecules/EditorGap/EditorGap.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.vue.d.ts +2 -2
- package/dist/components/editor/molecules/EditorShadow/EditorShadow.vue.d.ts +2 -2
- package/dist/components/organisms/ColorPicker/ColorPicker.vue.d.ts +58 -2
- package/dist/components/organisms/ColorPicker/_GradientField.vue.d.ts +23 -0
- package/dist/components/organisms/ColorPicker/_GradientPreview.vue.d.ts +11 -0
- package/dist/components/organisms/ColorPicker/_GradientStopRow.vue.d.ts +21 -0
- package/dist/components/organisms/ColorPicker/_GradientStops.vue.d.ts +19 -0
- package/dist/components/organisms/ColorPicker/gradient.d.ts +189 -0
- package/dist/components/organisms/ColorPicker/gradientGeometry.d.ts +101 -0
- package/dist/components/organisms/ColorPicker/useGradientEditor.d.ts +89 -0
- package/dist/components/organisms/VideoControls/VideoControls.vue.d.ts +8 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +3400 -2083
- package/package.json +1 -1
- package/src/components/editor/molecules/EditorColor/EditorColor.vue +83 -171
- package/src/components/editor/molecules/EditorColor/_ColorField.vue +445 -0
- package/src/components/editor/molecules/EditorColor/colorClass.ts +61 -0
- package/src/components/editor/molecules/EditorColor/gradientClass.ts +225 -0
- package/src/components/molecules/ToggleGroup/ToggleGroup.vue +6 -2
- package/src/components/organisms/ColorPicker/ColorPicker.vue +673 -271
- package/src/components/organisms/ColorPicker/_GradientField.vue +93 -0
- package/src/components/organisms/ColorPicker/_GradientPreview.vue +401 -0
- package/src/components/organisms/ColorPicker/_GradientStopRow.vue +181 -0
- package/src/components/organisms/ColorPicker/_GradientStops.vue +218 -0
- package/src/components/organisms/ColorPicker/gradient.ts +303 -0
- package/src/components/organisms/ColorPicker/gradientGeometry.ts +216 -0
- package/src/components/organisms/ColorPicker/useGradientEditor.ts +358 -0
- package/src/components/organisms/VideoControls/VideoControls.vue +15 -4
- package/src/index.ts +25 -0
|
@@ -57,10 +57,10 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorBackgroundS
|
|
|
57
57
|
/** The selected background size, as the Tailwind class to apply. */
|
|
58
58
|
modelValue: EditorBackgroundSizeValue;
|
|
59
59
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
60
|
-
"update:modelValue": (value: "bg-auto" | "bg-
|
|
60
|
+
"update:modelValue": (value: "bg-auto" | "bg-contain" | "bg-cover") => any;
|
|
61
61
|
}, string, import('vue').PublicProps, Readonly<NexxtEditorBackgroundSizeProps & {
|
|
62
62
|
/** The selected background size, as the Tailwind class to apply. */
|
|
63
63
|
modelValue: EditorBackgroundSizeValue;
|
|
64
64
|
}> & Readonly<{
|
|
65
|
-
"onUpdate:modelValue"?: ((value: "bg-auto" | "bg-
|
|
65
|
+
"onUpdate:modelValue"?: ((value: "bg-auto" | "bg-contain" | "bg-cover") => any) | undefined;
|
|
66
66
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -83,7 +83,7 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorBlurProps &
|
|
|
83
83
|
*/
|
|
84
84
|
enabled?: boolean;
|
|
85
85
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
86
|
-
"update:modelValue": (value: "backdrop-blur-
|
|
86
|
+
"update:modelValue": (value: "backdrop-blur-lg" | "backdrop-blur-sm" | "backdrop-blur-md" | "backdrop-blur-xs" | "backdrop-blur-xl" | undefined) => any;
|
|
87
87
|
"update:enabled": (value: boolean) => any;
|
|
88
88
|
}, string, import('vue').PublicProps, Readonly<NexxtEditorBlurProps & {
|
|
89
89
|
/**
|
|
@@ -101,6 +101,6 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorBlurProps &
|
|
|
101
101
|
*/
|
|
102
102
|
enabled?: boolean;
|
|
103
103
|
}> & Readonly<{
|
|
104
|
-
"onUpdate:modelValue"?: ((value: "backdrop-blur-
|
|
104
|
+
"onUpdate:modelValue"?: ((value: "backdrop-blur-lg" | "backdrop-blur-sm" | "backdrop-blur-md" | "backdrop-blur-xs" | "backdrop-blur-xl" | undefined) => any) | undefined;
|
|
105
105
|
"onUpdate:enabled"?: ((value: boolean) => any) | undefined;
|
|
106
106
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
import { EditorColorRole, EditorColorThemeRole } from './colorClass';
|
|
2
|
+
import { EditorColorGradientValue } from './gradientClass';
|
|
3
|
+
import { ColorPickerFillMode, ColorPickerGradientMessages } from '../../../organisms/ColorPicker/ColorPicker.vue';
|
|
4
|
+
export type { EditorColorRole, EditorColorThemeRole } from './colorClass';
|
|
5
|
+
export type { EditorColorGradientValue, EditorColorLinearGradientValue, EditorColorRadialGradientValue, } from './gradientClass';
|
|
6
|
+
/** A fill the editor can offer: `'solid'` or `'gradient'`; see NexxtColorPicker. */
|
|
7
|
+
export type EditorColorFillMode = ColorPickerFillMode;
|
|
8
|
+
/** Copy of the gradient mode; see NexxtColorPicker. */
|
|
9
|
+
export type EditorColorGradientMessages = ColorPickerGradientMessages;
|
|
1
10
|
/**
|
|
2
11
|
* The CSS property the chosen colour is written to. It is the prefix of the
|
|
3
12
|
* Tailwind class the model carries, so it decides whether the colour becomes a
|
|
@@ -5,12 +14,6 @@
|
|
|
5
14
|
* is colour plus width, and that pair gets a component of its own.
|
|
6
15
|
*/
|
|
7
16
|
export type EditorColorProperty = 'bg' | 'text';
|
|
8
|
-
declare const ROLES: readonly ["main", "accent", "background", "heading", "text"];
|
|
9
|
-
/**
|
|
10
|
-
* A role of the customer's theme. A colour bound to a role follows the theme,
|
|
11
|
-
* where a literal colour stays what it was picked as.
|
|
12
|
-
*/
|
|
13
|
-
export type EditorColorRole = (typeof ROLES)[number];
|
|
14
17
|
/** A literal colour: a Tailwind arbitrary-value class such as `'bg-[#1777EA]'`. */
|
|
15
18
|
export type EditorColorLiteralValue = `${EditorColorProperty}-[#${string}]`;
|
|
16
19
|
/** A colour bound to a theme role: a token class such as `'bg-theme-main'`. */
|
|
@@ -18,21 +21,10 @@ export type EditorColorRoleValue = `${EditorColorProperty}-theme-${EditorColorRo
|
|
|
18
21
|
/**
|
|
19
22
|
* The colour as the editor needs it: the class to apply, so the consumer can
|
|
20
23
|
* put the model value straight on the element it styles. Either a literal
|
|
21
|
-
* colour or a theme role
|
|
24
|
+
* colour or a theme role, or with `modes` including `'gradient'` a gradient: a string of classes
|
|
25
|
+
* such as `'bg-linear-135 from-[#7f56d9] to-[#432e73]'`.
|
|
22
26
|
*/
|
|
23
|
-
export type EditorColorValue = EditorColorLiteralValue | EditorColorRoleValue;
|
|
24
|
-
export interface EditorColorThemeRole {
|
|
25
|
-
/** The role the class is written for: `'main'` becomes `bg-theme-main`. */
|
|
26
|
-
role: EditorColorRole;
|
|
27
|
-
/** Name of the role as the user reads it, in the swatch's tooltip and in the trigger. */
|
|
28
|
-
label: string;
|
|
29
|
-
/**
|
|
30
|
-
* The role's current colour as a 6- or 8-digit hex. Only used to paint the
|
|
31
|
-
* swatch: the library ships no CSS for the role classes, and the hex never
|
|
32
|
-
* reaches the model.
|
|
33
|
-
*/
|
|
34
|
-
hex: string;
|
|
35
|
-
}
|
|
27
|
+
export type EditorColorValue = EditorColorLiteralValue | EditorColorRoleValue | EditorColorGradientValue;
|
|
36
28
|
export interface EditorColorMessages {
|
|
37
29
|
/** Text shown while no colour is set. Defaults to `'Kies kleur...'`. */
|
|
38
30
|
placeholder?: string;
|
|
@@ -89,6 +81,38 @@ export interface NexxtEditorColorProps {
|
|
|
89
81
|
* alpha and the model gets the opaque 6-digit hex.
|
|
90
82
|
*/
|
|
91
83
|
showAlpha?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The fills the picker offers. `['solid']` (the default) is the plain colour
|
|
86
|
+
* picker, unchanged. `['solid', 'gradient']`, in any order, adds an
|
|
87
|
+
* "Effen | Verloop" switch; `['gradient']` offers only the gradient, without a
|
|
88
|
+
* switch -- an empty value or a solid colour then opens on the gradient a
|
|
89
|
+
* switch would give, written only on the first change. A gradient only exists
|
|
90
|
+
* for `property` `'bg'`: with `'text'` this falls back to `['solid']`, also
|
|
91
|
+
* for `['gradient']`. A gradient is written as
|
|
92
|
+
* one string of classes in a fixed order -- type, from, from-position, via,
|
|
93
|
+
* via-position, to, to-position -- such as
|
|
94
|
+
* `'bg-linear-135 from-[#7f56d9] via-theme-main via-40% to-[#432e73cc]'` or
|
|
95
|
+
* `'bg-radial-[at_30%_70%] from-theme-accent to-[#ffffff00]'`. Hexes are in
|
|
96
|
+
* lower case without an opaque `ff`, and a position is only written when it
|
|
97
|
+
* differs from 0 %, 50 % or 100 %. In the gradient mode the opacity slider is
|
|
98
|
+
* always offered, whatever `showAlpha` says. To draw a stored gradient as an
|
|
99
|
+
* inline style, parse it with `parseGradientClass` and turn it into CSS with
|
|
100
|
+
* `gradientClassToCss`, which always interpolates in oklab, as the preview does.
|
|
101
|
+
* A radial gradient off centre renders in sRGB as a Tailwind class; draw it
|
|
102
|
+
* with `gradientClassToCss` for the oklab result the picker shows.
|
|
103
|
+
*/
|
|
104
|
+
modes?: EditorColorFillMode[];
|
|
105
|
+
/**
|
|
106
|
+
* Copy of the gradient mode. Merged per key over the Dutch defaults, so
|
|
107
|
+
* overriding one key keeps the others.
|
|
108
|
+
*/
|
|
109
|
+
gradientMessages?: EditorColorGradientMessages;
|
|
110
|
+
/**
|
|
111
|
+
* Id(s) of an element that describes the setting, such as a hint the
|
|
112
|
+
* consumer renders itself. Set as `aria-describedby` on the picker's trigger,
|
|
113
|
+
* and on the switch when `switchable`. Without it no attribute is set.
|
|
114
|
+
*/
|
|
115
|
+
describedby?: string;
|
|
92
116
|
}
|
|
93
117
|
declare const _default: typeof __VLS_export;
|
|
94
118
|
export default _default;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ColorClass, EditorColorThemeRole } from './colorClass';
|
|
2
|
+
import { EditorColorGradientValue } from './gradientClass';
|
|
3
|
+
import { ColorPickerFillMode, ColorPickerGradientMessages } from '../../../organisms/ColorPicker/ColorPicker.vue';
|
|
4
|
+
export interface ColorFieldProps<P extends string> {
|
|
5
|
+
/** The prefix of the class that is written, such as `'bg'` or `'from'`. */
|
|
6
|
+
property: P;
|
|
7
|
+
/**
|
|
8
|
+
* The prefixes that are read as a colour. Defaults to `property` alone.
|
|
9
|
+
* NexxtEditorColor reads both `bg` and `text`, so a value with the other
|
|
10
|
+
* prefix is shown, and rewritten once `property` changes.
|
|
11
|
+
*/
|
|
12
|
+
accepts?: readonly P[];
|
|
13
|
+
/** Visible label above the trigger. Without it the placeholder names the trigger. */
|
|
14
|
+
label?: string;
|
|
15
|
+
/** Id(s) set as `aria-describedby` on the trigger. */
|
|
16
|
+
describedby?: string;
|
|
17
|
+
/** Text shown while no colour is set. */
|
|
18
|
+
placeholder: string;
|
|
19
|
+
/** Label shown above the suggestions. */
|
|
20
|
+
suggestionsLabel: string;
|
|
21
|
+
/** Label shown above the theme roles. */
|
|
22
|
+
themeLabel: string;
|
|
23
|
+
/** Label above the opacity slider, and its accessible name. */
|
|
24
|
+
alphaLabel: string;
|
|
25
|
+
/** Hex colours offered as one-click suggestions. */
|
|
26
|
+
suggestions?: string[];
|
|
27
|
+
/** Theme roles offered above the suggestions; an entry with an unreadable hex is left out. */
|
|
28
|
+
themeRoles?: EditorColorThemeRole[];
|
|
29
|
+
/** Offer an opacity slider, hidden while a theme role is selected. */
|
|
30
|
+
showAlpha?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The fills offered: `['solid']` (the default), `['solid', 'gradient']` or
|
|
33
|
+
* `['gradient']`. A gradient only exists for `property` `'bg'`; for any other
|
|
34
|
+
* prefix only the solid colour is offered, also with `['gradient']`. The
|
|
35
|
+
* gradient is written as the class string of `gradientClass.ts`.
|
|
36
|
+
*/
|
|
37
|
+
modes?: readonly ColorPickerFillMode[];
|
|
38
|
+
/** Copy of the gradient mode, merged per key over the picker's defaults. */
|
|
39
|
+
gradientMessages?: ColorPickerGradientMessages;
|
|
40
|
+
}
|
|
41
|
+
declare const _default: typeof __VLS_export;
|
|
42
|
+
export default _default;
|
|
43
|
+
declare const __VLS_export: <P extends string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
44
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<(ColorFieldProps<P> & {
|
|
45
|
+
/**
|
|
46
|
+
* The chosen colour, as the class to apply, or with `gradient` the gradient's
|
|
47
|
+
* class string. Unset or unreadable shows the placeholder.
|
|
48
|
+
*/
|
|
49
|
+
modelValue?: ColorClass<P> | EditorColorGradientValue;
|
|
50
|
+
}) & {
|
|
51
|
+
"onUpdate:modelValue"?: ((value: EditorColorGradientValue | ColorClass<P> | undefined) => any) | undefined;
|
|
52
|
+
}> & (typeof globalThis extends {
|
|
53
|
+
__VLS_PROPS_FALLBACK: infer P_1;
|
|
54
|
+
} ? P_1 : {});
|
|
55
|
+
expose: (exposed: {}) => void;
|
|
56
|
+
attrs: any;
|
|
57
|
+
slots: {};
|
|
58
|
+
emit: (event: "update:modelValue", value: EditorColorGradientValue | ColorClass<P> | undefined) => void;
|
|
59
|
+
}>) => import('vue').VNode & {
|
|
60
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
61
|
+
};
|
|
62
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
63
|
+
[K in keyof T]: T[K];
|
|
64
|
+
} : {
|
|
65
|
+
[K in keyof T as K]: T[K];
|
|
66
|
+
}) & {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parsing of the colour classes of the editor: NexxtEditorColor writes `bg-`/
|
|
3
|
+
* `text-` classes, and its gradient `from-`/`via-`/`to-` ones (see
|
|
4
|
+
* `gradientClass.ts`). The class is always a prefix, then either a hex between
|
|
5
|
+
* brackets or `theme-` and a role.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COLOR_ROLES: readonly ["main", "accent", "background", "heading", "text"];
|
|
8
|
+
/**
|
|
9
|
+
* A role of the customer's theme. A colour bound to a role follows the theme,
|
|
10
|
+
* where a literal colour stays what it was picked as.
|
|
11
|
+
*/
|
|
12
|
+
export type EditorColorRole = (typeof COLOR_ROLES)[number];
|
|
13
|
+
export interface EditorColorThemeRole {
|
|
14
|
+
/** The role the class is written for: `'main'` becomes `bg-theme-main`. */
|
|
15
|
+
role: EditorColorRole;
|
|
16
|
+
/** Name of the role as the user reads it, in the swatch's tooltip and in the trigger. */
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* The role's current colour as a 6- or 8-digit hex. Only used to paint the
|
|
20
|
+
* swatch: the library ships no CSS for the role classes, and the hex never
|
|
21
|
+
* reaches the model.
|
|
22
|
+
*/
|
|
23
|
+
hex: string;
|
|
24
|
+
}
|
|
25
|
+
/** A colour class with the given prefix: a literal hex or a theme role. */
|
|
26
|
+
export type ColorClass<P extends string> = `${P}-[#${string}]` | `${P}-theme-${EditorColorRole}`;
|
|
27
|
+
/** What a colour class stands for, or `null` when it is not one. */
|
|
28
|
+
export type ParsedColorClass = {
|
|
29
|
+
hex: `#${string}`;
|
|
30
|
+
} | {
|
|
31
|
+
role: EditorColorRole;
|
|
32
|
+
} | null;
|
|
33
|
+
/** The picker throws on a colour it cannot read, so a role's hex is checked first. */
|
|
34
|
+
export declare const ROLE_HEX_PATTERN: RegExp;
|
|
35
|
+
/**
|
|
36
|
+
* The `#` is part of the model's type, so a plain `string` cannot be written
|
|
37
|
+
* into it. This narrows a regex capture or picker output without a cast.
|
|
38
|
+
*/
|
|
39
|
+
export declare const isHex: (value: string) => value is `#${string}`;
|
|
40
|
+
/**
|
|
41
|
+
* Reads a class written with one of `prefixes`. A 6- or 8-digit hex is accepted
|
|
42
|
+
* whatever its case, so a stored `#1777EA80` survives a round trip. A tint such
|
|
43
|
+
* as `bg-theme-main/10`, a token class such as `bg-red-500` or a class with
|
|
44
|
+
* another prefix is read as `null`.
|
|
45
|
+
*/
|
|
46
|
+
export declare const parseColorClass: (value: string | undefined, prefixes: readonly string[]) => ParsedColorClass;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { EditorColorRole } from './colorClass';
|
|
2
|
+
/** A linear gradient: `bg-linear-<0–359>`, followed by its stops. */
|
|
3
|
+
export type EditorColorLinearGradientValue = `bg-linear-${number} ${string}`;
|
|
4
|
+
/**
|
|
5
|
+
* A radial gradient: `bg-radial` when its centre is the middle, or
|
|
6
|
+
* `bg-radial-[at_<x>%_<y>%]`, followed by its stops.
|
|
7
|
+
*/
|
|
8
|
+
export type EditorColorRadialGradientValue = `bg-radial ${string}` | `bg-radial-[at_${string}`;
|
|
9
|
+
/** A gradient background as the class string of the contract above. */
|
|
10
|
+
export type EditorColorGradientValue = EditorColorLinearGradientValue | EditorColorRadialGradientValue;
|
|
11
|
+
/** The colour of a stop: a literal hex in normal form, or a theme role (always opaque). */
|
|
12
|
+
export type GradientClassColor = {
|
|
13
|
+
hex: `#${string}`;
|
|
14
|
+
} | {
|
|
15
|
+
role: EditorColorRole;
|
|
16
|
+
};
|
|
17
|
+
/** One stop of a parsed gradient class: its colour and its position. */
|
|
18
|
+
export interface GradientClassStop {
|
|
19
|
+
color: GradientClassColor;
|
|
20
|
+
/** Whole percentage, 0–100. */
|
|
21
|
+
position: number;
|
|
22
|
+
}
|
|
23
|
+
/** The kind of gradient: `bg-linear-*` or `bg-radial`/`bg-radial-[at_…]`. */
|
|
24
|
+
export type GradientClassType = 'linear' | 'radial';
|
|
25
|
+
/**
|
|
26
|
+
* A gradient class string, parsed: its type with the angle or the centre, and
|
|
27
|
+
* two or three stops in order of position (from, optional via, to).
|
|
28
|
+
*/
|
|
29
|
+
export type GradientClass = {
|
|
30
|
+
type: 'linear';
|
|
31
|
+
/** Whole degrees, 0–359. */
|
|
32
|
+
angle: number;
|
|
33
|
+
stops: GradientClassStop[];
|
|
34
|
+
} | {
|
|
35
|
+
type: 'radial';
|
|
36
|
+
/** Centre, in whole percentages from the left (0–100). */
|
|
37
|
+
x: number;
|
|
38
|
+
/** Centre, in whole percentages from the top (0–100). */
|
|
39
|
+
y: number;
|
|
40
|
+
stops: GradientClassStop[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* A hex in the one spelling the contract writes: lower case, and without an
|
|
44
|
+
* opaque `ff` pair (`#AABBCCFF` → `#aabbcc`).
|
|
45
|
+
*/
|
|
46
|
+
export declare const normalizeGradientHex: (hex: `#${string}`) => `#${string}`;
|
|
47
|
+
/**
|
|
48
|
+
* Reads a gradient class string, or returns `null` when it does not follow the
|
|
49
|
+
* contract: no type, no `from` or `to`, an unknown role or token, a value out
|
|
50
|
+
* of range, a class given twice, or stops whose positions run backwards (the
|
|
51
|
+
* contract always writes them in order). The order of the classes themselves
|
|
52
|
+
* is not checked. The result is in normal form, so serializing it gives the
|
|
53
|
+
* contract's spelling back.
|
|
54
|
+
*/
|
|
55
|
+
export declare const parseGradientClass: (value: string | undefined) => GradientClass | null;
|
|
56
|
+
/**
|
|
57
|
+
* Writes a gradient in the contract's form. The stops are written in the order
|
|
58
|
+
* given, which must be their order on position: the first is `from`, the last
|
|
59
|
+
* `to`, and a third in between is `via`. Positions are rounded and clamped to
|
|
60
|
+
* 0–100, the angle to a whole 0–359 and the centre to whole percentages.
|
|
61
|
+
*/
|
|
62
|
+
export declare const serializeGradientClass: (gradient: GradientClass) => EditorColorGradientValue;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a value reads as a gradient at all -- its first class is a gradient
|
|
65
|
+
* type -- even when the rest of it does not follow the contract. Such a value
|
|
66
|
+
* opens the picker in its gradient mode, with the placeholder in the trigger.
|
|
67
|
+
*/
|
|
68
|
+
export declare const looksLikeGradientClass: (value: string | undefined) => boolean;
|
|
69
|
+
/**
|
|
70
|
+
* A parsed gradient class as a CSS `background-image`, for drawing it as an
|
|
71
|
+
* inline style: `linear-gradient(<angle>deg in oklab, …)`,
|
|
72
|
+
* `radial-gradient(at <x>% <y>% in oklab, …)`, or for a centred radial
|
|
73
|
+
* gradient `radial-gradient(in oklab, …)`. Always interpolated in oklab -- the
|
|
74
|
+
* same as the picker's preview -- and with every position written, 0, 50 and
|
|
75
|
+
* 100 included. Angle and positions are those of the Tailwind class, so a
|
|
76
|
+
* linear gradient renders exactly as `bg-linear-*` does. A hex stays a hex
|
|
77
|
+
* (eight digits with alpha); a role (`'main'`, `'accent'`, …) is resolved by
|
|
78
|
+
* `resolveRole`, for example to `var(--color-theme-main)`. Pure: no DOM, safe on the server.
|
|
79
|
+
*/
|
|
80
|
+
export declare const gradientClassToCss: (gradient: GradientClass, resolveRole: (role: EditorColorRole) => string) => string;
|
|
@@ -105,7 +105,7 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorGapProps &
|
|
|
105
105
|
*/
|
|
106
106
|
auto?: boolean;
|
|
107
107
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
108
|
-
"update:modelValue": (value: "gap-
|
|
108
|
+
"update:modelValue": (value: "gap-3" | "gap-4" | "gap-0" | "gap-1" | "gap-2" | "gap-5" | "gap-6" | "gap-7" | "gap-8" | "gap-9" | "gap-10" | "gap-11" | "gap-12" | "gap-14" | "gap-16") => any;
|
|
109
109
|
"update:auto": (value: boolean) => any;
|
|
110
110
|
}, string, import('vue').PublicProps, Readonly<NexxtEditorGapProps & {
|
|
111
111
|
/** The selected gap, as the Tailwind class to apply. */
|
|
@@ -118,6 +118,6 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorGapProps &
|
|
|
118
118
|
*/
|
|
119
119
|
auto?: boolean;
|
|
120
120
|
}> & Readonly<{
|
|
121
|
-
"onUpdate:modelValue"?: ((value: "gap-
|
|
121
|
+
"onUpdate:modelValue"?: ((value: "gap-3" | "gap-4" | "gap-0" | "gap-1" | "gap-2" | "gap-5" | "gap-6" | "gap-7" | "gap-8" | "gap-9" | "gap-10" | "gap-11" | "gap-12" | "gap-14" | "gap-16") => any) | undefined;
|
|
122
122
|
"onUpdate:auto"?: ((value: boolean) => any) | undefined;
|
|
123
123
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -87,7 +87,7 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorMaxWidthPro
|
|
|
87
87
|
*/
|
|
88
88
|
enabled?: boolean;
|
|
89
89
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
90
|
-
"update:modelValue": (value: "max-w-
|
|
90
|
+
"update:modelValue": (value: "max-w-lg" | "max-w-sm" | "max-w-md" | "max-w-xs" | "max-w-xl" | "max-w-2xl" | "max-w-3xl" | "max-w-4xl" | "max-w-5xl" | "max-w-6xl" | "max-w-7xl") => any;
|
|
91
91
|
"update:enabled": (value: boolean) => any;
|
|
92
92
|
}, string, import('vue').PublicProps, Readonly<NexxtEditorMaxWidthProps & {
|
|
93
93
|
/** The selected maximum width, as the Tailwind class to apply. */
|
|
@@ -100,6 +100,6 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorMaxWidthPro
|
|
|
100
100
|
*/
|
|
101
101
|
enabled?: boolean;
|
|
102
102
|
}> & Readonly<{
|
|
103
|
-
"onUpdate:modelValue"?: ((value: "max-w-
|
|
103
|
+
"onUpdate:modelValue"?: ((value: "max-w-lg" | "max-w-sm" | "max-w-md" | "max-w-xs" | "max-w-xl" | "max-w-2xl" | "max-w-3xl" | "max-w-4xl" | "max-w-5xl" | "max-w-6xl" | "max-w-7xl") => any) | undefined;
|
|
104
104
|
"onUpdate:enabled"?: ((value: boolean) => any) | undefined;
|
|
105
105
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -59,7 +59,7 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorShadowProps
|
|
|
59
59
|
/** Open state of the block. Only has an effect when `switchable` is `true`. */
|
|
60
60
|
enabled?: boolean;
|
|
61
61
|
}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
62
|
-
"update:modelValue": (value: "shadow-
|
|
62
|
+
"update:modelValue": (value: "shadow-lg" | "shadow-sm" | "shadow-md") => any;
|
|
63
63
|
"update:enabled": (value: boolean) => any;
|
|
64
64
|
}, string, import('vue').PublicProps, Readonly<NexxtEditorShadowProps & {
|
|
65
65
|
/** The selected strength, as the Tailwind class to apply. */
|
|
@@ -67,6 +67,6 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorShadowProps
|
|
|
67
67
|
/** Open state of the block. Only has an effect when `switchable` is `true`. */
|
|
68
68
|
enabled?: boolean;
|
|
69
69
|
}> & Readonly<{
|
|
70
|
-
"onUpdate:modelValue"?: ((value: "shadow-
|
|
70
|
+
"onUpdate:modelValue"?: ((value: "shadow-lg" | "shadow-sm" | "shadow-md") => any) | undefined;
|
|
71
71
|
"onUpdate:enabled"?: ((value: boolean) => any) | undefined;
|
|
72
72
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { ColorPickerGradient, ColorPickerGradientMessages, ColorPickerPreset } from './gradient';
|
|
2
|
+
export type { ColorPickerGradient, ColorPickerGradientMessages, ColorPickerGradientStop, ColorPickerPreset, } from './gradient';
|
|
3
|
+
/**
|
|
4
|
+
* A fill the picker can edit: `'solid'`, one colour, or `'gradient'`, a linear
|
|
5
|
+
* or radial gradient of two or three stops.
|
|
6
|
+
*/
|
|
7
|
+
export type ColorPickerFillMode = 'solid' | 'gradient';
|
|
1
8
|
export type ColorFormat = 'hex' | 'hsl' | 'rgb';
|
|
2
9
|
export type ColorSuggestions = Partial<Record<ColorFormat, string[]>>;
|
|
3
10
|
export interface NexxtColorPickerProps {
|
|
@@ -26,20 +33,68 @@ export interface NexxtColorPickerProps {
|
|
|
26
33
|
* its own, such as a theme role. Only shown while a colour is set.
|
|
27
34
|
*/
|
|
28
35
|
valueLabel?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Id(s) of an element that describes the field, set as `aria-describedby` on
|
|
38
|
+
* the trigger. Without it no attribute is rendered.
|
|
39
|
+
*/
|
|
40
|
+
describedby?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The fills the picker offers. `['solid']` (the default) is the plain colour
|
|
43
|
+
* picker, exactly as without this prop. `['solid', 'gradient']`, in any
|
|
44
|
+
* order, adds an "Effen | Verloop" switch at the top of the panel;
|
|
45
|
+
* `['gradient']` offers only the gradient, without a switch. The gradient is
|
|
46
|
+
* edited through the `gradientValue` model; `mode` tells which fill is in
|
|
47
|
+
* use, and stays on the one fill when only one is offered.
|
|
48
|
+
*/
|
|
49
|
+
modes?: ColorPickerFillMode[];
|
|
50
|
+
/**
|
|
51
|
+
* The gradient the gradient mode shows while `gradientValue` is unset. It is
|
|
52
|
+
* not written until the first change. Defaults to a fade from `#00000000` to
|
|
53
|
+
* `#00000099`.
|
|
54
|
+
*/
|
|
55
|
+
gradientStart?: ColorPickerGradient;
|
|
56
|
+
/** Copy of the gradient mode, merged per key over the Dutch defaults. */
|
|
57
|
+
gradientMessages?: ColorPickerGradientMessages;
|
|
29
58
|
}
|
|
30
59
|
type __VLS_Slots = {
|
|
31
|
-
/**
|
|
32
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Named colours a wrapper offers next to the free picker; rendered above the
|
|
62
|
+
* suggestions. In the gradient mode a preset is applied to the selected stop
|
|
63
|
+
* through `selectPreset`, and `preset` is the key of the selected stop's
|
|
64
|
+
* preset, if any.
|
|
65
|
+
*/
|
|
66
|
+
presets?(props: {
|
|
67
|
+
preset: string | undefined;
|
|
68
|
+
selectPreset: (preset: ColorPickerPreset, hex: string) => void;
|
|
69
|
+
}): unknown;
|
|
33
70
|
};
|
|
34
71
|
type __VLS_Props = NexxtColorPickerProps;
|
|
35
72
|
type __VLS_ModelProps = {
|
|
36
73
|
modelValue?: string;
|
|
74
|
+
/** Which fill is edited. Only used when `modes` offers both; otherwise it is ignored. */
|
|
75
|
+
'mode'?: ColorPickerFillMode;
|
|
76
|
+
/**
|
|
77
|
+
* The gradient, with its stops in order of position. Unset while there is no
|
|
78
|
+
* readable gradient: the gradient mode then shows a default and writes nothing
|
|
79
|
+
* until the first change.
|
|
80
|
+
*/
|
|
81
|
+
'gradientValue'?: ColorPickerGradient | undefined;
|
|
82
|
+
/** The selected stop, as its index in order of position. */
|
|
83
|
+
'selectedStop'?: number;
|
|
37
84
|
};
|
|
38
85
|
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
39
86
|
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
87
|
+
close: () => any;
|
|
40
88
|
"update:modelValue": (value: string) => any;
|
|
89
|
+
"update:mode": (value: ColorPickerFillMode) => any;
|
|
90
|
+
"update:gradientValue": (value: ColorPickerGradient | undefined) => any;
|
|
91
|
+
"update:selectedStop": (value: number) => any;
|
|
41
92
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
93
|
+
onClose?: (() => any) | undefined;
|
|
42
94
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
95
|
+
"onUpdate:mode"?: ((value: ColorPickerFillMode) => any) | undefined;
|
|
96
|
+
"onUpdate:gradientValue"?: ((value: ColorPickerGradient | undefined) => any) | undefined;
|
|
97
|
+
"onUpdate:selectedStop"?: ((value: number) => any) | undefined;
|
|
43
98
|
}>, {
|
|
44
99
|
fullWidth: boolean;
|
|
45
100
|
matchWidth: boolean;
|
|
@@ -49,6 +104,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
|
|
|
49
104
|
suggestions: ColorSuggestions;
|
|
50
105
|
suggestionsLabel: string;
|
|
51
106
|
alphaLabel: string;
|
|
107
|
+
modes: ColorPickerFillMode[];
|
|
52
108
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
53
109
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
54
110
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface NexxtGradientFieldProps {
|
|
2
|
+
/** The applied value, shown while the field is not being edited. */
|
|
3
|
+
value: string;
|
|
4
|
+
/** Accessible name of the input. */
|
|
5
|
+
name: string;
|
|
6
|
+
/** Whether typed text can be applied; text that cannot is never committed. */
|
|
7
|
+
validate: (text: string) => boolean;
|
|
8
|
+
/** Ask for the numeric keypad. */
|
|
9
|
+
numeric?: boolean;
|
|
10
|
+
/** Show the value without editing it, such as a role name in place of a hex. */
|
|
11
|
+
readonly?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const __VLS_export: import('vue').DefineComponent<NexxtGradientFieldProps, {
|
|
14
|
+
focus: () => void | undefined;
|
|
15
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
16
|
+
invalid: (invalid: boolean) => any;
|
|
17
|
+
commit: (text: string) => any;
|
|
18
|
+
}, string, import('vue').PublicProps, Readonly<NexxtGradientFieldProps> & Readonly<{
|
|
19
|
+
onInvalid?: ((invalid: boolean) => any) | undefined;
|
|
20
|
+
onCommit?: ((text: string) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GradientCopy } from './gradient';
|
|
2
|
+
import { GradientEditor } from './useGradientEditor';
|
|
3
|
+
export interface NexxtGradientPreviewProps {
|
|
4
|
+
/** The gradient state of the picker. */
|
|
5
|
+
editor: GradientEditor;
|
|
6
|
+
/** Copy, already merged over the defaults. */
|
|
7
|
+
copy: GradientCopy;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
declare const __VLS_export: import('vue').DefineComponent<NexxtGradientPreviewProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<NexxtGradientPreviewProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GradientCopy } from './gradient';
|
|
2
|
+
import { GradientEditor, GradientEditorStop } from './useGradientEditor';
|
|
3
|
+
export interface NexxtGradientStopRowProps {
|
|
4
|
+
/** The gradient state of the picker. */
|
|
5
|
+
editor: GradientEditor;
|
|
6
|
+
/** The stop this row edits. */
|
|
7
|
+
stop: GradientEditorStop;
|
|
8
|
+
/** Copy, already merged over the defaults. */
|
|
9
|
+
copy: GradientCopy;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
declare const __VLS_export: import('vue').DefineComponent<NexxtGradientStopRowProps, {
|
|
14
|
+
focusPosition: () => void | undefined;
|
|
15
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
16
|
+
remove: () => any;
|
|
17
|
+
target: (element: HTMLElement | null) => any;
|
|
18
|
+
}, string, import('vue').PublicProps, Readonly<NexxtGradientStopRowProps> & Readonly<{
|
|
19
|
+
onRemove?: (() => any) | undefined;
|
|
20
|
+
onTarget?: ((element: HTMLElement | null) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GradientCopy } from './gradient';
|
|
2
|
+
import { GradientEditor } from './useGradientEditor';
|
|
3
|
+
export interface NexxtGradientStopsProps {
|
|
4
|
+
/** The gradient state of the picker. */
|
|
5
|
+
editor: GradientEditor;
|
|
6
|
+
/** Copy, already merged over the defaults. */
|
|
7
|
+
copy: GradientCopy;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
declare const __VLS_export: import('vue').DefineComponent<NexxtGradientStopsProps, {
|
|
12
|
+
focusStop: (id: number) => Promise<void>;
|
|
13
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
14
|
+
remove: (id: number) => any;
|
|
15
|
+
add: () => any;
|
|
16
|
+
}, string, import('vue').PublicProps, Readonly<NexxtGradientStopsProps> & Readonly<{
|
|
17
|
+
onRemove?: ((id: number) => any) | undefined;
|
|
18
|
+
onAdd?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|