@gospore/theme 1.0.124 → 1.0.126
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 +81 -16
- package/dist/Theme.vue.d.ts +16 -0
- package/dist/ThemeSwitcher.vue.d.ts +8 -0
- package/dist/index.d.ts +2 -0
- package/dist/modeStorage.d.ts +5 -0
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,24 +1,89 @@
|
|
|
1
|
-
# gospore
|
|
1
|
+
# @gospore/theme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Provides the base styling primitives for the entire Design System: a Vue
|
|
4
|
+
`<Theme>` component that toggles dark/light mode, runtime helpers for storing
|
|
5
|
+
the preferred mode, a `<ThemeSwitcher>` dropdown, and the Less bundles that
|
|
6
|
+
expose tokens (colors, typography, spacing, elevation, etc.).
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
## Installation
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
```bash
|
|
11
|
+
yarn add @gospore/theme
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Install Font Awesome + `what-input` if you plan to use the optional theme
|
|
15
|
+
switcher. The package ships compiled CSS as well as source Less files.
|
|
16
|
+
|
|
17
|
+
## Loading tokens
|
|
8
18
|
|
|
9
|
-
|
|
19
|
+
You can either wrap your app in `<Theme>` **and** import the shared Less bundle
|
|
20
|
+
once, or – if your tooling supports global Less resources – load
|
|
21
|
+
`component-bundle.less` directly.
|
|
10
22
|
|
|
11
|
-
|
|
23
|
+
```js
|
|
24
|
+
// vite.config.js (example)
|
|
25
|
+
import { defineConfig } from "vite";
|
|
12
26
|
|
|
27
|
+
export default defineConfig({
|
|
28
|
+
css: {
|
|
29
|
+
preprocessorOptions: {
|
|
30
|
+
less: {
|
|
31
|
+
additionalData: '@import "@gospore/theme/src/component-bundle.less";\n',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
13
36
|
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
|
|
38
|
+
## Theme component
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<script setup>
|
|
42
|
+
import { Theme } from "@gospore/theme";
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<Theme mode="auto" accent-color="#0052CC">
|
|
46
|
+
<App />
|
|
47
|
+
</Theme>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default | Description |
|
|
51
|
+
| --- | --- | --- | --- |
|
|
52
|
+
| `mode` | `auto | light | dark` | `auto` | Controls which color mode is active. `auto` follows the OS preference (and persisted storage when used with `ThemeSwitcher`). |
|
|
53
|
+
| `accentColor` | `String` | `undefined` | Optional HEX color (`#RRGGBB` or `#RGB`). When provided, the component derives a full brand palette and applies it to both the local `.theme` wrapper and `document.documentElement` for portals. |
|
|
54
|
+
|
|
55
|
+
`<Theme>` listens for system changes, stores the resolved mode, exposes a
|
|
56
|
+
`theme` provide/inject value, and toggles the global `dark-mode` attribute so
|
|
57
|
+
all Design System components react automatically.
|
|
58
|
+
|
|
59
|
+
## Theme switcher
|
|
60
|
+
|
|
61
|
+
```vue
|
|
62
|
+
<script setup>
|
|
63
|
+
import { Theme, ThemeSwitcher } from "@gospore/theme";
|
|
64
|
+
import { ref } from "vue";
|
|
65
|
+
|
|
66
|
+
const mode = ref("auto");
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<Theme :mode="mode">
|
|
70
|
+
<ThemeSwitcher v-model:mode="mode" />
|
|
71
|
+
</Theme>
|
|
24
72
|
```
|
|
73
|
+
|
|
74
|
+
The switcher is a ready-made dropdown that persists the selected mode to local
|
|
75
|
+
storage via `modeStorage`. It emits `update:mode` and updates `<Theme>` when you
|
|
76
|
+
use it with `v-model`.
|
|
77
|
+
|
|
78
|
+
## Utility files
|
|
79
|
+
|
|
80
|
+
- `src/basic.less`, `styles.less`, `colors.css`, `fonts.css`, `sizing.css`,
|
|
81
|
+
`elevation.css`, `transitions.css`, `borders.css`, `layering.css`: import
|
|
82
|
+
these selectively when you need just a subset of the tokens.
|
|
83
|
+
- `modeStorage.js`: helpers for reading/writing the current theme mode.
|
|
84
|
+
|
|
85
|
+
## Accessibility & motion
|
|
86
|
+
|
|
87
|
+
`Theme` respects the `prefers-reduced-motion` media query when animating dark /
|
|
88
|
+
light transitions. When users prefer reduced motion, color changes happen
|
|
89
|
+
without fades.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {
|
|
7
|
+
mode?: string;
|
|
8
|
+
accentColor?: string;
|
|
9
|
+
$props: {
|
|
10
|
+
readonly mode?: string;
|
|
11
|
+
readonly accentColor?: string;
|
|
12
|
+
};
|
|
13
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
type __VLS_Slots = {
|
|
15
|
+
default?: (props: {}) => any;
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
$emit: (event: "update:mode", ...args: any[]) => void;
|
|
3
|
+
mode: string;
|
|
4
|
+
$props: {
|
|
5
|
+
readonly mode?: string;
|
|
6
|
+
};
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
export default _default;
|
package/dist/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gospore/theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.126",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Gospore",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"import": "./dist/theme.es.js",
|
|
15
|
-
"require": "./dist/theme.cjs.js"
|
|
15
|
+
"require": "./dist/theme.cjs.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
16
17
|
},
|
|
17
18
|
"./umd": {
|
|
18
19
|
"import": "./dist/theme.umd.js",
|
|
@@ -26,7 +27,7 @@
|
|
|
26
27
|
"vue": "^3.4.20"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@gospore/dropdown-menu": "^1.0.
|
|
30
|
+
"@gospore/dropdown-menu": "^1.0.94",
|
|
30
31
|
"what-input": "^5.2.12"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
@@ -34,5 +35,6 @@
|
|
|
34
35
|
"unplugin-vue-macros": "^2.14.5",
|
|
35
36
|
"vite": "^7.1.12"
|
|
36
37
|
},
|
|
37
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "f61d801f78eb9326157eb26817d0c7d36ab721cb",
|
|
39
|
+
"types": "./dist/index.d.ts"
|
|
38
40
|
}
|