@selfhelp/shared 1.0.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 (64) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENSE +381 -0
  3. package/README.md +266 -0
  4. package/dist/common-B96dASgu.d.mts +80 -0
  5. package/dist/common-B96dASgu.d.ts +80 -0
  6. package/dist/index-Bg60YTsF.d.mts +1743 -0
  7. package/dist/index-DEOVT86P.d.ts +1743 -0
  8. package/dist/index.d.mts +597 -0
  9. package/dist/index.d.ts +597 -0
  10. package/dist/index.js +796 -0
  11. package/dist/index.mjs +718 -0
  12. package/dist/registry/index.d.mts +2 -0
  13. package/dist/registry/index.d.ts +2 -0
  14. package/dist/registry/index.js +134 -0
  15. package/dist/registry/index.mjs +105 -0
  16. package/dist/theme/index.d.mts +63 -0
  17. package/dist/theme/index.d.ts +63 -0
  18. package/dist/theme/index.js +202 -0
  19. package/dist/theme/index.mjs +162 -0
  20. package/dist/theme/tailwind.d.mts +36 -0
  21. package/dist/theme/tailwind.d.ts +36 -0
  22. package/dist/theme/tailwind.js +125 -0
  23. package/dist/theme/tailwind.mjs +97 -0
  24. package/package.json +69 -0
  25. package/src/api/endpoints.ts +58 -0
  26. package/src/api/index.ts +5 -0
  27. package/src/assets/index.ts +5 -0
  28. package/src/assets/resolveAssetUrl.ts +44 -0
  29. package/src/cms-classes/allow-list.ts +158 -0
  30. package/src/cms-classes/classify.ts +90 -0
  31. package/src/cms-classes/index.ts +7 -0
  32. package/src/cms-classes/remap.ts +44 -0
  33. package/src/condition/evaluate.ts +121 -0
  34. package/src/condition/index.ts +5 -0
  35. package/src/index.ts +25 -0
  36. package/src/interpolation/index.ts +5 -0
  37. package/src/interpolation/replaceCalcedValues.ts +27 -0
  38. package/src/registry/index.ts +37 -0
  39. package/src/registry/styles.registry.ts +158 -0
  40. package/src/theme/index.ts +6 -0
  41. package/src/theme/tailwind.ts +73 -0
  42. package/src/theme/tokens.ts +177 -0
  43. package/src/types/api/auth.ts +46 -0
  44. package/src/types/api/envelope.ts +34 -0
  45. package/src/types/api/forms.ts +38 -0
  46. package/src/types/api/index.ts +9 -0
  47. package/src/types/api/language.ts +12 -0
  48. package/src/types/api/page.ts +9 -0
  49. package/src/types/auth.ts +110 -0
  50. package/src/types/index.ts +17 -0
  51. package/src/types/mantine/common.ts +142 -0
  52. package/src/types/pages.ts +107 -0
  53. package/src/types/styles/auth.ts +165 -0
  54. package/src/types/styles/base.ts +72 -0
  55. package/src/types/styles/composite.ts +131 -0
  56. package/src/types/styles/forms.ts +439 -0
  57. package/src/types/styles/interactive.ts +165 -0
  58. package/src/types/styles/layout.ts +184 -0
  59. package/src/types/styles/media.ts +68 -0
  60. package/src/types/styles/typography.ts +118 -0
  61. package/src/types/styles/unknown.ts +220 -0
  62. package/src/utils/index.ts +6 -0
  63. package/src/utils/spacing.ts +64 -0
  64. package/src/utils/transformPageData.ts +93 -0
