@ktjs/mui 0.35.0 → 0.36.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/README.md CHANGED
@@ -17,7 +17,9 @@
17
17
 
18
18
  ## Recent Updates
19
19
 
20
- 1. 0.35.x - `reactive.get('a','b')` is a shortcut for `reactive.map((v) => v.a.b)`. By default it has 5 levels of type annotations and it's convienient for common use cases.
20
+ 1. 0.36.x - override 0.35.x. Now refs and computeds have 2 new apis:
21
+ 1. `get(...keys)`: create a `KTSubComputed` object. It is a light version of computed, used to bind values
22
+ 2. `subref(...keys)`: create a `KTSubRef` object. It is a light version of ref, used to bind values and also support two-way binding with `k-model`.
21
23
  2. 0.34.x - `ref.notify()` no-longer has an optional argument.
22
24
  3. 0.33.x - `ref.value` remains the standard read API, and it can also replace the whole outer value with `ref.value = nextValue`.
23
25
  4. 0.33.x - `ref.draft` is the deep-mutation entry for literally any objects. Just use `someRef.draft.a = someValue`, and kt.js will add it to microqueue and redraw it on the next tick. Works for `Map`, `Set`, `Array`, `Date` and your custom objects.
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { KTReactive, KTRawContent, KTMaybeReactive as KTMaybeReactive$1, JSX } from '@ktjs/core';
1
+ import { KTReactiveLike, KTRawContent, KTMaybeReactive as KTMaybeReactive$1, JSX, KTRefLike } from '@ktjs/core';
2
2
 
3
3
  interface KTMuiProps {
4
- class?: string | KTReactive<string>;
5
- style?: string | Partial<CSSStyleDeclaration> | KTReactive<string> | KTReactive<Partial<CSSStyleDeclaration>>;
4
+ class?: string | KTReactiveLike<string>;
5
+ style?: string | Partial<CSSStyleDeclaration> | KTReactiveLike<string> | KTReactiveLike<Partial<CSSStyleDeclaration>>;
6
6
  children?: KTRawContent;
7
7
  }
8
8
 
9
- type KTMaybeReactive<T> = T | KTReactive<T>;
9
+ type KTMaybeReactive<T> = T | KTReactiveLike<T>;
10
10
 
11
11
  type KTMuiAlertSeverity = 'error' | 'warning' | 'info' | 'success';
12
12
  type KTMuiAlertVariant = 'standard' | 'filled' | 'outlined';
@@ -243,7 +243,7 @@ interface KTMuiPopoverOrigin {
243
243
  horizontal: KTMuiPopoverHorizontalOrigin;
244
244
  }
245
245
  type KTMuiPopoverCloseReason = 'backdropClick' | 'escapeKeyDown';
