@webstrail/ui-library 1.0.2 → 1.0.3
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -6
- package/dist/index.js +1248 -817
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -19
- package/dist/UIProvider-C3ae0nQV.cjs +0 -2
- package/dist/UIProvider-C3ae0nQV.cjs.map +0 -1
- package/dist/UIProvider-CHECrDaZ.js +0 -466
- package/dist/UIProvider-CHECrDaZ.js.map +0 -1
- package/dist/core/config/globalConfig.d.ts +0 -54
- package/dist/core/config/index.d.ts +0 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/theme/defaultTheme.d.ts +0 -7
- package/dist/core/theme/deriveTokens.d.ts +0 -16
- package/dist/core/theme/index.d.ts +0 -2
- package/dist/core/types/common.d.ts +0 -32
- package/dist/core/types/config.d.ts +0 -70
- package/dist/core/types/index.d.ts +0 -3
- package/dist/core/types/tokens.d.ts +0 -65
- package/dist/core/utils/styles.d.ts +0 -19
- package/dist/core.cjs +0 -2
- package/dist/core.cjs.map +0 -1
- package/dist/core.js +0 -344
- package/dist/core.js.map +0 -1
- package/dist/react/components/Button/Button.d.ts +0 -2
- package/dist/react/components/Button/Button.types.d.ts +0 -52
- package/dist/react/components/Button/index.d.ts +0 -2
- package/dist/react/index.d.ts +0 -6
- package/dist/react.cjs +0 -2
- package/dist/react.cjs.map +0 -1
- package/dist/react.js +0 -9
- package/dist/react.js.map +0 -1
- package/dist/web-components/button/button.element.d.ts +0 -59
- package/dist/web-components/button/button.styles.d.ts +0 -1
- package/dist/web-components/button/button.types.d.ts +0 -21
- package/dist/web-components/button/index.d.ts +0 -3
- package/dist/web-components/index.d.ts +0 -1
- package/dist/web-components.cjs +0 -269
- package/dist/web-components.cjs.map +0 -1
- package/dist/web-components.js +0 -503
- package/dist/web-components.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UIProvider-CHECrDaZ.js","sources":["../src/config/defaultConfig.ts","../src/context/UIContext.tsx","../src/hooks/useUI.ts","../src/config/mergeConfig.ts","../src/utils/resolveStyles.ts","../src/hooks/useComponentStyles.ts","../src/react/components/Button/Button.tsx","../src/providers/UIProvider.tsx"],"sourcesContent":["import type { UIConfig } from './config.types';\r\n\r\nexport const defaultUIConfig: UIConfig = {\r\n colors: {\r\n primary: '#2491eb',\r\n secondary: '#406993',\r\n text: '#1f2937',\r\n textSecondary: '#6b7280',\r\n border: '#d1d5db',\r\n background: '#ffffff',\r\n error: '#dc2626',\r\n success: '#16a34a',\r\n disabled: '#9ca3af',\r\n disabledBackground: '#f3f4f6',\r\n disabledText: '#9ca3af',\r\n focusRing: 'rgba(36, 145, 235, 0.35)',\r\n },\r\n typography: {\r\n fontFamily:\r\n 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif',\r\n fontSizeSmall: '12px',\r\n fontSizeMedium: '14px',\r\n fontSizeLarge: '16px',\r\n fontWeightNormal: 400,\r\n fontWeightMedium: 500,\r\n fontWeightBold: 600,\r\n },\r\n layout: {\r\n borderRadiusSmall: '6px',\r\n borderRadiusMedium: '8px',\r\n borderRadiusLarge: '12px',\r\n },\r\n button: {\r\n height: '40px',\r\n borderRadius: '8px',\r\n fontSize: '14px',\r\n fontWeight: 500,\r\n backgroundColor: '#2491eb',\r\n textColor: '#ffffff',\r\n borderColor: 'transparent',\r\n hoverBackgroundColor: '#1d78c4',\r\n hoverTextColor: '#ffffff',\r\n activeBackgroundColor: '#1565a0',\r\n disabledBackgroundColor: '#f3f4f6',\r\n disabledTextColor: '#9ca3af',\r\n disabledBorderColor: '#e5e7eb',\r\n focusRingColor: 'rgba(36, 145, 235, 0.35)',\r\n padding: '0 16px',\r\n transition: 'all 0.15s ease-in-out',\r\n },\r\n input: {\r\n height: '42px',\r\n borderRadius: '8px',\r\n borderColor: '#d1d5db',\r\n textColor: '#1f2937',\r\n placeholderColor: '#9ca3af',\r\n backgroundColor: '#ffffff',\r\n focusBorderColor: '#2491eb',\r\n focusRingColor: 'rgba(36, 145, 235, 0.25)',\r\n errorBorderColor: '#dc2626',\r\n disabledBackgroundColor: '#f3f4f6',\r\n disabledTextColor: '#9ca3af',\r\n disabledBorderColor: '#e5e7eb',\r\n labelColor: '#374151',\r\n helperColor: '#6b7280',\r\n errorColor: '#dc2626',\r\n fontSize: '14px',\r\n padding: '0 14px',\r\n floatingLabel: true,\r\n },\r\n select: {\r\n height: '42px',\r\n borderRadius: '8px',\r\n borderColor: '#d1d5db',\r\n textColor: '#1f2937',\r\n placeholderColor: '#9ca3af',\r\n backgroundColor: '#ffffff',\r\n focusBorderColor: '#2491eb',\r\n focusRingColor: 'rgba(36, 145, 235, 0.25)',\r\n errorBorderColor: '#dc2626',\r\n disabledBackgroundColor: '#f3f4f6',\r\n disabledTextColor: '#9ca3af',\r\n dropdownBackgroundColor: '#ffffff',\r\n dropdownBorderColor: '#e5e7eb',\r\n dropdownShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)',\r\n optionTextColor: '#1f2937',\r\n optionHoverBackgroundColor: '#f3f4f6',\r\n optionHoverTextColor: '#1f2937',\r\n optionSelectedBackgroundColor: '#eff6ff',\r\n optionSelectedTextColor: '#2491eb',\r\n optionSelectedHoverBackgroundColor: '#dbeafe',\r\n optionCheckColor: '#2491eb',\r\n optionBorderRadius: '6px',\r\n optionPadding: '8px 12px',\r\n optionFontSize: '14px',\r\n optionFontWeight: 400,\r\n optionSelectedFontWeight: 500,\r\n labelColor: '#374151',\r\n errorColor: '#dc2626',\r\n fontSize: '14px',\r\n floatingLabel: true,\r\n },\r\n checkbox: {\r\n size: '18px',\r\n borderRadius: '4px',\r\n borderColor: '#d1d5db',\r\n checkedColor: '#2491eb',\r\n checkmarkColor: '#ffffff',\r\n backgroundColor: '#ffffff',\r\n focusRingColor: 'rgba(36, 145, 235, 0.35)',\r\n disabledColor: '#d1d5db',\r\n disabledBackgroundColor: '#f3f4f6',\r\n labelColor: '#1f2937',\r\n fontSize: '14px',\r\n },\r\n textarea: {\r\n minHeight: '100px',\r\n borderRadius: '8px',\r\n borderColor: '#d1d5db',\r\n textColor: '#1f2937',\r\n placeholderColor: '#9ca3af',\r\n backgroundColor: '#ffffff',\r\n focusBorderColor: '#2491eb',\r\n focusRingColor: 'rgba(36, 145, 235, 0.25)',\r\n errorBorderColor: '#dc2626',\r\n disabledBackgroundColor: '#f3f4f6',\r\n disabledTextColor: '#9ca3af',\r\n disabledBorderColor: '#e5e7eb',\r\n labelColor: '#374151',\r\n helperColor: '#6b7280',\r\n errorColor: '#dc2626',\r\n counterColor: '#9ca3af',\r\n fontSize: '14px',\r\n padding: '10px 14px',\r\n floatingLabel: true,\r\n },\r\n radio: {\r\n size: '18px',\r\n color: '#2491eb',\r\n checkedColor: '#2491eb',\r\n labelColor: '#1f2937',\r\n descriptionColor: '#6b7280',\r\n fontSize: '14px',\r\n },\r\n switch: {\r\n width: '40px',\r\n height: '22px',\r\n thumbSize: '16px',\r\n thumbColor: '#ffffff',\r\n trackColor: '#e2e8f0',\r\n trackCheckedColor: '#2491eb',\r\n focusRingColor: 'rgba(36, 145, 235, 0.35)',\r\n borderRadius: '9999px',\r\n disabledOpacity: 0.5,\r\n labelColor: '#1f2937',\r\n descriptionColor: '#6b7280',\r\n fontSize: '14px',\r\n },\r\n};\r\n","import { createContext } from 'react';\nimport type { UIConfig } from '../config/config.types';\nimport { defaultUIConfig } from '../config/defaultConfig';\n\n/**\n * React Context providing the UI library configuration.\n * Defaults to defaultUIConfig when no UIProvider is present in the tree.\n */\nexport const UIContext = createContext<UIConfig>(defaultUIConfig);\n\nUIContext.displayName = 'UIContext';\n","import { useContext } from 'react';\nimport { UIContext } from '../context/UIContext';\nimport type { UIConfig } from '../config/config.types';\n\n/**\n * Hook to access the current UI library configuration from the nearest UIProvider.\n * Falls back to defaultUIConfig when called outside of a UIProvider.\n */\nexport function useUI(): UIConfig {\n return useContext(UIContext);\n}\n","import type { DeepPartial, UIConfig, UserUIConfig } from './config.types';\r\n\r\nfunction isRecord(value: unknown): value is Record<string, unknown> {\r\n return typeof value === 'object' && value !== null && !Array.isArray(value);\r\n}\r\n\r\n/**\r\n * Derives a subtle transparent background color (e.g., for selected options, hover chips).\r\n */\r\nexport function getSubtleBackgroundColor(color: string, opacity = 0.1): string {\r\n if (!color || typeof color !== 'string') return 'rgba(36, 145, 235, 0.1)';\r\n const trimmed = color.trim();\r\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\r\n if (hex6) {\r\n const r = parseInt(hex6[1]!, 16);\r\n const g = parseInt(hex6[2]!, 16);\r\n const b = parseInt(hex6[3]!, 16);\r\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\r\n }\r\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\r\n if (hex3) {\r\n const r = parseInt(hex3[1]! + hex3[1]!, 16);\r\n const g = parseInt(hex3[2]! + hex3[2]!, 16);\r\n const b = parseInt(hex3[3]! + hex3[3]!, 16);\r\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\r\n }\r\n const percentage = Math.round(opacity * 100);\r\n return `color-mix(in srgb, ${trimmed} ${percentage}%, #ffffff)`;\r\n}\r\n\r\n/**\r\n * Derives a focus ring color with alpha transparency.\r\n */\r\nexport function getFocusRingColor(color: string, opacity = 0.25): string {\r\n if (!color || typeof color !== 'string') return 'rgba(36, 145, 235, 0.25)';\r\n const trimmed = color.trim();\r\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\r\n if (hex6) {\r\n const r = parseInt(hex6[1]!, 16);\r\n const g = parseInt(hex6[2]!, 16);\r\n const b = parseInt(hex6[3]!, 16);\r\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\r\n }\r\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\r\n if (hex3) {\r\n const r = parseInt(hex3[1]! + hex3[1]!, 16);\r\n const g = parseInt(hex3[2]! + hex3[2]!, 16);\r\n const b = parseInt(hex3[3]! + hex3[3]!, 16);\r\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\r\n }\r\n const percentage = Math.round(opacity * 100);\r\n return `color-mix(in srgb, ${trimmed} ${percentage}%, transparent)`;\r\n}\r\n\r\n/**\r\n * Derives a darker shade of a color (e.g. for button hover and active states).\r\n */\r\nexport function getDarkerShade(color: string, amount = 0.12): string {\r\n if (!color || typeof color !== 'string') return '#1d78c4';\r\n const trimmed = color.trim();\r\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\r\n if (hex6) {\r\n const factor = Math.max(0, 1 - amount);\r\n const r = Math.round(parseInt(hex6[1]!, 16) * factor);\r\n const g = Math.round(parseInt(hex6[2]!, 16) * factor);\r\n const b = Math.round(parseInt(hex6[3]!, 16) * factor);\r\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\r\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\r\n }\r\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\r\n if (hex3) {\r\n const factor = Math.max(0, 1 - amount);\r\n const r = Math.round(parseInt(hex3[1]! + hex3[1]!, 16) * factor);\r\n const g = Math.round(parseInt(hex3[2]! + hex3[2]!, 16) * factor);\r\n const b = Math.round(parseInt(hex3[3]! + hex3[3]!, 16) * factor);\r\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\r\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\r\n }\r\n const percentage = Math.round((1 - amount) * 100);\r\n return `color-mix(in srgb, ${trimmed} ${percentage}%, #000000)`;\r\n}\r\n\r\n/**\r\n * Derives default component styling tokens based on a primary color.\r\n */\r\nexport function deriveTokensFromPrimary(primary: string): Record<string, unknown> {\r\n const selectedBg = getSubtleBackgroundColor(primary, 0.1);\r\n const selectedHoverBg = getSubtleBackgroundColor(primary, 0.18);\r\n const ring = getFocusRingColor(primary, 0.25);\r\n const hoverBg = getDarkerShade(primary, 0.12);\r\n const activeBg = getDarkerShade(primary, 0.22);\r\n const outlineTint = getSubtleBackgroundColor(primary, 0.08);\r\n\r\n return {\r\n colors: {\r\n primary,\r\n focusRing: ring,\r\n },\r\n select: {\r\n focusBorderColor: primary,\r\n focusRingColor: ring,\r\n optionSelectedTextColor: primary,\r\n optionCheckColor: primary,\r\n optionSelectedBackgroundColor: selectedBg,\r\n optionSelectedHoverBackgroundColor: selectedHoverBg,\r\n },\r\n button: {\r\n backgroundColor: primary,\r\n hoverBackgroundColor: hoverBg,\r\n activeBackgroundColor: activeBg,\r\n focusRingColor: ring,\r\n outlineColor: primary,\r\n outlineBorderColor: primary,\r\n outlineHoverBackgroundColor: outlineTint,\r\n ghostColor: primary,\r\n ghostHoverBackgroundColor: outlineTint,\r\n },\r\n input: {\r\n focusBorderColor: primary,\r\n focusRingColor: ring,\r\n },\r\n checkbox: {\r\n checkedColor: primary,\r\n focusRingColor: ring,\r\n },\r\n textarea: {\r\n focusBorderColor: primary,\r\n focusRingColor: ring,\r\n },\r\n radio: {\r\n color: primary,\r\n checkedColor: primary,\r\n focusRingColor: ring,\r\n },\r\n switch: {\r\n trackCheckedColor: primary,\r\n focusRingColor: ring,\r\n },\r\n };\r\n}\r\n\r\n/**\r\n * Immutably deep-merges objects from left to right.\r\n * Only defined properties from sources override earlier properties.\r\n * Undefined values in overrides are ignored to preserve defaults.\r\n */\r\nexport function deepMerge<T extends object>(\r\n target: T,\r\n ...sources: Array<DeepPartial<T> | Record<string, unknown> | undefined | null>\r\n): T {\r\n let result: Record<string, unknown> = { ...(target as Record<string, unknown>) };\r\n\r\n for (const source of sources) {\r\n if (!source || !isRecord(source)) {\r\n continue;\r\n }\r\n\r\n const nextResult: Record<string, unknown> = { ...result };\r\n\r\n for (const key of Object.keys(source)) {\r\n const sourceValue = (source as Record<string, unknown>)[key];\r\n\r\n if (sourceValue === undefined) {\r\n // Undefined does not overwrite an existing value\r\n continue;\r\n }\r\n\r\n const existingValue = nextResult[key];\r\n\r\n if (isRecord(existingValue) && isRecord(sourceValue)) {\r\n nextResult[key] = deepMerge(\r\n existingValue as Record<string, unknown>,\r\n sourceValue as Record<string, unknown>\r\n );\r\n } else {\r\n nextResult[key] = sourceValue;\r\n }\r\n }\r\n\r\n result = nextResult;\r\n }\r\n\r\n return result as T;\r\n}\r\n\r\n/**\r\n * Merges user-provided UI configuration with a base configuration.\r\n * Always returns a fresh object without mutating inputs.\r\n */\r\nexport function mergeUIConfig(base: UIConfig, userConfig?: UserUIConfig): UIConfig {\r\n if (!userConfig) {\r\n return { ...base };\r\n }\r\n\r\n const primary = userConfig.colors?.primary;\r\n if (primary && typeof primary === 'string') {\r\n const derivedDefaults = deriveTokensFromPrimary(primary);\r\n return deepMerge(base, derivedDefaults, userConfig as Record<string, unknown>);\r\n }\r\n\r\n return deepMerge(base, userConfig as Record<string, unknown>);\r\n}\r\n","import type { CSSProperties } from 'react';\nimport type { DeepPartial } from '../config/config.types';\nimport { deepMerge } from '../config/mergeConfig';\n\nconst UNITLESS_PROPERTIES = new Set([\n 'fontWeight',\n 'opacity',\n 'zIndex',\n 'lineHeight',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'order',\n]);\n\n/**\n * Converts a camelCase string to kebab-case.\n * e.g., 'borderRadius' -> 'border-radius'\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/([A-Z])/g, '-$1').toLowerCase();\n}\n\n/**\n * Normalizes dimension values (appends 'px' to numbers where appropriate).\n */\nexport function normalizeDimension(propName: string, value: string | number): string {\n if (typeof value === 'number' && !UNITLESS_PROPERTIES.has(propName)) {\n return `${value}px`;\n }\n return String(value);\n}\n\n/**\n * Resolves component styling with strict priority:\n * 1. component-level styles prop\n * 2. global UIProvider configuration\n * 3. built-in library default configuration\n *\n * Immutably deep-merges objects, preserving unspecified properties.\n */\nexport function resolveComponentStyles<T extends object>(\n defaultStyles: T,\n providerStyles?: DeepPartial<T> | null,\n componentStyles?: DeepPartial<T> | null\n): T {\n return deepMerge(\n defaultStyles,\n providerStyles as Record<string, unknown> | undefined,\n componentStyles as Record<string, unknown> | undefined\n );\n}\n\n/**\n * Transforms a flat semantic styles object into scoped CSS custom properties.\n *\n * @example\n * stylesToCssVars({ height: '42px', borderColor: 'red' }, 'wui-input')\n * // Returns { '--wui-input-height': '42px', '--wui-input-border-color': 'red' }\n */\nexport function stylesToCssVars(\n styles: Record<string, unknown> | undefined,\n prefix: string\n): CSSProperties {\n if (!styles) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(styles)) {\n if (value === undefined || value === null || value === '') {\n continue;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n const varName = `--${prefix}-${camelToKebab(key)}`;\n vars[varName] = normalizeDimension(key, value);\n }\n }\n\n return vars as unknown as CSSProperties;\n}\n","import { useMemo, type CSSProperties } from 'react';\r\nimport { useUI } from './useUI';\r\nimport { defaultUIConfig } from '../config/defaultConfig';\r\nimport type { DeepPartial, UIConfig } from '../config/config.types';\r\nimport { resolveComponentStyles, stylesToCssVars } from '../utils/resolveStyles';\r\n\r\nexport interface UseComponentStylesResult<T> {\r\n /**\r\n * Fully resolved semantic styles combining defaults, provider config, and component props.\r\n */\r\n resolved: T;\r\n\r\n /**\r\n * Scoped CSS custom properties derived from the resolved semantic styles.\r\n */\r\n cssVars: CSSProperties;\r\n\r\n /**\r\n * Helper that merges generated CSS variables with consumer-provided inline style.\r\n * Consumer inline styles always take direct element precedence.\r\n */\r\n getCombinedStyle: (consumerStyle?: CSSProperties) => CSSProperties;\r\n}\r\n\r\n/**\r\n * Reusable hook to resolve component-level styling with strict priority:\r\n * 1. component-level styles prop\r\n * 2. global UIProvider configuration\r\n * 3. built-in library default configuration\r\n *\r\n * Automatically generates scoped CSS custom properties with prefix `wui-{componentKey}`.\r\n */\r\nexport function useComponentStyles<\r\n K extends 'button' | 'input' | 'select' | 'checkbox' | 'textarea' | 'radio' | 'switch',\r\n>(\r\n componentKey: K,\r\n componentStyles?: DeepPartial<UIConfig[K]> | null\r\n): UseComponentStylesResult<UIConfig[K]> {\r\n const providerConfig = useUI();\r\n const defaultStyles = defaultUIConfig[componentKey];\r\n const providerStyles = providerConfig[componentKey];\r\n\r\n return useMemo(() => {\r\n const resolved = resolveComponentStyles(\r\n defaultStyles,\r\n providerStyles as DeepPartial<UIConfig[K]>,\r\n componentStyles\r\n );\r\n\r\n const cssVars = stylesToCssVars(\r\n resolved as unknown as Record<string, unknown>,\r\n `wui-${componentKey}`\r\n );\r\n\r\n const getCombinedStyle = (consumerStyle?: CSSProperties): CSSProperties => {\r\n if (!consumerStyle) {\r\n return cssVars;\r\n }\r\n return {\r\n ...cssVars,\r\n ...consumerStyle,\r\n };\r\n };\r\n\r\n return {\r\n resolved,\r\n cssVars,\r\n getCombinedStyle,\r\n };\r\n }, [componentKey, defaultStyles, providerStyles, componentStyles]);\r\n}\r\n","import { forwardRef, useImperativeHandle, useRef, useEffect, type MouseEvent } from 'react';\nimport '../../jsx.d.ts';\nimport type { ButtonProps } from './Button.types';\nimport { useComponentStyles } from '../../../hooks/useComponentStyles';\nimport { registerWbButton, type WbButton } from '../../../web-components/button';\nimport { normalizeButtonSize } from '../../../core/types/common';\n\n// Ensure the web component is registered\nregisterWbButton();\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n children,\n label,\n variant = 'primary',\n size = 'medium',\n loading = false,\n loadingText,\n disabled = false,\n startIcon,\n endIcon,\n fullWidth = false,\n className,\n style,\n styles: componentStyles,\n type = 'button',\n onClick,\n onWbClick,\n ...rest\n },\n ref\n) {\n const wbRef = useRef<WbButton | null>(null);\n\n // Integrate with existing React UIProvider context if present\n const { getCombinedStyle } = useComponentStyles('button', componentStyles);\n const combinedStyle = getCombinedStyle(style);\n\n // Expose inner HTMLButtonElement or host element via ref\n useImperativeHandle(ref, () => {\n if (wbRef.current?.button) {\n return wbRef.current.button;\n }\n return wbRef.current as unknown as HTMLButtonElement;\n }, []);\n\n // Attach onWbClick custom event listener if provided\n useEffect(() => {\n const el = wbRef.current;\n if (!el || !onWbClick) return;\n\n const handler = (e: Event) => {\n onWbClick(e as CustomEvent);\n };\n\n el.addEventListener('wb-click', handler);\n return () => {\n el.removeEventListener('wb-click', handler);\n };\n }, [onWbClick]);\n\n const isActuallyDisabled = disabled || loading;\n const normalizedSize = normalizeButtonSize(size);\n\n const handleClick = (e: MouseEvent<HTMLElement>) => {\n if (isActuallyDisabled) {\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n onClick?.(e as unknown as MouseEvent<HTMLButtonElement>);\n };\n\n const isStringLabel = typeof label === 'string';\n const isStringLoadingText = typeof loadingText === 'string';\n\n return (\n <wb-button\n ref={wbRef}\n variant={variant}\n size={normalizedSize}\n disabled={isActuallyDisabled ? true : undefined}\n loading={loading ? true : undefined}\n loading-text={isStringLoadingText ? (loadingText as string) : undefined}\n label={isStringLabel ? (label as string) : undefined}\n full-width={fullWidth ? true : undefined}\n type={type}\n class={className}\n style={combinedStyle}\n onClick={handleClick}\n {...(rest as Record<string, unknown>)}\n >\n {/* Start Icon Slot */}\n {startIcon && !loading ? <span slot=\"start-icon\">{startIcon}</span> : null}\n\n {/* Middle Content */}\n {loading && !isStringLoadingText && loadingText ? (\n <span>{loadingText}</span>\n ) : !isStringLabel && label !== undefined ? (\n <span>{label}</span>\n ) : !isStringLabel ? (\n children\n ) : null}\n\n {/* End Icon Slot */}\n {endIcon && !loading ? <span slot=\"end-icon\">{endIcon}</span> : null}\n </wb-button>\n );\n});\n\nButton.displayName = 'Button';\n","import { useContext, useMemo, type ReactNode, type CSSProperties, type FC } from 'react';\nimport { UIContext } from '../context/UIContext';\nimport type { UserUIConfig } from '../config/config.types';\nimport { mergeUIConfig } from '../config/mergeConfig';\nimport { stylesToCssVars } from '../utils/resolveStyles';\n\nexport interface UIProviderProps {\n children: ReactNode;\n config?: UserUIConfig;\n /**\n * If true, wraps children in a `<div className=\"wui-provider-root\">` with scoped CSS tokens.\n * Defaults to false so no extra DOM elements are injected.\n */\n wrapWithContainer?: boolean;\n className?: string;\n style?: CSSProperties;\n}\n\n/**\n * UIProvider allows consumers to customize the library globally or per subtree.\n * - Supports nested providers (nearest configuration takes precedence).\n * - Avoids global CSS pollution by scoping custom properties.\n * - Supports runtime updates and partial configuration objects.\n */\nexport const UIProvider: FC<UIProviderProps> = ({\n children,\n config,\n wrapWithContainer = false,\n className,\n style,\n}) => {\n const parentConfig = useContext(UIContext);\n\n const mergedConfig = useMemo(() => {\n return mergeUIConfig(parentConfig, config);\n }, [parentConfig, config]);\n\n const containerStyle = useMemo<CSSProperties>(() => {\n if (!wrapWithContainer) return {};\n\n const colorVars = stylesToCssVars(\n mergedConfig.colors as unknown as Record<string, unknown>,\n 'wui-color'\n );\n const typoVars = stylesToCssVars(\n mergedConfig.typography as unknown as Record<string, unknown>,\n 'wui-typography'\n );\n const layoutVars = stylesToCssVars(\n mergedConfig.layout as unknown as Record<string, unknown>,\n 'wui-layout'\n );\n\n return {\n ...colorVars,\n ...typoVars,\n ...layoutVars,\n ...style,\n };\n }, [wrapWithContainer, mergedConfig, style]);\n\n const content = wrapWithContainer ? (\n <div\n className={className ? `wui-provider-root ${className}` : 'wui-provider-root'}\n style={containerStyle}\n >\n {children}\n </div>\n ) : (\n children\n );\n\n return <UIContext.Provider value={mergedConfig}>{content}</UIContext.Provider>;\n};\n\nUIProvider.displayName = 'UIProvider';\n"],"names":["defaultUIConfig","UIContext","createContext","useUI","useContext","isRecord","value","getSubtleBackgroundColor","color","opacity","trimmed","hex6","r","g","b","hex3","percentage","getFocusRingColor","getDarkerShade","amount","factor","toHex","n","deriveTokensFromPrimary","primary","selectedBg","selectedHoverBg","ring","hoverBg","activeBg","outlineTint","deepMerge","target","sources","result","source","nextResult","key","sourceValue","existingValue","mergeUIConfig","base","userConfig","_a","derivedDefaults","UNITLESS_PROPERTIES","camelToKebab","str","normalizeDimension","propName","resolveComponentStyles","defaultStyles","providerStyles","componentStyles","stylesToCssVars","styles","prefix","vars","varName","useComponentStyles","componentKey","providerConfig","useMemo","resolved","cssVars","consumerStyle","registerWbButton","Button","forwardRef","children","label","variant","size","loading","loadingText","disabled","startIcon","endIcon","fullWidth","className","style","type","onClick","onWbClick","rest","ref","wbRef","useRef","getCombinedStyle","combinedStyle","useImperativeHandle","useEffect","el","handler","e","isActuallyDisabled","normalizedSize","normalizeButtonSize","handleClick","isStringLabel","isStringLoadingText","jsxs","jsx","UIProvider","config","wrapWithContainer","parentConfig","mergedConfig","containerStyle","colorVars","typoVars","layoutVars","content"],"mappings":";;;;AAEO,MAAMA,IAA4B;AAAA,EACvC,QAAQ;AAAA,IACN,SAAS;AAAA,IACT,WAAW;AAAA,IACX,MAAM;AAAA,IACN,eAAe;AAAA,IACf,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,oBAAoB;AAAA,IACpB,cAAc;AAAA,IACd,WAAW;AAAA,EAAA;AAAA,EAEb,YAAY;AAAA,IACV,YACE;AAAA,IACF,eAAe;AAAA,IACf,gBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAAA;AAAA,EAElB,QAAQ;AAAA,IACN,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,mBAAmB;AAAA,EAAA;AAAA,EAErB,QAAQ;AAAA,IACN,QAAQ;AAAA,IACR,cAAc;AAAA,IACd,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,WAAW;AAAA,IACX,aAAa;AAAA,IACb,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AA,MACjBqD,EAAa;AAAA,MACb;AAAA,IAAA;AAGF,WAAO;AAAA,MACL,GAAGE;AAAA,MACH,GAAGC;AAAA,MACH,GAAGC;AAAA,MACH,GAAG/B;AAAA,IAAA;AAAA,EAEP,GAAG,CAACyB,GAAmBE,GAAc3B,CAAK,CAAC,GAErCgC,IAAUP,IACd,gBAAAH;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWvB,IAAY,qBAAqBA,CAAS,KAAK;AAAA,MAC1D,OAAO6B;AAAA,MAEN,UAAAvC;AAAA,IAAA;AAAA,EAAA,IAGHA;AAGF,2BAAQpE,EAAU,UAAV,EAAmB,OAAO0G,GAAe,UAAAK,GAAQ;AAC3D;AAEAT,GAAW,cAAc;"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ButtonSize, ButtonVariant } from '../types/common';
|
|
2
|
-
import { ResolvedWebstrailConfig, WebstrailConfig } from '../types/config';
|
|
3
|
-
import { ButtonStyles } from '../types/tokens';
|
|
4
|
-
/**
|
|
5
|
-
* Returns the current resolved global Webstrail configuration.
|
|
6
|
-
*/
|
|
7
|
-
export declare function getWebstrailConfig(): ResolvedWebstrailConfig;
|
|
8
|
-
/**
|
|
9
|
-
* Subscribes to global configuration changes.
|
|
10
|
-
* Returns an unsubscribe callback function.
|
|
11
|
-
*/
|
|
12
|
-
export declare function subscribeWebstrailConfig(listener: (config: ResolvedWebstrailConfig) => void): () => void;
|
|
13
|
-
/**
|
|
14
|
-
* Configures the global Webstrail library settings (theme, component defaults).
|
|
15
|
-
* Notifies all subscribers and active components.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* configureWebstrail({
|
|
20
|
-
* theme: {
|
|
21
|
-
* primaryColor: '#2491eb',
|
|
22
|
-
* },
|
|
23
|
-
* components: {
|
|
24
|
-
* button: {
|
|
25
|
-
* variant: 'primary',
|
|
26
|
-
* size: 'md',
|
|
27
|
-
* },
|
|
28
|
-
* },
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export declare function configureWebstrail(userConfig: WebstrailConfig): ResolvedWebstrailConfig;
|
|
33
|
-
/**
|
|
34
|
-
* Resets global configuration to library defaults.
|
|
35
|
-
*/
|
|
36
|
-
export declare function resetWebstrailConfig(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Resolves effective Button properties and styles using 3-tier priority:
|
|
39
|
-
* 1. Component-level properties / styles
|
|
40
|
-
* 2. Global configuration
|
|
41
|
-
* 3. Built-in default configuration
|
|
42
|
-
*/
|
|
43
|
-
export declare function resolveEffectiveButtonConfig(componentOverrides?: {
|
|
44
|
-
variant?: ButtonVariant | string;
|
|
45
|
-
size?: ButtonSize | string;
|
|
46
|
-
fullWidth?: boolean;
|
|
47
|
-
styles?: ButtonStyles;
|
|
48
|
-
}): {
|
|
49
|
-
variant: ButtonVariant;
|
|
50
|
-
size: ButtonSize;
|
|
51
|
-
fullWidth: boolean;
|
|
52
|
-
styles: ButtonStyles;
|
|
53
|
-
cssVars: Record<string, string>;
|
|
54
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './globalConfig';
|
package/dist/core/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ButtonStyles, GlobalColorTokens, GlobalLayoutTokens, GlobalTypographyTokens } from '../types/tokens';
|
|
2
|
-
import { ResolvedWebstrailConfig } from '../types/config';
|
|
3
|
-
export declare const defaultColors: GlobalColorTokens;
|
|
4
|
-
export declare const defaultTypography: GlobalTypographyTokens;
|
|
5
|
-
export declare const defaultLayout: GlobalLayoutTokens;
|
|
6
|
-
export declare const defaultButtonStyles: ButtonStyles;
|
|
7
|
-
export declare const defaultResolvedConfig: ResolvedWebstrailConfig;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Derives a subtle transparent background color (e.g., for selected options, hover chips).
|
|
3
|
-
*/
|
|
4
|
-
export declare function getSubtleBackgroundColor(color: string, opacity?: number): string;
|
|
5
|
-
/**
|
|
6
|
-
* Derives a focus ring color with alpha transparency.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getFocusRingColor(color: string, opacity?: number): string;
|
|
9
|
-
/**
|
|
10
|
-
* Derives a darker shade of a color (e.g. for button hover and active states).
|
|
11
|
-
*/
|
|
12
|
-
export declare function getDarkerShade(color: string, amount?: number): string;
|
|
13
|
-
/**
|
|
14
|
-
* Derives default component styling tokens based on a primary color.
|
|
15
|
-
*/
|
|
16
|
-
export declare function deriveTokensFromPrimary(primary: string): Record<string, unknown>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standard size variants supported across components.
|
|
3
|
-
*/
|
|
4
|
-
export type ComponentSize = 'small' | 'medium' | 'large';
|
|
5
|
-
/**
|
|
6
|
-
* Size aliases supported for developer convenience.
|
|
7
|
-
*/
|
|
8
|
-
export type SizeAlias = 'sm' | 'md' | 'lg';
|
|
9
|
-
/**
|
|
10
|
-
* Size type for Button (accepts standard full names or aliases).
|
|
11
|
-
*/
|
|
12
|
-
export type ButtonSize = ComponentSize | SizeAlias;
|
|
13
|
-
/**
|
|
14
|
-
* Standard semantic color intent variants.
|
|
15
|
-
*/
|
|
16
|
-
export type ComponentVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
|
|
17
|
-
/**
|
|
18
|
-
* Variant type alias for Button.
|
|
19
|
-
*/
|
|
20
|
-
export type ButtonVariant = ComponentVariant;
|
|
21
|
-
/**
|
|
22
|
-
* Supported HTML button types.
|
|
23
|
-
*/
|
|
24
|
-
export type ButtonType = 'button' | 'submit' | 'reset';
|
|
25
|
-
/**
|
|
26
|
-
* Helper to accept string or number for dimension properties (adds 'px' if number).
|
|
27
|
-
*/
|
|
28
|
-
export type DimensionValue = string | number;
|
|
29
|
-
/**
|
|
30
|
-
* Normalizes size aliases ('sm' -> 'small', 'md' -> 'medium', 'lg' -> 'large').
|
|
31
|
-
*/
|
|
32
|
-
export declare function normalizeButtonSize(size?: ButtonSize | string): ComponentSize;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { ButtonSize, ButtonVariant, DimensionValue } from './common';
|
|
2
|
-
import { ButtonStyles, GlobalColorTokens, GlobalLayoutTokens, GlobalTypographyTokens } from './tokens';
|
|
3
|
-
/**
|
|
4
|
-
* Deep partial utility allowing partial overrides of nested configuration objects.
|
|
5
|
-
*/
|
|
6
|
-
export type DeepPartial<T> = {
|
|
7
|
-
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Theme configuration accepted by configureWebstrail.
|
|
11
|
-
*/
|
|
12
|
-
export interface WebstrailThemeConfig {
|
|
13
|
-
primaryColor?: string;
|
|
14
|
-
secondaryColor?: string;
|
|
15
|
-
fontFamily?: string;
|
|
16
|
-
borderRadius?: DimensionValue;
|
|
17
|
-
colors?: Partial<GlobalColorTokens>;
|
|
18
|
-
typography?: Partial<GlobalTypographyTokens>;
|
|
19
|
-
layout?: Partial<GlobalLayoutTokens>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Global Button default configuration.
|
|
23
|
-
*/
|
|
24
|
-
export interface WebstrailButtonConfig {
|
|
25
|
-
variant?: ButtonVariant;
|
|
26
|
-
size?: ButtonSize;
|
|
27
|
-
fullWidth?: boolean;
|
|
28
|
-
styles?: ButtonStyles;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Components configuration dictionary.
|
|
32
|
-
*/
|
|
33
|
-
export interface WebstrailComponentsConfig {
|
|
34
|
-
button?: WebstrailButtonConfig;
|
|
35
|
-
[key: string]: unknown;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Global configuration options passed to configureWebstrail.
|
|
39
|
-
*/
|
|
40
|
-
export interface WebstrailConfig {
|
|
41
|
-
theme?: WebstrailThemeConfig;
|
|
42
|
-
components?: WebstrailComponentsConfig;
|
|
43
|
-
colors?: Partial<GlobalColorTokens>;
|
|
44
|
-
typography?: Partial<GlobalTypographyTokens>;
|
|
45
|
-
layout?: Partial<GlobalLayoutTokens>;
|
|
46
|
-
button?: ButtonStyles;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Fully resolved configuration object.
|
|
50
|
-
*/
|
|
51
|
-
export interface ResolvedWebstrailConfig {
|
|
52
|
-
theme: {
|
|
53
|
-
primaryColor: string;
|
|
54
|
-
secondaryColor: string;
|
|
55
|
-
fontFamily: string;
|
|
56
|
-
borderRadius: DimensionValue;
|
|
57
|
-
colors: GlobalColorTokens;
|
|
58
|
-
typography: GlobalTypographyTokens;
|
|
59
|
-
layout: GlobalLayoutTokens;
|
|
60
|
-
};
|
|
61
|
-
components: {
|
|
62
|
-
button: {
|
|
63
|
-
variant: ButtonVariant;
|
|
64
|
-
size: ButtonSize;
|
|
65
|
-
fullWidth: boolean;
|
|
66
|
-
styles: ButtonStyles;
|
|
67
|
-
};
|
|
68
|
-
[key: string]: unknown;
|
|
69
|
-
};
|
|
70
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { DimensionValue } from './common';
|
|
2
|
-
/**
|
|
3
|
-
* Central design tokens for colors.
|
|
4
|
-
*/
|
|
5
|
-
export interface GlobalColorTokens {
|
|
6
|
-
primary: string;
|
|
7
|
-
secondary: string;
|
|
8
|
-
text: string;
|
|
9
|
-
textSecondary: string;
|
|
10
|
-
border: string;
|
|
11
|
-
background: string;
|
|
12
|
-
error: string;
|
|
13
|
-
success: string;
|
|
14
|
-
disabled: string;
|
|
15
|
-
disabledBackground: string;
|
|
16
|
-
disabledText: string;
|
|
17
|
-
focusRing: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Central typography design tokens.
|
|
21
|
-
*/
|
|
22
|
-
export interface GlobalTypographyTokens {
|
|
23
|
-
fontFamily: string;
|
|
24
|
-
fontSizeSmall: string;
|
|
25
|
-
fontSizeMedium: string;
|
|
26
|
-
fontSizeLarge: string;
|
|
27
|
-
fontWeightNormal: number | string;
|
|
28
|
-
fontWeightMedium: number | string;
|
|
29
|
-
fontWeightBold: number | string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Global spacing and radius tokens.
|
|
33
|
-
*/
|
|
34
|
-
export interface GlobalLayoutTokens {
|
|
35
|
-
borderRadiusSmall: DimensionValue;
|
|
36
|
-
borderRadiusMedium: DimensionValue;
|
|
37
|
-
borderRadiusLarge: DimensionValue;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Semantic style configuration for Button component.
|
|
41
|
-
*/
|
|
42
|
-
export interface ButtonStyles {
|
|
43
|
-
height?: DimensionValue;
|
|
44
|
-
borderRadius?: DimensionValue;
|
|
45
|
-
fontSize?: DimensionValue;
|
|
46
|
-
fontWeight?: number | string;
|
|
47
|
-
backgroundColor?: string;
|
|
48
|
-
textColor?: string;
|
|
49
|
-
borderColor?: string;
|
|
50
|
-
hoverBackgroundColor?: string;
|
|
51
|
-
hoverTextColor?: string;
|
|
52
|
-
activeBackgroundColor?: string;
|
|
53
|
-
disabledBackgroundColor?: string;
|
|
54
|
-
disabledTextColor?: string;
|
|
55
|
-
disabledBorderColor?: string;
|
|
56
|
-
focusRingColor?: string;
|
|
57
|
-
focusShadow?: string;
|
|
58
|
-
padding?: string;
|
|
59
|
-
transition?: string;
|
|
60
|
-
outlineColor?: string;
|
|
61
|
-
outlineBorderColor?: string;
|
|
62
|
-
outlineHoverBackgroundColor?: string;
|
|
63
|
-
ghostColor?: string;
|
|
64
|
-
ghostHoverBackgroundColor?: string;
|
|
65
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { DeepPartial } from '../types/config';
|
|
2
|
-
/**
|
|
3
|
-
* Converts camelCase to kebab-case (e.g. borderRadius -> border-radius).
|
|
4
|
-
*/
|
|
5
|
-
export declare function camelToKebab(str: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Normalizes dimension values (appends 'px' to numbers where appropriate).
|
|
8
|
-
*/
|
|
9
|
-
export declare function normalizeDimension(propName: string, value: string | number): string;
|
|
10
|
-
/**
|
|
11
|
-
* Immutably deep-merges objects from left to right.
|
|
12
|
-
* Undefined values in overrides are ignored to preserve defaults.
|
|
13
|
-
*/
|
|
14
|
-
export declare function deepMerge<T extends object>(target: T, ...sources: Array<DeepPartial<T> | Record<string, unknown> | undefined | null>): T;
|
|
15
|
-
/**
|
|
16
|
-
* Transforms a flat semantic styles object into scoped CSS custom properties.
|
|
17
|
-
* Framework-independent: returns Record<string, string>.
|
|
18
|
-
*/
|
|
19
|
-
export declare function stylesToCssVars(styles: Record<string, unknown> | object | undefined, prefix: string): Record<string, string>;
|
package/dist/core.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function x(o){if(!o)return"medium";switch(o){case"sm":case"small":return"small";case"lg":case"large":return"large";case"md":case"medium":default:return"medium"}}const F={primary:"#2491eb",secondary:"#406993",text:"#1f2937",textSecondary:"#6b7280",border:"#d1d5db",background:"#ffffff",error:"#dc2626",success:"#16a34a",disabled:"#9ca3af",disabledBackground:"#f3f4f6",disabledText:"#9ca3af",focusRing:"rgba(36, 145, 235, 0.35)"},p={fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif',fontSizeSmall:"12px",fontSizeMedium:"14px",fontSizeLarge:"16px",fontWeightNormal:400,fontWeightMedium:500,fontWeightBold:600},R={borderRadiusSmall:"6px",borderRadiusMedium:"8px",borderRadiusLarge:"12px"},y={height:"40px",borderRadius:"8px",fontSize:"14px",fontWeight:500,backgroundColor:"#2491eb",textColor:"#ffffff",borderColor:"transparent",hoverBackgroundColor:"#1d78c4",hoverTextColor:"#ffffff",activeBackgroundColor:"#1565a0",disabledBackgroundColor:"#f3f4f6",disabledTextColor:"#9ca3af",disabledBorderColor:"#e5e7eb",focusRingColor:"rgba(36, 145, 235, 0.35)",padding:"0 16px",transition:"all 0.15s ease-in-out",outlineColor:"#2491eb",outlineBorderColor:"#2491eb",outlineHoverBackgroundColor:"rgba(36, 145, 235, 0.08)",ghostColor:"#2491eb",ghostHoverBackgroundColor:"rgba(36, 145, 235, 0.08)"},S={theme:{primaryColor:"#2491eb",secondaryColor:"#406993",fontFamily:p.fontFamily,borderRadius:"8px",colors:F,typography:p,layout:R},components:{button:{variant:"primary",size:"medium",fullWidth:!1,styles:y}}};function d(o,e=.1){if(!o||typeof o!="string")return"rgba(36, 145, 235, 0.1)";const s=o.trim(),n=s.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(n){const r=parseInt(n[1],16),l=parseInt(n[2],16),i=parseInt(n[3],16);return`rgba(${r}, ${l}, ${i}, ${e})`}const t=s.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);if(t){const r=parseInt(t[1]+t[1],16),l=parseInt(t[2]+t[2],16),i=parseInt(t[3]+t[3],16);return`rgba(${r}, ${l}, ${i}, ${e})`}const a=Math.round(e*100);return`color-mix(in srgb, ${s} ${a}%, #ffffff)`}function $(o,e=.25){if(!o||typeof o!="string")return"rgba(36, 145, 235, 0.25)";const s=o.trim(),n=s.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(n){const r=parseInt(n[1],16),l=parseInt(n[2],16),i=parseInt(n[3],16);return`rgba(${r}, ${l}, ${i}, ${e})`}const t=s.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);if(t){const r=parseInt(t[1]+t[1],16),l=parseInt(t[2]+t[2],16),i=parseInt(t[3]+t[3],16);return`rgba(${r}, ${l}, ${i}, ${e})`}const a=Math.round(e*100);return`color-mix(in srgb, ${s} ${a}%, transparent)`}function b(o,e=.12){if(!o||typeof o!="string")return"#1d78c4";const s=o.trim(),n=s.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);if(n){const r=Math.max(0,1-e),l=Math.round(parseInt(n[1],16)*r),i=Math.round(parseInt(n[2],16)*r),g=Math.round(parseInt(n[3],16)*r),u=f=>f.toString(16).padStart(2,"0");return`#${u(l)}${u(i)}${u(g)}`}const t=s.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);if(t){const r=Math.max(0,1-e),l=Math.round(parseInt(t[1]+t[1],16)*r),i=Math.round(parseInt(t[2]+t[2],16)*r),g=Math.round(parseInt(t[3]+t[3],16)*r),u=f=>f.toString(16).padStart(2,"0");return`#${u(l)}${u(i)}${u(g)}`}const a=Math.round((1-e)*100);return`color-mix(in srgb, ${s} ${a}%, #000000)`}function v(o){const e=d(o,.1),s=d(o,.18),n=$(o,.25),t=b(o,.12),a=b(o,.22),r=d(o,.08);return{colors:{primary:o,focusRing:n},button:{backgroundColor:o,hoverBackgroundColor:t,activeBackgroundColor:a,focusRingColor:n,outlineColor:o,outlineBorderColor:o,outlineHoverBackgroundColor:r,ghostColor:o,ghostHoverBackgroundColor:r},select:{focusBorderColor:o,focusRingColor:n,optionSelectedTextColor:o,optionCheckColor:o,optionSelectedBackgroundColor:e,optionSelectedHoverBackgroundColor:s},input:{focusBorderColor:o,focusRingColor:n},checkbox:{checkedColor:o,focusRingColor:n},textarea:{focusBorderColor:o,focusRingColor:n},radio:{color:o,checkedColor:o,focusRingColor:n},switch:{trackCheckedColor:o,focusRingColor:n}}}const z=new Set(["fontWeight","opacity","zIndex","lineHeight","flex","flexGrow","flexShrink","order"]);function I(o){return o.replace(/([A-Z])/g,"-$1").toLowerCase()}function W(o,e){return typeof e=="number"&&!z.has(o)?`${e}px`:String(e)}function m(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}function h(o,...e){let s={...o};for(const n of e){if(!n||!m(n))continue;const t={...s};for(const a of Object.keys(n)){const r=n[a];if(r===void 0)continue;const l=t[a];m(l)&&m(r)?t[a]=h(l,r):t[a]=r}s=t}return s}function B(o,e){if(!o)return{};const s={};for(const[n,t]of Object.entries(o))if(!(t==null||t==="")&&(typeof t=="string"||typeof t=="number")){const a=`--${e}-${I(n)}`;s[a]=W(n,t)}return s}let c=JSON.parse(JSON.stringify(S));const C=new Set;function M(){return c}function T(o){return C.add(o),()=>{C.delete(o)}}function w(o){var l,i,g;const e=((l=o.theme)==null?void 0:l.primaryColor)||((i=o.colors)==null?void 0:i.primary)||c.theme.primaryColor;let s={};if(e){const u=b(e,.12),f=b(e,.22),A=$(e,.35),k=d(e,.08);s={backgroundColor:e,hoverBackgroundColor:u,activeBackgroundColor:f,focusRingColor:A,outlineColor:e,outlineBorderColor:e,outlineHoverBackgroundColor:k,ghostColor:e,ghostHoverBackgroundColor:k}}const n=h(c.theme,o.theme||{},o.colors?{colors:o.colors}:{},o.typography?{typography:o.typography}:{},o.layout?{layout:o.layout}:{}),t={...((g=o.components)==null?void 0:g.button)||{},...o.button?{styles:o.button}:{}},a=t.size?x(t.size):c.components.button.size,r=h(y,c.components.button.styles,s,t.styles||{});if(c={theme:n,components:{...c.components,button:{variant:t.variant??c.components.button.variant,size:a,fullWidth:t.fullWidth??c.components.button.fullWidth,styles:r}}},C.forEach(u=>{try{u(c)}catch(f){console.error("Error notifying Webstrail config listener:",f)}}),typeof window<"u")try{window.dispatchEvent(new CustomEvent("webstrail-config-change",{detail:c}))}catch{}return c}function E(){c=JSON.parse(JSON.stringify(S)),C.forEach(o=>{try{o(c)}catch(e){console.error("Error notifying Webstrail config listener:",e)}})}function H(o){const e=c.components.button,s=(o==null?void 0:o.variant)||e.variant||"primary",n=o!=null&&o.size?x(o.size):e.size||"medium",t=(o==null?void 0:o.fullWidth)??e.fullWidth??!1,a=h(y,e.styles,(o==null?void 0:o.styles)||{}),r={...B(a,"wui-button"),...B(a,"wb-button")};return{variant:s,size:n,fullWidth:t,styles:a,cssVars:r}}exports.camelToKebab=I;exports.configureWebstrail=w;exports.deepMerge=h;exports.defaultButtonStyles=y;exports.defaultColors=F;exports.defaultLayout=R;exports.defaultResolvedConfig=S;exports.defaultTypography=p;exports.deriveTokensFromPrimary=v;exports.getDarkerShade=b;exports.getFocusRingColor=$;exports.getSubtleBackgroundColor=d;exports.getWebstrailConfig=M;exports.normalizeButtonSize=x;exports.normalizeDimension=W;exports.resetWebstrailConfig=E;exports.resolveEffectiveButtonConfig=H;exports.stylesToCssVars=B;exports.subscribeWebstrailConfig=T;
|
|
2
|
-
//# sourceMappingURL=core.cjs.map
|
package/dist/core.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","sources":["../src/core/types/common.ts","../src/core/theme/defaultTheme.ts","../src/core/theme/deriveTokens.ts","../src/core/utils/styles.ts","../src/core/config/globalConfig.ts"],"sourcesContent":["/**\n * Standard size variants supported across components.\n */\nexport type ComponentSize = 'small' | 'medium' | 'large';\n\n/**\n * Size aliases supported for developer convenience.\n */\nexport type SizeAlias = 'sm' | 'md' | 'lg';\n\n/**\n * Size type for Button (accepts standard full names or aliases).\n */\nexport type ButtonSize = ComponentSize | SizeAlias;\n\n/**\n * Standard semantic color intent variants.\n */\nexport type ComponentVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';\n\n/**\n * Variant type alias for Button.\n */\nexport type ButtonVariant = ComponentVariant;\n\n/**\n * Supported HTML button types.\n */\nexport type ButtonType = 'button' | 'submit' | 'reset';\n\n/**\n * Helper to accept string or number for dimension properties (adds 'px' if number).\n */\nexport type DimensionValue = string | number;\n\n/**\n * Normalizes size aliases ('sm' -> 'small', 'md' -> 'medium', 'lg' -> 'large').\n */\nexport function normalizeButtonSize(size?: ButtonSize | string): ComponentSize {\n if (!size) return 'medium';\n switch (size) {\n case 'sm':\n case 'small':\n return 'small';\n case 'lg':\n case 'large':\n return 'large';\n case 'md':\n case 'medium':\n default:\n return 'medium';\n }\n}\n","import type {\n ButtonStyles,\n GlobalColorTokens,\n GlobalLayoutTokens,\n GlobalTypographyTokens,\n} from '../types/tokens';\nimport type { ResolvedWebstrailConfig } from '../types/config';\n\nexport const defaultColors: GlobalColorTokens = {\n primary: '#2491eb',\n secondary: '#406993',\n text: '#1f2937',\n textSecondary: '#6b7280',\n border: '#d1d5db',\n background: '#ffffff',\n error: '#dc2626',\n success: '#16a34a',\n disabled: '#9ca3af',\n disabledBackground: '#f3f4f6',\n disabledText: '#9ca3af',\n focusRing: 'rgba(36, 145, 235, 0.35)',\n};\n\nexport const defaultTypography: GlobalTypographyTokens = {\n fontFamily:\n 'system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif',\n fontSizeSmall: '12px',\n fontSizeMedium: '14px',\n fontSizeLarge: '16px',\n fontWeightNormal: 400,\n fontWeightMedium: 500,\n fontWeightBold: 600,\n};\n\nexport const defaultLayout: GlobalLayoutTokens = {\n borderRadiusSmall: '6px',\n borderRadiusMedium: '8px',\n borderRadiusLarge: '12px',\n};\n\nexport const defaultButtonStyles: ButtonStyles = {\n height: '40px',\n borderRadius: '8px',\n fontSize: '14px',\n fontWeight: 500,\n backgroundColor: '#2491eb',\n textColor: '#ffffff',\n borderColor: 'transparent',\n hoverBackgroundColor: '#1d78c4',\n hoverTextColor: '#ffffff',\n activeBackgroundColor: '#1565a0',\n disabledBackgroundColor: '#f3f4f6',\n disabledTextColor: '#9ca3af',\n disabledBorderColor: '#e5e7eb',\n focusRingColor: 'rgba(36, 145, 235, 0.35)',\n padding: '0 16px',\n transition: 'all 0.15s ease-in-out',\n outlineColor: '#2491eb',\n outlineBorderColor: '#2491eb',\n outlineHoverBackgroundColor: 'rgba(36, 145, 235, 0.08)',\n ghostColor: '#2491eb',\n ghostHoverBackgroundColor: 'rgba(36, 145, 235, 0.08)',\n};\n\nexport const defaultResolvedConfig: ResolvedWebstrailConfig = {\n theme: {\n primaryColor: '#2491eb',\n secondaryColor: '#406993',\n fontFamily: defaultTypography.fontFamily,\n borderRadius: '8px',\n colors: defaultColors,\n typography: defaultTypography,\n layout: defaultLayout,\n },\n components: {\n button: {\n variant: 'primary',\n size: 'medium',\n fullWidth: false,\n styles: defaultButtonStyles,\n },\n },\n};\n","/**\n * Derives a subtle transparent background color (e.g., for selected options, hover chips).\n */\nexport function getSubtleBackgroundColor(color: string, opacity = 0.1): string {\n if (!color || typeof color !== 'string') return 'rgba(36, 145, 235, 0.1)';\n const trimmed = color.trim();\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n if (hex6) {\n const r = parseInt(hex6[1]!, 16);\n const g = parseInt(hex6[2]!, 16);\n const b = parseInt(hex6[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\n if (hex3) {\n const r = parseInt(hex3[1]! + hex3[1]!, 16);\n const g = parseInt(hex3[2]! + hex3[2]!, 16);\n const b = parseInt(hex3[3]! + hex3[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const percentage = Math.round(opacity * 100);\n return `color-mix(in srgb, ${trimmed} ${percentage}%, #ffffff)`;\n}\n\n/**\n * Derives a focus ring color with alpha transparency.\n */\nexport function getFocusRingColor(color: string, opacity = 0.25): string {\n if (!color || typeof color !== 'string') return 'rgba(36, 145, 235, 0.25)';\n const trimmed = color.trim();\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n if (hex6) {\n const r = parseInt(hex6[1]!, 16);\n const g = parseInt(hex6[2]!, 16);\n const b = parseInt(hex6[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\n if (hex3) {\n const r = parseInt(hex3[1]! + hex3[1]!, 16);\n const g = parseInt(hex3[2]! + hex3[2]!, 16);\n const b = parseInt(hex3[3]! + hex3[3]!, 16);\n return `rgba(${r}, ${g}, ${b}, ${opacity})`;\n }\n const percentage = Math.round(opacity * 100);\n return `color-mix(in srgb, ${trimmed} ${percentage}%, transparent)`;\n}\n\n/**\n * Derives a darker shade of a color (e.g. for button hover and active states).\n */\nexport function getDarkerShade(color: string, amount = 0.12): string {\n if (!color || typeof color !== 'string') return '#1d78c4';\n const trimmed = color.trim();\n const hex6 = trimmed.match(/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/);\n if (hex6) {\n const factor = Math.max(0, 1 - amount);\n const r = Math.round(parseInt(hex6[1]!, 16) * factor);\n const g = Math.round(parseInt(hex6[2]!, 16) * factor);\n const b = Math.round(parseInt(hex6[3]!, 16) * factor);\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n }\n const hex3 = trimmed.match(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/);\n if (hex3) {\n const factor = Math.max(0, 1 - amount);\n const r = Math.round(parseInt(hex3[1]! + hex3[1]!, 16) * factor);\n const g = Math.round(parseInt(hex3[2]! + hex3[2]!, 16) * factor);\n const b = Math.round(parseInt(hex3[3]! + hex3[3]!, 16) * factor);\n const toHex = (n: number) => n.toString(16).padStart(2, '0');\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n }\n const percentage = Math.round((1 - amount) * 100);\n return `color-mix(in srgb, ${trimmed} ${percentage}%, #000000)`;\n}\n\n/**\n * Derives default component styling tokens based on a primary color.\n */\nexport function deriveTokensFromPrimary(primary: string): Record<string, unknown> {\n const selectedBg = getSubtleBackgroundColor(primary, 0.1);\n const selectedHoverBg = getSubtleBackgroundColor(primary, 0.18);\n const ring = getFocusRingColor(primary, 0.25);\n const hoverBg = getDarkerShade(primary, 0.12);\n const activeBg = getDarkerShade(primary, 0.22);\n const outlineTint = getSubtleBackgroundColor(primary, 0.08);\n\n return {\n colors: {\n primary,\n focusRing: ring,\n },\n button: {\n backgroundColor: primary,\n hoverBackgroundColor: hoverBg,\n activeBackgroundColor: activeBg,\n focusRingColor: ring,\n outlineColor: primary,\n outlineBorderColor: primary,\n outlineHoverBackgroundColor: outlineTint,\n ghostColor: primary,\n ghostHoverBackgroundColor: outlineTint,\n },\n select: {\n focusBorderColor: primary,\n focusRingColor: ring,\n optionSelectedTextColor: primary,\n optionCheckColor: primary,\n optionSelectedBackgroundColor: selectedBg,\n optionSelectedHoverBackgroundColor: selectedHoverBg,\n },\n input: {\n focusBorderColor: primary,\n focusRingColor: ring,\n },\n checkbox: {\n checkedColor: primary,\n focusRingColor: ring,\n },\n textarea: {\n focusBorderColor: primary,\n focusRingColor: ring,\n },\n radio: {\n color: primary,\n checkedColor: primary,\n focusRingColor: ring,\n },\n switch: {\n trackCheckedColor: primary,\n focusRingColor: ring,\n },\n };\n}\n","import type { DeepPartial } from '../types/config';\n\nconst UNITLESS_PROPERTIES = new Set([\n 'fontWeight',\n 'opacity',\n 'zIndex',\n 'lineHeight',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'order',\n]);\n\n/**\n * Converts camelCase to kebab-case (e.g. borderRadius -> border-radius).\n */\nexport function camelToKebab(str: string): string {\n return str.replace(/([A-Z])/g, '-$1').toLowerCase();\n}\n\n/**\n * Normalizes dimension values (appends 'px' to numbers where appropriate).\n */\nexport function normalizeDimension(propName: string, value: string | number): string {\n if (typeof value === 'number' && !UNITLESS_PROPERTIES.has(propName)) {\n return `${value}px`;\n }\n return String(value);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Immutably deep-merges objects from left to right.\n * Undefined values in overrides are ignored to preserve defaults.\n */\nexport function deepMerge<T extends object>(\n target: T,\n ...sources: Array<DeepPartial<T> | Record<string, unknown> | undefined | null>\n): T {\n let result: Record<string, unknown> = { ...(target as Record<string, unknown>) };\n\n for (const source of sources) {\n if (!source || !isRecord(source)) {\n continue;\n }\n\n const nextResult: Record<string, unknown> = { ...result };\n\n for (const key of Object.keys(source)) {\n const sourceValue = (source as Record<string, unknown>)[key];\n\n if (sourceValue === undefined) {\n continue;\n }\n\n const existingValue = nextResult[key];\n\n if (isRecord(existingValue) && isRecord(sourceValue)) {\n nextResult[key] = deepMerge(\n existingValue as Record<string, unknown>,\n sourceValue as Record<string, unknown>\n );\n } else {\n nextResult[key] = sourceValue;\n }\n }\n\n result = nextResult;\n }\n\n return result as T;\n}\n\n/**\n * Transforms a flat semantic styles object into scoped CSS custom properties.\n * Framework-independent: returns Record<string, string>.\n */\nexport function stylesToCssVars(\n styles: Record<string, unknown> | object | undefined,\n prefix: string\n): Record<string, string> {\n if (!styles) {\n return {};\n }\n\n const vars: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(styles as Record<string, unknown>)) {\n if (value === undefined || value === null || value === '') {\n continue;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n const varName = `--${prefix}-${camelToKebab(key)}`;\n vars[varName] = normalizeDimension(key, value);\n }\n }\n\n return vars;\n}\n","import type { ButtonSize, ButtonVariant } from '../types/common';\nimport type {\n ResolvedWebstrailConfig,\n WebstrailButtonConfig,\n WebstrailConfig,\n} from '../types/config';\nimport type { ButtonStyles } from '../types/tokens';\nimport { defaultButtonStyles, defaultResolvedConfig } from '../theme/defaultTheme';\nimport { getFocusRingColor, getDarkerShade, getSubtleBackgroundColor } from '../theme/deriveTokens';\nimport { deepMerge, stylesToCssVars } from '../utils/styles';\nimport { normalizeButtonSize } from '../types/common';\n\nlet currentConfig: ResolvedWebstrailConfig = JSON.parse(JSON.stringify(defaultResolvedConfig));\nconst listeners = new Set<(config: ResolvedWebstrailConfig) => void>();\n\n/**\n * Returns the current resolved global Webstrail configuration.\n */\nexport function getWebstrailConfig(): ResolvedWebstrailConfig {\n return currentConfig;\n}\n\n/**\n * Subscribes to global configuration changes.\n * Returns an unsubscribe callback function.\n */\nexport function subscribeWebstrailConfig(\n listener: (config: ResolvedWebstrailConfig) => void\n): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\n/**\n * Configures the global Webstrail library settings (theme, component defaults).\n * Notifies all subscribers and active components.\n *\n * @example\n * ```ts\n * configureWebstrail({\n * theme: {\n * primaryColor: '#2491eb',\n * },\n * components: {\n * button: {\n * variant: 'primary',\n * size: 'md',\n * },\n * },\n * });\n * ```\n */\nexport function configureWebstrail(userConfig: WebstrailConfig): ResolvedWebstrailConfig {\n const primaryColor =\n userConfig.theme?.primaryColor ||\n userConfig.colors?.primary ||\n currentConfig.theme.primaryColor;\n\n let derivedButtonStyles: Partial<ButtonStyles> = {};\n if (primaryColor) {\n const hoverBg = getDarkerShade(primaryColor, 0.12);\n const activeBg = getDarkerShade(primaryColor, 0.22);\n const ring = getFocusRingColor(primaryColor, 0.35);\n const outlineTint = getSubtleBackgroundColor(primaryColor, 0.08);\n\n derivedButtonStyles = {\n backgroundColor: primaryColor,\n hoverBackgroundColor: hoverBg,\n activeBackgroundColor: activeBg,\n focusRingColor: ring,\n outlineColor: primaryColor,\n outlineBorderColor: primaryColor,\n outlineHoverBackgroundColor: outlineTint,\n ghostColor: primaryColor,\n ghostHoverBackgroundColor: outlineTint,\n };\n }\n\n // Merge theme\n const mergedTheme = deepMerge(\n currentConfig.theme,\n userConfig.theme || {},\n userConfig.colors ? { colors: userConfig.colors } : {},\n userConfig.typography ? { typography: userConfig.typography } : {},\n userConfig.layout ? { layout: userConfig.layout } : {}\n );\n\n // Normalize component button config\n const rawButtonConfig: WebstrailButtonConfig = {\n ...(userConfig.components?.button || {}),\n ...(userConfig.button ? { styles: userConfig.button } : {}),\n };\n\n const buttonSize = rawButtonConfig.size\n ? normalizeButtonSize(rawButtonConfig.size)\n : currentConfig.components.button.size;\n\n const mergedButtonStyles = deepMerge(\n defaultButtonStyles,\n currentConfig.components.button.styles,\n derivedButtonStyles,\n rawButtonConfig.styles || {}\n );\n\n currentConfig = {\n theme: mergedTheme,\n components: {\n ...currentConfig.components,\n button: {\n variant: rawButtonConfig.variant ?? currentConfig.components.button.variant,\n size: buttonSize,\n fullWidth: rawButtonConfig.fullWidth ?? currentConfig.components.button.fullWidth,\n styles: mergedButtonStyles,\n },\n },\n };\n\n // Notify registered listeners\n listeners.forEach((listener) => {\n try {\n listener(currentConfig);\n } catch (e) {\n console.error('Error notifying Webstrail config listener:', e);\n }\n });\n\n // Dispatch browser DOM event if window is defined\n if (typeof window !== 'undefined') {\n try {\n window.dispatchEvent(\n new CustomEvent('webstrail-config-change', {\n detail: currentConfig,\n })\n );\n } catch {\n // Ignore if event dispatch fails in restricted environments\n }\n }\n\n return currentConfig;\n}\n\n/**\n * Resets global configuration to library defaults.\n */\nexport function resetWebstrailConfig(): void {\n currentConfig = JSON.parse(JSON.stringify(defaultResolvedConfig));\n listeners.forEach((listener) => {\n try {\n listener(currentConfig);\n } catch (e) {\n console.error('Error notifying Webstrail config listener:', e);\n }\n });\n}\n\n/**\n * Resolves effective Button properties and styles using 3-tier priority:\n * 1. Component-level properties / styles\n * 2. Global configuration\n * 3. Built-in default configuration\n */\nexport function resolveEffectiveButtonConfig(componentOverrides?: {\n variant?: ButtonVariant | string;\n size?: ButtonSize | string;\n fullWidth?: boolean;\n styles?: ButtonStyles;\n}): {\n variant: ButtonVariant;\n size: ButtonSize;\n fullWidth: boolean;\n styles: ButtonStyles;\n cssVars: Record<string, string>;\n} {\n const globalBtn = currentConfig.components.button;\n\n const variant = (componentOverrides?.variant as ButtonVariant) || globalBtn.variant || 'primary';\n const size = componentOverrides?.size\n ? normalizeButtonSize(componentOverrides.size)\n : globalBtn.size || 'medium';\n const fullWidth = componentOverrides?.fullWidth ?? globalBtn.fullWidth ?? false;\n\n const resolvedStyles = deepMerge(\n defaultButtonStyles,\n globalBtn.styles,\n componentOverrides?.styles || {}\n );\n\n const cssVars = {\n ...stylesToCssVars(resolvedStyles, 'wui-button'),\n ...stylesToCssVars(resolvedStyles, 'wb-button'),\n };\n\n return {\n variant,\n size,\n fullWidth,\n styles: resolvedStyles,\n cssVars,\n };\n}\n"],"names":["normalizeButtonSize","size","defaultColors","defaultTypography","defaultLayout","defaultButtonStyles","defaultResolvedConfig","getSubtleBackgroundColor","color","opacity","trimmed","hex6","g","b","hex3","percentage","getFocusRingColor","getDarkerShade","amount","factor","r","toHex","n","deriveTokensFromPrimary","primary","selectedBg","selectedHoverBg","ring","hoverBg","activeBg","outlineTint","UNITLESS_PROPERTIES","camelToKebab","str","normalizeDimension","propName","value","isRecord","deepMerge","target","sources","result","source","nextResult","key","sourceValue","existingValue","stylesToCssVars","styles","prefix","vars","varName","currentConfig","listeners","getWebstrailConfig","subscribeWebstrailConfig","listener","configureWebstrail","userConfig","primaryColor","_a","_b","derivedButtonStyles","mergedTheme","rawButtonConfig","_c","buttonSize","mergedButtonStyles","e","resetWebstrailConfig","resolveEffectiveButtonConfig","componentOverrides","globalBtn","variant","fullWidth","resolvedStyles","cssVars"],"mappings":"gFAsCO,SAASA,EAAoBC,EAA2C,CAC7E,GAAI,CAACA,EAAM,MAAO,SAClB,OAAQA,EAAA,CACN,IAAK,KACL,IAAK,QACH,MAAO,QACT,IAAK,KACL,IAAK,QACH,MAAO,QACT,IAAK,KACL,IAAK,SACL,QACE,MAAO,QAAA,CAEb,CC5CO,MAAMC,EAAmC,CAC9C,QAAS,UACT,UAAW,UACX,KAAM,UACN,cAAe,UACf,OAAQ,UACR,WAAY,UACZ,MAAO,UACP,QAAS,UACT,SAAU,UACV,mBAAoB,UACpB,aAAc,UACd,UAAW,0BACb,EAEaC,EAA4C,CACvD,WACE,0GACF,cAAe,OACf,eAAgB,OAChB,cAAe,OACf,iBAAkB,IAClB,iBAAkB,IAClB,eAAgB,GAClB,EAEaC,EAAoC,CAC/C,kBAAmB,MACnB,mBAAoB,MACpB,kBAAmB,MACrB,EAEaC,EAAoC,CAC/C,OAAQ,OACR,aAAc,MACd,SAAU,OACV,WAAY,IACZ,gBAAiB,UACjB,UAAW,UACX,Y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