@semcore/core 16.3.0-prerelease.5 → 16.4.0-prerelease.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/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [16.4.0] - 2025-09-20
6
+
7
+ ### Added
8
+
9
+ - Ability to use two tags in `tag` property. First for some logic like `Ellipsis` or `Select.Trigger` and second for real `html` tag.
10
+
11
+ ## [16.3.1] - 2025-09-12
12
+
13
+ ### Changed
14
+
15
+ - Prevent scroll on focus by mouse interaction.
16
+
5
17
  ## [16.3.0] - 2025-09-08
6
18
 
7
19
  ### Added
@@ -130,12 +130,12 @@ export declare namespace Intergalactic {
130
130
  } ? NestedProps : {}>, 'children' | 'tag'>;
131
131
  export type ReturnResult = React.ReactElement | React.ReactNode | React.ReactNode[] | string | null;
132
132
  export type ComponentTag = keyof JSX.IntrinsicElements | React.ComponentClass | React.FC | ReactFCLike;
133
- export type ComponentProps<Tag extends ComponentTag, BaseTag extends ComponentTag | never, Props, Context = never, AdditionalContext extends any[] = never[]> = {
133
+ export type ComponentProps<Tag extends ComponentTag | [ComponentTag, keyof JSX.IntrinsicElements], BaseTag extends ComponentTag | never, Props, Context = never, AdditionalContext extends any[] = never[]> = {
134
134
  tag?: Tag;
135
135
  children?: ComponentChildren<EfficientOmit<Props, 'children'> & {
136
136
  children: React.ReactNode;
137
137
  }, Context, ReturnResult, AdditionalContext>;
138
- } & ComponentBasicProps<Tag> & MergeProps<EfficientOmit<Props, 'tag' | 'children'>, MergeProps<ComponentPropsNesting<Tag>, ComponentPropsNesting<BaseTag>>>;
138
+ } & ComponentBasicProps<Tag extends [ComponentTag, keyof JSX.IntrinsicElements] ? Tag[0] : Tag> & MergeProps<EfficientOmit<Props, 'tag' | 'children'>, MergeProps<ComponentPropsNesting<Tag extends [ComponentTag, keyof JSX.IntrinsicElements] ? Tag[0] : Tag>, ComponentPropsNesting<BaseTag>>>;
139
139
  export type PropsRenderingResultComponentProps<Tag extends ComponentTag, Props, Context = {}, AdditionalContext extends any[] = never[]> = {
140
140
  tag?: Tag;
141
141
  children?: ComponentChildren<EfficientOmit<Props, 'children'> & {
@@ -166,7 +166,7 @@ export declare namespace Intergalactic {
166
166
  };
167
167
  export {};
168
168
  }
169
- export type Component<BaseTag extends InternalTypings.ComponentTag = never, BaseProps = {}, Context = {}, AdditionalContext extends any[] = never[]> = (<Tag extends InternalTypings.ComponentTag = BaseTag, Props extends BaseProps = BaseProps>(props: InternalTypings.ComponentProps<Tag, BaseTag, Props, Context, AdditionalContext>) => InternalTypings.ComponentRenderingResults) & InternalTypings.ComponentAdditive<BaseTag, Tag, BaseProps, Context, AdditionalContext>;
169
+ export type Component<BaseTag extends InternalTypings.ComponentTag = never, BaseProps = {}, Context = {}, AdditionalContext extends any[] = never[]> = (<Tag extends InternalTypings.ComponentTag | [InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = BaseTag, Props extends BaseProps = BaseProps>(props: InternalTypings.ComponentProps<Tag, BaseTag, Props, Context, AdditionalContext>) => InternalTypings.ComponentRenderingResults) & InternalTypings.ComponentAdditive<BaseTag, Tag, BaseProps, Context, AdditionalContext>;
170
170
  export type Tag = InternalTypings.ComponentTag;
171
171
  export type DomProps<Tag extends keyof JSX.IntrinsicElements> = InternalTypings.InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>;
172
172
  export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
@@ -1 +1 @@
1
- {"version":3,"file":"Component.js","names":["_react","require","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","Root","exports","undefined","RootComponent","_PureComponent","_this","_len","arguments","length","args","Array","_key","_classCallCheck2","concat","_defineProperty2","_inherits2","_createClass2","key","get","PureComponent","Component","Intergalactic","wrapIntergalacticComponent","wrapper"],"sources":["../../src/core-types/Component.ts"],"sourcesContent":["import type React from 'react';\nimport { type\nAllHTMLAttributes, type\nForwardRefExoticComponent,\nPureComponent, type\nReactNode, type\nRefAttributes, type\nRefObject,\n} from 'react';\n\nimport type { CORE_COMPONENT, CREATE_COMPONENT } from './symbols';\nimport type { IStyledProps } from '../styled/index';\n\n/** @deprecated */\ntype KnownKeys<T> = {\n [K in keyof T]: string extends K ? never : number extends K ? never : K;\n} extends { [_ in keyof T]: infer U }\n ? U\n : never;\n\n/** @deprecated */\nexport type HandlersType<UCProps> = { [K in keyof UCProps]?: <T = unknown>(arg: T) => void };\n/** @deprecated */\nexport type ChildrenType<Props = {}, Ctx = {}, UCProps = {}> =\n | ((props: Props & Ctx, handlers: HandlersType<UCProps>) => ReactNode)\n | ReactNode;\n\n/** @deprecated */\nexport type RootComponentHandler = (...args: any[]) => void | false;\n\n/** @deprecated */\nexport interface IRootComponentHandlers {\n [key: string]: RootComponentHandler;\n}\n\n/** @deprecated */\nexport interface IRootComponentProps<Props = {}, Ctx = {}> {\n 'forwardRef'?: RefObject<any>;\n 'Children'?: any;\n 'children'?: ChildrenType<Props, Ctx>;\n 'styles'?: IStyledProps['styles'];\n 'data-ui-name'?: string;\n}\n\n/** @deprecated */\nexport type IComponentProps<Props = {}, Ctx = {}> = Props & IRootComponentProps<Props, Ctx>;\n\n/** @deprecated */\nexport type IFunctionProps<Props = {}, Ctx = {}> = IComponentProps<Props, Ctx> &\n Omit<AllHTMLAttributes<any>, keyof IComponentProps<Props, Ctx>> & { Root?: Root };\n\n/** @deprecated */\nexport type PropsWithRenderFnChildren<Props = {}, Ctx = {}, UCProps = {}> = Omit<\n Pick<Props, KnownKeys<Props>>,\n 'children'\n> & {\n children?: ChildrenType<Props, Ctx, UCProps>;\n [key: string]: unknown;\n};\n\n/** @deprecated */\nexport type CProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?: ((props: Props & Ctx, handlers: UCProps) => React.ReactNode) | React.ReactNode;\n};\n/** @deprecated */\nexport type ReturnEl = React.ReactElement | null;\n\nexport interface IRootNodeProps {\n render: React.ElementType | string;\n tag?: React.ElementType | string;\n\n [key: string]: any;\n}\n\ntype Root = ForwardRefExoticComponent<IRootNodeProps>;\n\n/**\n * @deprecated since version ^1.8.0\n */\nexport type PropGetter<T extends (...args: any) => any> = <P>(props?: P) => ReturnType<T> & P;\n/**\n * @deprecated since version ^1.8.0\n */\n/** @deprecated */\nexport type PropGetterReturn<T extends (...args: any) => any> = Partial<ReturnType<T>>;\n/** @deprecated */\nexport type PropGetterFn = <T extends {}>(props?: T) => T & { [key: string]: unknown };\n/** @deprecated */\nexport type Merge<Props, HTMLProps> = Props & Omit<HTMLProps, keyof Props>;\n/** @deprecated */\nexport type MergeGetters<G1 extends (...args: any) => any, G2 extends (...args: any) => any> = <P>(\n props?: P,\n) => Merge<ReturnType<G1>, ReturnType<G2>> & P;\n\nconst Root: Root = undefined as any;\n\nexport { Root };\n\n/** @deprecated */\nabstract class RootComponent<\n Props = {},\n Context = {},\n State = {},\n Enhance extends readonly ((...args: any[]) => any)[] = [],\n InnerProps = {},\n> extends PureComponent<Props, State> {\n get handlers(): Readonly<IRootComponentHandlers> {\n return {};\n }\n\n get asProps() {\n return {} as Readonly<\n Merge<\n Props &\n IRootComponentProps<Props, Context> &\n Intergalactic.InternalTypings.ExtractEnhanceType<Enhance> &\n InnerProps,\n AllHTMLAttributes<any>\n >\n >;\n }\n\n Root: Root = undefined as any;\n\n isControlled = false;\n}\n\nexport const Component = RootComponent;\n/** @deprecated */\nexport type Component<\n Props = {},\n Context = {},\n State = {},\n Handlers extends IRootComponentHandlers = IRootComponentHandlers,\n> = React.ComponentClass<Props, State> & {\n isControlled: boolean;\n\n handlers: Readonly<Handlers>;\n\n asProps: Readonly<Merge<Props & IRootComponentProps<Props, Context>, AllHTMLAttributes<any>>>;\n\n Root: Root;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Intergalactic {\n type ReactFCProps<C extends React.FC> = C extends React.FC<infer Props> ? Omit<Props, 'tag'> : {};\n type ReactComponentProps<C extends React.ComponentClass> = C extends React.ComponentClass<\n infer Props\n >\n ? Omit<Props, 'tag'>\n : never;\n type ReactFCLike = (props: any) => any;\n type ReactFCLikeProps<C extends ReactFCLike> = C extends (props: infer Props) => any ? Props : {};\n type ComponentChildren<\n Props,\n Context,\n RenderingResult = InternalTypings.ReturnResult,\n AdditionalContext extends any[] = never[],\n > =\n | ((props: MergeProps<Context, Props>, ...args: AdditionalContext) => RenderingResult)\n | InternalTypings.ReturnResult;\n type ComponentBasicProps<Tag extends InternalTypings.ComponentTag> = {\n ref?: React.Ref<InternalTypings.ComponentHtmlElement<Tag> | null>;\n /** @private DO NOT USE IT. Low-level api that prevents specified props from being applied as DOM attribute. */\n __excludeProps?: string[];\n };\n type MergeProps<HighPriorityProps, LowPriorityProps> = {\n [K in keyof LowPriorityProps]: K extends keyof HighPriorityProps\n ? HighPriorityProps[K]\n : LowPriorityProps[K];\n } & HighPriorityProps;\n /** @private */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace InternalTypings {\n export type EfficientOmit<Type, Keys> = {\n [Property in keyof Type as Exclude<Property, Keys>]: Type[Property];\n };\n export type ExtractEnhanceType<F extends readonly ((...args: any[]) => any)[]> =\n F['length'] extends 0\n ? {}\n : F['length'] extends 1\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n }\n : F['length'] extends 2\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n }\n : F['length'] extends 3\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n }\n : F['length'] extends 4\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n } & {\n [K in keyof ReturnType<F[3]>]: ReturnType<F[3]>[K];\n }\n : {};\n export type ComponentPropsNesting<Tag extends InternalTypings.ComponentTag> = Omit<\n MergeProps<\n Tag extends React.FC\n ? ReactFCProps<Tag>\n : Tag extends React.ComponentClass\n ? ReactComponentProps<Tag>\n : Tag extends ReactFCLike\n ? ReactFCLikeProps<Tag>\n : Tag extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[Tag]\n : {},\n Tag extends { __nestedProps: infer NestedProps } ? NestedProps : {}\n >,\n 'children' | 'tag'\n >;\n export type ReturnResult =\n | React.ReactElement\n | React.ReactNode\n | React.ReactNode[]\n | string\n | null;\n export type ComponentTag =\n | keyof JSX.IntrinsicElements\n | React.ComponentClass\n | React.FC\n | ReactFCLike;\n export type ComponentProps<\n Tag extends ComponentTag,\n BaseTag extends ComponentTag | never,\n Props,\n Context = never,\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n ReturnResult,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag> &\n MergeProps<\n EfficientOmit<Props, 'tag' | 'children'>,\n MergeProps<ComponentPropsNesting<Tag>, ComponentPropsNesting<BaseTag>>\n >;\n export type PropsRenderingResultComponentProps<\n Tag extends ComponentTag,\n Props,\n Context = {},\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n Partial<\n EfficientOmit<\n MergeProps<Props, ComponentPropsNesting<Tag>>,\n 'children' | 'tag' | 'ref'\n > & {\n children?: React.ReactNode;\n }\n >,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag> &\n MergeProps<EfficientOmit<Props, 'tag' | 'children'>, ComponentPropsNesting<Tag>>;\n export type ComponentRenderingResults = React.ReactElement;\n export type ComponentAdditive<\n BaseTag extends ComponentTag,\n Tag extends ComponentTag,\n Props = {},\n Context = {},\n AdditionalContext = {},\n > = {\n __nestedProps: ComponentPropsNesting<BaseTag>;\n __tag: Tag;\n __props: Props;\n __context: Context;\n __additionalContext: AdditionalContext;\n displayName: string;\n newInstance: () => Component<BaseTag, Props, Context>;\n };\n export type InferJsxIntrinsicElement<T extends React.DetailedHTMLProps<any, any>> =\n T extends React.DetailedHTMLProps<infer _, infer Element> ? Element : HTMLElement;\n type InferElementFromRef<T> = T extends React.Ref<infer Element> ? Element : never;\n type InferRefElementFromProps<T> = 'ref' extends keyof T\n ? InferElementFromRef<T['ref']>\n : HTMLElement;\n export type ComponentHtmlElement<Tag extends ComponentTag> =\n Tag extends keyof JSX.IntrinsicElements\n ? InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>\n : Tag extends { __nestedProps: infer NestedProps }\n ? InferRefElementFromProps<NestedProps>\n : HTMLElement;\n export type UntypeRefAndTag<Props> = Intergalactic.InternalTypings.EfficientOmit<\n Props,\n 'ref' | 'tag'\n > & {\n ref: React.Ref<any>;\n tag: Intergalactic.InternalTypings.ComponentTag;\n };\n }\n export type Component<\n BaseTag extends InternalTypings.ComponentTag = never,\n BaseProps = {},\n Context = {},\n AdditionalContext extends any[] = never[],\n > = (<Tag extends InternalTypings.ComponentTag = BaseTag, Props extends BaseProps = BaseProps>(\n props: InternalTypings.ComponentProps<Tag, BaseTag, Props, Context, AdditionalContext>,\n ) => InternalTypings.ComponentRenderingResults) &\n InternalTypings.ComponentAdditive<BaseTag, Tag, BaseProps, Context, AdditionalContext>;\n export type Tag = InternalTypings.ComponentTag;\n export type DomProps<Tag extends keyof JSX.IntrinsicElements> =\n InternalTypings.InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>;\n export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<\n T,\n Exclude<keyof T, Keys>\n > &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n}\n\nexport const wrapIntergalacticComponent = <\n Component extends Intergalactic.Component<any, any, any, any>,\n PropsExtending = {},\n>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n): Intergalactic.Component<\n Component['__tag'],\n Component['__props'] & Component['__nestedProps'] & PropsExtending,\n Component['__context'],\n Component['__additionalContext']\n> => wrapper as any;\n\nexport type PropsAndRef<T, Ctx, UCProps> = PropsWithRenderFnChildren<T, Ctx, UCProps> &\n RefAttributes<unknown>;\nexport type ForwardRefComponent<T, Ctx, UCProps> = ForwardRefExoticComponent<\n PropsAndRef<T, Ctx, UCProps>\n>;\ntype ComponentOrProps<T, Context, UCProps> = T extends [infer ParentProps, infer ChildProps]\n ? ComponentType<ParentProps, ChildProps, Context, UCProps>\n : ForwardRefComponent<T, Context, UCProps>;\n\nexport type ComponentType<\n ComponentProps,\n ChildComponentProps = {},\n ContextType = {},\n UCProps = {},\n FNType = null,\n> = (FNType extends null\n ? ForwardRefComponent<ComponentProps, ContextType, UCProps>\n : FNType & { displayName: string }) & {\n [K in keyof ChildComponentProps]: ComponentOrProps<ChildComponentProps[K], ContextType, UCProps>;\n } & {\n [CORE_COMPONENT]: boolean;\n [CREATE_COMPONENT]: () => ComponentType<\n ComponentProps,\n ChildComponentProps,\n ContextType,\n UCProps\n >;\n };\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAOe,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,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;AAgBA;AAAA,IACiBkB,aAAa;AAgMvB,IAAMC,0BAA0B,GAAArB,OAAA,CAAAqB,0BAAA,GAAG,SAA7BA,0BAA0BA,CAIrCC,OAKoB;EAAA,OAMjBA,OAAO;AAAA,CAAO","ignoreList":[]}
1
+ {"version":3,"file":"Component.js","names":["_react","require","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","Root","exports","undefined","RootComponent","_PureComponent","_this","_len","arguments","length","args","Array","_key","_classCallCheck2","concat","_defineProperty2","_inherits2","_createClass2","key","get","PureComponent","Component","Intergalactic","wrapIntergalacticComponent","wrapper"],"sources":["../../src/core-types/Component.ts"],"sourcesContent":["import type React from 'react';\nimport { type\nAllHTMLAttributes, type\nForwardRefExoticComponent,\nPureComponent, type\nReactNode, type\nRefAttributes, type\nRefObject,\n} from 'react';\n\nimport type { CORE_COMPONENT, CREATE_COMPONENT } from './symbols';\nimport type { IStyledProps } from '../styled/index';\n\n/** @deprecated */\ntype KnownKeys<T> = {\n [K in keyof T]: string extends K ? never : number extends K ? never : K;\n} extends { [_ in keyof T]: infer U }\n ? U\n : never;\n\n/** @deprecated */\nexport type HandlersType<UCProps> = { [K in keyof UCProps]?: <T = unknown>(arg: T) => void };\n/** @deprecated */\nexport type ChildrenType<Props = {}, Ctx = {}, UCProps = {}> =\n | ((props: Props & Ctx, handlers: HandlersType<UCProps>) => ReactNode)\n | ReactNode;\n\n/** @deprecated */\nexport type RootComponentHandler = (...args: any[]) => void | false;\n\n/** @deprecated */\nexport interface IRootComponentHandlers {\n [key: string]: RootComponentHandler;\n}\n\n/** @deprecated */\nexport interface IRootComponentProps<Props = {}, Ctx = {}> {\n 'forwardRef'?: RefObject<any>;\n 'Children'?: any;\n 'children'?: ChildrenType<Props, Ctx>;\n 'styles'?: IStyledProps['styles'];\n 'data-ui-name'?: string;\n}\n\n/** @deprecated */\nexport type IComponentProps<Props = {}, Ctx = {}> = Props & IRootComponentProps<Props, Ctx>;\n\n/** @deprecated */\nexport type IFunctionProps<Props = {}, Ctx = {}> = IComponentProps<Props, Ctx> &\n Omit<AllHTMLAttributes<any>, keyof IComponentProps<Props, Ctx>> & { Root?: Root };\n\n/** @deprecated */\nexport type PropsWithRenderFnChildren<Props = {}, Ctx = {}, UCProps = {}> = Omit<\n Pick<Props, KnownKeys<Props>>,\n 'children'\n> & {\n children?: ChildrenType<Props, Ctx, UCProps>;\n [key: string]: unknown;\n};\n\n/** @deprecated */\nexport type CProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?: ((props: Props & Ctx, handlers: UCProps) => React.ReactNode) | React.ReactNode;\n};\n/** @deprecated */\nexport type ReturnEl = React.ReactElement | null;\n\nexport interface IRootNodeProps {\n render: React.ElementType | string;\n tag?: React.ElementType | string;\n\n [key: string]: any;\n}\n\ntype Root = ForwardRefExoticComponent<IRootNodeProps>;\n\n/**\n * @deprecated since version ^1.8.0\n */\nexport type PropGetter<T extends (...args: any) => any> = <P>(props?: P) => ReturnType<T> & P;\n/**\n * @deprecated since version ^1.8.0\n */\n/** @deprecated */\nexport type PropGetterReturn<T extends (...args: any) => any> = Partial<ReturnType<T>>;\n/** @deprecated */\nexport type PropGetterFn = <T extends {}>(props?: T) => T & { [key: string]: unknown };\n/** @deprecated */\nexport type Merge<Props, HTMLProps> = Props & Omit<HTMLProps, keyof Props>;\n/** @deprecated */\nexport type MergeGetters<G1 extends (...args: any) => any, G2 extends (...args: any) => any> = <P>(\n props?: P,\n) => Merge<ReturnType<G1>, ReturnType<G2>> & P;\n\nconst Root: Root = undefined as any;\n\nexport { Root };\n\n/** @deprecated */\nabstract class RootComponent<\n Props = {},\n Context = {},\n State = {},\n Enhance extends readonly ((...args: any[]) => any)[] = [],\n InnerProps = {},\n> extends PureComponent<Props, State> {\n get handlers(): Readonly<IRootComponentHandlers> {\n return {};\n }\n\n get asProps() {\n return {} as Readonly<\n Merge<\n Props &\n IRootComponentProps<Props, Context> &\n Intergalactic.InternalTypings.ExtractEnhanceType<Enhance> &\n InnerProps,\n AllHTMLAttributes<any>\n >\n >;\n }\n\n Root: Root = undefined as any;\n\n isControlled = false;\n}\n\nexport const Component = RootComponent;\n/** @deprecated */\nexport type Component<\n Props = {},\n Context = {},\n State = {},\n Handlers extends IRootComponentHandlers = IRootComponentHandlers,\n> = React.ComponentClass<Props, State> & {\n isControlled: boolean;\n\n handlers: Readonly<Handlers>;\n\n asProps: Readonly<Merge<Props & IRootComponentProps<Props, Context>, AllHTMLAttributes<any>>>;\n\n Root: Root;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Intergalactic {\n type ReactFCProps<C extends React.FC> = C extends React.FC<infer Props> ? Omit<Props, 'tag'> : {};\n type ReactComponentProps<C extends React.ComponentClass> = C extends React.ComponentClass<\n infer Props\n >\n ? Omit<Props, 'tag'>\n : never;\n type ReactFCLike = (props: any) => any;\n type ReactFCLikeProps<C extends ReactFCLike> = C extends (props: infer Props) => any ? Props : {};\n type ComponentChildren<\n Props,\n Context,\n RenderingResult = InternalTypings.ReturnResult,\n AdditionalContext extends any[] = never[],\n > =\n | ((props: MergeProps<Context, Props>, ...args: AdditionalContext) => RenderingResult)\n | InternalTypings.ReturnResult;\n type ComponentBasicProps<Tag extends InternalTypings.ComponentTag> = {\n ref?: React.Ref<InternalTypings.ComponentHtmlElement<Tag> | null>;\n /** @private DO NOT USE IT. Low-level api that prevents specified props from being applied as DOM attribute. */\n __excludeProps?: string[];\n };\n type MergeProps<HighPriorityProps, LowPriorityProps> = {\n [K in keyof LowPriorityProps]: K extends keyof HighPriorityProps\n ? HighPriorityProps[K]\n : LowPriorityProps[K];\n } & HighPriorityProps;\n /** @private */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace InternalTypings {\n export type EfficientOmit<Type, Keys> = {\n [Property in keyof Type as Exclude<Property, Keys>]: Type[Property];\n };\n export type ExtractEnhanceType<F extends readonly ((...args: any[]) => any)[]> =\n F['length'] extends 0\n ? {}\n : F['length'] extends 1\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n }\n : F['length'] extends 2\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n }\n : F['length'] extends 3\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n }\n : F['length'] extends 4\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n } & {\n [K in keyof ReturnType<F[3]>]: ReturnType<F[3]>[K];\n }\n : {};\n export type ComponentPropsNesting<Tag extends InternalTypings.ComponentTag> = Omit<\n MergeProps<\n Tag extends React.FC\n ? ReactFCProps<Tag>\n : Tag extends React.ComponentClass\n ? ReactComponentProps<Tag>\n : Tag extends ReactFCLike\n ? ReactFCLikeProps<Tag>\n : Tag extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[Tag]\n : {},\n Tag extends { __nestedProps: infer NestedProps } ? NestedProps : {}\n >,\n 'children' | 'tag'\n >;\n export type ReturnResult =\n | React.ReactElement\n | React.ReactNode\n | React.ReactNode[]\n | string\n | null;\n export type ComponentTag =\n | keyof JSX.IntrinsicElements\n | React.ComponentClass\n | React.FC\n | ReactFCLike;\n export type ComponentProps<\n Tag extends ComponentTag | [ComponentTag, keyof JSX.IntrinsicElements],\n BaseTag extends ComponentTag | never,\n Props,\n Context = never,\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n ReturnResult,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag extends [ComponentTag, keyof JSX.IntrinsicElements] ? Tag[0] : Tag> &\n MergeProps<\n EfficientOmit<Props, 'tag' | 'children'>,\n MergeProps<ComponentPropsNesting<Tag extends [ComponentTag, keyof JSX.IntrinsicElements] ? Tag[0] : Tag>, ComponentPropsNesting<BaseTag>>\n >;\n export type PropsRenderingResultComponentProps<\n Tag extends ComponentTag,\n Props,\n Context = {},\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n Partial<\n EfficientOmit<\n MergeProps<Props, ComponentPropsNesting<Tag>>,\n 'children' | 'tag' | 'ref'\n > & {\n children?: React.ReactNode;\n }\n >,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag> &\n MergeProps<EfficientOmit<Props, 'tag' | 'children'>, ComponentPropsNesting<Tag>>;\n export type ComponentRenderingResults = React.ReactElement;\n export type ComponentAdditive<\n BaseTag extends ComponentTag,\n Tag extends ComponentTag,\n Props = {},\n Context = {},\n AdditionalContext = {},\n > = {\n __nestedProps: ComponentPropsNesting<BaseTag>;\n __tag: Tag;\n __props: Props;\n __context: Context;\n __additionalContext: AdditionalContext;\n displayName: string;\n newInstance: () => Component<BaseTag, Props, Context>;\n };\n export type InferJsxIntrinsicElement<T extends React.DetailedHTMLProps<any, any>> =\n T extends React.DetailedHTMLProps<infer _, infer Element> ? Element : HTMLElement;\n type InferElementFromRef<T> = T extends React.Ref<infer Element> ? Element : never;\n type InferRefElementFromProps<T> = 'ref' extends keyof T\n ? InferElementFromRef<T['ref']>\n : HTMLElement;\n export type ComponentHtmlElement<Tag extends ComponentTag> =\n Tag extends keyof JSX.IntrinsicElements\n ? InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>\n : Tag extends { __nestedProps: infer NestedProps }\n ? InferRefElementFromProps<NestedProps>\n : HTMLElement;\n export type UntypeRefAndTag<Props> = Intergalactic.InternalTypings.EfficientOmit<\n Props,\n 'ref' | 'tag'\n > & {\n ref: React.Ref<any>;\n tag: Intergalactic.InternalTypings.ComponentTag;\n };\n }\n export type Component<\n BaseTag extends InternalTypings.ComponentTag = never,\n BaseProps = {},\n Context = {},\n AdditionalContext extends any[] = never[],\n > = (<Tag extends InternalTypings.ComponentTag | [InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = BaseTag, Props extends BaseProps = BaseProps>(\n props: InternalTypings.ComponentProps<Tag, BaseTag, Props, Context, AdditionalContext>,\n ) => InternalTypings.ComponentRenderingResults) &\n InternalTypings.ComponentAdditive<BaseTag, Tag, BaseProps, Context, AdditionalContext>;\n export type Tag = InternalTypings.ComponentTag;\n export type DomProps<Tag extends keyof JSX.IntrinsicElements> =\n InternalTypings.InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>;\n export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<\n T,\n Exclude<keyof T, Keys>\n > &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n}\n\nexport const wrapIntergalacticComponent = <\n Component extends Intergalactic.Component<any, any, any, any>,\n PropsExtending = {},\n>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n): Intergalactic.Component<\n Component['__tag'],\n Component['__props'] & Component['__nestedProps'] & PropsExtending,\n Component['__context'],\n Component['__additionalContext']\n> => wrapper as any;\n\nexport type PropsAndRef<T, Ctx, UCProps> = PropsWithRenderFnChildren<T, Ctx, UCProps> &\n RefAttributes<unknown>;\nexport type ForwardRefComponent<T, Ctx, UCProps> = ForwardRefExoticComponent<\n PropsAndRef<T, Ctx, UCProps>\n>;\ntype ComponentOrProps<T, Context, UCProps> = T extends [infer ParentProps, infer ChildProps]\n ? ComponentType<ParentProps, ChildProps, Context, UCProps>\n : ForwardRefComponent<T, Context, UCProps>;\n\nexport type ComponentType<\n ComponentProps,\n ChildComponentProps = {},\n ContextType = {},\n UCProps = {},\n FNType = null,\n> = (FNType extends null\n ? ForwardRefComponent<ComponentProps, ContextType, UCProps>\n : FNType & { displayName: string }) & {\n [K in keyof ChildComponentProps]: ComponentOrProps<ChildComponentProps[K], ContextType, UCProps>;\n } & {\n [CORE_COMPONENT]: boolean;\n [CREATE_COMPONENT]: () => ComponentType<\n ComponentProps,\n ChildComponentProps,\n ContextType,\n UCProps\n >;\n };\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAOe,SAAAC,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,MAAAK,0BAAA,iBAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAKf;;AAOA;;AAEA;;AAKA;;AAGA;;AAKA;;AASA;;AAGA;;AAIA;;AASA;;AAIA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAKA,IAAMQ,IAAU,GAAAC,OAAA,CAAAD,IAAA,GAAGE,SAAgB;AAInC;AAAA,IACeC,aAAa,0BAAAC,cAAA;EAAA,SAAAD,cAAA;IAAA,IAAAE,KAAA;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAA,IAAAC,gBAAA,mBAAAT,aAAA;IAAAE,KAAA,GAAAhB,UAAA,OAAAc,aAAA,KAAAU,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAT,KAAA,UAuBbH,SAAS;IAAA,IAAAY,gBAAA,aAAAT,KAAA,kBAEP,KAAK;IAAA,OAAAA,KAAA;EAAA;EAAA,IAAAU,UAAA,aAAAZ,aAAA,EAAAC,cAAA;EAAA,WAAAY,aAAA,aAAAb,aAAA;IAAAc,GAAA;IAAAC,GAAA,EAlBpB,SAAAA,IAAA,EAAiD;MAC/C,OAAO,CAAC,CAAC;IACX;EAAC;IAAAD,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAc;MACZ,OAAO,CAAC,CAAC;IASX;EAAC;AAAA,EAfOC,oBAAa;AAsBhB,IAAMC,SAAS,GAAAnB,OAAA,CAAAmB,SAAA,GAAGjB,aAAa;AACtC;AAgBA;AAAA,IACiBkB,aAAa;AAgMvB,IAAMC,0BAA0B,GAAArB,OAAA,CAAAqB,0BAAA,GAAG,SAA7BA,0BAA0BA,CAIrCC,OAKoB;EAAA,OAMjBA,OAAO;AAAA,CAAO","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Component.mjs","names":["PureComponent","Root","undefined","RootComponent","_PureComponent","_this","_len","arguments","length","args","Array","_key","_classCallCheck","_callSuper","concat","_defineProperty","_inherits","_createClass","key","get","Component","Intergalactic","wrapIntergalacticComponent","wrapper"],"sources":["../../src/core-types/Component.ts"],"sourcesContent":["import type React from 'react';\nimport { type\nAllHTMLAttributes, type\nForwardRefExoticComponent,\nPureComponent, type\nReactNode, type\nRefAttributes, type\nRefObject,\n} from 'react';\n\nimport type { CORE_COMPONENT, CREATE_COMPONENT } from './symbols';\nimport type { IStyledProps } from '../styled/index';\n\n/** @deprecated */\ntype KnownKeys<T> = {\n [K in keyof T]: string extends K ? never : number extends K ? never : K;\n} extends { [_ in keyof T]: infer U }\n ? U\n : never;\n\n/** @deprecated */\nexport type HandlersType<UCProps> = { [K in keyof UCProps]?: <T = unknown>(arg: T) => void };\n/** @deprecated */\nexport type ChildrenType<Props = {}, Ctx = {}, UCProps = {}> =\n | ((props: Props & Ctx, handlers: HandlersType<UCProps>) => ReactNode)\n | ReactNode;\n\n/** @deprecated */\nexport type RootComponentHandler = (...args: any[]) => void | false;\n\n/** @deprecated */\nexport interface IRootComponentHandlers {\n [key: string]: RootComponentHandler;\n}\n\n/** @deprecated */\nexport interface IRootComponentProps<Props = {}, Ctx = {}> {\n 'forwardRef'?: RefObject<any>;\n 'Children'?: any;\n 'children'?: ChildrenType<Props, Ctx>;\n 'styles'?: IStyledProps['styles'];\n 'data-ui-name'?: string;\n}\n\n/** @deprecated */\nexport type IComponentProps<Props = {}, Ctx = {}> = Props & IRootComponentProps<Props, Ctx>;\n\n/** @deprecated */\nexport type IFunctionProps<Props = {}, Ctx = {}> = IComponentProps<Props, Ctx> &\n Omit<AllHTMLAttributes<any>, keyof IComponentProps<Props, Ctx>> & { Root?: Root };\n\n/** @deprecated */\nexport type PropsWithRenderFnChildren<Props = {}, Ctx = {}, UCProps = {}> = Omit<\n Pick<Props, KnownKeys<Props>>,\n 'children'\n> & {\n children?: ChildrenType<Props, Ctx, UCProps>;\n [key: string]: unknown;\n};\n\n/** @deprecated */\nexport type CProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?: ((props: Props & Ctx, handlers: UCProps) => React.ReactNode) | React.ReactNode;\n};\n/** @deprecated */\nexport type ReturnEl = React.ReactElement | null;\n\nexport interface IRootNodeProps {\n render: React.ElementType | string;\n tag?: React.ElementType | string;\n\n [key: string]: any;\n}\n\ntype Root = ForwardRefExoticComponent<IRootNodeProps>;\n\n/**\n * @deprecated since version ^1.8.0\n */\nexport type PropGetter<T extends (...args: any) => any> = <P>(props?: P) => ReturnType<T> & P;\n/**\n * @deprecated since version ^1.8.0\n */\n/** @deprecated */\nexport type PropGetterReturn<T extends (...args: any) => any> = Partial<ReturnType<T>>;\n/** @deprecated */\nexport type PropGetterFn = <T extends {}>(props?: T) => T & { [key: string]: unknown };\n/** @deprecated */\nexport type Merge<Props, HTMLProps> = Props & Omit<HTMLProps, keyof Props>;\n/** @deprecated */\nexport type MergeGetters<G1 extends (...args: any) => any, G2 extends (...args: any) => any> = <P>(\n props?: P,\n) => Merge<ReturnType<G1>, ReturnType<G2>> & P;\n\nconst Root: Root = undefined as any;\n\nexport { Root };\n\n/** @deprecated */\nabstract class RootComponent<\n Props = {},\n Context = {},\n State = {},\n Enhance extends readonly ((...args: any[]) => any)[] = [],\n InnerProps = {},\n> extends PureComponent<Props, State> {\n get handlers(): Readonly<IRootComponentHandlers> {\n return {};\n }\n\n get asProps() {\n return {} as Readonly<\n Merge<\n Props &\n IRootComponentProps<Props, Context> &\n Intergalactic.InternalTypings.ExtractEnhanceType<Enhance> &\n InnerProps,\n AllHTMLAttributes<any>\n >\n >;\n }\n\n Root: Root = undefined as any;\n\n isControlled = false;\n}\n\nexport const Component = RootComponent;\n/** @deprecated */\nexport type Component<\n Props = {},\n Context = {},\n State = {},\n Handlers extends IRootComponentHandlers = IRootComponentHandlers,\n> = React.ComponentClass<Props, State> & {\n isControlled: boolean;\n\n handlers: Readonly<Handlers>;\n\n asProps: Readonly<Merge<Props & IRootComponentProps<Props, Context>, AllHTMLAttributes<any>>>;\n\n Root: Root;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Intergalactic {\n type ReactFCProps<C extends React.FC> = C extends React.FC<infer Props> ? Omit<Props, 'tag'> : {};\n type ReactComponentProps<C extends React.ComponentClass> = C extends React.ComponentClass<\n infer Props\n >\n ? Omit<Props, 'tag'>\n : never;\n type ReactFCLike = (props: any) => any;\n type ReactFCLikeProps<C extends ReactFCLike> = C extends (props: infer Props) => any ? Props : {};\n type ComponentChildren<\n Props,\n Context,\n RenderingResult = InternalTypings.ReturnResult,\n AdditionalContext extends any[] = never[],\n > =\n | ((props: MergeProps<Context, Props>, ...args: AdditionalContext) => RenderingResult)\n | InternalTypings.ReturnResult;\n type ComponentBasicProps<Tag extends InternalTypings.ComponentTag> = {\n ref?: React.Ref<InternalTypings.ComponentHtmlElement<Tag> | null>;\n /** @private DO NOT USE IT. Low-level api that prevents specified props from being applied as DOM attribute. */\n __excludeProps?: string[];\n };\n type MergeProps<HighPriorityProps, LowPriorityProps> = {\n [K in keyof LowPriorityProps]: K extends keyof HighPriorityProps\n ? HighPriorityProps[K]\n : LowPriorityProps[K];\n } & HighPriorityProps;\n /** @private */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace InternalTypings {\n export type EfficientOmit<Type, Keys> = {\n [Property in keyof Type as Exclude<Property, Keys>]: Type[Property];\n };\n export type ExtractEnhanceType<F extends readonly ((...args: any[]) => any)[]> =\n F['length'] extends 0\n ? {}\n : F['length'] extends 1\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n }\n : F['length'] extends 2\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n }\n : F['length'] extends 3\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n }\n : F['length'] extends 4\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n } & {\n [K in keyof ReturnType<F[3]>]: ReturnType<F[3]>[K];\n }\n : {};\n export type ComponentPropsNesting<Tag extends InternalTypings.ComponentTag> = Omit<\n MergeProps<\n Tag extends React.FC\n ? ReactFCProps<Tag>\n : Tag extends React.ComponentClass\n ? ReactComponentProps<Tag>\n : Tag extends ReactFCLike\n ? ReactFCLikeProps<Tag>\n : Tag extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[Tag]\n : {},\n Tag extends { __nestedProps: infer NestedProps } ? NestedProps : {}\n >,\n 'children' | 'tag'\n >;\n export type ReturnResult =\n | React.ReactElement\n | React.ReactNode\n | React.ReactNode[]\n | string\n | null;\n export type ComponentTag =\n | keyof JSX.IntrinsicElements\n | React.ComponentClass\n | React.FC\n | ReactFCLike;\n export type ComponentProps<\n Tag extends ComponentTag,\n BaseTag extends ComponentTag | never,\n Props,\n Context = never,\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n ReturnResult,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag> &\n MergeProps<\n EfficientOmit<Props, 'tag' | 'children'>,\n MergeProps<ComponentPropsNesting<Tag>, ComponentPropsNesting<BaseTag>>\n >;\n export type PropsRenderingResultComponentProps<\n Tag extends ComponentTag,\n Props,\n Context = {},\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n Partial<\n EfficientOmit<\n MergeProps<Props, ComponentPropsNesting<Tag>>,\n 'children' | 'tag' | 'ref'\n > & {\n children?: React.ReactNode;\n }\n >,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag> &\n MergeProps<EfficientOmit<Props, 'tag' | 'children'>, ComponentPropsNesting<Tag>>;\n export type ComponentRenderingResults = React.ReactElement;\n export type ComponentAdditive<\n BaseTag extends ComponentTag,\n Tag extends ComponentTag,\n Props = {},\n Context = {},\n AdditionalContext = {},\n > = {\n __nestedProps: ComponentPropsNesting<BaseTag>;\n __tag: Tag;\n __props: Props;\n __context: Context;\n __additionalContext: AdditionalContext;\n displayName: string;\n newInstance: () => Component<BaseTag, Props, Context>;\n };\n export type InferJsxIntrinsicElement<T extends React.DetailedHTMLProps<any, any>> =\n T extends React.DetailedHTMLProps<infer _, infer Element> ? Element : HTMLElement;\n type InferElementFromRef<T> = T extends React.Ref<infer Element> ? Element : never;\n type InferRefElementFromProps<T> = 'ref' extends keyof T\n ? InferElementFromRef<T['ref']>\n : HTMLElement;\n export type ComponentHtmlElement<Tag extends ComponentTag> =\n Tag extends keyof JSX.IntrinsicElements\n ? InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>\n : Tag extends { __nestedProps: infer NestedProps }\n ? InferRefElementFromProps<NestedProps>\n : HTMLElement;\n export type UntypeRefAndTag<Props> = Intergalactic.InternalTypings.EfficientOmit<\n Props,\n 'ref' | 'tag'\n > & {\n ref: React.Ref<any>;\n tag: Intergalactic.InternalTypings.ComponentTag;\n };\n }\n export type Component<\n BaseTag extends InternalTypings.ComponentTag = never,\n BaseProps = {},\n Context = {},\n AdditionalContext extends any[] = never[],\n > = (<Tag extends InternalTypings.ComponentTag = BaseTag, Props extends BaseProps = BaseProps>(\n props: InternalTypings.ComponentProps<Tag, BaseTag, Props, Context, AdditionalContext>,\n ) => InternalTypings.ComponentRenderingResults) &\n InternalTypings.ComponentAdditive<BaseTag, Tag, BaseProps, Context, AdditionalContext>;\n export type Tag = InternalTypings.ComponentTag;\n export type DomProps<Tag extends keyof JSX.IntrinsicElements> =\n InternalTypings.InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>;\n export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<\n T,\n Exclude<keyof T, Keys>\n > &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n}\n\nexport const wrapIntergalacticComponent = <\n Component extends Intergalactic.Component<any, any, any, any>,\n PropsExtending = {},\n>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n): Intergalactic.Component<\n Component['__tag'],\n Component['__props'] & Component['__nestedProps'] & PropsExtending,\n Component['__context'],\n Component['__additionalContext']\n> => wrapper as any;\n\nexport type PropsAndRef<T, Ctx, UCProps> = PropsWithRenderFnChildren<T, Ctx, UCProps> &\n RefAttributes<unknown>;\nexport type ForwardRefComponent<T, Ctx, UCProps> = ForwardRefExoticComponent<\n PropsAndRef<T, Ctx, UCProps>\n>;\ntype ComponentOrProps<T, Context, UCProps> = T extends [infer ParentProps, infer ChildProps]\n ? ComponentType<ParentProps, ChildProps, Context, UCProps>\n : ForwardRefComponent<T, Context, UCProps>;\n\nexport type ComponentType<\n ComponentProps,\n ChildComponentProps = {},\n ContextType = {},\n UCProps = {},\n FNType = null,\n> = (FNType extends null\n ? ForwardRefComponent<ComponentProps, ContextType, UCProps>\n : FNType & { displayName: string }) & {\n [K in keyof ChildComponentProps]: ComponentOrProps<ChildComponentProps[K], ContextType, UCProps>;\n } & {\n [CORE_COMPONENT]: boolean;\n [CREATE_COMPONENT]: () => ComponentType<\n ComponentProps,\n ChildComponentProps,\n ContextType,\n UCProps\n >;\n };\n"],"mappings":";;;;;;;;AACA,SAGAA,aAAa,QAIN,OAAO;;AAKd;;AAOA;;AAEA;;AAKA;;AAGA;;AAKA;;AASA;;AAGA;;AAIA;;AASA;;AAIA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAKA,IAAMC,IAAU,GAAGC,SAAgB;AAEnC,SAASD,IAAI;;AAEb;AAAA,IACeE,aAAa,0BAAAC,cAAA;EAAA,SAAAD,cAAA;IAAA,IAAAE,KAAA;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAC,eAAA,OAAAT,aAAA;IAAAE,KAAA,GAAAQ,UAAA,OAAAV,aAAA,KAAAW,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAV,KAAA,UAuBbH,SAAS;IAAAa,eAAA,CAAAV,KAAA,kBAEP,KAAK;IAAA,OAAAA,KAAA;EAAA;EAAAW,SAAA,CAAAb,aAAA,EAAAC,cAAA;EAAA,OAAAa,YAAA,CAAAd,aAAA;IAAAe,GAAA;IAAAC,GAAA,EAlBpB,SAAAA,IAAA,EAAiD;MAC/C,OAAO,CAAC,CAAC;IACX;EAAC;IAAAD,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAc;MACZ,OAAO,CAAC,CAAC;IASX;EAAC;AAAA,EAfOnB,aAAa;AAsBvB,OAAO,IAAMoB,SAAS,GAAGjB,aAAa;AACtC;AAgBA;AAAA,WACiBkB,aAAa;AAgM9B,OAAO,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAIrCC,OAKoB;EAAA,OAMjBA,OAAO;AAAA,CAAO","ignoreList":[]}
1
+ {"version":3,"file":"Component.mjs","names":["PureComponent","Root","undefined","RootComponent","_PureComponent","_this","_len","arguments","length","args","Array","_key","_classCallCheck","_callSuper","concat","_defineProperty","_inherits","_createClass","key","get","Component","Intergalactic","wrapIntergalacticComponent","wrapper"],"sources":["../../src/core-types/Component.ts"],"sourcesContent":["import type React from 'react';\nimport { type\nAllHTMLAttributes, type\nForwardRefExoticComponent,\nPureComponent, type\nReactNode, type\nRefAttributes, type\nRefObject,\n} from 'react';\n\nimport type { CORE_COMPONENT, CREATE_COMPONENT } from './symbols';\nimport type { IStyledProps } from '../styled/index';\n\n/** @deprecated */\ntype KnownKeys<T> = {\n [K in keyof T]: string extends K ? never : number extends K ? never : K;\n} extends { [_ in keyof T]: infer U }\n ? U\n : never;\n\n/** @deprecated */\nexport type HandlersType<UCProps> = { [K in keyof UCProps]?: <T = unknown>(arg: T) => void };\n/** @deprecated */\nexport type ChildrenType<Props = {}, Ctx = {}, UCProps = {}> =\n | ((props: Props & Ctx, handlers: HandlersType<UCProps>) => ReactNode)\n | ReactNode;\n\n/** @deprecated */\nexport type RootComponentHandler = (...args: any[]) => void | false;\n\n/** @deprecated */\nexport interface IRootComponentHandlers {\n [key: string]: RootComponentHandler;\n}\n\n/** @deprecated */\nexport interface IRootComponentProps<Props = {}, Ctx = {}> {\n 'forwardRef'?: RefObject<any>;\n 'Children'?: any;\n 'children'?: ChildrenType<Props, Ctx>;\n 'styles'?: IStyledProps['styles'];\n 'data-ui-name'?: string;\n}\n\n/** @deprecated */\nexport type IComponentProps<Props = {}, Ctx = {}> = Props & IRootComponentProps<Props, Ctx>;\n\n/** @deprecated */\nexport type IFunctionProps<Props = {}, Ctx = {}> = IComponentProps<Props, Ctx> &\n Omit<AllHTMLAttributes<any>, keyof IComponentProps<Props, Ctx>> & { Root?: Root };\n\n/** @deprecated */\nexport type PropsWithRenderFnChildren<Props = {}, Ctx = {}, UCProps = {}> = Omit<\n Pick<Props, KnownKeys<Props>>,\n 'children'\n> & {\n children?: ChildrenType<Props, Ctx, UCProps>;\n [key: string]: unknown;\n};\n\n/** @deprecated */\nexport type CProps<Props, Ctx = {}, UCProps = {}> = Props & {\n children?: ((props: Props & Ctx, handlers: UCProps) => React.ReactNode) | React.ReactNode;\n};\n/** @deprecated */\nexport type ReturnEl = React.ReactElement | null;\n\nexport interface IRootNodeProps {\n render: React.ElementType | string;\n tag?: React.ElementType | string;\n\n [key: string]: any;\n}\n\ntype Root = ForwardRefExoticComponent<IRootNodeProps>;\n\n/**\n * @deprecated since version ^1.8.0\n */\nexport type PropGetter<T extends (...args: any) => any> = <P>(props?: P) => ReturnType<T> & P;\n/**\n * @deprecated since version ^1.8.0\n */\n/** @deprecated */\nexport type PropGetterReturn<T extends (...args: any) => any> = Partial<ReturnType<T>>;\n/** @deprecated */\nexport type PropGetterFn = <T extends {}>(props?: T) => T & { [key: string]: unknown };\n/** @deprecated */\nexport type Merge<Props, HTMLProps> = Props & Omit<HTMLProps, keyof Props>;\n/** @deprecated */\nexport type MergeGetters<G1 extends (...args: any) => any, G2 extends (...args: any) => any> = <P>(\n props?: P,\n) => Merge<ReturnType<G1>, ReturnType<G2>> & P;\n\nconst Root: Root = undefined as any;\n\nexport { Root };\n\n/** @deprecated */\nabstract class RootComponent<\n Props = {},\n Context = {},\n State = {},\n Enhance extends readonly ((...args: any[]) => any)[] = [],\n InnerProps = {},\n> extends PureComponent<Props, State> {\n get handlers(): Readonly<IRootComponentHandlers> {\n return {};\n }\n\n get asProps() {\n return {} as Readonly<\n Merge<\n Props &\n IRootComponentProps<Props, Context> &\n Intergalactic.InternalTypings.ExtractEnhanceType<Enhance> &\n InnerProps,\n AllHTMLAttributes<any>\n >\n >;\n }\n\n Root: Root = undefined as any;\n\n isControlled = false;\n}\n\nexport const Component = RootComponent;\n/** @deprecated */\nexport type Component<\n Props = {},\n Context = {},\n State = {},\n Handlers extends IRootComponentHandlers = IRootComponentHandlers,\n> = React.ComponentClass<Props, State> & {\n isControlled: boolean;\n\n handlers: Readonly<Handlers>;\n\n asProps: Readonly<Merge<Props & IRootComponentProps<Props, Context>, AllHTMLAttributes<any>>>;\n\n Root: Root;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace Intergalactic {\n type ReactFCProps<C extends React.FC> = C extends React.FC<infer Props> ? Omit<Props, 'tag'> : {};\n type ReactComponentProps<C extends React.ComponentClass> = C extends React.ComponentClass<\n infer Props\n >\n ? Omit<Props, 'tag'>\n : never;\n type ReactFCLike = (props: any) => any;\n type ReactFCLikeProps<C extends ReactFCLike> = C extends (props: infer Props) => any ? Props : {};\n type ComponentChildren<\n Props,\n Context,\n RenderingResult = InternalTypings.ReturnResult,\n AdditionalContext extends any[] = never[],\n > =\n | ((props: MergeProps<Context, Props>, ...args: AdditionalContext) => RenderingResult)\n | InternalTypings.ReturnResult;\n type ComponentBasicProps<Tag extends InternalTypings.ComponentTag> = {\n ref?: React.Ref<InternalTypings.ComponentHtmlElement<Tag> | null>;\n /** @private DO NOT USE IT. Low-level api that prevents specified props from being applied as DOM attribute. */\n __excludeProps?: string[];\n };\n type MergeProps<HighPriorityProps, LowPriorityProps> = {\n [K in keyof LowPriorityProps]: K extends keyof HighPriorityProps\n ? HighPriorityProps[K]\n : LowPriorityProps[K];\n } & HighPriorityProps;\n /** @private */\n // eslint-disable-next-line @typescript-eslint/no-namespace\n export namespace InternalTypings {\n export type EfficientOmit<Type, Keys> = {\n [Property in keyof Type as Exclude<Property, Keys>]: Type[Property];\n };\n export type ExtractEnhanceType<F extends readonly ((...args: any[]) => any)[]> =\n F['length'] extends 0\n ? {}\n : F['length'] extends 1\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n }\n : F['length'] extends 2\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n }\n : F['length'] extends 3\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n }\n : F['length'] extends 4\n // eslint-disable-next-line @stylistic/indent-binary-ops\n ? {\n [K in keyof ReturnType<F[0]>]: ReturnType<F[0]>[K];\n } & {\n [K in keyof ReturnType<F[1]>]: ReturnType<F[1]>[K];\n } & {\n [K in keyof ReturnType<F[2]>]: ReturnType<F[2]>[K];\n } & {\n [K in keyof ReturnType<F[3]>]: ReturnType<F[3]>[K];\n }\n : {};\n export type ComponentPropsNesting<Tag extends InternalTypings.ComponentTag> = Omit<\n MergeProps<\n Tag extends React.FC\n ? ReactFCProps<Tag>\n : Tag extends React.ComponentClass\n ? ReactComponentProps<Tag>\n : Tag extends ReactFCLike\n ? ReactFCLikeProps<Tag>\n : Tag extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[Tag]\n : {},\n Tag extends { __nestedProps: infer NestedProps } ? NestedProps : {}\n >,\n 'children' | 'tag'\n >;\n export type ReturnResult =\n | React.ReactElement\n | React.ReactNode\n | React.ReactNode[]\n | string\n | null;\n export type ComponentTag =\n | keyof JSX.IntrinsicElements\n | React.ComponentClass\n | React.FC\n | ReactFCLike;\n export type ComponentProps<\n Tag extends ComponentTag | [ComponentTag, keyof JSX.IntrinsicElements],\n BaseTag extends ComponentTag | never,\n Props,\n Context = never,\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n ReturnResult,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag extends [ComponentTag, keyof JSX.IntrinsicElements] ? Tag[0] : Tag> &\n MergeProps<\n EfficientOmit<Props, 'tag' | 'children'>,\n MergeProps<ComponentPropsNesting<Tag extends [ComponentTag, keyof JSX.IntrinsicElements] ? Tag[0] : Tag>, ComponentPropsNesting<BaseTag>>\n >;\n export type PropsRenderingResultComponentProps<\n Tag extends ComponentTag,\n Props,\n Context = {},\n AdditionalContext extends any[] = never[],\n > = {\n tag?: Tag;\n children?: ComponentChildren<\n EfficientOmit<Props, 'children'> & { children: React.ReactNode },\n Context,\n Partial<\n EfficientOmit<\n MergeProps<Props, ComponentPropsNesting<Tag>>,\n 'children' | 'tag' | 'ref'\n > & {\n children?: React.ReactNode;\n }\n >,\n AdditionalContext\n >;\n } & ComponentBasicProps<Tag> &\n MergeProps<EfficientOmit<Props, 'tag' | 'children'>, ComponentPropsNesting<Tag>>;\n export type ComponentRenderingResults = React.ReactElement;\n export type ComponentAdditive<\n BaseTag extends ComponentTag,\n Tag extends ComponentTag,\n Props = {},\n Context = {},\n AdditionalContext = {},\n > = {\n __nestedProps: ComponentPropsNesting<BaseTag>;\n __tag: Tag;\n __props: Props;\n __context: Context;\n __additionalContext: AdditionalContext;\n displayName: string;\n newInstance: () => Component<BaseTag, Props, Context>;\n };\n export type InferJsxIntrinsicElement<T extends React.DetailedHTMLProps<any, any>> =\n T extends React.DetailedHTMLProps<infer _, infer Element> ? Element : HTMLElement;\n type InferElementFromRef<T> = T extends React.Ref<infer Element> ? Element : never;\n type InferRefElementFromProps<T> = 'ref' extends keyof T\n ? InferElementFromRef<T['ref']>\n : HTMLElement;\n export type ComponentHtmlElement<Tag extends ComponentTag> =\n Tag extends keyof JSX.IntrinsicElements\n ? InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>\n : Tag extends { __nestedProps: infer NestedProps }\n ? InferRefElementFromProps<NestedProps>\n : HTMLElement;\n export type UntypeRefAndTag<Props> = Intergalactic.InternalTypings.EfficientOmit<\n Props,\n 'ref' | 'tag'\n > & {\n ref: React.Ref<any>;\n tag: Intergalactic.InternalTypings.ComponentTag;\n };\n }\n export type Component<\n BaseTag extends InternalTypings.ComponentTag = never,\n BaseProps = {},\n Context = {},\n AdditionalContext extends any[] = never[],\n > = (<Tag extends InternalTypings.ComponentTag | [InternalTypings.ComponentTag, keyof JSX.IntrinsicElements] = BaseTag, Props extends BaseProps = BaseProps>(\n props: InternalTypings.ComponentProps<Tag, BaseTag, Props, Context, AdditionalContext>,\n ) => InternalTypings.ComponentRenderingResults) &\n InternalTypings.ComponentAdditive<BaseTag, Tag, BaseProps, Context, AdditionalContext>;\n export type Tag = InternalTypings.ComponentTag;\n export type DomProps<Tag extends keyof JSX.IntrinsicElements> =\n InternalTypings.InferJsxIntrinsicElement<JSX.IntrinsicElements[Tag]>;\n export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<\n T,\n Exclude<keyof T, Keys>\n > &\n {\n [K in Keys]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<Keys, K>>>;\n }[Keys];\n}\n\nexport const wrapIntergalacticComponent = <\n Component extends Intergalactic.Component<any, any, any, any>,\n PropsExtending = {},\n>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<Component>\n > &\n PropsExtending,\n ) => React.ReactNode,\n): Intergalactic.Component<\n Component['__tag'],\n Component['__props'] & Component['__nestedProps'] & PropsExtending,\n Component['__context'],\n Component['__additionalContext']\n> => wrapper as any;\n\nexport type PropsAndRef<T, Ctx, UCProps> = PropsWithRenderFnChildren<T, Ctx, UCProps> &\n RefAttributes<unknown>;\nexport type ForwardRefComponent<T, Ctx, UCProps> = ForwardRefExoticComponent<\n PropsAndRef<T, Ctx, UCProps>\n>;\ntype ComponentOrProps<T, Context, UCProps> = T extends [infer ParentProps, infer ChildProps]\n ? ComponentType<ParentProps, ChildProps, Context, UCProps>\n : ForwardRefComponent<T, Context, UCProps>;\n\nexport type ComponentType<\n ComponentProps,\n ChildComponentProps = {},\n ContextType = {},\n UCProps = {},\n FNType = null,\n> = (FNType extends null\n ? ForwardRefComponent<ComponentProps, ContextType, UCProps>\n : FNType & { displayName: string }) & {\n [K in keyof ChildComponentProps]: ComponentOrProps<ChildComponentProps[K], ContextType, UCProps>;\n } & {\n [CORE_COMPONENT]: boolean;\n [CREATE_COMPONENT]: () => ComponentType<\n ComponentProps,\n ChildComponentProps,\n ContextType,\n UCProps\n >;\n };\n"],"mappings":";;;;;;;;AACA,SAGAA,aAAa,QAIN,OAAO;;AAKd;;AAOA;;AAEA;;AAKA;;AAGA;;AAKA;;AASA;;AAGA;;AAIA;;AASA;;AAIA;;AAYA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;;AAKA,IAAMC,IAAU,GAAGC,SAAgB;AAEnC,SAASD,IAAI;;AAEb;AAAA,IACeE,aAAa,0BAAAC,cAAA;EAAA,SAAAD,cAAA;IAAA,IAAAE,KAAA;IAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAC,eAAA,OAAAT,aAAA;IAAAE,KAAA,GAAAQ,UAAA,OAAAV,aAAA,KAAAW,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAV,KAAA,UAuBbH,SAAS;IAAAa,eAAA,CAAAV,KAAA,kBAEP,KAAK;IAAA,OAAAA,KAAA;EAAA;EAAAW,SAAA,CAAAb,aAAA,EAAAC,cAAA;EAAA,OAAAa,YAAA,CAAAd,aAAA;IAAAe,GAAA;IAAAC,GAAA,EAlBpB,SAAAA,IAAA,EAAiD;MAC/C,OAAO,CAAC,CAAC;IACX;EAAC;IAAAD,GAAA;IAAAC,GAAA,EAED,SAAAA,IAAA,EAAc;MACZ,OAAO,CAAC,CAAC;IASX;EAAC;AAAA,EAfOnB,aAAa;AAsBvB,OAAO,IAAMoB,SAAS,GAAGjB,aAAa;AACtC;AAgBA;AAAA,WACiBkB,aAAa;AAgM9B,OAAO,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA0BA,CAIrCC,OAKoB;EAAA,OAMjBA,OAAO;AAAA,CAAO","ignoreList":[]}
@@ -20,7 +20,8 @@ var unsafeSetFocus = function unsafeSetFocus(node, previousActiveElement, actual
20
20
  }
21
21
  (_target = target) === null || _target === void 0 || _target.focus((0, _objectSpread2["default"])({
22
22
  // @ts-ignore. set focus-visible in FF and Safari
23
- focusVisible: _LastInteractionType.lastInteraction.isKeyboard()
23
+ focusVisible: _LastInteractionType.lastInteraction.isKeyboard(),
24
+ preventScroll: _LastInteractionType.lastInteraction.isMouse()
24
25
  }, focusOptions));
25
26
  };
26
27
 
@@ -1 +1 @@
1
- {"version":3,"file":"setFocus.js","names":["_LastInteractionType","require","_canUseDOM","_interopRequireDefault","_getFocusableIn","unsafeSetFocus","node","previousActiveElement","actualActiveElement","_target","focusOptions","arguments","length","undefined","activeElement","document","focusable","getFocusableIn","target","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","focus","_objectSpread2","focusVisible","lastInteraction","isKeyboard","focusMoveRequests","focusMoveDisabledUntil","lastUserAction","safeSetFocus","Date","now","push","lastFocusMoveRequests","slice","timeBetweenFocusMoveRequests","map","time","index","Math","abs","every","console","error","apply","canUseDOM","addEventListener","capture","setFocus","exports"],"sources":["../../../src/utils/focus-lock/setFocus.ts"],"sourcesContent":["import { lastInteraction } from '../../LastInteractionType';\nimport canUseDOM from '../canUseDOM';\nimport { getFocusableIn } from './getFocusableIn';\n\nconst unsafeSetFocus = (\n node: HTMLElement,\n previousActiveElement?: HTMLElement | null,\n actualActiveElement?: HTMLElement,\n focusOptions: FocusOptions = {},\n) => {\n const activeElement = actualActiveElement || document.activeElement;\n\n const focusable = getFocusableIn(node);\n\n let target = focusable[0];\n\n if (\n activeElement &&\n previousActiveElement &&\n previousActiveElement.compareDocumentPosition(activeElement) &\n Node.DOCUMENT_POSITION_PRECEDING &&\n !(\n previousActiveElement.compareDocumentPosition(activeElement) & Node.DOCUMENT_POSITION_CONTAINS\n )\n ) {\n target = focusable[focusable.length - 1];\n }\n\n target?.focus({\n // @ts-ignore. set focus-visible in FF and Safari\n focusVisible: lastInteraction.isKeyboard(),\n ...focusOptions,\n });\n};\n\n/** \"safe\" focus movement means that function wrapper tries\n * to detect focus war (when two focus locks are trying to\n * control focus recursively) and disables it for 10 seconds\n */\nlet focusMoveRequests: number[] = [];\nlet focusMoveDisabledUntil = 0;\nlet lastUserAction = 0;\nconst safeSetFocus: typeof unsafeSetFocus = (...args) => {\n if (focusMoveDisabledUntil > Date.now()) return;\n focusMoveRequests.push(Date.now());\n if (focusMoveRequests.length > 10 && Date.now() - lastUserAction > 600) {\n const lastFocusMoveRequests = focusMoveRequests.slice(-10);\n const timeBetweenFocusMoveRequests = lastFocusMoveRequests\n .slice(1)\n .map((time, index) => Math.abs(time - lastFocusMoveRequests[index]));\n if (timeBetweenFocusMoveRequests.every((time) => time < 250)) {\n focusMoveDisabledUntil = Date.now() + 10000;\n focusMoveRequests = [];\n\n // eslint-disable-next-line no-console\n console.error(\n '[useFocusLock] Probably the focus war was detected. It is a process when multiple browser focus control subjects are reacting to \"blur\" event on their element and are trying to get it back. Focus move function was disabled for 10 seconds. Probably your page has different focus lock systems. If you have multiple versions of Intergalactic components, updated them to the latest version (at least to 15.16.3).',\n );\n return;\n }\n }\n if (focusMoveRequests.length > 500) focusMoveRequests = focusMoveRequests.slice(-10);\n\n return unsafeSetFocus(...args);\n};\nif (canUseDOM()) {\n document.addEventListener(\n 'keydown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n document.addEventListener(\n 'mousedown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n}\n\nexport const setFocus = safeSetFocus;\n"],"mappings":";;;;;;;;AAAA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAMI,cAAc,GAAG,SAAjBA,cAAcA,CAClBC,IAAiB,EACjBC,qBAA0C,EAC1CC,mBAAiC,EAE9B;EAAA,IAAAC,OAAA;EAAA,IADHC,YAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE/B,IAAMG,aAAa,GAAGN,mBAAmB,IAAIO,QAAQ,CAACD,aAAa;EAEnE,IAAME,SAAS,GAAG,IAAAC,8BAAc,EAACX,IAAI,CAAC;EAEtC,IAAIY,MAAM,GAAGF,SAAS,CAAC,CAAC,CAAC;EAEzB,IACEF,aAAa,IACbP,qBAAqB,IACrBA,qBAAqB,CAACY,uBAAuB,CAACL,aAAa,CAAC,GAC5DM,IAAI,CAACC,2BAA2B,IAChC,EACEd,qBAAqB,CAACY,uBAAuB,CAACL,aAAa,CAAC,GAAGM,IAAI,CAACE,0BAA0B,CAC/F,EACD;IACAJ,MAAM,GAAGF,SAAS,CAACA,SAAS,CAACJ,MAAM,GAAG,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AiB,GAAGA,iBAAiB,CAACQ,KAAK,CAAC,CAAC,EAAE,CAAC;EAEpF,OAAO/B,cAAc,CAAAyC,KAAA,SAAAnC,SAAQ,CAAC;AAChC,CAAC;AACD,IAAI,IAAAoC,qBAAS,EAAC,CAAC,EAAE;EACfhC,QAAQ,CAACiC,gBAAgB,CACvB,SAAS,EACT,YAAM;IACJlB,cAAc,GAAGE,IAAI,CAACC,GAAG,CAAC,CAAC;EAC7B,CAAC,EACD;IAAEgB,OAAO,EAAE;EAAK,CAClB,CAAC;EACDlC,QAAQ,CAACiC,gBAAgB,CACvB,WAAW,EACX,YAAM;IACJlB,cAAc,GAAGE,IAAI,CAACC,GAAG,CAAC,CAAC;EAC7B,CAAC,EACD;IAAEgB,OAAO,EAAE;EAAK,CAClB,CAAC;AACH;AAEO,IAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGnB,YAAY","ignoreList":[]}
1
+ {"version":3,"file":"setFocus.js","names":["_LastInteractionType","require","_canUseDOM","_interopRequireDefault","_getFocusableIn","unsafeSetFocus","node","previousActiveElement","actualActiveElement","_target","focusOptions","arguments","length","undefined","activeElement","document","focusable","getFocusableIn","target","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","focus","_objectSpread2","focusVisible","lastInteraction","isKeyboard","preventScroll","isMouse","focusMoveRequests","focusMoveDisabledUntil","lastUserAction","safeSetFocus","Date","now","push","lastFocusMoveRequests","slice","timeBetweenFocusMoveRequests","map","time","index","Math","abs","every","console","error","apply","canUseDOM","addEventListener","capture","setFocus","exports"],"sources":["../../../src/utils/focus-lock/setFocus.ts"],"sourcesContent":["import { lastInteraction } from '../../LastInteractionType';\nimport canUseDOM from '../canUseDOM';\nimport { getFocusableIn } from './getFocusableIn';\n\nconst unsafeSetFocus = (\n node: HTMLElement,\n previousActiveElement?: HTMLElement | null,\n actualActiveElement?: HTMLElement,\n focusOptions: FocusOptions = {},\n) => {\n const activeElement = actualActiveElement || document.activeElement;\n\n const focusable = getFocusableIn(node);\n\n let target = focusable[0];\n\n if (\n activeElement &&\n previousActiveElement &&\n previousActiveElement.compareDocumentPosition(activeElement) &\n Node.DOCUMENT_POSITION_PRECEDING &&\n !(\n previousActiveElement.compareDocumentPosition(activeElement) & Node.DOCUMENT_POSITION_CONTAINS\n )\n ) {\n target = focusable[focusable.length - 1];\n }\n\n target?.focus({\n // @ts-ignore. set focus-visible in FF and Safari\n focusVisible: lastInteraction.isKeyboard(),\n preventScroll: lastInteraction.isMouse(),\n ...focusOptions,\n });\n};\n\n/** \"safe\" focus movement means that function wrapper tries\n * to detect focus war (when two focus locks are trying to\n * control focus recursively) and disables it for 10 seconds\n */\nlet focusMoveRequests: number[] = [];\nlet focusMoveDisabledUntil = 0;\nlet lastUserAction = 0;\nconst safeSetFocus: typeof unsafeSetFocus = (...args) => {\n if (focusMoveDisabledUntil > Date.now()) return;\n focusMoveRequests.push(Date.now());\n if (focusMoveRequests.length > 10 && Date.now() - lastUserAction > 600) {\n const lastFocusMoveRequests = focusMoveRequests.slice(-10);\n const timeBetweenFocusMoveRequests = lastFocusMoveRequests\n .slice(1)\n .map((time, index) => Math.abs(time - lastFocusMoveRequests[index]));\n if (timeBetweenFocusMoveRequests.every((time) => time < 250)) {\n focusMoveDisabledUntil = Date.now() + 10000;\n focusMoveRequests = [];\n\n // eslint-disable-next-line no-console\n console.error(\n '[useFocusLock] Probably the focus war was detected. It is a process when multiple browser focus control subjects are reacting to \"blur\" event on their element and are trying to get it back. Focus move function was disabled for 10 seconds. Probably your page has different focus lock systems. If you have multiple versions of Intergalactic components, updated them to the latest version (at least to 15.16.3).',\n );\n return;\n }\n }\n if (focusMoveRequests.length > 500) focusMoveRequests = focusMoveRequests.slice(-10);\n\n return unsafeSetFocus(...args);\n};\nif (canUseDOM()) {\n document.addEventListener(\n 'keydown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n document.addEventListener(\n 'mousedown',\n () => {\n lastUserAction = Date.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,gBAAgB,CACvB,WAAW,EACX,YAAM;IACJlB,cAAc,GAAGE,IAAI,CAACC,GAAG,CAAC,CAAC;EAC7B,CAAC,EACD;IAAEgB,OAAO,EAAE;EAAK,CAClB,CAAC;AACH;AAEO,IAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGnB,YAAY","ignoreList":[]}
@@ -13,7 +13,8 @@ var unsafeSetFocus = function unsafeSetFocus(node, previousActiveElement, actual
13
13
  }
14
14
  (_target = target) === null || _target === void 0 || _target.focus(_objectSpread({
15
15
  // @ts-ignore. set focus-visible in FF and Safari
16
- focusVisible: lastInteraction.isKeyboard()
16
+ focusVisible: lastInteraction.isKeyboard(),
17
+ preventScroll: lastInteraction.isMouse()
17
18
  }, focusOptions));
18
19
  };
19
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"setFocus.mjs","names":["lastInteraction","canUseDOM","getFocusableIn","unsafeSetFocus","node","previousActiveElement","actualActiveElement","_target","focusOptions","arguments","length","undefined","activeElement","document","focusable","target","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","focus","_objectSpread","focusVisible","isKeyboard","focusMoveRequests","focusMoveDisabledUntil","lastUserAction","safeSetFocus","Date","now","push","lastFocusMoveRequests","slice","timeBetweenFocusMoveRequests","map","time","index","Math","abs","every","console","error","apply","addEventListener","capture","setFocus"],"sources":["../../../src/utils/focus-lock/setFocus.ts"],"sourcesContent":["import { lastInteraction } from '../../LastInteractionType';\nimport canUseDOM from '../canUseDOM';\nimport { getFocusableIn } from './getFocusableIn';\n\nconst unsafeSetFocus = (\n node: HTMLElement,\n previousActiveElement?: HTMLElement | null,\n actualActiveElement?: HTMLElement,\n focusOptions: FocusOptions = {},\n) => {\n const activeElement = actualActiveElement || document.activeElement;\n\n const focusable = getFocusableIn(node);\n\n let target = focusable[0];\n\n if (\n activeElement &&\n previousActiveElement &&\n previousActiveElement.compareDocumentPosition(activeElement) &\n Node.DOCUMENT_POSITION_PRECEDING &&\n !(\n previousActiveElement.compareDocumentPosition(activeElement) & Node.DOCUMENT_POSITION_CONTAINS\n )\n ) {\n target = focusable[focusable.length - 1];\n }\n\n target?.focus({\n // @ts-ignore. set focus-visible in FF and Safari\n focusVisible: lastInteraction.isKeyboard(),\n ...focusOptions,\n });\n};\n\n/** \"safe\" focus movement means that function wrapper tries\n * to detect focus war (when two focus locks are trying to\n * control focus recursively) and disables it for 10 seconds\n */\nlet focusMoveRequests: number[] = [];\nlet focusMoveDisabledUntil = 0;\nlet lastUserAction = 0;\nconst safeSetFocus: typeof unsafeSetFocus = (...args) => {\n if (focusMoveDisabledUntil > Date.now()) return;\n focusMoveRequests.push(Date.now());\n if (focusMoveRequests.length > 10 && Date.now() - lastUserAction > 600) {\n const lastFocusMoveRequests = focusMoveRequests.slice(-10);\n const timeBetweenFocusMoveRequests = lastFocusMoveRequests\n .slice(1)\n .map((time, index) => Math.abs(time - lastFocusMoveRequests[index]));\n if (timeBetweenFocusMoveRequests.every((time) => time < 250)) {\n focusMoveDisabledUntil = Date.now() + 10000;\n focusMoveRequests = [];\n\n // eslint-disable-next-line no-console\n console.error(\n '[useFocusLock] Probably the focus war was detected. It is a process when multiple browser focus control subjects are reacting to \"blur\" event on their element and are trying to get it back. Focus move function was disabled for 10 seconds. Probably your page has different focus lock systems. If you have multiple versions of Intergalactic components, updated them to the latest version (at least to 15.16.3).',\n );\n return;\n }\n }\n if (focusMoveRequests.length > 500) focusMoveRequests = focusMoveRequests.slice(-10);\n\n return unsafeSetFocus(...args);\n};\nif (canUseDOM()) {\n document.addEventListener(\n 'keydown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n document.addEventListener(\n 'mousedown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n}\n\nexport const setFocus = safeSetFocus;\n"],"mappings":";AAAA,SAASA,eAAe,QAAQ,+BAA2B;AAC3D,OAAOC,SAAS,MAAM,kBAAc;AACpC,SAASC,cAAc,QAAQ,sBAAkB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OM","getFocusableIn","unsafeSetFocus","node","previousActiveElement","actualActiveElement","_target","focusOptions","arguments","length","undefined","activeElement","document","focusable","target","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","DOCUMENT_POSITION_CONTAINS","focus","_objectSpread","focusVisible","isKeyboard","preventScroll","isMouse","focusMoveRequests","focusMoveDisabledUntil","lastUserAction","safeSetFocus","Date","now","push","lastFocusMoveRequests","slice","timeBetweenFocusMoveRequests","map","time","index","Math","abs","every","console","error","apply","addEventListener","capture","setFocus"],"sources":["../../../src/utils/focus-lock/setFocus.ts"],"sourcesContent":["import { lastInteraction } from '../../LastInteractionType';\nimport canUseDOM from '../canUseDOM';\nimport { getFocusableIn } from './getFocusableIn';\n\nconst unsafeSetFocus = (\n node: HTMLElement,\n previousActiveElement?: HTMLElement | null,\n actualActiveElement?: HTMLElement,\n focusOptions: FocusOptions = {},\n) => {\n const activeElement = actualActiveElement || document.activeElement;\n\n const focusable = getFocusableIn(node);\n\n let target = focusable[0];\n\n if (\n activeElement &&\n previousActiveElement &&\n previousActiveElement.compareDocumentPosition(activeElement) &\n Node.DOCUMENT_POSITION_PRECEDING &&\n !(\n previousActiveElement.compareDocumentPosition(activeElement) & Node.DOCUMENT_POSITION_CONTAINS\n )\n ) {\n target = focusable[focusable.length - 1];\n }\n\n target?.focus({\n // @ts-ignore. set focus-visible in FF and Safari\n focusVisible: lastInteraction.isKeyboard(),\n preventScroll: lastInteraction.isMouse(),\n ...focusOptions,\n });\n};\n\n/** \"safe\" focus movement means that function wrapper tries\n * to detect focus war (when two focus locks are trying to\n * control focus recursively) and disables it for 10 seconds\n */\nlet focusMoveRequests: number[] = [];\nlet focusMoveDisabledUntil = 0;\nlet lastUserAction = 0;\nconst safeSetFocus: typeof unsafeSetFocus = (...args) => {\n if (focusMoveDisabledUntil > Date.now()) return;\n focusMoveRequests.push(Date.now());\n if (focusMoveRequests.length > 10 && Date.now() - lastUserAction > 600) {\n const lastFocusMoveRequests = focusMoveRequests.slice(-10);\n const timeBetweenFocusMoveRequests = lastFocusMoveRequests\n .slice(1)\n .map((time, index) => Math.abs(time - lastFocusMoveRequests[index]));\n if (timeBetweenFocusMoveRequests.every((time) => time < 250)) {\n focusMoveDisabledUntil = Date.now() + 10000;\n focusMoveRequests = [];\n\n // eslint-disable-next-line no-console\n console.error(\n '[useFocusLock] Probably the focus war was detected. It is a process when multiple browser focus control subjects are reacting to \"blur\" event on their element and are trying to get it back. Focus move function was disabled for 10 seconds. Probably your page has different focus lock systems. If you have multiple versions of Intergalactic components, updated them to the latest version (at least to 15.16.3).',\n );\n return;\n }\n }\n if (focusMoveRequests.length > 500) focusMoveRequests = focusMoveRequests.slice(-10);\n\n return unsafeSetFocus(...args);\n};\nif (canUseDOM()) {\n document.addEventListener(\n 'keydown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n document.addEventListener(\n 'mousedown',\n () => {\n lastUserAction = Date.now();\n },\n { capture: true },\n );\n}\n\nexport const setFocus = safeSetFocus;\n"],"mappings":";AAAA,SAASA,eAAe,QAAQ,+BAA2B;AAC3D,OAAOC,SAAS,MAAM,kBAAc;AACpC,SAASC,cAAc,QAAQ,sBAAkB;AAEjD,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAClBC,IAAiB,EACjBC,qBAA0C,EAC1CC,mBAAiC,EAE9B;EAAA,IAAAC,OAAA;EAAA,IADHC,YAA0B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAE/B,IAAMG,aAAa,GAAGN,mBAAmB,IAAIO,QAAQ,CAACD,aAAa;EAEnE,IAAME,SAAS,GAAGZ,cAAc,CAACE,IAAI,CAAC;EAEtC,IAAIW,MAAM,GAAGD,SAAS,CAAC,CAAC,CAAC;EAEzB,IACEF,aAAa,IACbP,qBAAqB,IACrBA,qBAAqB,CAACW,uBAAuB,CAACJ,aAAa,CAAC,GAC5DK,IAAI,CAACC,2BAA2B,IAChC,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AGG,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,KAAK;MAC3CL,iBAAiB,GAAG,EAAE;;MAEtB;MACAgB,OAAO,CAACC,KAAK,CACX,0ZACF,CAAC;MACD;IACF;EACF;EACA,IAAIjB,iBAAiB,CAAChB,MAAM,GAAG,GAAG,EAAEgB,iBAAiB,GAAGA,iBAAiB,CAACQ,KAAK,CAAC,CAAC,EAAE,CAAC;EAEpF,OAAO/B,cAAc,CAAAyC,KAAA,SAAAnC,SAAQ,CAAC;AAChC,CAAC;AACD,IAAIR,SAAS,CAAC,CAAC,EAAE;EACfY,QAAQ,CAACgC,gBAAgB,CACvB,SAAS,EACT,YAAM;IACJjB,cAAc,GAAGE,IAAI,CAACC,GAAG,CAAC,CAAC;EAC7B,CAAC,EACD;IAAEe,OAAO,EAAE;EAAK,CAClB,CAAC;EACDjC,QAAQ,CAACgC,gBAAgB,CACvB,WAAW,EACX,YAAM;IACJjB,cAAc,GAAGE,IAAI,CAACC,GAAG,CAAC,CAAC;EAC7B,CAAC,EACD;IAAEe,OAAO,EAAE;EAAK,CAClB,CAAC;AACH;AAEA,OAAO,IAAMC,QAAQ,GAAGlB,YAAY","ignoreList":[]}
@@ -29,7 +29,7 @@ function injectStyle(css) {
29
29
  sh = prevSh;
30
30
  } else {
31
31
  // @ts-ignore
32
- var version = "16.3.0";
32
+ var version = "16.4.0";
33
33
  sh = document.createElement('style');
34
34
  sh.setAttribute('data-ui-v', version);
35
35
  sh.classList.add(selectorClass);
@@ -22,7 +22,7 @@ function injectStyle(css) {
22
22
  sh = prevSh;
23
23
  } else {
24
24
  // @ts-ignore
25
- var version = "16.3.0";
25
+ var version = "16.4.0";
26
26
  sh = document.createElement('style');
27
27
  sh.setAttribute('data-ui-v', version);
28
28
  sh.classList.add(selectorClass);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/core",
3
3
  "description": "Semrush Core Component",
4
- "version": "16.3.0-prerelease.5",
4
+ "version": "16.4.0-prerelease.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.mjs",
7
7
  "typings": "lib/index.d.ts",