@nexxtmove/ui 1.35.0 → 1.36.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.
@@ -5,17 +5,41 @@
5
5
  * is colour plus width, and that pair gets a component of its own.
6
6
  */
7
7
  export type EditorColorProperty = 'bg' | 'text';
8
+ declare const ROLES: readonly ["main", "accent", "background", "heading", "text"];
8
9
  /**
9
- * The colour as the editor needs it: a Tailwind arbitrary-value class such as
10
- * `'bg-[#1777EA]'`, so the consumer can put the model value straight on the
11
- * element it styles.
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
12
  */
13
- export type EditorColorValue = `${EditorColorProperty}-[#${string}]`;
13
+ export type EditorColorRole = (typeof ROLES)[number];
14
+ /** A literal colour: a Tailwind arbitrary-value class such as `'bg-[#1777EA]'`. */
15
+ export type EditorColorLiteralValue = `${EditorColorProperty}-[#${string}]`;
16
+ /** A colour bound to a theme role: a token class such as `'bg-theme-main'`. */
17
+ export type EditorColorRoleValue = `${EditorColorProperty}-theme-${EditorColorRole}`;
18
+ /**
19
+ * The colour as the editor needs it: the class to apply, so the consumer can
20
+ * put the model value straight on the element it styles. Either a literal
21
+ * colour or a theme role.
22
+ */
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
+ }
14
36
  export interface EditorColorMessages {
15
37
  /** Text shown while no colour is set. Defaults to `'Kies kleur...'`. */
16
38
  placeholder?: string;
17
39
  /** Label shown above reusable colours. */
18
40
  suggestionsLabel?: string;
41
+ /** Label shown above the theme roles. Defaults to `'Huisstijl'`. */
42
+ themeLabel?: string;
19
43
  }
20
44
  export interface NexxtEditorColorProps {
21
45
  /**
@@ -43,6 +67,13 @@ export interface NexxtEditorColorProps {
43
67
  messages?: EditorColorMessages;
44
68
  /** Hex colours available inside the picker panel as one-click suggestions. */
45
69
  suggestions?: string[];
70
+ /**
71
+ * Theme roles offered above the suggestions. Picking one writes the role
72
+ * class for the current `property` instead of a literal colour. Which roles
73
+ * are offered is up to the consumer; an entry whose `hex` is not a 6- or
74
+ * 8-digit hex is left out. Without roles the section is not rendered.
75
+ */
76
+ themeRoles?: EditorColorThemeRole[];
46
77
  }
47
78
  declare const _default: typeof __VLS_export;
48
79
  export default _default;
@@ -51,33 +82,39 @@ declare const __VLS_export: import('vue').DefineComponent<NexxtEditorColorProps
51
82
  * The chosen colour, as the Tailwind class to apply.
52
83
  *
53
84
  * Beware: Tailwind only generates an arbitrary class for text it finds in the
54
- * source at build time. A value that arrives at runtime -- from a database,
55
- * say -- therefore gets no CSS of its own; the consumer either translates it
56
- * into an inline style or safelists the classes it can produce. The hex is
57
- * always parseable out of the string, which is what makes that translation
58
- * possible.
85
+ * source at build time. A literal value that arrives at runtime -- from a
86
+ * database, say -- therefore gets no CSS of its own; the consumer either
87
+ * translates it into an inline style or safelists the classes it can produce.
88
+ * The hex is always parseable out of a literal value, which is what makes that
89
+ * translation possible.
90
+ *
91
+ * A role class is a finite list, so it is static CSS -- but the consumer's:
92
+ * this library defines no `theme-*` colours.
59
93
  */
60
94
  modelValue: EditorColorValue;
61
95
  /** Open state of the block. Only has an effect when `switchable` is `true`. */
62
96
  enabled?: boolean;
63
97
  }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
64
- "update:modelValue": (value: `text-[#${string}]` | `bg-[#${string}]`) => any;
98
+ "update:modelValue": (value: EditorColorValue) => any;
65
99
  "update:enabled": (value: boolean) => any;
