@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
@@ -4,8 +4,9 @@ SPDX-License-Identifier: MPL-2.0
4
4
  */
5
5
  /**
6
6
  * Shared semantic style mapper — the single source of truth that turns
7
- * renderer-agnostic CMS values (`shared_*` fields) into concrete per-platform
8
- * props. Renderers consume this module instead of duplicating mapping logic.
7
+ * renderer-agnostic CMS values (the unprefixed portable fields) into concrete
8
+ * per-platform props. Renderers consume this module instead of duplicating
9
+ * mapping logic.
9
10
  *
10
11
  * - Web -> Mantine (`toMantineSemanticProps`)
11
12
  * - Mobile -> HeroUI Native (`toHeroUiSemanticProps`)
@@ -17,14 +18,15 @@ SPDX-License-Identifier: MPL-2.0
17
18
  * value maps 1:1 to each platform. The backend enforces the same domain
18
19
  * (migration `Version20260618195450`).
19
20
  * - NO implicit cross-platform fallback. These functions take already-resolved
20
- * SHARED props; the precedence `web_*`/`mobile_*` override -> `shared_*` ->
21
- * component default is applied by each platform renderer, never here.
21
+ * portable props; the precedence `web_*`/`mobile_*` override -> portable
22
+ * (unprefixed) -> component default is applied by each platform renderer,
23
+ * never here.
22
24
  * - Exhaustive enum handling (every switch covers the full domain).
23
25
  *
24
- * Platform-specific props stay separate from these shared values:
26
+ * Platform-specific props stay separate from these portable values:
25
27
  * - `web_*` Mantine-only fields
26
28
  * - `mobile_*` HeroUI/native-only fields
27
- * - shared the semantic fields mapped here
29
+ * - portable the unprefixed semantic fields mapped here
28
30
  */
29
31
 
30
32
  import { RADIUS_PX, SPACING_PX, type TCanonicalSpacing } from './tokens';
@@ -37,23 +39,14 @@ export type TSemanticSize = TSharedSize; // 'sm' | 'md' | 'lg'
37
39
  export type TSemanticSpacing = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
38
40
  /** Cross-platform radius. `full` = pill; `none` = square. */
39
41
  export type TSemanticRadius = TSharedRadius; // 'none' | 'sm' | 'md' | 'lg' | 'full'
40
- export type TSemanticIntent =
41
- | 'primary'
42
- | 'secondary'
43
- | 'success'
44
- | 'warning'
45
- | 'danger'
46
- | 'neutral';
47
42
  export type TSemanticState = 'disabled' | 'loading' | 'invalid' | 'required';
48
43
 
49
44
  /**
50
45
  * Cross-platform colour + variant authored in the CMS (`color` /
51
- * `variant`). These are stored as Mantine palette / variant *values* —
52
- * the catalog keeps them verbatim (migration `Version20260618143216` renamed the
53
- * legacy `mantine_*` fields to `shared_*` without touching the values). They are
54
- * the REAL cross-platform appearance fields (there is no `shared_intent` in the
55
- * live catalog); the mapper maps them onto HeroUI Native for mobile, while the
56
- * web renderer feeds them straight into Mantine.
46
+ * `variant`), stored as Mantine palette / variant *values* kept verbatim by the
47
+ * catalog. They are the canonical cross-platform appearance fields; the mapper
48
+ * maps them onto HeroUI Native for mobile, while the web renderer feeds them
49
+ * straight into Mantine.
57
50
  */
58
51
  export type TSemanticColor = TMantineColor;
59
52
  export type TSemanticVariant = TMantineVariant;
@@ -63,14 +56,6 @@ export const FULL_RADIUS_PX = 9999;
63
56
 
64
57
  const SEMANTIC_SIZES: readonly TSemanticSize[] = ['sm', 'md', 'lg'];
65
58
  const SEMANTIC_RADII: readonly TSemanticRadius[] = ['none', 'sm', 'md', 'lg', 'full'];
66
- const SEMANTIC_INTENTS: readonly TSemanticIntent[] = [
67
- 'primary',
68
- 'secondary',
69
- 'success',
70
- 'warning',
71
- 'danger',
72
- 'neutral',
73
- ];
74
59
 
