@stacksjs/defaults 0.75.253 → 0.75.254

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.
@@ -33,6 +33,12 @@ STX 0.2.631 keeps top-level mutable bindings live in template expressions,
33
33
  including controllers assigned in `onMount` by imported TypeScript code. Use
34
34
  signals for values whose changes should schedule rendering.
35
35
 
36
+ Imported modules that create template-facing signals must import `state` from
37
+ `@stacksjs/stx`. The native bundler maps that entry to the page runtime, so
38
+ reads participate in template effects. The `/signals` subpath owns the separate
39
+ module reactive graph and does not schedule browser template updates. Explicit
40
+ module composables retain their documented getter/subscription contracts.
41
+
36
42
  ## Browser and module contracts differ
37
43
 
38
44
  | Name | STX client runtime | Explicit @stacksjs/composables |
@@ -2,7 +2,7 @@
2
2
  "publisher": "Stacks",
3
3
  "name": "vscode-stacks",
4
4
  "displayName": "Stacks",
5
- "version": "0.75.253",
5
+ "version": "0.75.254",
6
6
  "description": "Stacks, built into VS Code: stx templates, pickier linting and formatting, encrypted env files, the dev server preview and every buddy command. No other extensions required.",
7
7
  "license": "MIT",
8
8
  "funding": "https://github.com/sponsors/chrisbbreuer",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/defaults",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.75.253",
5
+ "version": "0.75.254",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/stacksjs/stacks.git",
@@ -44,8 +44,9 @@
44
44
  "dependencies": {
45
45
  "@iconify-json/f7": "^1.2.2",
46
46
  "@iconify-json/hugeicons": "^1.2.35",
47
- "@stacksjs/mobile": "0.75.253",
47
+ "@stacksjs/mobile": "0.75.254",
48
48
  "@stacksjs/sanitizer": "^0.2.534",
49
+ "@stacksjs/stx": "^0.2.631",
49
50
  "@xterm/addon-fit": "^0.11.0",
50
51
  "@xterm/xterm": "^6.0.0",
51
52
  "ts-qr-codes": "^0.1.8"
@@ -1,8 +1,7 @@
1
+ import { state } from '@stacksjs/stx'
2
+
1
3
  export const count = state(0)
2
4
 
3
5
  export function increment(): void {
4
- // eslint-disable-next-line no-console
5
- console.log('increment() was run')
6
-
7
6
  count.update(value => value + 1)
8
7
  }
@@ -1,4 +1,22 @@
1
- // read the documentation for all the auto-imported APIs
2
- export const isDark = useDark()
3
- export const toggleDark = useToggle(isDark)
4
- export const preferredDark = usePreferredDark()
1
+ import { useDark, usePreferredDark } from '@stacksjs/stx/composables'
2
+ import { state } from '@stacksjs/stx'
3
+
4
+ const dark = useDark()
5
+ const preferred = usePreferredDark()
6
+ const darkValue = state(dark.isDark)
7
+ const preferredValue = state(preferred.matches)
8
+
9
+ dark.subscribe(value => darkValue.set(value))
10
+ preferred.subscribe(value => preferredValue.set(value))
11
+
12
+ export function isDark(): boolean {
13
+ return darkValue()
14
+ }
15
+
16
+ export function preferredDark(): boolean {
17
+ return preferredValue()
18
+ }
19
+
20
+ export function toggleDark(): void {
21
+ dark.toggle()
22
+ }