@constela/core 0.16.1 → 0.17.0
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/index.d.ts +326 -5
- package/dist/index.js +460 -121
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme System Types for Constela UI Framework
|
|
3
|
+
*/
|
|
4
|
+
declare const COLOR_SCHEMES: readonly ["light", "dark", "system"];
|
|
5
|
+
type ColorScheme = (typeof COLOR_SCHEMES)[number];
|
|
6
|
+
interface ThemeColors {
|
|
7
|
+
primary?: string;
|
|
8
|
+
'primary-foreground'?: string;
|
|
9
|
+
secondary?: string;
|
|
10
|
+
'secondary-foreground'?: string;
|
|
11
|
+
destructive?: string;
|
|
12
|
+
'destructive-foreground'?: string;
|
|
13
|
+
background?: string;
|
|
14
|
+
foreground?: string;
|
|
15
|
+
muted?: string;
|
|
16
|
+
'muted-foreground'?: string;
|
|
17
|
+
accent?: string;
|
|
18
|
+
'accent-foreground'?: string;
|
|
19
|
+
popover?: string;
|
|
20
|
+
'popover-foreground'?: string;
|
|
21
|
+
card?: string;
|
|
22
|
+
'card-foreground'?: string;
|
|
23
|
+
border?: string;
|
|
24
|
+
input?: string;
|
|
25
|
+
ring?: string;
|
|
26
|
+
[key: string]: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
interface ThemeFonts {
|
|
29
|
+
sans?: string;
|
|
30
|
+
serif?: string;
|
|
31
|
+
mono?: string;
|
|
32
|
+
[key: string]: string | undefined;
|
|
33
|
+
}
|
|
34
|
+
interface ThemeConfig {
|
|
35
|
+
mode?: ColorScheme;
|
|
36
|
+
colors?: ThemeColors;
|
|
37
|
+
darkColors?: ThemeColors;
|
|
38
|
+
fonts?: ThemeFonts;
|
|
39
|
+
cssPrefix?: string;
|
|
40
|
+
}
|
|
41
|
+
declare function isColorScheme(value: unknown): value is ColorScheme;
|
|
42
|
+
declare function isThemeColors(value: unknown): value is ThemeColors;
|
|
43
|
+
declare function isThemeFonts(value: unknown): value is ThemeFonts;
|
|
44
|
+
declare function isThemeConfig(value: unknown): value is ThemeConfig;
|
|
45
|
+
|
|
1
46
|
/**
|
|
2
47
|
* AST Type Definitions for Constela UI Framework
|
|
3
48
|
*
|
|
4
49
|
* This module defines the complete Abstract Syntax Tree (AST) types
|
|
5
50
|
* for representing Constela UI applications.
|
|
6
51
|
*/
|
|
52
|
+
|
|
7
53
|
declare const BINARY_OPERATORS: readonly ["+", "-", "*", "/", "==", "!=", "<", "<=", ">", ">=", "&&", "||"];
|
|
8
54
|
type BinaryOperator = (typeof BINARY_OPERATORS)[number];
|
|
9
55
|
declare const UPDATE_OPERATIONS: readonly ["increment", "decrement", "push", "pop", "remove", "toggle", "merge", "replaceAt", "insertAt", "splice"];
|
|
@@ -22,6 +68,17 @@ declare const VALIDITY_PROPERTIES: readonly ["valid", "valueMissing", "typeMisma
|
|
|
22
68
|
type ValidityProperty = (typeof VALIDITY_PROPERTIES)[number];
|
|
23
69
|
declare const NAVIGATE_TARGETS: readonly ["_self", "_blank"];
|
|
24
70
|
type NavigateTarget = (typeof NAVIGATE_TARGETS)[number];
|
|
71
|
+
declare const ISLAND_STRATEGIES: readonly ["load", "idle", "visible", "interaction", "media", "never"];
|
|
72
|
+
type IslandStrategy = (typeof ISLAND_STRATEGIES)[number];
|
|
73
|
+
/**
|
|
74
|
+
* Options for island hydration strategies
|
|
75
|
+
*/
|
|
76
|
+
interface IslandStrategyOptions {
|
|
77
|
+
threshold?: number;
|
|
78
|
+
rootMargin?: string;
|
|
79
|
+
media?: string;
|
|
80
|
+
timeout?: number;
|
|
81
|
+
}
|
|
25
82
|
declare const PARAM_TYPES: readonly ["string", "number", "boolean", "json"];
|
|
26
83
|
type ParamType = (typeof PARAM_TYPES)[number];
|
|
27
84
|
interface ParamDef {
|
|
@@ -429,7 +486,95 @@ interface IfStep {
|
|
|
429
486
|
then: ActionStep[];
|
|
430
487
|
else?: ActionStep[];
|
|
431
488
|
}
|
|
432
|
-
|
|
489
|
+
/**
|
|
490
|
+
* Generate step - generates DSL using AI at runtime
|
|
491
|
+
*/
|
|
492
|
+
interface GenerateStep {
|
|
493
|
+
do: 'generate';
|
|
494
|
+
provider: AiProviderType;
|
|
495
|
+
prompt: Expression;
|
|
496
|
+
output: AiOutputType;
|
|
497
|
+
result: string;
|
|
498
|
+
model?: string;
|
|
499
|
+
onSuccess?: ActionStep[];
|
|
500
|
+
onError?: ActionStep[];
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Reconnection configuration for SSE and WebSocket
|
|
504
|
+
*/
|
|
505
|
+
interface ReconnectConfig {
|
|
506
|
+
enabled: boolean;
|
|
507
|
+
strategy: 'exponential' | 'linear' | 'none';
|
|
508
|
+
maxRetries: number;
|
|
509
|
+
baseDelay: number;
|
|
510
|
+
maxDelay?: number;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* SSE connect step - establishes a Server-Sent Events connection
|
|
514
|
+
*/
|
|
515
|
+
interface SSEConnectStep {
|
|
516
|
+
do: 'sseConnect';
|
|
517
|
+
connection: string;
|
|
518
|
+
url: Expression;
|
|
519
|
+
eventTypes?: string[];
|
|
520
|
+
reconnect?: ReconnectConfig;
|
|
521
|
+
onOpen?: ActionStep[];
|
|
522
|
+
onMessage?: ActionStep[];
|
|
523
|
+
onError?: ActionStep[];
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* SSE close step - closes a named SSE connection
|
|
527
|
+
*/
|
|
528
|
+
interface SSECloseStep {
|
|
529
|
+
do: 'sseClose';
|
|
530
|
+
connection: string;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Optimistic step - applies optimistic UI update
|
|
534
|
+
*/
|
|
535
|
+
interface OptimisticStep {
|
|
536
|
+
do: 'optimistic';
|
|
537
|
+
target: string;
|
|
538
|
+
path?: Expression;
|
|
539
|
+
value: Expression;
|
|
540
|
+
result?: string;
|
|
541
|
+
timeout?: number;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Confirm step - confirms an optimistic update
|
|
545
|
+
*/
|
|
546
|
+
interface ConfirmStep {
|
|
547
|
+
do: 'confirm';
|
|
548
|
+
id: Expression;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Reject step - rejects an optimistic update and rolls back
|
|
552
|
+
*/
|
|
553
|
+
interface RejectStep {
|
|
554
|
+
do: 'reject';
|
|
555
|
+
id: Expression;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Bind step - binds connection messages to state
|
|
559
|
+
*/
|
|
560
|
+
interface BindStep {
|
|
561
|
+
do: 'bind';
|
|
562
|
+
connection: string;
|
|
563
|
+
eventType?: string;
|
|
564
|
+
target: string;
|
|
565
|
+
path?: Expression;
|
|
566
|
+
transform?: Expression;
|
|
567
|
+
patch?: boolean;
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Unbind step - removes a binding
|
|
571
|
+
*/
|
|
572
|
+
interface UnbindStep {
|
|
573
|
+
do: 'unbind';
|
|
574
|
+
connection: string;
|
|
575
|
+
target: string;
|
|
576
|
+
}
|
|
577
|
+
type ActionStep = SetStep | UpdateStep | SetPathStep | FetchStep | StorageStep | ClipboardStep | NavigateStep | ImportStep | CallStep | SubscribeStep | DisposeStep | DomStep | SendStep | CloseStep | DelayStep | IntervalStep | ClearTimerStep | FocusStep | IfStep | GenerateStep | SSEConnectStep | SSECloseStep | OptimisticStep | ConfirmStep | RejectStep | BindStep | UnbindStep;
|
|
433
578
|
type LocalActionStep = SetStep | UpdateStep | SetPathStep;
|
|
434
579
|
/**
|
|
435
580
|
* Event handler options for special events like intersect
|
|
@@ -542,7 +687,36 @@ interface PortalNode {
|
|
|
542
687
|
target: 'body' | 'head' | string;
|
|
543
688
|
children: ViewNode[];
|
|
544
689
|
}
|
|
545
|
-
|
|
690
|
+
/**
|
|
691
|
+
* Island node - represents an interactive island in the Islands Architecture
|
|
692
|
+
*/
|
|
693
|
+
interface IslandNode {
|
|
694
|
+
kind: 'island';
|
|
695
|
+
id: string;
|
|
696
|
+
strategy: IslandStrategy;
|
|
697
|
+
strategyOptions?: IslandStrategyOptions;
|
|
698
|
+
content: ViewNode;
|
|
699
|
+
state?: Record<string, StateField>;
|
|
700
|
+
actions?: ActionDefinition[];
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Suspense node - represents an async boundary with loading fallback
|
|
704
|
+
*/
|
|
705
|
+
interface SuspenseNode {
|
|
706
|
+
kind: 'suspense';
|
|
707
|
+
id: string;
|
|
708
|
+
fallback: ViewNode;
|
|
709
|
+
content: ViewNode;
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Error boundary node - catches errors and displays fallback UI
|
|
713
|
+
*/
|
|
714
|
+
interface ErrorBoundaryNode {
|
|
715
|
+
kind: 'errorBoundary';
|
|
716
|
+
fallback: ViewNode;
|
|
717
|
+
content: ViewNode;
|
|
718
|
+
}
|
|
719
|
+
type ViewNode = ElementNode | TextNode | IfNode | EachNode | ComponentNode | SlotNode | MarkdownNode | CodeNode | PortalNode | IslandNode | SuspenseNode | ErrorBoundaryNode;
|
|
546
720
|
interface ComponentDef {
|
|
547
721
|
params?: Record<string, ParamDef>;
|
|
548
722
|
localState?: Record<string, StateField>;
|
|
@@ -573,7 +747,7 @@ type DataTransform = (typeof DATA_TRANSFORMS)[number];
|
|
|
573
747
|
/**
|
|
574
748
|
* Data source types
|
|
575
749
|
*/
|
|
576
|
-
declare const DATA_SOURCE_TYPES: readonly ["glob", "file", "api"];
|
|
750
|
+
declare const DATA_SOURCE_TYPES: readonly ["glob", "file", "api", "ai"];
|
|
577
751
|
type DataSourceType = (typeof DATA_SOURCE_TYPES)[number];
|
|
578
752
|
/**
|
|
579
753
|
* Reference to imported components for MDX transformation
|
|
@@ -593,6 +767,26 @@ interface DataSource {
|
|
|
593
767
|
transform?: DataTransform;
|
|
594
768
|
components?: string | ComponentsRef;
|
|
595
769
|
}
|
|
770
|
+
/**
|
|
771
|
+
* AI provider types for AI data source
|
|
772
|
+
*/
|
|
773
|
+
declare const AI_PROVIDER_TYPES: readonly ["anthropic", "openai"];
|
|
774
|
+
type AiProviderType = (typeof AI_PROVIDER_TYPES)[number];
|
|
775
|
+
/**
|
|
776
|
+
* AI output types for AI data source
|
|
777
|
+
*/
|
|
778
|
+
declare const AI_OUTPUT_TYPES: readonly ["component", "view"];
|
|
779
|
+
type AiOutputType = (typeof AI_OUTPUT_TYPES)[number];
|
|
780
|
+
/**
|
|
781
|
+
* AI data source for AI-generated content at build time
|
|
782
|
+
*/
|
|
783
|
+
interface AiDataSource {
|
|
784
|
+
type: 'ai';
|
|
785
|
+
provider: AiProviderType;
|
|
786
|
+
prompt: string;
|
|
787
|
+
output: AiOutputType;
|
|
788
|
+
model?: string;
|
|
789
|
+
}
|
|
596
790
|
/**
|
|
597
791
|
* Static paths definition for SSG
|
|
598
792
|
*/
|
|
@@ -643,6 +837,7 @@ interface Program {
|
|
|
643
837
|
data?: Record<string, DataSource>;
|
|
644
838
|
styles?: Record<string, StylePreset>;
|
|
645
839
|
lifecycle?: LifecycleHooks;
|
|
840
|
+
theme?: ThemeConfig;
|
|
646
841
|
state: Record<string, StateField>;
|
|
647
842
|
actions: ActionDefinition[];
|
|
648
843
|
view: ViewNode;
|
|
@@ -766,6 +961,14 @@ declare function isValidityExpr(value: unknown): value is ValidityExpr;
|
|
|
766
961
|
* Checks if value is a data source
|
|
767
962
|
*/
|
|
768
963
|
declare function isDataSource(value: unknown): value is DataSource;
|
|
964
|
+
/**
|
|
965
|
+
* Checks if value is an AI data source
|
|
966
|
+
*/
|
|
967
|
+
declare function isAiDataSource(value: unknown): value is AiDataSource;
|
|
968
|
+
/**
|
|
969
|
+
* Checks if value is a GenerateStep
|
|
970
|
+
*/
|
|
971
|
+
declare function isGenerateStep(value: unknown): value is GenerateStep;
|
|
769
972
|
/**
|
|
770
973
|
* Checks if value is a static paths definition
|
|
771
974
|
*/
|
|
@@ -814,6 +1017,26 @@ declare function isCodeNode(value: unknown): value is CodeNode;
|
|
|
814
1017
|
* Checks if value is a portal node
|
|
815
1018
|
*/
|
|
816
1019
|
declare function isPortalNode(value: unknown): value is PortalNode;
|
|
1020
|
+
/**
|
|
1021
|
+
* Checks if value is a valid island strategy
|
|
1022
|
+
*/
|
|
1023
|
+
declare function isIslandStrategy(value: unknown): value is IslandStrategy;
|
|
1024
|
+
/**
|
|
1025
|
+
* Checks if value is valid island strategy options
|
|
1026
|
+
*/
|
|
1027
|
+
declare function isIslandStrategyOptions(value: unknown): value is IslandStrategyOptions;
|
|
1028
|
+
/**
|
|
1029
|
+
* Checks if value is an island node
|
|
1030
|
+
*/
|
|
1031
|
+
declare function isIslandNode(value: unknown): value is IslandNode;
|
|
1032
|
+
/**
|
|
1033
|
+
* Checks if value is a suspense node
|
|
1034
|
+
*/
|
|
1035
|
+
declare function isSuspenseNode(value: unknown): value is SuspenseNode;
|
|
1036
|
+
/**
|
|
1037
|
+
* Checks if value is an error boundary node
|
|
1038
|
+
*/
|
|
1039
|
+
declare function isErrorBoundaryNode(value: unknown): value is ErrorBoundaryNode;
|
|
817
1040
|
/**
|
|
818
1041
|
* Checks if value is any valid view node
|
|
819
1042
|
*/
|
|
@@ -935,7 +1158,7 @@ declare function isLifecycleHooks(value: unknown): value is LifecycleHooks;
|
|
|
935
1158
|
* This module defines error types, the ConstelaError class,
|
|
936
1159
|
* and factory functions for creating specific errors.
|
|
937
1160
|
*/
|
|
938
|
-
type ErrorCode = 'SCHEMA_INVALID' | 'UNDEFINED_STATE' | 'UNDEFINED_ACTION' | 'VAR_UNDEFINED' | 'DUPLICATE_ACTION' | 'UNSUPPORTED_VERSION' | 'COMPONENT_NOT_FOUND' | 'COMPONENT_PROP_MISSING' | 'COMPONENT_CYCLE' | 'COMPONENT_PROP_TYPE' | 'PARAM_UNDEFINED' | 'OPERATION_INVALID_FOR_TYPE' | 'OPERATION_MISSING_FIELD' | 'OPERATION_UNKNOWN' | 'EXPR_INVALID_BASE' | 'EXPR_INVALID_CONDITION' | 'EXPR_COND_ELSE_REQUIRED' | 'UNDEFINED_ROUTE_PARAM' | 'ROUTE_NOT_DEFINED' | 'UNDEFINED_IMPORT' | 'IMPORTS_NOT_DEFINED' | 'LAYOUT_MISSING_SLOT' | 'LAYOUT_NOT_FOUND' | 'INVALID_SLOT_NAME' | 'DUPLICATE_SLOT_NAME' | 'DUPLICATE_DEFAULT_SLOT' | 'SLOT_IN_LOOP' | 'INVALID_DATA_SOURCE' | 'UNDEFINED_DATA_SOURCE' | 'DATA_NOT_DEFINED' | 'UNDEFINED_DATA' | 'UNDEFINED_REF' | 'INVALID_STORAGE_OPERATION' | 'INVALID_STORAGE_TYPE' | 'STORAGE_SET_MISSING_VALUE' | 'INVALID_CLIPBOARD_OPERATION' | 'CLIPBOARD_WRITE_MISSING_VALUE' | 'INVALID_NAVIGATE_TARGET' | 'UNDEFINED_STYLE' | 'UNDEFINED_VARIANT' | 'UNDEFINED_LOCAL_STATE' | 'LOCAL_ACTION_INVALID_STEP';
|
|
1161
|
+
type ErrorCode = 'SCHEMA_INVALID' | 'UNDEFINED_STATE' | 'UNDEFINED_ACTION' | 'VAR_UNDEFINED' | 'DUPLICATE_ACTION' | 'UNSUPPORTED_VERSION' | 'COMPONENT_NOT_FOUND' | 'COMPONENT_PROP_MISSING' | 'COMPONENT_CYCLE' | 'COMPONENT_PROP_TYPE' | 'PARAM_UNDEFINED' | 'OPERATION_INVALID_FOR_TYPE' | 'OPERATION_MISSING_FIELD' | 'OPERATION_UNKNOWN' | 'EXPR_INVALID_BASE' | 'EXPR_INVALID_CONDITION' | 'EXPR_COND_ELSE_REQUIRED' | 'UNDEFINED_ROUTE_PARAM' | 'ROUTE_NOT_DEFINED' | 'UNDEFINED_IMPORT' | 'IMPORTS_NOT_DEFINED' | 'LAYOUT_MISSING_SLOT' | 'LAYOUT_NOT_FOUND' | 'INVALID_SLOT_NAME' | 'DUPLICATE_SLOT_NAME' | 'DUPLICATE_DEFAULT_SLOT' | 'SLOT_IN_LOOP' | 'INVALID_DATA_SOURCE' | 'UNDEFINED_DATA_SOURCE' | 'DATA_NOT_DEFINED' | 'UNDEFINED_DATA' | 'UNDEFINED_REF' | 'INVALID_STORAGE_OPERATION' | 'INVALID_STORAGE_TYPE' | 'STORAGE_SET_MISSING_VALUE' | 'INVALID_CLIPBOARD_OPERATION' | 'CLIPBOARD_WRITE_MISSING_VALUE' | 'INVALID_NAVIGATE_TARGET' | 'UNDEFINED_STYLE' | 'UNDEFINED_VARIANT' | 'UNDEFINED_LOCAL_STATE' | 'LOCAL_ACTION_INVALID_STEP' | 'DUPLICATE_ISLAND_ID';
|
|
939
1162
|
/**
|
|
940
1163
|
* Options for creating enhanced ConstelaError instances
|
|
941
1164
|
*/
|
|
@@ -1142,6 +1365,10 @@ declare function createUndefinedLocalStateError(stateName: string, path?: string
|
|
|
1142
1365
|
* Creates a local action invalid step error
|
|
1143
1366
|
*/
|
|
1144
1367
|
declare function createLocalActionInvalidStepError(stepType: string, path?: string): ConstelaError;
|
|
1368
|
+
/**
|
|
1369
|
+
* Creates a duplicate island ID error
|
|
1370
|
+
*/
|
|
1371
|
+
declare function createDuplicateIslandIdError(id: string, path?: string, suggestions?: string[]): ConstelaError;
|
|
1145
1372
|
/**
|
|
1146
1373
|
* Finds similar names from a set of candidates using Levenshtein distance
|
|
1147
1374
|
* and prefix matching.
|
|
@@ -2103,4 +2330,98 @@ declare const astSchema: {
|
|
|
2103
2330
|
};
|
|
2104
2331
|
};
|
|
2105
2332
|
|
|
2106
|
-
|
|
2333
|
+
/**
|
|
2334
|
+
* Streaming SSR Types for Constela Framework
|
|
2335
|
+
*
|
|
2336
|
+
* Provides type definitions for streaming Server-Side Rendering,
|
|
2337
|
+
* supporting:
|
|
2338
|
+
* - Streaming render options with flush strategies
|
|
2339
|
+
* - Suspense boundaries for async content
|
|
2340
|
+
* - Stream chunks for progressive HTML delivery
|
|
2341
|
+
*
|
|
2342
|
+
* These types are designed for Edge Runtime compatibility,
|
|
2343
|
+
* using Web Streams API (not Node.js streams).
|
|
2344
|
+
*/
|
|
2345
|
+
|
|
2346
|
+
/**
|
|
2347
|
+
* Flush strategy for streaming SSR
|
|
2348
|
+
*
|
|
2349
|
+
* - 'immediate': Flush content as soon as it's available
|
|
2350
|
+
* - 'batched': Batch chunks until timeout or buffer limit
|
|
2351
|
+
* - 'manual': Only flush when explicitly requested
|
|
2352
|
+
*/
|
|
2353
|
+
type FlushStrategy = 'immediate' | 'batched' | 'manual';
|
|
2354
|
+
/**
|
|
2355
|
+
* Options for streaming SSR render
|
|
2356
|
+
*/
|
|
2357
|
+
interface StreamingRenderOptions {
|
|
2358
|
+
/** Enable streaming mode */
|
|
2359
|
+
streaming: boolean;
|
|
2360
|
+
/** Strategy for flushing chunks to the client */
|
|
2361
|
+
flushStrategy: FlushStrategy;
|
|
2362
|
+
/** Timeout in ms for batched flush strategy (default: 50ms) */
|
|
2363
|
+
batchTimeout?: number;
|
|
2364
|
+
}
|
|
2365
|
+
/**
|
|
2366
|
+
* Represents a suspense boundary in the view tree
|
|
2367
|
+
*
|
|
2368
|
+
* Used to mark async content that should:
|
|
2369
|
+
* 1. Initially render fallback content
|
|
2370
|
+
* 2. Stream resolved content when promise completes
|
|
2371
|
+
* 3. Replace fallback with resolved content on the client
|
|
2372
|
+
*/
|
|
2373
|
+
interface SuspenseBoundary {
|
|
2374
|
+
/** Unique identifier for this suspense boundary */
|
|
2375
|
+
id: string;
|
|
2376
|
+
/** Fallback content to show while loading */
|
|
2377
|
+
fallback: ViewNode;
|
|
2378
|
+
/** Promise that resolves to the actual content */
|
|
2379
|
+
promise: Promise<ViewNode>;
|
|
2380
|
+
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Chunk types for streaming SSR
|
|
2383
|
+
*
|
|
2384
|
+
* - 'html': Regular HTML content
|
|
2385
|
+
* - 'shell': Document shell (DOCTYPE, html, head, body opening)
|
|
2386
|
+
* - 'fallback': Suspense fallback content
|
|
2387
|
+
* - 'resolved': Resolved suspense content (replaces fallback)
|
|
2388
|
+
* - 'end': End of stream (closing tags)
|
|
2389
|
+
* - 'error': Error content
|
|
2390
|
+
*/
|
|
2391
|
+
type StreamChunkType = 'html' | 'shell' | 'fallback' | 'resolved' | 'end' | 'error';
|
|
2392
|
+
/**
|
|
2393
|
+
* A chunk of content in the streaming SSR output
|
|
2394
|
+
*/
|
|
2395
|
+
interface StreamChunk {
|
|
2396
|
+
/** Type of this chunk */
|
|
2397
|
+
type: StreamChunkType;
|
|
2398
|
+
/** HTML content */
|
|
2399
|
+
content: string;
|
|
2400
|
+
/** Suspense boundary ID (for fallback/resolved types) */
|
|
2401
|
+
boundaryId?: string;
|
|
2402
|
+
/** Error object (for error type) */
|
|
2403
|
+
error?: Error;
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Type guard for StreamingRenderOptions
|
|
2407
|
+
*
|
|
2408
|
+
* @param value - Value to check
|
|
2409
|
+
* @returns true if value is a valid StreamingRenderOptions
|
|
2410
|
+
*/
|
|
2411
|
+
declare function isStreamingRenderOptions(value: unknown): value is StreamingRenderOptions;
|
|
2412
|
+
/**
|
|
2413
|
+
* Type guard for SuspenseBoundary
|
|
2414
|
+
*
|
|
2415
|
+
* @param value - Value to check
|
|
2416
|
+
* @returns true if value is a valid SuspenseBoundary
|
|
2417
|
+
*/
|
|
2418
|
+
declare function isSuspenseBoundary(value: unknown): value is SuspenseBoundary;
|
|
2419
|
+
/**
|
|
2420
|
+
* Type guard for StreamChunk
|
|
2421
|
+
*
|
|
2422
|
+
* @param value - Value to check
|
|
2423
|
+
* @returns true if value is a valid StreamChunk
|
|
2424
|
+
*/
|
|
2425
|
+
declare function isStreamChunk(value: unknown): value is StreamChunk;
|
|
2426
|
+
|
|
2427
|
+
export { AI_OUTPUT_TYPES, AI_PROVIDER_TYPES, type ActionDefinition, type ActionStep, type AiDataSource, type AiOutputType, type AiProviderType, type ArrayExpr, BINARY_OPERATORS, type BinExpr, type BinaryOperator, type BindStep, type BooleanField, CLIPBOARD_OPERATIONS, COLOR_SCHEMES, type CallExpr, type CallStep, type ClearTimerStep, type ClipboardOperation, type ClipboardStep, type CloseStep, type CodeNode, type ColorScheme, type ComponentDef, type ComponentNode, type ComponentsRef, type CompoundVariant, type ConcatExpr, type CondExpr, type ConfirmStep, type ConstelaAst, ConstelaError, type ConstelaProgram, type CookieInitialExpr, DATA_SOURCE_TYPES, DATA_TRANSFORMS, type DataExpr, type DataSource, type DataSourceType, type DataTransform, type DelayStep, type DisposeStep, type DomStep, type EachNode, type ElementNode, type ErrorBoundaryNode, type ErrorCode, type ErrorOptions, type EventHandler, type EventHandlerOptions, type Expression, FOCUS_OPERATIONS, type FetchStep, type FlushStrategy, type FocusOperation, type FocusStep, type GenerateStep, type GetExpr, HTTP_METHODS, type HttpMethod, ISLAND_STRATEGIES, type IfNode, type IfStep, type ImportExpr, type ImportStep, type IndexExpr, type IntervalStep, type IslandNode, type IslandStrategy, type IslandStrategyOptions, type LambdaExpr, type LayoutProgram, type LifecycleHooks, type ListField, type LitExpr, type LocalActionDefinition, type LocalActionStep, type MarkdownNode, NAVIGATE_TARGETS, type NavigateStep, type NavigateTarget, type NotExpr, type NumberField, type ObjectField, type OptimisticStep, PARAM_TYPES, type ParamDef, type ParamExpr, type ParamType, type PortalNode, type Program, type ReconnectConfig, type RefExpr, type RejectStep, type RouteDefinition, type RouteExpr, type SSECloseStep, type SSEConnectStep, STORAGE_OPERATIONS, STORAGE_TYPES, type SendStep, type SetPathStep, type SetStep, type SlotNode, type StateExpr, type StateField, type StaticPathsDefinition, type StorageOperation, type StorageStep, type StorageType, type StreamChunk, type StreamChunkType, type StreamingRenderOptions, type StringField, type StyleExpr, type StylePreset, type SubscribeStep, type SuspenseBoundary, type SuspenseNode, type TextNode, type ThemeColors, type ThemeConfig, type ThemeFonts, UPDATE_OPERATIONS, type UnbindStep, type UpdateOperation, type UpdateStep, VALIDITY_PROPERTIES, type ValidationFailure, type ValidationResult, type ValidationSuccess, type ValidityExpr, type ValidityProperty, type VarExpr, type ViewNode, astSchema, createClipboardWriteMissingValueError, createComponentCycleError, createComponentNotFoundError, createComponentPropMissingError, createComponentPropTypeError, createCondElseRequiredError, createDataNotDefinedError, createDuplicateActionError, createDuplicateDefaultSlotError, createDuplicateIslandIdError, createDuplicateSlotNameError, createImportsNotDefinedError, createInvalidClipboardOperationError, createInvalidDataSourceError, createInvalidNavigateTargetError, createInvalidSlotNameError, createInvalidStorageOperationError, createInvalidStorageTypeError, createLayoutMissingSlotError, createLayoutNotFoundError, createLocalActionInvalidStepError, createOperationInvalidForTypeError, createOperationMissingFieldError, createOperationUnknownError, createRouteNotDefinedError, createSchemaError, createSlotInLoopError, createStorageSetMissingValueError, createUndefinedActionError, createUndefinedDataError, createUndefinedDataSourceError, createUndefinedImportError, createUndefinedLocalStateError, createUndefinedParamError, createUndefinedRefError, createUndefinedRouteParamError, createUndefinedStateError, createUndefinedStyleError, createUndefinedVarError, createUndefinedVariantError, createUnsupportedVersionError, findSimilarNames, isActionStep, isAiDataSource, isArrayExpr, isBinExpr, isBooleanField, isCallStep, isClipboardStep, isCodeNode, isColorScheme, isComponentNode, isConcatExpr, isCondExpr, isConstelaError, isCookieInitialExpr, isDataExpr, isDataSource, isDisposeStep, isEachNode, isElementNode, isErrorBoundaryNode, isEventHandler, isExpression, isFetchStep, isFocusStep, isGenerateStep, isGetExpr, isIfNode, isImportExpr, isImportStep, isIslandNode, isIslandStrategy, isIslandStrategyOptions, isLayoutProgram, isLifecycleHooks, isListField, isLitExpr, isLocalActionDefinition, isLocalActionStep, isMarkdownNode, isNamedSlotNode, isNavigateStep, isNotExpr, isNumberField, isObjectField, isParamExpr, isPortalNode, isRefExpr, isRouteDefinition, isRouteExpr, isSetPathStep, isSetStep, isSlotNode, isStateExpr, isStateField, isStaticPathsDefinition, isStorageStep, isStreamChunk, isStreamingRenderOptions, isStringField, isStyleExpr, isSubscribeStep, isSuspenseBoundary, isSuspenseNode, isTextNode, isThemeColors, isThemeConfig, isThemeFonts, isUpdateStep, isValidityExpr, isVarExpr, isViewNode, validateAst };
|