@servlyadmin/runtime-core 0.1.36 → 0.1.37
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/README.md +137 -98
- package/dist/index.cjs +6 -3
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,8 +17,8 @@ pnpm add @servlyadmin/runtime-core
|
|
|
17
17
|
```typescript
|
|
18
18
|
import { render, fetchComponent } from '@servlyadmin/runtime-core';
|
|
19
19
|
|
|
20
|
-
// Fetch a component from the registry
|
|
21
|
-
const { data } = await fetchComponent('my-component'
|
|
20
|
+
// Fetch a component from the registry (uses Servly's default registry)
|
|
21
|
+
const { data } = await fetchComponent('my-component-id');
|
|
22
22
|
|
|
23
23
|
// Render to a container
|
|
24
24
|
const result = render({
|
|
@@ -42,6 +42,47 @@ result.update({
|
|
|
42
42
|
result.destroy();
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
## Registry Configuration
|
|
46
|
+
|
|
47
|
+
By default, components are fetched from Servly's production registry:
|
|
48
|
+
- **Default URL**: `https://core-api.servly.app/v1/views/registry`
|
|
49
|
+
|
|
50
|
+
You can override this if you have a custom registry:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { setRegistryUrl } from '@servlyadmin/runtime-core';
|
|
54
|
+
|
|
55
|
+
// Use a custom registry
|
|
56
|
+
setRegistryUrl('https://your-api.com/v1/views/registry');
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Cache Strategies
|
|
60
|
+
|
|
61
|
+
The runtime supports three caching strategies to optimize component loading:
|
|
62
|
+
|
|
63
|
+
| Strategy | Description | Persistence | Best For |
|
|
64
|
+
|----------|-------------|-------------|----------|
|
|
65
|
+
| `localStorage` | Persists across browser sessions | Yes | Production apps (default) |
|
|
66
|
+
| `memory` | In-memory cache, cleared on page refresh | No | Development, SSR |
|
|
67
|
+
| `none` | No caching, always fetches fresh | No | Testing, debugging |
|
|
68
|
+
|
|
69
|
+
**Default**: `localStorage` - Components are cached in the browser's localStorage for fast subsequent loads.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// Use default localStorage caching
|
|
73
|
+
const { data } = await fetchComponent('my-component');
|
|
74
|
+
|
|
75
|
+
// Explicitly set cache strategy
|
|
76
|
+
const { data } = await fetchComponent('my-component', {
|
|
77
|
+
cacheStrategy: 'memory', // or 'localStorage' or 'none'
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Force refresh (bypass cache)
|
|
81
|
+
const { data } = await fetchComponent('my-component', {
|
|
82
|
+
forceRefresh: true,
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
45
86
|
## Core Concepts
|
|
46
87
|
|
|
47
88
|
### Layout Elements
|
|
@@ -51,14 +92,15 @@ Components are defined as a tree of layout elements:
|
|
|
51
92
|
```typescript
|
|
52
93
|
interface LayoutElement {
|
|
53
94
|
i: string; // Unique identifier
|
|
54
|
-
|
|
95
|
+
componentId: string; // Element type (container, text, button, etc.)
|
|
55
96
|
configuration?: { // Element configuration
|
|
56
|
-
|
|
97
|
+
classNames?: string;
|
|
57
98
|
style?: Record<string, any>;
|
|
58
|
-
|
|
99
|
+
text?: string;
|
|
59
100
|
// ... other attributes
|
|
60
101
|
};
|
|
61
|
-
children?:
|
|
102
|
+
children?: string[]; // Child element IDs
|
|
103
|
+
parent?: string; // Parent element ID
|
|
62
104
|
}
|
|
63
105
|
```
|
|
64
106
|
|
|
@@ -82,10 +124,10 @@ Use `{{path}}` syntax to bind data:
|
|
|
82
124
|
const elements = [
|
|
83
125
|
{
|
|
84
126
|
i: 'greeting',
|
|
85
|
-
|
|
127
|
+
componentId: 'text',
|
|
86
128
|
configuration: {
|
|
87
|
-
|
|
88
|
-
|
|
129
|
+
text: 'Hello, {{props.name}}!',
|
|
130
|
+
classNames: '{{props.className}}',
|
|
89
131
|
},
|
|
90
132
|
},
|
|
91
133
|
];
|
|
@@ -118,18 +160,33 @@ interface RenderResult {
|
|
|
118
160
|
Fetches a component from the registry.
|
|
119
161
|
|
|
120
162
|
```typescript
|
|
121
|
-
const { data, fromCache } = await fetchComponent('component-id', {
|
|
122
|
-
version: 'latest',
|
|
123
|
-
cacheStrategy: '
|
|
124
|
-
forceRefresh: false,
|
|
125
|
-
timeout: 30000, // Request timeout in ms
|
|
163
|
+
const { data, fromCache, version } = await fetchComponent('component-id', {
|
|
164
|
+
version: 'latest', // Version specifier (default: 'latest')
|
|
165
|
+
cacheStrategy: 'localStorage', // 'localStorage' | 'memory' | 'none' (default: 'localStorage')
|
|
166
|
+
forceRefresh: false, // Bypass cache (default: false)
|
|
126
167
|
retryConfig: {
|
|
127
|
-
maxRetries: 3,
|
|
128
|
-
|
|
168
|
+
maxRetries: 3, // Number of retry attempts (default: 3)
|
|
169
|
+
initialDelay: 1000, // Initial retry delay in ms (default: 1000)
|
|
170
|
+
maxDelay: 10000, // Maximum retry delay in ms (default: 10000)
|
|
171
|
+
backoffMultiplier: 2, // Exponential backoff multiplier (default: 2)
|
|
129
172
|
},
|
|
130
173
|
});
|
|
131
174
|
```
|
|
132
175
|
|
|
176
|
+
### setRegistryUrl(url)
|
|
177
|
+
|
|
178
|
+
Configure a custom registry URL.
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
import { setRegistryUrl, DEFAULT_REGISTRY_URL } from '@servlyadmin/runtime-core';
|
|
182
|
+
|
|
183
|
+
// Use custom registry
|
|
184
|
+
setRegistryUrl('https://your-api.com/v1/views/registry');
|
|
185
|
+
|
|
186
|
+
// Reset to default
|
|
187
|
+
setRegistryUrl(DEFAULT_REGISTRY_URL);
|
|
188
|
+
```
|
|
189
|
+
|
|
133
190
|
### StateManager
|
|
134
191
|
|
|
135
192
|
Manages component state with subscriptions.
|
|
@@ -140,25 +197,17 @@ import { StateManager } from '@servlyadmin/runtime-core';
|
|
|
140
197
|
const stateManager = new StateManager({ count: 0 });
|
|
141
198
|
|
|
142
199
|
// Get/set state
|
|
143
|
-
stateManager.
|
|
144
|
-
stateManager.
|
|
145
|
-
stateManager.
|
|
200
|
+
stateManager.set('count', 1);
|
|
201
|
+
stateManager.get('count'); // 1
|
|
202
|
+
stateManager.set('user.name', 'John');
|
|
146
203
|
|
|
147
204
|
// Subscribe to changes
|
|
148
|
-
const unsubscribe = stateManager.subscribe((
|
|
149
|
-
console.log('State changed:',
|
|
205
|
+
const unsubscribe = stateManager.subscribe((event) => {
|
|
206
|
+
console.log('State changed:', event.path, event.value);
|
|
150
207
|
});
|
|
151
208
|
|
|
152
|
-
//
|
|
153
|
-
stateManager.
|
|
154
|
-
console.log('Count changed:', value);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
// Batch updates
|
|
158
|
-
stateManager.batch(() => {
|
|
159
|
-
stateManager.setValue('a', 1);
|
|
160
|
-
stateManager.setValue('b', 2);
|
|
161
|
-
}); // Only one notification
|
|
209
|
+
// Cleanup
|
|
210
|
+
stateManager.clear();
|
|
162
211
|
```
|
|
163
212
|
|
|
164
213
|
### EventSystem
|
|
@@ -166,59 +215,52 @@ stateManager.batch(() => {
|
|
|
166
215
|
Handles events with plugin-based actions.
|
|
167
216
|
|
|
168
217
|
```typescript
|
|
169
|
-
import { EventSystem } from '@servlyadmin/runtime-core';
|
|
218
|
+
import { EventSystem, getEventSystem } from '@servlyadmin/runtime-core';
|
|
170
219
|
|
|
171
|
-
const eventSystem =
|
|
220
|
+
const eventSystem = getEventSystem();
|
|
172
221
|
|
|
173
222
|
// Register custom plugin
|
|
174
|
-
eventSystem.registerPlugin('my-action', async (
|
|
175
|
-
console.log('Action executed with:', config);
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// Create event handler
|
|
179
|
-
const handler = eventSystem.createHandler([
|
|
180
|
-
{ key: 'prevent-default', config: {} },
|
|
181
|
-
{ key: 'set-state', config: { path: 'clicked', value: true } },
|
|
182
|
-
{ key: 'my-action', config: { message: 'Button clicked!' } },
|
|
183
|
-
]);
|
|
184
|
-
|
|
185
|
-
// Use with element
|
|
186
|
-
button.addEventListener('click', (e) => {
|
|
187
|
-
handler(e, 'button-id', bindingContext);
|
|
223
|
+
eventSystem.registerPlugin('my-action', async (action, context) => {
|
|
224
|
+
console.log('Action executed with:', action.config);
|
|
188
225
|
});
|
|
189
226
|
```
|
|
190
227
|
|
|
191
228
|
#### Built-in Plugins
|
|
192
229
|
|
|
193
|
-
- `
|
|
194
|
-
- `
|
|
230
|
+
- `executeCode` - Execute arbitrary JavaScript code
|
|
231
|
+
- `state-setState` - Update state values
|
|
232
|
+
- `navigateTo` - Navigate to URL
|
|
233
|
+
- `localStorage-set/get/remove` - LocalStorage operations
|
|
234
|
+
- `sessionStorage-set/get` - SessionStorage operations
|
|
235
|
+
- `alert` - Show alert dialog
|
|
236
|
+
- `console-log` - Log to console
|
|
237
|
+
- `clipboard-copy` - Copy text to clipboard
|
|
238
|
+
- `scrollTo` - Scroll to element
|
|
239
|
+
- `focus/blur` - Focus/blur elements
|
|
240
|
+
- `addClass/removeClass/toggleClass` - CSS class manipulation
|
|
241
|
+
- `setAttribute/removeAttribute` - Attribute manipulation
|
|
242
|
+
- `dispatchEvent` - Dispatch custom events
|
|
195
243
|
- `delay` - Add delay between actions
|
|
196
|
-
- `prevent-default` - Call event.preventDefault()
|
|
197
|
-
- `stop-propagation` - Call event.stopPropagation()
|
|
198
244
|
|
|
199
|
-
### Cache
|
|
200
|
-
|
|
201
|
-
Component caching with multiple strategies.
|
|
245
|
+
### Cache Management
|
|
202
246
|
|
|
203
247
|
```typescript
|
|
204
|
-
import {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
248
|
+
import {
|
|
249
|
+
clearAllCaches,
|
|
250
|
+
clearMemoryCache,
|
|
251
|
+
clearLocalStorageCache,
|
|
252
|
+
getMemoryCacheSize
|
|
253
|
+
} from '@servlyadmin/runtime-core';
|
|
210
254
|
|
|
211
|
-
//
|
|
212
|
-
|
|
255
|
+
// Clear all caches
|
|
256
|
+
clearAllCaches();
|
|
213
257
|
|
|
214
|
-
//
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
cache.invalidateComponent('comp-id');
|
|
258
|
+
// Clear specific cache
|
|
259
|
+
clearMemoryCache();
|
|
260
|
+
clearLocalStorageCache();
|
|
218
261
|
|
|
219
|
-
//
|
|
220
|
-
const
|
|
221
|
-
console.log(`Hit rate: ${stats.hitRate * 100}%`);
|
|
262
|
+
// Get cache size
|
|
263
|
+
const size = getMemoryCacheSize();
|
|
222
264
|
```
|
|
223
265
|
|
|
224
266
|
### Bindings
|
|
@@ -226,7 +268,7 @@ console.log(`Hit rate: ${stats.hitRate * 100}%`);
|
|
|
226
268
|
Template resolution utilities.
|
|
227
269
|
|
|
228
270
|
```typescript
|
|
229
|
-
import { resolveTemplate,
|
|
271
|
+
import { resolveTemplate, hasTemplateSyntax } from '@servlyadmin/runtime-core';
|
|
230
272
|
|
|
231
273
|
const context = {
|
|
232
274
|
props: { name: 'World', count: 42 },
|
|
@@ -237,16 +279,9 @@ const context = {
|
|
|
237
279
|
// Resolve single template
|
|
238
280
|
resolveTemplate('Hello, {{props.name}}!', context); // "Hello, World!"
|
|
239
281
|
|
|
240
|
-
// Check if string
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
// Resolve all bindings in an object
|
|
245
|
-
resolveBindings({
|
|
246
|
-
title: '{{props.name}}',
|
|
247
|
-
subtitle: 'Count: {{props.count}}',
|
|
248
|
-
}, context);
|
|
249
|
-
// { title: 'World', subtitle: 'Count: 42' }
|
|
282
|
+
// Check if string has template syntax
|
|
283
|
+
hasTemplateSyntax('{{props.name}}'); // true
|
|
284
|
+
hasTemplateSyntax('static text'); // false
|
|
250
285
|
```
|
|
251
286
|
|
|
252
287
|
## Slots
|
|
@@ -257,24 +292,25 @@ Components can define slots for content injection:
|
|
|
257
292
|
const elements = [
|
|
258
293
|
{
|
|
259
294
|
i: 'card',
|
|
260
|
-
|
|
261
|
-
configuration: {
|
|
262
|
-
children: [
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
295
|
+
componentId: 'container',
|
|
296
|
+
configuration: { classNames: 'card' },
|
|
297
|
+
children: ['header-slot', 'content-slot'],
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
i: 'header-slot',
|
|
301
|
+
componentId: 'slot',
|
|
302
|
+
configuration: {
|
|
303
|
+
slotName: 'header',
|
|
304
|
+
},
|
|
305
|
+
parent: 'card',
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
i: 'content-slot',
|
|
309
|
+
componentId: 'slot',
|
|
310
|
+
configuration: {
|
|
311
|
+
slotName: 'default',
|
|
312
|
+
},
|
|
313
|
+
parent: 'card',
|
|
278
314
|
},
|
|
279
315
|
];
|
|
280
316
|
```
|
|
@@ -290,9 +326,12 @@ import type {
|
|
|
290
326
|
LayoutElement,
|
|
291
327
|
BindingContext,
|
|
292
328
|
RenderResult,
|
|
329
|
+
RenderOptions,
|
|
293
330
|
ComponentData,
|
|
294
331
|
CacheStrategy,
|
|
295
332
|
RetryConfig,
|
|
333
|
+
FetchOptions,
|
|
334
|
+
FetchResult,
|
|
296
335
|
} from '@servlyadmin/runtime-core';
|
|
297
336
|
```
|
|
298
337
|
|
package/dist/index.cjs
CHANGED
|
@@ -377,6 +377,7 @@ var index_exports = {};
|
|
|
377
377
|
__export(index_exports, {
|
|
378
378
|
AnalyticsCollector: () => AnalyticsCollector,
|
|
379
379
|
DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
|
|
380
|
+
DEFAULT_REGISTRY_URL: () => DEFAULT_REGISTRY_URL,
|
|
380
381
|
DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
|
|
381
382
|
DEFAULT_SERVLY_TAILWIND_CONFIG: () => DEFAULT_SERVLY_TAILWIND_CONFIG,
|
|
382
383
|
EVENT_HANDLERS: () => EVENT_HANDLERS,
|
|
@@ -4422,7 +4423,8 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
4422
4423
|
maxDelay: 1e4,
|
|
4423
4424
|
backoffMultiplier: 2
|
|
4424
4425
|
};
|
|
4425
|
-
var
|
|
4426
|
+
var DEFAULT_REGISTRY_URL = "https://core-api.servly.app/v1/views/registry";
|
|
4427
|
+
var registryBaseUrl = DEFAULT_REGISTRY_URL;
|
|
4426
4428
|
function setRegistryUrl(url) {
|
|
4427
4429
|
registryBaseUrl = url;
|
|
4428
4430
|
}
|
|
@@ -4557,7 +4559,7 @@ async function fetchComponent(id, options = {}) {
|
|
|
4557
4559
|
const {
|
|
4558
4560
|
version = "latest",
|
|
4559
4561
|
apiKey,
|
|
4560
|
-
cacheStrategy = "
|
|
4562
|
+
cacheStrategy = "localStorage",
|
|
4561
4563
|
cacheConfig = DEFAULT_CACHE_CONFIG,
|
|
4562
4564
|
retryConfig = {},
|
|
4563
4565
|
forceRefresh = false,
|
|
@@ -4725,7 +4727,7 @@ async function prefetchComponents(ids, options = {}) {
|
|
|
4725
4727
|
await Promise.all(promises);
|
|
4726
4728
|
}
|
|
4727
4729
|
async function isComponentAvailable(id, version = "latest", options = {}) {
|
|
4728
|
-
const { cacheStrategy = "
|
|
4730
|
+
const { cacheStrategy = "localStorage", cacheConfig = DEFAULT_CACHE_CONFIG } = options;
|
|
4729
4731
|
const cached = getFromCache(id, version, cacheStrategy, cacheConfig);
|
|
4730
4732
|
if (cached) {
|
|
4731
4733
|
return { available: true, cached: true, version: cached.version };
|
|
@@ -5149,6 +5151,7 @@ init_tailwind();
|
|
|
5149
5151
|
0 && (module.exports = {
|
|
5150
5152
|
AnalyticsCollector,
|
|
5151
5153
|
DEFAULT_CACHE_CONFIG,
|
|
5154
|
+
DEFAULT_REGISTRY_URL,
|
|
5152
5155
|
DEFAULT_RETRY_CONFIG,
|
|
5153
5156
|
DEFAULT_SERVLY_TAILWIND_CONFIG,
|
|
5154
5157
|
EVENT_HANDLERS,
|
package/dist/index.d.cts
CHANGED
|
@@ -778,6 +778,8 @@ declare function invalidateCache(id: string, version?: string, config?: CacheCon
|
|
|
778
778
|
|
|
779
779
|
/** Default retry configuration */
|
|
780
780
|
declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
|
|
781
|
+
/** Default Servly Registry API URL */
|
|
782
|
+
declare const DEFAULT_REGISTRY_URL = "https://core-api.servly.app/v1/views/registry";
|
|
781
783
|
/**
|
|
782
784
|
* Configure the registry base URL
|
|
783
785
|
*/
|
|
@@ -1970,4 +1972,4 @@ declare function getSupportedIconSets(): string[];
|
|
|
1970
1972
|
*/
|
|
1971
1973
|
declare function getIconifyCollection(set: string): string | undefined;
|
|
1972
1974
|
|
|
1973
|
-
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 IconConfig, type IconData, type IconRenderer, 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, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isValidSpecifier, navigateTo, parseVersion, prefetchComponents, preloadIcons, processStyles, registerIcon, registerIcons, removeClass, removeCustomStyles, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps };
|
|
1975
|
+
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_REGISTRY_URL, 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 IconConfig, type IconData, type IconRenderer, 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, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isValidSpecifier, navigateTo, parseVersion, prefetchComponents, preloadIcons, processStyles, registerIcon, registerIcons, removeClass, removeCustomStyles, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -778,6 +778,8 @@ declare function invalidateCache(id: string, version?: string, config?: CacheCon
|
|
|
778
778
|
|
|
779
779
|
/** Default retry configuration */
|
|
780
780
|
declare const DEFAULT_RETRY_CONFIG: Required<RetryConfig>;
|
|
781
|
+
/** Default Servly Registry API URL */
|
|
782
|
+
declare const DEFAULT_REGISTRY_URL = "https://core-api.servly.app/v1/views/registry";
|
|
781
783
|
/**
|
|
782
784
|
* Configure the registry base URL
|
|
783
785
|
*/
|
|
@@ -1970,4 +1972,4 @@ declare function getSupportedIconSets(): string[];
|
|
|
1970
1972
|
*/
|
|
1971
1973
|
declare function getIconifyCollection(set: string): string | undefined;
|
|
1972
1974
|
|
|
1973
|
-
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 IconConfig, type IconData, type IconRenderer, 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, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isValidSpecifier, navigateTo, parseVersion, prefetchComponents, preloadIcons, processStyles, registerIcon, registerIcons, removeClass, removeCustomStyles, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps };
|
|
1975
|
+
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_REGISTRY_URL, 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 IconConfig, type IconData, type IconRenderer, 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, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isValidSpecifier, navigateTo, parseVersion, prefetchComponents, preloadIcons, processStyles, registerIcon, registerIcons, removeClass, removeCustomStyles, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps };
|
package/dist/index.js
CHANGED
|
@@ -3930,7 +3930,8 @@ var DEFAULT_RETRY_CONFIG = {
|
|
|
3930
3930
|
maxDelay: 1e4,
|
|
3931
3931
|
backoffMultiplier: 2
|
|
3932
3932
|
};
|
|
3933
|
-
var
|
|
3933
|
+
var DEFAULT_REGISTRY_URL = "https://core-api.servly.app/v1/views/registry";
|
|
3934
|
+
var registryBaseUrl = DEFAULT_REGISTRY_URL;
|
|
3934
3935
|
function setRegistryUrl(url) {
|
|
3935
3936
|
registryBaseUrl = url;
|
|
3936
3937
|
}
|
|
@@ -4065,7 +4066,7 @@ async function fetchComponent(id, options = {}) {
|
|
|
4065
4066
|
const {
|
|
4066
4067
|
version = "latest",
|
|
4067
4068
|
apiKey,
|
|
4068
|
-
cacheStrategy = "
|
|
4069
|
+
cacheStrategy = "localStorage",
|
|
4069
4070
|
cacheConfig = DEFAULT_CACHE_CONFIG,
|
|
4070
4071
|
retryConfig = {},
|
|
4071
4072
|
forceRefresh = false,
|
|
@@ -4233,7 +4234,7 @@ async function prefetchComponents(ids, options = {}) {
|
|
|
4233
4234
|
await Promise.all(promises);
|
|
4234
4235
|
}
|
|
4235
4236
|
async function isComponentAvailable(id, version = "latest", options = {}) {
|
|
4236
|
-
const { cacheStrategy = "
|
|
4237
|
+
const { cacheStrategy = "localStorage", cacheConfig = DEFAULT_CACHE_CONFIG } = options;
|
|
4237
4238
|
const cached = getFromCache(id, version, cacheStrategy, cacheConfig);
|
|
4238
4239
|
if (cached) {
|
|
4239
4240
|
return { available: true, cached: true, version: cached.version };
|
|
@@ -4652,6 +4653,7 @@ function getSampleValue(def) {
|
|
|
4652
4653
|
export {
|
|
4653
4654
|
AnalyticsCollector,
|
|
4654
4655
|
DEFAULT_CACHE_CONFIG,
|
|
4656
|
+
DEFAULT_REGISTRY_URL,
|
|
4655
4657
|
DEFAULT_RETRY_CONFIG,
|
|
4656
4658
|
DEFAULT_SERVLY_TAILWIND_CONFIG,
|
|
4657
4659
|
EVENT_HANDLERS,
|