@servlyadmin/runtime-core 0.1.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.cjs +1519 -0
- package/dist/index.d.cts +582 -0
- package/dist/index.d.ts +582 -0
- package/dist/index.js +1451 -0
- package/package.json +41 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,582 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Servly Runtime Core Types
|
|
3
|
+
* Framework-agnostic type definitions for Layout JSON rendering
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Configuration options for an element
|
|
7
|
+
*/
|
|
8
|
+
interface ElementConfig {
|
|
9
|
+
/** HTML tag override */
|
|
10
|
+
tag?: string;
|
|
11
|
+
/** Static text content */
|
|
12
|
+
text?: string;
|
|
13
|
+
/** Dynamic text with template bindings */
|
|
14
|
+
dynamicText?: string;
|
|
15
|
+
/** CSS class name */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** Additional CSS class names */
|
|
18
|
+
classNames?: string;
|
|
19
|
+
/** Dynamic class name with template bindings */
|
|
20
|
+
dynamicClassName?: string;
|
|
21
|
+
/** CSS variables to apply */
|
|
22
|
+
cssVariables?: Record<string, string>;
|
|
23
|
+
/** Element ID */
|
|
24
|
+
id?: string;
|
|
25
|
+
/** Image source */
|
|
26
|
+
src?: string;
|
|
27
|
+
/** Dynamic image source */
|
|
28
|
+
dynamicSrc?: string;
|
|
29
|
+
/** Alt text for images */
|
|
30
|
+
alt?: string;
|
|
31
|
+
/** Link href */
|
|
32
|
+
href?: string;
|
|
33
|
+
/** Link target */
|
|
34
|
+
target?: string;
|
|
35
|
+
/** Input placeholder */
|
|
36
|
+
placeholder?: string;
|
|
37
|
+
/** Input type */
|
|
38
|
+
type?: string;
|
|
39
|
+
/** Input name */
|
|
40
|
+
name?: string;
|
|
41
|
+
/** Input value */
|
|
42
|
+
value?: string;
|
|
43
|
+
/** Disabled state */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** Required state */
|
|
46
|
+
required?: boolean;
|
|
47
|
+
/** Read-only state */
|
|
48
|
+
readOnly?: boolean;
|
|
49
|
+
/** Inline styles */
|
|
50
|
+
style?: Record<string, any>;
|
|
51
|
+
/** Data attributes */
|
|
52
|
+
[key: `data-${string}`]: string | undefined;
|
|
53
|
+
/** Aria attributes */
|
|
54
|
+
[key: `aria-${string}`]: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A single element in the Layout JSON tree
|
|
58
|
+
*/
|
|
59
|
+
interface LayoutElement {
|
|
60
|
+
/** Unique element identifier */
|
|
61
|
+
i: string;
|
|
62
|
+
/** Component type (container, text, button, etc.) */
|
|
63
|
+
componentId: string;
|
|
64
|
+
/** Parent element ID (null for root elements) */
|
|
65
|
+
parent?: string | null;
|
|
66
|
+
/** Element configuration */
|
|
67
|
+
configuration?: ElementConfig;
|
|
68
|
+
/** Inline styles */
|
|
69
|
+
style?: Record<string, any>;
|
|
70
|
+
/** CSS class name */
|
|
71
|
+
className?: string;
|
|
72
|
+
/** Whether this is a group/container */
|
|
73
|
+
isGroup?: boolean;
|
|
74
|
+
/** Child element IDs */
|
|
75
|
+
children?: string[];
|
|
76
|
+
/** Element name for debugging */
|
|
77
|
+
name?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Context for resolving template bindings
|
|
81
|
+
*/
|
|
82
|
+
interface BindingContext {
|
|
83
|
+
/** Props passed to the component */
|
|
84
|
+
props: Record<string, any>;
|
|
85
|
+
/** Component state */
|
|
86
|
+
state?: Record<string, any>;
|
|
87
|
+
/** Additional context data */
|
|
88
|
+
context?: Record<string, any>;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Options for rendering a component
|
|
92
|
+
*/
|
|
93
|
+
interface RenderOptions {
|
|
94
|
+
/** Container element to render into */
|
|
95
|
+
container: HTMLElement;
|
|
96
|
+
/** Layout elements to render */
|
|
97
|
+
elements: LayoutElement[];
|
|
98
|
+
/** Binding context for template resolution */
|
|
99
|
+
context: BindingContext;
|
|
100
|
+
/** Event handlers keyed by element ID then event name */
|
|
101
|
+
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Result of a render operation
|
|
105
|
+
*/
|
|
106
|
+
interface RenderResult {
|
|
107
|
+
/** Root DOM element created */
|
|
108
|
+
rootElement: HTMLElement | null;
|
|
109
|
+
/** Update the rendered component with new context */
|
|
110
|
+
update: (context: BindingContext) => void;
|
|
111
|
+
/** Destroy the rendered component and clean up */
|
|
112
|
+
destroy: () => void;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Prop definition for a component
|
|
116
|
+
*/
|
|
117
|
+
interface PropDefinition {
|
|
118
|
+
/** Prop name */
|
|
119
|
+
name: string;
|
|
120
|
+
/** Prop type */
|
|
121
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function';
|
|
122
|
+
/** Whether the prop is required */
|
|
123
|
+
required: boolean;
|
|
124
|
+
/** Default value if not provided */
|
|
125
|
+
defaultValue?: any;
|
|
126
|
+
/** Description for documentation */
|
|
127
|
+
description?: string;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Test case assertion
|
|
131
|
+
*/
|
|
132
|
+
interface Assertion$1 {
|
|
133
|
+
/** CSS selector to find element */
|
|
134
|
+
selector: string;
|
|
135
|
+
/** Property to check */
|
|
136
|
+
property: 'text' | 'attribute' | 'style' | 'exists' | 'class';
|
|
137
|
+
/** Attribute name (for attribute checks) */
|
|
138
|
+
attributeName?: string;
|
|
139
|
+
/** Style property name (for style checks) */
|
|
140
|
+
styleName?: string;
|
|
141
|
+
/** Expected value */
|
|
142
|
+
expected: any;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Test case for component validation
|
|
146
|
+
*/
|
|
147
|
+
interface TestCase$1 {
|
|
148
|
+
/** Unique test case ID */
|
|
149
|
+
id: string;
|
|
150
|
+
/** Test case name */
|
|
151
|
+
name: string;
|
|
152
|
+
/** Props to use for this test */
|
|
153
|
+
props: Record<string, any>;
|
|
154
|
+
/** Assertions to validate */
|
|
155
|
+
assertions?: Assertion$1[];
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Component data from registry
|
|
159
|
+
*/
|
|
160
|
+
interface ComponentData {
|
|
161
|
+
/** Component ID */
|
|
162
|
+
id: string;
|
|
163
|
+
/** Component name */
|
|
164
|
+
name: string;
|
|
165
|
+
/** Component description */
|
|
166
|
+
description?: string;
|
|
167
|
+
/** Component version */
|
|
168
|
+
version: string;
|
|
169
|
+
/** Layout JSON elements */
|
|
170
|
+
layout: LayoutElement[];
|
|
171
|
+
/** Props interface definition */
|
|
172
|
+
propsInterface?: PropDefinition[];
|
|
173
|
+
/** Test cases for validation */
|
|
174
|
+
testCases?: TestCase$1[];
|
|
175
|
+
/** CSS variables used */
|
|
176
|
+
cssVariables?: Record<string, string>;
|
|
177
|
+
/** Component tags for search */
|
|
178
|
+
tags?: string[];
|
|
179
|
+
/** Created timestamp */
|
|
180
|
+
createdAt?: string;
|
|
181
|
+
/** Updated timestamp */
|
|
182
|
+
updatedAt?: string;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Cache entry for component data
|
|
186
|
+
*/
|
|
187
|
+
interface CacheEntry {
|
|
188
|
+
/** Cached component data */
|
|
189
|
+
data: ComponentData;
|
|
190
|
+
/** Timestamp when cached */
|
|
191
|
+
timestamp: number;
|
|
192
|
+
/** Version of cached component */
|
|
193
|
+
version: string;
|
|
194
|
+
/** Number of times accessed */
|
|
195
|
+
accessCount: number;
|
|
196
|
+
/** Last access timestamp */
|
|
197
|
+
lastAccessed: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Cache configuration
|
|
201
|
+
*/
|
|
202
|
+
interface CacheConfig {
|
|
203
|
+
/** Maximum number of entries in cache */
|
|
204
|
+
maxEntries?: number;
|
|
205
|
+
/** Time-to-live in milliseconds */
|
|
206
|
+
ttl?: number;
|
|
207
|
+
/** Storage key prefix for localStorage */
|
|
208
|
+
storageKeyPrefix?: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Cache strategy type
|
|
212
|
+
*/
|
|
213
|
+
type CacheStrategy = 'memory' | 'localStorage' | 'none';
|
|
214
|
+
/**
|
|
215
|
+
* Retry configuration for failed fetches
|
|
216
|
+
*/
|
|
217
|
+
interface RetryConfig {
|
|
218
|
+
/** Maximum number of retries */
|
|
219
|
+
maxRetries?: number;
|
|
220
|
+
/** Initial delay in ms */
|
|
221
|
+
initialDelay?: number;
|
|
222
|
+
/** Maximum delay in ms */
|
|
223
|
+
maxDelay?: number;
|
|
224
|
+
/** Backoff multiplier */
|
|
225
|
+
backoffMultiplier?: number;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Options for fetching a component
|
|
229
|
+
*/
|
|
230
|
+
interface FetchOptions {
|
|
231
|
+
/** Version specifier */
|
|
232
|
+
version?: string;
|
|
233
|
+
/** API key for authentication */
|
|
234
|
+
apiKey?: string;
|
|
235
|
+
/** Cache strategy */
|
|
236
|
+
cacheStrategy?: CacheStrategy;
|
|
237
|
+
/** Cache configuration */
|
|
238
|
+
cacheConfig?: CacheConfig;
|
|
239
|
+
/** Retry configuration */
|
|
240
|
+
retryConfig?: Partial<RetryConfig>;
|
|
241
|
+
/** Skip cache and force fetch */
|
|
242
|
+
forceRefresh?: boolean;
|
|
243
|
+
/** Abort signal for cancellation */
|
|
244
|
+
signal?: AbortSignal;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Result of a fetch operation
|
|
248
|
+
*/
|
|
249
|
+
interface FetchResult {
|
|
250
|
+
/** Fetched component data */
|
|
251
|
+
data: ComponentData;
|
|
252
|
+
/** Whether data came from cache */
|
|
253
|
+
fromCache: boolean;
|
|
254
|
+
/** Resolved version */
|
|
255
|
+
version: string;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Result of a single assertion
|
|
259
|
+
*/
|
|
260
|
+
interface AssertionResult$1 {
|
|
261
|
+
/** Whether assertion passed */
|
|
262
|
+
passed: boolean;
|
|
263
|
+
/** The assertion that was checked */
|
|
264
|
+
assertion: Assertion$1;
|
|
265
|
+
/** Actual value found */
|
|
266
|
+
actual?: any;
|
|
267
|
+
/** Error message if failed */
|
|
268
|
+
error?: string;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Result of running a test case
|
|
272
|
+
*/
|
|
273
|
+
interface TestCaseResult {
|
|
274
|
+
/** Test case ID */
|
|
275
|
+
id: string;
|
|
276
|
+
/** Test case name */
|
|
277
|
+
name: string;
|
|
278
|
+
/** Whether all assertions passed */
|
|
279
|
+
passed: boolean;
|
|
280
|
+
/** Individual assertion results */
|
|
281
|
+
assertions: AssertionResult$1[];
|
|
282
|
+
/** Execution time in ms */
|
|
283
|
+
duration: number;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Summary of all test results
|
|
287
|
+
*/
|
|
288
|
+
interface TestSummary$1 {
|
|
289
|
+
/** Total number of tests */
|
|
290
|
+
total: number;
|
|
291
|
+
/** Number of passed tests */
|
|
292
|
+
passed: number;
|
|
293
|
+
/** Number of failed tests */
|
|
294
|
+
failed: number;
|
|
295
|
+
/** Individual test results */
|
|
296
|
+
results: TestCaseResult[];
|
|
297
|
+
/** Total execution time in ms */
|
|
298
|
+
duration: number;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Vanilla DOM Renderer
|
|
303
|
+
* Renders Layout JSON to native DOM elements
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Render Layout JSON to DOM
|
|
308
|
+
*/
|
|
309
|
+
declare function render(options: RenderOptions): RenderResult;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Template Binding Resolution
|
|
313
|
+
* Resolves {{path}} syntax in templates using binding context
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Check if a string contains template syntax
|
|
318
|
+
*/
|
|
319
|
+
declare function hasTemplateSyntax(value: unknown): value is string;
|
|
320
|
+
/**
|
|
321
|
+
* Resolve a binding path to its value from context
|
|
322
|
+
*
|
|
323
|
+
* @param path - The path to resolve (e.g., "props.title", "state.count")
|
|
324
|
+
* @param context - The binding context containing props, state, context
|
|
325
|
+
* @returns The resolved value or undefined if not found
|
|
326
|
+
*/
|
|
327
|
+
declare function resolveBindingPath(path: string, context: BindingContext): any;
|
|
328
|
+
/**
|
|
329
|
+
* Resolve a template string with bindings
|
|
330
|
+
* Replaces all {{path}} occurrences with resolved values
|
|
331
|
+
*
|
|
332
|
+
* @param template - The template string containing {{path}} bindings
|
|
333
|
+
* @param context - The binding context
|
|
334
|
+
* @returns The resolved string
|
|
335
|
+
*/
|
|
336
|
+
declare function resolveTemplate(template: string, context: BindingContext): string;
|
|
337
|
+
/**
|
|
338
|
+
* Resolve a template and return the raw value (not stringified)
|
|
339
|
+
* Useful for non-string values like objects, arrays, booleans
|
|
340
|
+
*/
|
|
341
|
+
declare function resolveTemplateValue(template: string, context: BindingContext): any;
|
|
342
|
+
/**
|
|
343
|
+
* Recursively resolve all template bindings in an object or array
|
|
344
|
+
*
|
|
345
|
+
* @param input - The input value (string, object, array, or primitive)
|
|
346
|
+
* @param context - The binding context
|
|
347
|
+
* @returns The input with all templates resolved
|
|
348
|
+
*/
|
|
349
|
+
declare function resolveTemplatesDeep<T>(input: T, context: BindingContext): T;
|
|
350
|
+
/**
|
|
351
|
+
* Extract all binding keys from a template string
|
|
352
|
+
*
|
|
353
|
+
* @param template - The template string
|
|
354
|
+
* @returns Array of binding keys found
|
|
355
|
+
*/
|
|
356
|
+
declare function extractBindingKeys(template: string): string[];
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Style Processing
|
|
360
|
+
* Handles CSS styles, variables, and class names for DOM elements
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Convert camelCase to kebab-case
|
|
365
|
+
*/
|
|
366
|
+
declare function camelToKebab(str: string): string;
|
|
367
|
+
/**
|
|
368
|
+
* Format a style value, adding px units if needed
|
|
369
|
+
*/
|
|
370
|
+
declare function formatStyleValue(property: string, value: any): string;
|
|
371
|
+
/**
|
|
372
|
+
* Process a style object, resolving templates and formatting values
|
|
373
|
+
*/
|
|
374
|
+
declare function processStyles(style: Record<string, any> | undefined, context: BindingContext): Record<string, string>;
|
|
375
|
+
/**
|
|
376
|
+
* Apply styles to a DOM element
|
|
377
|
+
*/
|
|
378
|
+
declare function applyStyles(element: HTMLElement, styles: Record<string, string>): void;
|
|
379
|
+
/**
|
|
380
|
+
* Build combined styles from element configuration
|
|
381
|
+
*/
|
|
382
|
+
declare function buildElementStyles(element: LayoutElement, context: BindingContext): Record<string, string>;
|
|
383
|
+
/**
|
|
384
|
+
* Build class name string from element configuration
|
|
385
|
+
*/
|
|
386
|
+
declare function buildClassName(element: LayoutElement, context: BindingContext): string;
|
|
387
|
+
/**
|
|
388
|
+
* Clear all inline styles from an element
|
|
389
|
+
*/
|
|
390
|
+
declare function clearStyles(element: HTMLElement): void;
|
|
391
|
+
/**
|
|
392
|
+
* Update styles on an element (diff and patch)
|
|
393
|
+
*/
|
|
394
|
+
declare function updateStyles(element: HTMLElement, oldStyles: Record<string, string>, newStyles: Record<string, string>): void;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Component Cache System
|
|
398
|
+
* In-memory and localStorage caching with LRU eviction
|
|
399
|
+
*/
|
|
400
|
+
|
|
401
|
+
/** Default cache configuration */
|
|
402
|
+
declare const DEFAULT_CACHE_CONFIG: Required<CacheConfig>;
|
|
403
|
+
/**
|
|
404
|
+
* Generate cache key for component
|
|
405
|
+
*/
|
|
406
|
+
declare function getCacheKey(id: string, version?: string): string;
|
|
407
|
+
/**
|
|
408
|
+
* Clear memory cache
|
|
409
|
+
*/
|
|
410
|
+
declare function clearMemoryCache(): void;
|
|
411
|
+
/**
|
|
412
|
+
* Get memory cache size
|
|
413
|
+
*/
|
|
414
|
+
declare function getMemoryCacheSize(): number;
|
|
415
|
+
/**
|
|
416
|
+
* Clear localStorage cache
|
|
417
|
+
*/
|
|
418
|
+
declare function clearLocalStorageCache(config?: CacheConfig): void;
|
|
419
|
+
/**
|
|
420
|
+
* Get component from cache (tries memory first, then localStorage)
|
|
421
|
+
*/
|
|
422
|
+
declare function getFromCache(id: string, version?: string, strategy?: CacheStrategy, config?: CacheConfig): ComponentData | null;
|
|
423
|
+
/**
|
|
424
|
+
* Set component in cache
|
|
425
|
+
*/
|
|
426
|
+
declare function setInCache(id: string, version: string, data: ComponentData, strategy?: CacheStrategy, config?: CacheConfig): void;
|
|
427
|
+
/**
|
|
428
|
+
* Clear all caches
|
|
429
|
+
*/
|
|
430
|
+
declare function clearAllCaches(config?: CacheConfig): void;
|
|
431
|
+
/**
|
|
432
|
+
* Invalidate specific component from all caches
|
|
433
|
+
*/
|
|
434
|
+
declare function invalidateCache(id: string, version?: string, config?: CacheConfig): void;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Component Fetcher
|
|
438
|
+
* Fetches component data from registry with retry logic
|
|
439
|
+
*/
|
|
440
|
+
|
|
441
|
+
/** Default retry configuration */
|
|
442
|
+
declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
|
|
443
|
+
/**
|
|
444
|
+
* Configure the registry base URL
|
|
445
|
+
*/
|
|
446
|
+
declare function setRegistryUrl(url: string): void;
|
|
447
|
+
/**
|
|
448
|
+
* Get the registry base URL
|
|
449
|
+
*/
|
|
450
|
+
declare function getRegistryUrl(): string;
|
|
451
|
+
/**
|
|
452
|
+
* Fetch component with caching and retry
|
|
453
|
+
*/
|
|
454
|
+
declare function fetchComponent(id: string, options?: FetchOptions): Promise<FetchResult>;
|
|
455
|
+
/**
|
|
456
|
+
* Prefetch components for faster loading
|
|
457
|
+
*/
|
|
458
|
+
declare function prefetchComponents(ids: Array<{
|
|
459
|
+
id: string;
|
|
460
|
+
version?: string;
|
|
461
|
+
}>, options?: Omit<FetchOptions, 'version'>): Promise<void>;
|
|
462
|
+
/**
|
|
463
|
+
* Check if component is available (in cache or online)
|
|
464
|
+
*/
|
|
465
|
+
declare function isComponentAvailable(id: string, version?: string, options?: Pick<FetchOptions, 'apiKey' | 'cacheStrategy' | 'cacheConfig'>): Promise<{
|
|
466
|
+
available: boolean;
|
|
467
|
+
cached: boolean;
|
|
468
|
+
}>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Semantic Version Utilities
|
|
472
|
+
* Parsing, comparison, and range resolution for semver
|
|
473
|
+
*/
|
|
474
|
+
/** Parsed semantic version */
|
|
475
|
+
interface ParsedVersion {
|
|
476
|
+
major: number;
|
|
477
|
+
minor: number;
|
|
478
|
+
patch: number;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Parse a semantic version string
|
|
482
|
+
* @returns Parsed version or null if invalid
|
|
483
|
+
*/
|
|
484
|
+
declare function parseVersion(version: string): ParsedVersion | null;
|
|
485
|
+
/**
|
|
486
|
+
* Compare two versions
|
|
487
|
+
* @returns -1 if a < b, 0 if a == b, 1 if a > b
|
|
488
|
+
*/
|
|
489
|
+
declare function compareVersions(a: string, b: string): number;
|
|
490
|
+
/**
|
|
491
|
+
* Check if a version satisfies a specifier
|
|
492
|
+
* Supports: exact (1.2.3), caret (^1.2.3), tilde (~1.2.3), latest, *
|
|
493
|
+
*/
|
|
494
|
+
declare function satisfiesVersion(version: string, specifier: string): boolean;
|
|
495
|
+
/**
|
|
496
|
+
* Find the best matching version from a list
|
|
497
|
+
* @param versions - Available versions (sorted newest first recommended)
|
|
498
|
+
* @param specifier - Version specifier to match
|
|
499
|
+
* @returns Best matching version or null if none match
|
|
500
|
+
*/
|
|
501
|
+
declare function resolveVersion(versions: string[], specifier?: string): string | null;
|
|
502
|
+
/**
|
|
503
|
+
* Get next version based on bump type
|
|
504
|
+
*/
|
|
505
|
+
declare function bumpVersion(currentVersion: string, bumpType: 'major' | 'minor' | 'patch'): string;
|
|
506
|
+
/**
|
|
507
|
+
* Check if a string is a valid version specifier
|
|
508
|
+
*/
|
|
509
|
+
declare function isValidSpecifier(specifier: string): boolean;
|
|
510
|
+
/**
|
|
511
|
+
* Format a version for display
|
|
512
|
+
*/
|
|
513
|
+
declare function formatVersion(version: string): string;
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Test Runner for Servly Components
|
|
517
|
+
*
|
|
518
|
+
* Runs test cases against components to validate prop behavior
|
|
519
|
+
* and DOM output matches expected assertions.
|
|
520
|
+
*/
|
|
521
|
+
|
|
522
|
+
interface TestCase {
|
|
523
|
+
id: string;
|
|
524
|
+
name: string;
|
|
525
|
+
description?: string;
|
|
526
|
+
props: Record<string, any>;
|
|
527
|
+
assertions: Assertion[];
|
|
528
|
+
}
|
|
529
|
+
interface Assertion {
|
|
530
|
+
type: 'exists' | 'text' | 'attribute' | 'class' | 'style' | 'count' | 'visible';
|
|
531
|
+
selector: string;
|
|
532
|
+
expected?: any;
|
|
533
|
+
attribute?: string;
|
|
534
|
+
property?: string;
|
|
535
|
+
}
|
|
536
|
+
interface TestResult {
|
|
537
|
+
testId: string;
|
|
538
|
+
testName: string;
|
|
539
|
+
passed: boolean;
|
|
540
|
+
assertions: AssertionResult[];
|
|
541
|
+
duration: number;
|
|
542
|
+
error?: string;
|
|
543
|
+
}
|
|
544
|
+
interface AssertionResult {
|
|
545
|
+
assertion: Assertion;
|
|
546
|
+
passed: boolean;
|
|
547
|
+
actual?: any;
|
|
548
|
+
expected?: any;
|
|
549
|
+
message?: string;
|
|
550
|
+
}
|
|
551
|
+
interface TestSummary {
|
|
552
|
+
total: number;
|
|
553
|
+
passed: number;
|
|
554
|
+
failed: number;
|
|
555
|
+
duration: number;
|
|
556
|
+
results: TestResult[];
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Run a single test case against a component
|
|
560
|
+
*/
|
|
561
|
+
declare function runTestCase(elements: LayoutElement[], testCase: TestCase, container?: HTMLElement): TestResult;
|
|
562
|
+
/**
|
|
563
|
+
* Run all test cases for a component
|
|
564
|
+
*/
|
|
565
|
+
declare function runAllTests(elements: LayoutElement[], testCases: TestCase[]): TestSummary;
|
|
566
|
+
/**
|
|
567
|
+
* Validate a single assertion against the DOM
|
|
568
|
+
*/
|
|
569
|
+
declare function validateAssertion(container: HTMLElement, assertion: Assertion): AssertionResult;
|
|
570
|
+
/**
|
|
571
|
+
* Validate props against prop definitions
|
|
572
|
+
*/
|
|
573
|
+
declare function validateProps(props: Record<string, any>, definitions: PropDefinition[]): {
|
|
574
|
+
valid: boolean;
|
|
575
|
+
errors: string[];
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* Generate test cases from prop definitions
|
|
579
|
+
*/
|
|
580
|
+
declare function generateTestCases(definitions: PropDefinition[]): TestCase[];
|
|
581
|
+
|
|
582
|
+
export { type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BindingContext, type CacheConfig, type CacheEntry, type CacheStrategy, type ComponentData, DEFAULT_CACHE_CONFIG, DEFAULT_RETRY_CONFIG, 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, buildClassName, buildElementStyles, bumpVersion, camelToKebab, clearAllCaches, clearLocalStorageCache, clearMemoryCache, clearStyles, compareVersions, extractBindingKeys, fetchComponent, formatStyleValue, formatVersion, generateTestCases, getCacheKey, getFromCache, getMemoryCacheSize, getRegistryUrl, hasTemplateSyntax, invalidateCache, isComponentAvailable, isValidSpecifier, parseVersion, prefetchComponents, processStyles, render, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setInCache, setRegistryUrl, updateStyles, validateAssertion, validateProps };
|