@selfhelp/shared 1.7.2 → 1.10.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.
- package/CHANGELOG.md +72 -0
- package/dist/{common-B96dASgu.d.mts → common-CJSHQL1E.d.mts} +13 -1
- package/dist/{common-B96dASgu.d.ts → common-CJSHQL1E.d.ts} +13 -1
- package/dist/index.d.mts +7 -44
- package/dist/index.d.ts +7 -44
- package/dist/index.js +400 -13
- package/dist/index.mjs +376 -13
- package/dist/plugin-sdk/index.d.mts +2 -2
- package/dist/plugin-sdk/index.d.ts +2 -2
- package/dist/plugin-sdk/index.js +15 -6
- package/dist/plugin-sdk/index.mjs +15 -6
- package/dist/registry/index.d.mts +42 -4
- package/dist/registry/index.d.ts +42 -4
- package/dist/registry/index.js +61 -8
- package/dist/registry/index.mjs +53 -7
- package/dist/{styles.registry-B147FVHY.d.mts → styles.registry-BV1iF7k-.d.ts} +695 -478
- package/dist/{styles.registry-D49K8F5z.d.ts → styles.registry-DkoT-FmN.d.mts} +695 -478
- package/dist/theme/index.d.mts +225 -4
- package/dist/theme/index.d.ts +225 -4
- package/dist/theme/index.js +343 -9
- package/dist/theme/index.mjs +325 -8
- package/dist/theme/tailwind.d.mts +2 -2
- package/dist/theme/tailwind.d.ts +2 -2
- package/package.json +1 -1
- package/src/registry/__tests__/platform.test.ts +187 -0
- package/src/registry/index.ts +73 -0
- package/src/registry/styles.registry.ts +65 -5
- package/src/theme/__tests__/mantineVariant.test.ts +87 -0
- package/src/theme/__tests__/semantic.test.ts +231 -0
- package/src/theme/index.ts +2 -0
- package/src/theme/mantineVariant.ts +145 -0
- package/src/theme/semantic.ts +472 -0
- package/src/theme/tailwind.ts +2 -2
- package/src/theme/tokens.ts +2 -2
- package/src/types/mantine/common.ts +13 -0
- package/src/types/styles/auth.ts +13 -13
- package/src/types/styles/base.ts +5 -5
- package/src/types/styles/composite.ts +62 -48
- package/src/types/styles/error.ts +26 -15
- package/src/types/styles/forms.ts +185 -185
- package/src/types/styles/interactive.ts +81 -76
- package/src/types/styles/layout.ts +103 -85
- package/src/types/styles/media.ts +20 -20
- package/src/types/styles/typography.ts +39 -39
- package/src/types/styles/unknown.ts +20 -2
- package/src/utils/spacing.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __export(index_exports, {
|
|
|
43
43
|
CONTAINER_SIZE_PX: () => CONTAINER_SIZE_PX,
|
|
44
44
|
ENDPOINTS: () => ENDPOINTS,
|
|
45
45
|
FONT_SIZE_PX: () => FONT_SIZE_PX,
|
|
46
|
+
FULL_RADIUS_PX: () => FULL_RADIUS_PX,
|
|
46
47
|
HEADER_CLIENT_TYPE: () => HEADER_CLIENT_TYPE,
|
|
47
48
|
LINE_HEIGHT: () => LINE_HEIGHT,
|
|
48
49
|
LITERAL_CLASSES: () => LITERAL_CLASSES,
|
|
@@ -67,19 +68,42 @@ __export(index_exports, {
|
|
|
67
68
|
getPluginStyleRegistry: () => getPluginStyleRegistry,
|
|
68
69
|
getRegistryEntry: () => getRegistryEntry,
|
|
69
70
|
getRegistryEntryAny: () => getRegistryEntryAny,
|
|
71
|
+
getStylePlacement: () => getStylePlacement,
|
|
72
|
+
getStylePlatforms: () => getStylePlatforms,
|
|
70
73
|
getStylePluginId: () => getStylePluginId,
|
|
71
74
|
isKnownStyleName: () => isKnownStyleName,
|
|
72
75
|
isRegisteredStyleName: () => isRegisteredStyleName,
|
|
76
|
+
isStyleAllowedOnPage: () => isStyleAllowedOnPage,
|
|
77
|
+
isStylePlacementAllowed: () => isStylePlacementAllowed,
|
|
78
|
+
isStyleSupportedOnPlatform: () => isStyleSupportedOnPlatform,
|
|
79
|
+
mapIntentToHeroUiButtonVariant: () => mapIntentToHeroUiButtonVariant,
|
|
80
|
+
mapIntentToHeroUiColor: () => mapIntentToHeroUiColor,
|
|
81
|
+
mapIntentToMantine: () => mapIntentToMantine,
|
|
82
|
+
mapRadiusToMantine: () => mapRadiusToMantine,
|
|
83
|
+
mapRadiusToPx: () => mapRadiusToPx,
|
|
84
|
+
mapSizeToHeroUi: () => mapSizeToHeroUi,
|
|
85
|
+
mapSizeToMantine: () => mapSizeToMantine,
|
|
86
|
+
mapSpacingToPx: () => mapSpacingToPx,
|
|
73
87
|
parseSpacing: () => parseSpacing,
|
|
74
88
|
radiusToPx: () => radiusToPx,
|
|
75
89
|
replaceCalcedValues: () => replaceCalcedValues,
|
|
76
90
|
resolveAssetSources: () => resolveAssetSources,
|
|
77
91
|
resolveAssetUrl: () => resolveAssetUrl,
|
|
92
|
+
resolveMantineVariant: () => resolveMantineVariant,
|
|
93
|
+
resolveSharedStyle: () => resolveSharedStyle,
|
|
94
|
+
resolveSharedStyleForMobile: () => resolveSharedStyleForMobile,
|
|
95
|
+
resolveSharedStyleForWeb: () => resolveSharedStyleForWeb,
|
|
96
|
+
resolveSharedStyleProps: () => resolveSharedStyleProps,
|
|
97
|
+
setToStylePlatform: () => setToStylePlatform,
|
|
78
98
|
sharedTailwindExtend: () => sharedTailwindExtend,
|
|
79
99
|
sharedTailwindPreset: () => sharedTailwindPreset,
|
|
80
100
|
sizeToFontPx: () => sizeToFontPx,
|
|
81
101
|
spacingToClasses: () => spacingToClasses,
|
|
82
102
|
spacingToPx: () => spacingToPx,
|
|
103
|
+
stylePlatformToSet: () => stylePlatformToSet,
|
|
104
|
+
toHeroUiSemanticProps: () => toHeroUiSemanticProps,
|
|
105
|
+
toMantineSemanticProps: () => toMantineSemanticProps,
|
|
106
|
+
toReactNativeSemanticStyle: () => toReactNativeSemanticStyle,
|
|
83
107
|
transformPageData: () => transformPageData,
|
|
84
108
|
transformPagesData: () => transformPagesData
|
|
85
109
|
});
|
|
@@ -167,8 +191,8 @@ var BASE_STYLE_REGISTRY = {
|
|
|
167
191
|
login: { description: "User login form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
168
192
|
register: { description: "User registration form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
169
193
|
validate: { description: "Email/account validation flow", category: "auth", frontendOnly: true, canHaveChildren: true },
|
|
170
|
-
|
|
171
|
-
|
|
194
|
+
"reset-password": { description: "Reset password form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
195
|
+
"two-factor-auth": { description: "Two-factor auth code form", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
172
196
|
profile: { description: "User profile management", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
173
197
|
// ===== layout =====
|
|
174
198
|
container: { description: "Mantine Container with responsive max-width", category: "layout", frontendOnly: true, canHaveChildren: true },
|
|
@@ -248,10 +272,19 @@ var BASE_STYLE_REGISTRY = {
|
|
|
248
272
|
timeline: { description: "Mantine Timeline", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
249
273
|
list: { description: "Mantine List", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
250
274
|
"list-item": { description: "Mantine List.Item", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true }
|
|
275
|
+
"entry-list": { description: "Data-driven list of entries (form-log table)", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
276
|
+
"entry-record": { description: "Single-record container", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
277
|
+
"entry-record-delete": { description: "Inline delete confirmation for an entry", category: "composite", frontendOnly: true, canHaveChildren: false },
|
|
278
|
+
loop: { description: "Loop / repeater over backend-provided rows", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
279
|
+
"timeline-item": { description: "A single entry inside a timeline (child-only)", category: "composite", frontendOnly: true, canHaveChildren: true },
|
|
280
|
+
// ===== system / data / reference (established backend catalog) =====
|
|
281
|
+
"no-access": { description: "Access-denied surface shown when the user lacks page access", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
282
|
+
missing: { description: 'Generic "content missing" system surface', category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
283
|
+
"not-found": { description: "Page-not-found system surface", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
284
|
+
version: { description: "Build/version diagnostic surface", category: "auth", frontendOnly: true, canHaveChildren: false },
|
|
285
|
+
"ref-container": { description: "Renders content referenced from another section", category: "layout", frontendOnly: true, canHaveChildren: true },
|
|
286
|
+
"data-container": { description: "Data-scoped container (renders subtree against a data scope)", category: "layout", frontendOnly: true, canHaveChildren: true },
|
|
287
|
+
"show-user-input": { description: "Displays previously submitted user input as a list/card view", category: "forms", frontendOnly: true, canHaveChildren: false }
|
|
255
288
|
};
|
|
256
289
|
var STYLE_REGISTRY = BASE_STYLE_REGISTRY;
|
|
257
290
|
var PLUGIN_STYLE_REGISTRY = {};
|
|
@@ -334,6 +367,36 @@ function getStylePluginId(name) {
|
|
|
334
367
|
const plugin = getPluginStyleRegistry()[name];
|
|
335
368
|
return plugin?.pluginId;
|
|
336
369
|
}
|
|
370
|
+
var DEFAULT_PLATFORMS = ["web", "mobile"];
|
|
371
|
+
function getStylePlatforms(name) {
|
|
372
|
+
const entry = getRegistryEntryAny(name);
|
|
373
|
+
return entry?.platforms ?? DEFAULT_PLATFORMS;
|
|
374
|
+
}
|
|
375
|
+
function isStyleSupportedOnPlatform(name, platform) {
|
|
376
|
+
return getStylePlatforms(name).includes(platform);
|
|
377
|
+
}
|
|
378
|
+
function stylePlatformToSet(platform) {
|
|
379
|
+
return platform === "both" ? DEFAULT_PLATFORMS : [platform];
|
|
380
|
+
}
|
|
381
|
+
function setToStylePlatform(set) {
|
|
382
|
+
const web = set.includes("web");
|
|
383
|
+
const mobile = set.includes("mobile");
|
|
384
|
+
if (web && mobile) return "both";
|
|
385
|
+
return mobile ? "mobile" : "web";
|
|
386
|
+
}
|
|
387
|
+
function isStyleAllowedOnPage(name, pagePlatform) {
|
|
388
|
+
if (pagePlatform === "both") return true;
|
|
389
|
+
return isStyleSupportedOnPlatform(name, pagePlatform);
|
|
390
|
+
}
|
|
391
|
+
function getStylePlacement(name) {
|
|
392
|
+
return getRegistryEntryAny(name)?.placement ?? "any";
|
|
393
|
+
}
|
|
394
|
+
function isStylePlacementAllowed(name, isRoot) {
|
|
395
|
+
const placement = getStylePlacement(name);
|
|
396
|
+
if (placement === "rootOnly") return isRoot;
|
|
397
|
+
if (placement === "containerOnly") return !isRoot;
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
337
400
|
|
|
338
401
|
// src/api/endpoints.ts
|
|
339
402
|
var API_VERSION_PREFIX = "/cms-api/v1";
|
|
@@ -472,23 +535,23 @@ function radiusToPx(token) {
|
|
|
472
535
|
function colorToHex(name, shade = 6) {
|
|
473
536
|
if (!name) return void 0;
|
|
474
537
|
if (name.startsWith("#") || name.startsWith("rgb") || name.startsWith("hsl")) return name;
|
|
475
|
-
const
|
|
476
|
-
if (!
|
|
477
|
-
return
|
|
538
|
+
const scale2 = COLOR_SCALES[name];
|
|
539
|
+
if (!scale2) return name;
|
|
540
|
+
return scale2[Math.max(0, Math.min(9, shade))];
|
|
478
541
|
}
|
|
479
542
|
|
|
480
543
|
// src/theme/tailwind.ts
|
|
481
544
|
var px = (n) => n === void 0 ? "0px" : `${n}px`;
|
|
482
|
-
var colorScaleToTailwind = (
|
|
545
|
+
var colorScaleToTailwind = (scale2) => {
|
|
483
546
|
const out = {};
|
|
484
|
-
|
|
547
|
+
scale2.forEach((value, idx) => {
|
|
485
548
|
out[String(idx)] = value;
|
|
486
549
|
});
|
|
487
550
|
return out;
|
|
488
551
|
};
|
|
489
552
|
var colors = {};
|
|
490
|
-
for (const [name,
|
|
491
|
-
colors[name] = colorScaleToTailwind(
|
|
553
|
+
for (const [name, scale2] of Object.entries(COLOR_SCALES)) {
|
|
554
|
+
colors[name] = colorScaleToTailwind(scale2);
|
|
492
555
|
}
|
|
493
556
|
var spacing = {
|
|
494
557
|
none: px(SPACING_PX.none),
|
|
@@ -524,6 +587,306 @@ var sharedTailwindPreset = {
|
|
|
524
587
|
}
|
|
525
588
|
};
|
|
526
589
|
|
|
590
|
+
// src/theme/semantic.ts
|
|
591
|
+
var FULL_RADIUS_PX = 9999;
|
|
592
|
+
var SEMANTIC_SIZES = ["sm", "md", "lg"];
|
|
593
|
+
var SEMANTIC_RADII = ["none", "sm", "md", "lg", "full"];
|
|
594
|
+
var SEMANTIC_INTENTS = [
|
|
595
|
+
"primary",
|
|
596
|
+
"secondary",
|
|
597
|
+
"success",
|
|
598
|
+
"warning",
|
|
599
|
+
"danger",
|
|
600
|
+
"neutral"
|
|
601
|
+
];
|
|
602
|
+
function mapSizeToMantine(size) {
|
|
603
|
+
return size;
|
|
604
|
+
}
|
|
605
|
+
function mapSizeToHeroUi(size) {
|
|
606
|
+
if (!size) return void 0;
|
|
607
|
+
switch (size) {
|
|
608
|
+
case "sm":
|
|
609
|
+
return "sm";
|
|
610
|
+
case "md":
|
|
611
|
+
return "md";
|
|
612
|
+
case "lg":
|
|
613
|
+
return "lg";
|
|
614
|
+
default:
|
|
615
|
+
return void 0;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function mapRadiusToPx(radius) {
|
|
619
|
+
if (!radius) return void 0;
|
|
620
|
+
switch (radius) {
|
|
621
|
+
case "none":
|
|
622
|
+
return 0;
|
|
623
|
+
case "full":
|
|
624
|
+
return FULL_RADIUS_PX;
|
|
625
|
+
case "sm":
|
|
626
|
+
return RADIUS_PX.sm;
|
|
627
|
+
case "md":
|
|
628
|
+
return RADIUS_PX.md;
|
|
629
|
+
case "lg":
|
|
630
|
+
return RADIUS_PX.lg;
|
|
631
|
+
default:
|
|
632
|
+
return void 0;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
function mapRadiusToMantine(radius) {
|
|
636
|
+
if (!radius) return void 0;
|
|
637
|
+
switch (radius) {
|
|
638
|
+
case "none":
|
|
639
|
+
return 0;
|
|
640
|
+
case "full":
|
|
641
|
+
return FULL_RADIUS_PX;
|
|
642
|
+
case "sm":
|
|
643
|
+
return "sm";
|
|
644
|
+
case "md":
|
|
645
|
+
return "md";
|
|
646
|
+
case "lg":
|
|
647
|
+
return "lg";
|
|
648
|
+
default:
|
|
649
|
+
return void 0;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function mapSpacingToPx(spacing2) {
|
|
653
|
+
if (!spacing2) return void 0;
|
|
654
|
+
if (spacing2 === "none") return 0;
|
|
655
|
+
return SPACING_PX[spacing2];
|
|
656
|
+
}
|
|
657
|
+
function mapIntentToMantine(intent) {
|
|
658
|
+
if (!intent) return void 0;
|
|
659
|
+
switch (intent) {
|
|
660
|
+
case "primary":
|
|
661
|
+
return { color: "blue", variant: "filled" };
|
|
662
|
+
case "secondary":
|
|
663
|
+
return { color: "gray", variant: "light" };
|
|
664
|
+
case "success":
|
|
665
|
+
return { color: "green", variant: "filled" };
|
|
666
|
+
case "warning":
|
|
667
|
+
return { color: "yellow", variant: "filled" };
|
|
668
|
+
case "danger":
|
|
669
|
+
return { color: "red", variant: "filled" };
|
|
670
|
+
case "neutral":
|
|
671
|
+
return { color: "gray", variant: "default" };
|
|
672
|
+
default:
|
|
673
|
+
return void 0;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function mapIntentToHeroUiButtonVariant(intent) {
|
|
677
|
+
if (!intent) return void 0;
|
|
678
|
+
switch (intent) {
|
|
679
|
+
case "primary":
|
|
680
|
+
return "primary";
|
|
681
|
+
case "secondary":
|
|
682
|
+
return "secondary";
|
|
683
|
+
case "success":
|
|
684
|
+
return "primary";
|
|
685
|
+
case "warning":
|
|
686
|
+
return "primary";
|
|
687
|
+
case "danger":
|
|
688
|
+
return "danger";
|
|
689
|
+
case "neutral":
|
|
690
|
+
return "secondary";
|
|
691
|
+
default:
|
|
692
|
+
return void 0;
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
function mapIntentToHeroUiColor(intent) {
|
|
696
|
+
if (!intent) return void 0;
|
|
697
|
+
switch (intent) {
|
|
698
|
+
case "primary":
|
|
699
|
+
return "accent";
|
|
700
|
+
case "secondary":
|
|
701
|
+
return "default";
|
|
702
|
+
case "success":
|
|
703
|
+
return "success";
|
|
704
|
+
case "warning":
|
|
705
|
+
return "warning";
|
|
706
|
+
case "danger":
|
|
707
|
+
return "danger";
|
|
708
|
+
case "neutral":
|
|
709
|
+
return "default";
|
|
710
|
+
default:
|
|
711
|
+
return void 0;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
function hasState(states, state) {
|
|
715
|
+
return !!states && states.includes(state);
|
|
716
|
+
}
|
|
717
|
+
function readString(value) {
|
|
718
|
+
if (typeof value === "string" && value !== "") return value;
|
|
719
|
+
return void 0;
|
|
720
|
+
}
|
|
721
|
+
function readBool(value) {
|
|
722
|
+
if (typeof value === "boolean") return value;
|
|
723
|
+
if (value === "1" || value === 1) return true;
|
|
724
|
+
if (value === "0" || value === 0) return false;
|
|
725
|
+
return void 0;
|
|
726
|
+
}
|
|
727
|
+
function resolveSharedStyleProps(fields) {
|
|
728
|
+
const resolved = {};
|
|
729
|
+
const size = readString(fields.shared_size);
|
|
730
|
+
if (size !== void 0 && SEMANTIC_SIZES.includes(size)) {
|
|
731
|
+
resolved.size = size;
|
|
732
|
+
}
|
|
733
|
+
const radius = readString(fields.shared_radius);
|
|
734
|
+
if (radius !== void 0 && SEMANTIC_RADII.includes(radius)) {
|
|
735
|
+
resolved.radius = radius;
|
|
736
|
+
}
|
|
737
|
+
const intent = readString(fields.shared_intent);
|
|
738
|
+
if (intent !== void 0 && SEMANTIC_INTENTS.includes(intent)) {
|
|
739
|
+
resolved.intent = intent;
|
|
740
|
+
}
|
|
741
|
+
const fullWidth = readBool(fields.shared_full_width);
|
|
742
|
+
if (fullWidth !== void 0) {
|
|
743
|
+
resolved.fullWidth = fullWidth;
|
|
744
|
+
}
|
|
745
|
+
return resolved;
|
|
746
|
+
}
|
|
747
|
+
function toMantineSemanticProps(props) {
|
|
748
|
+
const intent = mapIntentToMantine(props.intent);
|
|
749
|
+
const spacing2 = props.spacing && props.spacing !== "none" ? props.spacing : void 0;
|
|
750
|
+
return {
|
|
751
|
+
size: mapSizeToMantine(props.size),
|
|
752
|
+
color: intent?.color,
|
|
753
|
+
variant: intent?.variant,
|
|
754
|
+
radius: mapRadiusToMantine(props.radius),
|
|
755
|
+
spacing: spacing2,
|
|
756
|
+
disabled: hasState(props.states, "disabled") || void 0,
|
|
757
|
+
loading: hasState(props.states, "loading") || void 0,
|
|
758
|
+
error: hasState(props.states, "invalid") || void 0,
|
|
759
|
+
required: hasState(props.states, "required") || void 0,
|
|
760
|
+
fullWidth: props.fullWidth || void 0
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
function toHeroUiSemanticProps(props) {
|
|
764
|
+
return {
|
|
765
|
+
size: mapSizeToHeroUi(props.size),
|
|
766
|
+
buttonVariant: mapIntentToHeroUiButtonVariant(props.intent),
|
|
767
|
+
color: mapIntentToHeroUiColor(props.intent),
|
|
768
|
+
radiusPx: mapRadiusToPx(props.radius),
|
|
769
|
+
spacingPx: mapSpacingToPx(props.spacing),
|
|
770
|
+
isDisabled: hasState(props.states, "disabled") || void 0,
|
|
771
|
+
isLoading: hasState(props.states, "loading") || void 0,
|
|
772
|
+
isInvalid: hasState(props.states, "invalid") || void 0,
|
|
773
|
+
isRequired: hasState(props.states, "required") || void 0,
|
|
774
|
+
fullWidth: props.fullWidth || void 0
|
|
775
|
+
};
|
|
776
|
+
}
|
|
777
|
+
function toReactNativeSemanticStyle(props, theme) {
|
|
778
|
+
const style = {};
|
|
779
|
+
if (props.radius !== void 0) {
|
|
780
|
+
const borderRadius2 = resolveRadiusPx(props.radius, theme);
|
|
781
|
+
if (borderRadius2 !== void 0) style.borderRadius = borderRadius2;
|
|
782
|
+
}
|
|
783
|
+
if (props.spacing !== void 0) {
|
|
784
|
+
const padding = resolveSpacingPx(props.spacing, theme);
|
|
785
|
+
if (padding !== void 0) style.padding = padding;
|
|
786
|
+
}
|
|
787
|
+
if (props.fullWidth) {
|
|
788
|
+
style.alignSelf = "stretch";
|
|
789
|
+
style.width = "100%";
|
|
790
|
+
}
|
|
791
|
+
return style;
|
|
792
|
+
}
|
|
793
|
+
function resolveRadiusPx(radius, theme) {
|
|
794
|
+
if (radius === "none") return 0;
|
|
795
|
+
if (radius === "full") return FULL_RADIUS_PX;
|
|
796
|
+
return theme?.radiusPx?.[radius] ?? mapRadiusToPx(radius);
|
|
797
|
+
}
|
|
798
|
+
function resolveSpacingPx(spacing2, theme) {
|
|
799
|
+
if (spacing2 === "none") return 0;
|
|
800
|
+
return theme?.spacingPx?.[spacing2] ?? mapSpacingToPx(spacing2);
|
|
801
|
+
}
|
|
802
|
+
function resolveSharedStyle(props) {
|
|
803
|
+
return {
|
|
804
|
+
web: toMantineSemanticProps(props),
|
|
805
|
+
mobile: toHeroUiSemanticProps(props)
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
var resolveSharedStyleForWeb = toMantineSemanticProps;
|
|
809
|
+
var resolveSharedStyleForMobile = toHeroUiSemanticProps;
|
|
810
|
+
|
|
811
|
+
// src/theme/mantineVariant.ts
|
|
812
|
+
var TRANSPARENT = "transparent";
|
|
813
|
+
function scale(color) {
|
|
814
|
+
if (!color) return COLOR_SCALES.blue;
|
|
815
|
+
return COLOR_SCALES[color] ?? COLOR_SCALES.blue;
|
|
816
|
+
}
|
|
817
|
+
function resolveMantineVariant(variant, color) {
|
|
818
|
+
const palette = scale(color);
|
|
819
|
+
const accent = COLOR_PALETTE[color] ?? palette[6] ?? "#228be6";
|
|
820
|
+
const v = variant ?? "filled";
|
|
821
|
+
switch (v) {
|
|
822
|
+
case "light":
|
|
823
|
+
return {
|
|
824
|
+
background: palette[0],
|
|
825
|
+
foreground: palette[8],
|
|
826
|
+
border: TRANSPARENT,
|
|
827
|
+
borderWidth: 0,
|
|
828
|
+
pressedBackground: palette[1],
|
|
829
|
+
accent
|
|
830
|
+
};
|
|
831
|
+
case "outline":
|
|
832
|
+
return {
|
|
833
|
+
background: TRANSPARENT,
|
|
834
|
+
foreground: palette[7],
|
|
835
|
+
border: palette[6],
|
|
836
|
+
borderWidth: 1,
|
|
837
|
+
pressedBackground: palette[0],
|
|
838
|
+
accent
|
|
839
|
+
};
|
|
840
|
+
case "default":
|
|
841
|
+
return {
|
|
842
|
+
background: "#ffffff",
|
|
843
|
+
foreground: "#212529",
|
|
844
|
+
border: "#dee2e6",
|
|
845
|
+
borderWidth: 1,
|
|
846
|
+
pressedBackground: "#f1f3f5",
|
|
847
|
+
accent
|
|
848
|
+
};
|
|
849
|
+
case "subtle":
|
|
850
|
+
return {
|
|
851
|
+
background: TRANSPARENT,
|
|
852
|
+
foreground: palette[7],
|
|
853
|
+
border: TRANSPARENT,
|
|
854
|
+
borderWidth: 0,
|
|
855
|
+
pressedBackground: palette[0],
|
|
856
|
+
accent
|
|
857
|
+
};
|
|
858
|
+
case "transparent":
|
|
859
|
+
return {
|
|
860
|
+
background: TRANSPARENT,
|
|
861
|
+
foreground: palette[7],
|
|
862
|
+
border: TRANSPARENT,
|
|
863
|
+
borderWidth: 0,
|
|
864
|
+
pressedBackground: TRANSPARENT,
|
|
865
|
+
accent
|
|
866
|
+
};
|
|
867
|
+
case "dot":
|
|
868
|
+
return {
|
|
869
|
+
background: TRANSPARENT,
|
|
870
|
+
foreground: palette[7],
|
|
871
|
+
border: "#dee2e6",
|
|
872
|
+
borderWidth: 1,
|
|
873
|
+
pressedBackground: "#f8f9fa",
|
|
874
|
+
accent
|
|
875
|
+
};
|
|
876
|
+
case "filled":
|
|
877
|
+
case "gradient":
|
|
878
|
+
default:
|
|
879
|
+
return {
|
|
880
|
+
background: accent,
|
|
881
|
+
foreground: "#ffffff",
|
|
882
|
+
border: TRANSPARENT,
|
|
883
|
+
borderWidth: 0,
|
|
884
|
+
pressedBackground: palette[7] ?? accent,
|
|
885
|
+
accent
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
527
890
|
// src/interpolation/replaceCalcedValues.ts
|
|
528
891
|
var PLACEHOLDER_RE = /{{({{)?([^{}]+?)(}})?}}/g;
|
|
529
892
|
function replaceCalcedValues(input, values) {
|
|
@@ -876,6 +1239,7 @@ function transformPagesData(pages) {
|
|
|
876
1239
|
CONTAINER_SIZE_PX,
|
|
877
1240
|
ENDPOINTS,
|
|
878
1241
|
FONT_SIZE_PX,
|
|
1242
|
+
FULL_RADIUS_PX,
|
|
879
1243
|
HEADER_CLIENT_TYPE,
|
|
880
1244
|
LINE_HEIGHT,
|
|
881
1245
|
LITERAL_CLASSES,
|
|
@@ -900,19 +1264,42 @@ function transformPagesData(pages) {
|
|
|
900
1264
|
getPluginStyleRegistry,
|
|
901
1265
|
getRegistryEntry,
|
|
902
1266
|
getRegistryEntryAny,
|
|
1267
|
+
getStylePlacement,
|
|
1268
|
+
getStylePlatforms,
|
|
903
1269
|
getStylePluginId,
|
|
904
1270
|
isKnownStyleName,
|
|
905
1271
|
isRegisteredStyleName,
|
|
1272
|
+
isStyleAllowedOnPage,
|
|
1273
|
+
isStylePlacementAllowed,
|
|
1274
|
+
isStyleSupportedOnPlatform,
|
|
1275
|
+
mapIntentToHeroUiButtonVariant,
|
|
1276
|
+
mapIntentToHeroUiColor,
|
|
1277
|
+
mapIntentToMantine,
|
|
1278
|
+
mapRadiusToMantine,
|
|
1279
|
+
mapRadiusToPx,
|
|
1280
|
+
mapSizeToHeroUi,
|
|
1281
|
+
mapSizeToMantine,
|
|
1282
|
+
mapSpacingToPx,
|
|
906
1283
|
parseSpacing,
|
|
907
1284
|
radiusToPx,
|
|
908
1285
|
replaceCalcedValues,
|
|
909
1286
|
resolveAssetSources,
|
|
910
1287
|
resolveAssetUrl,
|
|
1288
|
+
resolveMantineVariant,
|
|
1289
|
+
resolveSharedStyle,
|
|
1290
|
+
resolveSharedStyleForMobile,
|
|
1291
|
+
resolveSharedStyleForWeb,
|
|
1292
|
+
resolveSharedStyleProps,
|
|
1293
|
+
setToStylePlatform,
|
|
911
1294
|
sharedTailwindExtend,
|
|
912
1295
|
sharedTailwindPreset,
|
|
913
1296
|
sizeToFontPx,
|
|
914
1297
|
spacingToClasses,
|
|
915
1298
|
spacingToPx,
|
|
1299
|
+
stylePlatformToSet,
|
|
1300
|
+
toHeroUiSemanticProps,
|
|
1301
|
+
toMantineSemanticProps,
|
|
1302
|
+
toReactNativeSemanticStyle,
|
|
916
1303
|
transformPageData,
|
|
917
1304
|
transformPagesData
|
|
918
1305
|
});
|