@kilivi/payloadcms-theme-management 0.2.11 → 0.2.13
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/fields/ExtendedThemeAutoPopulateField.d.ts +12 -0
- package/dist/fields/ExtendedThemeAutoPopulateField.d.ts.map +1 -0
- package/dist/fields/ExtendedThemeAutoPopulateField.js +176 -0
- package/dist/fields/ExtendedThemeAutoPopulateField.js.map +1 -0
- package/dist/fields/extendedThemeFields.d.ts +2 -1
- package/dist/fields/extendedThemeFields.d.ts.map +1 -1
- package/dist/fields/extendedThemeFields.js +5 -4
- package/dist/fields/extendedThemeFields.js.map +1 -1
- package/dist/fields/themeConfigurationField.d.ts.map +1 -1
- package/dist/fields/themeConfigurationField.js +4 -8
- package/dist/fields/themeConfigurationField.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/font-loader.d.ts +127 -0
- package/dist/providers/font-loader.d.ts.map +1 -0
- package/dist/providers/font-loader.js +212 -0
- package/dist/providers/font-loader.js.map +1 -0
- package/package.json +1 -1
- package/dist/fields/ThemePresetSelectField.d.ts +0 -4
- package/dist/fields/ThemePresetSelectField.d.ts.map +0 -1
- package/dist/fields/ThemePresetSelectField.js +0 -228
- package/dist/fields/ThemePresetSelectField.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, Plugin } from 'payload'\nimport { createThemeConfigurationField } from './fields/themeConfigurationField.js'\nimport type { SiteThemeConfiguration } from './payload-types.js'\nimport type { ThemePreset } from './presets.js'\nimport { defaultThemePresets } from './presets.js'\nimport type {\n FetchThemeConfigurationOptions,\n ThemeManagementPluginOptions,\n} from './types.js'\n\nconst THEME_TAB_NAME = 'themeConfiguration'\n\ninterface TabConfig {\n name: string\n label: { en: string; cs: string }\n description?: { en: string; cs: string }\n fields: Field[]\n}\n\n/**\n * Remove existing theme tab from tabs field\n */\nconst removeExistingThemeTab = (tabs: TabConfig[]): TabConfig[] =>\n tabs.filter((tab) => tab?.name !== THEME_TAB_NAME)\n\n/**\n * Add theme configuration tab to existing tabs field or create fields array\n */\nconst upsertThemeTab = (\n fields: Field[] | undefined,\n themeTabConfig: TabConfig,\n enableLogging: boolean,\n): Field[] => {\n const existingFields = fields ?? []\n\n // Find existing tabs field\n const tabsFieldIndex = existingFields.findIndex(\n (field) => 'type' in field && field.type === 'tabs',\n )\n\n if (tabsFieldIndex === -1) {\n // No tabs field exists - add theme configuration as group field instead\n if (enableLogging) {\n console.log(\n '🎨 Theme Management Plugin: No tabs field found, adding theme configuration as group field',\n )\n }\n\n return [\n ...existingFields,\n {\n name: THEME_TAB_NAME,\n type: 'group',\n label: themeTabConfig.label,\n admin: {\n description: themeTabConfig.description,\n },\n fields: themeTabConfig.fields,\n },\n ]\n }\n\n // Tabs field exists - inject our tab into it\n if (enableLogging) {\n console.log(\n '🎨 Theme Management Plugin: Adding theme configuration tab to existing tabs',\n )\n }\n\n const tabsField = existingFields[tabsFieldIndex]\n \n if (!('tabs' in tabsField)) {\n console.warn('🎨 Theme Management Plugin: Found tabs field but it has no tabs property')\n return existingFields\n }\n\n const existingTabs = (tabsField.tabs as TabConfig[]) || []\n\n // Remove existing theme tab if present\n const sanitizedTabs = removeExistingThemeTab(existingTabs)\n\n // Create new tabs field with our tab added\n const updatedTabsField = {\n ...tabsField,\n tabs: [...sanitizedTabs, themeTabConfig],\n }\n\n // Return fields array with updated tabs field\n const newFields = [...existingFields]\n newFields[tabsFieldIndex] = updatedTabsField\n\n return newFields\n}\n\nconst ensureCollectionsArray = (collections: Config['collections']): CollectionConfig[] =>\n Array.isArray(collections) ? collections : []\n\nexport const themeManagementPlugin = (options: ThemeManagementPluginOptions = {}): Plugin => {\n return (config: Config): Config => {\n const {\n enabled = true,\n targetCollection = 'site-settings',\n themePresets = defaultThemePresets,\n defaultTheme = 'cool',\n includeColorModeToggle = true,\n includeCustomCSS = true,\n includeBrandIdentity = false,\n enableAdvancedFeatures = true,\n enableLogging = false,\n } = options\n\n if (!enabled) {\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: disabled via options, skipping.')\n }\n return config\n }\n\n const themeTabConfig = createThemeConfigurationField({\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n includeBrandIdentity: includeBrandIdentity ?? false,\n enableAdvancedFeatures,\n })\n\n let collectionTouched = false\n\n const collections = ensureCollectionsArray(config.collections).map((collection) => {\n if (collection.slug !== targetCollection) {\n return collection\n }\n\n collectionTouched = true\n\n if (enableLogging) {\n console.log(\n `🎨 Theme Management Plugin: enhancing collection \"${collection.slug}\"`,\n )\n }\n\n const existingFields = Array.isArray(collection.fields) ? collection.fields : []\n\n const fields = upsertThemeTab(existingFields, themeTabConfig, enableLogging)\n\n return {\n ...collection,\n fields,\n }\n })\n\n if (!collectionTouched) {\n if (enableLogging) {\n console.warn(\n `🎨 Theme Management Plugin: collection \"${targetCollection}\" was not found, leaving config untouched.`,\n )\n }\n return config\n }\n\n // Add custom admin view for theme preview\n const admin = {\n ...config.admin,\n components: {\n ...config.admin?.components,\n views: {\n ...config.admin?.components?.views,\n themePreview: {\n Component: '@kilivi/payloadcms-theme-management/views/ThemePreviewView#default',\n path: '/theme-preview' as `/${string}`,\n exact: true,\n meta: {\n title: 'Theme Preview',\n description: 'Real-time preview of your theme configuration',\n },\n },\n },\n },\n }\n\n return {\n ...config,\n collections,\n admin,\n }\n }\n}\n\ntype FetchOptionsInput = string | FetchThemeConfigurationOptions\n\nexport const fetchThemeConfiguration = async (\n options?: FetchOptionsInput,\n): Promise<SiteThemeConfiguration | null> => {\n const normalizedOptions =\n typeof options === 'string'\n ? { tenantSlug: options }\n : options ?? {}\n\n const {\n tenantSlug,\n collectionSlug = 'site-settings',\n depth,\n locale,\n draft,\n queryParams = {},\n } = normalizedOptions\n\n const params = new URLSearchParams({ limit: '1' })\n\n if (typeof depth === 'number') params.set('depth', String(depth))\n if (tenantSlug) params.set('tenant', tenantSlug)\n if (locale) params.set('locale', locale)\n if (draft) params.set('draft', 'true')\n\n Object.entries(queryParams).forEach(([key, value]) => {\n if (value === undefined) return\n params.set(key, String(value))\n })\n\n const url = `/api/${collectionSlug}?${params.toString()}`\n\n try {\n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`Failed to fetch theme configuration (status ${response.status})`)\n }\n\n const data = (await response.json()) as {\n docs?: Array<{ themeConfiguration?: SiteThemeConfiguration }>\n }\n\n const doc = data.docs?.[0]\n\n return doc?.themeConfiguration ?? null\n } catch (error) {\n console.warn('Failed to fetch theme configuration:', error)\n return null\n }\n}\n\nexport const getThemePreset = (themeName: string): ThemePreset | null => {\n return defaultThemePresets.find((preset) => preset.name === themeName) || null\n}\n\nexport const getAvailableThemePresets = (): ThemePreset[] => {\n return defaultThemePresets\n}\n\n\n\nexport { defaultThemePresets } from './presets.js'\nexport type { ThemePreset, ThemeTypographyPreset } from './presets.js'\nexport { \n extendedThemePresets,\n allExtendedThemePresets,\n extendedThemeToCSSVariables,\n} from './extended-presets.js'\nexport type { ExtendedThemePreset, ShadcnColorTokens } from './extended-presets.js'\nexport {\n applyExtendedTheme,\n generateExtendedThemeCSS,\n resetExtendedTheme,\n getExtendedThemeTokens,\n createUseExtendedTheme,\n getTailwindVarReferences,\n} from './utils/extendedThemeHelpers.js'\nexport type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js'\nexport {\n DEFAULT_THEME_CONFIGURATION,\n resolveThemeConfiguration,\n} from './utils/resolveThemeConfiguration.js'\nexport type { ResolvedThemeConfiguration } from './utils/resolveThemeConfiguration.js'\nexport { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js'\nexport { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js'\nexport { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js'\n\nexport type { Mode, ThemeDefaults } from './providers/Theme/types.js'\nexport { ThemeProvider } from './providers/Theme/index.js'\n\n// Components\nexport { ThemeLivePreview } from './fields/ThemeLivePreview.js'\n\nexport const ThemeManagementPlugin = themeManagementPlugin\n/** @deprecated use {@link themeManagementPlugin} */\nexport const themeConfigurationPlugin = themeManagementPlugin\n\nexport default themeManagementPlugin"],"names":["createThemeConfigurationField","defaultThemePresets","THEME_TAB_NAME","removeExistingThemeTab","tabs","filter","tab","name","upsertThemeTab","fields","themeTabConfig","enableLogging","existingFields","tabsFieldIndex","findIndex","field","type","console","log","label","admin","description","tabsField","warn","existingTabs","sanitizedTabs","updatedTabsField","newFields","ensureCollectionsArray","collections","Array","isArray","themeManagementPlugin","options","config","enabled","targetCollection","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","includeBrandIdentity","enableAdvancedFeatures","collectionTouched","map","collection","slug","components","views","themePreview","Component","path","exact","meta","title","fetchThemeConfiguration","normalizedOptions","tenantSlug","collectionSlug","depth","locale","draft","queryParams","params","URLSearchParams","limit","set","String","Object","entries","forEach","key","value","undefined","url","toString","response","fetch","ok","Error","status","data","json","doc","docs","themeConfiguration","error","getThemePreset","themeName","find","preset","getAvailableThemePresets","extendedThemePresets","allExtendedThemePresets","extendedThemeToCSSVariables","applyExtendedTheme","generateExtendedThemeCSS","resetExtendedTheme","getExtendedThemeTokens","createUseExtendedTheme","getTailwindVarReferences","DEFAULT_THEME_CONFIGURATION","resolveThemeConfiguration","generateThemeColorsCss","hexToHsl","generateThemeCSS","getThemeStyles","getThemeHtmlAttributes","ThemeProvider","ThemeLivePreview","ThemeManagementPlugin","themeConfigurationPlugin"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,sCAAqC;AAGnF,SAASC,mBAAmB,QAAQ,eAAc;AAMlD,MAAMC,iBAAiB;AASvB;;CAEC,GACD,MAAMC,yBAAyB,CAACC,OAC9BA,KAAKC,MAAM,CAAC,CAACC,MAAQA,KAAKC,SAASL;AAErC;;CAEC,GACD,MAAM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F,cAAc;AAC5E,EAAC;AAED,OAAO,MAAMG,2BAA2B;IACtC,OAAO1F;AACT,EAAC;AAID,SAASA,mBAAmB,QAAQ,eAAc;AAElD,SACE2F,oBAAoB,EACpBC,uBAAuB,EACvBC,2BAA2B,QACtB,wBAAuB;AAE9B,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,QACnB,kCAAiC;AAExC,SACEC,2BAA2B,EAC3BC,yBAAyB,QACpB,uCAAsC;AAE7C,SAASC,sBAAsB,EAAEC,QAAQ,QAAQ,yBAAwB;AACzE,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,wBAAuB;AACxE,SAASC,sBAAsB,QAAQ,iCAAgC;AAGvE,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,aAAa;AACb,SAASC,gBAAgB,QAAQ,+BAA8B;AAE/D,OAAO,MAAMC,wBAAwB9E,sBAAqB;AAC1D,kDAAkD,GAClD,OAAO,MAAM+E,2BAA2B/E,sBAAqB;AAE7D,eAAeA,sBAAqB"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionConfig, Config, Field, Plugin } from 'payload'\nimport { createThemeConfigurationField } from './fields/themeConfigurationField.js'\nimport type { SiteThemeConfiguration } from './payload-types.js'\nimport type { ThemePreset } from './presets.js'\nimport { defaultThemePresets } from './presets.js'\nimport type { FetchThemeConfigurationOptions, ThemeManagementPluginOptions } from './types.js'\n\nconst THEME_TAB_NAME = 'themeConfiguration'\n\ninterface TabConfig {\n name: string\n label: { en: string; cs: string }\n description?: { en: string; cs: string }\n fields: Field[]\n}\n\n/**\n * Remove existing theme tab from tabs field\n */\nconst removeExistingThemeTab = (tabs: TabConfig[]): TabConfig[] =>\n tabs.filter((tab) => tab?.name !== THEME_TAB_NAME)\n\n/**\n * Add theme configuration tab to existing tabs field or create fields array\n */\nconst upsertThemeTab = (\n fields: Field[] | undefined,\n themeTabConfig: TabConfig,\n enableLogging: boolean,\n): Field[] => {\n const existingFields = fields ?? []\n\n // Find existing tabs field\n const tabsFieldIndex = existingFields.findIndex(\n (field) => 'type' in field && field.type === 'tabs',\n )\n\n if (tabsFieldIndex === -1) {\n // No tabs field exists - add theme configuration as group field instead\n if (enableLogging) {\n console.log(\n '🎨 Theme Management Plugin: No tabs field found, adding theme configuration as group field',\n )\n }\n\n return [\n ...existingFields,\n {\n name: THEME_TAB_NAME,\n type: 'group',\n label: themeTabConfig.label,\n admin: {\n description: themeTabConfig.description,\n },\n fields: themeTabConfig.fields,\n },\n ]\n }\n\n // Tabs field exists - inject our tab into it\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: Adding theme configuration tab to existing tabs')\n }\n\n const tabsField = existingFields[tabsFieldIndex]\n\n if (!('tabs' in tabsField)) {\n console.warn('🎨 Theme Management Plugin: Found tabs field but it has no tabs property')\n return existingFields\n }\n\n const existingTabs = (tabsField.tabs as TabConfig[]) || []\n\n // Remove existing theme tab if present\n const sanitizedTabs = removeExistingThemeTab(existingTabs)\n\n // Create new tabs field with our tab added\n const updatedTabsField = {\n ...tabsField,\n tabs: [...sanitizedTabs, themeTabConfig],\n }\n\n // Return fields array with updated tabs field\n const newFields = [...existingFields]\n newFields[tabsFieldIndex] = updatedTabsField\n\n return newFields\n}\n\nconst ensureCollectionsArray = (collections: Config['collections']): CollectionConfig[] =>\n Array.isArray(collections) ? collections : []\n\nexport const themeManagementPlugin = (options: ThemeManagementPluginOptions = {}): Plugin => {\n return (config: Config): Config => {\n const {\n enabled = true,\n targetCollection = 'site-settings',\n themePresets = defaultThemePresets,\n defaultTheme = 'cool',\n includeColorModeToggle = true,\n includeCustomCSS = true,\n includeBrandIdentity = false,\n enableAdvancedFeatures = true,\n enableLogging = false,\n } = options\n\n if (!enabled) {\n if (enableLogging) {\n console.log('🎨 Theme Management Plugin: disabled via options, skipping.')\n }\n return config\n }\n\n const themeTabConfig = createThemeConfigurationField({\n themePresets,\n defaultTheme,\n includeColorModeToggle,\n includeCustomCSS,\n includeBrandIdentity: includeBrandIdentity ?? false,\n enableAdvancedFeatures,\n })\n\n let collectionTouched = false\n\n const collections = ensureCollectionsArray(config.collections).map((collection) => {\n if (collection.slug !== targetCollection) {\n return collection\n }\n\n collectionTouched = true\n\n if (enableLogging) {\n console.log(`🎨 Theme Management Plugin: enhancing collection \"${collection.slug}\"`)\n }\n\n const existingFields = Array.isArray(collection.fields) ? collection.fields : []\n\n const fields = upsertThemeTab(existingFields, themeTabConfig, enableLogging)\n\n return {\n ...collection,\n fields,\n }\n })\n\n if (!collectionTouched) {\n if (enableLogging) {\n console.warn(\n `🎨 Theme Management Plugin: collection \"${targetCollection}\" was not found, leaving config untouched.`,\n )\n }\n return config\n }\n\n // Add custom admin view for theme preview\n const admin = {\n ...config.admin,\n components: {\n ...config.admin?.components,\n views: {\n ...config.admin?.components?.views,\n themePreview: {\n Component: '@kilivi/payloadcms-theme-management/views/ThemePreviewView#default',\n path: '/theme-preview' as `/${string}`,\n exact: true,\n meta: {\n title: 'Theme Preview',\n description: 'Real-time preview of your theme configuration',\n },\n },\n },\n },\n }\n\n return {\n ...config,\n collections,\n admin,\n }\n }\n}\n\ntype FetchOptionsInput = string | FetchThemeConfigurationOptions\n\nexport const fetchThemeConfiguration = async (\n options?: FetchOptionsInput,\n): Promise<SiteThemeConfiguration | null> => {\n const normalizedOptions = typeof options === 'string' ? { tenantSlug: options } : (options ?? {})\n\n const {\n tenantSlug,\n collectionSlug = 'site-settings',\n depth,\n locale,\n draft,\n queryParams = {},\n } = normalizedOptions\n\n const params = new URLSearchParams({ limit: '1' })\n\n if (typeof depth === 'number') params.set('depth', String(depth))\n if (tenantSlug) params.set('tenant', tenantSlug)\n if (locale) params.set('locale', locale)\n if (draft) params.set('draft', 'true')\n\n Object.entries(queryParams).forEach(([key, value]) => {\n if (value === undefined) return\n params.set(key, String(value))\n })\n\n const url = `/api/${collectionSlug}?${params.toString()}`\n\n try {\n const response = await fetch(url)\n if (!response.ok) {\n throw new Error(`Failed to fetch theme configuration (status ${response.status})`)\n }\n\n const data = (await response.json()) as {\n docs?: Array<{ themeConfiguration?: SiteThemeConfiguration }>\n }\n\n const doc = data.docs?.[0]\n\n return doc?.themeConfiguration ?? null\n } catch (error) {\n console.warn('Failed to fetch theme configuration:', error)\n return null\n }\n}\n\nexport const getThemePreset = (themeName: string): ThemePreset | null => {\n return defaultThemePresets.find((preset) => preset.name === themeName) || null\n}\n\nexport const getAvailableThemePresets = (): ThemePreset[] => {\n return defaultThemePresets\n}\n\nexport { defaultThemePresets } from './presets.js'\nexport type { ThemePreset, ThemeTypographyPreset } from './presets.js'\nexport {\n extendedThemePresets,\n allExtendedThemePresets,\n extendedThemeToCSSVariables,\n} from './extended-presets.js'\nexport type { ExtendedThemePreset, ShadcnColorTokens } from './extended-presets.js'\nexport {\n applyExtendedTheme,\n generateExtendedThemeCSS,\n resetExtendedTheme,\n getExtendedThemeTokens,\n createUseExtendedTheme,\n getTailwindVarReferences,\n} from './utils/extendedThemeHelpers.js'\nexport type { ThemeManagementPluginOptions, FetchThemeConfigurationOptions } from './types.js'\nexport {\n DEFAULT_THEME_CONFIGURATION,\n resolveThemeConfiguration,\n} from './utils/resolveThemeConfiguration.js'\nexport type { ResolvedThemeConfiguration } from './utils/resolveThemeConfiguration.js'\nexport { generateThemeColorsCss, hexToHsl } from './utils/themeColors.js'\nexport { generateThemeCSS, getThemeStyles } from './utils/themeUtils.js'\nexport { getThemeHtmlAttributes } from './utils/themeHtmlAttributes.js'\n\nexport type { Mode, ThemeDefaults } from './providers/Theme/types.js'\nexport { ThemeProvider } from './providers/Theme/index.js'\n\n// Font loading utilities for Next.js integration\nexport {\n getFontLoaderCode,\n getThemeFontFamilies,\n ThemeFontProvider,\n useThemeFonts,\n FONT_IMPORT_MAP,\n} from './providers/font-loader.js'\n\n// Components\nexport { ThemeLivePreview } from './fields/ThemeLivePreview.js'\n\nexport const ThemeManagementPlugin = themeManagementPlugin\n/** @deprecated use {@link themeManagementPlugin} */\nexport const themeConfigurationPlugin = themeManagementPlugin\n\nexport default themeManagementPlugin\n"],"names":["createThemeConfigurationField","defaultThemePresets","THEME_TAB_NAME","removeExistingThemeTab","tabs","filter","tab","name","upsertThemeTab","fields","themeTabConfig","enableLogging","existingFields","tabsFieldIndex","findIndex","field","type","console","log","label","admin","description","tabsField","warn","existingTabs","sanitizedTabs","updatedTabsField","newFields","ensureCollectionsArray","collections","Array","isArray","themeManagementPlugin","options","config","enabled","targetCollection","themePresets","defaultTheme","includeColorModeToggle","includeCustomCSS","includeBrandIdentity","enableAdvancedFeatures","collectionTouched","map","collection","slug","components","views","themePreview","Component","path","exact","meta","title","fetchThemeConfiguration","normalizedOptions","tenantSlug","collectionSlug","depth","locale","draft","queryParams","params","URLSearchParams","limit","set","String","Object","entries","forEach","key","value","undefined","url","toString","response","fetch","ok","Error","status","data","json","doc","docs","themeConfiguration","error","getThemePreset","themeName","find","preset","getAvailableThemePresets","extendedThemePresets","allExtendedThemePresets","extendedThemeToCSSVariables","applyExtendedTheme","generateExtendedThemeCSS","resetExtendedTheme","getExtendedThemeTokens","createUseExtendedTheme","getTailwindVarReferences","DEFAULT_THEME_CONFIGURATION","resolveThemeConfiguration","generateThemeColorsCss","hexToHsl","generateThemeCSS","getThemeStyles","getThemeHtmlAttributes","ThemeProvider","getFontLoaderCode","getThemeFontFamilies","ThemeFontProvider","useThemeFonts","FONT_IMPORT_MAP","ThemeLivePreview","ThemeManagementPlugin","themeConfigurationPlugin"],"mappings":"AACA,SAASA,6BAA6B,QAAQ,sCAAqC;AAGnF,SAASC,mBAAmB,QAAQ,eAAc;AAGlD,MAAMC,iBAAiB;AASvB;;CAEC,GACD,MAAMC,yBAAyB,CAACC,OAC9BA,KAAKC,MAAM,CAAC,CAACC,MAAQA,KAAKC,SAASL;AAErC;;CAEC,GACD,MAAMM,iBAAiB,CACrBC,QACAC,gBACAC;IAEA,MAAMC,iBAAiBH,UAAU,EAAE;IAEnC,2BAA2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,SAASA,mBAAmB,QAAQ,eAAc;AAElD,SACE2F,oBAAoB,EACpBC,uBAAuB,EACvBC,2BAA2B,QACtB,wBAAuB;AAE9B,SACEC,kBAAkB,EAClBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,QACnB,kCAAiC;AAExC,SACEC,2BAA2B,EAC3BC,yBAAyB,QACpB,uCAAsC;AAE7C,SAASC,sBAAsB,EAAEC,QAAQ,QAAQ,yBAAwB;AACzE,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,wBAAuB;AACxE,SAASC,sBAAsB,QAAQ,iCAAgC;AAGvE,SAASC,aAAa,QAAQ,6BAA4B;AAE1D,iDAAiD;AACjD,SACEC,iBAAiB,EACjBC,oBAAoB,EACpBC,iBAAiB,EACjBC,aAAa,EACbC,eAAe,QACV,6BAA4B;AAEnC,aAAa;AACb,SAASC,gBAAgB,QAAQ,+BAA8B;AAE/D,OAAO,MAAMC,wBAAwBnF,sBAAqB;AAC1D,kDAAkD,GAClD,OAAO,MAAMoF,2BAA2BpF,sBAAqB;AAE7D,eAAeA,sBAAqB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js Font Loader Utilities
|
|
3
|
+
*
|
|
4
|
+
* This file provides utilities for loading Google Fonts in Next.js applications
|
|
5
|
+
* based on theme configuration from the CMS.
|
|
6
|
+
*
|
|
7
|
+
* ## Usage Guide
|
|
8
|
+
*
|
|
9
|
+
* ### 1. Static Font Loading (Recommended)
|
|
10
|
+
*
|
|
11
|
+
* In your Next.js app's root layout:
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // app/layout.tsx
|
|
15
|
+
* import { Inter, Playfair_Display } from 'next/font/google'
|
|
16
|
+
*
|
|
17
|
+
* const inter = Inter({
|
|
18
|
+
* subsets: ['latin'],
|
|
19
|
+
* variable: '--font-body',
|
|
20
|
+
* display: 'swap',
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* const playfair = Playfair_Display({
|
|
24
|
+
* subsets: ['latin'],
|
|
25
|
+
* variable: '--font-heading',
|
|
26
|
+
* display: 'swap',
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
30
|
+
* return (
|
|
31
|
+
* <html lang="en" className={`${inter.variable} ${playfair.variable}`}>
|
|
32
|
+
* <body>{children}</body>
|
|
33
|
+
* </html>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ### 2. CSS Variables Usage
|
|
39
|
+
*
|
|
40
|
+
* In your global CSS:
|
|
41
|
+
*
|
|
42
|
+
* ```css
|
|
43
|
+
* :root {
|
|
44
|
+
* --font-body: var(--font-inter), system-ui, sans-serif;
|
|
45
|
+
* --font-heading: var(--font-playfair), Georgia, serif;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* body {
|
|
49
|
+
* font-family: var(--font-body);
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* h1, h2, h3, h4, h5, h6 {
|
|
53
|
+
* font-family: var(--font-heading);
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* ### 3. Dynamic Font Loading
|
|
58
|
+
*
|
|
59
|
+
* Use the helper functions below to generate font loader code:
|
|
60
|
+
*
|
|
61
|
+
* ```tsx
|
|
62
|
+
* import { getFontLoaderCode } from '@kilivi/payloadcms-theme-management/providers/font-loader'
|
|
63
|
+
*
|
|
64
|
+
* const themeConfig = await getThemeConfig()
|
|
65
|
+
* const fontCode = getFontLoaderCode(themeConfig)
|
|
66
|
+
* console.log(fontCode) // Copy this to your layout.tsx
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
interface ThemeConfig {
|
|
70
|
+
bodyFont?: string;
|
|
71
|
+
headingFont?: string;
|
|
72
|
+
bodyFontCustom?: string;
|
|
73
|
+
headingFontCustom?: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Font mapping for next/font/google imports
|
|
77
|
+
* Maps theme font values to Next.js font imports
|
|
78
|
+
*/
|
|
79
|
+
export declare const FONT_IMPORT_MAP: Record<string, {
|
|
80
|
+
import: string;
|
|
81
|
+
variable: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Generate Next.js font loader code for your layout
|
|
85
|
+
*
|
|
86
|
+
* @param config - Theme configuration from CMS
|
|
87
|
+
* @returns String with complete Next.js font loading code
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```tsx
|
|
91
|
+
* const code = getFontLoaderCode({ bodyFont: 'Inter', headingFont: 'Playfair Display' })
|
|
92
|
+
* console.log(code)
|
|
93
|
+
* // Copy the output to your app/layout.tsx file
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function getFontLoaderCode(config: ThemeConfig): string;
|
|
97
|
+
/**
|
|
98
|
+
* Get font family CSS strings for inline styles
|
|
99
|
+
*
|
|
100
|
+
* @param config - Theme configuration
|
|
101
|
+
* @returns Object with bodyFont and headingFont CSS font-family strings
|
|
102
|
+
*/
|
|
103
|
+
export declare function getThemeFontFamilies(config: ThemeConfig): {
|
|
104
|
+
bodyFont?: string;
|
|
105
|
+
headingFont?: string;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* React component wrapper for font variables
|
|
109
|
+
* Use this to inject font CSS variables into your app
|
|
110
|
+
*/
|
|
111
|
+
export declare function ThemeFontProvider({ children, bodyFont, headingFont, bodyFontCustom, headingFontCustom, }: {
|
|
112
|
+
children: React.ReactNode;
|
|
113
|
+
bodyFont?: string;
|
|
114
|
+
headingFont?: string;
|
|
115
|
+
bodyFontCustom?: string;
|
|
116
|
+
headingFontCustom?: string;
|
|
117
|
+
}): import("react").JSX.Element;
|
|
118
|
+
/**
|
|
119
|
+
* Client-side hook for accessing theme fonts
|
|
120
|
+
* Use this in client components to read font CSS variables
|
|
121
|
+
*/
|
|
122
|
+
export declare function useThemeFonts(): {
|
|
123
|
+
bodyFont: string;
|
|
124
|
+
headingFont: string;
|
|
125
|
+
};
|
|
126
|
+
export {};
|
|
127
|
+
//# sourceMappingURL=font-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"font-loader.d.ts","sourceRoot":"","sources":["../../src/providers/font-loader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAyChF,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CA+B7D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAkBA;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,cAAc,EACd,iBAAiB,GAClB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,+BAeA;AAED;;;GAGG;AACH,wBAAgB,aAAa;;;EAY5B"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js Font Loader Utilities
|
|
3
|
+
*
|
|
4
|
+
* This file provides utilities for loading Google Fonts in Next.js applications
|
|
5
|
+
* based on theme configuration from the CMS.
|
|
6
|
+
*
|
|
7
|
+
* ## Usage Guide
|
|
8
|
+
*
|
|
9
|
+
* ### 1. Static Font Loading (Recommended)
|
|
10
|
+
*
|
|
11
|
+
* In your Next.js app's root layout:
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* // app/layout.tsx
|
|
15
|
+
* import { Inter, Playfair_Display } from 'next/font/google'
|
|
16
|
+
*
|
|
17
|
+
* const inter = Inter({
|
|
18
|
+
* subsets: ['latin'],
|
|
19
|
+
* variable: '--font-body',
|
|
20
|
+
* display: 'swap',
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* const playfair = Playfair_Display({
|
|
24
|
+
* subsets: ['latin'],
|
|
25
|
+
* variable: '--font-heading',
|
|
26
|
+
* display: 'swap',
|
|
27
|
+
* })
|
|
28
|
+
*
|
|
29
|
+
* export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
30
|
+
* return (
|
|
31
|
+
* <html lang="en" className={`${inter.variable} ${playfair.variable}`}>
|
|
32
|
+
* <body>{children}</body>
|
|
33
|
+
* </html>
|
|
34
|
+
* )
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* ### 2. CSS Variables Usage
|
|
39
|
+
*
|
|
40
|
+
* In your global CSS:
|
|
41
|
+
*
|
|
42
|
+
* ```css
|
|
43
|
+
* :root {
|
|
44
|
+
* --font-body: var(--font-inter), system-ui, sans-serif;
|
|
45
|
+
* --font-heading: var(--font-playfair), Georgia, serif;
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* body {
|
|
49
|
+
* font-family: var(--font-body);
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* h1, h2, h3, h4, h5, h6 {
|
|
53
|
+
* font-family: var(--font-heading);
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* ### 3. Dynamic Font Loading
|
|
58
|
+
*
|
|
59
|
+
* Use the helper functions below to generate font loader code:
|
|
60
|
+
*
|
|
61
|
+
* ```tsx
|
|
62
|
+
* import { getFontLoaderCode } from '@kilivi/payloadcms-theme-management/providers/font-loader'
|
|
63
|
+
*
|
|
64
|
+
* const themeConfig = await getThemeConfig()
|
|
65
|
+
* const fontCode = getFontLoaderCode(themeConfig)
|
|
66
|
+
* console.log(fontCode) // Copy this to your layout.tsx
|
|
67
|
+
* ```
|
|
68
|
+
*/ import { jsx as _jsx } from "react/jsx-runtime";
|
|
69
|
+
/**
|
|
70
|
+
* Font mapping for next/font/google imports
|
|
71
|
+
* Maps theme font values to Next.js font imports
|
|
72
|
+
*/ export const FONT_IMPORT_MAP = {
|
|
73
|
+
Inter: {
|
|
74
|
+
import: `import { Inter } from 'next/font/google'\nconst inter = Inter({ subsets: ['latin'], variable: '--font-body' })`,
|
|
75
|
+
variable: 'inter.variable'
|
|
76
|
+
},
|
|
77
|
+
Roboto: {
|
|
78
|
+
import: `import { Roboto } from 'next/font/google'\nconst roboto = Roboto({ weight: ['400', '500', '700'], subsets: ['latin'], variable: '--font-body' })`,
|
|
79
|
+
variable: 'roboto.variable'
|
|
80
|
+
},
|
|
81
|
+
'Open Sans': {
|
|
82
|
+
import: `import { Open_Sans } from 'next/font/google'\nconst openSans = Open_Sans({ subsets: ['latin'], variable: '--font-body' })`,
|
|
83
|
+
variable: 'openSans.variable'
|
|
84
|
+
},
|
|
85
|
+
Lato: {
|
|
86
|
+
import: `import { Lato } from 'next/font/google'\nconst lato = Lato({ weight: ['400', '700'], subsets: ['latin'], variable: '--font-body' })`,
|
|
87
|
+
variable: 'lato.variable'
|
|
88
|
+
},
|
|
89
|
+
Montserrat: {
|
|
90
|
+
import: `import { Montserrat } from 'next/font/google'\nconst montserrat = Montserrat({ subsets: ['latin'], variable: '--font-body' })`,
|
|
91
|
+
variable: 'montserrat.variable'
|
|
92
|
+
},
|
|
93
|
+
Poppins: {
|
|
94
|
+
import: `import { Poppins } from 'next/font/google'\nconst poppins = Poppins({ weight: ['400', '500', '600', '700'], subsets: ['latin'], variable: '--font-body' })`,
|
|
95
|
+
variable: 'poppins.variable'
|
|
96
|
+
},
|
|
97
|
+
'Playfair Display': {
|
|
98
|
+
import: `import { Playfair_Display } from 'next/font/google'\nconst playfair = Playfair_Display({ subsets: ['latin'], variable: '--font-heading' })`,
|
|
99
|
+
variable: 'playfair.variable'
|
|
100
|
+
},
|
|
101
|
+
Merriweather: {
|
|
102
|
+
import: `import { Merriweather } from 'next/font/google'\nconst merriweather = Merriweather({ weight: ['400', '700'], subsets: ['latin'], variable: '--font-heading' })`,
|
|
103
|
+
variable: 'merriweather.variable'
|
|
104
|
+
},
|
|
105
|
+
Lora: {
|
|
106
|
+
import: `import { Lora } from 'next/font/google'\nconst lora = Lora({ subsets: ['latin'], variable: '--font-heading' })`,
|
|
107
|
+
variable: 'lora.variable'
|
|
108
|
+
},
|
|
109
|
+
'Crimson Text': {
|
|
110
|
+
import: `import { Crimson_Text } from 'next/font/google'\nconst crimsonText = Crimson_Text({ weight: ['400', '600', '700'], subsets: ['latin'], variable: '--font-heading' })`,
|
|
111
|
+
variable: 'crimsonText.variable'
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Generate Next.js font loader code for your layout
|
|
116
|
+
*
|
|
117
|
+
* @param config - Theme configuration from CMS
|
|
118
|
+
* @returns String with complete Next.js font loading code
|
|
119
|
+
*
|
|
120
|
+
* @example
|
|
121
|
+
* ```tsx
|
|
122
|
+
* const code = getFontLoaderCode({ bodyFont: 'Inter', headingFont: 'Playfair Display' })
|
|
123
|
+
* console.log(code)
|
|
124
|
+
* // Copy the output to your app/layout.tsx file
|
|
125
|
+
* ```
|
|
126
|
+
*/ export function getFontLoaderCode(config) {
|
|
127
|
+
const imports = [];
|
|
128
|
+
const variables = [];
|
|
129
|
+
if (config.bodyFont && config.bodyFont !== 'preset' && config.bodyFont !== 'custom') {
|
|
130
|
+
const fontConfig = FONT_IMPORT_MAP[config.bodyFont];
|
|
131
|
+
if (fontConfig) {
|
|
132
|
+
imports.push(fontConfig.import);
|
|
133
|
+
variables.push(fontConfig.variable);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (config.headingFont && config.headingFont !== 'preset' && config.headingFont !== 'custom') {
|
|
137
|
+
const fontConfig = FONT_IMPORT_MAP[config.headingFont];
|
|
138
|
+
if (fontConfig) {
|
|
139
|
+
imports.push(fontConfig.import);
|
|
140
|
+
variables.push(fontConfig.variable);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return `// app/layout.tsx
|
|
144
|
+
${imports.join('\n\n')}
|
|
145
|
+
|
|
146
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
147
|
+
return (
|
|
148
|
+
<html lang="en" className={\`${variables.join(' ')}\`}>
|
|
149
|
+
<body>{children}</body>
|
|
150
|
+
</html>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Get font family CSS strings for inline styles
|
|
157
|
+
*
|
|
158
|
+
* @param config - Theme configuration
|
|
159
|
+
* @returns Object with bodyFont and headingFont CSS font-family strings
|
|
160
|
+
*/ export function getThemeFontFamilies(config) {
|
|
161
|
+
const result = {};
|
|
162
|
+
// Body font
|
|
163
|
+
if (config.bodyFont === 'custom' && config.bodyFontCustom) {
|
|
164
|
+
result.bodyFont = config.bodyFontCustom;
|
|
165
|
+
} else if (config.bodyFont && config.bodyFont !== 'preset') {
|
|
166
|
+
result.bodyFont = `var(--font-body), ${config.bodyFont}, sans-serif`;
|
|
167
|
+
}
|
|
168
|
+
// Heading font
|
|
169
|
+
if (config.headingFont === 'custom' && config.headingFontCustom) {
|
|
170
|
+
result.headingFont = config.headingFontCustom;
|
|
171
|
+
} else if (config.headingFont && config.headingFont !== 'preset') {
|
|
172
|
+
result.headingFont = `var(--font-heading), ${config.headingFont}, serif`;
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* React component wrapper for font variables
|
|
178
|
+
* Use this to inject font CSS variables into your app
|
|
179
|
+
*/ export function ThemeFontProvider({ children, bodyFont, headingFont, bodyFontCustom, headingFontCustom }) {
|
|
180
|
+
const fonts = getThemeFontFamilies({
|
|
181
|
+
bodyFont,
|
|
182
|
+
headingFont,
|
|
183
|
+
bodyFontCustom,
|
|
184
|
+
headingFontCustom
|
|
185
|
+
});
|
|
186
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
187
|
+
style: {
|
|
188
|
+
'--font-body': fonts.bodyFont,
|
|
189
|
+
'--font-heading': fonts.headingFont
|
|
190
|
+
},
|
|
191
|
+
children: children
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Client-side hook for accessing theme fonts
|
|
196
|
+
* Use this in client components to read font CSS variables
|
|
197
|
+
*/ export function useThemeFonts() {
|
|
198
|
+
if (typeof window === 'undefined') {
|
|
199
|
+
return {
|
|
200
|
+
bodyFont: undefined,
|
|
201
|
+
headingFont: undefined
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
const bodyFont = getComputedStyle(document.documentElement).getPropertyValue('--font-body');
|
|
205
|
+
const headingFont = getComputedStyle(document.documentElement).getPropertyValue('--font-heading');
|
|
206
|
+
return {
|
|
207
|
+
bodyFont: bodyFont || undefined,
|
|
208
|
+
headingFont: headingFont || undefined
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
//# sourceMappingURL=font-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/providers/font-loader.tsx"],"sourcesContent":["/**\n * Next.js Font Loader Utilities\n *\n * This file provides utilities for loading Google Fonts in Next.js applications\n * based on theme configuration from the CMS.\n *\n * ## Usage Guide\n *\n * ### 1. Static Font Loading (Recommended)\n *\n * In your Next.js app's root layout:\n *\n * ```tsx\n * // app/layout.tsx\n * import { Inter, Playfair_Display } from 'next/font/google'\n *\n * const inter = Inter({\n * subsets: ['latin'],\n * variable: '--font-body',\n * display: 'swap',\n * })\n *\n * const playfair = Playfair_Display({\n * subsets: ['latin'],\n * variable: '--font-heading',\n * display: 'swap',\n * })\n *\n * export default function RootLayout({ children }: { children: React.ReactNode }) {\n * return (\n * <html lang=\"en\" className={`${inter.variable} ${playfair.variable}`}>\n * <body>{children}</body>\n * </html>\n * )\n * }\n * ```\n *\n * ### 2. CSS Variables Usage\n *\n * In your global CSS:\n *\n * ```css\n * :root {\n * --font-body: var(--font-inter), system-ui, sans-serif;\n * --font-heading: var(--font-playfair), Georgia, serif;\n * }\n *\n * body {\n * font-family: var(--font-body);\n * }\n *\n * h1, h2, h3, h4, h5, h6 {\n * font-family: var(--font-heading);\n * }\n * ```\n *\n * ### 3. Dynamic Font Loading\n *\n * Use the helper functions below to generate font loader code:\n *\n * ```tsx\n * import { getFontLoaderCode } from '@kilivi/payloadcms-theme-management/providers/font-loader'\n *\n * const themeConfig = await getThemeConfig()\n * const fontCode = getFontLoaderCode(themeConfig)\n * console.log(fontCode) // Copy this to your layout.tsx\n * ```\n */\n\ninterface ThemeConfig {\n bodyFont?: string\n headingFont?: string\n bodyFontCustom?: string\n headingFontCustom?: string\n}\n\n/**\n * Font mapping for next/font/google imports\n * Maps theme font values to Next.js font imports\n */\nexport const FONT_IMPORT_MAP: Record<string, { import: string; variable: string }> = {\n Inter: {\n import: `import { Inter } from 'next/font/google'\\nconst inter = Inter({ subsets: ['latin'], variable: '--font-body' })`,\n variable: 'inter.variable',\n },\n Roboto: {\n import: `import { Roboto } from 'next/font/google'\\nconst roboto = Roboto({ weight: ['400', '500', '700'], subsets: ['latin'], variable: '--font-body' })`,\n variable: 'roboto.variable',\n },\n 'Open Sans': {\n import: `import { Open_Sans } from 'next/font/google'\\nconst openSans = Open_Sans({ subsets: ['latin'], variable: '--font-body' })`,\n variable: 'openSans.variable',\n },\n Lato: {\n import: `import { Lato } from 'next/font/google'\\nconst lato = Lato({ weight: ['400', '700'], subsets: ['latin'], variable: '--font-body' })`,\n variable: 'lato.variable',\n },\n Montserrat: {\n import: `import { Montserrat } from 'next/font/google'\\nconst montserrat = Montserrat({ subsets: ['latin'], variable: '--font-body' })`,\n variable: 'montserrat.variable',\n },\n Poppins: {\n import: `import { Poppins } from 'next/font/google'\\nconst poppins = Poppins({ weight: ['400', '500', '600', '700'], subsets: ['latin'], variable: '--font-body' })`,\n variable: 'poppins.variable',\n },\n 'Playfair Display': {\n import: `import { Playfair_Display } from 'next/font/google'\\nconst playfair = Playfair_Display({ subsets: ['latin'], variable: '--font-heading' })`,\n variable: 'playfair.variable',\n },\n Merriweather: {\n import: `import { Merriweather } from 'next/font/google'\\nconst merriweather = Merriweather({ weight: ['400', '700'], subsets: ['latin'], variable: '--font-heading' })`,\n variable: 'merriweather.variable',\n },\n Lora: {\n import: `import { Lora } from 'next/font/google'\\nconst lora = Lora({ subsets: ['latin'], variable: '--font-heading' })`,\n variable: 'lora.variable',\n },\n 'Crimson Text': {\n import: `import { Crimson_Text } from 'next/font/google'\\nconst crimsonText = Crimson_Text({ weight: ['400', '600', '700'], subsets: ['latin'], variable: '--font-heading' })`,\n variable: 'crimsonText.variable',\n },\n}\n\n/**\n * Generate Next.js font loader code for your layout\n *\n * @param config - Theme configuration from CMS\n * @returns String with complete Next.js font loading code\n *\n * @example\n * ```tsx\n * const code = getFontLoaderCode({ bodyFont: 'Inter', headingFont: 'Playfair Display' })\n * console.log(code)\n * // Copy the output to your app/layout.tsx file\n * ```\n */\nexport function getFontLoaderCode(config: ThemeConfig): string {\n const imports: string[] = []\n const variables: string[] = []\n\n if (config.bodyFont && config.bodyFont !== 'preset' && config.bodyFont !== 'custom') {\n const fontConfig = FONT_IMPORT_MAP[config.bodyFont]\n if (fontConfig) {\n imports.push(fontConfig.import)\n variables.push(fontConfig.variable)\n }\n }\n\n if (config.headingFont && config.headingFont !== 'preset' && config.headingFont !== 'custom') {\n const fontConfig = FONT_IMPORT_MAP[config.headingFont]\n if (fontConfig) {\n imports.push(fontConfig.import)\n variables.push(fontConfig.variable)\n }\n }\n\n return `// app/layout.tsx\n${imports.join('\\n\\n')}\n\nexport default function RootLayout({ children }: { children: React.ReactNode }) {\n return (\n <html lang=\"en\" className={\\`${variables.join(' ')}\\`}>\n <body>{children}</body>\n </html>\n )\n}\n`\n}\n\n/**\n * Get font family CSS strings for inline styles\n *\n * @param config - Theme configuration\n * @returns Object with bodyFont and headingFont CSS font-family strings\n */\nexport function getThemeFontFamilies(config: ThemeConfig): {\n bodyFont?: string\n headingFont?: string\n} {\n const result: { bodyFont?: string; headingFont?: string } = {}\n\n // Body font\n if (config.bodyFont === 'custom' && config.bodyFontCustom) {\n result.bodyFont = config.bodyFontCustom\n } else if (config.bodyFont && config.bodyFont !== 'preset') {\n result.bodyFont = `var(--font-body), ${config.bodyFont}, sans-serif`\n }\n\n // Heading font\n if (config.headingFont === 'custom' && config.headingFontCustom) {\n result.headingFont = config.headingFontCustom\n } else if (config.headingFont && config.headingFont !== 'preset') {\n result.headingFont = `var(--font-heading), ${config.headingFont}, serif`\n }\n\n return result\n}\n\n/**\n * React component wrapper for font variables\n * Use this to inject font CSS variables into your app\n */\nexport function ThemeFontProvider({\n children,\n bodyFont,\n headingFont,\n bodyFontCustom,\n headingFontCustom,\n}: {\n children: React.ReactNode\n bodyFont?: string\n headingFont?: string\n bodyFontCustom?: string\n headingFontCustom?: string\n}) {\n const fonts = getThemeFontFamilies({ bodyFont, headingFont, bodyFontCustom, headingFontCustom })\n\n return (\n <div\n style={\n {\n '--font-body': fonts.bodyFont,\n '--font-heading': fonts.headingFont,\n } as React.CSSProperties\n }\n >\n {children}\n </div>\n )\n}\n\n/**\n * Client-side hook for accessing theme fonts\n * Use this in client components to read font CSS variables\n */\nexport function useThemeFonts() {\n if (typeof window === 'undefined') {\n return { bodyFont: undefined, headingFont: undefined }\n }\n\n const bodyFont = getComputedStyle(document.documentElement).getPropertyValue('--font-body')\n const headingFont = getComputedStyle(document.documentElement).getPropertyValue('--font-heading')\n\n return {\n bodyFont: bodyFont || undefined,\n headingFont: headingFont || undefined,\n }\n}\n"],"names":["FONT_IMPORT_MAP","Inter","import","variable","Roboto","Lato","Montserrat","Poppins","Merriweather","Lora","getFontLoaderCode","config","imports","variables","bodyFont","fontConfig","push","headingFont","join","getThemeFontFamilies","result","bodyFontCustom","headingFontCustom","ThemeFontProvider","children","fonts","div","style","useThemeFonts","window","undefined","getComputedStyle","document","documentElement","getPropertyValue"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEC;AASD;;;CAGC,GACD,OAAO,MAAMA,kBAAwE;IACnFC,OAAO;QACLC,QAAQ,CAAC,8GAA8G,CAAC;QACxHC,UAAU;IACZ;IACAC,QAAQ;QACNF,QAAQ,CAAC,gJAAgJ,CAAC;QAC1JC,UAAU;IACZ;IACA,aAAa;QACXD,QAAQ,CAAC,yHAAyH,CAAC;QACnIC,UAAU;IACZ;IACAE,MAAM;QACJH,QAAQ,CAAC,mIAAmI,CAAC;QAC7IC,UAAU;IACZ;IACAG,YAAY;QACVJ,QAAQ,CAAC,6HAA6H,CAAC;QACvIC,UAAU;IACZ;IACAI,SAAS;QACPL,QAAQ,CAAC,0JAA0J,CAAC;QACpKC,UAAU;IACZ;IACA,oBAAoB;QAClBD,QAAQ,CAAC,0IAA0I,CAAC;QACpJC,UAAU;IACZ;IACAK,cAAc;QACZN,QAAQ,CAAC,8JAA8J,CAAC;QACxKC,UAAU;IACZ;IACAM,MAAM;QACJP,QAAQ,CAAC,8GAA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AAK,YAAYN,OAAOW,iBAAiB,EAAE;QAC/DF,OAAOH,WAAW,GAAGN,OAAOW,iBAAiB;IAC/C,OAAO,IAAIX,OAAOM,WAAW,IAAIN,OAAOM,WAAW,KAAK,UAAU;QAChEG,OAAOH,WAAW,GAAG,CAAC,qBAAqB,EAAEN,OAAOM,WAAW,CAAC,OAAO,CAAC;IAC1E;IAEA,OAAOG;AACT;AAEA;;;CAGC,GACD,OAAO,SAASG,kBAAkB,EAChCC,QAAQ,EACRV,QAAQ,EACRG,WAAW,EACXI,cAAc,EACdC,iBAAiB,EAOlB;IACC,MAAMG,QAAQN,qBAAqB;QAAEL;QAAUG;QAAaI;QAAgBC;IAAkB;IAE9F,qBACE,KAACI;QACCC,OACE;YACE,eAAeF,MAAMX,QAAQ;YAC7B,kBAAkBW,MAAMR,WAAW;QACrC;kBAGDO;;AAGP;AAEA;;;CAGC,GACD,OAAO,SAASI;IACd,IAAI,OAAOC,WAAW,aAAa;QACjC,OAAO;YAAEf,UAAUgB;YAAWb,aAAaa;QAAU;IACvD;IAEA,MAAMhB,WAAWiB,iBAAiBC,SAASC,eAAe,EAAEC,gBAAgB,CAAC;IAC7E,MAAMjB,cAAcc,iBAAiBC,SAASC,eAAe,EAAEC,gBAAgB,CAAC;IAEhF,OAAO;QACLpB,UAAUA,YAAYgB;QACtBb,aAAaA,eAAea;IAC9B;AACF"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThemePresetSelectField.d.ts","sourceRoot":"","sources":["../../src/fields/ThemePresetSelectField.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAA;AAIzD,QAAA,MAAM,sBAAsB,EAAE,0BAsO7B,CAAA;AAED,eAAe,sBAAsB,CAAA"}
|