@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,199 +1,245 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type guard to check if a directive is a specific kind
|
|
3
|
-
*/
|
|
4
|
-
export declare function isDirectiveKind<K extends Directive['kind']>(directive: Directive, kind: K): directive is Extract<Directive, { kind: K }>;
|
|
5
1
|
/**
|
|
6
2
|
* Directive Types - Discriminated Unions for all directive types
|
|
7
3
|
*/
|
|
8
4
|
/**
|
|
9
5
|
* Base directive type with common properties
|
|
10
6
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
interface BaseDirective {
|
|
8
|
+
/** The directive type for discriminated union */
|
|
9
|
+
readonly kind: string;
|
|
10
|
+
/** Raw matched string from template */
|
|
11
|
+
raw: string;
|
|
12
|
+
/** Start position in template */
|
|
13
|
+
start: number;
|
|
14
|
+
/** End position in template */
|
|
15
|
+
end: number;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Conditional directive (@if, @elseif, @else, @unless, @isset, @empty)
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
export interface ConditionalDirective extends BaseDirective {
|
|
21
|
+
kind: 'conditional';
|
|
22
|
+
/** Specific conditional type */
|
|
23
|
+
type: 'if' | 'elseif' | 'else' | 'endif' | 'unless' | 'endunless' | 'isset' | 'endisset' | 'empty' | 'endempty';
|
|
24
|
+
/** Condition expression (undefined for @else, @endif, etc.) */
|
|
25
|
+
condition?: string;
|
|
26
|
+
/** Content inside the directive block */
|
|
27
|
+
content?: string;
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* Loop directive (@foreach, @for, @while, @forelse)
|
|
28
31
|
*/
|
|
29
|
-
export
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
export interface LoopDirective extends BaseDirective {
|
|
33
|
+
kind: 'loop';
|
|
34
|
+
/** Specific loop type */
|
|
35
|
+
type: 'foreach' | 'endforeach' | 'for' | 'endfor' | 'while' | 'endwhile' | 'forelse' | 'empty' | 'endforelse';
|
|
36
|
+
/** Loop expression (e.g., "items as item" or "let i = 0; i < 10; i++") */
|
|
37
|
+
expression?: string;
|
|
38
|
+
/** Item variable name (for foreach) */
|
|
39
|
+
itemVar?: string;
|
|
40
|
+
/** Array expression (for foreach) */
|
|
41
|
+
arrayExpr?: string;
|
|
42
|
+
/** Content inside the loop */
|
|
43
|
+
content?: string;
|
|
44
|
+
/** Empty content (for forelse) */
|
|
45
|
+
emptyContent?: string;
|
|
37
46
|
}
|
|
38
47
|
/**
|
|
39
48
|
* Include directive (@include, @includeIf, @includeWhen, @includeUnless, @includeFirst)
|
|
40
49
|
*/
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
export interface IncludeDirective extends BaseDirective {
|
|
51
|
+
kind: 'include';
|
|
52
|
+
/** Specific include type */
|
|
53
|
+
type: 'include' | 'includeIf' | 'includeWhen' | 'includeUnless' | 'includeFirst' | 'partial' | 'once';
|
|
54
|
+
/** Path to the included template */
|
|
55
|
+
path?: string;
|
|
56
|
+
/** Array of paths (for includeFirst) */
|
|
57
|
+
paths?: string[];
|
|
58
|
+
/** Condition expression (for includeWhen/includeUnless) */
|
|
59
|
+
condition?: string;
|
|
60
|
+
/** Local variables to pass to included template */
|
|
61
|
+
variables?: Record<string, unknown>;
|
|
48
62
|
}
|
|
49
63
|
/**
|
|
50
64
|
* Layout directive (@layout, @extends, @section, @yield, @parent)
|
|
51
65
|
*/
|
|
52
|
-
export
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
export interface LayoutDirective extends BaseDirective {
|
|
67
|
+
kind: 'layout';
|
|
68
|
+
/** Specific layout type */
|
|
69
|
+
type: 'layout' | 'extends' | 'section' | 'endsection' | 'yield' | 'parent' | 'show';
|
|
70
|
+
/** Layout or section name */
|
|
71
|
+
name?: string;
|
|
72
|
+
/** Default content (for yield) */
|
|
73
|
+
defaultContent?: string;
|
|
74
|
+
/** Section content */
|
|
75
|
+
content?: string;
|
|
58
76
|
}
|
|
59
77
|
/**
|
|
60
78
|
* Component directive (@component, x-component)
|
|
61
79
|
*/
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
export interface ComponentDirective extends BaseDirective {
|
|
81
|
+
kind: 'component';
|
|
82
|
+
/** Specific component type */
|
|
83
|
+
type: 'component' | 'endcomponent' | 'slot' | 'endslot';
|
|
84
|
+
/** Component name */
|
|
85
|
+
name?: string;
|
|
86
|
+
/** Component props */
|
|
87
|
+
props?: Record<string, unknown>;
|
|
88
|
+
/** Slot name (for named slots) */
|
|
89
|
+
slotName?: string;
|
|
90
|
+
/** Slot content */
|
|
91
|
+
content?: string;
|
|
69
92
|
}
|
|
70
93
|
/**
|
|
71
94
|
* Auth directive (@auth, @guest, @can, @cannot)
|
|
72
95
|
*/
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
export interface AuthDirective extends BaseDirective {
|
|
97
|
+
kind: 'auth';
|
|
98
|
+
/** Specific auth type */
|
|
99
|
+
type: 'auth' | 'endauth' | 'guest' | 'endguest' | 'can' | 'endcan' | 'cannot' | 'endcannot' | 'role' | 'endrole';
|
|
100
|
+
/** Guard name (optional) */
|
|
101
|
+
guard?: string;
|
|
102
|
+
/** Ability/permission name (for can/cannot) */
|
|
103
|
+
ability?: string;
|
|
104
|
+
/** Additional arguments for permission check */
|
|
105
|
+
arguments?: unknown[];
|
|
106
|
+
/** Content inside the auth block */
|
|
107
|
+
content?: string;
|
|
80
108
|
}
|
|
81
109
|
/**
|
|
82
110
|
* Form directive (@csrf, @method, @error, @old)
|
|
83
111
|
*/
|
|
84
|
-
export
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
112
|
+
export interface FormDirective extends BaseDirective {
|
|
113
|
+
kind: 'form';
|
|
114
|
+
/** Specific form type */
|
|
115
|
+
type: 'csrf' | 'method' | 'error' | 'enderror' | 'old';
|
|
116
|
+
/** HTTP method (for @method) */
|
|
117
|
+
method?: 'PUT' | 'PATCH' | 'DELETE';
|
|
118
|
+
/** Field name (for @error, @old) */
|
|
119
|
+
field?: string;
|
|
120
|
+
/** Content inside error block */
|
|
121
|
+
content?: string;
|
|
90
122
|
}
|
|
91
123
|
/**
|
|
92
124
|
* Stack directive (@push, @prepend, @stack)
|
|
93
125
|
*/
|
|
94
|
-
export
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
126
|
+
export interface StackDirective extends BaseDirective {
|
|
127
|
+
kind: 'stack';
|
|
128
|
+
/** Specific stack type */
|
|
129
|
+
type: 'push' | 'endpush' | 'prepend' | 'endprepend' | 'stack';
|
|
130
|
+
/** Stack name */
|
|
131
|
+
name: string;
|
|
132
|
+
/** Content to push/prepend */
|
|
133
|
+
content?: string;
|
|
99
134
|
}
|
|
100
135
|
/**
|
|
101
136
|
* Expression directive ({{ }}, {!! !!})
|
|
102
137
|
*/
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
138
|
+
export interface ExpressionDirective extends BaseDirective {
|
|
139
|
+
kind: 'expression';
|
|
140
|
+
/** Expression type */
|
|
141
|
+
type: 'escaped' | 'raw';
|
|
142
|
+
/** The expression to evaluate */
|
|
143
|
+
expression: string;
|
|
144
|
+
/** Applied filters */
|
|
145
|
+
filters?: Array<{
|
|
146
|
+
name: string;
|
|
147
|
+
args?: unknown[];
|
|
148
|
+
}>;
|
|
111
149
|
}
|
|
112
150
|
/**
|
|
113
151
|
* Switch directive (@switch, @case, @default)
|
|
114
152
|
*/
|
|
115
|
-
export
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
153
|
+
export interface SwitchDirective extends BaseDirective {
|
|
154
|
+
kind: 'switch';
|
|
155
|
+
/** Specific switch type */
|
|
156
|
+
type: 'switch' | 'case' | 'default' | 'break' | 'endswitch';
|
|
157
|
+
/** Switch expression */
|
|
158
|
+
expression?: string;
|
|
159
|
+
/** Case value */
|
|
160
|
+
caseValue?: unknown;
|
|
161
|
+
/** Content */
|
|
162
|
+
content?: string;
|
|
121
163
|
}
|
|
122
164
|
/**
|
|
123
165
|
* SEO directive (@meta, @seo, @og, @twitter, @jsonld)
|
|
124
166
|
*/
|
|
125
|
-
export
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
167
|
+
export interface SeoDirective extends BaseDirective {
|
|
168
|
+
kind: 'seo';
|
|
169
|
+
/** Specific SEO type */
|
|
170
|
+
type: 'meta' | 'seo' | 'og' | 'twitter' | 'jsonld' | 'canonical' | 'robots';
|
|
171
|
+
/** Meta name or property */
|
|
172
|
+
name?: string;
|
|
173
|
+
/** Meta content */
|
|
174
|
+
metaContent?: string;
|
|
175
|
+
/** SEO configuration object */
|
|
176
|
+
config?: Record<string, unknown>;
|
|
131
177
|
}
|
|
132
178
|
/**
|
|
133
179
|
* Accessibility directive (@a11y, @screenReader, @ariaDescribe)
|
|
134
180
|
*/
|
|
135
|
-
export
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
181
|
+
export interface A11yDirective extends BaseDirective {
|
|
182
|
+
kind: 'a11y';
|
|
183
|
+
/** Specific a11y type */
|
|
184
|
+
type: 'screenReader' | 'srOnly' | 'ariaDescribe' | 'a11y';
|
|
185
|
+
/** Screen reader text content */
|
|
186
|
+
text?: string;
|
|
187
|
+
/** Target element selector (for ariaDescribe) */
|
|
188
|
+
target?: string;
|
|
189
|
+
/** Description ID */
|
|
190
|
+
descriptionId?: string;
|
|
141
191
|
}
|
|
142
192
|
/**
|
|
143
193
|
* JavaScript/TypeScript execution directive (@js, @ts)
|
|
144
194
|
*/
|
|
145
|
-
export
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
195
|
+
export interface ScriptDirective extends BaseDirective {
|
|
196
|
+
kind: 'script';
|
|
197
|
+
/** Script type */
|
|
198
|
+
type: 'js' | 'ts';
|
|
199
|
+
/** Script code to execute */
|
|
200
|
+
code: string;
|
|
149
201
|
}
|
|
150
202
|
/**
|
|
151
203
|
* Environment directive (@env, @production, @development)
|
|
152
204
|
*/
|
|
153
|
-
export
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
205
|
+
export interface EnvDirective extends BaseDirective {
|
|
206
|
+
kind: 'env';
|
|
207
|
+
/** Specific env type */
|
|
208
|
+
type: 'env' | 'endenv' | 'production' | 'endproduction' | 'development' | 'enddevelopment';
|
|
209
|
+
/** Environment names to match */
|
|
210
|
+
environments?: string[];
|
|
211
|
+
/** Content */
|
|
212
|
+
content?: string;
|
|
158
213
|
}
|
|
159
214
|
/**
|
|
160
215
|
* i18n directive (@translate, @t, @lang)
|
|
161
216
|
*/
|
|
162
|
-
export
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
217
|
+
export interface I18nDirective extends BaseDirective {
|
|
218
|
+
kind: 'i18n';
|
|
219
|
+
/** Specific i18n type */
|
|
220
|
+
type: 'translate' | 't' | 'lang' | 'endlang' | 'choice';
|
|
221
|
+
/** Translation key */
|
|
222
|
+
key?: string;
|
|
223
|
+
/** Replacement parameters */
|
|
224
|
+
params?: Record<string, unknown>;
|
|
225
|
+
/** Count for pluralization */
|
|
226
|
+
count?: number;
|
|
227
|
+
/** Locale override */
|
|
228
|
+
locale?: string;
|
|
229
|
+
/** Content (for lang blocks) */
|
|
230
|
+
content?: string;
|
|
170
231
|
}
|
|
171
232
|
/**
|
|
172
233
|
* Custom directive (user-defined)
|
|
173
234
|
*/
|
|
174
|
-
export
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
|
|
182
|
-
*/
|
|
183
|
-
export declare interface CustomDirective {
|
|
184
|
-
name: string
|
|
185
|
-
handler: CustomDirectiveHandler
|
|
186
|
-
hasEndTag?: boolean
|
|
187
|
-
description?: string
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Middleware definition
|
|
191
|
-
*/
|
|
192
|
-
export declare interface Middleware {
|
|
193
|
-
name: string
|
|
194
|
-
handler: MiddlewareHandler
|
|
195
|
-
timing: 'before' | 'after'
|
|
196
|
-
description?: string
|
|
235
|
+
export interface UserCustomDirective extends BaseDirective {
|
|
236
|
+
kind: 'custom';
|
|
237
|
+
/** Directive name */
|
|
238
|
+
name: string;
|
|
239
|
+
/** Parameters passed to the directive */
|
|
240
|
+
params: string[];
|
|
241
|
+
/** Content inside the directive (if hasEndTag) */
|
|
242
|
+
content?: string;
|
|
197
243
|
}
|
|
198
244
|
/**
|
|
199
245
|
* Union type of all directive types (discriminated union)
|
|
@@ -219,41 +265,51 @@ export declare interface Middleware {
|
|
|
219
265
|
* }
|
|
220
266
|
* ```
|
|
221
267
|
*/
|
|
222
|
-
export type Directive = |
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
| StackDirective
|
|
230
|
-
| ExpressionDirective
|
|
231
|
-
| SwitchDirective
|
|
232
|
-
| SeoDirective
|
|
233
|
-
| A11yDirective
|
|
234
|
-
| ScriptDirective
|
|
235
|
-
| EnvDirective
|
|
236
|
-
| I18nDirective
|
|
237
|
-
| UserCustomDirective;
|
|
268
|
+
export type Directive = ConditionalDirective | LoopDirective | IncludeDirective | LayoutDirective | ComponentDirective | AuthDirective | FormDirective | StackDirective | ExpressionDirective | SwitchDirective | SeoDirective | A11yDirective | ScriptDirective | EnvDirective | I18nDirective | UserCustomDirective;
|
|
269
|
+
/**
|
|
270
|
+
* Type guard to check if a directive is a specific kind
|
|
271
|
+
*/
|
|
272
|
+
export declare function isDirectiveKind<K extends Directive['kind']>(directive: Directive, kind: K): directive is Extract<Directive, {
|
|
273
|
+
kind: K;
|
|
274
|
+
}>;
|
|
238
275
|
/**
|
|
239
276
|
* Helper type to extract directive by kind
|
|
240
277
|
*/
|
|
241
|
-
export type DirectiveOfKind<K extends Directive['kind']> = Extract<Directive, {
|
|
278
|
+
export type DirectiveOfKind<K extends Directive['kind']> = Extract<Directive, {
|
|
279
|
+
kind: K;
|
|
280
|
+
}>;
|
|
242
281
|
/**
|
|
243
282
|
* Custom directive handler function
|
|
244
283
|
*/
|
|
245
|
-
export type CustomDirectiveHandler = (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
284
|
+
export type CustomDirectiveHandler = (content: string, params: string[], context: Record<string, unknown>, filePath: string) => string | Promise<string>;
|
|
285
|
+
/**
|
|
286
|
+
* Custom directive definition
|
|
287
|
+
*/
|
|
288
|
+
export interface CustomDirective {
|
|
289
|
+
/** The name of the directive without the @ symbol (e.g., 'uppercase') */
|
|
290
|
+
name: string;
|
|
291
|
+
/** Handler function for the directive */
|
|
292
|
+
handler: CustomDirectiveHandler;
|
|
293
|
+
/** Whether the directive has a closing tag (e.g., @directive...@enddirective) */
|
|
294
|
+
hasEndTag?: boolean;
|
|
295
|
+
/** Optional description for documentation */
|
|
296
|
+
description?: string;
|
|
297
|
+
}
|
|
251
298
|
/**
|
|
252
299
|
* Middleware handler function
|
|
253
300
|
*/
|
|
254
|
-
export type MiddlewareHandler = (
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
301
|
+
export type MiddlewareHandler = (template: string, context: Record<string, unknown>, filePath: string, options: import('./config-types').StxOptions) => string | Promise<string>;
|
|
302
|
+
/**
|
|
303
|
+
* Middleware definition
|
|
304
|
+
*/
|
|
305
|
+
export interface Middleware {
|
|
306
|
+
/** Unique name for the middleware */
|
|
307
|
+
name: string;
|
|
308
|
+
/** Handler function for the middleware */
|
|
309
|
+
handler: MiddlewareHandler;
|
|
310
|
+
/** When to run this middleware (before or after directive processing) */
|
|
311
|
+
timing: 'before' | 'after';
|
|
312
|
+
/** Optional description for documentation */
|
|
313
|
+
description?: string;
|
|
314
|
+
}
|
|
315
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,113 +11,10 @@
|
|
|
11
11
|
* // Or import from index (backward compatible)
|
|
12
12
|
* import type { StxConfig } from './types'
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
export type {
|
|
16
|
-
AuthContext,
|
|
17
|
-
BaseTemplateContext,
|
|
18
|
-
ContextValue,
|
|
19
|
-
LoopContext,
|
|
20
|
-
PermissionsContext,
|
|
21
|
-
RequireContextKeys,
|
|
22
|
-
TemplateContext,
|
|
23
|
-
TranslationContext,
|
|
24
|
-
TypedContext,
|
|
25
|
-
} from './context-types';
|
|
26
|
-
// Directive types
|
|
27
|
-
export type {
|
|
28
|
-
A11yDirective,
|
|
29
|
-
AuthDirective,
|
|
30
|
-
ComponentDirective,
|
|
31
|
-
ConditionalDirective,
|
|
32
|
-
CustomDirective,
|
|
33
|
-
CustomDirectiveHandler,
|
|
34
|
-
Directive,
|
|
35
|
-
DirectiveOfKind,
|
|
36
|
-
EnvDirective,
|
|
37
|
-
ExpressionDirective,
|
|
38
|
-
FormDirective,
|
|
39
|
-
I18nDirective,
|
|
40
|
-
IncludeDirective,
|
|
41
|
-
LayoutDirective,
|
|
42
|
-
LoopDirective,
|
|
43
|
-
Middleware,
|
|
44
|
-
MiddlewareHandler,
|
|
45
|
-
ScriptDirective,
|
|
46
|
-
SeoDirective,
|
|
47
|
-
StackDirective,
|
|
48
|
-
SwitchDirective,
|
|
49
|
-
UserCustomDirective,
|
|
50
|
-
} from './directive-types';
|
|
51
|
-
// Component types
|
|
52
|
-
export type {
|
|
53
|
-
ComponentLibraryBuildResult,
|
|
54
|
-
ComponentLibraryComponent,
|
|
55
|
-
ComponentLibraryConfig,
|
|
56
|
-
ComponentLibraryEvent,
|
|
57
|
-
ComponentLibraryProperty,
|
|
58
|
-
ComponentConfig,
|
|
59
|
-
ComponentDefinition,
|
|
60
|
-
ComponentDoc,
|
|
61
|
-
ComponentPropDoc,
|
|
62
|
-
ComponentPropsSchema,
|
|
63
|
-
DirectiveDoc,
|
|
64
|
-
DocFormat,
|
|
65
|
-
DocGeneratorConfig,
|
|
66
|
-
PropDefinition,
|
|
67
|
-
PropType,
|
|
68
|
-
TemplateDoc,
|
|
69
|
-
WebComponent,
|
|
70
|
-
WebComponentConfig,
|
|
71
|
-
} from './component-types';
|
|
72
|
-
// Config types
|
|
73
|
-
export type {
|
|
74
|
-
A11yConfig,
|
|
75
|
-
AnalyticsConfig,
|
|
76
|
-
AnalyticsDriver,
|
|
77
|
-
AnimationConfig,
|
|
78
|
-
FormConfig,
|
|
79
|
-
HydrationConfig,
|
|
80
|
-
I18nConfig,
|
|
81
|
-
Island,
|
|
82
|
-
LoopConfig,
|
|
83
|
-
MarkdownConfig,
|
|
84
|
-
OpenGraphConfig,
|
|
85
|
-
SeoConfig,
|
|
86
|
-
SeoFeatureConfig,
|
|
87
|
-
StreamingConfig,
|
|
88
|
-
StreamRenderer,
|
|
89
|
-
StrictModeConfig,
|
|
90
|
-
StxConfig,
|
|
91
|
-
StxOptions,
|
|
92
|
-
SyntaxHighlightingConfig,
|
|
93
|
-
SyntaxHighlightTheme,
|
|
94
|
-
TwitterConfig,
|
|
95
|
-
} from './config-types';
|
|
96
|
-
// PWA types
|
|
97
|
-
export type {
|
|
98
|
-
PwaBackgroundSyncConfig,
|
|
99
|
-
PwaCacheStorageConfig,
|
|
100
|
-
PwaCacheStrategy,
|
|
101
|
-
PwaConfig,
|
|
102
|
-
PwaFileHandlerConfig,
|
|
103
|
-
PwaIconConfig,
|
|
104
|
-
PwaManifestConfig,
|
|
105
|
-
PwaOfflineConfig,
|
|
106
|
-
PwaPrecacheConfig,
|
|
107
|
-
PwaProtocolHandlerConfig,
|
|
108
|
-
PwaPushConfig,
|
|
109
|
-
PwaRouteCache,
|
|
110
|
-
PwaScreenshot,
|
|
111
|
-
PwaServiceWorkerConfig,
|
|
112
|
-
PwaShareTargetConfig,
|
|
113
|
-
PwaShortcut,
|
|
114
|
-
PwaUpdateConfig,
|
|
115
|
-
} from './pwa-types';
|
|
116
|
-
// CSP types
|
|
117
|
-
export type {
|
|
118
|
-
CspConfig,
|
|
119
|
-
CspDirectives,
|
|
120
|
-
CspPreset,
|
|
121
|
-
CspSourceValue,
|
|
122
|
-
} from './csp-types';
|
|
14
|
+
export type { AuthContext, BaseTemplateContext, ContextValue, LoopContext, PermissionsContext, RequireContextKeys, TemplateContext, TranslationContext, TypedContext, } from './context-types';
|
|
15
|
+
export type { A11yDirective, AuthDirective, ComponentDirective, ConditionalDirective, CustomDirective, CustomDirectiveHandler, Directive, DirectiveOfKind, EnvDirective, ExpressionDirective, FormDirective, I18nDirective, IncludeDirective, LayoutDirective, LoopDirective, Middleware, MiddlewareHandler, ScriptDirective, SeoDirective, StackDirective, SwitchDirective, UserCustomDirective, } from './directive-types';
|
|
123
16
|
export { isDirectiveKind } from './directive-types';
|
|
17
|
+
export type { ComponentLibraryBuildResult, ComponentLibraryComponent, ComponentLibraryConfig, ComponentLibraryEvent, ComponentLibraryProperty, ComponentConfig, ComponentDefinition, ComponentDoc, ComponentPropDoc, ComponentPropsSchema, DirectiveDoc, DocFormat, DocGeneratorConfig, PropDefinition, PropType, TemplateDoc, WebComponent, WebComponentConfig, } from './component-types';
|
|
18
|
+
export type { A11yConfig, AnalyticsConfig, AnalyticsDriver, AnimationConfig, FormConfig, HydrationConfig, I18nConfig, Island, LoopConfig, MarkdownConfig, OpenGraphConfig, SeoConfig, SeoFeatureConfig, StreamingConfig, StreamRenderer, StrictModeConfig, StxConfig, StxOptions, SyntaxHighlightingConfig, SyntaxHighlightTheme, TwitterConfig, } from './config-types';
|
|
19
|
+
export type { PwaBackgroundSyncConfig, PwaCacheStorageConfig, PwaCacheStrategy, PwaConfig, PwaFileHandlerConfig, PwaIconConfig, PwaManifestConfig, PwaOfflineConfig, PwaPrecacheConfig, PwaProtocolHandlerConfig, PwaPushConfig, PwaRouteCache, PwaScreenshot, PwaServiceWorkerConfig, PwaShareTargetConfig, PwaShortcut, PwaUpdateConfig, } from './pwa-types';
|
|
20
|
+
export type { CspConfig, CspDirectives, CspPreset, CspSourceValue, } from './csp-types';
|