@stacksjs/stx 0.2.146 → 0.2.148
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/dist/cli.js +617 -560
- package/dist/client-script.d.ts +5 -0
- package/dist/client-script.js +49 -5
- package/dist/color-mode-boot.d.ts +88 -0
- package/dist/color-mode-boot.js +35 -0
- package/dist/composables/use-color-mode.js +5 -5
- package/dist/composables/use-storage.js +6 -1
- package/dist/craft.js +330 -273
- package/dist/dev-server/crosswind.js +1 -1
- package/dist/document-shell.d.ts +8 -0
- package/dist/document-shell.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/process.js +7 -1
- package/dist/production-builder.js +6 -2
- package/dist/pwa.js +322 -265
- package/dist/script-classifier.d.ts +14 -8
- package/dist/script-classifier.js +33 -14
- package/dist/signals.js +66 -15
- package/dist/ssg.js +299 -242
- package/dist/stx.d.ts +32 -4
- package/dist/types/config-types.d.ts +2 -0
- package/package.json +6 -6
- package/stx.d.ts +32 -4
package/dist/stx.d.ts
CHANGED
|
@@ -233,11 +233,38 @@ declare function useWebSocket(_url: string, _options?: {
|
|
|
233
233
|
// Color mode
|
|
234
234
|
// ============================================================================
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
interface StxColorModeOptions {
|
|
237
|
+
/** localStorage key holding the preference. @default 'stx-color-mode' */
|
|
238
|
+
storageKey?: string
|
|
239
|
+
/** Mode used when nothing valid is stored. @default 'auto' */
|
|
240
|
+
initialMode?: 'light' | 'dark' | 'auto'
|
|
241
|
+
/** Class applied to `<html>` when dark. @default 'dark' */
|
|
242
|
+
darkClass?: string
|
|
243
|
+
/** Attribute applied to `<html>` INSTEAD of the class, e.g. 'data-theme'. */
|
|
244
|
+
attribute?: string
|
|
245
|
+
/** Suppress CSS transitions across a mode switch. @default true */
|
|
246
|
+
disableTransitions?: boolean
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Omitting the options picks up whatever `app.colorMode` in `stx.config.ts`
|
|
251
|
+
* published via the pre-paint boot script (stacksjs/stx#1794), so the storage
|
|
252
|
+
* key and attribute don't have to be repeated at the call site.
|
|
253
|
+
*/
|
|
254
|
+
declare function useColorMode(_options?: StxColorModeOptions): {
|
|
255
|
+
/** Current resolved mode. */
|
|
256
|
+
readonly mode: 'light' | 'dark'
|
|
257
|
+
/** User preference, which may be 'auto'. */
|
|
258
|
+
readonly preference: 'light' | 'dark' | 'auto'
|
|
259
|
+
readonly isDark: boolean
|
|
260
|
+
set: (mode: 'light' | 'dark' | 'auto') => void
|
|
261
|
+
toggle: () => void
|
|
262
|
+
subscribe: (fn: (mode: 'light' | 'dark', preference: 'light' | 'dark' | 'auto') => void) => () => void
|
|
263
|
+
}
|
|
264
|
+
declare function useDark(_options?: StxColorModeOptions): StxSignal<boolean> & {
|
|
265
|
+
readonly isDark: boolean
|
|
266
|
+
toggle: () => void
|
|
239
267
|
}
|
|
240
|
-
declare function useDark(): StxSignal<boolean>
|
|
241
268
|
declare function useMediaQuery(query: string): StxSignal<boolean> & {
|
|
242
269
|
readonly matches: boolean
|
|
243
270
|
readonly value: boolean
|
|
@@ -500,6 +527,7 @@ interface StxRuntimeRegistry {
|
|
|
500
527
|
useFocus: typeof useFocus
|
|
501
528
|
useAsync: typeof useAsync
|
|
502
529
|
useLocalStorage: typeof useLocalStorage
|
|
530
|
+
useSessionStorage: typeof useSessionStorage
|
|
503
531
|
useEventListener: typeof useEventListener
|
|
504
532
|
useScrollLock: typeof useScrollLock
|
|
505
533
|
useWebSocket: typeof useWebSocket
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ColorModeBootConfig } from '../color-mode-boot';
|
|
1
2
|
import type { ComponentConfig, DocGeneratorConfig, WebComponentConfig } from './component-types';
|
|
2
3
|
import type { CspConfig } from './csp-types';
|
|
3
4
|
import type { CustomDirective, Middleware } from './directive-types';
|
|
@@ -250,6 +251,7 @@ export declare interface AppHeadConfig {
|
|
|
250
251
|
export declare interface StxConfig {
|
|
251
252
|
app?: {
|
|
252
253
|
head?: AppHeadConfig
|
|
254
|
+
colorMode?: ColorModeBootConfig
|
|
253
255
|
window?: {
|
|
254
256
|
width?: number
|
|
255
257
|
height?: number
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.148",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -117,12 +117,12 @@
|
|
|
117
117
|
"dependencies": {
|
|
118
118
|
"@cwcss/crosswind": "^0.2.14",
|
|
119
119
|
"@stacksjs/clapp": "^0.2.0",
|
|
120
|
-
"@stacksjs/desktop": "0.2.
|
|
121
|
-
"@stacksjs/sanitizer": "0.2.
|
|
120
|
+
"@stacksjs/desktop": "0.2.148",
|
|
121
|
+
"@stacksjs/sanitizer": "0.2.148",
|
|
122
122
|
"@stacksjs/ts-i18n": "^0.1.11",
|
|
123
|
-
"bun-plugin-stx": "0.2.
|
|
124
|
-
"bunfig": "^0.15.
|
|
125
|
-
"stx-router": "0.2.
|
|
123
|
+
"bun-plugin-stx": "0.2.148",
|
|
124
|
+
"bunfig": "^0.15.17",
|
|
125
|
+
"stx-router": "0.2.148",
|
|
126
126
|
"ts-broadcasting": "^0.0.9",
|
|
127
127
|
"ts-images": "^0.1.9",
|
|
128
128
|
"ts-syntax-highlighter": "^0.2.1"
|
package/stx.d.ts
CHANGED
|
@@ -233,11 +233,38 @@ declare function useWebSocket(_url: string, _options?: {
|
|
|
233
233
|
// Color mode
|
|
234
234
|
// ============================================================================
|
|
235
235
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
236
|
+
interface StxColorModeOptions {
|
|
237
|
+
/** localStorage key holding the preference. @default 'stx-color-mode' */
|
|
238
|
+
storageKey?: string
|
|
239
|
+
/** Mode used when nothing valid is stored. @default 'auto' */
|
|
240
|
+
initialMode?: 'light' | 'dark' | 'auto'
|
|
241
|
+
/** Class applied to `<html>` when dark. @default 'dark' */
|
|
242
|
+
darkClass?: string
|
|
243
|
+
/** Attribute applied to `<html>` INSTEAD of the class, e.g. 'data-theme'. */
|
|
244
|
+
attribute?: string
|
|
245
|
+
/** Suppress CSS transitions across a mode switch. @default true */
|
|
246
|
+
disableTransitions?: boolean
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Omitting the options picks up whatever `app.colorMode` in `stx.config.ts`
|
|
251
|
+
* published via the pre-paint boot script (stacksjs/stx#1794), so the storage
|
|
252
|
+
* key and attribute don't have to be repeated at the call site.
|
|
253
|
+
*/
|
|
254
|
+
declare function useColorMode(_options?: StxColorModeOptions): {
|
|
255
|
+
/** Current resolved mode. */
|
|
256
|
+
readonly mode: 'light' | 'dark'
|
|
257
|
+
/** User preference, which may be 'auto'. */
|
|
258
|
+
readonly preference: 'light' | 'dark' | 'auto'
|
|
259
|
+
readonly isDark: boolean
|
|
260
|
+
set: (mode: 'light' | 'dark' | 'auto') => void
|
|
261
|
+
toggle: () => void
|
|
262
|
+
subscribe: (fn: (mode: 'light' | 'dark', preference: 'light' | 'dark' | 'auto') => void) => () => void
|
|
263
|
+
}
|
|
264
|
+
declare function useDark(_options?: StxColorModeOptions): StxSignal<boolean> & {
|
|
265
|
+
readonly isDark: boolean
|
|
266
|
+
toggle: () => void
|
|
239
267
|
}
|
|
240
|
-
declare function useDark(): StxSignal<boolean>
|
|
241
268
|
declare function useMediaQuery(query: string): StxSignal<boolean> & {
|
|
242
269
|
readonly matches: boolean
|
|
243
270
|
readonly value: boolean
|
|
@@ -500,6 +527,7 @@ interface StxRuntimeRegistry {
|
|
|
500
527
|
useFocus: typeof useFocus
|
|
501
528
|
useAsync: typeof useAsync
|
|
502
529
|
useLocalStorage: typeof useLocalStorage
|
|
530
|
+
useSessionStorage: typeof useSessionStorage
|
|
503
531
|
useEventListener: typeof useEventListener
|
|
504
532
|
useScrollLock: typeof useScrollLock
|
|
505
533
|
useWebSocket: typeof useWebSocket
|