@xsolla/switch-theme-customization 0.161.3 → 0.162.0-pr315.1780506653

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/index.js CHANGED
@@ -30,14 +30,23 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ DELETED_LEGACY_TYPO_VARS: () => DELETED_LEGACY_TYPO_VARS,
34
+ PentagramResolver: () => PentagramResolver,
33
35
  base: () => base10,
34
36
  baseDark: () => baseDark,
37
+ buildBaseColorsFromPentagram: () => buildBaseColorsFromPentagram,
35
38
  createDarkScheme: () => createDarkScheme,
39
+ createResolver: () => createResolver,
36
40
  createScheme: () => createScheme,
37
41
  emails: () => emails,
38
42
  emailsDark: () => emailsDark,
39
43
  emailsThemes: () => emailsThemes,
44
+ flattenPentagramShapeToVars: () => flattenPentagramShapeToVars,
40
45
  generateWithScheme: () => generateWithScheme,
46
+ mapHandCraftedPentagramToLegacy: () => mapHandCraftedPentagramToLegacy,
47
+ mapPentagramShapeToLegacy: () => mapPentagramShapeToLegacy,
48
+ mapPentagramThemeToLegacy: () => mapPentagramThemeToLegacy,
49
+ mapPentagramTypoToLegacy: () => mapPentagramTypoToLegacy,
41
50
  palettes: () => palettes,
42
51
  payStationDarkScheme: () => payStationDarkScheme,
43
52
  payStationScheme: () => payStationScheme,
@@ -51,11 +60,15 @@ __export(index_exports, {
51
60
  publisherV2: () => publisherV2,
52
61
  publisherV2Dark: () => publisherV2Dark,
53
62
  publisherV2Themes: () => publisherV2Themes,
63
+ resolveForDesktop: () => resolveForDesktop,
64
+ resolveForMobile: () => resolveForMobile,
65
+ shapePrimitives: () => shape_primitives_default,
54
66
  themeGenerator: () => themeGenerator,
55
67
  themes: () => themes,
56
68
  themesBaseColors: () => themesBaseColors,
57
69
  themesBaseColorsArray: () => themesBaseColorsArray,
58
- themesColorsScheme: () => themesColorsScheme
70
+ themesColorsScheme: () => themesColorsScheme,
71
+ typoPrimitives: () => typo_primitives_default
59
72
  });
60
73
  module.exports = __toCommonJS(index_exports);
61
74
 
@@ -2928,16 +2941,1061 @@ var applyPentagramColors = (schemeBase, overrides) => {
2928
2941
  });
2929
2942
  return result;
2930
2943
  };
