@servlyadmin/runtime-core 0.1.31 → 0.1.32

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,26 +1,526 @@
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";
21
- import "./chunk-MCKGQKYU.js";
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);
22
522
 
23
- // src/analyticsTypes.ts
523
+ // packages/runtime-core/src/analyticsTypes.ts
24
524
  var DEFAULT_ANALYTICS_CONFIG = {
25
525
  enabled: true,
26
526
  endpoint: "/api/v1/analytics/events",
@@ -38,7 +538,7 @@ var MAX_RETRY_ATTEMPTS = 3;
38
538
  var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
39
539
  var SDK_VERSION = "1.0.0";
40
540
 
41
- // src/sessionManager.ts
541
+ // packages/runtime-core/src/sessionManager.ts
42
542
  var SESSION_STORAGE_KEY = "servly_analytics_session";
43
543
  function generateUUID() {
44
544
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
@@ -100,8 +600,8 @@ function isSessionExpired(session) {
100
600
  return now - session.lastActivityAt > SESSION_TIMEOUT_MS;
101
601
  }
102
602
  var SessionManager = class {
603
+ session = null;
103
604
  constructor() {
104
- this.session = null;
105
605
  this.initialize();
106
606
  }
107
607
  /**
@@ -181,13 +681,15 @@ function resetSessionManager() {
181
681
  sessionManagerInstance = null;
182
682
  }
183
683
 
184
- // src/analytics.ts
684
+ // packages/runtime-core/src/analytics.ts
185
685
  var AnalyticsCollector = class {
686
+ config;
687
+ eventQueue = [];
688
+ flushTimer = null;
689
+ isEnabled;
690
+ isFlushing = false;
691
+ retryDelay = 1e3;
186
692
  constructor(config) {
187
- this.eventQueue = [];
188
- this.flushTimer = null;
189
- this.isFlushing = false;
190
- this.retryDelay = 1e3;
191
693
  this.config = { ...DEFAULT_ANALYTICS_CONFIG, ...config };
192
694
  this.isEnabled = this.config.enabled;
193
695
  this.startFlushTimer();
@@ -530,7 +1032,7 @@ var analytics = {
530
1032
  enable: () => getAnalytics().enable()
531
1033
  };
532
1034
 
533
- // src/bindings.ts
1035
+ // packages/runtime-core/src/bindings.ts
534
1036
  var BINDING_SOURCES = [
535
1037
  "props",
536
1038
  "state",
@@ -914,7 +1416,7 @@ function extractBindingKeys(template) {
914
1416
  return Array.from(keys);
915
1417
  }
916
1418
 
917
- // src/styles.ts
1419
+ // packages/runtime-core/src/styles.ts
918
1420
  var UNITLESS_PROPERTIES = /* @__PURE__ */ new Set([
919
1421
  "animationIterationCount",
920
1422
  "borderImageOutset",
@@ -1082,8 +1584,9 @@ function updateStyles(element, oldStyles, newStyles) {
1082
1584
  }
1083
1585
  }
1084
1586
 
1085
- // src/memorySampler.ts
1587
+ // packages/runtime-core/src/memorySampler.ts
1086
1588
  var MemorySampler = class {
1589
+ isSupported;
1087
1590
  constructor() {
1088
1591
  this.isSupported = this.checkSupport();
1089
1592
  }
@@ -1143,12 +1646,13 @@ function resetMemorySampler() {
1143
1646
  memorySamplerInstance = null;
1144
1647
  }
1145
1648
 
1146
- // src/longTaskObserver.ts
1649
+ // packages/runtime-core/src/longTaskObserver.ts
1147
1650
  var LongTaskObserver = class {
1651
+ observer = null;
1652
+ longTaskCount = 0;
1653
+ isSupported;
1654
+ isObserving = false;
1148
1655
  constructor() {
1149
- this.observer = null;
1150
- this.longTaskCount = 0;
1151
- this.isObserving = false;
1152
1656
  this.isSupported = this.checkSupport();
1153
1657
  }
1154
1658
  /**
@@ -1238,11 +1742,12 @@ function resetLongTaskObserver() {
1238
1742
  longTaskObserverInstance = null;
1239
1743
  }
1240
1744
 
1241
- // src/stateManager.ts
1745
+ // packages/runtime-core/src/stateManager.ts
1242
1746
  var StateManager = class {
1747
+ state = {};
1748
+ listeners = /* @__PURE__ */ new Set();
1749
+ config;
1243
1750
  constructor(config = {}) {
1244
- this.state = {};
1245
- this.listeners = /* @__PURE__ */ new Set();
1246
1751
  this.config = config;
1247
1752
  this.state = config.initialState || {};
1248
1753
  if (config.persistToLocalStorage && typeof localStorage !== "undefined") {
@@ -1628,7 +2133,7 @@ function getUrlInfo() {
1628
2133
  };
1629
2134
  }
1630
2135
 
1631
- // src/eventSystem.ts
2136
+ // packages/runtime-core/src/eventSystem.ts
1632
2137
  var builtInPlugins = {
1633
2138
  /**
1634
2139
  * Set state value
@@ -1894,9 +2399,11 @@ var builtInPlugins = {
1894
2399
  }
1895
2400
  };
1896
2401
  var EventSystem = class {
2402
+ config;
2403
+ pluginExecutors;
2404
+ debounceTimers = /* @__PURE__ */ new Map();
2405
+ throttleTimers = /* @__PURE__ */ new Map();
1897
2406
  constructor(config = {}) {
1898
- this.debounceTimers = /* @__PURE__ */ new Map();
1899
- this.throttleTimers = /* @__PURE__ */ new Map();
1900
2407
  this.config = config;
1901
2408
  this.pluginExecutors = {
1902
2409
  ...builtInPlugins,
@@ -2066,11 +2573,12 @@ function resetEventSystem() {
2066
2573
  }
2067
2574
  }
2068
2575
 
2069
- // src/overrides.ts
2576
+ // packages/runtime-core/src/overrides.ts
2070
2577
  var OverrideSystem = class {
2578
+ config;
2579
+ elementStates = /* @__PURE__ */ new Map();
2580
+ watchIntervals = /* @__PURE__ */ new Map();
2071
2581
  constructor(config = {}) {
2072
- this.elementStates = /* @__PURE__ */ new Map();
2073
- this.watchIntervals = /* @__PURE__ */ new Map();
2074
2582
  this.config = config;
2075
2583
  }
2076
2584
  /**
@@ -2287,7 +2795,7 @@ function resetOverrideSystem() {
2287
2795
  }
2288
2796
  }
2289
2797
 
2290
- // src/icons.ts
2798
+ // packages/runtime-core/src/icons.ts
2291
2799
  var cdnEnabled = true;
2292
2800
  function setIconCdnEnabled(enabled) {
2293
2801
  cdnEnabled = enabled;
@@ -2597,7 +3105,8 @@ function getIconifyCollection(set) {
2597
3105
  return ICONIFY_COLLECTIONS[set];
2598
3106
  }
2599
3107
 
2600
- // src/renderer.ts
3108
+ // packages/runtime-core/src/renderer.ts
3109
+ init_tailwind();
2601
3110
  var tailwindAutoInjected = false;
2602
3111
  function ensureTailwind() {
2603
3112
  if (tailwindAutoInjected || typeof document === "undefined") return;
@@ -3525,7 +4034,7 @@ async function createServlyRenderer(options) {
3525
4034
  container = containerOption;
3526
4035
  }
3527
4036
  if (shouldInjectTailwind) {
3528
- const { initServlyTailwind: initServlyTailwind2 } = await import("./tailwind-37JUQFRW.js");
4037
+ const { initServlyTailwind: initServlyTailwind2 } = await Promise.resolve().then(() => (init_tailwind(), tailwind_exports));
3529
4038
  await initServlyTailwind2(tailwindConfig);
3530
4039
  }
3531
4040
  const activeRenders = [];
@@ -3623,7 +4132,7 @@ function collectAllViewDependencies(views, startViewId) {
3623
4132
  return collected;
3624
4133
  }
3625
4134
 
3626
- // src/cache.ts
4135
+ // packages/runtime-core/src/cache.ts
3627
4136
  var DEFAULT_CACHE_CONFIG = {
3628
4137
  maxEntries: 50,
3629
4138
  ttl: 5 * 60 * 1e3,
@@ -3867,7 +4376,8 @@ function invalidateCache(id, version, config = DEFAULT_CACHE_CONFIG) {
3867
4376
  }
3868
4377
  }
3869
4378
 
3870
- // src/fetcher.ts
4379
+ // packages/runtime-core/src/fetcher.ts
4380
+ init_registry();
3871
4381
  var DEFAULT_RETRY_CONFIG = {
3872
4382
  maxRetries: 3,
3873
4383
  initialDelay: 1e3,
@@ -4121,7 +4631,7 @@ async function fetchComponent(id, options = {}) {
4121
4631
  async function fetchComponentWithDependencies(id, options = {}) {
4122
4632
  const result = await fetchComponent(id, { ...options, includeBundle: true });
4123
4633
  if (result.pendingDependencies && result.pendingDependencies.length > 0) {
4124
- const { createRegistry: createRegistry2 } = await import("./registry-7UL42655.js");
4634
+ const { createRegistry: createRegistry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
4125
4635
  const registry = result.registry || createRegistry2();
4126
4636
  await Promise.all(
4127
4637
  result.pendingDependencies.map(async (dep) => {
@@ -4227,7 +4737,7 @@ async function getDependencyTree(id, options = {}) {
4227
4737
  return data.data;
4228
4738
  }
4229
4739
 
4230
- // src/version.ts
4740
+ // packages/runtime-core/src/version.ts
4231
4741
  function parseVersion(version) {
4232
4742
  const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
4233
4743
  if (!match) return null;
@@ -4339,7 +4849,7 @@ function formatVersion(version) {
4339
4849
  return `v${parsed.major}.${parsed.minor}.${parsed.patch}`;
4340
4850
  }
4341
4851
 
4342
- // src/testRunner.ts
4852
+ // packages/runtime-core/src/testRunner.ts
4343
4853
  function runTestCase(elements, testCase, container) {
4344
4854
  const startTime = performance.now();
4345
4855
  const assertionResults = [];
@@ -4594,7 +5104,11 @@ function getSampleValue(def) {
4594
5104
  }
4595
5105
  }
4596
5106
 
4597
- // src/iconExtractor.ts
5107
+ // packages/runtime-core/src/index.ts
5108
+ init_registry();
5109
+ init_tailwind();
5110
+
5111
+ // packages/runtime-core/src/iconExtractor.ts
4598
5112
  var REACT_ICONS_PACKAGES = {
4599
5113
  Ai: "react-icons/ai",
4600
5114
  Bi: "react-icons/bi",
@@ -4638,8 +5152,8 @@ async function extractIconFromReactIcons(iconName, iconSet) {
4638
5152
  console.warn(`Icon not found: ${iconName} in ${packagePath}`);
4639
5153
  return null;
4640
5154
  }
4641
- const React = await import("./react-EKMBDYIU.js");
4642
- const { renderToStaticMarkup } = await import("./server.node-CQL3CG75.js");
5155
+ const React = await import("react");
5156
+ const { renderToStaticMarkup } = await import("react-dom/server");
4643
5157
  const svgString = renderToStaticMarkup(React.createElement(IconComponent, { size: 24 }));
4644
5158
  return parseSvgString(svgString);
4645
5159
  } catch (error) {
@@ -4729,7 +5243,8 @@ function generateIconBundle(icons) {
4729
5243
  lines.push("export { BUNDLED_ICONS };");
4730
5244
  return lines.join("\n");
4731
5245
  }
4732
- export {
5246
+ // Annotate the CommonJS export names for ESM import in node:
5247
+ 0 && (module.exports = {
4733
5248
  AnalyticsCollector,
4734
5249
  DEFAULT_CACHE_CONFIG,
4735
5250
  DEFAULT_RETRY_CONFIG,
@@ -4865,4 +5380,4 @@ export {
4865
5380
  updateTailwindConfig,
4866
5381
  validateAssertion,
4867
5382
  validateProps
4868
- };
5383
+ });