@servlyadmin/runtime-core 0.1.32 → 0.1.33

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.
@@ -1,25 +1,515 @@
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-ZF666DOB.mjs";
13
- import {
14
- buildRegistryFromBundle,
15
- collectAllDependencies,
16
- createRegistry,
17
- detectCircularDependencies,
18
- extractDependencies,
19
- extractDependenciesFromCode
20
- } from "./chunk-EQFZFPI7.mjs";
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esm = (fn, res) => function __init() {
7
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
8
+ };
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
22
 
22
- // packages/runtime-core/src/analyticsTypes.ts
23
+ // src/tailwind.ts
24
+ var tailwind_exports = {};
25
+ __export(tailwind_exports, {
26
+ DEFAULT_SERVLY_TAILWIND_CONFIG: () => DEFAULT_SERVLY_TAILWIND_CONFIG,
27
+ addCustomStyles: () => addCustomStyles,
28
+ default: () => tailwind_default,
29
+ getTailwind: () => getTailwind,
30
+ initServlyTailwind: () => initServlyTailwind,
31
+ injectTailwind: () => injectTailwind,
32
+ injectTailwindStyles: () => injectTailwindStyles,
33
+ isTailwindLoaded: () => isTailwindLoaded,
34
+ removeCustomStyles: () => removeCustomStyles,
35
+ removeTailwind: () => removeTailwind,
36
+ updateTailwindConfig: () => updateTailwindConfig
37
+ });
38
+ function injectTailwind(config = {}) {
39
+ return new Promise((resolve, reject) => {
40
+ if (tailwindInjected && tailwindScript) {
41
+ resolve();
42
+ return;
43
+ }
44
+ if (typeof document === "undefined") {
45
+ resolve();
46
+ return;
47
+ }
48
+ if (window.tailwind) {
49
+ tailwindInjected = true;
50
+ config.onReady?.();
51
+ resolve();
52
+ return;
53
+ }
54
+ const {
55
+ cdnUrl = DEFAULT_TAILWIND_CDN,
56
+ config: tailwindConfig,
57
+ plugins = [],
58
+ usePlayCdn = false,
59
+ onReady,
60
+ onError
61
+ } = config;
62
+ const script = document.createElement("script");
63
+ script.src = usePlayCdn ? `${cdnUrl}?plugins=forms,typography,aspect-ratio` : cdnUrl;
64
+ script.async = true;
65
+ script.onload = () => {
66
+ tailwindInjected = true;
67
+ tailwindScript = script;
68
+ if (tailwindConfig && window.tailwind) {
69
+ window.tailwind.config = tailwindConfig;
70
+ }
71
+ onReady?.();
72
+ resolve();
73
+ };
74
+ script.onerror = (event) => {
75
+ const error = new Error(`Failed to load Tailwind CSS from ${cdnUrl}`);
76
+ onError?.(error);
77
+ reject(error);
78
+ };
79
+ document.head.appendChild(script);
80
+ });
81
+ }
82
+ function removeTailwind() {
83
+ if (tailwindScript && tailwindScript.parentNode) {
84
+ tailwindScript.parentNode.removeChild(tailwindScript);
85
+ tailwindScript = null;
86
+ tailwindInjected = false;
87
+ delete window.tailwind;
88
+ }
89
+ }
90
+ function isTailwindLoaded() {
91
+ return tailwindInjected || !!window.tailwind;
92
+ }
93
+ function getTailwind() {
94
+ return window.tailwind;
95
+ }
96
+ function updateTailwindConfig(config) {
97
+ if (window.tailwind) {
98
+ window.tailwind.config = {
99
+ ...window.tailwind.config,
100
+ ...config
101
+ };
102
+ }
103
+ }
104
+ function addCustomStyles(css, id) {
105
+ if (typeof document === "undefined") {
106
+ throw new Error("addCustomStyles can only be used in browser environment");
107
+ }
108
+ const styleId = id || `servly-custom-styles-${Date.now()}`;
109
+ let existingStyle = document.getElementById(styleId);
110
+ if (existingStyle) {
111
+ existingStyle.textContent = css;
112
+ return existingStyle;
113
+ }
114
+ const style = document.createElement("style");
115
+ style.id = styleId;
116
+ style.textContent = css;
117
+ document.head.appendChild(style);
118
+ return style;
119
+ }
120
+ function removeCustomStyles(id) {
121
+ if (typeof document === "undefined") return;
122
+ const style = document.getElementById(id);
123
+ if (style && style.parentNode) {
124
+ style.parentNode.removeChild(style);
125
+ }
126
+ }
127
+ async function initServlyTailwind(customConfig) {
128
+ const config = customConfig ? { ...DEFAULT_SERVLY_TAILWIND_CONFIG, ...customConfig } : DEFAULT_SERVLY_TAILWIND_CONFIG;
129
+ await injectTailwind({
130
+ config,
131
+ usePlayCdn: true
132
+ });
133
+ }
134
+ var DEFAULT_TAILWIND_CDN, tailwindInjected, tailwindScript, DEFAULT_SERVLY_TAILWIND_CONFIG, injectTailwindStyles, tailwind_default;
135
+ var init_tailwind = __esm({
136
+ "src/tailwind.ts"() {
137
+ "use strict";
138
+ DEFAULT_TAILWIND_CDN = "https://cdn.tailwindcss.com";
139
+ tailwindInjected = false;
140
+ tailwindScript = null;
141
+ DEFAULT_SERVLY_TAILWIND_CONFIG = {
142
+ theme: {
143
+ extend: {
144
+ // Add any Servly-specific theme extensions here
145
+ }
146
+ },
147
+ // Safelist common dynamic classes
148
+ safelist: [
149
+ // Spacing
150
+ { pattern: /^(p|m|gap)-/ },
151
+ // Sizing
152
+ { pattern: /^(w|h|min-w|min-h|max-w|max-h)-/ },
153
+ // Flexbox
154
+ { pattern: /^(flex|justify|items|self)-/ },
155
+ // Grid
156
+ { pattern: /^(grid|col|row)-/ },
157
+ // Colors
158
+ { pattern: /^(bg|text|border|ring)-/ },
159
+ // Typography
160
+ { pattern: /^(font|text|leading|tracking)-/ },
161
+ // Borders
162
+ { pattern: /^(rounded|border)-/ },
163
+ // Effects
164
+ { pattern: /^(shadow|opacity|blur)-/ },
165
+ // Transforms
166
+ { pattern: /^(scale|rotate|translate|skew)-/ },
167
+ // Transitions
168
+ { pattern: /^(transition|duration|ease|delay)-/ }
169
+ ]
170
+ };
171
+ injectTailwindStyles = initServlyTailwind;
172
+ tailwind_default = {
173
+ injectTailwind,
174
+ injectTailwindStyles,
175
+ removeTailwind,
176
+ isTailwindLoaded,
177
+ getTailwind,
178
+ updateTailwindConfig,
179
+ addCustomStyles,
180
+ removeCustomStyles,
181
+ initServlyTailwind,
182
+ DEFAULT_SERVLY_TAILWIND_CONFIG
183
+ };
184
+ }
185
+ });
186
+
187
+ // src/registry.ts
188
+ var registry_exports = {};
189
+ __export(registry_exports, {
190
+ buildRegistryFromBundle: () => buildRegistryFromBundle,
191
+ collectAllDependencies: () => collectAllDependencies,
192
+ createRegistry: () => createRegistry,
193
+ detectCircularDependencies: () => detectCircularDependencies,
194
+ extractDependencies: () => extractDependencies,
195
+ extractDependenciesFromCode: () => extractDependenciesFromCode
196
+ });
197
+ function createRegistry() {
198
+ const components = /* @__PURE__ */ new Map();
199
+ return {
200
+ get(id, version) {
201
+ if (version) {
202
+ const key = `${id}@${version}`;
203
+ if (components.has(key)) {
204
+ return components.get(key);
205
+ }
206
+ }
207
+ for (const [key, component] of components) {
208
+ if (key.startsWith(`${id}@`)) {
209
+ return component;
210
+ }
211
+ }
212
+ return components.get(id);
213
+ },
214
+ has(id, version) {
215
+ if (version) {
216
+ return components.has(`${id}@${version}`);
217
+ }
218
+ for (const key of components.keys()) {
219
+ if (key.startsWith(`${id}@`) || key === id) {
220
+ return true;
221
+ }
222
+ }
223
+ return false;
224
+ },
225
+ set(id, version, component) {
226
+ components.set(`${id}@${version}`, component);
227
+ }
228
+ };
229
+ }
230
+ function buildRegistryFromBundle(data) {
231
+ const registry = createRegistry();
232
+ registry.set(data.id, data.version, {
233
+ layout: data.layout,
234
+ propsInterface: data.propsInterface
235
+ });
236
+ if (data.bundle) {
237
+ for (const [key, component] of Object.entries(data.bundle)) {
238
+ const [id, version] = key.split("@");
239
+ if (id && version) {
240
+ registry.set(id, version, component);
241
+ }
242
+ }
243
+ }
244
+ return registry;
245
+ }
246
+ function extractDependencies(elements) {
247
+ const dependencies = [];
248
+ for (const element of elements) {
249
+ const config = element.configuration;
250
+ if (!config) continue;
251
+ if (config.componentViewRef) {
252
+ dependencies.push({
253
+ id: config.componentViewRef,
254
+ version: config.componentViewVersion,
255
+ type: "viewRef",
256
+ elementId: element.i
257
+ });
258
+ }
259
+ if (config.blueprint) {
260
+ dependencies.push({
261
+ id: config.blueprint,
262
+ version: config.blueprintVersion,
263
+ type: "blueprint",
264
+ elementId: element.i
265
+ });
266
+ }
267
+ }
268
+ return dependencies;
269
+ }
270
+ function extractDependenciesFromCode(code) {
271
+ const dependencies = [];
272
+ const pattern = /renderDynamicList\s*\(\s*\{[^}]*blueprint\s*:\s*["']([^"']+)["']/g;
273
+ let match;
274
+ while ((match = pattern.exec(code)) !== null) {
275
+ dependencies.push({
276
+ id: match[1],
277
+ type: "blueprint"
278
+ });
279
+ }
280
+ return dependencies;
281
+ }
282
+ async function collectAllDependencies(rootId, rootVersion, fetchComponent2, maxDepth = 10) {
283
+ const manifest = {};
284
+ const visited = /* @__PURE__ */ new Set();
285
+ async function collect(id, version, via, depth) {
286
+ if (depth > maxDepth) {
287
+ console.warn(`Max dependency depth (${maxDepth}) reached for ${id}`);
288
+ return;
289
+ }
290
+ const key = `${id}@${version || "latest"}`;
291
+ if (visited.has(key)) {
292
+ return;
293
+ }
294
+ visited.add(key);
295
+ try {
296
+ const component = await fetchComponent2(id, version);
297
+ if (!component) {
298
+ console.warn(`Dependency not found: ${id}@${version || "latest"}`);
299
+ return;
300
+ }
301
+ manifest[id] = {
302
+ version: version || "latest",
303
+ resolved: component.version,
304
+ type: via ? "viewRef" : "viewRef",
305
+ // Will be set by caller
306
+ via
307
+ };
308
+ const nestedDeps = extractDependencies(component.layout);
309
+ for (const dep of nestedDeps) {
310
+ await collect(dep.id, dep.version, id, depth + 1);
311
+ }
312
+ } catch (error) {
313
+ console.error(`Failed to fetch dependency ${id}:`, error);
314
+ }
315
+ }
316
+ const rootComponent = await fetchComponent2(rootId, rootVersion);
317
+ if (rootComponent) {
318
+ const rootDeps = extractDependencies(rootComponent.layout);
319
+ for (const dep of rootDeps) {
320
+ manifest[dep.id] = {
321
+ version: dep.version || "latest",
322
+ resolved: "",
323
+ // Will be filled when fetched
324
+ type: dep.type
325
+ };
326
+ await collect(dep.id, dep.version, void 0, 1);
327
+ }
328
+ }
329
+ return manifest;
330
+ }
331
+ function detectCircularDependencies(manifest) {
332
+ const graph = /* @__PURE__ */ new Map();
333
+ for (const [id, entry] of Object.entries(manifest)) {
334
+ if (entry.via) {
335
+ const deps = graph.get(entry.via) || [];
336
+ deps.push(id);
337
+ graph.set(entry.via, deps);
338
+ }
339
+ }
340
+ const visited = /* @__PURE__ */ new Set();
341
+ const stack = /* @__PURE__ */ new Set();
342
+ const path = [];
343
+ function dfs(node) {
344
+ if (stack.has(node)) {
345
+ const cycleStart = path.indexOf(node);
346
+ return [...path.slice(cycleStart), node];
347
+ }
348
+ if (visited.has(node)) {
349
+ return null;
350
+ }
351
+ visited.add(node);
352
+ stack.add(node);
353
+ path.push(node);
354
+ const neighbors = graph.get(node) || [];
355
+ for (const neighbor of neighbors) {
356
+ const cycle = dfs(neighbor);
357
+ if (cycle) return cycle;
358
+ }
359
+ stack.delete(node);
360
+ path.pop();
361
+ return null;
362
+ }
363
+ for (const node of graph.keys()) {
364
+ const cycle = dfs(node);
365
+ if (cycle) return cycle;
366
+ }
367
+ return null;
368
+ }
369
+ var init_registry = __esm({
370
+ "src/registry.ts"() {
371
+ "use strict";
372
+ }
373
+ });
374
+
375
+ // src/index.ts
376
+ var index_exports = {};
377
+ __export(index_exports, {
378
+ AnalyticsCollector: () => AnalyticsCollector,
379
+ DEFAULT_CACHE_CONFIG: () => DEFAULT_CACHE_CONFIG,
380
+ DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
381
+ DEFAULT_SERVLY_TAILWIND_CONFIG: () => DEFAULT_SERVLY_TAILWIND_CONFIG,
382
+ EVENT_HANDLERS: () => EVENT_HANDLERS,
383
+ EventSystem: () => EventSystem,
384
+ LongTaskObserver: () => LongTaskObserver,
385
+ MemorySampler: () => MemorySampler,
386
+ OverrideSystem: () => OverrideSystem,
387
+ SessionManager: () => SessionManager,
388
+ StateManager: () => StateManager,
389
+ addClass: () => addClass,
390
+ addCustomStyles: () => addCustomStyles,
391
+ analytics: () => analytics,
392
+ applyStyles: () => applyStyles,
393
+ batchFetchComponents: () => batchFetchComponents,
394
+ buildClassName: () => buildClassName,
395
+ buildElementStyles: () => buildElementStyles,
396
+ buildRegistryFromBundle: () => buildRegistryFromBundle,
397
+ bumpVersion: () => bumpVersion,
398
+ camelToKebab: () => camelToKebab,
399
+ clearAllCaches: () => clearAllCaches,
400
+ clearIconCache: () => clearIconCache,
401
+ clearLocalStorageCache: () => clearLocalStorageCache,
402
+ clearMemoryCache: () => clearMemoryCache,
403
+ clearStyles: () => clearStyles,
404
+ collectAllDependencies: () => collectAllDependencies,
405
+ collectAllViewDependencies: () => collectAllViewDependencies,
406
+ compareVersions: () => compareVersions,
407
+ configureAnalytics: () => configureAnalytics,
408
+ createIconSVG: () => createIconSVG,
409
+ createPlaceholderIcon: () => createPlaceholderIcon,
410
+ createRegistry: () => createRegistry,
411
+ createServlyRenderer: () => createServlyRenderer,
412
+ createViewsMap: () => createViewsMap,
413
+ deepMerge: () => deepMerge,
414
+ deleteValueByPath: () => deleteValueByPath,
415
+ detectCircularDependencies: () => detectCircularDependencies,
416
+ extractBindingKeys: () => extractBindingKeys,
417
+ extractDependencies: () => extractDependencies,
418
+ extractDependenciesFromCode: () => extractDependenciesFromCode,
419
+ extractOverrideDependencies: () => extractOverrideDependencies,
420
+ extractReferencedViewIds: () => extractReferencedViewIds,
421
+ fetchComponent: () => fetchComponent,
422
+ fetchComponentWithDependencies: () => fetchComponentWithDependencies,
423
+ formatStyleValue: () => formatStyleValue,
424
+ formatVersion: () => formatVersion,
425
+ generateTestCases: () => generateTestCases,
426
+ getAnalytics: () => getAnalytics,
427
+ getCacheKey: () => getCacheKey,
428
+ getCleanupOverrides: () => getCleanupOverrides,
429
+ getDependencyTree: () => getDependencyTree,
430
+ getEventSystem: () => getEventSystem,
431
+ getFromCache: () => getFromCache,
432
+ getIconData: () => getIconData,
433
+ getIconDataSync: () => getIconDataSync,
434
+ getIconifyCollection: () => getIconifyCollection,
435
+ getLocalStorage: () => getLocalStorage,
436
+ getLongTaskObserver: () => getLongTaskObserver,
437
+ getMemoryCacheSize: () => getMemoryCacheSize,
438
+ getMemorySampler: () => getMemorySampler,
439
+ getMountOverrides: () => getMountOverrides,
440
+ getOverrideSystem: () => getOverrideSystem,
441
+ getRegisteredIconKeys: () => getRegisteredIconKeys,
442
+ getRegistryUrl: () => getRegistryUrl,
443
+ getSessionManager: () => getSessionManager,
444
+ getSessionStorage: () => getSessionStorage,
445
+ getSupportedIconSets: () => getSupportedIconSets,
446
+ getTailwind: () => getTailwind,
447
+ getUrlInfo: () => getUrlInfo,
448
+ getValueByPath: () => getValueByPath,
449
+ goBack: () => goBack,
450
+ goForward: () => goForward,
451
+ hasClass: () => hasClass,
452
+ hasDependencyOverrides: () => hasDependencyOverrides,
453
+ hasOverrides: () => hasOverrides,
454
+ hasTemplateSyntax: () => hasTemplateSyntax,
455
+ initServlyTailwind: () => initServlyTailwind,
456
+ injectTailwind: () => injectTailwind,
457
+ injectTailwindStyles: () => injectTailwindStyles,
458
+ invalidateCache: () => invalidateCache,
459
+ isComponentAvailable: () => isComponentAvailable,
460
+ isIconCdnEnabled: () => isIconCdnEnabled,
461
+ isIconRegistered: () => isIconRegistered,
462
+ isIconSetSupported: () => isIconSetSupported,
463
+ isTailwindLoaded: () => isTailwindLoaded,
464
+ isValidSpecifier: () => isValidSpecifier,
465
+ navigateTo: () => navigateTo,
466
+ parseVersion: () => parseVersion,
467
+ prefetchComponents: () => prefetchComponents,
468
+ preloadIcons: () => preloadIcons,
469
+ processStyles: () => processStyles,
470
+ registerIcon: () => registerIcon,
471
+ registerIcons: () => registerIcons,
472
+ removeClass: () => removeClass,
473
+ removeCustomStyles: () => removeCustomStyles,
474
+ removeLocalStorage: () => removeLocalStorage,
475
+ removeSessionStorage: () => removeSessionStorage,
476
+ removeTailwind: () => removeTailwind,
477
+ render: () => render,
478
+ renderDynamicList: () => renderDynamicList,
479
+ renderIcon: () => renderIcon,
480
+ renderInShadow: () => renderInShadow,
481
+ renderNode: () => renderNode,
482
+ resetAnalytics: () => resetAnalytics,
483
+ resetEventSystem: () => resetEventSystem,
484
+ resetLongTaskObserver: () => resetLongTaskObserver,
485
+ resetMemorySampler: () => resetMemorySampler,
486
+ resetOverrideSystem: () => resetOverrideSystem,
487
+ resetSessionManager: () => resetSessionManager,
488
+ resolveBindingPath: () => resolveBindingPath,
489
+ resolveTemplate: () => resolveTemplate,
490
+ resolveTemplateValue: () => resolveTemplateValue,
491
+ resolveTemplatesDeep: () => resolveTemplatesDeep,
492
+ resolveVersion: () => resolveVersion,
493
+ runAllTests: () => runAllTests,
494
+ runTestCase: () => runTestCase,
495
+ satisfiesVersion: () => satisfiesVersion,
496
+ setIconCdnEnabled: () => setIconCdnEnabled,
497
+ setInCache: () => setInCache,
498
+ setLocalStorage: () => setLocalStorage,
499
+ setRegistryUrl: () => setRegistryUrl,
500
+ setSessionStorage: () => setSessionStorage,
501
+ setValueByPath: () => setValueByPath,
502
+ toDomEventName: () => toDomEventName,
503
+ toReactEventName: () => toReactEventName,
504
+ toggleClass: () => toggleClass,
505
+ updateStyles: () => updateStyles,
506
+ updateTailwindConfig: () => updateTailwindConfig,
507
+ validateAssertion: () => validateAssertion,
508
+ validateProps: () => validateProps
509
+ });
510
+ module.exports = __toCommonJS(index_exports);
511
+
512
+ // src/analyticsTypes.ts
23
513
  var DEFAULT_ANALYTICS_CONFIG = {
24
514
  enabled: true,
25
515
  endpoint: "/api/v1/analytics/events",
@@ -37,7 +527,7 @@ var MAX_RETRY_ATTEMPTS = 3;
37
527
  var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
38
528
  var SDK_VERSION = "1.0.0";
39
529
 
40
- // packages/runtime-core/src/sessionManager.ts
530
+ // src/sessionManager.ts
41
531
  var SESSION_STORAGE_KEY = "servly_analytics_session";
42
532
  function generateUUID() {
43
533
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -99,8 +589,8 @@ function isSessionExpired(session) {
99
589
  return now - session.lastActivityAt > SESSION_TIMEOUT_MS;
100
590
  }
101
591
  var SessionManager = class {
102
- session = null;
103
592
  constructor() {
593
+ this.session = null;
104
594
  this.initialize();
105
595
  }
106
596
  /**
@@ -180,15 +670,13 @@ function resetSessionManager() {
180
670
  sessionManagerInstance = null;
181
671
  }
182
672
 
183
- // packages/runtime-core/src/analytics.ts
673
+ // src/analytics.ts
184
674
  var AnalyticsCollector = class {
185
- config;
186
- eventQueue = [];
187
- flushTimer = null;
188
- isEnabled;
189
- isFlushing = false;
190
- retryDelay = 1e3;
191
675
  constructor(config) {
676
+ this.eventQueue = [];
677
+ this.flushTimer = null;
678
+ this.isFlushing = false;
679
+ this.retryDelay = 1e3;
192
680
  this.config = { ...DEFAULT_ANALYTICS_CONFIG, ...config };
193
681
  this.isEnabled = this.config.enabled;
194
682
  this.startFlushTimer();
@@ -531,7 +1019,7 @@ var analytics = {
531
1019
  enable: () => getAnalytics().enable()
532
1020
  };
533
1021
 
534
- // packages/runtime-core/src/bindings.ts
1022
+ // src/bindings.ts
535
1023
  var BINDING_SOURCES = [
536
1024
  "props",
537
1025
  "state",
@@ -915,7 +1403,7 @@ function extractBindingKeys(template) {
915
1403
  return Array.from(keys);
916
1404
  }
917
1405
 
918
- // packages/runtime-core/src/styles.ts
1406
+ // src/styles.ts
919
1407
  var UNITLESS_PROPERTIES = /* @__PURE__ */ new Set([
920
1408
  "animationIterationCount",
921
1409
  "borderImageOutset",
@@ -1083,9 +1571,8 @@ function updateStyles(element, oldStyles, newStyles) {
1083
1571
  }
1084
1572
  }
1085
1573
 
1086
- // packages/runtime-core/src/memorySampler.ts
1574
+ // src/memorySampler.ts
1087
1575
  var MemorySampler = class {
1088
- isSupported;
1089
1576
  constructor() {
1090
1577
  this.isSupported = this.checkSupport();
1091
1578
  }
@@ -1145,13 +1632,12 @@ function resetMemorySampler() {
1145
1632
  memorySamplerInstance = null;
1146
1633
  }
1147
1634
 
1148
- // packages/runtime-core/src/longTaskObserver.ts
1635
+ // src/longTaskObserver.ts
1149
1636
  var LongTaskObserver = class {
1150
- observer = null;
1151
- longTaskCount = 0;
1152
- isSupported;
1153
- isObserving = false;
1154
1637
  constructor() {
1638
+ this.observer = null;
1639
+ this.longTaskCount = 0;
1640
+ this.isObserving = false;
1155
1641
  this.isSupported = this.checkSupport();
1156
1642
  }
1157
1643
  /**
@@ -1241,12 +1727,11 @@ function resetLongTaskObserver() {
1241
1727
  longTaskObserverInstance = null;
1242
1728
  }
1243
1729
 
1244
- // packages/runtime-core/src/stateManager.ts
1730
+ // src/stateManager.ts
1245
1731
  var StateManager = class {
1246
- state = {};
1247
- listeners = /* @__PURE__ */ new Set();
1248
- config;
1249
1732
  constructor(config = {}) {
1733
+ this.state = {};
1734
+ this.listeners = /* @__PURE__ */ new Set();
1250
1735
  this.config = config;
1251
1736
  this.state = config.initialState || {};
1252
1737
  if (config.persistToLocalStorage && typeof localStorage !== "undefined") {
@@ -1632,7 +2117,7 @@ function getUrlInfo() {
1632
2117
  };
1633
2118
  }
1634
2119
 
1635
- // packages/runtime-core/src/eventSystem.ts
2120
+ // src/eventSystem.ts
1636
2121
  var builtInPlugins = {
1637
2122
  /**
1638
2123
  * Set state value
@@ -1898,11 +2383,9 @@ var builtInPlugins = {
1898
2383
  }
1899
2384
  };
1900
2385
  var EventSystem = class {
1901
- config;
1902
- pluginExecutors;
1903
- debounceTimers = /* @__PURE__ */ new Map();
1904
- throttleTimers = /* @__PURE__ */ new Map();
1905
2386
  constructor(config = {}) {
2387
+ this.debounceTimers = /* @__PURE__ */ new Map();
2388
+ this.throttleTimers = /* @__PURE__ */ new Map();
1906
2389
  this.config = config;
1907
2390
  this.pluginExecutors = {
1908
2391
  ...builtInPlugins,
@@ -2072,12 +2555,11 @@ function resetEventSystem() {
2072
2555
  }
2073
2556
  }
2074
2557
 
2075
- // packages/runtime-core/src/overrides.ts
2558
+ // src/overrides.ts
2076
2559
  var OverrideSystem = class {
2077
- config;
2078
- elementStates = /* @__PURE__ */ new Map();
2079
- watchIntervals = /* @__PURE__ */ new Map();
2080
2560
  constructor(config = {}) {
2561
+ this.elementStates = /* @__PURE__ */ new Map();
2562
+ this.watchIntervals = /* @__PURE__ */ new Map();
2081
2563
  this.config = config;
2082
2564
  }
2083
2565
  /**
@@ -2294,7 +2776,7 @@ function resetOverrideSystem() {
2294
2776
  }
2295
2777
  }
2296
2778
 
2297
- // packages/runtime-core/src/icons.ts
2779
+ // src/icons.ts
2298
2780
  var cdnEnabled = true;
2299
2781
  function setIconCdnEnabled(enabled) {
2300
2782
  cdnEnabled = enabled;
@@ -2604,7 +3086,8 @@ function getIconifyCollection(set) {
2604
3086
  return ICONIFY_COLLECTIONS[set];
2605
3087
  }
2606
3088
 
2607
- // packages/runtime-core/src/renderer.ts
3089
+ // src/renderer.ts
3090
+ init_tailwind();
2608
3091
  var tailwindAutoInjected = false;
2609
3092
  function ensureTailwind() {
2610
3093
  if (tailwindAutoInjected || typeof document === "undefined") return;
@@ -3532,7 +4015,7 @@ async function createServlyRenderer(options) {
3532
4015
  container = containerOption;
3533
4016
  }
3534
4017
  if (shouldInjectTailwind) {
3535
- const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-E3IW5YY7.mjs");
4018
+ const { initServlyTailwind: initServlyTailwind2 } = await Promise.resolve().then(() => (init_tailwind(), tailwind_exports));
3536
4019
  await initServlyTailwind2(tailwindConfig);
3537
4020
  }
3538
4021
  const activeRenders = [];
@@ -3630,7 +4113,7 @@ function collectAllViewDependencies(views, startViewId) {
3630
4113
  return collected;
3631
4114
  }
3632
4115
 
3633
- // packages/runtime-core/src/cache.ts
4116
+ // src/cache.ts
3634
4117
  var DEFAULT_CACHE_CONFIG = {
3635
4118
  maxEntries: 50,
3636
4119
  ttl: 5 * 60 * 1e3,
@@ -3874,7 +4357,8 @@ function invalidateCache(id, version, config = DEFAULT_CACHE_CONFIG) {
3874
4357
  }
3875
4358
  }
3876
4359
 
3877
- // packages/runtime-core/src/fetcher.ts
4360
+ // src/fetcher.ts
4361
+ init_registry();
3878
4362
  var DEFAULT_RETRY_CONFIG = {
3879
4363
  maxRetries: 3,
3880
4364
  initialDelay: 1e3,
@@ -4128,7 +4612,7 @@ async function fetchComponent(id, options = {}) {
4128
4612
  async function fetchComponentWithDependencies(id, options = {}) {
4129
4613
  const result = await fetchComponent(id, { ...options, includeBundle: true });
4130
4614
  if (result.pendingDependencies && result.pendingDependencies.length > 0) {
4131
- const { createRegistry: createRegistry2 } = await import("./registry-HKUXXQ5V.mjs");
4615
+ const { createRegistry: createRegistry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
4132
4616
  const registry = result.registry || createRegistry2();
4133
4617
  await Promise.all(
4134
4618
  result.pendingDependencies.map(async (dep) => {
@@ -4234,7 +4718,7 @@ async function getDependencyTree(id, options = {}) {
4234
4718
  return data.data;
4235
4719
  }
4236
4720
 
4237
- // packages/runtime-core/src/version.ts
4721
+ // src/version.ts
4238
4722
  function parseVersion(version) {
4239
4723
  const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
4240
4724
  if (!match) return null;
@@ -4346,7 +4830,7 @@ function formatVersion(version) {
4346
4830
  return `v${parsed.major}.${parsed.minor}.${parsed.patch}`;
4347
4831
  }
4348
4832
 
4349
- // packages/runtime-core/src/testRunner.ts
4833
+ // src/testRunner.ts
4350
4834
  function runTestCase(elements, testCase, container) {
4351
4835
  const startTime = performance.now();
4352
4836
  const assertionResults = [];
@@ -4601,142 +5085,11 @@ function getSampleValue(def) {
4601
5085
  }
4602
5086
  }
4603
5087
 
4604
- // packages/runtime-core/src/iconExtractor.ts
4605
- var REACT_ICONS_PACKAGES = {
4606
- Ai: "react-icons/ai",
4607
- Bi: "react-icons/bi",
4608
- Bs: "react-icons/bs",
4609
- Cg: "react-icons/cg",
4610
- Di: "react-icons/di",
4611
- Fa: "react-icons/fa",
4612
- Fa6: "react-icons/fa6",
4613
- Fc: "react-icons/fc",
4614
- Fi: "react-icons/fi",
4615
- Gi: "react-icons/gi",
4616
- Go: "react-icons/go",
4617
- Gr: "react-icons/gr",
4618
- Hi: "react-icons/hi",
4619
- Hi2: "react-icons/hi2",
4620
- Im: "react-icons/im",
4621
- Io: "react-icons/io",
4622
- Io5: "react-icons/io5",
4623
- Lu: "react-icons/lu",
4624
- Md: "react-icons/md",
4625
- Pi: "react-icons/pi",
4626
- Ri: "react-icons/ri",
4627
- Rx: "react-icons/rx",
4628
- Si: "react-icons/si",
4629
- Sl: "react-icons/sl",
4630
- Tb: "react-icons/tb",
4631
- Tfi: "react-icons/tfi",
4632
- Vsc: "react-icons/vsc",
4633
- Wi: "react-icons/wi"
4634
- };
4635
- async function extractIconFromReactIcons(iconName, iconSet) {
4636
- const packagePath = REACT_ICONS_PACKAGES[iconSet];
4637
- if (!packagePath) {
4638
- console.warn(`Unknown icon set: ${iconSet}`);
4639
- return null;
4640
- }
4641
- try {
4642
- const iconModule = await import(packagePath);
4643
- const IconComponent = iconModule[iconName];
4644
- if (!IconComponent) {
4645
- console.warn(`Icon not found: ${iconName} in ${packagePath}`);
4646
- return null;
4647
- }
4648
- const React = await import("react");
4649
- const { renderToStaticMarkup } = await import("react-dom/server");
4650
- const svgString = renderToStaticMarkup(React.createElement(IconComponent, { size: 24 }));
4651
- return parseSvgString(svgString);
4652
- } catch (error) {
4653
- console.error(`Failed to extract icon ${iconSet}:${iconName}:`, error);
4654
- return null;
4655
- }
4656
- }
4657
- function parseSvgString(svgString) {
4658
- const viewBoxMatch = svgString.match(/viewBox="([^"]+)"/);
4659
- const viewBox = viewBoxMatch ? viewBoxMatch[1] : "0 0 24 24";
4660
- const widthMatch = svgString.match(/width="(\d+)"/);
4661
- const heightMatch = svgString.match(/height="(\d+)"/);
4662
- const width = widthMatch ? parseInt(widthMatch[1], 10) : 24;
4663
- const height = heightMatch ? parseInt(heightMatch[1], 10) : 24;
4664
- const bodyMatch = svgString.match(/<svg[^>]*>([\s\S]*)<\/svg>/);
4665
- const body = bodyMatch ? bodyMatch[1].trim() : "";
4666
- if (!body) {
4667
- return null;
4668
- }
4669
- return {
4670
- body,
4671
- viewBox,
4672
- width,
4673
- height
4674
- };
4675
- }
4676
- function findIconsInLayout(elements) {
4677
- const icons = [];
4678
- const seen = /* @__PURE__ */ new Set();
4679
- for (const element of elements) {
4680
- if (element.componentId === "icon" && element.configuration?.icon) {
4681
- const icon = element.configuration.icon;
4682
- const key = `${icon.set}:${icon.name}`;
4683
- if (!seen.has(key)) {
4684
- seen.add(key);
4685
- icons.push({
4686
- name: icon.name,
4687
- set: icon.set,
4688
- setName: icon.setName
4689
- });
4690
- }
4691
- }
4692
- }
4693
- return icons;
4694
- }
4695
- async function extractIconsForLayout(elements) {
4696
- const icons = findIconsInLayout(elements);
4697
- const result = {};
4698
- for (const icon of icons) {
4699
- const data = await extractIconFromReactIcons(icon.name, icon.set);
4700
- if (data) {
4701
- if (!result[icon.set]) {
4702
- result[icon.set] = {};
4703
- }
4704
- result[icon.set][icon.name] = data;
4705
- }
4706
- }
4707
- return result;
4708
- }
4709
- function generateIconBundle(icons) {
4710
- const lines = [
4711
- "// Auto-generated icon bundle",
4712
- "// Do not edit manually",
4713
- "",
4714
- "import { registerIcons, type IconData } from '@servlyadmin/runtime-core';",
4715
- "",
4716
- "const BUNDLED_ICONS: Record<string, Record<string, IconData>> = {"
4717
- ];
4718
- for (const [set, setIcons] of Object.entries(icons)) {
4719
- lines.push(` ${set}: {`);
4720
- for (const [name, data] of Object.entries(setIcons)) {
4721
- const escapedBody = data.body.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/\n/g, "\\n");
4722
- lines.push(` ${name}: {`);
4723
- lines.push(` body: '${escapedBody}',`);
4724
- lines.push(` viewBox: '${data.viewBox}',`);
4725
- if (data.width) lines.push(` width: ${data.width},`);
4726
- if (data.height) lines.push(` height: ${data.height},`);
4727
- lines.push(` },`);
4728
- }
4729
- lines.push(` },`);
4730
- }
4731
- lines.push("};");
4732
- lines.push("");
4733
- lines.push("// Register all bundled icons");
4734
- lines.push("registerIcons(BUNDLED_ICONS);");
4735
- lines.push("");
4736
- lines.push("export { BUNDLED_ICONS };");
4737
- return lines.join("\n");
4738
- }
4739
- export {
5088
+ // src/index.ts
5089
+ init_registry();
5090
+ init_tailwind();
5091
+ // Annotate the CommonJS export names for ESM import in node:
5092
+ 0 && (module.exports = {
4740
5093
  AnalyticsCollector,
4741
5094
  DEFAULT_CACHE_CONFIG,
4742
5095
  DEFAULT_RETRY_CONFIG,
@@ -4778,16 +5131,12 @@ export {
4778
5131
  extractBindingKeys,
4779
5132
  extractDependencies,
4780
5133
  extractDependenciesFromCode,
4781
- extractIconFromReactIcons,
4782
- extractIconsForLayout,
4783
5134
  extractOverrideDependencies,
4784
5135
  extractReferencedViewIds,
4785
5136
  fetchComponent,
4786
5137
  fetchComponentWithDependencies,
4787
- findIconsInLayout,
4788
5138
  formatStyleValue,
4789
5139
  formatVersion,
4790
- generateIconBundle,
4791
5140
  generateTestCases,
4792
5141
  getAnalytics,
4793
5142
  getCacheKey,
@@ -4872,4 +5221,4 @@ export {
4872
5221
  updateTailwindConfig,
4873
5222
  validateAssertion,
4874
5223
  validateProps
4875
- };
5224
+ });