@stacksjs/stx 0.2.154 → 0.2.156
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a11y.d.ts +87 -46
- package/dist/animation.d.ts +96 -42
- package/dist/appearance-bootstrap.d.ts +49 -15
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +9 -7
- package/dist/async-components.d.ts +78 -56
- package/dist/auth.d.ts +3 -0
- package/dist/build-externalize.d.ts +40 -0
- package/dist/build-externalize.js +63 -0
- package/dist/build-id.d.ts +22 -22
- package/dist/build-message.d.ts +73 -2
- package/dist/build-message.js +47 -8
- package/dist/builtins/attrs.d.ts +14 -0
- package/dist/builtins/drawer.d.ts +22 -0
- package/dist/builtins/icon.d.ts +16 -2
- package/dist/builtins/index.d.ts +5 -15
- package/dist/builtins/modal.d.ts +24 -0
- package/dist/builtins/safe-image.d.ts +42 -0
- package/dist/builtins/stx-image.d.ts +27 -0
- package/dist/builtins/stx-link.d.ts +9 -0
- package/dist/builtins/stx-loading-indicator.d.ts +11 -0
- package/dist/builtins/suspense.d.ts +28 -0
- package/dist/builtins/toast.d.ts +17 -0
- package/dist/builtins/transition-group.d.ts +25 -0
- package/dist/caching.d.ts +12 -15
- package/dist/cli.js +1798 -908
- package/dist/client/directive.d.ts +7 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client-script-bundler.d.ts +63 -5
- package/dist/client-script-bundler.js +30 -2
- package/dist/client-script.d.ts +102 -47
- package/dist/client-script.js +15 -3
- package/dist/codemod.d.ts +56 -0
- package/dist/codemod.js +192 -0
- package/dist/color-mode-boot.d.ts +83 -65
- package/dist/component-client-factories.d.ts +1 -6
- package/dist/component-processing.d.ts +58 -49
- package/dist/component-processing.js +1 -1
- package/dist/component-registry.d.ts +94 -31
- package/dist/component-renderer.d.ts +18 -0
- package/dist/composable-loader.d.ts +24 -0
- package/dist/composable-loader.js +12 -9
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.js +30 -2
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables.d.ts +64 -60
- package/dist/computed.d.ts +86 -92
- package/dist/conditionals.d.ts +24 -8
- package/dist/conditionals.js +16 -0
- package/dist/config.d.ts +34 -21
- package/dist/config.js +35 -14
- package/dist/craft.js +1476 -768
- package/dist/crosswind-config.d.ts +58 -0
- package/dist/crosswind-config.js +40 -0
- package/dist/csp.d.ts +107 -41
- package/dist/defer.d.ts +24 -0
- package/dist/dev-server/crosswind.d.ts +35 -26
- package/dist/dev-server/crosswind.js +2 -18
- package/dist/dev-server/serve-app.js +4 -3
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/directive-api.d.ts +86 -43
- package/dist/document-shell.d.ts +54 -41
- package/dist/dynamic-components.d.ts +9 -0
- package/dist/error-boundaries.d.ts +47 -41
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +51 -43
- package/dist/errors/formatter.d.ts +58 -38
- package/dist/errors/index.d.ts +5 -61
- package/dist/errors/logger.d.ts +114 -40
- package/dist/errors/sanitizer.d.ts +53 -23
- package/dist/errors/types.d.ts +44 -31
- package/dist/events.d.ts +86 -25
- package/dist/expressions.d.ts +50 -42
- package/dist/forms-validation.d.ts +138 -123
- package/dist/forms-validation.js +1 -90
- package/dist/forms.d.ts +120 -66
- package/dist/forms.js +31 -11
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +109 -0
- package/dist/framework-composables.d.ts +32 -0
- package/dist/head.d.ts +156 -114
- package/dist/heatmap.d.ts +152 -72
- package/dist/html-masking.d.ts +40 -34
- package/dist/hydration-runtime.d.ts +20 -24
- package/dist/i18n.d.ts +93 -32
- package/dist/image-optimization/auto-sibling.d.ts +32 -4
- package/dist/includes.d.ts +69 -7
- package/dist/index.d.ts +66 -0
- package/dist/index.js +23 -0
- package/dist/internal-markdown.d.ts +12 -8
- package/dist/island-chunking.d.ts +30 -13
- package/dist/keep-alive.d.ts +72 -52
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-module.d.ts +10 -0
- package/dist/loops.d.ts +66 -0
- package/dist/loops.js +47 -6
- package/dist/markdown.d.ts +0 -1
- package/dist/media/image/component.d.ts +25 -9
- package/dist/media/image/directive.d.ts +15 -1
- package/dist/media/image/placeholder.d.ts +20 -9
- package/dist/media/image/processor/cache.d.ts +40 -18
- package/dist/media/image/processor/index.d.ts +1 -10
- package/dist/media/image/processor/optimizer.d.ts +12 -1
- package/dist/media/image/processor/responsive.d.ts +16 -6
- package/dist/media/image/srcset.d.ts +47 -50
- package/dist/media/shared/cache.d.ts +51 -31
- package/dist/media/shared/hash.d.ts +7 -0
- package/dist/media/types.d.ts +1235 -754
- package/dist/media/video/directive.d.ts +15 -1
- package/dist/media/video/index.d.ts +39 -17
- package/dist/media/video/processor/cache.d.ts +42 -19
- package/dist/media/video/processor/index.d.ts +1 -18
- package/dist/media/video/processor/streaming.d.ts +17 -10
- package/dist/media/video/processor/thumbnail.d.ts +21 -15
- package/dist/media/video/processor/transcoder.d.ts +11 -1
- package/dist/method-spoofing.d.ts +7 -0
- package/dist/middleware.d.ts +60 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/parser/directive-parser.d.ts +57 -45
- package/dist/parser/expression-parser.d.ts +33 -35
- package/dist/parser/index.d.ts +4 -39
- package/dist/parser/tokenizer.d.ts +61 -49
- package/dist/partial-hydration.d.ts +82 -50
- package/dist/performance-utils.d.ts +217 -124
- package/dist/placeholder.d.ts +18 -9
- package/dist/plugin-system.d.ts +264 -115
- package/dist/process.d.ts +11 -6
- package/dist/process.js +21 -4
- package/dist/production-builder.js +7 -0
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +14 -0
- package/dist/pwa/directives.d.ts +12 -3
- package/dist/pwa/inject.d.ts +10 -0
- package/dist/pwa/precache.d.ts +22 -16
- package/dist/pwa/service-worker.d.ts +12 -0
- package/dist/pwa.js +1318 -610
- package/dist/reactive-bindings.d.ts +34 -11
- package/dist/reactive.d.ts +58 -30
- package/dist/reactive.js +56 -31
- package/dist/render.js +1 -0
- package/dist/route-middleware.d.ts +2 -35
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +5 -7
- package/dist/routes.d.ts +1 -3
- package/dist/runtime-globals.d.ts +147 -24
- package/dist/runtime-globals.js +16 -1
- package/dist/runtime-injection.d.ts +8 -0
- package/dist/runtime-injection.js +33 -24
- package/dist/script-emit.d.ts +30 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +21 -4
- package/dist/seo.d.ts +118 -47
- package/dist/server-bindings.d.ts +21 -0
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +35 -15
- package/dist/signals-api.d.ts +117 -58
- package/dist/signals-api.js +7 -4
- package/dist/signals.d.ts +24 -17
- package/dist/signals.js +765 -60
- package/dist/site-builder/build.js +8 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +86 -20
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/ssg.d.ts +285 -142
- package/dist/ssg.js +1268 -556
- package/dist/state-dir.d.ts +4 -4
- package/dist/state-management.d.ts +0 -12
- package/dist/state-management.js +8 -25
- package/dist/store-imports.d.ts +23 -0
- package/dist/store-imports.js +3 -0
- package/dist/store-loader.d.ts +10 -0
- package/dist/store-loader.js +10 -9
- package/dist/story/analytics.d.ts +138 -60
- package/dist/story/bookmarks.d.ts +87 -34
- package/dist/story/cli.d.ts +123 -69
- package/dist/story/collect/scanner.d.ts +4 -0
- package/dist/story/collect/tree.d.ts +8 -1
- package/dist/story/commands/build.d.ts +11 -6
- package/dist/story/commands/dev.d.ts +15 -8
- package/dist/story/commands/preview.d.ts +13 -7
- package/dist/story/config-watcher.d.ts +20 -13
- package/dist/story/config.d.ts +11 -8
- package/dist/story/context.d.ts +14 -8
- package/dist/story/hmr.d.ts +24 -26
- package/dist/story/hot-swap.d.ts +34 -23
- package/dist/story/keyboard-shortcuts.d.ts +23 -18
- package/dist/story/output.d.ts +46 -44
- package/dist/story/performance.d.ts +107 -45
- package/dist/story/presets.d.ts +107 -41
- package/dist/story/renderer.d.ts +41 -27
- package/dist/story/search.d.ts +23 -12
- package/dist/story/server.d.ts +21 -11
- package/dist/story/setup.d.ts +23 -15
- package/dist/story/testing.d.ts +65 -40
- package/dist/story/types.d.ts +262 -160
- package/dist/streaming.d.ts +119 -57
- package/dist/stx-virtual-ts.d.ts +165 -0
- package/dist/stx-virtual-ts.js +372 -0
- package/dist/stx.d.ts +78 -1
- package/dist/style-scoping.d.ts +17 -4
- package/dist/suspense.d.ts +67 -52
- package/dist/teleport.d.ts +22 -0
- package/dist/template-tag-balance.d.ts +22 -6
- package/dist/transitions.d.ts +66 -55
- package/dist/typecheck.d.ts +77 -0
- package/dist/typecheck.js +156 -0
- package/dist/types/component-types.d.ts +187 -122
- package/dist/types/config-types.d.ts +758 -297
- package/dist/types/context-types.d.ts +46 -24
- package/dist/types/csp-types.d.ts +70 -66
- package/dist/types/directive-types.d.ts +211 -155
- package/dist/types/index.d.ts +6 -109
- package/dist/types/pwa-types.d.ts +273 -148
- package/dist/types.d.ts +0 -1
- package/dist/typescript-templates.d.ts +11 -0
- package/dist/unresolved-identifiers.d.ts +24 -22
- package/dist/unresolved-identifiers.js +2 -0
- package/dist/utils.d.ts +24 -21
- package/dist/validator.d.ts +28 -26
- package/dist/variable-extractor.d.ts +48 -13
- package/dist/variable-extractor.js +27 -4
- package/dist/view-composers.d.ts +80 -81
- package/dist/virtual-scrolling.d.ts +101 -81
- package/dist/vue-template.d.ts +23 -0
- package/dist/web-components/css-scoping.d.ts +21 -11
- package/dist/web-components.d.ts +81 -58
- package/dist/x-element.d.ts +0 -1
- package/package.json +5 -5
- package/stx.d.ts +78 -1
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STX Media - Video Directive
|
|
3
|
+
*
|
|
4
|
+
* @video directive for declarative video rendering with ts-videos integration.
|
|
5
|
+
*
|
|
6
|
+
* @module media/video/directive
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```html
|
|
10
|
+
* @video('/videos/intro.mp4', { controls: true, lazy: true })
|
|
11
|
+
* @video('/videos/movie.mp4', { quality: 'high', generatePoster: true })
|
|
12
|
+
* @video(dynamicSrc, { streaming: { format: 'hls' } })
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
1
15
|
import type { CustomDirective } from '../../types';
|
|
2
16
|
/**
|
|
3
17
|
* Create the @video directive
|
|
@@ -6,4 +20,4 @@ export declare function createVideoDirective(): CustomDirective;
|
|
|
6
20
|
/**
|
|
7
21
|
* The @video directive instance
|
|
8
22
|
*/
|
|
9
|
-
export declare const videoDirective:
|
|
23
|
+
export declare const videoDirective: CustomDirective;
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STX Media - Video Module
|
|
3
|
+
*
|
|
4
|
+
* Video playback with native HTML5 and ts-video-player integration.
|
|
5
|
+
*
|
|
6
|
+
* This module provides a <Video> component that integrates with the
|
|
7
|
+
* ts-video-player library for advanced playback features including:
|
|
8
|
+
* - HLS/DASH streaming support
|
|
9
|
+
* - YouTube/Vimeo embeds with custom controls
|
|
10
|
+
* - Keyboard shortcuts
|
|
11
|
+
* - Picture-in-Picture
|
|
12
|
+
* - Full accessibility support
|
|
13
|
+
*
|
|
14
|
+
* With ts-videos integration:
|
|
15
|
+
* - Video transcoding with quality presets
|
|
16
|
+
* - Automatic poster/thumbnail generation
|
|
17
|
+
* - HLS/DASH streaming manifest generation
|
|
18
|
+
* - Sprite sheet generation for scrubbing preview
|
|
19
|
+
*
|
|
20
|
+
* @module media/video
|
|
21
|
+
*/
|
|
1
22
|
import type { VideoProps, VideoRenderResult, EnhancedVideoProps, TsVideosConfig, ProcessedVideoResult } from '../types';
|
|
23
|
+
/**
|
|
24
|
+
* Extended video render context with ts-videos config
|
|
25
|
+
*/
|
|
26
|
+
export interface ExtendedVideoRenderContext {
|
|
27
|
+
/** Development mode */
|
|
28
|
+
isDev?: boolean;
|
|
29
|
+
/** ts-videos configuration */
|
|
30
|
+
tsVideosConfig?: TsVideosConfig;
|
|
31
|
+
/** Pre-processed video result */
|
|
32
|
+
processedResult?: ProcessedVideoResult;
|
|
33
|
+
}
|
|
2
34
|
/**
|
|
3
35
|
* Render a video component
|
|
4
36
|
*
|
|
@@ -31,24 +63,14 @@ import type { VideoProps, VideoRenderResult, EnhancedVideoProps, TsVideosConfig,
|
|
|
31
63
|
* }, { tsVideosConfig: { enabled: true, outputDir: 'dist/videos' } })
|
|
32
64
|
* ```
|
|
33
65
|
*/
|
|
34
|
-
export declare function renderVideoComponent(props: VideoProps | EnhancedVideoProps, context?: {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
39
|
-
export declare function parseVideoDirectiveOptions(content: string, params: Record<string, unknown>, context: Record<string, unknown>): VideoProps;
|
|
40
|
-
/**
|
|
41
|
-
* Extended video render context with ts-videos config
|
|
42
|
-
*/
|
|
43
|
-
export declare interface ExtendedVideoRenderContext {
|
|
44
|
-
isDev?: boolean
|
|
45
|
-
tsVideosConfig?: TsVideosConfig
|
|
46
|
-
processedResult?: ProcessedVideoResult
|
|
47
|
-
}
|
|
66
|
+
export declare function renderVideoComponent(props: VideoProps | EnhancedVideoProps, context?: {
|
|
67
|
+
isDev?: boolean;
|
|
68
|
+
} | ExtendedVideoRenderContext): Promise<VideoRenderResult>;
|
|
48
69
|
/**
|
|
49
70
|
* Parse @video directive options
|
|
50
71
|
*/
|
|
51
|
-
// =============================================================================
|
|
52
|
-
// Directive Exports
|
|
53
|
-
// =============================================================================
|
|
54
72
|
export { createVideoDirective, videoDirective } from './directive';
|
|
73
|
+
/**
|
|
74
|
+
* Parse @video directive options (legacy - use videoDirective instead)
|
|
75
|
+
*/
|
|
76
|
+
export declare function parseVideoDirectiveOptions(content: string, params: Record<string, unknown>, context: Record<string, unknown>): VideoProps;
|
|
@@ -1,5 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* STX Media - Video Processing Cache
|
|
3
|
+
*
|
|
4
|
+
* Specialized cache for video processing results.
|
|
5
|
+
*
|
|
6
|
+
* @module media/video/processor/cache
|
|
7
|
+
*/
|
|
2
8
|
import type { EnhancedVideoProps, ProcessedVideoResult, TsVideosConfig } from '../../types';
|
|
9
|
+
import { type CacheConfig } from '../../shared/cache';
|
|
10
|
+
/**
|
|
11
|
+
* Video processor cache configuration
|
|
12
|
+
*/
|
|
13
|
+
export interface VideoCacheConfig extends CacheConfig {
|
|
14
|
+
/** Cache transcoded videos */
|
|
15
|
+
cacheTranscoded?: boolean;
|
|
16
|
+
/** Cache thumbnails separately */
|
|
17
|
+
cacheThumbnails?: boolean;
|
|
18
|
+
/** Cache streaming manifests */
|
|
19
|
+
cacheManifests?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Video processor cache class
|
|
23
|
+
*/
|
|
24
|
+
export declare class VideoProcessorCache {
|
|
25
|
+
private config;
|
|
26
|
+
constructor(config?: Partial<VideoCacheConfig>);
|
|
27
|
+
/**
|
|
28
|
+
* Get cached processing result
|
|
29
|
+
*/
|
|
30
|
+
get(src: string, options: Partial<EnhancedVideoProps>): Promise<ProcessedVideoResult | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Set cached processing result
|
|
33
|
+
*/
|
|
34
|
+
set(src: string, options: Partial<EnhancedVideoProps>, result: ProcessedVideoResult): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Clear the entire video cache
|
|
37
|
+
*/
|
|
38
|
+
clear(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Update cache configuration
|
|
41
|
+
*/
|
|
42
|
+
updateConfig(config: Partial<VideoCacheConfig>): void;
|
|
43
|
+
}
|
|
3
44
|
/**
|
|
4
45
|
* Get cached video processing result
|
|
5
46
|
*/
|
|
@@ -12,21 +53,3 @@ export declare function setCachedVideoResult(src: string, options: Partial<Enhan
|
|
|
12
53
|
* Clear video processing cache
|
|
13
54
|
*/
|
|
14
55
|
export declare function clearVideoCache(): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Video processor cache configuration
|
|
17
|
-
*/
|
|
18
|
-
export declare interface VideoCacheConfig extends CacheConfig {
|
|
19
|
-
cacheTranscoded?: boolean
|
|
20
|
-
cacheThumbnails?: boolean
|
|
21
|
-
cacheManifests?: boolean
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Video processor cache class
|
|
25
|
-
*/
|
|
26
|
-
export declare class VideoProcessorCache {
|
|
27
|
-
constructor(config?: Partial<VideoCacheConfig>);
|
|
28
|
-
get(src: string, options: Partial<EnhancedVideoProps>): Promise<ProcessedVideoResult | null>;
|
|
29
|
-
set(src: string, options: Partial<EnhancedVideoProps>, result: ProcessedVideoResult): Promise<void>;
|
|
30
|
-
clear(): Promise<void>;
|
|
31
|
-
updateConfig(config: Partial<VideoCacheConfig>): void;
|
|
32
|
-
}
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
// Re-export types for convenience
|
|
2
|
-
export type {
|
|
3
|
-
EnhancedVideoProps,
|
|
4
|
-
ProcessedVideoResult,
|
|
5
|
-
TsVideosConfig,
|
|
6
|
-
VideoQualityPreset,
|
|
7
|
-
VideoPlatformPreset,
|
|
8
|
-
TranscodeConfig,
|
|
9
|
-
TranscodeResult,
|
|
10
|
-
ThumbnailResult,
|
|
11
|
-
HLSResult,
|
|
12
|
-
DASHResult,
|
|
13
|
-
StreamingConfig,
|
|
14
|
-
StreamingQualityLevel,
|
|
15
|
-
PosterGenerationConfig,
|
|
16
|
-
SpriteSheetConfig,
|
|
17
|
-
WaveformConfig,
|
|
18
|
-
} from '../../types';
|
|
19
1
|
/**
|
|
20
2
|
* STX Media - Video Processor
|
|
21
3
|
*
|
|
@@ -27,3 +9,4 @@ export { processVideo, analyzeVideo } from './transcoder';
|
|
|
27
9
|
export { generatePoster, generateThumbnails, generateSpriteSheet } from './thumbnail';
|
|
28
10
|
export { generateHLSManifest, generateDASHManifest } from './streaming';
|
|
29
11
|
export { getCachedVideoResult, setCachedVideoResult, clearVideoCache, VideoProcessorCache } from './cache';
|
|
12
|
+
export type { EnhancedVideoProps, ProcessedVideoResult, TsVideosConfig, VideoQualityPreset, VideoPlatformPreset, TranscodeConfig, TranscodeResult, ThumbnailResult, HLSResult, DASHResult, StreamingConfig, StreamingQualityLevel, PosterGenerationConfig, SpriteSheetConfig, WaveformConfig, } from '../../types';
|
|
@@ -1,19 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STX Media - Video Streaming Manifest Generation
|
|
3
|
+
*
|
|
4
|
+
* Generate HLS and DASH manifests for adaptive streaming.
|
|
5
|
+
*
|
|
6
|
+
* @module media/video/processor/streaming
|
|
7
|
+
*/
|
|
1
8
|
import type { HLSResult, DASHResult, StreamingQualityLevel } from '../../types';
|
|
9
|
+
/**
|
|
10
|
+
* Default streaming quality levels
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEFAULT_STREAMING_QUALITIES: StreamingQualityLevel[];
|
|
2
13
|
/**
|
|
3
14
|
* Generate HLS (HTTP Live Streaming) manifest and segments
|
|
4
15
|
*/
|
|
5
16
|
export declare function generateHLSManifest(src: string, qualities: StreamingQualityLevel[], outputDir: string, baseUrl: string, options?: {
|
|
6
|
-
segmentDuration?: number
|
|
7
|
-
playlistType?: 'vod' | 'event'
|
|
8
|
-
|
|
17
|
+
segmentDuration?: number;
|
|
18
|
+
playlistType?: 'vod' | 'event';
|
|
19
|
+
}): Promise<HLSResult | null>;
|
|
9
20
|
/**
|
|
10
21
|
* Generate DASH (Dynamic Adaptive Streaming over HTTP) manifest
|
|
11
22
|
*/
|
|
12
23
|
export declare function generateDASHManifest(src: string, qualities: StreamingQualityLevel[], outputDir: string, baseUrl: string, options?: {
|
|
13
|
-
segmentDuration?: number
|
|
14
|
-
minBufferTime?: number
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Default streaming quality levels
|
|
18
|
-
*/
|
|
19
|
-
export declare const DEFAULT_STREAMING_QUALITIES: StreamingQualityLevel[];
|
|
24
|
+
segmentDuration?: number;
|
|
25
|
+
minBufferTime?: number;
|
|
26
|
+
}): Promise<DASHResult | null>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STX Media - Video Thumbnail Generation
|
|
3
|
+
*
|
|
4
|
+
* Generate poster images, thumbnails, and sprite sheets from video.
|
|
5
|
+
*
|
|
6
|
+
* @module media/video/processor/thumbnail
|
|
7
|
+
*/
|
|
1
8
|
import type { ThumbnailResult, PosterGenerationConfig, SpriteSheetConfig } from '../../types';
|
|
2
9
|
/**
|
|
3
10
|
* Generate poster/thumbnail from video at specific timestamp
|
|
@@ -7,23 +14,22 @@ export declare function generatePoster(src: string, options: PosterGenerationCon
|
|
|
7
14
|
* Generate multiple thumbnails at intervals
|
|
8
15
|
*/
|
|
9
16
|
export declare function generateThumbnails(src: string, options: {
|
|
10
|
-
count?: number
|
|
11
|
-
interval?: number
|
|
12
|
-
format?: 'jpeg' | 'png' | 'webp'
|
|
13
|
-
width?: number
|
|
14
|
-
quality?: number
|
|
15
|
-
|
|
17
|
+
count?: number;
|
|
18
|
+
interval?: number;
|
|
19
|
+
format?: 'jpeg' | 'png' | 'webp';
|
|
20
|
+
width?: number;
|
|
21
|
+
quality?: number;
|
|
22
|
+
}, outputDir: string, baseUrl: string): Promise<ThumbnailResult[]>;
|
|
16
23
|
/**
|
|
17
24
|
* Generate sprite sheet for video scrubbing preview
|
|
18
25
|
*/
|
|
19
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
20
26
|
export declare function generateSpriteSheet(src: string, options: SpriteSheetConfig, outputDir: string, baseUrl: string): Promise<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
url: string;
|
|
28
|
+
path: string;
|
|
29
|
+
columns: number;
|
|
30
|
+
rows: number;
|
|
31
|
+
thumbnailWidth: number;
|
|
32
|
+
thumbnailHeight: number;
|
|
33
|
+
interval: number;
|
|
34
|
+
totalFrames: number;
|
|
29
35
|
} | null>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* STX Media - Video Transcoder
|
|
3
|
+
*
|
|
4
|
+
* Wraps ts-videos for video transcoding and analysis.
|
|
5
|
+
*
|
|
6
|
+
* @module media/video/processor/transcoder
|
|
7
|
+
*/
|
|
1
8
|
import type { EnhancedVideoProps, ProcessedVideoResult, TsVideosConfig } from '../../types';
|
|
2
9
|
/**
|
|
3
10
|
* Analyze video to get metadata
|
|
@@ -6,4 +13,7 @@ export declare function analyzeVideo(src: string): Promise<ProcessedVideoResult[
|
|
|
6
13
|
/**
|
|
7
14
|
* Process a video with ts-videos
|
|
8
15
|
*/
|
|
9
|
-
export declare function processVideo(src: string, options: Partial<EnhancedVideoProps>, config: TsVideosConfig, onProgress?: (progress: {
|
|
16
|
+
export declare function processVideo(src: string, options: Partial<EnhancedVideoProps>, config: TsVideosConfig, onProgress?: (progress: {
|
|
17
|
+
percentage: number;
|
|
18
|
+
stage: string;
|
|
19
|
+
}) => void): Promise<ProcessedVideoResult>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form Method Spoofing for stx templates
|
|
3
|
+
*
|
|
4
|
+
* Similar to Laravel's @method directive, this allows specifying
|
|
5
|
+
* HTTP methods like PUT, PATCH, DELETE in HTML forms which only
|
|
6
|
+
* support GET and POST.
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* Generate a method spoofing input field
|
|
3
10
|
*/
|
package/dist/middleware.d.ts
CHANGED
|
@@ -1,3 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Middleware Module
|
|
3
|
+
*
|
|
4
|
+
* Provides a middleware system for pre/post-processing templates.
|
|
5
|
+
* Middleware can transform template content before or after directive processing.
|
|
6
|
+
*
|
|
7
|
+
* ## Middleware Lifecycle
|
|
8
|
+
*
|
|
9
|
+
* 1. **Before (pre-processing)**: Runs before any directives are processed.
|
|
10
|
+
* Use for raw template transformation, content injection, or validation.
|
|
11
|
+
*
|
|
12
|
+
* 2. **After (post-processing)**: Runs after all directives are processed.
|
|
13
|
+
* Use for output transformation, minification, or final validation.
|
|
14
|
+
*
|
|
15
|
+
* ## Middleware Definition
|
|
16
|
+
*
|
|
17
|
+
* ```typescript
|
|
18
|
+
* interface Middleware {
|
|
19
|
+
* name: string // Unique identifier
|
|
20
|
+
* timing: 'before' | 'after' // When to run
|
|
21
|
+
* handler: (
|
|
22
|
+
* template: string, // Current template content
|
|
23
|
+
* context: Record<string, any>, // Template context
|
|
24
|
+
* filePath: string, // Path to template file
|
|
25
|
+
* options: StxOptions // Processing options
|
|
26
|
+
* ) => string | Promise<string> // Modified template
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* ## Configuration Example
|
|
31
|
+
*
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // stx.config.ts
|
|
34
|
+
* export default {
|
|
35
|
+
* middleware: [
|
|
36
|
+
* {
|
|
37
|
+
* name: 'minify-html',
|
|
38
|
+
* timing: 'after',
|
|
39
|
+
* handler: (template) => template.replace(/\\s+/g, ' ')
|
|
40
|
+
* },
|
|
41
|
+
* {
|
|
42
|
+
* name: 'inject-timestamp',
|
|
43
|
+
* timing: 'before',
|
|
44
|
+
* handler: (template, ctx) => {
|
|
45
|
+
* ctx.buildTime = new Date().toISOString()
|
|
46
|
+
* return template
|
|
47
|
+
* }
|
|
48
|
+
* }
|
|
49
|
+
* ]
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* ## Error Handling
|
|
54
|
+
*
|
|
55
|
+
* - Middleware errors are caught and logged (in debug mode)
|
|
56
|
+
* - A visual error message is injected into the output when debug is enabled
|
|
57
|
+
* - Processing continues with remaining middleware even if one fails
|
|
58
|
+
*
|
|
59
|
+
* @module middleware
|
|
60
|
+
*/
|
|
1
61
|
import type { StxOptions } from './types';
|
|
2
62
|
/**
|
|
3
63
|
* Process middleware registered in the application.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which same-origin paths the SPA router actually owns (stacksjs/stx#1864).
|
|
3
|
+
*
|
|
4
|
+
* With `interceptAllLinks` — hardcoded as the base default on the serve path —
|
|
5
|
+
* the router claimed EVERY same-origin relative anchor. `shouldIntercept()`
|
|
6
|
+
* filtered on protocol, target and a few opt-out attributes and had no notion
|
|
7
|
+
* of a route table, so a link to a non-page endpoint got fetched, failed to
|
|
8
|
+
* swap, and then fell back to a real navigation. The endpoint was hit twice:
|
|
9
|
+
*
|
|
10
|
+
* Fetch 503 /api/auth/github/redirect
|
|
11
|
+
* Document 503 /api/auth/github/redirect
|
|
12
|
+
*
|
|
13
|
+
* on an endpoint whose whole job is minting OAuth state. Worse, when such an
|
|
14
|
+
* endpoint returns a successful cross-origin redirect, `fetch` follows it and
|
|
15
|
+
* the router swaps a third-party document into the container.
|
|
16
|
+
*
|
|
17
|
+
* The only escape was `data-no-router`, which removes the anchor from routing
|
|
18
|
+
* entirely — one reporting app carries 17 of them, and every new link has to
|
|
19
|
+
* remember whether it needs one.
|
|
20
|
+
*
|
|
21
|
+
* The missing concept is a manifest of owned paths, which the file router
|
|
22
|
+
* already has. This ships the compiled matchers to the client so interception
|
|
23
|
+
* asks "is this a page I can render?" instead of "is this same-origin?".
|
|
24
|
+
*
|
|
25
|
+
* Regex SOURCES are shipped rather than patterns because the client runtime is
|
|
26
|
+
* a template literal (see CLAUDE.md item 41) — re-implementing the pattern
|
|
27
|
+
* compiler in there would mean maintaining a second matcher, in a file where
|
|
28
|
+
* every backslash has to be doubled, that must agree with this one forever.
|
|
29
|
+
*
|
|
30
|
+
* @module owned-routes
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* Serialised matchers for every route the router can render.
|
|
34
|
+
*
|
|
35
|
+
* Empty when nothing could be discovered — callers MUST treat that as "unknown"
|
|
36
|
+
* and leave interception alone, never as "owns nothing". Shipping an empty list
|
|
37
|
+
* as authoritative would disable SPA navigation for a whole site, which is a
|
|
38
|
+
* far worse failure than the double-fetch this fixes.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getOwnedRouteMatchers(pagesDir?: string): Promise<string[]>;
|
|
41
|
+
/** Drop the memo, for tests and for a dev server that added a page. */
|
|
42
|
+
export declare function clearOwnedRoutesCache(): void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRouter } from "./router.js";
|
|
2
|
+
import { loadStxConfig } from "./config.js";
|
|
3
|
+
const _cache = new Map;
|
|
4
|
+
export async function getOwnedRouteMatchers(pagesDir) {
|
|
5
|
+
let dir = pagesDir;
|
|
6
|
+
if (!dir)
|
|
7
|
+
try {
|
|
8
|
+
dir = (await loadStxConfig())?.pagesDir || "pages";
|
|
9
|
+
} catch {
|
|
10
|
+
dir = "pages";
|
|
11
|
+
}
|
|
12
|
+
const key = dir, cached = _cache.get(key);
|
|
13
|
+
if (cached)
|
|
14
|
+
return cached;
|
|
15
|
+
let sources = [];
|
|
16
|
+
try {
|
|
17
|
+
sources = createRouter(".", { pagesDir: key }).map((route) => route.regex.source).filter(Boolean);
|
|
18
|
+
} catch {
|
|
19
|
+
sources = [];
|
|
20
|
+
}
|
|
21
|
+
_cache.set(key, sources);
|
|
22
|
+
return sources;
|
|
23
|
+
}
|
|
24
|
+
export function clearOwnedRoutesCache() {
|
|
25
|
+
_cache.clear();
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading `definePageMeta({ … })` out of a template's source.
|
|
3
|
+
*
|
|
4
|
+
* `PageMeta.layout` was part of the public type and appeared in
|
|
5
|
+
* `definePageMeta`'s own documentation example, but no code path read it. A
|
|
6
|
+
* page declaring `definePageMeta({ layout: 'app' })` type-checked, looked like
|
|
7
|
+
* the idiomatic declaration, and rendered with no layout at all
|
|
8
|
+
* (stacksjs/stx#1879).
|
|
9
|
+
*
|
|
10
|
+
* The cost was not just the missing layout. With no working typed way to say
|
|
11
|
+
* "this page belongs to the app layout group", pages hand-wrote
|
|
12
|
+
* `<meta name="stx-layout" content="app">` — a copy of a marker stx emits
|
|
13
|
+
* itself. The router's full-document-vs-fragment swap decision hinges on that
|
|
14
|
+
* string, so a page asserting a group it does not belong to is a routing
|
|
15
|
+
* hazard, not a cosmetic one.
|
|
16
|
+
*
|
|
17
|
+
* The extraction lives here because four separate regexes over
|
|
18
|
+
* `definePageMeta` had accumulated across `ssg.ts`, `page-response.ts` and
|
|
19
|
+
* `bun-plugin`'s serve path, each recognising a slightly different subset.
|
|
20
|
+
*
|
|
21
|
+
* @module page-meta
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Parse the first `definePageMeta({ … })` call in `source`.
|
|
25
|
+
*
|
|
26
|
+
* Object literals only — the call is read statically, before any script has
|
|
27
|
+
* run, so a computed argument cannot be resolved and returns `null` rather
|
|
28
|
+
* than half a result.
|
|
29
|
+
*/
|
|
30
|
+
export declare function extractPageMetaFromSource(source: string): Record<string, any> | null;
|
|
31
|
+
/**
|
|
32
|
+
* The layout a page declares, if any.
|
|
33
|
+
*
|
|
34
|
+
* `false` is meaningful and distinct from "not declared" — it means the same
|
|
35
|
+
* as `@nolayout`, so it must survive as `false` rather than collapsing into
|
|
36
|
+
* `undefined`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function pageMetaLayout(meta: Record<string, any> | null | undefined): string | false | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function extractPageMetaFromSource(source) {
|
|
2
|
+
const match = source.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);
|
|
3
|
+
if (!match)
|
|
4
|
+
return null;
|
|
5
|
+
try {
|
|
6
|
+
return Function(`return ${match[1]}`)();
|
|
7
|
+
} catch {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function pageMetaLayout(meta) {
|
|
12
|
+
const layout = meta?.layout;
|
|
13
|
+
if (layout === !1)
|
|
14
|
+
return !1;
|
|
15
|
+
return typeof layout === "string" && layout.trim() ? layout.trim() : void 0;
|
|
16
|
+
}
|
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directive Parser
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities for parsing directives with proper handling of
|
|
5
|
+
* nested structures, balanced tags, and expressions.
|
|
6
|
+
*
|
|
7
|
+
* @module parser/directive-parser
|
|
8
|
+
*/
|
|
9
|
+
export interface DirectiveMatch {
|
|
10
|
+
fullMatch: string;
|
|
11
|
+
name: string;
|
|
12
|
+
params: string;
|
|
13
|
+
content: string;
|
|
14
|
+
start: number;
|
|
15
|
+
end: number;
|
|
16
|
+
}
|
|
17
|
+
export interface ConditionalBranch {
|
|
18
|
+
type: 'if' | 'elseif' | 'else';
|
|
19
|
+
condition?: string;
|
|
20
|
+
content: string;
|
|
21
|
+
start: number;
|
|
22
|
+
end: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ParsedConditional {
|
|
25
|
+
fullMatch: string;
|
|
26
|
+
branches: ConditionalBranch[];
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
}
|
|
1
30
|
/**
|
|
2
31
|
* Extract a parenthesized expression from a string, handling nested parens
|
|
3
32
|
* e.g., "func(a, fn(b, c))" -> { expression: "func(a, fn(b, c))", endPos: 17 }
|
|
@@ -7,9 +36,24 @@
|
|
|
7
36
|
* messages pointing at the source location of a malformed `@if(`).
|
|
8
37
|
*/
|
|
9
38
|
export declare function extractParenthesizedExpression(source: string, startPos: number): {
|
|
10
|
-
|
|
11
|
-
|
|
39
|
+
expression: string;
|
|
40
|
+
endPos: number;
|
|
12
41
|
} | null;
|
|
42
|
+
/**
|
|
43
|
+
* Structured variant of `extractParenthesizedExpression` — returns either a
|
|
44
|
+
* successful parse or a `{ ok: false, reason, pos }` record explaining the
|
|
45
|
+
* failure. Use this when emitting user-facing errors ("missing opening
|
|
46
|
+
* paren", "unclosed paren at column N", etc.).
|
|
47
|
+
*/
|
|
48
|
+
export type ExtractParenResult = {
|
|
49
|
+
ok: true;
|
|
50
|
+
expression: string;
|
|
51
|
+
endPos: number;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
reason: 'missing-open-paren' | 'unclosed-paren';
|
|
55
|
+
pos: number;
|
|
56
|
+
};
|
|
13
57
|
export declare function extractParenthesizedExpressionDetailed(source: string, startPos: number): ExtractParenResult;
|
|
14
58
|
/**
|
|
15
59
|
* Whether `pos` in `source` falls INSIDE an HTML tag (`<...>`) — i.e. the nearest
|
|
@@ -57,51 +101,19 @@ export declare function findIfBlocks(source: string): ParsedConditional[];
|
|
|
57
101
|
* @returns All matches found
|
|
58
102
|
*/
|
|
59
103
|
export declare function findDirectiveBlocks(source: string, directiveName: string, endDirectiveName: string): DirectiveMatch[];
|
|
60
|
-
export declare function parseSwitchBlock(source: string, startPos: number): ParsedSwitch | null;
|
|
61
|
-
// =============================================================================
|
|
62
|
-
// Types
|
|
63
|
-
// =============================================================================
|
|
64
|
-
export declare interface DirectiveMatch {
|
|
65
|
-
fullMatch: string
|
|
66
|
-
name: string
|
|
67
|
-
params: string
|
|
68
|
-
content: string
|
|
69
|
-
start: number
|
|
70
|
-
end: number
|
|
71
|
-
}
|
|
72
|
-
export declare interface ConditionalBranch {
|
|
73
|
-
type: 'if' | 'elseif' | 'else'
|
|
74
|
-
condition?: string
|
|
75
|
-
content: string
|
|
76
|
-
start: number
|
|
77
|
-
end: number
|
|
78
|
-
}
|
|
79
|
-
export declare interface ParsedConditional {
|
|
80
|
-
fullMatch: string
|
|
81
|
-
branches: ConditionalBranch[]
|
|
82
|
-
start: number
|
|
83
|
-
end: number
|
|
84
|
-
}
|
|
85
104
|
/**
|
|
86
105
|
* Parse @switch block with proper handling of nested switches
|
|
87
106
|
*/
|
|
88
|
-
export
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
export interface SwitchCase {
|
|
108
|
+
type: 'case' | 'default';
|
|
109
|
+
value?: string;
|
|
110
|
+
content: string;
|
|
92
111
|
}
|
|
93
|
-
export
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
112
|
+
export interface ParsedSwitch {
|
|
113
|
+
fullMatch: string;
|
|
114
|
+
expression: string;
|
|
115
|
+
cases: SwitchCase[];
|
|
116
|
+
start: number;
|
|
117
|
+
end: number;
|
|
99
118
|
}
|
|
100
|
-
|
|
101
|
-
* Structured variant of `extractParenthesizedExpression` — returns either a
|
|
102
|
-
* successful parse or a `{ ok: false, reason, pos }` record explaining the
|
|
103
|
-
* failure. Use this when emitting user-facing errors ("missing opening
|
|
104
|
-
* paren", "unclosed paren at column N", etc.).
|
|
105
|
-
*/
|
|
106
|
-
export type ExtractParenResult = | { ok: true, expression: string, endPos: number }
|
|
107
|
-
| { ok: false, reason: 'missing-open-paren' | 'unclosed-paren', pos: number }
|
|
119
|
+
export declare function parseSwitchBlock(source: string, startPos: number): ParsedSwitch | null;
|