@kong-ui-public/expressions 1.7.2 → 1.7.3
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
CHANGED
|
@@ -7,6 +7,7 @@ Reusable components to support [Kong's expressions language](https://developer.k
|
|
|
7
7
|
- [Usage](#usage)
|
|
8
8
|
- [Install](#install)
|
|
9
9
|
- [Import and use](#import-and-use)
|
|
10
|
+
- [Color mode (light/dark theme)](#color-mode-lightdark-theme)
|
|
10
11
|
- [Individual component documentation](#individual-component-documentation)
|
|
11
12
|
|
|
12
13
|
## Features
|
|
@@ -69,6 +70,20 @@ asyncInit.then(() => {
|
|
|
69
70
|
|
|
70
71
|
You can also make use of Vue's experimental [Suspense](https://vuejs.org/guide/built-ins/suspense.html) component to load async components that use this package.
|
|
71
72
|
|
|
73
|
+
### Color mode (light/dark theme)
|
|
74
|
+
|
|
75
|
+
The Monaco-based editors in this package automatically match the host application's active color mode. To enable this, the host application should `provide` a `ComputedRef<'light' | 'dark'>` under the `app:konnectColorMode` injection key. When provided, the editors reactively switch between their light and dark themes as the value changes. When the key is not provided, the editors fall back to the `'light'` theme.
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
// In the host application (e.g. within your root component's setup)
|
|
79
|
+
import { computed, provide } from 'vue'
|
|
80
|
+
|
|
81
|
+
// `isDarkMode` is however your app tracks its current theme
|
|
82
|
+
const colorMode = computed<'light' | 'dark'>(() => (isDarkMode.value ? 'dark' : 'light'))
|
|
83
|
+
|
|
84
|
+
provide('app:konnectColorMode', colorMode)
|
|
85
|
+
```
|
|
86
|
+
|
|
72
87
|
## Individual component documentation
|
|
73
88
|
|
|
74
89
|
- [`<ExpressionsEditor />`](docs/expressions-editor.md)
|