@selfhelp/shared 1.2.5 → 1.3.1

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 (64) hide show
  1. package/CHANGELOG.md +341 -326
  2. package/LICENSE +381 -381
  3. package/README.md +57 -57
  4. package/dist/index.d.mts +25 -1
  5. package/dist/index.d.ts +25 -1
  6. package/dist/index.js +2 -0
  7. package/dist/index.mjs +2 -0
  8. package/package.json +102 -102
  9. package/src/api/__tests__/endpoints.test.ts +45 -0
  10. package/src/api/endpoints.ts +2 -0
  11. package/src/api/index.ts +5 -5
  12. package/src/assets/__tests__/resolveAssetUrl.test.ts +61 -61
  13. package/src/assets/index.ts +5 -5
  14. package/src/assets/resolveAssetUrl.ts +44 -44
  15. package/src/cms-classes/__tests__/classify.test.ts +63 -63
  16. package/src/cms-classes/allow-list.ts +158 -158
  17. package/src/cms-classes/classify.ts +90 -90
  18. package/src/cms-classes/index.ts +7 -7
  19. package/src/cms-classes/remap.ts +44 -44
  20. package/src/condition/__tests__/evaluate.test.ts +54 -54
  21. package/src/condition/evaluate.ts +121 -121
  22. package/src/condition/index.ts +5 -5
  23. package/src/index.ts +25 -25
  24. package/src/interpolation/__tests__/replaceCalcedValues.test.ts +41 -41
  25. package/src/interpolation/index.ts +5 -5
  26. package/src/interpolation/replaceCalcedValues.ts +27 -27
  27. package/src/plugin-sdk/define.ts +89 -89
  28. package/src/plugin-sdk/index.ts +103 -103
  29. package/src/plugin-sdk/lock.ts +124 -124
  30. package/src/plugin-sdk/manifest.ts +307 -307
  31. package/src/plugin-sdk/realtime.ts +277 -277
  32. package/src/plugin-sdk/registry.ts +105 -105
  33. package/src/plugin-sdk/runtime-shim.ts +140 -140
  34. package/src/plugin-sdk/types.ts +315 -315
  35. package/src/plugin-sdk/version.ts +209 -209
  36. package/src/registry/__tests__/registry.test.ts +135 -135
  37. package/src/registry/index.ts +94 -94
  38. package/src/registry/styles.registry.ts +295 -295
  39. package/src/testing/__tests__/testing-kit.test.ts +228 -228
  40. package/src/testing/index.ts +483 -483
  41. package/src/theme/index.ts +6 -6
  42. package/src/theme/tailwind.ts +73 -73
  43. package/src/theme/tokens.ts +177 -177
  44. package/src/types/api/auth.ts +22 -0
  45. package/src/types/api/envelope.ts +34 -34
  46. package/src/types/api/forms.ts +76 -76
  47. package/src/types/api/index.ts +9 -9
  48. package/src/types/api/language.ts +12 -12
  49. package/src/types/api/page.ts +9 -9
  50. package/src/types/index.ts +17 -17
  51. package/src/types/mantine/common.ts +142 -142
  52. package/src/types/pages.ts +107 -107
  53. package/src/types/styles/auth.ts +184 -184
  54. package/src/types/styles/base.ts +72 -72
  55. package/src/types/styles/composite.ts +131 -131
  56. package/src/types/styles/forms.ts +439 -439
  57. package/src/types/styles/interactive.ts +165 -165
  58. package/src/types/styles/layout.ts +184 -184
  59. package/src/types/styles/media.ts +68 -68
  60. package/src/types/styles/typography.ts +118 -118
  61. package/src/types/styles/unknown.ts +220 -220
  62. package/src/utils/__tests__/transformPageData.test.ts +69 -69
  63. package/src/utils/spacing.ts +64 -64
  64. package/src/utils/transformPageData.ts +99 -99
