@servlyadmin/runtime-core 0.1.39 → 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.
@@ -222,6 +222,21 @@ function updateTailwindConfig(config) {
222
222
  };
223
223
  }
224
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
+ }
225
240
  function addCustomStyles(css, id) {
226
241
  if (typeof document === "undefined") {
227
242
  throw new Error("addCustomStyles can only be used in browser environment");
@@ -292,6 +307,8 @@ var tailwind_default = {
292
307
  waitForTailwind,
293
308
  getTailwind,
294
309
  updateTailwindConfig,
310
+ refreshTailwind,
311
+ scheduleRefresh,
295
312
  addCustomStyles,
296
313
  removeCustomStyles,
297
314
  initServlyTailwind,
@@ -314,6 +331,8 @@ export {
314
331
  isTailwindLoaded,
315
332
  getTailwind,
316
333
  updateTailwindConfig,
334
+ refreshTailwind,
335
+ scheduleRefresh,
317
336
  addCustomStyles,
318
337
  removeCustomStyles,
319
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
  });
@@ -248,6 +250,21 @@ function updateTailwindConfig(config) {
248
250
  };
249
251
  }
250
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
+ }
251
268
  function addCustomStyles(css, id) {
252
269
  if (typeof document === "undefined") {
253
270
  throw new Error("addCustomStyles can only be used in browser environment");
@@ -338,6 +355,8 @@ var init_tailwind = __esm({
338
355
  waitForTailwind,
339
356
  getTailwind,
340
357
  updateTailwindConfig,
358
+ refreshTailwind,
359
+ scheduleRefresh,
341
360
  addCustomStyles,
342
361
  removeCustomStyles,
343
362
  initServlyTailwind,
@@ -638,6 +657,7 @@ __export(index_exports, {
638
657
  preloadTailwind: () => preloadTailwind,
639
658
  preventFOUC: () => preventFOUC,
640
659
  processStyles: () => processStyles,
660
+ refreshTailwind: () => refreshTailwind,
641
661
  registerIcon: () => registerIcon,
642
662
  registerIcons: () => registerIcons,
643
663
  removeClass: () => removeClass,
@@ -665,6 +685,7 @@ __export(index_exports, {
665
685
  runAllTests: () => runAllTests,
666
686
  runTestCase: () => runTestCase,
667
687
  satisfiesVersion: () => satisfiesVersion,
688
+ scheduleRefresh: () => scheduleRefresh,
668
689
  setIconCdnEnabled: () => setIconCdnEnabled,
669
690
  setInCache: () => setInCache,
670
691
  setLocalStorage: () => setLocalStorage,
@@ -4037,6 +4058,9 @@ function render(options) {
4037
4058
  }
4038
4059
  }
4039
4060
  }
4061
+ if (!options.disableTailwind) {
4062
+ scheduleRefresh();
4063
+ }
4040
4064
  const duration = performance.now() - startTime;
4041
4065
  const memoryAfter = memorySampler.sample();
4042
4066
  const longTasks = longTaskObserver.stop();
@@ -5441,6 +5465,7 @@ init_tailwind();
5441
5465
  preloadTailwind,
5442
5466
  preventFOUC,
5443
5467
  processStyles,
5468
+ refreshTailwind,
5444
5469
  registerIcon,
5445
5470
  registerIcons,
5446
5471
  removeClass,
@@ -5468,6 +5493,7 @@ init_tailwind();
5468
5493
  runAllTests,
5469
5494
  runTestCase,
5470
5495
  satisfiesVersion,
5496
+ scheduleRefresh,
5471
5497
  setIconCdnEnabled,
5472
5498
  setInCache,
5473
5499
  setLocalStorage,