@tectra-ng/themes 0.4.4 → 0.4.5
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/README.md
CHANGED
|
@@ -36,7 +36,7 @@ Gives the primitive tokens a meaning. A preset = semantic tokens for light + dar
|
|
|
36
36
|
| `semantic/contrast.ts` | `primaryBaseStep(scale)` — light primary is step 600, or 700 when white text on 600 is under 4.5:1 |
|
|
37
37
|
| `define-preset.ts` | `definePreset(base, overrides)` — deep merge: override one token without copying the rest |
|
|
38
38
|
| `components/*.tokens.ts` | design tokens of every component (`button`, `select`, `table`, `datePicker`, …) — every size, padding, colour per severity and variant; emitted as `--tx-<component>-…` once a component of that group is on the page (an app ships only the groups it uses), overridable per preset or per instance with `[dt]`; `preset.components` holds only the overrides of a style or `definePreset` |
|
|
39
|
-
| `preset-to-css.ts` | `presetBaseCss(preset)` → `:root { --tx-… }` + `:root[data-tx-theme="dark"] { … }` without component tokens; `componentTokensCss(group, tokens)` → the variables of one component group; `presetToCss(preset)` → everything at once (every component), for a page without Angular |
|
|
39
|
+
| `preset-to-css.ts` | `presetBaseCss(preset)` → `:root { --tx-… }` + `:root[data-tx-theme="dark"] { … }` without component tokens; `componentTokensCss(group, tokens)` → the variables of one component group; `presetToCss(preset)` → everything at once (every component), for a page without Angular. Each takes `TectraCssOptions` as the last argument (`provideTectra` passes its own): `palettes` (accent palettes of `@tectra-ng/tokens` also written as `--tx-<palette>-<step>`, e.g. `['teal', 'rose']`; none by default), `units` (`rem` writes every px size above 1px as rem; `px` by default) and `rootFontSize` (16); `pxToRem(value, rootFontSize)` converts one value |
|
|
40
40
|
|
|
41
41
|
Semantic groups (each becomes `--tx-<group>-<key>`): `primary`, `secondary`, `success`, `info`, `warn`, `danger`, `help`, `contrast`, `surface`, `text`, `field`, `highlight`, `list`, `mask`, `focus-ring`, `shadow`, `content`. Shared: `radius`, `space`, `font`, `motion`.
|
|
42
42
|
|
|
@@ -211,6 +211,7 @@ function solid$2(group) {
|
|
|
211
211
|
/* @__NO_SIDE_EFFECTS__ */
|
|
212
212
|
function outlined$1(palette, color) {
|
|
213
213
|
return {
|
|
214
|
+
background: "transparent",
|
|
214
215
|
hoverBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef(`${palette}-50`), /* @__PURE__ */ mix(/* @__PURE__ */ tokenRef(`${palette}-400`), "8%", /* @__PURE__ */ tokenRef("surface-900"))),
|
|
215
216
|
activeBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef(`${palette}-100`), /* @__PURE__ */ mix(/* @__PURE__ */ tokenRef(`${palette}-400`), "18%", /* @__PURE__ */ tokenRef("surface-900"))),
|
|
216
217
|
borderColor: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef(`${palette}-200`), /* @__PURE__ */ tokenRef(`${palette}-700`)),
|
|
@@ -285,6 +286,7 @@ const buttonTokens = {
|
|
|
285
286
|
outlined: {
|
|
286
287
|
primary: /* @__PURE__ */ outlined$1("primary", /* @__PURE__ */ tokenRef("primary-base")),
|
|
287
288
|
secondary: {
|
|
289
|
+
background: "transparent",
|
|
288
290
|
hoverBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-100"), /* @__PURE__ */ tokenRef("surface-800")),
|
|
289
291
|
activeBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-200"), /* @__PURE__ */ tokenRef("surface-700")),
|
|
290
292
|
borderColor: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-300"), /* @__PURE__ */ tokenRef("surface-600")),
|
|
@@ -296,12 +298,14 @@ const buttonTokens = {
|
|
|
296
298
|
help: /* @__PURE__ */ outlined$1("purple", /* @__PURE__ */ severityColor("purple")),
|
|
297
299
|
danger: /* @__PURE__ */ outlined$1("red", /* @__PURE__ */ severityColor("red")),
|
|
298
300
|
contrast: {
|
|
301
|
+
background: "transparent",
|
|
299
302
|
hoverBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-50"), /* @__PURE__ */ tokenRef("surface-800")),
|
|
300
303
|
activeBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-100"), /* @__PURE__ */ tokenRef("surface-700")),
|
|
301
304
|
borderColor: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-700"), /* @__PURE__ */ tokenRef("surface-500")),
|
|
302
305
|
color: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-950"), /* @__PURE__ */ tokenRef("surface-0"))
|
|
303
306
|
},
|
|
304
307
|
plain: {
|
|
308
|
+
background: "transparent",
|
|
305
309
|
hoverBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-50"), /* @__PURE__ */ tokenRef("surface-800")),
|
|
306
310
|
activeBackground: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-100"), /* @__PURE__ */ tokenRef("surface-700")),
|
|
307
311
|
borderColor: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-200"), /* @__PURE__ */ tokenRef("surface-600")),
|
|
@@ -384,7 +388,11 @@ const formFieldTokens = { root: {
|
|
|
384
388
|
offset: "0px"
|
|
385
389
|
},
|
|
386
390
|
invalidFocusRing: { shadow: "none" },
|
|
387
|
-
transitionDuration: /* @__PURE__ */ tokenRef("motion-duration")
|
|
391
|
+
transitionDuration: /* @__PURE__ */ tokenRef("motion-duration"),
|
|
392
|
+
actionSize: "24px",
|
|
393
|
+
actionRoom: "28px",
|
|
394
|
+
iconGap: "6px",
|
|
395
|
+
panelMaxWidth: "300px"
|
|
388
396
|
} };
|
|
389
397
|
const inputGroupTokens = { addon: {
|
|
390
398
|
background: /* @__PURE__ */ tokenRef("form-field-filled-background"),
|
|
@@ -401,13 +409,19 @@ const labelTokens = {
|
|
|
401
409
|
fontWeight: /* @__PURE__ */ tokenRef("font-weight-semibold"),
|
|
402
410
|
gap: "4px",
|
|
403
411
|
marginBottom: "6px",
|
|
412
|
+
lineHeight: "1.3",
|
|
413
|
+
textDisplay: "inline-flex",
|
|
404
414
|
requiredColor: /* @__PURE__ */ tokenRef("danger-base"),
|
|
405
|
-
hintColor: /* @__PURE__ */ tokenRef("text-muted")
|
|
415
|
+
hintColor: /* @__PURE__ */ tokenRef("text-muted"),
|
|
416
|
+
hintFontSize: "0.9em",
|
|
417
|
+
filledColor: /* @__PURE__ */ tokenRef("success-base"),
|
|
418
|
+
filledFontSize: "0.9em"
|
|
406
419
|
},
|
|
407
420
|
subtle: {
|
|
408
421
|
color: /* @__PURE__ */ tokenRef("text-muted"),
|
|
409
422
|
fontSize: /* @__PURE__ */ tokenRef("font-size-sm"),
|
|
410
|
-
fontWeight: /* @__PURE__ */ tokenRef("font-weight-semibold")
|
|
423
|
+
fontWeight: /* @__PURE__ */ tokenRef("font-weight-semibold"),
|
|
424
|
+
lineHeight: "1.3"
|
|
411
425
|
}
|
|
412
426
|
};
|
|
413
427
|
const floatLabelTokens = {
|
|
@@ -469,7 +483,8 @@ const selectTokens = {
|
|
|
469
483
|
background: /* @__PURE__ */ tokenRef("surface-overlay"),
|
|
470
484
|
borderColor: /* @__PURE__ */ tokenRef("surface-overlay-border"),
|
|
471
485
|
borderRadius: /* @__PURE__ */ tokenRef("radius-lg"),
|
|
472
|
-
shadow: /* @__PURE__ */ tokenRef("shadow-overlay")
|
|
486
|
+
shadow: /* @__PURE__ */ tokenRef("shadow-overlay"),
|
|
487
|
+
maxWidth: /* @__PURE__ */ tokenRef("form-field-panel-max-width")
|
|
473
488
|
},
|
|
474
489
|
list: {
|
|
475
490
|
padding: "3.5px",
|
|
@@ -520,7 +535,8 @@ const selectTokens = {
|
|
|
520
535
|
fontSize: "10.5px",
|
|
521
536
|
removeSize: "12.25px",
|
|
522
537
|
removeColor: /* @__PURE__ */ lightDark(/* @__PURE__ */ tokenRef("surface-800"), /* @__PURE__ */ tokenRef("surface-0")),
|
|
523
|
-
removeHoverColor: /* @__PURE__ */ tokenRef("text-primary")
|
|
538
|
+
removeHoverColor: /* @__PURE__ */ tokenRef("text-primary"),
|
|
539
|
+
inputMinWidth: "64px"
|
|
524
540
|
},
|
|
525
541
|
optionGroup: {
|
|
526
542
|
padding: "3.5px 8.75px",
|
|
@@ -566,7 +582,8 @@ const chipsInputTokens = { root: {
|
|
|
566
582
|
chipFontSize: /* @__PURE__ */ tokenRef("font-size-sm"),
|
|
567
583
|
chipPaddingX: "8px",
|
|
568
584
|
chipBorderRadius: /* @__PURE__ */ tokenRef("radius-sm"),
|
|
569
|
-
inputMinWidth: "80px"
|
|
585
|
+
inputMinWidth: "80px",
|
|
586
|
+
chipRemoveSize: "16px"
|
|
570
587
|
} };
|
|
571
588
|
const countryTokens = { root: {
|
|
572
589
|
gap: "7px",
|
|
@@ -1084,6 +1101,7 @@ const ratingTokens = {
|
|
|
1084
1101
|
focusRingOffset: "3px",
|
|
1085
1102
|
borderRadius: /* @__PURE__ */ tokenRef("radius-sm"),
|
|
1086
1103
|
clearGap: "10px",
|
|
1104
|
+
clearPadding: "2px 6px",
|
|
1087
1105
|
clearColor: /* @__PURE__ */ tokenRef("text-muted"),
|
|
1088
1106
|
clearHoverColor: /* @__PURE__ */ tokenRef("text-primary"),
|
|
1089
1107
|
clearFontSize: /* @__PURE__ */ tokenRef("font-size-sm"),
|
|
@@ -1207,6 +1225,8 @@ const pillTokens = {
|
|
|
1207
1225
|
iconSize: "0.9em",
|
|
1208
1226
|
dotSize: "6px",
|
|
1209
1227
|
removeSize: "16px",
|
|
1228
|
+
removeOffset: "-4px",
|
|
1229
|
+
spinDuration: "0.8s",
|
|
1210
1230
|
focusRingColor: /* @__PURE__ */ tokenRef("focus-ring-color")
|
|
1211
1231
|
},
|
|
1212
1232
|
sm: {
|
|
@@ -1258,6 +1278,7 @@ const tagTokens = {
|
|
|
1258
1278
|
tint: "14%",
|
|
1259
1279
|
iconSize: "0.95em",
|
|
1260
1280
|
actionSize: "16px",
|
|
1281
|
+
actionOffset: "-3px",
|
|
1261
1282
|
focusRingColor: /* @__PURE__ */ tokenRef("focus-ring-color")
|
|
1262
1283
|
},
|
|
1263
1284
|
sm: {
|
|
@@ -1395,7 +1416,11 @@ const avatarTokens = {
|
|
|
1395
1416
|
sky: /* @__PURE__ */ tone$1("sky"),
|
|
1396
1417
|
orange: /* @__PURE__ */ tone$1("orange"),
|
|
1397
1418
|
purple: /* @__PURE__ */ tone$1("purple"),
|
|
1398
|
-
red: /* @__PURE__ */ tone$1("red")
|
|
1419
|
+
red: /* @__PURE__ */ tone$1("red"),
|
|
1420
|
+
solid: {
|
|
1421
|
+
background: /* @__PURE__ */ tokenRef("primary-base"),
|
|
1422
|
+
color: /* @__PURE__ */ tokenRef("primary-contrast")
|
|
1423
|
+
}
|
|
1399
1424
|
},
|
|
1400
1425
|
group: {
|
|
1401
1426
|
overlap: "0.18",
|
|
@@ -1477,6 +1502,16 @@ const panelTokens = {
|
|
|
1477
1502
|
iconBorderRadius: /* @__PURE__ */ tokenRef("radius-lg"),
|
|
1478
1503
|
iconColor: /* @__PURE__ */ tokenRef("primary-base"),
|
|
1479
1504
|
iconBackground: /* @__PURE__ */ fade(/* @__PURE__ */ tokenRef("primary-base"), "88%"),
|
|
1505
|
+
iconScale: "0.45",
|
|
1506
|
+
headerGap: "12px",
|
|
1507
|
+
headerEndGap: "16px 24px",
|
|
1508
|
+
leadGap: "12px",
|
|
1509
|
+
headingGap: "2px",
|
|
1510
|
+
titleLineHeight: "1.3",
|
|
1511
|
+
subtitleLineHeight: "1.45",
|
|
1512
|
+
actionsGap: "8px",
|
|
1513
|
+
footerGap: "8px",
|
|
1514
|
+
toggleSize: "32px",
|
|
1480
1515
|
transitionDuration: "0.25s"
|
|
1481
1516
|
},
|
|
1482
1517
|
inset: {
|
|
@@ -1505,6 +1540,7 @@ const fieldsetTokens = { root: {
|
|
|
1505
1540
|
legendBorderColor: "transparent",
|
|
1506
1541
|
legendBorderRadius: /* @__PURE__ */ tokenRef("radius-md"),
|
|
1507
1542
|
togglePadding: "4px 8px",
|
|
1543
|
+
toggleGap: "6px",
|
|
1508
1544
|
focusRingWidth: "2px",
|
|
1509
1545
|
focusRingOffset: "1px",
|
|
1510
1546
|
focusRingShadow: "none",
|
|
@@ -1705,6 +1741,7 @@ const toastTokens = {
|
|
|
1705
1741
|
shadow: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)"
|
|
1706
1742
|
},
|
|
1707
1743
|
action: {
|
|
1744
|
+
gap: "6px",
|
|
1708
1745
|
padding: "5.25px 12.25px",
|
|
1709
1746
|
fontSize: "12.25px",
|
|
1710
1747
|
fontWeight: /* @__PURE__ */ tokenRef("font-weight-semibold"),
|
|
@@ -1746,7 +1783,8 @@ const dialogTokens = {
|
|
|
1746
1783
|
},
|
|
1747
1784
|
subtitle: {
|
|
1748
1785
|
color: /* @__PURE__ */ tokenRef("text-muted"),
|
|
1749
|
-
fontSize: "12.25px"
|
|
1786
|
+
fontSize: "12.25px",
|
|
1787
|
+
marginTop: "2px"
|
|
1750
1788
|
},
|
|
1751
1789
|
content: {
|
|
1752
1790
|
padding: "0 21px",
|
|
@@ -2047,6 +2085,7 @@ const tableTokens = {
|
|
|
2047
2085
|
frozenColumn: { shadow: "none" },
|
|
2048
2086
|
columnResizer: {
|
|
2049
2087
|
width: "8px",
|
|
2088
|
+
hitWidth: "14px",
|
|
2050
2089
|
lineWidth: "2px",
|
|
2051
2090
|
color: /* @__PURE__ */ tokenRef("primary-base")
|
|
2052
2091
|
},
|
|
@@ -2118,7 +2157,9 @@ const tableTokens = {
|
|
|
2118
2157
|
},
|
|
2119
2158
|
actions: {
|
|
2120
2159
|
gap: "7px",
|
|
2121
|
-
overflowPadding: "10.5px"
|
|
2160
|
+
overflowPadding: "10.5px",
|
|
2161
|
+
menuIconSize: "24px",
|
|
2162
|
+
menuIconFontSize: "10.5px"
|
|
2122
2163
|
},
|
|
2123
2164
|
card: {
|
|
2124
2165
|
minWidth: "280px",
|
|
@@ -3016,6 +3057,8 @@ const editorContentTokens = {
|
|
|
3016
3057
|
task: {
|
|
3017
3058
|
size: "16px",
|
|
3018
3059
|
gap: "8.75px",
|
|
3060
|
+
checkWidth: "4px",
|
|
3061
|
+
checkHeight: "8px",
|
|
3019
3062
|
borderRadius: /* @__PURE__ */ tokenRef("radius-sm"),
|
|
3020
3063
|
borderColor: /* @__PURE__ */ tokenRef("form-field-border-color"),
|
|
3021
3064
|
checkedBackground: /* @__PURE__ */ tokenRef("primary-base"),
|
|
@@ -3054,7 +3097,8 @@ const editorContentTokens = {
|
|
|
3054
3097
|
},
|
|
3055
3098
|
video: {
|
|
3056
3099
|
borderRadius: /* @__PURE__ */ tokenRef("radius-lg"),
|
|
3057
|
-
aspectRatio: "16 / 9"
|
|
3100
|
+
aspectRatio: "16 / 9",
|
|
3101
|
+
maxWidth: "640px"
|
|
3058
3102
|
},
|
|
3059
3103
|
mention: {
|
|
3060
3104
|
padding: "0.05em 0.35em",
|
|
@@ -3102,6 +3146,7 @@ const editorTokens = {
|
|
|
3102
3146
|
},
|
|
3103
3147
|
tool: {
|
|
3104
3148
|
size: "29.75px",
|
|
3149
|
+
gap: "2px",
|
|
3105
3150
|
borderRadius: /* @__PURE__ */ tokenRef("radius-md"),
|
|
3106
3151
|
iconSize: "15px",
|
|
3107
3152
|
color: /* @__PURE__ */ tokenRef("text-muted"),
|
|
@@ -3113,6 +3158,9 @@ const editorTokens = {
|
|
|
3113
3158
|
labelFontSize: /* @__PURE__ */ tokenRef("font-size-sm"),
|
|
3114
3159
|
labelFontWeight: /* @__PURE__ */ tokenRef("font-weight-medium"),
|
|
3115
3160
|
labelPadding: "0 8.75px",
|
|
3161
|
+
labelMinWidth: "112px",
|
|
3162
|
+
menuPadding: "0 5px 0 7px",
|
|
3163
|
+
colorBarHeight: "3px",
|
|
3116
3164
|
focusRingWidth: "2px",
|
|
3117
3165
|
focusRingColor: /* @__PURE__ */ tokenRef("focus-ring-color")
|
|
3118
3166
|
},
|
|
@@ -3120,13 +3168,16 @@ const editorTokens = {
|
|
|
3120
3168
|
background: /* @__PURE__ */ mix(/* @__PURE__ */ tokenRef("primary-base"), "10%", "transparent"),
|
|
3121
3169
|
hoverBackground: /* @__PURE__ */ mix(/* @__PURE__ */ tokenRef("primary-base"), "17%", "transparent"),
|
|
3122
3170
|
color: /* @__PURE__ */ tokenRef("primary-hover"),
|
|
3123
|
-
animationDuration: "3.2s"
|
|
3171
|
+
animationDuration: "3.2s",
|
|
3172
|
+
gap: "6px",
|
|
3173
|
+
padding: "0 10.5px"
|
|
3124
3174
|
},
|
|
3125
3175
|
content: {
|
|
3126
3176
|
padding: "12.25px 15.75px",
|
|
3127
3177
|
minHeight: "140px",
|
|
3128
3178
|
placeholderColor: /* @__PURE__ */ tokenRef("form-field-placeholder-color")
|
|
3129
3179
|
},
|
|
3180
|
+
table: { cellMinWidth: "48px" },
|
|
3130
3181
|
footer: {
|
|
3131
3182
|
padding: "5.25px 12.25px",
|
|
3132
3183
|
color: /* @__PURE__ */ tokenRef("text-muted"),
|
|
@@ -3149,7 +3200,9 @@ const editorTokens = {
|
|
|
3149
3200
|
borderColor: /* @__PURE__ */ tokenRef("surface-overlay-border"),
|
|
3150
3201
|
shadow: /* @__PURE__ */ tokenRef("shadow-overlay"),
|
|
3151
3202
|
offset: "8px",
|
|
3152
|
-
linkMaxWidth: "240px"
|
|
3203
|
+
linkMaxWidth: "240px",
|
|
3204
|
+
labelGap: "6px",
|
|
3205
|
+
itemPadding: "0 7px"
|
|
3153
3206
|
},
|
|
3154
3207
|
popover: {
|
|
3155
3208
|
padding: "10.5px",
|
|
@@ -3172,6 +3225,7 @@ const editorTokens = {
|
|
|
3172
3225
|
itemRadius: /* @__PURE__ */ tokenRef("radius-sm"),
|
|
3173
3226
|
itemFocusBackground: /* @__PURE__ */ tokenRef("list-focus-background"),
|
|
3174
3227
|
avatarSize: "22px",
|
|
3228
|
+
commandIconInset: "3px",
|
|
3175
3229
|
secondaryColor: /* @__PURE__ */ tokenRef("text-muted")
|
|
3176
3230
|
}
|
|
3177
3231
|
};
|
|
@@ -3261,7 +3315,12 @@ const codeEditorTokens = {
|
|
|
3261
3315
|
widgetEnd: "14px",
|
|
3262
3316
|
widgetWidth: "420px",
|
|
3263
3317
|
countColor: /* @__PURE__ */ tokenRef("text-muted"),
|
|
3264
|
-
countFontSize: "12px"
|
|
3318
|
+
countFontSize: "12px",
|
|
3319
|
+
countMinWidth: "76px",
|
|
3320
|
+
inputPaddingEnd: "72px",
|
|
3321
|
+
optionSize: "22px",
|
|
3322
|
+
optionInset: "3px",
|
|
3323
|
+
optionFontSize: "11px"
|
|
3265
3324
|
}
|
|
3266
3325
|
};
|
|
3267
3326
|
const codeDiffTokens = {
|
|
@@ -4012,7 +4071,8 @@ const pageHeaderTokens = {
|
|
|
4012
4071
|
background: /* @__PURE__ */ tokenRef("surface-card"),
|
|
4013
4072
|
hoverBackground: /* @__PURE__ */ tokenRef("surface-hover"),
|
|
4014
4073
|
activeBackground: /* @__PURE__ */ tokenRef("surface-hover"),
|
|
4015
|
-
borderColor: /* @__PURE__ */ tokenRef("surface-border")
|
|
4074
|
+
borderColor: /* @__PURE__ */ tokenRef("surface-border"),
|
|
4075
|
+
shadow: "none"
|
|
4016
4076
|
}
|
|
4017
4077
|
};
|
|
4018
4078
|
const emptyStateTokens = {
|
|
@@ -5220,6 +5280,11 @@ const chartTokens = {
|
|
|
5220
5280
|
dependencyActiveWidth: "2px",
|
|
5221
5281
|
dimmedOpacity: "0.35",
|
|
5222
5282
|
toolbarGap: "8px",
|
|
5283
|
+
tickPaddingX: "8px",
|
|
5284
|
+
toggleGap: "6px",
|
|
5285
|
+
barMinWidth: "6px",
|
|
5286
|
+
insideLabelPadding: "6px",
|
|
5287
|
+
emptyMinHeight: "160px",
|
|
5223
5288
|
maxHeight: "420px",
|
|
5224
5289
|
radius: /* @__PURE__ */ tokenRef("radius-lg")
|
|
5225
5290
|
},
|
|
@@ -7051,10 +7116,19 @@ function toCssVariables(tokens, prefix = "--tx") {
|
|
|
7051
7116
|
function toStyleObject(tokens, prefix) {
|
|
7052
7117
|
return tokens ? Object.fromEntries(toCssVariables(tokens, prefix).map(({ name, value }) => [name, value])) : {};
|
|
7053
7118
|
}
|
|
7054
|
-
|
|
7055
|
-
|
|
7119
|
+
const PX_SIZE = /(?<![\w.#-])(-?(?:\d+(?:\.\d+)?|\.\d+))px\b/g;
|
|
7120
|
+
function pxToRem(value, rootFontSize = 16) {
|
|
7121
|
+
return value.replace(PX_SIZE, (size, amount) => Math.abs(Number(amount)) <= 1 ? size : `${+(Number(amount) / rootFontSize).toFixed(4)}rem`);
|
|
7122
|
+
}
|
|
7123
|
+
function block(variables, options) {
|
|
7124
|
+
const write = options.units === "rem" ? (value) => pxToRem(value, options.rootFontSize) : (value) => value;
|
|
7125
|
+
return variables.map(({ name, value }) => `${name}: ${write(value)};`).join(" ");
|
|
7126
|
+
}
|
|
7127
|
+
function extraPalettes(options) {
|
|
7128
|
+
const names = (options.palettes ?? []).filter((name) => name in ACCENT_PALETTES && !(name in SEVERITY_PALETTES));
|
|
7129
|
+
return Object.fromEntries(names.map((name) => [name, ACCENT_PALETTES[name]]));
|
|
7056
7130
|
}
|
|
7057
|
-
function sharedVariables(preset) {
|
|
7131
|
+
function sharedVariables(preset, options) {
|
|
7058
7132
|
return toCssVariables({
|
|
7059
7133
|
radius,
|
|
7060
7134
|
space: spacing,
|
|
@@ -7063,29 +7137,30 @@ function sharedVariables(preset) {
|
|
|
7063
7137
|
layer: layers,
|
|
7064
7138
|
primary: preset.palettes.accent,
|
|
7065
7139
|
surface: preset.palettes.surface,
|
|
7066
|
-
...SEVERITY_PALETTES
|
|
7140
|
+
...SEVERITY_PALETTES,
|
|
7141
|
+
...extraPalettes(options)
|
|
7067
7142
|
});
|
|
7068
7143
|
}
|
|
7069
|
-
function themeCss(preset, components) {
|
|
7144
|
+
function themeCss(preset, components, options) {
|
|
7070
7145
|
return [
|
|
7071
|
-
`:root { ${block(sharedVariables(preset))} ${block(toCssVariables(preset.light))} ${block(components)} color-scheme: light; }`,
|
|
7072
|
-
`:root[data-tx-theme="dark"] { ${block(toCssVariables(preset.dark))} color-scheme: dark; }`,
|
|
7146
|
+
`:root { ${block(sharedVariables(preset, options), options)} ${block(toCssVariables(preset.light), options)} ${block(components, options)} color-scheme: light; }`,
|
|
7147
|
+
`:root[data-tx-theme="dark"] { ${block(toCssVariables(preset.dark), options)} color-scheme: dark; }`,
|
|
7073
7148
|
...preset.css ? [preset.css] : []
|
|
7074
7149
|
].join("\n");
|
|
7075
7150
|
}
|
|
7076
7151
|
function componentVariables(name, tokens) {
|
|
7077
7152
|
return toCssVariables(tokens, `--tx-${kebab(name)}`);
|
|
7078
7153
|
}
|
|
7079
|
-
function componentTokensCss(name, tokens) {
|
|
7080
|
-
return `:root { ${block(componentVariables(name, tokens))} }`;
|
|
7154
|
+
function componentTokensCss(name, tokens, options = {}) {
|
|
7155
|
+
return `:root { ${block(componentVariables(name, tokens), options)} }`;
|
|
7081
7156
|
}
|
|
7082
|
-
function presetBaseCss(preset) {
|
|
7083
|
-
return themeCss(preset, []);
|
|
7157
|
+
function presetBaseCss(preset, options = {}) {
|
|
7158
|
+
return themeCss(preset, [], options);
|
|
7084
7159
|
}
|
|
7085
|
-
function presetToCss(preset) {
|
|
7160
|
+
function presetToCss(preset, options = {}) {
|
|
7086
7161
|
const components = /* @__PURE__ */ deepMerge(COMPONENT_TOKENS, preset.components);
|
|
7087
|
-
return themeCss(preset, Object.entries(components).flatMap(([name, tokens]) => componentVariables(name, tokens)));
|
|
7162
|
+
return themeCss(preset, Object.entries(components).flatMap(([name, tokens]) => componentVariables(name, tokens)), options);
|
|
7088
7163
|
}
|
|
7089
|
-
export { COMPONENT_TOKENS, Edge, Paper, TECTRA_STYLES, Tectra, accordionTokens, actionTileTokens, actionsMenuTokens, amountTokens, analogClockTokens, appFooterTokens, appLayoutTokens, avatarTokens, badgeTokens, breadcrumbTokens, buttonGroupTokens, buttonTokens, cardTokens, carouselTokens, cascadeSelectTokens, chartTokens, checkboxTokens, chipTokens, chipsInputTokens, codeDiffTokens, codeEditorTokens, codeHighlightTokens, codeSyntaxTokens, colorPickerTokens, colorSwatchesTokens, commandPaletteTokens, componentTokensCss, componentVariables, confettiTokens, confirmTokens, consoleLayoutTokens, contrastWithWhite, cookieNoticeTokens, countdownTokens, countryTokens, createDarkSemantic, createLightSemantic, createTectraPreset, dataViewTokens, datePickerTokens, deepMerge, definePreset, dialogTokens, dividerTokens, edgeStyle, editorContentTokens, editorTokens, emailSuggestionTokens, emptyStateTokens, extendTokens, fade, fieldMessageTokens, fieldTokens, fieldsetTokens, fileUploadTokens, filtersPanelTokens, floatLabelTokens, formFieldTokens, galleriaTokens, highlightTextTokens, hoverEffectTokens, iconLinkTokens, iconTokens, iftaLabelTokens, imageTokens, inputGroupTokens, inputNumberTokens, inputOtpTokens, isTectraPrimary, isTectraSurface, joinCss, kanbanTokens, knobTokens, labelTokens, lightDark, linkTokens, listInputTokens, listboxTokens, mascotTokens, mentionTokens, menuTokens, menubarTokens, mergeTokens, messageTokens, mix, monthCalendarTokens, networkStatusTokens, noirScale, overlayBadgeTokens, pageHeaderTokens, paginatorTokens, panelMenuTokens, panelTokens, paperStyle, passwordTokens, pillTokens, pinnedTabsTokens, popoverTokens, presetBaseCss, presetToCss, primaryBaseStep, progressBarTokens, progressSpinnerTokens, publicHeaderTokens, qrCodeTokens, radioButtonTokens, ratingTokens, relativeLuminance, rippleTokens, scrollPanelTokens, selectButtonTokens, selectTokens, skeletonTokens, sliderTokens, sparklineTokens, speedDialTokens, splitButtonTokens, splitterTokens, statTileTokens, statTilesTokens, statusIconTokens, stepperTokens, stepsTokens, switchLanguageTokens, switchThemeTokens, tableTokens, tabsTokens, tagTokens, tectraPrimaryChoices, tectraStyle, tectraSurfaceChoices, textareaTokens, themeConfiguratorTokens, timelineTokens, toCssVariables, toStyleObject, toastTokens, toggleButtonTokens, toggleSwitchTokens, tokenRef, toolbarTokens, tooltipTokens, topbarPreferencesTokens, treeTableTokens, treeTokens, truncateTextTokens, virtualScrollerTokens, wizardTokens };
|
|
7164
|
+
export { COMPONENT_TOKENS, Edge, Paper, TECTRA_STYLES, Tectra, accordionTokens, actionTileTokens, actionsMenuTokens, amountTokens, analogClockTokens, appFooterTokens, appLayoutTokens, avatarTokens, badgeTokens, breadcrumbTokens, buttonGroupTokens, buttonTokens, cardTokens, carouselTokens, cascadeSelectTokens, chartTokens, checkboxTokens, chipTokens, chipsInputTokens, codeDiffTokens, codeEditorTokens, codeHighlightTokens, codeSyntaxTokens, colorPickerTokens, colorSwatchesTokens, commandPaletteTokens, componentTokensCss, componentVariables, confettiTokens, confirmTokens, consoleLayoutTokens, contrastWithWhite, cookieNoticeTokens, countdownTokens, countryTokens, createDarkSemantic, createLightSemantic, createTectraPreset, dataViewTokens, datePickerTokens, deepMerge, definePreset, dialogTokens, dividerTokens, edgeStyle, editorContentTokens, editorTokens, emailSuggestionTokens, emptyStateTokens, extendTokens, fade, fieldMessageTokens, fieldTokens, fieldsetTokens, fileUploadTokens, filtersPanelTokens, floatLabelTokens, formFieldTokens, galleriaTokens, highlightTextTokens, hoverEffectTokens, iconLinkTokens, iconTokens, iftaLabelTokens, imageTokens, inputGroupTokens, inputNumberTokens, inputOtpTokens, isTectraPrimary, isTectraSurface, joinCss, kanbanTokens, knobTokens, labelTokens, lightDark, linkTokens, listInputTokens, listboxTokens, mascotTokens, mentionTokens, menuTokens, menubarTokens, mergeTokens, messageTokens, mix, monthCalendarTokens, networkStatusTokens, noirScale, overlayBadgeTokens, pageHeaderTokens, paginatorTokens, panelMenuTokens, panelTokens, paperStyle, passwordTokens, pillTokens, pinnedTabsTokens, popoverTokens, presetBaseCss, presetToCss, primaryBaseStep, progressBarTokens, progressSpinnerTokens, publicHeaderTokens, pxToRem, qrCodeTokens, radioButtonTokens, ratingTokens, relativeLuminance, rippleTokens, scrollPanelTokens, selectButtonTokens, selectTokens, skeletonTokens, sliderTokens, sparklineTokens, speedDialTokens, splitButtonTokens, splitterTokens, statTileTokens, statTilesTokens, statusIconTokens, stepperTokens, stepsTokens, switchLanguageTokens, switchThemeTokens, tableTokens, tabsTokens, tagTokens, tectraPrimaryChoices, tectraStyle, tectraSurfaceChoices, textareaTokens, themeConfiguratorTokens, timelineTokens, toCssVariables, toStyleObject, toastTokens, toggleButtonTokens, toggleSwitchTokens, tokenRef, toolbarTokens, tooltipTokens, topbarPreferencesTokens, treeTableTokens, treeTokens, truncateTextTokens, virtualScrollerTokens, wizardTokens };
|
|
7090
7165
|
|
|
7091
7166
|
//# sourceMappingURL=tectra-ng-themes.mjs.map
|