@selfhelp/shared 1.14.23 → 1.15.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 (47) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/{common-udJ0O8qC.d.mts → common-qaDIAYS3.d.mts} +5 -4
  3. package/dist/{common-udJ0O8qC.d.ts → common-qaDIAYS3.d.ts} +5 -4
  4. package/dist/index.d.mts +121 -5
  5. package/dist/index.d.ts +121 -5
  6. package/dist/index.js +105 -170
  7. package/dist/index.mjs +104 -167
  8. package/dist/{manifest-C8sBTLJb.d.mts → manifest-8YXAk-4o.d.mts} +8 -0
  9. package/dist/{manifest-C8sBTLJb.d.ts → manifest-8YXAk-4o.d.ts} +8 -0
  10. package/dist/plugin-sdk/index.d.mts +41 -4
  11. package/dist/plugin-sdk/index.d.ts +41 -4
  12. package/dist/plugin-sdk/index.js +103 -91
  13. package/dist/plugin-sdk/index.mjs +101 -91
  14. package/dist/registry/index.d.mts +3 -3
  15. package/dist/registry/index.d.ts +3 -3
  16. package/dist/registry/index.js +90 -90
  17. package/dist/registry/index.mjs +90 -90
  18. package/dist/{styles.registry-CZZwODJY.d.mts → styles.registry-4W0LzmZB.d.mts} +2 -189
  19. package/dist/{styles.registry-DQKcvIBZ.d.ts → styles.registry-D6xMm5VR.d.ts} +2 -189
  20. package/dist/testing/index.d.mts +1 -1
  21. package/dist/testing/index.d.ts +1 -1
  22. package/dist/theme/index.d.mts +27 -76
  23. package/dist/theme/index.d.ts +27 -76
  24. package/dist/theme/index.js +4 -80
  25. package/dist/theme/index.mjs +4 -77
  26. package/package.json +1 -1
  27. package/src/plugin-sdk/__tests__/version.test.ts +40 -0
  28. package/src/plugin-sdk/define.ts +0 -1
  29. package/src/plugin-sdk/index.ts +2 -0
  30. package/src/plugin-sdk/manifest.ts +8 -0
  31. package/src/plugin-sdk/registry.ts +11 -0
  32. package/src/plugin-sdk/version.ts +38 -0
  33. package/src/registry/__tests__/platform.test.ts +0 -4
  34. package/src/registry/__tests__/registry.test.ts +0 -2
  35. package/src/registry/styles.registry.ts +90 -96
  36. package/src/theme/__tests__/mantineVariant.test.ts +2 -2
  37. package/src/theme/__tests__/semantic.test.ts +16 -53
  38. package/src/theme/mantineVariant.ts +3 -3
  39. package/src/theme/semantic.ts +24 -164
  40. package/src/theme/tokens.ts +2 -2
  41. package/src/types/__tests__/distribution.test.ts +55 -1
  42. package/src/types/api/index.ts +1 -0
  43. package/src/types/api/mobile-preview.ts +71 -0
  44. package/src/types/distribution.ts +54 -1
  45. package/src/types/mantine/common.ts +4 -3
  46. package/src/types/styles/base.ts +1 -1
  47. package/src/types/styles/composite.ts +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.14.23",
3
+ "version": "1.15.0",
4
4
  "description": "Shared TypeScript package for SelfHelp web frontend and mobile app: style registry, types, API contracts, Mantine theme tokens, condition + interpolation engines, CMS class allow-list.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,40 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ import { describe, expect, it } from 'vitest';
