@es-joy/jsoe 0.6.0 → 0.7.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 +4 -0
- package/.nyc_output/out.json +20412 -43956
- package/CHANGES.md +9 -0
- package/README.md +15 -3
- package/demo/index.js +17 -2
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/formats/structuredCloning.js +2 -4
- package/src/fundamentalTypes/arrayType.js +11 -13
- package/src/fundamentalTypes/errorType.js +1 -0
- package/src/fundamentalTypes/fileType.js +1148 -0
- package/src/jsoe.css +41 -0
- package/src/types.js +2 -3
package/CHANGES.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# CHANGES TO `@es-joy/jsoe`
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
- feat: add `file` type including video, audio, photo, and
|
|
6
|
+
screen sharing recording
|
|
7
|
+
|
|
8
|
+
## 0.6.1
|
|
9
|
+
|
|
10
|
+
- refactor: avoid problems for instrumenter
|
|
11
|
+
|
|
3
12
|
## 0.6.0
|
|
4
13
|
|
|
5
14
|
- feat: add `set`, `map`, `error`, and special error types
|
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Supported types include:
|
|
|
32
32
|
- `Error`
|
|
33
33
|
- `TypeError`, `RangeError`, `SyntaxError`, `ReferenceError`, `EvalError`,
|
|
34
34
|
`URIError`, `AggregateError`, `InternalError`
|
|
35
|
+
- `File`
|
|
35
36
|
- `Map`
|
|
36
37
|
- `null`
|
|
37
38
|
- `Number` object
|
|
@@ -102,10 +103,21 @@ Supported supertypes include:
|
|
|
102
103
|
1. bigint64arrayconstructor
|
|
103
104
|
1. biguint64arrayconstructor
|
|
104
105
|
1. Web/API types
|
|
105
|
-
1. blob (besides HTML
|
|
106
|
+
1. blob (besides HTML, including SVG), filelist
|
|
106
107
|
1. imagedata, imagebitmap
|
|
108
|
+
1. Our own custom derivative types (e.g., MIDI using TypedArray)
|
|
107
109
|
1. Expand subtypes
|
|
108
|
-
1.
|
|
109
|
-
|
|
110
|
+
1. String
|
|
111
|
+
1. As supported by Zod, JSON Schema, etc. (e.g., email addresses as
|
|
112
|
+
subtype of `string`, color as a subtype of string)
|
|
113
|
+
1. `File`
|
|
114
|
+
1. Drawing image for `image/png`, etc. `File`'s
|
|
115
|
+
1. Drawing SVG program for `application/svg` `File`
|
|
116
|
+
1. JS/CSS/HTML/XML/Markdown/JSON/CSV/text text editor (including
|
|
117
|
+
syntax highlighting in view mode); with text-to-speech
|
|
118
|
+
1. OCR (`TextDetector` API if implemented) added as image pop-up
|
|
119
|
+
utility
|
|
110
120
|
1. Might put views and data into separate repos
|
|
111
121
|
1. Implement as Custom Elements?
|
|
122
|
+
1. Add drag-and-drop support for `File` type
|
|
123
|
+
1. Import CSV as array
|
package/demo/index.js
CHANGED
|
@@ -333,7 +333,11 @@ setTimeout(async function () {
|
|
|
333
333
|
error2,
|
|
334
334
|
error3,
|
|
335
335
|
typeError,
|
|
336
|
-
errAggregate
|
|
336
|
+
errAggregate,
|
|
337
|
+
new File(['abc'], 'someName', {
|
|
338
|
+
lastModified: 1231231230,
|
|
339
|
+
type: 'text/plain'
|
|
340
|
+
})
|
|
337
341
|
],
|
|
338
342
|
typeNamespace: 'demo-type-choices-only-initial-value'
|
|
339
343
|
});
|
|
@@ -385,13 +389,24 @@ setTimeout(async function () {
|
|
|
385
389
|
typeNamespace: 'demo-type-choices-only-initial-value-ErrorsAggregate'
|
|
386
390
|
});
|
|
387
391
|
|
|
392
|
+
const typeSelectionFile = typeChoices({
|
|
393
|
+
format: 'structuredCloning',
|
|
394
|
+
setValue: true,
|
|
395
|
+
value: new File(['abc'], 'anotherName', {
|
|
396
|
+
lastModified: 1231231230,
|
|
397
|
+
type: 'text/plain'
|
|
398
|
+
}),
|
|
399
|
+
typeNamespace: 'demo-type-choices-only-initial-value'
|
|
400
|
+
});
|
|
401
|
+
|
|
388
402
|
return ['form', [
|
|
389
403
|
...typeSelection.domArray,
|
|
390
404
|
...typeSelectionBlob.domArray,
|
|
391
405
|
...typeSelectionErrorWithCause.domArray,
|
|
392
406
|
...typeSelectionIndexedDBKey.domArray,
|
|
393
407
|
...typeSelectionTypeErrorWithCause.domArray,
|
|
394
|
-
...typeSelectionTypeErrorWithAggregate.domArray
|
|
408
|
+
...typeSelectionTypeErrorWithAggregate.domArray,
|
|
409
|
+
...typeSelectionFile.domArray
|
|
395
410
|
]];
|
|
396
411
|
})(),
|
|
397
412
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";sBAUa,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,
|
|
1
|
+
{"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";sBAUa,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,CAgmDvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorsSpecialType.d.ts","sourceRoot":"","sources":["../../src/superTypes/errorsSpecialType.js"],"names":[],"mappings":";sBAOa,MAAM;+BAaN,gBAAgB,GAAC,yBAAyB;AAyBvD;;GAEG;AACH,iCAFU,OAAO,wBAAwB,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"errorsSpecialType.d.ts","sourceRoot":"","sources":["../../src/superTypes/errorsSpecialType.js"],"names":[],"mappings":";sBAOa,MAAM;+BAaN,gBAAgB,GAAC,yBAAyB;AAyBvD;;GAEG;AACH,iCAFU,OAAO,wBAAwB,EAAE,eAAe,CA+sBxD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@es-joy/jsoe",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -95,7 +95,8 @@
|
|
|
95
95
|
"rollup": "4.5.0",
|
|
96
96
|
"rollup-plugin-istanbul": "^5.0.0",
|
|
97
97
|
"rollup-plugin-node-builtins": "^2.1.2",
|
|
98
|
-
"typescript": "^5.2.2"
|
|
98
|
+
"typescript": "^5.2.2",
|
|
99
|
+
"webappfind-demos-samples": "^0.7.0"
|
|
99
100
|
},
|
|
100
101
|
"repository": {
|
|
101
102
|
"type": "git",
|
|
@@ -245,9 +245,6 @@ const encapsulateObserver = (stateObj) => {
|
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
if (!readonly) {
|
|
248
|
-
// Todo: Redundant with `typeObj.setValue`? Ensure `idb-manager`
|
|
249
|
-
// does not need both; this write-only would seem preferable
|
|
250
|
-
// to the block in `arrayType.js` if readonly indeed not needed
|
|
251
248
|
Types.setValue({
|
|
252
249
|
type: newType,
|
|
253
250
|
// eslint-disable-next-line object-shorthand -- TS
|
|
@@ -461,10 +458,11 @@ const structuredCloning = {
|
|
|
461
458
|
'error',
|
|
462
459
|
'errors',
|
|
463
460
|
'blobHTML',
|
|
461
|
+
'file',
|
|
464
462
|
'set',
|
|
465
463
|
'map'
|
|
466
464
|
// Ok, but will need some work
|
|
467
|
-
// 'blob', '
|
|
465
|
+
// 'blob', 'filelist',
|
|
468
466
|
// 'arraybuffer',
|
|
469
467
|
// 'dataview', 'imagedata', 'imagebitmap',
|
|
470
468
|
/*
|
|
@@ -1389,16 +1389,15 @@ const arrayType = {
|
|
|
1389
1389
|
* @this {HTMLDivElement}
|
|
1390
1390
|
*/
|
|
1391
1391
|
$getArrayItems () {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
);
|
|
1392
|
+
const prevSibling = /**
|
|
1393
|
+
* @type {HTMLDivElement & {
|
|
1394
|
+
* $inputsExceedingLength: InputsExceedingLength,
|
|
1395
|
+
* $getPropertyInputs: GetPropertyInputs,
|
|
1396
|
+
* $redrawMoveArrows: RedrawMoveArrows,
|
|
1397
|
+
* $getMapKeySelects: GetMapKeySelects
|
|
1398
|
+
* }}
|
|
1399
|
+
*/ (this.previousElementSibling);
|
|
1400
|
+
return prevSibling;
|
|
1402
1401
|
}
|
|
1403
1402
|
},
|
|
1404
1403
|
$on: {click () {
|
|
@@ -1627,9 +1626,8 @@ const arrayType = {
|
|
|
1627
1626
|
const typeChoices = this.$getTypeChoices();
|
|
1628
1627
|
typeChoices.$setType({type, baseValue: value, bringIntoFocus});
|
|
1629
1628
|
const root = typeChoices.$getTypeRoot();
|
|
1630
|
-
//
|
|
1631
|
-
//
|
|
1632
|
-
// with running `Error.cause` type twice and is inefficient;
|
|
1629
|
+
// If run for all, causes problems with running `Error.cause`
|
|
1630
|
+
// type twice and is inefficient;
|
|
1633
1631
|
// currently put behind `setAValue` as we need to set a value
|
|
1634
1632
|
// from `errorsSpecialType`
|
|
1635
1633
|
if (setAValue) {
|
|
@@ -173,6 +173,7 @@ const errorType = {
|
|
|
173
173
|
) {
|
|
174
174
|
return /** @type {import('jamilih').JamilihArray} */ ([
|
|
175
175
|
'div', {dataset: {type: 'error'}}, [
|
|
176
|
+
['b', {class: 'emphasis'}, ['Error']],
|
|
176
177
|
typeof o.message === 'string'
|
|
177
178
|
? ['div', [['b', ['Message: ']], ['span', [o.message]]]]
|
|
178
179
|
: [],
|