@es-joy/jsoe 0.13.8 → 0.15.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 +7 -0
- package/.nyc_output/out.json +20068 -11970
- package/CHANGES.md +10 -0
- package/README.md +10 -21
- package/demo/index.js +79 -2
- package/dist/formats/indexedDBKey.d.ts.map +1 -1
- package/dist/formats/structuredCloning.d.ts.map +1 -1
- package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
- package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
- package/dist/fundamentalTypes/filelistType.d.ts.map +1 -1
- package/dist/fundamentalTypes/mapType.d.ts.map +1 -1
- package/dist/fundamentalTypes/noneditableType.d.ts +6 -0
- package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -0
- package/dist/fundamentalTypes/objectReferenceType.d.ts.map +1 -1
- package/dist/fundamentalTypes/objectType.d.ts.map +1 -1
- package/dist/fundamentalTypes/setType.d.ts.map +1 -1
- package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -1
- package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
- package/dist/index.js +1980 -237
- package/dist/superTypes/SpecialNumberType.d.ts +2 -10
- package/dist/superTypes/SpecialNumberType.d.ts.map +1 -1
- package/dist/superTypes/SpecialRealNumberType.d.ts +2 -2
- package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
- package/dist/superTypes/buffersourceType.d.ts +8 -0
- package/dist/superTypes/buffersourceType.d.ts.map +1 -0
- package/dist/superTypes/dommatrixType.d.ts +6 -0
- package/dist/superTypes/dommatrixType.d.ts.map +1 -0
- package/dist/superTypes/dompointType.d.ts +6 -0
- package/dist/superTypes/dompointType.d.ts.map +1 -0
- package/dist/superTypes/domrectType.d.ts +6 -0
- package/dist/superTypes/domrectType.d.ts.map +1 -0
- package/dist/superTypes/errorsSpecialType.d.ts +2 -2
- package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
- package/dist/types.d.ts +29 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/media.d.ts.map +1 -1
- package/dist/vendor-imports.d.ts +1 -1
- package/package.json +13 -13
- package/src/formats/indexedDBKey.js +2 -3
- package/src/formats/structuredCloning.js +37 -20
- package/src/fundamentalTypes/BooleanObjectType.js +3 -1
- package/src/fundamentalTypes/NumberObjectType.js +3 -1
- package/src/fundamentalTypes/StringObjectType.js +3 -1
- package/src/fundamentalTypes/arrayType.js +4 -2
- package/src/fundamentalTypes/blobType.js +17 -13
- package/src/fundamentalTypes/dateType.js +6 -2
- package/src/fundamentalTypes/fileType.js +14 -12
- package/src/fundamentalTypes/filelistType.js +3 -1
- package/src/fundamentalTypes/mapType.js +3 -1
- package/src/fundamentalTypes/noneditableType.js +87 -0
- package/src/fundamentalTypes/objectReferenceType.js +3 -1
- package/src/fundamentalTypes/objectType.js +3 -1
- package/src/fundamentalTypes/setType.js +3 -1
- package/src/fundamentalTypes/sparseUndefinedType.js +3 -1
- package/src/fundamentalTypes/undefinedType.js +3 -1
- package/src/jsoe.css +64 -0
- package/src/subTypes/blobHTMLType.js +1 -1
- package/src/superTypes/SpecialNumberType.js +2 -8
- package/src/superTypes/SpecialRealNumberType.js +2 -2
- package/src/superTypes/buffersourceType.js +1455 -0
- package/src/{fundamentalTypes → superTypes}/dommatrixType.js +63 -10
- package/src/{fundamentalTypes → superTypes}/dompointType.js +60 -7
- package/src/{fundamentalTypes → superTypes}/domrectType.js +59 -7
- package/src/superTypes/errorsSpecialType.js +1 -1
- package/src/types.js +39 -22
- package/src/utils/media.js +3 -2
- package/src/vendor-imports.js +2 -1
- package/vendor/typeson-registry/dist/index.js +90 -28
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
import {$e} from '../utils/templateUtils.js';
|
|
2
|
+
import {toStringTag} from '../vendor-imports.js';
|
|
2
3
|
|
|
3
4
|
let idx = 0;
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* @type {import('../types.js').
|
|
7
|
+
* @type {import('../types.js').SuperTypeObject}
|
|
7
8
|
*/
|
|
8
9
|
const dommatrixType = {
|
|
9
10
|
option: ['DOMMatrix'],
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
childTypes: ['dommatrixreadonly'],
|
|
12
|
+
stringRegex: /^(?<domMatrixClass>DOMMatrix|DOMMatrixReadOnly)\((?<innerContent>.*)\)$/u,
|
|
13
|
+
toValue (s, rootInfo) {
|
|
14
|
+
const {groups: {
|
|
15
|
+
domMatrixClass
|
|
16
|
+
/* istanbul ignore next -- Should always be found */
|
|
17
|
+
} = {}} = /** @type {RegExpMatchArray} */ (
|
|
18
|
+
/** @type {import('../types.js').RootInfo} */ (rootInfo).match
|
|
19
|
+
);
|
|
12
20
|
const o = JSON.parse(s);
|
|
13
21
|
|
|
22
|
+
const DOMMatrixClass = domMatrixClass === 'DOMMatrix'
|
|
23
|
+
? DOMMatrix
|
|
24
|
+
: DOMMatrixReadOnly;
|
|
25
|
+
|
|
14
26
|
const dommatrix = Object.hasOwn(o, 'a')
|
|
15
|
-
? new
|
|
16
|
-
: new
|
|
27
|
+
? new DOMMatrixClass([o.a, o.b, o.c, o.d, o.e, o.f])
|
|
28
|
+
: new DOMMatrixClass([
|
|
17
29
|
o.m11, o.m12, o.m13, o.m14,
|
|
18
30
|
o.m21, o.m22, o.m23, o.m24,
|
|
19
31
|
o.m31, o.m32, o.m33, o.m34,
|
|
@@ -23,7 +35,7 @@ const dommatrixType = {
|
|
|
23
35
|
return {value: dommatrix};
|
|
24
36
|
},
|
|
25
37
|
getInput ({root}) {
|
|
26
|
-
return /** @type {HTMLInputElement} */ ($e(root, 'input'));
|
|
38
|
+
return /** @type {HTMLInputElement} */ ($e(root, 'input:not([type])'));
|
|
27
39
|
},
|
|
28
40
|
setValue ({root, value: o}) {
|
|
29
41
|
const {is2D} = o;
|
|
@@ -109,8 +121,23 @@ const dommatrixType = {
|
|
|
109
121
|
$e(root, '.m44')
|
|
110
122
|
).value = o.m44;
|
|
111
123
|
}
|
|
124
|
+
|
|
125
|
+
if (toStringTag(o) === 'DOMMatrix') {
|
|
126
|
+
/** @type {HTMLInputElement} */ (
|
|
127
|
+
$e(root, '.dommatrix-readonly-readwrite')
|
|
128
|
+
).checked = true;
|
|
129
|
+
} else {
|
|
130
|
+
/** @type {HTMLInputElement} */ (
|
|
131
|
+
$e(root, '.dommatrix-readonly-readonly')
|
|
132
|
+
).checked = true;
|
|
133
|
+
}
|
|
112
134
|
},
|
|
113
135
|
getValue ({root}) {
|
|
136
|
+
const isReadWrite = /** @type {HTMLInputElement} */ (
|
|
137
|
+
$e(root, '.dommatrix-readonly-readwrite')
|
|
138
|
+
).checked;
|
|
139
|
+
const DOMMatrixClass = isReadWrite ? DOMMatrix : DOMMatrixReadOnly;
|
|
140
|
+
|
|
114
141
|
const aType = /** @type {HTMLInputElement} */ (
|
|
115
142
|
$e(root, '.a')
|
|
116
143
|
).value;
|
|
@@ -132,7 +159,7 @@ const dommatrixType = {
|
|
|
132
159
|
const f = Number(/** @type {HTMLInputElement} */ (
|
|
133
160
|
$e(root, '.f')
|
|
134
161
|
).value);
|
|
135
|
-
return new
|
|
162
|
+
return new DOMMatrixClass([a, b, c, d, e, f]);
|
|
136
163
|
}
|
|
137
164
|
|
|
138
165
|
const m11 = Number(/** @type {HTMLInputElement} */ (
|
|
@@ -187,7 +214,7 @@ const dommatrixType = {
|
|
|
187
214
|
$e(root, '.m44')
|
|
188
215
|
).value);
|
|
189
216
|
|
|
190
|
-
return new
|
|
217
|
+
return new DOMMatrixClass([
|
|
191
218
|
m11, m12, m13, m14,
|
|
192
219
|
m21, m22, m23, m24,
|
|
193
220
|
m31, m32, m33, m34,
|
|
@@ -195,8 +222,11 @@ const dommatrixType = {
|
|
|
195
222
|
]);
|
|
196
223
|
},
|
|
197
224
|
viewUI ({value}) {
|
|
225
|
+
const isReadWrite = toStringTag(value) === 'DOMMatrix';
|
|
198
226
|
return ['div', {dataset: {type: 'dommatrix'}}, [
|
|
199
|
-
['b', {class: 'emphasis'}, [
|
|
227
|
+
['b', {class: 'emphasis'}, [
|
|
228
|
+
isReadWrite ? 'DOMMatrix' : 'DOMMatrixReadOnly'
|
|
229
|
+
]],
|
|
200
230
|
value.is2D
|
|
201
231
|
? ['div', [
|
|
202
232
|
['b', ['a ']],
|
|
@@ -276,11 +306,34 @@ const dommatrixType = {
|
|
|
276
306
|
const {is2D} = value;
|
|
277
307
|
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
278
308
|
return ['div', {dataset: {type: 'dommatrix'}}, /** @type {import('jamilih').JamilihChildren} */ ([
|
|
309
|
+
['div', [
|
|
310
|
+
['label', [
|
|
311
|
+
['input', {
|
|
312
|
+
type: 'radio',
|
|
313
|
+
class: 'dommatrix-readonly-readwrite',
|
|
314
|
+
name: `${typeNamespace}-dommatrix-readonly-${idx}`,
|
|
315
|
+
value: 'readwrite',
|
|
316
|
+
checked: toStringTag(value) !== 'DOMMatrixReadOnly'
|
|
317
|
+
}],
|
|
318
|
+
'Readwrite'
|
|
319
|
+
]],
|
|
320
|
+
' ',
|
|
321
|
+
['label', [
|
|
322
|
+
['input', {
|
|
323
|
+
type: 'radio',
|
|
324
|
+
class: 'dommatrix-readonly-readonly',
|
|
325
|
+
name: `${typeNamespace}-dommatrix-readonly-${idx}`,
|
|
326
|
+
value: 'readonly',
|
|
327
|
+
checked: toStringTag(value) === 'DOMMatrixReadOnly'
|
|
328
|
+
}],
|
|
329
|
+
'Read-only'
|
|
330
|
+
]]
|
|
331
|
+
]],
|
|
279
332
|
['div', {
|
|
280
333
|
$on: {
|
|
281
334
|
click (e) {
|
|
282
335
|
const {target} = e;
|
|
283
|
-
/*
|
|
336
|
+
/* istanbul ignore if */
|
|
284
337
|
if (/** @type {HTMLInputElement} */ (target).type !== 'radio') {
|
|
285
338
|
return;
|
|
286
339
|
}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import {$e} from '../utils/templateUtils.js';
|
|
2
|
+
import {toStringTag} from '../vendor-imports.js';
|
|
3
|
+
|
|
4
|
+
let idx = 0;
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
|
-
* @type {import('../types.js').
|
|
7
|
+
* @type {import('../types.js').SuperTypeObject}
|
|
5
8
|
*/
|
|
6
9
|
const dompointType = {
|
|
7
10
|
option: ['DOMPoint'],
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
childTypes: ['dompointreadonly'],
|
|
12
|
+
stringRegex: /^(?<domPointClass>DOMPoint|DOMPointReadOnly)\((?<innerContent>.*)\)$/u,
|
|
13
|
+
toValue (s, rootInfo) {
|
|
14
|
+
const {groups: {
|
|
15
|
+
domPointClass
|
|
16
|
+
/* istanbul ignore next -- Should always be found */
|
|
17
|
+
} = {}} = /** @type {RegExpMatchArray} */ (
|
|
18
|
+
/** @type {import('../types.js').RootInfo} */ (rootInfo).match
|
|
19
|
+
);
|
|
10
20
|
const {x, y, z, w} = JSON.parse(s);
|
|
11
|
-
return {value: new
|
|
21
|
+
return {value: new (
|
|
22
|
+
domPointClass === 'DOMPoint' ? DOMPoint : DOMPointReadOnly
|
|
23
|
+
)(x, y, z, w)};
|
|
12
24
|
},
|
|
13
25
|
getInput ({root}) {
|
|
14
|
-
return /** @type {HTMLInputElement} */ ($e(root, 'input'));
|
|
26
|
+
return /** @type {HTMLInputElement} */ ($e(root, 'input:not([type])'));
|
|
15
27
|
},
|
|
16
28
|
setValue ({root, value}) {
|
|
17
29
|
/** @type {HTMLInputElement} */ (
|
|
@@ -26,6 +38,16 @@ const dompointType = {
|
|
|
26
38
|
/** @type {HTMLInputElement} */ (
|
|
27
39
|
$e(root, '.w')
|
|
28
40
|
).value = String(value.w);
|
|
41
|
+
|
|
42
|
+
if (toStringTag(value) === 'DOMPoint') {
|
|
43
|
+
/** @type {HTMLInputElement} */ (
|
|
44
|
+
$e(root, '.dompoint-readonly-readwrite')
|
|
45
|
+
).checked = true;
|
|
46
|
+
} else {
|
|
47
|
+
/** @type {HTMLInputElement} */ (
|
|
48
|
+
$e(root, '.dompoint-readonly-readonly')
|
|
49
|
+
).checked = true;
|
|
50
|
+
}
|
|
29
51
|
},
|
|
30
52
|
getValue ({root}) {
|
|
31
53
|
const x = Number(/** @type {HTMLInputElement} */ (
|
|
@@ -40,11 +62,18 @@ const dompointType = {
|
|
|
40
62
|
const w = Number(/** @type {HTMLInputElement} */ (
|
|
41
63
|
$e(root, '.w')
|
|
42
64
|
).value);
|
|
43
|
-
|
|
65
|
+
|
|
66
|
+
const isReadWrite = /** @type {HTMLInputElement} */ (
|
|
67
|
+
$e(root, '.dompoint-readonly-readwrite')
|
|
68
|
+
).checked;
|
|
69
|
+
return new (isReadWrite ? DOMPoint : DOMPointReadOnly)(x, y, z, w);
|
|
44
70
|
},
|
|
45
71
|
viewUI ({value}) {
|
|
72
|
+
const isReadWrite = toStringTag(value) === 'DOMPoint';
|
|
46
73
|
return ['div', {dataset: {type: 'dompoint'}}, [
|
|
47
|
-
['b', {class: 'emphasis'}, [
|
|
74
|
+
['b', {class: 'emphasis'}, [
|
|
75
|
+
isReadWrite ? 'DOMPoint' : 'DOMPointReadOnly'
|
|
76
|
+
]],
|
|
48
77
|
['br'],
|
|
49
78
|
['b', ['x ']],
|
|
50
79
|
value.x,
|
|
@@ -65,8 +94,32 @@ const dompointType = {
|
|
|
65
94
|
z: '',
|
|
66
95
|
w: ''
|
|
67
96
|
}}) {
|
|
97
|
+
idx++;
|
|
68
98
|
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
69
99
|
return ['div', {dataset: {type: 'dompoint'}}, /** @type {import('jamilih').JamilihChildren} */ ([
|
|
100
|
+
['div', [
|
|
101
|
+
['label', [
|
|
102
|
+
['input', {
|
|
103
|
+
type: 'radio',
|
|
104
|
+
class: 'dompoint-readonly-readwrite',
|
|
105
|
+
name: `${typeNamespace}-dompoint-readonly-${idx}`,
|
|
106
|
+
value: 'readwrite',
|
|
107
|
+
checked: toStringTag(value) !== 'DOMPointReadOnly'
|
|
108
|
+
}],
|
|
109
|
+
'Readwrite'
|
|
110
|
+
]],
|
|
111
|
+
' ',
|
|
112
|
+
['label', [
|
|
113
|
+
['input', {
|
|
114
|
+
type: 'radio',
|
|
115
|
+
class: 'dompoint-readonly-readonly',
|
|
116
|
+
name: `${typeNamespace}-dompoint-readonly-${idx}`,
|
|
117
|
+
value: 'readonly',
|
|
118
|
+
checked: toStringTag(value) === 'DOMPointReadOnly'
|
|
119
|
+
}],
|
|
120
|
+
'Read-only'
|
|
121
|
+
]]
|
|
122
|
+
]],
|
|
70
123
|
['label', [
|
|
71
124
|
'x: ',
|
|
72
125
|
['input', {
|
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
import {$e} from '../utils/templateUtils.js';
|
|
2
|
+
import {toStringTag} from '../vendor-imports.js';
|
|
3
|
+
|
|
4
|
+
let idx = 0;
|
|
2
5
|
|
|
3
6
|
/**
|
|
4
|
-
* @type {import('../types.js').
|
|
7
|
+
* @type {import('../types.js').SuperTypeObject}
|
|
5
8
|
*/
|
|
6
9
|
const domrectType = {
|
|
7
10
|
option: ['DOMRect'],
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
childTypes: ['domrectreadonly'],
|
|
12
|
+
stringRegex: /^(?<domRectClass>DOMRect|DOMRectReadOnly)\((?<innerContent>.*)\)$/u,
|
|
13
|
+
toValue (s, rootInfo) {
|
|
14
|
+
const {groups: {
|
|
15
|
+
domRectClass
|
|
16
|
+
/* istanbul ignore next -- Should always be found */
|
|
17
|
+
} = {}} = /** @type {RegExpMatchArray} */ (
|
|
18
|
+
/** @type {import('../types.js').RootInfo} */ (rootInfo).match
|
|
19
|
+
);
|
|
10
20
|
const {x, y, width, height} = JSON.parse(s);
|
|
11
|
-
return {
|
|
21
|
+
return {
|
|
22
|
+
value: new (
|
|
23
|
+
domRectClass === 'DOMRect' ? DOMRect : DOMRectReadOnly
|
|
24
|
+
)(x, y, width, height)};
|
|
12
25
|
},
|
|
13
26
|
getInput ({root}) {
|
|
14
|
-
return /** @type {HTMLInputElement} */ ($e(root, 'input'));
|
|
27
|
+
return /** @type {HTMLInputElement} */ ($e(root, 'input:not([type])'));
|
|
15
28
|
},
|
|
16
29
|
setValue ({root, value}) {
|
|
17
30
|
/** @type {HTMLInputElement} */ (
|
|
@@ -26,6 +39,16 @@ const domrectType = {
|
|
|
26
39
|
/** @type {HTMLInputElement} */ (
|
|
27
40
|
$e(root, '.height')
|
|
28
41
|
).value = String(value.height);
|
|
42
|
+
|
|
43
|
+
if (toStringTag(value) === 'DOMRect') {
|
|
44
|
+
/** @type {HTMLInputElement} */ (
|
|
45
|
+
$e(root, '.domrect-readonly-readwrite')
|
|
46
|
+
).checked = true;
|
|
47
|
+
} else {
|
|
48
|
+
/** @type {HTMLInputElement} */ (
|
|
49
|
+
$e(root, '.domrect-readonly-readonly')
|
|
50
|
+
).checked = true;
|
|
51
|
+
}
|
|
29
52
|
},
|
|
30
53
|
getValue ({root}) {
|
|
31
54
|
const x = Number(/** @type {HTMLInputElement} */ (
|
|
@@ -40,11 +63,16 @@ const domrectType = {
|
|
|
40
63
|
const height = Number(/** @type {HTMLInputElement} */ (
|
|
41
64
|
$e(root, '.height')
|
|
42
65
|
).value);
|
|
43
|
-
|
|
66
|
+
|
|
67
|
+
const isReadWrite = /** @type {HTMLInputElement} */ (
|
|
68
|
+
$e(root, '.domrect-readonly-readwrite')
|
|
69
|
+
).checked;
|
|
70
|
+
return new (isReadWrite ? DOMRect : DOMRectReadOnly)(x, y, width, height);
|
|
44
71
|
},
|
|
45
72
|
viewUI ({value}) {
|
|
73
|
+
const isReadWrite = toStringTag(value) === 'DOMRect';
|
|
46
74
|
return ['div', {dataset: {type: 'domrect'}}, [
|
|
47
|
-
['b', {class: 'emphasis'}, ['DOMRect']],
|
|
75
|
+
['b', {class: 'emphasis'}, [isReadWrite ? 'DOMRect' : 'DOMRectReadOnly']],
|
|
48
76
|
['br'],
|
|
49
77
|
['b', ['x ']],
|
|
50
78
|
value.x,
|
|
@@ -65,8 +93,32 @@ const domrectType = {
|
|
|
65
93
|
width: '',
|
|
66
94
|
height: ''
|
|
67
95
|
}}) {
|
|
96
|
+
idx++;
|
|
68
97
|
// eslint-disable-next-line @stylistic/max-len -- Long
|
|
69
98
|
return ['div', {dataset: {type: 'domrect'}}, /** @type {import('jamilih').JamilihChildren} */ ([
|
|
99
|
+
['div', [
|
|
100
|
+
['label', [
|
|
101
|
+
['input', {
|
|
102
|
+
type: 'radio',
|
|
103
|
+
class: 'domrect-readonly-readwrite',
|
|
104
|
+
name: `${typeNamespace}-domrect-readonly-${idx}`,
|
|
105
|
+
value: 'readwrite',
|
|
106
|
+
checked: toStringTag(value) !== 'DOMRectReadOnly'
|
|
107
|
+
}],
|
|
108
|
+
'Readwrite'
|
|
109
|
+
]],
|
|
110
|
+
' ',
|
|
111
|
+
['label', [
|
|
112
|
+
['input', {
|
|
113
|
+
type: 'radio',
|
|
114
|
+
class: 'domrect-readonly-readonly',
|
|
115
|
+
name: `${typeNamespace}-domrect-readonly-${idx}`,
|
|
116
|
+
value: 'readonly',
|
|
117
|
+
checked: toStringTag(value) === 'DOMRectReadOnly'
|
|
118
|
+
}],
|
|
119
|
+
'Read-only'
|
|
120
|
+
]]
|
|
121
|
+
]],
|
|
70
122
|
['label', [
|
|
71
123
|
'x: ',
|
|
72
124
|
['input', {
|
|
@@ -44,7 +44,7 @@ if (typeof InternalError !== 'undefined') {
|
|
|
44
44
|
const specialErrors = [...specialErrorsMap.keys()];
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
* @type {import('
|
|
47
|
+
* @type {import('../types.js').SuperTypeObject}
|
|
48
48
|
*/
|
|
49
49
|
const errorsSpecialType = {
|
|
50
50
|
option: ['Special errors'],
|
package/src/types.js
CHANGED
|
@@ -38,9 +38,11 @@ import fileType from './fundamentalTypes/fileType.js';
|
|
|
38
38
|
import filelistType from './fundamentalTypes/filelistType.js';
|
|
39
39
|
import blobType from './fundamentalTypes/blobType.js';
|
|
40
40
|
import domexceptionType from './fundamentalTypes/domexceptionType.js';
|
|
41
|
-
import domrectType from './
|
|
42
|
-
import dompointType from './
|
|
43
|
-
import dommatrixType from './
|
|
41
|
+
import domrectType from './superTypes/domrectType.js';
|
|
42
|
+
import dompointType from './superTypes/dompointType.js';
|
|
43
|
+
import dommatrixType from './superTypes/dommatrixType.js';
|
|
44
|
+
import buffersourceType from './superTypes/buffersourceType.js';
|
|
45
|
+
import noneditableType from './fundamentalTypes/noneditableType.js';
|
|
44
46
|
|
|
45
47
|
/**
|
|
46
48
|
* Utility to retrieve the property value given a legend element.
|
|
@@ -266,6 +268,16 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
266
268
|
* ) => void} TypeObjectSetValue
|
|
267
269
|
*/
|
|
268
270
|
|
|
271
|
+
/**
|
|
272
|
+
* @typedef {(
|
|
273
|
+
* s: string, info?: RootInfo
|
|
274
|
+
* ) => {
|
|
275
|
+
* value?: StructuredCloneValue,
|
|
276
|
+
* remnant?: string,
|
|
277
|
+
* assign?: false
|
|
278
|
+
* }} ToValue
|
|
279
|
+
*/
|
|
280
|
+
|
|
269
281
|
/**
|
|
270
282
|
* @typedef {object} TypeObject
|
|
271
283
|
* @property {[
|
|
@@ -295,13 +307,7 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
295
307
|
* check whether this subtype matches
|
|
296
308
|
* @property {string} [superType] The greater fundamental type to which
|
|
297
309
|
* the type belongs
|
|
298
|
-
* @property {
|
|
299
|
-
* s: string, info?: RootInfo
|
|
300
|
-
* ) => {
|
|
301
|
-
* value?: StructuredCloneValue,
|
|
302
|
-
* remnant?: string,
|
|
303
|
-
* assign?: false
|
|
304
|
-
* }} toValue Converts from string to value. May use
|
|
310
|
+
* @property {ToValue} [toValue] Converts from string to value. May use
|
|
305
311
|
* `stringRegex` to find components.
|
|
306
312
|
* @property {(info: {
|
|
307
313
|
* root: HTMLDivElement,
|
|
@@ -366,13 +372,19 @@ export const getPropertyValueFromLegend = (legend) => {
|
|
|
366
372
|
* "objectReference"|"array"|"object"|"date"|"userObject"|"undef"|
|
|
367
373
|
* "SpecialRealNumber"|"SpecialNumber"|"regexp"|"BooleanObject"|
|
|
368
374
|
* "NumberObject"|"StringObject"|"map"|"set"|"file"|"filelist"|"blobHTML"|
|
|
369
|
-
* "
|
|
375
|
+
* "buffersource"|"dataview"|"imagedata"|"imagebitmap"|
|
|
370
376
|
* "int8array"|"uint8array"|"uint8clampedarray"|"int16array"|"uint16array"|
|
|
371
377
|
* "int32array"|"uint32array"|"float32array"|"float64array"|"ValidDate"|
|
|
372
378
|
* "arrayNonindexKeys"|"error"|"errors"|"blob"|"domexception"|"domrect"|
|
|
373
|
-
* "dompoint"|"dommatrix"} AvailableType
|
|
379
|
+
* "dompoint"|"dommatrix"|"resurrectable"} AvailableType
|
|
374
380
|
*/
|
|
375
381
|
|
|
382
|
+
/**
|
|
383
|
+
* @typedef {TypeObject & {
|
|
384
|
+
* childTypes: string[]
|
|
385
|
+
* }} SuperTypeObject
|
|
386
|
+
*/
|
|
387
|
+
|
|
376
388
|
/**
|
|
377
389
|
*
|
|
378
390
|
*/
|
|
@@ -436,12 +448,9 @@ class Types {
|
|
|
436
448
|
dompoint: dompointType,
|
|
437
449
|
dommatrix: dommatrixType,
|
|
438
450
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
arraybufferview: {
|
|
443
|
-
option: ['ArrayBufferView']
|
|
444
|
-
},
|
|
451
|
+
resurrectable: noneditableType,
|
|
452
|
+
|
|
453
|
+
buffersource: buffersourceType,
|
|
445
454
|
dataview: {
|
|
446
455
|
option: ['DataView']
|
|
447
456
|
},
|
|
@@ -594,6 +603,7 @@ class Types {
|
|
|
594
603
|
// Ensure `stateObj` remains a reference if present
|
|
595
604
|
return typeObject.getValue({
|
|
596
605
|
root,
|
|
606
|
+
/* istanbul ignore next -- Guard */
|
|
597
607
|
stateObj: stateObj ?? {
|
|
598
608
|
types: this
|
|
599
609
|
},
|
|
@@ -638,11 +648,12 @@ class Types {
|
|
|
638
648
|
|
|
639
649
|
/** @type {GetOptionForType} */
|
|
640
650
|
getOptionForType (type) {
|
|
651
|
+
const availableType = /** @type {TypeObject} */ (
|
|
652
|
+
this.availableTypes[type]
|
|
653
|
+
);
|
|
641
654
|
/** @type {[string, {value?: AvailableType, title?: string}?]} */
|
|
642
655
|
const optInfo = [
|
|
643
|
-
...
|
|
644
|
-
this.availableTypes[type]
|
|
645
|
-
)).option
|
|
656
|
+
...availableType.option
|
|
646
657
|
];
|
|
647
658
|
optInfo[1] = {value: type, ...(optInfo[1])};
|
|
648
659
|
return /** @type {[string, {value: AvailableType, title?: string}]} */ (
|
|
@@ -658,6 +669,7 @@ class Types {
|
|
|
658
669
|
if (!typesForFormatAndState) {
|
|
659
670
|
throw new Error('Unexpected type for format and state');
|
|
660
671
|
}
|
|
672
|
+
|
|
661
673
|
return typesForFormatAndState.map((type) => {
|
|
662
674
|
return this.getOptionForType(type);
|
|
663
675
|
});
|
|
@@ -840,7 +852,12 @@ class Types {
|
|
|
840
852
|
// console.log('s0', s, '::', remnant, match);
|
|
841
853
|
let valObj;
|
|
842
854
|
try {
|
|
843
|
-
|
|
855
|
+
const typeObj = /** @type {TypeObject} */ (found[1]);
|
|
856
|
+
/* istanbul ignore if -- TS guard */
|
|
857
|
+
if (!typeObj.toValue) {
|
|
858
|
+
throw new Error('Type has no `toValue` method');
|
|
859
|
+
}
|
|
860
|
+
valObj = typeObj.toValue(
|
|
844
861
|
mtch.groups?.innerContent || innerContent || s, {
|
|
845
862
|
types: this,
|
|
846
863
|
format,
|
package/src/utils/media.js
CHANGED
|
@@ -75,9 +75,10 @@ async function getUserMedia (constraints) {
|
|
|
75
75
|
let stream = null;
|
|
76
76
|
try {
|
|
77
77
|
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
78
|
-
/* c8 ignore next 4 */
|
|
79
78
|
} catch (err) {
|
|
79
|
+
/* istanbul ignore next */
|
|
80
80
|
console.error('err', err);
|
|
81
|
+
/* istanbul ignore next */
|
|
81
82
|
return null;
|
|
82
83
|
}
|
|
83
84
|
return stream;
|
|
@@ -93,8 +94,8 @@ async function startScreenCapture (displayMediaOptions) {
|
|
|
93
94
|
try {
|
|
94
95
|
captureStream =
|
|
95
96
|
await navigator.mediaDevices.getDisplayMedia(displayMediaOptions);
|
|
96
|
-
/* c8 ignore next 3 */
|
|
97
97
|
} catch (err) {
|
|
98
|
+
/* istanbul ignore next */
|
|
98
99
|
console.error(`Error: ${err}`);
|
|
99
100
|
}
|
|
100
101
|
return captureStream;
|
package/src/vendor-imports.js
CHANGED
|
@@ -2,6 +2,7 @@ export {jml, body, nbsp, $} from 'jamilih';
|
|
|
2
2
|
// export {jml, body, nbsp, $} from '../node_modules/jamilih/dist/jml-es.js';
|
|
3
3
|
|
|
4
4
|
export {
|
|
5
|
-
getJSONType, Typeson, unescapeKeyPathComponent, structuredCloningThrowing
|
|
5
|
+
getJSONType, Typeson, unescapeKeyPathComponent, structuredCloningThrowing,
|
|
6
|
+
resurrectable, toStringTag
|
|
6
7
|
} from 'typeson-registry';
|
|
7
8
|
// } from '../node_modules/typeson-registry/dist/index.js';
|