@molecule/app-svelte 4.0.0 → 4.0.2

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
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-28T05:21:58.912Z
6
+ Generated: 2026-12-01T11:25:42.389Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-svelte
@@ -157,7 +157,7 @@ signs the user out.
157
157
  ## Installation
158
158
 
159
159
  ```bash
160
- npm install @molecule/app-svelte @molecule/app-auth @molecule/app-device @molecule/app-forms @molecule/app-http @molecule/app-i18n @molecule/app-logger @molecule/app-platform @molecule/app-routing @molecule/app-state @molecule/app-storage @molecule/app-theme @molecule/app-ui @molecule/app-utilities @molecule/app-version svelte
160
+ npm install @molecule/app-svelte @molecule/app-device @molecule/app-forms @molecule/app-i18n @molecule/app-logger @molecule/app-platform @molecule/app-routing @molecule/app-state @molecule/app-storage @molecule/app-version svelte
161
161
  ```
162
162
 
163
163
  ## API
@@ -4899,11 +4899,11 @@ Peer dependencies:
4899
4899
 
4900
4900
  - `@molecule/app-ai-chat` ^1.8.0 _(optional)_
4901
4901
  - `@molecule/app-ai-models` ^1.0.1 _(optional)_
4902
- - `@molecule/app-auth` ^3.0.0
4902
+ - `@molecule/app-auth` ^3.0.0 _(optional)_
4903
4903
  - `@molecule/app-code-editor` ^1.0.1 _(optional)_
4904
4904
  - `@molecule/app-device` ^1.0.1
4905
4905
  - `@molecule/app-forms` ^2.4.0
4906
- - `@molecule/app-http` ^1.0.1
4906
+ - `@molecule/app-http` ^1.0.1 _(optional)_
4907
4907
  - `@molecule/app-i18n` ^1.4.0
4908
4908
  - `@molecule/app-ide` ^1.1.0 _(optional)_
4909
4909
  - `@molecule/app-live-preview` ^1.0.1 _(optional)_
@@ -4914,9 +4914,9 @@ Peer dependencies:
4914
4914
  - `@molecule/app-routing-sveltekit` >=3.0.0 _(optional)_
4915
4915
  - `@molecule/app-state` ^1.2.0
4916
4916
  - `@molecule/app-storage` ^1.1.1
4917
- - `@molecule/app-theme` ^1.0.2
4918
- - `@molecule/app-ui` ^1.0.1
4919
- - `@molecule/app-utilities` ^1.0.1
4917
+ - `@molecule/app-theme` ^1.0.2 _(optional)_
4918
+ - `@molecule/app-ui` ^1.0.1 _(optional)_
4919
+ - `@molecule/app-utilities` ^1.0.1 _(optional)_
4920
4920
  - `@molecule/app-version` ^1.0.1
4921
4921
  - `svelte` ^5.43.15
4922
4922
 
@@ -4924,11 +4924,11 @@ Peer dependencies:
4924
4924
 
4925
4925
  - `@molecule/app-ai-chat` _(optional)_
4926
4926
  - `@molecule/app-ai-models` _(optional)_
4927
- - `@molecule/app-auth`
4927
+ - `@molecule/app-auth` _(optional)_
4928
4928
  - `@molecule/app-code-editor` _(optional)_
4929
4929
  - `@molecule/app-device`
4930
4930
  - `@molecule/app-forms`
4931
- - `@molecule/app-http`
4931
+ - `@molecule/app-http` _(optional)_
4932
4932
  - `@molecule/app-i18n`
4933
4933
  - `@molecule/app-ide` _(optional)_
4934
4934
  - `@molecule/app-live-preview` _(optional)_
@@ -4939,9 +4939,9 @@ Peer dependencies:
4939
4939
  - `@molecule/app-routing-sveltekit` _(optional)_
4940
4940
  - `@molecule/app-state`
4941
4941
  - `@molecule/app-storage`
4942
- - `@molecule/app-theme`
4943
- - `@molecule/app-ui`
4944
- - `@molecule/app-utilities`
4942
+ - `@molecule/app-theme` _(optional)_
4943
+ - `@molecule/app-ui` _(optional)_
4944
+ - `@molecule/app-utilities` _(optional)_
4945
4945
  - `@molecule/app-version`
4946
4946
  - `svelte`
