@nexxtmove/ui 2.1.0 → 2.3.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.
Files changed (40) hide show
  1. package/dist/components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue.d.ts +6 -0
  2. package/dist/components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue.d.ts +2 -2
  3. package/dist/components/editor/molecules/EditorBlur/EditorBlur.vue.d.ts +106 -0
  4. package/dist/components/editor/molecules/EditorColor/EditorColor.vue.d.ts +49 -20
  5. package/dist/components/editor/molecules/EditorColor/_ColorField.vue.d.ts +66 -0
  6. package/dist/components/editor/molecules/EditorColor/colorClass.d.ts +46 -0
  7. package/dist/components/editor/molecules/EditorColor/gradientClass.d.ts +80 -0
  8. package/dist/components/editor/molecules/EditorGap/EditorGap.vue.d.ts +2 -2
  9. package/dist/components/editor/molecules/EditorMaxWidth/EditorMaxWidth.vue.d.ts +2 -2
  10. package/dist/components/editor/molecules/EditorShadow/EditorShadow.vue.d.ts +2 -2
  11. package/dist/components/molecules/ToggleGroup/ToggleGroup.vue.d.ts +7 -0
  12. package/dist/components/organisms/ColorPicker/ColorPicker.vue.d.ts +61 -2
  13. package/dist/components/organisms/ColorPicker/_GradientField.vue.d.ts +23 -0
  14. package/dist/components/organisms/ColorPicker/_GradientPreview.vue.d.ts +11 -0
  15. package/dist/components/organisms/ColorPicker/_GradientStopRow.vue.d.ts +21 -0
  16. package/dist/components/organisms/ColorPicker/_GradientStops.vue.d.ts +19 -0
  17. package/dist/components/organisms/ColorPicker/gradient.d.ts +189 -0
  18. package/dist/components/organisms/ColorPicker/gradientGeometry.d.ts +101 -0
  19. package/dist/components/organisms/ColorPicker/useGradientEditor.d.ts +89 -0
  20. package/dist/index.d.ts +7 -1
  21. package/dist/index.js +3591 -2182
  22. package/dist/nuxt.js +1 -0
  23. package/package.json +1 -1
  24. package/src/components/editor/atoms/EditorSettingsBlock/EditorSettingsBlock.vue +15 -2
  25. package/src/components/editor/molecules/EditorBlur/EditorBlur.vue +160 -0
  26. package/src/components/editor/molecules/EditorColor/EditorColor.vue +90 -171
  27. package/src/components/editor/molecules/EditorColor/_ColorField.vue +445 -0
  28. package/src/components/editor/molecules/EditorColor/colorClass.ts +61 -0
  29. package/src/components/editor/molecules/EditorColor/gradientClass.ts +225 -0
  30. package/src/components/molecules/ToggleGroup/ToggleGroup.vue +18 -3
  31. package/src/components/organisms/ColorPicker/ColorPicker.vue +686 -257
  32. package/src/components/organisms/ColorPicker/_GradientField.vue +93 -0
  33. package/src/components/organisms/ColorPicker/_GradientPreview.vue +401 -0
  34. package/src/components/organisms/ColorPicker/_GradientStopRow.vue +181 -0
  35. package/src/components/organisms/ColorPicker/_GradientStops.vue +218 -0
  36. package/src/components/organisms/ColorPicker/gradient.ts +303 -0
  37. package/src/components/organisms/ColorPicker/gradientGeometry.ts +216 -0
  38. package/src/components/organisms/ColorPicker/useGradientEditor.ts +358 -0
  39. package/src/components.json +1 -0
  40. package/src/index.ts +32 -0
@@ -6,6 +6,12 @@ interface NexxtEditorSettingsBlockProps {
6
6
  * When `false` the content is always visible and the model is ignored.
7
7
  */
8
8
  switchable?: boolean;
9
+ /**
10
+ * Id(s) of an element that describes the setting, set as `aria-describedby`
11
+ * on the switch. Only has an effect when `switchable` is `true`; without it
12
+ * no attribute is rendered.
13
+ */
14
+ describedby?: string;
9
15
  }
10
16
  type __VLS_Props = NexxtEditorSettingsBlockProps;