@@ -1,6 +1,6 @@
1
- /*
2
- SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
- SPDX-License-Identifier: MPL-2.0
4
- */
5
- export * from './tokens';
6
- export * from './tailwind';
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ export * from './tokens';
6
+ export * from './tailwind';
@@ -1,73 +1,73 @@
1
- /*
2
- SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
- SPDX-License-Identifier: MPL-2.0
4
- */
5
- /**
6
- * Shared Tailwind preset extended by both the web frontend (Tailwind v4)
7
- * and the mobile app (Uniwind v4 inside HeroUI Native). Anchors the same
8
- * scale values that drive `mantine_size`, `mantine_radius`,
9
- * `mantine_spacing`, and the color palette so a class like `p-md` or
10
- * `text-blue-6` resolves identically on web and mobile.
11
- */
12
-
13
- import { COLOR_SCALES, RADIUS_PX, SPACING_PX, FONT_SIZE_PX, LINE_HEIGHT } from './tokens';
14
-
15
- const px = (n: number | undefined): string => (n === undefined ? '0px' : `${n}px`);
16
-
17
- const colorScaleToTailwind = (scale: readonly string[]): Record<string, string> => {
18
- const out: Record<string, string> = {};
19
- scale.forEach((value, idx) => {
20
- out[String(idx)] = value;
21
- });
22
- return out;
23
- };
24
-
25
- const colors: Record<string, Record<string, string>> = {};
26
- for (const [name, scale] of Object.entries(COLOR_SCALES)) {
27
- colors[name] = colorScaleToTailwind(scale);
28
- }
29
-
30
- const spacing: Record<string, string> = {
31
- none: px(SPACING_PX.none),
32
- xs: px(SPACING_PX.xs),
33
- sm: px(SPACING_PX.sm),
34
- md: px(SPACING_PX.md),
35
- lg: px(SPACING_PX.lg),
36
- xl: px(SPACING_PX.xl),
37
- };
38
-
39
- const borderRadius: Record<string, string> = {
40
- xs: px(RADIUS_PX.xs),
41
- sm: px(RADIUS_PX.sm),
42
- md: px(RADIUS_PX.md),
43
- lg: px(RADIUS_PX.lg),
44
- xl: px(RADIUS_PX.xl),
45
- };
46
-
47
- const fontSize: Record<string, [string, { lineHeight: string }]> = {
48
- xs: [px(FONT_SIZE_PX.xs), { lineHeight: String(LINE_HEIGHT.xs) }],
49
- sm: [px(FONT_SIZE_PX.sm), { lineHeight: String(LINE_HEIGHT.sm) }],
50
- md: [px(FONT_SIZE_PX.md), { lineHeight: String(LINE_HEIGHT.md) }],
51
- lg: [px(FONT_SIZE_PX.lg), { lineHeight: String(LINE_HEIGHT.lg) }],
52
- xl: [px(FONT_SIZE_PX.xl), { lineHeight: String(LINE_HEIGHT.xl) }],
53
- };
54
-
55
- /**
56
- * Tailwind theme `extend` block. Apps spread this into their own
57
- * tailwind config (`theme.extend`).
58
- */
59
- export const sharedTailwindExtend = {
60
- colors,
61
- spacing,
62
- borderRadius,
63
- fontSize,
64
- } as const;
65
-
66
- /**
67
- * Convenience preset object that fits both Tailwind v3 and v4 / Uniwind.
68
- */
69
- export const sharedTailwindPreset = {
70
- theme: {
71
- extend: sharedTailwindExtend,
72
- },
73
- } as const;
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Shared Tailwind preset extended by both the web frontend (Tailwind v4)
7
+ * and the mobile app (Uniwind v4 inside HeroUI Native). Anchors the same
8
+ * scale values that drive `mantine_size`, `mantine_radius`,
9
+ * `mantine_spacing`, and the color palette so a class like `p-md` or
10
+ * `text-blue-6` resolves identically on web and mobile.
11
+ */
12
+
13
+ import { COLOR_SCALES, RADIUS_PX, SPACING_PX, FONT_SIZE_PX, LINE_HEIGHT } from './tokens';
14
+
15
+ const px = (n: number | undefined): string => (n === undefined ? '0px' : `${n}px`);
16
+
17
+ const colorScaleToTailwind = (scale: readonly string[]): Record<string, string> => {
18
+ const out: Record<string, string> = {};
19
+ scale.forEach((value, idx) => {
20
+ out[String(idx)] = value;
21
+ });
22
+ return out;
23
+ };
24
+
25
+ const colors: Record<string, Record<string, string>> = {};
26
+ for (const [name, scale] of Object.entries(COLOR_SCALES)) {
27
+ colors[name] = colorScaleToTailwind(scale);
28
+ }
29
+
30
+ const spacing: Record<string, string> = {
31
+ none: px(SPACING_PX.none),
32
+ xs: px(SPACING_PX.xs),
33
+ sm: px(SPACING_PX.sm),
34
+ md: px(SPACING_PX.md),
35
+ lg: px(SPACING_PX.lg),
36
+ xl: px(SPACING_PX.xl),
37
+ };
38
+
39
+ const borderRadius: Record<string, string> = {
40
+ xs: px(RADIUS_PX.xs),
41
+ sm: px(RADIUS_PX.sm),
42
+ md: px(RADIUS_PX.md),
43
+ lg: px(RADIUS_PX.lg),
44
+ xl: px(RADIUS_PX.xl),
45
+ };
46
+
47
+ const fontSize: Record<string, [string, { lineHeight: string }]> = {
48
+ xs: [px(FONT_SIZE_PX.xs), { lineHeight: String(LINE_HEIGHT.xs) }],
49
+ sm: [px(FONT_SIZE_PX.sm), { lineHeight: String(LINE_HEIGHT.sm) }],
50
+ md: [px(FONT_SIZE_PX.md), { lineHeight: String(LINE_HEIGHT.md) }],
51
+ lg: [px(FONT_SIZE_PX.lg), { lineHeight: String(LINE_HEIGHT.lg) }],
52
+ xl: [px(FONT_SIZE_PX.xl), { lineHeight: String(LINE_HEIGHT.xl) }],
53
+ };
54
+
55
+ /**
56
+ * Tailwind theme `extend` block. Apps spread this into their own
57
+ * tailwind config (`theme.extend`).
58
+ */
59
+ export const sharedTailwindExtend = {
60
+ colors,
61
+ spacing,
62
+ borderRadius,
63
+ fontSize,
64
+ } as const;
65
+
66
+ /**
67
+ * Convenience preset object that fits both Tailwind v3 and v4 / Uniwind.
68
+ */
69
+ export const sharedTailwindPreset = {
70
+ theme: {
71
+ extend: sharedTailwindExtend,
72
+ },
73
+ } as const;
@@ -1,177 +1,177 @@
1
- /*
2
- SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
- SPDX-License-Identifier: MPL-2.0
4
- */
5
- /**
6
- * Mantine semantic token tables. Both the web Mantine theme and the
7
- * mobile HeroUI Native theme extend these so a `mantine_size: 'md'` on a
8
- * section renders identical sizing regardless of platform.
9
- *
10
- * Pixel values come straight from Mantine v9 defaults:
11
- * https://mantine.dev/theming/sizes/
12
- */
13
-
14
- import type { TMantineSize } from '../types/mantine/common';
15
-
16
- /** Canonical spacing tokens (without the `string` escape hatch). */
17
- export type TCanonicalSpacing = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
18
- export type TCanonicalRadius = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
- export type TCanonicalColor =
20
- | 'gray'
21
- | 'red'
22
- | 'pink'
23
- | 'grape'
24
- | 'violet'
25
- | 'indigo'
26
- | 'blue'
27
- | 'cyan'
28
- | 'teal'
29
- | 'green'
30
- | 'lime'
31
- | 'yellow'
32
- | 'orange'
33
- | 'dark';
34
-
35
- /** xs..xl -> font-size px (Mantine `theme.fontSizes`). */
36
- export const FONT_SIZE_PX: Record<TMantineSize, number> = {
37
- xs: 12,
38
- sm: 14,
39
- md: 16,
40
- lg: 18,
41
- xl: 20,
42
- };
43
-
44
- /** xs..xl -> line-height. */
45
- export const LINE_HEIGHT: Record<TMantineSize, number> = {
46
- xs: 1.4,
47
- sm: 1.45,
48
- md: 1.55,
49
- lg: 1.6,
50
- xl: 1.65,
51
- };
52
-
53
- /** xs..xl -> spacing px (Mantine `theme.spacing`). */
54
- export const SPACING_PX: Record<TCanonicalSpacing, number> = {
55
- none: 0,
56
- xs: 10,
57
- sm: 12,
58
- md: 16,
59
- lg: 20,
60
- xl: 32,
61
- };
62
-
63
- /** Mantine spacing -> Tailwind spacing class suffix. */
64
- export const SPACING_TO_TAILWIND: Record<TCanonicalSpacing, string> = {
65
- none: '0',
66
- xs: '2.5',
67
- sm: '3',
68
- md: '4',
69
- lg: '5',
70
- xl: '8',
71
- };
72
-
73
- /** xs..xl -> border-radius px. */
74
- export const RADIUS_PX: Record<TCanonicalRadius, number> = {
75
- xs: 2,
76
- sm: 4,
77
- md: 8,
78
- lg: 16,
79
- xl: 32,
80
- };
81
-
82
- /** Mantine container size -> max-width px. */
83
- export const CONTAINER_SIZE_PX: Record<TMantineSize, number> = {
84
- xs: 540,
85
- sm: 720,
86
- md: 960,
87
- lg: 1140,
88
- xl: 1320,
89
- };
90
-
91
- /**
92
- * Mantine palette base colors (color-6 from each scale). Each renderer
93
- * maps these to its own theme tokens. For HeroUI Native we feed these
94
- * into the theme builder so `mantine_color: 'blue'` resolves to the
95
- * same Mantine-blue look on mobile.
96
- */
97
- export const COLOR_PALETTE: Record<TCanonicalColor, string> = {
98
- gray: '#868e96',
99
- red: '#fa5252',
100
- pink: '#e64980',
101
- grape: '#be4bdb',
102
- violet: '#7950f2',
103
- indigo: '#4c6ef5',
104
- blue: '#228be6',
105
- cyan: '#15aabf',
106
- teal: '#12b886',
107
- green: '#40c057',
108
- lime: '#82c91e',
109
- yellow: '#fab005',
110
- orange: '#fd7e14',
111
- dark: '#212529',
112
- };
113
-
114
- /**
115
- * Full Mantine color scales (0..9). The renderer can pick a shade
116
- * (default 6 for `light`/`filled`).
117
- */
118
- export const COLOR_SCALES: Record<TCanonicalColor, readonly string[]> = {
119
- gray: ['#f8f9fa', '#f1f3f5', '#e9ecef', '#dee2e6', '#ced4da', '#adb5bd', '#868e96', '#495057', '#343a40', '#212529'],
120
- red: ['#fff5f5', '#ffe3e3', '#ffc9c9', '#ffa8a8', '#ff8787', '#ff6b6b', '#fa5252', '#f03e3e', '#e03131', '#c92a2a'],
121
- pink: ['#fff0f6', '#ffdeeb', '#fcc2d7', '#faa2c1', '#f783ac', '#f06595', '#e64980', '#d6336c', '#c2255c', '#a61e4d'],
122
- grape: ['#f8f0fc', '#f3d9fa', '#eebefa', '#e599f7', '#da77f2', '#cc5de8', '#be4bdb', '#ae3ec9', '#9c36b5', '#862e9c'],
123
- violet: ['#f3f0ff', '#e5dbff', '#d0bfff', '#b197fc', '#9775fa', '#845ef7', '#7950f2', '#7048e8', '#6741d9', '#5f3dc4'],
124
- indigo: ['#edf2ff', '#dbe4ff', '#bac8ff', '#91a7ff', '#748ffc', '#5c7cfa', '#4c6ef5', '#4263eb', '#3b5bdb', '#364fc7'],
125
- blue: ['#e7f5ff', '#d0ebff', '#a5d8ff', '#74c0fc', '#4dabf7', '#339af0', '#228be6', '#1c7ed6', '#1971c2', '#1864ab'],
126
- cyan: ['#e3fafc', '#c5f6fa', '#99e9f2', '#66d9e8', '#3bc9db', '#22b8cf', '#15aabf', '#1098ad', '#0c8599', '#0b7285'],
127
- teal: ['#e6fcf5', '#c3fae8', '#96f2d7', '#63e6be', '#38d9a9', '#20c997', '#12b886', '#0ca678', '#099268', '#087f5b'],
128
- green: ['#ebfbee', '#d3f9d8', '#b2f2bb', '#8ce99a', '#69db7c', '#51cf66', '#40c057', '#37b24d', '#2f9e44', '#2b8a3e'],
129
- lime: ['#f4fce3', '#e9fac8', '#d8f5a2', '#c0eb75', '#a9e34b', '#94d82d', '#82c91e', '#74b816', '#66a80f', '#5c940d'],
130
- yellow: ['#fff9db', '#fff3bf', '#ffec99', '#ffe066', '#ffd43b', '#fcc419', '#fab005', '#f59f00', '#f08c00', '#e67700'],
131
- orange: ['#fff4e6', '#ffe8cc', '#ffd8a8', '#ffc078', '#ffa94d', '#ff922b', '#fd7e14', '#f76707', '#e8590c', '#d9480f'],
132
- dark: ['#c1c2c5', '#a6a7ab', '#909296', '#5c5f66', '#373a40', '#2c2e33', '#25262b', '#1a1b1e', '#141517', '#101113'],
133
- };
134
-
135
- export interface ISpacingResolved {
136
- mt?: number | string;
137
- mb?: number | string;
138
- ms?: number | string;
139
- me?: number | string;
140
- pt?: number | string;
141
- pb?: number | string;
142
- ps?: number | string;
143
- pe?: number | string;
144
- }
145
-
146
- /** Resolve a spacing token (xs..xl/none) to a px value, passing through any non-Mantine string verbatim. */
147
- export function spacingToPx(token: string | undefined): number | string | undefined {
148
- if (!token || token === 'none') return undefined;
149
- if (token in SPACING_PX) return SPACING_PX[token as TCanonicalSpacing];
150
- return token;
151
- }
152
-
153
- /** Resolve a Mantine size to a font-size px value, passing through any non-Mantine string verbatim. */
154
- export function sizeToFontPx(token: string | undefined): number | string | undefined {
155
- if (!token) return undefined;
156
- if (token in FONT_SIZE_PX) return FONT_SIZE_PX[token as TMantineSize];
157
- return token;
158
- }
159
-
160
- /** Resolve a Mantine radius to a px value, passing through any non-Mantine string verbatim. */
161
- export function radiusToPx(token: string | undefined): number | string | undefined {
162
- if (!token) return undefined;
163
- if (token in RADIUS_PX) return RADIUS_PX[token as TCanonicalRadius];
164
- return token;
165
- }
166
-
167
- /**
168
- * Resolve a Mantine palette color name + optional shade index to a hex
169
- * string. Passes raw hex/css color values through unchanged.
170
- */
171
- export function colorToHex(name: string | undefined, shade = 6): string | undefined {
172
- if (!name) return undefined;
173
- if (name.startsWith('#') || name.startsWith('rgb') || name.startsWith('hsl')) return name;
174
- const scale = COLOR_SCALES[name as TCanonicalColor];
175
- if (!scale) return name;
176
- return scale[Math.max(0, Math.min(9, shade))];
177
- }
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Mantine semantic token tables. Both the web Mantine theme and the
7
+ * mobile HeroUI Native theme extend these so a `mantine_size: 'md'` on a
8
+ * section renders identical sizing regardless of platform.
9
+ *
10
+ * Pixel values come straight from Mantine v9 defaults:
11
+ * https://mantine.dev/theming/sizes/
12
+ */
13
+
14
+ import type { TMantineSize } from '../types/mantine/common';
15
+
16
+ /** Canonical spacing tokens (without the `string` escape hatch). */
17
+ export type TCanonicalSpacing = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
18
+ export type TCanonicalRadius = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
19
+ export type TCanonicalColor =
20
+ | 'gray'
21
+ | 'red'
22
+ | 'pink'
23
+ | 'grape'
24
+ | 'violet'
25
+ | 'indigo'
26
+ | 'blue'
27
+ | 'cyan'
28
+ | 'teal'
29
+ | 'green'
30
+ | 'lime'
31
+ | 'yellow'
32
+ | 'orange'
33
+ | 'dark';
34
+
35
+ /** xs..xl -> font-size px (Mantine `theme.fontSizes`). */
36
+ export const FONT_SIZE_PX: Record<TMantineSize, number> = {
37
+ xs: 12,
38
+ sm: 14,
39
+ md: 16,
40
+ lg: 18,
41
+ xl: 20,
42
+ };
43
+
44
+ /** xs..xl -> line-height. */
45
+ export const LINE_HEIGHT: Record<TMantineSize, number> = {
46
+ xs: 1.4,
47
+ sm: 1.45,
48
+ md: 1.55,
49
+ lg: 1.6,
50
+ xl: 1.65,
51
+ };
52
+
53
+ /** xs..xl -> spacing px (Mantine `theme.spacing`). */
54
+ export const SPACING_PX: Record<TCanonicalSpacing, number> = {
55
+ none: 0,
56
+ xs: 10,
57
+ sm: 12,
58
+ md: 16,
59
+ lg: 20,
60
+ xl: 32,
61
+ };
62
+
63
+ /** Mantine spacing -> Tailwind spacing class suffix. */
64
+ export const SPACING_TO_TAILWIND: Record<TCanonicalSpacing, string> = {
65
+ none: '0',
66
+ xs: '2.5',
67
+ sm: '3',
68
+ md: '4',
69
+ lg: '5',
70
+ xl: '8',
71
+ };
72
+
73
+ /** xs..xl -> border-radius px. */
74
+ export const RADIUS_PX: Record<TCanonicalRadius, number> = {
75
+ xs: 2,
76
+ sm: 4,
77
+ md: 8,
78
+ lg: 16,
79
+ xl: 32,
80
+ };
81
+
82
+ /** Mantine container size -> max-width px. */
83
+ export const CONTAINER_SIZE_PX: Record<TMantineSize, number> = {
84
+ xs: 540,
85
+ sm: 720,
86
+ md: 960,
87
+ lg: 1140,
88
+ xl: 1320,
89
+ };
90
+
91
+ /**
92
+ * Mantine palette base colors (color-6 from each scale). Each renderer
93
+ * maps these to its own theme tokens. For HeroUI Native we feed these
94
+ * into the theme builder so `mantine_color: 'blue'` resolves to the
95
+ * same Mantine-blue look on mobile.
96
+ */
97
+ export const COLOR_PALETTE: Record<TCanonicalColor, string> = {
98
+ gray: '#868e96',
99
+ red: '#fa5252',
100
+ pink: '#e64980',
101
+ grape: '#be4bdb',
102
+ violet: '#7950f2',
103
+ indigo: '#4c6ef5',
104
+ blue: '#228be6',
105
+ cyan: '#15aabf',
106
+ teal: '#12b886',
107
+ green: '#40c057',
108
+ lime: '#82c91e',
109
+ yellow: '#fab005',
110
+ orange: '#fd7e14',
111
+ dark: '#212529',
112
+ };
113
+
114
+ /**
115
+ * Full Mantine color scales (0..9). The renderer can pick a shade
116
+ * (default 6 for `light`/`filled`).
117
+ */
118
+ export const COLOR_SCALES: Record<TCanonicalColor, readonly string[]> = {
119
+ gray: ['#f8f9fa', '#f1f3f5', '#e9ecef', '#dee2e6', '#ced4da', '#adb5bd', '#868e96', '#495057', '#343a40', '#212529'],
120
+ red: ['#fff5f5', '#ffe3e3', '#ffc9c9', '#ffa8a8', '#ff8787', '#ff6b6b', '#fa5252', '#f03e3e', '#e03131', '#c92a2a'],
121
+ pink: ['#fff0f6', '#ffdeeb', '#fcc2d7', '#faa2c1', '#f783ac', '#f06595', '#e64980', '#d6336c', '#c2255c', '#a61e4d'],
122
+ grape: ['#f8f0fc', '#f3d9fa', '#eebefa', '#e599f7', '#da77f2', '#cc5de8', '#be4bdb', '#ae3ec9', '#9c36b5', '#862e9c'],
123
+ violet: ['#f3f0ff', '#e5dbff', '#d0bfff', '#b197fc', '#9775fa', '#845ef7', '#7950f2', '#7048e8', '#6741d9', '#5f3dc4'],
124
+ indigo: ['#edf2ff', '#dbe4ff', '#bac8ff', '#91a7ff', '#748ffc', '#5c7cfa', '#4c6ef5', '#4263eb', '#3b5bdb', '#364fc7'],
125
+ blue: ['#e7f5ff', '#d0ebff', '#a5d8ff', '#74c0fc', '#4dabf7', '#339af0', '#228be6', '#1c7ed6', '#1971c2', '#1864ab'],
126
+ cyan: ['#e3fafc', '#c5f6fa', '#99e9f2', '#66d9e8', '#3bc9db', '#22b8cf', '#15aabf', '#1098ad', '#0c8599', '#0b7285'],
127
+ teal: ['#e6fcf5', '#c3fae8', '#96f2d7', '#63e6be', '#38d9a9', '#20c997', '#12b886', '#0ca678', '#099268', '#087f5b'],
128
+ green: ['#ebfbee', '#d3f9d8', '#b2f2bb', '#8ce99a', '#69db7c', '#51cf66', '#40c057', '#37b24d', '#2f9e44', '#2b8a3e'],
129
+ lime: ['#f4fce3', '#e9fac8', '#d8f5a2', '#c0eb75', '#a9e34b', '#94d82d', '#82c91e', '#74b816', '#66a80f', '#5c940d'],
130
+ yellow: ['#fff9db', '#fff3bf', '#ffec99', '#ffe066', '#ffd43b', '#fcc419', '#fab005', '#f59f00', '#f08c00', '#e67700'],
131
+ orange: ['#fff4e6', '#ffe8cc', '#ffd8a8', '#ffc078', '#ffa94d', '#ff922b', '#fd7e14', '#f76707', '#e8590c', '#d9480f'],
132
+ dark: ['#c1c2c5', '#a6a7ab', '#909296', '#5c5f66', '#373a40', '#2c2e33', '#25262b', '#1a1b1e', '#141517', '#101113'],
133
+ };
134
+
135
+ export interface ISpacingResolved {
136
+ mt?: number | string;
137
+ mb?: number | string;
138
+ ms?: number | string;
139
+ me?: number | string;
140
+ pt?: number | string;
141
+ pb?: number | string;
142
+ ps?: number | string;
143
+ pe?: number | string;
144
+ }
145
+
146
+ /** Resolve a spacing token (xs..xl/none) to a px value, passing through any non-Mantine string verbatim. */
147
+ export function spacingToPx(token: string | undefined): number | string | undefined {
148
+ if (!token || token === 'none') return undefined;
149
+ if (token in SPACING_PX) return SPACING_PX[token as TCanonicalSpacing];
150
+ return token;
151
+ }
152
+
153
+ /** Resolve a Mantine size to a font-size px value, passing through any non-Mantine string verbatim. */
154
+ export function sizeToFontPx(token: string | undefined): number | string | undefined {
155
+ if (!token) return undefined;
156
+ if (token in FONT_SIZE_PX) return FONT_SIZE_PX[token as TMantineSize];
157
+ return token;
158
+ }
159
+
160
+ /** Resolve a Mantine radius to a px value, passing through any non-Mantine string verbatim. */
161
+ export function radiusToPx(token: string | undefined): number | string | undefined {
162
+ if (!token) return undefined;
163
+ if (token in RADIUS_PX) return RADIUS_PX[token as TCanonicalRadius];
164
+ return token;
165
+ }
166
+
167
+ /**
168
+ * Resolve a Mantine palette color name + optional shade index to a hex
169
+ * string. Passes raw hex/css color values through unchanged.
170
+ */
171
+ export function colorToHex(name: string | undefined, shade = 6): string | undefined {
172
+ if (!name) return undefined;
173
+ if (name.startsWith('#') || name.startsWith('rgb') || name.startsWith('hsl')) return name;
174
+ const scale = COLOR_SCALES[name as TCanonicalColor];
175
+ if (!scale) return name;
176
+ return scale[Math.max(0, Math.min(9, shade))];
177
+ }
@@ -20,6 +20,18 @@ export interface IRefreshRequest {
20
20
  refresh_token: string;
21
21
  }
