@omnitron-dev/prism 0.3.0 → 0.3.1
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 +148 -0
- package/dist/blocks/index.js +3 -1
- package/dist/blocks/index.js.map +1 -1
- package/dist/{chunk-S6SEGBX6.js → chunk-472SOF76.js} +4 -4
- package/dist/{chunk-S6SEGBX6.js.map → chunk-472SOF76.js.map} +1 -1
- package/dist/{chunk-Z5OSPAOC.js → chunk-4Z5DE5GK.js} +78 -75
- package/dist/chunk-4Z5DE5GK.js.map +1 -0
- package/dist/chunk-52PQL67Q.js +559 -0
- package/dist/chunk-52PQL67Q.js.map +1 -0
- package/dist/chunk-75FQ5IW3.js +590 -0
- package/dist/chunk-75FQ5IW3.js.map +1 -0
- package/dist/{chunk-6AHI4GSV.js → chunk-7G5D5PTC.js} +4 -3
- package/dist/chunk-7G5D5PTC.js.map +1 -0
- package/dist/chunk-BJE2AKD4.js +105 -0
- package/dist/chunk-BJE2AKD4.js.map +1 -0
- package/dist/chunk-FF5RF32O.js +248 -0
- package/dist/chunk-FF5RF32O.js.map +1 -0
- package/dist/{chunk-OBJ244BO.js → chunk-GMIE6III.js} +9 -42
- package/dist/chunk-GMIE6III.js.map +1 -0
- package/dist/chunk-GUGTDURV.js +826 -0
- package/dist/chunk-GUGTDURV.js.map +1 -0
- package/dist/chunk-HOXFSQUV.js +573 -0
- package/dist/chunk-HOXFSQUV.js.map +1 -0
- package/dist/chunk-JSQTYDPG.js +3 -0
- package/dist/chunk-JSQTYDPG.js.map +1 -0
- package/dist/{chunk-ZTATTUH7.js → chunk-KQ67XB6T.js} +213 -651
- package/dist/chunk-KQ67XB6T.js.map +1 -0
- package/dist/{chunk-WFD54GQQ.js → chunk-LOY2NPCO.js} +14 -573
- package/dist/chunk-LOY2NPCO.js.map +1 -0
- package/dist/{chunk-YQW43BDH.js → chunk-LSPFFEJT.js} +240 -1824
- package/dist/chunk-LSPFFEJT.js.map +1 -0
- package/dist/{chunk-BZOL7GMU.js → chunk-OKTLA23Q.js} +4 -4
- package/dist/chunk-OKTLA23Q.js.map +1 -0
- package/dist/chunk-PFT2BNYO.js +191 -0
- package/dist/chunk-PFT2BNYO.js.map +1 -0
- package/dist/chunk-PGHEP4JD.js +106 -0
- package/dist/chunk-PGHEP4JD.js.map +1 -0
- package/dist/chunk-PXXPLHIY.js +74 -0
- package/dist/chunk-PXXPLHIY.js.map +1 -0
- package/dist/chunk-SU3LVQ7N.js +518 -0
- package/dist/chunk-SU3LVQ7N.js.map +1 -0
- package/dist/chunk-YHE7HXSG.js +206 -0
- package/dist/chunk-YHE7HXSG.js.map +1 -0
- package/dist/cli/index.js +7 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/admin-filters/admin-data-table.d.ts.map +1 -1
- package/dist/components/admin-filters/filter-toolbar.d.ts.map +1 -1
- package/dist/components/date-input/date-input.d.ts +27 -0
- package/dist/components/date-input/date-input.d.ts.map +1 -0
- package/dist/components/date-input/index.d.ts +4 -0
- package/dist/components/date-input/index.d.ts.map +1 -0
- package/dist/components/date-input/value.d.ts +9 -0
- package/dist/components/date-input/value.d.ts.map +1 -0
- package/dist/components/doc-layout/doc-sidebar.d.ts +4 -1
- package/dist/components/doc-layout/doc-sidebar.d.ts.map +1 -1
- package/dist/components/doc-layout/index.js +6 -0
- package/dist/components/doc-layout/index.js.map +1 -0
- package/dist/components/editor/editor.d.ts.map +1 -1
- package/dist/components/editor/icons/index.d.ts +32 -40
- package/dist/components/editor/icons/index.d.ts.map +1 -1
- package/dist/components/editor/index.js +3 -1
- package/dist/components/error-boundary/error-boundary.d.ts.map +1 -1
- package/dist/components/index.css +4 -0
- package/dist/components/index.css.map +1 -1
- package/dist/components/index.d.ts +4 -4
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +18 -8
- package/dist/components/knowledge-graph/edge-labels.d.ts +14 -0
- package/dist/components/knowledge-graph/edge-labels.d.ts.map +1 -0
- package/dist/components/knowledge-graph/graph.d.ts +56 -0
- package/dist/components/knowledge-graph/graph.d.ts.map +1 -0
- package/dist/components/knowledge-graph/index.css +176 -0
- package/dist/components/knowledge-graph/index.css.map +1 -0
- package/dist/components/knowledge-graph/index.d.ts +3 -0
- package/dist/components/knowledge-graph/index.d.ts.map +1 -0
- package/dist/components/knowledge-graph/index.js +795 -0
- package/dist/components/knowledge-graph/index.js.map +1 -0
- package/dist/components/knowledge-graph/label-layout.d.ts +28 -0
- package/dist/components/knowledge-graph/label-layout.d.ts.map +1 -0
- package/dist/components/knowledge-graph/label-store.d.ts +15 -0
- package/dist/components/knowledge-graph/label-store.d.ts.map +1 -0
- package/dist/components/knowledge-graph/model.d.ts +92 -0
- package/dist/components/knowledge-graph/model.d.ts.map +1 -0
- package/dist/components/lightbox/lightbox.d.ts.map +1 -1
- package/dist/components/map/Map.d.ts +19 -43
- package/dist/components/map/Map.d.ts.map +1 -1
- package/dist/components/map/MapCoverageLayer.d.ts +1 -1
- package/dist/components/map/MapCoverageLayer.d.ts.map +1 -1
- package/dist/components/map/MapMarker.d.ts +1 -1
- package/dist/components/map/MapMarker.d.ts.map +1 -1
- package/dist/components/map/MapPlaceSearch.d.ts +33 -0
- package/dist/components/map/MapPlaceSearch.d.ts.map +1 -0
- package/dist/components/map/MapPointPicker.d.ts +21 -12
- package/dist/components/map/MapPointPicker.d.ts.map +1 -1
- package/dist/components/map/coordinates.d.ts +10 -0
- package/dist/components/map/coordinates.d.ts.map +1 -0
- package/dist/components/map/index.css +4 -0
- package/dist/components/map/index.css.map +1 -0
- package/dist/components/map/index.d.ts +7 -2
- package/dist/components/map/index.d.ts.map +1 -1
- package/dist/components/map/index.js +3 -0
- package/dist/components/map/index.js.map +1 -0
- package/dist/components/nav-card/nav-card.d.ts.map +1 -1
- package/dist/components/rail/rail.d.ts.map +1 -1
- package/dist/components/research/diagram-image.d.ts +11 -0
- package/dist/components/research/diagram-image.d.ts.map +1 -0
- package/dist/components/research/diagram.d.ts +8 -0
- package/dist/components/research/diagram.d.ts.map +1 -0
- package/dist/components/research/document.d.ts +33 -0
- package/dist/components/research/document.d.ts.map +1 -0
- package/dist/components/research/frontmatter.d.ts +15 -0
- package/dist/components/research/frontmatter.d.ts.map +1 -0
- package/dist/components/research/index.css +51 -0
- package/dist/components/research/index.css.map +1 -0
- package/dist/components/research/index.d.ts +3 -0
- package/dist/components/research/index.d.ts.map +1 -0
- package/dist/components/research/index.js +6 -0
- package/dist/components/research/index.js.map +1 -0
- package/dist/components/research/parse.d.ts +29 -0
- package/dist/components/research/parse.d.ts.map +1 -0
- package/dist/components/research-editor/block-commands.d.ts +20 -0
- package/dist/components/research-editor/block-commands.d.ts.map +1 -0
- package/dist/components/research-editor/block-controls.d.ts +13 -0
- package/dist/components/research-editor/block-controls.d.ts.map +1 -0
- package/dist/components/research-editor/editor.d.ts +75 -0
- package/dist/components/research-editor/editor.d.ts.map +1 -0
- package/dist/components/research-editor/extensions.d.ts +14 -0
- package/dist/components/research-editor/extensions.d.ts.map +1 -0
- package/dist/components/research-editor/index.css +332 -0
- package/dist/components/research-editor/index.css.map +1 -0
- package/dist/components/research-editor/index.d.ts +5 -0
- package/dist/components/research-editor/index.d.ts.map +1 -0
- package/dist/components/research-editor/index.js +1592 -0
- package/dist/components/research-editor/index.js.map +1 -0
- package/dist/components/research-editor/math-input.d.ts +32 -0
- package/dist/components/research-editor/math-input.d.ts.map +1 -0
- package/dist/components/research-editor/math-markup.d.ts +4 -0
- package/dist/components/research-editor/math-markup.d.ts.map +1 -0
- package/dist/components/research-editor/math-navigation.d.ts +6 -0
- package/dist/components/research-editor/math-navigation.d.ts.map +1 -0
- package/dist/components/research-editor/math-node.d.ts +11 -0
- package/dist/components/research-editor/math-node.d.ts.map +1 -0
- package/dist/components/research-editor/source.d.ts +19 -0
- package/dist/components/research-editor/source.d.ts.map +1 -0
- package/dist/components/scrollbar/scrollbar.d.ts +4 -2
- package/dist/components/scrollbar/scrollbar.d.ts.map +1 -1
- package/dist/components/search-input/search-input.d.ts +0 -10
- package/dist/components/search-input/search-input.d.ts.map +1 -1
- package/dist/components/tiptap-renderer/tiptap-renderer.d.ts +4 -3
- package/dist/components/tiptap-renderer/tiptap-renderer.d.ts.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +8 -4
- package/dist/core/provider.d.ts +7 -2
- package/dist/core/provider.d.ts.map +1 -1
- package/dist/forms/schema-provider.d.ts +3 -3
- package/dist/forms/schema-utils.d.ts +3 -3
- package/dist/hooks/index.js +9 -5
- package/dist/icons/context.d.ts +17 -0
- package/dist/icons/context.d.ts.map +1 -0
- package/dist/icons/controls.d.ts +51 -0
- package/dist/icons/controls.d.ts.map +1 -0
- package/dist/icons/index.d.ts +3 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +4 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/icons/theme.d.ts +4 -0
- package/dist/icons/theme.d.ts.map +1 -0
- package/dist/index.css +4 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/layouts/core/header-section.d.ts.map +1 -1
- package/dist/layouts/dashboard/labels.d.ts +12 -0
- package/dist/layouts/dashboard/labels.d.ts.map +1 -0
- package/dist/layouts/dashboard/layout.d.ts +7 -1
- package/dist/layouts/dashboard/layout.d.ts.map +1 -1
- package/dist/layouts/dashboard/sidenav.d.ts +7 -3
- package/dist/layouts/dashboard/sidenav.d.ts.map +1 -1
- package/dist/layouts/index.d.ts +5 -0
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +6 -1
- package/dist/layouts/panel-layout.d.ts +35 -0
- package/dist/layouts/panel-layout.d.ts.map +1 -0
- package/dist/layouts/sidebar-toggle.d.ts +11 -0
- package/dist/layouts/sidebar-toggle.d.ts.map +1 -0
- package/dist/state/stores/auth.d.ts +4 -16
- package/dist/state/stores/auth.d.ts.map +1 -1
- package/dist/state/stores/ui.d.ts +7 -105
- package/dist/state/stores/ui.d.ts.map +1 -1
- package/dist/theme/components/Button.d.ts.map +1 -1
- package/dist/theme/components/FormControls.d.ts +3 -12
- package/dist/theme/components/FormControls.d.ts.map +1 -1
- package/dist/theme/components/index.d.ts.map +1 -1
- package/dist/theme/create-theme.d.ts +5 -17
- package/dist/theme/create-theme.d.ts.map +1 -1
- package/dist/theme/index.js +6 -2
- package/dist/theme/mixins.d.ts +3 -1
- package/dist/theme/mixins.d.ts.map +1 -1
- package/dist/theme/palette/overrides.d.ts +23 -0
- package/dist/theme/palette/overrides.d.ts.map +1 -0
- package/dist/ui/index.d.ts +18 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +148 -0
- package/dist/ui/index.js.map +1 -0
- package/package.json +92 -45
- package/dist/chunk-6AHI4GSV.js.map +0 -1
- package/dist/chunk-BZOL7GMU.js.map +0 -1
- package/dist/chunk-OBJ244BO.js.map +0 -1
- package/dist/chunk-WFD54GQQ.js.map +0 -1
- package/dist/chunk-YQW43BDH.js.map +0 -1
- package/dist/chunk-Z5OSPAOC.js.map +0 -1
- package/dist/chunk-ZTATTUH7.js.map +0 -1
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
// src/theme/utils/color.ts
|
|
2
|
+
function hexToRgb(hex) {
|
|
3
|
+
const h = hex.replace("#", "");
|
|
4
|
+
const expanded = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
|
|
5
|
+
const bigint = parseInt(expanded, 16);
|
|
6
|
+
const r = bigint >> 16 & 255;
|
|
7
|
+
const g = bigint >> 8 & 255;
|
|
8
|
+
const b = bigint & 255;
|
|
9
|
+
return [r, g, b];
|
|
10
|
+
}
|
|
11
|
+
function hexToRgbChannel(hex) {
|
|
12
|
+
const [r, g, b] = hexToRgb(hex);
|
|
13
|
+
return `${r} ${g} ${b}`;
|
|
14
|
+
}
|
|
15
|
+
function rgbToHex(r, g, b) {
|
|
16
|
+
const to2 = (n) => Math.round(n).toString(16).padStart(2, "0");
|
|
17
|
+
return `#${to2(r)}${to2(g)}${to2(b)}`.toUpperCase();
|
|
18
|
+
}
|
|
19
|
+
function hexToHsl(hex) {
|
|
20
|
+
const [r, g, b] = hexToRgb(hex);
|
|
21
|
+
const r1 = r / 255;
|
|
22
|
+
const g1 = g / 255;
|
|
23
|
+
const b1 = b / 255;
|
|
24
|
+
const max = Math.max(r1, g1, b1);
|
|
25
|
+
const min = Math.min(r1, g1, b1);
|
|
26
|
+
let h = 0;
|
|
27
|
+
let s = 0;
|
|
28
|
+
const l = (max + min) / 2;
|
|
29
|
+
const d = max - min;
|
|
30
|
+
if (d !== 0) {
|
|
31
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
32
|
+
switch (max) {
|
|
33
|
+
case r1:
|
|
34
|
+
h = (g1 - b1) / d + (g1 < b1 ? 6 : 0);
|
|
35
|
+
break;
|
|
36
|
+
case g1:
|
|
37
|
+
h = (b1 - r1) / d + 2;
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
h = (r1 - g1) / d + 4;
|
|
41
|
+
}
|
|
42
|
+
h /= 6;
|
|
43
|
+
}
|
|
44
|
+
return { h: h * 360, s: s * 100, l: l * 100 };
|
|
45
|
+
}
|
|
46
|
+
function hslToHex(h, s, l) {
|
|
47
|
+
const s1 = s / 100;
|
|
48
|
+
const l1 = l / 100;
|
|
49
|
+
const c = (1 - Math.abs(2 * l1 - 1)) * s1;
|
|
50
|
+
const x = c * (1 - Math.abs(h / 60 % 2 - 1));
|
|
51
|
+
const m = l1 - c / 2;
|
|
52
|
+
let r1;
|
|
53
|
+
let g1;
|
|
54
|
+
let b1;
|
|
55
|
+
if (h >= 0 && h < 60) {
|
|
56
|
+
[r1, g1, b1] = [c, x, 0];
|
|
57
|
+
} else if (h >= 60 && h < 120) {
|
|
58
|
+
[r1, g1, b1] = [x, c, 0];
|
|
59
|
+
} else if (h >= 120 && h < 180) {
|
|
60
|
+
[r1, g1, b1] = [0, c, x];
|
|
61
|
+
} else if (h >= 180 && h < 240) {
|
|
62
|
+
[r1, g1, b1] = [0, x, c];
|
|
63
|
+
} else if (h >= 240 && h < 300) {
|
|
64
|
+
[r1, g1, b1] = [x, 0, c];
|
|
65
|
+
} else {
|
|
66
|
+
[r1, g1, b1] = [c, 0, x];
|
|
67
|
+
}
|
|
68
|
+
return rgbToHex(Math.round((r1 + m) * 255), Math.round((g1 + m) * 255), Math.round((b1 + m) * 255));
|
|
69
|
+
}
|
|
70
|
+
function rgba(color, alpha) {
|
|
71
|
+
const [r, g, b] = hexToRgb(color);
|
|
72
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
73
|
+
}
|
|
74
|
+
function cssVarRgba(channel, alpha) {
|
|
75
|
+
return `rgba(${channel} / ${alpha})`;
|
|
76
|
+
}
|
|
77
|
+
function generatePaletteColorWithChannels(color) {
|
|
78
|
+
return {
|
|
79
|
+
...color,
|
|
80
|
+
lighterChannel: hexToRgbChannel(color.lighter),
|
|
81
|
+
lightChannel: hexToRgbChannel(color.light),
|
|
82
|
+
mainChannel: hexToRgbChannel(color.main),
|
|
83
|
+
darkChannel: hexToRgbChannel(color.dark),
|
|
84
|
+
darkerChannel: hexToRgbChannel(color.darker),
|
|
85
|
+
contrastTextChannel: hexToRgbChannel(color.contrastText)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function generateColorScaleWithChannels(scale) {
|
|
89
|
+
const shadeKeys = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
|
|
90
|
+
const channels = {};
|
|
91
|
+
for (const key of shadeKeys) {
|
|
92
|
+
const channelKey = `${key}Channel`;
|
|
93
|
+
channels[channelKey] = hexToRgbChannel(scale[key]);
|
|
94
|
+
}
|
|
95
|
+
return { ...scale, ...channels };
|
|
96
|
+
}
|
|
97
|
+
function clamp(n, min, max) {
|
|
98
|
+
return Math.max(min, Math.min(max, n));
|
|
99
|
+
}
|
|
100
|
+
function generateColorScale(baseColor) {
|
|
101
|
+
const base = hexToHsl(baseColor);
|
|
102
|
+
const tones = [
|
|
103
|
+
{ key: 50, lDelta: 40 },
|
|
104
|
+
{ key: 100, lDelta: 32 },
|
|
105
|
+
{ key: 200, lDelta: 24 },
|
|
106
|
+
{ key: 300, lDelta: 16 },
|
|
107
|
+
{ key: 400, lDelta: 8 },
|
|
108
|
+
{ key: 500, lDelta: 0 },
|
|
109
|
+
{ key: 600, lDelta: -8 },
|
|
110
|
+
{ key: 700, lDelta: -16 },
|
|
111
|
+
{ key: 800, lDelta: -24 },
|
|
112
|
+
{ key: 900, lDelta: -32 },
|
|
113
|
+
{ key: 950, lDelta: -40 }
|
|
114
|
+
];
|
|
115
|
+
const scale = {};
|
|
116
|
+
for (const { key, lDelta } of tones) {
|
|
117
|
+
const l = clamp(base.l + lDelta, 5, 95);
|
|
118
|
+
scale[key] = hslToHex(base.h, base.s, l);
|
|
119
|
+
}
|
|
120
|
+
return scale;
|
|
121
|
+
}
|
|
122
|
+
function createPaletteColorFromScale(scale, mode = "light") {
|
|
123
|
+
const mainColor = mode === "dark" ? scale[400] : scale[500];
|
|
124
|
+
const contrastText = getContrastText(mainColor, "#FFFFFF", "#212121");
|
|
125
|
+
if (mode === "dark") {
|
|
126
|
+
return {
|
|
127
|
+
lighter: scale[950],
|
|
128
|
+
light: scale[700],
|
|
129
|
+
main: mainColor,
|
|
130
|
+
dark: scale[300],
|
|
131
|
+
darker: scale[100],
|
|
132
|
+
contrastText
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
lighter: scale[50],
|
|
137
|
+
light: scale[400],
|
|
138
|
+
main: mainColor,
|
|
139
|
+
dark: scale[600],
|
|
140
|
+
darker: scale[900],
|
|
141
|
+
contrastText
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function invertColorScale(scale) {
|
|
145
|
+
return {
|
|
146
|
+
50: scale[950],
|
|
147
|
+
100: scale[800],
|
|
148
|
+
200: scale[700],
|
|
149
|
+
300: scale[600],
|
|
150
|
+
400: scale[500],
|
|
151
|
+
500: scale[400],
|
|
152
|
+
600: scale[300],
|
|
153
|
+
700: scale[200],
|
|
154
|
+
800: scale[100],
|
|
155
|
+
900: scale[50],
|
|
156
|
+
950: "#FFFFFF"
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function getLuminance(hex) {
|
|
160
|
+
const [r, g, b] = hexToRgb(hex).map((c) => {
|
|
161
|
+
const sRgb = c / 255;
|
|
162
|
+
return sRgb <= 0.03928 ? sRgb / 12.92 : Math.pow((sRgb + 0.055) / 1.055, 2.4);
|
|
163
|
+
});
|
|
164
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
165
|
+
}
|
|
166
|
+
function getContrastRatio(color1, color2) {
|
|
167
|
+
const l1 = getLuminance(color1);
|
|
168
|
+
const l2 = getLuminance(color2);
|
|
169
|
+
const lighter = Math.max(l1, l2);
|
|
170
|
+
const darker = Math.min(l1, l2);
|
|
171
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
172
|
+
}
|
|
173
|
+
function isLightColor(hex) {
|
|
174
|
+
return getLuminance(hex) > 0.5;
|
|
175
|
+
}
|
|
176
|
+
function getContrastText(background, lightText = "#FFFFFF", darkText = "#000000") {
|
|
177
|
+
return getContrastRatio(background, lightText) >= getContrastRatio(background, darkText) ? lightText : darkText;
|
|
178
|
+
}
|
|
179
|
+
function lighten(hex, amount) {
|
|
180
|
+
const hsl = hexToHsl(hex);
|
|
181
|
+
const newL = clamp(hsl.l + amount, 0, 100);
|
|
182
|
+
return hslToHex(hsl.h, hsl.s, newL);
|
|
183
|
+
}
|
|
184
|
+
function darken(hex, amount) {
|
|
185
|
+
const hsl = hexToHsl(hex);
|
|
186
|
+
const newL = clamp(hsl.l - amount, 0, 100);
|
|
187
|
+
return hslToHex(hsl.h, hsl.s, newL);
|
|
188
|
+
}
|
|
189
|
+
function mix(color1, color2, weight = 0.5) {
|
|
190
|
+
const [r1, g1, b1] = hexToRgb(color1);
|
|
191
|
+
const [r2, g2, b2] = hexToRgb(color2);
|
|
192
|
+
const w = clamp(weight, 0, 1);
|
|
193
|
+
const newR = Math.round(r1 * w + r2 * (1 - w));
|
|
194
|
+
const newG = Math.round(g1 * w + g2 * (1 - w));
|
|
195
|
+
const newB = Math.round(b1 * w + b2 * (1 - w));
|
|
196
|
+
return rgbToHex(newR, newG, newB);
|
|
197
|
+
}
|
|
198
|
+
function validateOpacity(opacity, color) {
|
|
199
|
+
const isCSSVar = (val) => val.includes("var(--");
|
|
200
|
+
const isPercentage = (val) => val.trim().endsWith("%");
|
|
201
|
+
const errors = {
|
|
202
|
+
invalid: `[varAlpha]: Invalid opacity "${opacity}" for "${color}".`,
|
|
203
|
+
range: "Must be a number between 0 and 1 (e.g., 0.48).",
|
|
204
|
+
format: 'Must be a percentage (e.g., "48%") or CSS variable (e.g., "var(--opacity)").'
|
|
205
|
+
};
|
|
206
|
+
if (typeof opacity === "string") {
|
|
207
|
+
if (isPercentage(opacity)) return opacity;
|
|
208
|
+
if (isCSSVar(opacity)) return `calc(${opacity} * 100%)`;
|
|
209
|
+
const parsed = parseFloat(opacity.trim());
|
|
210
|
+
if (!isNaN(parsed) && parsed >= 0 && parsed <= 1) {
|
|
211
|
+
return `${Number((parsed * 100).toFixed(2))}%`;
|
|
212
|
+
}
|
|
213
|
+
throw new Error(`${errors.invalid} ${errors.format}`);
|
|
214
|
+
}
|
|
215
|
+
if (typeof opacity === "number") {
|
|
216
|
+
if (opacity >= 0 && opacity <= 1) {
|
|
217
|
+
return `${Number((opacity * 100).toFixed(2))}%`;
|
|
218
|
+
}
|
|
219
|
+
throw new Error(`${errors.invalid} ${errors.range}`);
|
|
220
|
+
}
|
|
221
|
+
throw new Error(`${errors.invalid}`);
|
|
222
|
+
}
|
|
223
|
+
function varAlpha(color, opacity = 1) {
|
|
224
|
+
if (!color?.trim()) {
|
|
225
|
+
throw new Error("[varAlpha]: Color is undefined or empty!");
|
|
226
|
+
}
|
|
227
|
+
const isUnsupported = color.startsWith("#") || color.startsWith("rgb(") || color.startsWith("rgba(") || !color.includes("var") && color.includes("Channel");
|
|
228
|
+
if (isUnsupported) {
|
|
229
|
+
throw new Error(
|
|
230
|
+
[
|
|
231
|
+
`[varAlpha]: Unsupported color format "${color}"`,
|
|
232
|
+
"\u2705 Supported formats:",
|
|
233
|
+
' - RGB channels: "0 184 217"',
|
|
234
|
+
' - CSS variables: "var(--palette-primary-mainChannel)"',
|
|
235
|
+
" - currentColor",
|
|
236
|
+
"\u274C Unsupported formats:",
|
|
237
|
+
' - Hex: "#00B8D9"',
|
|
238
|
+
' - RGB: "rgb(0, 184, 217)"',
|
|
239
|
+
' - RGBA: "rgba(0, 184, 217, 1)"'
|
|
240
|
+
].join("\n")
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
const alpha = validateOpacity(opacity, color);
|
|
244
|
+
if (color.toLowerCase() === "currentcolor") {
|
|
245
|
+
return `color-mix(in srgb, currentColor ${alpha}, transparent)`;
|
|
246
|
+
}
|
|
247
|
+
return `rgba(${color} / ${alpha})`;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// src/theme/mixins.ts
|
|
251
|
+
function getHoverStyles(hoverOption, hoverBase) {
|
|
252
|
+
if (!hoverOption) return {};
|
|
253
|
+
return {
|
|
254
|
+
"&:hover": {
|
|
255
|
+
...hoverBase,
|
|
256
|
+
...typeof hoverOption === "object" ? hoverOption : {}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function filledStyles(theme, colorKey, options) {
|
|
261
|
+
if (!colorKey) {
|
|
262
|
+
if (process.env.NODE_ENV !== "production") {
|
|
263
|
+
console.warn("[Prism filledStyles] Missing colorKey parameter.");
|
|
264
|
+
}
|
|
265
|
+
return {};
|
|
266
|
+
}
|
|
267
|
+
const palette = theme.vars?.palette || theme.palette;
|
|
268
|
+
const grey = palette.grey;
|
|
269
|
+
if (colorKey === "default") {
|
|
270
|
+
const base2 = {
|
|
271
|
+
color: grey[800],
|
|
272
|
+
backgroundColor: grey[300]
|
|
273
|
+
};
|
|
274
|
+
const hover2 = getHoverStyles(options?.hover, {
|
|
275
|
+
backgroundColor: grey[400]
|
|
276
|
+
});
|
|
277
|
+
return { ...base2, ...hover2 };
|
|
278
|
+
}
|
|
279
|
+
if (colorKey === "inherit") {
|
|
280
|
+
const base2 = {
|
|
281
|
+
color: palette.common.white,
|
|
282
|
+
backgroundColor: grey[800]
|
|
283
|
+
};
|
|
284
|
+
const hover2 = getHoverStyles(options?.hover, {
|
|
285
|
+
backgroundColor: grey[700]
|
|
286
|
+
});
|
|
287
|
+
return { ...base2, ...hover2 };
|
|
288
|
+
}
|
|
289
|
+
if (colorKey === "white" || colorKey === "black") {
|
|
290
|
+
const oppositeColor = colorKey === "white" ? "black" : "white";
|
|
291
|
+
const base2 = {
|
|
292
|
+
color: palette.common[oppositeColor],
|
|
293
|
+
backgroundColor: palette.common[colorKey]
|
|
294
|
+
};
|
|
295
|
+
const hover2 = getHoverStyles(options?.hover, {
|
|
296
|
+
opacity: 0.8
|
|
297
|
+
});
|
|
298
|
+
return { ...base2, ...hover2 };
|
|
299
|
+
}
|
|
300
|
+
const paletteColor = palette[colorKey];
|
|
301
|
+
const base = {
|
|
302
|
+
color: paletteColor.contrastText,
|
|
303
|
+
backgroundColor: paletteColor.main
|
|
304
|
+
};
|
|
305
|
+
const hover = getHoverStyles(options?.hover, {
|
|
306
|
+
backgroundColor: paletteColor.dark
|
|
307
|
+
});
|
|
308
|
+
return { ...base, ...hover };
|
|
309
|
+
}
|
|
310
|
+
function softStyles(theme, colorKey, options) {
|
|
311
|
+
if (!colorKey) {
|
|
312
|
+
if (process.env.NODE_ENV !== "production") {
|
|
313
|
+
console.warn("[Prism softStyles] Missing colorKey parameter.");
|
|
314
|
+
}
|
|
315
|
+
return {};
|
|
316
|
+
}
|
|
317
|
+
const palette = theme.vars?.palette || theme.palette;
|
|
318
|
+
const grey = palette.grey;
|
|
319
|
+
if (colorKey === "default") {
|
|
320
|
+
return {
|
|
321
|
+
...filledStyles(theme, "default", options),
|
|
322
|
+
boxShadow: "none"
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
if (colorKey === "inherit") {
|
|
326
|
+
const greyChannel = grey["500Channel"] || "145, 158, 171";
|
|
327
|
+
const base2 = {
|
|
328
|
+
boxShadow: "none",
|
|
329
|
+
backgroundColor: varAlpha(greyChannel, 0.16)
|
|
330
|
+
};
|
|
331
|
+
const hover2 = getHoverStyles(options?.hover, {
|
|
332
|
+
backgroundColor: varAlpha(greyChannel, 0.32)
|
|
333
|
+
});
|
|
334
|
+
return { ...base2, ...hover2 };
|
|
335
|
+
}
|
|
336
|
+
if (colorKey === "white" || colorKey === "black") {
|
|
337
|
+
const base2 = {
|
|
338
|
+
boxShadow: "none",
|
|
339
|
+
color: palette.common[colorKey],
|
|
340
|
+
backgroundColor: varAlpha("currentColor", 0.08)
|
|
341
|
+
};
|
|
342
|
+
const hover2 = getHoverStyles(options?.hover, {
|
|
343
|
+
backgroundColor: varAlpha("currentColor", 0.16)
|
|
344
|
+
});
|
|
345
|
+
return { ...base2, ...hover2 };
|
|
346
|
+
}
|
|
347
|
+
const paletteColor = palette[colorKey];
|
|
348
|
+
const mainChannel = paletteColor.mainChannel || palette.primary.mainChannel || "51, 133, 240";
|
|
349
|
+
const base = {
|
|
350
|
+
boxShadow: "none",
|
|
351
|
+
color: paletteColor.dark,
|
|
352
|
+
backgroundColor: varAlpha(mainChannel, 0.16)
|
|
353
|
+
};
|
|
354
|
+
const hover = getHoverStyles(options?.hover, {
|
|
355
|
+
backgroundColor: varAlpha(mainChannel, 0.32)
|
|
356
|
+
});
|
|
357
|
+
return { ...base, ...hover };
|
|
358
|
+
}
|
|
359
|
+
function bgGradient(options) {
|
|
360
|
+
const { images, sizes, positions, colors, direction = "to bottom" } = options;
|
|
361
|
+
if (colors && colors.length > 0) {
|
|
362
|
+
return {
|
|
363
|
+
background: `linear-gradient(${direction}, ${colors.join(", ")})`
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
if (images && images.length > 0) {
|
|
367
|
+
return {
|
|
368
|
+
backgroundImage: images.join(", "),
|
|
369
|
+
backgroundSize: sizes?.join(", ") || "cover",
|
|
370
|
+
backgroundPosition: positions?.join(", ") || "center",
|
|
371
|
+
backgroundRepeat: "no-repeat"
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
return {};
|
|
375
|
+
}
|
|
376
|
+
function bgBlur(options) {
|
|
377
|
+
const { blur = 20, color = "rgba(255, 255, 255, 0.8)" } = options;
|
|
378
|
+
return {
|
|
379
|
+
backdropFilter: `blur(${blur}px)`,
|
|
380
|
+
WebkitBackdropFilter: `blur(${blur}px)`,
|
|
381
|
+
backgroundColor: color
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function paperStyles(theme, options) {
|
|
385
|
+
const { blur = 20, color, dropdown } = options ?? {};
|
|
386
|
+
const palette = theme.vars?.palette || theme.palette;
|
|
387
|
+
const baseStyles = {
|
|
388
|
+
backdropFilter: `blur(${blur}px)`,
|
|
389
|
+
WebkitBackdropFilter: `blur(${blur}px)`,
|
|
390
|
+
backgroundColor: color ?? varAlpha("255, 255, 255", 0.9)
|
|
391
|
+
};
|
|
392
|
+
if (dropdown) {
|
|
393
|
+
const customShadows = theme.customShadows;
|
|
394
|
+
const greyChannel = palette.grey["500Channel"] || "145, 158, 171";
|
|
395
|
+
return {
|
|
396
|
+
...baseStyles,
|
|
397
|
+
padding: theme.spacing(0.5),
|
|
398
|
+
boxShadow: customShadows?.dropdown || `0 0 2px 0 rgba(${greyChannel}, 0.24), -20px 20px 40px -4px rgba(${greyChannel}, 0.24)`,
|
|
399
|
+
borderRadius: `${Number(theme.shape.borderRadius) * 1.25}px`
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
return baseStyles;
|
|
403
|
+
}
|
|
404
|
+
function menuItemStyles(theme) {
|
|
405
|
+
const palette = theme.vars?.palette || theme.palette;
|
|
406
|
+
return {
|
|
407
|
+
...theme.typography.body2,
|
|
408
|
+
padding: theme.spacing(0.75, 1),
|
|
409
|
+
borderRadius: Number(theme.shape.borderRadius) * 0.75,
|
|
410
|
+
// `:not(:last-child)` is the universal sibling-position selector
|
|
411
|
+
// that works regardless of element type. `:last-of-type` only
|
|
412
|
+
// matches the last sibling of the SAME tag, so a fragment-rendered
|
|
413
|
+
// <Divider /> next to <MenuItem /> can fool it (Divider becomes
|
|
414
|
+
// the last-of-type MenuItem too, so the previous MenuItem keeps
|
|
415
|
+
// its margin instead of dropping it). Switching to :last-child
|
|
416
|
+
// also satisfies MUI v9's lint-against-of-type-selectors guidance.
|
|
417
|
+
"&:not(:last-child)": {
|
|
418
|
+
marginBottom: 4
|
|
419
|
+
},
|
|
420
|
+
"&.Mui-selected": {
|
|
421
|
+
fontWeight: theme.typography.fontWeightMedium,
|
|
422
|
+
backgroundColor: palette.action.selected,
|
|
423
|
+
"&:hover": { backgroundColor: palette.action.hover }
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
function maxLine(options) {
|
|
428
|
+
const { lines, lineHeight = 1.5 } = options;
|
|
429
|
+
return {
|
|
430
|
+
overflow: "hidden",
|
|
431
|
+
display: "-webkit-box",
|
|
432
|
+
WebkitBoxOrient: "vertical",
|
|
433
|
+
WebkitLineClamp: lines,
|
|
434
|
+
textOverflow: "ellipsis",
|
|
435
|
+
...lineHeight && { lineHeight }
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
function textGradient(direction, ...colors) {
|
|
439
|
+
return {
|
|
440
|
+
background: `linear-gradient(${direction}, ${colors.join(", ")})`,
|
|
441
|
+
WebkitBackgroundClip: "text",
|
|
442
|
+
WebkitTextFillColor: "transparent",
|
|
443
|
+
backgroundClip: "text",
|
|
444
|
+
textFillColor: "transparent",
|
|
445
|
+
display: "inline-block"
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
function borderGradient(options) {
|
|
449
|
+
const { color = "linear-gradient(135deg, #FF5630, #00AB55)", borderWidth = 2, borderRadius = 0 } = options;
|
|
450
|
+
return {
|
|
451
|
+
position: "relative",
|
|
452
|
+
border: "none",
|
|
453
|
+
borderRadius,
|
|
454
|
+
"&::before": {
|
|
455
|
+
content: '""',
|
|
456
|
+
position: "absolute",
|
|
457
|
+
inset: 0,
|
|
458
|
+
borderRadius: "inherit",
|
|
459
|
+
padding: borderWidth,
|
|
460
|
+
background: color,
|
|
461
|
+
WebkitMask: "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)",
|
|
462
|
+
WebkitMaskComposite: "xor",
|
|
463
|
+
maskComposite: "exclude",
|
|
464
|
+
pointerEvents: "none"
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
function scrollbarStyles(theme, { autoHide = true } = {}) {
|
|
469
|
+
const palette = theme.vars?.palette || theme.palette;
|
|
470
|
+
const greyChannel = palette.grey["500Channel"] || "145, 158, 171";
|
|
471
|
+
return {
|
|
472
|
+
scrollbarWidth: "thin",
|
|
473
|
+
scrollbarColor: `${varAlpha(greyChannel, 0.4)} transparent`,
|
|
474
|
+
"&::-webkit-scrollbar": { width: 6, height: 6 },
|
|
475
|
+
"&::-webkit-scrollbar-track": { backgroundColor: "transparent" },
|
|
476
|
+
"&::-webkit-scrollbar-thumb": { backgroundColor: varAlpha(greyChannel, 0.4), borderRadius: 3 },
|
|
477
|
+
"&::-webkit-scrollbar-thumb:hover": { backgroundColor: varAlpha(greyChannel, 0.65) },
|
|
478
|
+
"&::-webkit-scrollbar-corner": { backgroundColor: "transparent" },
|
|
479
|
+
// Change colour only: revealing a thumb must not change the scrollport's
|
|
480
|
+
// geometry. Touch and high-contrast interfaces retain native discoverability.
|
|
481
|
+
"@media (hover: hover) and (pointer: fine) and (forced-colors: none)": {
|
|
482
|
+
scrollbarColor: autoHide ? "transparent transparent" : `${varAlpha(greyChannel, 0.4)} transparent`,
|
|
483
|
+
"&::-webkit-scrollbar-thumb": {
|
|
484
|
+
backgroundColor: autoHide ? "transparent" : varAlpha(greyChannel, 0.4)
|
|
485
|
+
},
|
|
486
|
+
"&:hover, &:focus-within": {
|
|
487
|
+
scrollbarColor: `${varAlpha(greyChannel, 0.4)} transparent`,
|
|
488
|
+
"&::-webkit-scrollbar-thumb": { backgroundColor: varAlpha(greyChannel, 0.4) },
|
|
489
|
+
"&::-webkit-scrollbar-thumb:hover": { backgroundColor: varAlpha(greyChannel, 0.65) }
|
|
490
|
+
}
|
|
491
|
+
},
|
|
492
|
+
"@media (forced-colors: active)": {
|
|
493
|
+
scrollbarColor: "auto",
|
|
494
|
+
scrollbarWidth: "auto",
|
|
495
|
+
"&::-webkit-scrollbar-thumb": { backgroundColor: "CanvasText" }
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
var mixins = {
|
|
500
|
+
toolbar: {
|
|
501
|
+
minHeight: 56,
|
|
502
|
+
"@media (min-width:0px)": {
|
|
503
|
+
"@media (orientation: landscape)": {
|
|
504
|
+
minHeight: 48
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
"@media (min-width:600px)": {
|
|
508
|
+
minHeight: 64
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
// Extended mixins
|
|
512
|
+
hideScrollX: {
|
|
513
|
+
msOverflowStyle: "none",
|
|
514
|
+
scrollbarWidth: "none",
|
|
515
|
+
overflowX: "auto",
|
|
516
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
517
|
+
},
|
|
518
|
+
hideScrollY: {
|
|
519
|
+
msOverflowStyle: "none",
|
|
520
|
+
scrollbarWidth: "none",
|
|
521
|
+
overflowY: "auto",
|
|
522
|
+
"&::-webkit-scrollbar": { display: "none" }
|
|
523
|
+
},
|
|
524
|
+
// Style functions (attached at theme creation)
|
|
525
|
+
bgBlur,
|
|
526
|
+
bgGradient,
|
|
527
|
+
maxLine,
|
|
528
|
+
softStyles,
|
|
529
|
+
filledStyles,
|
|
530
|
+
paperStyles,
|
|
531
|
+
menuItemStyles,
|
|
532
|
+
varAlpha,
|
|
533
|
+
textGradient,
|
|
534
|
+
borderGradient,
|
|
535
|
+
scrollbarStyles
|
|
536
|
+
};
|
|
537
|
+
var hideScrollbarMixin = {
|
|
538
|
+
scrollbarWidth: "none",
|
|
539
|
+
msOverflowStyle: "none",
|
|
540
|
+
"&::-webkit-scrollbar": {
|
|
541
|
+
display: "none"
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
function customScrollbarMixin(theme) {
|
|
545
|
+
return scrollbarStyles(theme);
|
|
546
|
+
}
|
|
547
|
+
var textEllipsisMixin = {
|
|
548
|
+
overflow: "hidden",
|
|
549
|
+
textOverflow: "ellipsis",
|
|
550
|
+
whiteSpace: "nowrap"
|
|
551
|
+
};
|
|
552
|
+
function multiLineEllipsisMixin(lines) {
|
|
553
|
+
return {
|
|
554
|
+
overflow: "hidden",
|
|
555
|
+
display: "-webkit-box",
|
|
556
|
+
WebkitBoxOrient: "vertical",
|
|
557
|
+
WebkitLineClamp: lines
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
var focusRingMixin = {
|
|
561
|
+
"&:focus-visible": {
|
|
562
|
+
outline: "none",
|
|
563
|
+
boxShadow: "0 0 0 2px var(--prism-background, #FFF), 0 0 0 4px var(--prism-primary, #3385F0)"
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
var glassMixin = {
|
|
567
|
+
backdropFilter: "blur(20px)",
|
|
568
|
+
backgroundColor: "var(--prism-vibrant-overlay, rgba(255, 255, 255, 0.7))"
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
export { createPaletteColorFromScale, cssVarRgba, customScrollbarMixin, darken, focusRingMixin, generateColorScale, generateColorScaleWithChannels, generatePaletteColorWithChannels, getContrastRatio, getContrastText, getLuminance, glassMixin, hexToHsl, hexToRgb, hexToRgbChannel, hideScrollbarMixin, hslToHex, invertColorScale, isLightColor, lighten, mix, mixins, multiLineEllipsisMixin, rgbToHex, rgba, scrollbarStyles, textEllipsisMixin, varAlpha };
|
|
572
|
+
//# sourceMappingURL=chunk-HOXFSQUV.js.map
|
|
573
|
+
//# sourceMappingURL=chunk-HOXFSQUV.js.map
|