@servlyadmin/runtime-core 0.1.30 → 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/{chunk-CIUQK4GA.js → chunk-EQFZFPI7.mjs} +1 -1
- package/dist/{chunk-IWFVKY5N.js → chunk-ZF666DOB.mjs} +4 -1
- package/dist/index.js +587 -57
- package/dist/index.mjs +4875 -0
- package/dist/{registry-7UL42655.js → registry-HKUXXQ5V.mjs} +1 -2
- package/dist/{tailwind-3FTT56ZG.js → tailwind-E3IW5YY7.mjs} +3 -2
- package/package.json +6 -6
- package/dist/chunk-MCKGQKYU.js +0 -15
- package/dist/chunk-OHWFJHAT.js +0 -2189
- package/dist/index.cjs +0 -21723
- package/dist/react-EKMBDYIU.js +0 -5
- package/dist/server.node-CQL3CG75.js +0 -14187
package/dist/index.js
CHANGED
|
@@ -1,25 +1,526 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
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
|
+
});
|
|
21
194
|
|
|
22
|
-
// src/
|
|
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);
|
|
522
|
+
|
|
523
|
+
// packages/runtime-core/src/analyticsTypes.ts
|
|
23
524
|
var DEFAULT_ANALYTICS_CONFIG = {
|
|
24
525
|
enabled: true,
|
|
25
526
|
endpoint: "/api/v1/analytics/events",
|
|
@@ -37,7 +538,7 @@ var MAX_RETRY_ATTEMPTS = 3;
|
|
|
37
538
|
var SESSION_TIMEOUT_MS = 30 * 60 * 1e3;
|
|
38
539
|
var SDK_VERSION = "1.0.0";
|
|
39
540
|
|
|
40
|
-
// src/sessionManager.ts
|
|
541
|
+
// packages/runtime-core/src/sessionManager.ts
|
|
41
542
|
var SESSION_STORAGE_KEY = "servly_analytics_session";
|
|
42
543
|
function generateUUID() {
|
|
43
544
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
@@ -99,8 +600,8 @@ function isSessionExpired(session) {
|
|
|
99
600
|
return now - session.lastActivityAt > SESSION_TIMEOUT_MS;
|
|
100
601
|
}
|
|
101
602
|
var SessionManager = class {
|
|
603
|
+
session = null;
|
|
102
604
|
constructor() {
|
|
103
|
-
this.session = null;
|
|
104
605
|
this.initialize();
|
|
105
606
|
}
|
|
106
607
|
/**
|
|
@@ -180,13 +681,15 @@ function resetSessionManager() {
|
|
|
180
681
|
sessionManagerInstance = null;
|
|
181
682
|
}
|
|
182
683
|
|
|
183
|
-
// src/analytics.ts
|
|
684
|
+
// packages/runtime-core/src/analytics.ts
|
|
184
685
|
var AnalyticsCollector = class {
|
|
686
|
+
config;
|
|
687
|
+
eventQueue = [];
|
|
688
|
+
flushTimer = null;
|
|
689
|
+
isEnabled;
|
|
690
|
+
isFlushing = false;
|
|
691
|
+
retryDelay = 1e3;
|
|
185
692
|
constructor(config) {
|
|
186
|
-
this.eventQueue = [];
|
|
187
|
-
this.flushTimer = null;
|
|
188
|
-
this.isFlushing = false;
|
|
189
|
-
this.retryDelay = 1e3;
|
|
190
693
|
this.config = { ...DEFAULT_ANALYTICS_CONFIG, ...config };
|
|
191
694
|
this.isEnabled = this.config.enabled;
|
|
192
695
|
this.startFlushTimer();
|
|
@@ -529,7 +1032,7 @@ var analytics = {
|
|
|
529
1032
|
enable: () => getAnalytics().enable()
|
|
530
1033
|
};
|
|
531
1034
|
|
|
532
|
-
// src/bindings.ts
|
|
1035
|
+
// packages/runtime-core/src/bindings.ts
|
|
533
1036
|
var BINDING_SOURCES = [
|
|
534
1037
|
"props",
|
|
535
1038
|
"state",
|
|
@@ -913,7 +1416,7 @@ function extractBindingKeys(template) {
|
|
|
913
1416
|
return Array.from(keys);
|
|
914
1417
|
}
|
|
915
1418
|
|
|
916
|
-
// src/styles.ts
|
|
1419
|
+
// packages/runtime-core/src/styles.ts
|
|
917
1420
|
var UNITLESS_PROPERTIES = /* @__PURE__ */ new Set([
|
|
918
1421
|
"animationIterationCount",
|
|
919
1422
|
"borderImageOutset",
|
|
@@ -1081,8 +1584,9 @@ function updateStyles(element, oldStyles, newStyles) {
|
|
|
1081
1584
|
}
|
|
1082
1585
|
}
|
|
1083
1586
|
|
|
1084
|
-
// src/memorySampler.ts
|
|
1587
|
+
// packages/runtime-core/src/memorySampler.ts
|
|
1085
1588
|
var MemorySampler = class {
|
|
1589
|
+
isSupported;
|
|
1086
1590
|
constructor() {
|
|
1087
1591
|
this.isSupported = this.checkSupport();
|
|
1088
1592
|
}
|
|
@@ -1142,12 +1646,13 @@ function resetMemorySampler() {
|
|
|
1142
1646
|
memorySamplerInstance = null;
|
|
1143
1647
|
}
|
|
1144
1648
|
|
|
1145
|
-
// src/longTaskObserver.ts
|
|
1649
|
+
// packages/runtime-core/src/longTaskObserver.ts
|
|
1146
1650
|
var LongTaskObserver = class {
|
|
1651
|
+
observer = null;
|
|
1652
|
+
longTaskCount = 0;
|
|
1653
|
+
isSupported;
|
|
1654
|
+
isObserving = false;
|
|
1147
1655
|
constructor() {
|
|
1148
|
-
this.observer = null;
|
|
1149
|
-
this.longTaskCount = 0;
|
|
1150
|
-
this.isObserving = false;
|
|
1151
1656
|
this.isSupported = this.checkSupport();
|
|
1152
1657
|
}
|
|
1153
1658
|
/**
|
|
@@ -1237,11 +1742,12 @@ function resetLongTaskObserver() {
|
|
|
1237
1742
|
longTaskObserverInstance = null;
|
|
1238
1743
|
}
|
|
1239
1744
|
|
|
1240
|
-
// src/stateManager.ts
|
|
1745
|
+
// packages/runtime-core/src/stateManager.ts
|
|
1241
1746
|
var StateManager = class {
|
|
1747
|
+
state = {};
|
|
1748
|
+
listeners = /* @__PURE__ */ new Set();
|
|
1749
|
+
config;
|
|
1242
1750
|
constructor(config = {}) {
|
|
1243
|
-
this.state = {};
|
|
1244
|
-
this.listeners = /* @__PURE__ */ new Set();
|
|
1245
1751
|
this.config = config;
|
|
1246
1752
|
this.state = config.initialState || {};
|
|
1247
1753
|
if (config.persistToLocalStorage && typeof localStorage !== "undefined") {
|
|
@@ -1627,7 +2133,7 @@ function getUrlInfo() {
|
|
|
1627
2133
|
};
|
|
1628
2134
|
}
|
|
1629
2135
|
|
|
1630
|
-
// src/eventSystem.ts
|
|
2136
|
+
// packages/runtime-core/src/eventSystem.ts
|
|
1631
2137
|
var builtInPlugins = {
|
|
1632
2138
|
/**
|
|
1633
2139
|
* Set state value
|
|
@@ -1893,9 +2399,11 @@ var builtInPlugins = {
|
|
|
1893
2399
|
}
|
|
1894
2400
|
};
|
|
1895
2401
|
var EventSystem = class {
|
|
2402
|
+
config;
|
|
2403
|
+
pluginExecutors;
|
|
2404
|
+
debounceTimers = /* @__PURE__ */ new Map();
|
|
2405
|
+
throttleTimers = /* @__PURE__ */ new Map();
|
|
1896
2406
|
constructor(config = {}) {
|
|
1897
|
-
this.debounceTimers = /* @__PURE__ */ new Map();
|
|
1898
|
-
this.throttleTimers = /* @__PURE__ */ new Map();
|
|
1899
2407
|
this.config = config;
|
|
1900
2408
|
this.pluginExecutors = {
|
|
1901
2409
|
...builtInPlugins,
|
|
@@ -2065,11 +2573,12 @@ function resetEventSystem() {
|
|
|
2065
2573
|
}
|
|
2066
2574
|
}
|
|
2067
2575
|
|
|
2068
|
-
// src/overrides.ts
|
|
2576
|
+
// packages/runtime-core/src/overrides.ts
|
|
2069
2577
|
var OverrideSystem = class {
|
|
2578
|
+
config;
|
|
2579
|
+
elementStates = /* @__PURE__ */ new Map();
|
|
2580
|
+
watchIntervals = /* @__PURE__ */ new Map();
|
|
2070
2581
|
constructor(config = {}) {
|
|
2071
|
-
this.elementStates = /* @__PURE__ */ new Map();
|
|
2072
|
-
this.watchIntervals = /* @__PURE__ */ new Map();
|
|
2073
2582
|
this.config = config;
|
|
2074
2583
|
}
|
|
2075
2584
|
/**
|
|
@@ -2286,7 +2795,7 @@ function resetOverrideSystem() {
|
|
|
2286
2795
|
}
|
|
2287
2796
|
}
|
|
2288
2797
|
|
|
2289
|
-
// src/icons.ts
|
|
2798
|
+
// packages/runtime-core/src/icons.ts
|
|
2290
2799
|
var cdnEnabled = true;
|
|
2291
2800
|
function setIconCdnEnabled(enabled) {
|
|
2292
2801
|
cdnEnabled = enabled;
|
|
@@ -2596,7 +3105,18 @@ function getIconifyCollection(set) {
|
|
|
2596
3105
|
return ICONIFY_COLLECTIONS[set];
|
|
2597
3106
|
}
|
|
2598
3107
|
|
|
2599
|
-
// src/renderer.ts
|
|
3108
|
+
// packages/runtime-core/src/renderer.ts
|
|
3109
|
+
init_tailwind();
|
|
3110
|
+
var tailwindAutoInjected = false;
|
|
3111
|
+
function ensureTailwind() {
|
|
3112
|
+
if (tailwindAutoInjected || typeof document === "undefined") return;
|
|
3113
|
+
tailwindAutoInjected = true;
|
|
3114
|
+
if (!isTailwindLoaded()) {
|
|
3115
|
+
injectTailwind({ usePlayCdn: true }).catch((err) => {
|
|
3116
|
+
console.warn("Failed to auto-inject Tailwind CSS:", err);
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
2600
3120
|
var COMPONENT_TO_TAG = {
|
|
2601
3121
|
container: "div",
|
|
2602
3122
|
text: "span",
|
|
@@ -3155,6 +3675,9 @@ function renderSlotElement(element, tree, context, eventHandlers, elementStates,
|
|
|
3155
3675
|
return elementState.domElement;
|
|
3156
3676
|
}
|
|
3157
3677
|
function render(options) {
|
|
3678
|
+
if (!options.disableTailwind) {
|
|
3679
|
+
ensureTailwind();
|
|
3680
|
+
}
|
|
3158
3681
|
const {
|
|
3159
3682
|
container,
|
|
3160
3683
|
elements,
|
|
@@ -3511,7 +4034,7 @@ async function createServlyRenderer(options) {
|
|
|
3511
4034
|
container = containerOption;
|
|
3512
4035
|
}
|
|
3513
4036
|
if (shouldInjectTailwind) {
|
|
3514
|
-
const { initServlyTailwind: initServlyTailwind2 } = await
|
|
4037
|
+
const { initServlyTailwind: initServlyTailwind2 } = await Promise.resolve().then(() => (init_tailwind(), tailwind_exports));
|
|
3515
4038
|
await initServlyTailwind2(tailwindConfig);
|
|
3516
4039
|
}
|
|
3517
4040
|
const activeRenders = [];
|
|
@@ -3609,7 +4132,7 @@ function collectAllViewDependencies(views, startViewId) {
|
|
|
3609
4132
|
return collected;
|
|
3610
4133
|
}
|
|
3611
4134
|
|
|
3612
|
-
// src/cache.ts
|
|
4135
|
+
// packages/runtime-core/src/cache.ts
|
|
3613
4136
|
var DEFAULT_CACHE_CONFIG = {
|
|
3614
4137
|
maxEntries: 50,
|
|
3615
4138
|
ttl: 5 * 60 * 1e3,
|
|
@@ -3853,7 +4376,8 @@ function invalidateCache(id, version, config = DEFAULT_CACHE_CONFIG) {
|
|
|
3853
4376
|
}
|
|
3854
4377
|
}
|
|
3855
4378
|
|
|
3856
|
-
// src/fetcher.ts
|
|
4379
|
+
// packages/runtime-core/src/fetcher.ts
|
|
4380
|
+
init_registry();
|
|
3857
4381
|
var DEFAULT_RETRY_CONFIG = {
|
|
3858
4382
|
maxRetries: 3,
|
|
3859
4383
|
initialDelay: 1e3,
|
|
@@ -4107,7 +4631,7 @@ async function fetchComponent(id, options = {}) {
|
|
|
4107
4631
|
async function fetchComponentWithDependencies(id, options = {}) {
|
|
4108
4632
|
const result = await fetchComponent(id, { ...options, includeBundle: true });
|
|
4109
4633
|
if (result.pendingDependencies && result.pendingDependencies.length > 0) {
|
|
4110
|
-
const { createRegistry: createRegistry2 } = await
|
|
4634
|
+
const { createRegistry: createRegistry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
|
|
4111
4635
|
const registry = result.registry || createRegistry2();
|
|
4112
4636
|
await Promise.all(
|
|
4113
4637
|
result.pendingDependencies.map(async (dep) => {
|
|
@@ -4213,7 +4737,7 @@ async function getDependencyTree(id, options = {}) {
|
|
|
4213
4737
|
return data.data;
|
|
4214
4738
|
}
|
|
4215
4739
|
|
|
4216
|
-
// src/version.ts
|
|
4740
|
+
// packages/runtime-core/src/version.ts
|
|
4217
4741
|
function parseVersion(version) {
|
|
4218
4742
|
const match = version.match(/^(\d+)\.(\d+)\.(\d+)$/);
|
|
4219
4743
|
if (!match) return null;
|
|
@@ -4325,7 +4849,7 @@ function formatVersion(version) {
|
|
|
4325
4849
|
return `v${parsed.major}.${parsed.minor}.${parsed.patch}`;
|
|
4326
4850
|
}
|
|
4327
4851
|
|
|
4328
|
-
// src/testRunner.ts
|
|
4852
|
+
// packages/runtime-core/src/testRunner.ts
|
|
4329
4853
|
function runTestCase(elements, testCase, container) {
|
|
4330
4854
|
const startTime = performance.now();
|
|
4331
4855
|
const assertionResults = [];
|
|
@@ -4580,7 +5104,11 @@ function getSampleValue(def) {
|
|
|
4580
5104
|
}
|
|
4581
5105
|
}
|
|
4582
5106
|
|
|
4583
|
-
// src/
|
|
5107
|
+
// packages/runtime-core/src/index.ts
|
|
5108
|
+
init_registry();
|
|
5109
|
+
init_tailwind();
|
|
5110
|
+
|
|
5111
|
+
// packages/runtime-core/src/iconExtractor.ts
|
|
4584
5112
|
var REACT_ICONS_PACKAGES = {
|
|
4585
5113
|
Ai: "react-icons/ai",
|
|
4586
5114
|
Bi: "react-icons/bi",
|
|
@@ -4624,8 +5152,8 @@ async function extractIconFromReactIcons(iconName, iconSet) {
|
|
|
4624
5152
|
console.warn(`Icon not found: ${iconName} in ${packagePath}`);
|
|
4625
5153
|
return null;
|
|
4626
5154
|
}
|
|
4627
|
-
const React = await import("
|
|
4628
|
-
const { renderToStaticMarkup } = await import("
|
|
5155
|
+
const React = await import("react");
|
|
5156
|
+
const { renderToStaticMarkup } = await import("react-dom/server");
|
|
4629
5157
|
const svgString = renderToStaticMarkup(React.createElement(IconComponent, { size: 24 }));
|
|
4630
5158
|
return parseSvgString(svgString);
|
|
4631
5159
|
} catch (error) {
|
|
@@ -4715,7 +5243,8 @@ function generateIconBundle(icons) {
|
|
|
4715
5243
|
lines.push("export { BUNDLED_ICONS };");
|
|
4716
5244
|
return lines.join("\n");
|
|
4717
5245
|
}
|
|
4718
|
-
export
|
|
5246
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
5247
|
+
0 && (module.exports = {
|
|
4719
5248
|
AnalyticsCollector,
|
|
4720
5249
|
DEFAULT_CACHE_CONFIG,
|
|
4721
5250
|
DEFAULT_RETRY_CONFIG,
|
|
@@ -4799,6 +5328,7 @@ export {
|
|
|
4799
5328
|
hasTemplateSyntax,
|
|
4800
5329
|
initServlyTailwind,
|
|
4801
5330
|
injectTailwind,
|
|
5331
|
+
injectTailwindStyles,
|
|
4802
5332
|
invalidateCache,
|
|
4803
5333
|
isComponentAvailable,
|
|
4804
5334
|
isIconCdnEnabled,
|
|
@@ -4850,4 +5380,4 @@ export {
|
|
|
4850
5380
|
updateTailwindConfig,
|
|
4851
5381
|
validateAssertion,
|
|
4852
5382
|
validateProps
|
|
4853
|
-
};
|
|
5383
|
+
});
|