22
22
 
23
+ /** POST /auth/forgot-password — request a recovery email. */
24
+ export interface IForgotPasswordRequest {
25
+ email: string;
26
+ }
27
+
28
+ /** POST /auth/reset-password — set a new password from the one-time token. */
29
+ export interface IResetPasswordRequest {
30
+ id_users: number;
31
+ token: string;
32
+ password: string;
33
+ }
34
+
23
35
  export interface ILoginSuccessData {
24
36
  access_token: string;
25
37
  refresh_token: string;
@@ -44,3 +56,13 @@ export type ILanguagePreferenceUpdateResponse = IBaseApiResponse<{
44
56
  access_token?: string;
45
57
  language_id: number;
46
58
  }>;
59
+
60
+ /**
61
+ * Generic success for the forgot-password request. The backend always returns
62
+ * `requested: true` regardless of whether the email matched an account, so the
63
+ * endpoint cannot be used to enumerate registered users.
64
+ */
65
+ export type IForgotPasswordResponse = IBaseApiResponse<{ requested: boolean }>;
66
+
67
+ /** Success when the recovery token was valid and the password was changed. */
68
+ export type IResetPasswordResponse = IBaseApiResponse<{ reset: boolean }>;
@@ -1,34 +1,34 @@
1
- /*
2
- SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
- SPDX-License-Identifier: MPL-2.0
4
- */
5
- /**
6
- * Common API envelope returned by the Symfony backend's ApiResponseFormatter.
7
- */
8
-
9
- export interface IApiMeta {
10
- version: string;
11
- timestamp: string;
12
- }
13
-
14
- export type IMeta = IApiMeta;
15
-
16
- export interface IBaseApiResponse<TData> {
17
- status: number;
18
- message: string;
19
- error: null | string;
20
- error_type?: string;
21
- logged_in: boolean;
22
- meta: IApiMeta;
23
- data: TData;
24
- }
25
-
26
- export interface IApiError {
27
- status: number;
28
- message: string;
29
- error: string;
30
- error_type?: string;
31
- logged_in?: boolean;
32
- meta?: IApiMeta;
33
- data?: unknown;
34
- }
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Common API envelope returned by the Symfony backend's ApiResponseFormatter.
7
+ */
8
+
9
+ export interface IApiMeta {
10
+ version: string;
11
+ timestamp: string;
12
+ }
13
+
14
+ export type IMeta = IApiMeta;
15
+
16
+ export interface IBaseApiResponse<TData> {
17
+ status: number;
18
+ message: string;
19
+ error: null | string;
20
+ error_type?: string;
21
+ logged_in: boolean;
22
+ meta: IApiMeta;
23
+ data: TData;
24
+ }
25
+
26
+ export interface IApiError {
27
+ status: number;
28
+ message: string;
29
+ error: string;
30
+ error_type?: string;
31
+ logged_in?: boolean;
32
+ meta?: IApiMeta;
33
+ data?: unknown;
34
+ }