@stacksjs/stx 0.2.155 → 0.2.157
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.d.ts +0 -14
- package/dist/render.js +17 -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
|
@@ -1,221 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Types for stx
|
|
3
|
+
*/
|
|
1
4
|
import type { ColorModeBootConfig } from '../color-mode-boot';
|
|
5
|
+
import type { CustomDirective, Middleware } from './directive-types';
|
|
2
6
|
import type { ComponentConfig, DocGeneratorConfig, WebComponentConfig } from './component-types';
|
|
7
|
+
import type { PwaConfig } from './pwa-types';
|
|
3
8
|
import type { CspConfig } from './csp-types';
|
|
4
|
-
import type { CustomDirective, Middleware } from './directive-types';
|
|
5
9
|
import type { HeatmapConfig } from '../heatmap';
|
|
6
10
|
import type { MediaConfig } from '../media/types';
|
|
7
|
-
import type { MiddlewareMode } from '../route-middleware';
|
|
8
|
-
import type { PwaConfig } from './pwa-types';
|
|
9
11
|
/**
|
|
10
12
|
* Internationalization (i18n) configuration
|
|
11
13
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
export interface I18nConfig {
|
|
15
|
+
/** Default locale to use when translation is not found */
|
|
16
|
+
defaultLocale: string;
|
|
17
|
+
/** Current locale */
|
|
18
|
+
locale: string;
|
|
19
|
+
/** Path to directory containing translation files */
|
|
20
|
+
translationsDir: string;
|
|
21
|
+
/** Format of translation files (json, yaml, yml, or js) */
|
|
22
|
+
format: 'json' | 'yaml' | 'yml' | 'js';
|
|
23
|
+
/** Whether to fallback to the key when translation is not found */
|
|
24
|
+
fallbackToKey: boolean;
|
|
25
|
+
/** Cache translations in memory */
|
|
26
|
+
cache: boolean;
|
|
19
27
|
}
|
|
20
28
|
/**
|
|
21
29
|
* Streaming configuration
|
|
22
30
|
*/
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
export interface StreamingConfig {
|
|
32
|
+
/** Enable streaming support */
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
/** Buffer size for stream chunks in bytes */
|
|
35
|
+
bufferSize: number;
|
|
36
|
+
/** Strategy for chunking the output */
|
|
37
|
+
strategy: 'auto' | 'manual' | 'sections';
|
|
38
|
+
/** Default timeout for stream rendering in milliseconds */
|
|
39
|
+
timeout: number;
|
|
28
40
|
}
|
|
29
41
|
/**
|
|
30
42
|
* Stream renderer for progressive loading
|
|
31
43
|
*/
|
|
32
|
-
export
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
export interface StreamRenderer {
|
|
45
|
+
/** Render the shell of the page (initial HTML) */
|
|
46
|
+
renderShell: (data?: Record<string, unknown>) => Promise<string>;
|
|
47
|
+
/** Render a specific section of the template */
|
|
48
|
+
renderSection: (section: string, data?: Record<string, unknown>) => Promise<string>;
|
|
49
|
+
/** Get the list of sections defined in the template */
|
|
50
|
+
getSections: () => string[];
|
|
51
|
+
/** Get the full template content */
|
|
52
|
+
getTemplate: () => string;
|
|
37
53
|
}
|
|
38
54
|
/**
|
|
39
55
|
* Hydration configuration
|
|
40
56
|
*/
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
export interface HydrationConfig {
|
|
58
|
+
/** Enable partial hydration */
|
|
59
|
+
enabled: boolean;
|
|
60
|
+
/** Hydration mode */
|
|
61
|
+
mode: 'progressive' | 'islands';
|
|
62
|
+
/** Path to client-side hydration entry point */
|
|
63
|
+
clientEntry: string;
|
|
64
|
+
/** Auto-generate hydration markers */
|
|
65
|
+
autoMarkers: boolean;
|
|
66
|
+
/** Preload strategy for hydration code */
|
|
67
|
+
preload: 'none' | 'eager' | 'lazy';
|
|
47
68
|
}
|
|
48
69
|
/**
|
|
49
70
|
* Island definition for partial hydration
|
|
50
71
|
*/
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
72
|
+
export interface Island {
|
|
73
|
+
/** Island unique identifier */
|
|
74
|
+
id: string;
|
|
75
|
+
/** Client component to hydrate with (path or name) */
|
|
76
|
+
component: string;
|
|
77
|
+
/** Initial props for the island */
|
|
78
|
+
props?: Record<string, unknown>;
|
|
79
|
+
/** Load priority (eager or lazy) */
|
|
80
|
+
priority?: 'eager' | 'lazy';
|
|
81
|
+
/** Whether to use shadow DOM */
|
|
82
|
+
shadowDOM?: boolean;
|
|
57
83
|
}
|
|
58
84
|
/**
|
|
59
85
|
* Accessibility configuration
|
|
60
86
|
*/
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
export interface A11yConfig {
|
|
88
|
+
/** Enable accessibility checks */
|
|
89
|
+
enabled: boolean;
|
|
90
|
+
/** Automatically add screen reader styles */
|
|
91
|
+
addSrOnlyStyles: boolean;
|
|
92
|
+
/** Level of accessibility checking to enforce */
|
|
93
|
+
level: 'AA' | 'AAA';
|
|
94
|
+
/** Ignore certain types of a11y checks */
|
|
95
|
+
ignoreChecks?: string[];
|
|
96
|
+
/** Auto-fix simple a11y issues during template processing */
|
|
97
|
+
autoFix: boolean;
|
|
67
98
|
}
|
|
68
99
|
/**
|
|
69
100
|
* SEO OpenGraph configuration
|
|
70
101
|
*/
|
|
71
|
-
export
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
102
|
+
export interface OpenGraphConfig {
|
|
103
|
+
/** Open Graph type (website, article, etc.) */
|
|
104
|
+
type?: string;
|
|
105
|
+
/** Title for Open Graph */
|
|
106
|
+
title?: string;
|
|
107
|
+
/** Description for Open Graph */
|
|
108
|
+
description?: string;
|
|
109
|
+
/** URL for Open Graph */
|
|
110
|
+
url?: string;
|
|
111
|
+
/** Image URL for Open Graph */
|
|
112
|
+
image?: string;
|
|
113
|
+
/** Alt text for the OG image */
|
|
114
|
+
imageAlt?: string;
|
|
115
|
+
/** Width of the OG image */
|
|
116
|
+
imageWidth?: number;
|
|
117
|
+
/** Height of the OG image */
|
|
118
|
+
imageHeight?: number;
|
|
119
|
+
/** Site name for Open Graph */
|
|
120
|
+
siteName?: string;
|
|
81
121
|
}
|
|
82
122
|
/**
|
|
83
123
|
* SEO Twitter card configuration
|
|
84
124
|
*/
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
125
|
+
export interface TwitterConfig {
|
|
126
|
+
/** Twitter card type */
|
|
127
|
+
card?: 'summary' | 'summary_large_image' | 'app' | 'player';
|
|
128
|
+
/** Title for Twitter card */
|
|
129
|
+
title?: string;
|
|
130
|
+
/** Description for Twitter card */
|
|
131
|
+
description?: string;
|
|
132
|
+
/** Image URL for Twitter card */
|
|
133
|
+
image?: string;
|
|
134
|
+
/** Twitter site handle */
|
|
135
|
+
site?: string;
|
|
136
|
+
/** Twitter creator handle */
|
|
137
|
+
creator?: string;
|
|
92
138
|
}
|
|
93
139
|
/**
|
|
94
140
|
* SEO configuration
|
|
95
141
|
*/
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
export interface SeoConfig {
|
|
143
|
+
/** Page title */
|
|
144
|
+
title?: string;
|
|
145
|
+
/** Page description */
|
|
146
|
+
description?: string;
|
|
147
|
+
/** Page keywords */
|
|
148
|
+
keywords?: string[] | string;
|
|
149
|
+
/** Robots directives */
|
|
150
|
+
robots?: string;
|
|
151
|
+
/** Canonical URL */
|
|
152
|
+
canonical?: string;
|
|
153
|
+
/** Open Graph configuration */
|
|
154
|
+
openGraph?: OpenGraphConfig;
|
|
155
|
+
/** Twitter card configuration */
|
|
156
|
+
twitter?: TwitterConfig;
|
|
157
|
+
/** Structured data (JSON-LD) */
|
|
158
|
+
structuredData?: Record<string, unknown>;
|
|
105
159
|
}
|
|
106
160
|
/**
|
|
107
161
|
* SEO features configuration
|
|
108
162
|
*/
|
|
109
|
-
export
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
163
|
+
export interface SeoFeatureConfig {
|
|
164
|
+
/** Enable automatic SEO features */
|
|
165
|
+
enabled: boolean;
|
|
166
|
+
/** Default SEO configuration to apply to all pages */
|
|
167
|
+
defaultConfig?: SeoConfig;
|
|
168
|
+
/** Enable social preview meta tags */
|
|
169
|
+
socialPreview?: boolean;
|
|
170
|
+
/** Default image URL for social previews */
|
|
171
|
+
defaultImage?: string;
|
|
114
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Analytics driver type
|
|
175
|
+
*/
|
|
176
|
+
export type AnalyticsDriver = 'fathom' | 'google-analytics' | 'plausible' | 'self-hosted' | 'custom';
|
|
115
177
|
/**
|
|
116
178
|
* Analytics configuration for automatic script injection
|
|
117
179
|
*/
|
|
118
|
-
export
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
180
|
+
export interface AnalyticsConfig {
|
|
181
|
+
/** Enable analytics tracking */
|
|
182
|
+
enabled: boolean;
|
|
183
|
+
/** Analytics driver/provider */
|
|
184
|
+
driver: AnalyticsDriver;
|
|
185
|
+
/** Fathom Analytics configuration */
|
|
186
|
+
fathom?: {
|
|
187
|
+
/** Fathom site ID */
|
|
188
|
+
siteId: string;
|
|
189
|
+
/** Custom script URL (default: https://cdn.usefathom.com/script.js) */
|
|
190
|
+
scriptUrl?: string;
|
|
191
|
+
/** Honor Do Not Track browser setting */
|
|
192
|
+
honorDnt?: boolean;
|
|
193
|
+
/** Defer script loading (default: true) */
|
|
194
|
+
defer?: boolean;
|
|
195
|
+
/** Enable SPA mode for client-side routing */
|
|
196
|
+
spa?: boolean;
|
|
197
|
+
/** Canonical URL override */
|
|
198
|
+
canonical?: string;
|
|
199
|
+
/** Auto-track page views (default: true) */
|
|
200
|
+
auto?: boolean;
|
|
201
|
+
};
|
|
202
|
+
/** Google Analytics configuration */
|
|
203
|
+
googleAnalytics?: {
|
|
204
|
+
/** GA4 Measurement ID (e.g., G-XXXXXXXXXX) */
|
|
205
|
+
measurementId: string;
|
|
206
|
+
/** Enable debug mode */
|
|
207
|
+
debug?: boolean;
|
|
208
|
+
};
|
|
209
|
+
/** Plausible Analytics configuration */
|
|
210
|
+
plausible?: {
|
|
211
|
+
/** Your domain (e.g., example.com) */
|
|
212
|
+
domain: string;
|
|
213
|
+
/** Custom script URL (default: https://plausible.io/js/script.js) */
|
|
214
|
+
scriptUrl?: string;
|
|
215
|
+
/** Track localhost */
|
|
216
|
+
trackLocalhost?: boolean;
|
|
217
|
+
/** Enable hash-based routing */
|
|
218
|
+
hashMode?: boolean;
|
|
219
|
+
};
|
|
220
|
+
/** Self-hosted analytics configuration (using dynamodb-tooling analytics) */
|
|
221
|
+
selfHosted?: {
|
|
222
|
+
/** Site ID for tracking */
|
|
223
|
+
siteId: string;
|
|
224
|
+
/** API endpoint URL for collecting analytics */
|
|
225
|
+
apiEndpoint: string;
|
|
226
|
+
/** Honor Do Not Track browser setting */
|
|
227
|
+
honorDnt?: boolean;
|
|
228
|
+
/** Track hash changes as page views */
|
|
229
|
+
trackHashChanges?: boolean;
|
|
230
|
+
/** Track outbound link clicks */
|
|
231
|
+
trackOutboundLinks?: boolean;
|
|
232
|
+
};
|
|
233
|
+
/** Custom analytics configuration */
|
|
234
|
+
custom?: {
|
|
235
|
+
/** Custom script URL */
|
|
236
|
+
scriptUrl: string;
|
|
237
|
+
/** Script ID attribute */
|
|
238
|
+
scriptId?: string;
|
|
239
|
+
/** Additional script attributes */
|
|
240
|
+
attributes?: Record<string, string>;
|
|
241
|
+
/** Inline script content (instead of external URL) */
|
|
242
|
+
inlineScript?: string;
|
|
243
|
+
};
|
|
153
244
|
}
|
|
154
245
|
/**
|
|
155
246
|
* Animation configuration
|
|
156
247
|
*/
|
|
157
|
-
export
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
248
|
+
export interface AnimationConfig {
|
|
249
|
+
/** Enable animation system */
|
|
250
|
+
enabled: boolean;
|
|
251
|
+
/** Default duration for transitions in milliseconds */
|
|
252
|
+
defaultDuration: number;
|
|
253
|
+
/** Default easing function for transitions */
|
|
254
|
+
defaultEase: string;
|
|
255
|
+
/** Respect user's motion preferences by default */
|
|
256
|
+
respectMotionPreferences: boolean;
|
|
257
|
+
/** Default stagger delay for grouped animations */
|
|
258
|
+
staggerDelay: number;
|
|
163
259
|
}
|
|
164
260
|
/**
|
|
165
261
|
* Route middleware configuration
|
|
166
262
|
*/
|
|
167
|
-
export
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
263
|
+
export interface RouteMiddlewareConfig {
|
|
264
|
+
/** Enable route middleware system */
|
|
265
|
+
enabled: boolean;
|
|
266
|
+
/** Directory containing middleware files (default: 'middleware') */
|
|
267
|
+
dir: string;
|
|
268
|
+
/** Global middleware to run on every route */
|
|
269
|
+
global?: string[];
|
|
172
270
|
}
|
|
173
271
|
/**
|
|
174
272
|
* Loop directive configuration
|
|
175
273
|
*/
|
|
176
|
-
export
|
|
177
|
-
|
|
178
|
-
|
|
274
|
+
export interface LoopConfig {
|
|
275
|
+
/**
|
|
276
|
+
* Maximum iterations for @while loops (safety limit to prevent infinite loops)
|
|
277
|
+
* @default 1000
|
|
278
|
+
*/
|
|
279
|
+
maxWhileIterations: number;
|
|
280
|
+
/**
|
|
281
|
+
* Use $loop instead of loop for loop context variable
|
|
282
|
+
* Set to true to avoid conflicts if you have a variable named 'loop'
|
|
283
|
+
* @default false
|
|
284
|
+
*/
|
|
285
|
+
useAltLoopVariable: boolean;
|
|
179
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Available syntax highlighting themes
|
|
289
|
+
*/
|
|
290
|
+
export type SyntaxHighlightTheme = 'css-variables' | 'dark-plus' | 'dracula' | 'dracula-soft' | 'github-dark' | 'github-dark-dimmed' | 'github-light' | 'hc_light' | 'light-plus' | 'material-theme' | 'material-theme-darker' | 'material-theme-lighter' | 'material-theme-ocean' | 'material-theme-palenight' | 'min-dark' | 'min-light' | 'monokai' | 'nord' | 'one-dark-pro' | 'poimandres' | 'rose-pine' | 'rose-pine-dawn' | 'rose-pine-moon' | 'slack-dark' | 'slack-ochin' | 'solarized-dark' | 'solarized-light' | 'vitesse-dark' | 'vitesse-light';
|
|
180
291
|
/**
|
|
181
292
|
* Syntax highlighting configuration
|
|
182
293
|
*/
|
|
183
|
-
export
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
294
|
+
export interface SyntaxHighlightingConfig {
|
|
295
|
+
/** Enable syntax highlighting */
|
|
296
|
+
enabled: boolean;
|
|
297
|
+
/** Use server-side highlighting (true) instead of client-side (false) */
|
|
298
|
+
serverSide: boolean;
|
|
299
|
+
/** Default theme for syntax highlighting */
|
|
300
|
+
defaultTheme: SyntaxHighlightTheme;
|
|
301
|
+
/** Attempt to highlight code blocks with unknown language */
|
|
302
|
+
highlightUnknownLanguages: boolean;
|
|
303
|
+
/** List of additional themes to make available in the UI */
|
|
304
|
+
additionalThemes?: SyntaxHighlightTheme[];
|
|
189
305
|
}
|
|
190
306
|
/**
|
|
191
307
|
* Markdown configuration
|
|
192
308
|
*/
|
|
193
|
-
export
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
309
|
+
export interface MarkdownConfig {
|
|
310
|
+
/** Enable markdown processing */
|
|
311
|
+
enabled: boolean;
|
|
312
|
+
/** Path to markdown directory */
|
|
313
|
+
dir?: string;
|
|
314
|
+
/** Syntax highlighting configuration */
|
|
315
|
+
syntaxHighlighting?: Partial<SyntaxHighlightingConfig>;
|
|
197
316
|
}
|
|
198
317
|
/**
|
|
199
318
|
* Configuration for form directives
|
|
200
319
|
*/
|
|
201
|
-
export
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
320
|
+
export interface FormConfig {
|
|
321
|
+
/** CSS class names for form elements */
|
|
322
|
+
classes?: {
|
|
323
|
+
/** Class for text inputs, textareas, and selects */
|
|
324
|
+
input?: string;
|
|
325
|
+
/** Class added to inputs with validation errors */
|
|
326
|
+
inputError?: string;
|
|
327
|
+
/** Class for checkboxes and radios */
|
|
328
|
+
checkInput?: string;
|
|
329
|
+
/** Class for labels */
|
|
330
|
+
label?: string;
|
|
331
|
+
/** Class for error message containers */
|
|
332
|
+
errorFeedback?: string;
|
|
333
|
+
};
|
|
209
334
|
}
|
|
210
335
|
/**
|
|
211
336
|
* Strict mode configuration for DOM API validation.
|
|
212
337
|
* When enabled, stx warns (or errors) when client scripts use raw browser APIs
|
|
213
338
|
* instead of framework composables.
|
|
214
339
|
*/
|
|
215
|
-
export
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
340
|
+
export interface StrictModeConfig {
|
|
341
|
+
/** Enable strict mode validation */
|
|
342
|
+
enabled: boolean;
|
|
343
|
+
/** Throw errors instead of warnings (default: false) */
|
|
344
|
+
failOnViolation?: boolean;
|
|
345
|
+
/** Pattern strings to allow through validation (matched against message or regex source) */
|
|
346
|
+
allowPatterns?: string[];
|
|
219
347
|
}
|
|
220
348
|
/**
|
|
221
349
|
* Real-time broadcasting configuration.
|
|
@@ -223,175 +351,508 @@ export declare interface StrictModeConfig {
|
|
|
223
351
|
* When enabled, stx starts a ts-broadcasting WebSocket server
|
|
224
352
|
* alongside the dev server so pages can receive push events.
|
|
225
353
|
*/
|
|
226
|
-
export
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
354
|
+
export interface BroadcastingConfig {
|
|
355
|
+
/** Enable the broadcasting server @default false */
|
|
356
|
+
enabled?: boolean;
|
|
357
|
+
/** Broadcasting driver @default 'bun' */
|
|
358
|
+
driver?: 'bun' | 'reverb' | 'pusher' | 'ably' | 'log' | 'null';
|
|
359
|
+
/** WebSocket server host @default '0.0.0.0' */
|
|
360
|
+
host?: string;
|
|
361
|
+
/** WebSocket server port @default 6001 */
|
|
362
|
+
port?: number;
|
|
363
|
+
/** URL scheme @default 'ws' */
|
|
364
|
+
scheme?: 'ws' | 'wss';
|
|
365
|
+
/** Enable verbose logging @default false */
|
|
366
|
+
verbose?: boolean;
|
|
233
367
|
}
|
|
234
368
|
/**
|
|
235
369
|
* App head configuration — auto-generates the document shell.
|
|
236
370
|
* No .stx file needs to write <!DOCTYPE>, <html>, <head>, or <body>.
|
|
237
371
|
*/
|
|
238
|
-
export
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
372
|
+
export interface AppHeadConfig {
|
|
373
|
+
/** Page title (can be overridden per-page with @section('title')) */
|
|
374
|
+
title?: string;
|
|
375
|
+
/** HTML lang attribute @default 'en' */
|
|
376
|
+
lang?: string;
|
|
377
|
+
/** Meta tags */
|
|
378
|
+
meta?: Array<Record<string, string>>;
|
|
379
|
+
/** Link tags (stylesheets, icons, etc.) */
|
|
380
|
+
link?: Array<Record<string, string>>;
|
|
381
|
+
/** Script tags to include in <head> */
|
|
382
|
+
script?: Array<{
|
|
383
|
+
src?: string;
|
|
384
|
+
content?: string;
|
|
385
|
+
[key: string]: any;
|
|
386
|
+
}>;
|
|
387
|
+
/** Additional raw HTML to inject in <head> */
|
|
388
|
+
headRaw?: string;
|
|
389
|
+
/**
|
|
390
|
+
* Attributes for the `<html>` element.
|
|
391
|
+
*
|
|
392
|
+
* `class` is the reason this exists: design tokens scoped to the root
|
|
393
|
+
* element (`html.marketing { --bg: … }`) need a class the page cannot
|
|
394
|
+
* otherwise set once it stops hand-writing its own document shell.
|
|
395
|
+
* `htmlAttrs.lang` takes precedence over the `lang` option.
|
|
396
|
+
*
|
|
397
|
+
* Also settable per-page via `useHead({ htmlAttrs })`, which merges over
|
|
398
|
+
* this. Reconciled by the router on SPA layout changes (stacksjs/stx#1798).
|
|
399
|
+
*/
|
|
400
|
+
htmlAttrs?: Record<string, string>;
|
|
401
|
+
/** Body class */
|
|
402
|
+
bodyClass?: string;
|
|
403
|
+
/** Body attributes */
|
|
404
|
+
bodyAttrs?: Record<string, string>;
|
|
248
405
|
}
|
|
249
406
|
/**
|
|
250
407
|
* stx configuration options
|
|
251
408
|
*/
|
|
252
|
-
export
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
409
|
+
export interface StxConfig {
|
|
410
|
+
/**
|
|
411
|
+
* App head configuration.
|
|
412
|
+
* Defines the document shell that stx auto-generates around page content.
|
|
413
|
+
* No .stx file needs to write <!DOCTYPE>, <html>, <head>, or <body>.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* // stx.config.ts
|
|
418
|
+
* export default {
|
|
419
|
+
* app: {
|
|
420
|
+
* head: {
|
|
421
|
+
* title: 'My App',
|
|
422
|
+
* meta: [
|
|
423
|
+
* { name: 'description', content: 'My stx app' },
|
|
424
|
+
* ],
|
|
425
|
+
* link: [
|
|
426
|
+
* { rel: 'icon', href: '/favicon.ico' },
|
|
427
|
+
* ],
|
|
428
|
+
* },
|
|
429
|
+
* },
|
|
430
|
+
* }
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
433
|
+
/**
|
|
434
|
+
* Canonical site identity (stacksjs/stx#1866).
|
|
435
|
+
*
|
|
436
|
+
* `url` is what sitemap.xml and robots.txt are built from. Without it the
|
|
437
|
+
* static build falls back to `http://localhost` and warns — a sitemap of
|
|
438
|
+
* localhost URLs is valid XML and useless to a crawler, so it has to be said
|
|
439
|
+
* out loud rather than discovered after deploy.
|
|
440
|
+
*
|
|
441
|
+
* The site-builder path reads the same field from `site.config.ts`; either
|
|
442
|
+
* file works.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```ts
|
|
446
|
+
* // stx.config.ts
|
|
447
|
+
* export default {
|
|
448
|
+
* site: { url: 'https://example.com' },
|
|
449
|
+
* }
|
|
450
|
+
* ```
|
|
451
|
+
*/
|
|
452
|
+
site?: {
|
|
453
|
+
/** Absolute origin, e.g. `https://example.com`. */
|
|
454
|
+
url?: string;
|
|
455
|
+
};
|
|
456
|
+
app?: {
|
|
457
|
+
head?: AppHeadConfig;
|
|
458
|
+
/**
|
|
459
|
+
* Pre-paint color mode (stacksjs/stx#1794).
|
|
460
|
+
*
|
|
461
|
+
* Declaring this makes stx inline a small render-blocking script as the
|
|
462
|
+
* first thing in `<head>`, which reads the persisted preference and stamps
|
|
463
|
+
* the root element before the browser paints. Without it, `useColorMode`
|
|
464
|
+
* can only apply the theme after hydration, which flashes the wrong theme
|
|
465
|
+
* on every cold load for users whose stored preference differs from the
|
|
466
|
+
* default.
|
|
467
|
+
*
|
|
468
|
+
* The options are the same ones `useColorMode` takes, and the boot script
|
|
469
|
+
* publishes them to the client — so `useColorMode()` with no arguments
|
|
470
|
+
* picks up the configured key and attribute instead of repeating them.
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* ```ts
|
|
474
|
+
* // stx.config.ts
|
|
475
|
+
* export default {
|
|
476
|
+
* app: {
|
|
477
|
+
* colorMode: { storageKey: 'theme', attribute: 'data-theme' },
|
|
478
|
+
* },
|
|
479
|
+
* }
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
colorMode?: ColorModeBootConfig;
|
|
483
|
+
/**
|
|
484
|
+
* Defaults for the native dev window (`stx dev --native`).
|
|
485
|
+
* Only used when the user passes `--native`. Sensible per-app sizes
|
|
486
|
+
* keep the window from opening at a one-size-fits-all 1400×900.
|
|
487
|
+
*/
|
|
488
|
+
window?: {
|
|
489
|
+
/** Window width in points/pixels. Default: 1400. */
|
|
490
|
+
width?: number;
|
|
491
|
+
/** Window height in points/pixels. Default: 900. */
|
|
492
|
+
height?: number;
|
|
493
|
+
/** Open with the system dark theme. Default: true. */
|
|
494
|
+
darkMode?: boolean;
|
|
495
|
+
/** Enable hot-reload bridge inside the webview. Default: true. */
|
|
496
|
+
hotReload?: boolean;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
/**
|
|
500
|
+
* Source root for .stx files.
|
|
501
|
+
* pages/, layouts/, components/, partials/ resolve relative to this.
|
|
502
|
+
*
|
|
503
|
+
* - Standalone app: defaults to '.' (project root)
|
|
504
|
+
* - Stacks app: auto-detected as 'resources/views' if that directory has pages/
|
|
505
|
+
* - Override: set explicitly to any path
|
|
506
|
+
*
|
|
507
|
+
* Note: the state directory (see `stateDir`), .output/ (build), and
|
|
508
|
+
* stx.config.ts stay at project root.
|
|
509
|
+
*
|
|
510
|
+
* @default '.' (auto-detects 'resources/views' if it exists with pages/)
|
|
511
|
+
*/
|
|
512
|
+
root?: string;
|
|
513
|
+
/**
|
|
514
|
+
* Where stx keeps its generated state: the compiled-template cache, the
|
|
515
|
+
* Crosswind CSS cache, the client-script bundle cache and temp dir, the
|
|
516
|
+
* generated route manifest and route types, dev-server output, SSG and media
|
|
517
|
+
* caches, story snapshots.
|
|
518
|
+
*
|
|
519
|
+
* Point it at an existing home for generated state to keep the project root
|
|
520
|
+
* clean - a Stacks application sets `storage/framework/stx`. The path-shaped
|
|
521
|
+
* options that default to somewhere under `.stx/` (`cachePath`,
|
|
522
|
+
* `build.cacheDir`, `media.cache.directory`, `story.outDir`) follow this
|
|
523
|
+
* setting; a path you point somewhere else entirely is left alone.
|
|
524
|
+
*
|
|
525
|
+
* Relative paths resolve against the project root; absolute paths are used
|
|
526
|
+
* as-is. `STX_DIR` overrides this.
|
|
527
|
+
*
|
|
528
|
+
* @default '.stx'
|
|
529
|
+
*/
|
|
530
|
+
stateDir?: string;
|
|
531
|
+
/**
|
|
532
|
+
* Pages directory name (relative to root).
|
|
533
|
+
* Standalone apps: 'pages' (default)
|
|
534
|
+
* Stacks apps: 'views'
|
|
535
|
+
*
|
|
536
|
+
* @default 'pages'
|
|
537
|
+
*/
|
|
538
|
+
pagesDir?: string;
|
|
539
|
+
/**
|
|
540
|
+
* Root directory for templates
|
|
541
|
+
*/
|
|
542
|
+
templatesDir?: string;
|
|
543
|
+
/**
|
|
544
|
+
* Default title to use for SEO if none is provided
|
|
545
|
+
*/
|
|
546
|
+
defaultTitle?: string;
|
|
547
|
+
/**
|
|
548
|
+
* Default description to use for SEO if none is provided
|
|
549
|
+
*/
|
|
550
|
+
defaultDescription?: string;
|
|
551
|
+
/**
|
|
552
|
+
* Default image URL to use for SEO/OpenGraph if none is provided
|
|
553
|
+
*/
|
|
554
|
+
defaultImage?: string;
|
|
555
|
+
/**
|
|
556
|
+
* Enable server-side rendering at request time.
|
|
557
|
+
*
|
|
558
|
+
* - `false` (default) → SSG. `<script server>` runs at build time, output
|
|
559
|
+
* goes to `dist/` as flat HTML files. Deploy to S3 + CloudFront.
|
|
560
|
+
* - `true` → SSR. `<script server>` runs per-request on a Bun server,
|
|
561
|
+
* output goes to `.output/`. Deploy to EC2 behind CloudFront.
|
|
562
|
+
*
|
|
563
|
+
* `<script server>` works in both modes — this flag controls *when* it
|
|
564
|
+
* runs, not whether it's allowed.
|
|
565
|
+
*
|
|
566
|
+
* @default false
|
|
567
|
+
*/
|
|
568
|
+
ssr?: boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Enable or disable caching
|
|
571
|
+
*/
|
|
572
|
+
cache?: boolean;
|
|
573
|
+
/**
|
|
574
|
+
* Cache directory path
|
|
575
|
+
*/
|
|
576
|
+
cacheDir?: string;
|
|
577
|
+
/**
|
|
578
|
+
* Cache version, used to invalidate cache
|
|
579
|
+
*/
|
|
580
|
+
cacheVersion?: string;
|
|
581
|
+
/**
|
|
582
|
+
* Enable stx features
|
|
583
|
+
*/
|
|
584
|
+
enabled: boolean;
|
|
585
|
+
/** Path to partials directory, defaults to 'partials' in the same directory as the template */
|
|
586
|
+
partialsDir: string;
|
|
587
|
+
/** Path to components directory, defaults to 'components' in the same directory as the template */
|
|
588
|
+
componentsDir: string;
|
|
589
|
+
/** @internal Configured component root retained while nested components resolve locally. */
|
|
590
|
+
_rootComponentsDir?: string;
|
|
591
|
+
/** Path to layouts directory, defaults to 'layouts' in the project root */
|
|
592
|
+
layoutsDir?: string;
|
|
593
|
+
/**
|
|
594
|
+
* Path to the stores directory, resolved against `root`.
|
|
595
|
+
*
|
|
596
|
+
* Every `.ts` file in it (except `index.ts`, `types.ts` and `.d.ts`) is
|
|
597
|
+
* discovered, bundled, and injected ahead of any page script, so a
|
|
598
|
+
* `defineStore(...)` call has already run by the time `useStore('id')` looks
|
|
599
|
+
* it up. Files are ordered so stores that call `useStore()` load after the
|
|
600
|
+
* ones they depend on.
|
|
601
|
+
*
|
|
602
|
+
* @default 'stores'
|
|
603
|
+
*/
|
|
604
|
+
storesDir?: string;
|
|
605
|
+
/**
|
|
606
|
+
* Path to the composables directory, resolved against `root`.
|
|
607
|
+
*
|
|
608
|
+
* Every `.ts` file in it (except `index.ts`, `types.ts` and `.d.ts`) is
|
|
609
|
+
* discovered, bundled, and injected ahead of any page script. Exported
|
|
610
|
+
* bindings are registered on `window.__composables`, which is what
|
|
611
|
+
* `import { useThing } from '@composables'` compiles to — a plain destructure
|
|
612
|
+
* in the page's own scope, so template directives can see the names.
|
|
613
|
+
*
|
|
614
|
+
* All composables share one scope, so they can call each other directly
|
|
615
|
+
* without importing.
|
|
616
|
+
*
|
|
617
|
+
* When unset, stx probes `composables/` and then `functions/`, so an app
|
|
618
|
+
* already using either layout works with no configuration.
|
|
619
|
+
*
|
|
620
|
+
* @default 'composables' (falls back to 'functions')
|
|
621
|
+
*/
|
|
622
|
+
composablesDir?: string;
|
|
623
|
+
/** Default layout to use for pages without DOCTYPE, relative to layoutsDir */
|
|
624
|
+
defaultLayout?: string;
|
|
625
|
+
/** Plugins to load — npm packages, local paths, or [path, options] tuples */
|
|
626
|
+
plugins?: Array<string | [string, Record<string, any>]>;
|
|
627
|
+
/** Path to public/static assets directory, defaults to 'public' */
|
|
628
|
+
publicDir?: string;
|
|
629
|
+
/** Path to .env file, defaults to '.env' in project root (Bun loads this automatically) */
|
|
630
|
+
envFile?: string | boolean;
|
|
631
|
+
/** Environment variable prefix for client-side exposure (e.g. 'STX_PUBLIC_') */
|
|
632
|
+
envPrefix?: string;
|
|
633
|
+
/**
|
|
634
|
+
* Path to a `crosswind.config.*` file, or an inline Crosswind config. The
|
|
635
|
+
* inline object accepts any Crosswind field (`theme`, `fonts`, `safelist`,
|
|
636
|
+
* `shortcuts`, …) — e.g. load web fonts with
|
|
637
|
+
* `css: { fonts: { google: ['Inter:wght@400;700'] } }`.
|
|
638
|
+
*/
|
|
639
|
+
css?: string | {
|
|
640
|
+
config?: string;
|
|
641
|
+
content?: string[];
|
|
642
|
+
preflight?: boolean;
|
|
643
|
+
minify?: boolean;
|
|
644
|
+
[key: string]: unknown;
|
|
645
|
+
};
|
|
646
|
+
/** Enable debug mode for detailed error messages */
|
|
647
|
+
debug: boolean;
|
|
648
|
+
/**
|
|
649
|
+
* Turn degraded-but-working behaviour into a hard failure.
|
|
650
|
+
*
|
|
651
|
+
* `bundlerFallback` decides what happens when a `<script client>` block will
|
|
652
|
+
* not bundle. The default `'warn'` ships the ORIGINAL, unbundled source so the
|
|
653
|
+
* page still renders, which is right for a dev server and is why the overlay
|
|
654
|
+
* exists; `'error'` refuses instead, for anyone who would rather nothing
|
|
655
|
+
* rendered than a page whose bindings quietly do nothing. `stx build` fails on
|
|
656
|
+
* a bundle error either way. See #1884.
|
|
657
|
+
*/
|
|
658
|
+
strict?: {
|
|
659
|
+
bundlerFallback?: 'warn' | 'error';
|
|
660
|
+
};
|
|
661
|
+
/** Directory to store cached templates, defaults to `cache` inside `stateDir` */
|
|
662
|
+
cachePath: string;
|
|
663
|
+
/** Custom directives registered by the user */
|
|
664
|
+
customDirectives?: CustomDirective[];
|
|
665
|
+
/** Middleware for pre/post-processing templates */
|
|
666
|
+
middleware?: Middleware[];
|
|
667
|
+
/** Internationalization (i18n) configuration */
|
|
668
|
+
i18n?: Partial<I18nConfig>;
|
|
669
|
+
/** Web Components integration configuration */
|
|
670
|
+
webComponents?: Partial<WebComponentConfig>;
|
|
671
|
+
/** Documentation generator configuration */
|
|
672
|
+
docs?: Partial<DocGeneratorConfig>;
|
|
673
|
+
/** Streaming rendering configuration */
|
|
674
|
+
streaming?: Partial<StreamingConfig>;
|
|
675
|
+
/** Partial hydration configuration */
|
|
676
|
+
hydration?: Partial<HydrationConfig>;
|
|
677
|
+
/** Accessibility configuration */
|
|
678
|
+
a11y?: Partial<A11yConfig>;
|
|
679
|
+
/** SEO configuration */
|
|
680
|
+
seo?: Partial<SeoFeatureConfig>;
|
|
681
|
+
/** Analytics configuration */
|
|
682
|
+
analytics?: Partial<AnalyticsConfig>;
|
|
683
|
+
/** Animation system configuration */
|
|
684
|
+
animation?: Partial<AnimationConfig>;
|
|
685
|
+
/** Skip adding default SEO tags */
|
|
686
|
+
skipDefaultSeoTags?: boolean;
|
|
687
|
+
/** Skip injecting signals runtime (for nested component processing) */
|
|
688
|
+
skipSignalsRuntime?: boolean;
|
|
689
|
+
/** Skip event directive processing (for signal components where runtime handles @click etc.) */
|
|
690
|
+
skipEventDirectives?: boolean;
|
|
691
|
+
/** Markdown configuration */
|
|
692
|
+
markdown?: Partial<MarkdownConfig>;
|
|
693
|
+
/** Loop directive configuration */
|
|
694
|
+
loops?: Partial<LoopConfig>;
|
|
695
|
+
/** Form directives configuration */
|
|
696
|
+
forms?: Partial<FormConfig>;
|
|
697
|
+
/** Content Security Policy configuration */
|
|
698
|
+
csp?: Partial<CspConfig>;
|
|
699
|
+
/** Story (component showcase) configuration */
|
|
700
|
+
story?: Partial<import('../story/types').StoryConfig>;
|
|
701
|
+
/** Progressive Web App (PWA) configuration */
|
|
702
|
+
pwa?: Partial<PwaConfig>;
|
|
703
|
+
/** Component configuration */
|
|
704
|
+
components?: Partial<ComponentConfig>;
|
|
705
|
+
/** Route middleware configuration */
|
|
706
|
+
routeMiddleware?: Partial<RouteMiddlewareConfig>;
|
|
707
|
+
/** Heatmap tracking configuration */
|
|
708
|
+
heatmap?: Partial<HeatmapConfig>;
|
|
709
|
+
/** Static Site Generation (SSG) build configuration */
|
|
710
|
+
build?: Partial<BuildConfig>;
|
|
711
|
+
/** Media (images, video, uploads) configuration */
|
|
712
|
+
media?: Partial<MediaConfig>;
|
|
713
|
+
/**
|
|
714
|
+
* Strict mode for DOM API validation.
|
|
715
|
+
* When `true`, warns about raw `document.*` / `window.*` usage in client scripts.
|
|
716
|
+
* Pass a StrictModeConfig object for fine-grained control.
|
|
717
|
+
*/
|
|
718
|
+
strict?: boolean | StrictModeConfig;
|
|
719
|
+
/**
|
|
720
|
+
* Build mode for the processing pipeline.
|
|
721
|
+
* - `undefined` (default): dev mode, inline everything per request
|
|
722
|
+
* - `'compile'`: build mode, emit asset reference placeholders instead of inline code
|
|
723
|
+
* - `'serve'`: serve mode, reference shared runtime and router assets
|
|
724
|
+
*/
|
|
725
|
+
buildMode?: 'compile' | 'serve' | 'spa';
|
|
726
|
+
/**
|
|
727
|
+
* Auto-generate document shell (<!DOCTYPE>, <html>, <head>, <body>) around output.
|
|
728
|
+
* Set by serve paths to wrap page output. Not set for tests or programmatic usage.
|
|
729
|
+
* @default false
|
|
730
|
+
*/
|
|
731
|
+
autoShell?: boolean;
|
|
732
|
+
/**
|
|
733
|
+
* Output directory for production builds.
|
|
734
|
+
* @default '.output'
|
|
735
|
+
*/
|
|
736
|
+
outputDir?: string;
|
|
737
|
+
/**
|
|
738
|
+
* App shell file for single-shell mode.
|
|
739
|
+
* When set (or auto-detected as 'app.stx'), the shell wraps all pages.
|
|
740
|
+
* The shell's `<slot />` is replaced with page content.
|
|
741
|
+
* Direct requests get full shell + page; SPA navigation gets page fragments.
|
|
742
|
+
* @default undefined (auto-detects 'app.stx' in project root)
|
|
743
|
+
*/
|
|
744
|
+
shell?: string | false;
|
|
745
|
+
/**
|
|
746
|
+
* Real-time broadcasting configuration (powered by ts-broadcasting).
|
|
747
|
+
*
|
|
748
|
+
* When enabled, stx starts a WebSocket broadcasting server alongside
|
|
749
|
+
* the dev server and injects client helpers automatically.
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* ```ts
|
|
753
|
+
* // stx.config.ts
|
|
754
|
+
* export default {
|
|
755
|
+
* broadcasting: {
|
|
756
|
+
* enabled: true,
|
|
757
|
+
* port: 6001,
|
|
758
|
+
* }
|
|
759
|
+
* }
|
|
760
|
+
* ```
|
|
761
|
+
*/
|
|
762
|
+
broadcasting?: Partial<BroadcastingConfig>;
|
|
763
|
+
/**
|
|
764
|
+
* Custom API routes for the dev server.
|
|
765
|
+
* Keys are path patterns (e.g. '/api/delete'), values are request handlers.
|
|
766
|
+
* Handlers receive the standard Request and return a Response.
|
|
767
|
+
*/
|
|
768
|
+
apiRoutes?: Record<string, (request: Request) => Response | Promise<Response>>;
|
|
769
|
+
/**
|
|
770
|
+
* Client-side router configuration
|
|
771
|
+
*/
|
|
772
|
+
router?: {
|
|
773
|
+
enabled?: boolean;
|
|
774
|
+
container?: string;
|
|
775
|
+
linkSelector?: string;
|
|
776
|
+
/**
|
|
777
|
+
* Intercept every in-app `<a>` for client-side navigation rather than
|
|
778
|
+
* only those matching `linkSelector`. Default: false.
|
|
779
|
+
*/
|
|
780
|
+
interceptAllLinks?: boolean;
|
|
781
|
+
viewTransitions?: boolean;
|
|
782
|
+
/**
|
|
783
|
+
* Duration of the default View Transitions fade, in milliseconds.
|
|
784
|
+
* Only applied when viewTransitions is enabled and the browser supports
|
|
785
|
+
* document.startViewTransition. Default: 220.
|
|
786
|
+
*/
|
|
787
|
+
viewTransitionDuration?: number;
|
|
788
|
+
/**
|
|
789
|
+
* Easing curve for the default View Transitions fade. Any valid CSS
|
|
790
|
+
* animation-timing-function. Default: cubic-bezier(0.16, 1, 0.3, 1).
|
|
791
|
+
*/
|
|
792
|
+
viewTransitionEasing?: string;
|
|
793
|
+
scrollToTop?: boolean;
|
|
794
|
+
prefetch?: boolean;
|
|
795
|
+
cache?: boolean;
|
|
796
|
+
cacheTTL?: number;
|
|
797
|
+
skipSelectors?: string;
|
|
798
|
+
viewTransitionCSS?: Record<string, string>;
|
|
799
|
+
/**
|
|
800
|
+
* Show the top loading/progress bar during client-side navigation.
|
|
801
|
+
* Default: true.
|
|
802
|
+
*/
|
|
803
|
+
progress?: boolean;
|
|
804
|
+
/**
|
|
805
|
+
* Progress-bar color (hex, rgb, css var, etc.). Default: '#78dce8'.
|
|
806
|
+
*/
|
|
807
|
+
progressColor?: string;
|
|
808
|
+
/**
|
|
809
|
+
* Progress-bar height including units (e.g. '2px', '3px'). Default: '2px'.
|
|
810
|
+
*/
|
|
811
|
+
progressHeight?: string;
|
|
812
|
+
};
|
|
813
|
+
/**
|
|
814
|
+
* Custom router instance (e.g. @stacksjs/bun-router) for API handling.
|
|
815
|
+
* When set, incoming requests are passed to router.handleRequest() before
|
|
816
|
+
* falling through to page routes. Takes precedence over apiRoutes for
|
|
817
|
+
* matching paths.
|
|
818
|
+
*/
|
|
819
|
+
apiRouter?: {
|
|
820
|
+
handleRequest: (request: Request) => Response | Promise<Response>;
|
|
821
|
+
};
|
|
340
822
|
}
|
|
341
823
|
/**
|
|
342
824
|
* SSG Build configuration for static site generation
|
|
343
825
|
*/
|
|
344
|
-
export
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
826
|
+
export interface BuildConfig {
|
|
827
|
+
/** Directory containing page templates (default: 'pages') */
|
|
828
|
+
pagesDir: string;
|
|
829
|
+
/** Output directory for generated files (default: 'dist') */
|
|
830
|
+
outputDir: string;
|
|
831
|
+
/** Base URL path for the site (default: '/') */
|
|
832
|
+
baseUrl: string;
|
|
833
|
+
/** Site domain for absolute URLs in sitemap */
|
|
834
|
+
domain?: string;
|
|
835
|
+
/** Generate sitemap.xml (default: true) */
|
|
836
|
+
sitemap: boolean;
|
|
837
|
+
/** Generate RSS feed */
|
|
838
|
+
rss?: boolean | import('../ssg').RSSConfig;
|
|
839
|
+
/** Minify HTML output (default: true) */
|
|
840
|
+
minify: boolean;
|
|
841
|
+
/** Enable build caching (default: true) */
|
|
842
|
+
cache: boolean;
|
|
843
|
+
/** Cache directory (default: `ssg-cache` inside `stateDir`) */
|
|
844
|
+
cacheDir: string;
|
|
845
|
+
/** Parallel page generation limit (default: 10) */
|
|
846
|
+
concurrency: number;
|
|
847
|
+
/** Generate 404 page (default: true) */
|
|
848
|
+
generate404: boolean;
|
|
849
|
+
/** Directory with static assets to copy (default: 'public') */
|
|
850
|
+
publicDir: string;
|
|
851
|
+
/** Add trailing slashes to URLs (default: false) */
|
|
852
|
+
trailingSlash: boolean;
|
|
853
|
+
/** Clean output directory before build (default: true) */
|
|
854
|
+
cleanOutput: boolean;
|
|
855
|
+
/** ISR revalidation time in seconds */
|
|
856
|
+
revalidate?: number | false;
|
|
360
857
|
}
|
|
361
|
-
/**
|
|
362
|
-
* Analytics driver type
|
|
363
|
-
*/
|
|
364
|
-
export type AnalyticsDriver = 'fathom' | 'google-analytics' | 'plausible' | 'self-hosted' | 'custom';
|
|
365
|
-
/**
|
|
366
|
-
* Available syntax highlighting themes
|
|
367
|
-
*/
|
|
368
|
-
export type SyntaxHighlightTheme = | 'css-variables'
|
|
369
|
-
| 'dark-plus'
|
|
370
|
-
| 'dracula'
|
|
371
|
-
| 'dracula-soft'
|
|
372
|
-
| 'github-dark'
|
|
373
|
-
| 'github-dark-dimmed'
|
|
374
|
-
| 'github-light'
|
|
375
|
-
| 'hc_light'
|
|
376
|
-
| 'light-plus'
|
|
377
|
-
| 'material-theme'
|
|
378
|
-
| 'material-theme-darker'
|
|
379
|
-
| 'material-theme-lighter'
|
|
380
|
-
| 'material-theme-ocean'
|
|
381
|
-
| 'material-theme-palenight'
|
|
382
|
-
| 'min-dark'
|
|
383
|
-
| 'min-light'
|
|
384
|
-
| 'monokai'
|
|
385
|
-
| 'nord'
|
|
386
|
-
| 'one-dark-pro'
|
|
387
|
-
| 'poimandres'
|
|
388
|
-
| 'rose-pine'
|
|
389
|
-
| 'rose-pine-dawn'
|
|
390
|
-
| 'rose-pine-moon'
|
|
391
|
-
| 'slack-dark'
|
|
392
|
-
| 'slack-ochin'
|
|
393
|
-
| 'solarized-dark'
|
|
394
|
-
| 'solarized-light'
|
|
395
|
-
| 'vitesse-dark'
|
|
396
|
-
| 'vitesse-light';
|
|
397
858
|
export type StxOptions = Partial<StxConfig>;
|