@gospore/theme 1.0.124 → 1.0.125

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
@@ -1,24 +1,89 @@
1
- # gospore-design-system
1
+ # @gospore/theme
2
2
 
3
- ## Voraussetzungen
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
- Dependency style-resources-loader in der konsumierenden Applikation installieren:
8
+ ## Installation
6
9
 
7
- `vue add style-resources-loader`
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
- ## Verwendung
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
- In der vue.config.js aktivieren:
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
- module.exports = {
15
- pluginOptions: {
16
- "style-resources-loader": {
17
- preProcessor: "less",
18
- patterns: [
19
- "./node_modules/@gospore/gospore-web-design-system-theme/src/component-bundle.less"
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;
@@ -0,0 +1,2 @@
1
+ export { default as Theme } from "./Theme.vue";
2
+ export { default as ThemeSwitcher } from "./ThemeSwitcher.vue";
@@ -0,0 +1,5 @@
1
+ export function readStoredMode(): string;
2
+ export function writeStoredMode(mode: any): void;
3
+ export function applyStoredModeToDocument(mode: any): void;
4
+ export const VALID_THEME_MODES: string[];
5
+ export const STORAGE_KEY: "gospore-theme-mode";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gospore/theme",
3
- "version": "1.0.124",
3
+ "version": "1.0.125",
4
4
  "description": "",
5
5
  "author": "Gospore",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "vue": "^3.4.20"
27
27
  },
28
28
  "dependencies": {
29
- "@gospore/dropdown-menu": "^1.0.92",
29
+ "@gospore/dropdown-menu": "^1.0.93",
30
30
  "what-input": "^5.2.12"
31
31
  },
32
32
  "devDependencies": {
@@ -34,5 +34,6 @@
34
34
  "unplugin-vue-macros": "^2.14.5",
35
35
  "vite": "^7.1.12"
36
36
  },
37
- "gitHead": "06c1cc2ec2e495ed01330a63b352d03ff73533c9"
37
+ "gitHead": "201f386eb892634284e0d9645b17e5b8abd64d51",
38
+ "types": "./dist/index.d.ts"
38
39
  }