246
- type KTMuiPopoverAnchorEl<TAnchor extends JSX.Element | undefined = JSX.Element | undefined> = TAnchor | KTReactive<TAnchor>;
246
+ type KTMuiPopoverAnchorEl<TAnchor extends JSX.Element | undefined = JSX.Element | undefined> = TAnchor | KTReactiveLike<TAnchor>;
247
247
  interface KTMuiPopoverProps<TAnchor extends JSX.Element | undefined = JSX.Element | undefined> extends KTMuiProps {
248
248
  /**
249
249
  * Indicates whether the popover is open.
@@ -343,7 +343,7 @@ type ComponentChangeHandler<T = string> = (value: T, ...args: any[]) => void;
343
343
  type KTMuiTextFieldType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url';
344
344
  type KTMuiTextFieldSize = 'small' | 'medium';
345
345
  interface KTMuiTextFieldProps<T extends KTMuiTextFieldType = 'text'> extends KTMuiProps {
346
- 'k-model'?: T extends 'number' ? KTReactive<number> : KTReactive<string>;
346
+ 'k-model'?: T extends 'number' ? KTRefLike<number> : KTRefLike<string>;
347
347
  label?: KTMaybeReactive<string>;
348
348
  placeholder?: KTMaybeReactive<string>;
349
349
  value?: any;
@@ -356,7 +356,7 @@ interface KTMuiTextFieldProps<T extends KTMuiTextFieldType = 'text'> extends KTM
356
356
  fullWidth?: KTMaybeReactive<boolean>;
357
357
  multiline?: boolean;
358
358
  rows?: KTMaybeReactive<number>;
359
- size?: KTMuiTextFieldSize | KTReactive<KTMuiTextFieldSize>;
359
+ size?: KTMuiTextFieldSize | KTReactiveLike<KTMuiTextFieldSize>;
360
360
  'on:input'?: ComponentChangeHandler<T extends 'number' ? number : T extends 'date' ? Date : string>;
361
361
  'on:change'?: ComponentChangeHandler<T extends 'number' ? number : T extends 'date' ? Date : string>;
362
362
  'on:blur'?: () => void;
@@ -370,7 +370,7 @@ declare function TextField<T extends KTMuiTextFieldType = 'text'>(props: KTMuiTe
370
370
 
371
371
  type KTMuiFilePickerSize = 'small' | 'medium';
372
372
  interface KTMuiFilePickerProps extends KTMuiProps {
373
- 'k-model'?: KTReactive<File[]>;
373
+ 'k-model'?: KTRefLike<File[]>;
374
374
  label?: KTMaybeReactive<string>;
375
375
  placeholder?: KTMaybeReactive<string>;
376
376
  value?: File[];
@@ -382,7 +382,7 @@ interface KTMuiFilePickerProps extends KTMuiProps {
382
382
  error?: KTMaybeReactive<boolean>;
383
383
  helperText?: KTMaybeReactive<string>;
384
384
  fullWidth?: KTMaybeReactive<boolean>;
385
- size?: KTMuiFilePickerSize | KTReactive<KTMuiFilePickerSize>;
385
+ size?: KTMuiFilePickerSize | KTReactiveLike<KTMuiFilePickerSize>;
386
386
  buttonText?: KTMaybeReactive<string>;
387
387
  showFileCount?: KTMaybeReactive<boolean>;
388
388
  'on:change'?: (files: File[]) => void;
@@ -397,7 +397,7 @@ declare function FilePicker(props: KTMuiFilePickerProps): KTMuiFilePicker;
397
397
 
398
398
  type KTMuiDirectoryPickerSize = 'small' | 'medium';
399
399
  interface KTMuiDirectoryPickerProps extends KTMuiProps {
400
- 'k-model'?: KTReactive<File[]>;
400
+ 'k-model'?: KTRefLike<File[]>;
401
401
  label?: KTMaybeReactive<string>;
402
402
  placeholder?: KTMaybeReactive<string>;
403
403
  value?: File[];
@@ -407,7 +407,7 @@ interface KTMuiDirectoryPickerProps extends KTMuiProps {
407
407
  error?: KTMaybeReactive<boolean>;
408
408
  helperText?: KTMaybeReactive<string>;
409
409
  fullWidth?: KTMaybeReactive<boolean>;
410
- size?: KTMuiDirectoryPickerSize | KTReactive<KTMuiDirectoryPickerSize>;
410
+ size?: KTMuiDirectoryPickerSize | KTReactiveLike<KTMuiDirectoryPickerSize>;
411
411
  buttonText?: KTMaybeReactive<string>;
412
412
  'on:change'?: (files: File[], directoryPath: string) => void;
413
413
  'on:blur'?: () => void;
@@ -423,7 +423,7 @@ type KTMuiRadioSize = 'small' | 'medium';
423
423
  type KTMuiRadioColor = 'primary' | 'secondary' | 'default';
424
424
  interface KTMuiRadioProps extends KTMuiProps {
425
425
  value: string;
426
- label: string | JSX.Element | HTMLElement | KTReactive<string | JSX.Element | HTMLElement>;
426
+ label: KTMaybeReactive$1<string | JSX.Element | HTMLElement>;
427
427
  checked?: boolean;
428
428
  size?: KTMuiRadioSize;
429
429
  'on:change'?: (checked: boolean, value: string) => void;
@@ -487,10 +487,10 @@ declare function Select(props: KTMuiSelectProps): KTMuiSelect;
487
487
 
488
488
  type KTMuiCardVariant = 'elevation' | 'outlined' | 'contained';
489
489
  interface KTMuiCardProps extends KTMuiProps {
490
- variant?: KTMuiCardVariant;
491
- elevation?: number | KTReactive<number>;
492
- square?: boolean | KTReactive<boolean>;
493
- raised?: boolean | KTReactive<boolean>;
490
+ variant?: KTMaybeReactive$1<KTMuiCardVariant>;
491
+ elevation?: KTMaybeReactive$1<number>;
492
+ square?: KTMaybeReactive$1<boolean>;
493
+ raised?: KTMaybeReactive$1<boolean>;
494
494
  'on:click'?: (event: MouseEvent) => void;
495
495
  'on:mouseenter'?: (event: MouseEvent) => void;
496
496
  'on:mouseleave'?: (event: MouseEvent) => void;
@@ -554,7 +554,7 @@ interface KTMuiBadgeAnchorOrigin {
554
554
  horizontal: KTMuiBadgeHorizontalOrigin;
555
555
  }
556
556
  interface KTMuiBadgeProps extends KTMuiProps {
557
- badgeContent?: KTMuiBadgeContent | KTReactive<number> | KTReactive<string>;
557
+ badgeContent?: KTMaybeReactive$1<KTMuiBadgeContent>;
558
558
  max?: KTMaybeReactive$1<number>;
559
559
  showZero?: KTMaybeReactive$1<boolean>;
560
560
  invisible?: KTMaybeReactive$1<boolean>;
@@ -583,7 +583,7 @@ interface KTMuiTabOption {
583
583
  disabled?: boolean;
584
584
  }
585
585
  interface KTMuiTabsProps extends KTMuiProps {
586
- 'k-model'?: KTReactive<string>;
586
+ 'k-model'?: KTRefLike<string>;
587
587
  options: KTMaybeReactive<KTMuiTabOption[]>;
588
588
  variant?: KTMaybeReactive<KTMuiTabsVariant>;
589
589
  textColor?: KTMaybeReactive<KTMuiTabsTextColor>;