11
17
  type __VLS_ModelProps = {
@@ -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-cover" | "bg-contain") => any;
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-cover" | "bg-contain") => any) | undefined;
65
+ "onUpdate:modelValue"?: ((value: "bg-auto" | "bg-contain" | "bg-cover") => any) | undefined;
66
66
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * The blur steps the editor offers, in the order they are shown. `token` is the
3
+ * class without its fixed `backdrop-blur-` prefix, so the class is
4
+ * `backdrop-blur-` plus the token -- the same shape as `EDITOR_SHADOW_OPTIONS`.
5
+ * "No blur" is not a step: it is the switch being off. The labels are not in
6
+ * here; they arrive through `messages`, keyed by token.
7
+ */
8
+ export declare const EDITOR_BLUR_OPTIONS: readonly [{
9
+ readonly token: "xs";
10
+ }, {
11
+ readonly token: "sm";
12
+ }, {
13
+ readonly token: "md";
14
+ }, {
15
+ readonly token: "lg";
16
+ }, {
17
+ readonly token: "xl";
18
+ }];
19
+ /**
20
+ * The blur as the editor needs it: the Tailwind class itself, so the consumer
21
+ * can put the model value straight on the group it styles.
22
+ */
23
+ export type EditorBlurValue = `backdrop-blur-${(typeof EDITOR_BLUR_OPTIONS)[number]['token']}`;
24
+ /** Overridable copy of the step control. Every key is optional. */
25
+ export interface EditorBlurMessages {
26
+ /**
27
+ * Accessible name of the group of steps. Visually hidden: the block label
28
+ * already says what the steps are. Defaults to the Dutch `'Sterkte'`.
29
+ */
30
+ strength?: string;
31
+ /** Name of the `backdrop-blur-xs` option. Defaults to `'XS'`. */
32
+ xs?: string;
33
+ /** Name of the `backdrop-blur-sm` option. Defaults to `'S'`. */
34
+ sm?: string;
35
+ /** Name of the `backdrop-blur-md` option. Defaults to `'M'`. */
36
+ md?: string;
37
+ /** Name of the `backdrop-blur-lg` option. Defaults to `'L'`. */
38
+ lg?: string;
39
+ /** Name of the `backdrop-blur-xl` option. Defaults to `'XL'`. */
40
+ xl?: string;
41
+ }
42
+ export interface NexxtEditorBlurProps {
43
+ /**
44
+ * Header text of the settings block. Defaults to the Dutch `'Vervagen'`; the
45
+ * library has no i18n layer, so a consumer in another language passes its own
46
+ * copy in.
47
+ */
48
+ label?: string;
49
+ /**
50
+ * Render a switch next to the label that collapses and expands the steps.
51
+ * Defaults to `true`: there is no "none" step, so the switch is the only way
52
+ * to turn the blur off. The switch state is the `enabled` model; switching
53
+ * off leaves the step alone.
54
+ */
55
+ switchable?: boolean;
56
+ /**
57
+ * Copy of the step control. Merged per key, so overriding one key keeps the
58
+ * defaults of the others. Copy is never translated inside the component.
59
+ */
60
+ messages?: EditorBlurMessages;
61
+ /**
62
+ * Id(s) of an element that describes the setting, such as a hint the
63
+ * consumer renders itself. Set as `aria-describedby` on the switch (when
64
+ * `switchable`) and on the group of steps. Without it no attribute is set.
65
+ */
66
+ describedby?: string;
67
+ }
68
+ declare const _default: typeof __VLS_export;
69
+ export default _default;
70
+ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorBlurProps & {
71
+ /**
72
+ * The selected blur, as the Tailwind class to apply (`backdrop-blur-md`).
73
+ * Optional: a consumer may have no class stored yet. Without a valid class the
74
+ * control shows `md` but writes nothing, so the consumer has to assume
75
+ * `backdrop-blur-md` itself. Only a switch from off to on (when `switchable`)
76
+ * writes `backdrop-blur-md` back; mounting never emits.
77
+ */
78
+ modelValue?: EditorBlurValue;
79
+ /**
80
+ * Open state of the block. Only has an effect when `switchable` is `true`; then
81
+ * off is the way to express "no blur". With `switchable` set to `false` the
82
+ * steps are always active, whatever this model says.
83
+ */
84
+ enabled?: boolean;
85
+ }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
86
+ "update:modelValue": (value: "backdrop-blur-lg" | "backdrop-blur-sm" | "backdrop-blur-md" | "backdrop-blur-xs" | "backdrop-blur-xl" | undefined) => any;
87
+ "update:enabled": (value: boolean) => any;
88
+ }, string, import('vue').PublicProps, Readonly<NexxtEditorBlurProps & {
89
+ /**
90
+ * The selected blur, as the Tailwind class to apply (`backdrop-blur-md`).
91
+ * Optional: a consumer may have no class stored yet. Without a valid class the
92
+ * control shows `md` but writes nothing, so the consumer has to assume
93
+ * `backdrop-blur-md` itself. Only a switch from off to on (when `switchable`)
94
+ * writes `backdrop-blur-md` back; mounting never emits.
95
+ */
96
+ modelValue?: EditorBlurValue;
97
+ /**
98
+ * Open state of the block. Only has an effect when `switchable` is `true`; then
99
+ * off is the way to express "no blur". With `switchable` set to `false` the
100
+ * steps are always active, whatever this model says.
101
+ */
102
+ enabled?: boolean;
103
+ }> & Readonly<{
104
+ "onUpdate:modelValue"?: ((value: "backdrop-blur-lg" | "backdrop-blur-sm" | "backdrop-blur-md" | "backdrop-blur-xs" | "backdrop-blur-xl" | undefined) => any) | undefined;
105
+ "onUpdate:enabled"?: ((value: boolean) => any) | undefined;
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;
@@ -40,6 +32,11 @@ export interface EditorColorMessages {
40
32
  suggestionsLabel?: string;
41
33
  /** Label shown above the theme roles. Defaults to `'Huisstijl'`. */
42
34
  themeLabel?: string;
35
+ /**
36
+ * Label above the opacity slider, and its accessible name. Defaults to
37
+ * `'Dekking'`. Only shown with `showAlpha`.
38
+ */
39
+ alphaLabel?: string;
43
40
  }
44
41
  export interface NexxtEditorColorProps {
45
42
  /**
@@ -84,6 +81,38 @@ export interface NexxtEditorColorProps {
84
81
  * alpha and the model gets the opaque 6-digit hex.
85
82
  */
86
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;
87
116
  }
88
117
  declare const _default: typeof __VLS_export;
89
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-0" | "gap-1" | "gap-2" | "gap-3" | "gap-4" | "gap-5" | "gap-6" | "gap-7" | "gap-8" | "gap-9" | "gap-10" | "gap-11" | "gap-12" | "gap-14" | "gap-16") => any;
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-0" | "gap-1" | "gap-2" | "gap-3" | "gap-4" | "gap-5" | "gap-6" | "gap-7" | "gap-8" | "gap-9" | "gap-10" | "gap-11" | "gap-12" | "gap-14" | "gap-16") => any) | undefined;
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-sm" | "max-w-md" | "max-w-lg" | "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;
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-sm" | "max-w-md" | "max-w-lg" | "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;
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-sm" | "shadow-md" | "shadow-lg") => any;
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-sm" | "shadow-md" | "shadow-lg") => any) | undefined;
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>;
@@ -17,6 +17,12 @@ interface NexxtToggleGroupProps {
17
17
  options: NexxtToggleGroupOption[];
18
18
  label?: string;
19
19
  equalWidth?: boolean;
20
+ /**
21
+ * Hide `label` visually while it stays the group's accessible name, for a
22
+ * group whose purpose is already clear from a heading around it. Defaults to
23
+ * `false`. Has no effect without a `label`.
24
+ */
25
+ labelHidden?: boolean;
20
26
  }
21
27
  type __VLS_Props = NexxtToggleGroupProps;
22
28
  type __VLS_Slots = {
@@ -44,6 +50,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
44
50
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
45
51
  }>, {
46
52
  equalWidth: boolean;
53
+ labelHidden: boolean;
47
54
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
48
55
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
49
56
  declare const _default: typeof __VLS_export;
@@ -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 {
@@ -19,25 +26,75 @@ export interface NexxtColorPickerProps {
19
26
  suggestions?: ColorSuggestions;
20
27
  /** Accessible and visible label for the suggestions. */
21
28
  suggestionsLabel?: string;
29
+ /** Visible label of the opacity slider, and the slider's accessible name. */
30
+ alphaLabel?: string;
22
31
  /**
23
32
  * Text shown in the trigger in place of the formatted colour, for a value that has a name of
24
33
  * its own, such as a theme role. Only shown while a colour is set.
25
34
  */
26
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;
27
58
  }
28
59
  type __VLS_Slots = {
29
- /** Named colours a wrapper offers next to the free picker; rendered above the suggestions. */
30
- presets?(): unknown;
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;
31
70
  };
32
71
  type __VLS_Props = NexxtColorPickerProps;
33
72
  type __VLS_ModelProps = {
34
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;
35
84
  };
36
85
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
37
86
  declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
87
+ close: () => any;
38
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;
39
92
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
93
+ onClose?: (() => any) | undefined;
40
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;
41
98
  }>, {
42
99
  fullWidth: boolean;
43
100
  matchWidth: boolean;
@@ -46,6 +103,8 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
46
103
  formats: ColorFormat[];
47
104
  suggestions: ColorSuggestions;
48
105
  suggestionsLabel: string;
106
+ alphaLabel: string;
107
+ modes: ColorPickerFillMode[];
49
108
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
50
109
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
51
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>;