@vitus-labs/attrs 1.3.1-alpha.2 → 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 +4 -4
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["attrsHoc","useRef"],"sources":["../src/utils/attrs.ts","../src/hoc/attrsHoc.tsx","../src/hooks/useRef.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/utils/statics.ts","../src/attrs.tsx","../src/init.ts","../src/isAttrsComponent.tsx","../src/index.ts"],"sourcesContent":["/* eslint-disable no-param-reassign */\nimport { isEmpty } from '@vitus-labs/core'\n\n/**\n * Strips keys with `undefined` values from a props object.\n * This prevents undefined consumer props from overriding defaults\n * computed by `.attrs()` callbacks. Only explicitly set values\n * (including `null`) should override defaults.\n */\ntype RemoveUndefinedProps = <T extends Record<string, any>>(\n props: T,\n) => { [I in keyof T as T[I] extends undefined ? never : I]: T[I] }\n\nexport const removeUndefinedProps: RemoveUndefinedProps = (props) =>\n Object.keys(props).reduce((acc, key) => {\n const currentValue = props[key]\n if (currentValue !== undefined) acc[key] = currentValue\n return acc\n }, {} as any)\n\n/**\n * Reduces an array of option functions (from chained `.attrs()` calls)\n * into a single merged result. Each function is called with `args`\n * (typically the current props) and its return value is merged\n * left-to-right via Object.assign — so later `.attrs()` calls\n * override earlier ones.\n *\n * Returns a curried function: first call binds the chain, second\n * call provides the arguments and executes the reduction.\n */\ntype OptionFunc<A> = (...arg: A[]) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: OptionFunc<A>[],\n) => (args: A[]) => ReturnType<OptionFunc<A>>\n\nexport const calculateChainOptions: CalculateChainOptions =\n (options) => (args) => {\n const result = {}\n if (!options || isEmpty(options)) return result\n\n return options.reduce((acc, item) => Object.assign(acc, item(...args)), {})\n }\n","import {\n type ComponentType,\n type ForwardRefExoticComponent,\n forwardRef,\n useMemo,\n} from 'react'\nimport type { Configuration } from '~/types/configuration'\nimport { calculateChainOptions, removeUndefinedProps } from '~/utils/attrs'\n\nexport type AttrsStyleHOC = ({\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentType<any>,\n) => ForwardRefExoticComponent<any>\n\n/**\n * Creates the core HOC that computes default props from the `.attrs()` chain.\n *\n * This is always the outermost HOC in the compose chain, so it runs first.\n * It resolves both priority and normal attrs callbacks, then merges them\n * with the consumer's explicit props following this precedence:\n *\n * priorityAttrs < normalAttrs < explicit props (last wins)\n *\n * The consumer's `ref` is forwarded as `$attrsRef` through the rest of the\n * HOC chain, since intermediate HOCs may need their own `ref`.\n */\nconst createAttrsHOC: AttrsStyleHOC = ({ attrs, priorityAttrs }) => {\n // Pre-build the chain reducers once (not per render).\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const attrsHoc = (WrappedComponent: ComponentType<any>) =>\n forwardRef<any, any>((props, ref) => {\n // Strip undefined values so they don't shadow defaults from attrs callbacks.\n // Only explicitly set values (including `null`) should override defaults.\n const filteredProps = useMemo(() => removeUndefinedProps(props), [props])\n\n const finalProps = useMemo(() => {\n // 1. Resolve priority attrs (lowest precedence defaults).\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps])\n // 2. Resolve normal attrs — these see priority + explicit props as input.\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ])\n\n // 3. Merge: priority < normal attrs < explicit props (last wins).\n return {\n $attrsRef: ref,\n ...prioritizedAttrs,\n ...finalAttrs,\n ...filteredProps,\n }\n }, [filteredProps, ref])\n\n return <WrappedComponent {...finalProps} />\n })\n\n return attrsHoc\n}\n\nexport default createAttrsHOC\n","import { type ForwardedRef, useImperativeHandle, useRef } from 'react'\n\ntype UseAttrsRef = (props: {\n $attrsRef?: ForwardedRef<unknown>\n ref?: ForwardedRef<unknown>\n}) => ForwardedRef<unknown>\n\n/**\n * Unifies two ref sources into a single internal ref.\n *\n * The attrs HOC chain creates two refs that both need to reach the same DOM node:\n * - `$attrsRef`: the consumer's original ref, forwarded through attrsHoc\n * - `ref`: a ref from any intermediate HOC added via `.compose()`\n *\n * This hook creates one internal ref and wires both forwarded refs to it\n * via `useImperativeHandle`, so `consumer.ref.current === hoc.ref.current`.\n */\nconst useAttrsStyleRef: UseAttrsRef = ({ $attrsRef, ref }) => {\n const internalRef = useRef(null)\n\n useImperativeHandle($attrsRef, () => internalRef.current)\n useImperativeHandle(ref, () => internalRef.current)\n\n return internalRef\n}\n\nexport default useAttrsStyleRef\n","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n/**\n * Appends a new attrs option to the existing chain of option functions.\n *\n * The `.attrs()` API accepts either an object or a callback. This function\n * normalizes both forms into a function (objects are wrapped in `() => obj`)\n * and appends to the existing array. The array is cloned so each chained\n * component gets its own copy — maintaining immutability across the chain.\n */\ntype ChainOptions = (\n opts: Obj | Func | undefined,\n defaultOpts: Func[],\n) => Func[]\n\nexport const chainOptions: ChainOptions = (opts, defaultOpts = []) => {\n const result = [...defaultOpts]\n\n if (typeof opts === 'function') result.push(opts)\n else if (typeof opts === 'object') result.push(() => opts)\n\n return result\n}\n","/* eslint-disable import/prefer-default-export */\n\n/**\n * Extracts HOC functions from the `.compose()` configuration and reverses\n * them for correct application order. Setting a key to `null`, `undefined`,\n * or `false` removes a previously defined HOC — only actual functions are kept.\n *\n * The reversal is needed because `compose(a, b, c)(Component)` applies as\n * `a(b(c(Component)))`, so the last-defined HOC should wrap innermost.\n */\ntype CalculateHocsFuncs = (\n options: Record<string, any>,\n) => ((arg: any) => any)[]\n\nexport const calculateHocsFuncs: CalculateHocsFuncs = (options = {}) =>\n Object.values(options)\n .filter((item) => typeof item === 'function')\n .reverse()\n","import { isEmpty } from '@vitus-labs/core'\n\n/**\n * Copies user-defined statics from `.statics()` into the component's\n * `meta` object. These are accessible at `Component.meta.myStatic`.\n */\ntype CreateStaticsEnhancers = (params: {\n context: Record<string, any>\n options: Record<string, any>\n}) => void\n\nexport const createStaticsEnhancers: CreateStaticsEnhancers = ({\n context,\n options,\n}) => {\n if (!isEmpty(options)) {\n Object.assign(context, options)\n }\n}\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable no-underscore-dangle */\n\nimport { compose, hoistNonReactStatics, omit, pick } from '@vitus-labs/core'\nimport { forwardRef, useMemo } from 'react'\nimport { attrsHoc } from '~/hoc'\nimport { useRef } from '~/hooks'\nimport type {\n AttrsComponent as AttrsComponentType,\n ExoticComponent,\n InnerComponentProps,\n} from '~/types/AttrsComponent'\nimport type {\n Configuration,\n ExtendedConfiguration,\n} from '~/types/configuration'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport { calculateChainOptions } from '~/utils/attrs'\nimport { chainOptions } from '~/utils/chaining'\nimport { calculateHocsFuncs } from '~/utils/compose'\nimport { createStaticsEnhancers } from '~/utils/statics'\n\n/**\n * Clones the current configuration and merges new options, then creates a\n * fresh component. This makes the chaining API immutable — each `.attrs()`\n * / `.config()` / `.statics()` call returns a brand-new component with an\n * updated configuration rather than mutating the existing one.\n */\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>,\n) => ReturnType<typeof attrsComponent>\n\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n // @ts-expect-error\n attrsComponent({\n ...defaultOpts,\n ...(opts.name ? { name: opts.name } : undefined),\n ...(opts.component ? { component: opts.component } : undefined),\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n filterAttrs: [\n ...(defaultOpts.filterAttrs ?? []),\n ...(opts.filterAttrs ?? []),\n ],\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n })\n\n/**\n * Core factory that builds an attrs-enhanced React component.\n *\n * Creates a `forwardRef` component that:\n * 1. Wraps the original with attrsHoc (default props) + user HOCs from `.compose()`.\n * 2. Manages ref forwarding through the HOC chain via `$attrsRef`.\n * 3. Filters out internal props listed in `filterAttrs`.\n * 4. Attaches `data-attrs` attribute in development for debugging.\n *\n * Then adds chaining methods (`.attrs()`, `.config()`, `.compose()`, `.statics()`)\n * as static properties — each calls `cloneAndEnhance` to produce a new component.\n */\nconst attrsComponent: InitAttrsComponent = (options) => {\n const componentName =\n options.name ?? options.component.displayName ?? options.component.name\n\n const RenderComponent = options.component\n\n // Build the HOC chain: attrsHoc is always first (resolves default props),\n // followed by user-composed HOCs in reverse order (outermost wraps first).\n const hocsFuncs = [attrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // The inner component receives already-computed props from the HOC chain.\n // It handles ref merging, prop filtering, and final rendering.\n // eslint-disable-next-line react/display-name\n const EnhancedComponent: ExoticComponent<InnerComponentProps> = forwardRef(\n (\n {\n $attrsRef, // consumer's original ref, forwarded through attrsHoc\n ...props\n },\n ref, // ref from any intermediate HOC in the compose chain\n ) => {\n // Merge both ref sources into a single internal ref so that\n // both the consumer's ref and intermediate HOC refs point to the same node.\n const internalRef = useRef({ $attrsRef, ref })\n const needsRef = ref ?? $attrsRef\n const needsFiltering =\n options.filterAttrs && options.filterAttrs.length > 0\n\n const finalProps = useMemo(() => {\n // Only create new object if ref needs to be added\n const baseProps = needsRef ? { ...props, ref: internalRef } : props\n\n // Only filter if there are props to filter\n const filteredProps = needsFiltering\n ? omit(baseProps, options.filterAttrs)\n : baseProps\n\n // Add dev-only data attribute\n if (process.env.NODE_ENV !== 'production') {\n return { ...filteredProps, 'data-attrs': componentName }\n }\n\n return filteredProps\n }, [props, needsRef, internalRef, needsFiltering])\n\n return <RenderComponent {...finalProps} />\n },\n )\n\n // Apply the full HOC chain: compose(attrsHoc, ...userHocs)(EnhancedComponent)\n const AttrsComponent: AttrsComponentType = compose(...hocsFuncs)(\n EnhancedComponent,\n )\n\n AttrsComponent.IS_ATTRS = true\n AttrsComponent.displayName = componentName\n AttrsComponent.meta = {}\n\n // Copy static properties from the original component (e.g. propTypes).\n hoistNonReactStatics(AttrsComponent, options.component)\n\n // Populate `component.meta` with user-defined statics from `.statics()`.\n createStaticsEnhancers({\n context: AttrsComponent.meta,\n options: options.statics,\n })\n\n // ─── Chaining Methods ──────────────────────────────────\n // Each method creates a new component via cloneAndEnhance.\n // The original component is never mutated.\n\n // @ts-expect-error\n AttrsComponent.attrs = (attrs, { priority, filter } = {}) => {\n const result: Record<string, any> = {}\n\n if (filter) {\n result.filterAttrs = filter\n }\n\n if (priority) {\n result.priorityAttrs = attrs as ExtendedConfiguration['priorityAttrs']\n\n return cloneAndEnhance(options, result)\n }\n\n result.attrs = attrs as ExtendedConfiguration['attrs']\n\n return cloneAndEnhance(options, result)\n }\n\n // @ts-expect-error\n AttrsComponent.config = (opts = {}) => {\n const result = pick(opts)\n\n return cloneAndEnhance(options, result)\n }\n\n AttrsComponent.compose = (opts) =>\n // @ts-expect-error\n cloneAndEnhance(options, { compose: opts })\n\n AttrsComponent.statics = (opts) =>\n // @ts-expect-error\n cloneAndEnhance(options, { statics: opts })\n\n AttrsComponent.getDefaultAttrs = (props) =>\n calculateChainOptions(options.attrs)([props])\n\n return AttrsComponent\n}\n\nexport default attrsComponent\n","import { isEmpty } from '@vitus-labs/core'\nimport attrsComponent from '~/attrs'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport type { ElementType } from '~/types/utils'\n\n/**\n * Public entry point for creating an attrs-enhanced component.\n *\n * ```tsx\n * const Button = attrs({ name: 'Button', component: Element })\n * .attrs({ tag: 'button' })\n * .attrs<{ primary?: boolean }>(({ primary }) => ({\n * backgroundColor: primary ? 'blue' : 'gray',\n * }))\n * ```\n */\nexport type Attrs = <C extends ElementType>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<InitAttrsComponent<C>>\n\nconst attrs: Attrs = ({ name, component }) => {\n // Validate required params in development — fail fast with clear errors.\n if (process.env.NODE_ENV !== 'production') {\n type Errors = Partial<{\n component: string\n name: string\n }>\n\n const errors: Errors = {}\n if (!component) {\n errors.component = 'Parameter `component` is missing in params!'\n }\n\n if (!name) {\n errors.name = 'Parameter `name` is missing in params!'\n }\n\n if (!isEmpty(errors)) {\n throw Error(JSON.stringify(errors))\n }\n }\n\n // Bootstrap with empty configuration — all chains start from scratch.\n return attrsComponent({\n name,\n component,\n attrs: [],\n priorityAttrs: [],\n filterAttrs: [],\n compose: {},\n statics: {},\n })\n}\n\nexport default attrs\n","export type IsAttrsComponent = <T>(component: T) => boolean\n\n/** Runtime type guard — checks if a component was created by `attrs()`. */\nconst isAttrsComponent: IsAttrsComponent = (component) => {\n if (\n component &&\n typeof component === 'object' &&\n component !== null &&\n Object.hasOwn(component, 'IS_ATTRS')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isAttrsComponent\n","import type { Attrs } from '~/init'\nimport attrs from '~/init'\nimport type { IsAttrsComponent } from '~/isAttrsComponent'\nimport isAttrsComponent from '~/isAttrsComponent'\nimport type { AttrsComponent } from '~/types/AttrsComponent'\nimport type { AttrsCb } from '~/types/attrs'\nimport type { AttrsComponentType, ConfigAttrs } from '~/types/config'\nimport type { ComposeParam, GenericHoc } from '~/types/hoc'\nimport type { ElementType, TObj } from '~/types/utils'\n\nexport type {\n AttrsComponent,\n Attrs,\n AttrsComponentType,\n TObj,\n ElementType,\n ConfigAttrs,\n AttrsCb,\n GenericHoc,\n ComposeParam,\n IsAttrsComponent,\n}\n\nexport { attrs, isAttrsComponent }\nexport default attrs\n"],"mappings":";;;;;AAaA,MAAa,wBAA8C,UACzD,OAAO,KAAK,MAAM,CAAC,QAAQ,KAAK,QAAQ;CACtC,MAAM,eAAe,MAAM;AAC3B,KAAI,iBAAiB,OAAW,KAAI,OAAO;AAC3C,QAAO;GACN,EAAE,CAAQ;AAiBf,MAAa,yBACV,aAAa,SAAS;CACrB,MAAM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;;;;ACWT,kBAAe"}
1
+ {"version":3,"file":"index.js","names":["attrsHoc","useRef"],"sources":["../src/utils/attrs.ts","../src/hoc/attrsHoc.tsx","../src/hooks/useRef.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/utils/statics.ts","../src/attrs.tsx","../src/init.ts","../src/isAttrsComponent.tsx","../src/index.ts"],"sourcesContent":["import { isEmpty } from '@vitus-labs/core'\n\n/**\n * Strips keys with `undefined` values from a props object.\n * This prevents undefined consumer props from overriding defaults\n * computed by `.attrs()` callbacks. Only explicitly set values\n * (including `null`) should override defaults.\n */\ntype RemoveUndefinedProps = <T extends Record<string, any>>(\n props: T,\n) => { [I in keyof T as T[I] extends undefined ? never : I]: T[I] }\n\nexport const removeUndefinedProps: RemoveUndefinedProps = (props) =>\n Object.keys(props).reduce((acc, key) => {\n const currentValue = props[key]\n if (currentValue !== undefined) acc[key] = currentValue\n return acc\n }, {} as any)\n\n/**\n * Reduces an array of option functions (from chained `.attrs()` calls)\n * into a single merged result. Each function is called with `args`\n * (typically the current props) and its return value is merged\n * left-to-right via Object.assign — so later `.attrs()` calls\n * override earlier ones.\n *\n * Returns a curried function: first call binds the chain, second\n * call provides the arguments and executes the reduction.\n */\ntype OptionFunc<A> = (...arg: A[]) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: OptionFunc<A>[],\n) => (args: A[]) => ReturnType<OptionFunc<A>>\n\nexport const calculateChainOptions: CalculateChainOptions =\n (options) => (args) => {\n const result = {}\n if (!options || isEmpty(options)) return result\n\n return options.reduce((acc, item) => Object.assign(acc, item(...args)), {})\n }\n","import {\n type ComponentType,\n type ForwardRefExoticComponent,\n forwardRef,\n useMemo,\n} from 'react'\nimport type { Configuration } from '~/types/configuration'\nimport { calculateChainOptions, removeUndefinedProps } from '~/utils/attrs'\n\nexport type AttrsStyleHOC = ({\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentType<any>,\n) => ForwardRefExoticComponent<any>\n\n/**\n * Creates the core HOC that computes default props from the `.attrs()` chain.\n *\n * This is always the outermost HOC in the compose chain, so it runs first.\n * It resolves both priority and normal attrs callbacks, then merges them\n * with the consumer's explicit props following this precedence:\n *\n * priorityAttrs < normalAttrs < explicit props (last wins)\n *\n * The consumer's `ref` is forwarded as `$attrsRef` through the rest of the\n * HOC chain, since intermediate HOCs may need their own `ref`.\n */\nconst createAttrsHOC: AttrsStyleHOC = ({ attrs, priorityAttrs }) => {\n // Pre-build the chain reducers once (not per render).\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const attrsHoc = (WrappedComponent: ComponentType<any>) =>\n forwardRef<any, any>((props, ref) => {\n // Strip undefined values so they don't shadow defaults from attrs callbacks.\n // Only explicitly set values (including `null`) should override defaults.\n const filteredProps = useMemo(() => removeUndefinedProps(props), [props])\n\n const finalProps = useMemo(() => {\n // 1. Resolve priority attrs (lowest precedence defaults).\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps])\n // 2. Resolve normal attrs — these see priority + explicit props as input.\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ])\n\n // 3. Merge: priority < normal attrs < explicit props (last wins).\n return {\n $attrsRef: ref,\n ...prioritizedAttrs,\n ...finalAttrs,\n ...filteredProps,\n }\n }, [filteredProps, ref])\n\n return <WrappedComponent {...finalProps} />\n })\n\n return attrsHoc\n}\n\nexport default createAttrsHOC\n","import { type ForwardedRef, useImperativeHandle, useRef } from 'react'\n\ntype UseAttrsRef = (props: {\n $attrsRef?: ForwardedRef<unknown>\n ref?: ForwardedRef<unknown>\n}) => ForwardedRef<unknown>\n\n/**\n * Unifies two ref sources into a single internal ref.\n *\n * The attrs HOC chain creates two refs that both need to reach the same DOM node:\n * - `$attrsRef`: the consumer's original ref, forwarded through attrsHoc\n * - `ref`: a ref from any intermediate HOC added via `.compose()`\n *\n * This hook creates one internal ref and wires both forwarded refs to it\n * via `useImperativeHandle`, so `consumer.ref.current === hoc.ref.current`.\n */\nconst useAttrsStyleRef: UseAttrsRef = ({ $attrsRef, ref }) => {\n const internalRef = useRef(null)\n\n useImperativeHandle($attrsRef, () => internalRef.current)\n useImperativeHandle(ref, () => internalRef.current)\n\n return internalRef\n}\n\nexport default useAttrsStyleRef\n","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n/**\n * Appends a new attrs option to the existing chain of option functions.\n *\n * The `.attrs()` API accepts either an object or a callback. This function\n * normalizes both forms into a function (objects are wrapped in `() => obj`)\n * and appends to the existing array. The array is cloned so each chained\n * component gets its own copy — maintaining immutability across the chain.\n */\ntype ChainOptions = (\n opts: Obj | Func | undefined,\n defaultOpts: Func[],\n) => Func[]\n\nexport const chainOptions: ChainOptions = (opts, defaultOpts = []) => {\n const result = [...defaultOpts]\n\n if (typeof opts === 'function') result.push(opts)\n else if (typeof opts === 'object') result.push(() => opts)\n\n return result\n}\n","/**\n * Extracts HOC functions from the `.compose()` configuration and reverses\n * them for correct application order. Setting a key to `null`, `undefined`,\n * or `false` removes a previously defined HOC — only actual functions are kept.\n *\n * The reversal is needed because `compose(a, b, c)(Component)` applies as\n * `a(b(c(Component)))`, so the last-defined HOC should wrap innermost.\n */\ntype CalculateHocsFuncs = (\n options: Record<string, any>,\n) => ((arg: any) => any)[]\n\nexport const calculateHocsFuncs: CalculateHocsFuncs = (options = {}) =>\n Object.values(options)\n .filter((item) => typeof item === 'function')\n .reverse()\n","import { isEmpty } from '@vitus-labs/core'\n\n/**\n * Copies user-defined statics from `.statics()` into the component's\n * `meta` object. These are accessible at `Component.meta.myStatic`.\n */\ntype CreateStaticsEnhancers = (params: {\n context: Record<string, any>\n options: Record<string, any>\n}) => void\n\nexport const createStaticsEnhancers: CreateStaticsEnhancers = ({\n context,\n options,\n}) => {\n if (!isEmpty(options)) {\n Object.assign(context, options)\n }\n}\n","import { compose, hoistNonReactStatics, omit, pick } from '@vitus-labs/core'\nimport { forwardRef, useMemo } from 'react'\nimport { attrsHoc } from '~/hoc'\nimport { useRef } from '~/hooks'\nimport type {\n AttrsComponent as AttrsComponentType,\n ExoticComponent,\n InnerComponentProps,\n} from '~/types/AttrsComponent'\nimport type {\n Configuration,\n ExtendedConfiguration,\n} from '~/types/configuration'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport { calculateChainOptions } from '~/utils/attrs'\nimport { chainOptions } from '~/utils/chaining'\nimport { calculateHocsFuncs } from '~/utils/compose'\nimport { createStaticsEnhancers } from '~/utils/statics'\n\n/**\n * Clones the current configuration and merges new options, then creates a\n * fresh component. This makes the chaining API immutable — each `.attrs()`\n * / `.config()` / `.statics()` call returns a brand-new component with an\n * updated configuration rather than mutating the existing one.\n */\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>,\n) => ReturnType<typeof attrsComponent>\n\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n // @ts-expect-error\n attrsComponent({\n ...defaultOpts,\n ...(opts.name ? { name: opts.name } : undefined),\n ...(opts.component ? { component: opts.component } : undefined),\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n filterAttrs: [\n ...(defaultOpts.filterAttrs ?? []),\n ...(opts.filterAttrs ?? []),\n ],\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n })\n\n/**\n * Core factory that builds an attrs-enhanced React component.\n *\n * Creates a `forwardRef` component that:\n * 1. Wraps the original with attrsHoc (default props) + user HOCs from `.compose()`.\n * 2. Manages ref forwarding through the HOC chain via `$attrsRef`.\n * 3. Filters out internal props listed in `filterAttrs`.\n * 4. Attaches `data-attrs` attribute in development for debugging.\n *\n * Then adds chaining methods (`.attrs()`, `.config()`, `.compose()`, `.statics()`)\n * as static properties — each calls `cloneAndEnhance` to produce a new component.\n */\nconst attrsComponent: InitAttrsComponent = (options) => {\n const componentName =\n options.name ?? options.component.displayName ?? options.component.name\n\n const RenderComponent = options.component\n\n // Build the HOC chain: attrsHoc is always first (resolves default props),\n // followed by user-composed HOCs in reverse order (outermost wraps first).\n const hocsFuncs = [attrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // The inner component receives already-computed props from the HOC chain.\n // It handles ref merging, prop filtering, and final rendering.\n const EnhancedComponent: ExoticComponent<InnerComponentProps> = forwardRef(\n (\n {\n $attrsRef, // consumer's original ref, forwarded through attrsHoc\n ...props\n },\n ref, // ref from any intermediate HOC in the compose chain\n ) => {\n // Merge both ref sources into a single internal ref so that\n // both the consumer's ref and intermediate HOC refs point to the same node.\n const internalRef = useRef({ $attrsRef, ref })\n const needsRef = ref ?? $attrsRef\n const needsFiltering =\n options.filterAttrs && options.filterAttrs.length > 0\n\n const finalProps = useMemo(() => {\n // Only create new object if ref needs to be added\n const baseProps = needsRef ? { ...props, ref: internalRef } : props\n\n // Only filter if there are props to filter\n const filteredProps = needsFiltering\n ? omit(baseProps, options.filterAttrs)\n : baseProps\n\n // Add dev-only data attribute\n if (process.env.NODE_ENV !== 'production') {\n return { ...filteredProps, 'data-attrs': componentName }\n }\n\n return filteredProps\n }, [props, needsRef, internalRef, needsFiltering])\n\n return <RenderComponent {...finalProps} />\n },\n )\n\n // Apply the full HOC chain: compose(attrsHoc, ...userHocs)(EnhancedComponent)\n const AttrsComponent: AttrsComponentType = compose(...hocsFuncs)(\n EnhancedComponent,\n )\n\n AttrsComponent.IS_ATTRS = true\n AttrsComponent.displayName = componentName\n AttrsComponent.meta = {}\n\n // Copy static properties from the original component (e.g. propTypes).\n hoistNonReactStatics(AttrsComponent, options.component)\n\n // Populate `component.meta` with user-defined statics from `.statics()`.\n createStaticsEnhancers({\n context: AttrsComponent.meta,\n options: options.statics,\n })\n\n // ─── Chaining Methods ──────────────────────────────────\n // Each method creates a new component via cloneAndEnhance.\n // The original component is never mutated.\n\n // @ts-expect-error\n AttrsComponent.attrs = (attrs, { priority, filter } = {}) => {\n const result: Record<string, any> = {}\n\n if (filter) {\n result.filterAttrs = filter\n }\n\n if (priority) {\n result.priorityAttrs = attrs as ExtendedConfiguration['priorityAttrs']\n\n return cloneAndEnhance(options, result)\n }\n\n result.attrs = attrs as ExtendedConfiguration['attrs']\n\n return cloneAndEnhance(options, result)\n }\n\n // @ts-expect-error\n AttrsComponent.config = (opts = {}) => {\n const result = pick(opts)\n\n return cloneAndEnhance(options, result)\n }\n\n AttrsComponent.compose = (opts) =>\n // @ts-expect-error\n cloneAndEnhance(options, { compose: opts })\n\n AttrsComponent.statics = (opts) =>\n // @ts-expect-error\n cloneAndEnhance(options, { statics: opts })\n\n AttrsComponent.getDefaultAttrs = (props) =>\n calculateChainOptions(options.attrs)([props])\n\n return AttrsComponent\n}\n\nexport default attrsComponent\n","import { isEmpty } from '@vitus-labs/core'\nimport attrsComponent from '~/attrs'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport type { ElementType } from '~/types/utils'\n\n/**\n * Public entry point for creating an attrs-enhanced component.\n *\n * ```tsx\n * const Button = attrs({ name: 'Button', component: Element })\n * .attrs({ tag: 'button' })\n * .attrs<{ primary?: boolean }>(({ primary }) => ({\n * backgroundColor: primary ? 'blue' : 'gray',\n * }))\n * ```\n */\nexport type Attrs = <C extends ElementType>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<InitAttrsComponent<C>>\n\nconst attrs: Attrs = ({ name, component }) => {\n // Validate required params in development — fail fast with clear errors.\n if (process.env.NODE_ENV !== 'production') {\n type Errors = Partial<{\n component: string\n name: string\n }>\n\n const errors: Errors = {}\n if (!component) {\n errors.component = 'Parameter `component` is missing in params!'\n }\n\n if (!name) {\n errors.name = 'Parameter `name` is missing in params!'\n }\n\n if (!isEmpty(errors)) {\n throw Error(JSON.stringify(errors))\n }\n }\n\n // Bootstrap with empty configuration — all chains start from scratch.\n return attrsComponent({\n name,\n component,\n attrs: [],\n priorityAttrs: [],\n filterAttrs: [],\n compose: {},\n statics: {},\n })\n}\n\nexport default attrs\n","export type IsAttrsComponent = <T>(component: T) => boolean\n\n/** Runtime type guard — checks if a component was created by `attrs()`. */\nconst isAttrsComponent: IsAttrsComponent = (component) => {\n if (\n component &&\n typeof component === 'object' &&\n component !== null &&\n Object.hasOwn(component, 'IS_ATTRS')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isAttrsComponent\n","import type { Attrs } from '~/init'\nimport attrs from '~/init'\nimport type { IsAttrsComponent } from '~/isAttrsComponent'\nimport isAttrsComponent from '~/isAttrsComponent'\nimport type { AttrsComponent } from '~/types/AttrsComponent'\nimport type { AttrsCb } from '~/types/attrs'\nimport type { AttrsComponentType, ConfigAttrs } from '~/types/config'\nimport type { ComposeParam, GenericHoc } from '~/types/hoc'\nimport type { ElementType, TObj } from '~/types/utils'\n\nexport type {\n AttrsComponent,\n Attrs,\n AttrsComponentType,\n TObj,\n ElementType,\n ConfigAttrs,\n AttrsCb,\n GenericHoc,\n ComposeParam,\n IsAttrsComponent,\n}\n\nexport { attrs, isAttrsComponent }\nexport default attrs\n"],"mappings":";;;;;AAYA,MAAa,wBAA8C,UACzD,OAAO,KAAK,MAAM,CAAC,QAAQ,KAAK,QAAQ;CACtC,MAAM,eAAe,MAAM;AAC3B,KAAI,iBAAiB,OAAW,KAAI,OAAO;AAC3C,QAAO;GACN,EAAE,CAAQ;AAiBf,MAAa,yBACV,aAAa,SAAS;CACrB,MAAM,SAAS,EAAE;AACjB,KAAI,CAAC,WAAW,QAAQ,QAAQ,CAAE,QAAO;AAEzC,QAAO,QAAQ,QAAQ,KAAK,SAAS,OAAO,OAAO,KAAK,KAAK,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC;;;;;;;;;;;;;;;;;ACX/E,MAAM,kBAAiC,EAAE,OAAO,oBAAoB;CAElE,MAAM,iBAAiB,sBAAsB,MAAM;CACnD,MAAM,yBAAyB,sBAAsB,cAAc;CAEnE,MAAM,YAAY,qBAChB,YAAs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EvB,UAAO,gBAAgB,SAAS,OAAO;;AAGzC,SAAO,QAAQ;AAEf,SAAO,gBAAgB,SAAS,OAAO;;AAIzC,gBAAe,UAAU,OAAO,EAAE,KAAK;AAGrC,SAAO,gBAAgB,SAFR,KAAK,KAAK,CAEc;;AAGzC,gBAAe,WAAW,SAExB,gBAAgB,SAAS,EAAE,SAAS,MAAM,CAAC;AAE7C,gBAAe,WAAW,SAExB,gBAAgB,SAAS,EAAE,SAAS,MAAM,CAAC;AAE7C,gBAAe,mBAAmB,UAChC,sBAAsB,QAAQ,MAAM,CAAC,CAAC,MAAM,CAAC;AAE/C,QAAO;;;;;AC7IT,MAAM,SAAgB,EAAE,MAAM,gBAAgB;AAE5C,KAAI,QAAQ,IAAI,aAAa,cAAc;EAMzC,MAAM,SAAiB,EAAE;AACzB,MAAI,CAAC,UACH,QAAO,YAAY;AAGrB,MAAI,CAAC,KACH,QAAO,OAAO;AAGhB,MAAI,CAAC,QAAQ,OAAO,CAClB,OAAM,MAAM,KAAK,UAAU,OAAO,CAAC;;AAKvC,QAAO,eAAe;EACpB;EACA;EACA,OAAO,EAAE;EACT,eAAe,EAAE;EACjB,aAAa,EAAE;EACf,SAAS,EAAE;EACX,SAAS,EAAE;EACZ,CAAC;;;;;;ACpDJ,MAAM,oBAAsC,cAAc;AACxD,KACE,aACA,OAAO,cAAc,YACrB,cAAc,QACd,OAAO,OAAO,WAAW,WAAW,CAEpC,QAAO;AAGT,QAAO;;;;;ACWT,kBAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitus-labs/attrs",
3
- "version": "1.3.1-alpha.2+e27c504",
3
+ "version": "1.3.2-alpha.2+5db1de0",
4
4
  "license": "MIT",
5
5
  "author": "Vit Bokisch <vit@bokisch.cz>",
6
6
  "maintainers": [
@@ -53,11 +53,11 @@
53
53
  "react": ">= 19"
54
54
  },
55
55
  "devDependencies": {
56
- "@vitus-labs/core": "1.3.1-alpha.2+e27c504",
57
- "@vitus-labs/elements": "1.3.1-alpha.2+e27c504",
56
+ "@vitus-labs/core": "1.3.2-alpha.2+5db1de0",
57
+ "@vitus-labs/elements": "1.3.2-alpha.2+5db1de0",
58
58
  "@vitus-labs/tools-rolldown": "^1.6.0",
59
59
  "@vitus-labs/tools-storybook": "^1.6.0",
60
60
  "@vitus-labs/tools-typescript": "^1.6.0"
61
61
  },
62
- "gitHead": "e27c504367909378af051d5a4f63da8018d711a7"
62
+ "gitHead": "5db1de07a7b0efa905c31b01c21b2576fc68e664"
63
63
  }