@stacksjs/stx 0.1.16 → 0.2.3
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/a11y.d.ts +109 -5
- package/dist/analytics.d.ts +40 -0
- package/dist/animation.d.ts +91 -1
- package/dist/app.d.ts +51 -0
- package/dist/ast.d.ts +286 -0
- package/dist/async-components.d.ts +101 -0
- package/dist/auth.d.ts +1 -3
- package/dist/browser-composables.d.ts +314 -0
- package/dist/build-optimizer.d.ts +126 -0
- package/dist/build-views.d.ts +37 -0
- package/dist/bundle-analyzer/collector.d.ts +66 -0
- package/dist/bundle-analyzer/index.d.ts +60 -0
- package/dist/bundle-analyzer/report.d.ts +39 -0
- package/dist/bundle-analyzer/treemap.d.ts +19 -0
- package/dist/bundle-analyzer.js +499 -0
- package/dist/caching.d.ts +7 -0
- package/dist/cli.js +10885 -1203
- package/dist/client/directive.d.ts +10 -0
- package/dist/client/index.d.ts +7 -0
- package/dist/client/router.d.ts +36 -0
- package/dist/client/stx-router.browser.d.ts +0 -0
- package/dist/client-script.d.ts +22 -0
- package/dist/component-hmr.d.ts +120 -0
- package/dist/components.d.ts +23 -1
- package/dist/composables/index.d.ts +277 -0
- package/dist/composables/use-battery.d.ts +46 -0
- package/dist/composables/use-broadcast-channel.d.ts +58 -0
- package/dist/composables/use-clipboard.d.ts +34 -0
- package/dist/composables/use-cookie.d.ts +70 -0
- package/dist/composables/use-device-orientation.d.ts +109 -0
- package/dist/composables/use-event-source.d.ts +77 -0
- package/dist/composables/use-eye-dropper.d.ts +107 -0
- package/dist/composables/use-fetch.d.ts +84 -0
- package/dist/composables/use-fullscreen.d.ts +47 -0
- package/dist/composables/use-geolocation.d.ts +62 -0
- package/dist/composables/use-idle.d.ts +84 -0
- package/dist/composables/use-intersection-observer.d.ts +81 -0
- package/dist/composables/use-keyboard.d.ts +100 -0
- package/dist/composables/use-media-query.d.ts +56 -0
- package/dist/composables/use-mouse.d.ts +64 -0
- package/dist/composables/use-mutation-observer.d.ts +101 -0
- package/dist/composables/use-network.d.ts +40 -0
- package/dist/composables/use-notification.d.ts +89 -0
- package/dist/composables/use-permissions.d.ts +109 -0
- package/dist/composables/use-resize-observer.d.ts +60 -0
- package/dist/composables/use-share.d.ts +70 -0
- package/dist/composables/use-speech.d.ts +117 -0
- package/dist/composables/use-storage.d.ts +64 -0
- package/dist/composables/use-text-selection.d.ts +97 -0
- package/dist/composables/use-wake-lock.d.ts +85 -0
- package/dist/composables/use-websocket.d.ts +69 -0
- package/dist/composables/use-window.d.ts +84 -0
- package/dist/composables.d.ts +268 -0
- package/dist/composition-api.d.ts +190 -0
- package/dist/computed.d.ts +137 -0
- package/dist/conditionals.d.ts +14 -2
- package/dist/config.d.ts +36 -3
- package/dist/craft-bridge.d.ts +319 -0
- package/dist/craft-compiler.d.ts +229 -0
- package/dist/craft-components.d.ts +411 -0
- package/dist/craft-entry.d.ts +5 -0
- package/dist/craft-ssr.d.ts +134 -0
- package/dist/craft.js +1553 -0
- package/dist/csp.d.ts +229 -0
- package/dist/database.d.ts +407 -0
- package/dist/database.js +5 -0
- package/dist/defer.d.ts +4 -0
- package/dist/deploy/config-generators.d.ts +75 -0
- package/dist/deploy/index.d.ts +84 -0
- package/dist/deploy/netlify.d.ts +109 -0
- package/dist/dev-server/crosswind.d.ts +54 -0
- package/dist/dev-server/index.d.ts +7 -0
- package/dist/dev-server/keyboard-shortcuts.d.ts +34 -0
- package/dist/dev-server/native-window.d.ts +40 -0
- package/dist/dev-server/port-utils.d.ts +27 -0
- package/dist/dev-server/terminal-colors.d.ts +60 -0
- package/dist/dev-server/theme-selector.d.ts +32 -0
- package/dist/dev-server/types.d.ts +92 -0
- package/dist/dev-server.d.ts +21 -0
- package/dist/devtools.d.ts +142 -0
- package/dist/directive-api.d.ts +111 -0
- package/dist/dynamic-components.d.ts +14 -0
- package/dist/edge-runtime.d.ts +200 -0
- package/dist/env.d.ts +9 -0
- package/dist/error-boundaries.d.ts +71 -0
- package/dist/error-handling.d.ts +1 -101
- package/dist/errors/codes.d.ts +99 -0
- package/dist/errors/formatter.d.ts +64 -0
- package/dist/errors/index.d.ts +56 -0
- package/dist/errors/logger.d.ts +74 -0
- package/dist/errors/sanitizer.d.ts +43 -0
- package/dist/errors/types.d.ts +79 -0
- package/dist/events.d.ts +106 -0
- package/dist/expressions.d.ts +86 -11
- package/dist/formatter.d.ts +4 -0
- package/dist/forms-validation.d.ts +173 -0
- package/dist/forms.d.ts +157 -8
- package/dist/head.d.ts +225 -0
- package/dist/heatmap.d.ts +125 -0
- package/dist/hot-reload.d.ts +87 -0
- package/dist/hydration-runtime.d.ts +47 -0
- package/dist/hydration.d.ts +161 -0
- package/dist/i18n.d.ts +240 -4
- package/dist/image-optimization/build-plugin.d.ts +53 -0
- package/dist/image-optimization/component.d.ts +46 -0
- package/dist/image-optimization/directive.d.ts +30 -0
- package/dist/image-optimization/index.d.ts +86 -0
- package/dist/image-optimization/processor.d.ts +112 -0
- package/dist/includes.d.ts +94 -9
- package/dist/index.d.ts +63 -3
- package/dist/index.js +11604 -1318
- package/dist/init.d.ts +32 -2
- package/dist/interactive.d.ts +14 -0
- package/dist/internal-markdown.d.ts +22 -0
- package/dist/jsx-runtime.d.ts +110 -0
- package/dist/keep-alive.d.ts +87 -0
- package/dist/lazy-loader.d.ts +122 -0
- package/dist/loading-indicator.d.ts +40 -0
- package/dist/loops.d.ts +22 -1
- package/dist/media/client/blur-up.d.ts +65 -0
- package/dist/media/client/index.d.ts +77 -0
- package/dist/media/client/lazy-load.d.ts +73 -0
- package/dist/media/client/upload-handler.d.ts +79 -0
- package/dist/media/image/component.d.ts +46 -0
- package/dist/media/image/directive.d.ts +9 -0
- package/dist/media/image/editing.d.ts +212 -0
- package/dist/media/image/index.d.ts +118 -0
- package/dist/media/image/placeholder.d.ts +78 -0
- package/dist/media/image/processor/cache.d.ts +32 -0
- package/dist/media/image/processor/index.d.ts +12 -0
- package/dist/media/image/processor/optimizer.d.ts +13 -0
- package/dist/media/image/processor/responsive.d.ts +17 -0
- package/dist/media/image/srcset.d.ts +158 -0
- package/dist/media/index.d.ts +295 -0
- package/dist/media/manager/embed.d.ts +25 -0
- package/dist/media/protected/component.d.ts +34 -0
- package/dist/media/protected/index.d.ts +34 -0
- package/dist/media/protected/signature.d.ts +72 -0
- package/dist/media/shared/cache.d.ts +54 -0
- package/dist/media/shared/hash.d.ts +24 -0
- package/dist/media/shared/index.d.ts +2 -0
- package/dist/media/types.d.ts +1051 -0
- package/dist/media/upload/component.d.ts +23 -0
- package/dist/media/upload/index.d.ts +1 -0
- package/dist/media/video/directive.d.ts +9 -0
- package/dist/media/video/index.d.ts +47 -0
- package/dist/media/video/processor/cache.d.ts +33 -0
- package/dist/media/video/processor/index.d.ts +21 -0
- package/dist/media/video/processor/streaming.d.ts +19 -0
- package/dist/media/video/processor/thumbnail.d.ts +28 -0
- package/dist/media/video/processor/transcoder.d.ts +9 -0
- package/dist/middleware.d.ts +42 -3
- package/dist/native-build.d.ts +74 -0
- package/dist/parser/directive-parser.d.ts +79 -0
- package/dist/parser/expression-parser.d.ts +59 -0
- package/dist/parser/index.d.ts +35 -0
- package/dist/parser/tokenizer.d.ts +81 -0
- package/dist/partial-hydration.d.ts +88 -0
- package/dist/performance-utils.d.ts +146 -3
- package/dist/plugin-system.d.ts +128 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/precompiler.d.ts +108 -0
- package/dist/production-build.d.ts +199 -0
- package/dist/props.d.ts +199 -0
- package/dist/pwa/audit.d.ts +42 -0
- package/dist/pwa/directives.d.ts +29 -0
- package/dist/pwa/icons.d.ts +39 -0
- package/dist/pwa/index.d.ts +59 -0
- package/dist/pwa/inject.d.ts +22 -0
- package/dist/pwa/manifest.d.ts +104 -0
- package/dist/pwa/offline.d.ts +8 -0
- package/dist/pwa/precache.d.ts +29 -0
- package/dist/pwa/service-worker.d.ts +21 -0
- package/dist/pwa/workbox-strategies.d.ts +100 -0
- package/dist/pwa/workbox.d.ts +52 -0
- package/dist/pwa.d.ts +51 -0
- package/dist/pwa.js +8124 -0
- package/dist/reactive-bindings.d.ts +24 -0
- package/dist/reactive.d.ts +100 -0
- package/dist/reactivity.d.ts +253 -0
- package/dist/route-middleware.d.ts +232 -0
- package/dist/router.d.ts +31 -0
- package/dist/routes.d.ts +0 -7
- package/dist/runtime.d.ts +140 -0
- package/dist/safe-evaluator.d.ts +117 -3
- package/dist/scaffolding.d.ts +113 -0
- package/dist/seo.d.ts +120 -7
- package/dist/server-components.d.ts +134 -0
- package/dist/signals.d.ts +501 -0
- package/dist/slots.d.ts +63 -0
- package/dist/source-maps.d.ts +117 -0
- package/dist/ssg.d.ts +157 -0
- package/dist/ssg.js +6831 -0
- package/dist/ssr.d.ts +107 -0
- package/dist/state-management.d.ts +324 -0
- package/dist/stores-client.d.ts +70 -0
- package/dist/story/addons.d.ts +123 -0
- package/dist/story/analytics.d.ts +92 -0
- package/dist/story/auto-stories.d.ts +38 -0
- package/dist/story/bookmarks.d.ts +53 -0
- package/dist/story/bun-test.d.ts +44 -0
- package/dist/story/cli.d.ts +34 -0
- package/dist/story/collect/analyzer.d.ts +33 -0
- package/dist/story/collect/index.d.ts +27 -0
- package/dist/story/collect/parser.d.ts +17 -0
- package/dist/story/collect/scanner.d.ts +13 -0
- package/dist/story/collect/tree.d.ts +17 -0
- package/dist/story/commands/build.d.ts +14 -0
- package/dist/story/commands/dev.d.ts +16 -0
- package/dist/story/commands/index.d.ts +6 -0
- package/dist/story/commands/preview.d.ts +15 -0
- package/dist/story/compiled-output.d.ts +26 -0
- package/dist/story/composition.d.ts +47 -0
- package/dist/story/config-watcher.d.ts +26 -0
- package/dist/story/config.d.ts +26 -0
- package/dist/story/context.d.ts +21 -0
- package/dist/story/controls/index.d.ts +54 -0
- package/dist/story/crosswind.d.ts +29 -0
- package/dist/story/desktop-preview.d.ts +34 -0
- package/dist/story/docs-generator.d.ts +30 -0
- package/dist/story/errors.d.ts +47 -0
- package/dist/story/figma-export.d.ts +169 -0
- package/dist/story/generator.d.ts +21 -0
- package/dist/story/hmr.d.ts +64 -0
- package/dist/story/hot-swap.d.ts +35 -0
- package/dist/story/index.d.ts +51 -0
- package/dist/story/interactions.d.ts +52 -0
- package/dist/story/keyboard-shortcuts.d.ts +34 -0
- package/dist/story/output.d.ts +85 -0
- package/dist/story/performance.d.ts +76 -0
- package/dist/story/presets.d.ts +62 -0
- package/dist/story/props-validation.d.ts +45 -0
- package/dist/story/renderer.d.ts +53 -0
- package/dist/story/search-index.d.ts +47 -0
- package/dist/story/search.d.ts +45 -0
- package/dist/story/server.d.ts +21 -0
- package/dist/story/setup.d.ts +47 -0
- package/dist/story/snapshots.d.ts +65 -0
- package/dist/story/testing.d.ts +58 -0
- package/dist/story/theme.d.ts +68 -0
- package/dist/story/types.d.ts +249 -0
- package/dist/story/ui/code-panel.d.ts +42 -0
- package/dist/story/ui/controls-panel.d.ts +25 -0
- package/dist/story/ui/index.d.ts +4 -0
- package/dist/story/ui/navigation.d.ts +55 -0
- package/dist/story/ui/preview.d.ts +46 -0
- package/dist/story/visual-testing.d.ts +45 -0
- package/dist/streaming.d.ts +82 -2
- package/dist/suspense.d.ts +83 -0
- package/dist/teleport.d.ts +9 -0
- package/dist/testing.d.ts +289 -0
- package/dist/transitions.d.ts +87 -0
- package/dist/type-checker.d.ts +109 -0
- package/dist/types/component-types.d.ts +129 -0
- package/dist/types/config-types.d.ts +336 -0
- package/dist/types/context-types.d.ts +99 -0
- package/dist/types/csp-types.d.ts +79 -0
- package/dist/types/directive-types.d.ts +259 -0
- package/dist/types/index.d.ts +98 -0
- package/dist/types/pwa-types.d.ts +218 -0
- package/dist/types.d.ts +1 -315
- package/dist/typescript-templates.d.ts +178 -0
- package/dist/utils.d.ts +52 -6
- package/dist/validator.d.ts +77 -0
- package/dist/variable-extractor.d.ts +39 -0
- package/dist/view-composers.d.ts +154 -9
- package/dist/virtual-scrolling.d.ts +103 -0
- package/dist/visual-editor.d.ts +209 -0
- package/dist/visual-testing.d.ts +109 -0
- package/dist/visual-testing.js +126 -0
- package/dist/vue-template.d.ts +16 -0
- package/dist/web-components/css-scoping.d.ts +54 -0
- package/dist/web-components/index.d.ts +20 -0
- package/dist/web-components/reactive-generator.d.ts +72 -0
- package/dist/web-components.d.ts +222 -2
- package/dist/x-element.d.ts +35 -0
- package/package.json +41 -10
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive share composable
|
|
3
|
+
*/
|
|
4
|
+
export declare function useShare(): ShareRef;
|
|
5
|
+
/**
|
|
6
|
+
* Simple share helper
|
|
7
|
+
*/
|
|
8
|
+
export declare function share(data: ShareData): Promise<ShareResult>;
|
|
9
|
+
/**
|
|
10
|
+
* Share a URL with optional title and text
|
|
11
|
+
*/
|
|
12
|
+
export declare function shareURL(url: string, title?: string, text?: string): Promise<ShareResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Share text content
|
|
15
|
+
*/
|
|
16
|
+
export declare function shareText(text: string, title?: string): Promise<ShareResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Share files
|
|
19
|
+
*/
|
|
20
|
+
export declare function shareFiles(files: File[], title?: string, text?: string): Promise<ShareResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a shareable file from a blob
|
|
23
|
+
*/
|
|
24
|
+
export declare function createShareableFile(blob: Blob, filename: string, mimeType?: string): File;
|
|
25
|
+
/**
|
|
26
|
+
* Share current page
|
|
27
|
+
*/
|
|
28
|
+
export declare function shareCurrentPage(text?: string): Promise<ShareResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Copy to clipboard as fallback when share is not supported
|
|
31
|
+
*/
|
|
32
|
+
export declare function shareWithFallback(data: ShareData, fallbackMessage?: string): Promise<ShareResult & { usedFallback?: boolean }>;
|
|
33
|
+
/**
|
|
34
|
+
* useShare - Web Share API wrapper
|
|
35
|
+
*
|
|
36
|
+
* Share content using the native share dialog on supported devices.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const { isSupported, share, canShare } = useShare()
|
|
41
|
+
*
|
|
42
|
+
* // Share text
|
|
43
|
+
* await share({ title: 'Check this out!', text: 'Amazing content', url: 'https://example.com' })
|
|
44
|
+
*
|
|
45
|
+
* // Share files
|
|
46
|
+
* await share({ files: [imageFile] })
|
|
47
|
+
*
|
|
48
|
+
* // Check if specific content can be shared
|
|
49
|
+
* if (canShare({ files: [pdfFile] })) {
|
|
50
|
+
* await share({ files: [pdfFile] })
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare interface ShareData {
|
|
55
|
+
title?: string
|
|
56
|
+
text?: string
|
|
57
|
+
url?: string
|
|
58
|
+
files?: File[]
|
|
59
|
+
}
|
|
60
|
+
export declare interface ShareResult {
|
|
61
|
+
success: boolean
|
|
62
|
+
error?: Error
|
|
63
|
+
cancelled?: boolean
|
|
64
|
+
}
|
|
65
|
+
export declare interface ShareRef {
|
|
66
|
+
isSupported: () => boolean
|
|
67
|
+
isFileShareSupported: () => boolean
|
|
68
|
+
canShare: (data?: ShareData) => boolean
|
|
69
|
+
share: (data: ShareData) => Promise<ShareResult>
|
|
70
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if Speech Recognition is supported
|
|
3
|
+
*/
|
|
4
|
+
export declare function isSpeechRecognitionSupported(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Create a speech recognition composable
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSpeechRecognition(options?: SpeechRecognitionOptions): SpeechRecognitionRef;
|
|
9
|
+
/**
|
|
10
|
+
* Check if Speech Synthesis is supported
|
|
11
|
+
*/
|
|
12
|
+
export declare function isSpeechSynthesisSupported(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Create a speech synthesis composable
|
|
15
|
+
*/
|
|
16
|
+
export declare function useSpeechSynthesis(defaultOptions?: SpeechSynthesisOptions): SpeechSynthesisRef;
|
|
17
|
+
/**
|
|
18
|
+
* Simple speak function
|
|
19
|
+
*/
|
|
20
|
+
export declare function speak(text: string, options?: SpeechSynthesisOptions): void;
|
|
21
|
+
/**
|
|
22
|
+
* Stop all speech
|
|
23
|
+
*/
|
|
24
|
+
export declare function stopSpeaking(): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get available voices
|
|
27
|
+
*/
|
|
28
|
+
export declare function getVoices(): SpeechSynthesisVoice[];
|
|
29
|
+
/**
|
|
30
|
+
* useSpeech - Web Speech API wrappers
|
|
31
|
+
*
|
|
32
|
+
* Speech recognition and synthesis for voice-enabled applications.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // Speech Recognition
|
|
37
|
+
* const recognition = useSpeechRecognition({
|
|
38
|
+
* continuous: false,
|
|
39
|
+
* interimResults: true,
|
|
40
|
+
* lang: 'en-US'
|
|
41
|
+
* })
|
|
42
|
+
*
|
|
43
|
+
* recognition.subscribe(state => {
|
|
44
|
+
* console.log('Transcript:', state.transcript)
|
|
45
|
+
* console.log('Is listening:', state.isListening)
|
|
46
|
+
* })
|
|
47
|
+
*
|
|
48
|
+
* recognition.start()
|
|
49
|
+
*
|
|
50
|
+
* // Speech Synthesis
|
|
51
|
+
* const speech = useSpeechSynthesis()
|
|
52
|
+
* speech.speak('Hello, world!')
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Speech Recognition
|
|
57
|
+
// ============================================================================
|
|
58
|
+
export declare interface SpeechRecognitionOptions {
|
|
59
|
+
continuous?: boolean
|
|
60
|
+
interimResults?: boolean
|
|
61
|
+
lang?: string
|
|
62
|
+
maxAlternatives?: number
|
|
63
|
+
grammars?: SpeechGrammarList
|
|
64
|
+
}
|
|
65
|
+
export declare interface SpeechRecognitionState {
|
|
66
|
+
isListening: boolean
|
|
67
|
+
transcript: string
|
|
68
|
+
finalTranscript: string
|
|
69
|
+
interimTranscript: string
|
|
70
|
+
confidence: number
|
|
71
|
+
isSupported: boolean
|
|
72
|
+
error: string | null
|
|
73
|
+
}
|
|
74
|
+
export declare interface SpeechRecognitionResult {
|
|
75
|
+
transcript: string
|
|
76
|
+
confidence: number
|
|
77
|
+
isFinal: boolean
|
|
78
|
+
}
|
|
79
|
+
export declare interface SpeechRecognitionRef {
|
|
80
|
+
get: () => SpeechRecognitionState
|
|
81
|
+
subscribe: (fn: (state: SpeechRecognitionState) => void) => () => void
|
|
82
|
+
start: () => void
|
|
83
|
+
stop: () => void
|
|
84
|
+
abort: () => void
|
|
85
|
+
toggle: () => void
|
|
86
|
+
isSupported: () => boolean
|
|
87
|
+
on: (event: 'result' | 'error' | 'start' | 'end', callback: (data?: any) => void) => () => void
|
|
88
|
+
}
|
|
89
|
+
// ============================================================================
|
|
90
|
+
// Speech Synthesis
|
|
91
|
+
// ============================================================================
|
|
92
|
+
export declare interface SpeechSynthesisOptions {
|
|
93
|
+
voice?: string | number
|
|
94
|
+
rate?: number
|
|
95
|
+
pitch?: number
|
|
96
|
+
volume?: number
|
|
97
|
+
lang?: string
|
|
98
|
+
}
|
|
99
|
+
export declare interface SpeechSynthesisState {
|
|
100
|
+
isSpeaking: boolean
|
|
101
|
+
isPaused: boolean
|
|
102
|
+
isSupported: boolean
|
|
103
|
+
voices: SpeechSynthesisVoice[]
|
|
104
|
+
currentText: string
|
|
105
|
+
}
|
|
106
|
+
export declare interface SpeechSynthesisRef {
|
|
107
|
+
get: () => SpeechSynthesisState
|
|
108
|
+
subscribe: (fn: (state: SpeechSynthesisState) => void) => () => void
|
|
109
|
+
speak: (text: string, options?: SpeechSynthesisOptions) => void
|
|
110
|
+
stop: () => void
|
|
111
|
+
pause: () => void
|
|
112
|
+
resume: () => void
|
|
113
|
+
toggle: () => void
|
|
114
|
+
getVoices: () => SpeechSynthesisVoice[]
|
|
115
|
+
isSupported: () => boolean
|
|
116
|
+
on: (event: 'start' | 'end' | 'pause' | 'resume' | 'error', callback: (data?: any) => void) => () => void
|
|
117
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a reactive storage reference
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* // Simple usage
|
|
7
|
+
* const theme = useStorage('theme', 'light')
|
|
8
|
+
* theme.value = 'dark' // Automatically persists
|
|
9
|
+
*
|
|
10
|
+
* // With options
|
|
11
|
+
* const user = useStorage<User>('user', null, {
|
|
12
|
+
* storage: 'session',
|
|
13
|
+
* mergeDefaults: true
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* // Subscribe to changes
|
|
17
|
+
* theme.subscribe((newValue) => console.log('Theme changed:', newValue))
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function useStorage<T>(key: string, defaultValue: T, options?: UseStorageOptions<T>): StorageRef<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Shorthand for useStorage with localStorage
|
|
23
|
+
*/
|
|
24
|
+
export declare function useLocalStorage<T>(key: string, defaultValue: T, options?: Omit<UseStorageOptions<T>, 'storage'>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Shorthand for useStorage with sessionStorage
|
|
27
|
+
*/
|
|
28
|
+
export declare function useSessionStorage<T>(key: string, defaultValue: T, options?: Omit<UseStorageOptions<T>, 'storage'>): void;
|
|
29
|
+
/**
|
|
30
|
+
* Clear all items from storage
|
|
31
|
+
*/
|
|
32
|
+
export declare function clearStorage(type?: StorageType): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get all keys from storage
|
|
35
|
+
*/
|
|
36
|
+
export declare function getStorageKeys(type?: StorageType): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Get storage size in bytes (approximate)
|
|
39
|
+
*/
|
|
40
|
+
export declare function getStorageSize(type?: StorageType): number;
|
|
41
|
+
export declare interface UseStorageOptions<T> {
|
|
42
|
+
storage?: StorageType
|
|
43
|
+
default?: T
|
|
44
|
+
serializer?: {
|
|
45
|
+
read: (value: string) => T
|
|
46
|
+
write: (value: T) => string
|
|
47
|
+
}
|
|
48
|
+
mergeDefaults?: boolean
|
|
49
|
+
listenToStorageChanges?: boolean
|
|
50
|
+
}
|
|
51
|
+
export declare interface StorageRef<T> {
|
|
52
|
+
value: T
|
|
53
|
+
get: () => T
|
|
54
|
+
set: (value: T) => void
|
|
55
|
+
remove: () => void
|
|
56
|
+
subscribe: (callback: (value: T, prev: T | undefined) => void) => () => void
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* useStorage - Reactive localStorage/sessionStorage composable
|
|
60
|
+
*
|
|
61
|
+
* Similar to Nuxt's useStorage but for STX applications.
|
|
62
|
+
* Provides a reactive, type-safe wrapper around Web Storage APIs.
|
|
63
|
+
*/
|
|
64
|
+
export type StorageType = 'local' | 'session'
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a reactive text selection tracker
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const selection = useTextSelection({
|
|
7
|
+
* onSelect: (state) => {
|
|
8
|
+
* console.log('Selected text:', state.text)
|
|
9
|
+
* }
|
|
10
|
+
* })
|
|
11
|
+
*
|
|
12
|
+
* // Subscribe to selection changes
|
|
13
|
+
* selection.subscribe((state) => {
|
|
14
|
+
* if (state.text) {
|
|
15
|
+
* showTooltip(state.rects[0], state.text)
|
|
16
|
+
* }
|
|
17
|
+
* })
|
|
18
|
+
*
|
|
19
|
+
* // Get currently selected text
|
|
20
|
+
* const text = selection.getText()
|
|
21
|
+
*
|
|
22
|
+
* // Clear selection
|
|
23
|
+
* selection.clear()
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useTextSelection(options?: TextSelectionOptions): TextSelectionRef;
|
|
27
|
+
/**
|
|
28
|
+
* Track text selection within a specific element
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const selection = useElementTextSelection(editorRef)
|
|
33
|
+
*
|
|
34
|
+
* selection.subscribe((text) => {
|
|
35
|
+
* console.log('Selected in editor:', text)
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function useElementTextSelection(element: Element | null): void;
|
|
40
|
+
/**
|
|
41
|
+
* Create a selection popup that appears when text is selected
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const popup = useSelectionPopup({
|
|
46
|
+
* onShow: (text, position) => {
|
|
47
|
+
* showPopup(position.x, position.y, text)
|
|
48
|
+
* },
|
|
49
|
+
* onHide: () => {
|
|
50
|
+
* hidePopup()
|
|
51
|
+
* }
|
|
52
|
+
* })
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function useSelectionPopup(options: {
|
|
56
|
+
onShow?: (text: string, position: { x: number, y: number }) => void
|
|
57
|
+
onHide?: () => void
|
|
58
|
+
minLength?: number
|
|
59
|
+
}): void;
|
|
60
|
+
/**
|
|
61
|
+
* Copy selected text to clipboard with custom formatting
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const copy = useCopySelection()
|
|
66
|
+
*
|
|
67
|
+
* // Copy with markdown formatting
|
|
68
|
+
* copy.copyAsMarkdown()
|
|
69
|
+
*
|
|
70
|
+
* // Copy with custom prefix
|
|
71
|
+
* copy.copyWithPrefix('> ')
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare function useCopySelection(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Text Selection Composables
|
|
77
|
+
*
|
|
78
|
+
* Reactive utilities for tracking and manipulating text selection.
|
|
79
|
+
*/
|
|
80
|
+
export declare interface TextSelectionState {
|
|
81
|
+
text: string
|
|
82
|
+
rects: DOMRect[]
|
|
83
|
+
ranges: Range[]
|
|
84
|
+
isCollapsed: boolean
|
|
85
|
+
}
|
|
86
|
+
export declare interface TextSelectionOptions {
|
|
87
|
+
onSelect?: (state: TextSelectionState) => void
|
|
88
|
+
onClear?: () => void
|
|
89
|
+
}
|
|
90
|
+
export declare interface TextSelectionRef {
|
|
91
|
+
get: () => TextSelectionState
|
|
92
|
+
subscribe: (fn: (state: TextSelectionState) => void) => () => void
|
|
93
|
+
getText: () => string
|
|
94
|
+
clear: () => void
|
|
95
|
+
selectAll: (element?: Element) => void
|
|
96
|
+
getRects: () => DOMRect[]
|
|
97
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if Wake Lock API is supported
|
|
3
|
+
*/
|
|
4
|
+
export declare function isWakeLockSupported(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Create a reactive wake lock controller
|
|
7
|
+
*
|
|
8
|
+
* The Screen Wake Lock API prevents the screen from dimming or locking
|
|
9
|
+
* while your application is active. Useful for video players, presentation
|
|
10
|
+
* apps, or any application where the user needs to see the screen without
|
|
11
|
+
* interacting with it.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const wakeLock = useWakeLock()
|
|
16
|
+
*
|
|
17
|
+
* // Request wake lock
|
|
18
|
+
* await wakeLock.request()
|
|
19
|
+
*
|
|
20
|
+
* // Subscribe to state changes
|
|
21
|
+
* wakeLock.subscribe((state) => {
|
|
22
|
+
* console.log('Wake lock active:', state.isActive)
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* // Release when done
|
|
26
|
+
* await wakeLock.release()
|
|
27
|
+
*
|
|
28
|
+
* // Or toggle
|
|
29
|
+
* await wakeLock.toggle()
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useWakeLock(): WakeLockRef;
|
|
33
|
+
/**
|
|
34
|
+
* Auto-acquire wake lock while component is mounted
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* // In a video player component
|
|
39
|
+
* const wakeLock = useAutoWakeLock()
|
|
40
|
+
*
|
|
41
|
+
* wakeLock.subscribe((isActive) => {
|
|
42
|
+
* console.log('Screen wake lock:', isActive ? 'on' : 'off')
|
|
43
|
+
* })
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function useAutoWakeLock(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Wake lock that only activates while a condition is true
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const isPlaying = { value: false }
|
|
53
|
+
*
|
|
54
|
+
* const wakeLock = useConditionalWakeLock(() => isPlaying.value)
|
|
55
|
+
*
|
|
56
|
+
* // When video starts playing
|
|
57
|
+
* isPlaying.value = true
|
|
58
|
+
* wakeLock.check() // Acquires wake lock
|
|
59
|
+
*
|
|
60
|
+
* // When video pauses
|
|
61
|
+
* isPlaying.value = false
|
|
62
|
+
* wakeLock.check() // Releases wake lock
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function useConditionalWakeLock(condition: () => boolean): void;
|
|
66
|
+
/**
|
|
67
|
+
* Wake Lock Composables
|
|
68
|
+
*
|
|
69
|
+
* Reactive utilities for the Screen Wake Lock API to prevent devices from sleeping.
|
|
70
|
+
*/
|
|
71
|
+
export declare interface WakeLockState {
|
|
72
|
+
isSupported: boolean
|
|
73
|
+
isActive: boolean
|
|
74
|
+
type: 'screen' | null
|
|
75
|
+
error: Error | null
|
|
76
|
+
}
|
|
77
|
+
export declare interface WakeLockRef {
|
|
78
|
+
get: () => WakeLockState
|
|
79
|
+
subscribe: (fn: (state: WakeLockState) => void) => () => void
|
|
80
|
+
request: () => Promise<boolean>
|
|
81
|
+
release: () => Promise<void>
|
|
82
|
+
toggle: () => Promise<boolean>
|
|
83
|
+
isSupported: () => boolean
|
|
84
|
+
isActive: () => boolean
|
|
85
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if WebSocket is supported
|
|
3
|
+
*/
|
|
4
|
+
export declare function isWebSocketSupported(): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Create a reactive WebSocket connection
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const ws = useWebSocket('wss://echo.websocket.org', {
|
|
11
|
+
* autoReconnect: true,
|
|
12
|
+
* onMessage: (event) => console.log('Received:', event.data),
|
|
13
|
+
* })
|
|
14
|
+
*
|
|
15
|
+
* // Subscribe to state changes
|
|
16
|
+
* ws.subscribe((state) => {
|
|
17
|
+
* console.log('Status:', state.status)
|
|
18
|
+
* console.log('Last data:', state.data)
|
|
19
|
+
* })
|
|
20
|
+
*
|
|
21
|
+
* // Send a message
|
|
22
|
+
* ws.send('Hello!')
|
|
23
|
+
*
|
|
24
|
+
* // Close connection
|
|
25
|
+
* ws.close()
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function useWebSocket<T = unknown>(url: string | URL, options?: WebSocketOptions): WebSocketRef<T> & { on: (event: WebSocketEventType, callback: WebSocketEventCallback) => () => void };
|
|
29
|
+
export declare interface WebSocketState<T = unknown> {
|
|
30
|
+
status: WebSocketStatus
|
|
31
|
+
data: T | null
|
|
32
|
+
error: Event | null
|
|
33
|
+
ws: WebSocket | null
|
|
34
|
+
}
|
|
35
|
+
export declare interface WebSocketOptions {
|
|
36
|
+
protocols?: string | string[]
|
|
37
|
+
autoReconnect?: boolean | {
|
|
38
|
+
retries?: number
|
|
39
|
+
delay?: number
|
|
40
|
+
maxDelay?: number
|
|
41
|
+
onFailed?: () => void
|
|
42
|
+
}
|
|
43
|
+
heartbeat?: boolean | {
|
|
44
|
+
message?: string | ArrayBuffer | Blob
|
|
45
|
+
interval?: number
|
|
46
|
+
pongTimeout?: number
|
|
47
|
+
}
|
|
48
|
+
immediate?: boolean
|
|
49
|
+
onOpen?: (event: Event) => void
|
|
50
|
+
onMessage?: (event: MessageEvent) => void
|
|
51
|
+
onClose?: (event: CloseEvent) => void
|
|
52
|
+
onError?: (event: Event) => void
|
|
53
|
+
}
|
|
54
|
+
export declare interface WebSocketRef<T = unknown> {
|
|
55
|
+
get: () => WebSocketState<T>
|
|
56
|
+
subscribe: (fn: (state: WebSocketState<T>) => void) => () => void
|
|
57
|
+
send: (data: string | ArrayBuffer | Blob) => boolean
|
|
58
|
+
open: () => void
|
|
59
|
+
close: (code?: number, reason?: string) => void
|
|
60
|
+
ws: () => WebSocket | null
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* WebSocket Composables
|
|
64
|
+
*
|
|
65
|
+
* Reactive utilities for WebSocket communication with auto-reconnect support.
|
|
66
|
+
*/
|
|
67
|
+
export type WebSocketStatus = 'connecting' | 'open' | 'closing' | 'closed'
|
|
68
|
+
declare type WebSocketEventType = 'open' | 'message' | 'close' | 'error'
|
|
69
|
+
declare type WebSocketEventCallback = (event: Event | MessageEvent | CloseEvent) => void
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Track window size reactively
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* const size = useWindowSize()
|
|
7
|
+
* console.log(size.width, size.height)
|
|
8
|
+
*
|
|
9
|
+
* size.subscribe(({ width, height }) => {
|
|
10
|
+
* console.log('Window resized:', width, height)
|
|
11
|
+
* })
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare function useWindowSize(): WindowSizeRef;
|
|
15
|
+
/**
|
|
16
|
+
* Track scroll position reactively
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const scroll = useScroll()
|
|
21
|
+
* console.log(scroll.x, scroll.y)
|
|
22
|
+
*
|
|
23
|
+
* scroll.subscribe(({ y }) => {
|
|
24
|
+
* if (y > 100) showBackToTop()
|
|
25
|
+
* })
|
|
26
|
+
*
|
|
27
|
+
* scroll.scrollToTop()
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useScroll(): ScrollRef;
|
|
31
|
+
/**
|
|
32
|
+
* Track document visibility
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const visibility = useVisibility()
|
|
37
|
+
*
|
|
38
|
+
* visibility.subscribe((visible) => {
|
|
39
|
+
* if (!visible) pauseVideo()
|
|
40
|
+
* else resumeVideo()
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function useVisibility(): VisibilityRef;
|
|
45
|
+
/**
|
|
46
|
+
* Reactive document title
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const title = useTitle('My App')
|
|
51
|
+
* title.value = 'New Page - My App'
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function useTitle(initialTitle?: string): { value: string; set: (title: string) => void };
|
|
55
|
+
/**
|
|
56
|
+
* Reactive favicon
|
|
57
|
+
*/
|
|
58
|
+
export declare function useFavicon(href?: string): { value: string; set: (href: string) => void };
|
|
59
|
+
/**
|
|
60
|
+
* useWindow - Reactive window properties composables
|
|
61
|
+
*
|
|
62
|
+
* Provides reactive tracking of window size, scroll position, visibility, etc.
|
|
63
|
+
*/
|
|
64
|
+
export declare interface WindowSize {
|
|
65
|
+
width: number
|
|
66
|
+
height: number
|
|
67
|
+
}
|
|
68
|
+
export declare interface ScrollPosition {
|
|
69
|
+
x: number
|
|
70
|
+
y: number
|
|
71
|
+
}
|
|
72
|
+
export declare interface WindowSizeRef extends WindowSize {
|
|
73
|
+
subscribe: (callback: (size: WindowSize) => void) => () => void
|
|
74
|
+
}
|
|
75
|
+
export declare interface ScrollRef extends ScrollPosition {
|
|
76
|
+
subscribe: (callback: (position: ScrollPosition) => void) => () => void
|
|
77
|
+
scrollTo: (options: ScrollToOptions | number, y?: number) => void
|
|
78
|
+
scrollToTop: () => void
|
|
79
|
+
scrollToBottom: () => void
|
|
80
|
+
}
|
|
81
|
+
export declare interface VisibilityRef {
|
|
82
|
+
isVisible: boolean
|
|
83
|
+
subscribe: (callback: (visible: boolean) => void) => () => void
|
|
84
|
+
}
|