native-document 1.0.192 → 1.0.194

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": "native-document",
3
- "version": "1.0.192",
3
+ "version": "1.0.194",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -2,7 +2,7 @@ import type { ValidChild } from '../../../../../types/elements';
2
2
  import type { ObservableItem } from '../../../../../types/observable';
3
3
  import type { GlobalAttributes } from '../../../../../types/globals';
4
4
  import type { FieldInterface } from '../Field';
5
- import type { FileItemPreviewInterface } from './FileItemPreview';
5
+ import {FileItemPreviewDescription, FileItemPreviewInterface} from './FileItemPreview';
6
6
 
7
7
  export type FileFieldDescription = {
8
8
  name: string;
@@ -31,9 +31,10 @@ export interface FileFieldInterface extends Omit<FieldInterface, 'render' | 'res
31
31
  extensions(extensions: string[], message?: string): this;
32
32
  maxFiles(max: number, message?: string): this;
33
33
  minFiles(min: number, message?: string): this;
34
- onAddFile(handler: (file: File) => void): this;
34
+ onSelectFile(handler: (file: File) => void): this;
35
+ onAddFile(handler: (file: FileItemPreviewInterface) => void): this;
35
36
  onReset(handler: () => void): this;
36
- onRemoveFile(handler: (file: File) => void): this;
37
+ onRemoveFile(handler: (file: FileItemPreviewInterface) => void): this;
37
38
  addFile(file: FileItemPreviewInterface, update?: boolean): this;
38
39
  setFiles(files: File[]): this;
39
40
  addFiles(files: File[]): this;
@@ -71,7 +71,7 @@ ObservableObject.prototype.$addKey = function(key) {
71
71
  */
72
72
  ObservableObject.prototype.only = function(properties) {
73
73
  const result = {};
74
- for(const key in properties) {
74
+ for(const key of properties) {
75
75
  result[key] = this.$observables[key]?.val();
76
76
  }
77
77
  return result;
@@ -207,8 +207,7 @@ ObservableObject.prototype.set = function(newData) {
207
207
  targetItem.set([...newValue]);
208
208
  continue;
209
209
  }
210
- const value = ObservableItem.auto(newValue);
211
- this.$observables[key] = value;
210
+ this.$observables[key] = ObservableItem.auto(newValue);
212
211
  this.$addKey(key);
213
212
  }
214
213
  };