@vitus-labs/attrs 0.79.0 → 0.80.0
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/lib/analysis/vitus-labs-attrs.js.html +1 -1
- package/lib/analysis/vitus-labs-attrs.module.js.html +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/types/types/AttrsComponent.d.ts +3 -1
- package/lib/types/types/AttrsComponent.d.ts.map +1 -1
- package/lib/vitus-labs-attrs.js +1 -0
- package/lib/vitus-labs-attrs.js.map +1 -1
- package/lib/vitus-labs-attrs.module.js +1 -0
- package/lib/vitus-labs-attrs.module.js.map +1 -1
- package/package.json +8 -8
|
@@ -6618,7 +6618,7 @@ var drawChart = (function (exports) {
|
|
|
6618
6618
|
</script>
|
|
6619
6619
|
<script>
|
|
6620
6620
|
/*<!--*/
|
|
6621
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-attrs.js","children":[{"name":"src","children":[{"name":"hooks/useRef.ts","uid":"
|
|
6621
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-attrs.js","children":[{"name":"src","children":[{"name":"hooks/useRef.ts","uid":"613d-1"},{"name":"utils","children":[{"uid":"613d-3","name":"attrs.ts"},{"uid":"613d-7","name":"statics.ts"},{"uid":"613d-9","name":"chaining.ts"},{"uid":"613d-11","name":"compose.ts"}]},{"name":"hoc/attrsHoc.tsx","uid":"613d-5"},{"uid":"613d-13","name":"attrs.tsx"},{"uid":"613d-15","name":"init.ts"},{"uid":"613d-17","name":"isAttrsComponent.tsx"},{"uid":"613d-19","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"613d-1":{"renderedLength":259,"gzipLength":151,"brotliLength":0,"metaUid":"613d-0"},"613d-3":{"renderedLength":505,"gzipLength":281,"brotliLength":0,"metaUid":"613d-2"},"613d-5":{"renderedLength":1316,"gzipLength":488,"brotliLength":0,"metaUid":"613d-4"},"613d-7":{"renderedLength":147,"gzipLength":131,"brotliLength":0,"metaUid":"613d-6"},"613d-9":{"renderedLength":251,"gzipLength":159,"brotliLength":0,"metaUid":"613d-8"},"613d-11":{"renderedLength":135,"gzipLength":129,"brotliLength":0,"metaUid":"613d-10"},"613d-13":{"renderedLength":4778,"gzipLength":1343,"brotliLength":0,"metaUid":"613d-12"},"613d-15":{"renderedLength":800,"gzipLength":330,"brotliLength":0,"metaUid":"613d-14"},"613d-17":{"renderedLength":260,"gzipLength":175,"brotliLength":0,"metaUid":"613d-16"},"613d-19":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"613d-18"}},"nodeMetas":{"613d-0":{"id":"/src/hooks/useRef.ts","moduleParts":{"vitus-labs-attrs.js":"613d-1"},"imported":[{"uid":"613d-21"}],"importedBy":[{"uid":"613d-23"}]},"613d-2":{"id":"/src/utils/attrs.ts","moduleParts":{"vitus-labs-attrs.js":"613d-3"},"imported":[{"uid":"613d-20"}],"importedBy":[{"uid":"613d-12"},{"uid":"613d-4"}]},"613d-4":{"id":"/src/hoc/attrsHoc.tsx","moduleParts":{"vitus-labs-attrs.js":"613d-5"},"imported":[{"uid":"613d-21"},{"uid":"613d-2"}],"importedBy":[{"uid":"613d-24"}]},"613d-6":{"id":"/src/utils/statics.ts","moduleParts":{"vitus-labs-attrs.js":"613d-7"},"imported":[{"uid":"613d-20"}],"importedBy":[{"uid":"613d-12"}]},"613d-8":{"id":"/src/utils/chaining.ts","moduleParts":{"vitus-labs-attrs.js":"613d-9"},"imported":[],"importedBy":[{"uid":"613d-12"}]},"613d-10":{"id":"/src/utils/compose.ts","moduleParts":{"vitus-labs-attrs.js":"613d-11"},"imported":[],"importedBy":[{"uid":"613d-12"}]},"613d-12":{"id":"/src/attrs.tsx","moduleParts":{"vitus-labs-attrs.js":"613d-13"},"imported":[{"uid":"613d-21"},{"uid":"613d-22"},{"uid":"613d-20"},{"uid":"613d-23"},{"uid":"613d-24"},{"uid":"613d-6"},{"uid":"613d-8"},{"uid":"613d-10"},{"uid":"613d-2"}],"importedBy":[{"uid":"613d-14"}]},"613d-14":{"id":"/src/init.ts","moduleParts":{"vitus-labs-attrs.js":"613d-15"},"imported":[{"uid":"613d-20"},{"uid":"613d-12"}],"importedBy":[{"uid":"613d-18"}]},"613d-16":{"id":"/src/isAttrsComponent.tsx","moduleParts":{"vitus-labs-attrs.js":"613d-17"},"imported":[],"importedBy":[{"uid":"613d-18"}]},"613d-18":{"id":"/src/index.ts","moduleParts":{"vitus-labs-attrs.js":"613d-19"},"imported":[{"uid":"613d-14"},{"uid":"613d-16"}],"importedBy":[],"isEntry":true},"613d-20":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"613d-14"},{"uid":"613d-12"},{"uid":"613d-6"},{"uid":"613d-2"}],"isExternal":true},"613d-21":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"613d-12"},{"uid":"613d-0"},{"uid":"613d-4"}],"isExternal":true},"613d-22":{"id":"hoist-non-react-statics","moduleParts":{},"imported":[],"importedBy":[{"uid":"613d-12"}],"isExternal":true},"613d-23":{"id":"/src/hooks/index.ts","moduleParts":{},"imported":[{"uid":"613d-0"}],"importedBy":[{"uid":"613d-12"}]},"613d-24":{"id":"/src/hoc/index.ts","moduleParts":{},"imported":[{"uid":"613d-4"}],"importedBy":[{"uid":"613d-12"}]}},"env":{"rollup":"3.23.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6622
6622
|
|
|
6623
6623
|
const run = () => {
|
|
6624
6624
|
const width = window.innerWidth;
|
|
@@ -6618,7 +6618,7 @@ var drawChart = (function (exports) {
|
|
|
6618
6618
|
</script>
|
|
6619
6619
|
<script>
|
|
6620
6620
|
/*<!--*/
|
|
6621
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-attrs.module.js","children":[{"name":"src","children":[{"name":"hooks/useRef.ts","uid":"
|
|
6621
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"vitus-labs-attrs.module.js","children":[{"name":"src","children":[{"name":"hooks/useRef.ts","uid":"613d-26"},{"name":"utils","children":[{"uid":"613d-28","name":"attrs.ts"},{"uid":"613d-32","name":"statics.ts"},{"uid":"613d-34","name":"chaining.ts"},{"uid":"613d-36","name":"compose.ts"}]},{"name":"hoc/attrsHoc.tsx","uid":"613d-30"},{"uid":"613d-38","name":"attrs.tsx"},{"uid":"613d-40","name":"init.ts"},{"uid":"613d-42","name":"isAttrsComponent.tsx"},{"uid":"613d-44","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"613d-26":{"renderedLength":241,"gzipLength":146,"brotliLength":0,"metaUid":"613d-25"},"613d-28":{"renderedLength":500,"gzipLength":278,"brotliLength":0,"metaUid":"613d-27"},"613d-30":{"renderedLength":1290,"gzipLength":476,"brotliLength":0,"metaUid":"613d-29"},"613d-32":{"renderedLength":142,"gzipLength":128,"brotliLength":0,"metaUid":"613d-31"},"613d-34":{"renderedLength":251,"gzipLength":159,"brotliLength":0,"metaUid":"613d-33"},"613d-36":{"renderedLength":135,"gzipLength":129,"brotliLength":0,"metaUid":"613d-35"},"613d-38":{"renderedLength":4722,"gzipLength":1322,"brotliLength":0,"metaUid":"613d-37"},"613d-40":{"renderedLength":795,"gzipLength":326,"brotliLength":0,"metaUid":"613d-39"},"613d-42":{"renderedLength":260,"gzipLength":175,"brotliLength":0,"metaUid":"613d-41"},"613d-44":{"renderedLength":0,"gzipLength":0,"brotliLength":0,"metaUid":"613d-43"}},"nodeMetas":{"613d-25":{"id":"/src/hooks/useRef.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-26"},"imported":[{"uid":"613d-46"}],"importedBy":[{"uid":"613d-48"}]},"613d-27":{"id":"/src/utils/attrs.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-28"},"imported":[{"uid":"613d-45"}],"importedBy":[{"uid":"613d-37"},{"uid":"613d-29"}]},"613d-29":{"id":"/src/hoc/attrsHoc.tsx","moduleParts":{"vitus-labs-attrs.module.js":"613d-30"},"imported":[{"uid":"613d-46"},{"uid":"613d-27"}],"importedBy":[{"uid":"613d-49"}]},"613d-31":{"id":"/src/utils/statics.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-32"},"imported":[{"uid":"613d-45"}],"importedBy":[{"uid":"613d-37"}]},"613d-33":{"id":"/src/utils/chaining.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-34"},"imported":[],"importedBy":[{"uid":"613d-37"}]},"613d-35":{"id":"/src/utils/compose.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-36"},"imported":[],"importedBy":[{"uid":"613d-37"}]},"613d-37":{"id":"/src/attrs.tsx","moduleParts":{"vitus-labs-attrs.module.js":"613d-38"},"imported":[{"uid":"613d-46"},{"uid":"613d-47"},{"uid":"613d-45"},{"uid":"613d-48"},{"uid":"613d-49"},{"uid":"613d-31"},{"uid":"613d-33"},{"uid":"613d-35"},{"uid":"613d-27"}],"importedBy":[{"uid":"613d-39"}]},"613d-39":{"id":"/src/init.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-40"},"imported":[{"uid":"613d-45"},{"uid":"613d-37"}],"importedBy":[{"uid":"613d-43"}]},"613d-41":{"id":"/src/isAttrsComponent.tsx","moduleParts":{"vitus-labs-attrs.module.js":"613d-42"},"imported":[],"importedBy":[{"uid":"613d-43"}]},"613d-43":{"id":"/src/index.ts","moduleParts":{"vitus-labs-attrs.module.js":"613d-44"},"imported":[{"uid":"613d-39"},{"uid":"613d-41"}],"importedBy":[],"isEntry":true},"613d-45":{"id":"@vitus-labs/core","moduleParts":{},"imported":[],"importedBy":[{"uid":"613d-39"},{"uid":"613d-37"},{"uid":"613d-31"},{"uid":"613d-27"}],"isExternal":true},"613d-46":{"id":"react","moduleParts":{},"imported":[],"importedBy":[{"uid":"613d-37"},{"uid":"613d-25"},{"uid":"613d-29"}],"isExternal":true},"613d-47":{"id":"hoist-non-react-statics","moduleParts":{},"imported":[],"importedBy":[{"uid":"613d-37"}],"isExternal":true},"613d-48":{"id":"/src/hooks/index.ts","moduleParts":{},"imported":[{"uid":"613d-25"}],"importedBy":[{"uid":"613d-37"}]},"613d-49":{"id":"/src/hoc/index.ts","moduleParts":{},"imported":[{"uid":"613d-29"}],"importedBy":[{"uid":"613d-37"}]}},"env":{"rollup":"3.23.1"},"options":{"gzip":true,"brotli":false,"sourcemap":false}};
|
|
6622
6622
|
|
|
6623
6623
|
const run = () => {
|
|
6624
6624
|
const width = window.innerWidth;
|
package/lib/index.d.ts
CHANGED
|
@@ -89,7 +89,9 @@ export declare interface AttrsComponent<OA extends TObj = {}, EA extends TObj =
|
|
|
89
89
|
config: <NC extends ElementType | unknown = unknown>({ name, component: NC, DEBUG, }: ConfigAttrs<NC>) => NC extends ElementType ? AttrsComponent<ExtractProps<NC>, EA, S, HOC> : AttrsComponent<OA, EA, S, HOC>;
|
|
90
90
|
/**
|
|
91
91
|
* A chaining method to define default component props
|
|
92
|
-
* @param param
|
|
92
|
+
* @param param Can be either _object_ or a _callback_
|
|
93
|
+
* @param config Optional. Can define `priority` in chaining. All `attrs` callbacks
|
|
94
|
+
* having `priority` set to `true` will be calculated first
|
|
93
95
|
*
|
|
94
96
|
* #### Examples
|
|
95
97
|
*
|
|
@@ -90,7 +90,9 @@ export interface AttrsComponent<OA extends TObj = {}, EA extends TObj = {}, S ex
|
|
|
90
90
|
config: <NC extends ElementType | unknown = unknown>({ name, component: NC, DEBUG, }: ConfigAttrs<NC>) => NC extends ElementType ? AttrsComponent<ExtractProps<NC>, EA, S, HOC> : AttrsComponent<OA, EA, S, HOC>;
|
|
91
91
|
/**
|
|
92
92
|
* A chaining method to define default component props
|
|
93
|
-
* @param param
|
|
93
|
+
* @param param Can be either _object_ or a _callback_
|
|
94
|
+
* @param config Optional. Can define `priority` in chaining. All `attrs` callbacks
|
|
95
|
+
* having `priority` set to `true` will be calculated first
|
|
94
96
|
*
|
|
95
97
|
* #### Examples
|
|
96
98
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttrsComponent.d.ts","sour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C,aAAa,EAAE,EAAE,CAAA;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAA;IAC5B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAA;IACrB;;OAEG;IACH,QAAQ,EAAE,IAAI,CAAA;IACd;;;;;;;;;;OAUG;IACH,WAAW,EAAE,MAAM,CAAA;CACpB"}
|
package/lib/vitus-labs-attrs.js
CHANGED
|
@@ -79,6 +79,7 @@ const calculateHocsFuncs = (options = {}) => Object.values(options)
|
|
|
79
79
|
.reverse();
|
|
80
80
|
|
|
81
81
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
82
|
+
/* eslint-disable no-underscore-dangle */
|
|
82
83
|
const cloneAndEnhance = (defaultOpts, opts) =>
|
|
83
84
|
// @ts-ignore
|
|
84
85
|
rocketComponent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-attrs.js","sources":["../src/hooks/useRef.ts","../src/utils/attrs.ts","../src/hoc/attrsHoc.tsx","../src/utils/statics.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/attrs.tsx","../src/init.ts","../src/isAttrsComponent.tsx"],"sourcesContent":["import { useRef, useImperativeHandle, ForwardedRef } from 'react'\n\ntype UseAttrsRef = (props: {\n $attrsRef?: ForwardedRef<unknown>\n ref?: ForwardedRef<unknown>\n}) => ForwardedRef<unknown>\n\nconst useRocketstyleRef: 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 useRocketstyleRef\n","/* eslint-disable no-param-reassign */\nimport { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// Remove undefined props\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) return { ...acc, [key]: currentValue }\n return acc\n }, {} as any)\n\n// --------------------------------------------------------\n// combine values\n// --------------------------------------------------------\ntype OptionFunc<A> = (...arg: Array<A>) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: Array<OptionFunc<A>>\n) => (args: Array<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","/* eslint-disable no-underscore-dangle */\nimport React, {\n forwardRef,\n ForwardRefExoticComponent,\n ComponentType,\n} from 'react'\nimport { calculateChainOptions, removeUndefinedProps } from '~/utils/attrs'\nimport type { Configuration } from '~/types/configuration'\n\nexport type RocketStyleHOC = ({\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentType<any>\n) => ForwardRefExoticComponent<any>\n\nconst attrsHOC: RocketStyleHOC = ({ attrs, priorityAttrs }) => {\n // --------------------------------------------------\n // .attrs(...)\n // first we need to calculate final props which are\n // being returned by using `attr` chaining method\n // --------------------------------------------------\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const Enhanced = (WrappedComponent: ComponentType<any>) =>\n forwardRef<any, any>((props, ref) => {\n // --------------------------------------------------\n // remove undefined props not to override potential default props\n // only props with value (e.g. `null`) should override default props\n // --------------------------------------------------\n const filteredProps = removeUndefinedProps(props)\n\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps])\n\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ])\n\n return (\n <WrappedComponent\n $attrsRef={ref}\n {...prioritizedAttrs}\n {...finalAttrs}\n {...filteredProps}\n />\n )\n })\n\n return Enhanced\n}\n\nexport default attrsHOC\n","import { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// helpers for create statics on component\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","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n// --------------------------------------------------------\n// Chain Options\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 */\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","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable no-underscore-dangle */\nimport React, { forwardRef } from 'react'\nimport hoistNonReactStatics from 'hoist-non-react-statics'\nimport { pick, compose } from '@vitus-labs/core'\nimport { useRef } from '~/hooks'\nimport { attrsHoc } from '~/hoc'\nimport { createStaticsEnhancers } from '~/utils/statics'\nimport { chainOptions } from '~/utils/chaining'\nimport { calculateHocsFuncs } from '~/utils/compose'\nimport { calculateChainOptions } from '~/utils/attrs'\nimport type { AttrsComponent, ExoticComponent } from '~/types/AttrsComponent'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport type {\n Configuration,\n ExtendedConfiguration,\n} from '~/types/configuration'\n\n// --------------------------------------------------------\n// cloneAndEnhance\n// helper function which allows function chaining\n// always returns rocketComponent with static functions\n// assigned\n// --------------------------------------------------------\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>\n) => ReturnType<typeof rocketComponent>\n\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n // @ts-ignore\n rocketComponent({\n ...defaultOpts,\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n })\n\n// --------------------------------------------------------\n// styleComponent\n// helper function which allows function chaining\n// always returns a valid React component with static functions\n// assigned, so it can be even rendered as a valid component\n// or styles can be extended via its statics\n// --------------------------------------------------------\n// @ts-ignore\nconst rocketComponent: InitAttrsComponent = (options) => {\n const componentName =\n options.name || options.component.displayName || options.component.name\n\n // --------------------------------------------------------\n // COMPONENT - Final component to be rendered\n // --------------------------------------------------------\n const RenderComponent = options.component\n\n // --------------------------------------------------------\n // COMPOSE - high-order components\n // --------------------------------------------------------\n const hocsFuncs = [attrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // --------------------------------------------------------\n // ENHANCED COMPONENT (returned component)\n // --------------------------------------------------------\n // .attrs() chaining option is calculated in HOC and passed as props already\n const EnhancedComponent: ExoticComponent = forwardRef(\n (\n {\n $attrsRef, // it's forwarded from HOC which is always on top of all hocs\n ...props\n },\n ref\n ) => {\n // --------------------------------------------------\n // handle refs\n // (1) one is passed from inner HOC - $rocketstyleRef\n // (2) second one is used to be used directly (e.g. inside hocs)\n // --------------------------------------------------\n const internalRef = useRef({ $attrsRef, ref })\n\n // --------------------------------------------------\n // final props\n // final props passed to WrappedComponent\n // excluding: styling props\n // including: $rocketstyle, $rocketstate\n // --------------------------------------------------\n const finalProps: Record<string, any> = {\n // this removes styling state from props and passes its state\n // under rocketstate key only\n ...props,\n ref: ref || $attrsRef ? internalRef : undefined,\n }\n\n // all the development stuff injected\n if (process.env.NODE_ENV !== 'production') {\n finalProps['data-attrs'] = componentName\n }\n\n return <RenderComponent {...finalProps} />\n }\n )\n\n // ------------------------------------------------------\n // This will hoist and generate dynamically next static methods\n // for all dimensions available in configuration\n // ------------------------------------------------------\n const RocketComponent: AttrsComponent = compose(...hocsFuncs)(\n EnhancedComponent\n )\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n\n hoistNonReactStatics(RocketComponent, options.component)\n\n // ------------------------------------------------------\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n RocketComponent.meta = {}\n // ------------------------------------------------------\n\n // ------------------------------------------------------\n // enhance for statics\n // ------------------------------------------------------\n createStaticsEnhancers({\n context: RocketComponent.meta,\n options: options.statics,\n })\n\n // @ts-ignore\n RocketComponent.attrs = (attrs, { priority } = {}) => {\n if (priority) {\n return cloneAndEnhance(options, {\n priorityAttrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n return cloneAndEnhance(options, {\n attrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n // @ts-ignore\n RocketComponent.config = (opts = {}) => {\n const result = pick(opts)\n\n return cloneAndEnhance(options, result)\n }\n\n // @ts-ignore\n RocketComponent.statics = (opts) =>\n // @ts-ignore\n cloneAndEnhance(options, { statics: opts })\n\n RocketComponent.getDefaultAttrs = (props) =>\n calculateChainOptions(options.attrs)([props])\n\n return RocketComponent\n}\n\nexport default rocketComponent\n","import { isEmpty } from '@vitus-labs/core'\nimport attrsComponent from '~/attrs'\nimport type { ElementType } from '~/types/utils'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\n\nexport type Attrs = <C extends ElementType<any>>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<InitAttrsComponent<C>>\n\n// @ts-ignore\nconst attrs: Attrs = ({ name, component }) => {\n // --------------------------------------------------------\n // handle ERRORS in development mode\n // --------------------------------------------------------\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 return attrsComponent({\n name,\n component,\n attrs: [],\n priorityAttrs: [],\n compose: {},\n statics: {},\n })\n}\n\nexport default attrs\n","export type IsAttrsComponent = <T>(component: T) => boolean\n\nconst isAttrsComponent: IsAttrsComponent = (component) => {\n if (\n component &&\n typeof component === 'object' &&\n component !== null &&\n Object.prototype.hasOwnProperty.call(component, 'IS_ATTRS')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isAttrsComponent\n"],"names":["useRef","useImperativeHandle","isEmpty","forwardRef","React","attrsHoc","compose","hoistNonReactStatics","pick","attrsComponent"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,iBAAiB,GAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAI;AAC5D,IAAA,MAAM,WAAW,GAAGA,YAAM,CAAC,IAAI,CAAC,CAAA;IAEhCC,yBAAmB,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAA;IACzDA,yBAAmB,CAAC,GAAG,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAA;AAEnD,IAAA,OAAO,WAAW,CAAA;AACpB,CAAC;;ACdD;AAUO,MAAM,oBAAoB,GAAyB,CAAC,KAAK,KAC9D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAI;AACrC,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,YAAY,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,YAAY,EAAE,CAAA;AACtE,IAAA,OAAO,GAAG,CAAA;AACZ,CAAC,EAAE,EAAS,CAAC,CAAA;AAUR,MAAM,qBAAqB,GAChC,CAAC,OAAO,KAAK,CAAC,IA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AA6C,CAAA;AACjE,SAAA;QAED,IAAI,CAAC,IAAI,EAAE;AACT,YAAA,MAAM,CAAC,IAAI,GAAG,wCAAwC,CAAA;AACvD,SAAA;AAED,QAAA,IAAI,CAACN,YAAO,CAAC,MAAM,CAAC,EAAE;YACpB,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AACpC,SAAA;AACF,KAAA;AAED,IAAA,OAAOO,eAAc,CAAC;QACpB,IAAI;QACJ,SAAS;AACT,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,aAAa,EAAE,EAAE;AACjB,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,OAAO,EAAE,EAAE;AACZ,KAAA,CAAC,CAAA;AACJ;;AC5CA,MAAM,gBAAgB,GAAqB,CAAC,SAAS,KAAI;AACvD,IAAA,IACE,SAAS;QACT,OAAO,SAAS,KAAK,QAAQ;AAC7B,QAAA,SAAS,KAAK,IAAI;QAClB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAC3D;AACA,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;;;;;"}
|
|
1
|
+
{"version":3,"file":"vitus-labs-attrs.js","sources":["../src/hooks/useRef.ts","../src/utils/attrs.ts","../src/hoc/attrsHoc.tsx","../src/utils/statics.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/attrs.tsx","../src/init.ts","../src/isAttrsComponent.tsx"],"sourcesContent":["import { useRef, useImperativeHandle, ForwardedRef } from 'react'\n\ntype UseAttrsRef = (props: {\n $attrsRef?: ForwardedRef<unknown>\n ref?: ForwardedRef<unknown>\n}) => ForwardedRef<unknown>\n\nconst useRocketstyleRef: 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 useRocketstyleRef\n","/* eslint-disable no-param-reassign */\nimport { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// Remove undefined props\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) return { ...acc, [key]: currentValue }\n return acc\n }, {} as any)\n\n// --------------------------------------------------------\n// combine values\n// --------------------------------------------------------\ntype OptionFunc<A> = (...arg: Array<A>) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: Array<OptionFunc<A>>\n) => (args: Array<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","/* eslint-disable no-underscore-dangle */\nimport React, {\n forwardRef,\n ForwardRefExoticComponent,\n ComponentType,\n} from 'react'\nimport { calculateChainOptions, removeUndefinedProps } from '~/utils/attrs'\nimport type { Configuration } from '~/types/configuration'\n\nexport type RocketStyleHOC = ({\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentType<any>\n) => ForwardRefExoticComponent<any>\n\nconst attrsHOC: RocketStyleHOC = ({ attrs, priorityAttrs }) => {\n // --------------------------------------------------\n // .attrs(...)\n // first we need to calculate final props which are\n // being returned by using `attr` chaining method\n // --------------------------------------------------\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const Enhanced = (WrappedComponent: ComponentType<any>) =>\n forwardRef<any, any>((props, ref) => {\n // --------------------------------------------------\n // remove undefined props not to override potential default props\n // only props with value (e.g. `null`) should override default props\n // --------------------------------------------------\n const filteredProps = removeUndefinedProps(props)\n\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps])\n\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ])\n\n return (\n <WrappedComponent\n $attrsRef={ref}\n {...prioritizedAttrs}\n {...finalAttrs}\n {...filteredProps}\n />\n )\n })\n\n return Enhanced\n}\n\nexport default attrsHOC\n","import { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// helpers for create statics on component\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","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n// --------------------------------------------------------\n// Chain Options\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 */\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","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable no-underscore-dangle */\nimport React, { forwardRef } from 'react'\nimport hoistNonReactStatics from 'hoist-non-react-statics'\nimport { pick, compose } from '@vitus-labs/core'\nimport { useRef } from '~/hooks'\nimport { attrsHoc } from '~/hoc'\nimport { createStaticsEnhancers } from '~/utils/statics'\nimport { chainOptions } from '~/utils/chaining'\nimport { calculateHocsFuncs } from '~/utils/compose'\nimport { calculateChainOptions } from '~/utils/attrs'\nimport type { AttrsComponent, ExoticComponent } from '~/types/AttrsComponent'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport type {\n Configuration,\n ExtendedConfiguration,\n} from '~/types/configuration'\n\n// --------------------------------------------------------\n// cloneAndEnhance\n// helper function which allows function chaining\n// always returns rocketComponent with static functions\n// assigned\n// --------------------------------------------------------\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>\n) => ReturnType<typeof rocketComponent>\n\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n // @ts-ignore\n rocketComponent({\n ...defaultOpts,\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n })\n\n// --------------------------------------------------------\n// styleComponent\n// helper function which allows function chaining\n// always returns a valid React component with static functions\n// assigned, so it can be even rendered as a valid component\n// or styles can be extended via its statics\n// --------------------------------------------------------\n// @ts-ignore\nconst rocketComponent: InitAttrsComponent = (options) => {\n const componentName =\n options.name || options.component.displayName || options.component.name\n\n // --------------------------------------------------------\n // COMPONENT - Final component to be rendered\n // --------------------------------------------------------\n const RenderComponent = options.component\n\n // --------------------------------------------------------\n // COMPOSE - high-order components\n // --------------------------------------------------------\n const hocsFuncs = [attrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // --------------------------------------------------------\n // ENHANCED COMPONENT (returned component)\n // --------------------------------------------------------\n // .attrs() chaining option is calculated in HOC and passed as props already\n const EnhancedComponent: ExoticComponent = forwardRef(\n (\n {\n $attrsRef, // it's forwarded from HOC which is always on top of all hocs\n ...props\n },\n ref\n ) => {\n // --------------------------------------------------\n // handle refs\n // (1) one is passed from inner HOC - $rocketstyleRef\n // (2) second one is used to be used directly (e.g. inside hocs)\n // --------------------------------------------------\n const internalRef = useRef({ $attrsRef, ref })\n\n // --------------------------------------------------\n // final props\n // final props passed to WrappedComponent\n // excluding: styling props\n // including: $rocketstyle, $rocketstate\n // --------------------------------------------------\n const finalProps: Record<string, any> = {\n // this removes styling state from props and passes its state\n // under rocketstate key only\n ...props,\n ref: ref || $attrsRef ? internalRef : undefined,\n }\n\n // all the development stuff injected\n if (process.env.NODE_ENV !== 'production') {\n finalProps['data-attrs'] = componentName\n }\n\n return <RenderComponent {...finalProps} />\n }\n )\n\n // ------------------------------------------------------\n // This will hoist and generate dynamically next static methods\n // for all dimensions available in configuration\n // ------------------------------------------------------\n const RocketComponent: AttrsComponent = compose(...hocsFuncs)(\n EnhancedComponent\n )\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n\n hoistNonReactStatics(RocketComponent, options.component)\n\n // ------------------------------------------------------\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n RocketComponent.meta = {}\n // ------------------------------------------------------\n\n // ------------------------------------------------------\n // enhance for statics\n // ------------------------------------------------------\n createStaticsEnhancers({\n context: RocketComponent.meta,\n options: options.statics,\n })\n\n // @ts-ignore\n RocketComponent.attrs = (attrs, { priority } = {}) => {\n if (priority) {\n return cloneAndEnhance(options, {\n priorityAttrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n return cloneAndEnhance(options, {\n attrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n // @ts-ignore\n RocketComponent.config = (opts = {}) => {\n const result = pick(opts)\n\n return cloneAndEnhance(options, result)\n }\n\n // @ts-ignore\n RocketComponent.statics = (opts) =>\n // @ts-ignore\n cloneAndEnhance(options, { statics: opts })\n\n RocketComponent.getDefaultAttrs = (props) =>\n calculateChainOptions(options.attrs)([props])\n\n return RocketComponent\n}\n\nexport default rocketComponent\n","import { isEmpty } from '@vitus-labs/core'\nimport attrsComponent from '~/attrs'\nimport type { ElementType } from '~/types/utils'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\n\nexport type Attrs = <C extends ElementType<any>>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<InitAttrsComponent<C>>\n\n// @ts-ignore\nconst attrs: Attrs = ({ name, component }) => {\n // --------------------------------------------------------\n // handle ERRORS in development mode\n // --------------------------------------------------------\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 return attrsComponent({\n name,\n component,\n attrs: [],\n priorityAttrs: [],\n compose: {},\n statics: {},\n })\n}\n\nexport default attrs\n","export type IsAttrsComponent = <T>(component: T) => boolean\n\nconst isAttrsComponent: IsAttrsComponent = (component) => {\n if (\n component &&\n typeof component === 'object' &&\n component !== null &&\n Object.prototype.hasOwnProperty.call(component, 'IS_ATTRS')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isAttrsComponent\n"],"names":["useRef","useImperativeHandle","isEmpty","forwardRef","React","attrsHoc","compose","hoistNonReactStatics","pick","attrsComponent"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,iBAAiB,GAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAI;AAC5D,IAAA,MAAM,WAAW,GAAGA,YAAM,CAAC,IAAI,CAAC,CAAA;IAEhCC,yBAAmB,CAAC,SAAS,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAA;IACzDA,yBAAmB,CAAC,GAAG,EAAE,MAAM,WAAW,CAAC,OAAO,CAAC,CAAA;AAEnD,IAAA,OAAO,WAAW,CAAA;AACpB,CAAC;;ACdD;AAUO,MAAM,oBAAoB,GAAyB,CAAC,KAAK,KAC9D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAI;AACrC,IAAA,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IAC/B,IAAI,YAAY,KAAK,SAAS;QAA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AS,EAAE,KAAI;;;;AAI3C,IAAA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QAMzC,MAAM,MAAM,GAAW,EAAE,CAAA;QACzB,IAAI,CAAC,SAAS,EAAE;AACd,YAAA,MAAM,CAAC,SAAS,GAAG,6CAA6C,CAAA;AACjE,SAAA;QAED,IAAI,CAAC,IAAI,EAAE;AACT,YAAA,MAAM,CAAC,IAAI,GAAG,wCAAwC,CAAA;AACvD,SAAA;AAED,QAAA,IAAI,CAACN,YAAO,CAAC,MAAM,CAAC,EAAE;YACpB,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAA;AACpC,SAAA;AACF,KAAA;AAED,IAAA,OAAOO,eAAc,CAAC;QACpB,IAAI;QACJ,SAAS;AACT,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,aAAa,EAAE,EAAE;AACjB,QAAA,OAAO,EAAE,EAAE;AACX,QAAA,OAAO,EAAE,EAAE;AACZ,KAAA,CAAC,CAAA;AACJ;;AC5CA,MAAM,gBAAgB,GAAqB,CAAC,SAAS,KAAI;AACvD,IAAA,IACE,SAAS;QACT,OAAO,SAAS,KAAK,QAAQ;AAC7B,QAAA,SAAS,KAAK,IAAI;QAClB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAC3D;AACA,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;;;;;"}
|
|
@@ -70,6 +70,7 @@ const calculateHocsFuncs = (options = {}) => Object.values(options)
|
|
|
70
70
|
.reverse();
|
|
71
71
|
|
|
72
72
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
73
|
+
/* eslint-disable no-underscore-dangle */
|
|
73
74
|
const cloneAndEnhance = (defaultOpts, opts) =>
|
|
74
75
|
// @ts-ignore
|
|
75
76
|
rocketComponent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vitus-labs-attrs.module.js","sources":["../src/hooks/useRef.ts","../src/utils/attrs.ts","../src/hoc/attrsHoc.tsx","../src/utils/statics.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/attrs.tsx","../src/init.ts","../src/isAttrsComponent.tsx"],"sourcesContent":["import { useRef, useImperativeHandle, ForwardedRef } from 'react'\n\ntype UseAttrsRef = (props: {\n $attrsRef?: ForwardedRef<unknown>\n ref?: ForwardedRef<unknown>\n}) => ForwardedRef<unknown>\n\nconst useRocketstyleRef: 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 useRocketstyleRef\n","/* eslint-disable no-param-reassign */\nimport { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// Remove undefined props\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) return { ...acc, [key]: currentValue }\n return acc\n }, {} as any)\n\n// --------------------------------------------------------\n// combine values\n// --------------------------------------------------------\ntype OptionFunc<A> = (...arg: Array<A>) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: Array<OptionFunc<A>>\n) => (args: Array<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","/* eslint-disable no-underscore-dangle */\nimport React, {\n forwardRef,\n ForwardRefExoticComponent,\n ComponentType,\n} from 'react'\nimport { calculateChainOptions, removeUndefinedProps } from '~/utils/attrs'\nimport type { Configuration } from '~/types/configuration'\n\nexport type RocketStyleHOC = ({\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentType<any>\n) => ForwardRefExoticComponent<any>\n\nconst attrsHOC: RocketStyleHOC = ({ attrs, priorityAttrs }) => {\n // --------------------------------------------------\n // .attrs(...)\n // first we need to calculate final props which are\n // being returned by using `attr` chaining method\n // --------------------------------------------------\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const Enhanced = (WrappedComponent: ComponentType<any>) =>\n forwardRef<any, any>((props, ref) => {\n // --------------------------------------------------\n // remove undefined props not to override potential default props\n // only props with value (e.g. `null`) should override default props\n // --------------------------------------------------\n const filteredProps = removeUndefinedProps(props)\n\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps])\n\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ])\n\n return (\n <WrappedComponent\n $attrsRef={ref}\n {...prioritizedAttrs}\n {...finalAttrs}\n {...filteredProps}\n />\n )\n })\n\n return Enhanced\n}\n\nexport default attrsHOC\n","import { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// helpers for create statics on component\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","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n// --------------------------------------------------------\n// Chain Options\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 */\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","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable no-underscore-dangle */\nimport React, { forwardRef } from 'react'\nimport hoistNonReactStatics from 'hoist-non-react-statics'\nimport { pick, compose } from '@vitus-labs/core'\nimport { useRef } from '~/hooks'\nimport { attrsHoc } from '~/hoc'\nimport { createStaticsEnhancers } from '~/utils/statics'\nimport { chainOptions } from '~/utils/chaining'\nimport { calculateHocsFuncs } from '~/utils/compose'\nimport { calculateChainOptions } from '~/utils/attrs'\nimport type { AttrsComponent, ExoticComponent } from '~/types/AttrsComponent'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport type {\n Configuration,\n ExtendedConfiguration,\n} from '~/types/configuration'\n\n// --------------------------------------------------------\n// cloneAndEnhance\n// helper function which allows function chaining\n// always returns rocketComponent with static functions\n// assigned\n// --------------------------------------------------------\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>\n) => ReturnType<typeof rocketComponent>\n\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n // @ts-ignore\n rocketComponent({\n ...defaultOpts,\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n })\n\n// --------------------------------------------------------\n// styleComponent\n// helper function which allows function chaining\n// always returns a valid React component with static functions\n// assigned, so it can be even rendered as a valid component\n// or styles can be extended via its statics\n// --------------------------------------------------------\n// @ts-ignore\nconst rocketComponent: InitAttrsComponent = (options) => {\n const componentName =\n options.name || options.component.displayName || options.component.name\n\n // --------------------------------------------------------\n // COMPONENT - Final component to be rendered\n // --------------------------------------------------------\n const RenderComponent = options.component\n\n // --------------------------------------------------------\n // COMPOSE - high-order components\n // --------------------------------------------------------\n const hocsFuncs = [attrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // --------------------------------------------------------\n // ENHANCED COMPONENT (returned component)\n // --------------------------------------------------------\n // .attrs() chaining option is calculated in HOC and passed as props already\n const EnhancedComponent: ExoticComponent = forwardRef(\n (\n {\n $attrsRef, // it's forwarded from HOC which is always on top of all hocs\n ...props\n },\n ref\n ) => {\n // --------------------------------------------------\n // handle refs\n // (1) one is passed from inner HOC - $rocketstyleRef\n // (2) second one is used to be used directly (e.g. inside hocs)\n // --------------------------------------------------\n const internalRef = useRef({ $attrsRef, ref })\n\n // --------------------------------------------------\n // final props\n // final props passed to WrappedComponent\n // excluding: styling props\n // including: $rocketstyle, $rocketstate\n // --------------------------------------------------\n const finalProps: Record<string, any> = {\n // this removes styling state from props and passes its state\n // under rocketstate key only\n ...props,\n ref: ref || $attrsRef ? internalRef : undefined,\n }\n\n // all the development stuff injected\n if (process.env.NODE_ENV !== 'production') {\n finalProps['data-attrs'] = componentName\n }\n\n return <RenderComponent {...finalProps} />\n }\n )\n\n // ------------------------------------------------------\n // This will hoist and generate dynamically next static methods\n // for all dimensions available in configuration\n // ------------------------------------------------------\n const RocketComponent: AttrsComponent = compose(...hocsFuncs)(\n EnhancedComponent\n )\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n\n hoistNonReactStatics(RocketComponent, options.component)\n\n // ------------------------------------------------------\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n RocketComponent.meta = {}\n // ------------------------------------------------------\n\n // ------------------------------------------------------\n // enhance for statics\n // ------------------------------------------------------\n createStaticsEnhancers({\n context: RocketComponent.meta,\n options: options.statics,\n })\n\n // @ts-ignore\n RocketComponent.attrs = (attrs, { priority } = {}) => {\n if (priority) {\n return cloneAndEnhance(options, {\n priorityAttrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n return cloneAndEnhance(options, {\n attrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n // @ts-ignore\n RocketComponent.config = (opts = {}) => {\n const result = pick(opts)\n\n return cloneAndEnhance(options, result)\n }\n\n // @ts-ignore\n RocketComponent.statics = (opts) =>\n // @ts-ignore\n cloneAndEnhance(options, { statics: opts })\n\n RocketComponent.getDefaultAttrs = (props) =>\n calculateChainOptions(options.attrs)([props])\n\n return RocketComponent\n}\n\nexport default rocketComponent\n","import { isEmpty } from '@vitus-labs/core'\nimport attrsComponent from '~/attrs'\nimport type { ElementType } from '~/types/utils'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\n\nexport type Attrs = <C extends ElementType<any>>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<InitAttrsComponent<C>>\n\n// @ts-ignore\nconst attrs: Attrs = ({ name, component }) => {\n // --------------------------------------------------------\n // handle ERRORS in development mode\n // --------------------------------------------------------\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 return attrsComponent({\n name,\n component,\n attrs: [],\n priorityAttrs: [],\n compose: {},\n statics: {},\n })\n}\n\nexport default attrs\n","export type IsAttrsComponent = <T>(component: T) => boolean\n\nconst isAttrsComponent: IsAttrsComponent = (component) => {\n if (\n component &&\n typeof component === 'object' &&\n component !== null &&\n Object.prototype.hasOwnProperty.call(component, 'IS_ATTRS')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isAttrsComponent\n"],"names":["attrsHoc","useRef","attrsComponent"],"mappings":";;;;AAOA,MAAM,iBAAiB,GAAgB,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAI;AAC5D,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAEh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,SAAS,EAAE,UAAU,CAAC,EAC3D;AACA,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;;;"}
|
|
1
|
+
{"version":3,"file":"vitus-labs-attrs.module.js","sources":["../src/hooks/useRef.ts","../src/utils/attrs.ts","../src/hoc/attrsHoc.tsx","../src/utils/statics.ts","../src/utils/chaining.ts","../src/utils/compose.ts","../src/attrs.tsx","../src/init.ts","../src/isAttrsComponent.tsx"],"sourcesContent":["import { useRef, useImperativeHandle, ForwardedRef } from 'react'\n\ntype UseAttrsRef = (props: {\n $attrsRef?: ForwardedRef<unknown>\n ref?: ForwardedRef<unknown>\n}) => ForwardedRef<unknown>\n\nconst useRocketstyleRef: 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 useRocketstyleRef\n","/* eslint-disable no-param-reassign */\nimport { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// Remove undefined props\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) return { ...acc, [key]: currentValue }\n return acc\n }, {} as any)\n\n// --------------------------------------------------------\n// combine values\n// --------------------------------------------------------\ntype OptionFunc<A> = (...arg: Array<A>) => Record<string, unknown>\ntype CalculateChainOptions = <A>(\n options?: Array<OptionFunc<A>>\n) => (args: Array<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","/* eslint-disable no-underscore-dangle */\nimport React, {\n forwardRef,\n ForwardRefExoticComponent,\n ComponentType,\n} from 'react'\nimport { calculateChainOptions, removeUndefinedProps } from '~/utils/attrs'\nimport type { Configuration } from '~/types/configuration'\n\nexport type RocketStyleHOC = ({\n attrs,\n priorityAttrs,\n}: Pick<Configuration, 'attrs' | 'priorityAttrs'>) => (\n WrappedComponent: ComponentType<any>\n) => ForwardRefExoticComponent<any>\n\nconst attrsHOC: RocketStyleHOC = ({ attrs, priorityAttrs }) => {\n // --------------------------------------------------\n // .attrs(...)\n // first we need to calculate final props which are\n // being returned by using `attr` chaining method\n // --------------------------------------------------\n const calculateAttrs = calculateChainOptions(attrs)\n const calculatePriorityAttrs = calculateChainOptions(priorityAttrs)\n\n const Enhanced = (WrappedComponent: ComponentType<any>) =>\n forwardRef<any, any>((props, ref) => {\n // --------------------------------------------------\n // remove undefined props not to override potential default props\n // only props with value (e.g. `null`) should override default props\n // --------------------------------------------------\n const filteredProps = removeUndefinedProps(props)\n\n const prioritizedAttrs = calculatePriorityAttrs([filteredProps])\n\n const finalAttrs = calculateAttrs([\n {\n ...prioritizedAttrs,\n ...filteredProps,\n },\n ])\n\n return (\n <WrappedComponent\n $attrsRef={ref}\n {...prioritizedAttrs}\n {...finalAttrs}\n {...filteredProps}\n />\n )\n })\n\n return Enhanced\n}\n\nexport default attrsHOC\n","import { isEmpty } from '@vitus-labs/core'\n\n// --------------------------------------------------------\n// helpers for create statics on component\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","type Func = (...args: any) => Record<string, unknown>\ntype Obj = Record<string, unknown>\n\n// --------------------------------------------------------\n// Chain Options\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 */\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","/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable no-underscore-dangle */\nimport React, { forwardRef } from 'react'\nimport hoistNonReactStatics from 'hoist-non-react-statics'\nimport { pick, compose } from '@vitus-labs/core'\nimport { useRef } from '~/hooks'\nimport { attrsHoc } from '~/hoc'\nimport { createStaticsEnhancers } from '~/utils/statics'\nimport { chainOptions } from '~/utils/chaining'\nimport { calculateHocsFuncs } from '~/utils/compose'\nimport { calculateChainOptions } from '~/utils/attrs'\nimport type { AttrsComponent, ExoticComponent } from '~/types/AttrsComponent'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\nimport type {\n Configuration,\n ExtendedConfiguration,\n} from '~/types/configuration'\n\n// --------------------------------------------------------\n// cloneAndEnhance\n// helper function which allows function chaining\n// always returns rocketComponent with static functions\n// assigned\n// --------------------------------------------------------\ntype CloneAndEnhance = (\n defaultOpts: Configuration,\n opts: Partial<ExtendedConfiguration>\n) => ReturnType<typeof rocketComponent>\n\nconst cloneAndEnhance: CloneAndEnhance = (defaultOpts, opts) =>\n // @ts-ignore\n rocketComponent({\n ...defaultOpts,\n attrs: chainOptions(opts.attrs, defaultOpts.attrs),\n priorityAttrs: chainOptions(opts.priorityAttrs, defaultOpts.priorityAttrs),\n statics: { ...defaultOpts.statics, ...opts.statics },\n compose: { ...defaultOpts.compose, ...opts.compose },\n })\n\n// --------------------------------------------------------\n// styleComponent\n// helper function which allows function chaining\n// always returns a valid React component with static functions\n// assigned, so it can be even rendered as a valid component\n// or styles can be extended via its statics\n// --------------------------------------------------------\n// @ts-ignore\nconst rocketComponent: InitAttrsComponent = (options) => {\n const componentName =\n options.name || options.component.displayName || options.component.name\n\n // --------------------------------------------------------\n // COMPONENT - Final component to be rendered\n // --------------------------------------------------------\n const RenderComponent = options.component\n\n // --------------------------------------------------------\n // COMPOSE - high-order components\n // --------------------------------------------------------\n const hocsFuncs = [attrsHoc(options), ...calculateHocsFuncs(options.compose)]\n\n // --------------------------------------------------------\n // ENHANCED COMPONENT (returned component)\n // --------------------------------------------------------\n // .attrs() chaining option is calculated in HOC and passed as props already\n const EnhancedComponent: ExoticComponent = forwardRef(\n (\n {\n $attrsRef, // it's forwarded from HOC which is always on top of all hocs\n ...props\n },\n ref\n ) => {\n // --------------------------------------------------\n // handle refs\n // (1) one is passed from inner HOC - $rocketstyleRef\n // (2) second one is used to be used directly (e.g. inside hocs)\n // --------------------------------------------------\n const internalRef = useRef({ $attrsRef, ref })\n\n // --------------------------------------------------\n // final props\n // final props passed to WrappedComponent\n // excluding: styling props\n // including: $rocketstyle, $rocketstate\n // --------------------------------------------------\n const finalProps: Record<string, any> = {\n // this removes styling state from props and passes its state\n // under rocketstate key only\n ...props,\n ref: ref || $attrsRef ? internalRef : undefined,\n }\n\n // all the development stuff injected\n if (process.env.NODE_ENV !== 'production') {\n finalProps['data-attrs'] = componentName\n }\n\n return <RenderComponent {...finalProps} />\n }\n )\n\n // ------------------------------------------------------\n // This will hoist and generate dynamically next static methods\n // for all dimensions available in configuration\n // ------------------------------------------------------\n const RocketComponent: AttrsComponent = compose(...hocsFuncs)(\n EnhancedComponent\n )\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n\n hoistNonReactStatics(RocketComponent, options.component)\n\n // ------------------------------------------------------\n RocketComponent.IS_ATTRS = true\n RocketComponent.displayName = componentName\n RocketComponent.meta = {}\n // ------------------------------------------------------\n\n // ------------------------------------------------------\n // enhance for statics\n // ------------------------------------------------------\n createStaticsEnhancers({\n context: RocketComponent.meta,\n options: options.statics,\n })\n\n // @ts-ignore\n RocketComponent.attrs = (attrs, { priority } = {}) => {\n if (priority) {\n return cloneAndEnhance(options, {\n priorityAttrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n return cloneAndEnhance(options, {\n attrs: attrs as ExtendedConfiguration['attrs'],\n })\n }\n\n // @ts-ignore\n RocketComponent.config = (opts = {}) => {\n const result = pick(opts)\n\n return cloneAndEnhance(options, result)\n }\n\n // @ts-ignore\n RocketComponent.statics = (opts) =>\n // @ts-ignore\n cloneAndEnhance(options, { statics: opts })\n\n RocketComponent.getDefaultAttrs = (props) =>\n calculateChainOptions(options.attrs)([props])\n\n return RocketComponent\n}\n\nexport default rocketComponent\n","import { isEmpty } from '@vitus-labs/core'\nimport attrsComponent from '~/attrs'\nimport type { ElementType } from '~/types/utils'\nimport type { InitAttrsComponent } from '~/types/InitAttrsComponent'\n\nexport type Attrs = <C extends ElementType<any>>({\n name,\n component,\n}: {\n name: string\n component: C\n}) => ReturnType<InitAttrsComponent<C>>\n\n// @ts-ignore\nconst attrs: Attrs = ({ name, component }) => {\n // --------------------------------------------------------\n // handle ERRORS in development mode\n // --------------------------------------------------------\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 return attrsComponent({\n name,\n component,\n attrs: [],\n priorityAttrs: [],\n compose: {},\n statics: {},\n })\n}\n\nexport default attrs\n","export type IsAttrsComponent = <T>(component: T) => boolean\n\nconst isAttrsComponent: IsAttrsComponent = (component) => {\n if (\n component &&\n typeof component === 'object' &&\n component !== null &&\n Object.prototype.hasOwnProperty.call(component, 'IS_ATTRS')\n ) {\n return true\n }\n\n return false\n}\n\nexport default isAttrsComponent\n"],"names":["attrsHoc","useRef","attrsComponent"],"mappings":";;;;AAOA,MAAM,iBAAiB,GAAg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;QACT,OAAO,SAAS,KAAK,QAAQ;AAC7B,QAAA,SAAS,KAAK,IAAI;QAClB,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,EAC3D;AACA,QAAA,OAAO,IAAI,CAAA;AACZ,KAAA;AAED,IAAA,OAAO,KAAK,CAAA;AACd;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitus-labs/attrs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Vit Bokisch <vit@bokisch.cz>",
|
|
6
6
|
"maintainers": [
|
|
@@ -54,12 +54,12 @@
|
|
|
54
54
|
"hoist-non-react-statics": "^3.3.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@vitus-labs/core": "^0.
|
|
58
|
-
"@vitus-labs/tools-babel": "^0.
|
|
59
|
-
"@vitus-labs/tools-rollup": "^0.
|
|
60
|
-
"@vitus-labs/tools-storybook": "^0.
|
|
61
|
-
"@vitus-labs/tools-types": "^0.
|
|
62
|
-
"@vitus-labs/tools-typescript": "^0.
|
|
57
|
+
"@vitus-labs/core": "^0.80.0",
|
|
58
|
+
"@vitus-labs/tools-babel": "^0.46.0",
|
|
59
|
+
"@vitus-labs/tools-rollup": "^0.46.0",
|
|
60
|
+
"@vitus-labs/tools-storybook": "^0.46.0",
|
|
61
|
+
"@vitus-labs/tools-types": "^0.46.0",
|
|
62
|
+
"@vitus-labs/tools-typescript": "^0.46.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "e828ad350de262d49cd4420c3a16221446ea0c45"
|
|
65
65
|
}
|