@servlyadmin/runtime-core 0.1.43 → 0.1.44

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.cjs CHANGED
@@ -684,6 +684,7 @@ __export(index_exports, {
684
684
  StateManager: () => StateManager,
685
685
  addClass: () => addClass,
686
686
  addCustomStyles: () => addCustomStyles,
687
+ addFontPreconnect: () => addFontPreconnect,
687
688
  analytics: () => analytics,
688
689
  applyStyles: () => applyStyles,
689
690
  batchFetchComponents: () => batchFetchComponents,
@@ -709,6 +710,7 @@ __export(index_exports, {
709
710
  deepMerge: () => deepMerge,
710
711
  deleteValueByPath: () => deleteValueByPath,
711
712
  detectCircularDependencies: () => detectCircularDependencies,
713
+ ensureFonts: () => ensureFonts,
712
714
  extractBindingKeys: () => extractBindingKeys,
713
715
  extractDependencies: () => extractDependencies,
714
716
  extractDependenciesFromCode: () => extractDependenciesFromCode,
@@ -722,12 +724,14 @@ __export(index_exports, {
722
724
  getAnalytics: () => getAnalytics,
723
725
  getCacheKey: () => getCacheKey,
724
726
  getCleanupOverrides: () => getCleanupOverrides,
727
+ getDefaultFonts: () => getDefaultFonts,
725
728
  getDependencyTree: () => getDependencyTree,
726
729
  getEventSystem: () => getEventSystem,
727
730
  getFromCache: () => getFromCache,
728
731
  getIconData: () => getIconData,
729
732
  getIconDataSync: () => getIconDataSync,
730
733
  getIconifyCollection: () => getIconifyCollection,
734
+ getLoadedFonts: () => getLoadedFonts,
731
735
  getLocalStorage: () => getLocalStorage,
732
736
  getLongTaskObserver: () => getLongTaskObserver,
733
737
  getMemoryCacheSize: () => getMemoryCacheSize,
@@ -748,17 +752,22 @@ __export(index_exports, {
748
752
  hasDependencyOverrides: () => hasDependencyOverrides,
749
753
  hasOverrides: () => hasOverrides,
750
754
  hasTemplateSyntax: () => hasTemplateSyntax,
755
+ initFonts: () => initFonts,
751
756
  initServlyTailwind: () => initServlyTailwind,
752
757
  injectTailwind: () => injectTailwind,
753
758
  injectTailwindStyles: () => injectTailwindStyles,
754
759
  invalidateCache: () => invalidateCache,
755
760
  isComponentAvailable: () => isComponentAvailable,
761
+ isFontLoaded: () => isFontLoaded,
756
762
  isIconCdnEnabled: () => isIconCdnEnabled,
757
763
  isIconRegistered: () => isIconRegistered,
758
764
  isIconSetSupported: () => isIconSetSupported,
759
765
  isTailwindLoaded: () => isTailwindLoaded,
760
766
  isTailwindReady: () => isTailwindReady,
761
767
  isValidSpecifier: () => isValidSpecifier,
768
+ loadDefaultFonts: () => loadDefaultFonts,
769
+ loadFont: () => loadFont,
770
+ loadFonts: () => loadFonts,
762
771
  markElementReady: () => markElementReady,
763
772
  navigateTo: () => navigateTo,
764
773
  parseVersion: () => parseVersion,
@@ -3428,6 +3437,113 @@ function getIconifyCollection(set) {
3428
3437
 
3429
3438
  // src/renderer.ts
3430
3439
  init_tailwind();
3440
+
3441
+ // src/fonts.ts
3442
+ var DEFAULT_FONTS = [
3443
+ "Roboto",
3444
+ "Open Sans",
3445
+ "Lato",
3446
+ "Montserrat",
3447
+ "Poppins",
3448
+ "Inter",
3449
+ "Playfair Display",
3450
+ "Raleway",
3451
+ "Ubuntu",
3452
+ "Nunito",
3453
+ "Merriweather",
3454
+ "Work Sans",
3455
+ "Quicksand",
3456
+ "Mulish",
3457
+ "Manrope",
3458
+ "DM Sans",
3459
+ "Space Grotesk",
3460
+ "Plus Jakarta Sans",
3461
+ "Outfit",
3462
+ "Sora"
3463
+ ];
3464
+ var loadedFonts = /* @__PURE__ */ new Set();
3465
+ var fontsInitialized = false;
3466
+ var preconnectAdded = false;
3467
+ function addFontPreconnect() {
3468
+ if (typeof document === "undefined" || preconnectAdded) return;
3469
+ preconnectAdded = true;
3470
+ if (!document.querySelector('link[href="https://fonts.googleapis.com"]')) {
3471
+ const pc1 = document.createElement("link");
3472
+ pc1.rel = "preconnect";
3473
+ pc1.href = "https://fonts.googleapis.com";
3474
+ document.head.appendChild(pc1);
3475
+ }
3476
+ if (!document.querySelector('link[href="https://fonts.gstatic.com"]')) {
3477
+ const pc2 = document.createElement("link");
3478
+ pc2.rel = "preconnect";
3479
+ pc2.href = "https://fonts.gstatic.com";
3480
+ pc2.crossOrigin = "anonymous";
3481
+ document.head.appendChild(pc2);
3482
+ }
3483
+ }
3484
+ function loadFont(family, weights = ["400", "500", "600", "700"]) {
3485
+ if (typeof document === "undefined") return;
3486
+ const linkId = `google-font-${family.replace(/[\s+]/g, "-").toLowerCase()}`;
3487
+ if (document.getElementById(linkId) || loadedFonts.has(family)) {
3488
+ return;
3489
+ }
3490
+ addFontPreconnect();
3491
+ const weightsStr = weights.join(";");
3492
+ const encodedFontName = encodeURIComponent(family).replace(/%20/g, "+");
3493
+ const fontUrl = `https://fonts.googleapis.com/css2?family=${encodedFontName}:wght@${weightsStr}&display=swap`;
3494
+ const link = document.createElement("link");
3495
+ link.id = linkId;
3496
+ link.rel = "stylesheet";
3497
+ link.href = fontUrl;
3498
+ document.head.appendChild(link);
3499
+ loadedFonts.add(family);
3500
+ }
3501
+ function loadFonts(fonts, weights = ["400", "500", "600", "700"]) {
3502
+ for (const font of fonts) {
3503
+ loadFont(font, weights);
3504
+ }
3505
+ }
3506
+ function loadDefaultFonts() {
3507
+ if (fontsInitialized) return;
3508
+ fontsInitialized = true;
3509
+ console.log("[Servly Fonts] Loading default fonts...");
3510
+ loadFonts(DEFAULT_FONTS);
3511
+ console.log("[Servly Fonts] Default fonts loaded");
3512
+ }
3513
+ function isFontLoaded(family) {
3514
+ if (typeof document === "undefined") return false;
3515
+ const linkId = `google-font-${family.replace(/[\s+]/g, "-").toLowerCase()}`;
3516
+ return !!document.getElementById(linkId) || loadedFonts.has(family);
3517
+ }
3518
+ function getDefaultFonts() {
3519
+ return [...DEFAULT_FONTS];
3520
+ }
3521
+ function getLoadedFonts() {
3522
+ return Array.from(loadedFonts);
3523
+ }
3524
+ function initFonts(config = {}) {
3525
+ const {
3526
+ additionalFonts = [],
3527
+ weights = ["400", "500", "600", "700"],
3528
+ loadDefaults = true
3529
+ } = config;
3530
+ addFontPreconnect();
3531
+ if (loadDefaults) {
3532
+ loadDefaultFonts();
3533
+ }
3534
+ if (additionalFonts.length > 0) {
3535
+ loadFonts(additionalFonts, weights);
3536
+ }
3537
+ }
3538
+ var autoInitialized = false;
3539
+ function ensureFonts() {
3540
+ if (autoInitialized || typeof document === "undefined") return;
3541
+ autoInitialized = true;
3542
+ addFontPreconnect();
3543
+ loadDefaultFonts();
3544
+ }
3545
+
3546
+ // src/renderer.ts
3431
3547
  var tailwindAutoInjected = false;
3432
3548
  function ensureTailwind() {
3433
3549
  if (tailwindAutoInjected || typeof document === "undefined") return;
@@ -3435,6 +3551,7 @@ function ensureTailwind() {
3435
3551
  injectTailwind({ usePlayCdn: true }).catch((err) => {
3436
3552
  console.warn("Failed to auto-inject Tailwind CSS:", err);
3437
3553
  });
3554
+ ensureFonts();
3438
3555
  }
3439
3556
  var COMPONENT_TO_TAG = {
3440
3557
  container: "div",
@@ -5490,6 +5607,7 @@ init_tailwind();
5490
5607
  StateManager,
5491
5608
  addClass,
5492
5609
  addCustomStyles,
5610
+ addFontPreconnect,
5493
5611
  analytics,
5494
5612
  applyStyles,
5495
5613
  batchFetchComponents,
@@ -5515,6 +5633,7 @@ init_tailwind();
5515
5633
  deepMerge,
5516
5634
  deleteValueByPath,
5517
5635
  detectCircularDependencies,
5636
+ ensureFonts,
5518
5637
  extractBindingKeys,
5519
5638
  extractDependencies,
5520
5639
  extractDependenciesFromCode,
@@ -5528,12 +5647,14 @@ init_tailwind();
5528
5647
  getAnalytics,
5529
5648
  getCacheKey,
5530
5649
  getCleanupOverrides,
5650
+ getDefaultFonts,
5531
5651
  getDependencyTree,
5532
5652
  getEventSystem,
5533
5653
  getFromCache,
5534
5654
  getIconData,
5535
5655
  getIconDataSync,
5536
5656
  getIconifyCollection,
5657
+ getLoadedFonts,
5537
5658
  getLocalStorage,
5538
5659
  getLongTaskObserver,
5539
5660
  getMemoryCacheSize,
@@ -5554,17 +5675,22 @@ init_tailwind();
5554
5675
  hasDependencyOverrides,
5555
5676
  hasOverrides,
5556
5677
  hasTemplateSyntax,
5678
+ initFonts,
5557
5679
  initServlyTailwind,
5558
5680
  injectTailwind,
5559
5681
  injectTailwindStyles,
5560
5682
  invalidateCache,
5561
5683
  isComponentAvailable,
5684
+ isFontLoaded,
5562
5685
  isIconCdnEnabled,
5563
5686
  isIconRegistered,
5564
5687
  isIconSetSupported,
5565
5688
  isTailwindLoaded,
5566
5689
  isTailwindReady,
5567
5690
  isValidSpecifier,
5691
+ loadDefaultFonts,
5692
+ loadFont,
5693
+ loadFonts,
5568
5694
  markElementReady,
5569
5695
  navigateTo,
5570
5696
  parseVersion,
package/dist/index.d.cts CHANGED
@@ -1822,6 +1822,55 @@ declare const DEFAULT_SERVLY_TAILWIND_CONFIG: {
1822
1822
  declare function initServlyTailwind(customConfig?: Record<string, any>): Promise<void>;
1823
1823
  declare const injectTailwindStyles: typeof initServlyTailwind;
1824
1824
 
1825
+ /**
1826
+ * Google Fonts Utilities for Runtime Core
1827
+ * Provides automatic font loading for Servly components
1828
+ */
1829
+ /**
1830
+ * Add preconnect links for Google Fonts (improves load performance)
1831
+ */
1832
+ declare function addFontPreconnect(): void;
1833
+ /**
1834
+ * Load a specific Google Font
1835
+ */
1836
+ declare function loadFont(family: string, weights?: string[]): void;
1837
+ /**
1838
+ * Load multiple fonts at once
1839
+ */
1840
+ declare function loadFonts(fonts: string[], weights?: string[]): void;
1841
+ /**
1842
+ * Load default popular fonts
1843
+ */
1844
+ declare function loadDefaultFonts(): void;
1845
+ /**
1846
+ * Check if a font is loaded
1847
+ */
1848
+ declare function isFontLoaded(family: string): boolean;
1849
+ /**
1850
+ * Get list of default fonts
1851
+ */
1852
+ declare function getDefaultFonts(): string[];
1853
+ /**
1854
+ * Get list of currently loaded fonts
1855
+ */
1856
+ declare function getLoadedFonts(): string[];
1857
+ interface FontConfig {
1858
+ /** Additional fonts to load beyond defaults */
1859
+ additionalFonts?: string[];
1860
+ /** Font weights to load */
1861
+ weights?: string[];
1862
+ /** Whether to load default fonts */
1863
+ loadDefaults?: boolean;
1864
+ }
1865
+ /**
1866
+ * Initialize fonts with configuration
1867
+ */
1868
+ declare function initFonts(config?: FontConfig): void;
1869
+ /**
1870
+ * Ensure fonts are loaded (called automatically by renderer)
1871
+ */
1872
+ declare function ensureFonts(): void;
1873
+
1825
1874
  /**
1826
1875
  * Overrides System for Runtime Core
1827
1876
  * Handles element overrides with dependency tracking
@@ -2019,4 +2068,4 @@ declare function getSupportedIconSets(): string[];
2019
2068
  */
2020
2069
  declare function getIconifyCollection(set: string): string | undefined;
2021
2070
 
2022
- export { AnalyticsCollector, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BatchEventsRequest, type BatchEventsResponse, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ClientInfo, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_REGISTRY_URL, DEFAULT_RETRY_CONFIG, DEFAULT_SERVLY_TAILWIND_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, EVENT_HANDLERS, type ElementConfig, type ErrorMetadata, type ErrorType, type EventContext, type EventHandlerConfig, EventSystem, type EventSystemConfig, type FetchMetadata, type FetchOptions, type FetchResult, type IconConfig, type IconData, type IconRenderer, type LayoutElement, LongTaskObserver, MemorySampler, type NavigationOptions, type Override, type OverrideState, OverrideSystem, type OverrideSystemConfig, type ParsedVersion, type PluginExecutor, type PropDefinition, type RenderMetadata, type RenderOptions, type RenderResult, type RetryConfig, type ServlyEventHandler, type ServlyPluginAction, type SessionInfo, SessionManager, type StateChangeEvent, StateManager, type StateManagerConfig, type TailwindConfig, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, type ViewData, addClass, addCustomStyles, analytics, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isTailwindReady, isValidSpecifier, markElementReady, navigateTo, parseVersion, prefetchComponents, preloadIcons, preloadTailwind, preventFOUC, processStyles, refreshTailwind, registerIcon, registerIcons, removeClass, removeCustomStyles, removeFOUCPrevention, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, scheduleRefresh, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps, waitForTailwind };
2071
+ export { AnalyticsCollector, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BatchEventsRequest, type BatchEventsResponse, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ClientInfo, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_REGISTRY_URL, DEFAULT_RETRY_CONFIG, DEFAULT_SERVLY_TAILWIND_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, EVENT_HANDLERS, type ElementConfig, type ErrorMetadata, type ErrorType, type EventContext, type EventHandlerConfig, EventSystem, type EventSystemConfig, type FetchMetadata, type FetchOptions, type FetchResult, type FontConfig, type IconConfig, type IconData, type IconRenderer, type LayoutElement, LongTaskObserver, MemorySampler, type NavigationOptions, type Override, type OverrideState, OverrideSystem, type OverrideSystemConfig, type ParsedVersion, type PluginExecutor, type PropDefinition, type RenderMetadata, type RenderOptions, type RenderResult, type RetryConfig, type ServlyEventHandler, type ServlyPluginAction, type SessionInfo, SessionManager, type StateChangeEvent, StateManager, type StateManagerConfig, type TailwindConfig, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, type ViewData, addClass, addCustomStyles, addFontPreconnect, analytics, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, ensureFonts, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDefaultFonts, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLoadedFonts, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initFonts, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isFontLoaded, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isTailwindReady, isValidSpecifier, loadDefaultFonts, loadFont, loadFonts, markElementReady, navigateTo, parseVersion, prefetchComponents, preloadIcons, preloadTailwind, preventFOUC, processStyles, refreshTailwind, registerIcon, registerIcons, removeClass, removeCustomStyles, removeFOUCPrevention, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, scheduleRefresh, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps, waitForTailwind };
package/dist/index.d.ts CHANGED
@@ -1822,6 +1822,55 @@ declare const DEFAULT_SERVLY_TAILWIND_CONFIG: {
1822
1822
  declare function initServlyTailwind(customConfig?: Record<string, any>): Promise<void>;
1823
1823
  declare const injectTailwindStyles: typeof initServlyTailwind;
1824
1824
 
1825
+ /**
1826
+ * Google Fonts Utilities for Runtime Core
1827
+ * Provides automatic font loading for Servly components
1828
+ */
1829
+ /**
1830
+ * Add preconnect links for Google Fonts (improves load performance)
1831
+ */
1832
+ declare function addFontPreconnect(): void;
1833
+ /**
1834
+ * Load a specific Google Font
1835
+ */
1836
+ declare function loadFont(family: string, weights?: string[]): void;
1837
+ /**
1838
+ * Load multiple fonts at once
1839
+ */
1840
+ declare function loadFonts(fonts: string[], weights?: string[]): void;
1841
+ /**
1842
+ * Load default popular fonts
1843
+ */
1844
+ declare function loadDefaultFonts(): void;
1845
+ /**
1846
+ * Check if a font is loaded
1847
+ */
1848
+ declare function isFontLoaded(family: string): boolean;
1849
+ /**
1850
+ * Get list of default fonts
1851
+ */
1852
+ declare function getDefaultFonts(): string[];
1853
+ /**
1854
+ * Get list of currently loaded fonts
1855
+ */
1856
+ declare function getLoadedFonts(): string[];
1857
+ interface FontConfig {
1858
+ /** Additional fonts to load beyond defaults */
1859
+ additionalFonts?: string[];
1860
+ /** Font weights to load */
1861
+ weights?: string[];
1862
+ /** Whether to load default fonts */
1863
+ loadDefaults?: boolean;
1864
+ }
1865
+ /**
1866
+ * Initialize fonts with configuration
1867
+ */
1868
+ declare function initFonts(config?: FontConfig): void;
1869
+ /**
1870
+ * Ensure fonts are loaded (called automatically by renderer)
1871
+ */
1872
+ declare function ensureFonts(): void;
1873
+
1825
1874
  /**
1826
1875
  * Overrides System for Runtime Core
1827
1876
  * Handles element overrides with dependency tracking
@@ -2019,4 +2068,4 @@ declare function getSupportedIconSets(): string[];
2019
2068
  */
2020
2069
  declare function getIconifyCollection(set: string): string | undefined;
2021
2070
 
2022
- export { AnalyticsCollector, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BatchEventsRequest, type BatchEventsResponse, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ClientInfo, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_REGISTRY_URL, DEFAULT_RETRY_CONFIG, DEFAULT_SERVLY_TAILWIND_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, EVENT_HANDLERS, type ElementConfig, type ErrorMetadata, type ErrorType, type EventContext, type EventHandlerConfig, EventSystem, type EventSystemConfig, type FetchMetadata, type FetchOptions, type FetchResult, type IconConfig, type IconData, type IconRenderer, type LayoutElement, LongTaskObserver, MemorySampler, type NavigationOptions, type Override, type OverrideState, OverrideSystem, type OverrideSystemConfig, type ParsedVersion, type PluginExecutor, type PropDefinition, type RenderMetadata, type RenderOptions, type RenderResult, type RetryConfig, type ServlyEventHandler, type ServlyPluginAction, type SessionInfo, SessionManager, type StateChangeEvent, StateManager, type StateManagerConfig, type TailwindConfig, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, type ViewData, addClass, addCustomStyles, analytics, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isTailwindReady, isValidSpecifier, markElementReady, navigateTo, parseVersion, prefetchComponents, preloadIcons, preloadTailwind, preventFOUC, processStyles, refreshTailwind, registerIcon, registerIcons, removeClass, removeCustomStyles, removeFOUCPrevention, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, scheduleRefresh, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps, waitForTailwind };
2071
+ export { AnalyticsCollector, type AnalyticsConfig, type AnalyticsEvent, type AnalyticsEventType, type Assertion$1 as Assertion, type AssertionResult$1 as AssertionResult, type BatchEventsRequest, type BatchEventsResponse, type BindingContext, type BundleStrategy, type BundledComponent, type CacheConfig, type CacheEntry, type CacheStrategy, type ClientInfo, type ComponentBundle, type ComponentData, type ComponentRegistry, DEFAULT_CACHE_CONFIG, DEFAULT_REGISTRY_URL, DEFAULT_RETRY_CONFIG, DEFAULT_SERVLY_TAILWIND_CONFIG, type DependencyEntry, type DependencyManifest, type DependencyType, EVENT_HANDLERS, type ElementConfig, type ErrorMetadata, type ErrorType, type EventContext, type EventHandlerConfig, EventSystem, type EventSystemConfig, type FetchMetadata, type FetchOptions, type FetchResult, type FontConfig, type IconConfig, type IconData, type IconRenderer, type LayoutElement, LongTaskObserver, MemorySampler, type NavigationOptions, type Override, type OverrideState, OverrideSystem, type OverrideSystemConfig, type ParsedVersion, type PluginExecutor, type PropDefinition, type RenderMetadata, type RenderOptions, type RenderResult, type RetryConfig, type ServlyEventHandler, type ServlyPluginAction, type SessionInfo, SessionManager, type StateChangeEvent, StateManager, type StateManagerConfig, type TailwindConfig, type AssertionResult as TestAssertionResult, type TestCase$1 as TestCase, type TestCase as TestCaseInput, type TestCaseResult, type TestResult, type TestSummary as TestRunSummary, type TestSummary$1 as TestSummary, type ViewData, addClass, addCustomStyles, addFontPreconnect, analytics, applyStyles, batchFetchComponents, buildClassName, buildElementStyles, buildRegistryFromBundle, bumpVersion, camelToKebab, clearAllCaches, clearIconCache, clearLocalStorageCache, clearMemoryCache, clearStyles, collectAllDependencies, collectAllViewDependencies, compareVersions, configureAnalytics, createIconSVG, createPlaceholderIcon, createRegistry, createServlyRenderer, createViewsMap, deepMerge, deleteValueByPath, detectCircularDependencies, ensureFonts, extractBindingKeys, extractDependencies, extractDependenciesFromCode, extractOverrideDependencies, extractReferencedViewIds, fetchComponent, fetchComponentWithDependencies, formatStyleValue, formatVersion, generateTestCases, getAnalytics, getCacheKey, getCleanupOverrides, getDefaultFonts, getDependencyTree, getEventSystem, getFromCache, getIconData, getIconDataSync, getIconifyCollection, getLoadedFonts, getLocalStorage, getLongTaskObserver, getMemoryCacheSize, getMemorySampler, getMountOverrides, getOverrideSystem, getRegisteredIconKeys, getRegistryUrl, getSessionManager, getSessionStorage, getSupportedIconSets, getTailwind, getUrlInfo, getValueByPath, goBack, goForward, hasClass, hasDependencyOverrides, hasOverrides, hasTemplateSyntax, initFonts, initServlyTailwind, injectTailwind, injectTailwindStyles, invalidateCache, isComponentAvailable, isFontLoaded, isIconCdnEnabled, isIconRegistered, isIconSetSupported, isTailwindLoaded, isTailwindReady, isValidSpecifier, loadDefaultFonts, loadFont, loadFonts, markElementReady, navigateTo, parseVersion, prefetchComponents, preloadIcons, preloadTailwind, preventFOUC, processStyles, refreshTailwind, registerIcon, registerIcons, removeClass, removeCustomStyles, removeFOUCPrevention, removeLocalStorage, removeSessionStorage, removeTailwind, render, renderDynamicList, renderIcon, renderInShadow, renderNode, resetAnalytics, resetEventSystem, resetLongTaskObserver, resetMemorySampler, resetOverrideSystem, resetSessionManager, resolveBindingPath, resolveTemplate, resolveTemplateValue, resolveTemplatesDeep, resolveVersion, runAllTests, runTestCase, satisfiesVersion, scheduleRefresh, setIconCdnEnabled, setInCache, setLocalStorage, setRegistryUrl, setSessionStorage, setValueByPath, toDomEventName, toReactEventName, toggleClass, updateStyles, updateTailwindConfig, validateAssertion, validateProps, waitForTailwind };
package/dist/index.js CHANGED
@@ -2640,6 +2640,111 @@ function getIconifyCollection(set) {
2640
2640
  return ICONIFY_COLLECTIONS[set];
2641
2641
  }
2642
2642
 
2643
+ // src/fonts.ts
2644
+ var DEFAULT_FONTS = [
2645
+ "Roboto",
2646
+ "Open Sans",
2647
+ "Lato",
2648
+ "Montserrat",
2649
+ "Poppins",
2650
+ "Inter",
2651
+ "Playfair Display",
2652
+ "Raleway",
2653
+ "Ubuntu",
2654
+ "Nunito",
2655
+ "Merriweather",
2656
+ "Work Sans",
2657
+ "Quicksand",
2658
+ "Mulish",
2659
+ "Manrope",
2660
+ "DM Sans",
2661
+ "Space Grotesk",
2662
+ "Plus Jakarta Sans",
2663
+ "Outfit",
2664
+ "Sora"
2665
+ ];
2666
+ var loadedFonts = /* @__PURE__ */ new Set();
2667
+ var fontsInitialized = false;
2668
+ var preconnectAdded = false;
2669
+ function addFontPreconnect() {
2670
+ if (typeof document === "undefined" || preconnectAdded) return;
2671
+ preconnectAdded = true;
2672
+ if (!document.querySelector('link[href="https://fonts.googleapis.com"]')) {
2673
+ const pc1 = document.createElement("link");
2674
+ pc1.rel = "preconnect";
2675
+ pc1.href = "https://fonts.googleapis.com";
2676
+ document.head.appendChild(pc1);
2677
+ }
2678
+ if (!document.querySelector('link[href="https://fonts.gstatic.com"]')) {
2679
+ const pc2 = document.createElement("link");
2680
+ pc2.rel = "preconnect";
2681
+ pc2.href = "https://fonts.gstatic.com";
2682
+ pc2.crossOrigin = "anonymous";
2683
+ document.head.appendChild(pc2);
2684
+ }
2685
+ }
2686
+ function loadFont(family, weights = ["400", "500", "600", "700"]) {
2687
+ if (typeof document === "undefined") return;
2688
+ const linkId = `google-font-${family.replace(/[\s+]/g, "-").toLowerCase()}`;
2689
+ if (document.getElementById(linkId) || loadedFonts.has(family)) {
2690
+ return;
2691
+ }
2692
+ addFontPreconnect();
2693
+ const weightsStr = weights.join(";");
2694
+ const encodedFontName = encodeURIComponent(family).replace(/%20/g, "+");
2695
+ const fontUrl = `https://fonts.googleapis.com/css2?family=${encodedFontName}:wght@${weightsStr}&display=swap`;
2696
+ const link = document.createElement("link");
2697
+ link.id = linkId;
2698
+ link.rel = "stylesheet";
2699
+ link.href = fontUrl;
2700
+ document.head.appendChild(link);
2701
+ loadedFonts.add(family);
2702
+ }
2703
+ function loadFonts(fonts, weights = ["400", "500", "600", "700"]) {
2704
+ for (const font of fonts) {
2705
+ loadFont(font, weights);
2706
+ }
2707
+ }
2708
+ function loadDefaultFonts() {
2709
+ if (fontsInitialized) return;
2710
+ fontsInitialized = true;
2711
+ console.log("[Servly Fonts] Loading default fonts...");
2712
+ loadFonts(DEFAULT_FONTS);
2713
+ console.log("[Servly Fonts] Default fonts loaded");
2714
+ }
2715
+ function isFontLoaded(family) {
2716
+ if (typeof document === "undefined") return false;
2717
+ const linkId = `google-font-${family.replace(/[\s+]/g, "-").toLowerCase()}`;
2718
+ return !!document.getElementById(linkId) || loadedFonts.has(family);
2719
+ }
2720
+ function getDefaultFonts() {
2721
+ return [...DEFAULT_FONTS];
2722
+ }
2723
+ function getLoadedFonts() {
2724
+ return Array.from(loadedFonts);
2725
+ }
2726
+ function initFonts(config = {}) {
2727
+ const {
2728
+ additionalFonts = [],
2729
+ weights = ["400", "500", "600", "700"],
2730
+ loadDefaults = true
2731
+ } = config;
2732
+ addFontPreconnect();
2733
+ if (loadDefaults) {
2734
+ loadDefaultFonts();
2735
+ }
2736
+ if (additionalFonts.length > 0) {
2737
+ loadFonts(additionalFonts, weights);
2738
+ }
2739
+ }
2740
+ var autoInitialized = false;
2741
+ function ensureFonts() {
2742
+ if (autoInitialized || typeof document === "undefined") return;
2743
+ autoInitialized = true;
2744
+ addFontPreconnect();
2745
+ loadDefaultFonts();
2746
+ }
2747
+
2643
2748
  // src/renderer.ts
2644
2749
  var tailwindAutoInjected = false;
2645
2750
  function ensureTailwind() {
@@ -2648,6 +2753,7 @@ function ensureTailwind() {
2648
2753
  injectTailwind({ usePlayCdn: true }).catch((err) => {
2649
2754
  console.warn("Failed to auto-inject Tailwind CSS:", err);
2650
2755
  });
2756
+ ensureFonts();
2651
2757
  }
2652
2758
  var COMPONENT_TO_TAG = {
2653
2759
  container: "div",
@@ -4697,6 +4803,7 @@ export {
4697
4803
  StateManager,
4698
4804
  addClass,
4699
4805
  addCustomStyles,
4806
+ addFontPreconnect,
4700
4807
  analytics,
4701
4808
  applyStyles,
4702
4809
  batchFetchComponents,
@@ -4722,6 +4829,7 @@ export {
4722
4829
  deepMerge,
4723
4830
  deleteValueByPath,
4724
4831
  detectCircularDependencies,
4832
+ ensureFonts,
4725
4833
  extractBindingKeys,
4726
4834
  extractDependencies,
4727
4835
  extractDependenciesFromCode,
@@ -4735,12 +4843,14 @@ export {
4735
4843
  getAnalytics,
4736
4844
  getCacheKey,
4737
4845
  getCleanupOverrides,
4846
+ getDefaultFonts,
4738
4847
  getDependencyTree,
4739
4848
  getEventSystem,
4740
4849
  getFromCache,
4741
4850
  getIconData,
4742
4851
  getIconDataSync,
4743
4852
  getIconifyCollection,
4853
+ getLoadedFonts,
4744
4854
  getLocalStorage,
4745
4855
  getLongTaskObserver,
4746
4856
  getMemoryCacheSize,
@@ -4761,17 +4871,22 @@ export {
4761
4871
  hasDependencyOverrides,
4762
4872
  hasOverrides,
4763
4873
  hasTemplateSyntax,
4874
+ initFonts,
4764
4875
  initServlyTailwind,
4765
4876
  injectTailwind,
4766
4877
  injectTailwindStyles,
4767
4878
  invalidateCache,
4768
4879
  isComponentAvailable,
4880
+ isFontLoaded,
4769
4881
  isIconCdnEnabled,
4770
4882
  isIconRegistered,
4771
4883
  isIconSetSupported,
4772
4884
  isTailwindLoaded,
4773
4885
  isTailwindReady,
4774
4886
  isValidSpecifier,
4887
+ loadDefaultFonts,
4888
+ loadFont,
4889
+ loadFonts,
4775
4890
  markElementReady,
4776
4891
  navigateTo,
4777
4892
  parseVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servlyadmin/runtime-core",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "Framework-agnostic core renderer for Servly components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",