6
+ import {
7
+ MOBILE_RENDERER_VERSION,
8
+ isMobileRendererCompatible,
9
+ parseSemver,
10
+ } from '../version';
11
+
12
+ describe('mobile renderer compatibility (compatibility.mobile axis)', () => {
13
+ it('exposes a valid semver MOBILE_RENDERER_VERSION constant', () => {
14
+ const v = parseSemver(MOBILE_RENDERER_VERSION);
15
+ expect(v.major).toBeGreaterThanOrEqual(0);
16
+ expect(typeof v.minor).toBe('number');
17
+ expect(typeof v.patch).toBe('number');
18
+ });
19
+
20
+ it('accepts a range that covers the host renderer version', () => {
21
+ expect(isMobileRendererCompatible('>=0.1.0 <0.2.0', '0.1.0')).toBe(true);
22
+ expect(isMobileRendererCompatible('^0.2.0', '0.2.3')).toBe(true);
23
+ // Default host arg = MOBILE_RENDERER_VERSION.
24
+ expect(isMobileRendererCompatible(`>=${MOBILE_RENDERER_VERSION}`)).toBe(true);
25
+ });
26
+
27
+ it('rejects a range outside the host renderer version', () => {
28
+ expect(isMobileRendererCompatible('>=0.2.0', '0.1.0')).toBe(false);
29
+ expect(isMobileRendererCompatible('<0.1.0', '0.1.0')).toBe(false);
30
+ });
31
+
32
+ it('treats a missing range as "no mobile support declared" (web-only plugin)', () => {
33
+ expect(isMobileRendererCompatible(undefined)).toBe(false);
34
+ expect(isMobileRendererCompatible('')).toBe(false);
35
+ });
36
+
37
+ it('never throws on a malformed range', () => {
38
+ expect(isMobileRendererCompatible('not-a-range', '0.1.0')).toBe(false);
39
+ });
40
+ });
@@ -81,7 +81,6 @@ function toRegistryRecord(styles: IStyleDefinition[]): Record<string, IStyleRegi
81
81
  out[style.name] = {
82
82
  description: style.description,
83
83
  category: style.category,
84
- frontendOnly: true,
85
84
  canHaveChildren: style.canHaveChildren,
86
85
  };
87
86
  }
@@ -17,8 +17,10 @@ SPDX-License-Identifier: MPL-2.0
17
17
 