66
100
  }, string, import('vue').PublicProps, Readonly<NexxtEditorColorProps & {
67
101
  /**
68
102
  * The chosen colour, as the Tailwind class to apply.
69
103
  *
70
104
  * Beware: Tailwind only generates an arbitrary class for text it finds in the
71
- * source at build time. A value that arrives at runtime -- from a database,
72
- * say -- therefore gets no CSS of its own; the consumer either translates it
73
- * into an inline style or safelists the classes it can produce. The hex is
74
- * always parseable out of the string, which is what makes that translation
75
- * possible.
105
+ * source at build time. A literal value that arrives at runtime -- from a
106
+ * database, say -- therefore gets no CSS of its own; the consumer either
107
+ * translates it into an inline style or safelists the classes it can produce.
108
+ * The hex is always parseable out of a literal value, which is what makes that
109
+ * translation possible.
110
+ *
111
+ * A role class is a finite list, so it is static CSS -- but the consumer's:
112
+ * this library defines no `theme-*` colours.
76
113
  */
77
114
  modelValue: EditorColorValue;
78
115
  /** Open state of the block. Only has an effect when `switchable` is `true`. */
79
116
  enabled?: boolean;
80
117
  }> & Readonly<{
81
- "onUpdate:modelValue"?: ((value: `text-[#${string}]` | `bg-[#${string}]`) => any) | undefined;
118
+ "onUpdate:modelValue"?: ((value: EditorColorValue) => any) | undefined;
82
119
  "onUpdate:enabled"?: ((value: boolean) => any) | undefined;
83
120
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -14,13 +14,22 @@ export interface NexxtColorPickerProps {
14
14
  suggestions?: ColorSuggestions;
15
15
  /** Accessible and visible label for the suggestions. */
16
16
  suggestionsLabel?: string;
17
+ /**
18
+ * Text shown in the trigger in place of the formatted colour, for a value that has a name of
19
+ * its own, such as a theme role. Only shown while a colour is set.
20
+ */
21
+ valueLabel?: string;
17
22
  }
23
+ type __VLS_Slots = {
24
+ /** Named colours a wrapper offers next to the free picker; rendered above the suggestions. */
25
+ presets?(): unknown;
26
+ };
18
27
  type __VLS_Props = NexxtColorPickerProps;
19
28
  type __VLS_ModelProps = {
20
29
  modelValue?: string;
21
30
  };
22
31
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
23
- declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
32
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
24
33
  "update:modelValue": (value: string) => any;
25
34
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
26
35
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
@@ -33,5 +42,11 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
33
42
  suggestions: ColorSuggestions;
34
43
  suggestionsLabel: string;
35
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
45
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
46
  declare const _default: typeof __VLS_export;
37
47
  export default _default;
48
+ type __VLS_WithSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export type { EditorAlignItemsMessages, EditorAlignItemsValue, } from './compone
14
14
  export type { EditorBackgroundSizeMessages, EditorBackgroundSizeValue, } from './components/editor/molecules/EditorBackgroundSize/EditorBackgroundSize.vue';
15
15
  export type { EditorFlexDirectionMessages, EditorFlexDirectionValue, } from './components/editor/molecules/EditorFlexDirection/EditorFlexDirection.vue';
16
16
  export type { EditorGapMessages, EditorGapValue, } from './components/editor/molecules/EditorGap/EditorGap.vue';
17
- export type { EditorColorMessages, EditorColorProperty, EditorColorValue, } from './components/editor/molecules/EditorColor/EditorColor.vue';
17
+ export type { EditorColorLiteralValue, EditorColorMessages, EditorColorProperty, EditorColorRole, EditorColorRoleValue, EditorColorThemeRole, EditorColorValue, } from './components/editor/molecules/EditorColor/EditorColor.vue';
18
18
  export type { EditorBorderMessages, EditorBorderWidth, } from './components/editor/molecules/EditorBorder/EditorBorder.vue';
19
19
  export type { EditorHeadingTypeMessages, EditorHeadingTypeValue, } from './components/editor/molecules/EditorHeadingType/EditorHeadingType.vue';
20
20
  export { EDITOR_RADIUS_STEPS } from './components/editor/molecules/EditorRadius/EditorRadius.vue';