@selfhelp/shared 1.14.23 → 1.14.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/dist/{common-udJ0O8qC.d.mts → common-qaDIAYS3.d.mts} +5 -4
- package/dist/{common-udJ0O8qC.d.ts → common-qaDIAYS3.d.ts} +5 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +94 -170
- package/dist/index.mjs +94 -167
- package/dist/plugin-sdk/index.d.mts +2 -2
- package/dist/plugin-sdk/index.d.ts +2 -2
- package/dist/plugin-sdk/index.js +90 -91
- package/dist/plugin-sdk/index.mjs +90 -91
- package/dist/registry/index.d.mts +3 -3
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.js +90 -90
- package/dist/registry/index.mjs +90 -90
- package/dist/{styles.registry-CZZwODJY.d.mts → styles.registry-4W0LzmZB.d.mts} +2 -189
- package/dist/{styles.registry-DQKcvIBZ.d.ts → styles.registry-D6xMm5VR.d.ts} +2 -189
- package/dist/theme/index.d.mts +27 -76
- package/dist/theme/index.d.ts +27 -76
- package/dist/theme/index.js +4 -80
- package/dist/theme/index.mjs +4 -77
- package/package.json +1 -1
- package/src/plugin-sdk/define.ts +0 -1
- package/src/registry/__tests__/platform.test.ts +0 -4
- package/src/registry/__tests__/registry.test.ts +0 -2
- package/src/registry/styles.registry.ts +90 -96
- package/src/theme/__tests__/mantineVariant.test.ts +2 -2
- package/src/theme/__tests__/semantic.test.ts +16 -53
- package/src/theme/mantineVariant.ts +3 -3
- package/src/theme/semantic.ts +24 -164
- package/src/theme/tokens.ts +2 -2
- package/src/types/mantine/common.ts +4 -3
- package/src/types/styles/base.ts +1 -1
- package/src/types/styles/composite.ts +0 -2
|
@@ -54,7 +54,6 @@ describe('style render-target targeting', () => {
|
|
|
54
54
|
const mobileOnly: IStyleRegistryEntry = {
|
|
55
55
|
description: 'QA mobile-only plugin style',
|
|
56
56
|
category: 'plugin',
|
|
57
|
-
frontendOnly: true,
|
|
58
57
|
canHaveChildren: false,
|
|
59
58
|
platforms: ['mobile'],
|
|
60
59
|
};
|
|
@@ -81,7 +80,6 @@ describe('style render-target targeting', () => {
|
|
|
81
80
|
const webOnly: IStyleRegistryEntry = {
|
|
82
81
|
description: 'QA web-only plugin style',
|
|
83
82
|
category: 'plugin',
|
|
84
|
-
frontendOnly: true,
|
|
85
83
|
canHaveChildren: false,
|
|
86
84
|
platforms: ['web'],
|
|
87
85
|
};
|
|
@@ -121,7 +119,6 @@ describe('style placement targeting', () => {
|
|
|
121
119
|
const rootOnly: IStyleRegistryEntry = {
|
|
122
120
|
description: 'QA root-only plugin style',
|
|
123
121
|
category: 'plugin',
|
|
124
|
-
frontendOnly: true,
|
|
125
122
|
canHaveChildren: false,
|
|
126
123
|
placement: 'rootOnly',
|
|
127
124
|
};
|
|
@@ -136,7 +133,6 @@ describe('style placement targeting', () => {
|
|
|
136
133
|
const childOnly: IStyleRegistryEntry = {
|
|
137
134
|
description: 'QA container-only plugin style',
|
|
138
135
|
category: 'plugin',
|
|
139
|
-
frontendOnly: true,
|
|
140
136
|
canHaveChildren: false,
|
|
141
137
|
placement: 'containerOnly',
|
|
142
138
|
};
|
|
@@ -36,7 +36,6 @@ const PLUGIN_ID = 'qa-shp-registry-test';
|
|
|
36
36
|
const pluginEntry: IStyleRegistryEntry = {
|
|
37
37
|
description: 'QA plugin style for registry tests',
|
|
38
38
|
category: 'plugin',
|
|
39
|
-
frontendOnly: true,
|
|
40
39
|
canHaveChildren: false,
|
|
41
40
|
};
|
|
42
41
|
|
|
@@ -64,7 +63,6 @@ describe('shared style registry', () => {
|
|
|
64
63
|
expect(typeof entry.description, `${name}.description`).toBe('string');
|
|
65
64
|
expect(entry.description.length, `${name}.description not empty`).toBeGreaterThan(0);
|
|
66
65
|
expect(ALLOWED_CATEGORIES.has(entry.category), `${name}.category`).toBe(true);
|
|
67
|
-
expect(entry.frontendOnly, `${name}.frontendOnly`).toBe(true);
|
|
68
66
|
expect(typeof entry.canHaveChildren, `${name}.canHaveChildren`).toBe('boolean');
|
|
69
67
|
}
|
|
70
68
|
});
|
|
@@ -78,12 +78,6 @@ export interface IStyleRegistryEntry {
|
|
|
78
78
|
| 'forms'
|
|
79
79
|
| 'composite'
|
|
80
80
|
| 'plugin';
|
|
81
|
-
/**
|
|
82
|
-
* Whether the style is intended for end-user pages. Mobile renders
|
|
83
|
-
* only `frontendOnly: true` styles. Today every entry below is true;
|
|
84
|
-
* if/when an admin-only style is added it must be marked false.
|
|
85
|
-
*/
|
|
86
|
-
frontendOnly: true;
|
|
87
81
|
/**
|
|
88
82
|
* Whether the style can have child sections (mirrors backend
|
|
89
83
|
* `styles.can_have_children`). Renderers use this to short-circuit
|
|
@@ -128,110 +122,110 @@ export interface IPluginStyleRegistryEntry extends IStyleRegistryEntry {
|
|
|
128
122
|
*/
|
|
129
123
|
export const BASE_STYLE_REGISTRY = {
|
|
130
124
|
// ===== auth =====
|
|
131
|
-
login: { description: 'User login form', category: 'auth',
|
|
132
|
-
register: { description: 'User registration form', category: 'auth',
|
|
133
|
-
validate: { description: 'Email/account validation flow', category: 'auth',
|
|
134
|
-
'reset-password': { description: 'Reset password form', category: 'auth',
|
|
135
|
-
'two-factor-auth': { description: 'Two-factor auth code form', category: 'auth',
|
|
136
|
-
profile: { description: 'User profile management', category: 'auth',
|
|
125
|
+
login: { description: 'User login form', category: 'auth', canHaveChildren: false },
|
|
126
|
+
register: { description: 'User registration form', category: 'auth', canHaveChildren: false },
|
|
127
|
+
validate: { description: 'Email/account validation flow', category: 'auth', canHaveChildren: true },
|
|
128
|
+
'reset-password': { description: 'Reset password form', category: 'auth', canHaveChildren: false },
|
|
129
|
+
'two-factor-auth': { description: 'Two-factor auth code form', category: 'auth', canHaveChildren: false },
|
|
130
|
+
profile: { description: 'User profile management', category: 'auth', canHaveChildren: false },
|
|
137
131
|
|
|
138
132
|
// ===== layout =====
|
|
139
|
-
container: { description: 'Mantine Container with responsive max-width', category: 'layout',
|
|
140
|
-
box: { description: 'Generic Mantine Box wrapper', category: 'layout',
|
|
141
|
-
flex: { description: 'Mantine Flex layout', category: 'layout',
|
|
142
|
-
group: { description: 'Mantine Group horizontal layout', category: 'layout',
|
|
143
|
-
stack: { description: 'Mantine Stack vertical layout', category: 'layout',
|
|
144
|
-
'simple-grid': { description: 'Mantine SimpleGrid', category: 'layout',
|
|
145
|
-
grid: { description: 'Mantine Grid', category: 'layout',
|
|
146
|
-
'grid-column': { description: 'Mantine Grid.Col', category: 'layout',
|
|
147
|
-
space: { description: 'Mantine Space spacer', category: 'layout',
|
|
148
|
-
divider: { description: 'Mantine Divider', category: 'layout',
|
|
149
|
-
paper: { description: 'Mantine Paper surface', category: 'layout',
|
|
150
|
-
center: { description: 'Mantine Center alignment', category: 'layout',
|
|
151
|
-
'scroll-area': { description: 'Mantine ScrollArea', category: 'layout',
|
|
152
|
-
card: { description: 'Mantine Card', category: 'layout',
|
|
153
|
-
'card-segment': { description: 'Mantine Card.Section', category: 'layout',
|
|
154
|
-
'aspect-ratio': { description: 'Mantine AspectRatio wrapper', category: 'layout',
|
|
155
|
-
'background-image': { description: 'Mantine BackgroundImage', category: 'layout',
|
|
133
|
+
container: { description: 'Mantine Container with responsive max-width', category: 'layout', canHaveChildren: true },
|
|
134
|
+
box: { description: 'Generic Mantine Box wrapper', category: 'layout', canHaveChildren: true },
|
|
135
|
+
flex: { description: 'Mantine Flex layout', category: 'layout', canHaveChildren: true },
|
|
136
|
+
group: { description: 'Mantine Group horizontal layout', category: 'layout', canHaveChildren: true },
|
|
137
|
+
stack: { description: 'Mantine Stack vertical layout', category: 'layout', canHaveChildren: true },
|
|
138
|
+
'simple-grid': { description: 'Mantine SimpleGrid', category: 'layout', canHaveChildren: true },
|
|
139
|
+
grid: { description: 'Mantine Grid', category: 'layout', canHaveChildren: true },
|
|
140
|
+
'grid-column': { description: 'Mantine Grid.Col', category: 'layout', canHaveChildren: true },
|
|
141
|
+
space: { description: 'Mantine Space spacer', category: 'layout', canHaveChildren: false },
|
|
142
|
+
divider: { description: 'Mantine Divider', category: 'layout', canHaveChildren: false },
|
|
143
|
+
paper: { description: 'Mantine Paper surface', category: 'layout', canHaveChildren: true },
|
|
144
|
+
center: { description: 'Mantine Center alignment', category: 'layout', canHaveChildren: true },
|
|
145
|
+
'scroll-area': { description: 'Mantine ScrollArea', category: 'layout', canHaveChildren: true },
|
|
146
|
+
card: { description: 'Mantine Card', category: 'layout', canHaveChildren: true },
|
|
147
|
+
'card-segment': { description: 'Mantine Card.Section', category: 'layout', canHaveChildren: true },
|
|
148
|
+
'aspect-ratio': { description: 'Mantine AspectRatio wrapper', category: 'layout', canHaveChildren: true },
|
|
149
|
+
'background-image': { description: 'Mantine BackgroundImage', category: 'layout', canHaveChildren: true },
|
|
156
150
|
|
|
157
151
|
// ===== typography =====
|
|
158
|
-
title: { description: 'Mantine Title', category: 'typography',
|
|
159
|
-
text: { description: 'Mantine Text', category: 'typography',
|
|
160
|
-
code: { description: 'Mantine Code (inline / block)', category: 'typography',
|
|
161
|
-
highlight: { description: 'Mantine Highlight', category: 'typography',
|
|
162
|
-
blockquote: { description: 'Mantine Blockquote', category: 'typography',
|
|
163
|
-
'html-tag': { description: 'Generic HTML tag wrapper (web), maps to View on RN', category: 'typography',
|
|
164
|
-
kbd: { description: 'Mantine Kbd', category: 'typography',
|
|
165
|
-
typography: { description: 'Mantine Typography wrapper', category: 'typography',
|
|
166
|
-
fieldset: { description: 'Mantine Fieldset', category: 'typography',
|
|
167
|
-
spoiler: { description: 'Mantine Spoiler reveal', category: 'typography',
|
|
152
|
+
title: { description: 'Mantine Title', category: 'typography', canHaveChildren: false },
|
|
153
|
+
text: { description: 'Mantine Text', category: 'typography', canHaveChildren: false },
|
|
154
|
+
code: { description: 'Mantine Code (inline / block)', category: 'typography', canHaveChildren: false },
|
|
155
|
+
highlight: { description: 'Mantine Highlight', category: 'typography', canHaveChildren: false },
|
|
156
|
+
blockquote: { description: 'Mantine Blockquote', category: 'typography', canHaveChildren: false },
|
|
157
|
+
'html-tag': { description: 'Generic HTML tag wrapper (web), maps to View on RN', category: 'typography', canHaveChildren: true },
|
|
158
|
+
kbd: { description: 'Mantine Kbd', category: 'typography', canHaveChildren: false },
|
|
159
|
+
typography: { description: 'Mantine Typography wrapper', category: 'typography', canHaveChildren: true },
|
|
160
|
+
fieldset: { description: 'Mantine Fieldset', category: 'typography', canHaveChildren: true },
|
|
161
|
+
spoiler: { description: 'Mantine Spoiler reveal', category: 'typography', canHaveChildren: true },
|
|
168
162
|
|
|
169
163
|
// ===== media =====
|
|
170
|
-
image: { description: 'Mantine Image / RN Image', category: 'media',
|
|
171
|
-
video: { description: 'HTML5 video / expo-video', category: 'media',
|
|
172
|
-
audio: { description: 'HTML5 audio / expo-audio', category: 'media',
|
|
173
|
-
figure: { description: 'Figure with caption', category: 'media',
|
|
174
|
-
carousel: { description: 'Embla on web, reanimated-carousel on RN', category: 'media',
|
|
164
|
+
image: { description: 'Mantine Image / RN Image', category: 'media', canHaveChildren: false },
|
|
165
|
+
video: { description: 'HTML5 video / expo-video', category: 'media', canHaveChildren: false },
|
|
166
|
+
audio: { description: 'HTML5 audio / expo-audio', category: 'media', canHaveChildren: false },
|
|
167
|
+
figure: { description: 'Figure with caption', category: 'media', canHaveChildren: true },
|
|
168
|
+
carousel: { description: 'Embla on web, reanimated-carousel on RN', category: 'media', canHaveChildren: true },
|
|
175
169
|
|
|
176
170
|
// ===== interactive =====
|
|
177
|
-
button: { description: 'Mantine Button / HeroUI Button', category: 'interactive',
|
|
178
|
-
link: { description: 'Anchor / Pressable navigation', category: 'interactive',
|
|
179
|
-
'action-icon': { description: 'Mantine ActionIcon', category: 'interactive',
|
|
180
|
-
alert: { description: 'Mantine Alert', category: 'interactive',
|
|
181
|
-
badge: { description: 'Mantine Badge', category: 'interactive',
|
|
182
|
-
avatar: { description: 'Mantine Avatar', category: 'interactive',
|
|
183
|
-
chip: { description: 'Mantine Chip', category: 'interactive',
|
|
184
|
-
indicator: { description: 'Mantine Indicator dot', category: 'interactive',
|
|
185
|
-
'theme-icon': { description: 'Mantine ThemeIcon', category: 'interactive',
|
|
186
|
-
notification: { description: 'Mantine Notification', category: 'interactive',
|
|
171
|
+
button: { description: 'Mantine Button / HeroUI Button', category: 'interactive', canHaveChildren: false },
|
|
172
|
+
link: { description: 'Anchor / Pressable navigation', category: 'interactive', canHaveChildren: false },
|
|
173
|
+
'action-icon': { description: 'Mantine ActionIcon', category: 'interactive', canHaveChildren: false },
|
|
174
|
+
alert: { description: 'Mantine Alert', category: 'interactive', canHaveChildren: true },
|
|
175
|
+
badge: { description: 'Mantine Badge', category: 'interactive', canHaveChildren: false },
|
|
176
|
+
avatar: { description: 'Mantine Avatar', category: 'interactive', canHaveChildren: false },
|
|
177
|
+
chip: { description: 'Mantine Chip', category: 'interactive', canHaveChildren: false },
|
|
178
|
+
indicator: { description: 'Mantine Indicator dot', category: 'interactive', canHaveChildren: true },
|
|
179
|
+
'theme-icon': { description: 'Mantine ThemeIcon', category: 'interactive', canHaveChildren: false },
|
|
180
|
+
notification: { description: 'Mantine Notification', category: 'interactive', canHaveChildren: false },
|
|
187
181
|
|
|
188
182
|
// ===== forms =====
|
|
189
|
-
'form-log': { description: 'Append-only form (one row per submit)', category: 'forms',
|
|
190
|
-
'form-record': { description: 'Per-user record form', category: 'forms',
|
|
191
|
-
input: { description: 'Plain HTML input', category: 'forms',
|
|
192
|
-
'text-input': { description: 'Mantine TextInput', category: 'forms',
|
|
193
|
-
textarea: { description: 'Mantine Textarea', category: 'forms',
|
|
194
|
-
'rich-text-editor': { description: 'Tiptap editor on web; native inline-format toolbar editor on mobile', category: 'forms',
|
|
195
|
-
select: { description: 'HTML select / Mantine Select', category: 'forms',
|
|
196
|
-
radio: { description: 'Mantine Radio / RadioGroup', category: 'forms',
|
|
197
|
-
checkbox: { description: 'Mantine Checkbox', category: 'forms',
|
|
198
|
-
slider: { description: 'Mantine Slider', category: 'forms',
|
|
199
|
-
'range-slider': { description: 'Mantine RangeSlider', category: 'forms',
|
|
200
|
-
datepicker: { description: 'Mantine DatePicker', category: 'forms',
|
|
201
|
-
switch: { description: 'Mantine Switch', category: 'forms',
|
|
202
|
-
combobox: { description: 'Mantine Combobox', category: 'forms',
|
|
203
|
-
'color-input': { description: 'Mantine ColorInput', category: 'forms',
|
|
204
|
-
'color-picker': { description: 'Mantine ColorPicker', category: 'forms',
|
|
205
|
-
'file-input': { description: 'Mantine FileInput / DocumentPicker on RN', category: 'forms',
|
|
206
|
-
'number-input': { description: 'Mantine NumberInput', category: 'forms',
|
|
207
|
-
'segmented-control': { description: 'Mantine SegmentedControl', category: 'forms',
|
|
208
|
-
rating: { description: 'Mantine Rating', category: 'forms',
|
|
209
|
-
progress: { description: 'Mantine Progress', category: 'forms',
|
|
210
|
-
'progress-root': { description: 'Mantine Progress.Root', category: 'forms',
|
|
211
|
-
'progress-section': { description: 'Mantine Progress.Section', category: 'forms',
|
|
183
|
+
'form-log': { description: 'Append-only form (one row per submit)', category: 'forms', canHaveChildren: true },
|
|
184
|
+
'form-record': { description: 'Per-user record form', category: 'forms', canHaveChildren: true },
|
|
185
|
+
input: { description: 'Plain HTML input', category: 'forms', canHaveChildren: false },
|
|
186
|
+
'text-input': { description: 'Mantine TextInput', category: 'forms', canHaveChildren: false },
|
|
187
|
+
textarea: { description: 'Mantine Textarea', category: 'forms', canHaveChildren: false },
|
|
188
|
+
'rich-text-editor': { description: 'Tiptap editor on web; native inline-format toolbar editor on mobile', category: 'forms', canHaveChildren: false },
|
|
189
|
+
select: { description: 'HTML select / Mantine Select', category: 'forms', canHaveChildren: false },
|
|
190
|
+
radio: { description: 'Mantine Radio / RadioGroup', category: 'forms', canHaveChildren: false },
|
|
191
|
+
checkbox: { description: 'Mantine Checkbox', category: 'forms', canHaveChildren: false },
|
|
192
|
+
slider: { description: 'Mantine Slider', category: 'forms', canHaveChildren: false },
|
|
193
|
+
'range-slider': { description: 'Mantine RangeSlider', category: 'forms', canHaveChildren: false },
|
|
194
|
+
datepicker: { description: 'Mantine DatePicker', category: 'forms', canHaveChildren: false },
|
|
195
|
+
switch: { description: 'Mantine Switch', category: 'forms', canHaveChildren: false },
|
|
196
|
+
combobox: { description: 'Mantine Combobox', category: 'forms', canHaveChildren: false },
|
|
197
|
+
'color-input': { description: 'Mantine ColorInput', category: 'forms', canHaveChildren: false },
|
|
198
|
+
'color-picker': { description: 'Mantine ColorPicker', category: 'forms', canHaveChildren: false },
|
|
199
|
+
'file-input': { description: 'Mantine FileInput / DocumentPicker on RN', category: 'forms', canHaveChildren: false },
|
|
200
|
+
'number-input': { description: 'Mantine NumberInput', category: 'forms', canHaveChildren: false },
|
|
201
|
+
'segmented-control': { description: 'Mantine SegmentedControl', category: 'forms', canHaveChildren: false },
|
|
202
|
+
rating: { description: 'Mantine Rating', category: 'forms', canHaveChildren: false },
|
|
203
|
+
progress: { description: 'Mantine Progress', category: 'forms', canHaveChildren: false },
|
|
204
|
+
'progress-root': { description: 'Mantine Progress.Root', category: 'forms', canHaveChildren: true },
|
|
205
|
+
'progress-section': { description: 'Mantine Progress.Section', category: 'forms', canHaveChildren: false },
|
|
212
206
|
|
|
213
207
|
// ===== composite =====
|
|
214
|
-
accordion: { description: 'Mantine Accordion', category: 'composite',
|
|
215
|
-
'accordion-item': { description: 'Mantine Accordion.Item', category: 'composite',
|
|
216
|
-
tabs: { description: 'Mantine Tabs', category: 'composite',
|
|
217
|
-
tab: { description: 'Mantine Tabs.Tab + Tabs.Panel pair', category: 'composite',
|
|
218
|
-
timeline: { description: 'Mantine Timeline', category: 'composite',
|
|
219
|
-
list: { description: 'Mantine List', category: 'composite',
|
|
220
|
-
'list-item': { description: 'Mantine List.Item', category: 'composite',
|
|
221
|
-
'entry-list': { description: 'Data-driven list of entries (form-log table)', category: 'composite',
|
|
222
|
-
'entry-record': { description: 'Single-record container', category: 'composite',
|
|
223
|
-
'entry-record-delete': { description: 'Inline delete confirmation for an entry', category: 'composite',
|
|
224
|
-
loop: { description: 'Loop / repeater over backend-provided rows', category: 'composite',
|
|
225
|
-
'timeline-item': { description: 'A single entry inside a timeline (child-only)', category: 'composite',
|
|
208
|
+
accordion: { description: 'Mantine Accordion', category: 'composite', canHaveChildren: true },
|
|
209
|
+
'accordion-item': { description: 'Mantine Accordion.Item', category: 'composite', canHaveChildren: true },
|
|
210
|
+
tabs: { description: 'Mantine Tabs', category: 'composite', canHaveChildren: true },
|
|
211
|
+
tab: { description: 'Mantine Tabs.Tab + Tabs.Panel pair', category: 'composite', canHaveChildren: true },
|
|
212
|
+
timeline: { description: 'Mantine Timeline', category: 'composite', canHaveChildren: true },
|
|
213
|
+
list: { description: 'Mantine List', category: 'composite', canHaveChildren: true },
|
|
214
|
+
'list-item': { description: 'Mantine List.Item', category: 'composite', canHaveChildren: true },
|
|
215
|
+
'entry-list': { description: 'Data-driven list of entries (form-log table)', category: 'composite', canHaveChildren: true },
|
|
216
|
+
'entry-record': { description: 'Single-record container', category: 'composite', canHaveChildren: true },
|
|
217
|
+
'entry-record-delete': { description: 'Inline delete confirmation for an entry', category: 'composite', canHaveChildren: false },
|
|
218
|
+
loop: { description: 'Loop / repeater over backend-provided rows', category: 'composite', canHaveChildren: true },
|
|
219
|
+
'timeline-item': { description: 'A single entry inside a timeline (child-only)', category: 'composite', canHaveChildren: true },
|
|
226
220
|
|
|
227
221
|
// ===== system / data / reference (established backend catalog) =====
|
|
228
|
-
'no-access': { description: 'Access-denied surface shown when the user lacks page access', category: 'auth',
|
|
229
|
-
missing: { description: 'Generic "content missing" system surface', category: 'auth',
|
|
230
|
-
'not-found': { description: 'Page-not-found system surface', category: 'auth',
|
|
231
|
-
version: { description: 'Build/version diagnostic surface', category: 'auth',
|
|
232
|
-
'ref-container': { description: 'Renders content referenced from another section', category: 'layout',
|
|
233
|
-
'data-container': { description: 'Data-scoped container (renders subtree against a data scope)', category: 'layout',
|
|
234
|
-
'show-user-input': { description: 'Displays previously submitted user input as a list/card view', category: 'forms',
|
|
222
|
+
'no-access': { description: 'Access-denied surface shown when the user lacks page access', category: 'auth', canHaveChildren: false },
|
|
223
|
+
missing: { description: 'Generic "content missing" system surface', category: 'auth', canHaveChildren: false },
|
|
224
|
+
'not-found': { description: 'Page-not-found system surface', category: 'auth', canHaveChildren: false },
|
|
225
|
+
version: { description: 'Build/version diagnostic surface', category: 'auth', canHaveChildren: false },
|
|
226
|
+
'ref-container': { description: 'Renders content referenced from another section', category: 'layout', canHaveChildren: true },
|
|
227
|
+
'data-container': { description: 'Data-scoped container (renders subtree against a data scope)', category: 'layout', canHaveChildren: true },
|
|
228
|
+
'show-user-input': { description: 'Displays previously submitted user input as a list/card view', category: 'forms', canHaveChildren: false },
|
|
235
229
|
} as const satisfies Record<string, IStyleRegistryEntry>;
|
|
236
230
|
|
|
237
231
|
/**
|
|
@@ -8,8 +8,8 @@ import { COLOR_PALETTE, COLOR_SCALES } from '../tokens';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* The Mantine palette resolver is the single cross-repo source of truth for
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
11
|
+
* the portable `color` + `variant` fields -> concrete RGB (consumed by the
|
|
12
|
+
* mobile renderer). Every variant branch is pinned so a regression surfaces
|
|
13
13
|
* immediately and neither repo re-implements the ladder.
|
|
14
14
|
*/
|
|
15
15
|
describe('resolveMantineVariant', () => {
|
|
@@ -7,9 +7,6 @@ import {
|
|
|
7
7
|
FULL_RADIUS_PX,
|
|
8
8
|
gridSpanToReactNativeColumn,
|
|
9
9
|
mapDividerVariantToReactNative,
|
|
10
|
-
mapIntentToHeroUiButtonVariant,
|
|
11
|
-
mapIntentToHeroUiColor,
|
|
12
|
-
mapIntentToMantine,
|
|
13
10
|
mapMantineColorToHeroUiButtonVariant,
|
|
14
11
|
mapMantineColorToHeroUiColor,
|
|
15
12
|
mapAccordionVariantToHeroUiVariant,
|
|
@@ -27,15 +24,14 @@ import {
|
|
|
27
24
|
toHeroUiSemanticProps,
|
|
28
25
|
toMantineSemanticProps,
|
|
29
26
|
toReactNativeSemanticStyle,
|
|
30
|
-
type TSemanticIntent,
|
|
31
27
|
type TSemanticSize,
|
|
32
28
|
} from '../semantic';
|
|
33
29
|
import { RADIUS_PX, SPACING_PX } from '../tokens';
|
|
34
30
|
|
|
35
31
|
/**
|
|
36
32
|
* The semantic mapper is the single source of truth that turns CMS
|
|
37
|
-
* cross-platform (
|
|
38
|
-
* rendering plan (section 8.2) it does NOT clamp: the shared scales
|
|
33
|
+
* cross-platform (unprefixed portable) values into per-platform props. Per the
|
|
34
|
+
* mobile rendering plan (section 8.2) it does NOT clamp: the shared scales
|
|
39
35
|
* (`size` = sm|md|lg, `radius` = none|sm|md|lg|full) are the true common
|
|
40
36
|
* denominator, so every value maps 1:1 to both platforms. Every mapping is
|
|
41
37
|
* pinned here so a regression surfaces immediately on web and mobile.
|
|
@@ -84,47 +80,15 @@ describe('semantic style mapper', () => {
|
|
|
84
80
|
});
|
|
85
81
|
});
|
|
86
82
|
|
|
87
|
-
describe('intent', () => {
|
|
88
|
-
it('maps to Mantine color + variant', () => {
|
|
89
|
-
expect(mapIntentToMantine('primary')).toEqual({ color: 'blue', variant: 'filled' });
|
|
90
|
-
expect(mapIntentToMantine('secondary')).toEqual({ color: 'gray', variant: 'light' });
|
|
91
|
-
expect(mapIntentToMantine('success')).toEqual({ color: 'green', variant: 'filled' });
|
|
92
|
-
expect(mapIntentToMantine('warning')).toEqual({ color: 'yellow', variant: 'filled' });
|
|
93
|
-
expect(mapIntentToMantine('danger')).toEqual({ color: 'red', variant: 'filled' });
|
|
94
|
-
expect(mapIntentToMantine('neutral')).toEqual({ color: 'gray', variant: 'default' });
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('maps intent to a HeroUI button variant (status color carried separately)', () => {
|
|
98
|
-
expect(mapIntentToHeroUiButtonVariant('primary')).toBe('primary');
|
|
99
|
-
expect(mapIntentToHeroUiButtonVariant('secondary')).toBe('secondary');
|
|
100
|
-
expect(mapIntentToHeroUiButtonVariant('danger')).toBe('danger');
|
|
101
|
-
// HeroUI has no success/warning BUTTON variant; the status colour is
|
|
102
|
-
// carried by mapIntentToHeroUiColor, the button stays prominent.
|
|
103
|
-
expect(mapIntentToHeroUiButtonVariant('success')).toBe('primary');
|
|
104
|
-
expect(mapIntentToHeroUiButtonVariant('warning')).toBe('primary');
|
|
105
|
-
expect(mapIntentToHeroUiButtonVariant('neutral')).toBe('secondary');
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
it('maps to HeroUI semantic color preserving success/warning', () => {
|
|
109
|
-
expect(mapIntentToHeroUiColor('primary')).toBe('accent');
|
|
110
|
-
expect(mapIntentToHeroUiColor('secondary')).toBe('default');
|
|
111
|
-
expect(mapIntentToHeroUiColor('success')).toBe('success');
|
|
112
|
-
expect(mapIntentToHeroUiColor('warning')).toBe('warning');
|
|
113
|
-
expect(mapIntentToHeroUiColor('danger')).toBe('danger');
|
|
114
|
-
expect(mapIntentToHeroUiColor('neutral')).toBe('default');
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
|
|
118
83
|
describe('resolveSharedStyleProps (read CMS fields)', () => {
|
|
119
|
-
it('reads valid
|
|
84
|
+
it('reads valid portable values', () => {
|
|
120
85
|
expect(
|
|
121
86
|
resolveSharedStyleProps({
|
|
122
87
|
size: 'lg',
|
|
123
88
|
radius: 'full',
|
|
124
|
-
shared_intent: 'danger',
|
|
125
89
|
full_width: '1',
|
|
126
90
|
}),
|
|
127
|
-
).toEqual({ size: 'lg', radius: 'full',
|
|
91
|
+
).toEqual({ size: 'lg', radius: 'full', fullWidth: true });
|
|
128
92
|
});
|
|
129
93
|
|
|
130
94
|
it('ignores out-of-domain values instead of clamping them', () => {
|
|
@@ -133,11 +97,9 @@ describe('semantic style mapper', () => {
|
|
|
133
97
|
const resolved = resolveSharedStyleProps({
|
|
134
98
|
size: 'xl',
|
|
135
99
|
radius: 'xs',
|
|
136
|
-
shared_intent: 'bogus',
|
|
137
100
|
});
|
|
138
101
|
expect(resolved.size).toBeUndefined();
|
|
139
102
|
expect(resolved.radius).toBeUndefined();
|
|
140
|
-
expect(resolved.intent).toBeUndefined();
|
|
141
103
|
});
|
|
142
104
|
|
|
143
105
|
it('coerces full_width booleans', () => {
|
|
@@ -199,15 +161,15 @@ describe('semantic style mapper', () => {
|
|
|
199
161
|
expect(mapMantineColorToHeroUiButtonVariant('blue')).toBe('primary');
|
|
200
162
|
});
|
|
201
163
|
|
|
202
|
-
it('toHeroUiSemanticProps prefers variant, then color
|
|
164
|
+
it('toHeroUiSemanticProps prefers variant, then color', () => {
|
|
203
165
|
expect(
|
|
204
|
-
toHeroUiSemanticProps({ variant: 'outline', color: 'red'
|
|
166
|
+
toHeroUiSemanticProps({ variant: 'outline', color: 'red' }).buttonVariant,
|
|
205
167
|
).toBe('outline');
|
|
206
168
|
expect(toHeroUiSemanticProps({ color: 'red' })).toMatchObject({
|
|
207
169
|
buttonVariant: 'danger',
|
|
208
170
|
color: 'danger',
|
|
209
171
|
});
|
|
210
|
-
expect(toHeroUiSemanticProps({
|
|
172
|
+
expect(toHeroUiSemanticProps({ color: 'green' })).toMatchObject({
|
|
211
173
|
buttonVariant: 'primary',
|
|
212
174
|
color: 'success',
|
|
213
175
|
});
|
|
@@ -230,9 +192,10 @@ describe('semantic style mapper', () => {
|
|
|
230
192
|
});
|
|
231
193
|
|
|
232
194
|
describe('platform resolvers', () => {
|
|
233
|
-
it('resolves a
|
|
195
|
+
it('resolves a red / filled / lg / full / fullWidth control consistently (no clamp)', () => {
|
|
234
196
|
const props = {
|
|
235
|
-
|
|
197
|
+
color: 'red' as const,
|
|
198
|
+
variant: 'filled' as const,
|
|
236
199
|
size: 'lg' as const,
|
|
237
200
|
radius: 'full' as const,
|
|
238
201
|
spacing: 'md' as const,
|
|
@@ -253,8 +216,8 @@ describe('semantic style mapper', () => {
|
|
|
253
216
|
|
|
254
217
|
expect(toHeroUiSemanticProps(props)).toMatchObject({
|
|
255
218
|
size: 'lg', // 1:1, not clamped
|
|
256
|
-
buttonVariant: '
|
|
257
|
-
color: 'danger',
|
|
219
|
+
buttonVariant: 'primary', // filled -> primary
|
|
220
|
+
color: 'danger', // red -> danger
|
|
258
221
|
radiusPx: FULL_RADIUS_PX,
|
|
259
222
|
spacingPx: SPACING_PX.md,
|
|
260
223
|
isDisabled: true,
|
|
@@ -264,7 +227,7 @@ describe('semantic style mapper', () => {
|
|
|
264
227
|
});
|
|
265
228
|
|
|
266
229
|
it('resolveSharedStyle returns both platform shapes', () => {
|
|
267
|
-
const { web, mobile } = resolveSharedStyle({ size: 'md',
|
|
230
|
+
const { web, mobile } = resolveSharedStyle({ size: 'md', color: 'blue' });
|
|
268
231
|
expect(web.size).toBe('md');
|
|
269
232
|
expect(web.color).toBe('blue');
|
|
270
233
|
expect(mobile.size).toBe('md');
|
|
@@ -279,9 +242,9 @@ describe('semantic style mapper', () => {
|
|
|
279
242
|
expect(mobile.isDisabled).toBeUndefined();
|
|
280
243
|
});
|
|
281
244
|
|
|
282
|
-
it('covers every
|
|
283
|
-
for (const
|
|
284
|
-
const { web, mobile } = resolveSharedStyle({
|
|
245
|
+
it('covers every mapped colour without throwing', () => {
|
|
246
|
+
for (const color of ['blue', 'gray', 'green', 'yellow', 'red'] as const) {
|
|
247
|
+
const { web, mobile } = resolveSharedStyle({ color });
|
|
285
248
|
expect(web.color).toBeDefined();
|
|
286
249
|
expect(mobile.color).toBeDefined();
|
|
287
250
|
expect(mobile.buttonVariant).toBeDefined();
|
|
@@ -13,10 +13,10 @@ SPDX-License-Identifier: MPL-2.0
|
|
|
13
13
|
* SCOPE — this is NOT the semantic mapper (`semantic.ts`). The two have
|
|
14
14
|
* different input domains and both live here so there is exactly one home
|
|
15
15
|
* for style mapping:
|
|
16
|
-
* - `semantic.ts` maps renderer-agnostic
|
|
17
|
-
* (`
|
|
16
|
+
* - `semantic.ts` maps renderer-agnostic unprefixed portable fields
|
|
17
|
+
* (`color` / `variant` / `size` / `radius` / `spacing`) per platform.
|
|
18
18
|
* - `mantineVariant.ts` resolves a Mantine palette `color` + `variant` value
|
|
19
|
-
* pair (e.g. the
|
|
19
|
+
* pair (e.g. the portable `color` + `variant`)
|
|
20
20
|
* into concrete RGB. Its only runtime
|
|
21
21
|
* consumer today is the mobile **Expo Web preview**
|
|
22
22
|
* fallback (where `heroui-native` cannot render and the
|