@stacksjs/stx 0.2.21 → 0.2.24
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/animation.d.ts +30 -0
- package/dist/builtins/drawer.d.ts +2 -0
- package/dist/builtins/index.d.ts +6 -2
- package/dist/builtins/tooltip.d.ts +18 -0
- package/dist/caching.d.ts +8 -0
- package/dist/cli.js +728 -626
- package/dist/component-renderer.d.ts +1 -18
- package/dist/composables/use-fetch.d.ts +0 -29
- package/dist/composables/use-share.d.ts +4 -0
- package/dist/craft-bridge.d.ts +7 -0
- package/dist/craft-compiler.d.ts +13 -0
- package/dist/craft-components.d.ts +7 -0
- package/dist/craft-ssr.d.ts +13 -0
- package/dist/database.d.ts +1 -0
- package/dist/dev-server/crosswind.d.ts +24 -0
- package/dist/dev-server/types.d.ts +2 -0
- package/dist/devtools.d.ts +36 -0
- package/dist/docs.d.ts +1 -20
- package/dist/forms.d.ts +9 -9
- package/dist/hot-reload.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +666 -564
- package/dist/native-build.d.ts +10 -0
- package/dist/partial-hydration.d.ts +4 -0
- package/dist/public-env.d.ts +15 -0
- package/dist/pwa/workbox.d.ts +8 -0
- package/dist/pwa.js +482 -380
- package/dist/reactive.d.ts +4 -0
- package/dist/ssg.js +508 -406
- package/dist/story/cli.d.ts +10 -10
- package/dist/story/output.d.ts +28 -0
- package/dist/story/ui/code-panel.d.ts +0 -25
- package/dist/streaming.d.ts +60 -0
- package/dist/stx.d.ts +18 -0
- package/dist/testing.d.ts +52 -78
- package/dist/types/config-types.d.ts +6 -0
- package/dist/visual-editor.d.ts +4 -0
- package/package.json +5 -5
- package/stx.d.ts +18 -0
package/dist/story/cli.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare function runStoryCLI(args?: string[]): Promise<void>;
|
|
|
19
19
|
* open: { alias: 'o', description: 'Open browser automatically' },
|
|
20
20
|
* host: { description: 'Host to bind to' }
|
|
21
21
|
* },
|
|
22
|
-
* action: (options: { port?: number, open?: boolean, host?: string }) => unknown
|
|
22
|
+
* action: (options: { port?: number, open?: boolean, host?: string }): Promise<void> => Promise<unknown>
|
|
23
23
|
* },
|
|
24
24
|
* 'story:dev': {
|
|
25
25
|
* description: 'Start story development server',
|
|
@@ -28,12 +28,12 @@ export declare function runStoryCLI(args?: string[]): Promise<void>;
|
|
|
28
28
|
* open: { alias: 'o', description: 'Open browser automatically' },
|
|
29
29
|
* host: { description: 'Host to bind to' }
|
|
30
30
|
* },
|
|
31
|
-
* action: (options: { port?: number, open?: boolean, host?: string }) => unknown
|
|
31
|
+
* action: (options: { port?: number, open?: boolean, host?: string }): Promise<void> => Promise<unknown>
|
|
32
32
|
* },
|
|
33
33
|
* 'story:build': {
|
|
34
34
|
* description: 'Build static story site',
|
|
35
35
|
* options: { outDir: { alias: 'o', description: 'Output directory' } },
|
|
36
|
-
* action: (options: { outDir?: string }) => unknown
|
|
36
|
+
* action: (options: { outDir?: string }): Promise<void> => Promise<unknown>
|
|
37
37
|
* },
|
|
38
38
|
* 'story:preview': {
|
|
39
39
|
* description: 'Preview built story site',
|
|
@@ -41,7 +41,7 @@ export declare function runStoryCLI(args?: string[]): Promise<void>;
|
|
|
41
41
|
* port: { alias: 'p', description: 'Server port (default: 4173)' },
|
|
42
42
|
* open: { alias: 'o', description: 'Open browser automatically' }
|
|
43
43
|
* },
|
|
44
|
-
* action: (options: { port?: number, open?: boolean }) => unknown
|
|
44
|
+
* action: (options: { port?: number, open?: boolean }): Promise<void> => Promise<unknown>
|
|
45
45
|
* },
|
|
46
46
|
* 'story:test': {
|
|
47
47
|
* description: 'Run visual regression tests',
|
|
@@ -49,7 +49,7 @@ export declare function runStoryCLI(args?: string[]): Promise<void>;
|
|
|
49
49
|
* update: { alias: 'u', description: 'Update snapshots' },
|
|
50
50
|
* filter: { alias: 'f', description: 'Filter components by name' }
|
|
51
51
|
* },
|
|
52
|
-
* action: (options: { update?: boolean, filter?: string }) => unknown
|
|
52
|
+
* action: (options: { update?: boolean, filter?: string }): Promise<void> => Promise<unknown>
|
|
53
53
|
* }
|
|
54
54
|
* }
|
|
55
55
|
* ```
|
|
@@ -58,21 +58,21 @@ export declare const storyCommands: {
|
|
|
58
58
|
/**
|
|
59
59
|
* Main story command (defaults to dev)
|
|
60
60
|
*/
|
|
61
|
-
'story': { /** @defaultValue 'Component showcase and testing' */ description: string; options: { port: { /** @defaultValue 'p' */ alias: string; type: 'number'; /** @defaultValue 'Server port (default: 6006)' */ description: string }; open: { /** @defaultValue 'o' */ alias: string; type: 'boolean'; /** @defaultValue 'Open browser automatically' */ description: string }; host: { type: 'string'; /** @defaultValue 'Host to bind to' */ description: string } }; action: (options: { port?: number, open?: boolean, host?: string }) => unknown };
|
|
61
|
+
'story': { /** @defaultValue 'Component showcase and testing' */ description: string; options: { port: { /** @defaultValue 'p' */ alias: string; type: 'number'; /** @defaultValue 'Server port (default: 6006)' */ description: string }; open: { /** @defaultValue 'o' */ alias: string; type: 'boolean'; /** @defaultValue 'Open browser automatically' */ description: string }; host: { type: 'string'; /** @defaultValue 'Host to bind to' */ description: string } }; action: (options: { port?: number, open?: boolean, host?: string }): Promise<void> => Promise<unknown> };
|
|
62
62
|
/**
|
|
63
63
|
* Story dev subcommand
|
|
64
64
|
*/
|
|
65
|
-
'story:dev': { /** @defaultValue 'Start story development server' */ description: string; options: { port: { /** @defaultValue 'p' */ alias: string; type: 'number'; /** @defaultValue 'Server port (default: 6006)' */ description: string }; open: { /** @defaultValue 'o' */ alias: string; type: 'boolean'; /** @defaultValue 'Open browser automatically' */ description: string }; host: { type: 'string'; /** @defaultValue 'Host to bind to' */ description: string } }; action: (options: { port?: number, open?: boolean, host?: string }) => unknown };
|
|
65
|
+
'story:dev': { /** @defaultValue 'Start story development server' */ description: string; options: { port: { /** @defaultValue 'p' */ alias: string; type: 'number'; /** @defaultValue 'Server port (default: 6006)' */ description: string }; open: { /** @defaultValue 'o' */ alias: string; type: 'boolean'; /** @defaultValue 'Open browser automatically' */ description: string }; host: { type: 'string'; /** @defaultValue 'Host to bind to' */ description: string } }; action: (options: { port?: number, open?: boolean, host?: string }): Promise<void> => Promise<unknown> };
|
|
66
66
|
/**
|
|
67
67
|
* Story build subcommand
|
|
68
68
|
*/
|
|
69
|
-
'story:build': { /** @defaultValue 'Build static story site' */ description: string; options: { outDir: { /** @defaultValue 'o' */ alias: string; type: 'string'; /** @defaultValue 'Output directory' */ description: string } }; action: (options: { outDir?: string }) => unknown };
|
|
69
|
+
'story:build': { /** @defaultValue 'Build static story site' */ description: string; options: { outDir: { /** @defaultValue 'o' */ alias: string; type: 'string'; /** @defaultValue 'Output directory' */ description: string } }; action: (options: { outDir?: string }): Promise<void> => Promise<unknown> };
|
|
70
70
|
/**
|
|
71
71
|
* Story preview subcommand
|
|
72
72
|
*/
|
|
73
|
-
'story:preview': { /** @defaultValue 'Preview built story site' */ description: string; options: { port: { /** @defaultValue 'p' */ alias: string; type: 'number'; /** @defaultValue 'Server port (default: 4173)' */ description: string }; open: { /** @defaultValue 'o' */ alias: string; type: 'boolean'; /** @defaultValue 'Open browser automatically' */ description: string } }; action: (options: { port?: number, open?: boolean }) => unknown };
|
|
73
|
+
'story:preview': { /** @defaultValue 'Preview built story site' */ description: string; options: { port: { /** @defaultValue 'p' */ alias: string; type: 'number'; /** @defaultValue 'Server port (default: 4173)' */ description: string }; open: { /** @defaultValue 'o' */ alias: string; type: 'boolean'; /** @defaultValue 'Open browser automatically' */ description: string } }; action: (options: { port?: number, open?: boolean }): Promise<void> => Promise<unknown> };
|
|
74
74
|
/**
|
|
75
75
|
* Story test subcommand
|
|
76
76
|
*/
|
|
77
|
-
'story:test': { /** @defaultValue 'Run visual regression tests' */ description: string; options: { update: { /** @defaultValue 'u' */ alias: string; type: 'boolean'; /** @defaultValue 'Update snapshots' */ description: string }; filter: { /** @defaultValue 'f' */ alias: string; type: 'string'; /** @defaultValue 'Filter components by name' */ description: string } }; action: (options: { update?: boolean, filter?: string }) => unknown }
|
|
77
|
+
'story:test': { /** @defaultValue 'Run visual regression tests' */ description: string; options: { update: { /** @defaultValue 'u' */ alias: string; type: 'boolean'; /** @defaultValue 'Update snapshots' */ description: string }; filter: { /** @defaultValue 'f' */ alias: string; type: 'string'; /** @defaultValue 'Filter components by name' */ description: string } }; action: (options: { update?: boolean, filter?: string }): Promise<void> => Promise<unknown> }
|
|
78
78
|
};
|
package/dist/story/output.d.ts
CHANGED
|
@@ -70,6 +70,34 @@ export declare function formatDuration(ms: number): string;
|
|
|
70
70
|
* Format file size in human-readable format
|
|
71
71
|
*/
|
|
72
72
|
export declare function formatSize(bytes: number): string;
|
|
73
|
+
// Colors
|
|
74
|
+
declare const colors: {
|
|
75
|
+
black: string;
|
|
76
|
+
red: string;
|
|
77
|
+
green: string;
|
|
78
|
+
yellow: string;
|
|
79
|
+
blue: string;
|
|
80
|
+
magenta: string;
|
|
81
|
+
cyan: string;
|
|
82
|
+
white: string;
|
|
83
|
+
gray: string;
|
|
84
|
+
brightRed: string;
|
|
85
|
+
brightGreen: string;
|
|
86
|
+
brightYellow: string;
|
|
87
|
+
brightBlue: string;
|
|
88
|
+
brightMagenta: string;
|
|
89
|
+
brightCyan: string;
|
|
90
|
+
brightWhite: string
|
|
91
|
+
};
|
|
92
|
+
// Styles
|
|
93
|
+
declare const styles: {
|
|
94
|
+
bold: string;
|
|
95
|
+
dim: string;
|
|
96
|
+
italic: string;
|
|
97
|
+
underline: string;
|
|
98
|
+
inverse: string;
|
|
99
|
+
strikethrough: string
|
|
100
|
+
};
|
|
73
101
|
// Convenience functions
|
|
74
102
|
export declare const red: (text: string) => string;
|
|
75
103
|
export declare const green: (text: string) => string;
|
|
@@ -12,31 +12,6 @@ export declare function getComponentSource(filePath: string): Promise<string>;
|
|
|
12
12
|
* Get story code with current props
|
|
13
13
|
*/
|
|
14
14
|
export declare function getStoryCode(componentName: string, props: Record<string, any>): string;
|
|
15
|
-
/**
|
|
16
|
-
* Get props as JSON
|
|
17
|
-
*/
|
|
18
|
-
export declare function getPropsJson(props: Record<string, any>): string;
|
|
19
|
-
/**
|
|
20
|
-
* Apply syntax highlighting to code
|
|
21
|
-
* Uses simple regex-based highlighting without external deps
|
|
22
|
-
*/
|
|
23
|
-
export declare function highlightCode(code: string, language: string): string;
|
|
24
|
-
/**
|
|
25
|
-
* Get syntax highlighting styles
|
|
26
|
-
*/
|
|
27
|
-
export declare function getHighlightStyles(): string;
|
|
28
|
-
/**
|
|
29
|
-
* Get code panel styles
|
|
30
|
-
*/
|
|
31
|
-
export declare function getCodePanelStyles(): string;
|
|
32
|
-
/**
|
|
33
|
-
* Copy code to clipboard (client-side)
|
|
34
|
-
*/
|
|
35
|
-
export declare function getCopyCodeScript(): string;
|
|
36
|
-
/**
|
|
37
|
-
* Open in VS Code (client-side)
|
|
38
|
-
*/
|
|
39
|
-
export declare function getOpenInVSCodeScript(filePath: string): string;
|
|
40
15
|
/**
|
|
41
16
|
* Code panel tabs
|
|
42
17
|
*/
|
package/dist/streaming.d.ts
CHANGED
|
@@ -28,6 +28,58 @@ export declare function streamTemplateSimple(templatePath: string, data?: Record
|
|
|
28
28
|
* @param options stx options
|
|
29
29
|
*/
|
|
30
30
|
export declare function createStreamRenderer(templatePath: string, options?: StxOptions): Promise<StreamRenderer>;
|
|
31
|
+
/**
|
|
32
|
+
* Register streaming and hydration directives
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerStreamingDirectives(options?: StxOptions): CustomDirective[];
|
|
35
|
+
/**
|
|
36
|
+
* Process section directives
|
|
37
|
+
* @param content Template content
|
|
38
|
+
* @param context Data context
|
|
39
|
+
* @param filePath Template file path
|
|
40
|
+
* @param _options stx options
|
|
41
|
+
*/
|
|
42
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
43
|
+
export declare function processSectionDirectives(content: string, context: Record<string, any>, filePath: string, _options?: StxOptions): Promise<string>;
|
|
44
|
+
/**
|
|
45
|
+
* Wrap a ReadableStream<string> in a proper Response with chunked transfer encoding headers.
|
|
46
|
+
*
|
|
47
|
+
* Makes it trivial to use streaming from a Bun server handler:
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const server = Bun.serve({
|
|
52
|
+
* async fetch(req) {
|
|
53
|
+
* const stream = await streamTemplate('index.stx', { title: 'Home' })
|
|
54
|
+
* return streamToResponse(stream)
|
|
55
|
+
* }
|
|
56
|
+
* })
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param stream - The template ReadableStream
|
|
60
|
+
* @param init - Optional additional ResponseInit (headers, status, etc.)
|
|
61
|
+
* @returns A Response with proper streaming headers
|
|
62
|
+
*/
|
|
63
|
+
export declare function streamToResponse(stream: ReadableStream<string>, init?: ResponseInit): Response;
|
|
64
|
+
/**
|
|
65
|
+
* Generate client-side hydration runtime script.
|
|
66
|
+
*
|
|
67
|
+
* This script handles:
|
|
68
|
+
* - Finding islands in the DOM
|
|
69
|
+
* - Loading island components based on priority
|
|
70
|
+
* - Hydrating islands with their props
|
|
71
|
+
*
|
|
72
|
+
* Usage: Include the generated script in your page, then call
|
|
73
|
+
* `window.__stx.hydrate()` when ready.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```html
|
|
77
|
+
* <script>
|
|
78
|
+
* {{ generateHydrationRuntime({ mode: 'full' }) }}
|
|
79
|
+
* </script>
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
export declare function generateHydrationRuntime(config?: HydrationRuntimeConfig): string;
|
|
31
83
|
/**
|
|
32
84
|
* Custom directive for marking suspense boundaries in streaming templates.
|
|
33
85
|
*
|
|
@@ -49,3 +101,11 @@ export declare const streamingSuspenseDirective: CustomDirective;
|
|
|
49
101
|
* Custom directive for creating islands (for partial hydration)
|
|
50
102
|
*/
|
|
51
103
|
export declare const islandDirective: CustomDirective;
|
|
104
|
+
/**
|
|
105
|
+
* Configuration for hydration runtime generation
|
|
106
|
+
*/
|
|
107
|
+
export declare interface HydrationRuntimeConfig {
|
|
108
|
+
mode: 'full' | 'loader'
|
|
109
|
+
components?: Record<string, string>
|
|
110
|
+
dynamicImports?: boolean
|
|
111
|
+
}
|
package/dist/stx.d.ts
CHANGED
|
@@ -340,6 +340,21 @@ interface StxModal {
|
|
|
340
340
|
|
|
341
341
|
declare const modal: StxModal
|
|
342
342
|
|
|
343
|
+
// ============================================================================
|
|
344
|
+
// Drawer system
|
|
345
|
+
// ============================================================================
|
|
346
|
+
|
|
347
|
+
interface StxDrawer {
|
|
348
|
+
/** Open a drawer by its id */
|
|
349
|
+
open: (id: string) => void
|
|
350
|
+
/** Close a drawer by its id */
|
|
351
|
+
close: (id: string) => void
|
|
352
|
+
/** Toggle a drawer by its id */
|
|
353
|
+
toggle: (id: string) => void
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare const drawer: StxDrawer
|
|
357
|
+
|
|
343
358
|
// ============================================================================
|
|
344
359
|
// Alert & Confirm dialogs
|
|
345
360
|
// ============================================================================
|
|
@@ -478,6 +493,9 @@ interface StxRuntimeRegistry {
|
|
|
478
493
|
// Modal
|
|
479
494
|
modal: StxModal
|
|
480
495
|
|
|
496
|
+
// Drawer
|
|
497
|
+
drawer: StxDrawer
|
|
498
|
+
|
|
481
499
|
// Dialogs
|
|
482
500
|
alert: typeof stxAlert
|
|
483
501
|
confirm: typeof stxConfirm
|
package/dist/testing.d.ts
CHANGED
|
@@ -86,142 +86,116 @@ export declare function createTestContext(options?: {
|
|
|
86
86
|
export declare function cleanup(): void;
|
|
87
87
|
/**
|
|
88
88
|
* Fire events on elements.
|
|
89
|
-
* @defaultValue
|
|
90
|
-
* ```ts
|
|
91
|
-
* {
|
|
92
|
-
* async click: (
|
|
93
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
94
|
-
* options?: MouseEventInit,
|
|
95
|
-
* ) => unknown,
|
|
96
|
-
* async dblClick: (
|
|
97
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
98
|
-
* options?: MouseEventInit,
|
|
99
|
-
* ) => unknown,
|
|
100
|
-
* async input: (
|
|
101
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
102
|
-
* value: string,
|
|
103
|
-
* ) => unknown,
|
|
104
|
-
* async change: (
|
|
105
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
106
|
-
* value?: string,
|
|
107
|
-
* ) => unknown,
|
|
108
|
-
* async submit: (
|
|
109
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
110
|
-
* ) => unknown,
|
|
111
|
-
* async focus: (
|
|
112
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
113
|
-
* ) => unknown,
|
|
114
|
-
* async blur: (
|
|
115
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
116
|
-
* ) => unknown,
|
|
117
|
-
* async keyDown: (
|
|
118
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
119
|
-
* key: string,
|
|
120
|
-
* options?: KeyboardEventInit,
|
|
121
|
-
* ) => unknown,
|
|
122
|
-
* async keyUp: (
|
|
123
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
124
|
-
* key: string,
|
|
125
|
-
* options?: KeyboardEventInit,
|
|
126
|
-
* ) => unknown,
|
|
127
|
-
* async custom: (
|
|
128
|
-
* target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
129
|
-
* eventName: string,
|
|
130
|
-
* options?: FireEventOptions,
|
|
131
|
-
* ) => unknown
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
89
|
*/
|
|
135
90
|
export declare const fireEvent: {
|
|
136
91
|
/**
|
|
137
92
|
* Fire a click event.
|
|
138
93
|
*/
|
|
139
|
-
async click: (
|
|
94
|
+
async click: (
|
|
95
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
96
|
+
options?: MouseEventInit,
|
|
97
|
+
) => Promise<void>;
|
|
140
98
|
/**
|
|
141
99
|
* Fire a double click event.
|
|
142
100
|
*/
|
|
143
|
-
async dblClick: (
|
|
101
|
+
async dblClick: (
|
|
102
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
103
|
+
options?: MouseEventInit,
|
|
104
|
+
) => Promise<void>;
|
|
144
105
|
/**
|
|
145
106
|
* Fire an input event.
|
|
146
107
|
*/
|
|
147
|
-
async input: (
|
|
108
|
+
async input: (
|
|
109
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
110
|
+
value: string,
|
|
111
|
+
) => Promise<void>;
|
|
148
112
|
/**
|
|
149
113
|
* Fire a change event.
|
|
150
114
|
*/
|
|
151
|
-
async change: (
|
|
115
|
+
async change: (
|
|
116
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
117
|
+
value?: string,
|
|
118
|
+
) => Promise<void>;
|
|
152
119
|
/**
|
|
153
120
|
* Fire a submit event.
|
|
154
121
|
*/
|
|
155
|
-
async submit: (
|
|
122
|
+
async submit: (
|
|
123
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
124
|
+
) => Promise<void>;
|
|
156
125
|
/**
|
|
157
126
|
* Fire a focus event.
|
|
158
127
|
*/
|
|
159
|
-
async focus: (
|
|
128
|
+
async focus: (
|
|
129
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
130
|
+
) => Promise<void>;
|
|
160
131
|
/**
|
|
161
132
|
* Fire a blur event.
|
|
162
133
|
*/
|
|
163
|
-
async blur: (
|
|
134
|
+
async blur: (
|
|
135
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
136
|
+
) => Promise<void>;
|
|
164
137
|
/**
|
|
165
138
|
* Fire a keydown event.
|
|
166
139
|
*/
|
|
167
|
-
async keyDown: (
|
|
140
|
+
async keyDown: (
|
|
141
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
142
|
+
key: string,
|
|
143
|
+
options?: KeyboardEventInit,
|
|
144
|
+
) => Promise<void>;
|
|
168
145
|
/**
|
|
169
146
|
* Fire a keyup event.
|
|
170
147
|
*/
|
|
171
|
-
async keyUp: (
|
|
148
|
+
async keyUp: (
|
|
149
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
150
|
+
key: string,
|
|
151
|
+
options?: KeyboardEventInit,
|
|
152
|
+
) => Promise<void>;
|
|
172
153
|
/**
|
|
173
154
|
* Fire a custom event.
|
|
174
155
|
*/
|
|
175
|
-
async custom: (
|
|
156
|
+
async custom: (
|
|
157
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
158
|
+
eventName: string,
|
|
159
|
+
options?: FireEventOptions,
|
|
160
|
+
) => Promise<void>
|
|
176
161
|
};
|
|
177
162
|
/**
|
|
178
163
|
* Create custom matchers for testing.
|
|
179
|
-
* @defaultValue
|
|
180
|
-
* ```ts
|
|
181
|
-
* {
|
|
182
|
-
* toContainText: (wrapper: ComponentWrapper | ElementWrapper, text: string) => unknown,
|
|
183
|
-
* toHaveClass: (wrapper: ComponentWrapper | ElementWrapper, className: string) => unknown,
|
|
184
|
-
* toHaveAttribute: (
|
|
185
|
-
* wrapper: ComponentWrapper | ElementWrapper,
|
|
186
|
-
* name: string,
|
|
187
|
-
* value?: string,
|
|
188
|
-
* ) => unknown,
|
|
189
|
-
* toBeVisible: (wrapper: ComponentWrapper | ElementWrapper) => unknown,
|
|
190
|
-
* toExist: (wrapper: ComponentWrapper | ElementWrapper | null) => unknown,
|
|
191
|
-
* toHaveEmitted: (wrapper: ComponentWrapper, event: string, times?: number) => unknown,
|
|
192
|
-
* toHaveEmittedWith: (wrapper: ComponentWrapper, event: string, payload: unknown) => unknown
|
|
193
|
-
* }
|
|
194
|
-
* ```
|
|
164
|
+
* @defaultValue `{ toHaveEmittedWith: () => unknown }`
|
|
195
165
|
*/
|
|
196
166
|
export declare const matchers: {
|
|
197
167
|
/**
|
|
198
168
|
* Check if wrapper contains text.
|
|
199
169
|
*/
|
|
200
|
-
toContainText: (wrapper: ComponentWrapper | ElementWrapper, text: string) =>
|
|
170
|
+
toContainText: (wrapper: ComponentWrapper | ElementWrapper, text: string) => boolean;
|
|
201
171
|
/**
|
|
202
172
|
* Check if wrapper has class.
|
|
203
173
|
*/
|
|
204
|
-
toHaveClass: (wrapper: ComponentWrapper | ElementWrapper, className: string) =>
|
|
174
|
+
toHaveClass: (wrapper: ComponentWrapper | ElementWrapper, className: string) => boolean;
|
|
205
175
|
/**
|
|
206
176
|
* Check if wrapper has attribute.
|
|
207
177
|
*/
|
|
208
|
-
toHaveAttribute: (
|
|
178
|
+
toHaveAttribute: (
|
|
179
|
+
wrapper: ComponentWrapper | ElementWrapper,
|
|
180
|
+
name: string,
|
|
181
|
+
value?: string,
|
|
182
|
+
) => boolean;
|
|
209
183
|
/**
|
|
210
184
|
* Check if wrapper is visible.
|
|
211
185
|
*/
|
|
212
|
-
toBeVisible: (wrapper: ComponentWrapper | ElementWrapper) =>
|
|
186
|
+
toBeVisible: (wrapper: ComponentWrapper | ElementWrapper) => boolean;
|
|
213
187
|
/**
|
|
214
188
|
* Check if wrapper exists.
|
|
215
189
|
*/
|
|
216
|
-
toExist: (wrapper: ComponentWrapper | ElementWrapper | null) =>
|
|
190
|
+
toExist: (wrapper: ComponentWrapper | ElementWrapper | null) => boolean;
|
|
217
191
|
/**
|
|
218
192
|
* Check if event was emitted.
|
|
219
193
|
*/
|
|
220
|
-
toHaveEmitted: (wrapper: ComponentWrapper, event: string, times?: number) =>
|
|
194
|
+
toHaveEmitted: (wrapper: ComponentWrapper, event: string, times?: number) => boolean;
|
|
221
195
|
/**
|
|
222
196
|
* Check if event was emitted with payload.
|
|
223
197
|
*/
|
|
224
|
-
toHaveEmittedWith: (wrapper: ComponentWrapper, event: string, payload: unknown) =>
|
|
198
|
+
toHaveEmittedWith: (wrapper: ComponentWrapper, event: string, payload: unknown) => boolean
|
|
225
199
|
};
|
|
226
200
|
/** Mount options */
|
|
227
201
|
export declare interface MountOptions {
|
|
@@ -250,6 +250,12 @@ export declare interface AppHeadConfig {
|
|
|
250
250
|
export declare interface StxConfig {
|
|
251
251
|
app?: {
|
|
252
252
|
head?: AppHeadConfig
|
|
253
|
+
window?: {
|
|
254
|
+
width?: number
|
|
255
|
+
height?: number
|
|
256
|
+
darkMode?: boolean
|
|
257
|
+
hotReload?: boolean
|
|
258
|
+
}
|
|
253
259
|
}
|
|
254
260
|
root?: string
|
|
255
261
|
pagesDir?: string
|
package/dist/visual-editor.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export declare function getDefaultPalette(): PaletteItem[];
|
|
|
26
26
|
* Generate insert result for a palette item.
|
|
27
27
|
*/
|
|
28
28
|
export declare function insertPaletteItem(item: PaletteItem, position: EditorPosition, indentation?: string): InsertResult;
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// Helper Functions
|
|
31
|
+
// =============================================================================
|
|
32
|
+
declare function hasEndTag(directiveName: string): boolean;
|
|
29
33
|
/** Template outline node */
|
|
30
34
|
export declare interface OutlineNode {
|
|
31
35
|
type: OutlineNodeType
|
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.24",
|
|
5
5
|
"description": "A performant UI Framework. Powered by Bun.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -116,12 +116,12 @@
|
|
|
116
116
|
"dependencies": {
|
|
117
117
|
"@cwcss/crosswind": "^0.2.0",
|
|
118
118
|
"@stacksjs/clapp": "^0.2.0",
|
|
119
|
-
"@stacksjs/desktop": "0.2.
|
|
120
|
-
"@stacksjs/sanitizer": "0.2.
|
|
119
|
+
"@stacksjs/desktop": "0.2.24",
|
|
120
|
+
"@stacksjs/sanitizer": "0.2.24",
|
|
121
121
|
"@stacksjs/ts-craft": "^0.0.2",
|
|
122
|
-
"bun-plugin-stx": "0.2.
|
|
122
|
+
"bun-plugin-stx": "0.2.24",
|
|
123
123
|
"bunfig": "^0.15.6",
|
|
124
|
-
"stx-router": "0.2.
|
|
124
|
+
"stx-router": "0.2.24",
|
|
125
125
|
"ts-broadcasting": "^0.0.4",
|
|
126
126
|
"ts-syntax-highlighter": "^0.2.1"
|
|
127
127
|
}
|
package/stx.d.ts
CHANGED
|
@@ -340,6 +340,21 @@ interface StxModal {
|
|
|
340
340
|
|
|
341
341
|
declare const modal: StxModal
|
|
342
342
|
|
|
343
|
+
// ============================================================================
|
|
344
|
+
// Drawer system
|
|
345
|
+
// ============================================================================
|
|
346
|
+
|
|
347
|
+
interface StxDrawer {
|
|
348
|
+
/** Open a drawer by its id */
|
|
349
|
+
open: (id: string) => void
|
|
350
|
+
/** Close a drawer by its id */
|
|
351
|
+
close: (id: string) => void
|
|
352
|
+
/** Toggle a drawer by its id */
|
|
353
|
+
toggle: (id: string) => void
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
declare const drawer: StxDrawer
|
|
357
|
+
|
|
343
358
|
// ============================================================================
|
|
344
359
|
// Alert & Confirm dialogs
|
|
345
360
|
// ============================================================================
|
|
@@ -478,6 +493,9 @@ interface StxRuntimeRegistry {
|
|
|
478
493
|
// Modal
|
|
479
494
|
modal: StxModal
|
|
480
495
|
|
|
496
|
+
// Drawer
|
|
497
|
+
drawer: StxDrawer
|
|
498
|
+
|
|
481
499
|
// Dialogs
|
|
482
500
|
alert: typeof stxAlert
|
|
483
501
|
confirm: typeof stxConfirm
|