4947
4947
 
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/stores/theme.ts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AC3B,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,WAAW,EAAE,MAAM,IAAI,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,IAAI,WAAW,GAAG;IAAE,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;CAAE,CAGvF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAExF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,aAAa,GAAG,WAAW,CA6BlF"}
@@ -25,43 +25,8 @@ import { getThemeProvider } from '../context.js';
25
25
  * ```
26
26
  */
27
27
  export function createThemeStores() {
28
- const provider = getThemeProvider();
29
- // Main theme store
30
- const theme = readable(provider.getTheme(), (set) => {
31
- return provider.subscribe(() => {
32
- set(provider.getTheme());
33
- });
34
- });
35
- // Theme name store
36
- const themeName = readable(provider.getTheme().name, (set) => {
37
- return provider.subscribe(() => {
38
- set(provider.getTheme().name);
39
- });
40
- });
41
- // Derived stores
42
- const mode = derived(theme, ($theme) => $theme.mode);
43
- const colors = derived(theme, ($theme) => $theme.colors);
44
- // Get available themes
45
- const themes = provider.getThemes?.() ?? [];
46
- // Actions
47
- const setTheme = (name) => {
48
- provider.setTheme(name);
49
- };
50
- const toggleTheme = () => {
51
- const currentName = provider.getTheme().name;
52
- const currentIndex = themes.findIndex((t) => t.name === currentName);
53
- const nextIndex = (currentIndex + 1) % themes.length;
54
- provider.setTheme(themes[nextIndex]);
55
- };
56
- return {
57
- theme,
58
- themeName,
59
- mode,
60
- colors,
61
- themes,
62
- setTheme,
63
- toggleTheme,
64
- };
28
+ const stores = createThemeStoresFromProvider(getThemeProvider());
29
+ return { ...stores, colors: createThemeColorsStore(stores.theme) };
65
30
  }
66
31
  /**
67
32
  * Create a derived store that returns just the theme colors.
@@ -92,15 +57,12 @@ export function createThemeColorsStore(theme) {
92
57
  */
93
58
  export function createThemeStoresFromProvider(provider) {
94
59
  const theme = readable(provider.getTheme(), (set) => {
95
- return provider.subscribe(() => {
96
- set(provider.getTheme());
97
- });
98
- });
99
- const themeName = readable(provider.getTheme().name, (set) => {
100
- return provider.subscribe(() => {
101
- set(provider.getTheme().name);
102
- });
60
+ const refresh = () => set(provider.getTheme());
61
+ const unsubscribe = provider.subscribe(refresh);
62
+ refresh();
63
+ return unsubscribe;
103
64
  });
65
+ const themeName = derived(theme, ($theme) => $theme.name);
104
66
  const mode = derived(theme, ($theme) => $theme.mode);
105
67
  const themes = provider.getThemes?.() ?? [];
106
68
  return {
@@ -110,6 +72,10 @@ export function createThemeStoresFromProvider(provider) {
110
72
  themes,
111
73
  setTheme: (name) => provider.setTheme(name),
112
74
  toggleTheme: () => {
75
+ if (themes.length === 0) {
76
+ provider.toggleMode();
77
+ return;
78
+ }
113
79
  const currentName = provider.getTheme().name;
114
80
  const idx = themes.findIndex((t) => t.name === currentName);
115
81
  provider.setTheme(themes[(idx + 1) % themes.length]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-svelte",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "Svelte framework bindings for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -83,9 +83,15 @@
83
83
  "@molecule/app-ai-models": {
84
84
  "optional": true
85
85
  },
86
+ "@molecule/app-auth": {
87
+ "optional": true
88
+ },
86
89
  "@molecule/app-code-editor": {
87
90
  "optional": true
88
91
  },
92
+ "@molecule/app-http": {
93
+ "optional": true
94
+ },
89
95
  "@molecule/app-ide": {
90
96
  "optional": true
91
97
  },
@@ -97,6 +103,15 @@
97
103
  },
98
104
  "@molecule/app-routing-sveltekit": {
99
105
  "optional": true
106
+ },
107
+ "@molecule/app-theme": {
108
+ "optional": true
109
+ },
110
+ "@molecule/app-ui": {
111
+ "optional": true
112
+ },
113
+ "@molecule/app-utilities": {
114
+ "optional": true
100
115
  }
101
116
  },
102
117
  "devDependencies": {
@@ -104,7 +119,7 @@
104
119
  "@molecule/app-ai-models": "1.4.4",
105
120
  "@molecule/app-framework-conformance": "0.0.0",
106
121
  "@molecule/app-push": "1.2.3",
107
- "@molecule/app-utilities": "1.1.0",
122
+ "@molecule/app-utilities": "1.1.1",
108
123
  "@sveltejs/package": "3.0.2",
109
124
  "@sveltejs/vite-plugin-svelte": "7.1.2",
110
125
  "@types/node": "26.6.5",