2944
+
2945
+ // src/pentagram-to-legacy/pentagram-resolver.ts
2946
+ var FONT_SIZE_SCALE = {
2947
+ "75": { desktop: "10px", mobile: "10px" },
2948
+ "100": { desktop: "12px", mobile: "11px" },
2949
+ "125": { desktop: "14px", mobile: "12px" },
2950
+ "150": { desktop: "16px", mobile: "14px" },
2951
+ "175": { desktop: "18px", mobile: "16px" },
2952
+ "200": { desktop: "20px", mobile: "18px" },
2953
+ "250": { desktop: "24px", mobile: "20px" },
2954
+ "300": { desktop: "28px", mobile: "24px" },
2955
+ "350": { desktop: "32px", mobile: "28px" },
2956
+ "450": { desktop: "40px", mobile: "32px" },
2957
+ "550": { desktop: "48px", mobile: "40px" },
2958
+ "650": { desktop: "56px", mobile: "48px" },
2959
+ "750": { desktop: "64px", mobile: "56px" }
2960
+ };
2961
+ var LINE_HEIGHT_DISPLAY = {
2962
+ "75": { desktop: "10px", mobile: "10px" },
2963
+ "100": { desktop: "12px", mobile: "11px" },
2964
+ "125": { desktop: "14px", mobile: "12px" },
2965
+ "150": { desktop: "16px", mobile: "14px" },
2966
+ "175": { desktop: "18px", mobile: "16px" },
2967
+ "200": { desktop: "20px", mobile: "18px" },
2968
+ "250": { desktop: "24px", mobile: "20px" },
2969
+ "300": { desktop: "28px", mobile: "24px" },
2970
+ "350": { desktop: "32px", mobile: "28px" },
2971
+ "450": { desktop: "40px", mobile: "32px" },
2972
+ "550": { desktop: "48px", mobile: "40px" },
2973
+ "650": { desktop: "56px", mobile: "48px" },
2974
+ "750": { desktop: "64px", mobile: "56px" }
2975
+ };
2976
+ var LINE_HEIGHT_COMPACT = {
2977
+ "75": { desktop: "14px", mobile: "13px" },
2978
+ "100": { desktop: "16px", mobile: "14px" },
2979
+ "125": { desktop: "18px", mobile: "16px" },
2980
+ "150": { desktop: "20px", mobile: "18px" },
2981
+ "175": { desktop: "24px", mobile: "20px" },
2982
+ "200": { desktop: "26px", mobile: "24px" },
2983
+ "250": { desktop: "30px", mobile: "26px" },
2984
+ "300": { desktop: "36px", mobile: "30px" },
2985
+ "350": { desktop: "42px", mobile: "36px" },
2986
+ "450": { desktop: "52px", mobile: "42px" },
2987
+ "550": { desktop: "62px", mobile: "52px" },
2988
+ "650": { desktop: "72px", mobile: "62px" },
2989
+ "750": { desktop: "82px", mobile: "72px" }
2990
+ };
2991
+ var LINE_HEIGHT_TEXT = {
2992
+ "75": { desktop: "14px", mobile: "13px" },
2993
+ "100": { desktop: "18px", mobile: "14px" },
2994
+ "125": { desktop: "20px", mobile: "16px" },
2995
+ "150": { desktop: "22px", mobile: "18px" },
2996
+ "175": { desktop: "26px", mobile: "20px" },
2997
+ "200": { desktop: "28px", mobile: "24px" },
2998
+ "250": { desktop: "34px", mobile: "26px" },
2999
+ "300": { desktop: "40px", mobile: "30px" },
3000
+ "350": { desktop: "44px", mobile: "36px" },
3001
+ "450": { desktop: "56px", mobile: "42px" },
3002
+ "550": { desktop: "66px", mobile: "52px" },
3003
+ "650": { desktop: "78px", mobile: "62px" },
3004
+ "750": { desktop: "88px", mobile: "72px" }
3005
+ };
3006
+ var TYPOGRAPHY_SCALE_FONT_SIZE = {
3007
+ "200": "10px",
3008
+ "300": "12px",
3009
+ "400": "14px",
3010
+ "500": "16px",
3011
+ "600": "18px"
3012
+ };
3013
+ var TYPOGRAPHY_SCALE_LINE_HEIGHT = {
3014
+ "200": "16px",
3015
+ "300": "18px",
3016
+ "400": "20px",
3017
+ "500": "22px",
3018
+ "600": "24px"
3019
+ };
3020
+ var SPACING_SCALE = {
3021
+ "50": "2px",
3022
+ "75": "4px",
3023
+ "100": "6px",
3024
+ "150": "8px",
3025
+ "200": "10px",
3026
+ "250": "12px",
3027
+ "300": "16px",
3028
+ "400": "20px",
3029
+ "500": "24px",
3030
+ "600": "32px",
3031
+ "800": "48px",
3032
+ "1000": "64px"
3033
+ };
3034
+ var FONT_FAMILY = {
3035
+ compact: "'Aktiv Grotesk', sans-serif",
3036
+ display: "'Pilat Wide', 'Aktiv Grotesk', sans-serif",
3037
+ text: "'Aktiv Grotesk', sans-serif"
3038
+ };
3039
+ var RADIUS_SCALE = {
3040
+ "25": "2px",
3041
+ "50": "4px",
3042
+ "75": "6px",
3043
+ "100": "8px",
3044
+ "150": "12px",
3045
+ "200": "16px",
3046
+ "999": "999px"
3047
+ };
3048
+ var STROKE_SCALE = {
3049
+ "1": "1px",
3050
+ "2": "2px",
3051
+ "3": "3px"
3052
+ };
3053
+ var PentagramResolver = class {
3054
+ device;
3055
+ constructor(device = "desktop") {
3056
+ this.device = device;
3057
+ }
3058
+ setDevice(device) {
3059
+ this.device = device;
3060
+ }
3061
+ /**
3062
+ * Resolve a single alias to a concrete value.
3063
+ *
3064
+ * @param alias - Alias string like "300" (fontSize), "display/300" (lineHeight), or "radius/100"
3065
+ * @param context - Optional context hint: 'fontSize' or 'lineHeight'
3066
+ * @returns Resolved value (e.g., "28px") or original if not an alias
3067
+ */
3068
+ resolve(alias, context) {
3069
+ if (typeof alias !== "string") {
3070
+ return alias;
3071
+ }
3072
+ if (this.isResolved(alias)) {
3073
+ return alias;
3074
+ }
3075
+ if (/^\d+$/.test(alias) && context !== "lineHeight") {
3076
+ const value = FONT_SIZE_SCALE[alias];
3077
+ return value ? value[this.device] : alias;
3078
+ }
3079
+ if (alias.startsWith("display/")) {
3080
+ const step = alias.replace("display/", "");
3081
+ const value = LINE_HEIGHT_DISPLAY[step];
3082
+ return value ? value[this.device] : alias;
3083
+ }
3084
+ if (alias.startsWith("compact/")) {
3085
+ const step = alias.replace("compact/", "");
3086
+ const value = LINE_HEIGHT_COMPACT[step];
3087
+ return value ? value[this.device] : alias;
3088
+ }
3089
+ if (alias.startsWith("text/")) {
3090
+ const step = alias.replace("text/", "");
3091
+ const value = LINE_HEIGHT_TEXT[step];
3092
+ return value ? value[this.device] : alias;
3093
+ }
3094
+ if (alias.startsWith("font-size/")) {
3095
+ const step = alias.replace("font-size/", "");
3096
+ const value = FONT_SIZE_SCALE[step];
3097
+ return value ? value[this.device] : alias;
3098
+ }
3099
+ if (alias.startsWith("line-height/display/")) {
3100
+ const step = alias.replace("line-height/display/", "");
3101
+ const value = LINE_HEIGHT_DISPLAY[step];
3102
+ return value ? value[this.device] : alias;
3103
+ }
3104
+ if (alias.startsWith("line-height/compact/")) {
3105
+ const step = alias.replace("line-height/compact/", "");
3106
+ const value = LINE_HEIGHT_COMPACT[step];
3107
+ return value ? value[this.device] : alias;
3108
+ }
3109
+ if (alias.startsWith("line-height/text/")) {
3110
+ const step = alias.replace("line-height/text/", "");
3111
+ const value = LINE_HEIGHT_TEXT[step];
3112
+ return value ? value[this.device] : alias;
3113
+ }
3114
+ if (alias.startsWith("typography-scale/font-size/")) {
3115
+ const step = alias.replace("typography-scale/font-size/", "");
3116
+ return TYPOGRAPHY_SCALE_FONT_SIZE[step] ?? alias;
3117
+ }
3118
+ if (alias.startsWith("typography-scale/line-height/")) {
3119
+ const step = alias.replace("typography-scale/line-height/", "");
3120
+ return TYPOGRAPHY_SCALE_LINE_HEIGHT[step] ?? alias;
3121
+ }
3122
+ if (alias.startsWith("spacing/")) {
3123
+ const step = alias.replace("spacing/", "");
3124
+ return SPACING_SCALE[step] ?? alias;
3125
+ }
3126
+ if (FONT_FAMILY[alias]) {
3127
+ return FONT_FAMILY[alias];
3128
+ }
3129
+ if (alias.startsWith("radius/")) {
3130
+ const step = alias.replace("radius/", "");
3131
+ return RADIUS_SCALE[step] ?? alias;
3132
+ }
3133
+ if (alias.startsWith("stroke/")) {
3134
+ const step = alias.replace("stroke/", "");
3135
+ return STROKE_SCALE[step] ?? alias;
3136
+ }
3137
+ return alias;
3138
+ }
3139
+ /**
3140
+ * Recursively resolve all aliases in an object.
3141
+ *
3142
+ * @param obj - Object containing alias strings
3143
+ * @returns New object with all aliases resolved to concrete values
3144
+ */
3145
+ resolvePrimitives(obj) {
3146
+ if (obj === null || obj === void 0) {
3147
+ return obj;
3148
+ }
3149
+ if (typeof obj === "string" || typeof obj === "number") {
3150
+ return this.resolve(obj);
3151
+ }
3152
+ if (Array.isArray(obj)) {
3153
+ return obj.map((item) => this.resolvePrimitives(item));
3154
+ }
3155
+ if (typeof obj === "object") {
3156
+ const input = obj;
3157
+ const result = {};
3158
+ if ("scale" in input && typeof input.scale === "string" && Object.keys(input).length === 1) {
3159
+ const scale = input.scale;
3160
+ return {
3161
+ fontSize: TYPOGRAPHY_SCALE_FONT_SIZE[scale] ?? `${scale}px`,
3162
+ lineHeight: TYPOGRAPHY_SCALE_LINE_HEIGHT[scale] ?? `${scale}px`
3163
+ };
3164
+ }
3165
+ for (const [key, value] of Object.entries(input)) {
3166
+ if (key === "fontSize" && typeof value === "string") {
3167
+ result[key] = this.resolve(value, "fontSize");
3168
+ } else if (key === "lineHeight" && typeof value === "string") {
3169
+ result[key] = this.resolve(value, "lineHeight");
3170
+ } else {
3171
+ result[key] = this.resolvePrimitives(value);
3172
+ }
3173
+ }
3174
+ return result;
3175
+ }
3176
+ return obj;
3177
+ }
3178
+ /**
3179
+ * Check if a value is already resolved (not an alias).
3180
+ */
3181
+ isResolved(value) {
3182
+ return /^\d+(\.\d+)?(px|em|rem|%|vw|vh|pt|cm|mm|in)$/i.test(value) || value.startsWith("rgb") || value.startsWith("#") || value.startsWith("var(") || value === "transparent" || value === "inherit" || value === "none";
3183
+ }
3184
+ };
3185
+ function createResolver(device = "desktop") {
3186
+ return new PentagramResolver(device);
3187
+ }
3188
+ function resolveForDesktop(obj) {
3189
+ return new PentagramResolver("desktop").resolvePrimitives(obj);
3190
+ }
3191
+ function resolveForMobile(obj) {
3192
+ return new PentagramResolver("mobile").resolvePrimitives(obj);
3193
+ }
3194
+
3195
+ // src/pentagram-to-legacy/map-pentagram-typo-to-legacy.ts
3196
+ function extractControlTypo(size, defaultFontWeight = 400) {
3197
+ if (!size) {
3198
+ return {
3199
+ fontSize: "14px",
3200
+ lineHeight: "20px",
3201
+ fontWeight: defaultFontWeight
3202
+ };
3203
+ }
3204
+ return {
3205
+ fontSize: size.fontSize,
3206
+ lineHeight: size.lineHeight,
3207
+ fontWeight: defaultFontWeight
3208
+ };
3209
+ }
3210
+ function buildBasicStyle(variant, useAccent = false) {
3211
+ const fontWeight = useAccent ? variant.accent?.fontWeight ?? 500 : variant.default?.fontWeight ?? 400;
3212
+ return {
3213
+ fontSize: variant.fontSize,
3214
+ lineHeight: variant.lineHeight,
3215
+ fontWeight
3216
+ };
3217
+ }
3218
+ function buildParagraphStyle(variant) {
3219
+ return {
3220
+ fontSize: variant.fontSize,
3221
+ lineHeight: variant.paragraph?.lineHeight ?? variant.lineHeight,
3222
+ fontWeight: variant.default?.fontWeight ?? 400
3223
+ };
3224
+ }
3225
+ var DEFAULT_FONT_FAMILY = `'GraphikLCWebUikit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif`;
3226
+ function mapPentagramTypoToLegacy(pentagram, fontFamily = DEFAULT_FONT_FAMILY) {
3227
+ const { heading, basic, control } = pentagram;
3228
+ return {
3229
+ fontFamily,
3230
+ core: {
3231
+ // heading.h1 → core.h1
3232
+ h1: {
3233
+ fontSize: heading.h1.fontSize,
3234
+ lineHeight: heading.h1.lineHeight,
3235
+ fontWeight: heading.h1.fontWeight ?? 700
3236
+ },
3237
+ // heading.h2 → core.h2
3238
+ h2: {
3239
+ fontSize: heading.h2.fontSize,
3240
+ lineHeight: heading.h2.lineHeight,
3241
+ fontWeight: heading.h2.fontWeight ?? 700
3242
+ },
3243
+ // heading.h3 → core.h3
3244
+ h3: {
3245
+ fontSize: heading.h3.fontSize,
3246
+ lineHeight: heading.h3.lineHeight,
3247
+ fontWeight: heading.h3.fontWeight ?? 700
3248
+ },
3249
+ // heading.h4 → core.h4
3250
+ h4: {
3251
+ fontSize: heading.h4.fontSize,
3252
+ lineHeight: heading.h4.lineHeight,
3253
+ fontWeight: heading.h4.fontWeight ?? 700
3254
+ },
3255
+ // basic.bodyMd → core.bodyMd
3256
+ bodyMd: buildBasicStyle(basic.bodyMd, false),
3257
+ // basic.bodyMd.accent → core.bodyMdAccent
3258
+ bodyMdAccent: buildBasicStyle(basic.bodyMd, true),
3259
+ // basic.bodyLg.accent → core.bodyLgAccent
3260
+ bodyLgAccent: buildBasicStyle(basic.bodyLg, true),
3261
+ // basic.bodyMd.paragraph → core.paragraph
3262
+ paragraph: buildParagraphStyle(basic.bodyMd),
3263
+ // basic.bodyMd → core.label (same as bodyMd)
3264
+ label: buildBasicStyle(basic.bodyMd, false),
3265
+ // basic.bodySm → core.minor
3266
+ minor: buildBasicStyle(basic.bodySm, false)
3267
+ },
3268
+ components: {
3269
+ // control.button.* → components.button.*
3270
+ button: {
3271
+ sm: extractControlTypo(control.button.sm, 500),
3272
+ md: extractControlTypo(control.button.md, 500),
3273
+ lg: extractControlTypo(control.button.lg, 500)
3274
+ },
3275
+ // control.input.* → components.input.*
3276
+ input: {
3277
+ sm: extractControlTypo(control.input.sm, 400),
3278
+ md: extractControlTypo(control.input.md, 400),
3279
+ lg: extractControlTypo(control.input.lg, 400)
3280
+ },
3281
+ // control.tab.* → components.tab.*
3282
+ tab: {
3283
+ sm: extractControlTypo(control.tab.sm, 500),
3284
+ md: extractControlTypo(control.tab.md, 500),
3285
+ lg: extractControlTypo(control.tab.lg, 500)
3286
+ },
3287
+ // control.checkbox.* + control.radio.* → components.check.*
3288
+ // (checkbox and radio share the same legacy component)
3289
+ check: {
3290
+ sm: extractControlTypo(control.checkbox?.sm ?? control.radio?.sm, 400),
3291
+ md: extractControlTypo(control.checkbox?.md ?? control.radio?.md, 400),
3292
+ lg: extractControlTypo(control.checkbox?.lg ?? control.radio?.lg, 400)
3293
+ },
3294
+ // basic.bodyMd/bodySm/bodyXs → components.label.lg/md/sm
3295
+ label: {
3296
+ sm: buildBasicStyle(basic.bodyXs, false),
3297
+ md: buildBasicStyle(basic.bodySm, false),
3298
+ lg: buildBasicStyle(basic.bodyMd, false)
3299
+ }
3300
+ }
3301
+ };
3302
+ }
3303
+ var DELETED_LEGACY_TYPO_VARS = [
3304
+ "components.heading",
3305
+ "components.fieldGroup",
3306
+ "core.strong",
3307
+ "core.bodyLg"
3308
+ ];
3309
+
3310
+ // src/pentagram-to-legacy/map-pentagram-shape-to-legacy.ts
3311
+ function getShapeBorderRadius(shape, preferredSize = "md", fallback = "8px") {
3312
+ if (!shape) return fallback;
3313
+ const size = shape[preferredSize] ?? shape["lg"] ?? shape["sm"] ?? Object.values(shape)[0];
3314
+ return size?.borderRadius ?? fallback;
3315
+ }
3316
+ function getShapeBorderWidth(shape, preferredSize = "md", fallback = "1px") {
3317
+ if (!shape) return fallback;
3318
+ const size = shape[preferredSize] ?? shape["lg"] ?? shape["sm"] ?? Object.values(shape)[0];
3319
+ return size?.borderWidth ?? fallback;
3320
+ }
3321
+ function mapPentagramShapeToLegacy(pentagram, existingMisc) {
3322
+ const buttonRadius = getShapeBorderRadius(pentagram.button, "md", "8px");
3323
+ const inputRadius = getShapeBorderRadius(pentagram.input, "md", "8px");
3324
+ const checkboxRadius = getShapeBorderRadius(pentagram.checkbox, "md", "4px");
3325
+ const tagRadius = getShapeBorderRadius(pentagram.tag, "md", "8px");
3326
+ const popupRadius = pentagram.modal?.borderRadius ?? pentagram.contextMenu?.md?.borderRadius ?? pentagram.tooltip?.md?.borderRadius ?? "8px";
3327
+ const borderWidth = getShapeBorderWidth(pentagram.button, "md", "2px");
3328
+ const buttonSm = pentagram.button?.sm?.borderRadius ?? "4px";
3329
+ const buttonMd = pentagram.button?.md?.borderRadius ?? "6px";
3330
+ const buttonLg = pentagram.button?.lg?.borderRadius ?? "8px";
3331
+ const buttonXl = pentagram.button?.xl?.borderRadius ?? "8px";
3332
+ return {
3333
+ borderRadiusScale: {
3334
+ sm: existingMisc?.borderRadiusScale?.sm ?? buttonSm,
3335
+ md: existingMisc?.borderRadiusScale?.md ?? buttonMd,
3336
+ lg: existingMisc?.borderRadiusScale?.lg ?? buttonLg,
3337
+ xl: existingMisc?.borderRadiusScale?.xl ?? buttonXl
3338
+ },
3339
+ borderWidth: existingMisc?.borderWidth ?? borderWidth,
3340
+ borderRadius: {
3341
+ input: inputRadius,
3342
+ button: buttonRadius,
3343
+ buttonIcon: buttonRadius,
3344
+ popup: popupRadius,
3345
+ checkbox: checkboxRadius,
3346
+ tag: tagRadius
3347
+ },
3348
+ minWidth: {
3349
+ button: existingMisc?.minWidth?.button ?? "40px"
3350
+ }
3351
+ };
3352
+ }
3353
+ function flattenPentagramShapeToVars(pentagram) {
3354
+ const vars = {};
3355
+ function addSizedComponent(name, shape) {
3356
+ if (!shape) return;
3357
+ for (const [size, props] of Object.entries(shape)) {
3358
+ if (props.borderRadius) {
3359
+ vars[`shape-${name}-${size}-borderRadius`] = props.borderRadius;
3360
+ }
3361
+ if (props.borderWidth) {
3362
+ vars[`shape-${name}-${size}-borderWidth`] = props.borderWidth;
3363
+ }
3364
+ }
3365
+ }
3366
+ addSizedComponent("button", pentagram.button);
3367
+ addSizedComponent("input", pentagram.input);
3368
+ addSizedComponent("checkbox", pentagram.checkbox);
3369
+ addSizedComponent("tab", pentagram.tabItem);
3370
+ addSizedComponent("tag", pentagram.tag);
3371
+ addSizedComponent("radio", pentagram.radio);
3372
+ addSizedComponent("switch", pentagram.switch);
3373
+ addSizedComponent("segmented", pentagram.segmented);
3374
+ addSizedComponent("segmentedItem", pentagram.segmentedItem);
3375
+ addSizedComponent("tooltip", pentagram.tooltip);
3376
+ addSizedComponent("contextMenu", pentagram.contextMenu);
3377
+ addSizedComponent("avatar", pentagram.avatar);
3378
+ addSizedComponent("toggleButtonGroup", pentagram.toggleButtonGroup);
3379
+ if (pentagram.modal?.borderRadius) {
3380
+ vars["shape-modal-borderRadius"] = pentagram.modal.borderRadius;
3381
+ }
3382
+ if (pentagram.cell?.borderRadius) {
3383
+ vars["shape-cell-borderRadius"] = pentagram.cell.borderRadius;
3384
+ }
3385
+ if (pentagram.toast?.borderRadius) {
3386
+ vars["shape-toast-borderRadius"] = pentagram.toast.borderRadius;
3387
+ }
3388
+ return vars;
3389
+ }
3390
+
3391
+ // src/pentagram-to-legacy/map-handcrafted-pentagram-to-legacy.ts
3392
+ function mapHandCraftedPentagramToLegacy(pentagram) {
3393
+ return {
3394
+ core: {
3395
+ background: {
3396
+ primary: pentagram.background.primary,
3397
+ secondary: pentagram.layer.float,
3398
+ ghost: pentagram.overlay.mono,
3399
+ tone: pentagram.layer.scrim,
3400
+ selection: "transparent",
3401
+ // deleted in Pentagram
3402
+ hover: "transparent",
3403
+ // deleted in Pentagram
3404
+ brand: pentagram.background.brandSecondary,
3405
+ brandSecondary: pentagram.background.brandExtraSecondary,
3406
+ success: pentagram.background.successSecondary,
3407
+ warning: pentagram.background.warningSecondary,
3408
+ alert: pentagram.background.alertSecondary,
3409
+ neutral: pentagram.background.neutralSecondary
3410
+ },
3411
+ divider: {
3412
+ divider: pentagram.border.secondary
3413
+ },
3414
+ text: {
3415
+ primary: pentagram.content.primary,
3416
+ secondary: pentagram.content.secondary,
3417
+ tertiary: pentagram.content.tertiary,
3418
+ brand: pentagram.content.brandPrimary,
3419
+ brandSecondary: pentagram.content.brandExtraPrimary,
3420
+ success: pentagram.content.successPrimary,
3421
+ warning: pentagram.content.warningPrimary,
3422
+ alert: pentagram.content.alertPrimary,
3423
+ neutral: pentagram.content.neutralPrimary
3424
+ },
3425
+ link: {
3426
+ link: pentagram.control.link.primary,
3427
+ linkHover: pentagram.control.link.primaryHover,
3428
+ linkMinor: pentagram.control.link.secondary,
3429
+ linkMinorHover: pentagram.control.link.secondaryHover
3430
+ }
3431
+ },
3432
+ control: {
3433
+ primary: {
3434
+ bg: pentagram.control.brand.primary.bg,
3435
+ bgHover: pentagram.control.brand.primary.bgHover,
3436
+ bgPress: pentagram.control.brand.primary.bgPress,
3437
+ bgDisabled: pentagram.control.brand.primary.bgDisable,
3438
+ border: pentagram.control.brand.primary.border,
3439
+ borderHover: pentagram.control.brand.primary.borderHover,
3440
+ borderPress: pentagram.control.brand.primary.borderPress
3441
+ },
3442
+ secondary: {
3443
+ bg: pentagram.control.brand.secondary.bg,
3444
+ bgHover: pentagram.control.brand.secondary.bgHover,
3445
+ bgPress: pentagram.control.brand.secondary.bgPress,
3446
+ border: pentagram.control.brand.secondary.border,
3447
+ borderHover: pentagram.control.brand.secondary.borderHover,
3448
+ borderPress: pentagram.control.brand.secondary.borderPress
3449
+ },
3450
+ default: {
3451
+ bg: pentagram.control.mono.primary.bg,
3452
+ bgHover: pentagram.control.mono.primary.bgHover,
3453
+ bgPress: pentagram.control.mono.primary.bgPress,
3454
+ border: pentagram.control.mono.primary.border,
3455
+ borderHover: pentagram.control.mono.primary.borderHover,
3456
+ borderPress: pentagram.control.mono.primary.borderPress
3457
+ },
3458
+ input: {
3459
+ bg: pentagram.control.input.bg,
3460
+ bgHover: pentagram.control.input.bgHover,
3461
+ bgDisabled: pentagram.control.input.bgDisable,
3462
+ border: pentagram.control.input.border,
3463
+ borderHover: pentagram.control.input.borderHover,
3464
+ borderDisabled: pentagram.control.input.borderDisable,
3465
+ text: pentagram.control.input.text,
3466
+ textDisabled: pentagram.control.input.textDisable,
3467
+ placeholder: pentagram.control.input.placeholder
3468
+ },
3469
+ focus: {
3470
+ bg: pentagram.control.focus.bg,
3471
+ border: pentagram.control.focus.border
3472
+ },
3473
+ alert: {
3474
+ bg: pentagram.control.alert.secondary.bg,
3475
+ bgHover: pentagram.control.alert.secondary.bgHover,
3476
+ bgPress: pentagram.control.alert.secondary.bgPress,
3477
+ border: pentagram.control.alert.secondary.border,
3478
+ borderHover: pentagram.control.alert.secondary.borderHover,
3479
+ borderPress: pentagram.control.alert.secondary.borderPress
3480
+ },
3481
+ check: {
3482
+ bg: pentagram.control.check.bg,
3483
+ bgHover: pentagram.control.check.bgHover,
3484
+ bgDisabled: pentagram.control.check.bgDisable
3485
+ },
3486
+ faint: {
3487
+ bg: pentagram.control.faint.bg,
3488
+ bgHover: pentagram.control.faint.bgHover,
3489
+ border: pentagram.control.faint.border,
3490
+ borderHover: pentagram.control.faint.borderHover
3491
+ },
3492
+ toggle: {
3493
+ bg: pentagram.control.switch.bg,
3494
+ bgHover: pentagram.control.switch.bgHover
3495
+ },
3496
+ text: {
3497
+ active: pentagram.control.brand.text.primary,
3498
+ secondary: pentagram.control.brand.text.secondary,
3499
+ default: pentagram.control.mono.text.primary,
3500
+ primary: pentagram.control.text.primary,
3501
+ disabled: pentagram.control.brand.text.disable,
3502
+ faint: pentagram.control.check.icon,
3503
+ alert: pentagram.control.alert.text.secondary
3504
+ }
3505
+ }
3506
+ };
3507
+ }
3508
+
3509
+ // src/pentagram-to-legacy/map-pentagram-theme-to-legacy.ts
3510
+ function buildBaseColorsFromPentagram(colors) {
3511
+ return {
3512
+ content: colors.content.primary,
3513
+ surface: colors.background.primary,
3514
+ project: colors.control.brand.primary.bg,
3515
+ accent: colors.control.brand.text.primary,
3516
+ phantom: colors.border.secondary,
3517
+ path: colors.control.link.primary,
3518
+ success: colors.content.successPrimary,
3519
+ warning: colors.content.warningPrimary,
3520
+ alert: colors.content.alertPrimary,
3521
+ neutral: colors.content.neutralPrimary
3522
+ };
3523
+ }
3524
+ function mapPentagramThemeToLegacy(pentagram, device = "desktop") {
3525
+ const resolver = createResolver(device);
3526
+ const resolvedTypo = resolver.resolvePrimitives(pentagram.typo);
3527
+ const resolvedShape = resolver.resolvePrimitives(pentagram.shape);
3528
+ return {
3529
+ colors: {
3530
+ base: buildBaseColorsFromPentagram(pentagram.colors),
3531
+ ...mapHandCraftedPentagramToLegacy(pentagram.colors)
3532
+ },
3533
+ typo: mapPentagramTypoToLegacy(resolvedTypo),
3534
+ misc: mapPentagramShapeToLegacy(resolvedShape),
3535
+ shadows: pentagram.shadows
3536
+ };
3537
+ }
3538
+
3539
+ // src/pentagram-primitives/typo-primitives.json
3540
+ var typo_primitives_default = {
3541
+ heading: {
3542
+ h1: {
3543
+ fontSize: "450",
3544
+ lineHeight: "display/450",
3545
+ fontWeight: 700
3546
+ },
3547
+ h2: {
3548
+ fontSize: "350",
3549
+ lineHeight: "display/350",
3550
+ fontWeight: 700
3551
+ },
3552
+ h3: {
3553
+ fontSize: "300",
3554
+ lineHeight: "display/300",
3555
+ fontWeight: 700
3556
+ },
3557
+ h4: {
3558
+ fontSize: "250",
3559
+ lineHeight: "display/250",
3560
+ fontWeight: 700
3561
+ },
3562
+ h5: {
3563
+ fontSize: "200",
3564
+ lineHeight: "display/200",
3565
+ fontWeight: 700
3566
+ }
3567
+ },
3568
+ basic: {
3569
+ display: {
3570
+ fontFamily: "compact",
3571
+ fontSize: "300",
3572
+ lineHeight: "compact/300",
3573
+ fontWeight: 500
3574
+ },
3575
+ bodyLg: {
3576
+ fontSize: "175",
3577
+ lineHeight: "compact/175",
3578
+ default: {
3579
+ fontWeight: 400
3580
+ },
3581
+ accent: {
3582
+ fontWeight: 500
3583
+ },
3584
+ paragraph: {
3585
+ spacing: "spacing/250",
3586
+ lineHeight: "text/175"
3587
+ }
3588
+ },
3589
+ bodyMd: {
3590
+ fontSize: "150",
3591
+ lineHeight: "compact/150",
3592
+ default: {
3593
+ fontWeight: 400
3594
+ },
3595
+ accent: {
3596
+ fontWeight: 500
3597
+ },
3598
+ paragraph: {
3599
+ spacing: "spacing/200",
3600
+ lineHeight: "text/150"
3601
+ }
3602
+ },
3603
+ bodySm: {
3604
+ fontSize: "125",
3605
+ lineHeight: "compact/125",
3606
+ default: {
3607
+ fontWeight: 400
3608
+ },
3609
+ accent: {
3610
+ fontWeight: 500
3611
+ },
3612
+ paragraph: {
3613
+ spacing: "spacing/150",
3614
+ lineHeight: "text/125"
3615
+ }
3616
+ },
3617
+ bodyXs: {
3618
+ fontSize: "100",
3619
+ lineHeight: "compact/100",
3620
+ default: {
3621
+ fontWeight: 400
3622
+ },
3623
+ accent: {
3624
+ fontWeight: 500
3625
+ },
3626
+ paragraph: {
3627
+ spacing: "spacing/100",
3628
+ lineHeight: "text/100"
3629
+ }
3630
+ },
3631
+ bodyXxs: {
3632
+ fontSize: "75",
3633
+ lineHeight: "compact/75",
3634
+ default: {
3635
+ fontWeight: 400
3636
+ },
3637
+ accent: {
3638
+ fontWeight: 500
3639
+ },
3640
+ paragraph: {
3641
+ spacing: "spacing/75",
3642
+ lineHeight: "text/75"
3643
+ }
3644
+ }
3645
+ },
3646
+ control: {
3647
+ button: {
3648
+ xl: { scale: "600" },
3649
+ lg: { scale: "500" },
3650
+ md: { scale: "400" },
3651
+ sm: { scale: "300" },
3652
+ xs: { scale: "200" }
3653
+ },
3654
+ input: {
3655
+ xl: { scale: "600" },
3656
+ lg: { scale: "500" },
3657
+ md: { scale: "400" },
3658
+ sm: { scale: "300" },
3659
+ xs: { scale: "200" }
3660
+ },
3661
+ checkbox: {
3662
+ xl: { scale: "600" },
3663
+ lg: { scale: "500" },
3664
+ md: { scale: "400" },
3665
+ sm: { scale: "300" }
3666
+ },
3667
+ tab: {
3668
+ xl: { scale: "600" },
3669
+ lg: { scale: "500" },
3670
+ md: { scale: "400" },
3671
+ sm: { scale: "300" },
3672
+ xs: { scale: "300" }
3673
+ },
3674
+ radio: {
3675
+ xl: { scale: "600" },
3676
+ lg: { scale: "500" },
3677
+ md: { scale: "400" },
3678
+ sm: { scale: "300" }
3679
+ },
3680
+ segmentedItem: {
3681
+ xl: { scale: "500" },
3682
+ lg: { scale: "400" },
3683
+ md: { scale: "300" },
3684
+ sm: { scale: "200" }
3685
+ },
3686
+ tag: {
3687
+ xl: { scale: "600" },
3688
+ lg: { scale: "500" },
3689
+ md: { scale: "400" },
3690
+ sm: { scale: "300" },
3691
+ xs: { scale: "200" }
3692
+ },
3693
+ toggleButton: {
3694
+ xl: { scale: "600" },
3695
+ lg: { scale: "500" },
3696
+ md: { scale: "400" },
3697
+ sm: { scale: "300" },
3698
+ xs: { scale: "200" }
3699
+ }
3700
+ }
3701
+ };
3702
+
3703
+ // src/pentagram-primitives/shape-primitives.json
3704
+ var shape_primitives_default = {
3705
+ button: {
3706
+ xl: {
3707
+ borderRadius: "radius/100",
3708
+ borderWidth: "stroke/1"
3709
+ },
3710
+ lg: {
3711
+ borderRadius: "radius/100",
3712
+ borderWidth: "stroke/1"
3713
+ },
3714
+ md: {
3715
+ borderRadius: "radius/75",
3716
+ borderWidth: "stroke/1"
3717
+ },
3718
+ sm: {
3719
+ borderRadius: "radius/50",
3720
+ borderWidth: "stroke/1"
3721
+ },
3722
+ xs: {
3723
+ borderRadius: "radius/50",
3724
+ borderWidth: "stroke/1"
3725
+ }
3726
+ },
3727
+ checkbox: {
3728
+ xl: {
3729
+ borderRadius: "radius/50",
3730
+ borderWidth: "stroke/1"
3731
+ },
3732
+ lg: {
3733
+ borderRadius: "radius/50",
3734
+ borderWidth: "stroke/1"
3735
+ },
3736
+ md: {
3737
+ borderRadius: "radius/50",
3738
+ borderWidth: "stroke/1"
3739
+ },
3740
+ sm: {
3741
+ borderRadius: "radius/50",
3742
+ borderWidth: "stroke/1"
3743
+ }
3744
+ },
3745
+ input: {
3746
+ xl: {
3747
+ borderRadius: "radius/100",
3748
+ borderWidth: "stroke/1"
3749
+ },
3750
+ lg: {
3751
+ borderRadius: "radius/100",
3752
+ borderWidth: "stroke/1"
3753
+ },
3754
+ md: {
3755
+ borderRadius: "radius/100",
3756
+ borderWidth: "stroke/1"
3757
+ },
3758
+ sm: {
3759
+ borderRadius: "radius/50",
3760
+ borderWidth: "stroke/1"
3761
+ },
3762
+ xs: {
3763
+ borderRadius: "radius/50",
3764
+ borderWidth: "stroke/1"
3765
+ }
3766
+ },
3767
+ cell: {
3768
+ borderRadius: "radius/100",
3769
+ borderWidth: "stroke/1"
3770
+ },
3771
+ modal: {
3772
+ borderRadius: "radius/100"
3773
+ },
3774
+ toast: {
3775
+ borderRadius: "radius/50",
3776
+ borderWidth: "0px"
3777
+ },
3778
+ segmentedItem: {
3779
+ xl: {
3780
+ borderRadius: "radius/50",
3781
+ borderWidth: "stroke/1"
3782
+ },
3783
+ lg: {
3784
+ borderRadius: "radius/50",
3785
+ borderWidth: "stroke/1"
3786
+ },
3787
+ md: {
3788
+ borderRadius: "radius/50",
3789
+ borderWidth: "stroke/1"
3790
+ },
3791
+ sm: {
3792
+ borderRadius: "radius/25",
3793
+ borderWidth: "stroke/1"
3794
+ }
3795
+ },
3796
+ segmented: {
3797
+ xl: {
3798
+ borderRadius: "radius/100",
3799
+ borderWidth: "stroke/1"
3800
+ },
3801
+ lg: {
3802
+ borderRadius: "radius/100",
3803
+ borderWidth: "stroke/1"
3804
+ },
3805
+ md: {
3806
+ borderRadius: "radius/100",
3807
+ borderWidth: "stroke/1"
3808
+ },
3809
+ sm: {
3810
+ borderRadius: "radius/50",
3811
+ borderWidth: "stroke/1"
3812
+ }
3813
+ },
3814
+ switch: {
3815
+ xl: {
3816
+ borderRadius: "radius/50",
3817
+ borderWidth: "stroke/1"
3818
+ },
3819
+ lg: {
3820
+ borderRadius: "radius/50",
3821
+ borderWidth: "stroke/1"
3822
+ },
3823
+ md: {
3824
+ borderRadius: "radius/50",
3825
+ borderWidth: "stroke/1"
3826
+ },
3827
+ sm: {
3828
+ borderRadius: "radius/50",
3829
+ borderWidth: "stroke/1"
3830
+ }
3831
+ },
3832
+ knob: {
3833
+ xl: {
3834
+ borderRadius: "radius/25"
3835
+ },
3836
+ lg: {
3837
+ borderRadius: "radius/25"
3838
+ },
3839
+ md: {
3840
+ borderRadius: "radius/25"
3841
+ },
3842
+ sm: {
3843
+ borderRadius: "radius/25"
3844
+ }
3845
+ },
3846
+ tabItem: {
3847
+ xl: {
3848
+ borderRadius: "radius/100"
3849
+ },
3850
+ lg: {
3851
+ borderRadius: "radius/100"
3852
+ },
3853
+ md: {
3854
+ borderRadius: "radius/50"
3855
+ },
3856
+ sm: {
3857
+ borderRadius: "radius/50"
3858
+ }
3859
+ },
3860
+ tag: {
3861
+ xl: {
3862
+ borderRadius: "radius/100",
3863
+ borderWidth: "stroke/1"
3864
+ },
3865
+ lg: {
3866
+ borderRadius: "radius/100",
3867
+ borderWidth: "stroke/1"
3868
+ },
3869
+ md: {
3870
+ borderRadius: "radius/75",
3871
+ borderWidth: "stroke/1"
3872
+ },
3873
+ sm: {
3874
+ borderRadius: "radius/50",
3875
+ borderWidth: "stroke/1"
3876
+ },
3877
+ xs: {
3878
+ borderRadius: "radius/50",
3879
+ borderWidth: "stroke/1"
3880
+ }
3881
+ },
3882
+ tagLabel: {
3883
+ borderRadius: "0px"
3884
+ },
3885
+ tooltip: {
3886
+ xl: {
3887
+ borderRadius: "radius/100"
3888
+ },
3889
+ lg: {
3890
+ borderRadius: "radius/100"
3891
+ },
3892
+ md: {
3893
+ borderRadius: "radius/100"
3894
+ },
3895
+ sm: {
3896
+ borderRadius: "radius/50"
3897
+ }
3898
+ },
3899
+ radio: {
3900
+ xl: {
3901
+ borderRadius: "radius/999",
3902
+ borderWidth: "stroke/1"
3903
+ },
3904
+ lg: {
3905
+ borderRadius: "radius/999",
3906
+ borderWidth: "stroke/1"
3907
+ },
3908
+ md: {
3909
+ borderRadius: "radius/999",
3910
+ borderWidth: "stroke/1"
3911
+ },
3912
+ sm: {
3913
+ borderRadius: "radius/999",
3914
+ borderWidth: "stroke/1"
3915
+ }
3916
+ },
3917
+ contextMenu: {
3918
+ xl: {
3919
+ borderRadius: "radius/100"
3920
+ },
3921
+ lg: {
3922
+ borderRadius: "radius/100"
3923
+ },
3924
+ md: {
3925
+ borderRadius: "radius/100"
3926
+ },
3927
+ sm: {
3928
+ borderRadius: "radius/50"
3929
+ }
3930
+ },
3931
+ avatar: {
3932
+ xl: {
3933
+ borderRadius: "radius/100",
3934
+ borderWidth: "stroke/2"
3935
+ },
3936
+ lg: {
3937
+ borderRadius: "radius/75",
3938
+ borderWidth: "stroke/2"
3939
+ },
3940
+ md: {
3941
+ borderRadius: "radius/75",
3942
+ borderWidth: "stroke/2"
3943
+ },
3944
+ sm: {
3945
+ borderRadius: "radius/50",
3946
+ borderWidth: "stroke/2"
3947
+ },
3948
+ xs: {
3949
+ borderRadius: "radius/50",
3950
+ borderWidth: "stroke/2"
3951
+ },
3952
+ xxs: {
3953
+ borderRadius: "radius/25",
3954
+ borderWidth: "stroke/2"
3955
+ }
3956
+ },
3957
+ toggleButtonGroup: {
3958
+ xl: {
3959
+ borderRadius: "radius/100",
3960
+ borderWidth: "stroke/1"
3961
+ },
3962
+ lg: {
3963
+ borderRadius: "radius/100",
3964
+ borderWidth: "stroke/1"
3965
+ },
3966
+ md: {
3967
+ borderRadius: "radius/75",
3968
+ borderWidth: "stroke/1"
3969
+ },
3970
+ sm: {
3971
+ borderRadius: "radius/50",
3972
+ borderWidth: "stroke/1"
3973
+ },
3974
+ xs: {
3975
+ borderRadius: "radius/50",
3976
+ borderWidth: "stroke/1"
3977
+ }
3978
+ }
3979
+ };
2931
3980
  // Annotate the CommonJS export names for ESM import in node:
