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