@es-joy/jsoe 0.6.1 → 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 +20626 -44170
- package/CHANGES.md +5 -0
- package/README.md +15 -3
- package/demo/index.js +17 -2
- package/package.json +3 -2
- package/src/formats/structuredCloning.js +2 -1
- 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
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
|
|
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",
|
|
@@ -458,10 +458,11 @@ const structuredCloning = {
|
|
|
458
458
|
'error',
|
|
459
459
|
'errors',
|
|
460
460
|
'blobHTML',
|
|
461
|
+
'file',
|
|
461
462
|
'set',
|
|
462
463
|
'map'
|
|
463
464
|
// Ok, but will need some work
|
|
464
|
-
// 'blob', '
|
|
465
|
+
// 'blob', 'filelist',
|
|
465
466
|
// 'arraybuffer',
|
|
466
467
|
// 'dataview', 'imagedata', 'imagebitmap',
|
|
467
468
|
/*
|
|
@@ -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
|
: [],
|