@vitus-labs/core 1.3.1 → 1.3.2-alpha.2

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.
Files changed (2) hide show
  1. package/lib/index.js.map +1 -1
  2. package/package.json +2 -2
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/compose.ts","../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/hoistNonReactStatics.ts","../src/html/htmlTags.ts","../src/render.ts","../src/utils.ts"],"sourcesContent":["type ArityOneFn = (arg: any) => any\n\n/** Extracts the last function from a tuple type. */\ntype PickLastInTuple<T extends any[]> = T extends [\n ...rest: infer _U,\n argn: infer L,\n]\n ? L\n : any\n\n/** Parameter type of the rightmost (first-applied) function. */\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\n/** Return type of the leftmost (last-applied) function. */\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\n/**\n * Right-to-left function composition.\n * `compose(f, g, h)(x)` === `f(g(h(x)))`.\n *\n * Used throughout the system to build HOC chains —\n * `compose(attrsHoc, userHoc1, userHoc2)(Component)`.\n */\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","import type { ComponentType } from 'react'\nimport { css, styled, ThemeProvider } from 'styled-components'\nimport type { HTMLTags } from '~/html'\n\n/**\n * Singleton configuration that bridges the UI system with styled-components.\n * All packages reference `config.css`, `config.styled`, etc. so the styling\n * engine can be swapped at runtime (e.g. for React Native) via `init()`.\n */\ninterface Internal {\n css: typeof css\n styled: typeof styled\n provider: typeof ThemeProvider\n component: ComponentType | HTMLTags\n textComponent: ComponentType | HTMLTags\n}\n\nclass Configuration {\n css: Internal['css']\n\n styled: Internal['styled']\n\n ExternalProvider: Internal['provider']\n\n component: Internal['component'] = 'div'\n\n textComponent: Internal['textComponent'] = 'span'\n\n constructor(props: Internal) {\n this.css = props.css\n this.styled = props.styled\n this.ExternalProvider = props.provider\n this.component = props.component\n this.textComponent = props.textComponent\n }\n\n init = (props: Partial<Internal>) => {\n if (props.css) {\n this.css = props.css\n }\n\n if (props.styled) {\n this.styled = props.styled\n }\n\n if (props.provider) {\n this.ExternalProvider = props.provider\n }\n\n if (props.component) {\n this.component = props.component\n }\n\n if (props.textComponent) {\n this.textComponent = props.textComponent\n }\n }\n}\n\nconst defaultParams = {\n css,\n styled,\n provider: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as const\n\nconst config = new Configuration(defaultParams)\n\nconst { init } = config\n\nexport default config\nexport { init }\n","/**\n * Type-safe emptiness check for objects, arrays, null, and undefined.\n * Returns `true` for null, undefined, empty objects `{}`, and empty arrays `[]`.\n * Non-object primitives (string, number) also return `true` as any.\n */\nexport type IsEmpty = <\n T extends Record<number | string, any> | any[] | null | undefined,\n>(\n param: T,\n) => T extends null | undefined\n ? true\n : keyof T extends never\n ? true\n : T extends T[]\n ? T[number] extends never\n ? true\n : false\n : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return true as any\n }\n\n if (Array.isArray(param)) {\n return param.length === 0\n }\n\n return Object.keys(param).length === 0\n}\n\nexport default isEmpty\n","import type { FC, ReactNode } from 'react'\nimport { createContext, useMemo } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\nimport type { Breakpoints } from '~/types'\n\n/**\n * Internal React context shared across all @vitus-labs packages.\n * Carries the theme object plus any extra provider props.\n */\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Breakpoints\n } & Record<string, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n children: ReactNode\n } & Record<string, any>\n>\n\n/**\n * Dual-layer provider that feeds both the internal VitusLabs context\n * and an optional external styling provider (e.g. styled-components'\n * ThemeProvider). When no theme is supplied, renders children directly.\n */\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n const ExternalProvider = useMemo(() => config.ExternalProvider, [])\n const context = useMemo(\n () => ({ theme, ...props }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [theme, ...Object.values(props), props],\n )\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n if (isEmpty(theme) || !theme) return <>{children}</>\n\n if (ExternalProvider) {\n return (\n <VitusLabsProvider value={context}>\n <ExternalProvider theme={theme}>{children}</ExternalProvider>\n </VitusLabsProvider>\n )\n }\n\n return <VitusLabsProvider value={context}>{children}</VitusLabsProvider>\n}\n\nexport { context }\n\nexport default Provider\n","import { isMemo } from 'react-is'\n\nconst REACT_STATICS: Record<string, true> = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true,\n}\n\nconst KNOWN_STATICS: Record<string, true> = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true,\n}\n\nconst FORWARD_REF_STATICS: Record<string, true> = {\n $$typeof: true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n}\n\nconst MEMO_STATICS: Record<string, true> = {\n $$typeof: true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true,\n}\n\nconst TYPE_STATICS: Record<string | symbol, Record<string, true>> = {}\n\n// Symbol.for matches what react-is uses internally\nTYPE_STATICS[Symbol.for('react.forward_ref')] = FORWARD_REF_STATICS\nTYPE_STATICS[Symbol.for('react.memo')] = MEMO_STATICS\n\nconst getStatics = (component: any): Record<string, true> => {\n if (isMemo(component)) return MEMO_STATICS\n return TYPE_STATICS[component.$$typeof] || REACT_STATICS\n}\n\nconst hoistNonReactStatics = <T, S>(\n target: T,\n source: S,\n excludeList?: Record<string, true>,\n): T => {\n if (typeof source === 'string') return target\n\n const proto = Object.getPrototypeOf(source)\n if (proto && proto !== Object.prototype) {\n hoistNonReactStatics(target, proto, excludeList)\n }\n\n const keys: (string | symbol)[] = [\n ...Object.getOwnPropertyNames(source),\n ...Object.getOwnPropertySymbols(source),\n ]\n\n const targetStatics = getStatics(target)\n const sourceStatics = getStatics(source)\n\n for (const key of keys) {\n const k = key as string\n if (\n KNOWN_STATICS[k] ||\n excludeList?.[k] ||\n sourceStatics[k] ||\n targetStatics[k]\n ) {\n continue\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (descriptor) {\n try {\n Object.defineProperty(target, key, descriptor)\n } catch {\n // Silently skip non-configurable properties\n }\n }\n }\n\n return target\n}\n\nexport default hoistNonReactStatics\n","const HTML_TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n // 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n // 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n // 'link',\n 'main',\n 'map',\n 'mark',\n // 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n // 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n // 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n // 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n // 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n // 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nconst HTML_TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'del',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = (typeof HTML_TAGS)[number]\n\nexport type HTMLTextTags = (typeof HTML_TEXT_TAGS)[number]\n\nexport { HTML_TAGS, HTML_TEXT_TAGS }\n","import type { ReactNode } from 'react'\nimport { cloneElement, createElement, isValidElement } from 'react'\nimport { isFragment, isValidElementType } from 'react-is'\nimport isEmpty from './isEmpty'\n\ntype CreateTypes = Parameters<typeof createElement>[0]\ntype CloneTypes = Parameters<typeof cloneElement>[0]\ntype RenderProps<T extends Record<string, unknown> | undefined> = (\n props: Partial<T>,\n) => ReactNode\n\n/**\n * Flexible element renderer that handles multiple content types:\n * - Primitives (string, number) — returned as-is\n * - Arrays and fragments — returned as-is\n * - Component types (class/function) — created via `createElement`\n * - Valid elements — cloned with `attachProps` if provided\n * - Falsy values — return null\n */\nexport type Render = <T extends Record<string, any> | undefined>(\n content?: CreateTypes | CloneTypes | ReactNode | ReactNode[] | RenderProps<T>,\n attachProps?: T,\n) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\nconst render: Render = (content, attachProps) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n if (!content) return null as any\n\n const render = (child: Parameters<typeof createElement>[0]) =>\n attachProps ? createElement(child, attachProps) : createElement(child)\n\n if (['number', 'boolean', 'bigint', 'string'].includes(typeof content)) {\n return content\n }\n\n if (Array.isArray(content) || isFragment(content)) {\n return content\n }\n\n if (isValidElementType(content)) {\n return render(content)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(content, attachProps)\n }\n\n return content\n}\n\nexport default render\n","// --------------------------------------------------------\n// omit — create a new object without the specified keys.\n// Accepts nullable input for convenience (returns `{}`).\n// Uses a Set for O(1) key lookup.\n// --------------------------------------------------------\nexport const omit = <T extends Record<string, any>>(\n obj: T | null | undefined,\n keys?: readonly (string | keyof T)[],\n): Partial<T> => {\n if (obj == null) return {} as Partial<T>\n if (!keys || keys.length === 0) return { ...obj }\n\n const result: Record<string, any> = {}\n const keysSet = new Set(keys as readonly string[])\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key) && !keysSet.has(key)) {\n result[key] = obj[key]\n }\n }\n\n return result as Partial<T>\n}\n\n// --------------------------------------------------------\n// pick — create a new object with only the specified keys.\n// Accepts nullable input for convenience (returns `{}`).\n// When no keys given, returns a shallow copy of the whole object.\n// --------------------------------------------------------\nexport const pick = <T extends Record<string, any>>(\n obj: T | null | undefined,\n keys?: readonly (string | keyof T)[],\n): Partial<T> => {\n if (obj == null) return {} as Partial<T>\n if (!keys || keys.length === 0) return { ...obj }\n\n const result: Record<string, any> = {}\n\n for (const key of keys) {\n const k = key as string\n if (Object.hasOwn(obj, k)) {\n result[k] = obj[k]\n }\n }\n\n return result as Partial<T>\n}\n\n// --------------------------------------------------------\n// get — retrieve a nested value by dot/bracket path.\n// e.g. get(obj, 'a.b.c') or get(obj, 'a.children[0]')\n// Returns `defaultValue` when any segment is null/undefined.\n// --------------------------------------------------------\nconst PATH_RE = /[^.[\\]]+/g\n\n/** Split a dot/bracket path string into individual key tokens. */\nconst parsePath = (path: string | string[]): string[] => {\n if (Array.isArray(path)) return path\n const parts = path.match(PATH_RE)\n return parts ?? []\n}\n\nexport const get = (\n obj: any,\n path: string | string[],\n defaultValue?: any,\n): any => {\n const keys = parsePath(path)\n let result = obj\n\n for (const key of keys) {\n if (result == null) return defaultValue\n result = result[key]\n }\n\n return result === undefined ? defaultValue : result\n}\n\n// --------------------------------------------------------\n// set — set a nested value by path (mutates the object).\n// Auto-creates intermediate objects/arrays as needed.\n// Blocks prototype-pollution keys (__proto__, constructor, prototype).\n// --------------------------------------------------------\nconst UNSAFE_KEYS = new Set(['__proto__', 'prototype', 'constructor'])\n\nexport const set = (\n obj: Record<string, any>,\n path: string | string[],\n value: any,\n): Record<string, any> => {\n const keys = parsePath(path)\n if (keys.some((k) => UNSAFE_KEYS.has(k))) return obj\n\n let current = obj\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i]!\n const nextKey = keys[i + 1]!\n\n if (current[key] == null) {\n // create array if next key is numeric, otherwise object\n current[key] = /^\\d+$/.test(nextKey) ? [] : {}\n }\n\n current = current[key]\n }\n\n const lastKey = keys[keys.length - 1]\n if (lastKey != null) {\n current[lastKey] = value\n }\n\n return obj\n}\n\n// --------------------------------------------------------\n// throttle — limit function execution to at most once per `wait` ms.\n// Trailing calls are preserved: if called during the cooldown, the\n// last invocation fires after the remaining delay.\n// Returns a throttled function with a `.cancel()` method to clear\n// any pending trailing call.\n// --------------------------------------------------------\nexport const throttle = <T extends (...args: any[]) => any>(\n fn: T,\n wait: number = 0,\n): T & { cancel: () => void } => {\n let lastCallTime: number | undefined\n let timeoutId: ReturnType<typeof setTimeout> | undefined\n let lastArgs: any[] | undefined\n\n const throttled = (...args: any[]) => {\n const now = Date.now()\n\n if (lastCallTime === undefined || now - lastCallTime >= wait) {\n lastCallTime = now\n fn(...args)\n } else {\n lastArgs = args\n if (timeoutId === undefined) {\n const remaining = wait - (now - lastCallTime)\n timeoutId = setTimeout(() => {\n lastCallTime = Date.now()\n timeoutId = undefined\n if (lastArgs) {\n fn(...lastArgs)\n lastArgs = undefined\n }\n }, remaining)\n }\n }\n }\n\n throttled.cancel = () => {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId)\n timeoutId = undefined\n }\n lastArgs = undefined\n lastCallTime = undefined\n }\n\n return throttled as T & { cancel: () => void }\n}\n\n// --------------------------------------------------------\n// merge — deep merge objects (source wins, arrays replaced wholesale).\n// Only plain objects are recursed into; class instances and arrays\n// are assigned by reference. Blocks prototype-pollution keys.\n// --------------------------------------------------------\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype\n\nexport const merge = <T extends Record<string, any>>(\n target: T,\n ...sources: Record<string, any>[]\n): T => {\n for (const source of sources) {\n if (source == null) continue\n\n for (const key of Object.keys(source)) {\n if (key === '__proto__' || key === 'constructor' || key === 'prototype')\n continue\n\n const targetVal = (target as any)[key]\n const sourceVal = source[key]\n\n if (isPlainObject(targetVal) && isPlainObject(sourceVal)) {\n ;(target as any)[key] = merge({ ...targetVal }, sourceVal)\n } else {\n ;(target as any)[key] = sourceVal\n }\n }\n }\n\n return target\n}\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,WACqB,GAAG,SAC3B,MAEC,IAAI,aAAa,KAAU,QAAa,IAAI,IAAI,EAAE,EAAE;;;;ACTxD,IAAM,gBAAN,MAAoB;CAClB;CAEA;CAEA;CAEA,YAAmC;CAEnC,gBAA2C;CAE3C,YAAY,OAAiB;AAC3B,OAAK,MAAM,MAAM;AACjB,OAAK,SAAS,MAAM;AACpB,OAAK,mBAAmB,MAAM;AAC9B,OAAK,YAAY,MAAM;AACvB,OAAK,gBAA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AAUT,MAAa,YACX,IACA,OAAe,MACgB;CAC/B,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,MAAM,aAAa,GAAG,SAAgB;EACpC,MAAM,MAAM,KAAK,KAAK;AAEtB,MAAI,iBAAiB,UAAa,MAAM,gBAAgB,MAAM;AAC5D,kBAAe;AACf,MAAG,GAAG,KAAK;SACN;AACL,cAAW;AACX,OAAI,cAAc,QAAW;IAC3B,MAAM,YAAY,QAAQ,MAAM;AAChC,gBAAY,iBAAiB;AAC3B,oBAAe,KAAK,KAAK;AACzB,iBAAY;AACZ,SAAI,UAAU;AACZ,SAAG,GAAG,SAAS;AACf,iBAAW;;OAEZ,UAAU;;;;AAKnB,WAAU,eAAe;AACvB,MAAI,cAAc,QAAW;AAC3B,gBAAa,UAAU;AACvB,eAAY;;AAEd,aAAW;AACX,iBAAe;;AAGjB,QAAO;;AAQT,MAAM,iBAAiB,UACrB,UAAU,QACV,OAAO,UAAU,YACjB,CAAC,MAAM,QAAQ,MAAM,IACrB,OAAO,eAAe,MAAM,KAAK,OAAO;AAE1C,MAAa,SACX,QACA,GAAG,YACG;AACN,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,UAAU,KAAM;AAEpB,OAAK,MAAM,OAAO,OAAO,KAAK,OAAO,EAAE;AACrC,OAAI,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ,YAC1D;GAEF,MAAM,YAAa,OAAe;GAClC,MAAM,YAAY,OAAO;AAEzB,OAAI,cAAc,UAAU,IAAI,cAAc,UAAU,CACrD,CAAC,OAAe,OAAO,MAAM,EAAE,GAAG,WAAW,EAAE,UAAU;OAEzD,CAAC,OAAe,OAAO;;;AAK9B,QAAO"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/compose.ts","../src/config.ts","../src/isEmpty.ts","../src/context.tsx","../src/hoistNonReactStatics.ts","../src/html/htmlTags.ts","../src/render.ts","../src/utils.ts"],"sourcesContent":["type ArityOneFn = (arg: any) => any\n\n/** Extracts the last function from a tuple type. */\ntype PickLastInTuple<T extends any[]> = T extends [\n ...rest: infer _U,\n argn: infer L,\n]\n ? L\n : any\n\n/** Parameter type of the rightmost (first-applied) function. */\ntype FirstFnParameterType<T extends any[]> = Parameters<PickLastInTuple<T>>[any]\n/** Return type of the leftmost (last-applied) function. */\ntype LastFnReturnType<T extends any[]> = ReturnType<T[0]>\n\n/**\n * Right-to-left function composition.\n * `compose(f, g, h)(x)` === `f(g(h(x)))`.\n *\n * Used throughout the system to build HOC chains —\n * `compose(attrsHoc, userHoc1, userHoc2)(Component)`.\n */\nconst compose =\n <T extends ArityOneFn[]>(...fns: T) =>\n (p: FirstFnParameterType<T>): LastFnReturnType<T> =>\n fns.reduceRight((acc: any, cur: any) => cur(acc), p)\n\nexport default compose\n","import type { ComponentType } from 'react'\nimport { css, styled, ThemeProvider } from 'styled-components'\nimport type { HTMLTags } from '~/html'\n\n/**\n * Singleton configuration that bridges the UI system with styled-components.\n * All packages reference `config.css`, `config.styled`, etc. so the styling\n * engine can be swapped at runtime (e.g. for React Native) via `init()`.\n */\ninterface Internal {\n css: typeof css\n styled: typeof styled\n provider: typeof ThemeProvider\n component: ComponentType | HTMLTags\n textComponent: ComponentType | HTMLTags\n}\n\nclass Configuration {\n css: Internal['css']\n\n styled: Internal['styled']\n\n ExternalProvider: Internal['provider']\n\n component: Internal['component'] = 'div'\n\n textComponent: Internal['textComponent'] = 'span'\n\n constructor(props: Internal) {\n this.css = props.css\n this.styled = props.styled\n this.ExternalProvider = props.provider\n this.component = props.component\n this.textComponent = props.textComponent\n }\n\n init = (props: Partial<Internal>) => {\n if (props.css) {\n this.css = props.css\n }\n\n if (props.styled) {\n this.styled = props.styled\n }\n\n if (props.provider) {\n this.ExternalProvider = props.provider\n }\n\n if (props.component) {\n this.component = props.component\n }\n\n if (props.textComponent) {\n this.textComponent = props.textComponent\n }\n }\n}\n\nconst defaultParams = {\n css,\n styled,\n provider: ThemeProvider,\n component: 'div',\n textComponent: 'span',\n} as const\n\nconst config = new Configuration(defaultParams)\n\nconst { init } = config\n\nexport default config\nexport { init }\n","/**\n * Type-safe emptiness check for objects, arrays, null, and undefined.\n * Returns `true` for null, undefined, empty objects `{}`, and empty arrays `[]`.\n * Non-object primitives (string, number) also return `true` as any.\n */\nexport type IsEmpty = <\n T extends Record<number | string, any> | any[] | null | undefined,\n>(\n param: T,\n) => T extends null | undefined\n ? true\n : keyof T extends never\n ? true\n : T extends T[]\n ? T[number] extends never\n ? true\n : false\n : false\n\nconst isEmpty: IsEmpty = (param) => {\n if (!param) return true\n\n if (typeof param !== 'object') {\n return true as any\n }\n\n if (Array.isArray(param)) {\n return param.length === 0\n }\n\n return Object.keys(param).length === 0\n}\n\nexport default isEmpty\n","import type { FC, ReactNode } from 'react'\nimport { createContext, useMemo } from 'react'\nimport config from '~/config'\nimport isEmpty from '~/isEmpty'\nimport type { Breakpoints } from '~/types'\n\n/**\n * Internal React context shared across all @vitus-labs packages.\n * Carries the theme object plus any extra provider props.\n */\nconst context = createContext<any>({})\nconst VitusLabsProvider = context.Provider\n\ntype Theme = Partial<\n {\n rootSize: number\n breakpoints: Breakpoints\n } & Record<string, any>\n>\n\ntype ProviderType = Partial<\n {\n theme: Theme\n children: ReactNode\n } & Record<string, any>\n>\n\n/**\n * Dual-layer provider that feeds both the internal VitusLabs context\n * and an optional external styling provider (e.g. styled-components'\n * ThemeProvider). When no theme is supplied, renders children directly.\n */\nconst Provider: FC<ProviderType> = ({ theme, children, ...props }) => {\n const ExternalProvider = useMemo(() => config.ExternalProvider, [])\n const context = useMemo(\n () => ({ theme, ...props }),\n [theme, ...Object.values(props), props],\n )\n\n if (isEmpty(theme) || !theme) return <>{children}</>\n\n if (ExternalProvider) {\n return (\n <VitusLabsProvider value={context}>\n <ExternalProvider theme={theme}>{children}</ExternalProvider>\n </VitusLabsProvider>\n )\n }\n\n return <VitusLabsProvider value={context}>{children}</VitusLabsProvider>\n}\n\nexport { context }\n\nexport default Provider\n","import { isMemo } from 'react-is'\n\nconst REACT_STATICS: Record<string, true> = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true,\n}\n\nconst KNOWN_STATICS: Record<string, true> = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true,\n}\n\nconst FORWARD_REF_STATICS: Record<string, true> = {\n $$typeof: true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n}\n\nconst MEMO_STATICS: Record<string, true> = {\n $$typeof: true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true,\n}\n\nconst TYPE_STATICS: Record<string | symbol, Record<string, true>> = {}\n\n// Symbol.for matches what react-is uses internally\nTYPE_STATICS[Symbol.for('react.forward_ref')] = FORWARD_REF_STATICS\nTYPE_STATICS[Symbol.for('react.memo')] = MEMO_STATICS\n\nconst getStatics = (component: any): Record<string, true> => {\n if (isMemo(component)) return MEMO_STATICS\n return TYPE_STATICS[component.$$typeof] || REACT_STATICS\n}\n\nconst hoistNonReactStatics = <T, S>(\n target: T,\n source: S,\n excludeList?: Record<string, true>,\n): T => {\n if (typeof source === 'string') return target\n\n const proto = Object.getPrototypeOf(source)\n if (proto && proto !== Object.prototype) {\n hoistNonReactStatics(target, proto, excludeList)\n }\n\n const keys: (string | symbol)[] = [\n ...Object.getOwnPropertyNames(source),\n ...Object.getOwnPropertySymbols(source),\n ]\n\n const targetStatics = getStatics(target)\n const sourceStatics = getStatics(source)\n\n for (const key of keys) {\n const k = key as string\n if (\n KNOWN_STATICS[k] ||\n excludeList?.[k] ||\n sourceStatics[k] ||\n targetStatics[k]\n ) {\n continue\n }\n\n const descriptor = Object.getOwnPropertyDescriptor(source, key)\n if (descriptor) {\n try {\n Object.defineProperty(target, key, descriptor)\n } catch {\n // Silently skip non-configurable properties\n }\n }\n }\n\n return target\n}\n\nexport default hoistNonReactStatics\n","const HTML_TAGS = [\n 'a',\n 'abbr',\n // 'acronym',\n 'address',\n // 'applet',\n 'area',\n 'article',\n 'aside',\n 'audio',\n 'b',\n // 'base',\n // 'basefont',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'body',\n 'br',\n 'button',\n 'canvas',\n 'caption',\n // 'center',\n 'cite',\n 'code',\n 'col',\n 'colgroup',\n 'data',\n 'datalist',\n 'dd',\n 'del',\n 'details',\n 'dfn',\n 'dialog',\n // 'dir',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'embed',\n 'fieldset',\n 'figcaption',\n 'figure',\n // 'font',\n 'footer',\n 'form',\n // 'frame',\n // 'frameset',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n // 'head',\n 'header',\n 'hr',\n 'html',\n 'i',\n 'iframe',\n 'img',\n 'input',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n // 'link',\n 'main',\n 'map',\n 'mark',\n // 'meta',\n 'meter',\n 'nav',\n // 'noframes',\n // 'noscript',\n 'object',\n 'ol',\n 'optgroup',\n 'option',\n 'output',\n 'p',\n // 'param',\n 'picture',\n 'pre',\n 'progress',\n 'q',\n 'rp',\n 'rt',\n 'ruby',\n 's',\n 'samp',\n // 'script',\n 'section',\n 'select',\n 'small',\n 'source',\n 'span',\n // 'strike',\n 'strong',\n // 'style',\n 'sub',\n 'summary',\n 'sup',\n 'svg',\n 'table',\n 'tbody',\n 'td',\n 'template',\n 'textarea',\n 'tfoot',\n 'th',\n 'thead',\n 'time',\n // 'title',\n 'tr',\n 'track',\n // 'tt',\n 'u',\n 'ul',\n 'var',\n 'video',\n 'wbr',\n] as const\n\nconst HTML_TEXT_TAGS = [\n 'abbr',\n 'b',\n 'bdi',\n 'bdo',\n 'big',\n 'blockquote',\n 'cite',\n 'code',\n 'del',\n 'div',\n 'dl',\n 'dt',\n 'em',\n 'figcaption',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'i',\n 'ins',\n 'kbd',\n 'label',\n 'legend',\n 'li',\n 'p',\n 'pre',\n 'q',\n 'rp',\n 'rt',\n 's',\n 'small',\n 'span',\n 'strong',\n 'sub',\n 'summary',\n 'sup',\n 'time',\n 'u',\n] as const\n\nexport type HTMLTags = (typeof HTML_TAGS)[number]\n\nexport type HTMLTextTags = (typeof HTML_TEXT_TAGS)[number]\n\nexport { HTML_TAGS, HTML_TEXT_TAGS }\n","import type { ReactNode } from 'react'\nimport { cloneElement, createElement, isValidElement } from 'react'\nimport { isFragment, isValidElementType } from 'react-is'\nimport isEmpty from './isEmpty'\n\ntype CreateTypes = Parameters<typeof createElement>[0]\ntype CloneTypes = Parameters<typeof cloneElement>[0]\ntype RenderProps<T extends Record<string, unknown> | undefined> = (\n props: Partial<T>,\n) => ReactNode\n\n/**\n * Flexible element renderer that handles multiple content types:\n * - Primitives (string, number) — returned as-is\n * - Arrays and fragments — returned as-is\n * - Component types (class/function) — created via `createElement`\n * - Valid elements — cloned with `attachProps` if provided\n * - Falsy values — return null\n */\nexport type Render = <T extends Record<string, any> | undefined>(\n content?: CreateTypes | CloneTypes | ReactNode | ReactNode[] | RenderProps<T>,\n attachProps?: T,\n) => ReturnType<typeof createElement> | ReturnType<typeof cloneElement> | null\n\nconst render: Render = (content, attachProps) => {\n if (!content) return null as any\n\n const render = (child: Parameters<typeof createElement>[0]) =>\n attachProps ? createElement(child, attachProps) : createElement(child)\n\n if (['number', 'boolean', 'bigint', 'string'].includes(typeof content)) {\n return content\n }\n\n if (Array.isArray(content) || isFragment(content)) {\n return content\n }\n\n if (isValidElementType(content)) {\n return render(content)\n }\n\n if (isValidElement(content)) {\n if (isEmpty(attachProps)) {\n return content\n }\n\n return cloneElement(content, attachProps)\n }\n\n return content\n}\n\nexport default render\n","// --------------------------------------------------------\n// omit — create a new object without the specified keys.\n// Accepts nullable input for convenience (returns `{}`).\n// Uses a Set for O(1) key lookup.\n// --------------------------------------------------------\nexport const omit = <T extends Record<string, any>>(\n obj: T | null | undefined,\n keys?: readonly (string | keyof T)[],\n): Partial<T> => {\n if (obj == null) return {} as Partial<T>\n if (!keys || keys.length === 0) return { ...obj }\n\n const result: Record<string, any> = {}\n const keysSet = new Set(keys as readonly string[])\n\n for (const key in obj) {\n if (Object.hasOwn(obj, key) && !keysSet.has(key)) {\n result[key] = obj[key]\n }\n }\n\n return result as Partial<T>\n}\n\n// --------------------------------------------------------\n// pick — create a new object with only the specified keys.\n// Accepts nullable input for convenience (returns `{}`).\n// When no keys given, returns a shallow copy of the whole object.\n// --------------------------------------------------------\nexport const pick = <T extends Record<string, any>>(\n obj: T | null | undefined,\n keys?: readonly (string | keyof T)[],\n): Partial<T> => {\n if (obj == null) return {} as Partial<T>\n if (!keys || keys.length === 0) return { ...obj }\n\n const result: Record<string, any> = {}\n\n for (const key of keys) {\n const k = key as string\n if (Object.hasOwn(obj, k)) {\n result[k] = obj[k]\n }\n }\n\n return result as Partial<T>\n}\n\n// --------------------------------------------------------\n// get — retrieve a nested value by dot/bracket path.\n// e.g. get(obj, 'a.b.c') or get(obj, 'a.children[0]')\n// Returns `defaultValue` when any segment is null/undefined.\n// --------------------------------------------------------\nconst PATH_RE = /[^.[\\]]+/g\n\n/** Split a dot/bracket path string into individual key tokens. */\nconst parsePath = (path: string | string[]): string[] => {\n if (Array.isArray(path)) return path\n const parts = path.match(PATH_RE)\n return parts ?? []\n}\n\nexport const get = (\n obj: any,\n path: string | string[],\n defaultValue?: any,\n): any => {\n const keys = parsePath(path)\n let result = obj\n\n for (const key of keys) {\n if (result == null) return defaultValue\n result = result[key]\n }\n\n return result === undefined ? defaultValue : result\n}\n\n// --------------------------------------------------------\n// set — set a nested value by path (mutates the object).\n// Auto-creates intermediate objects/arrays as needed.\n// Blocks prototype-pollution keys (__proto__, constructor, prototype).\n// --------------------------------------------------------\nconst UNSAFE_KEYS = new Set(['__proto__', 'prototype', 'constructor'])\n\nexport const set = (\n obj: Record<string, any>,\n path: string | string[],\n value: any,\n): Record<string, any> => {\n const keys = parsePath(path)\n if (keys.some((k) => UNSAFE_KEYS.has(k))) return obj\n\n let current = obj\n for (let i = 0; i < keys.length - 1; i++) {\n const key = keys[i]!\n const nextKey = keys[i + 1]!\n\n if (current[key] == null) {\n // create array if next key is numeric, otherwise object\n current[key] = /^\\d+$/.test(nextKey) ? [] : {}\n }\n\n current = current[key]\n }\n\n const lastKey = keys[keys.length - 1]\n if (lastKey != null) {\n current[lastKey] = value\n }\n\n return obj\n}\n\n// --------------------------------------------------------\n// throttle — limit function execution to at most once per `wait` ms.\n// Trailing calls are preserved: if called during the cooldown, the\n// last invocation fires after the remaining delay.\n// Returns a throttled function with a `.cancel()` method to clear\n// any pending trailing call.\n// --------------------------------------------------------\nexport const throttle = <T extends (...args: any[]) => any>(\n fn: T,\n wait: number = 0,\n): T & { cancel: () => void } => {\n let lastCallTime: number | undefined\n let timeoutId: ReturnType<typeof setTimeout> | undefined\n let lastArgs: any[] | undefined\n\n const throttled = (...args: any[]) => {\n const now = Date.now()\n\n if (lastCallTime === undefined || now - lastCallTime >= wait) {\n lastCallTime = now\n fn(...args)\n } else {\n lastArgs = args\n if (timeoutId === undefined) {\n const remaining = wait - (now - lastCallTime)\n timeoutId = setTimeout(() => {\n lastCallTime = Date.now()\n timeoutId = undefined\n if (lastArgs) {\n fn(...lastArgs)\n lastArgs = undefined\n }\n }, remaining)\n }\n }\n }\n\n throttled.cancel = () => {\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId)\n timeoutId = undefined\n }\n lastArgs = undefined\n lastCallTime = undefined\n }\n\n return throttled as T & { cancel: () => void }\n}\n\n// --------------------------------------------------------\n// merge — deep merge objects (source wins, arrays replaced wholesale).\n// Only plain objects are recursed into; class instances and arrays\n// are assigned by reference. Blocks prototype-pollution keys.\n// --------------------------------------------------------\nconst isPlainObject = (value: unknown): value is Record<string, any> =>\n value !== null &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype\n\nexport const merge = <T extends Record<string, any>>(\n target: T,\n ...sources: Record<string, any>[]\n): T => {\n for (const source of sources) {\n if (source == null) continue\n\n for (const key of Object.keys(source)) {\n if (key === '__proto__' || key === 'constructor' || key === 'prototype')\n continue\n\n const targetVal = (target as any)[key]\n const sourceVal = source[key]\n\n if (isPlainObject(targetVal) && isPlainObject(sourceVal)) {\n ;(target as any)[key] = merge({ ...targetVal }, sourceVal)\n } else {\n ;(target as any)[key] = sourceVal\n }\n }\n }\n\n return target\n}\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,WACqB,GAAG,SAC3B,MACC,IAAI,aAAa,KAAU,QAAa,IAAI,IAAI,EAAE,EAAE;;;;ACRxD,IAAM,gBAAN,MAAoB;CAClB;CAEA;CAEA;CAEA,YAAmC;CAEnC,gBAA2C;CAE3C,YAAY,OAAiB;AAC3B,OAAK,MAAM,MAAM;AACjB,OAAK,SAAS,MAAM;AACpB,OAAK,mBAAmB,MAAM;AAC9B,OAAK,YAAY,MAAM;AACvB,OAAK,gBAAgB,MAAM;;CAG7B,QAAQ,UAA6B;AACnC,MAAI,MAAM,IACR,MAAK,MAAM,MAAM;AAGnB,MAAI,MAAM,OACR,MAAK,SAAS,MAAM;AAGtB,MAAI,MAAM,SACR,MAAK,mBAAmB,MAAM;AAGhC,MAAI,MAAM,UACR,MAAK,YAAY,MAAM;AAGzB,MAAI,MAAM,cACR,MAAK,gBAAgB,MAAM;;;AAajC,MAAM,SAAS,IAAI,cARG;CACpB;CACA;CACA,UAAU;CACV,WAAW;CACX,eAAe;CAChB,CAE8C;AAE/C,MAAM,EAAE,SAAS;;;;AClDjB,MAAM,WAAoB,UAAU;AAClC,KAAI,CAAC,MAAO,QAAO;AAEnB,KAAI,OAAO,UAAU,SACnB,QAAO;AAGT,KAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,WAAW;AAG1B,QAAO,OAAO,KAAK,MAAM,CAAC,WAAW;;;;;;;;;ACpBvC,MAAM,UAAU,cA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UAAU,OAAO,UAC5B,sBAAqB,QAAQ,OAAO,YAAY;CAGlD,MAAM,OAA4B,CAChC,GAAG,OAAO,oBAAoB,OAAO,EACrC,GAAG,OAAO,sBAAsB,OAAO,CACxC;CAED,MAAM,gBAAgB,WAAW,OAAO;CACxC,MAAM,gBAAgB,WAAW,OAAO;AAExC,MAAK,MAAM,OAAO,MAAM;EACtB,MAAM,IAAI;AACV,MACE,cAAc,MACd,cAAc,MACd,cAAc,MACd,cAAc,GAEd;EAGF,MAAM,aAAa,OAAO,yBAAyB,QAAQ,IAAI;AAC/D,MAAI,WACF,KAAI;AACF,UAAO,eAAe,QAAQ,KAAK,WAAW;UACxC;;AAMZ,QAAO;;;;;AC/FT,MAAM,YAAY;CAChB;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACD;AAED,MAAM,iBAAiB;CACrB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AC9ID,MAAM,UAAkB,SAAS,gBAAgB;AAC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ACjB,CAAC,MAAM,QAAQ,MAAM,IACrB,OAAO,eAAe,MAAM,KAAK,OAAO;AAE1C,MAAa,SACX,QACA,GAAG,YACG;AACN,MAAK,MAAM,UAAU,SAAS;AAC5B,MAAI,UAAU,KAAM;AAEpB,OAAK,MAAM,OAAO,OAAO,KAAK,OAAO,EAAE;AACrC,OAAI,QAAQ,eAAe,QAAQ,iBAAiB,QAAQ,YAC1D;GAEF,MAAM,YAAa,OAAe;GAClC,MAAM,YAAY,OAAO;AAEzB,OAAI,cAAc,UAAU,IAAI,cAAc,UAAU,CACrD,CAAC,OAAe,OAAO,MAAM,EAAE,GAAG,WAAW,EAAE,UAAU;OAEzD,CAAC,OAAe,OAAO;;;AAK9B,QAAO"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitus-labs/core",
3
- "version": "1.3.1",
3
+ "version": "1.3.2-alpha.2+5db1de0",
4
4
  "license": "MIT",
5
5
  "author": "Vit Bokisch <vit@bokisch.cz>",
6
6
  "maintainers": [
@@ -55,5 +55,5 @@
55
55
  "@vitus-labs/tools-rolldown": "^1.6.0",
56
56
  "@vitus-labs/tools-typescript": "^1.6.0"
57
57
  },
58
- "gitHead": "bb22d6fa565082f85feab8275cb01ec51e4fc531"
58
+ "gitHead": "5db1de07a7b0efa905c31b01c21b2576fc68e664"
59
59
  }