@optilogic/core 1.3.4 → 1.3.6
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/dist/index.cjs +75 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +75 -46
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -0
- package/dist/tailwind-preset.cjs +5 -0
- package/dist/tailwind-preset.cjs.map +1 -1
- package/dist/tailwind-preset.js +5 -0
- package/dist/tailwind-preset.js.map +1 -1
- package/package.json +1 -1
- package/src/components/accordion.tsx +4 -4
- package/src/components/autocomplete.tsx +4 -4
- package/src/components/button.tsx +3 -3
- package/src/components/calendar.tsx +2 -2
- package/src/components/chip.tsx +1 -2
- package/src/components/combobox.tsx +3 -3
- package/src/components/context-menu.tsx +2 -2
- package/src/components/data-grid/DataGrid.tsx +2 -2
- package/src/components/data-grid/components/HeaderCell.tsx +2 -2
- package/src/components/dropdown-menu.tsx +4 -4
- package/src/components/file-view/FileView.tsx +1 -1
- package/src/components/icon-button.tsx +9 -9
- package/src/components/multi-select.tsx +5 -5
- package/src/components/select.tsx +1 -1
- package/src/components/table.tsx +1 -1
- package/src/components/theme-picker.tsx +1 -1
- package/src/styles.css +2 -0
- package/src/tailwind-preset.ts +6 -0
- package/src/theme/types.ts +3 -0
- package/src/theme/utils.ts +30 -0
package/dist/index.cjs
CHANGED
|
@@ -71,12 +71,12 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
71
71
|
{
|
|
72
72
|
variants: {
|
|
73
73
|
variant: {
|
|
74
|
-
default: "bg-muted text-foreground hover:bg-
|
|
74
|
+
default: "bg-muted text-foreground hover:bg-hover disabled:opacity-50 disabled:text-muted-foreground",
|
|
75
75
|
primary: "bg-accent text-accent-foreground shadow hover:shadow-md disabled:opacity-50",
|
|
76
76
|
destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 hover:shadow-md disabled:opacity-50",
|
|
77
|
-
outline: "border border-input bg-background shadow-sm hover:bg-
|
|
77
|
+
outline: "border border-input bg-background shadow-sm hover:bg-hover disabled:opacity-50 disabled:bg-muted/20 disabled:text-muted-foreground",
|
|
78
78
|
secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 disabled:opacity-50",
|
|
79
|
-
ghost: "text-foreground hover:bg-
|
|
79
|
+
ghost: "text-foreground hover:bg-hover disabled:text-muted-foreground disabled:bg-muted/30 disabled:opacity-70",
|
|
80
80
|
link: "text-primary underline-offset-4 hover:underline disabled:opacity-50 disabled:text-muted-foreground"
|
|
81
81
|
},
|
|
82
82
|
size: {
|
|
@@ -388,7 +388,7 @@ var SelectItem = React20__namespace.forwardRef(({ className, children, ...props
|
|
|
388
388
|
{
|
|
389
389
|
ref,
|
|
390
390
|
className: cn(
|
|
391
|
-
"relative flex w-full cursor-default select-none items-start rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-
|
|
391
|
+
"relative flex w-full cursor-default select-none items-start rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
392
392
|
className
|
|
393
393
|
),
|
|
394
394
|
...props,
|
|
@@ -542,10 +542,10 @@ var accordionTriggerVariants = classVarianceAuthority.cva(
|
|
|
542
542
|
variants: {
|
|
543
543
|
variant: {
|
|
544
544
|
default: "hover:text-foreground/80",
|
|
545
|
-
bordered: "px-4 hover:bg-
|
|
546
|
-
card: "px-4 hover:bg-
|
|
547
|
-
filled: "px-4 hover:bg-
|
|
548
|
-
ghost: "px-2 rounded-md hover:bg-
|
|
545
|
+
bordered: "px-4 hover:bg-hover",
|
|
546
|
+
card: "px-4 hover:bg-hover",
|
|
547
|
+
filled: "px-4 hover:bg-hover",
|
|
548
|
+
ghost: "px-2 rounded-md hover:bg-hover"
|
|
549
549
|
}
|
|
550
550
|
},
|
|
551
551
|
defaultVariants: {
|
|
@@ -722,7 +722,7 @@ var DropdownMenuSubTrigger = React20__namespace.forwardRef(({ className, inset,
|
|
|
722
722
|
ref,
|
|
723
723
|
className: cn(
|
|
724
724
|
"flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
725
|
-
"focus:bg-
|
|
725
|
+
"focus:bg-hover",
|
|
726
726
|
"data-[state=open]:bg-accent",
|
|
727
727
|
inset && "pl-8",
|
|
728
728
|
className
|
|
@@ -776,7 +776,7 @@ var DropdownMenuItem = React20__namespace.forwardRef(({ className, inset, destru
|
|
|
776
776
|
ref,
|
|
777
777
|
className: cn(
|
|
778
778
|
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors",
|
|
779
|
-
"focus:bg-
|
|
779
|
+
"focus:bg-hover",
|
|
780
780
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
781
781
|
inset && "pl-8",
|
|
782
782
|
destructive && "text-destructive focus:text-destructive",
|
|
@@ -792,7 +792,7 @@ var DropdownMenuCheckboxItem = React20__namespace.forwardRef(({ className, child
|
|
|
792
792
|
ref,
|
|
793
793
|
className: cn(
|
|
794
794
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",
|
|
795
|
-
"focus:bg-
|
|
795
|
+
"focus:bg-hover",
|
|
796
796
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
797
797
|
className
|
|
798
798
|
),
|
|
@@ -811,7 +811,7 @@ var DropdownMenuRadioItem = React20__namespace.forwardRef(({ className, children
|
|
|
811
811
|
ref,
|
|
812
812
|
className: cn(
|
|
813
813
|
"relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors",
|
|
814
|
-
"focus:bg-
|
|
814
|
+
"focus:bg-hover",
|
|
815
815
|
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
816
816
|
className
|
|
817
817
|
),
|
|
@@ -1563,7 +1563,7 @@ var TableRow = React20__namespace.forwardRef(
|
|
|
1563
1563
|
{
|
|
1564
1564
|
ref,
|
|
1565
1565
|
className: cn(
|
|
1566
|
-
"border-b transition-colors hover:bg-
|
|
1566
|
+
"border-b transition-colors hover:bg-hover data-[state=selected]:bg-muted",
|
|
1567
1567
|
className
|
|
1568
1568
|
),
|
|
1569
1569
|
...props
|
|
@@ -2695,8 +2695,7 @@ function Chip({
|
|
|
2695
2695
|
// Clickable state
|
|
2696
2696
|
isClickable && [
|
|
2697
2697
|
"cursor-pointer",
|
|
2698
|
-
"hover:bg-
|
|
2699
|
-
"hover:border-accent",
|
|
2698
|
+
"hover:bg-hover",
|
|
2700
2699
|
"hover:shadow-md"
|
|
2701
2700
|
],
|
|
2702
2701
|
// Non-clickable state
|
|
@@ -2856,7 +2855,7 @@ function Calendar({
|
|
|
2856
2855
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2857
2856
|
SelectTrigger,
|
|
2858
2857
|
{
|
|
2859
|
-
className: "h-7 w-[110px] text-sm font-medium border-none shadow-none hover:bg-
|
|
2858
|
+
className: "h-7 w-[110px] text-sm font-medium border-none shadow-none hover:bg-hover focus:ring-0 px-2",
|
|
2860
2859
|
"aria-label": "Select month",
|
|
2861
2860
|
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { children: MONTHS[month] })
|
|
2862
2861
|
}
|
|
@@ -2878,7 +2877,7 @@ function Calendar({
|
|
|
2878
2877
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2879
2878
|
SelectTrigger,
|
|
2880
2879
|
{
|
|
2881
|
-
className: "h-7 w-[70px] text-sm font-medium border-none shadow-none hover:bg-
|
|
2880
|
+
className: "h-7 w-[70px] text-sm font-medium border-none shadow-none hover:bg-hover focus:ring-0 px-2",
|
|
2882
2881
|
"aria-label": "Select year",
|
|
2883
2882
|
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { children: year })
|
|
2884
2883
|
}
|
|
@@ -3529,7 +3528,7 @@ function HeaderCell({
|
|
|
3529
3528
|
"flex items-center gap-1 px-3 py-2 h-full",
|
|
3530
3529
|
isResizable && "pr-6",
|
|
3531
3530
|
// Extra padding to create space for resize handle
|
|
3532
|
-
isSortable && "cursor-pointer hover:bg-
|
|
3531
|
+
isSortable && "cursor-pointer hover:bg-hover",
|
|
3533
3532
|
column.align === "center" && "justify-center",
|
|
3534
3533
|
column.align === "right" && "justify-end"
|
|
3535
3534
|
),
|
|
@@ -3600,7 +3599,7 @@ function HeaderCell({
|
|
|
3600
3599
|
className: cn(
|
|
3601
3600
|
"absolute top-0 right-0 w-4 h-full cursor-col-resize z-10",
|
|
3602
3601
|
"flex items-center justify-center",
|
|
3603
|
-
"hover:bg-
|
|
3602
|
+
"hover:bg-hover transition-colors",
|
|
3604
3603
|
"group",
|
|
3605
3604
|
isResizing && "bg-accent"
|
|
3606
3605
|
),
|
|
@@ -5230,7 +5229,7 @@ function DataGrid({
|
|
|
5230
5229
|
"absolute top-0 left-0 transition-colors border-b border-border",
|
|
5231
5230
|
onRowClick && "cursor-pointer",
|
|
5232
5231
|
isSelected && "bg-accent/20",
|
|
5233
|
-
!isSelected && "hover:bg-
|
|
5232
|
+
!isSelected && "hover:bg-hover",
|
|
5234
5233
|
rowClassName && rowClassName(row, virtualRow.index)
|
|
5235
5234
|
),
|
|
5236
5235
|
style: {
|
|
@@ -5426,7 +5425,7 @@ function DataGrid({
|
|
|
5426
5425
|
"flex border-b border-border transition-colors",
|
|
5427
5426
|
onRowClick && "cursor-pointer",
|
|
5428
5427
|
isSelected && "bg-accent/20",
|
|
5429
|
-
!isSelected && "hover:bg-
|
|
5428
|
+
!isSelected && "hover:bg-hover",
|
|
5430
5429
|
rowClassName && rowClassName(row, rowIndex)
|
|
5431
5430
|
),
|
|
5432
5431
|
style: { width: tableWidth ? `${tableWidth}px` : "100%" },
|
|
@@ -5675,8 +5674,8 @@ function Autocomplete({
|
|
|
5675
5674
|
onClick: () => handleSelect(option.value),
|
|
5676
5675
|
className: cn(
|
|
5677
5676
|
"relative flex w-full cursor-pointer select-none items-start gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
5678
|
-
"hover:bg-
|
|
5679
|
-
"focus:bg-
|
|
5677
|
+
"hover:bg-hover",
|
|
5678
|
+
"focus:bg-hover",
|
|
5680
5679
|
option.disabled && "pointer-events-none opacity-50",
|
|
5681
5680
|
value === option.value && "bg-accent/50"
|
|
5682
5681
|
),
|
|
@@ -5716,7 +5715,7 @@ function Autocomplete({
|
|
|
5716
5715
|
role: "button",
|
|
5717
5716
|
tabIndex: -1,
|
|
5718
5717
|
onClick: handleClear,
|
|
5719
|
-
className: "rounded-sm hover:bg-
|
|
5718
|
+
className: "rounded-sm hover:bg-hover p-0.5",
|
|
5720
5719
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5721
5720
|
}
|
|
5722
5721
|
),
|
|
@@ -5750,7 +5749,7 @@ function Autocomplete({
|
|
|
5750
5749
|
{
|
|
5751
5750
|
type: "button",
|
|
5752
5751
|
onClick: () => setSearch(""),
|
|
5753
|
-
className: "p-1 hover:bg-
|
|
5752
|
+
className: "p-1 hover:bg-hover rounded-sm",
|
|
5754
5753
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5755
5754
|
}
|
|
5756
5755
|
)
|
|
@@ -5881,7 +5880,7 @@ function MultiSelect({
|
|
|
5881
5880
|
onClick: () => handleToggle(option.value),
|
|
5882
5881
|
className: cn(
|
|
5883
5882
|
"relative flex w-full cursor-pointer select-none items-start gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
5884
|
-
"hover:bg-
|
|
5883
|
+
"hover:bg-hover",
|
|
5885
5884
|
option.disabled && "pointer-events-none opacity-50"
|
|
5886
5885
|
),
|
|
5887
5886
|
children: [
|
|
@@ -5931,7 +5930,7 @@ function MultiSelect({
|
|
|
5931
5930
|
role: "button",
|
|
5932
5931
|
tabIndex: -1,
|
|
5933
5932
|
onClick: (e) => handleRemove(safeValue[i], e),
|
|
5934
|
-
className: "rounded-sm hover:bg-
|
|
5933
|
+
className: "rounded-sm hover:bg-hover p-0.5",
|
|
5935
5934
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3 w-3" })
|
|
5936
5935
|
}
|
|
5937
5936
|
)
|
|
@@ -5951,7 +5950,7 @@ function MultiSelect({
|
|
|
5951
5950
|
role: "button",
|
|
5952
5951
|
tabIndex: -1,
|
|
5953
5952
|
onClick: handleClearAll,
|
|
5954
|
-
className: "rounded-sm hover:bg-
|
|
5953
|
+
className: "rounded-sm hover:bg-hover p-0.5",
|
|
5955
5954
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5956
5955
|
}
|
|
5957
5956
|
),
|
|
@@ -5985,7 +5984,7 @@ function MultiSelect({
|
|
|
5985
5984
|
{
|
|
5986
5985
|
type: "button",
|
|
5987
5986
|
onClick: () => setSearch(""),
|
|
5988
|
-
className: "p-1 hover:bg-
|
|
5987
|
+
className: "p-1 hover:bg-hover rounded-sm",
|
|
5989
5988
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5990
5989
|
}
|
|
5991
5990
|
)
|
|
@@ -5999,7 +5998,7 @@ function MultiSelect({
|
|
|
5999
5998
|
onClick: handleSelectAll,
|
|
6000
5999
|
className: cn(
|
|
6001
6000
|
"relative flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
6002
|
-
"hover:bg-
|
|
6001
|
+
"hover:bg-hover"
|
|
6003
6002
|
),
|
|
6004
6003
|
children: [
|
|
6005
6004
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6171,8 +6170,8 @@ function Combobox({
|
|
|
6171
6170
|
onClick: () => handleSelect(option.value),
|
|
6172
6171
|
className: cn(
|
|
6173
6172
|
"relative flex w-full cursor-pointer select-none items-start gap-2 rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
6174
|
-
"hover:bg-
|
|
6175
|
-
"focus:bg-
|
|
6173
|
+
"hover:bg-hover",
|
|
6174
|
+
"focus:bg-hover",
|
|
6176
6175
|
option.disabled && "pointer-events-none opacity-50",
|
|
6177
6176
|
value === option.value && "bg-accent/50"
|
|
6178
6177
|
),
|
|
@@ -6226,7 +6225,7 @@ function Combobox({
|
|
|
6226
6225
|
tabIndex: -1,
|
|
6227
6226
|
onMouseDown: (e) => e.preventDefault(),
|
|
6228
6227
|
onClick: handleClear,
|
|
6229
|
-
className: "rounded-sm hover:bg-
|
|
6228
|
+
className: "rounded-sm hover:bg-hover p-0.5",
|
|
6230
6229
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
6231
6230
|
}
|
|
6232
6231
|
),
|
|
@@ -6279,41 +6278,41 @@ var iconButtonVariants = classVarianceAuthority.cva(
|
|
|
6279
6278
|
variants: {
|
|
6280
6279
|
variant: {
|
|
6281
6280
|
/**
|
|
6282
|
-
* Default - subtle
|
|
6281
|
+
* Default - subtle hover tint
|
|
6283
6282
|
*/
|
|
6284
6283
|
default: [
|
|
6285
6284
|
"bg-transparent text-muted-foreground",
|
|
6286
|
-
"hover:bg-
|
|
6285
|
+
"hover:bg-hover",
|
|
6287
6286
|
"border border-transparent"
|
|
6288
6287
|
],
|
|
6289
6288
|
/**
|
|
6290
|
-
* Ghost - no background,
|
|
6289
|
+
* Ghost - no background, subtle hover tint
|
|
6291
6290
|
*/
|
|
6292
6291
|
ghost: [
|
|
6293
6292
|
"bg-transparent text-muted-foreground",
|
|
6294
|
-
"hover:bg-
|
|
6293
|
+
"hover:bg-hover"
|
|
6295
6294
|
],
|
|
6296
6295
|
/**
|
|
6297
|
-
* Outline -
|
|
6296
|
+
* Outline - bordered, subtle hover tint
|
|
6298
6297
|
*/
|
|
6299
6298
|
outline: [
|
|
6300
6299
|
"bg-transparent text-muted-foreground",
|
|
6301
6300
|
"border border-border",
|
|
6302
|
-
"hover:bg-
|
|
6301
|
+
"hover:bg-hover"
|
|
6303
6302
|
],
|
|
6304
6303
|
/**
|
|
6305
|
-
* Filled - accent background
|
|
6304
|
+
* Filled - accent background (branded; darkens on hover)
|
|
6306
6305
|
*/
|
|
6307
6306
|
filled: [
|
|
6308
6307
|
"bg-accent text-accent-foreground",
|
|
6309
6308
|
"hover:bg-accent/90 hover:shadow-sm"
|
|
6310
6309
|
],
|
|
6311
6310
|
/**
|
|
6312
|
-
* Muted - muted background with
|
|
6311
|
+
* Muted - muted background with subtle hover tint
|
|
6313
6312
|
*/
|
|
6314
6313
|
muted: [
|
|
6315
6314
|
"bg-muted text-muted-foreground",
|
|
6316
|
-
"hover:bg-
|
|
6315
|
+
"hover:bg-hover"
|
|
6317
6316
|
]
|
|
6318
6317
|
},
|
|
6319
6318
|
size: {
|
|
@@ -6730,6 +6729,7 @@ function themeToHsl(theme) {
|
|
|
6730
6729
|
toggleTrack: theme.toggleTrack ? hexToHsl(theme.toggleTrack) : void 0,
|
|
6731
6730
|
toggleTrackForeground: theme.toggleTrackForeground ? hexToHsl(theme.toggleTrackForeground) : void 0,
|
|
6732
6731
|
inputHover: theme.inputHover ? hexToHsl(theme.inputHover) : void 0,
|
|
6732
|
+
hover: theme.hover ? hexToHsl(theme.hover) : void 0,
|
|
6733
6733
|
chart1: hexToHsl(theme.chart1),
|
|
6734
6734
|
chart2: hexToHsl(theme.chart2),
|
|
6735
6735
|
chart3: hexToHsl(theme.chart3),
|
|
@@ -6753,6 +6753,11 @@ function deriveInputHoverHsl(hslTheme) {
|
|
|
6753
6753
|
}
|
|
6754
6754
|
return hslTheme.foreground;
|
|
6755
6755
|
}
|
|
6756
|
+
var HOVER_PRIMARY_MIN_CONTRAST = 2;
|
|
6757
|
+
function deriveHoverChannels(theme, hslTheme) {
|
|
6758
|
+
const primaryBgContrast = getContrastRatio(theme.primary, theme.background);
|
|
6759
|
+
return primaryBgContrast >= HOVER_PRIMARY_MIN_CONTRAST ? hslTheme.primary : hslTheme.foreground;
|
|
6760
|
+
}
|
|
6756
6761
|
function applyTheme(theme, targetElement) {
|
|
6757
6762
|
const element = targetElement || document.documentElement;
|
|
6758
6763
|
const hslTheme = themeToHsl(theme);
|
|
@@ -6807,6 +6812,10 @@ function applyTheme(theme, targetElement) {
|
|
|
6807
6812
|
"--input-hover",
|
|
6808
6813
|
hslTheme.inputHover ?? deriveInputHoverHsl(hslTheme)
|
|
6809
6814
|
);
|
|
6815
|
+
element.style.setProperty(
|
|
6816
|
+
"--hover",
|
|
6817
|
+
`${hslTheme.hover ?? deriveHoverChannels(theme, hslTheme)} / 0.12`
|
|
6818
|
+
);
|
|
6810
6819
|
element.style.setProperty("--chart-1", hslTheme.chart1);
|
|
6811
6820
|
element.style.setProperty("--chart-2", hslTheme.chart2);
|
|
6812
6821
|
element.style.setProperty("--chart-3", hslTheme.chart3);
|
|
@@ -6924,6 +6933,7 @@ function areThemesEqual(theme1, theme2) {
|
|
|
6924
6933
|
"toggleTrack",
|
|
6925
6934
|
"toggleTrackForeground",
|
|
6926
6935
|
"inputHover",
|
|
6936
|
+
"hover",
|
|
6927
6937
|
"chart1",
|
|
6928
6938
|
"chart2",
|
|
6929
6939
|
"chart3",
|
|
@@ -6967,6 +6977,25 @@ function importTheme(jsonString) {
|
|
|
6967
6977
|
};
|
|
6968
6978
|
}
|
|
6969
6979
|
}
|
|
6980
|
+
function hexToLinearRgb(hex) {
|
|
6981
|
+
hex = hex.replace(/^#/, "");
|
|
6982
|
+
const r = parseInt(hex.substring(0, 2), 16) / 255;
|
|
6983
|
+
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
6984
|
+
const b = parseInt(hex.substring(4, 6), 16) / 255;
|
|
6985
|
+
const toLinear = (c) => c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
|
|
6986
|
+
return [toLinear(r), toLinear(g), toLinear(b)];
|
|
6987
|
+
}
|
|
6988
|
+
function getRelativeLuminance(hex) {
|
|
6989
|
+
const [r, g, b] = hexToLinearRgb(hex);
|
|
6990
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
6991
|
+
}
|
|
6992
|
+
function getContrastRatio(hex1, hex2) {
|
|
6993
|
+
const l1 = getRelativeLuminance(hex1);
|
|
6994
|
+
const l2 = getRelativeLuminance(hex2);
|
|
6995
|
+
const lighter = Math.max(l1, l2);
|
|
6996
|
+
const darker = Math.min(l1, l2);
|
|
6997
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
6998
|
+
}
|
|
6970
6999
|
function ThemeSwatch({ theme, isSelected, onClick }) {
|
|
6971
7000
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6972
7001
|
Tooltip,
|
|
@@ -6984,7 +7013,7 @@ function ThemeSwatch({ theme, isSelected, onClick }) {
|
|
|
6984
7013
|
onClick,
|
|
6985
7014
|
className: cn(
|
|
6986
7015
|
"relative flex flex-col items-center gap-1.5 p-2 rounded-lg transition-all",
|
|
6987
|
-
"hover:bg-
|
|
7016
|
+
"hover:bg-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
6988
7017
|
isSelected && "bg-accent ring-2 ring-primary"
|
|
6989
7018
|
),
|
|
6990
7019
|
children: [
|
|
@@ -7219,8 +7248,8 @@ function MenuItem({ item, onClose, depth = 0 }) {
|
|
|
7219
7248
|
className: cn(
|
|
7220
7249
|
"w-full flex items-center gap-3 px-3 py-2 text-sm rounded-sm",
|
|
7221
7250
|
"transition-colors text-left",
|
|
7222
|
-
"focus:outline-none focus:bg-
|
|
7223
|
-
item.disabled ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-
|
|
7251
|
+
"focus:outline-none focus:bg-hover",
|
|
7252
|
+
item.disabled ? "opacity-50 cursor-not-allowed text-muted-foreground" : "hover:bg-hover cursor-pointer",
|
|
7224
7253
|
item.destructive && !item.disabled && "text-destructive hover:text-destructive"
|
|
7225
7254
|
),
|
|
7226
7255
|
children: [
|
|
@@ -8217,7 +8246,7 @@ function DefaultErrorState({ error }) {
|
|
|
8217
8246
|
onClick: error.onRetry,
|
|
8218
8247
|
className: cn(
|
|
8219
8248
|
"rounded-md border border-border bg-background px-3 py-1.5 text-sm text-foreground",
|
|
8220
|
-
"transition-colors hover:bg-
|
|
8249
|
+
"transition-colors hover:bg-hover"
|
|
8221
8250
|
),
|
|
8222
8251
|
children: "Retry"
|
|
8223
8252
|
}
|