75
60
  /**
76
61
  * Renderer-agnostic style values configured in the CMS. Every field is
@@ -85,12 +70,6 @@ export interface ISharedStyleProps {
85
70
  color?: TSemanticColor;
86
71
  /** Mantine variant authored via `variant` (cross-platform). */
87
72
  variant?: TSemanticVariant;
88
- /**
89
- * Legacy semantic intent. Kept for back-compat; `shared_intent` is NOT in the
90
- * live catalog, so real CMS sections drive appearance through `color` /
91
- * `variant` above. Used as the final fallback in the platform resolvers.
92
- */
93
- intent?: TSemanticIntent;
94
73
  /** Active boolean states. Stored as a small set so multiple can apply. */
95
74
  states?: readonly TSemanticState[];
96
75
  /** Layout: stretch the control to the full width of its container. */
@@ -99,19 +78,13 @@ export interface ISharedStyleProps {
99
78
 
100
79
  // ===== Mantine (web) target shapes =====
101
80
 
102
- export type TMantineMappedColor =
103
- | 'blue'
104
- | 'gray'
105
- | 'green'
106
- | 'yellow'
107
- | 'red';
108
- export type TMantineMappedVariant = 'filled' | 'light' | 'outline' | 'default';
109
-
110
81
  export interface IMantineResolvedStyle {
111
82
  /** Mantine accepts sm|md|lg 1:1 (a subset of its xs..xl scale). */
112
83
  size?: TSemanticSize;
113
- color?: TMantineMappedColor;
114
- variant?: TMantineMappedVariant;
84
+ /** Mantine palette colour, read verbatim from the `color` field. */
85
+ color?: TSemanticColor;
86
+ /** Mantine variant, read verbatim from the `variant` field. */
87
+ variant?: TSemanticVariant;
115
88
  /** Mantine `radius` accepts a token or a number; pill => FULL_RADIUS_PX. */
116
89
  radius?: TSemanticSize | number;
117
90
  /** Margin/padding spacing token (xs..xl); `none` => undefined. */
@@ -141,9 +114,9 @@ export type THeroUiColor = 'accent' | 'default' | 'success' | 'warning' | 'dange
141
114
 
142
115
  export interface IHeroUiResolvedStyle {
143
116
  size?: THeroUiSize;
144
- /** Intent mapped onto the Button variant vocabulary. */
117
+ /** Button variant derived from the Mantine `variant`/`color`. */
145
118
  buttonVariant?: THeroUiButtonVariant;
146
- /** Intent mapped onto the semantic color vocabulary (Chip/Tag/etc). */
119
+ /** Semantic color derived from the Mantine `color` (Chip/Tag/etc). */
147
120
  color?: THeroUiColor;
148
121
  /** Resolved radius in px (pill => FULL_RADIUS_PX, none => 0). */
149
122
  radiusPx?: number;
@@ -243,109 +216,6 @@ export function mapSpacingToPx(spacing: TSemanticSpacing | undefined): number |
243
216
  return SPACING_PX[spacing as TCanonicalSpacing];
244
217
  }
245
218
 
246
- // ===== intent =====
247
-
248
- /**
249
- * Map a semantic intent to a Mantine `{ color, variant }` pair.
250
- * primary -> blue / filled
251
- * secondary -> gray / light
252
- * success -> green / filled
253
- * warning -> yellow / filled
254
- * danger -> red / filled
255
- * neutral -> gray / default
256
- */
257
- export function mapIntentToMantine(
258
- intent: TSemanticIntent | undefined,
259
- ): { color: TMantineMappedColor; variant: TMantineMappedVariant } | undefined {
260
- if (!intent) return undefined;
261
- switch (intent) {
262
- case 'primary':
263
- return { color: 'blue', variant: 'filled' };
264
- case 'secondary':
265
- return { color: 'gray', variant: 'light' };
266
- case 'success':
267
- return { color: 'green', variant: 'filled' };
268
- case 'warning':
269
- return { color: 'yellow', variant: 'filled' };
270
- case 'danger':
271
- return { color: 'red', variant: 'filled' };
272
- case 'neutral':
273
- return { color: 'gray', variant: 'default' };
274
- default:
275
- return undefined;
276
- }
277
- }
278
-
279
- /**
280
- * Map a semantic intent to a HeroUI Native **Button** variant.
281
- *
282
- * HeroUI buttons have no dedicated success/warning variant. Rather than
283
- * silently collapse them, the dedicated status surfaces use
284
- * {@link mapIntentToHeroUiColor}; the Button variant maps success/warning to
285
- * `primary` because that is the closest *prominent* action affordance, and the
286
- * status color is carried separately. This is an explicit semantic choice, not
287
- * a clamp that hides an unsupported size/scale value.
288
- * primary -> primary
289
- * secondary -> secondary
290
- * success -> primary (status color carried by mapIntentToHeroUiColor)
291
- * warning -> primary (status color carried by mapIntentToHeroUiColor)
292
- * danger -> danger
293
- * neutral -> secondary
294
- */
295
- export function mapIntentToHeroUiButtonVariant(
296
- intent: TSemanticIntent | undefined,
297
- ): THeroUiButtonVariant | undefined {
298
- if (!intent) return undefined;
299
- switch (intent) {
300
- case 'primary':
301
- return 'primary';
302
- case 'secondary':
303
- return 'secondary';
304
- case 'success':
305
- return 'primary';
306
- case 'warning':
307
- return 'primary';
308
- case 'danger':
309
- return 'danger';
310
- case 'neutral':
311
- return 'secondary';
312
- default:
313
- return undefined;
314
- }
315
- }
316
-
317
- /**
318
- * Map a semantic intent to a HeroUI Native semantic color (Chip/Tag/
319
- * status surfaces, which DO support success/warning).
320
- * primary -> accent
321
- * secondary -> default
322
- * success -> success
323
- * warning -> warning
324
- * danger -> danger
325
- * neutral -> default
326
- */
327
- export function mapIntentToHeroUiColor(
328
- intent: TSemanticIntent | undefined,
329
- ): THeroUiColor | undefined {
330
- if (!intent) return undefined;
331
- switch (intent) {
332
- case 'primary':
333
- return 'accent';
334
- case 'secondary':
335
- return 'default';
336
- case 'success':
337
- return 'success';
338
- case 'warning':
339
- return 'warning';
340
- case 'danger':
341
- return 'danger';
342
- case 'neutral':
343
- return 'default';
344
- default:
345
- return undefined;
346
- }
347
- }
348
-
349
219
  // ===== color / variant (the REAL cross-platform appearance fields) =====
350
220
 
351
221
  /**
@@ -625,13 +495,6 @@ export function resolveSharedStyleProps(fields: Record<string, unknown>): IShare
625
495
  resolved.variant = variant as TSemanticVariant;
626
496
  }
627
497
 
628
- // Legacy: `shared_intent` is not in the live catalog, but keep reading it so
629
- // any forward-compat seed still resolves. Domain-checked like size/radius.
630
- const intent = readString(fields.shared_intent);
631
- if (intent !== undefined && (SEMANTIC_INTENTS as readonly string[]).includes(intent)) {
632
- resolved.intent = intent as TSemanticIntent;
633
- }
634
-
635
498
  const fullWidth = readBool(fields.full_width);
636
499
  if (fullWidth !== undefined) {
637
500
  resolved.fullWidth = fullWidth;
@@ -644,12 +507,11 @@ export function resolveSharedStyleProps(fields: Record<string, unknown>): IShare
644
507
 
645
508
  /** Resolve shared props into Mantine (web) props. */
646
509
  export function toMantineSemanticProps(props: ISharedStyleProps): IMantineResolvedStyle {
647
- const intent = mapIntentToMantine(props.intent);
648
510
  const spacing = props.spacing && props.spacing !== 'none' ? props.spacing : undefined;
649
511
  return {
650
512
  size: mapSizeToMantine(props.size),
651
- color: intent?.color,
652
- variant: intent?.variant,
513
+ color: props.color,
514
+ variant: props.variant,
653
515
  radius: mapRadiusToMantine(props.radius),
654
516
  spacing,
655
517
  disabled: hasState(props.states, 'disabled') || undefined,
@@ -666,16 +528,14 @@ export function toMantineSemanticProps(props: ISharedStyleProps): IMantineResolv
666
528
  * Appearance precedence (mirrors the web renderer, which reads the same CMS
667
529
  * fields straight into Mantine):
668
530
  * 1. `variant` (Mantine variant) mapped onto the HeroUI button vocab;
669
- * 2. else `color` (Mantine palette) mapped onto a button variant;
670
- * 3. else the legacy `intent` mapping (back-compat fallback).
671
- * The semantic `color` is resolved from `color` first, then `intent`.
531
+ * 2. else `color` (Mantine palette) mapped onto a button variant.
532
+ * The semantic `color` is resolved from `color`.
672
533
  */
673
534
  export function toHeroUiSemanticProps(props: ISharedStyleProps): IHeroUiResolvedStyle {
674
535
  const buttonVariant =
675
536
  mapMantineVariantToHeroUiButtonVariant(props.variant) ??
676
- mapMantineColorToHeroUiButtonVariant(props.color) ??
677
- mapIntentToHeroUiButtonVariant(props.intent);
678
- const color = mapMantineColorToHeroUiColor(props.color) ?? mapIntentToHeroUiColor(props.intent);
537
+ mapMantineColorToHeroUiButtonVariant(props.color);
538
+ const color = mapMantineColorToHeroUiColor(props.color);
679
539
  return {
680
540
  size: mapSizeToHeroUi(props.size),
681
541
  buttonVariant,
@@ -91,8 +91,8 @@ export const CONTAINER_SIZE_PX: Record<TMantineSize, number> = {
91
91
  /**
92
92
  * Mantine palette base colors (color-6 from each scale). Each renderer
93
93
  * maps these to its own theme tokens. For HeroUI Native we feed these
94
- * into the theme builder so `web_color: 'blue'` resolves to the
95
- * same Mantine-blue look on mobile.
94
+ * into the theme builder so the portable `color: 'blue'` field resolves
95
+ * to the same Mantine-blue look on mobile.
96
96
  */
97
97
  export const COLOR_PALETTE: Record<TCanonicalColor, string> = {
98
98
  gray: '#868e96',
@@ -10,6 +10,7 @@ import type {
10
10
  AdvisoryFeed,
11
11
  CompatibilityRules,
12
12
  CoreRelease,
13
+ MobilePreviewRelease,
13
14
  PluginRelease,
14
15
  RegistryIndex,
15
16
  } from '../distribution';
@@ -29,7 +30,7 @@ function readExample(name: string): Record<string, unknown> {
29
30
  const SPEC: Record<string, { required: string[]; optional?: string[]; kind?: string }> = {
30
31
  'registry-index.json': {
31
32
  required: ['schemaVersion', 'requiresManager', 'publishedAt', 'baseUrl', 'publisher', 'core', 'frontend', 'scheduler', 'worker', 'plugins'],
32
- optional: ['advisoriesUrl', 'compatibilityUrl', 'trustedKeysUrl'],
33
+ optional: ['mobilePreview', 'advisoriesUrl', 'compatibilityUrl', 'trustedKeysUrl'],
33
34
  },
34
35
  'core-release.json': {
35
36
  kind: 'selfhelp-core-release',
@@ -165,4 +166,57 @@ describe('distribution contracts compile and are usable', () => {
165
166
  expect(advisories.advisories[0]?.blocked).toBe(true);
166
167
  expect(compatibility.rules[0]?.runtime.mysql.recommendedImage).toBe('mysql:8.4');
167
168
  });
169
+
170
+ it('types a mobile-preview release with bundled plugins + renderer version', () => {
171
+ const preview: MobilePreviewRelease = {
172
+ kind: 'selfhelp-mobile-preview-release',
173
+ id: 'selfhelp-mobile-preview-0.2.0',
174
+ version: '0.2.0',
175
+ channel: 'stable',
176
+ image: 'ghcr.io/humdek-unibe-ch/selfhelp-mobile-preview:0.2.0',
177
+ digest: 'sha256:abc',
178
+ backendCompatibility: { requiredCoreRange: '>=0.1.0 <0.2.0', requiredApiVersion: '0.1.0' },
179
+ mobileRendererVersion: '0.1.0',
180
+ bundledPlugins: [
181
+ {
182
+ id: 'sh2-shp-survey-js',
183
+ version: '0.2.23',
184
+ mobilePackage: '@humdek/sh2-shp-survey-js-mobile',
185
+ mobilePackageVersion: '0.2.23',
186
+ },
187
+ ],
188
+ security: { signature: 'sig', keyId: 'selfhelp-dev-fixture' },
189
+ };
190
+ // Index can carry the additive mobilePreview ref array; a plugin can
191
+ // declare the additive compatibility.mobile axis.
192
+ const index: RegistryIndex = {
193
+ schemaVersion: '1.1',
194
+ requiresManager: '>=0.1.0',
195
+ publishedAt: '2026-06-23T12:00:00Z',
196
+ baseUrl: 'https://example/',
197
+ publisher: { name: 'SelfHelp', url: 'https://example/' },
198
+ core: [],
199
+ frontend: [],
200
+ scheduler: [],
201
+ worker: [],
202
+ plugins: [],
203
+ mobilePreview: [
204
+ { id: preview.id, version: preview.version, channel: 'stable', releaseUrl: 'releases/mobile-preview/x.json' },
205
+ ],
206
+ };
207
+ const plugin: PluginRelease = {
208
+ kind: 'selfhelp-plugin-release',
209
+ id: 'sh2-shp-survey-js',
210
+ version: '0.2.23',
211
+ channel: 'stable',
212
+ official: true,
213
+ compatibility: { core: '>=0.1.0 <0.2.0', pluginApi: '0.1.0', mobile: '>=0.1.0 <0.2.0' },
214
+ artifacts: { manifestUrl: 'm', archiveUrl: 'a', sha256: 'sha256:0' },
215
+ security: { signature: 'sig', keyId: 'selfhelp-dev-fixture' },
216
+ };
217
+ expect(preview.bundledPlugins[0]?.mobilePackage).toBe('@humdek/sh2-shp-survey-js-mobile');
218
+ expect(preview.mobileRendererVersion).toBe('0.1.0');
219
+ expect(index.mobilePreview?.[0]?.version).toBe('0.2.0');
220
+ expect(plugin.compatibility.mobile).toBe('>=0.1.0 <0.2.0');
221
+ });
168
222
  });
@@ -8,3 +8,4 @@ export * from './forms';
8
8
  export * from './language';
9
9
  export * from './page';
10
10
  export * from './system';
11
+ export * from './mobile-preview';
@@ -0,0 +1,71 @@
1
+ /*
2
+ SPDX-FileCopyrightText: 2026 Humdek, University of Bern
3
+ SPDX-License-Identifier: MPL-2.0
4
+ */
5
+ /**
6
+ * Mobile preview session contracts (CMS admin <-> backend <-> mobile-preview
7
+ * web image).
8
+ *
9
+ * Flow: the CMS admin mints a SHORT-LIVED, SINGLE-USE preview code (bound to the
10
+ * admin user + an optional scope). The `selfhelp-mobile-preview` web image
11
+ * exchanges that one-time code for an in-memory, scoped JWT
12
+ * (`purpose: 'mobile_preview'`) used for read-only `/cms-api` calls. The admin
13
+ * JWT is never exposed to the preview iframe.
14
+ *
15
+ * Snake_case is the wire contract (these mirror the backend JSON schemas under
16
+ * `config/schemas/api/v1/{requests,responses}/`).
17
+ */
18
+ import type { IBaseApiResponse } from './envelope';
19
+ import type { IUserData } from '../auth';
20
+
21
+ const MOBILE_PREVIEW_PREFIX = '/cms-api/v1';
22
+
23
+ /** Mobile preview session endpoints. */
24
+ export const MOBILE_PREVIEW_ENDPOINTS = {
25
+ /** Admin-only: mint a one-time preview session code. */
26
+ SESSION: `${MOBILE_PREVIEW_PREFIX}/admin/mobile-preview/session`,
27
+ /** Public: exchange a one-time code for a scoped preview JWT. */
28
+ EXCHANGE: `${MOBILE_PREVIEW_PREFIX}/mobile-preview/session/exchange`,
29
+ } as const;
30
+
31
+ /**
32
+ * POST /admin/mobile-preview/session — mint a one-time preview code. No
33
+ * `instance_id`: the backend derives + verifies the admin server-side. The
34
+ * optional scope is bound into the code and enforced on exchange.
35
+ */
36
+ export interface IMobilePreviewSessionRequest {
37
+ /** Page keyword to preview. */
38
+ keyword?: string;
39
+ /** Page id to preview (alternative to `keyword`). */
40
+ page_id?: number;
41
+ /** Language id to render in. */
42
+ language_id?: number;
43
+ /** Whether to preview the unpublished draft version. */
44
+ draft?: boolean;
45
+ }
46
+
47
+ export interface IMobilePreviewSessionData {
48
+ /** Opaque one-time code (safe in the iframe URL; invalid after exchange). */
49
+ code: string;
50
+ /** ISO-8601 expiry of the one-time code. */
51
+ expires_at: string;
52
+ }
53
+ export type IMobilePreviewSessionResponse = IBaseApiResponse<IMobilePreviewSessionData>;
54
+
55
+ /**
56
+ * POST /mobile-preview/session/exchange — public route; the one-time code IS the
57
+ * credential. Consumes (deletes) the code and mints a scoped preview JWT.
58
+ */
59
+ export interface IMobilePreviewExchangeRequest {
60
+ code: string;
61
+ }
62
+
63
+ export interface IMobilePreviewExchangeData {
64
+ /** Short-lived scoped JWT (`purpose: 'mobile_preview'`); held in memory only. */
65
+ access_token: string;
66
+ /** Seconds until the scoped token expires. */
67
+ expires_in: number;
68
+ /** The previewed user (the minting admin), for the preview UI. */
69
+ user: IUserData;
70
+ }
71
+ export type IMobilePreviewExchangeResponse = IBaseApiResponse<IMobilePreviewExchangeData>;
@@ -88,6 +88,8 @@ export interface InstanceVersions {
88
88
  frontend: string;
89
89
  scheduler: string;
90
90
  worker: string;
91
+ /** Mobile-preview web image version pinned for this instance (additive). */
92
+ mobilePreview?: string;
91
93
  pluginApi: string;
92
94
  }
93
95
 
@@ -99,6 +101,8 @@ export interface InstanceImages {
99
101
  mysql: string;
100
102
  redis: string;
101
103
  mercure: string;
104
+ /** Mobile-preview web image reference (additive). */
105
+ mobilePreview?: string;
102
106
  }
103
107
 
104
108
  export interface InstanceRouting {
@@ -205,6 +209,8 @@ export interface InstanceLock {
205
209
  version: string;
206
210
  backendImageDigest: string;
207
211
  frontendImageDigest: string;
212
+ /** Mobile-preview web image digest pinned for this instance (additive). */
213
+ mobilePreviewImageDigest?: string;
208
214
  schedulerImageDigest: string;
209
215
  workerImageDigest: string;
210
216
  migrationVersion: string;
@@ -245,6 +251,8 @@ export interface RegistryIndex {
245
251
  scheduler: RegistryReleaseRef[];
246
252
  worker: RegistryReleaseRef[];
247
253
  plugins: RegistryReleaseRef[];
254
+ /** Mobile-preview web image release refs (additive; older managers ignore). */
255
+ mobilePreview?: RegistryReleaseRef[];
248
256
  advisoriesUrl?: string;
249
257
  compatibilityUrl?: string;
250
258
  trustedKeysUrl?: string;
@@ -349,13 +357,58 @@ export interface WorkerRelease {
349
357
  blocked?: boolean;
350
358
  }
351
359
 
360
+ /**
361
+ * One plugin mobile package baked into a mobile-preview image at build time.
362
+ * The preview CI runs `plugins-sync.mjs` against a curated official-plugin set
363
+ * and records the result here so the manager can compute coverage (which
364
+ * enabled plugins render natively vs. fall back to open-on-web in the preview)
365
+ * without inspecting the image.
366
+ */
367
+ export interface BundledPluginRef {
368
+ id: string;
369
+ version: string;
370
+ mobilePackage: string;
371
+ mobilePackageVersion: string;
372
+ }
373
+
374
+ /**
375
+ * Mobile-preview web image release, resolved/pinned as a first-class artifact
376
+ * (peer of the frontend release). The image serves the Expo web export at
377
+ * `/mobile-preview` and proxies a narrow `/mobile-preview/api` allowlist to the
378
+ * private backend. `mobileRendererVersion` is the mobile renderer contract the
379
+ * image was built against (what plugin `compatibility.mobile` ranges target);
380
+ * `bundledPlugins` is the curated official-plugin set baked into the image.
381
+ */
382
+ export interface MobilePreviewRelease {
383
+ kind: 'selfhelp-mobile-preview-release';
384
+ id: string;
385
+ version: string;
386
+ channel: ReleaseChannel;
387
+ image: string;
388
+ digest: string;
389
+ builtFrom?: { sharedPackageVersion?: string; expoSdk?: string; reactNative?: string };
390
+ backendCompatibility: ServiceBackendCompatibility;
391
+ /** Mobile renderer contract version advertised by this image (semver). */
392
+ mobileRendererVersion: string;
393
+ /** Curated plugin mobile packages baked into the image. */
394
+ bundledPlugins: BundledPluginRef[];
395
+ security: SignatureBlock;
396
+ blocked?: boolean;
397
+ }
398
+
352
399
  export interface PluginRelease {
353
400
  kind: 'selfhelp-plugin-release';
354
401
  id: string;
355
402
  version: string;
356
403
  channel: ReleaseChannel;
357
404
  official: boolean;
358
- compatibility: { core: string; pluginApi: string };
405
+ /**
406
+ * Compatibility ranges the host must satisfy. `mobile` (additive) is the
407
+ * NEW mobile-renderer axis: the range of host `mobileRendererVersion` the
408
+ * plugin's mobile package supports (parallel to `pluginApi`). Absent for
409
+ * web-only plugins.
410
+ */
411
+ compatibility: { core: string; pluginApi: string; mobile?: string };
359
412
  dependencies?: { plugins: { id: string; range: string }[] };
360
413
  artifacts: { manifestUrl: string; archiveUrl: string; sha256: string };
361
414
  security: SignatureBlock;
@@ -15,14 +15,15 @@ export type TMantineRadius = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | string;
15
15
  export type TMantineSpacing = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'none' | string;
16
16
 
17
17
  /**
18
- * Cross-platform (`shared_*`) semantic scales — the TRUE common denominator
18
+ * Cross-platform semantic scales — the TRUE common denominator
19
19
  * between Mantine (web) and HeroUI Native / React Native (mobile). HeroUI Native
20
- * only exposes `sm | md | lg`, so portable `size` / `radius` fields
20
+ * only exposes `sm | md | lg`, so the portable unprefixed `size` / `radius` fields
21
21
  * use these narrowed scales instead of the full Mantine `xs..xl` range. The
22
22
  * backend enforces the same domain (migration `Version20260618195450`), and the
23
23
  * semantic mapper (`theme/semantic.ts`) maps these 1:1 without clamping.
24
24
  *
25
- * Web-only `web_size` / `web_radius` keep the full `TMantineSize` / `TMantineRadius`.
25
+ * Genuinely web-specific size/radius fields (typed `TMantineSize` / `TMantineRadius`)
26
+ * keep the full Mantine range.
26
27
  */
27
28
  export type TSharedSize = 'sm' | 'md' | 'lg';
28
29
  export type TSharedRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
@@ -65,6 +65,6 @@ export interface IBaseStyle {
65
65
 
66
66
  /** Styles that support the unified spacing field. */
67
67
  export interface IStyleWithSpacing extends IBaseStyle {
68
- /** Portable box-model spacing (margin + padding). Backend field `spacing`; RF-15 merged the legacy margin-only `web_spacing_margin` into this, so every spacing-capable style now uses it. */
68
+ /** Portable box-model spacing (margin + padding). Backend field `spacing`; every spacing-capable style uses this single unified field. */
69
69
  spacing?: IContentField<string>;
70
70
  }
@@ -6,7 +6,6 @@ import type { IBaseStyle, IContentField, IStyleWithSpacing } from './base';
6
6
  import type {
7
7
  TMantineColor,
8
8
  TMantineRadius,
9
- TMantineSpacing,
10
9
  TMantineOrientation,
11
10
  TMantineAccordionVariant,
12
11
  TMantineTabsVariant,
@@ -109,7 +108,6 @@ export interface ITimelineItemStyle extends IBaseStyle {
109
108
  export interface IListStyle extends IStyleWithSpacing {
110
109
  style_name: 'list';
111
110
  web_list_type?: IContentField<TMantineListType>;
112
- web_spacing?: IContentField<TMantineSpacing>;
113
111
  size?: IContentField<TSharedSize>; web_list_list_style_type?: IContentField<TMantineListStyleType>;
114
112
  web_list_with_padding?: IContentField<TMantineListWithPadding>;
115
113
  web_list_center?: IContentField<TMantineListCenter>;