@servlyadmin/runtime-core 0.1.38 → 0.1.40
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-5O72RMSO.js → chunk-YYJF3UI2.js} +39 -2
- package/dist/index.cjs +46 -2
- package/dist/index.d.cts +2021 -0
- package/dist/index.d.ts +2021 -0
- package/dist/index.js +9 -2
- package/dist/{tailwind-4IK6HZC6.js → tailwind-XB76THS4.js} +5 -1
- package/package.json +2 -2
|
@@ -87,9 +87,9 @@ function markElementReady(element) {
|
|
|
87
87
|
}
|
|
88
88
|
function isTailwindReady() {
|
|
89
89
|
if (typeof window === "undefined") return false;
|
|
90
|
-
return tailwindInjected
|
|
90
|
+
return tailwindInjected || !!window.tailwind;
|
|
91
91
|
}
|
|
92
|
-
function waitForTailwind() {
|
|
92
|
+
function waitForTailwind(timeoutMs = 3e3) {
|
|
93
93
|
if (isTailwindReady()) {
|
|
94
94
|
return Promise.resolve();
|
|
95
95
|
}
|
|
@@ -98,6 +98,24 @@ function waitForTailwind() {
|
|
|
98
98
|
}
|
|
99
99
|
tailwindReadyPromise = new Promise((resolve) => {
|
|
100
100
|
tailwindReadyResolve = resolve;
|
|
101
|
+
const timeout = setTimeout(() => {
|
|
102
|
+
if (tailwindReadyResolve) {
|
|
103
|
+
tailwindReadyResolve();
|
|
104
|
+
tailwindReadyResolve = null;
|
|
105
|
+
}
|
|
106
|
+
}, timeoutMs);
|
|
107
|
+
const checkInterval = setInterval(() => {
|
|
108
|
+
if (window.tailwind) {
|
|
109
|
+
clearTimeout(timeout);
|
|
110
|
+
clearInterval(checkInterval);
|
|
111
|
+
tailwindInjected = true;
|
|
112
|
+
if (tailwindReadyResolve) {
|
|
113
|
+
tailwindReadyResolve();
|
|
114
|
+
tailwindReadyResolve = null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}, 50);
|
|
118
|
+
setTimeout(() => clearInterval(checkInterval), timeoutMs);
|
|
101
119
|
});
|
|
102
120
|
return tailwindReadyPromise;
|
|
103
121
|
}
|
|
@@ -204,6 +222,21 @@ function updateTailwindConfig(config) {
|
|
|
204
222
|
};
|
|
205
223
|
}
|
|
206
224
|
}
|
|
225
|
+
function refreshTailwind() {
|
|
226
|
+
if (typeof window === "undefined") return;
|
|
227
|
+
const tw = window.tailwind;
|
|
228
|
+
if (tw && typeof tw.refresh === "function") {
|
|
229
|
+
tw.refresh();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function scheduleRefresh(delayMs = 0) {
|
|
233
|
+
if (typeof window === "undefined") return;
|
|
234
|
+
if (delayMs === 0) {
|
|
235
|
+
requestAnimationFrame(() => refreshTailwind());
|
|
236
|
+
} else {
|
|
237
|
+
setTimeout(() => refreshTailwind(), delayMs);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
207
240
|
function addCustomStyles(css, id) {
|
|
208
241
|
if (typeof document === "undefined") {
|
|
209
242
|
throw new Error("addCustomStyles can only be used in browser environment");
|
|
@@ -274,6 +307,8 @@ var tailwind_default = {
|
|
|
274
307
|
waitForTailwind,
|
|
275
308
|
getTailwind,
|
|
276
309
|
updateTailwindConfig,
|
|
310
|
+
refreshTailwind,
|
|
311
|
+
scheduleRefresh,
|
|
277
312
|
addCustomStyles,
|
|
278
313
|
removeCustomStyles,
|
|
279
314
|
initServlyTailwind,
|
|
@@ -296,6 +331,8 @@ export {
|
|
|
296
331
|
isTailwindLoaded,
|
|
297
332
|
getTailwind,
|
|
298
333
|
updateTailwindConfig,
|
|
334
|
+
refreshTailwind,
|
|
335
|
+
scheduleRefresh,
|
|
299
336
|
addCustomStyles,
|
|
300
337
|
removeCustomStyles,
|
|
301
338
|
DEFAULT_SERVLY_TAILWIND_CONFIG,
|
package/dist/index.cjs
CHANGED
|
@@ -35,9 +35,11 @@ __export(tailwind_exports, {
|
|
|
35
35
|
markElementReady: () => markElementReady,
|
|
36
36
|
preloadTailwind: () => preloadTailwind,
|
|
37
37
|
preventFOUC: () => preventFOUC,
|
|
38
|
+
refreshTailwind: () => refreshTailwind,
|
|
38
39
|
removeCustomStyles: () => removeCustomStyles,
|
|
39
40
|
removeFOUCPrevention: () => removeFOUCPrevention,
|
|
40
41
|
removeTailwind: () => removeTailwind,
|
|
42
|
+
scheduleRefresh: () => scheduleRefresh,
|
|
41
43
|
updateTailwindConfig: () => updateTailwindConfig,
|
|
42
44
|
waitForTailwind: () => waitForTailwind
|
|
43
45
|
});
|
|
@@ -113,9 +115,9 @@ function markElementReady(element) {
|
|
|
113
115
|
}
|
|
114
116
|
function isTailwindReady() {
|
|
115
117
|
if (typeof window === "undefined") return false;
|
|
116
|
-
return tailwindInjected
|
|
118
|
+
return tailwindInjected || !!window.tailwind;
|
|
117
119
|
}
|
|
118
|
-
function waitForTailwind() {
|
|
120
|
+
function waitForTailwind(timeoutMs = 3e3) {
|
|
119
121
|
if (isTailwindReady()) {
|
|
120
122
|
return Promise.resolve();
|
|
121
123
|
}
|
|
@@ -124,6 +126,24 @@ function waitForTailwind() {
|
|
|
124
126
|
}
|
|
125
127
|
tailwindReadyPromise = new Promise((resolve) => {
|
|
126
128
|
tailwindReadyResolve = resolve;
|
|
129
|
+
const timeout = setTimeout(() => {
|
|
130
|
+
if (tailwindReadyResolve) {
|
|
131
|
+
tailwindReadyResolve();
|
|
132
|
+
tailwindReadyResolve = null;
|
|
133
|
+
}
|
|
134
|
+
}, timeoutMs);
|
|
135
|
+
const checkInterval = setInterval(() => {
|
|
136
|
+
if (window.tailwind) {
|
|
137
|
+
clearTimeout(timeout);
|
|
138
|
+
clearInterval(checkInterval);
|
|
139
|
+
tailwindInjected = true;
|
|
140
|
+
if (tailwindReadyResolve) {
|
|
141
|
+
tailwindReadyResolve();
|
|
142
|
+
tailwindReadyResolve = null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, 50);
|
|
146
|
+
setTimeout(() => clearInterval(checkInterval), timeoutMs);
|
|
127
147
|
});
|
|
128
148
|
return tailwindReadyPromise;
|
|
129
149
|
}
|
|
@@ -230,6 +250,21 @@ function updateTailwindConfig(config) {
|
|
|
230
250
|
};
|
|
231
251
|
}
|
|
232
252
|
}
|
|
253
|
+
function refreshTailwind() {
|
|
254
|
+
if (typeof window === "undefined") return;
|
|
255
|
+
const tw = window.tailwind;
|
|
256
|
+
if (tw && typeof tw.refresh === "function") {
|
|
257
|
+
tw.refresh();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function scheduleRefresh(delayMs = 0) {
|
|
261
|
+
if (typeof window === "undefined") return;
|
|
262
|
+
if (delayMs === 0) {
|
|
263
|
+
requestAnimationFrame(() => refreshTailwind());
|
|
264
|
+
} else {
|
|
265
|
+
setTimeout(() => refreshTailwind(), delayMs);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
233
268
|
function addCustomStyles(css, id) {
|
|
234
269
|
if (typeof document === "undefined") {
|
|
235
270
|
throw new Error("addCustomStyles can only be used in browser environment");
|
|
@@ -320,6 +355,8 @@ var init_tailwind = __esm({
|
|
|
320
355
|
waitForTailwind,
|
|
321
356
|
getTailwind,
|
|
322
357
|
updateTailwindConfig,
|
|
358
|
+
refreshTailwind,
|
|
359
|
+
scheduleRefresh,
|
|
323
360
|
addCustomStyles,
|
|
324
361
|
removeCustomStyles,
|
|
325
362
|
initServlyTailwind,
|
|
@@ -620,6 +657,7 @@ __export(index_exports, {
|
|
|
620
657
|
preloadTailwind: () => preloadTailwind,
|
|
621
658
|
preventFOUC: () => preventFOUC,
|
|
622
659
|
processStyles: () => processStyles,
|
|
660
|
+
refreshTailwind: () => refreshTailwind,
|
|
623
661
|
registerIcon: () => registerIcon,
|
|
624
662
|
registerIcons: () => registerIcons,
|
|
625
663
|
removeClass: () => removeClass,
|
|
@@ -647,6 +685,7 @@ __export(index_exports, {
|
|
|
647
685
|
runAllTests: () => runAllTests,
|
|
648
686
|
runTestCase: () => runTestCase,
|
|
649
687
|
satisfiesVersion: () => satisfiesVersion,
|
|
688
|
+
scheduleRefresh: () => scheduleRefresh,
|
|
650
689
|
setIconCdnEnabled: () => setIconCdnEnabled,
|
|
651
690
|
setInCache: () => setInCache,
|
|
652
691
|
setLocalStorage: () => setLocalStorage,
|
|
@@ -4019,6 +4058,9 @@ function render(options) {
|
|
|
4019
4058
|
}
|
|
4020
4059
|
}
|
|
4021
4060
|
}
|
|
4061
|
+
if (!options.disableTailwind) {
|
|
4062
|
+
scheduleRefresh();
|
|
4063
|
+
}
|
|
4022
4064
|
const duration = performance.now() - startTime;
|
|
4023
4065
|
const memoryAfter = memorySampler.sample();
|
|
4024
4066
|
const longTasks = longTaskObserver.stop();
|
|
@@ -5423,6 +5465,7 @@ init_tailwind();
|
|
|
5423
5465
|
preloadTailwind,
|
|
5424
5466
|
preventFOUC,
|
|
5425
5467
|
processStyles,
|
|
5468
|
+
refreshTailwind,
|
|
5426
5469
|
registerIcon,
|
|
5427
5470
|
registerIcons,
|
|
5428
5471
|
removeClass,
|
|
@@ -5450,6 +5493,7 @@ init_tailwind();
|
|
|
5450
5493
|
runAllTests,
|
|
5451
5494
|
runTestCase,
|
|
5452
5495
|
satisfiesVersion,
|
|
5496
|
+
scheduleRefresh,
|
|
5453
5497
|
setIconCdnEnabled,
|
|
5454
5498
|
setInCache,
|
|
5455
5499
|
setLocalStorage,
|