2932
3981
  0 && (module.exports = {
3982
+ DELETED_LEGACY_TYPO_VARS,
3983
+ PentagramResolver,
2933
3984
  base,
2934
3985
  baseDark,
3986
+ buildBaseColorsFromPentagram,
2935
3987
  createDarkScheme,
3988
+ createResolver,
2936
3989
  createScheme,
2937
3990
  emails,
2938
3991
  emailsDark,
2939
3992
  emailsThemes,
3993
+ flattenPentagramShapeToVars,
2940
3994
  generateWithScheme,
3995
+ mapHandCraftedPentagramToLegacy,
3996
+ mapPentagramShapeToLegacy,
3997
+ mapPentagramThemeToLegacy,
3998
+ mapPentagramTypoToLegacy,
2941
3999
  palettes,
2942
4000
  payStationDarkScheme,
2943
4001
  payStationScheme,
@@ -2951,10 +4009,14 @@ var applyPentagramColors = (schemeBase, overrides) => {
2951
4009
  publisherV2,
2952
4010
  publisherV2Dark,
2953
4011
  publisherV2Themes,
4012
+ resolveForDesktop,
4013
+ resolveForMobile,
4014
+ shapePrimitives,
2954
4015
  themeGenerator,
2955
4016
  themes,
2956
4017
  themesBaseColors,
2957
4018
  themesBaseColorsArray,
2958
- themesColorsScheme
4019
+ themesColorsScheme,
4020
+ typoPrimitives
2959
4021
  });
2960
4022
  //# sourceMappingURL=index.js.map