@selfhelp/shared 1.14.10 → 1.14.13

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.
@@ -343,6 +343,48 @@ function mapChipVariantToHeroUiVariant(variant) {
343
343
  return "primary";
344
344
  }
345
345
  }
346
+ function parseDimensionToReactNative(value) {
347
+ if (value === void 0 || value === null) return void 0;
348
+ if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
349
+ const trimmed = value.trim();
350
+ if (trimmed === "") return void 0;
351
+ if (trimmed === "auto") return "auto";
352
+ const pct = /^(\d+(?:\.\d+)?)%$/.exec(trimmed);
353
+ if (pct) {
354
+ const n = Number(pct[1]);
355
+ return `${n}%`;
356
+ }
357
+ const px2 = /^(\d+(?:\.\d+)?)(?:px)?$/.exec(trimmed);
358
+ if (px2) return Number(px2[1]);
359
+ return void 0;
360
+ }
361
+ function parseDimensionToWeb(value) {
362
+ if (value === void 0 || value === null) return void 0;
363
+ if (typeof value === "number") return value;
364
+ const trimmed = value.trim();
365
+ return trimmed === "" ? void 0 : trimmed;
366
+ }
367
+ function gridSpanToReactNativeColumn(span, cols = 12) {
368
+ const totalCols = cols > 0 ? cols : 12;
369
+ if (span === "auto") return { flexBasis: 0, flexGrow: 1, flexShrink: 1 };
370
+ if (span === "content") return { flexBasis: "auto", flexGrow: 0, flexShrink: 0 };
371
+ const n = typeof span === "number" ? span : Number.parseInt(String(span ?? ""), 10);
372
+ if (!Number.isFinite(n) || n <= 0) return { flexBasis: "100%", flexGrow: 0, flexShrink: 1 };
373
+ const clamped = Math.min(n, totalCols);
374
+ const pct = Math.round(clamped / totalCols * 1e4) / 100;
375
+ return { flexBasis: `${pct}%`, flexGrow: 0, flexShrink: 1 };
376
+ }
377
+ function mapDividerVariantToReactNative(variant) {
378
+ switch (variant) {
379
+ case "dashed":
380
+ return "dashed";
381
+ case "dotted":
382
+ return "dotted";
383
+ case "solid":
384
+ default:
385
+ return "solid";
386
+ }
387
+ }
346
388
  function hasState(states, state) {
347
389
  return !!states && states.includes(state);
348
390
  }
@@ -539,8 +581,10 @@ export {
539
581
  SPACING_PX,
540
582
  SPACING_TO_TAILWIND,
541
583
  colorToHex,
584
+ gridSpanToReactNativeColumn,
542
585
  mapAccordionVariantToHeroUiVariant,
543
586
  mapChipVariantToHeroUiVariant,
587
+ mapDividerVariantToReactNative,
544
588
  mapIntentToHeroUiButtonVariant,
545
589
  mapIntentToHeroUiColor,
546
590
  mapIntentToMantine,
@@ -552,6 +596,8 @@ export {
552
596
  mapSizeToHeroUi,
553
597
  mapSizeToMantine,
554
598
  mapSpacingToPx,
599
+ parseDimensionToReactNative,
600
+ parseDimensionToWeb,
555
601
  radiusToPx,
556
602
  resolveMantineVariant,
557
603
  resolveSharedStyle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selfhelp/shared",
3
- "version": "1.14.10",
3
+ "version": "1.14.13",
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",
@@ -34,6 +34,24 @@ describe('classifyClass (css_mobile classifier)', () => {
34
34
  expect(classifyClass('grid-cols-7').kind).toBe('drop');
35
35
  expect(classifyClass('').kind).toBe('drop');
36
36
  });
37
+
38
+ it('remaps the web dropdown standard Tailwind color scale onto the Mantine hex scale (RN-safe)', () => {
39
+ // Tailwind v4 default palette is oklch and crashes RN, so the standard
40
+ // scale the dropdown offers is rewritten onto the hex-backed Mantine scale.
41
+ expect(classifyClass('bg-blue-500')).toMatchObject({ kind: 'remap', from: 'bg-blue-500', to: 'bg-blue-6' });
42
+ expect(classifyClass('bg-green-600')).toMatchObject({ kind: 'remap', to: 'bg-green-7' });
43
+ expect(classifyClass('bg-gray-800')).toMatchObject({ kind: 'remap', to: 'bg-gray-9' });
44
+ expect(classifyClass('text-indigo-700')).toMatchObject({ kind: 'remap', to: 'text-indigo-8' });
45
+ expect(classifyClass('border-red-500')).toMatchObject({ kind: 'remap', to: 'border-red-6' });
46
+ // Tailwind-only names alias to the nearest Mantine palette.
47
+ expect(classifyClass('bg-purple-500')).toMatchObject({ kind: 'remap', to: 'bg-grape-6' });
48
+ expect(classifyClass('bg-slate-700')).toMatchObject({ kind: 'remap', to: 'bg-gray-8' });
49
+ });
50
+
51
+ it('allows text-white / text-black (plain colors, RN-safe)', () => {
52
+ expect(classifyClass('text-white').kind).toBe('allow');
53
+ expect(classifyClass('text-black').kind).toBe('allow');
54
+ });
37
55
  });
