@stacksjs/stx 0.2.155 → 0.2.156
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 +87 -46
- package/dist/animation.d.ts +96 -42
- package/dist/appearance-bootstrap.d.ts +49 -15
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +9 -7
- package/dist/async-components.d.ts +78 -56
- package/dist/auth.d.ts +3 -0
- package/dist/build-externalize.d.ts +40 -0
- package/dist/build-externalize.js +63 -0
- package/dist/build-id.d.ts +22 -22
- package/dist/build-message.d.ts +73 -2
- package/dist/build-message.js +47 -8
- package/dist/builtins/attrs.d.ts +14 -0
- package/dist/builtins/drawer.d.ts +22 -0
- package/dist/builtins/icon.d.ts +16 -2
- package/dist/builtins/index.d.ts +5 -15
- package/dist/builtins/modal.d.ts +24 -0
- package/dist/builtins/safe-image.d.ts +42 -0
- package/dist/builtins/stx-image.d.ts +27 -0
- package/dist/builtins/stx-link.d.ts +9 -0
- package/dist/builtins/stx-loading-indicator.d.ts +11 -0
- package/dist/builtins/suspense.d.ts +28 -0
- package/dist/builtins/toast.d.ts +17 -0
- package/dist/builtins/transition-group.d.ts +25 -0
- package/dist/caching.d.ts +12 -15
- package/dist/cli.js +1798 -908
- package/dist/client/directive.d.ts +7 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client-script-bundler.d.ts +63 -5
- package/dist/client-script-bundler.js +30 -2
- package/dist/client-script.d.ts +102 -47
- package/dist/client-script.js +15 -3
- package/dist/codemod.d.ts +56 -0
- package/dist/codemod.js +192 -0
- package/dist/color-mode-boot.d.ts +83 -65
- package/dist/component-client-factories.d.ts +1 -6
- package/dist/component-processing.d.ts +58 -49
- package/dist/component-processing.js +1 -1
- package/dist/component-registry.d.ts +94 -31
- package/dist/component-renderer.d.ts +18 -0
- package/dist/composable-loader.d.ts +24 -0
- package/dist/composable-loader.js +12 -9
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.js +30 -2
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables.d.ts +64 -60
- package/dist/computed.d.ts +86 -92
- package/dist/conditionals.d.ts +24 -8
- package/dist/conditionals.js +16 -0
- package/dist/config.d.ts +34 -21
- package/dist/config.js +35 -14
- package/dist/craft.js +1476 -768
- package/dist/crosswind-config.d.ts +58 -0
- package/dist/crosswind-config.js +40 -0
- package/dist/csp.d.ts +107 -41
- package/dist/defer.d.ts +24 -0
- package/dist/dev-server/crosswind.d.ts +35 -26
- package/dist/dev-server/crosswind.js +2 -18
- package/dist/dev-server/serve-app.js +4 -3
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/directive-api.d.ts +86 -43
- package/dist/document-shell.d.ts +54 -41
- package/dist/dynamic-components.d.ts +9 -0
- package/dist/error-boundaries.d.ts +47 -41
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +51 -43
- package/dist/errors/formatter.d.ts +58 -38
- package/dist/errors/index.d.ts +5 -61
- package/dist/errors/logger.d.ts +114 -40
- package/dist/errors/sanitizer.d.ts +53 -23
- package/dist/errors/types.d.ts +44 -31
- package/dist/events.d.ts +86 -25
- package/dist/expressions.d.ts +50 -42
- package/dist/forms-validation.d.ts +138 -123
- package/dist/forms-validation.js +1 -90
- package/dist/forms.d.ts +120 -66
- package/dist/forms.js +31 -11
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +109 -0
- package/dist/framework-composables.d.ts +32 -0
- package/dist/head.d.ts +156 -114
- package/dist/heatmap.d.ts +152 -72
- package/dist/html-masking.d.ts +40 -34
- package/dist/hydration-runtime.d.ts +20 -24
- package/dist/i18n.d.ts +93 -32
- package/dist/image-optimization/auto-sibling.d.ts +32 -4
- package/dist/includes.d.ts +69 -7
- package/dist/index.d.ts +66 -0
- package/dist/index.js +23 -0
- package/dist/internal-markdown.d.ts +12 -8
- package/dist/island-chunking.d.ts +30 -13
- package/dist/keep-alive.d.ts +72 -52
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-module.d.ts +10 -0
- package/dist/loops.d.ts +66 -0
- package/dist/loops.js +47 -6
- package/dist/markdown.d.ts +0 -1
- package/dist/media/image/component.d.ts +25 -9
- package/dist/media/image/directive.d.ts +15 -1
- package/dist/media/image/placeholder.d.ts +20 -9
- package/dist/media/image/processor/cache.d.ts +40 -18
- package/dist/media/image/processor/index.d.ts +1 -10
- package/dist/media/image/processor/optimizer.d.ts +12 -1
- package/dist/media/image/processor/responsive.d.ts +16 -6
- package/dist/media/image/srcset.d.ts +47 -50
- package/dist/media/shared/cache.d.ts +51 -31
- package/dist/media/shared/hash.d.ts +7 -0
- package/dist/media/types.d.ts +1235 -754
- package/dist/media/video/directive.d.ts +15 -1
- package/dist/media/video/index.d.ts +39 -17
- package/dist/media/video/processor/cache.d.ts +42 -19
- package/dist/media/video/processor/index.d.ts +1 -18
- package/dist/media/video/processor/streaming.d.ts +17 -10
- package/dist/media/video/processor/thumbnail.d.ts +21 -15
- package/dist/media/video/processor/transcoder.d.ts +11 -1
- package/dist/method-spoofing.d.ts +7 -0
- package/dist/middleware.d.ts +60 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/parser/directive-parser.d.ts +57 -45
- package/dist/parser/expression-parser.d.ts +33 -35
- package/dist/parser/index.d.ts +4 -39
- package/dist/parser/tokenizer.d.ts +61 -49
- package/dist/partial-hydration.d.ts +82 -50
- package/dist/performance-utils.d.ts +217 -124
- package/dist/placeholder.d.ts +18 -9
- package/dist/plugin-system.d.ts +264 -115
- package/dist/process.d.ts +11 -6
- package/dist/process.js +21 -4
- package/dist/production-builder.js +7 -0
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +14 -0
- package/dist/pwa/directives.d.ts +12 -3
- package/dist/pwa/inject.d.ts +10 -0
- package/dist/pwa/precache.d.ts +22 -16
- package/dist/pwa/service-worker.d.ts +12 -0
- package/dist/pwa.js +1318 -610
- package/dist/reactive-bindings.d.ts +34 -11
- package/dist/reactive.d.ts +58 -30
- package/dist/reactive.js +56 -31
- package/dist/render.js +1 -0
- package/dist/route-middleware.d.ts +2 -35
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +5 -7
- package/dist/routes.d.ts +1 -3
- package/dist/runtime-globals.d.ts +147 -24
- package/dist/runtime-globals.js +16 -1
- package/dist/runtime-injection.d.ts +8 -0
- package/dist/runtime-injection.js +33 -24
- package/dist/script-emit.d.ts +30 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +21 -4
- package/dist/seo.d.ts +118 -47
- package/dist/server-bindings.d.ts +21 -0
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +35 -15
- package/dist/signals-api.d.ts +117 -58
- package/dist/signals-api.js +7 -4
- package/dist/signals.d.ts +24 -17
- package/dist/signals.js +765 -60
- package/dist/site-builder/build.js +8 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +86 -20
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/ssg.d.ts +285 -142
- package/dist/ssg.js +1268 -556
- package/dist/state-dir.d.ts +4 -4
- package/dist/state-management.d.ts +0 -12
- package/dist/state-management.js +8 -25
- package/dist/store-imports.d.ts +23 -0
- package/dist/store-imports.js +3 -0
- package/dist/store-loader.d.ts +10 -0
- package/dist/store-loader.js +10 -9
- package/dist/story/analytics.d.ts +138 -60
- package/dist/story/bookmarks.d.ts +87 -34
- package/dist/story/cli.d.ts +123 -69
- package/dist/story/collect/scanner.d.ts +4 -0
- package/dist/story/collect/tree.d.ts +8 -1
- package/dist/story/commands/build.d.ts +11 -6
- package/dist/story/commands/dev.d.ts +15 -8
- package/dist/story/commands/preview.d.ts +13 -7
- package/dist/story/config-watcher.d.ts +20 -13
- package/dist/story/config.d.ts +11 -8
- package/dist/story/context.d.ts +14 -8
- package/dist/story/hmr.d.ts +24 -26
- package/dist/story/hot-swap.d.ts +34 -23
- package/dist/story/keyboard-shortcuts.d.ts +23 -18
- package/dist/story/output.d.ts +46 -44
- package/dist/story/performance.d.ts +107 -45
- package/dist/story/presets.d.ts +107 -41
- package/dist/story/renderer.d.ts +41 -27
- package/dist/story/search.d.ts +23 -12
- package/dist/story/server.d.ts +21 -11
- package/dist/story/setup.d.ts +23 -15
- package/dist/story/testing.d.ts +65 -40
- package/dist/story/types.d.ts +262 -160
- package/dist/streaming.d.ts +119 -57
- package/dist/stx-virtual-ts.d.ts +165 -0
- package/dist/stx-virtual-ts.js +372 -0
- package/dist/stx.d.ts +78 -1
- package/dist/style-scoping.d.ts +17 -4
- package/dist/suspense.d.ts +67 -52
- package/dist/teleport.d.ts +22 -0
- package/dist/template-tag-balance.d.ts +22 -6
- package/dist/transitions.d.ts +66 -55
- package/dist/typecheck.d.ts +77 -0
- package/dist/typecheck.js +156 -0
- package/dist/types/component-types.d.ts +187 -122
- package/dist/types/config-types.d.ts +758 -297
- package/dist/types/context-types.d.ts +46 -24
- package/dist/types/csp-types.d.ts +70 -66
- package/dist/types/directive-types.d.ts +211 -155
- package/dist/types/index.d.ts +6 -109
- package/dist/types/pwa-types.d.ts +273 -148
- package/dist/types.d.ts +0 -1
- package/dist/typescript-templates.d.ts +11 -0
- package/dist/unresolved-identifiers.d.ts +24 -22
- package/dist/unresolved-identifiers.js +2 -0
- package/dist/utils.d.ts +24 -21
- package/dist/validator.d.ts +28 -26
- package/dist/variable-extractor.d.ts +48 -13
- package/dist/variable-extractor.js +27 -4
- package/dist/view-composers.d.ts +80 -81
- package/dist/virtual-scrolling.d.ts +101 -81
- package/dist/vue-template.d.ts +23 -0
- package/dist/web-components/css-scoping.d.ts +21 -11
- package/dist/web-components.d.ts +81 -58
- package/dist/x-element.d.ts +0 -1
- package/package.json +5 -5
- package/stx.d.ts +78 -1
package/dist/a11y.d.ts
CHANGED
|
@@ -1,4 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility (A11y) Module
|
|
3
|
+
*
|
|
4
|
+
* Provides directives and utilities for accessibility compliance:
|
|
5
|
+
* - `@a11y('type', 'message')` - Add accessibility hints as HTML comments
|
|
6
|
+
* - `@screenReader(...)@endScreenReader` - Screen reader only content
|
|
7
|
+
* - `@ariaDescribe('id', 'description')` - Connect elements with descriptions
|
|
8
|
+
*
|
|
9
|
+
* Also provides automated accessibility checking via `checkA11y()` and
|
|
10
|
+
* directory scanning via `scanA11yIssues()`.
|
|
11
|
+
*
|
|
12
|
+
* ## Accessibility Checks
|
|
13
|
+
*
|
|
14
|
+
* The automated checker validates:
|
|
15
|
+
* - Images have alt attributes
|
|
16
|
+
* - Interactive elements have accessible names
|
|
17
|
+
* - Form inputs have associated labels
|
|
18
|
+
* - Heading hierarchy is maintained
|
|
19
|
+
* - Document has lang attribute
|
|
20
|
+
*/
|
|
1
21
|
import type { CustomDirective, StxOptions } from './types';
|
|
22
|
+
/**
|
|
23
|
+
* Accessibility violation found during a11y checks
|
|
24
|
+
*/
|
|
25
|
+
export interface A11yViolation {
|
|
26
|
+
/** Type/category of violation */
|
|
27
|
+
type: string;
|
|
28
|
+
/** The problematic HTML element */
|
|
29
|
+
element: string;
|
|
30
|
+
/** Description of the issue */
|
|
31
|
+
message: string;
|
|
32
|
+
/** Impact level of the violation */
|
|
33
|
+
impact: 'critical' | 'serious' | 'moderate' | 'minor';
|
|
34
|
+
/** Suggested fix */
|
|
35
|
+
help: string;
|
|
36
|
+
/** URL to more information */
|
|
37
|
+
helpUrl?: string;
|
|
38
|
+
}
|
|
2
39
|
/**
|
|
3
40
|
* Process accessibility directives.
|
|
4
41
|
* Handles @a11y hints, @screenReader content, and @ariaDescribe.
|
|
@@ -48,7 +85,49 @@ export declare function checkA11y(html: string, filePath: string): Promise<A11yV
|
|
|
48
85
|
* Scan a directory of stx files for accessibility issues.
|
|
49
86
|
* Returns a map of file paths to their violations.
|
|
50
87
|
*/
|
|
51
|
-
export declare function scanA11yIssues(directory: string, options?: {
|
|
88
|
+
export declare function scanA11yIssues(directory: string, options?: {
|
|
89
|
+
recursive?: boolean;
|
|
90
|
+
ignorePaths?: string[];
|
|
91
|
+
}): Promise<Record<string, A11yViolation[]>>;
|
|
92
|
+
/**
|
|
93
|
+
* Auto-fix result
|
|
94
|
+
*/
|
|
95
|
+
export interface A11yFixResult {
|
|
96
|
+
/** Original HTML */
|
|
97
|
+
original: string;
|
|
98
|
+
/** Fixed HTML */
|
|
99
|
+
fixed: string;
|
|
100
|
+
/** Number of fixes applied */
|
|
101
|
+
fixCount: number;
|
|
102
|
+
/** Details of each fix */
|
|
103
|
+
fixes: Array<{
|
|
104
|
+
type: string;
|
|
105
|
+
description: string;
|
|
106
|
+
before: string;
|
|
107
|
+
after: string;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Auto-fix configuration
|
|
112
|
+
*/
|
|
113
|
+
export interface A11yAutoFixConfig {
|
|
114
|
+
/** Fix images without alt text by adding empty alt="" */
|
|
115
|
+
fixMissingAlt?: boolean;
|
|
116
|
+
/** Fix buttons/links without accessible names by adding aria-label */
|
|
117
|
+
fixMissingLabels?: boolean;
|
|
118
|
+
/** Fix form inputs without labels by adding aria-label */
|
|
119
|
+
fixMissingFormLabels?: boolean;
|
|
120
|
+
/** Fix tables without headers by adding scope attribute */
|
|
121
|
+
fixTableHeaders?: boolean;
|
|
122
|
+
/** Add lang attribute to html element */
|
|
123
|
+
fixMissingLang?: boolean;
|
|
124
|
+
/** Fix positive tabindex values */
|
|
125
|
+
fixPositiveTabindex?: boolean;
|
|
126
|
+
/** Fix custom buttons without tabindex */
|
|
127
|
+
fixButtonFocusable?: boolean;
|
|
128
|
+
/** Default language for lang attribute */
|
|
129
|
+
defaultLang?: string;
|
|
130
|
+
}
|
|
52
131
|
/**
|
|
53
132
|
* Auto-fix accessibility issues in HTML content.
|
|
54
133
|
*
|
|
@@ -88,15 +167,11 @@ export declare function autoFixA11yFile(filePath: string, config?: A11yAutoFixCo
|
|
|
88
167
|
* @returns Map of file paths to fix results
|
|
89
168
|
*/
|
|
90
169
|
export declare function autoFixA11yDirectory(directory: string, config?: A11yAutoFixConfig, options?: {
|
|
91
|
-
recursive?: boolean
|
|
92
|
-
ignorePaths?: string[]
|
|
93
|
-
writeBack?: boolean
|
|
94
|
-
extensions?: string[]
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Register all a11y directives
|
|
98
|
-
*/
|
|
99
|
-
export declare function registerA11yDirectives(): CustomDirective[];
|
|
170
|
+
recursive?: boolean;
|
|
171
|
+
ignorePaths?: string[];
|
|
172
|
+
writeBack?: boolean;
|
|
173
|
+
extensions?: string[];
|
|
174
|
+
}): Promise<Record<string, A11yFixResult>>;
|
|
100
175
|
/**
|
|
101
176
|
* A11y directive for adding accessibility hints
|
|
102
177
|
*/
|
|
@@ -106,40 +181,6 @@ export declare const a11yDirective: CustomDirective;
|
|
|
106
181
|
*/
|
|
107
182
|
export declare const screenReaderDirective: CustomDirective;
|
|
108
183
|
/**
|
|
109
|
-
*
|
|
110
|
-
*/
|
|
111
|
-
export declare interface A11yViolation {
|
|
112
|
-
type: string
|
|
113
|
-
element: string
|
|
114
|
-
message: string
|
|
115
|
-
impact: 'critical' | 'serious' | 'moderate' | 'minor'
|
|
116
|
-
help: string
|
|
117
|
-
helpUrl?: string
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Auto-fix result
|
|
121
|
-
*/
|
|
122
|
-
export declare interface A11yFixResult {
|
|
123
|
-
original: string
|
|
124
|
-
fixed: string
|
|
125
|
-
fixCount: number
|
|
126
|
-
fixes: Array<{
|
|
127
|
-
type: string
|
|
128
|
-
description: string
|
|
129
|
-
before: string
|
|
130
|
-
after: string
|
|
131
|
-
}>
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Auto-fix configuration
|
|
184
|
+
* Register all a11y directives
|
|
135
185
|
*/
|
|
136
|
-
export declare
|
|
137
|
-
fixMissingAlt?: boolean
|
|
138
|
-
fixMissingLabels?: boolean
|
|
139
|
-
fixMissingFormLabels?: boolean
|
|
140
|
-
fixTableHeaders?: boolean
|
|
141
|
-
fixMissingLang?: boolean
|
|
142
|
-
fixPositiveTabindex?: boolean
|
|
143
|
-
fixButtonFocusable?: boolean
|
|
144
|
-
defaultLang?: string
|
|
145
|
-
}
|
|
186
|
+
export declare function registerA11yDirectives(): CustomDirective[];
|
package/dist/animation.d.ts
CHANGED
|
@@ -1,34 +1,97 @@
|
|
|
1
1
|
import type { CustomDirective, StxOptions } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Available transition types that can be used with @transition directive
|
|
4
4
|
*/
|
|
5
|
-
export declare
|
|
5
|
+
export declare enum TransitionType {
|
|
6
|
+
Fade = "fade",
|
|
7
|
+
Slide = "slide",
|
|
8
|
+
Scale = "scale",
|
|
9
|
+
Flip = "flip",
|
|
10
|
+
Rotate = "rotate",
|
|
11
|
+
Custom = "custom"
|
|
12
|
+
}
|
|
6
13
|
/**
|
|
7
|
-
*
|
|
14
|
+
* Available transition directions that can be used with @transition directive
|
|
8
15
|
*/
|
|
9
|
-
export declare
|
|
16
|
+
export declare enum TransitionDirection {
|
|
17
|
+
In = "in",
|
|
18
|
+
Out = "out",
|
|
19
|
+
Both = "both"
|
|
20
|
+
}
|
|
10
21
|
/**
|
|
11
|
-
*
|
|
12
|
-
* Format: "duration [delay] [easing] [iterations] [direction] [fill]"
|
|
22
|
+
* Available ease functions for transitions
|
|
13
23
|
*/
|
|
14
|
-
export declare
|
|
24
|
+
export declare enum TransitionEase {
|
|
25
|
+
Linear = "linear",
|
|
26
|
+
Ease = "ease",
|
|
27
|
+
EaseIn = "ease-in",
|
|
28
|
+
EaseOut = "ease-out",
|
|
29
|
+
EaseInOut = "ease-in-out",
|
|
30
|
+
Spring = "spring"
|
|
31
|
+
}
|
|
15
32
|
/**
|
|
16
|
-
*
|
|
33
|
+
* Default transition options
|
|
17
34
|
*/
|
|
18
|
-
export declare
|
|
35
|
+
export declare const DEFAULT_TRANSITION_OPTIONS: {
|
|
36
|
+
duration: number;
|
|
37
|
+
delay: number;
|
|
38
|
+
ease: string;
|
|
39
|
+
direction: string;
|
|
40
|
+
};
|
|
19
41
|
/**
|
|
20
|
-
*
|
|
42
|
+
* Transition directive for applying transitions to elements
|
|
21
43
|
*/
|
|
22
|
-
export declare
|
|
44
|
+
export declare const transitionDirective: CustomDirective;
|
|
23
45
|
/**
|
|
24
|
-
*
|
|
46
|
+
* Scroll animation directive for triggering animations on scroll
|
|
25
47
|
*/
|
|
26
|
-
export declare const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
48
|
+
export declare const scrollAnimateDirective: CustomDirective;
|
|
49
|
+
/**
|
|
50
|
+
* Animation group directive for coordinating multiple animations
|
|
51
|
+
*/
|
|
52
|
+
export declare const animationGroupDirective: CustomDirective;
|
|
53
|
+
/**
|
|
54
|
+
* Motion preferences directive for controlling animation preferences
|
|
55
|
+
*/
|
|
56
|
+
export declare const motionDirective: CustomDirective;
|
|
57
|
+
/**
|
|
58
|
+
* Process animation directives in the template
|
|
59
|
+
*/
|
|
60
|
+
export declare function processAnimationDirectives(template: string, context: Record<string, any>, filePath: string, options: StxOptions): string;
|
|
61
|
+
/** Keyframe definition */
|
|
62
|
+
export interface Keyframe {
|
|
63
|
+
offset?: number;
|
|
64
|
+
properties: Record<string, string | number>;
|
|
65
|
+
easing?: string;
|
|
66
|
+
}
|
|
67
|
+
/** Animation timeline entry */
|
|
68
|
+
export interface TimelineEntry {
|
|
69
|
+
selector: string;
|
|
70
|
+
keyframes: Keyframe[];
|
|
71
|
+
options: KeyframeAnimationOptions;
|
|
72
|
+
}
|
|
73
|
+
/** Keyframe animation options */
|
|
74
|
+
export interface KeyframeAnimationOptions {
|
|
75
|
+
duration: number;
|
|
76
|
+
delay?: number;
|
|
77
|
+
easing?: string;
|
|
78
|
+
iterations?: number | 'infinite';
|
|
79
|
+
direction?: 'normal' | 'reverse' | 'alternate' | 'alternate-reverse';
|
|
80
|
+
fill?: 'none' | 'forwards' | 'backwards' | 'both';
|
|
81
|
+
}
|
|
82
|
+
/** Spring animation config */
|
|
83
|
+
export interface SpringConfig {
|
|
84
|
+
stiffness: number;
|
|
85
|
+
damping: number;
|
|
86
|
+
mass: number;
|
|
87
|
+
velocity?: number;
|
|
88
|
+
}
|
|
89
|
+
/** Preset spring configurations */
|
|
90
|
+
export declare const SPRING_PRESETS: Record<string, SpringConfig>;
|
|
91
|
+
/**
|
|
92
|
+
* @keyframe directive for custom keyframe animations
|
|
93
|
+
*/
|
|
94
|
+
export declare const keyframeDirective: CustomDirective;
|
|
32
95
|
/**
|
|
33
96
|
* @stagger directive for staggered child animations
|
|
34
97
|
*/
|
|
@@ -38,32 +101,23 @@ export declare const staggerDirective: CustomDirective;
|
|
|
38
101
|
*/
|
|
39
102
|
export declare const springDirective: CustomDirective;
|
|
40
103
|
/**
|
|
41
|
-
*
|
|
104
|
+
* Create an animation timeline for coordinated animations
|
|
42
105
|
*/
|
|
43
|
-
export declare
|
|
44
|
-
Fade = 'fade',
|
|
45
|
-
Slide = 'slide',
|
|
46
|
-
Scale = 'scale',
|
|
47
|
-
Flip = 'flip',
|
|
48
|
-
Rotate = 'rotate',
|
|
49
|
-
Custom = 'custom',
|
|
50
|
-
}
|
|
106
|
+
export declare function createAnimationTimeline(entries: TimelineEntry[]): string;
|
|
51
107
|
/**
|
|
52
|
-
*
|
|
108
|
+
* Generate CSS for a custom animation
|
|
53
109
|
*/
|
|
54
|
-
export declare
|
|
55
|
-
In = 'in',
|
|
56
|
-
Out = 'out',
|
|
57
|
-
Both = 'both',
|
|
58
|
-
}
|
|
110
|
+
export declare function generateAnimationCSS(name: string, keyframes: Keyframe[], options: KeyframeAnimationOptions): string;
|
|
59
111
|
/**
|
|
60
|
-
*
|
|
112
|
+
* Parse animation shorthand string
|
|
113
|
+
* Format: "duration [delay] [easing] [iterations] [direction] [fill]"
|
|
61
114
|
*/
|
|
62
|
-
export declare
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
115
|
+
export declare function parseAnimationShorthand(shorthand: string): KeyframeAnimationOptions;
|
|
116
|
+
/**
|
|
117
|
+
* Generate client-side animation runtime
|
|
118
|
+
*/
|
|
119
|
+
export declare function generateAnimationRuntime(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Register animation directives
|
|
122
|
+
*/
|
|
123
|
+
export declare function registerAnimationDirectives(options: StxOptions): StxOptions;
|
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Declarative pre-paint appearance bootstrapping.
|
|
3
|
+
*
|
|
4
|
+
* Client composables apply appearance reactively after mount, but that is too
|
|
5
|
+
* late for the first paint. This directive emits a compiler-owned synchronous
|
|
6
|
+
* script at the directive location so persisted root attributes and the dark
|
|
7
|
+
* class are present before the browser parses the application shell.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```stx
|
|
11
|
+
* @appearanceBootstrap({
|
|
12
|
+
* storageKey: 'app-appearance',
|
|
13
|
+
* appearance: {
|
|
14
|
+
* key: 'sidebarStyle',
|
|
15
|
+
* attribute: 'appearance',
|
|
16
|
+
* allowed: ['macos', 'arc'],
|
|
17
|
+
* default: 'macos',
|
|
18
|
+
* },
|
|
19
|
+
* colorMode: {
|
|
20
|
+
* key: 'colorMode',
|
|
21
|
+
* attribute: 'color-mode',
|
|
22
|
+
* default: 'system',
|
|
23
|
+
* },
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
3
26
|
*/
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
27
|
+
export interface AppearanceBootstrapValue {
|
|
28
|
+
/** Property read from the persisted JSON object. */
|
|
29
|
+
key: string;
|
|
30
|
+
/** Root data attribute name without the `data-` prefix. */
|
|
31
|
+
attribute: string;
|
|
32
|
+
/** Persisted values accepted by the bootstrap. */
|
|
33
|
+
allowed: string[];
|
|
34
|
+
/** Value used when storage is absent, malformed, or outside the allowlist. */
|
|
35
|
+
default: string;
|
|
10
36
|
}
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
37
|
+
export interface ColorModeBootstrapValue {
|
|
38
|
+
/** Property read from the persisted JSON object. */
|
|
39
|
+
key: string;
|
|
40
|
+
/** Root data attribute name without the `data-` prefix. */
|
|
41
|
+
attribute: string;
|
|
42
|
+
/** Mode used when storage is absent or malformed. */
|
|
43
|
+
default: 'light' | 'dark' | 'system';
|
|
15
44
|
}
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
45
|
+
export interface AppearanceBootstrapOptions {
|
|
46
|
+
/** localStorage key containing the persisted JSON preference object. */
|
|
47
|
+
storageKey: string;
|
|
48
|
+
appearance: AppearanceBootstrapValue;
|
|
49
|
+
colorMode: ColorModeBootstrapValue;
|
|
20
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Transform every `@appearanceBootstrap({...})` directive in a template.
|
|
53
|
+
*/
|
|
54
|
+
export declare function processAppearanceBootstrapDirective(template: string, context: Record<string, unknown>): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conventional asset root, shared by the serve path and every build path.
|
|
3
|
+
*
|
|
4
|
+
* `serve()` resolves `/assets/*` from `resources/assets/*` as well as from
|
|
5
|
+
* `publicDir` — the Stacks/Laravel-style layout that `buddy make:*` produces.
|
|
6
|
+
* No build path had ever heard of it: they copy `publicDir` and nothing else.
|
|
7
|
+
*
|
|
8
|
+
* So `<script src="/assets/scripts/site-mode.js">` resolved under `stx dev` and
|
|
9
|
+
* 404'd in `dist/`, with nothing in the build reporting it. The only way to
|
|
10
|
+
* notice was to diff the build output against the served tree
|
|
11
|
+
* (stacksjs/stx#1876).
|
|
12
|
+
*
|
|
13
|
+
* It lives here rather than in one of the three builders because there are
|
|
14
|
+
* three of them — ssg.ts, site-builder/build.ts and production-builder.ts —
|
|
15
|
+
* each with its own copy mechanism, and a convention restated three times is
|
|
16
|
+
* one that will be fixed in one place and left behind in the others.
|
|
17
|
+
*
|
|
18
|
+
* @module asset-roots
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Directory whose contents are served at `/assets/*`, in addition to
|
|
22
|
+
* `publicDir`. Relative to the project root, and deliberately not a config
|
|
23
|
+
* option — it mirrors what `serve()` hardcodes.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CONVENTIONAL_ASSET_ROOT = "resources/assets";
|
|
26
|
+
/** Where its contents must land so `/assets/*` resolves in built output. */
|
|
27
|
+
export declare const CONVENTIONAL_ASSET_OUTPUT = "assets";
|
|
28
|
+
/**
|
|
29
|
+
* Absolute path to the conventional asset root, or `null` when the project
|
|
30
|
+
* does not use that layout.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveConventionalAssetRoot(root?: string): string | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
export const CONVENTIONAL_ASSET_ROOT = "resources/assets", CONVENTIONAL_ASSET_OUTPUT = "assets";
|
|
4
|
+
export function resolveConventionalAssetRoot(root = process.cwd()) {
|
|
5
|
+
const dir = path.resolve(root, CONVENTIONAL_ASSET_ROOT);
|
|
6
|
+
return fs.existsSync(dir) && fs.statSync(dir).isDirectory() ? dir : null;
|
|
7
|
+
}
|
package/dist/assets.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type { StxOptions } from './types';
|
|
2
|
+
export declare const markdownCache: Map<string, {
|
|
3
|
+
content: string;
|
|
4
|
+
data: Record<string, any>;
|
|
5
|
+
updatedAt: number;
|
|
6
|
+
}>;
|
|
2
7
|
/**
|
|
3
8
|
* Read and parse a markdown file with frontmatter
|
|
4
9
|
* @param filePath Path to the markdown file
|
|
5
10
|
* @param options stx options
|
|
6
11
|
* @returns Object containing parsed content and frontmatter data
|
|
7
12
|
*/
|
|
8
|
-
export declare function readMarkdownFile(filePath: string, options?: StxOptions): Promise<{
|
|
13
|
+
export declare function readMarkdownFile(filePath: string, options?: StxOptions): Promise<{
|
|
14
|
+
content: string;
|
|
15
|
+
data: Record<string, any>;
|
|
16
|
+
}>;
|
|
9
17
|
/**
|
|
10
18
|
* Process @markdown-file directive
|
|
11
19
|
* This directive includes markdown files in templates
|
|
12
20
|
*/
|
|
13
21
|
export declare function processMarkdownFileDirectives(template: string, context: Record<string, any>, filePath?: string, options?: StxOptions): Promise<string>;
|
|
14
|
-
// Define a cache for markdown files to avoid repeated file reads
|
|
15
|
-
export declare const markdownCache: Map<string, {
|
|
16
|
-
content: string
|
|
17
|
-
data: Record<string, any>
|
|
18
|
-
updatedAt: number
|
|
19
|
-
}>;
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Process @async directives in templates.
|
|
3
|
-
*
|
|
4
|
-
* Syntax:
|
|
5
|
-
* @async(component: 'ComponentName', timeout: 5000)
|
|
6
|
-
* <loading content>
|
|
7
|
-
* @error
|
|
8
|
-
* <error content>
|
|
9
|
-
* @endasync
|
|
10
|
-
*/
|
|
11
|
-
export declare function processAsyncDirectives(template: string, _context?: Record<string, unknown>, _filePath?: string): string;
|
|
12
|
-
/**
|
|
13
|
-
* Define an async component.
|
|
14
|
-
*/
|
|
15
|
-
export declare function defineAsyncComponent(options: DefineAsyncComponentOptions | (() => Promise<{ default: string } | string>)): AsyncComponentDefinition;
|
|
16
|
-
/**
|
|
17
|
-
* Check if a value is an async component definition.
|
|
18
|
-
*/
|
|
19
|
-
export declare function isAsyncComponent(value: unknown): value is AsyncComponentDefinition;
|
|
20
|
-
/**
|
|
21
|
-
* Generate CSS for async component styling.
|
|
22
|
-
*/
|
|
23
|
-
export declare function generateAsyncComponentCSS(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Generate client-side runtime for async components.
|
|
26
|
-
*/
|
|
27
|
-
export declare function generateAsyncComponentRuntime(): string;
|
|
28
1
|
/**
|
|
29
2
|
* STX Async Components
|
|
30
3
|
*
|
|
@@ -52,25 +25,45 @@ export declare function generateAsyncComponentRuntime(): string;
|
|
|
52
25
|
* </AsyncComponent>
|
|
53
26
|
* ```
|
|
54
27
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
28
|
+
export interface AsyncComponentOptions {
|
|
29
|
+
/** Component path or name to load */
|
|
30
|
+
component: string;
|
|
31
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
32
|
+
timeout?: number;
|
|
33
|
+
/** Delay before showing loading state in ms (default: 200) */
|
|
34
|
+
delay?: number;
|
|
35
|
+
/** Whether to suspend parent Suspense boundary */
|
|
36
|
+
suspensible?: boolean;
|
|
37
|
+
/** Custom loading component */
|
|
38
|
+
loadingComponent?: string;
|
|
39
|
+
/** Custom error component */
|
|
40
|
+
errorComponent?: string;
|
|
41
|
+
/** Retry attempts on failure (default: 0) */
|
|
42
|
+
retries?: number;
|
|
43
|
+
/** Props to pass to the loaded component */
|
|
44
|
+
props?: Record<string, unknown>;
|
|
67
45
|
}
|
|
68
|
-
export
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
export interface AsyncComponentState {
|
|
47
|
+
/** Current loading state */
|
|
48
|
+
status: 'pending' | 'loading' | 'resolved' | 'rejected';
|
|
49
|
+
/** The loaded component content */
|
|
50
|
+
component: string | null;
|
|
51
|
+
/** Error if loading failed */
|
|
52
|
+
error: Error | null;
|
|
53
|
+
/** Number of retry attempts made */
|
|
54
|
+
attempts: number;
|
|
73
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Process @async directives in templates.
|
|
58
|
+
*
|
|
59
|
+
* Syntax:
|
|
60
|
+
* @async(component: 'ComponentName', timeout: 5000)
|
|
61
|
+
* <loading content>
|
|
62
|
+
* @error
|
|
63
|
+
* <error content>
|
|
64
|
+
* @endasync
|
|
65
|
+
*/
|
|
66
|
+
export declare function processAsyncDirectives(template: string, _context?: Record<string, unknown>, _filePath?: string): string;
|
|
74
67
|
/**
|
|
75
68
|
* Define an async component for programmatic use.
|
|
76
69
|
*
|
|
@@ -85,17 +78,46 @@ export declare interface AsyncComponentState {
|
|
|
85
78
|
* })
|
|
86
79
|
* ```
|
|
87
80
|
*/
|
|
88
|
-
export
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
81
|
+
export interface DefineAsyncComponentOptions {
|
|
82
|
+
/** Function that returns a Promise resolving to the component */
|
|
83
|
+
loader: () => Promise<{
|
|
84
|
+
default: string;
|
|
85
|
+
} | string>;
|
|
86
|
+
/** Component to show while loading */
|
|
87
|
+
loadingComponent?: string;
|
|
88
|
+
/** Component to show on error */
|
|
89
|
+
errorComponent?: string;
|
|
90
|
+
/** Delay before showing loading component (ms) */
|
|
91
|
+
delay?: number;
|
|
92
|
+
/** Timeout before showing error (ms) */
|
|
93
|
+
timeout?: number;
|
|
94
|
+
/** Whether to suspend parent Suspense */
|
|
95
|
+
suspensible?: boolean;
|
|
96
|
+
/** Called when loading starts */
|
|
97
|
+
onLoadStart?: () => void;
|
|
98
|
+
/** Called when component is loaded */
|
|
99
|
+
onLoadEnd?: () => void;
|
|
100
|
+
/** Called on error */
|
|
101
|
+
onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => void;
|
|
98
102
|
}
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Define an async component.
|
|
105
|
+
*/
|
|
106
|
+
export declare function defineAsyncComponent(options: DefineAsyncComponentOptions | (() => Promise<{
|
|
107
|
+
default: string;
|
|
108
|
+
} | string>)): AsyncComponentDefinition;
|
|
109
|
+
export interface AsyncComponentDefinition extends DefineAsyncComponentOptions {
|
|
110
|
+
__asyncComponent: true;
|
|
101
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Check if a value is an async component definition.
|
|
114
|
+
*/
|
|
115
|
+
export declare function isAsyncComponent(value: unknown): value is AsyncComponentDefinition;
|
|
116
|
+
/**
|
|
117
|
+
* Generate CSS for async component styling.
|
|
118
|
+
*/
|
|
119
|
+
export declare function generateAsyncComponentCSS(): string;
|
|
120
|
+
/**
|
|
121
|
+
* Generate client-side runtime for async components.
|
|
122
|
+
*/
|
|
123
|
+
export declare function generateAsyncComponentRuntime(): string;
|
package/dist/auth.d.ts
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lift shared inline blobs out of built HTML into content-hashed assets.
|
|
3
|
+
*
|
|
4
|
+
* The static build inlines the whole signals runtime and the whole generated
|
|
5
|
+
* stylesheet into every page. On a 35-page site that is ~118KB of
|
|
6
|
+
* byte-identical runtime per page and a separate copy of the reset in each one,
|
|
7
|
+
* none of it cacheable across a navigation, and `find dist -name '*.js'`
|
|
8
|
+
* returns nothing at all (stacksjs/stx#1865, #1878).
|
|
9
|
+
*
|
|
10
|
+
* Done as a post-pass over the emitted HTML rather than by threading
|
|
11
|
+
* `buildMode` through the renderer, deliberately. The existing `compile` branch
|
|
12
|
+
* emits `/__stx/runtime.__STX_HASH__.js`, a placeholder only the production
|
|
13
|
+
* builder knows how to rewrite, and setting that mode also suppresses the
|
|
14
|
+
* document shell — so reusing it on the SSG path produces pages that reference
|
|
15
|
+
* a 404 and lose their `<html>` wrapper. A post-pass needs neither.
|
|
16
|
+
*
|
|
17
|
+
* Content-addressed, so identical blobs across pages collapse to one file: the
|
|
18
|
+
* runtime is byte-identical everywhere and becomes a single asset, while
|
|
19
|
+
* per-page CSS dedupes only where pages genuinely share a stylesheet.
|
|
20
|
+
*
|
|
21
|
+
* @module build-externalize
|
|
22
|
+
*/
|
|
23
|
+
/** Where externalized assets are written, relative to the output directory. */
|
|
24
|
+
export declare const EXTERNALIZED_ASSET_DIR = "_stx";
|
|
25
|
+
export interface ExternalizeResult {
|
|
26
|
+
/** HTML files rewritten. */
|
|
27
|
+
pages: number;
|
|
28
|
+
/** Distinct asset files written. */
|
|
29
|
+
assets: number;
|
|
30
|
+
/** Bytes removed from HTML (before any compression). */
|
|
31
|
+
bytesInlined: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Rewrite every HTML file under `outDir`, moving the signals runtime and the
|
|
35
|
+
* generated stylesheet into `_stx/` and linking to them.
|
|
36
|
+
*
|
|
37
|
+
* Safe to run twice: a page whose runtime is already a `src=` reference has no
|
|
38
|
+
* inline body to match, so a second pass is a no-op.
|
|
39
|
+
*/
|
|
40
|
+
export declare function externalizeSharedAssets(outDir: string): ExternalizeResult;
|