@nectary/components 4.11.0 → 4.11.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "4.11.0",
3
+ "version": "4.11.1",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
package/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ClassAttributes, DOMAttributes, HTMLAttributes } from 'react'
2
- import type { ReactifyEvents, ReactifyElement, SafeSelect, CamelCaseify, RemoveReadonly, SetAttributes, ExtendEventListeners } from './utils/adapters'
1
+ import type { HTMLAttributes, CSSProperties } from 'react'
2
+ import type { ReactifyEvents, WebComponentReactBaseProp, SafeSelect, CamelCaseify, RemoveReadonly, SetAttributes, ExtendEventListeners } from './utils/adapters'
3
3
 
4
4
  export type TRect = {
5
5
  x: number,
@@ -8,21 +8,24 @@ export type TRect = {
8
8
  height: number,
9
9
  }
10
10
 
11
- export type NectaryComponentVanillaByType<T extends object> =
11
+ export type NectaryComponentVanillaByType<T extends NectaryComponentMap[keyof NectaryComponentMap]> =
12
12
  Omit<HTMLElement, 'addEventListener' | 'removeEventListener'> &
13
13
  ExtendEventListeners<Required<SafeSelect<T, 'events'>>> &
14
14
  SetAttributes<Required<RemoveReadonly<SafeSelect<T, 'props'>>>> &
15
15
  Required<CamelCaseify<SafeSelect<T, 'props'>>> &
16
16
  Required<SafeSelect<T, 'methods'>>
17
17
 
18
- export type NectaryComponentReactByType<T extends object> =
19
- ReactifyElement<HTMLElement> &
18
+ export type NectaryComponentReactByType<T extends NectaryComponentMap[keyof NectaryComponentMap]> =
19
+ WebComponentReactBaseProp<NectaryComponentVanillaByType<T>> &
20
20
  ReactifyEvents<SafeSelect<T, 'events'>> &
21
21
  RemoveReadonly<SafeSelect<T, 'props'>> &
22
- { style?: SafeSelect<T, 'style'> }
22
+ {
23
+ style?: Partial<SafeSelect<T, 'style'>> & CSSProperties;
24
+ }
25
+
23
26
 
24
27
  export type NectaryComponentVanilla<K extends keyof NectaryComponentMap> =
25
28
  NectaryComponentVanillaByType<NectaryComponentMap[K]>
26
29
 
27
30
  export type NectaryComponentReact<K extends keyof NectaryComponentMap> =
28
- NectaryComponentReactByType<NectaryComponentMap[K]>
31
+ NectaryComponentReactByType<NectaryComponentMap[K]>
@@ -1,4 +1,4 @@
1
- import type { ClassAttributes, DOMAttributes, HTMLAttributes } from 'react';
1
+ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
2
2
  export type SafeSelect<T extends object, K extends string | number | symbol> = K extends keyof T ? T[K] extends object ? T[K] : {} : {};
3
3
  type CamelCaseString<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCaseString<P3>}` : S;
4
4
  export type CamelCaseify<T> = T extends object ? {
@@ -21,10 +21,10 @@ export type ExtendEventListeners<Events> = {
21
21
  export type SetAttributes<Props> = {
22
22
  setAttribute<K extends keyof Props>(attr: K, value: Props[K] extends boolean ? '' : Props[K]): void;
23
23
  };
24
- export type ReactifyElement<TElement> = Pick<HTMLAttributes<HTMLElement>, 'id' | 'className' | 'style' | 'slot' | 'children'> & ClassAttributes<TElement> & Pick<DOMAttributes<TElement>, 'onClick' | 'onDoubleClick' | 'onMouseDown' | 'onMouseUp' | 'onMouseMove' | 'onMouseOver' | 'onMouseOut' | 'onFocus' | 'onBlur' | 'onKeyDown' | 'onKeyUp' | 'onKeyPress'> & {
25
- class?: string;
26
- };
27
24
  export type ReactifyEvents<T> = {
28
25
  [K in keyof T as K extends string ? `on${K}` : never]: T[K];
29
26
  };
27
+ export type WebComponentReactBaseProp<T = HTMLElement> = Omit<DetailedHTMLProps<HTMLAttributes<T>, T>, 'className' | 'style'> & {
28
+ class?: string;
29
+ };
30
30
  export {};