@destyler/types 0.2.11 → 0.2.12

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/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import * as CSS from "csstype";
2
-
3
2
  //#region src/jsx.d.ts
4
3
  type NativeAnimationEvent = AnimationEvent;
5
4
  type NativeClipboardEvent = ClipboardEvent;
@@ -122,6 +121,12 @@ interface SyntheticTouchEvent<T = Element> extends SyntheticUIEvent<T, NativeTou
122
121
  targetTouches: TouchList;
123
122
  touches: TouchList;
124
123
  }
124
+ declare global {
125
+ interface StyleMedia {
126
+ type: string;
127
+ matchMedium(mediaquery: string): boolean;
128
+ }
129
+ }
125
130
  interface AbstractView {
126
131
  document: Document;
127
132
  styleMedia: StyleMedia;
@@ -1375,8 +1380,8 @@ interface IntrinsicElements {
1375
1380
  }
1376
1381
  //#endregion
1377
1382
  //#region src/create-props.d.ts
1378
- type StrictKeys<K$1 extends (keyof T)[], T> = K$1 extends (keyof T)[] ? [keyof T] extends [K$1[number]] ? unknown : `Missing required keys: ${Exclude<keyof T, K$1[number]>}` : never;
1379
- declare function createProps<T extends Record<never, never>>(): <K$1 extends (keyof T)[]>(props: K$1 & StrictKeys<K$1, T>) => (keyof T)[];
1383
+ type StrictKeys<K extends (keyof T)[], T> = K extends (keyof T)[] ? [keyof T] extends [K[number]] ? unknown : `Missing required keys: ${Exclude<keyof T, K[number]>}` : never;
1384
+ export declare function createProps<T extends Record<never, never>>(): <K extends (keyof T)[]>(props: K & StrictKeys<K, T>) => (keyof T)[];
1380
1385
  //#endregion
1381
1386
  //#region src/prop-types.d.ts
1382
1387
  type Dict<T = any> = Record<string, T>;
@@ -1416,45 +1421,45 @@ type DataAttr = {
1416
1421
  'data-orientation'?: 'horizontal' | 'vertical' | undefined;
1417
1422
  'data-count'?: number | undefined;
1418
1423
  'data-index'?: number | undefined;
1419
- } & { [key in `data-${string}`]?: any | undefined };
1420
- type PropTypes<T = Dict> = Record<'button' | 'label' | 'input' | 'textarea' | 'img' | 'output' | 'element' | 'select' | 'rect' | 'style' | 'circle' | 'svg' | 'path', T>;
1421
- type NormalizeProps<T extends PropTypes> = { [K in keyof T]: (props: K extends keyof IntrinsicElements ? DataAttr & IntrinsicElements[K] : never) => T[K] } & {
1424
+ } & { [key in `data-${string}`]?: any | undefined; };
1425
+ export type PropTypes<T = Dict> = Record<'button' | 'label' | 'input' | 'textarea' | 'img' | 'output' | 'element' | 'select' | 'rect' | 'style' | 'circle' | 'svg' | 'path', T>;
1426
+ export type NormalizeProps<T extends PropTypes> = { [K in keyof T]: (props: K extends keyof IntrinsicElements ? DataAttr & IntrinsicElements[K] : never) => T[K]; } & {
1422
1427
  element: (props: DataAttr & HTMLAttributes<HTMLElement> & Record<string, any>) => T['element'];
1423
1428
  style: CSSProperties;
1424
1429
  };
1425
- declare function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T>;
1430
+ export declare function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T>;
1426
1431
  //#endregion
1427
1432
  //#region index.d.ts
1428
- type RequiredBy<T, K$1 extends keyof T> = Partial<Omit<T, K$1>> & Required<Pick<T, K$1>>;
1429
- type Nullable<T> = T | null;
1430
- type NonNullable<T> = T extends null | undefined ? never : T;
1431
- type Required<T> = { [P in keyof T]-?: NonNullable<T[P]> };
1432
- type Direction = 'ltr' | 'rtl';
1433
- type Orientation = 'horizontal' | 'vertical';
1434
- type MaybeFn<T> = T | (() => T);
1435
- type MaybeElement<T extends HTMLElement = HTMLElement> = Nullable<T>;
1436
- interface OrientationProperty {
1433
+ export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
1434
+ export type Nullable<T> = T | null;
1435
+ export type NonNullable<T> = T extends null | undefined ? never : T;
1436
+ export type Required<T> = { [P in keyof T]-?: NonNullable<T[P]>; };
1437
+ export type Direction = 'ltr' | 'rtl';
1438
+ export type Orientation = 'horizontal' | 'vertical';
1439
+ export type MaybeFn<T> = T | (() => T);
1440
+ export type MaybeElement<T extends HTMLElement = HTMLElement> = Nullable<T>;
1441
+ export interface OrientationProperty {
1437
1442
  /**
1438
1443
  * The orientation of the element.
1439
1444
  * @default "horizontal"
1440
1445
  */
1441
1446
  orientation: Orientation;
1442
1447
  }
1443
- interface DirectionProperty {
1448
+ export interface DirectionProperty {
1444
1449
  /**
1445
1450
  * The document's text/writing direction.
1446
1451
  * @default "ltr"
1447
1452
  */
1448
1453
  dir?: 'ltr' | 'rtl' | undefined;
1449
1454
  }
1450
- interface LocaleProperties extends DirectionProperty {
1455
+ export interface LocaleProperties extends DirectionProperty {
1451
1456
  /**
1452
1457
  * The current locale. Based on the BCP 47 definition.
1453
1458
  * @default "en-US"
1454
1459
  */
1455
1460
  locale?: string | undefined;
1456
1461
  }
1457
- interface CommonProperties {
1462
+ export interface CommonProperties {
1458
1463
  /**
1459
1464
  * The unique identifier of the machine.
1460
1465
  */
@@ -1464,12 +1469,12 @@ interface CommonProperties {
1464
1469
  */
1465
1470
  getRootNode?: (() => ShadowRoot | Document | Node) | undefined;
1466
1471
  }
1467
- type Style = CSSProperties;
1468
- type EventKey = 'ArrowDown' | 'ArrowUp' | 'ArrowLeft' | 'ArrowRight' | 'Space' | 'Enter' | 'Comma' | 'Escape' | 'Backspace' | 'Delete' | 'Home' | 'End' | 'Tab' | 'PageUp' | 'PageDown' | (string & {});
1469
- type EventKeyMap<T extends HTMLElement = HTMLElement> = { [key in EventKey]?: (event: SyntheticKeyboardEvent<T>) => void };
1470
- interface Point {
1472
+ export type Style = CSSProperties;
1473
+ export type EventKey = 'ArrowDown' | 'ArrowUp' | 'ArrowLeft' | 'ArrowRight' | 'Space' | 'Enter' | 'Comma' | 'Escape' | 'Backspace' | 'Delete' | 'Home' | 'End' | 'Tab' | 'PageUp' | 'PageDown' | (string & {});
1474
+ export type EventKeyMap<T extends HTMLElement = HTMLElement> = { [key in EventKey]?: (event: SyntheticKeyboardEvent<T>) => void; };
1475
+ export interface Point {
1471
1476
  x: number;
1472
1477
  y: number;
1473
1478
  }
1474
1479
  //#endregion
1475
- export { type AbstractView, type AllHTMLAttributes, type AnchorHTMLAttributes, type AnimationEventHandler, type AreaHTMLAttributes, type AriaAttributes, type AudioHTMLAttributes, type BaseHTMLAttributes, type BaseSyntheticEvent, type BlockquoteHTMLAttributes, type ButtonHTMLAttributes, type CSSProperties, type CanvasHTMLAttributes, type ChangeEventHandler, type ClipboardEventHandler, type ColHTMLAttributes, type ColgroupHTMLAttributes, CommonProperties, type CompositionEventHandler, type DOMAttributes, type DataHTMLAttributes, type DelHTMLAttributes, type DetailsHTMLAttributes, type DialogHTMLAttributes, Direction, DirectionProperty, type DragEventHandler, type EmbedHTMLAttributes, EventKey, EventKeyMap, type FieldsetHTMLAttributes, type FocusEventHandler, type FormEventHandler, type FormHTMLAttributes, type HTMLAttributes, type HTMLProps, type HtmlHTMLAttributes, type IframeHTMLAttributes, type ImgHTMLAttributes, type InputHTMLAttributes, type InsHTMLAttributes, type IntrinsicElements, type KeyboardEventHandler, type KeygenHTMLAttributes, type LabelHTMLAttributes, type LiHTMLAttributes, type LinkHTMLAttributes, LocaleProperties, type MapHTMLAttributes, MaybeElement, MaybeFn, type MediaHTMLAttributes, type MenuHTMLAttributes, type MetaHTMLAttributes, type MeterHTMLAttributes, type MouseEventHandler, NonNullable, NormalizeProps, Nullable, type ObjectHTMLAttributes, type OlHTMLAttributes, type OptgroupHTMLAttributes, Orientation, OrientationProperty, type OutputHTMLAttributes, type ParamHTMLAttributes, Point, type PointerEventHandler, type ProgressHTMLAttributes, PropTypes, type QuoteHTMLAttributes, Required, RequiredBy, type SVGAttributes, type ScriptHTMLAttributes, type SelectHTMLAttributes, type SlotHTMLAttributes, type SourceHTMLAttributes, Style, type StyleHTMLAttributes, type SyntheticAnimationEvent, type SyntheticChangeEvent, type SyntheticClipboardEvent, type SyntheticCompositionEvent, type SyntheticDragEvent, type SyntheticEvent, type SyntheticFocusEvent, type SyntheticFormEvent, type SyntheticInvalidEvent, type SyntheticKeyboardEvent, type SyntheticMouseEvent, type SyntheticPointerEvent, type SyntheticTouchEvent, type SyntheticTransitionEvent, type SyntheticUIEvent, type SyntheticWheelEvent, type TableHTMLAttributes, type TdHTMLAttributes, type TextareaHTMLAttributes, type ThHTMLAttributes, type TouchEventHandler, type TrackHTMLAttributes, type TransitionEventHandler, type UIEventHandler, type VideoHTMLAttributes, type WheelEventHandler, createNormalizer, createProps };
1480
+ export type { AbstractView, AllHTMLAttributes, AnchorHTMLAttributes, AnimationEventHandler, AreaHTMLAttributes, AriaAttributes, AudioHTMLAttributes, BaseHTMLAttributes, BaseSyntheticEvent, BlockquoteHTMLAttributes, ButtonHTMLAttributes, CSSProperties, CanvasHTMLAttributes, ChangeEventHandler, ClipboardEventHandler, ColHTMLAttributes, ColgroupHTMLAttributes, CompositionEventHandler, DOMAttributes, DataHTMLAttributes, DelHTMLAttributes, DetailsHTMLAttributes, DialogHTMLAttributes, DragEventHandler, EmbedHTMLAttributes, FieldsetHTMLAttributes, FocusEventHandler, FormEventHandler, FormHTMLAttributes, HTMLAttributes, HTMLProps, HtmlHTMLAttributes, IframeHTMLAttributes, ImgHTMLAttributes, InputHTMLAttributes, InsHTMLAttributes, IntrinsicElements, KeyboardEventHandler, KeygenHTMLAttributes, LabelHTMLAttributes, LiHTMLAttributes, LinkHTMLAttributes, MapHTMLAttributes, MediaHTMLAttributes, MenuHTMLAttributes, MetaHTMLAttributes, MeterHTMLAttributes, MouseEventHandler, ObjectHTMLAttributes, OlHTMLAttributes, OptgroupHTMLAttributes, OutputHTMLAttributes, ParamHTMLAttributes, PointerEventHandler, ProgressHTMLAttributes, QuoteHTMLAttributes, SVGAttributes, ScriptHTMLAttributes, SelectHTMLAttributes, SlotHTMLAttributes, SourceHTMLAttributes, StyleHTMLAttributes, SyntheticAnimationEvent, SyntheticChangeEvent, SyntheticClipboardEvent, SyntheticCompositionEvent, SyntheticDragEvent, SyntheticEvent, SyntheticFocusEvent, SyntheticFormEvent, SyntheticInvalidEvent, SyntheticKeyboardEvent, SyntheticMouseEvent, SyntheticPointerEvent, SyntheticTouchEvent, SyntheticTransitionEvent, SyntheticUIEvent, SyntheticWheelEvent, TableHTMLAttributes, TdHTMLAttributes, TextareaHTMLAttributes, ThHTMLAttributes, TouchEventHandler, TrackHTMLAttributes, TransitionEventHandler, UIEventHandler, VideoHTMLAttributes, WheelEventHandler };
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@
2
2
  function createProps() {
3
3
  return (props) => Array.from(new Set(props));
4
4
  }
5
-
6
5
  //#endregion
7
6
  //#region src/prop-types.ts
8
7
  function createNormalizer(fn) {
@@ -10,6 +9,5 @@ function createNormalizer(fn) {
10
9
  return fn;
11
10
  } });
12
11
  }
13
-
14
12
  //#endregion
15
- export { createNormalizer, createProps };
13
+ export { createNormalizer, createProps };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@destyler/types",
3
3
  "type": "module",
4
- "version": "0.2.11",
4
+ "version": "0.2.12",
5
5
  "description": "a minimal implementation of types for UI machines",
6
6
  "author": "Elone Hoo <elonehoo@gmail.com>",
7
7
  "license": "MIT",
@@ -22,9 +22,9 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "csstype": "^3.2.3",
26
- "@destyler/store": "0.2.11",
27
- "@destyler/utils": "0.2.11"
25
+ "@destyler/store": "0.2.12",
26
+ "@destyler/utils": "0.2.12",
27
+ "csstype": "^3.2.3"
28
28
  },
29
29
  "publishConfig": {
30
30
  "access": "public"