@servlyadmin/runtime-core 0.1.7 → 0.1.8
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-IWFVKY5N.js +154 -0
- package/dist/index.cjs +2136 -160
- package/dist/index.d.cts +631 -2
- package/dist/index.d.ts +631 -2
- package/dist/index.js +1955 -178
- package/dist/tailwind-CGAHPC3O.js +24 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,10 @@ interface ElementConfig {
|
|
|
71
71
|
blueprint?: string;
|
|
72
72
|
/** Blueprint version specifier */
|
|
73
73
|
blueprintVersion?: string;
|
|
74
|
+
/** Slot name for slot elements */
|
|
75
|
+
slotName?: string;
|
|
76
|
+
/** Fallback content for empty slots */
|
|
77
|
+
fallback?: any[];
|
|
74
78
|
/** Data attributes */
|
|
75
79
|
[key: `data-${string}`]: string | undefined;
|
|
76
80
|
/** Aria attributes */
|
|
@@ -98,6 +102,8 @@ interface LayoutElement {
|
|
|
98
102
|
children?: string[];
|
|
99
103
|
/** Element name for debugging */
|
|
100
104
|
name?: string;
|
|
105
|
+
/** Slot name (for slot elements that can receive external content) */
|
|
106
|
+
slotName?: string;
|
|
101
107
|
}
|
|
102
108
|
/**
|
|
103
109
|
* Context for resolving template bindings
|
|
@@ -139,6 +145,31 @@ interface RenderOptions {
|
|
|
139
145
|
onDependencyNeeded?: (id: string, version?: string) => Promise<BundledComponent | undefined>;
|
|
140
146
|
/** Callback when rendering a referenced component */
|
|
141
147
|
onComponentRender?: (id: string, container: HTMLElement) => void;
|
|
148
|
+
/** Map of view ID to view data for isComponentView resolution */
|
|
149
|
+
views?: Map<string, {
|
|
150
|
+
id: string;
|
|
151
|
+
layout: LayoutElement[];
|
|
152
|
+
props?: any;
|
|
153
|
+
}>;
|
|
154
|
+
/** Enable built-in state management for Servly plugin actions */
|
|
155
|
+
enableStateManager?: boolean;
|
|
156
|
+
/** Initial state for the state manager */
|
|
157
|
+
initialState?: Record<string, any>;
|
|
158
|
+
/** Callback when state changes */
|
|
159
|
+
onStateChange?: (event: {
|
|
160
|
+
key: string;
|
|
161
|
+
value: any;
|
|
162
|
+
previousValue: any;
|
|
163
|
+
}) => void;
|
|
164
|
+
/** Custom plugin executors for event system */
|
|
165
|
+
pluginExecutors?: Record<string, (action: any, context: any) => any>;
|
|
166
|
+
/** Callback when navigation is requested */
|
|
167
|
+
onNavigate?: (url: string, options?: {
|
|
168
|
+
replace?: boolean;
|
|
169
|
+
state?: any;
|
|
170
|
+
}) => void;
|
|
171
|
+
/** Callback for external API calls */
|
|
172
|
+
onApiCall?: (config: any) => Promise<any>;
|
|
142
173
|
}
|
|
143
174
|
/**
|
|
144
175
|
* Result of a render operation
|
|
@@ -235,6 +266,21 @@ interface BundledComponent {
|
|
|
235
266
|
interface ComponentBundle {
|
|
236
267
|
[componentIdAtVersion: string]: BundledComponent;
|
|
237
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* View data structure (matches application views)
|
|
271
|
+
*/
|
|
272
|
+
interface ViewData {
|
|
273
|
+
/** View ID */
|
|
274
|
+
id: string;
|
|
275
|
+
/** View name */
|
|
276
|
+
name?: string;
|
|
277
|
+
/** Layout JSON elements */
|
|
278
|
+
layout: LayoutElement[];
|
|
279
|
+
/** Props interface definition */
|
|
280
|
+
propsInterface?: PropDefinition[];
|
|
281
|
+
/** Whether this is the main/entry view */
|
|
282
|
+
isMain?: boolean;
|
|
283
|
+
}
|
|
238
284
|
/**
|
|
239
285
|
* Component data from registry
|
|
240
286
|
*/
|
|
@@ -265,6 +311,8 @@ interface ComponentData {
|
|
|
265
311
|
dependencies?: DependencyManifest;
|
|
266
312
|
/** Bundled dependencies - included component data */
|
|
267
313
|
bundle?: ComponentBundle;
|
|
314
|
+
/** All views needed to render this component (returned by API) */
|
|
315
|
+
views?: ViewData[];
|
|
268
316
|
}
|
|
269
317
|
/**
|
|
270
318
|
* Cache entry for component data
|
|
@@ -337,6 +385,8 @@ interface FetchOptions {
|
|
|
337
385
|
includeBundle?: boolean;
|
|
338
386
|
/** Maximum bundle size in bytes before switching to lazy */
|
|
339
387
|
maxBundleSize?: number;
|
|
388
|
+
/** Include all views needed to render this component (default: true) */
|
|
389
|
+
includeViews?: boolean;
|
|
340
390
|
}
|
|
341
391
|
/**
|
|
342
392
|
* Result of a fetch operation
|
|
@@ -355,6 +405,12 @@ interface FetchResult {
|
|
|
355
405
|
id: string;
|
|
356
406
|
version: string;
|
|
357
407
|
}>;
|
|
408
|
+
/** Views map built from API response (ready for render()) */
|
|
409
|
+
views?: Map<string, {
|
|
410
|
+
id: string;
|
|
411
|
+
layout: LayoutElement[];
|
|
412
|
+
props?: any;
|
|
413
|
+
}>;
|
|
358
414
|
}
|
|
359
415
|
/**
|
|
360
416
|
* Result of a single assertion
|
|
@@ -403,7 +459,10 @@ interface TestSummary$1 {
|
|
|
403
459
|
/**
|
|
404
460
|
* Vanilla DOM Renderer
|
|
405
461
|
* Renders Layout JSON to native DOM elements
|
|
406
|
-
* Supports component dependencies via componentViewRef and blueprint
|
|
462
|
+
* Supports component dependencies via componentViewRef, isComponentView, and blueprint
|
|
463
|
+
*
|
|
464
|
+
* This renderer is designed to produce output consistent with RenderElements.tsx
|
|
465
|
+
* in the builder, enabling preview and production rendering to match.
|
|
407
466
|
*/
|
|
408
467
|
|
|
409
468
|
/**
|
|
@@ -434,10 +493,119 @@ declare function renderDynamicList(options: {
|
|
|
434
493
|
/** Parent context */
|
|
435
494
|
context?: BindingContext;
|
|
436
495
|
}): RenderResult[];
|
|
496
|
+
/**
|
|
497
|
+
* Render a single node/element by ID from a layout
|
|
498
|
+
* Useful for rendering specific parts of a component
|
|
499
|
+
*/
|
|
500
|
+
declare function renderNode(options: {
|
|
501
|
+
/** Container element to render into */
|
|
502
|
+
container: HTMLElement;
|
|
503
|
+
/** All layout elements */
|
|
504
|
+
elements: LayoutElement[];
|
|
505
|
+
/** ID of the node to render */
|
|
506
|
+
nodeId: string;
|
|
507
|
+
/** Binding context */
|
|
508
|
+
context: BindingContext;
|
|
509
|
+
/** Whether to include children */
|
|
510
|
+
includeChildren?: boolean;
|
|
511
|
+
/** Event handlers */
|
|
512
|
+
eventHandlers?: Record<string, Record<string, (e: Event) => void>>;
|
|
513
|
+
/** Component registry */
|
|
514
|
+
componentRegistry?: ComponentRegistry;
|
|
515
|
+
/** Views map */
|
|
516
|
+
views?: Map<string, {
|
|
517
|
+
id: string;
|
|
518
|
+
layout: LayoutElement[];
|
|
519
|
+
props?: any;
|
|
520
|
+
}>;
|
|
521
|
+
}): RenderResult | null;
|
|
522
|
+
/**
|
|
523
|
+
* Render into a shadow DOM for style isolation
|
|
524
|
+
*/
|
|
525
|
+
declare function renderInShadow(options: RenderOptions & {
|
|
526
|
+
/** Shadow DOM mode */
|
|
527
|
+
mode?: 'open' | 'closed';
|
|
528
|
+
/** Styles to inject into shadow DOM */
|
|
529
|
+
styles?: string;
|
|
530
|
+
/** Whether to inject Tailwind CSS */
|
|
531
|
+
injectTailwind?: boolean;
|
|
532
|
+
}): RenderResult & {
|
|
533
|
+
shadowRoot: ShadowRoot;
|
|
534
|
+
};
|
|
535
|
+
/**
|
|
536
|
+
* Create a standalone Servly renderer with Tailwind CSS
|
|
537
|
+
* This is the main entry point for standalone usage
|
|
538
|
+
*/
|
|
539
|
+
declare function createServlyRenderer(options: {
|
|
540
|
+
/** Container element or selector */
|
|
541
|
+
container: HTMLElement | string;
|
|
542
|
+
/** Whether to inject Tailwind CSS */
|
|
543
|
+
injectTailwind?: boolean;
|
|
544
|
+
/** Custom Tailwind config */
|
|
545
|
+
tailwindConfig?: Record<string, any>;
|
|
546
|
+
/** Initial state */
|
|
547
|
+
initialState?: Record<string, any>;
|
|
548
|
+
/** State change callback */
|
|
549
|
+
onStateChange?: (event: {
|
|
550
|
+
key: string;
|
|
551
|
+
value: any;
|
|
552
|
+
previousValue: any;
|
|
553
|
+
}) => void;
|
|
554
|
+
/** Navigation callback */
|
|
555
|
+
onNavigate?: (url: string, options?: {
|
|
556
|
+
replace?: boolean;
|
|
557
|
+
state?: any;
|
|
558
|
+
}) => void;
|
|
559
|
+
}): Promise<{
|
|
560
|
+
render: (elements: LayoutElement[], context?: BindingContext) => RenderResult;
|
|
561
|
+
renderNode: (elements: LayoutElement[], nodeId: string, context?: BindingContext) => RenderResult | null;
|
|
562
|
+
renderDynamicList: typeof renderDynamicList;
|
|
563
|
+
destroy: () => void;
|
|
564
|
+
}>;
|
|
565
|
+
/**
|
|
566
|
+
* Create a views Map from an array of view objects
|
|
567
|
+
* Helper function to convert application views to the format expected by render()
|
|
568
|
+
*
|
|
569
|
+
* @param views - Array of view objects with id and layout
|
|
570
|
+
* @returns Map of view ID to view data
|
|
571
|
+
*/
|
|
572
|
+
declare function createViewsMap(views: Array<{
|
|
573
|
+
id?: string;
|
|
574
|
+
_id?: string;
|
|
575
|
+
layout: LayoutElement[];
|
|
576
|
+
props?: any;
|
|
577
|
+
}>): Map<string, {
|
|
578
|
+
id: string;
|
|
579
|
+
layout: LayoutElement[];
|
|
580
|
+
props?: any;
|
|
581
|
+
}>;
|
|
582
|
+
/**
|
|
583
|
+
* Extract all component view IDs referenced in a layout
|
|
584
|
+
* Useful for pre-fetching required views
|
|
585
|
+
*
|
|
586
|
+
* @param elements - Layout elements to scan
|
|
587
|
+
* @returns Array of unique view IDs referenced
|
|
588
|
+
*/
|
|
589
|
+
declare function extractReferencedViewIds(elements: LayoutElement[]): string[];
|
|
590
|
+
/**
|
|
591
|
+
* Recursively extract all view IDs from a set of views
|
|
592
|
+
* Follows component view references to find all dependencies
|
|
593
|
+
*
|
|
594
|
+
* @param views - Map of all available views
|
|
595
|
+
* @param startViewId - The view to start from
|
|
596
|
+
* @returns Set of all view IDs needed to render the start view
|
|
597
|
+
*/
|
|
598
|
+
declare function collectAllViewDependencies(views: Map<string, {
|
|
599
|
+
id: string;
|
|
600
|
+
layout: LayoutElement[];
|
|
601
|
+
}>, startViewId: string): Set<string>;
|
|
437
602
|
|
|
438
603
|
/**
|
|
439
604
|
* Template Binding Resolution
|
|
440
605
|
* Resolves {{path}} syntax in templates using binding context
|
|
606
|
+
*
|
|
607
|
+
* This module provides template resolution similar to RenderElements.tsx's
|
|
608
|
+
* retrieveBody function, but in a framework-agnostic way.
|
|
441
609
|
*/
|
|
442
610
|
|
|
443
611
|
/**
|
|
@@ -1210,4 +1378,465 @@ declare function getLongTaskObserver(): LongTaskObserver;
|
|
|
1210
1378
|
*/
|
|
1211
1379
|
declare function resetLongTaskObserver(): void;
|
|
1212
1380
|
|
|
1213
|
-
|
|
1381
|
+
/**
|
|
1382
|
+
* State Manager for Runtime Core
|
|
1383
|
+
* Provides state management capabilities similar to RenderElements.tsx
|
|
1384
|
+
* but in a framework-agnostic way.
|
|
1385
|
+
*/
|
|
1386
|
+
interface StateChangeEvent {
|
|
1387
|
+
key: string;
|
|
1388
|
+
value: any;
|
|
1389
|
+
previousValue: any;
|
|
1390
|
+
operation: 'set' | 'merge' | 'delete' | 'append' | 'prepend' | 'toggle';
|
|
1391
|
+
elementId?: string;
|
|
1392
|
+
timestamp: number;
|
|
1393
|
+
}
|
|
1394
|
+
interface StateManagerConfig {
|
|
1395
|
+
/** Initial state */
|
|
1396
|
+
initialState?: Record<string, any>;
|
|
1397
|
+
/** Callback when state changes */
|
|
1398
|
+
onStateChange?: (event: StateChangeEvent) => void;
|
|
1399
|
+
/** Whether to persist state to localStorage */
|
|
1400
|
+
persistToLocalStorage?: boolean;
|
|
1401
|
+
/** localStorage key prefix */
|
|
1402
|
+
localStoragePrefix?: string;
|
|
1403
|
+
/** Whether to sync with sessionStorage */
|
|
1404
|
+
syncWithSessionStorage?: boolean;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Framework-agnostic state manager
|
|
1408
|
+
* Provides setState, getState, and state change notifications
|
|
1409
|
+
*/
|
|
1410
|
+
declare class StateManager {
|
|
1411
|
+
private state;
|
|
1412
|
+
private listeners;
|
|
1413
|
+
private config;
|
|
1414
|
+
constructor(config?: StateManagerConfig);
|
|
1415
|
+
/**
|
|
1416
|
+
* Get value by path from state
|
|
1417
|
+
*/
|
|
1418
|
+
get(path: string): any;
|
|
1419
|
+
/**
|
|
1420
|
+
* Get the entire state object
|
|
1421
|
+
*/
|
|
1422
|
+
getState(): Record<string, any>;
|
|
1423
|
+
/**
|
|
1424
|
+
* Set a value in state
|
|
1425
|
+
*/
|
|
1426
|
+
set(key: string, value: any, elementId?: string): void;
|
|
1427
|
+
/**
|
|
1428
|
+
* Merge an object into state at the given path
|
|
1429
|
+
*/
|
|
1430
|
+
merge(key: string, value: Record<string, any>, deep?: boolean, elementId?: string): void;
|
|
1431
|
+
/**
|
|
1432
|
+
* Delete a key from state
|
|
1433
|
+
*/
|
|
1434
|
+
delete(key: string, elementId?: string): void;
|
|
1435
|
+
/**
|
|
1436
|
+
* Append to an array in state
|
|
1437
|
+
*/
|
|
1438
|
+
append(key: string, value: any, elementId?: string): void;
|
|
1439
|
+
/**
|
|
1440
|
+
* Prepend to an array in state
|
|
1441
|
+
*/
|
|
1442
|
+
prepend(key: string, value: any, elementId?: string): void;
|
|
1443
|
+
/**
|
|
1444
|
+
* Toggle a boolean value in state
|
|
1445
|
+
*/
|
|
1446
|
+
toggle(key: string, elementId?: string): void;
|
|
1447
|
+
/**
|
|
1448
|
+
* Subscribe to state changes
|
|
1449
|
+
*/
|
|
1450
|
+
subscribe(listener: (event: StateChangeEvent) => void): () => void;
|
|
1451
|
+
/**
|
|
1452
|
+
* Notify all listeners of a state change
|
|
1453
|
+
*/
|
|
1454
|
+
private notifyChange;
|
|
1455
|
+
/**
|
|
1456
|
+
* Load state from localStorage
|
|
1457
|
+
*/
|
|
1458
|
+
private loadFromLocalStorage;
|
|
1459
|
+
/**
|
|
1460
|
+
* Save state to localStorage
|
|
1461
|
+
*/
|
|
1462
|
+
private saveToLocalStorage;
|
|
1463
|
+
/**
|
|
1464
|
+
* Clear all state
|
|
1465
|
+
*/
|
|
1466
|
+
clear(): void;
|
|
1467
|
+
}
|
|
1468
|
+
/**
|
|
1469
|
+
* Get value by dot-notation path
|
|
1470
|
+
*/
|
|
1471
|
+
declare function getValueByPath(obj: any, path: string): any;
|
|
1472
|
+
/**
|
|
1473
|
+
* Set value by dot-notation path
|
|
1474
|
+
*/
|
|
1475
|
+
declare function setValueByPath(obj: any, path: string, value: any): void;
|
|
1476
|
+
/**
|
|
1477
|
+
* Delete value by dot-notation path
|
|
1478
|
+
*/
|
|
1479
|
+
declare function deleteValueByPath(obj: any, path: string): void;
|
|
1480
|
+
/**
|
|
1481
|
+
* Deep merge two objects
|
|
1482
|
+
*/
|
|
1483
|
+
declare function deepMerge(target: any, source: any): any;
|
|
1484
|
+
/**
|
|
1485
|
+
* Add a class to an element's className string
|
|
1486
|
+
*/
|
|
1487
|
+
declare function addClass(currentClasses: string, classToAdd: string): string;
|
|
1488
|
+
/**
|
|
1489
|
+
* Remove a class from an element's className string
|
|
1490
|
+
*/
|
|
1491
|
+
declare function removeClass(currentClasses: string, classToRemove: string): string;
|
|
1492
|
+
/**
|
|
1493
|
+
* Toggle a class in an element's className string
|
|
1494
|
+
*/
|
|
1495
|
+
declare function toggleClass(currentClasses: string, classToToggle: string): string;
|
|
1496
|
+
/**
|
|
1497
|
+
* Check if a className string contains a specific class
|
|
1498
|
+
*/
|
|
1499
|
+
declare function hasClass(currentClasses: string, classToCheck: string): boolean;
|
|
1500
|
+
/**
|
|
1501
|
+
* Get value from localStorage with JSON parsing
|
|
1502
|
+
*/
|
|
1503
|
+
declare function getLocalStorage(key: string, defaultValue?: any): any;
|
|
1504
|
+
/**
|
|
1505
|
+
* Set value in localStorage with JSON stringification
|
|
1506
|
+
*/
|
|
1507
|
+
declare function setLocalStorage(key: string, value: any): void;
|
|
1508
|
+
/**
|
|
1509
|
+
* Remove value from localStorage
|
|
1510
|
+
*/
|
|
1511
|
+
declare function removeLocalStorage(key: string): void;
|
|
1512
|
+
/**
|
|
1513
|
+
* Get value from sessionStorage with JSON parsing
|
|
1514
|
+
*/
|
|
1515
|
+
declare function getSessionStorage(key: string, defaultValue?: any): any;
|
|
1516
|
+
/**
|
|
1517
|
+
* Set value in sessionStorage with JSON stringification
|
|
1518
|
+
*/
|
|
1519
|
+
declare function setSessionStorage(key: string, value: any): void;
|
|
1520
|
+
/**
|
|
1521
|
+
* Remove value from sessionStorage
|
|
1522
|
+
*/
|
|
1523
|
+
declare function removeSessionStorage(key: string): void;
|
|
1524
|
+
interface NavigationOptions {
|
|
1525
|
+
/** Replace current history entry instead of pushing */
|
|
1526
|
+
replace?: boolean;
|
|
1527
|
+
/** State to pass to the new route */
|
|
1528
|
+
state?: any;
|
|
1529
|
+
/** Open in new tab */
|
|
1530
|
+
newTab?: boolean;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Navigate to a URL
|
|
1534
|
+
* Works with both hash-based and history-based routing
|
|
1535
|
+
*/
|
|
1536
|
+
declare function navigateTo(url: string, options?: NavigationOptions): void;
|
|
1537
|
+
/**
|
|
1538
|
+
* Go back in history
|
|
1539
|
+
*/
|
|
1540
|
+
declare function goBack(): void;
|
|
1541
|
+
/**
|
|
1542
|
+
* Go forward in history
|
|
1543
|
+
*/
|
|
1544
|
+
declare function goForward(): void;
|
|
1545
|
+
/**
|
|
1546
|
+
* Get current URL information
|
|
1547
|
+
*/
|
|
1548
|
+
declare function getUrlInfo(): {
|
|
1549
|
+
href: string;
|
|
1550
|
+
pathname: string;
|
|
1551
|
+
search: string;
|
|
1552
|
+
hash: string;
|
|
1553
|
+
searchParams: Record<string, string>;
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
/**
|
|
1557
|
+
* Event System for Runtime Core
|
|
1558
|
+
* Provides event handling capabilities similar to RenderElements.tsx
|
|
1559
|
+
* but in a framework-agnostic way.
|
|
1560
|
+
*
|
|
1561
|
+
* This module provides:
|
|
1562
|
+
* - Event handler creation and management
|
|
1563
|
+
* - Event delegation and bubbling control
|
|
1564
|
+
* - Integration with state management
|
|
1565
|
+
* - Support for Servly plugin format (via callbacks)
|
|
1566
|
+
*/
|
|
1567
|
+
|
|
1568
|
+
interface EventHandlerConfig {
|
|
1569
|
+
/** Prevent default browser behavior */
|
|
1570
|
+
preventDefault?: boolean;
|
|
1571
|
+
/** Stop event propagation */
|
|
1572
|
+
stopPropagation?: boolean;
|
|
1573
|
+
/** Debounce delay in ms */
|
|
1574
|
+
debounce?: number;
|
|
1575
|
+
/** Throttle delay in ms */
|
|
1576
|
+
throttle?: number;
|
|
1577
|
+
/** Only trigger once */
|
|
1578
|
+
once?: boolean;
|
|
1579
|
+
}
|
|
1580
|
+
interface ServlyPluginAction {
|
|
1581
|
+
/** Plugin key (e.g., 'state-setState', 'navigateTo') */
|
|
1582
|
+
key: string;
|
|
1583
|
+
/** Plugin configuration */
|
|
1584
|
+
config?: Record<string, any>;
|
|
1585
|
+
/** Plugin name for debugging */
|
|
1586
|
+
name?: string;
|
|
1587
|
+
}
|
|
1588
|
+
interface ServlyEventHandler {
|
|
1589
|
+
/** Array of plugin actions to execute */
|
|
1590
|
+
plugins?: ServlyPluginAction[];
|
|
1591
|
+
/** Event handler configuration */
|
|
1592
|
+
preventDefault?: boolean;
|
|
1593
|
+
stopPropagation?: boolean;
|
|
1594
|
+
}
|
|
1595
|
+
interface EventContext {
|
|
1596
|
+
/** The DOM event */
|
|
1597
|
+
event: Event;
|
|
1598
|
+
/** Element ID that triggered the event */
|
|
1599
|
+
elementId: string;
|
|
1600
|
+
/** Current binding context */
|
|
1601
|
+
context: BindingContext;
|
|
1602
|
+
/** State manager instance */
|
|
1603
|
+
stateManager?: StateManager;
|
|
1604
|
+
/** Current item data (for list items) */
|
|
1605
|
+
currentItem?: any;
|
|
1606
|
+
/** Current index (for list items) */
|
|
1607
|
+
currentIndex?: number;
|
|
1608
|
+
}
|
|
1609
|
+
type PluginExecutor = (action: ServlyPluginAction, eventContext: EventContext) => Promise<any> | any;
|
|
1610
|
+
interface EventSystemConfig {
|
|
1611
|
+
/** State manager instance */
|
|
1612
|
+
stateManager?: StateManager;
|
|
1613
|
+
/** Custom plugin executors */
|
|
1614
|
+
pluginExecutors?: Record<string, PluginExecutor>;
|
|
1615
|
+
/** Callback when an event is triggered */
|
|
1616
|
+
onEvent?: (eventName: string, elementId: string, event: Event) => void;
|
|
1617
|
+
/** Callback when a plugin action is executed */
|
|
1618
|
+
onPluginExecute?: (action: ServlyPluginAction, result: any) => void;
|
|
1619
|
+
/** Callback for navigation requests */
|
|
1620
|
+
onNavigate?: (url: string, options?: {
|
|
1621
|
+
replace?: boolean;
|
|
1622
|
+
state?: any;
|
|
1623
|
+
}) => void;
|
|
1624
|
+
/** Callback for external API calls */
|
|
1625
|
+
onApiCall?: (config: any) => Promise<any>;
|
|
1626
|
+
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Event system for managing event handlers in runtime-core
|
|
1629
|
+
*/
|
|
1630
|
+
declare class EventSystem {
|
|
1631
|
+
private config;
|
|
1632
|
+
private pluginExecutors;
|
|
1633
|
+
private debounceTimers;
|
|
1634
|
+
private throttleTimers;
|
|
1635
|
+
constructor(config?: EventSystemConfig);
|
|
1636
|
+
/**
|
|
1637
|
+
* Register a custom plugin executor
|
|
1638
|
+
*/
|
|
1639
|
+
registerPlugin(key: string, executor: PluginExecutor): void;
|
|
1640
|
+
/**
|
|
1641
|
+
* Create an event handler from Servly plugin format
|
|
1642
|
+
*/
|
|
1643
|
+
createHandler(elementId: string, handlerConfig: ServlyEventHandler, context: BindingContext, options?: EventHandlerConfig): (event: Event) => void;
|
|
1644
|
+
/**
|
|
1645
|
+
* Execute a sequence of plugin actions
|
|
1646
|
+
*/
|
|
1647
|
+
executePlugins(plugins: ServlyPluginAction[], eventContext: EventContext): Promise<any[]>;
|
|
1648
|
+
/**
|
|
1649
|
+
* Create a debounced event handler
|
|
1650
|
+
*/
|
|
1651
|
+
createDebouncedHandler(elementId: string, handler: (event: Event) => void, delay: number): (event: Event) => void;
|
|
1652
|
+
/**
|
|
1653
|
+
* Create a throttled event handler
|
|
1654
|
+
*/
|
|
1655
|
+
createThrottledHandler(elementId: string, handler: (event: Event) => void, delay: number): (event: Event) => void;
|
|
1656
|
+
/**
|
|
1657
|
+
* Clean up all timers
|
|
1658
|
+
*/
|
|
1659
|
+
destroy(): void;
|
|
1660
|
+
}
|
|
1661
|
+
/**
|
|
1662
|
+
* Standard DOM event names that map to React-style event props
|
|
1663
|
+
*/
|
|
1664
|
+
declare const EVENT_HANDLERS: Record<string, string>;
|
|
1665
|
+
/**
|
|
1666
|
+
* Convert React-style event name to DOM event name
|
|
1667
|
+
*/
|
|
1668
|
+
declare function toDomEventName(reactEventName: string): string;
|
|
1669
|
+
/**
|
|
1670
|
+
* Convert DOM event name to React-style event name
|
|
1671
|
+
*/
|
|
1672
|
+
declare function toReactEventName(domEventName: string): string;
|
|
1673
|
+
declare function getEventSystem(config?: EventSystemConfig): EventSystem;
|
|
1674
|
+
declare function resetEventSystem(): void;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Tailwind CSS Utilities for Runtime Core
|
|
1678
|
+
* Provides automatic Tailwind CSS injection for standalone rendering
|
|
1679
|
+
*/
|
|
1680
|
+
interface TailwindConfig {
|
|
1681
|
+
/** Custom CDN URL for Tailwind */
|
|
1682
|
+
cdnUrl?: string;
|
|
1683
|
+
/** Tailwind configuration object */
|
|
1684
|
+
config?: Record<string, any>;
|
|
1685
|
+
/** Custom plugins to load */
|
|
1686
|
+
plugins?: string[];
|
|
1687
|
+
/** Whether to use the Play CDN (includes all plugins) */
|
|
1688
|
+
usePlayCdn?: boolean;
|
|
1689
|
+
/** Callback when Tailwind is ready */
|
|
1690
|
+
onReady?: () => void;
|
|
1691
|
+
/** Callback on error */
|
|
1692
|
+
onError?: (error: Error) => void;
|
|
1693
|
+
}
|
|
1694
|
+
/**
|
|
1695
|
+
* Inject Tailwind CSS into the document
|
|
1696
|
+
* Uses the Tailwind CDN for quick setup
|
|
1697
|
+
*/
|
|
1698
|
+
declare function injectTailwind(config?: TailwindConfig): Promise<void>;
|
|
1699
|
+
/**
|
|
1700
|
+
* Remove Tailwind CSS from the document
|
|
1701
|
+
*/
|
|
1702
|
+
declare function removeTailwind(): void;
|
|
1703
|
+
/**
|
|
1704
|
+
* Check if Tailwind CSS is loaded
|
|
1705
|
+
*/
|
|
1706
|
+
declare function isTailwindLoaded(): boolean;
|
|
1707
|
+
/**
|
|
1708
|
+
* Get the Tailwind instance (if loaded)
|
|
1709
|
+
*/
|
|
1710
|
+
declare function getTailwind(): any;
|
|
1711
|
+
/**
|
|
1712
|
+
* Update Tailwind configuration at runtime
|
|
1713
|
+
*/
|
|
1714
|
+
declare function updateTailwindConfig(config: Record<string, any>): void;
|
|
1715
|
+
/**
|
|
1716
|
+
* Add custom CSS to the document
|
|
1717
|
+
* Useful for adding custom styles alongside Tailwind
|
|
1718
|
+
*/
|
|
1719
|
+
declare function addCustomStyles(css: string, id?: string): HTMLStyleElement;
|
|
1720
|
+
/**
|
|
1721
|
+
* Remove custom styles by ID
|
|
1722
|
+
*/
|
|
1723
|
+
declare function removeCustomStyles(id: string): void;
|
|
1724
|
+
/**
|
|
1725
|
+
* Default Tailwind configuration for Servly components
|
|
1726
|
+
*/
|
|
1727
|
+
declare const DEFAULT_SERVLY_TAILWIND_CONFIG: {
|
|
1728
|
+
theme: {
|
|
1729
|
+
extend: {};
|
|
1730
|
+
};
|
|
1731
|
+
safelist: {
|
|
1732
|
+
pattern: RegExp;
|
|
1733
|
+
}[];
|
|
1734
|
+
};
|
|
1735
|
+
/**
|
|
1736
|
+
* Initialize Tailwind with Servly defaults
|
|
1737
|
+
*/
|
|
1738
|
+
declare function initServlyTailwind(customConfig?: Record<string, any>): Promise<void>;
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* Overrides System for Runtime Core
|
|
1742
|
+
* Handles element overrides with dependency tracking
|
|
1743
|
+
*
|
|
1744
|
+
* Overrides are stored in element.configuration._overrides_ and contain:
|
|
1745
|
+
* - plugins: Array of plugin actions to execute
|
|
1746
|
+
* - dependencies: Array of template strings to watch for changes
|
|
1747
|
+
* - isCleanUp: Boolean flag for unmount actions
|
|
1748
|
+
*/
|
|
1749
|
+
|
|
1750
|
+
interface Override {
|
|
1751
|
+
/** Plugin actions to execute */
|
|
1752
|
+
plugins?: ServlyPluginAction[];
|
|
1753
|
+
/** Template strings to watch for changes */
|
|
1754
|
+
dependencies?: string[];
|
|
1755
|
+
/** Whether this is a cleanup override (runs on unmount) */
|
|
1756
|
+
isCleanUp?: boolean;
|
|
1757
|
+
/** Override name for debugging */
|
|
1758
|
+
name?: string;
|
|
1759
|
+
}
|
|
1760
|
+
interface OverrideState {
|
|
1761
|
+
/** Previous resolved dependency values */
|
|
1762
|
+
previousValues: Map<number, any[]>;
|
|
1763
|
+
/** Whether the override has been initialized */
|
|
1764
|
+
initialized: boolean;
|
|
1765
|
+
/** Abort controller for cancelling pending operations */
|
|
1766
|
+
abortController?: AbortController;
|
|
1767
|
+
}
|
|
1768
|
+
interface OverrideSystemConfig {
|
|
1769
|
+
/** Event system for executing plugins */
|
|
1770
|
+
eventSystem?: EventSystem;
|
|
1771
|
+
/** State manager for state operations */
|
|
1772
|
+
stateManager?: StateManager;
|
|
1773
|
+
/** Callback when an override is triggered */
|
|
1774
|
+
onOverrideTrigger?: (elementId: string, override: Override, eventType: string) => void;
|
|
1775
|
+
/** Callback when dependencies change */
|
|
1776
|
+
onDependencyChange?: (elementId: string, dependencies: string[], values: any[]) => void;
|
|
1777
|
+
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Manages element overrides with dependency tracking
|
|
1780
|
+
*/
|
|
1781
|
+
declare class OverrideSystem {
|
|
1782
|
+
private config;
|
|
1783
|
+
private elementStates;
|
|
1784
|
+
private watchIntervals;
|
|
1785
|
+
constructor(config?: OverrideSystemConfig);
|
|
1786
|
+
/**
|
|
1787
|
+
* Get overrides from an element
|
|
1788
|
+
*/
|
|
1789
|
+
getOverrides(element: LayoutElement): Override[];
|
|
1790
|
+
/**
|
|
1791
|
+
* Initialize overrides for an element (called on mount)
|
|
1792
|
+
*/
|
|
1793
|
+
initializeElement(element: LayoutElement, context: BindingContext): Promise<void>;
|
|
1794
|
+
/**
|
|
1795
|
+
* Check and process dependency changes for an element
|
|
1796
|
+
*/
|
|
1797
|
+
checkDependencies(element: LayoutElement, context: BindingContext): Promise<void>;
|
|
1798
|
+
/**
|
|
1799
|
+
* Cleanup overrides for an element (called on unmount)
|
|
1800
|
+
*/
|
|
1801
|
+
cleanupElement(element: LayoutElement, context: BindingContext): Promise<void>;
|
|
1802
|
+
/**
|
|
1803
|
+
* Process a list of overrides
|
|
1804
|
+
*/
|
|
1805
|
+
private processOverrides;
|
|
1806
|
+
/**
|
|
1807
|
+
* Start watching an element for dependency changes
|
|
1808
|
+
*/
|
|
1809
|
+
startWatching(element: LayoutElement, context: BindingContext, intervalMs?: number): void;
|
|
1810
|
+
/**
|
|
1811
|
+
* Stop watching an element
|
|
1812
|
+
*/
|
|
1813
|
+
stopWatching(elementId: string): void;
|
|
1814
|
+
/**
|
|
1815
|
+
* Destroy the override system
|
|
1816
|
+
*/
|
|
1817
|
+
destroy(): void;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Extract all dependencies from overrides
|
|
1821
|
+
*/
|
|
1822
|
+
declare function extractOverrideDependencies(element: LayoutElement): string[];
|
|
1823
|
+
/**
|
|
1824
|
+
* Check if an element has overrides
|
|
1825
|
+
*/
|
|
1826
|
+
declare function hasOverrides(element: LayoutElement): boolean;
|
|
1827
|
+
/**
|
|
1828
|
+
* Check if an element has dependency-based overrides
|
|
1829
|
+
*/
|
|
1830
|
+
declare function hasDependencyOverrides(element: LayoutElement): boolean;
|
|
1831
|
+
/**
|
|
1832
|
+
* Get mount overrides for an element
|
|
1833
|
+
*/
|
|
1834
|
+
declare function getMountOverrides(element: LayoutElement): Override[];
|
|
1835
|
+
/**
|
|
1836
|
+
* Get cleanup overrides for an element
|
|
1837
|
+
*/
|
|
1838
|
+
declare function getCleanupOverrides(element: LayoutElement): Override[];
|
|
1839
|
+
declare function getOverrideSystem(config?: OverrideSystemConfig): OverrideSystem;
|
|
1840
|
+
declare function resetOverrideSystem(): void;
|
|
1841
|
+
|
|
1842
|
+
export { AnalyticsCollector, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BatchEventsRequest, type BatchEventsResponse, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ClientInfo, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_SERVLY_TAILWIND_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, EVENT_HANDLERS, type ElementConfig, type ErrorMetadata, type ErrorType, type EventContext, type EventHandlerConfig, EventSystem, type EventSystemConfig, type FetchMetadata, type FetchOptions, type FetchResult, type LayoutElement, LongTaskObserver, MemorySampler, type NavigationOptions, type Override, type OverrideState, OverrideSystem, type OverrideSystemConfig, type ParsedVersion, type PluginExecutor, type PropDefinition, type RenderMetadata, type RenderOptions, type RenderResult, type RetryConfig, type ServlyEventHandler, type ServlyPluginAction, type SessionInfo, SessionManager, type StateChangeEvent, StateManager, type StateManagerConfig, type TailwindConfig, 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, type ViewData, addClass, addCustomStyles, analytics, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegistryUrl, getSessionManager, getSessionStorage, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, invalidateCache, isComponentAvailable, isTailwindLoaded, isValidSpecifier, navigateTo, parseVersion, prefetchComponents, processStyles, removeClass, removeCustomStyles, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps };
|