@roku-ui/preset 0.28.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +34 -61
  2. package/dist/index.mjs +34 -61
  3. package/package.json +15 -15
package/dist/index.cjs CHANGED
@@ -1,13 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var fs = require('node:fs');
4
3
  var unocss = require('unocss');
5
4
 
6
5
  var tailwindReset = "/*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n2. [UnoCSS]: allow to override the default border color with css var `--un-default-border-color`\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: var(--un-default-border-color, #e5e7eb); /* 2 */\n}\n\n::before,\n::after {\n --un-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS.\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/*\nMake elements with the HTML hidden attribute stay hidden by default.\n*/\n\n[hidden]:where(:not([hidden=\"until-found\"])) {\n display: none;\n}\n";
7
6
 
8
- var baseStyle = "/* Base color scheme configuration */\n:root {\n color-scheme: light dark;\n}\n\n:root[data-scheme=\"dark\"] {\n color-scheme: dark;\n}\n\n:root[data-scheme=\"light\"] {\n color-scheme: light;\n}\n\n/* Theme layer for better organization and overrides */\n@layer theme {\n /* Default (light) theme colors */\n * {\n color-scheme: light;\n --r-surface-background-base-color: rgb(var(--r-color-surface-0));\n --r-surface-background-color: rgb(var(--r-color-surface-1));\n --r-surface-background-variant-1-color: rgb(var(--r-color-surface-2));\n --r-surface-background-variant-2-color: rgb(var(--r-color-surface-2));\n --r-surface-border-color: rgb(var(--r-color-surface-3));\n --r-surface-border-variant-color: rgb(var(--r-color-surface-4));\n --r-surface-text-color: rgb(var(--r-color-surface-7));\n --r-surface-text-dimmed-color: rgb(var(--r-color-surface-5));\n\n --r-primary-background-color: rgb(var(--r-color-primary-4));\n --r-secondary-background-color: rgb(var(--r-color-secondary-4));\n --r-tertiary-background-color: rgb(var(--r-color-tertiary-4));\n --r-error-background-color: rgb(var(--r-color-error-4));\n\n --r-primary-text-color: rgb(var(--r-color-primary-6));\n --r-secondary-text-color: rgb(var(--r-color-secondary-6));\n --r-tertiary-text-color: rgb(var(--r-color-tertiary-6));\n --r-error-text-color: rgb(var(--r-color-error-6));\n }\n\n /* Dark theme overrides */\n [data-scheme=\"dark\"] *,\n [data-scheme=\"light\"] [data-scheme=\"dark\"] * {\n color-scheme: dark;\n --r-surface-background-base-color: rgb(var(--r-color-surface-10));\n --r-surface-background-color: rgb(var(--r-color-surface-9));\n --r-surface-background-variant-1-color: rgb(var(--r-color-surface-8));\n --r-surface-background-variant-2-color: rgb(var(--r-color-surface-7));\n --r-surface-border-color: rgb(var(--r-color-surface-7));\n --r-surface-border-variant-color: rgb(var(--r-color-surface-6));\n --r-surface-text-color: rgb(var(--r-color-surface-3));\n --r-surface-text-dimmed-color: rgb(var(--r-color-surface-4));\n\n --r-primary-background-color: rgb(var(--r-color-primary-5));\n --r-secondary-background-color: rgb(var(--r-color-secondary-5));\n --r-tertiary-background-color: rgb(var(--r-color-tertiary-5));\n --r-error-background-color: rgb(var(--r-color-error-5));\n\n --r-primary-text-color: rgb(var(--r-color-primary-3));\n --r-secondary-text-color: rgb(var(--r-color-secondary-3));\n --r-tertiary-text-color: rgb(var(--r-color-tertiary-3));\n --r-error-text-color: rgb(var(--r-color-error-3));\n }\n\n /* Custom theme support - can be overridden by users */\n\n\n}";
7
+ var baseStyle = "/* Base color scheme configuration */\n:root {\n color-scheme: light dark;\n text-autospace: normal;\n}\n:root[data-scheme=\"dark\"] {\n color-scheme: dark;\n}\n\n:root[data-scheme=\"light\"] {\n color-scheme: light;\n}\n/* Theme layer for better organization and overrides */\n@layer theme {\n [data-scheme=\"light\"] *, [data-scheme=\"dark\"] [data-scheme=\"light\"] * {\n color: rgb(var(--r-text-default));\n\n --r-text-primary: var(--r-color-primary-5);\n --r-text-secondary: var(--r-color-secondary-5);\n --r-text-tertiary: var(--r-color-tertiary-5);\n --r-text-success: var(--r-color-success-5);\n --r-text-info: var(--r-color-info-5);\n --r-text-warning: var(--r-color-warning-5);\n --r-text-error: var(--r-color-error-5);\n\n --r-text-dimmed: var(--r-color-surface-3);\n --r-text-muted: var(--r-color-surface-5);\n --r-text-default: var(--r-color-surface-8);\n --r-text-highlight: var(--r-color-surface-10);\n --r-text-inverted: var(--r-color-surface-1);\n\n --r-bg-base: var(--r-color-surface-0);\n --r-bg-container: var(--r-color-surface-0);\n --r-bg-elevated: var(--r-color-surface-1);\n --r-bg-inverted: var(--r-color-surface-9);\n\n --r-bg-primary: var(--r-color-primary-5);\n --r-bg-secondary: var(--r-color-secondary-5);\n --r-bg-tertiary: var(--r-color-tertiary-5);\n --r-bg-success: var(--r-color-success-5);\n --r-bg-info: var(--r-color-info-5);\n --r-bg-warning: var(--r-color-warning-5);\n --r-bg-error: var(--r-color-error-5);\n\n --r-border-base: var(--r-color-surface-3);\n --r-border-container: var(--r-color-surface-4);\n --r-border-elevated: var(--r-color-surface-6);\n --r-border-inverted: var(--r-color-surface-9);\n }\n\n [data-scheme=\"dark\"] * {\n color: rgb(var(--r-text-default));\n\n --r-text-primary: var(--r-color-primary-4);\n --r-text-secondary: var(--r-color-secondary-4);\n --r-text-tertiary: var(--r-color-tertiary-4);\n --r-text-success: var(--r-color-success-4);\n --r-text-info: var(--r-color-info-4);\n --r-text-warning: var(--r-color-warning-4);\n --r-text-error: var(--r-color-error-4);\n\n --r-text-dimmed: var(--r-color-surface-5);\n --r-text-muted: var(--r-color-surface-3);\n --r-text-default: var(--r-color-surface-1);\n --r-text-highlight: var(--r-color-surface-0);\n --r-text-inverted: var(--r-color-surface-9);\n\n --r-bg-base: var(--r-color-surface-9);\n --r-bg-container: var(--r-color-surface-9);\n --r-bg-elevated: var(--r-color-surface-8);\n --r-bg-inverted: var(--r-color-surface-1);\n\n --r-bg-primary: var(--r-color-primary-4);\n --r-bg-secondary: var(--r-color-secondary-4);\n --r-bg-tertiary: var(--r-color-tertiary-4);\n --r-bg-success: var(--r-color-success-4);\n --r-bg-info: var(--r-color-info-4);\n --r-bg-warning: var(--r-color-warning-4);\n --r-bg-error: var(--r-color-error-4);\n\n --r-border-base: var(--r-color-surface-7);\n --r-border-container: var(--r-color-surface-6);\n --r-border-elevated: var(--r-color-surface-5);\n --r-border-inverted: var(--r-color-surface-2);\n }\n}\n\n@layer components {\n :where(*, *::before, *::after) {\n --r-scheme-bg-light: var(--l-bg, transparent);\n --r-scheme-bg-dark: var(--d-bg, var(--r-scheme-bg-light));\n --r-scheme-bg: var(--r-scheme-bg-light);\n\n --r-scheme-bg-hover-light: var(--l-bg-h, var(--r-scheme-bg));\n --r-scheme-bg-hover-dark: var(--d-bg-h, var(--r-scheme-bg-hover-light));\n --r-scheme-bg-hover: var(--r-scheme-bg-hover-light);\n\n --r-scheme-border-light: var(--l-border, currentColor);\n --r-scheme-border-dark: var(--d-border, var(--r-scheme-border-light));\n --r-scheme-border: var(--r-scheme-border-light);\n\n --r-scheme-border-hover-light: var(--l-border-h, var(--r-scheme-border));\n --r-scheme-border-hover-dark: var(--d-border-h, var(--r-scheme-border-hover-light));\n --r-scheme-border-hover: var(--r-scheme-border-hover-light);\n\n --r-scheme-border-focus-light: var(--l-border-f, var(--r-scheme-border));\n --r-scheme-border-focus-dark: var(--d-border-f, var(--r-scheme-border-focus-light));\n --r-scheme-border-focus: var(--r-scheme-border-focus-light);\n\n --r-scheme-text-light: var(--l-text, inherit);\n --r-scheme-text-dark: var(--d-text, var(--r-scheme-text-light));\n --r-scheme-text: var(--r-scheme-text-light);\n\n --r-scheme-text-hover-light: var(--l-text-h, var(--r-scheme-text));\n --r-scheme-text-hover-dark: var(--d-text-h, var(--r-scheme-text-hover-light));\n --r-scheme-text-hover: var(--r-scheme-text-hover-light);\n\n --r-scheme-placeholder-light: var(--l-placeholder, var(--r-scheme-text));\n --r-scheme-placeholder-dark: var(--d-placeholder, var(--r-scheme-placeholder-light));\n --r-scheme-placeholder: var(--r-scheme-placeholder-light);\n\n --r-scheme-outline-light: var(--l-outline, transparent);\n --r-scheme-outline-dark: var(--d-outline, var(--r-scheme-outline-light));\n --r-scheme-outline: var(--r-scheme-outline-light);\n }\n\n [data-scheme=\"dark\"] :where(*, *::before, *::after),\n [data-scheme=\"light\"] [data-scheme=\"dark\"] :where(*, *::before, *::after) {\n --r-scheme-bg: var(--r-scheme-bg-dark);\n --r-scheme-bg-hover: var(--r-scheme-bg-hover-dark);\n --r-scheme-border: var(--r-scheme-border-dark);\n --r-scheme-border-hover: var(--r-scheme-border-hover-dark);\n --r-scheme-border-focus: var(--r-scheme-border-focus-dark);\n --r-scheme-text: var(--r-scheme-text-dark);\n --r-scheme-text-hover: var(--r-scheme-text-hover-dark);\n --r-scheme-placeholder: var(--r-scheme-placeholder-dark);\n --r-scheme-outline: var(--r-scheme-outline-dark);\n }\n\n [data-scheme=\"dark\"] [data-scheme=\"light\"] :where(*, *::before, *::after) {\n --r-scheme-bg: var(--r-scheme-bg-light);\n --r-scheme-bg-hover: var(--r-scheme-bg-hover-light);\n --r-scheme-border: var(--r-scheme-border-light);\n --r-scheme-border-hover: var(--r-scheme-border-hover-light);\n --r-scheme-border-focus: var(--r-scheme-border-focus-light);\n --r-scheme-text: var(--r-scheme-text-light);\n --r-scheme-text-hover: var(--r-scheme-text-hover-light);\n --r-scheme-placeholder: var(--r-scheme-placeholder-light);\n --r-scheme-outline: var(--r-scheme-outline-light);\n }\n}\n";
9
8
 
