@es-joy/jsoe 0.8.1 → 0.10.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 +3 -0
- package/.nyc_output/out.json +14319 -8379
- package/CHANGES.md +8 -0
- package/README.md +9 -3
- package/demo/index.js +17 -3
- 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 +25 -16
- package/src/fundamentalTypes/arrayType.js +57 -18
- package/src/fundamentalTypes/blobType.js +1001 -0
- package/src/fundamentalTypes/fileType.js +1 -101
- package/src/fundamentalTypes/filelistType.js +35 -0
- package/src/jsoe.css +8 -0
- package/src/types.js +9 -6
- package/src/utils/FileList.js +32 -0
- package/src/utils/media.js +103 -0
package/CHANGES.md
CHANGED
package/README.md
CHANGED
|
@@ -27,12 +27,14 @@ Supported types include:
|
|
|
27
27
|
- Array reference (for cyclic arrays)
|
|
28
28
|
- Array
|
|
29
29
|
- `BigInt`
|
|
30
|
+
- `Blob`
|
|
30
31
|
- `Boolean` object
|
|
31
32
|
- `Date`
|
|
32
33
|
- `Error`
|
|
33
34
|
- `TypeError`, `RangeError`, `SyntaxError`, `ReferenceError`, `EvalError`,
|
|
34
35
|
`URIError`, `AggregateError`, `InternalError`
|
|
35
36
|
- `File`
|
|
37
|
+
- `FileList`
|
|
36
38
|
- `Map`
|
|
37
39
|
- `null`
|
|
38
40
|
- `Number` object
|
|
@@ -103,14 +105,18 @@ Supported supertypes include:
|
|
|
103
105
|
1. bigint64arrayconstructor
|
|
104
106
|
1. biguint64arrayconstructor
|
|
105
107
|
1. Web/API types
|
|
106
|
-
1. blob (besides HTML, including SVG), filelist
|
|
107
108
|
1. imagedata, imagebitmap
|
|
108
|
-
|
|
109
|
+
1. cryptokey
|
|
110
|
+
1. domexception
|
|
111
|
+
1. domrect
|
|
112
|
+
1. dompoint
|
|
113
|
+
1. dommatrix
|
|
114
|
+
1. Our own custom derivative types? (e.g., MIDI using TypedArray)
|
|
109
115
|
1. Expand subtypes
|
|
110
116
|
1. String
|
|
111
117
|
1. As supported by Zod, JSON Schema, etc. (e.g., email addresses as
|
|
112
118
|
subtype of `string`, color as a subtype of string)
|
|
113
|
-
1. `File`
|
|
119
|
+
1. `File`/`Blob`
|
|
114
120
|
1. Drawing image for `image/png`, etc. `File`'s
|
|
115
121
|
1. Drawing SVG program for `application/svg` `File`
|
|
116
122
|
1. JS/CSS/HTML/XML/Markdown/JSON/CSV/text text editor (including
|
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,
|
|
@@ -337,12 +338,15 @@ setTimeout(async function () {
|
|
|
337
338
|
new File(['abc'], 'someName', {
|
|
338
339
|
lastModified: 1231231230,
|
|
339
340
|
type: 'text/plain'
|
|
341
|
+
}),
|
|
342
|
+
new Blob(['abc'], {
|
|
343
|
+
type: 'text/plain'
|
|
340
344
|
})
|
|
341
345
|
],
|
|
342
346
|
typeNamespace: 'demo-type-choices-only-initial-value'
|
|
343
347
|
});
|
|
344
348
|
|
|
345
|
-
const
|
|
349
|
+
const typeSelectionBlobHTML = typeChoices({
|
|
346
350
|
format: 'structuredCloning',
|
|
347
351
|
setValue: true,
|
|
348
352
|
value: new Blob(['<b>Testing</b>'], {type: 'text/html'}),
|
|
@@ -399,14 +403,24 @@ setTimeout(async function () {
|
|
|
399
403
|
typeNamespace: 'demo-type-choices-only-initial-value'
|
|
400
404
|
});
|
|
401
405
|
|
|
406
|
+
const typeSelectionBlob = typeChoices({
|
|
407
|
+
format: 'structuredCloning',
|
|
408
|
+
setValue: true,
|
|
409
|
+
value: new Blob(['abc'], {
|
|
410
|
+
type: 'text/plain'
|
|
411
|
+
}),
|
|
412
|
+
typeNamespace: 'demo-type-choices-only-initial-value'
|
|
413
|
+
});
|
|
414
|
+
|
|
402
415
|
return ['form', [
|
|
403
416
|
...typeSelection.domArray,
|
|
404
|
-
...
|
|
417
|
+
...typeSelectionBlobHTML.domArray,
|
|
405
418
|
...typeSelectionErrorWithCause.domArray,
|
|
406
419
|
...typeSelectionIndexedDBKey.domArray,
|
|
407
420
|
...typeSelectionTypeErrorWithCause.domArray,
|
|
408
421
|
...typeSelectionTypeErrorWithAggregate.domArray,
|
|
409
|
-
...typeSelectionFile.domArray
|
|
422
|
+
...typeSelectionFile.domArray,
|
|
423
|
+
...typeSelectionBlob.domArray
|
|
410
424
|
]];
|
|
411
425
|
})(),
|
|
412
426
|
|
|
@@ -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;iDAKX,MAAM,iCAEJ,aAAa,EAAE,GAAC,SAAS;sCAK3B,aAAa,KACX,CAAC,MAAM,EAAE;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;uDAKlD,MAAM,uCAEJ,CAAC,MAAM,EAAE;IAAC,KAAK,EAAE,aAAa,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,EAAE;wCAK5C;IAClB,QAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAc,CAAC,EA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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) {
|
|
@@ -337,15 +337,7 @@ const canonicalToAvailableType = (format, state, valType, v) => {
|
|
|
337
337
|
valType = newValType;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
|
|
341
|
-
if (allowableType === valType) {
|
|
342
|
-
ret = allowableType;
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
return false;
|
|
346
|
-
})) {
|
|
347
|
-
return /** @type {import('../types.js').AvailableType} */ (ret);
|
|
348
|
-
}
|
|
340
|
+
|
|
349
341
|
// console.log('ret', ret);
|
|
350
342
|
allowableTypes.some((allowableType) => {
|
|
351
343
|
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
@@ -364,6 +356,11 @@ const canonicalToAvailableType = (format, state, valType, v) => {
|
|
|
364
356
|
ret = allowableType;
|
|
365
357
|
return true;
|
|
366
358
|
}
|
|
359
|
+
if (allowableType === valType) {
|
|
360
|
+
ret = allowableType;
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
|
|
367
364
|
return false;
|
|
368
365
|
});
|
|
369
366
|
// console.log('ret2', ret);
|
|
@@ -422,6 +419,9 @@ const structuredCloning = {
|
|
|
422
419
|
if (state === 'errorsArray') {
|
|
423
420
|
return ['error', 'errors'];
|
|
424
421
|
}
|
|
422
|
+
if (state === 'filelistArray') {
|
|
423
|
+
return ['file'];
|
|
424
|
+
}
|
|
425
425
|
return this.types();
|
|
426
426
|
/*
|
|
427
427
|
// Todo (low): These need to specify their own inner contexts
|
|
@@ -457,14 +457,23 @@ const structuredCloning = {
|
|
|
457
457
|
'StringObject',
|
|
458
458
|
'error',
|
|
459
459
|
'errors',
|
|
460
|
-
'blobHTML',
|
|
460
|
+
'blobHTML', // Must come before `blob`
|
|
461
|
+
'blob',
|
|
461
462
|
'file',
|
|
462
463
|
'set',
|
|
463
|
-
'map'
|
|
464
|
-
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
//
|
|
464
|
+
'map',
|
|
465
|
+
'filelist'
|
|
466
|
+
// Ok:
|
|
467
|
+
// 'domexception',
|
|
468
|
+
// 'domrect',
|
|
469
|
+
// 'dompoint',
|
|
470
|
+
// 'dommatrix',
|
|
471
|
+
|
|
472
|
+
// Ok, but will need some work and/or decisions on how to present:
|
|
473
|
+
// 'cryptokey',
|
|
474
|
+
|
|
475
|
+
// 'arraybuffer',
|
|
476
|
+
// 'dataview', 'imagedata', 'imagebitmap',
|
|
468
477
|
/*
|
|
469
478
|
// Typed Arrays
|
|
470
479
|
'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
|
]))
|