@ilokesto/utilinent 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { BaseTypeHelperFn, Fallback, ProxyType } from "../../types";
2
3
  export interface ForProps<T extends Array<unknown>> extends Fallback {
3
4
  each: T | null | undefined;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { BaseTypeHelperFn, Fallback, ProxyType } from "../../types";
2
3
  export interface MountProps extends Fallback {
3
4
  children: React.ReactNode | (() => React.ReactNode | Promise<React.ReactNode>);
@@ -1,4 +1,5 @@
1
+ /// <reference types="react" />
1
2
  import { ObserverProps } from "./types";
2
3
  export declare const Observer: import("react").ForwardRefExoticComponent<ObserverProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
3
- ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
4
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
4
5
  }, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { Fallback } from "../../types";
2
3
  export interface ObserverProps extends Fallback {
3
4
  children?: React.ReactNode | ((isIntersecting: boolean) => React.ReactNode);
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import { OptionalWrapperProps } from "./types";
2
3
  export declare function OptionalWrapper<T>({ when, children, wrapper, fallback }: OptionalWrapperProps<T>): React.ReactNode;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface OptionalWrapperProps<T = unknown> {
2
3
  when: T;
3
4
  children: React.ReactNode;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { BaseTypeHelperFn, Fallback, ProxyType } from "../../types";
2
3
  export interface RepeatProps extends Fallback {
3
4
  times: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { BaseTypeHelperFn, Fallback, NonNullableElements, ProxyType } from "../../types";
2
3
  export interface ShowPropsArray<T extends unknown[]> extends Fallback {
3
4
  when: T;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type SlackerFallbackProps = {
2
3
  isLoading: boolean;
3
4
  error: Error | null;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Slot: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLElement> & import("react").RefAttributes<HTMLElement>>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare function isSlottable(child: React.ReactNode): child is React.ReactElement;
2
3
  export declare const Slottable: ({ children }: {
3
4
  children: React.ReactNode;
@@ -1,3 +1,7 @@
1
- import { MatchProps } from "./types";
2
- export declare function Match<T>({ when, children }: MatchProps<T>): import("react").ReactNode;
3
- export declare const isMatchElement: (child: React.ReactNode) => child is React.ReactElement<MatchProps>;
1
+ /// <reference types="react" />
2
+ import type { MatchProps, MatchPropsArray } from "./types";
3
+ type MatchElementProps = MatchProps | MatchPropsArray<readonly unknown[]>;
4
+ export declare function Match<const T extends readonly unknown[]>(props: MatchPropsArray<T>): React.ReactNode;
5
+ export declare function Match<T>(props: MatchProps<T>): React.ReactNode;
6
+ export declare const isMatchElement: (child: React.ReactNode) => child is import("react").ReactElement<MatchElementProps, string | import("react").JSXElementConstructor<any>>;
7
+ export {};
@@ -1,8 +1,13 @@
1
- import type { BaseTypeHelperFn, Fallback, ProxyType } from "../../types";
1
+ /// <reference types="react" />
2
+ import type { BaseTypeHelperFn, Fallback, NonNullableElements, ProxyType } from "../../types";
2
3
  export interface MatchProps<T = unknown> {
3
- when: T | null | undefined | false;
4
+ when: T;
4
5
  children: React.ReactNode | ((item: NonNullable<T>) => React.ReactNode);
5
6
  }
7
+ export interface MatchPropsArray<T extends readonly unknown[]> {
8
+ when: T;
9
+ children: React.ReactNode | ((item: NonNullableElements<T>) => React.ReactNode);
10
+ }
6
11
  export interface SwitchProps extends Fallback {
7
12
  children: React.ReactNode;
8
13
  }
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  import type { RegistryCategory } from "../types";
2
3
  export declare function createProxy<TProxy extends object, TBase extends object = TProxy>(base: TBase, renderForTag: (tag: any) => React.ForwardRefExoticComponent<any>, category: RegistryCategory): TProxy;
package/dist/index.d.ts CHANGED
@@ -5,8 +5,8 @@ export * from './components/OptionalWrapper';
5
5
  export * from './components/Repeat';
6
6
  export * from './components/Show';
7
7
  export * from './components/Slacker';
8
- export * from './components/Slot/Slot';
9
- export * from './components/Switch/Switch';
8
+ export * from './components/Slot';
9
+ export * from './components/Switch';
10
10
  export * from './hooks/useIntersectionObserver';
11
11
  export { PluginManager } from './core/PluginManager';
12
12
  export { UtilinentRegister } from './types';
package/dist/index.js CHANGED
@@ -6,8 +6,8 @@ export * from './components/OptionalWrapper';
6
6
  export * from './components/Repeat';
7
7
  export * from './components/Show';
8
8
  export * from './components/Slacker';
9
- export * from './components/Slot/Slot';
10
- export * from './components/Switch/Switch';
9
+ export * from './components/Slot';
10
+ export * from './components/Switch';
11
11
  // export hooks
12
12
  export * from './hooks/useIntersectionObserver';
13
13
  // export Register and PluginManager
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { HtmlTag } from "../constants/htmlTags";
2
3
  import { RegisterProps } from "./register";
3
4
  import { RegistryCategory } from "./RegistryCategory";
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export type { UtilinentRegister } from "./register";
2
3
  export interface Fallback {
3
4
  fallback?: React.ReactNode;
@@ -1 +1,3 @@
1
- export declare const resolveWhen: (value: unknown) => boolean;
1
+ import type { NonNullableElements } from "../types";
2
+ export declare function resolveWhen<T extends readonly unknown[]>(value: T): value is NonNullableElements<T>;
3
+ export declare function resolveWhen<T>(value: T): value is NonNullable<T>;
@@ -1 +1,3 @@
1
- export const resolveWhen = (value) => Array.isArray(value) ? value.every(Boolean) : !!value;
1
+ export function resolveWhen(value) {
2
+ return Array.isArray(value) ? value.length > 0 && value.every(Boolean) : !!value;
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ilokesto/utilinent",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ilokesto/utilinent.git"