10
- const colorKeys = ['surface', 'primary', 'secondary', 'tertiary', 'error'];
9
+ const colorKeys = ['surface', 'primary', 'secondary', 'tertiary', 'info', 'warning', 'error'];
11
10
  const colors = {};
12
11
  for (const key of colorKeys) {
13
12
  const obj = {};
@@ -16,53 +15,45 @@ for (const key of colorKeys) {
16
15
  }
17
16
  colors[key] = obj;
18
17
  }
18
+ const shortcuts = {
19
+ // Legacy component integration shortcuts (keep for backward compatibility)
20
+ 'custom-colors': 'border text-[var(--r-scheme-text)] bg-[var(--r-scheme-bg)] border-[var(--r-scheme-border)] hover:bg-[var(--r-scheme-bg-hover)] hover:text-[var(--r-scheme-text-hover)] focus-visible:outline-[var(--r-scheme-outline)]',
21
+ 'custom-input-colors': 'border bg-[var(--r-scheme-bg)] text-[var(--r-scheme-text)] placeholder-[var(--r-scheme-placeholder)] border-[var(--r-scheme-border)] focus:border-[var(--r-scheme-border-focus)] hover:bg-[var(--r-scheme-bg-hover)]',
22
+ };
19
23
  function rokuPresetImpl() {
20
- let file = '';
21
- try {
22
- file = fs.readFileSync('node_modules/@roku-ui/vue/dist/index.js', 'utf8');
23
- }
24
- catch (_a) { }
25
24
  // Dynamic rules generator - replaces many static shortcuts
26
25
  const dynamicRules = [
27
- // Color-mix transparency: bg-{color}-mix-{percentage}
28
- [/^bg-([a-z]+)-mix-(\d+)$/, ([, color, percentage]) => {
29
- return `background-color: color-mix(in oklch, var(--r-${color}-background-color) ${percentage}%, transparent);`;
30
- }],
31
- // Color-mix transparency: text-{color}-mix-{percentage}
32
- [/^text-([a-z]+)-mix-(\d+)$/, ([, color, percentage]) => {
33
- return `color: color-mix(in oklch, var(--r-${color}-text-color) ${percentage}%, transparent);`;
34
- }],
35
- // Color-mix transparency: border-{color}-mix-{percentage}
36
- [/^border-([a-z]+)-mix-(\d+)$/, ([, color, percentage]) => {
37
- return `border-color: color-mix(in oklch, var(--r-${color}-background-color) ${percentage}%, transparent);`;
38
- }],
39
26
  // Standard color backgrounds: bg-{color}
40
- [/^bg-(secondary|tertiary|error)$/, ([, color]) => {
41
- return `background-color: var(--r-${color}-background-color);`;
42
- }],
27
+ [/^bg-(primary|secondary|tertiary|success|error|info|warning)$/, ([, color]) => ({
28
+ 'background-color': `rgb(var(--r-bg-${color}) / var(--un-bg-opacity, 1))`,
29
+ })],
43
30
  // Standard color text: text-{color}
44
- [/^text-(secondary|tertiary|error)$/, ([, color]) => {
45
- return `color: var(--r-${color}-text-color);`;
46
- }],
47
- // Standard color borders: border-{color}
48
- [/^border-(primary|secondary|tertiary|error)$/, ([, color]) => {
49
- return `border-color: var(--r-${color}-background-color);`;
50
- }],
31
+ [/^text-(dimmed|muted|default|highlight|inverted)$/, ([, variant]) => ({
32
+ color: `rgb(var(--r-text-${variant}) / var(--un-text-opacity, 1))`,
33
+ })],
34
+ [/^bg-(base|container|elevated|inverted)$/, ([, variant]) => ({
35
+ 'background-color': `rgb(var(--r-bg-${variant}) / var(--un-bg-opacity, 1))`,
36
+ })],
37
+ [/^border-(base|container|elevated|inverted)$/, ([, color]) => ({
38
+ 'border-color': `rgb(var(--r-border-${color}) / var(--un-border-opacity, 1))`,
39
+ })],
40
+ [/^text-(primary|secondary|tertiary|success|error|info|warning)$/, ([, color]) => ({
41
+ color: `rgb(var(--r-text-${color}) / var(--un-text-opacity, 1))`,
42
+ })],
43
+ // Note: border-{color} handled via shortcuts below to avoid raw declarations
51
44
  // Standard color outlines: outline-{color}
52
- [/^outline-(primary|secondary|tertiary|error)$/, ([, color]) => {
53
- return `outline-color: var(--r-${color}-background-color);`;
54
- }],
55
- // Surface variants: bg-surface-variant-{number}
56
- [/^bg-surface-variant-([12])$/, ([, variant]) => {
57
- return `background-color: var(--r-surface-background-variant-${variant}-color);`;
58
- }],
59
- // Surface border variants: border-surface-variant
60
- [/^border-surface-variant$/, () => {
61
- return `border-color: var(--r-surface-border-variant-color);`;
62
- }],
45
+ [/^outline-(primary|secondary|tertiary|error|info|warning)$/, ([, color]) => ({
46
+ 'outline-color': `rgb(var(--r-bg-${color}) / var(--un-outline-opacity, 1))`,
47
+ })],
63
48
  ];
64
49
  return {
65
- name: 'roku',
50
+ name: '@roku-ui/preset',
51
+ content: {
52
+ pipeline: {
53
+ include: [/\.js$/],
54
+ },
55
+ filesystem: ['**/node_modules/@roku-ui/vue/dist/index.js'],
56
+ },
66
57
  theme: {
67
58
  colors: {
68
59
  ...colors,
@@ -73,22 +64,7 @@ function rokuPresetImpl() {
73
64
  // Dynamic rules replace many static shortcuts
74
65
  ...dynamicRules,
75
66
  ],
76
- shortcuts: {
77
- // Legacy component integration shortcuts (keep for backward compatibility)
78
- 'custom-colors': 'border dark:text-[var(--d-text)] text-[var(--l-text)] dark:bg-[var(--d-bg)] bg-[var(--l-bg)] dark:border-[var(--d-border)] border-[var(--l-border)] dark:hover:bg-[var(--d-bg-h)] hover:bg-[var(--l-bg-h)] hover:text-[var(--l-text-h)] dark:hover:text-[var(--d-text-h)] focus-visible:outline-[--l-outline] dark:focus-visible:outline-[--d-outline]',
79
- 'custom-input-colors': 'border bg-[var(--l-bg)] dark:bg-[var(--d-bg)] text-[var(--l-text)] dark:text-[var(--d-text)] placeholder-[var(--l-placeholder)] dark:placeholder-[var(--d-placeholder)] border-[var(--l-border)] dark:border-[var(--d-border)] focus:border-[var(--l-border-f)] dark:focus:border-[var(--d-border-f)]',
80
- // Essential semantic color shortcuts
81
- 'bg-surface': 'bg-[--r-surface-background-color]',
82
- 'bg-surface-base': 'bg-[--r-surface-background-base-color]',
83
- 'text-surface': 'text-[--r-surface-text-color]',
84
- 'text-surface-dimmed': 'text-[--r-surface-text-dimmed-color]',
85
- 'border-surface': 'border-[--r-surface-border-color]',
86
- // Core color shortcuts (most commonly used)
87
- 'bg-primary': 'bg-[--r-primary-background-color]',
88
- 'text-primary': 'text-[--r-primary-text-color]',
89
- // Note: Other color combinations (bg-secondary, text-tertiary, etc.) are handled by dynamic rules
90
- // Note: Color-mix transparency (bg-primary-mix-30, etc.) is handled by dynamic rules
91
- },
67
+ shortcuts,
92
68
  presets: [
93
69
  unocss.presetWind4({
94
70
  dark: {
@@ -105,9 +81,6 @@ function rokuPresetImpl() {
105
81
  },
106
82
  }),
107
83
  ],
108
- content: {
109
- inline: [file],
110
- },
111
84
  preflights: [
112
85
  { getCSS: () => tailwindReset },
113
86
  {
package/dist/index.mjs CHANGED
@@ -1,11 +1,10 @@
1
- import fs from 'node:fs';
2
1
  import { presetWind4, presetTypography, presetIcons } from 'unocss';
3
2
 
4
3
  var tailwindReset = "/*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n2. [UnoCSS]: allow to override the default border color with css var `--un-default-border-color`\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: var(--un-default-border-color, #e5e7eb); /* 2 */\n}\n\n::before,\n::after {\n --un-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS.\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\n[type='button'],\n[type='reset'],\n[type='submit'] {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/*\nMake elements with the HTML hidden attribute stay hidden by default.\n*/\n\n[hidden]:where(:not([hidden=\"until-found\"])) {\n display: none;\n}\n";
5
4
 
6
- var baseStyle = "/* Base color scheme configuration */\n:root {\n color-scheme: light dark;\n}\n\n:root[data-scheme=\"dark\"] {\n color-scheme: dark;\n}\n\n:root[data-scheme=\"light\"] {\n color-scheme: light;\n}\n\n/* Theme layer for better organization and overrides */\n@layer theme {\n /* Default (light) theme colors */\n * {\n color-scheme: light;\n --r-surface-background-base-color: rgb(var(--r-color-surface-0));\n --r-surface-background-color: rgb(var(--r-color-surface-1));\n --r-surface-background-variant-1-color: rgb(var(--r-color-surface-2));\n --r-surface-background-variant-2-color: rgb(var(--r-color-surface-2));\n --r-surface-border-color: rgb(var(--r-color-surface-3));\n --r-surface-border-variant-color: rgb(var(--r-color-surface-4));\n --r-surface-text-color: rgb(var(--r-color-surface-7));\n --r-surface-text-dimmed-color: rgb(var(--r-color-surface-5));\n\n --r-primary-background-color: rgb(var(--r-color-primary-4));\n --r-secondary-background-color: rgb(var(--r-color-secondary-4));\n --r-tertiary-background-color: rgb(var(--r-color-tertiary-4));\n --r-error-background-color: rgb(var(--r-color-error-4));\n\n --r-primary-text-color: rgb(var(--r-color-primary-6));\n --r-secondary-text-color: rgb(var(--r-color-secondary-6));\n --r-tertiary-text-color: rgb(var(--r-color-tertiary-6));\n --r-error-text-color: rgb(var(--r-color-error-6));\n }\n\n /* Dark theme overrides */\n [data-scheme=\"dark\"] *,\n [data-scheme=\"light\"] [data-scheme=\"dark\"] * {\n color-scheme: dark;\n --r-surface-background-base-color: rgb(var(--r-color-surface-10));\n --r-surface-background-color: rgb(var(--r-color-surface-9));\n --r-surface-background-variant-1-color: rgb(var(--r-color-surface-8));\n --r-surface-background-variant-2-color: rgb(var(--r-color-surface-7));\n --r-surface-border-color: rgb(var(--r-color-surface-7));\n --r-surface-border-variant-color: rgb(var(--r-color-surface-6));\n --r-surface-text-color: rgb(var(--r-color-surface-3));\n --r-surface-text-dimmed-color: rgb(var(--r-color-surface-4));\n\n --r-primary-background-color: rgb(var(--r-color-primary-5));\n --r-secondary-background-color: rgb(var(--r-color-secondary-5));\n --r-tertiary-background-color: rgb(var(--r-color-tertiary-5));\n --r-error-background-color: rgb(var(--r-color-error-5));\n\n --r-primary-text-color: rgb(var(--r-color-primary-3));\n --r-secondary-text-color: rgb(var(--r-color-secondary-3));\n --r-tertiary-text-color: rgb(var(--r-color-tertiary-3));\n --r-error-text-color: rgb(var(--r-color-error-3));\n }\n\n /* Custom theme support - can be overridden by users */\n\n\n}";
5
+ var baseStyle = "/* Base color scheme configuration */\n:root {\n color-scheme: light dark;\n text-autospace: normal;\n}\n:root[data-scheme=\"dark\"] {\n color-scheme: dark;\n}\n\n:root[data-scheme=\"light\"] {\n color-scheme: light;\n}\n/* Theme layer for better organization and overrides */\n@layer theme {\n [data-scheme=\"light\"] *, [data-scheme=\"dark\"] [data-scheme=\"light\"] * {\n color: rgb(var(--r-text-default));\n\n --r-text-primary: var(--r-color-primary-5);\n --r-text-secondary: var(--r-color-secondary-5);\n --r-text-tertiary: var(--r-color-tertiary-5);\n --r-text-success: var(--r-color-success-5);\n --r-text-info: var(--r-color-info-5);\n --r-text-warning: var(--r-color-warning-5);\n --r-text-error: var(--r-color-error-5);\n\n --r-text-dimmed: var(--r-color-surface-3);\n --r-text-muted: var(--r-color-surface-5);\n --r-text-default: var(--r-color-surface-8);\n --r-text-highlight: var(--r-color-surface-10);\n --r-text-inverted: var(--r-color-surface-1);\n\n --r-bg-base: var(--r-color-surface-0);\n --r-bg-container: var(--r-color-surface-0);\n --r-bg-elevated: var(--r-color-surface-1);\n --r-bg-inverted: var(--r-color-surface-9);\n\n --r-bg-primary: var(--r-color-primary-5);\n --r-bg-secondary: var(--r-color-secondary-5);\n --r-bg-tertiary: var(--r-color-tertiary-5);\n --r-bg-success: var(--r-color-success-5);\n --r-bg-info: var(--r-color-info-5);\n --r-bg-warning: var(--r-color-warning-5);\n --r-bg-error: var(--r-color-error-5);\n\n --r-border-base: var(--r-color-surface-3);\n --r-border-container: var(--r-color-surface-4);\n --r-border-elevated: var(--r-color-surface-6);\n --r-border-inverted: var(--r-color-surface-9);\n }\n\n [data-scheme=\"dark\"] * {\n color: rgb(var(--r-text-default));\n\n --r-text-primary: var(--r-color-primary-4);\n --r-text-secondary: var(--r-color-secondary-4);\n --r-text-tertiary: var(--r-color-tertiary-4);\n --r-text-success: var(--r-color-success-4);\n --r-text-info: var(--r-color-info-4);\n --r-text-warning: var(--r-color-warning-4);\n --r-text-error: var(--r-color-error-4);\n\n --r-text-dimmed: var(--r-color-surface-5);\n --r-text-muted: var(--r-color-surface-3);\n --r-text-default: var(--r-color-surface-1);\n --r-text-highlight: var(--r-color-surface-0);\n --r-text-inverted: var(--r-color-surface-9);\n\n --r-bg-base: var(--r-color-surface-9);\n --r-bg-container: var(--r-color-surface-9);\n --r-bg-elevated: var(--r-color-surface-8);\n --r-bg-inverted: var(--r-color-surface-1);\n\n --r-bg-primary: var(--r-color-primary-4);\n --r-bg-secondary: var(--r-color-secondary-4);\n --r-bg-tertiary: var(--r-color-tertiary-4);\n --r-bg-success: var(--r-color-success-4);\n --r-bg-info: var(--r-color-info-4);\n --r-bg-warning: var(--r-color-warning-4);\n --r-bg-error: var(--r-color-error-4);\n\n --r-border-base: var(--r-color-surface-7);\n --r-border-container: var(--r-color-surface-6);\n --r-border-elevated: var(--r-color-surface-5);\n --r-border-inverted: var(--r-color-surface-2);\n }\n}\n\n@layer components {\n :where(*, *::before, *::after) {\n --r-scheme-bg-light: var(--l-bg, transparent);\n --r-scheme-bg-dark: var(--d-bg, var(--r-scheme-bg-light));\n --r-scheme-bg: var(--r-scheme-bg-light);\n\n --r-scheme-bg-hover-light: var(--l-bg-h, var(--r-scheme-bg));\n --r-scheme-bg-hover-dark: var(--d-bg-h, var(--r-scheme-bg-hover-light));\n --r-scheme-bg-hover: var(--r-scheme-bg-hover-light);\n\n --r-scheme-border-light: var(--l-border, currentColor);\n --r-scheme-border-dark: var(--d-border, var(--r-scheme-border-light));\n --r-scheme-border: var(--r-scheme-border-light);\n\n --r-scheme-border-hover-light: var(--l-border-h, var(--r-scheme-border));\n --r-scheme-border-hover-dark: var(--d-border-h, var(--r-scheme-border-hover-light));\n --r-scheme-border-hover: var(--r-scheme-border-hover-light);\n\n --r-scheme-border-focus-light: var(--l-border-f, var(--r-scheme-border));\n --r-scheme-border-focus-dark: var(--d-border-f, var(--r-scheme-border-focus-light));\n --r-scheme-border-focus: var(--r-scheme-border-focus-light);\n\n --r-scheme-text-light: var(--l-text, inherit);\n --r-scheme-text-dark: var(--d-text, var(--r-scheme-text-light));\n --r-scheme-text: var(--r-scheme-text-light);\n\n --r-scheme-text-hover-light: var(--l-text-h, var(--r-scheme-text));\n --r-scheme-text-hover-dark: var(--d-text-h, var(--r-scheme-text-hover-light));\n --r-scheme-text-hover: var(--r-scheme-text-hover-light);\n\n --r-scheme-placeholder-light: var(--l-placeholder, var(--r-scheme-text));\n --r-scheme-placeholder-dark: var(--d-placeholder, var(--r-scheme-placeholder-light));\n --r-scheme-placeholder: var(--r-scheme-placeholder-light);\n\n --r-scheme-outline-light: var(--l-outline, transparent);\n --r-scheme-outline-dark: var(--d-outline, var(--r-scheme-outline-light));\n --r-scheme-outline: var(--r-scheme-outline-light);\n }\n\n [data-scheme=\"dark\"] :where(*, *::before, *::after),\n [data-scheme=\"light\"] [data-scheme=\"dark\"] :where(*, *::before, *::after) {\n --r-scheme-bg: var(--r-scheme-bg-dark);\n --r-scheme-bg-hover: var(--r-scheme-bg-hover-dark);\n --r-scheme-border: var(--r-scheme-border-dark);\n --r-scheme-border-hover: var(--r-scheme-border-hover-dark);\n --r-scheme-border-focus: var(--r-scheme-border-focus-dark);\n --r-scheme-text: var(--r-scheme-text-dark);\n --r-scheme-text-hover: var(--r-scheme-text-hover-dark);\n --r-scheme-placeholder: var(--r-scheme-placeholder-dark);\n --r-scheme-outline: var(--r-scheme-outline-dark);\n }\n\n [data-scheme=\"dark\"] [data-scheme=\"light\"] :where(*, *::before, *::after) {\n --r-scheme-bg: var(--r-scheme-bg-light);\n --r-scheme-bg-hover: var(--r-scheme-bg-hover-light);\n --r-scheme-border: var(--r-scheme-border-light);\n --r-scheme-border-hover: var(--r-scheme-border-hover-light);\n --r-scheme-border-focus: var(--r-scheme-border-focus-light);\n --r-scheme-text: var(--r-scheme-text-light);\n --r-scheme-text-hover: var(--r-scheme-text-hover-light);\n --r-scheme-placeholder: var(--r-scheme-placeholder-light);\n --r-scheme-outline: var(--r-scheme-outline-light);\n }\n}\n";
7
6
 
8
- const colorKeys = ['surface', 'primary', 'secondary', 'tertiary', 'error'];
7
+ const colorKeys = ['surface', 'primary', 'secondary', 'tertiary', 'info', 'warning', 'error'];
9
8
  const colors = {};
10
9
  for (const key of colorKeys) {
11
10
  const obj = {};
@@ -14,53 +13,45 @@ for (const key of colorKeys) {
14
13
  }
15
14
  colors[key] = obj;
16
15
  }
16
+ const shortcuts = {
17
+ // Legacy component integration shortcuts (keep for backward compatibility)
18
+ 'custom-colors': 'border text-[var(--r-scheme-text)] bg-[var(--r-scheme-bg)] border-[var(--r-scheme-border)] hover:bg-[var(--r-scheme-bg-hover)] hover:text-[var(--r-scheme-text-hover)] focus-visible:outline-[var(--r-scheme-outline)]',
19
+ 'custom-input-colors': 'border bg-[var(--r-scheme-bg)] text-[var(--r-scheme-text)] placeholder-[var(--r-scheme-placeholder)] border-[var(--r-scheme-border)] focus:border-[var(--r-scheme-border-focus)] hover:bg-[var(--r-scheme-bg-hover)]',
20
+ };
17
21
  function rokuPresetImpl() {
18
- let file = '';
19
- try {
20
- file = fs.readFileSync('node_modules/@roku-ui/vue/dist/index.js', 'utf8');
21
- }
22
- catch (_a) { }
23
22
  // Dynamic rules generator - replaces many static shortcuts
24
23
  const dynamicRules = [
25
- // Color-mix transparency: bg-{color}-mix-{percentage}
26
- [/^bg-([a-z]+)-mix-(\d+)$/, ([, color, percentage]) => {
27
- return `background-color: color-mix(in oklch, var(--r-${color}-background-color) ${percentage}%, transparent);`;
28
- }],
29
- // Color-mix transparency: text-{color}-mix-{percentage}
30
- [/^text-([a-z]+)-mix-(\d+)$/, ([, color, percentage]) => {
31
- return `color: color-mix(in oklch, var(--r-${color}-text-color) ${percentage}%, transparent);`;
32
- }],
33
- // Color-mix transparency: border-{color}-mix-{percentage}
34
- [/^border-([a-z]+)-mix-(\d+)$/, ([, color, percentage]) => {
35
- return `border-color: color-mix(in oklch, var(--r-${color}-background-color) ${percentage}%, transparent);`;
36
- }],
37
24
  // Standard color backgrounds: bg-{color}
38
- [/^bg-(secondary|tertiary|error)$/, ([, color]) => {
39
- return `background-color: var(--r-${color}-background-color);`;
40
- }],
25
+ [/^bg-(primary|secondary|tertiary|success|error|info|warning)$/, ([, color]) => ({
26
+ 'background-color': `rgb(var(--r-bg-${color}) / var(--un-bg-opacity, 1))`,
27
+ })],
41
28
  // Standard color text: text-{color}
42
- [/^text-(secondary|tertiary|error)$/, ([, color]) => {
43
- return `color: var(--r-${color}-text-color);`;
44
- }],
45
- // Standard color borders: border-{color}
46
- [/^border-(primary|secondary|tertiary|error)$/, ([, color]) => {
47
- return `border-color: var(--r-${color}-background-color);`;
48
- }],
29
+ [/^text-(dimmed|muted|default|highlight|inverted)$/, ([, variant]) => ({
30
+ color: `rgb(var(--r-text-${variant}) / var(--un-text-opacity, 1))`,
31
+ })],
32
+ [/^bg-(base|container|elevated|inverted)$/, ([, variant]) => ({
33
+ 'background-color': `rgb(var(--r-bg-${variant}) / var(--un-bg-opacity, 1))`,
34
+ })],
35
+ [/^border-(base|container|elevated|inverted)$/, ([, color]) => ({
36
+ 'border-color': `rgb(var(--r-border-${color}) / var(--un-border-opacity, 1))`,
37
+ })],
38
+ [/^text-(primary|secondary|tertiary|success|error|info|warning)$/, ([, color]) => ({
39
+ color: `rgb(var(--r-text-${color}) / var(--un-text-opacity, 1))`,
40
+ })],
41
+ // Note: border-{color} handled via shortcuts below to avoid raw declarations
49
42
  // Standard color outlines: outline-{color}
50
- [/^outline-(primary|secondary|tertiary|error)$/, ([, color]) => {
51
- return `outline-color: var(--r-${color}-background-color);`;
52
- }],
53
- // Surface variants: bg-surface-variant-{number}
54
- [/^bg-surface-variant-([12])$/, ([, variant]) => {
55
- return `background-color: var(--r-surface-background-variant-${variant}-color);`;
56
- }],
57
- // Surface border variants: border-surface-variant
58
- [/^border-surface-variant$/, () => {
59
- return `border-color: var(--r-surface-border-variant-color);`;
60
- }],
43
+ [/^outline-(primary|secondary|tertiary|error|info|warning)$/, ([, color]) => ({
44
+ 'outline-color': `rgb(var(--r-bg-${color}) / var(--un-outline-opacity, 1))`,
45
+ })],
61
46
  ];
62
47
  return {
63
- name: 'roku',
48
+ name: '@roku-ui/preset',
49
+ content: {
50
+ pipeline: {
51
+ include: [/\.js$/],
52
+ },
53
+ filesystem: ['**/node_modules/@roku-ui/vue/dist/index.js'],
54
+ },
64
55
  theme: {
65
56
  colors: {
66
57
  ...colors,
@@ -71,22 +62,7 @@ function rokuPresetImpl() {
71
62
  // Dynamic rules replace many static shortcuts
72
63
  ...dynamicRules,
73
64
  ],
74
- shortcuts: {
75
- // Legacy component integration shortcuts (keep for backward compatibility)
76
- 'custom-colors': 'border dark:text-[var(--d-text)] text-[var(--l-text)] dark:bg-[var(--d-bg)] bg-[var(--l-bg)] dark:border-[var(--d-border)] border-[var(--l-border)] dark:hover:bg-[var(--d-bg-h)] hover:bg-[var(--l-bg-h)] hover:text-[var(--l-text-h)] dark:hover:text-[var(--d-text-h)] focus-visible:outline-[--l-outline] dark:focus-visible:outline-[--d-outline]',
77
- 'custom-input-colors': 'border bg-[var(--l-bg)] dark:bg-[var(--d-bg)] text-[var(--l-text)] dark:text-[var(--d-text)] placeholder-[var(--l-placeholder)] dark:placeholder-[var(--d-placeholder)] border-[var(--l-border)] dark:border-[var(--d-border)] focus:border-[var(--l-border-f)] dark:focus:border-[var(--d-border-f)]',
78
- // Essential semantic color shortcuts
79
- 'bg-surface': 'bg-[--r-surface-background-color]',
80
- 'bg-surface-base': 'bg-[--r-surface-background-base-color]',
81
- 'text-surface': 'text-[--r-surface-text-color]',
82
- 'text-surface-dimmed': 'text-[--r-surface-text-dimmed-color]',
83
- 'border-surface': 'border-[--r-surface-border-color]',
84
- // Core color shortcuts (most commonly used)
85
- 'bg-primary': 'bg-[--r-primary-background-color]',
86
- 'text-primary': 'text-[--r-primary-text-color]',
87
- // Note: Other color combinations (bg-secondary, text-tertiary, etc.) are handled by dynamic rules
88
- // Note: Color-mix transparency (bg-primary-mix-30, etc.) is handled by dynamic rules
89
- },
65
+ shortcuts,
90
66
  presets: [
91
67
  presetWind4({
92
68
  dark: {
@@ -103,9 +79,6 @@ function rokuPresetImpl() {
103
79
  },
104
80
  }),
105
81
  ],
106
- content: {
107
- inline: [file],
108
- },
109
82
  preflights: [
110
83
  { getCSS: () => tailwindReset },
111
84
  {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@roku-ui/preset",
3
3
  "type": "module",
4
- "version": "0.28.0",
4
+ "version": "0.30.0",
5
5
  "author": "Jianqi Pan <jannchie@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -28,22 +28,22 @@
28
28
  "index.d.ts"
29
29
  ],
30
30
  "devDependencies": {
31
- "@jannchie/eslint-config": "^3.7.0",
32
- "@rollup/plugin-commonjs": "^28.0.6",
33
- "@rollup/plugin-node-resolve": "^16.0.1",
34
- "@rollup/plugin-typescript": "^12.1.4",
35
- "@types/node": "^24.3.0",
36
- "@unocss/preset-icons": "66.4.2",
37
- "@unocss/preset-mini": "66.4.2",
38
- "@unocss/reset": "66.4.2",
39
- "eslint": "^9.33.0",
40
- "eslint-plugin-format": "^1.0.1",
41
- "rollup": "^4.47.1",
31
+ "@jannchie/eslint-config": "^3.7.1",
32
+ "@rollup/plugin-commonjs": "^29.0.0",
33
+ "@rollup/plugin-node-resolve": "^16.0.3",
34
+ "@rollup/plugin-typescript": "^12.3.0",
35
+ "@types/node": "^24.10.1",
36
+ "@unocss/preset-icons": "66.5.9",
37
+ "@unocss/preset-mini": "66.5.9",
38
+ "@unocss/reset": "66.5.9",
39
+ "eslint": "^9.39.1",
40
+ "eslint-plugin-format": "^1.0.2",
41
+ "rollup": "^4.53.3",
42
42
  "rollup-plugin-dts": "^6.2.3",
43
- "rollup-plugin-import-css": "^4.0.2",
43
+ "rollup-plugin-import-css": "^4.1.2",
44
44
  "rollup-plugin-string": "^3.0.0",
45
- "typescript": "^5.9.2",
46
- "unocss": "66.4.2",
45
+ "typescript": "^5.9.3",
46
+ "unocss": "66.5.9",
47
47
  "unocss-preset-scrollbar": "^3.2.0"
48
48
  },
49
49
  "scripts": {