@es-joy/jsoe 0.9.0 → 0.11.0
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/.eslintrc.cjs +9 -0
- package/.nyc_output/out.json +9131 -5880
- package/CHANGES.md +8 -0
- package/README.md +7 -2
- package/demo/index.js +12 -1
- package/dist/formats/structuredCloning.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/blobType.d.ts +11 -0
- package/dist/fundamentalTypes/blobType.d.ts.map +1 -0
- package/dist/fundamentalTypes/errorType.d.ts.map +1 -1
- package/dist/fundamentalTypes/fileType.d.ts +13 -0
- package/dist/fundamentalTypes/fileType.d.ts.map +1 -0
- package/dist/fundamentalTypes/filelistType.d.ts +6 -0
- package/dist/fundamentalTypes/filelistType.d.ts.map +1 -0
- package/dist/types.d.ts +9 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/FileList.d.ts +26 -0
- package/dist/utils/FileList.d.ts.map +1 -0
- package/dist/utils/dialogs.d.ts +3 -1
- package/dist/utils/dialogs.d.ts.map +1 -1
- package/dist/utils/media.d.ts +18 -0
- package/dist/utils/media.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/formats/structuredCloning.js +16 -6
- package/src/fundamentalTypes/arrayType.js +57 -18
- package/src/fundamentalTypes/domexceptionType.js +124 -0
- package/src/fundamentalTypes/dommatrixType.js +357 -0
- package/src/fundamentalTypes/dompointType.js +103 -0
- package/src/fundamentalTypes/domrectType.js +103 -0
- package/src/fundamentalTypes/filelistType.js +35 -0
- package/src/jsoe.css +4 -0
- package/src/types.js +19 -19
- package/src/utils/FileList.js +32 -0
package/CHANGES.md
CHANGED
package/README.md
CHANGED
|
@@ -30,10 +30,15 @@ Supported types include:
|
|
|
30
30
|
- `Blob`
|
|
31
31
|
- `Boolean` object
|
|
32
32
|
- `Date`
|
|
33
|
+
- `DOMException`,
|
|
34
|
+
- `DOMMatrix`
|
|
35
|
+
- `DOMPoint`
|
|
36
|
+
- `DOMRect`
|
|
33
37
|
- `Error`
|
|
34
38
|
- `TypeError`, `RangeError`, `SyntaxError`, `ReferenceError`, `EvalError`,
|
|
35
39
|
`URIError`, `AggregateError`, `InternalError`
|
|
36
40
|
- `File`
|
|
41
|
+
- `FileList`
|
|
37
42
|
- `Map`
|
|
38
43
|
- `null`
|
|
39
44
|
- `Number` object
|
|
@@ -104,9 +109,9 @@ Supported supertypes include:
|
|
|
104
109
|
1. bigint64arrayconstructor
|
|
105
110
|
1. biguint64arrayconstructor
|
|
106
111
|
1. Web/API types
|
|
107
|
-
1. filelist
|
|
108
112
|
1. imagedata, imagebitmap
|
|
109
|
-
|
|
113
|
+
1. cryptokey
|
|
114
|
+
1. Our own custom derivative types? (e.g., MIDI using TypedArray)
|
|
110
115
|
1. Expand subtypes
|
|
111
116
|
1. String
|
|
112
117
|
1. As supported by Zod, JSON Schema, etc. (e.g., email addresses as
|
package/demo/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {jml, body, $} from '../src/vendor-imports.js';
|
|
2
|
+
// import FileList from '../src/utils/FileList.js';
|
|
2
3
|
|
|
3
4
|
import {
|
|
4
5
|
typeChoices,
|
|
@@ -340,7 +341,17 @@ setTimeout(async function () {
|
|
|
340
341
|
}),
|
|
341
342
|
new Blob(['abc'], {
|
|
342
343
|
type: 'text/plain'
|
|
343
|
-
})
|
|
344
|
+
}),
|
|
345
|
+
new DOMException('some message', 'someName'),
|
|
346
|
+
new DOMRect(1, 2, 3, 4),
|
|
347
|
+
new DOMPoint(1, 2, 3, 4),
|
|
348
|
+
new DOMMatrix([1, 2, 3, 4, 5, 6]),
|
|
349
|
+
new DOMMatrix([
|
|
350
|
+
1, 2, 3, 4,
|
|
351
|
+
5, 6, 7, 8,
|
|
352
|
+
9, 10, 11, 12,
|
|
353
|
+
13, 14, 15, 16
|
|
354
|
+
])
|
|
344
355
|
],
|
|
345
356
|
typeNamespace: 'demo-type-choices-only-initial-value'
|
|
346
357
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structuredCloning.d.ts","sourceRoot":"","sources":["../../src/formats/structuredCloning.js"],"names":[],"mappings":";2CAcoB;IACnB,QAAY,EAAE,MAAM,CAAC;IACrB,IAAQ,EAAE,OAAO,aAAa,EAAE,aAAa,CAAC;IAC9C,KAAS,EAAE,OAAO,eAAe,EAAE,oBAAoB,CAAC;IACxD,cAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAe,CAAC,EAAE,OAAO,aAAa,EAAE,gCAAgC,CAAA;CACrE,KAAK,WAAW,GAAC,IAAI;kCAIZ,OAAO,kBAAkB,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"structuredCloning.d.ts","sourceRoot":"","sources":["../../src/formats/structuredCloning.js"],"names":[],"mappings":";2CAcoB;IACnB,QAAY,EAAE,MAAM,CAAC;IACrB,IAAQ,EAAE,OAAO,aAAa,EAAE,aAAa,CAAC;IAC9C,KAAS,EAAE,OAAO,eAAe,EAAE,oBAAoB,CAAC;IACxD,cAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAe,CAAC,EAAE,OAAO,aAAa,EAAE,gCAAgC,CAAA;CACrE,KAAK,WAAW,GAAC,IAAI;kCAIZ,OAAO,kBAAkB,EAAE,mBAAmB;uCA4VhD,OAAO,eAAe,EAAE,oBAAoB,YAC5C,OAAO,aAAa,EAAE,WAAW,KAC/B,QAAQ,OAAO,CAAC;AAJ7B;;;;;GAKG;AAEH,6CAA6C;AAC7C,iCADW,OAAO,eAAe,EAAE,MAAM,CA+GvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";sBAWa,MAAM;;oCAQN,MAAM,gBAAgB,EAAE;+BAGxB,MAAM,CAAC,iBAAiB,GAAG;IACvC,SAAa,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAA;CAChD,CAAC,EAAE;6BAGM,MAAM,IAAI;sCAIV,gBAAgB,EAAE;qCAKlB,IAAI;4BAGJ,MAAM,cAAc,GAAG;IACnC,sBAA0B,EAAE,qBAAqB,CAAC;IAClD,kBAAsB,EAAE,iBAAiB,CAAC;IAC1C,iBAAqB,EAAE,gBAAgB,CAAC;IACxC,iBAAqB,EAAE,gBAAgB,CAAA;CACpC;uBAGS,MAAM,QAAQ,IAAI,CAAC;2BAKrB;IAAC,WAAW,CAAC,EAAE,IAAI,CAAA;CAAC,KAClB,IAAI;+BAIJ,MAAM,gBAAgB,GAAC,SAAS;uBAIhC,GAAG;AAmBhB;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,MAAM,CAAC,EAAE,OAAO,GAAC,SAAS,CAAA;CAAC,CAuoDvE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default blobType;
|
|
2
|
+
export type BlobInfo = Blob | {
|
|
3
|
+
size: string;
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
6
|
+
export type SetValue = (blob: BlobInfo) => void;
|
|
7
|
+
/**
|
|
8
|
+
* @type {import('../types.js').TypeObject}
|
|
9
|
+
*/
|
|
10
|
+
declare const blobType: import('../types.js').TypeObject;
|
|
11
|
+
//# sourceMappingURL=blobType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blobType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/blobType.js"],"names":[],"mappings":";uBAMa,IAAI,GAAC;IACjB,IAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAC3B;8BAIgB,QAAQ,KAAK,IAAI;AAiIrC;;GAEG;AACH,wBAFU,OAAO,aAAa,EAAE,UAAU,CAw1BxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/errorType.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"errorType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/errorType.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,CAyZxC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default fileType;
|
|
2
|
+
export type FileInfo = File | {
|
|
3
|
+
name: string;
|
|
4
|
+
size: string;
|
|
5
|
+
type: string;
|
|
6
|
+
lastModified: string;
|
|
7
|
+
};
|
|
8
|
+
export type SetValue = (file: FileInfo) => void;
|
|
9
|
+
/**
|
|
10
|
+
* @type {import('../types.js').TypeObject}
|
|
11
|
+
*/
|
|
12
|
+
declare const fileType: import('../types.js').TypeObject;
|
|
13
|
+
//# sourceMappingURL=fileType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/fileType.js"],"names":[],"mappings":";uBAMa,IAAI,GAAC;IACjB,MAAU,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAC7C,YAAgB,EAAE,MAAM,CAAA;CACrB;8BAIgB,QAAQ,KAAK,IAAI;AAsJrC;;GAEG;AACH,wBAFU,OAAO,aAAa,EAAE,UAAU,CA+6BxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filelistType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/filelistType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,4BAFU,OAAO,aAAa,EAAE,UAAU,CA6BxC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -119,14 +119,19 @@ export type TypeObject = {
|
|
|
119
119
|
array?: boolean | undefined;
|
|
120
120
|
/**
|
|
121
121
|
* Private context variable. Whether or not
|
|
122
|
-
* it is a Map
|
|
122
|
+
* it is a `Map`. Do not use in other types.
|
|
123
123
|
*/
|
|
124
124
|
map?: boolean | undefined;
|
|
125
125
|
/**
|
|
126
126
|
* Private context variable. Whether or not
|
|
127
|
-
* it is a
|
|
127
|
+
* it is a `Set`. Do not use in other types.
|
|
128
128
|
*/
|
|
129
129
|
set?: boolean | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Private context variable. Whether or not
|
|
132
|
+
* it is a `FileList` type. Do not use in other types.
|
|
133
|
+
*/
|
|
134
|
+
filelist?: boolean | undefined;
|
|
130
135
|
/**
|
|
131
136
|
* Private context variable. Whether or not
|
|
132
137
|
* it is a sparse array. Do not use in other types.
|
|
@@ -250,7 +255,7 @@ export type TypeObject = {
|
|
|
250
255
|
};
|
|
251
256
|
} | undefined;
|
|
252
257
|
};
|
|
253
|
-
export type AvailableType = "null" | "true" | "false" | "number" | "bigint" | "string" | "arrayReference" | "objectReference" | "array" | "object" | "date" | "userObject" | "undef" | "SpecialRealNumber" | "SpecialNumber" | "regexp" | "BooleanObject" | "NumberObject" | "StringObject" | "map" | "set" | "file" | "filelist" | "blobHTML" | "arraybuffer" | "arraybufferview" | "dataview" | "imagedata" | "imagebitmap" | "int8array" | "uint8array" | "uint8clampedarray" | "int16array" | "uint16array" | "int32array" | "uint32array" | "float32array" | "float64array" | "IntlCollator" | "IntlDateTimeFormat" | "IntlNumberFormat" | "ValidDate" | "arrayNonindexKeys" | "error" | "errors";
|
|
258
|
+
export type AvailableType = "null" | "true" | "false" | "number" | "bigint" | "string" | "arrayReference" | "objectReference" | "array" | "object" | "date" | "userObject" | "undef" | "SpecialRealNumber" | "SpecialNumber" | "regexp" | "BooleanObject" | "NumberObject" | "StringObject" | "map" | "set" | "file" | "filelist" | "blobHTML" | "arraybuffer" | "arraybufferview" | "dataview" | "imagedata" | "imagebitmap" | "int8array" | "uint8array" | "uint8clampedarray" | "int16array" | "uint16array" | "int32array" | "uint32array" | "float32array" | "float64array" | "IntlCollator" | "IntlDateTimeFormat" | "IntlNumberFormat" | "ValidDate" | "arrayNonindexKeys" | "error" | "errors" | "blob";
|
|
254
259
|
export type GetPossibleSchemasForPathAndType = (keypath: string, parentPath: string, arrayOrObjectPropertyName: string, valueType: string) => StateObject;
|
|
255
260
|
export type StateObject = {
|
|
256
261
|
typeNamespace?: string | undefined;
|
|
@@ -433,6 +438,7 @@ declare const Types: {
|
|
|
433
438
|
error: string[] | Partial<TypeObject>;
|
|
434
439
|
file: string[] | Partial<TypeObject>;
|
|
435
440
|
arraybuffer: string[] | Partial<TypeObject>;
|
|
441
|
+
blob: string[] | Partial<TypeObject>;
|
|
436
442
|
date: string[] | Partial<TypeObject>;
|
|
437
443
|
null: string[] | Partial<TypeObject>;
|
|
438
444
|
regexp: string[] | Partial<TypeObject>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.js"],"names":[],"mappings":"AA6CO,mDAHI,iBAAiB,GACf,MAAM,CAmBlB;;;;;oCAKW,WAAW,YACV,MAAM;;;;;qCAOR,WAAW,2EAGT,oBAAoB;;;;2CAMtB,WAAW,KACT,IAAI,GAChB,gBAAoB,GAAC,mBAAmB,GAAC,iBAAiB,GAAC,iBAAiB;;;;iDAMlE,MAAM,GAAC,WAAW,yCAEhB,oBAAoB;uDAKtB,MAAM,GAAC,WAAW,KAChB,IAAI,GAAC,gBAAgB,GAAC,mBAAmB,GAAC,iBAAiB,GACvE,iBAAqB;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAtBqB,cAAc;qBACb,eAAe;2BACT,qBAAqB;8BAClB,wBAAwB;oCAClB,8BAA8B;+BACnC,yBAAyB;sBAClC,gBAAgB;qCACD,+BAA+B;yBAC3C,mBAAmB;;;;sBAGd,aAAa;uBAAS,aAAa;;;;oBAG7C,cAAc;2BACP,qBAAqB;cAClC,QAAQ;cACR,QAAQ;uBACC,iBAAiB;;EAIxB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default FileList;
|
|
2
|
+
export type Integer = number;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {number} Integer
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* `FileList` polyfill.
|
|
8
|
+
*/
|
|
9
|
+
declare class FileList {
|
|
10
|
+
/**
|
|
11
|
+
* Set private properties and length.
|
|
12
|
+
*/
|
|
13
|
+
constructor(...args: any[]);
|
|
14
|
+
_files: any;
|
|
15
|
+
length: any;
|
|
16
|
+
/**
|
|
17
|
+
* @param {Integer} index
|
|
18
|
+
* @returns {File}
|
|
19
|
+
*/
|
|
20
|
+
item(index: Integer): File;
|
|
21
|
+
/**
|
|
22
|
+
* @returns {"FileList"}
|
|
23
|
+
*/
|
|
24
|
+
get [Symbol.toStringTag](): "FileList";
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=FileList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileList.d.ts","sourceRoot":"","sources":["../../src/utils/FileList.js"],"names":[],"mappings":";sBACa,MAAM;AADnB;;GAEG;AACH;;GAEG;AACH;IACE;;OAEG;IACH,4BAIC;IAFC,YAA0B;IAC1B,YAAgC;IAElC;;;OAGG;IACH,YAHW,OAAO,GACL,IAAI,CAIhB;IAED;;OAEG;IACH,uCAGC;CACF"}
|
package/dist/utils/dialogs.d.ts
CHANGED
|
@@ -56,15 +56,17 @@ declare namespace dialogs {
|
|
|
56
56
|
/**
|
|
57
57
|
* @param {object} cfg
|
|
58
58
|
* @param {(info: {e: Event, dialog: HTMLDialogElement}) => void} cfg.submit
|
|
59
|
+
* @param {string} [cfg.submitText]
|
|
59
60
|
* @param {string} [cfg.submitClass]
|
|
60
61
|
* @param {MakeCancelArgs} [cfg.args]
|
|
61
62
|
* @returns {HTMLDialogElement}
|
|
62
63
|
*/
|
|
63
|
-
function makeSubmitDialog({ submit, submitClass, ...args }: {
|
|
64
|
+
function makeSubmitDialog({ submit, submitText, submitClass, ...args }: {
|
|
64
65
|
submit: (info: {
|
|
65
66
|
e: Event;
|
|
66
67
|
dialog: HTMLDialogElement;
|
|
67
68
|
}) => void;
|
|
69
|
+
submitText?: string | undefined;
|
|
68
70
|
submitClass?: string | undefined;
|
|
69
71
|
args?: {
|
|
70
72
|
cancel?: ((info: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../src/utils/dialogs.js"],"names":[],"mappings":";;;;;uBAiBa,MAAM;IAEjB;;;OAGG;IACH,sDAEC;IAED;;;;;;OAMG;IACH;;;OAGG;IACH;;;;;0BAmBC;IACD;;;;;;;;OAQG;IACH;;;OAGG;IACH;;;;;;;;;;;;;0BA0BC;IACD
|
|
1
|
+
{"version":3,"file":"dialogs.d.ts","sourceRoot":"","sources":["../../src/utils/dialogs.js"],"names":[],"mappings":";;;;;uBAiBa,MAAM;IAEjB;;;OAGG;IACH,sDAEC;IAED;;;;;;OAMG;IACH;;;OAGG;IACH;;;;;0BAmBC;IACD;;;;;;;;OAQG;IACH;;;OAGG;IACH;;;;;;;;;;;;;0BA0BC;IACD;;;;;;;OAOG;IACH;;;;;;;;;;;;;;;;;;;;;0BAiBC;IACD;;;;;;OAMG;IACH;;;sBAiBC;IACD;;;;;OAKG;IACH;;;;;;qBAwBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {MediaStream} stream
|
|
3
|
+
* @param {HTMLCanvasElement} canvas
|
|
4
|
+
* @see Adapted from {@link https://mdn.github.io/dom-examples/media/web-dictaphone/}
|
|
5
|
+
* @returns {void}
|
|
6
|
+
*/
|
|
7
|
+
export function visualize(stream: MediaStream, canvas: HTMLCanvasElement): void;
|
|
8
|
+
/**
|
|
9
|
+
* @param {MediaStreamConstraints} constraints
|
|
10
|
+
* @returns {Promise<MediaStream|null>}
|
|
11
|
+
*/
|
|
12
|
+
export function getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream | null>;
|
|
13
|
+
/**
|
|
14
|
+
* @param {DisplayMediaStreamOptions|undefined} displayMediaOptions
|
|
15
|
+
* @returns {Promise<MediaStream|null>}
|
|
16
|
+
*/
|
|
17
|
+
export function startScreenCapture(displayMediaOptions: DisplayMediaStreamOptions | undefined): Promise<MediaStream | null>;
|
|
18
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/utils/media.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,kCALW,WAAW,UACX,iBAAiB,GAEf,IAAI,CA4DhB;AAGD;;;GAGG;AACH,0CAHW,sBAAsB,GACpB,QAAQ,WAAW,GAAC,IAAI,CAAC,CAYrC;AAED;;;GAGG;AACH,wDAHW,yBAAyB,GAAC,SAAS,GACjC,QAAQ,WAAW,GAAC,IAAI,CAAC,CAarC"}
|
package/package.json
CHANGED
|
@@ -68,7 +68,7 @@ const encapsulateObserver = (stateObj) => {
|
|
|
68
68
|
if (cyclic === 'readonly' && !Array.isArray(observerObj.value)) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
if (cyclic === 'readonly' && type === 'set') {
|
|
71
|
+
if (cyclic === 'readonly' && (type === 'set' || type === 'filelist')) {
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
if (endIterateIn || endIterateOwn) {
|
|
@@ -419,6 +419,9 @@ const structuredCloning = {
|
|
|
419
419
|
if (state === 'errorsArray') {
|
|
420
420
|
return ['error', 'errors'];
|
|
421
421
|
}
|
|
422
|
+
if (state === 'filelistArray') {
|
|
423
|
+
return ['file'];
|
|
424
|
+
}
|
|
422
425
|
return this.types();
|
|
423
426
|
/*
|
|
424
427
|
// Todo (low): These need to specify their own inner contexts
|
|
@@ -458,11 +461,18 @@ const structuredCloning = {
|
|
|
458
461
|
'blob',
|
|
459
462
|
'file',
|
|
460
463
|
'set',
|
|
461
|
-
'map'
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
464
|
+
'map',
|
|
465
|
+
'filelist',
|
|
466
|
+
'domexception',
|
|
467
|
+
'domrect',
|
|
468
|
+
'dompoint',
|
|
469
|
+
'dommatrix'
|
|
470
|
+
|
|
471
|
+
// Ok, but will need some work and/or decisions on how to present:
|
|
472
|
+
// 'cryptokey',
|
|
473
|
+
|
|
474
|
+
// 'arraybuffer',
|
|
475
|
+
// 'dataview', 'imagedata', 'imagebitmap',
|
|
466
476
|
/*
|
|
467
477
|
// Typed Arrays
|
|
468
478
|
'int8array',
|
|
@@ -6,6 +6,7 @@ import dialogs from '../utils/dialogs.js';
|
|
|
6
6
|
import {
|
|
7
7
|
resolveJSONPointer, getJSONPointerParts, reduceJSONPointerParts
|
|
8
8
|
} from '../utils/jsonPointer.js';
|
|
9
|
+
import FileList from '../utils/FileList.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @typedef {number} Integer
|
|
@@ -177,7 +178,9 @@ const arrayType = {
|
|
|
177
178
|
? new Set(retObj)
|
|
178
179
|
: this.map
|
|
179
180
|
? new Map(/** @type {Array<any>} */ (retObj))
|
|
180
|
-
:
|
|
181
|
+
: this.filelist
|
|
182
|
+
? new FileList(retObj)
|
|
183
|
+
: retObj,
|
|
181
184
|
remnant: stringVal
|
|
182
185
|
};
|
|
183
186
|
}
|
|
@@ -330,14 +333,16 @@ const arrayType = {
|
|
|
330
333
|
}
|
|
331
334
|
);
|
|
332
335
|
}
|
|
333
|
-
return this.
|
|
334
|
-
? new
|
|
335
|
-
: this.
|
|
336
|
-
? new
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
336
|
+
return this.filelist
|
|
337
|
+
? new FileList(ret)
|
|
338
|
+
: this.set && Array.isArray(ret)
|
|
339
|
+
? new Set(ret)
|
|
340
|
+
: this.map
|
|
341
|
+
? new Map(arrayItems.$getMapKeySelects().map((select, idx) => {
|
|
342
|
+
const key = select.$getValue();
|
|
343
|
+
return [key, /** @type {any[]} */ (ret)[idx]];
|
|
344
|
+
}))
|
|
345
|
+
: ret;
|
|
341
346
|
},
|
|
342
347
|
|
|
343
348
|
// Try to keep in sync with basic structure of `editUI`
|
|
@@ -508,11 +513,13 @@ const arrayType = {
|
|
|
508
513
|
['div', {class: 'arrayContents'}, [
|
|
509
514
|
this.array
|
|
510
515
|
? ['div', [
|
|
511
|
-
type === '
|
|
512
|
-
? '
|
|
513
|
-
: type === '
|
|
514
|
-
? '
|
|
515
|
-
:
|
|
516
|
+
type === 'filelist'
|
|
517
|
+
? 'FileList length: '
|
|
518
|
+
: type === 'set'
|
|
519
|
+
? 'Set size: '
|
|
520
|
+
: type === 'map'
|
|
521
|
+
? 'Map size: '
|
|
522
|
+
: 'Array length: ',
|
|
516
523
|
['span', [
|
|
517
524
|
(value && (type === 'set' || type === 'map')
|
|
518
525
|
? value.size
|
|
@@ -545,7 +552,7 @@ const arrayType = {
|
|
|
545
552
|
const itemAdjust = type === 'object' ? 1 : 0;
|
|
546
553
|
let itemIndex = itemAdjust - 1;
|
|
547
554
|
const editableProperties = type !== 'array' &&
|
|
548
|
-
type !== 'set' && type !== 'map';
|
|
555
|
+
type !== 'set' && type !== 'map' && type !== 'filelist';
|
|
549
556
|
const mapProperties = type === 'map';
|
|
550
557
|
|
|
551
558
|
/**
|
|
@@ -1223,7 +1230,9 @@ const arrayType = {
|
|
|
1223
1230
|
topRoot: /** @type {HTMLDivElement} */ (topRoot),
|
|
1224
1231
|
// eslint-disable-next-line object-shorthand, @stylistic/max-len -- TS
|
|
1225
1232
|
format: /** @type {import('../formats.js').AvailableFormat} */ (format),
|
|
1226
|
-
state:
|
|
1233
|
+
state: parentTypeObject.filelist
|
|
1234
|
+
? 'filelistArray'
|
|
1235
|
+
: arrayState ?? type,
|
|
1227
1236
|
// itemIndex,
|
|
1228
1237
|
typeNamespace
|
|
1229
1238
|
}).domArray),
|
|
@@ -1588,7 +1597,8 @@ const arrayType = {
|
|
|
1588
1597
|
|
|
1589
1598
|
const parentType = type;
|
|
1590
1599
|
|
|
1591
|
-
|
|
1600
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
1601
|
+
const div = /** @type {HTMLDivElement & {$addAndSetArrayElement: import('../formats/structuredCloning.js').AddAndSetArrayElement}} */ (
|
|
1592
1602
|
jml('div', /** @type {import('jamilih').JamilihAttributes} */ ({
|
|
1593
1603
|
dataset: {type},
|
|
1594
1604
|
// is: 'array-or-object-editor',
|
|
@@ -1629,7 +1639,7 @@ const arrayType = {
|
|
|
1629
1639
|
// If run for all, causes problems with running `Error.cause`
|
|
1630
1640
|
// type twice and is inefficient;
|
|
1631
1641
|
// currently put behind `setAValue` as we need to set a value
|
|
1632
|
-
// from `errorsSpecialType`
|
|
1642
|
+
// from `errorsSpecialType` (and `filelistType`)
|
|
1633
1643
|
if (setAValue) {
|
|
1634
1644
|
const typeObj = /** @type {import('../types.js').TypeObject} */ (
|
|
1635
1645
|
Types.availableTypes[type]
|
|
@@ -1704,6 +1714,35 @@ const arrayType = {
|
|
|
1704
1714
|
/** @type {import('../types.js').AvailableType} */
|
|
1705
1715
|
(type)
|
|
1706
1716
|
).replace(/s$/u, ''), nbsp.repeat(2),
|
|
1717
|
+
type === 'filelist'
|
|
1718
|
+
? ['input', {
|
|
1719
|
+
name: typeNamespace + '-filelist',
|
|
1720
|
+
multiple: true,
|
|
1721
|
+
type: 'file',
|
|
1722
|
+
$on: {
|
|
1723
|
+
/**
|
|
1724
|
+
* @this {HTMLInputElement}
|
|
1725
|
+
*/
|
|
1726
|
+
change () {
|
|
1727
|
+
/* c8 ignore next 3 */
|
|
1728
|
+
if (!this.files) {
|
|
1729
|
+
return;
|
|
1730
|
+
}
|
|
1731
|
+
for (let i = 0; i < this.files.length; i++) {
|
|
1732
|
+
const file = this.files.item(i);
|
|
1733
|
+
|
|
1734
|
+
div.$addAndSetArrayElement({
|
|
1735
|
+
propName: String(i),
|
|
1736
|
+
type: 'file',
|
|
1737
|
+
value: file,
|
|
1738
|
+
bringIntoFocus: false,
|
|
1739
|
+
setAValue: true
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}]
|
|
1745
|
+
: '',
|
|
1707
1746
|
minusButton,
|
|
1708
1747
|
arrayContents
|
|
1709
1748
|
]))
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {$e} from '../utils/templateUtils.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @type {import('../types.js').TypeObject}
|
|
5
|
+
*/
|
|
6
|
+
const domexceptionType = {
|
|
7
|
+
option: ['DOMException'],
|
|
8
|
+
stringRegex: /^DOMException\((.*)\)$/u,
|
|
9
|
+
toValue (s) {
|
|
10
|
+
const {message, name} = JSON.parse(s);
|
|
11
|
+
return {value: new DOMException(message, name)};
|
|
12
|
+
},
|
|
13
|
+
getInput ({root}) {
|
|
14
|
+
return /** @type {HTMLInputElement} */ ($e(root, 'input'));
|
|
15
|
+
},
|
|
16
|
+
setValue ({root, value}) {
|
|
17
|
+
/** @type {HTMLInputElement} */ (
|
|
18
|
+
$e(root, '.message')
|
|
19
|
+
).value = value.message;
|
|
20
|
+
/** @type {HTMLInputElement} */ (
|
|
21
|
+
$e(root, '.name')
|
|
22
|
+
).value = value.name;
|
|
23
|
+
},
|
|
24
|
+
getValue ({root}) {
|
|
25
|
+
const message = /** @type {HTMLInputElement} */ (
|
|
26
|
+
$e(root, '.message')
|
|
27
|
+
).value;
|
|
28
|
+
const name = /** @type {HTMLInputElement} */ (
|
|
29
|
+
$e(root, '.name')
|
|
30
|
+
).value;
|
|
31
|
+
return new DOMException(message, name);
|
|
32
|
+
},
|
|
33
|
+
viewUI ({value}) {
|
|
34
|
+
return ['div', {dataset: {type: 'domexception'}}, [
|
|
35
|
+
['b', ['Message ']],
|
|
36
|
+
value.message,
|
|
37
|
+
['br'],
|
|
38
|
+
['b', ['Name ']],
|
|
39
|
+
value.name,
|
|
40
|
+
['br'],
|
|
41
|
+
['b', ['Code ']],
|
|
42
|
+
value.code
|
|
43
|
+
]];
|
|
44
|
+
},
|
|
45
|
+
editUI ({typeNamespace, value = ''}) {
|
|
46
|
+
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
47
|
+
return ['div', {dataset: {type: 'domexception'}}, /** @type {import('jamilih').JamilihChildren} */ ([
|
|
48
|
+
['label', [
|
|
49
|
+
'Name: ',
|
|
50
|
+
['input', {
|
|
51
|
+
class: 'name',
|
|
52
|
+
name: `${typeNamespace}-domexception-name`, value
|
|
53
|
+
}]
|
|
54
|
+
]],
|
|
55
|
+
' ',
|
|
56
|
+
['select', {
|
|
57
|
+
class: 'predefinedNames',
|
|
58
|
+
$on: {
|
|
59
|
+
/**
|
|
60
|
+
* @this {HTMLSelectElement}
|
|
61
|
+
*/
|
|
62
|
+
change () {
|
|
63
|
+
/** @type {HTMLInputElement} */
|
|
64
|
+
($e(
|
|
65
|
+
/** @type {HTMLLabelElement} */ (
|
|
66
|
+
this.previousElementSibling
|
|
67
|
+
),
|
|
68
|
+
'.name'
|
|
69
|
+
)).value = this.value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, [
|
|
73
|
+
['option', {value: ''}, [
|
|
74
|
+
'(Choose an optional predefined name)'
|
|
75
|
+
]],
|
|
76
|
+
...[
|
|
77
|
+
'IndexSizeError',
|
|
78
|
+
'HierarchyRequestError',
|
|
79
|
+
'WrongDocumentError',
|
|
80
|
+
'InvalidCharacterError',
|
|
81
|
+
'NoModificationAllowedError',
|
|
82
|
+
'NotFoundError',
|
|
83
|
+
'NotSupportedError',
|
|
84
|
+
'InvalidStateError',
|
|
85
|
+
'InUseAttributeError',
|
|
86
|
+
'SyntaxError',
|
|
87
|
+
'InvalidModificationError',
|
|
88
|
+
'NamespaceError',
|
|
89
|
+
'InvalidAccessError',
|
|
90
|
+
'TypeMismatchError',
|
|
91
|
+
'SecurityError',
|
|
92
|
+
'NetworkError',
|
|
93
|
+
'AbortError',
|
|
94
|
+
'URLMismatchError',
|
|
95
|
+
'QuotaExceededError',
|
|
96
|
+
'TimeoutError',
|
|
97
|
+
'InvalidNodeTypeError',
|
|
98
|
+
'DataCloneError',
|
|
99
|
+
'EncodingError',
|
|
100
|
+
'NotReadableError',
|
|
101
|
+
'UnknownError',
|
|
102
|
+
'ConstraintError',
|
|
103
|
+
'DataError',
|
|
104
|
+
'TransactionInactiveError',
|
|
105
|
+
'ReadOnlyErrorVersionError',
|
|
106
|
+
'OperationError',
|
|
107
|
+
'NotAllowedError'
|
|
108
|
+
].map((name) => {
|
|
109
|
+
return ['option', [name]];
|
|
110
|
+
})
|
|
111
|
+
]],
|
|
112
|
+
['br'],
|
|
113
|
+
['label', [
|
|
114
|
+
'Message: ',
|
|
115
|
+
['input', {
|
|
116
|
+
class: 'message',
|
|
117
|
+
name: `${typeNamespace}-domexception-message`, value
|
|
118
|
+
}]
|
|
119
|
+
]]
|
|
120
|
+
])];
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export default domexceptionType;
|