@reopt-ai/opt-ui 1.4.1 → 1.6.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.
- package/COMPONENT_CATALOG.md +374 -84
- package/README.md +28 -7
- package/dist/app.css +146 -0
- package/dist/core/index.cjs +164 -324
- package/dist/core/index.d.cts +3 -5
- package/dist/core/index.d.ts +3 -5
- package/dist/core/index.js +3 -323
- package/dist/docs/01-getting-started.md +25 -5
- package/dist/docs/02-components/01-core.md +192 -46
- package/dist/docs/02-components/02-visuals.md +1 -1
- package/dist/docs/02-components/03-shells.md +177 -42
- package/dist/docs/02-components/04-surfaces.md +1 -1
- package/dist/docs/02-components/index.md +1 -1
- package/dist/docs/03-recipes/03-layouts.md +20 -12
- package/dist/docs/04-theming.md +3 -1
- package/dist/docs/05-migration/01-breaking-changes.md +28 -0
- package/dist/id-registry.cjs +1899 -1872
- package/dist/id-registry.d.cts +13 -10
- package/dist/id-registry.d.cts.map +1 -0
- package/dist/id-registry.d.ts +13 -10
- package/dist/id-registry.d.ts.map +1 -0
- package/dist/id-registry.js +1897 -1871
- package/dist/id-registry.js.map +1 -0
- package/dist/id-registry.json +44 -44
- package/dist/index.cjs +8294 -9613
- package/dist/index.d.cts +1486 -1438
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +1486 -1438
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7933 -9600
- package/dist/index.js.map +1 -0
- package/dist/meta.cjs +7461 -6765
- package/dist/meta.d.cts.map +1 -0
- package/dist/meta.d.ts.map +1 -0
- package/dist/meta.js +7460 -6736
- package/dist/meta.js.map +1 -0
- package/dist/pagination-By7Ozv3U.js +3788 -0
- package/dist/pagination-By7Ozv3U.js.map +1 -0
- package/dist/pagination-Uv3CnGJz.cjs +4677 -0
- package/dist/shader-surface-BK1GMt5_.d.cts +1788 -0
- package/dist/shader-surface-BK1GMt5_.d.cts.map +1 -0
- package/dist/shader-surface-BWhO2xkk.js +3715 -0
- package/dist/shader-surface-BWhO2xkk.js.map +1 -0
- package/dist/shader-surface-DIVWtpFl.d.ts +1788 -0
- package/dist/shader-surface-DIVWtpFl.d.ts.map +1 -0
- package/dist/shader-surface-DxLLfrE6.cjs +4108 -0
- package/dist/shells/index.cjs +51 -65
- package/dist/shells/index.d.cts +4 -5
- package/dist/shells/index.d.ts +4 -5
- package/dist/shells/index.js +3 -64
- package/dist/tailwind.css +54 -5
- package/dist/theme/presets/default.css +12 -12
- package/dist/theme/server.cjs +310 -0
- package/dist/theme/server.d.cts +117 -0
- package/dist/theme/server.d.cts.map +1 -0
- package/dist/theme/server.d.ts +117 -0
- package/dist/theme/server.d.ts.map +1 -0
- package/dist/theme/server.js +287 -0
- package/dist/theme/server.js.map +1 -0
- package/dist/types-D0FlcYnM.d.cts +301 -0
- package/dist/types-D0FlcYnM.d.cts.map +1 -0
- package/dist/types-D0FlcYnM.d.ts +301 -0
- package/dist/types-D0FlcYnM.d.ts.map +1 -0
- package/dist/visuals/index.cjs +10 -4
- package/dist/visuals/index.d.cts +2 -1
- package/dist/visuals/index.d.ts +2 -1
- package/dist/visuals/index.js +1 -2
- package/dist/workflow-canvas-3Jeevkgy.cjs +2599 -0
- package/dist/workflow-canvas-BGBAcjf-.js +2403 -0
- package/dist/workflow-canvas-BGBAcjf-.js.map +1 -0
- package/dist/workflow-canvas-Bar_O2SQ.d.ts +494 -0
- package/dist/workflow-canvas-Bar_O2SQ.d.ts.map +1 -0
- package/dist/workflow-canvas-DghDRtHn.d.cts +494 -0
- package/dist/workflow-canvas-DghDRtHn.d.cts.map +1 -0
- package/package.json +24 -8
- package/dist/chunk-3GWWZKX7.js +0 -38
- package/dist/chunk-AFF2HPE5.cjs +0 -5008
- package/dist/chunk-ELWICXYY.js +0 -4745
- package/dist/chunk-N4NDU5ET.cjs +0 -4745
- package/dist/chunk-ONE3C5RV.cjs +0 -38
- package/dist/chunk-QWBHD54V.js +0 -3218
- package/dist/chunk-RBM2RNC2.js +0 -5008
- package/dist/chunk-X5WCXJAF.cjs +0 -3218
- package/dist/index-BZ_lBlO1.d.ts +0 -474
- package/dist/index-BuvxoWHf.d.cts +0 -474
- package/dist/index-DlAcuvQp.d.cts +0 -1686
- package/dist/index-Slu5hOj1.d.ts +0 -1686
- package/dist/types-D4-0lwaE.d.cts +0 -298
- package/dist/types-D4-0lwaE.d.ts +0 -298
package/dist/shells/index.cjs
CHANGED
|
@@ -1,65 +1,51 @@
|
|
|
1
|
-
"use
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
exports.AppMenubar = _chunkX5WCXJAFcjs.AppMenubar; exports.BranchSelect = _chunkX5WCXJAFcjs.BranchSelect; exports.CommandPalette = _chunkX5WCXJAFcjs.CommandPalette; exports.CommandPaletteTrigger = _chunkX5WCXJAFcjs.CommandPaletteTrigger; exports.ContentTabs = _chunkX5WCXJAFcjs.ContentTabs; exports.DashboardGrid = _chunkX5WCXJAFcjs.DashboardGrid; exports.DataTable = _chunkX5WCXJAFcjs.DataTable; exports.DeploymentTimeline = _chunkX5WCXJAFcjs.DeploymentTimeline; exports.DomainTable = _chunkX5WCXJAFcjs.DomainTable; exports.EditorToolbar = _chunkX5WCXJAFcjs.EditorToolbar; exports.EnvPanel = _chunkX5WCXJAFcjs.EnvPanel; exports.EventSparkline = _optcharts.EventSparkline; exports.FailureList = _chunkX5WCXJAFcjs.FailureList; exports.FaqAccordion = _chunkX5WCXJAFcjs.FaqAccordion; exports.KeyValueEditor = _chunkX5WCXJAFcjs.KeyValueEditor; exports.MetricsCard = _optcharts.MetricsCard; exports.NotificationToast = _chunkX5WCXJAFcjs.NotificationToast; exports.ProjectSwitcher = _chunkX5WCXJAFcjs.ProjectSwitcher; exports.ReportWidget = _optcharts.ReportWidget; exports.SearchCombobox = _chunkX5WCXJAFcjs.SearchCombobox; exports.SettingsForm = _chunkX5WCXJAFcjs.SettingsForm; exports.SidebarNav = _chunkX5WCXJAFcjs.SidebarNav; exports.StatusSelect = _chunkX5WCXJAFcjs.StatusSelect; exports.ToastProvider = _chunkX5WCXJAFcjs.ToastProvider; exports.TrendChart = _optcharts.TrendChart; exports.WorkflowCanvas = _chunkX5WCXJAFcjs.WorkflowCanvas; exports.useToast = _chunkX5WCXJAFcjs.useToast;
|
|
1
|
+
"use client";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_workflow_canvas = require("../workflow-canvas-3Jeevkgy.cjs");
|
|
4
|
+
let _reopt_ai_opt_charts = require("@reopt-ai/opt-charts");
|
|
5
|
+
exports.AppMenubar = require_workflow_canvas.AppMenubar;
|
|
6
|
+
exports.BranchSelect = require_workflow_canvas.BranchSelect;
|
|
7
|
+
exports.CommandPalette = require_workflow_canvas.CommandPalette;
|
|
8
|
+
exports.CommandPaletteTrigger = require_workflow_canvas.CommandPaletteTrigger;
|
|
9
|
+
exports.ContentTabs = require_workflow_canvas.ContentTabs;
|
|
10
|
+
exports.DashboardGrid = require_workflow_canvas.DashboardGrid;
|
|
11
|
+
exports.DataTable = require_workflow_canvas.DataTable;
|
|
12
|
+
exports.DeploymentTimeline = require_workflow_canvas.DeploymentTimeline;
|
|
13
|
+
exports.DomainTable = require_workflow_canvas.DomainTable;
|
|
14
|
+
exports.EditorToolbar = require_workflow_canvas.EditorToolbar;
|
|
15
|
+
exports.EnvPanel = require_workflow_canvas.EnvPanel;
|
|
16
|
+
Object.defineProperty(exports, "EventSparkline", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return _reopt_ai_opt_charts.EventSparkline;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
exports.FailureList = require_workflow_canvas.FailureList;
|
|
23
|
+
exports.FaqAccordion = require_workflow_canvas.FaqAccordion;
|
|
24
|
+
exports.KeyValueEditor = require_workflow_canvas.KeyValueEditor;
|
|
25
|
+
Object.defineProperty(exports, "MetricsCard", {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function() {
|
|
28
|
+
return _reopt_ai_opt_charts.MetricsCard;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
exports.NotificationToast = require_workflow_canvas.NotificationToast;
|
|
32
|
+
exports.ProjectSwitcher = require_workflow_canvas.ProjectSwitcher;
|
|
33
|
+
Object.defineProperty(exports, "ReportWidget", {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function() {
|
|
36
|
+
return _reopt_ai_opt_charts.ReportWidget;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
exports.SearchCombobox = require_workflow_canvas.SearchCombobox;
|
|
40
|
+
exports.SettingsForm = require_workflow_canvas.SettingsForm;
|
|
41
|
+
exports.SidebarNav = require_workflow_canvas.SidebarNav;
|
|
42
|
+
exports.StatusSelect = require_workflow_canvas.StatusSelect;
|
|
43
|
+
exports.ToastProvider = require_workflow_canvas.ToastProvider;
|
|
44
|
+
Object.defineProperty(exports, "TrendChart", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function() {
|
|
47
|
+
return _reopt_ai_opt_charts.TrendChart;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
exports.WorkflowCanvas = require_workflow_canvas.WorkflowCanvas;
|
|
51
|
+
exports.useToast = require_workflow_canvas.useToast;
|
package/dist/shells/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import '../types-D4-0lwaE.cjs';
|
|
1
|
+
|
|
2
|
+
import { $ as CommandPaletteTriggerProps, A as ProjectSwitcher, B as EditorToolbar, C as DataTableProps, D as BranchSelectProps, E as BranchSelect, F as SettingsFormProps, G as AppMenubarProps, H as SidebarNav, I as FaqAccordion, J as SearchCombobox, K as StatusSelect, L as FaqAccordionProps, M as DeploymentTimeline, N as DeploymentTimelineProps, O as EnvPanel, P as SettingsForm, Q as CommandPaletteTrigger, R as ContentTabs, S as DataTable, T as DomainTableProps, U as SidebarNavProps, V as EditorToolbarProps, W as AppMenubar, X as DashboardGrid, Y as SearchComboboxProps, Z as DashboardGridProps, _ as ToastProviderProps, a as KeyValueEditor, b as useToast, c as KeyValueEntry, d as FailureListProps, et as CommandPalette, f as NotificationToast, g as ToastProvider, h as ToastMessage, i as WorkflowCanvasStep, j as ProjectSwitcherProps, k as EnvPanelProps, l as FailureList, m as ToastContextValue, n as WorkflowCanvasConnection, o as KeyValueEditorLabels, q as StatusSelectProps, r as WorkflowCanvasProps, s as KeyValueEditorProps, t as WorkflowCanvas, tt as CommandPaletteProps, u as FailureListLabels, w as DomainTable, x as ColumnDef, z as ContentTabsProps } from "../workflow-canvas-DghDRtHn.cjs";
|
|
3
|
+
import { EventSparkline, EventSparklineLabels, EventSparklineProps, MetricsCard, MetricsCardProps, ReportWidget, ReportWidgetConfig, ReportWidgetLabels, ReportWidgetProps, ReportWidgetType, TrendChart, TrendChartProps } from "@reopt-ai/opt-charts";
|
|
4
|
+
export { AppMenubar, type AppMenubarProps, BranchSelect, type BranchSelectProps, type ColumnDef, CommandPalette, type CommandPaletteProps, CommandPaletteTrigger, type CommandPaletteTriggerProps, ContentTabs, type ContentTabsProps, DashboardGrid, type DashboardGridProps, DataTable, type DataTableProps, DeploymentTimeline, type DeploymentTimelineProps, DomainTable, type DomainTableProps, EditorToolbar, type EditorToolbarProps, EnvPanel, type EnvPanelProps, EventSparkline, type EventSparklineLabels, type EventSparklineProps, FailureList, type FailureListLabels, type FailureListProps, FaqAccordion, type FaqAccordionProps, KeyValueEditor, type KeyValueEditorLabels, type KeyValueEditorProps, type KeyValueEntry, MetricsCard, type MetricsCardProps, NotificationToast, ProjectSwitcher, type ProjectSwitcherProps, ReportWidget, type ReportWidgetConfig, type ReportWidgetLabels, type ReportWidgetProps, type ReportWidgetType, SearchCombobox, type SearchComboboxProps, SettingsForm, type SettingsFormProps, SidebarNav, type SidebarNavProps, StatusSelect, type StatusSelectProps, type ToastContextValue, type ToastMessage, ToastProvider, type ToastProviderProps, TrendChart, type TrendChartProps, WorkflowCanvas, type WorkflowCanvasConnection, type WorkflowCanvasProps, type WorkflowCanvasStep, useToast };
|
package/dist/shells/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import '../types-D4-0lwaE.js';
|
|
1
|
+
|
|
2
|
+
import { $ as CommandPaletteTriggerProps, A as ProjectSwitcher, B as EditorToolbar, C as DataTableProps, D as BranchSelectProps, E as BranchSelect, F as SettingsFormProps, G as AppMenubarProps, H as SidebarNav, I as FaqAccordion, J as SearchCombobox, K as StatusSelect, L as FaqAccordionProps, M as DeploymentTimeline, N as DeploymentTimelineProps, O as EnvPanel, P as SettingsForm, Q as CommandPaletteTrigger, R as ContentTabs, S as DataTable, T as DomainTableProps, U as SidebarNavProps, V as EditorToolbarProps, W as AppMenubar, X as DashboardGrid, Y as SearchComboboxProps, Z as DashboardGridProps, _ as ToastProviderProps, a as KeyValueEditor, b as useToast, c as KeyValueEntry, d as FailureListProps, et as CommandPalette, f as NotificationToast, g as ToastProvider, h as ToastMessage, i as WorkflowCanvasStep, j as ProjectSwitcherProps, k as EnvPanelProps, l as FailureList, m as ToastContextValue, n as WorkflowCanvasConnection, o as KeyValueEditorLabels, q as StatusSelectProps, r as WorkflowCanvasProps, s as KeyValueEditorProps, t as WorkflowCanvas, tt as CommandPaletteProps, u as FailureListLabels, w as DomainTable, x as ColumnDef, z as ContentTabsProps } from "../workflow-canvas-Bar_O2SQ.js";
|
|
3
|
+
import { EventSparkline, EventSparklineLabels, EventSparklineProps, MetricsCard, MetricsCardProps, ReportWidget, ReportWidgetConfig, ReportWidgetLabels, ReportWidgetProps, ReportWidgetType, TrendChart, TrendChartProps } from "@reopt-ai/opt-charts";
|
|
4
|
+
export { AppMenubar, type AppMenubarProps, BranchSelect, type BranchSelectProps, type ColumnDef, CommandPalette, type CommandPaletteProps, CommandPaletteTrigger, type CommandPaletteTriggerProps, ContentTabs, type ContentTabsProps, DashboardGrid, type DashboardGridProps, DataTable, type DataTableProps, DeploymentTimeline, type DeploymentTimelineProps, DomainTable, type DomainTableProps, EditorToolbar, type EditorToolbarProps, EnvPanel, type EnvPanelProps, EventSparkline, type EventSparklineLabels, type EventSparklineProps, FailureList, type FailureListLabels, type FailureListProps, FaqAccordion, type FaqAccordionProps, KeyValueEditor, type KeyValueEditorLabels, type KeyValueEditorProps, type KeyValueEntry, MetricsCard, type MetricsCardProps, NotificationToast, ProjectSwitcher, type ProjectSwitcherProps, ReportWidget, type ReportWidgetConfig, type ReportWidgetLabels, type ReportWidgetProps, type ReportWidgetType, SearchCombobox, type SearchComboboxProps, SettingsForm, type SettingsFormProps, SidebarNav, type SidebarNavProps, StatusSelect, type StatusSelectProps, type ToastContextValue, type ToastMessage, ToastProvider, type ToastProviderProps, TrendChart, type TrendChartProps, WorkflowCanvas, type WorkflowCanvasConnection, type WorkflowCanvasProps, type WorkflowCanvasStep, useToast };
|
package/dist/shells/index.js
CHANGED
|
@@ -1,65 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
CommandPalette,
|
|
6
|
-
CommandPaletteTrigger,
|
|
7
|
-
ContentTabs,
|
|
8
|
-
DashboardGrid,
|
|
9
|
-
DataTable,
|
|
10
|
-
DeploymentTimeline,
|
|
11
|
-
DomainTable,
|
|
12
|
-
EditorToolbar,
|
|
13
|
-
EnvPanel,
|
|
14
|
-
FailureList,
|
|
15
|
-
FaqAccordion,
|
|
16
|
-
KeyValueEditor,
|
|
17
|
-
NotificationToast,
|
|
18
|
-
ProjectSwitcher,
|
|
19
|
-
SearchCombobox,
|
|
20
|
-
SettingsForm,
|
|
21
|
-
SidebarNav,
|
|
22
|
-
StatusSelect,
|
|
23
|
-
ToastProvider,
|
|
24
|
-
WorkflowCanvas,
|
|
25
|
-
useToast
|
|
26
|
-
} from "../chunk-QWBHD54V.js";
|
|
27
|
-
import "../chunk-RBM2RNC2.js";
|
|
28
|
-
import "../chunk-3GWWZKX7.js";
|
|
29
|
-
|
|
30
|
-
// src/shells/index.ts
|
|
31
|
-
import {
|
|
32
|
-
MetricsCard,
|
|
33
|
-
TrendChart,
|
|
34
|
-
EventSparkline,
|
|
35
|
-
ReportWidget
|
|
36
|
-
} from "@reopt-ai/opt-charts";
|
|
37
|
-
export {
|
|
38
|
-
AppMenubar,
|
|
39
|
-
BranchSelect,
|
|
40
|
-
CommandPalette,
|
|
41
|
-
CommandPaletteTrigger,
|
|
42
|
-
ContentTabs,
|
|
43
|
-
DashboardGrid,
|
|
44
|
-
DataTable,
|
|
45
|
-
DeploymentTimeline,
|
|
46
|
-
DomainTable,
|
|
47
|
-
EditorToolbar,
|
|
48
|
-
EnvPanel,
|
|
49
|
-
EventSparkline,
|
|
50
|
-
FailureList,
|
|
51
|
-
FaqAccordion,
|
|
52
|
-
KeyValueEditor,
|
|
53
|
-
MetricsCard,
|
|
54
|
-
NotificationToast,
|
|
55
|
-
ProjectSwitcher,
|
|
56
|
-
ReportWidget,
|
|
57
|
-
SearchCombobox,
|
|
58
|
-
SettingsForm,
|
|
59
|
-
SidebarNav,
|
|
60
|
-
StatusSelect,
|
|
61
|
-
ToastProvider,
|
|
62
|
-
TrendChart,
|
|
63
|
-
WorkflowCanvas,
|
|
64
|
-
useToast
|
|
65
|
-
};
|
|
2
|
+
import { C as CommandPaletteTrigger, S as DashboardGrid, _ as EditorToolbar, a as ToastProvider, b as StatusSelect, c as DataTable, d as EnvPanel, f as ProjectSwitcher, g as ContentTabs, h as FaqAccordion, i as NotificationToast, l as DomainTable, m as SettingsForm, n as KeyValueEditor, p as DeploymentTimeline, r as FailureList, s as useToast, t as WorkflowCanvas, u as BranchSelect, v as SidebarNav, w as CommandPalette, x as SearchCombobox, y as AppMenubar } from "../workflow-canvas-BGBAcjf-.js";
|
|
3
|
+
import { EventSparkline, MetricsCard, ReportWidget, TrendChart } from "@reopt-ai/opt-charts";
|
|
4
|
+
export { AppMenubar, BranchSelect, CommandPalette, CommandPaletteTrigger, ContentTabs, DashboardGrid, DataTable, DeploymentTimeline, DomainTable, EditorToolbar, EnvPanel, EventSparkline, FailureList, FaqAccordion, KeyValueEditor, MetricsCard, NotificationToast, ProjectSwitcher, ReportWidget, SearchCombobox, SettingsForm, SidebarNav, StatusSelect, ToastProvider, TrendChart, WorkflowCanvas, useToast };
|
package/dist/tailwind.css
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/* ── Theme Presets (5 presets × light/dark, natural force-light) ── */
|
|
15
|
-
@import "
|
|
16
|
-
@import "
|
|
17
|
-
@import "
|
|
18
|
-
@import "
|
|
19
|
-
@import "
|
|
15
|
+
@import "@reopt-ai/opt-ui/theme/presets/default.css";
|
|
16
|
+
@import "@reopt-ai/opt-ui/theme/presets/minimal.css";
|
|
17
|
+
@import "@reopt-ai/opt-ui/theme/presets/natural.css";
|
|
18
|
+
@import "@reopt-ai/opt-ui/theme/presets/pro.css";
|
|
19
|
+
@import "@reopt-ai/opt-ui/theme/presets/mono-dark.css";
|
|
20
20
|
|
|
21
21
|
/* ── Dark Mode Variant ── */
|
|
22
22
|
@custom-variant dark (&:where([data-theme$="-dark"], [data-theme$="-dark"] *));
|
|
@@ -116,6 +116,55 @@
|
|
|
116
116
|
--weight-heading: var(--opt-weight-heading, 600);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/* ── Short semantic utility aliases ──
|
|
120
|
+
*
|
|
121
|
+
* `@theme inline`의 토큰 이름은 스코프를 접두사로 갖기 때문에(`--color-bg-subtle`,
|
|
122
|
+
* `--color-text-secondary`) 생성되는 유틸이 `bg-bg-subtle` / `text-text-secondary`
|
|
123
|
+
* 처럼 접두사가 두 번 반복된다. 소비자는 자연스럽게 짧은 쪽(`bg-subtle`,
|
|
124
|
+
* `text-secondary`)을 쓰고, 그 클래스는 존재하지 않아 스타일이 조용히 사라진다.
|
|
125
|
+
* 실제 소비 프로젝트에서 이 무음 실패가 반복 관측됐고(죽은 클래스 20회), 결국
|
|
126
|
+
* Tailwind를 우회해 CSS Module에서 `var(--opt-*)`를 직접 참조하는 경로로 이어졌다.
|
|
127
|
+
*
|
|
128
|
+
* 아래 alias는 그 짧은 이름을 정확한 시맨틱으로 1급 유틸로 만든다. 기존 이중어
|
|
129
|
+
* 이름(`bg-bg-subtle` 등)은 그대로 유효하다 — 제거가 아니라 추가다.
|
|
130
|
+
*
|
|
131
|
+
* 제약: static utility에는 alpha modifier가 붙지 않는다(`bg-subtle/40`은 생성되지
|
|
132
|
+
* 않음 — Tailwind의 `--modifier()`는 functional utility 전용). 투명도가 필요하면
|
|
133
|
+
* 정식 토큰 이름을 쓴다: `text-text-secondary/60`, `bg-accent-subtle` 등. */
|
|
134
|
+
@utility bg-subtle {
|
|
135
|
+
background-color: var(--opt-bg-subtle);
|
|
136
|
+
}
|
|
137
|
+
@utility bg-muted {
|
|
138
|
+
background-color: var(--opt-bg-muted);
|
|
139
|
+
}
|
|
140
|
+
@utility bg-raised {
|
|
141
|
+
background-color: var(--opt-surface-raised);
|
|
142
|
+
}
|
|
143
|
+
@utility bg-overlay {
|
|
144
|
+
background-color: var(--opt-surface-overlay);
|
|
145
|
+
}
|
|
146
|
+
@utility bg-inset {
|
|
147
|
+
background-color: var(--opt-surface-inset);
|
|
148
|
+
}
|
|
149
|
+
@utility bg-input {
|
|
150
|
+
background-color: var(--opt-surface-input);
|
|
151
|
+
}
|
|
152
|
+
@utility text-primary {
|
|
153
|
+
color: var(--opt-text);
|
|
154
|
+
}
|
|
155
|
+
@utility text-secondary {
|
|
156
|
+
color: var(--opt-text-secondary);
|
|
157
|
+
}
|
|
158
|
+
@utility text-tertiary {
|
|
159
|
+
color: var(--opt-text-tertiary);
|
|
160
|
+
}
|
|
161
|
+
@utility border-subtle {
|
|
162
|
+
border-color: var(--opt-border-subtle);
|
|
163
|
+
}
|
|
164
|
+
@utility border-strong {
|
|
165
|
+
border-color: var(--opt-border-hover);
|
|
166
|
+
}
|
|
167
|
+
|
|
119
168
|
/* ── Density ── */
|
|
120
169
|
[data-density="compact"],
|
|
121
170
|
[data-harness-density="compact"] {
|
|
@@ -182,12 +182,12 @@
|
|
|
182
182
|
|
|
183
183
|
[data-theme="default-dark"] {
|
|
184
184
|
/* Surface */
|
|
185
|
-
--opt-surface: hsl(204
|
|
186
|
-
--opt-surface-raised: hsl(204
|
|
187
|
-
--opt-surface-overlay: hsl(204
|
|
188
|
-
--opt-surface-input: hsl(204
|
|
189
|
-
--opt-surface-input-hover: hsl(204
|
|
190
|
-
--opt-surface-inset: rgba(255, 255, 255, 0.
|
|
185
|
+
--opt-surface: hsl(204 5% 7%);
|
|
186
|
+
--opt-surface-raised: hsl(204 5% 9%);
|
|
187
|
+
--opt-surface-overlay: hsl(204 5% 12%);
|
|
188
|
+
--opt-surface-input: hsl(204 5% 5%);
|
|
189
|
+
--opt-surface-input-hover: hsl(204 5% 4%);
|
|
190
|
+
--opt-surface-inset: rgba(255, 255, 255, 0.02);
|
|
191
191
|
|
|
192
192
|
/* Accent */
|
|
193
193
|
--opt-accent: hsl(221 83% 53%);
|
|
@@ -242,18 +242,18 @@
|
|
|
242
242
|
|
|
243
243
|
/* Border */
|
|
244
244
|
--opt-border-width: 1px;
|
|
245
|
-
--opt-border: rgba(255, 255, 255, 0.
|
|
246
|
-
--opt-border-hover: rgba(255, 255, 255, 0.
|
|
247
|
-
--opt-border-subtle: rgba(255, 255, 255, 0.
|
|
245
|
+
--opt-border: rgba(255, 255, 255, 0.07);
|
|
246
|
+
--opt-border-hover: rgba(255, 255, 255, 0.18);
|
|
247
|
+
--opt-border-subtle: rgba(255, 255, 255, 0.04);
|
|
248
248
|
|
|
249
249
|
/* Focus */
|
|
250
250
|
--opt-ring: hsl(221 83% 53%);
|
|
251
|
-
--opt-ring-offset: hsl(204
|
|
251
|
+
--opt-ring-offset: hsl(204 5% 7%);
|
|
252
252
|
|
|
253
253
|
/* Background */
|
|
254
254
|
--opt-bg: #0a0a0a;
|
|
255
|
-
--opt-bg-subtle: rgba(255, 255, 255, 0.
|
|
256
|
-
--opt-bg-muted: rgba(255, 255, 255, 0.
|
|
255
|
+
--opt-bg-subtle: rgba(255, 255, 255, 0.03);
|
|
256
|
+
--opt-bg-muted: rgba(255, 255, 255, 0.05);
|
|
257
257
|
|
|
258
258
|
/* Status */
|
|
259
259
|
--opt-success: hsl(142 71% 45%);
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("@reopt-ai/opt-palette");
|
|
3
|
+
const THEME_REGISTRY = {
|
|
4
|
+
default: {
|
|
5
|
+
id: "default",
|
|
6
|
+
label: "Default",
|
|
7
|
+
description: "Blue accent, balanced radius & shadow",
|
|
8
|
+
palette: {
|
|
9
|
+
seed: "#2563eb",
|
|
10
|
+
harmony: "split-complementary",
|
|
11
|
+
radiusScale: "medium",
|
|
12
|
+
shadowIntensity: "subtle",
|
|
13
|
+
neutralTemperature: "cool"
|
|
14
|
+
},
|
|
15
|
+
switcherSwatches: [
|
|
16
|
+
"hsl(221 83% 53%)",
|
|
17
|
+
"hsl(142 71% 45%)",
|
|
18
|
+
"hsl(38 92% 50%)"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
minimal: {
|
|
22
|
+
id: "minimal",
|
|
23
|
+
label: "Minimal",
|
|
24
|
+
description: "Monochrome, no shadow, sharp edges",
|
|
25
|
+
palette: {
|
|
26
|
+
seed: "#333333",
|
|
27
|
+
harmony: "analogous",
|
|
28
|
+
radiusScale: "sharp",
|
|
29
|
+
shadowIntensity: "none",
|
|
30
|
+
neutralTemperature: "cool"
|
|
31
|
+
},
|
|
32
|
+
switcherSwatches: [
|
|
33
|
+
"hsl(0 0% 20%)",
|
|
34
|
+
"hsl(0 0% 45%)",
|
|
35
|
+
"hsl(0 0% 70%)"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
natural: {
|
|
39
|
+
id: "natural",
|
|
40
|
+
label: "Natural",
|
|
41
|
+
description: "Always light — sage accent, warm cream",
|
|
42
|
+
forceLightOnly: true,
|
|
43
|
+
palette: {
|
|
44
|
+
seed: "#5a9376",
|
|
45
|
+
harmony: "complementary",
|
|
46
|
+
radiusScale: "medium",
|
|
47
|
+
shadowIntensity: "subtle",
|
|
48
|
+
neutralTemperature: "warm"
|
|
49
|
+
},
|
|
50
|
+
switcherSwatches: [
|
|
51
|
+
"hsl(155 38% 45%)",
|
|
52
|
+
"hsl(25 65% 55%)",
|
|
53
|
+
"hsl(45 75% 50%)"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
pro: {
|
|
57
|
+
id: "pro",
|
|
58
|
+
label: "Pro",
|
|
59
|
+
description: "Neon blue accent, mono headings, ultra-dense",
|
|
60
|
+
palette: {
|
|
61
|
+
seed: "#0080ff",
|
|
62
|
+
harmony: "tetradic",
|
|
63
|
+
radiusScale: "sharp",
|
|
64
|
+
shadowIntensity: "subtle",
|
|
65
|
+
neutralTemperature: "cool"
|
|
66
|
+
},
|
|
67
|
+
switcherSwatches: [
|
|
68
|
+
"hsl(210 100% 55%)",
|
|
69
|
+
"hsl(170 90% 48%)",
|
|
70
|
+
"hsl(290 85% 60%)"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"mono-dark": {
|
|
74
|
+
id: "mono-dark",
|
|
75
|
+
label: "Mono Dark",
|
|
76
|
+
description: "OLED-friendly black, neon cyan accent, mono headings",
|
|
77
|
+
palette: {
|
|
78
|
+
seed: "#00d4ff",
|
|
79
|
+
harmony: "tetradic",
|
|
80
|
+
radiusScale: "sharp",
|
|
81
|
+
shadowIntensity: "subtle",
|
|
82
|
+
neutralTemperature: "cool"
|
|
83
|
+
},
|
|
84
|
+
switcherSwatches: [
|
|
85
|
+
"hsl(190 100% 50%)",
|
|
86
|
+
"hsl(0 0% 8%)",
|
|
87
|
+
"hsl(280 90% 65%)"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
/** All registered preset ids in declaration order. */
|
|
92
|
+
const THEME_PRESET_IDS = Object.keys(THEME_REGISTRY);
|
|
93
|
+
/** Type guard for a known preset id. */
|
|
94
|
+
function isThemePresetId(id) {
|
|
95
|
+
return id in THEME_REGISTRY;
|
|
96
|
+
}
|
|
97
|
+
/** Preset ids that suppress dark mode generation. */
|
|
98
|
+
const FORCE_LIGHT_PRESET_IDS = new Set(THEME_PRESET_IDS.filter((id) => THEME_REGISTRY[id].forceLightOnly));
|
|
99
|
+
/**
|
|
100
|
+
* Map from removed preset ids to the closest surviving preset. Boot script and
|
|
101
|
+
* `readStoredTheme` consult this so users with persisted `corporate`/`playful`
|
|
102
|
+
* values silently land on a working preset on next page load instead of
|
|
103
|
+
* showing the global default fallback for an unknown id.
|
|
104
|
+
*
|
|
105
|
+
* Keep this around indefinitely — localStorage values are forever and the
|
|
106
|
+
* cost of two extra entries is negligible.
|
|
107
|
+
*/
|
|
108
|
+
const DEPRECATED_PRESET_MIGRATIONS = Object.freeze({
|
|
109
|
+
corporate: "default",
|
|
110
|
+
playful: "default"
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Resolve a possibly-deprecated preset id to a registered one. Returns the
|
|
114
|
+
* input unchanged when it is already valid; returns the migration target when
|
|
115
|
+
* it is a known deprecated id; returns `null` when the id is unknown
|
|
116
|
+
* altogether (caller should fall back to its default).
|
|
117
|
+
*/
|
|
118
|
+
function migrateDeprecatedPresetId(id) {
|
|
119
|
+
if (!id) return null;
|
|
120
|
+
if (isThemePresetId(id)) return id;
|
|
121
|
+
if (id in DEPRECATED_PRESET_MIGRATIONS) return DEPRECATED_PRESET_MIGRATIONS[id];
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/lib/theme/theme-serialize.ts
|
|
126
|
+
/**
|
|
127
|
+
* theme-serialize.ts
|
|
128
|
+
*
|
|
129
|
+
* Pure helpers that turn a `ThemeSpec` into the artifacts the runtime needs:
|
|
130
|
+
* resolved descriptor + mode, computed token maps for generated palettes, and
|
|
131
|
+
* `<style>` CSS strings ready to be injected into `<head>`.
|
|
132
|
+
*
|
|
133
|
+
* Kept side-effect free so the boot script and the provider can share the
|
|
134
|
+
* same logic without dragging React into the client bundle's critical path.
|
|
135
|
+
*/
|
|
136
|
+
/** Element id used for the global generated theme style tag. */
|
|
137
|
+
const GLOBAL_THEME_STYLE_ID = "opt-global-theme";
|
|
138
|
+
/** localStorage key for the persisted ThemeSpec (generated mode). */
|
|
139
|
+
const THEME_SPEC_STORAGE_KEY = "opt-theme-spec";
|
|
140
|
+
/**
|
|
141
|
+
* localStorage key for the cached, pre-serialized token maps that match the
|
|
142
|
+
* spec under `THEME_SPEC_STORAGE_KEY`. The boot script reads this directly so
|
|
143
|
+
* it can inline tokens without invoking opt-palette at startup.
|
|
144
|
+
*/
|
|
145
|
+
const THEME_TOKENS_STORAGE_KEY = "opt-theme-tokens";
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/lib/theme/theme-resolution.ts
|
|
148
|
+
/**
|
|
149
|
+
* Registered preset id list. Preferred for runtime iteration.
|
|
150
|
+
* @deprecated Prefer `THEME_PRESET_IDS` from `./presets`.
|
|
151
|
+
*/
|
|
152
|
+
const THEME_PRESET_VALUES = THEME_PRESET_IDS;
|
|
153
|
+
const THEME_MODE_VALUES = [
|
|
154
|
+
"light",
|
|
155
|
+
"dark",
|
|
156
|
+
"system"
|
|
157
|
+
];
|
|
158
|
+
const LEGACY_THEME_STORAGE_KEY = "opt-theme";
|
|
159
|
+
const THEME_PRESET_STORAGE_KEY = "opt-preset";
|
|
160
|
+
const THEME_MODE_STORAGE_KEY = "opt-mode";
|
|
161
|
+
const DARK_MQ = "(prefers-color-scheme: dark)";
|
|
162
|
+
/**
|
|
163
|
+
* Presets that force light mode regardless of system dark/light preference.
|
|
164
|
+
* Mirrors `FORCE_LIGHT_PRESET_IDS` from `./presets` — kept as alias for
|
|
165
|
+
* existing imports.
|
|
166
|
+
*/
|
|
167
|
+
const FORCE_LIGHT_PRESETS = FORCE_LIGHT_PRESET_IDS;
|
|
168
|
+
/** All valid compound theme names. Useful for static enumeration. */
|
|
169
|
+
const ALL_COMPOUND_THEMES = THEME_PRESET_IDS.flatMap((id) => FORCE_LIGHT_PRESET_IDS.has(id) ? [id] : [id, `${id}-dark`]);
|
|
170
|
+
function hasStorageMutation(storage) {
|
|
171
|
+
return typeof storage.setItem === "function" && typeof storage.removeItem === "function";
|
|
172
|
+
}
|
|
173
|
+
/** Handles is theme preset. */
|
|
174
|
+
function isThemePreset(value) {
|
|
175
|
+
return typeof value === "string" && THEME_PRESET_VALUES.includes(value);
|
|
176
|
+
}
|
|
177
|
+
/** Handles is theme mode. */
|
|
178
|
+
function isThemeMode(value) {
|
|
179
|
+
return typeof value === "string" && THEME_MODE_VALUES.includes(value);
|
|
180
|
+
}
|
|
181
|
+
/** Compute compound theme name from preset + resolved mode. */
|
|
182
|
+
function getCompoundTheme(preset, resolvedMode) {
|
|
183
|
+
if (FORCE_LIGHT_PRESETS.has(preset)) return preset;
|
|
184
|
+
return resolvedMode === "dark" ? `${preset}-dark` : preset;
|
|
185
|
+
}
|
|
186
|
+
/** Handles resolve theme mode. */
|
|
187
|
+
function resolveThemeMode(preset, mode, systemDark) {
|
|
188
|
+
if (FORCE_LIGHT_PRESETS.has(preset)) return "light";
|
|
189
|
+
if (mode === "system") return systemDark ? "dark" : "light";
|
|
190
|
+
return mode;
|
|
191
|
+
}
|
|
192
|
+
/** Handles read stored theme. */
|
|
193
|
+
function readStoredTheme(storage, defaultPreset, defaultMode, options = {}) {
|
|
194
|
+
const legacy = storage.getItem(LEGACY_THEME_STORAGE_KEY);
|
|
195
|
+
const storedPreset = storage.getItem(THEME_PRESET_STORAGE_KEY);
|
|
196
|
+
const storedMode = storage.getItem(THEME_MODE_STORAGE_KEY);
|
|
197
|
+
let preset = defaultPreset;
|
|
198
|
+
if (typeof legacy === "string") {
|
|
199
|
+
const migratedLegacy = migrateDeprecatedPresetId(legacy);
|
|
200
|
+
if (migratedLegacy) {
|
|
201
|
+
if (options.migrateLegacy && hasStorageMutation(storage)) {
|
|
202
|
+
storage.setItem(THEME_PRESET_STORAGE_KEY, migratedLegacy);
|
|
203
|
+
storage.removeItem(LEGACY_THEME_STORAGE_KEY);
|
|
204
|
+
}
|
|
205
|
+
preset = migratedLegacy;
|
|
206
|
+
}
|
|
207
|
+
} else if (typeof storedPreset === "string") {
|
|
208
|
+
const migrated = migrateDeprecatedPresetId(storedPreset);
|
|
209
|
+
if (migrated) {
|
|
210
|
+
preset = migrated;
|
|
211
|
+
if (hasStorageMutation(storage) && migrated !== storedPreset && storedPreset in DEPRECATED_PRESET_MIGRATIONS) storage.setItem(THEME_PRESET_STORAGE_KEY, migrated);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
const mode = isThemeMode(storedMode) ? storedMode : defaultMode;
|
|
215
|
+
return {
|
|
216
|
+
preset,
|
|
217
|
+
mode
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/** Normalize a mode against an optional allowed-mode list. */
|
|
221
|
+
function coerceThemeMode(mode, allowedModes, fallback = "system") {
|
|
222
|
+
var _allowedModes$;
|
|
223
|
+
if (!allowedModes || allowedModes.length === 0) return mode;
|
|
224
|
+
if (allowedModes.includes(mode)) return mode;
|
|
225
|
+
if (allowedModes.includes(fallback)) return fallback;
|
|
226
|
+
return (_allowedModes$ = allowedModes[0]) !== null && _allowedModes$ !== void 0 ? _allowedModes$ : fallback;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Build the inline `<head>` boot script that paints the correct theme before
|
|
230
|
+
* React mounts. Two paths:
|
|
231
|
+
*
|
|
232
|
+
* 1. **Generated** — when both `opt-theme-spec` (kind: "generated") and
|
|
233
|
+
* `opt-theme-tokens` are present and well-formed, a `<style id="…">` tag
|
|
234
|
+
* is inserted with the cached tokens and `<html data-theme>` is set to the
|
|
235
|
+
* generated id (with optional `-dark` suffix). This bypasses opt-palette
|
|
236
|
+
* at startup so first paint is instant.
|
|
237
|
+
* 2. **Preset (legacy)** — falls through to the existing preset selector,
|
|
238
|
+
* including legacy `opt-theme` → `opt-preset` migration.
|
|
239
|
+
*
|
|
240
|
+
* Returned as a single minified line; intended for `dangerouslySetInnerHTML`.
|
|
241
|
+
*/
|
|
242
|
+
function createThemeBootScript(defaultPreset = "default", defaultMode = "system", options = {}) {
|
|
243
|
+
var _options$allowedModes, _allowedModes$2;
|
|
244
|
+
const presetValues = JSON.stringify(THEME_PRESET_VALUES);
|
|
245
|
+
const modeValues = JSON.stringify(THEME_MODE_VALUES);
|
|
246
|
+
const allowedModes = ((_options$allowedModes = options.allowedModes) === null || _options$allowedModes === void 0 ? void 0 : _options$allowedModes.length) ? options.allowedModes : THEME_MODE_VALUES;
|
|
247
|
+
const allowedModeValues = JSON.stringify(allowedModes);
|
|
248
|
+
const forceLightPresets = JSON.stringify(Array.from(FORCE_LIGHT_PRESETS));
|
|
249
|
+
const deprecatedMap = JSON.stringify(DEPRECATED_PRESET_MIGRATIONS);
|
|
250
|
+
const lockedPreset = options.lockedPreset;
|
|
251
|
+
const defaultPresetLiteral = JSON.stringify(lockedPreset !== null && lockedPreset !== void 0 ? lockedPreset : defaultPreset);
|
|
252
|
+
const defaultModeLiteral = JSON.stringify(coerceThemeMode(defaultMode, allowedModes, (_allowedModes$2 = allowedModes[0]) !== null && _allowedModes$2 !== void 0 ? _allowedModes$2 : "system"));
|
|
253
|
+
const lockedPresetLiteral = JSON.stringify(lockedPreset !== null && lockedPreset !== void 0 ? lockedPreset : null);
|
|
254
|
+
const styleId = JSON.stringify(GLOBAL_THEME_STYLE_ID);
|
|
255
|
+
const specKey = JSON.stringify(THEME_SPEC_STORAGE_KEY);
|
|
256
|
+
const tokensKey = JSON.stringify(THEME_TOKENS_STORAGE_KEY);
|
|
257
|
+
const presetKey = JSON.stringify(THEME_PRESET_STORAGE_KEY);
|
|
258
|
+
const modeKey = JSON.stringify(THEME_MODE_STORAGE_KEY);
|
|
259
|
+
const legacyKey = JSON.stringify(LEGACY_THEME_STORAGE_KEY);
|
|
260
|
+
const darkMq = JSON.stringify(DARK_MQ);
|
|
261
|
+
return `
|
|
262
|
+
try {
|
|
263
|
+
var pv=${presetValues},mv=${modeValues},am=${allowedModeValues},fp=${forceLightPresets},dm=${deprecatedMap},lk=${lockedPresetLiteral};
|
|
264
|
+
function mp(v){if(typeof v!=="string")return null;if(pv.indexOf(v)>=0)return v;return Object.prototype.hasOwnProperty.call(dm,v)?dm[v]:null;}
|
|
265
|
+
var p=${defaultPresetLiteral};
|
|
266
|
+
if(!lk){
|
|
267
|
+
var lp=localStorage.getItem(${legacyKey}),sp=localStorage.getItem(${presetKey});
|
|
268
|
+
var lpm=mp(lp),spm=mp(sp);
|
|
269
|
+
p=lpm||spm||${defaultPresetLiteral};
|
|
270
|
+
if(lpm){localStorage.setItem(${presetKey},lpm);localStorage.removeItem(${legacyKey});}
|
|
271
|
+
else if(sp&&spm&&sp!==spm){localStorage.setItem(${presetKey},spm);}
|
|
272
|
+
}
|
|
273
|
+
var sm=localStorage.getItem(${modeKey});
|
|
274
|
+
var m=(typeof sm==="string"&&mv.indexOf(sm)>=0&&am.indexOf(sm)>=0)?sm:${defaultModeLiteral};
|
|
275
|
+
var spec=null,tk=null;
|
|
276
|
+
if(!lk){try{var sj=localStorage.getItem(${specKey});if(sj)spec=JSON.parse(sj);}catch(e){}}
|
|
277
|
+
if(!lk){try{var tj=localStorage.getItem(${tokensKey});if(tj)tk=JSON.parse(tj);}catch(e){}}
|
|
278
|
+
if(!lk&&spec&&spec.kind==="generated"&&tk&&typeof tk.id==="string"&&tk.light&&typeof tk.light==="object"){
|
|
279
|
+
var fld=spec.forceLightOnly===true;
|
|
280
|
+
var dk=!fld&&(m==="dark"||(m==="system"&&matchMedia(${darkMq}).matches));
|
|
281
|
+
var tt=(dk&&tk.dark)?tk.dark:tk.light;
|
|
282
|
+
var cid=(dk&&tk.dark)?(tk.id+"-dark"):tk.id;
|
|
283
|
+
var css="";
|
|
284
|
+
for(var k in tt){if(Object.prototype.hasOwnProperty.call(tt,k))css+=k+":"+tt[k]+";"}
|
|
285
|
+
var st=document.getElementById(${styleId});
|
|
286
|
+
if(!st){st=document.createElement("style");st.id=${styleId};document.head.appendChild(st);}
|
|
287
|
+
st.textContent='[data-theme="'+cid+'"]{'+css+'}';
|
|
288
|
+
document.documentElement.setAttribute("data-theme",cid);
|
|
289
|
+
} else {
|
|
290
|
+
var d=fp.indexOf(p)<0&&(m==="dark"||(m==="system"&&matchMedia(${darkMq}).matches));
|
|
291
|
+
document.documentElement.setAttribute("data-theme",d?p+"-dark":p);
|
|
292
|
+
}
|
|
293
|
+
} catch(e){}`.replace(/\n\s*/g, "");
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
296
|
+
exports.ALL_COMPOUND_THEMES = ALL_COMPOUND_THEMES;
|
|
297
|
+
exports.DARK_MQ = DARK_MQ;
|
|
298
|
+
exports.FORCE_LIGHT_PRESETS = FORCE_LIGHT_PRESETS;
|
|
299
|
+
exports.LEGACY_THEME_STORAGE_KEY = LEGACY_THEME_STORAGE_KEY;
|
|
300
|
+
exports.THEME_MODE_STORAGE_KEY = THEME_MODE_STORAGE_KEY;
|
|
301
|
+
exports.THEME_MODE_VALUES = THEME_MODE_VALUES;
|
|
302
|
+
exports.THEME_PRESET_STORAGE_KEY = THEME_PRESET_STORAGE_KEY;
|
|
303
|
+
exports.THEME_PRESET_VALUES = THEME_PRESET_VALUES;
|
|
304
|
+
exports.coerceThemeMode = coerceThemeMode;
|
|
305
|
+
exports.createThemeBootScript = createThemeBootScript;
|
|
306
|
+
exports.getCompoundTheme = getCompoundTheme;
|
|
307
|
+
exports.isThemeMode = isThemeMode;
|
|
308
|
+
exports.isThemePreset = isThemePreset;
|
|
309
|
+
exports.readStoredTheme = readStoredTheme;
|
|
310
|
+
exports.resolveThemeMode = resolveThemeMode;
|