@servlyadmin/runtime-core 0.1.0 → 0.1.2
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/chunk-CIUQK4GA.js +182 -0
- package/dist/index.cjs +637 -149
- package/dist/index.d.cts +198 -5
- package/dist/index.d.ts +198 -5
- package/dist/index.js +441 -149
- package/dist/registry-GCCVK65D.js +16 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -26,6 +26,10 @@ interface ElementConfig {
|
|
|
26
26
|
src?: string;
|
|
27
27
|
/** Dynamic image source */
|
|
28
28
|
dynamicSrc?: string;
|
|
29
|
+
/** Dynamic href */
|
|
30
|
+
dynamicHref?: string;
|
|
31
|
+
/** Dynamic value */
|
|
32
|
+
dynamicValue?: string;
|
|
29
33
|
/** Alt text for images */
|
|
30
34
|
alt?: string;
|
|
31
35
|
/** Link href */
|
|
@@ -48,6 +52,16 @@ interface ElementConfig {
|
|
|
48
52
|
readOnly?: boolean;
|
|
49
53
|
/** Inline styles */
|
|
50
54
|
style?: Record<string, any>;
|
|
55
|
+
/** Reference to another component (for componentView elements) */
|
|
56
|
+
componentViewRef?: string;
|
|
57
|
+
/** Version specifier for the referenced component */
|
|
58
|
+
componentViewVersion?: string;
|
|
59
|
+
/** Props to pass to the referenced component */
|
|
60
|
+
componentViewProps?: Record<string, any>;
|
|
61
|
+
/** Blueprint ID for renderDynamicList */
|
|
62
|
+
blueprint?: string;
|
|
63
|
+
/** Blueprint version specifier */
|
|
64
|
+
blueprintVersion?: string;
|
|
51
65
|
/** Data attributes */
|
|
52
66
|
[key: `data-${string}`]: string | undefined;
|
|
53
67
|
/** Aria attributes */
|
|
@@ -87,6 +101,17 @@ interface BindingContext {
|
|
|
87
101
|
/** Additional context data */
|
|
88
102
|
context?: Record<string, any>;
|
|
89
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Registry of available components for dependency resolution
|
|
106
|
+
*/
|
|
107
|
+
interface ComponentRegistry {
|
|
108
|
+
/** Get component by ID and optional version */
|
|
109
|
+
get(id: string, version?: string): BundledComponent | undefined;
|
|
110
|
+
/** Check if component exists */
|
|
111
|
+
has(id: string, version?: string): boolean;
|
|
112
|
+
/** Register a component */
|
|
113
|
+
set(id: string, version: string, component: BundledComponent): void;
|
|
114
|
+
}
|
|
90
115
|
/**
|
|
91
116
|
* Options for rendering a component
|
|
92
117
|
*/
|
|
@@ -99,6 +124,12 @@ interface RenderOptions {
|
|
|
99
124
|
context: BindingContext;
|
|
100
125
|
/** Event handlers keyed by element ID then event name */
|
|
101
126
|
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
127
|
+
/** Registry of components for resolving componentViewRef and blueprints */
|
|
128
|
+
componentRegistry?: ComponentRegistry;
|
|
129
|
+
/** Callback when a dependency needs to be loaded */
|
|
130
|
+
onDependencyNeeded?: (id: string, version?: string) => Promise<BundledComponent | undefined>;
|
|
131
|
+
/** Callback when rendering a referenced component */
|
|
132
|
+
onComponentRender?: (id: string, container: HTMLElement) => void;
|
|
102
133
|
}
|
|
103
134
|
/**
|
|
104
135
|
* Result of a render operation
|
|
@@ -154,6 +185,47 @@ interface TestCase$1 {
|
|
|
154
185
|
/** Assertions to validate */
|
|
155
186
|
assertions?: Assertion$1[];
|
|
156
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Type of component dependency
|
|
190
|
+
*/
|
|
191
|
+
type DependencyType = 'blueprint' | 'viewRef' | 'slot';
|
|
192
|
+
/**
|
|
193
|
+
* Single dependency entry in manifest
|
|
194
|
+
*/
|
|
195
|
+
interface DependencyEntry {
|
|
196
|
+
/** Requested version specifier (e.g., "^1.0.0") */
|
|
197
|
+
version: string;
|
|
198
|
+
/** Actual resolved version (e.g., "1.2.3") */
|
|
199
|
+
resolved: string;
|
|
200
|
+
/** Type of dependency */
|
|
201
|
+
type: DependencyType;
|
|
202
|
+
/** Parent dependency ID (for nested deps) */
|
|
203
|
+
via?: string;
|
|
204
|
+
/** If true, component works without this dependency */
|
|
205
|
+
optional?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Manifest of all component dependencies
|
|
209
|
+
*/
|
|
210
|
+
interface DependencyManifest {
|
|
211
|
+
[componentId: string]: DependencyEntry;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Bundled component data (minimal for bundle)
|
|
215
|
+
*/
|
|
216
|
+
interface BundledComponent {
|
|
217
|
+
/** Layout JSON elements */
|
|
218
|
+
layout: LayoutElement[];
|
|
219
|
+
/** Props interface definition */
|
|
220
|
+
propsInterface?: PropDefinition[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Bundle of all dependencies
|
|
224
|
+
* Key format: "componentId@version"
|
|
225
|
+
*/
|
|
226
|
+
interface ComponentBundle {
|
|
227
|
+
[componentIdAtVersion: string]: BundledComponent;
|
|
228
|
+
}
|
|
157
229
|
/**
|
|
158
230
|
* Component data from registry
|
|
159
231
|
*/
|
|
@@ -180,6 +252,10 @@ interface ComponentData {
|
|
|
180
252
|
createdAt?: string;
|
|
181
253
|
/** Updated timestamp */
|
|
182
254
|
updatedAt?: string;
|
|
255
|
+
/** Dependency manifest - lists all required components */
|
|
256
|
+
dependencies?: DependencyManifest;
|
|
257
|
+
/** Bundled dependencies - included component data */
|
|
258
|
+
bundle?: ComponentBundle;
|
|
183
259
|
}
|
|
184
260
|
/**
|
|
185
261
|
* Cache entry for component data
|
|
@@ -224,6 +300,10 @@ interface RetryConfig {
|
|
|
224
300
|
/** Backoff multiplier */
|
|
225
301
|
backoffMultiplier?: number;
|
|
226
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Bundle loading strategy
|
|
305
|
+
*/
|
|
306
|
+
type BundleStrategy = 'eager' | 'lazy' | 'none';
|
|
227
307
|
/**
|
|
228
308
|
* Options for fetching a component
|
|
229
309
|
*/
|
|
@@ -242,6 +322,12 @@ interface FetchOptions {
|
|
|
242
322
|
forceRefresh?: boolean;
|
|
243
323
|
/** Abort signal for cancellation */
|
|
244
324
|
signal?: AbortSignal;
|
|
325
|
+
/** How to handle dependencies: eager (bundle all), lazy (fetch on demand), none */
|
|
326
|
+
bundleStrategy?: BundleStrategy;
|
|
327
|
+
/** Include bundled dependencies in response */
|
|
328
|
+
includeBundle?: boolean;
|
|
329
|
+
/** Maximum bundle size in bytes before switching to lazy */
|
|
330
|
+
maxBundleSize?: number;
|
|
245
331
|
}
|
|
246
332
|
/**
|
|
247
333
|
* Result of a fetch operation
|
|
@@ -253,6 +339,13 @@ interface FetchResult {
|
|
|
253
339
|
fromCache: boolean;
|
|
254
340
|
/** Resolved version */
|
|
255
341
|
version: string;
|
|
342
|
+
/** Pre-built component registry from bundle */
|
|
343
|
+
registry?: ComponentRegistry;
|
|
344
|
+
/** List of dependencies that need lazy loading */
|
|
345
|
+
pendingDependencies?: Array<{
|
|
346
|
+
id: string;
|
|
347
|
+
version: string;
|
|
348
|
+
}>;
|
|
256
349
|
}
|
|
257
350
|
/**
|
|
258
351
|
* Result of a single assertion
|
|
@@ -301,12 +394,37 @@ interface TestSummary$1 {
|
|
|
301
394
|
/**
|
|
302
395
|
* Vanilla DOM Renderer
|
|
303
396
|
* Renders Layout JSON to native DOM elements
|
|
397
|
+
* Supports component dependencies via componentViewRef and blueprint
|
|
304
398
|
*/
|
|
305
399
|
|
|
306
400
|
/**
|
|
307
401
|
* Render Layout JSON to DOM
|
|
308
402
|
*/
|
|
309
403
|
declare function render(options: RenderOptions): RenderResult;
|
|
404
|
+
/**
|
|
405
|
+
* Render a dynamic list using a blueprint component
|
|
406
|
+
* This is called by event handlers that use renderDynamicList
|
|
407
|
+
*/
|
|
408
|
+
declare function renderDynamicList(options: {
|
|
409
|
+
/** Target container element or selector */
|
|
410
|
+
targetContainer: HTMLElement | string;
|
|
411
|
+
/** Blueprint component ID */
|
|
412
|
+
blueprint: string;
|
|
413
|
+
/** Blueprint version (optional) */
|
|
414
|
+
blueprintVersion?: string;
|
|
415
|
+
/** Data array to render */
|
|
416
|
+
data: any[];
|
|
417
|
+
/** How to render: 'renderInto' clears container, 'append' adds to end */
|
|
418
|
+
renderType?: 'renderInto' | 'append' | 'prepend';
|
|
419
|
+
/** Item variable name in template (default: 'item') */
|
|
420
|
+
itemKey?: string;
|
|
421
|
+
/** Index variable name in template (default: 'index') */
|
|
422
|
+
indexKey?: string;
|
|
423
|
+
/** Component registry for blueprint lookup */
|
|
424
|
+
componentRegistry: ComponentRegistry;
|
|
425
|
+
/** Parent context */
|
|
426
|
+
context?: BindingContext;
|
|
427
|
+
}): RenderResult[];
|
|
310
428
|
|
|
311
429
|
/**
|
|
312
430
|
* Template Binding Resolution
|
|
@@ -434,8 +552,11 @@ declare function clearAllCaches(config?: CacheConfig): void;
|
|
|
434
552
|
declare function invalidateCache(id: string, version?: string, config?: CacheConfig): void;
|
|
435
553
|
|
|
436
554
|
/**
|
|
437
|
-
*
|
|
438
|
-
* Fetches
|
|
555
|
+
* View Registry Fetcher
|
|
556
|
+
* Fetches view data from the View Registry API with retry logic
|
|
557
|
+
*
|
|
558
|
+
* API Base: /api/views/registry
|
|
559
|
+
* Supports: versioning, bundling, batch fetch, dependency resolution
|
|
439
560
|
*/
|
|
440
561
|
|
|
441
562
|
/** Default retry configuration */
|
|
@@ -453,18 +574,47 @@ declare function getRegistryUrl(): string;
|
|
|
453
574
|
*/
|
|
454
575
|
declare function fetchComponent(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
455
576
|
/**
|
|
456
|
-
*
|
|
577
|
+
* Fetch component with all dependencies resolved
|
|
578
|
+
* Convenience wrapper that handles lazy loading
|
|
579
|
+
*/
|
|
580
|
+
declare function fetchComponentWithDependencies(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
581
|
+
/**
|
|
582
|
+
* Batch fetch multiple views in a single request
|
|
583
|
+
* Uses: POST /api/views/registry/batch
|
|
584
|
+
*/
|
|
585
|
+
declare function batchFetchComponents(components: Array<{
|
|
586
|
+
id: string;
|
|
587
|
+
version?: string;
|
|
588
|
+
}>, options?: Pick<FetchOptions, 'apiKey'>): Promise<Record<string, BundledComponent>>;
|
|
589
|
+
/**
|
|
590
|
+
* Prefetch views for faster loading
|
|
591
|
+
* Uses: POST /api/views/registry/prefetch for version resolution
|
|
457
592
|
*/
|
|
458
593
|
declare function prefetchComponents(ids: Array<{
|
|
459
594
|
id: string;
|
|
460
595
|
version?: string;
|
|
461
596
|
}>, options?: Omit<FetchOptions, 'version'>): Promise<void>;
|
|
462
597
|
/**
|
|
463
|
-
* Check if
|
|
598
|
+
* Check if view is available (in cache or online)
|
|
599
|
+
* Uses: GET /api/views/registry/:viewId/available?version=^1.0.0
|
|
464
600
|
*/
|
|
465
601
|
declare function isComponentAvailable(id: string, version?: string, options?: Pick<FetchOptions, 'apiKey' | 'cacheStrategy' | 'cacheConfig'>): Promise<{
|
|
466
602
|
available: boolean;
|
|
467
603
|
cached: boolean;
|
|
604
|
+
version?: string;
|
|
605
|
+
}>;
|
|
606
|
+
/**
|
|
607
|
+
* Get dependency tree for a view
|
|
608
|
+
* Uses: GET /api/views/registry/:viewId/dependencies?version=^1.0.0&depth=10
|
|
609
|
+
*/
|
|
610
|
+
declare function getDependencyTree(id: string, options?: {
|
|
611
|
+
version?: string;
|
|
612
|
+
depth?: number;
|
|
613
|
+
apiKey?: string;
|
|
614
|
+
}): Promise<{
|
|
615
|
+
tree: any;
|
|
616
|
+
totalDependencies: number;
|
|
617
|
+
maxDepthReached: number;
|
|
468
618
|
}>;
|
|
469
619
|
|
|
470
620
|
/**
|
|
@@ -579,4 +729,47 @@ declare function validateProps(props: Record<string, any>, definitions: PropDefi
|
|
|
579
729
|
*/
|
|
580
730
|
declare function generateTestCases(definitions: PropDefinition[]): TestCase[];
|
|
581
731
|
|
|
582
|
-
|
|
732
|
+
/**
|
|
733
|
+
* Component Registry
|
|
734
|
+
*
|
|
735
|
+
* Manages a collection of components for dependency resolution.
|
|
736
|
+
* Used by the renderer to resolve componentViewRef and blueprint references.
|
|
737
|
+
*/
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Create a component registry from bundled data
|
|
741
|
+
*/
|
|
742
|
+
declare function createRegistry(): ComponentRegistry;
|
|
743
|
+
/**
|
|
744
|
+
* Build a registry from component data with bundle
|
|
745
|
+
*/
|
|
746
|
+
declare function buildRegistryFromBundle(data: ComponentData): ComponentRegistry;
|
|
747
|
+
/**
|
|
748
|
+
* Extract dependencies from layout elements
|
|
749
|
+
* Scans for componentViewRef and blueprint references
|
|
750
|
+
*/
|
|
751
|
+
declare function extractDependencies(elements: LayoutElement[]): Array<{
|
|
752
|
+
id: string;
|
|
753
|
+
version?: string;
|
|
754
|
+
type: 'viewRef' | 'blueprint';
|
|
755
|
+
elementId: string;
|
|
756
|
+
}>;
|
|
757
|
+
/**
|
|
758
|
+
* Extract dependencies from event handler code
|
|
759
|
+
* Looks for renderDynamicList calls
|
|
760
|
+
*/
|
|
761
|
+
declare function extractDependenciesFromCode(code: string): Array<{
|
|
762
|
+
id: string;
|
|
763
|
+
type: 'blueprint';
|
|
764
|
+
}>;
|
|
765
|
+
/**
|
|
766
|
+
* Recursively collect all dependencies from a component
|
|
767
|
+
* Handles nested dependencies (A → B → C)
|
|
768
|
+
*/
|
|
769
|
+
declare function collectAllDependencies(rootId: string, rootVersion: string, fetchComponent: (id: string, version?: string) => Promise<ComponentData | undefined>, maxDepth?: number): Promise<DependencyManifest>;
|
|
770
|
+
/**
|
|
771
|
+
* Check for circular dependencies
|
|
772
|
+
*/
|
|
773
|
+
declare function detectCircularDependencies(manifest: DependencyManifest): string[] | null;
|
|
774
|
+
|
|
775
|
+
export { type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_RETRY_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, type ElementConfig, type FetchOptions, type FetchResult, type LayoutElement, type ParsedVersion, type PropDefinition, type RenderOptions, type RenderResult, type RetryConfig, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, compareVersions, createRegistry, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getCacheKey, getDependencyTree, getFromCache, getMemoryCacheSize, getRegistryUrl, hasTemplateSyntax, invalidateCache, isComponentAvailable, isValidSpecifier, parseVersion, prefetchComponents, processStyles, render, renderDynamicList, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setInCache, setRegistryUrl, updateStyles, validateAssertion, validateProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ interface ElementConfig {
|
|
|
26
26
|
src?: string;
|
|
27
27
|
/** Dynamic image source */
|
|
28
28
|
dynamicSrc?: string;
|
|
29
|
+
/** Dynamic href */
|
|
30
|
+
dynamicHref?: string;
|
|
31
|
+
/** Dynamic value */
|
|
32
|
+
dynamicValue?: string;
|
|
29
33
|
/** Alt text for images */
|
|
30
34
|
alt?: string;
|
|
31
35
|
/** Link href */
|
|
@@ -48,6 +52,16 @@ interface ElementConfig {
|
|
|
48
52
|
readOnly?: boolean;
|
|
49
53
|
/** Inline styles */
|
|
50
54
|
style?: Record<string, any>;
|
|
55
|
+
/** Reference to another component (for componentView elements) */
|
|
56
|
+
componentViewRef?: string;
|
|
57
|
+
/** Version specifier for the referenced component */
|
|
58
|
+
componentViewVersion?: string;
|
|
59
|
+
/** Props to pass to the referenced component */
|
|
60
|
+
componentViewProps?: Record<string, any>;
|
|
61
|
+
/** Blueprint ID for renderDynamicList */
|
|
62
|
+
blueprint?: string;
|
|
63
|
+
/** Blueprint version specifier */
|
|
64
|
+
blueprintVersion?: string;
|
|
51
65
|
/** Data attributes */
|
|
52
66
|
[key: `data-${string}`]: string | undefined;
|
|
53
67
|
/** Aria attributes */
|
|
@@ -87,6 +101,17 @@ interface BindingContext {
|
|
|
87
101
|
/** Additional context data */
|
|
88
102
|
context?: Record<string, any>;
|
|
89
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Registry of available components for dependency resolution
|
|
106
|
+
*/
|
|
107
|
+
interface ComponentRegistry {
|
|
108
|
+
/** Get component by ID and optional version */
|
|
109
|
+
get(id: string, version?: string): BundledComponent | undefined;
|
|
110
|
+
/** Check if component exists */
|
|
111
|
+
has(id: string, version?: string): boolean;
|
|
112
|
+
/** Register a component */
|
|
113
|
+
set(id: string, version: string, component: BundledComponent): void;
|
|
114
|
+
}
|
|
90
115
|
/**
|
|
91
116
|
* Options for rendering a component
|
|
92
117
|
*/
|
|
@@ -99,6 +124,12 @@ interface RenderOptions {
|
|
|
99
124
|
context: BindingContext;
|
|
100
125
|
/** Event handlers keyed by element ID then event name */
|
|
101
126
|
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
127
|
+
/** Registry of components for resolving componentViewRef and blueprints */
|
|
128
|
+
componentRegistry?: ComponentRegistry;
|
|
129
|
+
/** Callback when a dependency needs to be loaded */
|
|
130
|
+
onDependencyNeeded?: (id: string, version?: string) => Promise<BundledComponent | undefined>;
|
|
131
|
+
/** Callback when rendering a referenced component */
|
|
132
|
+
onComponentRender?: (id: string, container: HTMLElement) => void;
|
|
102
133
|
}
|
|
103
134
|
/**
|
|
104
135
|
* Result of a render operation
|
|
@@ -154,6 +185,47 @@ interface TestCase$1 {
|
|
|
154
185
|
/** Assertions to validate */
|
|
155
186
|
assertions?: Assertion$1[];
|
|
156
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Type of component dependency
|
|
190
|
+
*/
|
|
191
|
+
type DependencyType = 'blueprint' | 'viewRef' | 'slot';
|
|
192
|
+
/**
|
|
193
|
+
* Single dependency entry in manifest
|
|
194
|
+
*/
|
|
195
|
+
interface DependencyEntry {
|
|
196
|
+
/** Requested version specifier (e.g., "^1.0.0") */
|
|
197
|
+
version: string;
|
|
198
|
+
/** Actual resolved version (e.g., "1.2.3") */
|
|
199
|
+
resolved: string;
|
|
200
|
+
/** Type of dependency */
|
|
201
|
+
type: DependencyType;
|
|
202
|
+
/** Parent dependency ID (for nested deps) */
|
|
203
|
+
via?: string;
|
|
204
|
+
/** If true, component works without this dependency */
|
|
205
|
+
optional?: boolean;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Manifest of all component dependencies
|
|
209
|
+
*/
|
|
210
|
+
interface DependencyManifest {
|
|
211
|
+
[componentId: string]: DependencyEntry;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Bundled component data (minimal for bundle)
|
|
215
|
+
*/
|
|
216
|
+
interface BundledComponent {
|
|
217
|
+
/** Layout JSON elements */
|
|
218
|
+
layout: LayoutElement[];
|
|
219
|
+
/** Props interface definition */
|
|
220
|
+
propsInterface?: PropDefinition[];
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Bundle of all dependencies
|
|
224
|
+
* Key format: "componentId@version"
|
|
225
|
+
*/
|
|
226
|
+
interface ComponentBundle {
|
|
227
|
+
[componentIdAtVersion: string]: BundledComponent;
|
|
228
|
+
}
|
|
157
229
|
/**
|
|
158
230
|
* Component data from registry
|
|
159
231
|
*/
|
|
@@ -180,6 +252,10 @@ interface ComponentData {
|
|
|
180
252
|
createdAt?: string;
|
|
181
253
|
/** Updated timestamp */
|
|
182
254
|
updatedAt?: string;
|
|
255
|
+
/** Dependency manifest - lists all required components */
|
|
256
|
+
dependencies?: DependencyManifest;
|
|
257
|
+
/** Bundled dependencies - included component data */
|
|
258
|
+
bundle?: ComponentBundle;
|
|
183
259
|
}
|
|
184
260
|
/**
|
|
185
261
|
* Cache entry for component data
|
|
@@ -224,6 +300,10 @@ interface RetryConfig {
|
|
|
224
300
|
/** Backoff multiplier */
|
|
225
301
|
backoffMultiplier?: number;
|
|
226
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Bundle loading strategy
|
|
305
|
+
*/
|
|
306
|
+
type BundleStrategy = 'eager' | 'lazy' | 'none';
|
|
227
307
|
/**
|
|
228
308
|
* Options for fetching a component
|
|
229
309
|
*/
|
|
@@ -242,6 +322,12 @@ interface FetchOptions {
|
|
|
242
322
|
forceRefresh?: boolean;
|
|
243
323
|
/** Abort signal for cancellation */
|
|
244
324
|
signal?: AbortSignal;
|
|
325
|
+
/** How to handle dependencies: eager (bundle all), lazy (fetch on demand), none */
|
|
326
|
+
bundleStrategy?: BundleStrategy;
|
|
327
|
+
/** Include bundled dependencies in response */
|
|
328
|
+
includeBundle?: boolean;
|
|
329
|
+
/** Maximum bundle size in bytes before switching to lazy */
|
|
330
|
+
maxBundleSize?: number;
|
|
245
331
|
}
|
|
246
332
|
/**
|
|
247
333
|
* Result of a fetch operation
|
|
@@ -253,6 +339,13 @@ interface FetchResult {
|
|
|
253
339
|
fromCache: boolean;
|
|
254
340
|
/** Resolved version */
|
|
255
341
|
version: string;
|
|
342
|
+
/** Pre-built component registry from bundle */
|
|
343
|
+
registry?: ComponentRegistry;
|
|
344
|
+
/** List of dependencies that need lazy loading */
|
|
345
|
+
pendingDependencies?: Array<{
|
|
346
|
+
id: string;
|
|
347
|
+
version: string;
|
|
348
|
+
}>;
|
|
256
349
|
}
|
|
257
350
|
/**
|
|
258
351
|
* Result of a single assertion
|
|
@@ -301,12 +394,37 @@ interface TestSummary$1 {
|
|
|
301
394
|
/**
|
|
302
395
|
* Vanilla DOM Renderer
|
|
303
396
|
* Renders Layout JSON to native DOM elements
|
|
397
|
+
* Supports component dependencies via componentViewRef and blueprint
|
|
304
398
|
*/
|
|
305
399
|
|
|
306
400
|
/**
|
|
307
401
|
* Render Layout JSON to DOM
|
|
308
402
|
*/
|
|
309
403
|
declare function render(options: RenderOptions): RenderResult;
|
|
404
|
+
/**
|
|
405
|
+
* Render a dynamic list using a blueprint component
|
|
406
|
+
* This is called by event handlers that use renderDynamicList
|
|
407
|
+
*/
|
|
408
|
+
declare function renderDynamicList(options: {
|
|
409
|
+
/** Target container element or selector */
|
|
410
|
+
targetContainer: HTMLElement | string;
|
|
411
|
+
/** Blueprint component ID */
|
|
412
|
+
blueprint: string;
|
|
413
|
+
/** Blueprint version (optional) */
|
|
414
|
+
blueprintVersion?: string;
|
|
415
|
+
/** Data array to render */
|
|
416
|
+
data: any[];
|
|
417
|
+
/** How to render: 'renderInto' clears container, 'append' adds to end */
|
|
418
|
+
renderType?: 'renderInto' | 'append' | 'prepend';
|
|
419
|
+
/** Item variable name in template (default: 'item') */
|
|
420
|
+
itemKey?: string;
|
|
421
|
+
/** Index variable name in template (default: 'index') */
|
|
422
|
+
indexKey?: string;
|
|
423
|
+
/** Component registry for blueprint lookup */
|
|
424
|
+
componentRegistry: ComponentRegistry;
|
|
425
|
+
/** Parent context */
|
|
426
|
+
context?: BindingContext;
|
|
427
|
+
}): RenderResult[];
|
|
310
428
|
|
|
311
429
|
/**
|
|
312
430
|
* Template Binding Resolution
|
|
@@ -434,8 +552,11 @@ declare function clearAllCaches(config?: CacheConfig): void;
|
|
|
434
552
|
declare function invalidateCache(id: string, version?: string, config?: CacheConfig): void;
|
|
435
553
|
|
|
436
554
|
/**
|
|
437
|
-
*
|
|
438
|
-
* Fetches
|
|
555
|
+
* View Registry Fetcher
|
|
556
|
+
* Fetches view data from the View Registry API with retry logic
|
|
557
|
+
*
|
|
558
|
+
* API Base: /api/views/registry
|
|
559
|
+
* Supports: versioning, bundling, batch fetch, dependency resolution
|
|
439
560
|
*/
|
|
440
561
|
|
|
441
562
|
/** Default retry configuration */
|
|
@@ -453,18 +574,47 @@ declare function getRegistryUrl(): string;
|
|
|
453
574
|
*/
|
|
454
575
|
declare function fetchComponent(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
455
576
|
/**
|
|
456
|
-
*
|
|
577
|
+
* Fetch component with all dependencies resolved
|
|
578
|
+
* Convenience wrapper that handles lazy loading
|
|
579
|
+
*/
|
|
580
|
+
declare function fetchComponentWithDependencies(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
581
|
+
/**
|
|
582
|
+
* Batch fetch multiple views in a single request
|
|
583
|
+
* Uses: POST /api/views/registry/batch
|
|
584
|
+
*/
|
|
585
|
+
declare function batchFetchComponents(components: Array<{
|
|
586
|
+
id: string;
|
|
587
|
+
version?: string;
|
|
588
|
+
}>, options?: Pick<FetchOptions, 'apiKey'>): Promise<Record<string, BundledComponent>>;
|
|
589
|
+
/**
|
|
590
|
+
* Prefetch views for faster loading
|
|
591
|
+
* Uses: POST /api/views/registry/prefetch for version resolution
|
|
457
592
|
*/
|
|
458
593
|
declare function prefetchComponents(ids: Array<{
|
|
459
594
|
id: string;
|
|
460
595
|
version?: string;
|
|
461
596
|
}>, options?: Omit<FetchOptions, 'version'>): Promise<void>;
|
|
462
597
|
/**
|
|
463
|
-
* Check if
|
|
598
|
+
* Check if view is available (in cache or online)
|
|
599
|
+
* Uses: GET /api/views/registry/:viewId/available?version=^1.0.0
|
|
464
600
|
*/
|
|
465
601
|
declare function isComponentAvailable(id: string, version?: string, options?: Pick<FetchOptions, 'apiKey' | 'cacheStrategy' | 'cacheConfig'>): Promise<{
|
|
466
602
|
available: boolean;
|
|
467
603
|
cached: boolean;
|
|
604
|
+
version?: string;
|
|
605
|
+
}>;
|
|
606
|
+
/**
|
|
607
|
+
* Get dependency tree for a view
|
|
608
|
+
* Uses: GET /api/views/registry/:viewId/dependencies?version=^1.0.0&depth=10
|
|
609
|
+
*/
|
|
610
|
+
declare function getDependencyTree(id: string, options?: {
|
|
611
|
+
version?: string;
|
|
612
|
+
depth?: number;
|
|
613
|
+
apiKey?: string;
|
|
614
|
+
}): Promise<{
|
|
615
|
+
tree: any;
|
|
616
|
+
totalDependencies: number;
|
|
617
|
+
maxDepthReached: number;
|
|
468
618
|
}>;
|
|
469
619
|
|
|
470
620
|
/**
|
|
@@ -579,4 +729,47 @@ declare function validateProps(props: Record<string, any>, definitions: PropDefi
|
|
|
579
729
|
*/
|
|
580
730
|
declare function generateTestCases(definitions: PropDefinition[]): TestCase[];
|
|
581
731
|
|
|
582
|
-
|
|
732
|
+
/**
|
|
733
|
+
* Component Registry
|
|
734
|
+
*
|
|
735
|
+
* Manages a collection of components for dependency resolution.
|
|
736
|
+
* Used by the renderer to resolve componentViewRef and blueprint references.
|
|
737
|
+
*/
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Create a component registry from bundled data
|
|
741
|
+
*/
|
|
742
|
+
declare function createRegistry(): ComponentRegistry;
|
|
743
|
+
/**
|
|
744
|
+
* Build a registry from component data with bundle
|
|
745
|
+
*/
|
|
746
|
+
declare function buildRegistryFromBundle(data: ComponentData): ComponentRegistry;
|
|
747
|
+
/**
|
|
748
|
+
* Extract dependencies from layout elements
|
|
749
|
+
* Scans for componentViewRef and blueprint references
|
|
750
|
+
*/
|
|
751
|
+
declare function extractDependencies(elements: LayoutElement[]): Array<{
|
|
752
|
+
id: string;
|
|
753
|
+
version?: string;
|
|
754
|
+
type: 'viewRef' | 'blueprint';
|
|
755
|
+
elementId: string;
|
|
756
|
+
}>;
|
|
757
|
+
/**
|
|
758
|
+
* Extract dependencies from event handler code
|
|
759
|
+
* Looks for renderDynamicList calls
|
|
760
|
+
*/
|
|
761
|
+
declare function extractDependenciesFromCode(code: string): Array<{
|
|
762
|
+
id: string;
|
|
763
|
+
type: 'blueprint';
|
|
764
|
+
}>;
|
|
765
|
+
/**
|
|
766
|
+
* Recursively collect all dependencies from a component
|
|
767
|
+
* Handles nested dependencies (A → B → C)
|
|
768
|
+
*/
|
|
769
|
+
declare function collectAllDependencies(rootId: string, rootVersion: string, fetchComponent: (id: string, version?: string) => Promise<ComponentData | undefined>, maxDepth?: number): Promise<DependencyManifest>;
|
|
770
|
+
/**
|
|
771
|
+
* Check for circular dependencies
|
|
772
|
+
*/
|
|
773
|
+
declare function detectCircularDependencies(manifest: DependencyManifest): string[] | null;
|
|
774
|
+
|
|
775
|
+
export { type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_RETRY_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, type ElementConfig, type FetchOptions, type FetchResult, type LayoutElement, type ParsedVersion, type PropDefinition, type RenderOptions, type RenderResult, type RetryConfig, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, compareVersions, createRegistry, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getCacheKey, getDependencyTree, getFromCache, getMemoryCacheSize, getRegistryUrl, hasTemplateSyntax, invalidateCache, isComponentAvailable, isValidSpecifier, parseVersion, prefetchComponents, processStyles, render, renderDynamicList, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setInCache, setRegistryUrl, updateStyles, validateAssertion, validateProps };
|