38
56
 
39
57
  describe('classifyClassString', () => {
@@ -85,7 +85,7 @@ export const CLASS_PATTERNS: readonly IClassPattern[] = [
85
85
  { prefix: 'max-w-', values: [...SIZE_VALUES, 'full', 'fit', 'screen', 'none'] },
86
86
  { prefix: 'max-h-', values: [...SIZE_VALUES, 'full', 'screen', 'none'] },
87
87
  // typography
88
- { prefix: 'text-', values: [...SIZE_VALUES, 'left', 'center', 'right', 'justify', ...COLOR_SCALE_VALUES] },
88
+ { prefix: 'text-', values: [...SIZE_VALUES, 'left', 'center', 'right', 'justify', 'white', 'black', ...COLOR_SCALE_VALUES] },
89
89
  { prefix: 'font-', values: ['thin', 'light', 'normal', 'medium', 'semibold', 'bold', 'extrabold', 'black'] },
90
90
  { prefix: 'leading-', values: ['none', 'tight', 'snug', 'normal', 'relaxed', 'loose'] },
91
91
  { prefix: 'tracking-', values: ['tighter', 'tight', 'normal', 'wide', 'wider', 'widest'] },
@@ -22,10 +22,100 @@ export interface IClassRemap {
22
22
  reason?: string;
23
23
  }
24
24
 
25
+ /**
26
+ * Standard Tailwind numeric color scale (`50..950`) → Mantine hex-backed
27
+ * scale index (`0..9`). The web dropdown (`generate-css-classes.js`) offers
28
+ * the standard Tailwind scale, but Tailwind v4's default palette is authored
29
+ * in `oklch()`, which React Native cannot parse — only the Mantine palettes
30
+ * carried by the shared preset (`theme/tailwind.ts`, indices `0..9`) resolve
31
+ * to RN-safe hex. So we rewrite the dropdown's standard scale onto the Mantine
32
+ * scale instead of dropping it. The shade is the closest visual match; this is
33
+ * a deliberate, documented web→mobile remap.
34
+ */
35
+ const TW_SCALE_TO_MANTINE: Readonly<Record<string, string>> = {
36
+ '50': '0',
37
+ '100': '1',
38
+ '200': '2',
39
+ '300': '3',
40
+ '400': '4',
41
+ '500': '6',
42
+ '600': '7',
43
+ '700': '8',
44
+ '800': '9',
45
+ '900': '9',
46
+ '950': '9',
47
+ };
48
+
49
+ /**
50
+ * Tailwind color name → Mantine palette name. Only Mantine palettes have an
51
+ * RN-safe hex scale in the shared preset; Tailwind-only names (`slate`,
52
+ * `purple`, `sky`, …) are aliased to their nearest Mantine palette.
53
+ */
54
+ const TW_NAME_TO_MANTINE: Readonly<Record<string, string>> = {
55
+ slate: 'gray',
56
+ gray: 'gray',
57
+ zinc: 'gray',
58
+ neutral: 'gray',
59
+ stone: 'gray',
60
+ red: 'red',
61
+ rose: 'pink',
62
+ pink: 'pink',
63
+ fuchsia: 'grape',
64
+ purple: 'grape',
65
+ grape: 'grape',
66
+ violet: 'violet',
67
+ indigo: 'indigo',
68
+ blue: 'blue',
69
+ sky: 'cyan',
70
+ cyan: 'cyan',
71
+ teal: 'teal',
72
+ emerald: 'green',
73
+ green: 'green',
74
+ lime: 'lime',
75
+ yellow: 'yellow',
76
+ amber: 'orange',
77
+ orange: 'orange',
78
+ };
79
+
80
+ const COLOR_PREFIXES = ['bg-', 'text-', 'border-'] as const;
81
+
82
+ /** Build the `{prefix}{twName}-{twScale}` → `{prefix}{mantineName}-{idx}` remaps. */
83
+ function buildColorScaleRemaps(): IClassRemap[] {
84
+ const out: IClassRemap[] = [];
85
+ for (const prefix of COLOR_PREFIXES) {
86
+ for (const [twName, mantineName] of Object.entries(TW_NAME_TO_MANTINE)) {
87
+ for (const [twScale, idx] of Object.entries(TW_SCALE_TO_MANTINE)) {
88
+ out.push({
89
+ from: `${prefix}${twName}-${twScale}`,
90
+ to: `${prefix}${mantineName}-${idx}`,
91
+ reason: 'tailwind oklch scale → mantine hex scale (RN-safe)',
92
+ });
93
+ }
94
+ }
95
+ }
96
+ return out;
97
+ }
98
+
99
+ /** Interactive-state classes the web dropdown offers but RN can't honour. */
100
+ const INTERACTIVE_DROP = [
101
+ 'hover:bg-gray-100',
102
+ 'hover:bg-blue-600',
103
+ 'hover:bg-green-600',
104
+ 'hover:bg-red-600',
105
+ 'hover:text-blue-600',
106
+ 'hover:text-green-600',
107
+ 'hover:text-red-600',
108
+ 'hover:shadow-md',
109
+ 'hover:shadow-lg',
110
+ 'hover:underline',
111
+ 'focus:outline-none',
112
+ 'focus:ring-2',
113
+ 'focus:ring-blue-500',
114
+ 'focus:ring-offset-2',
115
+ ].map((from): IClassRemap => ({ from, to: null, reason: 'interactive state not applicable on mobile' }));
116
+
25
117
  export const CLASS_REMAP: readonly IClassRemap[] = [
26
- // hover/focus on mobile only fires for keyboard nav; safe to drop.
27
- { from: 'hover:bg-gray-100', to: null, reason: 'hover not applicable on mobile' },
28
- { from: 'hover:underline', to: null, reason: 'hover not applicable on mobile' },
118
+ ...INTERACTIVE_DROP,
29
119
  // cursor classes are no-ops on RN.
30
120
  { from: 'cursor-pointer', to: null, reason: 'no cursor on RN' },
31
121
  { from: 'cursor-default', to: null, reason: 'no cursor on RN' },
@@ -35,6 +125,8 @@ export const CLASS_REMAP: readonly IClassRemap[] = [
35
125
  // legacy aliases
36
126
  { from: 'mantine-fw', to: 'w-full' },
37
127
  { from: 'mantine-h-full', to: 'h-full' },
128
+ // standard Tailwind color scale → Mantine hex scale (RN-safe)
129
+ ...buildColorScaleRemaps(),
38
130
  ];
39
131
 
40
132
  const REMAP_MAP = new Map<string, IClassRemap>(CLASS_REMAP.map((r) => [r.from, r]));
@@ -5,6 +5,8 @@ SPDX-License-Identifier: MPL-2.0
5
5
  import { describe, expect, it } from 'vitest';
6
6
  import {
7
7
  FULL_RADIUS_PX,
8
+ gridSpanToReactNativeColumn,
9
+ mapDividerVariantToReactNative,
8
10
  mapIntentToHeroUiButtonVariant,
9
11
  mapIntentToHeroUiColor,
10
12
  mapIntentToMantine,
@@ -18,6 +20,8 @@ import {
18
20
  mapSizeToHeroUi,
19
21
  mapSizeToMantine,
20
22
  mapSpacingToPx,
23
+ parseDimensionToReactNative,
24
+ parseDimensionToWeb,
21
25
  resolveSharedStyle,
22
26
  resolveSharedStyleProps,
23
27
  toHeroUiSemanticProps,
@@ -315,4 +319,77 @@ describe('semantic style mapper', () => {
315
319
  expect(toReactNativeSemanticStyle({})).toEqual({});
316
320
  });
317
321
  });
322
+
323
+ describe('layout dimensions (shared_width/height)', () => {
324
+ it('strips the px suffix to a unitless number for React Native', () => {
325
+ expect(parseDimensionToReactNative('320px')).toBe(320);
326
+ expect(parseDimensionToReactNative('320')).toBe(320);
327
+ expect(parseDimensionToReactNative(320)).toBe(320);
328
+ });
329
+
330
+ it('keeps percentages and auto for React Native', () => {
331
+ expect(parseDimensionToReactNative('50%')).toBe('50%');
332
+ expect(parseDimensionToReactNative('auto')).toBe('auto');
333
+ });
334
+
335
+ it('returns undefined for empty/invalid dimensions (renderer keeps its default)', () => {
336
+ expect(parseDimensionToReactNative('')).toBeUndefined();
337
+ expect(parseDimensionToReactNative(' ')).toBeUndefined();
338
+ expect(parseDimensionToReactNative(undefined)).toBeUndefined();
339
+ expect(parseDimensionToReactNative(null)).toBeUndefined();
340
+ expect(parseDimensionToReactNative('10rem')).toBeUndefined();
341
+ });
342
+
343
+ it('passes a dimension through verbatim for web (Mantine)', () => {
344
+ expect(parseDimensionToWeb('320px')).toBe('320px');
345
+ expect(parseDimensionToWeb('100%')).toBe('100%');
346
+ expect(parseDimensionToWeb('auto')).toBe('auto');
347
+ expect(parseDimensionToWeb('')).toBeUndefined();
348
+ expect(parseDimensionToWeb(undefined)).toBeUndefined();
349
+ });
350
+ });
351
+
352
+ describe('grid span -> React Native column', () => {
353
+ it('converts a numeric span to a flex-basis percentage of cols', () => {
354
+ expect(gridSpanToReactNativeColumn(6, 12)).toEqual({
355
+ flexBasis: '50%',
356
+ flexGrow: 0,
357
+ flexShrink: 1,
358
+ });
359
+ expect(gridSpanToReactNativeColumn(1, 4)).toEqual({
360
+ flexBasis: '25%',
361
+ flexGrow: 0,
362
+ flexShrink: 1,
363
+ });
364
+ });
365
+
366
+ it('grows to share space for "auto" and sizes to content for "content"', () => {
367
+ expect(gridSpanToReactNativeColumn('auto')).toEqual({
368
+ flexBasis: 0,
369
+ flexGrow: 1,
370
+ flexShrink: 1,
371
+ });
372
+ expect(gridSpanToReactNativeColumn('content')).toEqual({
373
+ flexBasis: 'auto',
374
+ flexGrow: 0,
375
+ flexShrink: 0,
376
+ });
377
+ });
378
+
379
+ it('clamps an oversized span and falls back to a full row for invalid input', () => {
380
+ expect(gridSpanToReactNativeColumn(99, 12).flexBasis).toBe('100%');
381
+ expect(gridSpanToReactNativeColumn('nope', 12).flexBasis).toBe('100%');
382
+ expect(gridSpanToReactNativeColumn(0, 12).flexBasis).toBe('100%');
383
+ });
384
+ });
385
+
386
+ describe('divider variant -> React Native borderStyle', () => {
387
+ it('maps the identical vocabulary and defaults to solid', () => {
388
+ expect(mapDividerVariantToReactNative('solid')).toBe('solid');
389
+ expect(mapDividerVariantToReactNative('dashed')).toBe('dashed');
390
+ expect(mapDividerVariantToReactNative('dotted')).toBe('dotted');
391
+ expect(mapDividerVariantToReactNative(undefined)).toBe('solid');
392
+ expect(mapDividerVariantToReactNative('bogus')).toBe('solid');
393
+ });
394
+ });
318
395
  });
@@ -475,6 +475,101 @@ export function mapChipVariantToHeroUiVariant(
475
475
  }
476
476
  }
477
477
 
478
+ // ===== layout dimensions (shared_width / shared_height / grid span / divider) =====
479
+
480
+ /** A React Native-safe dimension: a px number, a percentage string, or "auto". */
481
+ export type TReactNativeDimension = number | `${number}%` | 'auto';
482
+
483
+ /**
484
+ * Parse a CMS dimension string (`shared_width`/`shared_height`/`shared_mi*`/
485
+ * `shared_ma*`) into a React Native-safe value. Web (Mantine) accepts the raw
486
+ * string verbatim ("320px", "100%", "auto"); React Native does NOT accept a
487
+ * unit suffix, so a px value must become a unitless number:
488
+ * "320px" | "320" | 320 -> 320 (number)
489
+ * "50%" -> "50%" (percentage string)
490
+ * "auto" -> "auto"
491
+ * ""/undefined/unknown -> undefined (renderer keeps its default)
492
+ */
493
+ export function parseDimensionToReactNative(
494
+ value: string | number | undefined | null,
495
+ ): TReactNativeDimension | undefined {
496
+ if (value === undefined || value === null) return undefined;
497
+ if (typeof value === 'number') return Number.isFinite(value) ? value : undefined;
498
+ const trimmed = value.trim();
499
+ if (trimmed === '') return undefined;
500
+ if (trimmed === 'auto') return 'auto';
501
+ const pct = /^(\d+(?:\.\d+)?)%$/.exec(trimmed);
502
+ if (pct) {
503
+ const n = Number(pct[1]);
504
+ return `${n}%`;
505
+ }
506
+ const px = /^(\d+(?:\.\d+)?)(?:px)?$/.exec(trimmed);
507
+ if (px) return Number(px[1]);
508
+ return undefined;
509
+ }
510
+
511
+ /**
512
+ * Web pass-through for a CMS dimension: Mantine accepts "320px"/"100%"/"auto"
513
+ * verbatim. Returns undefined for empty so the renderer omits the prop.
514
+ */
515
+ export function parseDimensionToWeb(
516
+ value: string | number | undefined | null,
517
+ ): string | number | undefined {
518
+ if (value === undefined || value === null) return undefined;
519
+ if (typeof value === 'number') return value;
520
+ const trimmed = value.trim();
521
+ return trimmed === '' ? undefined : trimmed;
522
+ }
523
+
524
+ /** React Native flex layout for one emulated grid column. */
525
+ export interface IReactNativeGridColumn {
526
+ flexBasis: TReactNativeDimension;
527
+ flexGrow: number;
528
+ flexShrink: number;
529
+ }
530
+
531
+ /**
532
+ * Convert a Mantine `Grid.Col` span into a React Native flex layout for the
533
+ * emulated mobile grid. `cols` is the parent grid's column count (Mantine
534
+ * default 12).
535
+ * number -> a flex-basis percentage of (span / cols)
536
+ * "auto" -> grow to share remaining space (flexGrow 1, basis 0)
537
+ * "content" -> size to content (no grow/shrink, basis auto)
538
+ * invalid -> full row ("100%")
539
+ */
540
+ export function gridSpanToReactNativeColumn(
541
+ span: string | number | undefined | null,
542
+ cols: number = 12,
543
+ ): IReactNativeGridColumn {
544
+ const totalCols = cols > 0 ? cols : 12;
545
+ if (span === 'auto') return { flexBasis: 0, flexGrow: 1, flexShrink: 1 };
546
+ if (span === 'content') return { flexBasis: 'auto', flexGrow: 0, flexShrink: 0 };
547
+ const n = typeof span === 'number' ? span : Number.parseInt(String(span ?? ''), 10);
548
+ if (!Number.isFinite(n) || n <= 0) return { flexBasis: '100%', flexGrow: 0, flexShrink: 1 };
549
+ const clamped = Math.min(n, totalCols);
550
+ const pct = Math.round((clamped / totalCols) * 10000) / 100;
551
+ return { flexBasis: `${pct}%`, flexGrow: 0, flexShrink: 1 };
552
+ }
553
+
554
+ /**
555
+ * Map a `shared_divider_variant` (solid/dashed/dotted) onto a React Native
556
+ * `borderStyle`. The vocabularies are identical, so this validates the domain
557
+ * and falls back to 'solid'.
558
+ */
559
+ export function mapDividerVariantToReactNative(
560
+ variant: string | undefined | null,
561
+ ): 'solid' | 'dashed' | 'dotted' {
562
+ switch (variant) {
563
+ case 'dashed':
564
+ return 'dashed';
565
+ case 'dotted':
566
+ return 'dotted';
567
+ case 'solid':
568
+ default:
569
+ return 'solid';
570
+ }
571
+ }
572
+
478
573
  // ===== state helpers =====
479
574
 
480
575
  function hasState(states: readonly TSemanticState[] | undefined, state: TSemanticState): boolean {
@@ -4,7 +4,6 @@ SPDX-License-Identifier: MPL-2.0
4
4
  */
5
5
  import type { IBaseStyle, IContentField, IStyleWithSpacing } from './base';
6
6
  import type {
7
- TMantineSpacing,
8
7
  TMantineColor,
9
8
  TMantineOrientation,
10
9
  TMantineDirection,
@@ -12,34 +11,43 @@ import type {
12
11
  TMantineJustify,
13
12
  TMantineAlign,
14
13
  TMantineGridSpan,
14
+ TMantineGridGrow,
15
+ TMantineGridOverflow,
15
16
  TSharedSize,
16
17
  TSharedRadius,
17
18
  } from '../mantine/common';
18
19
 
19
20
  // Style-specific helper types only used in layout interfaces
20
21
  export type TMantineBorder = '0' | '1';
21
- // Cross-platform border toggle (card family): Mantine `withBorder` on web,
22
- // a themed border/divider on mobile.
22
+ // Cross-platform border toggle (card family + paper): Mantine `withBorder` on
23
+ // web, a themed border on mobile.
23
24
  export type TSharedBorder = '0' | '1';
25
+ // Cross-platform width/height/min/max dimension (e.g. "100%", "320px", "auto").
26
+ // Drives the web (Mantine) and the mobile (RN flexbox) renderer via the mapper.
27
+ export type TSharedDimension = string;
24
28
  export type TMantineWidth = string;
25
29
  export type TMantineHeight = string;
30
+ // Cross-platform divider line style (Mantine `variant` / RN `borderStyle`).
31
+ export type TSharedDividerVariant = 'solid' | 'dashed' | 'dotted';
32
+ export type TSharedDividerLabelPosition = 'left' | 'center' | 'right';
26
33
  export type TMantineDividerVariant = 'solid' | 'dashed' | 'dotted';
27
34
  export type TMantinePaperShadow = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
28
35
  export type TMantineCardShadow = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
29
36
  export type TMantineCardPadding = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
30
37
  export type TMantineGap = '0' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
38
+ // Cross-platform grid column count (string-encoded integer).
39
+ export type TSharedCols = string;
31
40
  export type TMantineCols = string;
32
41
  export type TMantineGridOffset = string;
33
42
  export type TMantineGridOrder = string;
34
43
  export type TMantineScrollAreaSize = string;
35
- export type TMantineScrollAreaType = 'hover' | 'always' | 'never' | 'scroll';
44
+ export type TMantineScrollAreaType = 'hover' | 'always' | 'auto' | 'never' | 'scroll';
36
45
 
37
46
  export interface IContainerStyle extends IStyleWithSpacing {
38
47
  style_name: 'container';
39
48
  shared_size?: IContentField<TSharedSize>;
40
49
  web_fluid?: IContentField<string>;
41
- web_px?: IContentField<TMantineSpacing>;
42
- web_py?: IContentField<TMantineSpacing>;}
50
+ }
43
51
 
44
52
  export interface IBoxStyle extends IStyleWithSpacing {
45
53
  style_name: 'box';
@@ -52,8 +60,8 @@ export interface IFlexStyle extends IStyleWithSpacing {
52
60
  shared_align?: IContentField<TMantineAlign>;
53
61
  shared_direction?: IContentField<TMantineDirection>;
54
62
  shared_wrap?: IContentField<TMantineWrap>;
55
- web_width?: IContentField<TMantineWidth>;
56
- web_height?: IContentField<TMantineHeight>;
63
+ shared_width?: IContentField<TSharedDimension>;
64
+ shared_height?: IContentField<TSharedDimension>;
57
65
  }
58
66
 
59
67
  export interface IGroupStyle extends IStyleWithSpacing {
@@ -61,10 +69,10 @@ export interface IGroupStyle extends IStyleWithSpacing {
61
69
  shared_gap?: IContentField<TMantineGap>;
62
70
  shared_justify?: IContentField<TMantineJustify>;
63
71
  shared_align?: IContentField<TMantineAlign>;
72
+ shared_width?: IContentField<TSharedDimension>;
73
+ shared_height?: IContentField<TSharedDimension>;
64
74
  web_group_wrap?: IContentField<'0' | '1'>;
65
75
  web_group_grow?: IContentField<'0' | '1'>;
66
- web_width?: IContentField<TMantineWidth>;
67
- web_height?: IContentField<TMantineHeight>;
68
76
  }
69
77
 
70
78
  export interface IStackStyle extends IStyleWithSpacing {
@@ -72,71 +80,77 @@ export interface IStackStyle extends IStyleWithSpacing {
72
80
  shared_gap?: IContentField<TMantineGap>;
73
81
  shared_justify?: IContentField<TMantineJustify>;
74
82
  shared_align?: IContentField<TMantineAlign>;
75
- web_width?: IContentField<TMantineWidth>;
76
- web_height?: IContentField<TMantineHeight>;
83
+ shared_width?: IContentField<TSharedDimension>;
84
+ shared_height?: IContentField<TSharedDimension>;
77
85
  }
78
86
 
79
87
  export interface ISimpleGridStyle extends IStyleWithSpacing {
80
88
  style_name: 'simple-grid';
81
- web_cols?: IContentField<TMantineCols>;
82
- web_spacing?: IContentField<TMantineSpacing>;
83
- web_breakpoints?: IContentField<string>;
84
- web_vertical_spacing?: IContentField<TMantineSpacing>;
85
- web_width?: IContentField<TMantineWidth>;
86
- web_height?: IContentField<TMantineHeight>;
89
+ shared_cols?: IContentField<TSharedCols>;
90
+ shared_gap?: IContentField<TMantineGap>;
91
+ shared_vertical_spacing?: IContentField<TMantineGap>;
92
+ shared_width?: IContentField<TSharedDimension>;
93
+ shared_height?: IContentField<TSharedDimension>;
94
+ // Web-only responsive column overrides; clear to inherit shared_cols.
95
+ web_cols_sm?: IContentField<TSharedCols>;
96
+ web_cols_md?: IContentField<TSharedCols>;
97
+ web_cols_lg?: IContentField<TSharedCols>;
87
98
  }
88
99
 
89
100
  export interface IGridStyle extends IStyleWithSpacing {
90
101
  style_name: 'grid';
91
- web_cols?: IContentField<TMantineCols>;
102
+ shared_cols?: IContentField<TSharedCols>;
92
103
  shared_gap?: IContentField<TMantineGap>;
93
104
  shared_justify?: IContentField<TMantineJustify>;
94
105
  shared_align?: IContentField<TMantineAlign>;
95
- web_grid_overflow?: IContentField<string>;
96
- web_width?: IContentField<TMantineWidth>;
97
- web_height?: IContentField<TMantineHeight>;}
106
+ shared_width?: IContentField<TSharedDimension>;
107
+ shared_height?: IContentField<TSharedDimension>;
108
+ web_grid_overflow?: IContentField<TMantineGridOverflow>;
109
+ }
98
110
 
99
111
  export interface IGridColumnStyle extends IStyleWithSpacing {
100
112
  style_name: 'grid-column';
101
- web_grid_span?: IContentField<TMantineGridSpan>;
102
- web_grid_offset?: IContentField<TMantineGridOffset>;
103
- web_grid_order?: IContentField<TMantineGridOrder>;
104
- web_grid_grow?: IContentField<string>;
105
- web_width?: IContentField<TMantineWidth>;
106
- web_height?: IContentField<TMantineHeight>;}
113
+ shared_grid_span?: IContentField<TMantineGridSpan>;
114
+ shared_grid_offset?: IContentField<TMantineGridOffset>;
115
+ shared_grid_order?: IContentField<TMantineGridOrder>;
116
+ shared_grid_grow?: IContentField<TMantineGridGrow>;
117
+ shared_width?: IContentField<TSharedDimension>;
118
+ shared_height?: IContentField<TSharedDimension>;
119
+ }
107
120
 
108
121
  export interface ISpaceStyle extends IStyleWithSpacing {
109
122
  style_name: 'space';
110
123
  shared_size?: IContentField<TSharedSize>;
111
- web_space_direction?: IContentField<string>;
124
+ shared_orientation?: IContentField<TMantineOrientation>;
112
125
  }
113
126
 
114
- export interface IDividerStyle extends IBaseStyle {
127
+ export interface IDividerStyle extends IStyleWithSpacing {
115
128
  style_name: 'divider';
116
- web_divider_variant?: IContentField<TMantineDividerVariant>;
129
+ shared_divider_variant?: IContentField<TSharedDividerVariant>;
117
130
  shared_size?: IContentField<TSharedSize>;
118
131
  divider_label?: IContentField<string>;
119
- web_divider_label_position?: IContentField<string>;
132
+ shared_divider_label_position?: IContentField<TSharedDividerLabelPosition>;
120
133
  shared_orientation?: IContentField<TMantineOrientation>;
121
134
  shared_color?: IContentField<TMantineColor>;}
122
135
 
123
136
  export interface IPaperStyle extends IStyleWithSpacing {
124
137
  style_name: 'paper';
138
+ // Optional auto-styled heading rendered above the content when non-empty;
139
+ // never auto-creates a child section.
140
+ title?: IContentField<string>;
125
141
  web_paper_shadow?: IContentField<TMantinePaperShadow>;
126
142
  shared_radius?: IContentField<TSharedRadius>;
127
- web_px?: IContentField<TMantineSpacing>;
128
- web_py?: IContentField<TMantineSpacing>;
129
- web_border?: IContentField<TMantineBorder>;}
143
+ shared_border?: IContentField<TSharedBorder>;}
130
144
 
131
- export interface ICenterStyle extends IBaseStyle {
145
+ export interface ICenterStyle extends IStyleWithSpacing {
132
146
  style_name: 'center';
133
147
  web_center_inline?: IContentField<string>;
134
- web_width?: IContentField<TMantineWidth>;
135
- web_height?: IContentField<TMantineHeight>;
136
- web_miw?: IContentField<TMantineWidth>;
137
- web_mih?: IContentField<TMantineHeight>;
138
- web_maw?: IContentField<TMantineWidth>;
139
- web_mah?: IContentField<TMantineHeight>;
148
+ shared_width?: IContentField<TSharedDimension>;
149
+ shared_height?: IContentField<TSharedDimension>;
150
+ shared_miw?: IContentField<TSharedDimension>;
151
+ shared_mih?: IContentField<TSharedDimension>;
152
+ shared_maw?: IContentField<TSharedDimension>;
153
+ shared_mah?: IContentField<TSharedDimension>;
140
154
  }
141
155
 
142
156
  export interface IScrollAreaStyle extends IStyleWithSpacing {
@@ -145,8 +159,7 @@ export interface IScrollAreaStyle extends IStyleWithSpacing {
145
159
  web_scroll_area_type?: IContentField<TMantineScrollAreaType>;
146
160
  web_scroll_area_offset_scrollbars?: IContentField<string>;
147
161
  web_scroll_area_scroll_hide_delay?: IContentField<string>;
148
- web_height?: IContentField<TMantineHeight>;
149
- web_width?: IContentField<TMantineWidth>;
162
+ shared_height?: IContentField<TSharedDimension>;
150
163
  }
151
164
 
152
165
  export interface ICardStyle extends IStyleWithSpacing {
@@ -157,7 +170,9 @@ export interface ICardStyle extends IStyleWithSpacing {
157
170
  img_src?: IContentField<string>;
158
171
  // Cross-platform border (Mantine withBorder / themed border on mobile).
159
172
  shared_border?: IContentField<TSharedBorder>;
160
- web_card_padding?: IContentField<TMantineCardPadding>;
173
+ // NOTE: no web-only card padding — padding is the portable `shared_spacing`
174
+ // (pt/pb/ps/pe), which renders on web AND mobile. The renderer keeps a fixed
175
+ // Mantine inner padding ("md") as the default + Card.Section bleed reference.
161
176
  web_card_shadow?: IContentField<TMantineCardShadow>;
162
177
  shared_radius?: IContentField<TSharedRadius>;}
163
178