@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,289 @@
|
|
|
1
|
+
import type { StxOptions } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Render an STX template to HTML.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const { html, container } = await render('<h1>{{ title }}</h1>', {
|
|
8
|
+
* context: { title: 'Hello World' }
|
|
9
|
+
* })
|
|
10
|
+
* expect(html).toContain('Hello World')
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function render(template: string, options?: MountOptions): Promise<RenderResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Mount an STX component for testing.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const wrapper = await mount('<Button @click="handleClick">Click me</Button>', {
|
|
20
|
+
* props: { disabled: false },
|
|
21
|
+
* context: { handleClick: vi.fn() }
|
|
22
|
+
* })
|
|
23
|
+
*
|
|
24
|
+
* await wrapper.find('button')?.trigger('click')
|
|
25
|
+
* expect(wrapper.emitted('click')).toBeDefined()
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function mount(template: string, options?: MountOptions): Promise<ComponentWrapper>;
|
|
29
|
+
/**
|
|
30
|
+
* Wait for the next tick.
|
|
31
|
+
*/
|
|
32
|
+
export declare function nextTick(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Wait for a condition to be true.
|
|
35
|
+
*/
|
|
36
|
+
export declare function waitFor(condition: () => boolean | Promise<boolean>, options?: { timeout?: number; interval?: number }): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Wait for element to appear.
|
|
39
|
+
*/
|
|
40
|
+
export declare function waitForElement(wrapper: ComponentWrapper, selector: string, options?: { timeout?: number }): Promise<ElementWrapper | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Flush all pending promises.
|
|
43
|
+
*/
|
|
44
|
+
export declare function flushPromises(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Create a mock function.
|
|
47
|
+
*/
|
|
48
|
+
export declare function createMockFn<T extends (...args: unknown[]) => unknown>(): MockFn<T>;
|
|
49
|
+
/**
|
|
50
|
+
* Create a mock store for testing.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const store = createMockStore({ count: 0, user: null })
|
|
55
|
+
*
|
|
56
|
+
* store.setState({ count: 5 })
|
|
57
|
+
* expect(store.getState().count).toBe(5)
|
|
58
|
+
*
|
|
59
|
+
* // Check history
|
|
60
|
+
* expect(store.getHistory()).toEqual([
|
|
61
|
+
* { count: 0, user: null },
|
|
62
|
+
* { count: 5, user: null }
|
|
63
|
+
* ])
|
|
64
|
+
*
|
|
65
|
+
* // Reset
|
|
66
|
+
* store.reset()
|
|
67
|
+
* expect(store.getState().count).toBe(0)
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function createMockStore<T extends Record<string, unknown>>(initialState: T): MockStore<T>;
|
|
71
|
+
/**
|
|
72
|
+
* Create a test context with common setup.
|
|
73
|
+
*/
|
|
74
|
+
export declare function createTestContext(options?: {
|
|
75
|
+
props?: Record<string, unknown>
|
|
76
|
+
context?: Record<string, unknown>
|
|
77
|
+
mocks?: Record<string, unknown>
|
|
78
|
+
}): {
|
|
79
|
+
props: Record<string, unknown>
|
|
80
|
+
context: Record<string, unknown>
|
|
81
|
+
mocks: Record<string, MockFn>
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Clean up after tests.
|
|
85
|
+
*/
|
|
86
|
+
export declare function cleanup(): void;
|
|
87
|
+
/**
|
|
88
|
+
* Fire events on elements.
|
|
89
|
+
*/
|
|
90
|
+
export declare const fireEvent: {
|
|
91
|
+
/**
|
|
92
|
+
* Fire a click event.
|
|
93
|
+
*/
|
|
94
|
+
async click(
|
|
95
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
96
|
+
options?: MouseEventInit,
|
|
97
|
+
): unknown;
|
|
98
|
+
/**
|
|
99
|
+
* Fire a double click event.
|
|
100
|
+
*/
|
|
101
|
+
async dblClick(
|
|
102
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
103
|
+
options?: MouseEventInit,
|
|
104
|
+
): unknown;
|
|
105
|
+
/**
|
|
106
|
+
* Fire an input event.
|
|
107
|
+
*/
|
|
108
|
+
async input(
|
|
109
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
110
|
+
value: string,
|
|
111
|
+
): unknown;
|
|
112
|
+
/**
|
|
113
|
+
* Fire a change event.
|
|
114
|
+
*/
|
|
115
|
+
async change(
|
|
116
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
117
|
+
value?: string,
|
|
118
|
+
): unknown;
|
|
119
|
+
/**
|
|
120
|
+
* Fire a submit event.
|
|
121
|
+
*/
|
|
122
|
+
async submit(
|
|
123
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
124
|
+
): unknown;
|
|
125
|
+
/**
|
|
126
|
+
* Fire a focus event.
|
|
127
|
+
*/
|
|
128
|
+
async focus(
|
|
129
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
130
|
+
): unknown;
|
|
131
|
+
/**
|
|
132
|
+
* Fire a blur event.
|
|
133
|
+
*/
|
|
134
|
+
async blur(
|
|
135
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
136
|
+
): unknown;
|
|
137
|
+
/**
|
|
138
|
+
* Fire a keydown event.
|
|
139
|
+
*/
|
|
140
|
+
async keyDown(
|
|
141
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
142
|
+
key: string,
|
|
143
|
+
options?: KeyboardEventInit,
|
|
144
|
+
): unknown;
|
|
145
|
+
/**
|
|
146
|
+
* Fire a keyup event.
|
|
147
|
+
*/
|
|
148
|
+
async keyUp(
|
|
149
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
150
|
+
key: string,
|
|
151
|
+
options?: KeyboardEventInit,
|
|
152
|
+
): unknown;
|
|
153
|
+
/**
|
|
154
|
+
* Fire a custom event.
|
|
155
|
+
*/
|
|
156
|
+
async custom(
|
|
157
|
+
target: HTMLElement | ElementWrapper | ComponentWrapper | null,
|
|
158
|
+
eventName: string,
|
|
159
|
+
options?: FireEventOptions,
|
|
160
|
+
): unknown
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Create custom matchers for testing.
|
|
164
|
+
*/
|
|
165
|
+
export declare const matchers: {
|
|
166
|
+
/**
|
|
167
|
+
* Check if wrapper contains text.
|
|
168
|
+
*/
|
|
169
|
+
toContainText(wrapper: ComponentWrapper | ElementWrapper, text: string): unknown;
|
|
170
|
+
/**
|
|
171
|
+
* Check if wrapper has class.
|
|
172
|
+
*/
|
|
173
|
+
toHaveClass(wrapper: ComponentWrapper | ElementWrapper, className: string): unknown;
|
|
174
|
+
/**
|
|
175
|
+
* Check if wrapper has attribute.
|
|
176
|
+
*/
|
|
177
|
+
toHaveAttribute(
|
|
178
|
+
wrapper: ComponentWrapper | ElementWrapper,
|
|
179
|
+
name: string,
|
|
180
|
+
value?: string,
|
|
181
|
+
): unknown;
|
|
182
|
+
/**
|
|
183
|
+
* Check if wrapper is visible.
|
|
184
|
+
*/
|
|
185
|
+
toBeVisible(wrapper: ComponentWrapper | ElementWrapper): unknown;
|
|
186
|
+
/**
|
|
187
|
+
* Check if wrapper exists.
|
|
188
|
+
*/
|
|
189
|
+
toExist(wrapper: ComponentWrapper | ElementWrapper | null): unknown;
|
|
190
|
+
/**
|
|
191
|
+
* Check if event was emitted.
|
|
192
|
+
*/
|
|
193
|
+
toHaveEmitted(wrapper: ComponentWrapper, event: string, times?: number): unknown;
|
|
194
|
+
/**
|
|
195
|
+
* Check if event was emitted with payload.
|
|
196
|
+
*/
|
|
197
|
+
toHaveEmittedWith(wrapper: ComponentWrapper, event: string, payload: unknown): (boolean { const emitted?) if (!emitted) return false return emitted.some((args)) => unknown
|
|
198
|
+
};
|
|
199
|
+
/** Mount options */
|
|
200
|
+
export declare interface MountOptions {
|
|
201
|
+
props?: Record<string, unknown>
|
|
202
|
+
slots?: Record<string, string>
|
|
203
|
+
context?: Record<string, unknown>
|
|
204
|
+
stxOptions?: Partial<StxOptions>
|
|
205
|
+
attachTo?: HTMLElement | string
|
|
206
|
+
mocks?: Record<string, unknown>
|
|
207
|
+
stubs?: Record<string, string | boolean>
|
|
208
|
+
plugins?: unknown[]
|
|
209
|
+
}
|
|
210
|
+
/** Render result */
|
|
211
|
+
export declare interface RenderResult {
|
|
212
|
+
html: string
|
|
213
|
+
document: Document
|
|
214
|
+
container: HTMLElement
|
|
215
|
+
context: Record<string, unknown>
|
|
216
|
+
dependencies: Set<string>
|
|
217
|
+
}
|
|
218
|
+
/** Wrapper for mounted component */
|
|
219
|
+
export declare interface ComponentWrapper {
|
|
220
|
+
element: HTMLElement
|
|
221
|
+
html(): string
|
|
222
|
+
text(): string
|
|
223
|
+
find(selector: string): ElementWrapper<T> | null
|
|
224
|
+
findAll(selector: string): ElementWrapper<T>[]
|
|
225
|
+
findComponent(name: string): ComponentWrapper | null
|
|
226
|
+
findAllComponents(name: string): ComponentWrapper[]
|
|
227
|
+
exists(): boolean
|
|
228
|
+
isVisible(): boolean
|
|
229
|
+
attributes(): Record<string, string>
|
|
230
|
+
attributes(name: string): string | null
|
|
231
|
+
classes(): string[]
|
|
232
|
+
classes(name: string): boolean
|
|
233
|
+
props(): Record<string, unknown>
|
|
234
|
+
props(name: string): T | undefined
|
|
235
|
+
emitted(): Record<string, unknown[][]>
|
|
236
|
+
emitted(event: string): unknown[][] | undefined
|
|
237
|
+
setProps(props: Record<string, unknown>): Promise<void>
|
|
238
|
+
setData(data: Record<string, unknown>): Promise<void>
|
|
239
|
+
trigger(event: string, payload?: unknown): Promise<void>
|
|
240
|
+
getValue(): string | boolean | string[]
|
|
241
|
+
setValue(value: string | boolean): Promise<void>
|
|
242
|
+
unmount(): void
|
|
243
|
+
vm: {
|
|
244
|
+
$nextTick(): Promise<void>
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
/** Wrapper for DOM elements */
|
|
248
|
+
export declare interface ElementWrapper<T extends HTMLElement = HTMLElement> {
|
|
249
|
+
element: T
|
|
250
|
+
html(): string
|
|
251
|
+
text(): string
|
|
252
|
+
find(selector: string): ElementWrapper<E> | null
|
|
253
|
+
findAll(selector: string): ElementWrapper<E>[]
|
|
254
|
+
exists(): boolean
|
|
255
|
+
isVisible(): boolean
|
|
256
|
+
attributes(): Record<string, string>
|
|
257
|
+
attributes(name: string): string | null
|
|
258
|
+
classes(): string[]
|
|
259
|
+
classes(name: string): boolean
|
|
260
|
+
trigger(event: string, payload?: unknown): Promise<void>
|
|
261
|
+
getValue(): string | boolean | string[]
|
|
262
|
+
setValue(value: string | boolean): Promise<void>
|
|
263
|
+
}
|
|
264
|
+
/** Fire event options */
|
|
265
|
+
export declare interface FireEventOptions {
|
|
266
|
+
bubbles?: boolean
|
|
267
|
+
cancelable?: boolean
|
|
268
|
+
detail?: unknown
|
|
269
|
+
}
|
|
270
|
+
/** Mock function type */
|
|
271
|
+
export declare interface MockFn<T extends (...args: unknown[]) => unknown = (...args: unknown[]) => unknown> {
|
|
272
|
+
(...args: Parameters<T>): ReturnType<T> | undefined
|
|
273
|
+
mock: {
|
|
274
|
+
calls: unknown[][]
|
|
275
|
+
results: unknown[]
|
|
276
|
+
}
|
|
277
|
+
mockImplementation(impl: T): MockFn<T>
|
|
278
|
+
mockReturnValue(value: unknown): MockFn<T>
|
|
279
|
+
mockClear(): MockFn<T>
|
|
280
|
+
mockReset(): MockFn<T>
|
|
281
|
+
}
|
|
282
|
+
/** Mock store interface */
|
|
283
|
+
export declare interface MockStore<T extends Record<string, unknown>> {
|
|
284
|
+
getState(): T
|
|
285
|
+
setState(partial: Partial<T>): void
|
|
286
|
+
reset(): void
|
|
287
|
+
getHistory(): T[]
|
|
288
|
+
subscribe(listener: (state: T) => void): () => void
|
|
289
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform an enter transition on an element.
|
|
3
|
+
*/
|
|
4
|
+
export declare function performEnter(el: Element, options?: TransitionOptions): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Perform a leave transition on an element.
|
|
7
|
+
*/
|
|
8
|
+
export declare function performLeave(el: Element, options?: TransitionOptions): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Process @transition directives in templates.
|
|
11
|
+
*
|
|
12
|
+
* Syntax:
|
|
13
|
+
* @transition(name: 'fade')
|
|
14
|
+
* @transition(name: 'slide', duration: 300)
|
|
15
|
+
* @transition(name: 'fade', mode: 'out-in')
|
|
16
|
+
*/
|
|
17
|
+
export declare function processTransitionDirectives(template: string, _context?: Record<string, unknown>, _filePath?: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Generate CSS for common transition presets.
|
|
20
|
+
*/
|
|
21
|
+
export declare function generateTransitionCSS(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Generate the client-side transition runtime.
|
|
24
|
+
*/
|
|
25
|
+
export declare function generateTransitionRuntime(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Process @transition attribute on elements.
|
|
28
|
+
*
|
|
29
|
+
* Usage:
|
|
30
|
+
* <div @transition.fade="visible">Content</div>
|
|
31
|
+
* <div @transition.slide-up.300="isOpen">Content</div>
|
|
32
|
+
*/
|
|
33
|
+
export declare function processTransitionAttributes(template: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* STX Transitions
|
|
36
|
+
*
|
|
37
|
+
* Vue-inspired transition system for enter/leave animations.
|
|
38
|
+
* Supports CSS transitions, CSS animations, and JavaScript hooks.
|
|
39
|
+
*
|
|
40
|
+
* @module transitions
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```html
|
|
44
|
+
* @transition(name: 'fade')
|
|
45
|
+
* @if (visible)
|
|
46
|
+
* <div class="modal">Content</div>
|
|
47
|
+
* @endif
|
|
48
|
+
* @endtransition
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* CSS classes applied:
|
|
52
|
+
* - `.fade-enter-from` - Starting state for enter
|
|
53
|
+
* - `.fade-enter-active` - Active state during enter
|
|
54
|
+
* - `.fade-enter-to` - Ending state for enter
|
|
55
|
+
* - `.fade-leave-from` - Starting state for leave
|
|
56
|
+
* - `.fade-leave-active` - Active state during leave
|
|
57
|
+
* - `.fade-leave-to` - Ending state for leave
|
|
58
|
+
*/
|
|
59
|
+
// =============================================================================
|
|
60
|
+
// Types
|
|
61
|
+
// =============================================================================
|
|
62
|
+
export declare interface TransitionOptions {
|
|
63
|
+
name?: string
|
|
64
|
+
duration?: number | { enter: number; leave: number }
|
|
65
|
+
easing?: string
|
|
66
|
+
mode?: 'in-out' | 'out-in' | 'default'
|
|
67
|
+
css?: boolean
|
|
68
|
+
enterClass?: string
|
|
69
|
+
enterActiveClass?: string
|
|
70
|
+
enterToClass?: string
|
|
71
|
+
leaveClass?: string
|
|
72
|
+
leaveActiveClass?: string
|
|
73
|
+
leaveToClass?: string
|
|
74
|
+
onBeforeEnter?: (el: Element) => void
|
|
75
|
+
onEnter?: (el: Element, done: () => void) => void
|
|
76
|
+
onAfterEnter?: (el: Element) => void
|
|
77
|
+
onEnterCancelled?: (el: Element) => void
|
|
78
|
+
onBeforeLeave?: (el: Element) => void
|
|
79
|
+
onLeave?: (el: Element, done: () => void) => void
|
|
80
|
+
onAfterLeave?: (el: Element) => void
|
|
81
|
+
onLeaveCancelled?: (el: Element) => void
|
|
82
|
+
}
|
|
83
|
+
export declare interface TransitionState {
|
|
84
|
+
isEntering: boolean
|
|
85
|
+
isLeaving: boolean
|
|
86
|
+
isCancelled: boolean
|
|
87
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a type checker instance
|
|
3
|
+
*/
|
|
4
|
+
export declare function createTypeChecker(options?: TypeCheckerOptions): TemplateTypeChecker;
|
|
5
|
+
/**
|
|
6
|
+
* Check a template file
|
|
7
|
+
*/
|
|
8
|
+
export declare function checkTemplateFile(filePath: string, options?: TypeCheckerOptions): TypeCheckResult;
|
|
9
|
+
/**
|
|
10
|
+
* Check a template string
|
|
11
|
+
*/
|
|
12
|
+
export declare function checkTemplate(template: string, options?: TypeCheckerOptions): TypeCheckResult;
|
|
13
|
+
/**
|
|
14
|
+
* Format type check errors for display
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatTypeErrors(result: TypeCheckResult): string;
|
|
17
|
+
/**
|
|
18
|
+
* Type definition for a variable or expression
|
|
19
|
+
*/
|
|
20
|
+
export declare interface TypeDefinition {
|
|
21
|
+
kind: 'primitive' | 'object' | 'array' | 'function' | 'union' | 'intersection' | 'literal'
|
|
22
|
+
name?: string
|
|
23
|
+
value?: PrimitiveType | string
|
|
24
|
+
properties?: Record<string, TypeDefinition>
|
|
25
|
+
elementType?: TypeDefinition
|
|
26
|
+
params?: Array<{ name: string, type: TypeDefinition, optional?: boolean }>
|
|
27
|
+
returnType?: TypeDefinition
|
|
28
|
+
types?: TypeDefinition[]
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Type error reported by the checker
|
|
32
|
+
*/
|
|
33
|
+
export declare interface TypeCheckError {
|
|
34
|
+
message: string
|
|
35
|
+
file: string
|
|
36
|
+
line: number
|
|
37
|
+
column: number
|
|
38
|
+
expression: string
|
|
39
|
+
expected?: string
|
|
40
|
+
received?: string
|
|
41
|
+
severity: 'error' | 'warning'
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Type check result
|
|
45
|
+
*/
|
|
46
|
+
export declare interface TypeCheckResult {
|
|
47
|
+
valid: boolean
|
|
48
|
+
errors: TypeCheckError[]
|
|
49
|
+
warnings: TypeCheckError[]
|
|
50
|
+
variables: Map<string, TypeDefinition>
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Options for the type checker
|
|
54
|
+
*/
|
|
55
|
+
export declare interface TypeCheckerOptions {
|
|
56
|
+
strict?: boolean
|
|
57
|
+
allowAny?: boolean
|
|
58
|
+
checkPropertyAccess?: boolean
|
|
59
|
+
checkFunctionCalls?: boolean
|
|
60
|
+
includeBuiltins?: boolean
|
|
61
|
+
customTypes?: Record<string, TypeDefinition>
|
|
62
|
+
baseDir?: string
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Primitive types supported by the type checker
|
|
66
|
+
*/
|
|
67
|
+
export type PrimitiveType = | 'string'
|
|
68
|
+
| 'number'
|
|
69
|
+
| 'boolean'
|
|
70
|
+
| 'null'
|
|
71
|
+
| 'undefined'
|
|
72
|
+
| 'any'
|
|
73
|
+
| 'unknown'
|
|
74
|
+
| 'void'
|
|
75
|
+
| 'never'
|
|
76
|
+
/**
|
|
77
|
+
* Template Type Checker class
|
|
78
|
+
*/
|
|
79
|
+
export declare class TemplateTypeChecker {
|
|
80
|
+
private options: TypeCheckerOptions;
|
|
81
|
+
private variables: Map<string, TypeDefinition>;
|
|
82
|
+
private errors: TypeCheckError[];
|
|
83
|
+
private warnings: TypeCheckError[];
|
|
84
|
+
private currentFile: string;
|
|
85
|
+
constructor(options?: TypeCheckerOptions);
|
|
86
|
+
checkFile(filePath: string): TypeCheckResult;
|
|
87
|
+
checkTemplate(template: string, filePath?: string): TypeCheckResult;
|
|
88
|
+
private analyzeScript(script: string, scriptOffset: number): void;
|
|
89
|
+
private extractTypedVariables(line: string, lineNum: number): void;
|
|
90
|
+
private extractInterfaces(line: string, lines: string[], index: number, lineNum: number): void;
|
|
91
|
+
private extractTypeAliases(line: string, lineNum: number): void;
|
|
92
|
+
private parseTypeAnnotation(annotation: string): TypeDefinition;
|
|
93
|
+
private inferType(value: string): TypeDefinition;
|
|
94
|
+
private parseParams(paramsStr: string): Array<{ name: string, type: TypeDefinition, optional?: boolean }>;
|
|
95
|
+
private checkExpressions(template: string): void;
|
|
96
|
+
private checkExpression(expression: string, line: number, column: number): void;
|
|
97
|
+
private checkDirectives(template: string): void;
|
|
98
|
+
private resolvePropertyAccess(expr: string): TypeDefinition;
|
|
99
|
+
private isLiteral(expr: string): boolean;
|
|
100
|
+
private extractObjectLiteral(expr: string): Record<string, string>;
|
|
101
|
+
private splitByComma(str: string): string[];
|
|
102
|
+
private getLineNumber(position: number, template?: string): number;
|
|
103
|
+
private getColumn(position: number, template: string): number;
|
|
104
|
+
private addError(message: string, line: number, column: number, expression: string, expected?: string, received?: string): void;
|
|
105
|
+
private addWarning(message: string, line: number, column: number, expression: string, expected?: string, received?: string): void;
|
|
106
|
+
private getResult(): TypeCheckResult;
|
|
107
|
+
addVariable(name: string, type: TypeDefinition): void;
|
|
108
|
+
reset(): void;
|
|
109
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component prop definition for validation
|
|
3
|
+
*/
|
|
4
|
+
export declare interface PropDefinition {
|
|
5
|
+
type: PropType | PropType[]
|
|
6
|
+
required?: boolean
|
|
7
|
+
default?: unknown
|
|
8
|
+
validator?: (value: unknown) => boolean
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Component props schema for validation
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const alertProps: ComponentPropsSchema = {
|
|
16
|
+
* title: { type: 'string', required: true },
|
|
17
|
+
* type: { type: 'string', default: 'info' },
|
|
18
|
+
* dismissible: { type: 'boolean', default: false }
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare interface ComponentPropsSchema {
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Component definition with metadata
|
|
27
|
+
*/
|
|
28
|
+
export declare interface ComponentDefinition {
|
|
29
|
+
name: string
|
|
30
|
+
path?: string
|
|
31
|
+
props?: ComponentPropsSchema
|
|
32
|
+
description?: string
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Component configuration
|
|
36
|
+
*/
|
|
37
|
+
export declare interface ComponentConfig {
|
|
38
|
+
validateProps?: boolean
|
|
39
|
+
components?: Record<string, ComponentDefinition>
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Web component definition
|
|
43
|
+
*/
|
|
44
|
+
export declare interface WebComponent {
|
|
45
|
+
name: string
|
|
46
|
+
tag: string
|
|
47
|
+
file: string
|
|
48
|
+
extends?: string
|
|
49
|
+
shadowDOM?: boolean
|
|
50
|
+
template?: boolean
|
|
51
|
+
styleSource?: string
|
|
52
|
+
attributes?: string[]
|
|
53
|
+
description?: string
|
|
54
|
+
outputFormat?: 'js' | 'ts'
|
|
55
|
+
attributeTypes?: Record<string, 'string' | 'number' | 'boolean' | 'object'>
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Web components configuration
|
|
59
|
+
*/
|
|
60
|
+
export declare interface WebComponentConfig {
|
|
61
|
+
enabled: boolean
|
|
62
|
+
outputDir: string
|
|
63
|
+
components: WebComponent[]
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Component property documentation
|
|
67
|
+
*/
|
|
68
|
+
export declare interface ComponentPropDoc {
|
|
69
|
+
name: string
|
|
70
|
+
type?: string
|
|
71
|
+
required?: boolean
|
|
72
|
+
default?: string
|
|
73
|
+
description?: string
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Component documentation
|
|
77
|
+
*/
|
|
78
|
+
export declare interface ComponentDoc {
|
|
79
|
+
name: string
|
|
80
|
+
path: string
|
|
81
|
+
description?: string
|
|
82
|
+
props: ComponentPropDoc[]
|
|
83
|
+
example?: string
|
|
84
|
+
isWebComponent?: boolean
|
|
85
|
+
tag?: string
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Template documentation
|
|
89
|
+
*/
|
|
90
|
+
export declare interface TemplateDoc {
|
|
91
|
+
name: string
|
|
92
|
+
path: string
|
|
93
|
+
description?: string
|
|
94
|
+
components?: string[]
|
|
95
|
+
directives?: string[]
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Directive documentation
|
|
99
|
+
*/
|
|
100
|
+
export declare interface DirectiveDoc {
|
|
101
|
+
name: string
|
|
102
|
+
description?: string
|
|
103
|
+
hasEndTag: boolean
|
|
104
|
+
example?: string
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Documentation generator configuration
|
|
108
|
+
*/
|
|
109
|
+
export declare interface DocGeneratorConfig {
|
|
110
|
+
enabled: boolean
|
|
111
|
+
outputDir: string
|
|
112
|
+
format: DocFormat
|
|
113
|
+
components: boolean
|
|
114
|
+
templates: boolean
|
|
115
|
+
directives: boolean
|
|
116
|
+
extraContent?: string
|
|
117
|
+
template?: string
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Component System Types
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* Prop type definition for component prop validation
|
|
124
|
+
*/
|
|
125
|
+
export type PropType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'function' | 'any'
|
|
126
|
+
/**
|
|
127
|
+
* Documentation format options
|
|
128
|
+
*/
|
|
129
|
+
export type DocFormat = 'markdown' | 'html' | 'json'
|