@stacksjs/stx 0.2.21 → 0.2.26
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/animation.d.ts +30 -0
- package/dist/builtins/drawer.d.ts +2 -0
- package/dist/builtins/index.d.ts +6 -2
- package/dist/builtins/tooltip.d.ts +18 -0
- package/dist/caching.d.ts +8 -0
- package/dist/cli.js +728 -626
- package/dist/component-renderer.d.ts +1 -18
- package/dist/composables/use-fetch.d.ts +0 -29
- package/dist/composables/use-share.d.ts +4 -0
- package/dist/craft-bridge.d.ts +7 -0
- package/dist/craft-compiler.d.ts +13 -0
- package/dist/craft-components.d.ts +7 -0
- package/dist/craft-ssr.d.ts +13 -0
- package/dist/database.d.ts +1 -0
- package/dist/dev-server/crosswind.d.ts +24 -0
- package/dist/dev-server/types.d.ts +2 -0
- package/dist/devtools.d.ts +36 -0
- package/dist/docs.d.ts +1 -20
- package/dist/forms.d.ts +9 -9
- package/dist/hot-reload.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +666 -564
- package/dist/native-build.d.ts +10 -0
- package/dist/partial-hydration.d.ts +4 -0
- package/dist/public-env.d.ts +15 -0
- package/dist/pwa/workbox.d.ts +8 -0
- package/dist/pwa.js +482 -380
- package/dist/reactive.d.ts +4 -0
- package/dist/ssg.js +508 -406
- package/dist/story/cli.d.ts +10 -10
- package/dist/story/output.d.ts +28 -0
- package/dist/story/ui/code-panel.d.ts +0 -25
- package/dist/streaming.d.ts +60 -0
- package/dist/stx.d.ts +18 -0
- package/dist/testing.d.ts +52 -78
- package/dist/types/config-types.d.ts +6 -0
- package/dist/visual-editor.d.ts +4 -0
- package/package.json +5 -5
- package/stx.d.ts +18 -0
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Unified component processing entry point.
|
|
4
|
-
*
|
|
5
|
-
* Processes all component-related syntax in the template in the correct order:
|
|
6
|
-
* 1. Register builtin components (once)
|
|
7
|
-
* 2. Process `@import` directives
|
|
8
|
-
* 3. Process `@component` directives
|
|
9
|
-
* 4. Process custom element tags (builtins and file-based)
|
|
10
|
-
*
|
|
11
|
-
* @param template - The template string to process
|
|
12
|
-
* @param context - Template variable context
|
|
13
|
-
* @param filePath - Absolute path of the template being processed
|
|
14
|
-
* @param options - Compiler options
|
|
15
|
-
* @param dependencies - Set to track file dependencies for cache invalidation
|
|
16
|
-
* @returns The processed template with all components rendered
|
|
17
|
-
*/
|
|
18
|
-
export declare function processComponents(template: string, context: Record<string, any>, filePath: string, options: StxOptions, dependencies: Set<string>): Promise<string>;
|
|
1
|
+
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reactive fetch with loading/error states
|
|
3
|
-
*/
|
|
4
|
-
export declare function useFetch<T = unknown>(url: string | (() => string), options?: FetchOptions<T>): FetchRef<T>;
|
|
5
|
-
/**
|
|
6
|
-
* Generic async data fetcher
|
|
7
|
-
*/
|
|
8
|
-
export declare function useAsyncData<T>(fetcher: () => Promise<T>, options?: {
|
|
9
|
-
immediate?: boolean
|
|
10
|
-
transform?: (data: T) => T
|
|
11
|
-
default?: T
|
|
12
|
-
key?: string
|
|
13
|
-
cacheTime?: number
|
|
14
|
-
}): FetchRef<T>;
|
|
15
|
-
/**
|
|
16
|
-
* POST request helper
|
|
17
|
-
*/
|
|
18
|
-
export declare function usePost<T = unknown, B = unknown>(url: string, options?: Omit<FetchOptions<T>, 'method' | 'body'>): {
|
|
19
|
-
execute: (body?: B) => Promise<T | null>
|
|
20
|
-
state: FetchRef<T>
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Clear fetch cache
|
|
24
|
-
*/
|
|
25
|
-
export declare function clearFetchCache(key?: string): void;
|
|
26
|
-
/**
|
|
27
|
-
* Prefetch data into cache
|
|
28
|
-
*/
|
|
29
|
-
export declare function prefetch<T>(url: string, options?: FetchOptions<T>): Promise<void>;
|
|
30
1
|
/**
|
|
31
2
|
* useFetch - Reactive data fetching with loading/error states
|
|
32
3
|
*
|
package/dist/craft-bridge.d.ts
CHANGED
|
@@ -296,6 +296,13 @@ else if (data.type === 'event' && data.method) {
|
|
|
296
296
|
})();
|
|
297
297
|
</script>
|
|
298
298
|
`;
|
|
299
|
+
declare const craftBridge: {
|
|
300
|
+
CRAFT_BRIDGE_SCRIPT: string
|
|
301
|
+
generateCraftBridgeScript: typeof generateCraftBridgeScript
|
|
302
|
+
processCraftDirective: typeof processCraftDirective
|
|
303
|
+
injectCraftBridge: typeof injectCraftBridge
|
|
304
|
+
isCraftEnvironment: typeof isCraftEnvironment
|
|
305
|
+
};
|
|
299
306
|
/**
|
|
300
307
|
* Craft Bridge Integration for stx
|
|
301
308
|
*
|
package/dist/craft-compiler.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { CompiledTemplate } from './craft-ssr';
|
|
|
3
3
|
* Compile stx template to native Craft code
|
|
4
4
|
*/
|
|
5
5
|
export declare function compileToNative(template: string | CompiledTemplate, config?: Partial<CompilerConfig>): Promise<CompiledNativeCode>;
|
|
6
|
+
/**
|
|
7
|
+
* Tree shake unused components
|
|
8
|
+
*/
|
|
9
|
+
declare function treeShake(ir: NativeIRNode, _deps: CompilerDependencyNode[]): NativeIRNode;
|
|
6
10
|
/**
|
|
7
11
|
* Create hot reload server
|
|
8
12
|
*/
|
|
@@ -11,6 +15,15 @@ export declare function createHotReloadServer(_config: HotReloadConfig): {
|
|
|
11
15
|
stop: () => Promise<void>
|
|
12
16
|
notifyChange: (path: string) => void
|
|
13
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Default native component definitions
|
|
20
|
+
*/
|
|
21
|
+
declare const NATIVE_COMPONENTS: Map<string, NativeComponentDefinition>;
|
|
22
|
+
declare const craftCompiler: {
|
|
23
|
+
compileToNative: typeof compileToNative
|
|
24
|
+
createHotReloadServer: typeof createHotReloadServer
|
|
25
|
+
NATIVE_COMPONENTS: typeof NATIVE_COMPONENTS
|
|
26
|
+
};
|
|
14
27
|
/**
|
|
15
28
|
* Compiler configuration
|
|
16
29
|
*/
|
|
@@ -370,6 +370,13 @@ export declare const CRAFT_COMPONENT_STYLES: `
|
|
|
370
370
|
}
|
|
371
371
|
</style>
|
|
372
372
|
`;
|
|
373
|
+
declare const craftComponents: {
|
|
374
|
+
CRAFT_COMPONENTS: typeof CRAFT_COMPONENTS
|
|
375
|
+
CRAFT_COMPONENT_STYLES: string
|
|
376
|
+
processCraftComponents: typeof processCraftComponents
|
|
377
|
+
registerCraftComponent: typeof registerCraftComponent
|
|
378
|
+
getCraftComponents: typeof getCraftComponents
|
|
379
|
+
};
|
|
373
380
|
/* eslint-disable prefer-const, style/max-statements-per-line, no-super-linear-backtracking, regexp/no-unused-capturing-group */
|
|
374
381
|
/**
|
|
375
382
|
* Craft Native Components for stx
|
package/dist/craft-ssr.d.ts
CHANGED
|
@@ -39,6 +39,19 @@ export declare function getSSRCacheStats(): {
|
|
|
39
39
|
renderCacheSize: number
|
|
40
40
|
totalEntries: number
|
|
41
41
|
};
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Export
|
|
44
|
+
// ============================================================================
|
|
45
|
+
declare const craftSSR: {
|
|
46
|
+
compileTemplate: typeof compileTemplate
|
|
47
|
+
renderSSR: typeof renderSSR
|
|
48
|
+
generateCraftOptimizations: typeof generateCraftOptimizations
|
|
49
|
+
prerenderForCraft: typeof prerenderForCraft
|
|
50
|
+
clearTemplateCache: typeof clearTemplateCache
|
|
51
|
+
clearRenderCache: typeof clearRenderCache
|
|
52
|
+
clearAllCaches: typeof clearAllCaches
|
|
53
|
+
getSSRCacheStats: typeof getSSRCacheStats
|
|
54
|
+
};
|
|
42
55
|
/**
|
|
43
56
|
* Represents a node in the Craft component tree
|
|
44
57
|
*/
|
package/dist/database.d.ts
CHANGED
|
@@ -149,6 +149,7 @@ export declare function processDatabaseDirectives(template: string, context: Rec
|
|
|
149
149
|
* Get schema builder
|
|
150
150
|
*/
|
|
151
151
|
export declare function schema(): SchemaBuilder;
|
|
152
|
+
declare const queryLog: never[];
|
|
152
153
|
/**
|
|
153
154
|
* Database connection configuration
|
|
154
155
|
*/
|
|
@@ -6,7 +6,31 @@ export declare function loadCrosswind(): Promise<CrosswindModule | null>;
|
|
|
6
6
|
/**
|
|
7
7
|
* Reset the Crosswind module cache (useful for testing)
|
|
8
8
|
*/
|
|
9
|
+
export declare function resetCssCache(): void;
|
|
9
10
|
export declare function resetCrosswindCache(): void;
|
|
11
|
+
/**
|
|
12
|
+
* Load crosswind config from the working directory.
|
|
13
|
+
*
|
|
14
|
+
* Uses `bunfig` for resolution so crosswind configs compose the same way as
|
|
15
|
+
* `stx.config.ts` and other stacks configs — a single source of truth for
|
|
16
|
+
* config loading across the stack.
|
|
17
|
+
*
|
|
18
|
+
* Pre-check: we only hand off to bunfig once we've confirmed a
|
|
19
|
+
* `crosswind.config.*` file actually exists in the target directory. When
|
|
20
|
+
* stx is run from a parent repo root (e.g. running an example from the
|
|
21
|
+
* monorepo root, or a page rendered before the app dir is known) bunfig's
|
|
22
|
+
* built-in search would span 250+ paths up the tree and, on miss, log a
|
|
23
|
+
* large stack-style error dump. The file-existence pre-check keeps the
|
|
24
|
+
* common "no config file" case silent and fast.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Load the user's crosswind config via bunfig — our shared config loader.
|
|
28
|
+
* bunfig's name-based search already covers `config/crosswind.ts`,
|
|
29
|
+
* `.config/crosswind.ts`, and root-level `crosswind.config.{ts,js,mjs,cjs}`,
|
|
30
|
+
* so we don't need to maintain a parallel list of paths here. Returns `null`
|
|
31
|
+
* when no config file is present, so callers can fall through to defaults
|
|
32
|
+
* without surfacing a "not found" warning to the user.
|
|
33
|
+
*/
|
|
10
34
|
export declare function loadCrosswindConfig(cwd: string): Promise<CrosswindConfig | null>;
|
|
11
35
|
/**
|
|
12
36
|
* Build Crosswind CSS using the build() API
|
package/dist/devtools.d.ts
CHANGED
|
@@ -53,6 +53,42 @@ export declare function measurePerformance<T>(name: string, fn: () => T, compone
|
|
|
53
53
|
* Measure async execution time.
|
|
54
54
|
*/
|
|
55
55
|
export declare function measurePerformanceAsync<T>(name: string, fn: () => Promise<T>, componentId?: string): Promise<T>;
|
|
56
|
+
/**
|
|
57
|
+
* Select a component for inspection.
|
|
58
|
+
*/
|
|
59
|
+
declare function selectComponent(id: string): ComponentInfo | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Select a store for inspection.
|
|
62
|
+
*/
|
|
63
|
+
declare function selectStore(id: string): StoreInfo | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Inspect a DOM element to find its component.
|
|
66
|
+
*/
|
|
67
|
+
declare function inspectElement(element: HTMLElement): ComponentInfo | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Highlight a component in the page.
|
|
70
|
+
*/
|
|
71
|
+
declare function highlightComponent(id: string): void;
|
|
72
|
+
/**
|
|
73
|
+
* Clear component highlight.
|
|
74
|
+
*/
|
|
75
|
+
declare function clearHighlight(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Log the component tree to console.
|
|
78
|
+
*/
|
|
79
|
+
declare function logComponentTree(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Log store state to console.
|
|
82
|
+
*/
|
|
83
|
+
declare function logStoreState(storeId?: string): void;
|
|
84
|
+
/**
|
|
85
|
+
* Time travel to a previous store state.
|
|
86
|
+
*/
|
|
87
|
+
declare function timeTravel(historyIndex: number, storeId: string): void;
|
|
88
|
+
// =============================================================================
|
|
89
|
+
// DevTools State
|
|
90
|
+
// =============================================================================
|
|
91
|
+
declare const devToolsState: DevToolsState;
|
|
56
92
|
/* eslint-disable no-console, prefer-const, style/max-statements-per-line */
|
|
57
93
|
/**
|
|
58
94
|
* STX DevTools Integration
|
package/dist/docs.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { ComponentDoc, ComponentPropDoc, DirectiveDoc, DocGeneratorConfig, TemplateDoc } from './types';
|
|
1
|
+
import type { ComponentDoc, ComponentPropDoc, DirectiveDoc, TemplateDoc } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* Extract component properties from a component file
|
|
5
4
|
*/
|
|
@@ -36,21 +35,3 @@ export declare function formatDocsAsMarkdown(componentDocs?: ComponentDoc[], tem
|
|
|
36
35
|
* Format documentation as HTML
|
|
37
36
|
*/
|
|
38
37
|
export declare function formatDocsAsHtml(componentDocs?: ComponentDoc[], templateDocs?: TemplateDoc[], directiveDocs?: DirectiveDoc[], extraContent?: string): string;
|
|
39
|
-
/**
|
|
40
|
-
* Format documentation as JSON
|
|
41
|
-
*/
|
|
42
|
-
export declare function formatDocsAsJson(componentDocs?: ComponentDoc[], templateDocs?: TemplateDoc[], directiveDocs?: DirectiveDoc[], extraContent?: string): string;
|
|
43
|
-
/**
|
|
44
|
-
* Generate documentation
|
|
45
|
-
*/
|
|
46
|
-
export declare function generateDocs(options: {
|
|
47
|
-
componentsDir?: string
|
|
48
|
-
templatesDir?: string
|
|
49
|
-
webComponentsConfig?: any
|
|
50
|
-
customDirectives?: any[]
|
|
51
|
-
config: Partial<DocGeneratorConfig>
|
|
52
|
-
}): Promise<boolean>;
|
|
53
|
-
/**
|
|
54
|
-
* Documentation generation command handler for CLI
|
|
55
|
-
*/
|
|
56
|
-
export declare function docsCommand(options: any): Promise<boolean>;
|
package/dist/forms.d.ts
CHANGED
|
@@ -112,13 +112,13 @@ export declare const defaultFormClasses: FormClassConfig;
|
|
|
112
112
|
* Enhanced validation rules registry with full validation support
|
|
113
113
|
*/
|
|
114
114
|
export declare const enhancedValidationRules: {
|
|
115
|
-
required: { name: 'required'; validate: (value) => unknown; toHtml5: () =>
|
|
116
|
-
email: { name: 'email'; validate: (value) => unknown; toHtml5: () =>
|
|
117
|
-
url: { name: 'url'; validate: (value) => unknown; toHtml5: () =>
|
|
118
|
-
numeric: { name: 'numeric'; validate: (value) => unknown; toHtml5: () =>
|
|
119
|
-
integer: { name: 'integer'; validate: (value) => unknown; toHtml5: () =>
|
|
120
|
-
alpha: { name: 'alpha'; validate: (value) => unknown; toHtml5: () =>
|
|
121
|
-
alphanumeric: { name: 'alphanumeric'; validate: (value) => unknown; toHtml5: () =>
|
|
115
|
+
required: { name: 'required'; validate: (value) => unknown; toHtml5: () => readonly ['required']; message: 'This field is required' };
|
|
116
|
+
email: { name: 'email'; validate: (value) => unknown; toHtml5: () => readonly ['type="email"']; message: 'Please enter a valid email address' };
|
|
117
|
+
url: { name: 'url'; validate: (value) => unknown; toHtml5: () => readonly ['type="url"']; message: 'Please enter a valid URL' };
|
|
118
|
+
numeric: { name: 'numeric'; validate: (value) => unknown; toHtml5: () => readonly ['type="number"']; message: 'Please enter a number' };
|
|
119
|
+
integer: { name: 'integer'; validate: (value) => unknown; toHtml5: () => readonly ['type="number"', 'step="1"']; message: 'Please enter a whole number' };
|
|
120
|
+
alpha: { name: 'alpha'; validate: (value) => unknown; toHtml5: () => readonly ['pattern="[a-zA-Z]+"']; message: 'Please enter only letters' };
|
|
121
|
+
alphanumeric: { name: 'alphanumeric'; validate: (value) => unknown; toHtml5: () => readonly ['pattern="[a-zA-Z0-9]+"']; message: 'Please enter only letters and numbers' };
|
|
122
122
|
min: { name: 'min'; validate: (value, params) => unknown; toHtml5: (params) => readonly [`minlength="${params[0]}"`, `min="${params[0]}"`]; message: 'Must be at least {{param}} characters' };
|
|
123
123
|
max: { name: 'max'; validate: (value, params) => unknown; toHtml5: (params) => readonly [`maxlength="${params[0]}"`, `max="${params[0]}"`]; message: 'Must be no more than {{param}} characters' };
|
|
124
124
|
between: { name: 'between'; validate: (value, params) => unknown; toHtml5: (params) => readonly [`minlength="${params[0]}"`, `maxlength="${params[1]}"`]; message: 'Must be between {{min}} and {{max}}' };
|
|
@@ -126,11 +126,11 @@ export declare const enhancedValidationRules: {
|
|
|
126
126
|
in: { name: 'in'; validate: (value, params) => unknown; message: 'Must be one of: {{values}}' };
|
|
127
127
|
notIn: { name: 'notIn'; validate: (value, params) => unknown; message: 'Must not be: {{values}}' };
|
|
128
128
|
regex: { name: 'regex'; validate: (value, params) => unknown; toHtml5: (params) => readonly [`pattern="${params[0]}"`]; message: 'Invalid format' };
|
|
129
|
-
date: { name: 'date'; validate: (value) => unknown; toHtml5: () =>
|
|
129
|
+
date: { name: 'date'; validate: (value) => unknown; toHtml5: () => readonly ['type="date"']; message: 'Please enter a valid date' };
|
|
130
130
|
before: { name: 'before'; validate: (value, params) => unknown; toHtml5: (params) => readonly [`max="${params[0]}"`]; message: 'Must be before {{date}}' };
|
|
131
131
|
after: { name: 'after'; validate: (value, params) => unknown; toHtml5: (params) => readonly [`min="${params[0]}"`]; message: 'Must be after {{date}}' };
|
|
132
132
|
size: { name: 'size'; validate: (value, params) => unknown; message: 'Must be exactly {{size}}' };
|
|
133
|
-
phone: { name: 'phone'; validate: (value) => unknown; toHtml5: () =>
|
|
133
|
+
phone: { name: 'phone'; validate: (value) => unknown; toHtml5: () => readonly ['type="tel"', 'pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"']; message: 'Please enter a valid phone number' }
|
|
134
134
|
};
|
|
135
135
|
/**
|
|
136
136
|
* Default CSS class names for form elements.
|
package/dist/hot-reload.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Generate the hot reload client script to inject into HTML
|
|
3
3
|
*/
|
|
4
4
|
export declare function generateHotReloadScript(wsPort: number, options?: HotReloadOptions): string;
|
|
5
|
+
/**
|
|
6
|
+
* Inject hot reload script into HTML content
|
|
7
|
+
*/
|
|
8
|
+
export declare function injectHotReload(html: string, wsPort: number, options?: HotReloadOptions): string;
|
|
5
9
|
/**
|
|
6
10
|
* Determine if a file change should trigger a CSS-only update
|
|
7
11
|
*/
|
package/dist/index.d.ts
CHANGED