@stacksjs/stx 0.2.9 → 0.2.11
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/README.md +16 -11
- package/dist/a11y.d.ts +2 -1
- package/dist/analyzer.d.ts +4 -0
- package/dist/app-shell.d.ts +72 -0
- package/dist/app.d.ts +1 -0
- package/dist/broadcasting.d.ts +77 -0
- package/dist/build-assets.d.ts +32 -0
- package/dist/build-mode-detector.d.ts +26 -0
- package/dist/build.d.ts +31 -0
- package/dist/builtins/icon.d.ts +7 -0
- package/dist/builtins/index.d.ts +21 -0
- package/dist/builtins/stx-image.d.ts +2 -0
- package/dist/builtins/stx-link.d.ts +2 -0
- package/dist/builtins/stx-loading-indicator.d.ts +2 -0
- package/dist/bundle-analyzer/index.d.ts +2 -0
- package/dist/bundle-analyzer.js +20 -20
- package/dist/caching.d.ts +27 -0
- package/dist/cli.js +3941 -2609
- package/dist/client-helpers.d.ts +7 -3
- package/dist/client-script-bundler.d.ts +27 -0
- package/dist/client-script.d.ts +5 -1
- package/dist/client.d.ts +1 -0
- package/dist/component-hmr.d.ts +1 -0
- package/dist/component-processing.d.ts +107 -0
- package/dist/component-registry.d.ts +54 -0
- package/dist/component-renderer.d.ts +18 -0
- package/dist/components/StxImage.stx +12 -0
- package/dist/components/StxLink.stx +18 -8
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/use-broadcast-channel.d.ts +1 -0
- package/dist/composables/use-channel.d.ts +67 -0
- package/dist/composables/use-intersection-observer.d.ts +2 -0
- package/dist/composables/use-keyboard.d.ts +1 -0
- package/dist/composables/use-mouse.d.ts +1 -0
- package/dist/composables/use-router.d.ts +4 -0
- package/dist/composables/use-websocket.d.ts +1 -0
- package/dist/composables.d.ts +2 -0
- package/dist/composition-api.d.ts +1 -0
- package/dist/computed.d.ts +1 -0
- package/dist/config.d.ts +12 -1
- package/dist/craft-bridge.d.ts +6 -3
- package/dist/craft-components.d.ts +1 -0
- package/dist/craft.js +39 -33
- package/dist/deploy/index.d.ts +1 -0
- package/dist/dev-server/crosswind.d.ts +2 -5
- package/dist/dev-server/native-window.d.ts +19 -1
- package/dist/dev-server/serve-app.d.ts +15 -0
- package/dist/dev-server/serve-file.d.ts +3 -0
- package/dist/dev-server/serve-markdown.d.ts +3 -0
- package/dist/dev-server/serve-multi.d.ts +5 -0
- package/dist/dev-server/types.d.ts +2 -0
- package/dist/dev-server.d.ts +6 -40
- package/dist/devtools.d.ts +1 -0
- package/dist/directive-api.d.ts +1 -1
- package/dist/document-shell.d.ts +33 -0
- package/dist/error-boundaries.d.ts +1 -0
- package/dist/events.d.ts +1 -0
- package/dist/expressions.d.ts +38 -0
- package/dist/forms-validation.d.ts +2 -0
- package/dist/head.d.ts +1 -0
- package/dist/hot-reload.d.ts +1 -0
- package/dist/hydration-runtime.d.ts +1 -0
- package/dist/hydration.d.ts +1 -0
- package/dist/i18n.d.ts +3 -1
- package/dist/image-optimization/build-plugin.d.ts +1 -0
- package/dist/index.d.ts +22 -1
- package/dist/index.js +5569 -4182
- package/dist/inline-assets.d.ts +28 -0
- package/dist/internal-markdown.d.ts +0 -4
- package/dist/jsx-runtime.d.ts +1 -0
- package/dist/keep-alive.d.ts +1 -0
- package/dist/manifest.d.ts +41 -0
- package/dist/markdown.d.ts +1 -0
- package/dist/media/client/blur-up.d.ts +1 -0
- package/dist/media/client/lazy-load.d.ts +1 -0
- package/dist/media/client/upload-handler.d.ts +1 -0
- package/dist/media/shared/cache.d.ts +2 -0
- package/dist/media/video/index.d.ts +1 -0
- package/dist/media/video/processor/thumbnail.d.ts +1 -0
- package/dist/misc-directives.d.ts +49 -0
- package/dist/parser/directive-parser.d.ts +13 -0
- package/dist/performance-utils.d.ts +2 -0
- package/dist/placeholder.d.ts +45 -0
- package/dist/plugin-system.d.ts +32 -2
- package/dist/process.d.ts +11 -1
- package/dist/production-builder.d.ts +42 -0
- package/dist/production-server.d.ts +19 -0
- package/dist/props.d.ts +1 -0
- package/dist/pwa.js +3883 -2679
- package/dist/reactive.d.ts +2 -16
- package/dist/reactivity.d.ts +1 -0
- package/dist/router.d.ts +1 -1
- package/dist/runtime-injection.d.ts +20 -0
- package/dist/runtime.d.ts +2 -2
- package/dist/script-classifier.d.ts +35 -0
- package/dist/script-validation.d.ts +16 -0
- package/dist/server-bindings.d.ts +7 -0
- package/dist/server-components.d.ts +4 -0
- package/dist/signal-processing.d.ts +109 -0
- package/dist/signals-api.d.ts +309 -0
- package/dist/signals.d.ts +2 -309
- package/dist/spa-shell.d.ts +1 -0
- package/dist/ssg.js +3862 -2655
- package/dist/ssr.d.ts +1 -0
- package/dist/state-management.d.ts +27 -0
- package/dist/store-imports.d.ts +24 -0
- package/dist/store-loader.d.ts +16 -0
- package/dist/story/bun-test.d.ts +1 -0
- package/dist/story/compiled-output.d.ts +1 -0
- package/dist/story/interactions.d.ts +1 -0
- package/dist/story/renderer.d.ts +2 -0
- package/dist/story/setup.d.ts +1 -0
- package/dist/story/ui/code-panel.d.ts +1 -0
- package/dist/stx.d.ts +437 -0
- package/dist/style-scoping.d.ts +23 -0
- package/dist/template-compiler.d.ts +31 -0
- package/dist/template-hydrator.d.ts +18 -0
- package/dist/transitions.d.ts +1 -0
- package/dist/types/config-types.d.ts +62 -0
- package/dist/validator.d.ts +1 -0
- package/dist/variable-extractor.d.ts +1 -1
- package/dist/view-composers.d.ts +1 -0
- package/dist/virtual-scrolling.d.ts +1 -0
- package/dist/visual-testing.js +2 -2
- package/dist/web-components.d.ts +1 -0
- package/dist/x-element.d.ts +1 -0
- package/package.json +72 -7
- package/stx.d.ts +437 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AppHeadConfig } from './types/config-types';
|
|
2
|
+
/**
|
|
3
|
+
* Generate the full HTML document shell wrapping page content.
|
|
4
|
+
*
|
|
5
|
+
* @param content - The rendered page/layout HTML (no document wrapper)
|
|
6
|
+
* @param headConfig - Head configuration from stx.config.ts
|
|
7
|
+
* @param options - Additional options for script/style injection
|
|
8
|
+
* @returns Complete HTML document
|
|
9
|
+
*/
|
|
10
|
+
export declare function generateDocumentShell(content: string, headConfig?: AppHeadConfig, options?: {
|
|
11
|
+
/** Page-specific title (overrides config) */
|
|
12
|
+
title?: string
|
|
13
|
+
/** Extra styles to inject in <head> (e.g. Crosswind CSS, scoped styles) */
|
|
14
|
+
styles?: string[]
|
|
15
|
+
/** Extra scripts to inject before </body> (e.g. signals runtime, router) */
|
|
16
|
+
bodyScripts?: string[]
|
|
17
|
+
/** Extra scripts/tags for <head> */
|
|
18
|
+
headScripts?: string[]
|
|
19
|
+
/** Stacks to inject (from @push directives) */
|
|
20
|
+
headStack?: string
|
|
21
|
+
bodyStack?: string
|
|
22
|
+
}): string;
|
|
23
|
+
/**
|
|
24
|
+
* Check if HTML already has a document shell (<!DOCTYPE> or <html>).
|
|
25
|
+
* Templates that extend layouts with document shells should not be double-wrapped.
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasDocumentShell(html: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Wrap HTML in a document shell if it doesn't already have one.
|
|
30
|
+
* This is the main entry point — called at the top level after all
|
|
31
|
+
* directive processing is complete.
|
|
32
|
+
*/
|
|
33
|
+
export declare function ensureDocumentShell(html: string, headConfig?: AppHeadConfig, options?: Parameters<typeof generateDocumentShell>[2]): string;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* Or with options:
|
|
12
12
|
* @errorBoundary(id: 'my-boundary', logErrors: false)
|
|
13
13
|
*/
|
|
14
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
14
15
|
export declare function processErrorBoundaryDirectives(template: string, context?: Record<string, unknown>, _filePath?: string): string;
|
|
15
16
|
/**
|
|
16
17
|
* Wrap content in a try/catch for SSR error handling.
|
package/dist/events.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare function processEventDirectives(template: string, context: Record
|
|
|
33
33
|
* Check if a template contains event directives
|
|
34
34
|
*/
|
|
35
35
|
export declare function hasEventDirectives(template: string): boolean;
|
|
36
|
+
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
36
37
|
/**
|
|
37
38
|
* Event Directives Module
|
|
38
39
|
*
|
package/dist/expressions.d.ts
CHANGED
|
@@ -46,6 +46,37 @@ export declare function escapeHtml(unsafe: string): string;
|
|
|
46
46
|
* or has reactive attributes (@if, @for) with function call expressions
|
|
47
47
|
*/
|
|
48
48
|
export declare function usesSignalsInScript(template: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Interpolate server-side `{{ expr }}` / `{!! expr !!}` expressions inside a
|
|
51
|
+
* `<script>` body, using the same evaluator as the main template.
|
|
52
|
+
*
|
|
53
|
+
* This makes server data available to client scripts without manual data-island
|
|
54
|
+
* plumbing — write `const PRICE = {{ car.price }}` and get `const PRICE = 42`.
|
|
55
|
+
*
|
|
56
|
+
* JavaScript-aware rules (different from HTML `{{ }}`):
|
|
57
|
+
* - `{{ expr }}` → `JSON.stringify(value)`. Strings become valid JS string
|
|
58
|
+
* literals, numbers/booleans pass through, objects/arrays become JSON
|
|
59
|
+
* literals. Safe to drop into any JS expression position.
|
|
60
|
+
* - `{!! expr !!}` → raw `String(value)`. Use when you want the value spliced
|
|
61
|
+
* verbatim (e.g. you've already serialized it yourself).
|
|
62
|
+
* - Expressions that fail to evaluate (reference a client-only signal, a
|
|
63
|
+
* loop variable, or anything not in context) are left **untouched** so the
|
|
64
|
+
* client runtime can process them later. This mirrors the "preserve for
|
|
65
|
+
* client" semantics of the main expression processor when signals are in use.
|
|
66
|
+
*
|
|
67
|
+
* Only the content strictly between `<script>` and `</script>` is touched —
|
|
68
|
+
* attributes and surrounding HTML are left alone.
|
|
69
|
+
*/
|
|
70
|
+
export declare function interpolateScriptExpressions(scriptBody: string, context: Record<string, any>): string;
|
|
71
|
+
/**
|
|
72
|
+
* Interpolate server expressions inside every `<script>` tag in a template,
|
|
73
|
+
* skipping any script that opts out via `data-raw`, `type="application/json"`,
|
|
74
|
+
* or a `src=` attribute (external scripts don't have inline content to template).
|
|
75
|
+
*
|
|
76
|
+
* Each matched script has its body passed through {@link interpolateScriptExpressions}.
|
|
77
|
+
* Attributes and tag structure are never modified.
|
|
78
|
+
*/
|
|
79
|
+
export declare function interpolateScriptsInTemplate(template: string, context: Record<string, any>, options?: InterpolateScriptsOptions): string;
|
|
49
80
|
/**
|
|
50
81
|
* Process template expressions including variables, filters, and operations
|
|
51
82
|
*/
|
|
@@ -96,8 +127,15 @@ export declare const defaultFilters: {
|
|
|
96
127
|
abs: (value: any, _context: Record<string, any>) => unknown;
|
|
97
128
|
round: (value: any, _context: Record<string, any>, decimals?: number) => unknown
|
|
98
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Options for {@link interpolateScriptsInTemplate}.
|
|
132
|
+
*/
|
|
133
|
+
export declare interface InterpolateScriptsOptions {
|
|
134
|
+
skipServer?: boolean
|
|
135
|
+
}
|
|
99
136
|
/**
|
|
100
137
|
* Add basic filter support to expressions
|
|
101
138
|
* Filter functions receive the value to transform, optional args, and the context object
|
|
102
139
|
*/
|
|
140
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
103
141
|
export type FilterFunction = (value: any, context: Record<string, any>, ...args: any[]) => any;
|
|
@@ -125,7 +125,9 @@ declare interface FormState<T extends Record<string, Validator>> {
|
|
|
125
125
|
// =============================================================================
|
|
126
126
|
// Types
|
|
127
127
|
// =============================================================================
|
|
128
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
128
129
|
declare type ValidatorFn = (value: unknown, formValues?: Record<string, unknown>) => true | string;
|
|
130
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
129
131
|
declare type AsyncValidatorFn = (value: unknown, formValues?: Record<string, unknown>) => Promise<true | string>;
|
|
130
132
|
// =============================================================================
|
|
131
133
|
// Validator Class
|
package/dist/head.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export declare function processTitleDirective(content: string, context: Record<s
|
|
|
117
117
|
* ```
|
|
118
118
|
*/
|
|
119
119
|
export declare function processMetaDirective(content: string, context: Record<string, unknown>): string;
|
|
120
|
+
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
120
121
|
/**
|
|
121
122
|
* STX Head Management
|
|
122
123
|
*
|
package/dist/hot-reload.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare function getHmrServer(options?: HotReloadOptions): HotReloadServe
|
|
|
22
22
|
* Stop and clear the global HMR server
|
|
23
23
|
*/
|
|
24
24
|
export declare function stopHmrServer(): void;
|
|
25
|
+
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
25
26
|
/**
|
|
26
27
|
* Hot Reload Module
|
|
27
28
|
*
|
|
@@ -22,6 +22,7 @@ export declare function extractComponentName(content: string): string | null;
|
|
|
22
22
|
* Parses :prop="value" bindings.
|
|
23
23
|
*/
|
|
24
24
|
export declare function extractBoundProps(content: string, context: Record<string, unknown>): Record<string, unknown>;
|
|
25
|
+
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
25
26
|
/**
|
|
26
27
|
* Unified Hydration Runtime for Islands Architecture
|
|
27
28
|
*
|
package/dist/hydration.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare function hydrate(options?: HydrationOptions): Promise<void>;
|
|
|
31
31
|
* Generate hydration CSS
|
|
32
32
|
*/
|
|
33
33
|
export declare function generateHydrationCSS(): string;
|
|
34
|
+
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
34
35
|
/**
|
|
35
36
|
* STX Hydration Runtime
|
|
36
37
|
*
|
package/dist/i18n.d.ts
CHANGED
|
@@ -103,7 +103,8 @@ export declare function loadTranslationLazy(locale: string, options: StxOptions)
|
|
|
103
103
|
* const translations = getTranslationSync('en')
|
|
104
104
|
* if (translations) {
|
|
105
105
|
* // Use translations
|
|
106
|
-
* }
|
|
106
|
+
* }
|
|
107
|
+
else {
|
|
107
108
|
* // Show loading state or fallback
|
|
108
109
|
* loadTranslationLazy('en', options).then(handleLoaded)
|
|
109
110
|
* }
|
|
@@ -220,6 +221,7 @@ export declare function getTranslation(key: string, translations: Record<string,
|
|
|
220
221
|
/**
|
|
221
222
|
* Process @translate directive
|
|
222
223
|
*/
|
|
224
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
223
225
|
export declare function processTranslateDirective(template: string, context: Record<string, any>, filePath: string, options: StxOptions): Promise<string>;
|
|
224
226
|
/**
|
|
225
227
|
* Create a translation filter for expressions
|
|
@@ -10,6 +10,7 @@ export declare function createImagePlugin(options?: ImageBuildOptions): BuildPlu
|
|
|
10
10
|
export declare function optimizeImage(inputPath: string, outputDir: string, options?: ImageOptions): Promise<ProcessedImage>;
|
|
11
11
|
/**
|
|
12
12
|
* Optimize all images in a directory
|
|
13
|
+
// eslint-disable-next-line pickier/no-unused-vars
|
|
13
14
|
*/
|
|
14
15
|
export declare function optimizeDirectory(inputDir: string, outputDir: string, options?: ImageBuildOptions): Promise<{
|
|
15
16
|
processed: ProcessedImage[]
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
/// <reference path="./stx.d.ts" />
|
|
2
|
+
export type { Store, StoreOptions, PersistOptions, DefineStoreOptions } from './state-management';
|
|
1
3
|
export type { StxComponentInstance, EmitFn } from './composition-api';
|
|
2
4
|
export type { VNode } from './jsx-runtime';
|
|
3
5
|
export type { StxApp, StxApp as App, StxAppPlugin, StxPluginInput, StxAppConfig } from './app';
|
|
6
|
+
export type { StxPlugin, PluginContext, PluginSetupContext } from './plugin-system';
|
|
4
7
|
// ============================================================
|
|
5
8
|
// STX Core Exports
|
|
6
9
|
// Note: Some modules have overlapping exports. If you need specific
|
|
@@ -32,9 +35,14 @@ export * from './analytics';
|
|
|
32
35
|
export * from './analyzer';
|
|
33
36
|
export * from './animation';
|
|
34
37
|
export * from './assets';
|
|
38
|
+
export * from './app-shell';
|
|
35
39
|
export * from './async-components';
|
|
36
40
|
export * from './auth';
|
|
41
|
+
export * from './build';
|
|
42
|
+
export * from './build-assets';
|
|
43
|
+
export * from './build-mode-detector';
|
|
37
44
|
export * from './build-optimizer';
|
|
45
|
+
export * from './broadcasting';
|
|
38
46
|
export * from './caching';
|
|
39
47
|
export * from './components';
|
|
40
48
|
export * from './config';
|
|
@@ -46,6 +54,7 @@ export * from './custom-directives';
|
|
|
46
54
|
export * from './defer';
|
|
47
55
|
export * from './deploy';
|
|
48
56
|
export * from './dev-server';
|
|
57
|
+
export * from './document-shell';
|
|
49
58
|
export * from './directive-api';
|
|
50
59
|
export * from './docs';
|
|
51
60
|
export * from './edge-runtime';
|
|
@@ -64,13 +73,21 @@ export * from './loops';
|
|
|
64
73
|
export * from './markdown';
|
|
65
74
|
export * from './middleware';
|
|
66
75
|
export * from './parser';
|
|
76
|
+
export * from './manifest';
|
|
77
|
+
export * from './placeholder';
|
|
67
78
|
export * from './process';
|
|
68
79
|
export * from './production-build';
|
|
80
|
+
export * from './production-builder';
|
|
81
|
+
export * from './production-server';
|
|
69
82
|
export * from './release';
|
|
70
83
|
export * from './router';
|
|
71
84
|
export * from './scaffolding';
|
|
85
|
+
export * from './script-classifier';
|
|
72
86
|
export * from './seo';
|
|
73
87
|
export * from './serve';
|
|
88
|
+
export * from './style-scoping';
|
|
89
|
+
export * from './template-compiler';
|
|
90
|
+
export * from './template-hydrator';
|
|
74
91
|
export * from './streaming';
|
|
75
92
|
export * from './suspense';
|
|
76
93
|
export * from './teleport';
|
|
@@ -89,6 +106,8 @@ export * from './component-hmr';
|
|
|
89
106
|
export * from './hydration';
|
|
90
107
|
// ssg moved to stx/ssg
|
|
91
108
|
export * from './ssr';
|
|
109
|
+
// State management — explicit exports to avoid conflicts with runtime.ts and reactivity.ts
|
|
110
|
+
export { defineStore, useStore, createStore, getStore, getStoreNames, hasStore } from './state-management';
|
|
92
111
|
// visual-testing moved to stx/visual-testing
|
|
93
112
|
export * from './image-optimization';
|
|
94
113
|
export * from './media';
|
|
@@ -96,12 +115,14 @@ export * from './media';
|
|
|
96
115
|
export * from './build-views';
|
|
97
116
|
export * from './signals';
|
|
98
117
|
export * from './spa-shell';
|
|
99
|
-
// Vue compatibility and JSX support
|
|
118
|
+
// Vue compatibility, server bindings, and JSX support
|
|
100
119
|
export * from './vue-template';
|
|
120
|
+
export { processServerBindings } from './server-bindings';
|
|
101
121
|
export { provide, inject, setGlobalProvide, defineEmits, defineExpose, nextTick, onErrorCaptured, handleError, useSlots, useAttrs, createProvideContext, generateCompositionRuntime } from './composition-api';
|
|
102
122
|
export { jsx, jsxs, jsxDEV, Fragment, renderToString, renderToStream, renderToDOM, Show, For, Portal, h } from './jsx-runtime';
|
|
103
123
|
export { createApp, createApp as createStxApp, defineCustomElement } from './app';
|
|
104
124
|
export * from './dynamic-components';
|
|
125
|
+
export { definePlugin, pluginManager } from './plugin-system';
|
|
105
126
|
// These modules are exported first to establish their types
|
|
106
127
|
export * from './render';
|
|
107
128
|
export { generateCrosswindCSS, injectCrosswindCSS, extractClassNames } from './dev-server/crosswind';
|