18
18
  export {
19
19
  PLUGIN_API_VERSION,
20
+ MOBILE_RENDERER_VERSION,
20
21
  assertPluginApiVersion,
21
22
  isPluginApiCompatible,
23
+ isMobileRendererCompatible,
22
24
  assertCmsCompatibility,
23
25
  assertPluginVersionSemantics,
24
26
  parseSemver,
@@ -46,6 +46,14 @@ export interface IPluginManifestCompatibility {
46
46
  reactNative?: string;
47
47
  /** SemVer range for Expo SDK. */
48
48
  expoSdk?: string;
49
+ /**
50
+ * SemVer range for the host mobile renderer contract
51
+ * (`MOBILE_RENDERER_VERSION`) the plugin's mobile package supports. The
52
+ * SelfHelp Manager gates a plugin's mobile package against the selected
53
+ * `selfhelp-mobile-preview` image's advertised `mobileRendererVersion`.
54
+ * Absent for web-only plugins.
55
+ */
56
+ mobile?: string;
49
57
  }
50
58
 
51
59
  export interface IPluginManifestDependency {
@@ -84,6 +84,12 @@ export interface IPluginRelease {
84
84
  core: string;
85
85
  /** Semver range of host plugin-API versions this plugin runs on. */
86
86
  pluginApi: string;
87
+ /**
88
+ * Semver range of the host mobile renderer contract
89
+ * (`mobileRendererVersion`) this plugin's mobile package supports.
90
+ * Additive; absent for web-only plugins.
91
+ */
92
+ mobile?: string;
87
93
  };
88
94
  /** Optional other-plugin requirements consumed by the resolver. */
89
95
  dependencies?: {
@@ -132,6 +138,11 @@ export interface IPluginRegistry {
132
138
  worker: IRegistryReleaseRef[];
133
139
  /** Plugin release refs (CMS-installed) — multi-version, one ref per published version. */
134
140
  plugins: IRegistryReleaseRef[];
141
+ /**
142
+ * Mobile-preview web image release refs (Manager-installed). Additive in
143
+ * registry `schemaVersion` 1.1 — older managers ignore the unknown array.
144
+ */
145
+ mobilePreview?: IRegistryReleaseRef[];
135
146
  /** Optional path to the security advisory feed. */
136
147
  advisoriesUrl?: string;
137
148
  /** Optional path to the cross-component compatibility feed. */
@@ -16,6 +16,24 @@ SPDX-License-Identifier: MPL-2.0
16
16
  */
17
17
  export const PLUGIN_API_VERSION = '0.1.0' as const;
18
18
 
19
+ /**
20
+ * Mobile renderer contract version. This is the SECOND, mobile-only
21
+ * compatibility axis (independent of `PLUGIN_API_VERSION`): it versions the
22
+ * mobile plugin rendering surface — the `registerMobile()` shape, `IStyleProps`
23
+ * / `TPluginStyleImplMap`, and the mobile host SDK primitives — that a plugin's
24
+ * mobile npm package compiles against.
25
+ *
26
+ * The mobile app and the `selfhelp-mobile-preview` image advertise this value
27
+ * (in `version.json` + the signed `mobile-preview-release.json`). A plugin
28
+ * declares the range it supports in `plugin.json` under `compatibility.mobile`;
29
+ * the SelfHelp Manager gates the plugin against the selected preview image's
30
+ * advertised `mobileRendererVersion` using {@see isMobileRendererCompatible}.
31
+ *
32
+ * Bump rules mirror the SDK contract: patch = additive fix, minor = additive
33
+ * renderer feature, major = breaking mobile renderer change.
34
+ */
35
+ export const MOBILE_RENDERER_VERSION = '0.1.0' as const;
36
+
19
37
  export interface ISemver {
20
38
  major: number;
21
39
  minor: number;
@@ -139,6 +157,26 @@ export function assertPluginApiVersion(required: string): void {
139
157
  }
140
158
  }
141
159
 
160
+ /**
161
+ * Non-throwing satisfaction check for the mobile-renderer axis: returns true
162
+ * when the host's `mobileRendererVersion` falls inside the plugin's declared
163
+ * `compatibility.mobile` range. Used by the SelfHelp Manager preflight to gate
164
+ * an enabled plugin's mobile package against the selected preview image, and by
165
+ * the mobile/preview runtime to skip an incompatible plugin instead of crashing.
166
+ * An empty/undefined range is treated as "no mobile support declared" → false.
167
+ */
168
+ export function isMobileRendererCompatible(
169
+ requiredRange: string | undefined,
170
+ host: string = MOBILE_RENDERER_VERSION,
171
+ ): boolean {
172
+ if (!requiredRange) return false;
173
+ try {
174
+ return satisfiesSemverRange(host, requiredRange);
175
+ } catch {
176
+ return false;
177
+ }
178
+ }
179
+
142
180
  /**
143
181
  * Throw if the running CMS version is not in the plugin's declared
144
182
  * compatibility range.
@@ -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', frontendOnly: true, canHaveChildren: false },
132
- register: { description: 'User registration form', category: 'auth', frontendOnly: true, canHaveChildren: false },
133
- validate: { description: 'Email/account validation flow', category: 'auth', frontendOnly: true, canHaveChildren: true },
134
- 'reset-password': { description: 'Reset password form', category: 'auth', frontendOnly: true, canHaveChildren: false },
135
- 'two-factor-auth': { description: 'Two-factor auth code form', category: 'auth', frontendOnly: true, canHaveChildren: false },
136
- profile: { description: 'User profile management', category: 'auth', frontendOnly: true, canHaveChildren: false },
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', frontendOnly: true, canHaveChildren: true },
140
- box: { description: 'Generic Mantine Box wrapper', category: 'layout', frontendOnly: true, canHaveChildren: true },
141
- flex: { description: 'Mantine Flex layout', category: 'layout', frontendOnly: true, canHaveChildren: true },
142
- group: { description: 'Mantine Group horizontal layout', category: 'layout', frontendOnly: true, canHaveChildren: true },
143
- stack: { description: 'Mantine Stack vertical layout', category: 'layout', frontendOnly: true, canHaveChildren: true },
144
- 'simple-grid': { description: 'Mantine SimpleGrid', category: 'layout', frontendOnly: true, canHaveChildren: true },
145
- grid: { description: 'Mantine Grid', category: 'layout', frontendOnly: true, canHaveChildren: true },
146
- 'grid-column': { description: 'Mantine Grid.Col', category: 'layout', frontendOnly: true, canHaveChildren: true },
147
- space: { description: 'Mantine Space spacer', category: 'layout', frontendOnly: true, canHaveChildren: false },
148
- divider: { description: 'Mantine Divider', category: 'layout', frontendOnly: true, canHaveChildren: false },
149
- paper: { description: 'Mantine Paper surface', category: 'layout', frontendOnly: true, canHaveChildren: true },
150
- center: { description: 'Mantine Center alignment', category: 'layout', frontendOnly: true, canHaveChildren: true },
151
- 'scroll-area': { description: 'Mantine ScrollArea', category: 'layout', frontendOnly: true, canHaveChildren: true },
152
- card: { description: 'Mantine Card', category: 'layout', frontendOnly: true, canHaveChildren: true },
153
- 'card-segment': { description: 'Mantine Card.Section', category: 'layout', frontendOnly: true, canHaveChildren: true },
154
- 'aspect-ratio': { description: 'Mantine AspectRatio wrapper', category: 'layout', frontendOnly: true, canHaveChildren: true },
155
- 'background-image': { description: 'Mantine BackgroundImage', category: 'layout', frontendOnly: true, canHaveChildren: true },
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', frontendOnly: true, canHaveChildren: false },
159
- text: { description: 'Mantine Text', category: 'typography', frontendOnly: true, canHaveChildren: false },
160
- code: { description: 'Mantine Code (inline / block)', category: 'typography', frontendOnly: true, canHaveChildren: false },
161
- highlight: { description: 'Mantine Highlight', category: 'typography', frontendOnly: true, canHaveChildren: false },
162
- blockquote: { description: 'Mantine Blockquote', category: 'typography', frontendOnly: true, canHaveChildren: false },
163
- 'html-tag': { description: 'Generic HTML tag wrapper (web), maps to View on RN', category: 'typography', frontendOnly: true, canHaveChildren: true },
164
- kbd: { description: 'Mantine Kbd', category: 'typography', frontendOnly: true, canHaveChildren: false },
165
- typography: { description: 'Mantine Typography wrapper', category: 'typography', frontendOnly: true, canHaveChildren: true },
166
- fieldset: { description: 'Mantine Fieldset', category: 'typography', frontendOnly: true, canHaveChildren: true },
167
- spoiler: { description: 'Mantine Spoiler reveal', category: 'typography', frontendOnly: true, canHaveChildren: true },
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', frontendOnly: true, canHaveChildren: false },
171
- video: { description: 'HTML5 video / expo-video', category: 'media', frontendOnly: true, canHaveChildren: false },
172
- audio: { description: 'HTML5 audio / expo-audio', category: 'media', frontendOnly: true, canHaveChildren: false },
173
- figure: { description: 'Figure with caption', category: 'media', frontendOnly: true, canHaveChildren: true },
174
- carousel: { description: 'Embla on web, reanimated-carousel on RN', category: 'media', frontendOnly: true, canHaveChildren: true },
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', frontendOnly: true, canHaveChildren: false },
178
- link: { description: 'Anchor / Pressable navigation', category: 'interactive', frontendOnly: true, canHaveChildren: false },
179
- 'action-icon': { description: 'Mantine ActionIcon', category: 'interactive', frontendOnly: true, canHaveChildren: false },
180
- alert: { description: 'Mantine Alert', category: 'interactive', frontendOnly: true, canHaveChildren: true },
181
- badge: { description: 'Mantine Badge', category: 'interactive', frontendOnly: true, canHaveChildren: false },
182
- avatar: { description: 'Mantine Avatar', category: 'interactive', frontendOnly: true, canHaveChildren: false },
183
- chip: { description: 'Mantine Chip', category: 'interactive', frontendOnly: true, canHaveChildren: false },
184
- indicator: { description: 'Mantine Indicator dot', category: 'interactive', frontendOnly: true, canHaveChildren: true },
185
- 'theme-icon': { description: 'Mantine ThemeIcon', category: 'interactive', frontendOnly: true, canHaveChildren: false },
186
- notification: { description: 'Mantine Notification', category: 'interactive', frontendOnly: true, canHaveChildren: false },
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', frontendOnly: true, canHaveChildren: true },
190
- 'form-record': { description: 'Per-user record form', category: 'forms', frontendOnly: true, canHaveChildren: true },
191
- input: { description: 'Plain HTML input', category: 'forms', frontendOnly: true, canHaveChildren: false },
192
- 'text-input': { description: 'Mantine TextInput', category: 'forms', frontendOnly: true, canHaveChildren: false },
193
- textarea: { description: 'Mantine Textarea', category: 'forms', frontendOnly: true, canHaveChildren: false },
194
- 'rich-text-editor': { description: 'Tiptap editor on web; native inline-format toolbar editor on mobile', category: 'forms', frontendOnly: true, canHaveChildren: false },
195
- select: { description: 'HTML select / Mantine Select', category: 'forms', frontendOnly: true, canHaveChildren: false },
196
- radio: { description: 'Mantine Radio / RadioGroup', category: 'forms', frontendOnly: true, canHaveChildren: false },
197
- checkbox: { description: 'Mantine Checkbox', category: 'forms', frontendOnly: true, canHaveChildren: false },
198
- slider: { description: 'Mantine Slider', category: 'forms', frontendOnly: true, canHaveChildren: false },
199
- 'range-slider': { description: 'Mantine RangeSlider', category: 'forms', frontendOnly: true, canHaveChildren: false },
200
- datepicker: { description: 'Mantine DatePicker', category: 'forms', frontendOnly: true, canHaveChildren: false },
201
- switch: { description: 'Mantine Switch', category: 'forms', frontendOnly: true, canHaveChildren: false },
202
- combobox: { description: 'Mantine Combobox', category: 'forms', frontendOnly: true, canHaveChildren: false },
203
- 'color-input': { description: 'Mantine ColorInput', category: 'forms', frontendOnly: true, canHaveChildren: false },
204
- 'color-picker': { description: 'Mantine ColorPicker', category: 'forms', frontendOnly: true, canHaveChildren: false },
205
- 'file-input': { description: 'Mantine FileInput / DocumentPicker on RN', category: 'forms', frontendOnly: true, canHaveChildren: false },
206
- 'number-input': { description: 'Mantine NumberInput', category: 'forms', frontendOnly: true, canHaveChildren: false },
207
- 'segmented-control': { description: 'Mantine SegmentedControl', category: 'forms', frontendOnly: true, canHaveChildren: false },
208
- rating: { description: 'Mantine Rating', category: 'forms', frontendOnly: true, canHaveChildren: false },
209
- progress: { description: 'Mantine Progress', category: 'forms', frontendOnly: true, canHaveChildren: false },
210
- 'progress-root': { description: 'Mantine Progress.Root', category: 'forms', frontendOnly: true, canHaveChildren: true },
211
- 'progress-section': { description: 'Mantine Progress.Section', category: 'forms', frontendOnly: true, canHaveChildren: false },
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', frontendOnly: true, canHaveChildren: true },
215
- 'accordion-item': { description: 'Mantine Accordion.Item', category: 'composite', frontendOnly: true, canHaveChildren: true },
216
- tabs: { description: 'Mantine Tabs', category: 'composite', frontendOnly: true, canHaveChildren: true },
217
- tab: { description: 'Mantine Tabs.Tab + Tabs.Panel pair', category: 'composite', frontendOnly: true, canHaveChildren: true },
218
- timeline: { description: 'Mantine Timeline', category: 'composite', frontendOnly: true, canHaveChildren: true },
219
- list: { description: 'Mantine List', category: 'composite', frontendOnly: true, canHaveChildren: true },
220
- 'list-item': { description: 'Mantine List.Item', category: 'composite', frontendOnly: true, canHaveChildren: true },
221
- 'entry-list': { description: 'Data-driven list of entries (form-log table)', category: 'composite', frontendOnly: true, canHaveChildren: true },
222
- 'entry-record': { description: 'Single-record container', category: 'composite', frontendOnly: true, canHaveChildren: true },
223
- 'entry-record-delete': { description: 'Inline delete confirmation for an entry', category: 'composite', frontendOnly: true, canHaveChildren: false },
224
- loop: { description: 'Loop / repeater over backend-provided rows', category: 'composite', frontendOnly: true, canHaveChildren: true },
225
- 'timeline-item': { description: 'A single entry inside a timeline (child-only)', category: 'composite', frontendOnly: true, canHaveChildren: true },
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', frontendOnly: true, canHaveChildren: false },
229
- missing: { description: 'Generic "content missing" system surface', category: 'auth', frontendOnly: true, canHaveChildren: false },
230
- 'not-found': { description: 'Page-not-found system surface', category: 'auth', frontendOnly: true, canHaveChildren: false },
231
- version: { description: 'Build/version diagnostic surface', category: 'auth', frontendOnly: true, canHaveChildren: false },
232
- 'ref-container': { description: 'Renders content referenced from another section', category: 'layout', frontendOnly: true, canHaveChildren: true },
233
- 'data-container': { description: 'Data-scoped container (renders subtree against a data scope)', category: 'layout', frontendOnly: true, canHaveChildren: true },
234
- 'show-user-input': { description: 'Displays previously submitted user input as a list/card view', category: 'forms', frontendOnly: true, canHaveChildren: false },
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
- * `web_color` + `web_variant` -> concrete RGB (consumed by the mobile Expo Web
12
- * preview fallback). Every variant branch is pinned so a regression surfaces
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 (`shared_*`) values into per-platform props. Per the mobile
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 shared_* values', () => {
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', intent: 'danger', fullWidth: true });
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, then intent', () => {
164
+ it('toHeroUiSemanticProps prefers variant, then color', () => {
203
165
  expect(
204
- toHeroUiSemanticProps({ variant: 'outline', color: 'red', intent: 'primary' }).buttonVariant,
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({ intent: 'success' })).toMatchObject({
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 danger / lg / full / fullWidth control consistently (no clamp)', () => {
195
+ it('resolves a red / filled / lg / full / fullWidth control consistently (no clamp)', () => {
234
196
  const props = {
235
- intent: 'danger' as const,
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: 'danger',
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', intent: 'primary' });
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 intent without throwing', () => {
283
- for (const intent of ['primary', 'secondary', 'success', 'warning', 'danger', 'neutral'] as TSemanticIntent[]) {
284
- const { web, mobile } = resolveSharedStyle({ intent });
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 shared fields
17
- * (`intent` / `size` / `radius` / `spacing`) per platform.
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 semantic `color` + `web_variant`)
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