@@ -0,0 +1,110 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Auth + permission types shared by both apps.
7
+ */
8
+
9
+ export interface ILanguagePreference {
10
+ id: number;
11
+ locale: string;
12
+ language: string;
13
+ csvSeparator?: string;
14
+ }
15
+
16
+ export type ILanguage = ILanguagePreference;
17
+
18
+ export interface IUserData {
19
+ id: number;
20
+ email: string | null;
21
+ user_name: string | null;
22
+ name: string | null;
23
+ last_login: string | null;
24
+ created: string | null;
25
+ timezone_id: number | null;
26
+ timezone: string | null;
27
+ blocked: boolean;
28
+ user_type: string | null;
29
+ language: ILanguagePreference | null;
30
+ languages?: ILanguagePreference[];
31
+ permissions?: string[];
32
+ roles?: string[];
33
+ groups?: string[];
34
+ acl_version?: string | number | null;
35
+ }
36
+
37
+ export interface IJwtPayload {
38
+ sub: number;
39
+ email?: string;
40
+ iat: number;
41
+ exp: number;
42
+ permissions?: string[];
43
+ roles?: string[];
44
+ }
45
+
46
+ export interface IUserDataResponse {
47
+ status: number;
48
+ message: string;
49
+ error: null | string;
50
+ logged_in: boolean;
51
+ meta: { version: string; timestamp: string };
52
+ data: IUserData | null;
53
+ }
54
+
55
+ /**
56
+ * Permission constants. The full list lives in the backend; these are
57
+ * the most commonly checked client-side. Add to this list as new
58
+ * permissions are introduced.
59
+ */
60
+ export const PERMISSIONS = {
61
+ ADMIN_ACCESS: 'admin.access',
62
+ ADMIN_PAGE_READ: 'admin.page.read',
63
+ ADMIN_PAGE_CREATE: 'admin.page.create',
64
+ ADMIN_PAGE_UPDATE: 'admin.page.update',
65
+ ADMIN_PAGE_DELETE: 'admin.page.delete',
66
+ ADMIN_PAGE_EXPORT: 'admin.page.export',
67
+ ADMIN_PAGE_VERSION_PUBLISH: 'admin.page.version.publish',
68
+ ADMIN_PAGE_VERSION_READ: 'admin.page.version.read',
69
+ ADMIN_PAGE_VERSION_COMPARE: 'admin.page.version.compare',
70
+ ADMIN_USER_READ: 'admin.user.read',
71
+ ADMIN_USER_CREATE: 'admin.user.create',
72
+ ADMIN_USER_UPDATE: 'admin.user.update',
73
+ ADMIN_USER_DELETE: 'admin.user.delete',
74
+ ADMIN_USER_BLOCK: 'admin.user.block',
75
+ ADMIN_USER_IMPERSONATE: 'admin.user.impersonate',
76
+ ADMIN_GROUP_READ: 'admin.group.read',
77
+ ADMIN_GROUP_CREATE: 'admin.group.create',
78
+ ADMIN_GROUP_UPDATE: 'admin.group.update',
79
+ ADMIN_GROUP_DELETE: 'admin.group.delete',
80
+ ADMIN_GROUP_ACL: 'admin.group.acl',
81
+ ADMIN_ROLE_READ: 'admin.role.read',
82
+ ADMIN_ROLE_CREATE: 'admin.role.create',
83
+ ADMIN_ROLE_UPDATE: 'admin.role.update',
84
+ ADMIN_ROLE_DELETE: 'admin.role.delete',
85
+ ADMIN_ROLE_PERMISSIONS: 'admin.role.permissions',
86
+ ADMIN_PERMISSION_READ: 'admin.permission.read',
87
+ ADMIN_ASSET_READ: 'admin.asset.read',
88
+ ADMIN_ASSET_CREATE: 'admin.asset.create',
89
+ ADMIN_ASSET_DELETE: 'admin.asset.delete',
90
+ ADMIN_ACTION_READ: 'admin.action.read',
91
+ ADMIN_ACTION_UPDATE: 'admin.action.update',
92
+ ADMIN_ACTION_DELETE: 'admin.action.delete',
93
+ ADMIN_ACTION_TRANSLATION_READ: 'admin.action.translation.read',
94
+ ADMIN_DATA_READ: 'admin.data.read',
95
+ ADMIN_DATA_DELETE: 'admin.data.delete',
96
+ ADMIN_DATA_DELETE_COLUMNS: 'admin.data.delete_columns',
97
+ ADMIN_SCHEDULED_JOB_READ: 'admin.scheduled_job.read',
98
+ ADMIN_SCHEDULED_JOB_EXECUTE: 'admin.scheduled_job.execute',
99
+ ADMIN_SCHEDULED_JOB_DELETE: 'admin.scheduled_job.delete',
100
+ ADMIN_SECTION_DELETE: 'admin.section.delete',
101
+ ADMIN_SETTINGS: 'admin.settings',
102
+ ADMIN_CMS_PREFERENCES_READ: 'admin.cms_preferences.read',
103
+ ADMIN_CMS_PREFERENCES_UPDATE: 'admin.cms_preferences.update',
104
+ ADMIN_CACHE_READ: 'admin.cache.read',
105
+ ADMIN_CACHE_CLEAR: 'admin.cache.clear',
106
+ ADMIN_CACHE_MANAGE: 'admin.cache.manage',
107
+ ADMIN_AUDIT_VIEW: 'admin.audit.view',
108
+ } as const;
109
+
110
+ export type TPermission = (typeof PERMISSIONS)[keyof typeof PERMISSIONS];
@@ -0,0 +1,17 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ export * from './styles/base';
6
+ export * from './styles/auth';
7
+ export * from './styles/layout';
8
+ export * from './styles/typography';
9
+ export * from './styles/media';
10
+ export * from './styles/interactive';
11
+ export * from './styles/forms';
12
+ export * from './styles/composite';
13
+ export * from './styles/unknown';
14
+ export * from './pages';
15
+ export * from './auth';
16
+ export * from './api';
17
+ export * from './mantine/common';
@@ -0,0 +1,142 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Shared Mantine semantic types used by both web (Mantine v9) and mobile
7
+ * (HeroUI Native + Uniwind, where these are mapped through the theme tokens).
8
+ *
9
+ * Whenever a value here changes, both renderers must update their token
10
+ * mapping in `src/theme/tokens.ts`.
11
+ */
12
+
13
+ export type TMantineSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
14
+ export type TMantineRadius = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string;
15
+ export type TMantineSpacing = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none' | string;
16
+ export type TMantineVariant =
17
+ | 'default'
18
+ | 'filled'
19
+ | 'light'
20
+ | 'outline'
21
+ | 'subtle'
22
+ | 'transparent'
23
+ | 'white'
24
+ | 'gradient';
25
+
26
+ export type TMantineColor =
27
+ | 'gray'
28
+ | 'red'
29
+ | 'pink'
30
+ | 'grape'
31
+ | 'violet'
32
+ | 'indigo'
33
+ | 'blue'
34
+ | 'cyan'
35
+ | 'teal'
36
+ | 'green'
37
+ | 'lime'
38
+ | 'yellow'
39
+ | 'orange'
40
+ | 'dark'
41
+ | string;
42
+
43
+ export type TMantineOrientation = 'horizontal' | 'vertical';
44
+ export type TMantineDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
45
+ export type TMantineWrap = 'nowrap' | 'wrap' | 'wrap-reverse';
46
+ export type TMantineJustify =
47
+ | 'flex-start'
48
+ | 'center'
49
+ | 'flex-end'
50
+ | 'space-between'
51
+ | 'space-around'
52
+ | 'space-evenly';
53
+ export type TMantineAlign = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
54
+ export type TMantineColorFormat = 'hex' | 'rgba' | 'rgb' | 'hsl' | 'hsla';
55
+ export type TMantineGridSpan = 'auto' | 'content' | string;
56
+ export type TMantineGridOverflow = 'visible' | 'hidden';
57
+ export type TMantineTabsVariant = 'default' | 'outline' | 'pills';
58
+ export type TMantineFileAccept =
59
+ | 'image/*'
60
+ | 'video/*'
61
+ | 'audio/*'
62
+ | 'application/pdf'
63
+ | string;
64
+ export type TMantineClampBehavior = 'strict' | 'blur' | 'none';
65
+ export type TMantineChipVariant = 'filled' | 'outline' | 'light';
66
+ export type TMantineFieldsetVariant = 'default' | 'filled' | 'unstyled';
67
+ export type TMantineAccordionVariant = 'default' | 'contained' | 'filled' | 'separated';
68
+ export type TMantineAvatarVariant =
69
+ | 'default'
70
+ | 'filled'
71
+ | 'light'
72
+ | 'outline'
73
+ | 'subtle'
74
+ | 'transparent'
75
+ | 'white';
76
+ export type TMantineBadgeVariant =
77
+ | 'default'
78
+ | 'filled'
79
+ | 'light'
80
+ | 'outline'
81
+ | 'dot'
82
+ | 'transparent'
83
+ | 'white'
84
+ | 'gradient';
85
+ export type TMantineIndicatorPosition =
86
+ | 'top-start'
87
+ | 'top-end'
88
+ | 'bottom-start'
89
+ | 'bottom-end'
90
+ | 'top-center'
91
+ | 'bottom-center'
92
+ | 'middle-start'
93
+ | 'middle-end';
94
+ export type TMantineKbdSize = TMantineSize;
95
+ export type TMantineThemeIconVariant = TMantineVariant;
96
+ export type TMantineTimelineLineVariant = 'solid' | 'dashed' | 'dotted';
97
+ export type TMantineTitleOrder = '1' | '2' | '3' | '4' | '5' | '6';
98
+ export type TMantineCodeBlock = '0' | '1';
99
+ export type TMantineHighlight = string;
100
+ export type TMantineSpoilerMaxHeight = string;
101
+ export type TMantineRatingCount = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | '10' | string;
102
+ export type TMantineRatingFractions = '1' | '2' | '3' | '4' | '5' | string;
103
+ export type TMantineNotificationWithCloseButton = '0' | '1';
104
+ export type TMantineAspectRatio = string;
105
+ export type TMantineColorPickerSwatchesPerRow = string;
106
+ export type TMantineActionIconLoading = '0' | '1';
107
+ export type TMantineGroupWrap = '0' | '1';
108
+ export type TMantineGroupGrow = '0' | '1';
109
+ export type TMantineGridGrow = '0' | '1';
110
+ export type TMantineTabDisabled = '0' | '1';
111
+ export type TMantineColorInputSwatches = string;
112
+ export type TMantineColorPickerSwatches = string;
113
+ export type TMantineFileInputMultiple = '0' | '1';
114
+ export type TMantineNumberInputDecimalScale = string;
115
+ export type TMantineRangeSliderMarks = string;
116
+ export type TMantineChipChecked = '0' | '1';
117
+ export type TMantineChipMultiple = '0' | '1';
118
+ export type TMantineRatingReadonly = '0' | '1';
119
+ export type TMantineSpaceHorizontal = '0' | '1';
120
+ export type TMantineCenterInline = '0' | '1';
121
+ export type TMantineContainerFluid = '0' | '1';
122
+ export type TMantineFullWidth = '0' | '1';
123
+ export type TMantineCompact = '0' | '1';
124
+ export type TMantineAutoContrast = '0' | '1';
125
+ export type TMantineIsLink = '0' | '1';
126
+ export type TMantineUseMantineStyle = '0' | '1';
127
+ export type TMantineDisabled = '0' | '1';
128
+ export type TMantineOpenInNewTab = '0' | '1';
129
+ export type TMantineLoading = '0' | '1';
130
+ export type TMantineMultiple = '0' | '1';
131
+ export type TMantineChecked = '0' | '1';
132
+ export type TMantineReadonly = '0' | '1';
133
+ export type TMantineWithCloseButton = '0' | '1';
134
+ export type TMantineProcessing = '0' | '1';
135
+ export type TMantineBlock = '0' | '1';
136
+ export type TMantineWithIcon = '0' | '1';
137
+ export type TMantineAllowStepClick = '0' | '1';
138
+ export type TMantineAllowNextClicks = '0' | '1';
139
+ export type TMantineSwatches = string;
140
+ export type TMantineGrow = '0' | '1';
141
+ export type TMantineInline = '0' | '1';
142
+ export type TMantineFluid = '0' | '1';
@@ -0,0 +1,107 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ import type { IContentField } from './styles/base';
6
+ import type { TStyleName } from './styles/unknown';
7
+
8
+ /**
9
+ * Comprehensive page type system, single source of truth for both apps.
10
+ */
11
+
12
+ export interface IBasePageSection {
13
+ id: number;
14
+ section_name: string;
15
+ id_styles: number;
16
+ style_name: TStyleName;
17
+ position: number;
18
+ level: number | { content: string; meta: string | null };
19
+ path: string;
20
+ children: IBasePageSection[];
21
+ }
22
+
23
+ export interface IPageSectionWithFields extends IBasePageSection {
24
+ can_have_children: number | null;
25
+ condition: string | null;
26
+ css: string | null;
27
+ css_mobile: string | null;
28
+ debug: number | null;
29
+ data_config: string | number | null;
30
+ section_data: unknown[];
31
+ fields: Record<string, IContentField<unknown>>;
32
+ children: IPageSectionWithFields[];
33
+ }
34
+
35
+ export interface IBasePageInfo {
36
+ id: number;
37
+ keyword: string;
38
+ url: string | null;
39
+ parent_page_id: number | null;
40
+ is_headless: boolean;
41
+ navPosition: number | null;
42
+ footerPosition: number | null;
43
+ is_system?: boolean;
44
+ }
45
+
46
+ export interface IPageAccessTypeInfo {
47
+ id: number;
48
+ typeCode: string;
49
+ lookupCode: string;
50
+ lookupValue: string;
51
+ lookupDescription: string | null;
52
+ }
53
+
54
+ export interface IPageItem extends IBasePageInfo {
55
+ id_users?: number;
56
+ id_pages?: number;
57
+ acl_select?: 0 | 1;
58
+ acl_insert?: 0 | 1;
59
+ acl_update?: 0 | 1;
60
+ acl_delete?: 0 | 1;
61
+ id_type?: number;
62
+ id_pageAccessTypes?: number;
63
+ title?: string | null;
64
+ description?: string | null;
65
+ children?: IPageItem[];
66
+ }
67
+
68
+ export interface IPageContent {
69
+ id: number;
70
+ keyword: string;
71
+ url: string | null;
72
+ parent_page_id: number | null;
73
+ is_headless: boolean;
74
+ nav_position: number | null;
75
+ footer_position: number | null;
76
+ title?: string | null;
77
+ description?: string | null;
78
+ sections: IPageSectionWithFields[];
79
+ }
80
+
81
+ export interface IPageFieldTranslation {
82
+ language_id: number;
83
+ language_code: string;
84
+ content: string;
85
+ }
86
+
87
+ export interface IPageField {
88
+ id: number;
89
+ name: string;
90
+ title: string | null;
91
+ type: string;
92
+ default_value: string | null;
93
+ help: string;
94
+ display: boolean;
95
+ translations: IPageFieldTranslation[];
96
+ config?: unknown;
97
+ }
98
+
99
+ export interface IPageFieldsData {
100
+ page: unknown;
101
+ fields: IPageField[];
102
+ }
103
+
104
+ export interface IPageSectionsData {
105
+ page_keyword: string;
106
+ sections: IPageSectionWithFields[];
107
+ }
@@ -0,0 +1,165 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ import type { IContentField, IStyleWithSpacing } from './base';
6
+ import type { TMantineRadius } from '../mantine/common';
7
+
8
+ export interface ILoginStyle extends IStyleWithSpacing {
9
+ style_name: 'login';
10
+ label_user?: IContentField<string>;
11
+ label_pw?: IContentField<string>;
12
+ label_login?: IContentField<string>;
13
+ label_pw_reset?: IContentField<string>;
14
+ alert_fail?: IContentField<string>;
15
+ login_title?: IContentField<string>;
16
+ type?: IContentField<string>;
17
+ }
18
+
19
+ export interface IRegisterStyle extends IStyleWithSpacing {
20
+ style_name: 'register';
21
+ label_user?: IContentField<string>;
22
+ label_pw?: IContentField<string>;
23
+ label_submit?: IContentField<string>;
24
+ alert_fail?: IContentField<string>;
25
+ alert_success?: IContentField<string>;
26
+ title?: IContentField<string>;
27
+ success?: IContentField<string>;
28
+ }
29
+
30
+ export interface IValidateStyle extends IStyleWithSpacing {
31
+ style_name: 'validate';
32
+ label_pw?: IContentField<string>;
33
+ label_login?: IContentField<string>;
34
+ alert_fail?: IContentField<string>;
35
+ label_pw_confirm?: IContentField<string>;
36
+ title?: IContentField<string>;
37
+ subtitle?: IContentField<string>;
38
+ alert_success?: IContentField<string>;
39
+ label_name?: IContentField<string>;
40
+ name_placeholder?: IContentField<string>;
41
+ name_description?: IContentField<string>;
42
+ label_activate?: IContentField<string>;
43
+ pw_placeholder?: IContentField<string>;
44
+ success?: IContentField<string>;
45
+ name?: IContentField<string>;
46
+ page_keyword?: IContentField<string>;
47
+ value_name?: IContentField<string>;
48
+ anonymous_user_name_description?: IContentField<string>;
49
+ redirect_at_end?: IContentField<string>;
50
+ cancel_url?: IContentField<string>;
51
+ label_save?: IContentField<string>;
52
+ label_update?: IContentField<string>;
53
+ label_cancel?: IContentField<string>;
54
+ mantine_buttons_size?: IContentField<string>;
55
+ mantine_buttons_radius?: IContentField<string>;
56
+ mantine_buttons_variant?: IContentField<string>;
57
+ mantine_buttons_position?: IContentField<string>;
58
+ mantine_buttons_order?: IContentField<string>;
59
+ mantine_btn_save_color?: IContentField<string>;
60
+ mantine_btn_cancel_color?: IContentField<string>;
61
+ mantine_card_shadow?: IContentField<string>;
62
+ mantine_card_padding?: IContentField<string>;
63
+ mantine_radius?: IContentField<TMantineRadius>;
64
+ mantine_border?: IContentField<string>;
65
+ }
66
+
67
+ export interface IResetPasswordStyle extends IStyleWithSpacing {
68
+ style_name: 'resetPassword';
69
+ label_pw_reset?: IContentField<string>;
70
+ text_md?: IContentField<string>;
71
+ type?: IContentField<string>;
72
+ alert_success?: IContentField<string>;
73
+ placeholder?: IContentField<string>;
74
+ email_user?: IContentField<string>;
75
+ subject_user?: IContentField<string>;
76
+ is_html?: IContentField<string>;
77
+ }
78
+
79
+ export interface ITwoFactorAuthStyle extends IStyleWithSpacing {
80
+ style_name: 'twoFactorAuth';
81
+ label_code?: IContentField<string>;
82
+ label_submit?: IContentField<string>;
83
+ alert_fail?: IContentField<string>;
84
+ title?: IContentField<string>;
85
+ text_md?: IContentField<string>;
86
+ label_expiration_2fa?: IContentField<string>;
87
+ }
88
+
89
+ export interface IProfileStyle extends IStyleWithSpacing {
90
+ style_name: 'profile';
91
+
92
+ profile_title?: IContentField<string>;
93
+ profile_account_info_title?: IContentField<string>;
94
+ profile_label_email?: IContentField<string>;
95
+ profile_label_username?: IContentField<string>;
96
+ profile_label_name?: IContentField<string>;
97
+ profile_label_created?: IContentField<string>;
98
+ profile_label_last_login?: IContentField<string>;
99
+ profile_label_timezone?: IContentField<string>;
100
+
101
+ profile_name_change_title?: IContentField<string>;
102
+ profile_name_change_description?: IContentField<string>;
103
+ profile_name_change_label?: IContentField<string>;
104
+ profile_name_change_placeholder?: IContentField<string>;
105
+ profile_name_change_button?: IContentField<string>;
106
+ profile_name_change_success?: IContentField<string>;
107
+ profile_name_change_error_required?: IContentField<string>;
108
+ profile_name_change_error_invalid?: IContentField<string>;
109
+ profile_name_change_error_general?: IContentField<string>;
110
+
111
+ profile_timezone_change_title?: IContentField<string>;
112
+ profile_timezone_change_description?: IContentField<string>;
113
+ profile_timezone_change_label?: IContentField<string>;
114
+ profile_timezone_change_placeholder?: IContentField<string>;
115
+ profile_timezone_change_button?: IContentField<string>;
116
+ profile_timezone_change_success?: IContentField<string>;
117
+ profile_timezone_change_error_required?: IContentField<string>;
118
+ profile_timezone_change_error_general?: IContentField<string>;
119
+
120
+ profile_password_reset_title?: IContentField<string>;
121
+ profile_password_reset_description?: IContentField<string>;
122
+ profile_password_reset_label_current?: IContentField<string>;
123
+ profile_password_reset_label_new?: IContentField<string>;
124
+ profile_password_reset_label_confirm?: IContentField<string>;
125
+ profile_password_reset_placeholder_current?: IContentField<string>;
126
+ profile_password_reset_placeholder_new?: IContentField<string>;
127
+ profile_password_reset_placeholder_confirm?: IContentField<string>;
128
+ profile_password_reset_button?: IContentField<string>;
129
+ profile_password_reset_success?: IContentField<string>;
130
+ profile_password_reset_error_current_required?: IContentField<string>;
131
+ profile_password_reset_error_current_wrong?: IContentField<string>;
132
+ profile_password_reset_error_new_required?: IContentField<string>;
133
+ profile_password_reset_error_confirm_required?: IContentField<string>;
134
+ profile_password_reset_error_mismatch?: IContentField<string>;
135
+ profile_password_reset_error_weak?: IContentField<string>;
136
+ profile_password_reset_error_general?: IContentField<string>;
137
+
138
+ profile_delete_title?: IContentField<string>;
139
+ profile_delete_description?: IContentField<string>;
140
+ profile_delete_alert_text?: IContentField<string>;
141
+ profile_delete_modal_warning?: IContentField<string>;
142
+ profile_delete_label_email?: IContentField<string>;
143
+ profile_delete_placeholder_email?: IContentField<string>;
144
+ profile_delete_button?: IContentField<string>;
145
+ profile_delete_success?: IContentField<string>;
146
+ profile_delete_error_email_required?: IContentField<string>;
147
+ profile_delete_error_email_mismatch?: IContentField<string>;
148
+ profile_delete_error_general?: IContentField<string>;
149
+
150
+ profile_gap?: IContentField<string>;
151
+ profile_use_accordion?: IContentField<string>;
152
+ profile_accordion_multiple?: IContentField<string>;
153
+ profile_accordion_default_opened?: IContentField<string>;
154
+
155
+ profile_variant?: IContentField<string>;
156
+ profile_radius?: IContentField<string>;
157
+ profile_shadow?: IContentField<string>;
158
+
159
+ profile_columns?: IContentField<string>;
160
+
161
+ alert_fail?: IContentField<string>;
162
+ alert_del_fail?: IContentField<string>;
163
+ alert_del_success?: IContentField<string>;
164
+ alert_success?: IContentField<string>;
165
+ }
@@ -0,0 +1,72 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Base interfaces shared by every CMS style. Mirrors what the backend
7
+ * `PageService` returns per section: a `style_name` discriminator, a
8
+ * `fields` map, and a handful of side-channel fields (css, condition, debug).
9
+ *
10
+ * The per-style interfaces (in `auth.ts`, `layout.ts`, …) extend these.
11
+ */
12
+
13
+ import type { TStyle } from './unknown';
14
+
15
+ /**
16
+ * One translatable / typed field as returned by the backend. The backend
17
+ * stores `{ content, meta?, type?, id?, default? }` per field; we keep
18
+ * the same shape so the renderer can simply read `field.content`.
19
+ */
20
+ export interface IContentField<T> {
21
+ content: T;
22
+ meta?: string;
23
+ type?: string;
24
+ id?: string;
25
+ default?: string;
26
+ }
27
+
28
+ /**
29
+ * Common fields every style has. The discriminator is `style_name`.
30
+ *
31
+ * - `id` / `id_styles` / `position` / `path` come from the section row.
32
+ * - `fields` is the field map (some styles also expose specific fields
33
+ * directly at the top level — those are typed in the per-style interfaces).
34
+ * - `css` is the web-only CSS class string. Mobile renderer reads ONLY
35
+ * `css_mobile` per the project decision.
36
+ * - `condition` is a JSON-Logic expression evaluated client-side for
37
+ * visibility (mirrors backend `ConditionService`).
38
+ * - `data_config` is an optional JSON config string used by data-bound
39
+ * styles (entryList, formUserInputRecord, …).
40
+ */
41
+ export interface IBaseStyle {
42
+ id: number;
43
+ id_styles: number;
44
+ style_name: string;
45
+ can_have_children: number | null;
46
+ position: number;
47
+ path: string;
48
+ children?: TStyle[];
49
+ section_name: string;
50
+ section_data?: unknown[];
51
+ fields: Record<string, IContentField<unknown>>;
52
+ condition: string | null;
53
+ css: string | null;
54
+ css_mobile: string | null;
55
+ debug: number | null;
56
+ data_config: string | number | null;
57
+ condition_debug?: {
58
+ condition?: string;
59
+ result: boolean;
60
+ error?: unknown[];
61
+ variables?: Record<string, unknown>;
62
+ condition_object?: unknown;
63
+ } | null;
64
+ }
65
+
66
+ /** Styles that support the unified spacing field. */
67
+ export interface IStyleWithSpacing extends IBaseStyle {
68
+ /** Legacy / margin-only field still used by many Mantine styles in the DB. */
69
+ mantine_spacing_margin?: IContentField<string>;
70
+ /** Newer box-model field that supports both margin and padding. */
71
+ mantine_spacing_margin_padding?: IContentField<string>;
72
+ }