@opencor/opencor 0.20250814.0 → 0.20250814.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/dist/{index-DnnuRqyP.js → index-Bwy89M_M.js} +10252 -10244
- package/dist/opencor.css +1 -1
- package/dist/opencor.es.js +1 -1
- package/dist/opencor.umd.js +129 -129
- package/dist/{quill-CL4ccaRT.js → quill-BlwByE3W.js} +1 -1
- package/package.json +1 -1
- package/src/common/vueCommon.ts +31 -7
- package/src/components/OpenCOR.vue +5 -1
- package/src/components/widgets/GraphPanelWidget.vue +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as ce, g as gl } from "./index-
|
|
1
|
+
import { c as ce, g as gl } from "./index-Bwy89M_M.js";
|
|
2
2
|
var pl = typeof global == "object" && global && global.Object === Object && global, yo = typeof self == "object" && self && self.Object === Object && self, Zt = pl || yo || Function("return this")(), de = Zt.Symbol, ml = Object.prototype, vo = ml.hasOwnProperty, Eo = ml.toString, yr = de ? de.toStringTag : void 0;
|
|
3
3
|
function Ao(n) {
|
|
4
4
|
var t = vo.call(n, yr), e = n[yr];
|
package/package.json
CHANGED
package/src/common/vueCommon.ts
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
import * as vue from 'vue'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { Theme } from '../../index.js'
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// Some constants to know whether the operating system uses light mode or dark mode.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const _prefersColorScheme = window.matchMedia('(prefers-color-scheme: light)')
|
|
8
|
+
const _isLightMode = vue.ref(_prefersColorScheme.matches)
|
|
9
|
+
const _isDarkMode = vue.ref(!_prefersColorScheme.matches)
|
|
10
|
+
let _theme: Theme = 'system'
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
_prefersColorScheme.addEventListener('change', (event) => {
|
|
13
|
+
if (_theme === 'system') {
|
|
14
|
+
_isLightMode.value = event.matches
|
|
15
|
+
_isDarkMode.value = !event.matches
|
|
16
|
+
}
|
|
13
17
|
})
|
|
14
18
|
|
|
19
|
+
export function setTheme(theme: Theme) {
|
|
20
|
+
_theme = theme
|
|
21
|
+
|
|
22
|
+
if (theme === 'light') {
|
|
23
|
+
_isLightMode.value = true
|
|
24
|
+
_isDarkMode.value = false
|
|
25
|
+
} else if (theme === 'dark') {
|
|
26
|
+
_isLightMode.value = false
|
|
27
|
+
_isDarkMode.value = true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function useLightMode(): boolean {
|
|
32
|
+
return _isLightMode.value
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useDarkMode(): boolean {
|
|
36
|
+
return _isDarkMode.value
|
|
37
|
+
}
|
|
38
|
+
|
|
15
39
|
// A method to track the height of a given element.
|
|
16
40
|
|
|
17
41
|
export function trackElementHeight(id: string): void {
|
|
@@ -105,9 +105,13 @@ if (getCurrentInstance !== null) {
|
|
|
105
105
|
app.use(primeVueToastService as unknown as vue.Plugin)
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
if (props.theme !== undefined) {
|
|
109
|
+
vueCommon.setTheme(props.theme)
|
|
110
|
+
}
|
|
111
|
+
|
|
108
112
|
const toast = useToast()
|
|
109
113
|
|
|
110
|
-
//
|
|
114
|
+
// Asynchronously initialise our libOpenCOR API.
|
|
111
115
|
|
|
112
116
|
const locApiInitialised = vue.ref(false)
|
|
113
117
|
|
|
@@ -55,19 +55,19 @@ function themeData() {
|
|
|
55
55
|
|
|
56
56
|
function axisThemeData() {
|
|
57
57
|
return {
|
|
58
|
-
zerolinecolor: vueCommon.
|
|
59
|
-
gridcolor: vueCommon.
|
|
58
|
+
zerolinecolor: vueCommon.useLightMode() ? '#94a3b8' : '#71717a', // --p-surface-400 / --p-surface-500
|
|
59
|
+
gridcolor: vueCommon.useLightMode() ? '#e2e8f0' : '#3f3f46', // --p-surface-200 / --p-surface-700
|
|
60
60
|
minor: {
|
|
61
|
-
gridcolor: vueCommon.
|
|
61
|
+
gridcolor: vueCommon.useLightMode() ? '#f1f5f9' : '#27272a' // --p-surface-100 / --p-surface-800
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return {
|
|
67
|
-
paper_bgcolor: vueCommon.
|
|
68
|
-
plot_bgcolor: vueCommon.
|
|
67
|
+
paper_bgcolor: vueCommon.useLightMode() ? '#ffffff' : '#18181b', // --p-content-background
|
|
68
|
+
plot_bgcolor: vueCommon.useLightMode() ? '#ffffff' : '#18181b', // --p-content-background
|
|
69
69
|
font: {
|
|
70
|
-
color: vueCommon.
|
|
70
|
+
color: vueCommon.useLightMode() ? '#334155' : '#ffffff' // --p-text-color
|
|
71
71
|
},
|
|
72
72
|
colorway: [
|
|
73
73
|
'#7289ab', // Blue
|
|
@@ -84,7 +84,7 @@ function themeData() {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
vue.watch(
|
|
87
|
-
() => [plots, vueCommon.
|
|
87
|
+
() => [plots, vueCommon.useLightMode()],
|
|
88
88
|
() => {
|
|
89
89
|
Plotly.react(
|
|
90
90
|
mainDiv.value,
|