@servlyadmin/runtime-core 0.1.32 → 0.1.34

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.js CHANGED
@@ -1,526 +1,25 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __esm = (fn, res) => function __init() {
8
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
- };
10
- var __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
31
-
32
- // packages/runtime-core/src/tailwind.ts
33
- var tailwind_exports = {};
34
- __export(tailwind_exports, {
35
- DEFAULT_SERVLY_TAILWIND_CONFIG: () => DEFAULT_SERVLY_TAILWIND_CONFIG,
36
- addCustomStyles: () => addCustomStyles,
37
- default: () => tailwind_default,
38
- getTailwind: () => getTailwind,
39
- initServlyTailwind: () => initServlyTailwind,
40
- injectTailwind: () => injectTailwind,
41
- injectTailwindStyles: () => injectTailwindStyles,
42
- isTailwindLoaded: () => isTailwindLoaded,
43
- removeCustomStyles: () => removeCustomStyles,
44
- removeTailwind: () => removeTailwind,
45
- updateTailwindConfig: () => updateTailwindConfig
46
- });
47
- function injectTailwind(config = {}) {
48
- return new Promise((resolve, reject) => {
49
- if (tailwindInjected && tailwindScript) {
50
- resolve();
51
- return;
52
- }
53
- if (typeof document === "undefined") {
54
- resolve();
55
- return;
56
- }
57
- if (window.tailwind) {
58
- tailwindInjected = true;
59
- config.onReady?.();
60
- resolve();
61
- return;
62
- }
63
- const {
64
- cdnUrl = DEFAULT_TAILWIND_CDN,
65
- config: tailwindConfig,
66
- plugins = [],
67
- usePlayCdn = false,
68
- onReady,
69
- onError
70
- } = config;
71
- const script = document.createElement("script");
72
- script.src = usePlayCdn ? `${cdnUrl}?plugins=forms,typography,aspect-ratio` : cdnUrl;
73
- script.async = true;
74
- script.onload = () => {
75
- tailwindInjected = true;
76
- tailwindScript = script;
77
- if (tailwindConfig && window.tailwind) {
78
- window.tailwind.config = tailwindConfig;
79
- }
80
- onReady?.();
81
- resolve();
82
- };
83
- script.onerror = (event) => {
84
- const error = new Error(`Failed to load Tailwind CSS from ${cdnUrl}`);
85
- onError?.(error);
86
- reject(error);
87
- };
88
- document.head.appendChild(script);
89
- });
90
- }
91
- function removeTailwind() {
92
- if (tailwindScript && tailwindScript.parentNode) {
93
- tailwindScript.parentNode.removeChild(tailwindScript);
94
- tailwindScript = null;
95
- tailwindInjected = false;
96
- delete window.tailwind;
97
- }
98
- }
99
- function isTailwindLoaded() {
100
- return tailwindInjected || !!window.tailwind;
101
- }
102
- function getTailwind() {
103
- return window.tailwind;
104
- }
105
- function updateTailwindConfig(config) {
106
- if (window.tailwind) {
107
- window.tailwind.config = {
108
- ...window.tailwind.config,
109
- ...config
110
- };
111
- }
112
- }
113
- function addCustomStyles(css, id) {
114
- if (typeof document === "undefined") {
115
- throw new Error("addCustomStyles can only be used in browser environment");
116
- }
117
- const styleId = id || `servly-custom-styles-${Date.now()}`;
118
- let existingStyle = document.getElementById(styleId);
119
- if (existingStyle) {
120
- existingStyle.textContent = css;
121
- return existingStyle;
122
- }
123
- const style = document.createElement("style");
124
- style.id = styleId;
125
- style.textContent = css;
126
- document.head.appendChild(style);
127
- return style;
128
- }
129
- function removeCustomStyles(id) {
130
- if (typeof document === "undefined") return;
131
- const style = document.getElementById(id);
132
- if (style && style.parentNode) {
133
- style.parentNode.removeChild(style);
134
- }
135
- }
136
- async function initServlyTailwind(customConfig) {
137
- const config = customConfig ? { ...DEFAULT_SERVLY_TAILWIND_CONFIG, ...customConfig } : DEFAULT_SERVLY_TAILWIND_CONFIG;
138
- await injectTailwind({
139
- config,
140
- usePlayCdn: true
141
- });
142
- }
143
- var DEFAULT_TAILWIND_CDN, tailwindInjected, tailwindScript, DEFAULT_SERVLY_TAILWIND_CONFIG, injectTailwindStyles, tailwind_default;
144
- var init_tailwind = __esm({
145
- "packages/runtime-core/src/tailwind.ts"() {
146
- DEFAULT_TAILWIND_CDN = "https://cdn.tailwindcss.com";
147
- tailwindInjected = false;
148
- tailwindScript = null;
149
- DEFAULT_SERVLY_TAILWIND_CONFIG = {
150
- theme: {
151
- extend: {
152
- // Add any Servly-specific theme extensions here
153
- }
154
- },
155
- // Safelist common dynamic classes
156
- safelist: [
157
- // Spacing
158
- { pattern: /^(p|m|gap)-/ },
159
- // Sizing
160
- { pattern: /^(w|h|min-w|min-h|max-w|max-h)-/ },
161
- // Flexbox
162
- { pattern: /^(flex|justify|items|self)-/ },
163
- // Grid
164
- { pattern: /^(grid|col|row)-/ },
165
- // Colors
166
- { pattern: /^(bg|text|border|ring)-/ },
167
- // Typography
168
- { pattern: /^(font|text|leading|tracking)-/ },
169
- // Borders
170
- { pattern: /^(rounded|border)-/ },
171
- // Effects
172
- { pattern: /^(shadow|opacity|blur)-/ },
173
- // Transforms
174
- { pattern: /^(scale|rotate|translate|skew)-/ },
175
- // Transitions
176
- { pattern: /^(transition|duration|ease|delay)-/ }
177
- ]
178
- };
179
- injectTailwindStyles = initServlyTailwind;
180
- tailwind_default = {
181
- injectTailwind,
182
- injectTailwindStyles,
183
- removeTailwind,
184
- isTailwindLoaded,
185
- getTailwind,
186
- updateTailwindConfig,
187
- addCustomStyles,
188
- removeCustomStyles,
189
- initServlyTailwind,
190
- DEFAULT_SERVLY_TAILWIND_CONFIG
191
- };
192
- }
193
- });
194
-
195
- // packages/runtime-core/src/registry.ts
196
- var registry_exports = {};
197
- __export(registry_exports, {
198
- buildRegistryFromBundle: () => buildRegistryFromBundle,
199
- collectAllDependencies: () => collectAllDependencies,
200
- createRegistry: () => createRegistry,
201
- detectCircularDependencies: () => detectCircularDependencies,
202
- extractDependencies: () => extractDependencies,
203
- extractDependenciesFromCode: () => extractDependenciesFromCode
204
- });
205
- function createRegistry() {
206
- const components = /* @__PURE__ */ new Map();
207
- return {
208
- get(id, version) {
209
- if (version) {
210
- const key = `${id}@${version}`;
211
- if (components.has(key)) {
212
- return components.get(key);
213
- }
214
- }
215
- for (const [key, component] of components) {
216
- if (key.startsWith(`${id}@`)) {
217
- return component;
218
- }
219
- }
220
- return components.get(id);
221
- },
222
- has(id, version) {
223
- if (version) {
224
- return components.has(`${id}@${version}`);
225
- }
226
- for (const key of components.keys()) {
227
- if (key.startsWith(`${id}@`) || key === id) {
228
- return true;
229
- }
230
- }
231
- return false;
232
- },
233
- set(id, version, component) {
234
- components.set(`${id}@${version}`, component);
235
- }
236
- };
237
- }
238
- function buildRegistryFromBundle(data) {
239
- const registry = createRegistry();
240
- registry.set(data.id, data.version, {
241
- layout: data.layout,
242
- propsInterface: data.propsInterface
243
- });
244
- if (data.bundle) {
245
- for (const [key, component] of Object.entries(data.bundle)) {
246
- const [id, version] = key.split("@");
247
- if (id && version) {
248
- registry.set(id, version, component);
249
- }
250
- }
251
- }
252
- return registry;
253
- }
254
- function extractDependencies(elements) {
255
- const dependencies = [];
256
- for (const element of elements) {
257
- const config = element.configuration;
258
- if (!config) continue;
259
- if (config.componentViewRef) {
260
- dependencies.push({
261
- id: config.componentViewRef,
262
- version: config.componentViewVersion,
263
- type: "viewRef",
264
- elementId: element.i
265
- });
266
- }
267
- if (config.blueprint) {
268
- dependencies.push({
269
- id: config.blueprint,
270
- version: config.blueprintVersion,
271
- type: "blueprint",
272
- elementId: element.i
273
- });
274
- }
275
- }
276
- return dependencies;
277
- }
278
- function extractDependenciesFromCode(code) {
279
- const dependencies = [];
280
- const pattern = /renderDynamicList\s*\(\s*\{[^}]*blueprint\s*:\s*["']([^"']+)["']/g;
281
- let match;
282
- while ((match = pattern.exec(code)) !== null) {
283
- dependencies.push({
284
- id: match[1],
285
- type: "blueprint"
286
- });
287
- }
288
- return dependencies;
289
- }
290
- async function collectAllDependencies(rootId, rootVersion, fetchComponent2, maxDepth = 10) {
291
- const manifest = {};
292
- const visited = /* @__PURE__ */ new Set();
293
- async function collect(id, version, via, depth) {
294
- if (depth > maxDepth) {
295
- console.warn(`Max dependency depth (${maxDepth}) reached for ${id}`);
296
- return;
297
- }
298
- const key = `${id}@${version || "latest"}`;
299
- if (visited.has(key)) {
300
- return;
301
- }
302
- visited.add(key);
303
- try {
304
- const component = await fetchComponent2(id, version);
305
- if (!component) {
306
- console.warn(`Dependency not found: ${id}@${version || "latest"}`);
307
- return;
308
- }
309
- manifest[id] = {
310
- version: version || "latest",
311
- resolved: component.version,
312
- type: via ? "viewRef" : "viewRef",
313
- // Will be set by caller
314
- via
315
- };
316
- const nestedDeps = extractDependencies(component.layout);
317
- for (const dep of nestedDeps) {
318
- await collect(dep.id, dep.version, id, depth + 1);
319
- }
320
- } catch (error) {
321
- console.error(`Failed to fetch dependency ${id}:`, error);
322
- }
323
- }
324
- const rootComponent = await fetchComponent2(rootId, rootVersion);
325
- if (rootComponent) {
326
- const rootDeps = extractDependencies(rootComponent.layout);
327
- for (const dep of rootDeps) {
328
- manifest[dep.id] = {
329
- version: dep.version || "latest",
330
- resolved: "",
331
- // Will be filled when fetched
332
- type: dep.type
333
- };
334
- await collect(dep.id, dep.version, void 0, 1);
335
- }
336
- }
337
- return manifest;
338
- }
339
- function detectCircularDependencies(manifest) {
340
- const graph = /* @__PURE__ */ new Map();
341
- for (const [id, entry] of Object.entries(manifest)) {
342
- if (entry.via) {
343
- const deps = graph.get(entry.via) || [];
344
- deps.push(id);
345
- graph.set(entry.via, deps);
346
- }
347
- }
348
- const visited = /* @__PURE__ */ new Set();
349
- const stack = /* @__PURE__ */ new Set();
350
- const path = [];
351
- function dfs(node) {
352
- if (stack.has(node)) {
353
- const cycleStart = path.indexOf(node);
354
- return [...path.slice(cycleStart), node];
355
- }
356
- if (visited.has(node)) {
357
- return null;
358
- }
359
- visited.add(node);
360
- stack.add(node);
361
- path.push(node);
362
- const neighbors = graph.get(node) || [];
363
- for (const neighbor of neighbors) {
364
- const cycle = dfs(neighbor);
365
- if (cycle) return cycle;
366
- }
367
- stack.delete(node);
368
- path.pop();
369
- return null;
370
- }
371
- for (const node of graph.keys()) {
372
- const cycle = dfs(node);
373
- if (cycle) return cycle;
374
- }
375
- return null;
376
- }
377
- var init_registry = __esm({
378
- "packages/runtime-core/src/registry.ts"() {
379
- }
380
- });
381
-
382
- // packages/runtime-core/src/index.ts
383
- var index_exports = {};
384
- __export(index_exports, {
385
- AnalyticsCollector: () => AnalyticsCollector,
386
- DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
387
- DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
388
- DEFAULT_SERVLY_TAILWIND_CONFIG: () => DEFAULT_SERVLY_TAILWIND_CONFIG,
389
- EVENT_HANDLERS: () => EVENT_HANDLERS,
390
- EventSystem: () => EventSystem,
391
- LongTaskObserver: () => LongTaskObserver,
392
- MemorySampler: () => MemorySampler,
393
- OverrideSystem: () => OverrideSystem,
394
- SessionManager: () => SessionManager,
395
- StateManager: () => StateManager,
396
- addClass: () => addClass,
397
- addCustomStyles: () => addCustomStyles,
398
- analytics: () => analytics,
399
- applyStyles: () => applyStyles,
400
- batchFetchComponents: () => batchFetchComponents,
401
- buildClassName: () => buildClassName,
402
- buildElementStyles: () => buildElementStyles,
403
- buildRegistryFromBundle: () => buildRegistryFromBundle,
404
- bumpVersion: () => bumpVersion,
405
- camelToKebab: () => camelToKebab,
406
- clearAllCaches: () => clearAllCaches,
407
- clearIconCache: () => clearIconCache,
408
- clearLocalStorageCache: () => clearLocalStorageCache,
409
- clearMemoryCache: () => clearMemoryCache,
410
- clearStyles: () => clearStyles,
411
- collectAllDependencies: () => collectAllDependencies,
412
- collectAllViewDependencies: () => collectAllViewDependencies,
413
- compareVersions: () => compareVersions,
414
- configureAnalytics: () => configureAnalytics,
415
- createIconSVG: () => createIconSVG,
416
- createPlaceholderIcon: () => createPlaceholderIcon,
417
- createRegistry: () => createRegistry,
418
- createServlyRenderer: () => createServlyRenderer,
419
- createViewsMap: () => createViewsMap,
420
- deepMerge: () => deepMerge,
421
- deleteValueByPath: () => deleteValueByPath,
422
- detectCircularDependencies: () => detectCircularDependencies,
423
- extractBindingKeys: () => extractBindingKeys,
424
- extractDependencies: () => extractDependencies,
425
- extractDependenciesFromCode: () => extractDependenciesFromCode,
426
- extractIconFromReactIcons: () => extractIconFromReactIcons,
427
- extractIconsForLayout: () => extractIconsForLayout,
428
- extractOverrideDependencies: () => extractOverrideDependencies,
429
- extractReferencedViewIds: () => extractReferencedViewIds,
430
- fetchComponent: () => fetchComponent,
431
- fetchComponentWithDependencies: () => fetchComponentWithDependencies,
432
- findIconsInLayout: () => findIconsInLayout,
433
- formatStyleValue: () => formatStyleValue,
434
- formatVersion: () => formatVersion,
435
- generateIconBundle: () => generateIconBundle,
436
- generateTestCases: () => generateTestCases,
437
- getAnalytics: () => getAnalytics,
438
- getCacheKey: () => getCacheKey,
439
- getCleanupOverrides: () => getCleanupOverrides,
440
- getDependencyTree: () => getDependencyTree,
441
- getEventSystem: () => getEventSystem,
442
- getFromCache: () => getFromCache,
443
- getIconData: () => getIconData,
444
- getIconDataSync: () => getIconDataSync,
445
- getIconifyCollection: () => getIconifyCollection,
446
- getLocalStorage: () => getLocalStorage,
447
- getLongTaskObserver: () => getLongTaskObserver,
448
- getMemoryCacheSize: () => getMemoryCacheSize,
449
- getMemorySampler: () => getMemorySampler,
450
- getMountOverrides: () => getMountOverrides,
451
- getOverrideSystem: () => getOverrideSystem,
452
- getRegisteredIconKeys: () => getRegisteredIconKeys,
453
- getRegistryUrl: () => getRegistryUrl,
454
- getSessionManager: () => getSessionManager,
455
- getSessionStorage: () => getSessionStorage,
456
- getSupportedIconSets: () => getSupportedIconSets,
457
- getTailwind: () => getTailwind,
458
- getUrlInfo: () => getUrlInfo,
459
- getValueByPath: () => getValueByPath,
460
- goBack: () => goBack,
461
- goForward: () => goForward,
462
- hasClass: () => hasClass,
463
- hasDependencyOverrides: () => hasDependencyOverrides,
464
- hasOverrides: () => hasOverrides,
465
- hasTemplateSyntax: () => hasTemplateSyntax,
466
- initServlyTailwind: () => initServlyTailwind,
467
- injectTailwind: () => injectTailwind,
468
- injectTailwindStyles: () => injectTailwindStyles,
469
- invalidateCache: () => invalidateCache,
470
- isComponentAvailable: () => isComponentAvailable,
471
- isIconCdnEnabled: () => isIconCdnEnabled,
472
- isIconRegistered: () => isIconRegistered,
473
- isIconSetSupported: () => isIconSetSupported,
474
- isTailwindLoaded: () => isTailwindLoaded,
475
- isValidSpecifier: () => isValidSpecifier,
476
- navigateTo: () => navigateTo,
477
- parseVersion: () => parseVersion,
478
- prefetchComponents: () => prefetchComponents,
479
- preloadIcons: () => preloadIcons,
480
- processStyles: () => processStyles,
481
- registerIcon: () => registerIcon,
482
- registerIcons: () => registerIcons,
483
- removeClass: () => removeClass,
484
- removeCustomStyles: () => removeCustomStyles,
485
- removeLocalStorage: () => removeLocalStorage,
486
- removeSessionStorage: () => removeSessionStorage,
487
- removeTailwind: () => removeTailwind,
488
- render: () => render,
489
- renderDynamicList: () => renderDynamicList,
490
- renderIcon: () => renderIcon,
491
- renderInShadow: () => renderInShadow,
492
- renderNode: () => renderNode,
493
- resetAnalytics: () => resetAnalytics,
494
- resetEventSystem: () => resetEventSystem,
495
- resetLongTaskObserver: () => resetLongTaskObserver,
496
- resetMemorySampler: () => resetMemorySampler,
497
- resetOverrideSystem: () => resetOverrideSystem,
498
- resetSessionManager: () => resetSessionManager,
499
- resolveBindingPath: () => resolveBindingPath,
500
- resolveTemplate: () => resolveTemplate,
501
- resolveTemplateValue: () => resolveTemplateValue,
502
- resolveTemplatesDeep: () => resolveTemplatesDeep,
503
- resolveVersion: () => resolveVersion,
504
- runAllTests: () => runAllTests,
505
- runTestCase: () => runTestCase,
506
- satisfiesVersion: () => satisfiesVersion,
507
- setIconCdnEnabled: () => setIconCdnEnabled,
508
- setInCache: () => setInCache,
509
- setLocalStorage: () => setLocalStorage,
510
- setRegistryUrl: () => setRegistryUrl,
511
- setSessionStorage: () => setSessionStorage,
512
- setValueByPath: () => setValueByPath,
513
- toDomEventName: () => toDomEventName,
514
- toReactEventName: () => toReactEventName,
515
- toggleClass: () => toggleClass,
516
- updateStyles: () => updateStyles,
517
- updateTailwindConfig: () => updateTailwindConfig,
518
- validateAssertion: () => validateAssertion,
519
- validateProps: () => validateProps
520
- });
521
- module.exports = __toCommonJS(index_exports);
1
+ import {
2
+ DEFAULT_SERVLY_TAILWIND_CONFIG,
3
+ addCustomStyles,
4
+ getTailwind,
5
+ initServlyTailwind,
6
+ injectTailwind,
7
+ injectTailwindStyles,
8
+ isTailwindLoaded,
9
+ removeCustomStyles,
10
+ removeTailwind,
11
+ updateTailwindConfig
12
+ } from "./chunk-SMHCCKAZ.js";
13
+ import {
14
+ buildRegistryFromBundle,
15
+ collectAllDependencies,
16
+ createRegistry,
17
+ detectCircularDependencies,
18
+ extractDependencies,
19
+ extractDependenciesFromCode
20
+ } from "./chunk-CIUQK4GA.js";
522
21
 
523
- // packages/runtime-core/src/analyticsTypes.ts
22
+ // src/analyticsTypes.ts
524
23
  var DEFAULT_ANALYTICS_CONFIG = {
525
24
  enabled: true,
526
25
  endpoint: "/api/v1/analytics/events",
@@ -538,7 +37,7 @@ var MAX_RETRY_ATTEMPTS = 3;
538
37
  var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
539
38
  var SDK_VERSION = "1.0.0";
540
39
 
541
- // packages/runtime-core/src/sessionManager.ts
40
+ // src/sessionManager.ts
542
41
  var SESSION_STORAGE_KEY = "servly_analytics_session";
543
42
  function generateUUID() {
544
43
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -600,8 +99,8 @@ function isSessionExpired(session) {
600
99
  return now - session.lastActivityAt > SESSION_TIMEOUT_MS;
601
100
  }
602
101
  var SessionManager = class {
603
- session = null;
604
102
  constructor() {
103
+ this.session = null;
605
104
  this.initialize();
606
105
  }
607
106
  /**
@@ -681,15 +180,13 @@ function resetSessionManager() {
681
180
  sessionManagerInstance = null;
682
181
  }
683
182
 
684
- // packages/runtime-core/src/analytics.ts
183
+ // src/analytics.ts
685
184
  var AnalyticsCollector = class {
686
- config;
687
- eventQueue = [];
688
- flushTimer = null;
689
- isEnabled;
690
- isFlushing = false;
691
- retryDelay = 1e3;
692
185
  constructor(config) {
186
+ this.eventQueue = [];
187
+ this.flushTimer = null;
188
+ this.isFlushing = false;
189
+ this.retryDelay = 1e3;
693
190
  this.config = { ...DEFAULT_ANALYTICS_CONFIG, ...config };
694
191
  this.isEnabled = this.config.enabled;
695
192
  this.startFlushTimer();
@@ -1032,7 +529,7 @@ var analytics = {
1032
529
  enable: () => getAnalytics().enable()
1033
530
  };
1034
531
 
1035
- // packages/runtime-core/src/bindings.ts
532
+ // src/bindings.ts
1036
533
  var BINDING_SOURCES = [
1037
534
  "props",
1038
535
  "state",
@@ -1416,7 +913,7 @@ function extractBindingKeys(template) {
1416
913
  return Array.from(keys);
1417
914
  }
1418
915
 
1419
- // packages/runtime-core/src/styles.ts
916
+ // src/styles.ts
1420
917
  var UNITLESS_PROPERTIES = /* @__PURE__ */ new Set([
1421
918
  "animationIterationCount",
1422
919
  "borderImageOutset",
@@ -1584,9 +1081,8 @@ function updateStyles(element, oldStyles, newStyles) {
1584
1081
  }
1585
1082
  }
1586
1083
 
1587
- // packages/runtime-core/src/memorySampler.ts
1084
+ // src/memorySampler.ts
1588
1085
  var MemorySampler = class {
1589
- isSupported;
1590
1086
  constructor() {
1591
1087
  this.isSupported = this.checkSupport();
1592
1088
  }
@@ -1646,13 +1142,12 @@ function resetMemorySampler() {
1646
1142
  memorySamplerInstance = null;
1647
1143
  }
1648
1144
 
1649
- // packages/runtime-core/src/longTaskObserver.ts
1145
+ // src/longTaskObserver.ts
1650
1146
  var LongTaskObserver = class {
1651
- observer = null;
1652
- longTaskCount = 0;
1653
- isSupported;
1654
- isObserving = false;
1655
1147
  constructor() {
1148
+ this.observer = null;
1149
+ this.longTaskCount = 0;
1150
+ this.isObserving = false;
1656
1151
  this.isSupported = this.checkSupport();
1657
1152
  }
1658
1153
  /**
@@ -1742,12 +1237,11 @@ function resetLongTaskObserver() {
1742
1237
  longTaskObserverInstance = null;
1743
1238
  }
1744
1239
 
1745
- // packages/runtime-core/src/stateManager.ts
1240
+ // src/stateManager.ts
1746
1241
  var StateManager = class {
1747
- state = {};
1748
- listeners = /* @__PURE__ */ new Set();
1749
- config;
1750
1242
  constructor(config = {}) {
1243
+ this.state = {};
1244
+ this.listeners = /* @__PURE__ */ new Set();
1751
1245
  this.config = config;
1752
1246
  this.state = config.initialState || {};
1753
1247
  if (config.persistToLocalStorage && typeof localStorage !== "undefined") {
@@ -2133,7 +1627,7 @@ function getUrlInfo() {
2133
1627
  };
2134
1628
  }
2135
1629
 
2136
- // packages/runtime-core/src/eventSystem.ts
1630
+ // src/eventSystem.ts
2137
1631
  var builtInPlugins = {
2138
1632
  /**
2139
1633
  * Set state value
@@ -2399,11 +1893,9 @@ var builtInPlugins = {
2399
1893
  }
2400
1894
  };
2401
1895
  var EventSystem = class {
2402
- config;
2403
- pluginExecutors;
2404
- debounceTimers = /* @__PURE__ */ new Map();
2405
- throttleTimers = /* @__PURE__ */ new Map();
2406
1896
  constructor(config = {}) {
1897
+ this.debounceTimers = /* @__PURE__ */ new Map();
1898
+ this.throttleTimers = /* @__PURE__ */ new Map();
2407
1899
  this.config = config;
2408
1900
  this.pluginExecutors = {
2409
1901
  ...builtInPlugins,
@@ -2573,12 +2065,11 @@ function resetEventSystem() {
2573
2065
  }
2574
2066
  }
2575
2067
 
2576
- // packages/runtime-core/src/overrides.ts
2068
+ // src/overrides.ts
2577
2069
  var OverrideSystem = class {
2578
- config;
2579
- elementStates = /* @__PURE__ */ new Map();
2580
- watchIntervals = /* @__PURE__ */ new Map();
2581
2070
  constructor(config = {}) {
2071
+ this.elementStates = /* @__PURE__ */ new Map();
2072
+ this.watchIntervals = /* @__PURE__ */ new Map();
2582
2073
  this.config = config;
2583
2074
  }
2584
2075
  /**
@@ -2795,7 +2286,7 @@ function resetOverrideSystem() {
2795
2286
  }
2796
2287
  }
2797
2288
 
2798
- // packages/runtime-core/src/icons.ts
2289
+ // src/icons.ts
2799
2290
  var cdnEnabled = true;
2800
2291
  function setIconCdnEnabled(enabled) {
2801
2292
  cdnEnabled = enabled;
@@ -3105,8 +2596,7 @@ function getIconifyCollection(set) {
3105
2596
  return ICONIFY_COLLECTIONS[set];
3106
2597
  }
3107
2598
 
3108
- // packages/runtime-core/src/renderer.ts
3109
- init_tailwind();
2599
+ // src/renderer.ts
3110
2600
  var tailwindAutoInjected = false;
3111
2601
  function ensureTailwind() {
3112
2602
  if (tailwindAutoInjected || typeof document === "undefined") return;
@@ -4034,7 +3524,7 @@ async function createServlyRenderer(options) {
4034
3524
  container = containerOption;
4035
3525
  }
4036
3526
  if (shouldInjectTailwind) {
4037
- const { initServlyTailwind: initServlyTailwind2 } = await Promise.resolve().then(() => (init_tailwind(), tailwind_exports));
3527
+ const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-DMUQ7TOT.js");
4038
3528
  await initServlyTailwind2(tailwindConfig);
4039
3529
  }
4040
3530
  const activeRenders = [];
@@ -4132,7 +3622,7 @@ function collectAllViewDependencies(views, startViewId) {
4132
3622
  return collected;
4133
3623
  }
4134
3624
 
4135
- // packages/runtime-core/src/cache.ts
3625
+ // src/cache.ts
4136
3626
  var DEFAULT_CACHE_CONFIG = {
4137
3627
  maxEntries: 50,
4138
3628
  ttl: 5 * 60 * 1e3,
@@ -4376,8 +3866,7 @@ function invalidateCache(id, version, config = DEFAULT_CACHE_CONFIG) {
4376
3866
  }
4377
3867
  }
4378
3868
 
4379
- // packages/runtime-core/src/fetcher.ts
4380
- init_registry();
3869
+ // src/fetcher.ts
4381
3870
  var DEFAULT_RETRY_CONFIG = {
4382
3871
  maxRetries: 3,
4383
3872
  initialDelay: 1e3,
@@ -4631,7 +4120,7 @@ async function fetchComponent(id, options = {}) {
4631
4120
  async function fetchComponentWithDependencies(id, options = {}) {
4632
4121
  const result = await fetchComponent(id, { ...options, includeBundle: true });
4633
4122
  if (result.pendingDependencies && result.pendingDependencies.length > 0) {
4634
- const { createRegistry: createRegistry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
4123
+ const { createRegistry: createRegistry2 } = await import("./registry-GCCVK65D.js");
4635
4124
  const registry = result.registry || createRegistry2();
4636
4125
  await Promise.all(
4637
4126
  result.pendingDependencies.map(async (dep) => {
@@ -4737,7 +4226,7 @@ async function getDependencyTree(id, options = {}) {
4737
4226
  return data.data;
4738
4227
  }
4739
4228
 
4740
- // packages/runtime-core/src/version.ts
4229
+ // src/version.ts
4741
4230
  function parseVersion(version) {
4742
4231
  const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
4743
4232
  if (!match) return null;
@@ -4849,7 +4338,7 @@ function formatVersion(version) {
4849
4338
  return `v${parsed.major}.${parsed.minor}.${parsed.patch}`;
4850
4339
  }
4851
4340
 
4852
- // packages/runtime-core/src/testRunner.ts
4341
+ // src/testRunner.ts
4853
4342
  function runTestCase(elements, testCase, container) {
4854
4343
  const startTime = performance.now();
4855
4344
  const assertionResults = [];
@@ -5103,148 +4592,7 @@ function getSampleValue(def) {
5103
4592
  return def.defaultValue;
5104
4593
  }
5105
4594
  }
5106
-
5107
- // packages/runtime-core/src/index.ts
5108
- init_registry();
5109
- init_tailwind();
5110
-
5111
- // packages/runtime-core/src/iconExtractor.ts
5112
- var REACT_ICONS_PACKAGES = {
5113
- Ai: "react-icons/ai",
5114
- Bi: "react-icons/bi",
5115
- Bs: "react-icons/bs",
5116
- Cg: "react-icons/cg",
5117
- Di: "react-icons/di",
5118
- Fa: "react-icons/fa",
5119
- Fa6: "react-icons/fa6",
5120
- Fc: "react-icons/fc",
5121
- Fi: "react-icons/fi",
5122
- Gi: "react-icons/gi",
5123
- Go: "react-icons/go",
5124
- Gr: "react-icons/gr",
5125
- Hi: "react-icons/hi",
5126
- Hi2: "react-icons/hi2",
5127
- Im: "react-icons/im",
5128
- Io: "react-icons/io",
5129
- Io5: "react-icons/io5",
5130
- Lu: "react-icons/lu",
5131
- Md: "react-icons/md",
5132
- Pi: "react-icons/pi",
5133
- Ri: "react-icons/ri",
5134
- Rx: "react-icons/rx",
5135
- Si: "react-icons/si",
5136
- Sl: "react-icons/sl",
5137
- Tb: "react-icons/tb",
5138
- Tfi: "react-icons/tfi",
5139
- Vsc: "react-icons/vsc",
5140
- Wi: "react-icons/wi"
5141
- };
5142
- async function extractIconFromReactIcons(iconName, iconSet) {
5143
- const packagePath = REACT_ICONS_PACKAGES[iconSet];
5144
- if (!packagePath) {
5145
- console.warn(`Unknown icon set: ${iconSet}`);
5146
- return null;
5147
- }
5148
- try {
5149
- const iconModule = await import(packagePath);
5150
- const IconComponent = iconModule[iconName];
5151
- if (!IconComponent) {
5152
- console.warn(`Icon not found: ${iconName} in ${packagePath}`);
5153
- return null;
5154
- }
5155
- const React = await import("react");
5156
- const { renderToStaticMarkup } = await import("react-dom/server");
5157
- const svgString = renderToStaticMarkup(React.createElement(IconComponent, { size: 24 }));
5158
- return parseSvgString(svgString);
5159
- } catch (error) {
5160
- console.error(`Failed to extract icon ${iconSet}:${iconName}:`, error);
5161
- return null;
5162
- }
5163
- }
5164
- function parseSvgString(svgString) {
5165
- const viewBoxMatch = svgString.match(/viewBox="([^"]+)"/);
5166
- const viewBox = viewBoxMatch ? viewBoxMatch[1] : "0 0 24 24";
5167
- const widthMatch = svgString.match(/width="(\d+)"/);
5168
- const heightMatch = svgString.match(/height="(\d+)"/);
5169
- const width = widthMatch ? parseInt(widthMatch[1], 10) : 24;
5170
- const height = heightMatch ? parseInt(heightMatch[1], 10) : 24;
5171
- const bodyMatch = svgString.match(/<svg[^>]*>([\s\S]*)<\/svg>/);
5172
- const body = bodyMatch ? bodyMatch[1].trim() : "";
5173
- if (!body) {
5174
- return null;
5175
- }
5176
- return {
5177
- body,
5178
- viewBox,
5179
- width,
5180
- height
5181
- };
5182
- }
5183
- function findIconsInLayout(elements) {
5184
- const icons = [];
5185
- const seen = /* @__PURE__ */ new Set();
5186
- for (const element of elements) {
5187
- if (element.componentId === "icon" && element.configuration?.icon) {
5188
- const icon = element.configuration.icon;
5189
- const key = `${icon.set}:${icon.name}`;
5190
- if (!seen.has(key)) {
5191
- seen.add(key);
5192
- icons.push({
5193
- name: icon.name,
5194
- set: icon.set,
5195
- setName: icon.setName
5196
- });
5197
- }
5198
- }
5199
- }
5200
- return icons;
5201
- }
5202
- async function extractIconsForLayout(elements) {
5203
- const icons = findIconsInLayout(elements);
5204
- const result = {};
5205
- for (const icon of icons) {
5206
- const data = await extractIconFromReactIcons(icon.name, icon.set);
5207
- if (data) {
5208
- if (!result[icon.set]) {
5209
- result[icon.set] = {};
5210
- }
5211
- result[icon.set][icon.name] = data;
5212
- }
5213
- }
5214
- return result;
5215
- }
5216
- function generateIconBundle(icons) {
5217
- const lines = [
5218
- "// Auto-generated icon bundle",
5219
- "// Do not edit manually",
5220
- "",
5221
- "import { registerIcons, type IconData } from '@servlyadmin/runtime-core';",
5222
- "",
5223
- "const BUNDLED_ICONS: Record<string, Record<string, IconData>> = {"
5224
- ];
5225
- for (const [set, setIcons] of Object.entries(icons)) {
5226
- lines.push(` ${set}: {`);
5227
- for (const [name, data] of Object.entries(setIcons)) {
5228
- const escapedBody = data.body.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n");
5229
- lines.push(` ${name}: {`);
5230
- lines.push(` body: '${escapedBody}',`);
5231
- lines.push(` viewBox: '${data.viewBox}',`);
5232
- if (data.width) lines.push(` width: ${data.width},`);
5233
- if (data.height) lines.push(` height: ${data.height},`);
5234
- lines.push(` },`);
5235
- }
5236
- lines.push(` },`);
5237
- }
5238
- lines.push("};");
5239
- lines.push("");
5240
- lines.push("// Register all bundled icons");
5241
- lines.push("registerIcons(BUNDLED_ICONS);");
5242
- lines.push("");
5243
- lines.push("export { BUNDLED_ICONS };");
5244
- return lines.join("\n");
5245
- }
5246
- // Annotate the CommonJS export names for ESM import in node:
5247
- 0 && (module.exports = {
4595
+ export {
5248
4596
  AnalyticsCollector,
5249
4597
  DEFAULT_CACHE_CONFIG,
5250
4598
  DEFAULT_RETRY_CONFIG,
@@ -5286,16 +4634,12 @@ function generateIconBundle(icons) {
5286
4634
  extractBindingKeys,
5287
4635
  extractDependencies,
5288
4636
  extractDependenciesFromCode,
5289
- extractIconFromReactIcons,
5290
- extractIconsForLayout,
5291
4637
  extractOverrideDependencies,
5292
4638
  extractReferencedViewIds,
5293
4639
  fetchComponent,
5294
4640
  fetchComponentWithDependencies,
5295
- findIconsInLayout,
5296
4641
  formatStyleValue,
5297
4642
  formatVersion,
5298
- generateIconBundle,
5299
4643
  generateTestCases,
5300
4644
  getAnalytics,
5301
4645
  getCacheKey,
@@ -5380,4 +4724,4 @@ function generateIconBundle(icons) {
5380
4724
  updateTailwindConfig,
5381
4725
  validateAssertion,
5382
4726
  validateProps
5383
- });
4727
+ };