@es-joy/jsoe 0.5.0 → 0.6.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/.eslintignore +2 -0
- package/.eslintrc.cjs +2 -0
- package/.nyc_output/out.json +121296 -0
- package/CHANGES.md +10 -0
- package/README.md +47 -21
- package/cypress.config.ts +13 -0
- package/demo/index-instrumented.html +29 -0
- package/demo/index.html +10 -1
- package/demo/index.js +482 -126
- package/dist/formatAndTypeChoices.d.ts +10 -4
- package/dist/formatAndTypeChoices.d.ts.map +1 -1
- package/dist/formats/json.d.ts.map +1 -1
- package/dist/formats/structuredCloning.d.ts +2 -1
- package/dist/formats/structuredCloning.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts +6 -37
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
- package/dist/fundamentalTypes/errorType.d.ts +6 -0
- package/dist/fundamentalTypes/errorType.d.ts.map +1 -0
- package/dist/fundamentalTypes/mapType.d.ts +6 -0
- package/dist/fundamentalTypes/mapType.d.ts.map +1 -0
- package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
- package/dist/fundamentalTypes/objectReferenceType.d.ts.map +1 -1
- package/dist/fundamentalTypes/setType.d.ts +6 -0
- package/dist/fundamentalTypes/setType.d.ts.map +1 -0
- package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -1
- package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
- package/dist/subTypes/blobHTMLType.d.ts +12 -6
- package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
- package/dist/superTypes/SpecialNumberType.d.ts +14 -0
- package/dist/superTypes/SpecialNumberType.d.ts.map +1 -0
- package/dist/superTypes/SpecialRealNumberType.d.ts +6 -0
- package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -0
- package/dist/superTypes/errorsSpecialType.d.ts +8 -0
- package/dist/superTypes/errorsSpecialType.d.ts.map +1 -0
- package/dist/typeChoices.d.ts +4 -2
- package/dist/typeChoices.d.ts.map +1 -1
- package/dist/types.d.ts +85 -233
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/dialogs.d.ts +22 -22
- package/dist/utils/dialogs.d.ts.map +1 -1
- package/dist/utils/templateUtils.d.ts +6 -6
- package/dist/utils/templateUtils.d.ts.map +1 -1
- package/dist/vendor-imports.d.ts +1 -1
- package/package.json +39 -34
- package/rollup.config.js +14 -2
- package/server.js +1 -1
- package/src/formatAndTypeChoices.js +14 -13
- package/src/formats/indexedDBKey.js +2 -2
- package/src/formats/json.js +1 -2
- package/src/formats/structuredCloning.js +104 -29
- package/src/formats.js +2 -2
- package/src/fundamentalTypes/arrayReferenceType.js +3 -3
- package/src/fundamentalTypes/arrayType.js +384 -79
- package/src/fundamentalTypes/dateType.js +4 -6
- package/src/fundamentalTypes/errorType.js +416 -0
- package/src/fundamentalTypes/mapType.js +34 -0
- package/src/fundamentalTypes/nullType.js +1 -2
- package/src/fundamentalTypes/objectReferenceType.js +2 -1
- package/src/fundamentalTypes/regexpType.js +2 -2
- package/src/fundamentalTypes/setType.js +34 -0
- package/src/fundamentalTypes/sparseUndefinedType.js +2 -3
- package/src/fundamentalTypes/undefinedType.js +2 -3
- package/src/jsoe.css +3 -0
- package/src/subTypes/blobHTMLType.js +37 -33
- package/src/subTypes/falseType.js +2 -2
- package/src/subTypes/trueType.js +2 -2
- package/src/superTypes/{SpecialNumberSuperType.js → SpecialNumberType.js} +1 -1
- package/src/superTypes/{SpecialRealNumberSuperType.js → SpecialRealNumberType.js} +3 -2
- package/src/superTypes/errorsSpecialType.js +768 -0
- package/src/typeChoices.js +27 -20
- package/src/types.js +72 -40
- package/src/utils/dialogs.js +11 -12
- package/src/utils/jsonPointer.js +3 -3
- package/src/utils/templateUtils.js +4 -4
- package/src/vendor-imports.js +2 -2
- package/tsconfig.json +1 -1
- package/typings/CypressPlugins.d.ts +10 -0
- package/vendor/jamilih/dist/jml-es.js +126 -106
- package/vendor/typeson-registry/dist/index.js +188 -44
package/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGES TO `@es-joy/jsoe`
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
- feat: add `set`, `map`, `error`, and special error types
|
|
6
|
+
- fix: ensure `Types.getTypeForRoot` always returns a string
|
|
7
|
+
- fix: ensure Blob textarea is independent per instance
|
|
8
|
+
|
|
9
|
+
## 0.5.1
|
|
10
|
+
|
|
11
|
+
- fix: TS types
|
|
12
|
+
|
|
3
13
|
## 0.5.0
|
|
4
14
|
|
|
5
15
|
- chore: update `jamilih`, `typeson-registry`, devDeps.;
|
package/README.md
CHANGED
|
@@ -12,6 +12,8 @@ app using this tool.
|
|
|
12
12
|
|
|
13
13
|
Formats are a collection of allowed types.
|
|
14
14
|
|
|
15
|
+
Supported formats include:
|
|
16
|
+
|
|
15
17
|
- Structured Cloning (using [typeson](https://github.com/dfahlander/typeson)) (e.g., IndexedDB)
|
|
16
18
|
- JSON
|
|
17
19
|
- IndexedDB keys
|
|
@@ -20,17 +22,24 @@ Formats are a collection of allowed types.
|
|
|
20
22
|
|
|
21
23
|
These are generally atomic types which correlate to JavaScript language structures.
|
|
22
24
|
|
|
25
|
+
Supported types include:
|
|
26
|
+
|
|
23
27
|
- Array reference (for cyclic arrays)
|
|
24
28
|
- Array
|
|
25
29
|
- `BigInt`
|
|
26
30
|
- `Boolean` object
|
|
27
31
|
- `Date`
|
|
32
|
+
- `Error`
|
|
33
|
+
- `TypeError`, `RangeError`, `SyntaxError`, `ReferenceError`, `EvalError`,
|
|
34
|
+
`URIError`, `AggregateError`, `InternalError`
|
|
35
|
+
- `Map`
|
|
28
36
|
- `null`
|
|
29
37
|
- `Number` object
|
|
30
38
|
- number
|
|
31
39
|
- Object reference (for cyclic objects)
|
|
32
40
|
- Object
|
|
33
41
|
- `RegExp`
|
|
42
|
+
- `Set`
|
|
34
43
|
- `String` object
|
|
35
44
|
- string
|
|
36
45
|
- `undefined`
|
|
@@ -39,6 +48,8 @@ These are generally atomic types which correlate to JavaScript language structur
|
|
|
39
48
|
|
|
40
49
|
These map to a subset of JavaScript language structures. Note that false and true were common and limited enough in number to justify their own subtype for the sake of having a quick pull-down entry.
|
|
41
50
|
|
|
51
|
+
Supported subtypes include:
|
|
52
|
+
|
|
42
53
|
- Blob (text/html)
|
|
43
54
|
- `false`
|
|
44
55
|
- `true`
|
|
@@ -48,9 +59,20 @@ These map to a subset of JavaScript language structures. Note that false and tru
|
|
|
48
59
|
These are collections of individual types, justified by the subitems not being so frequent as to necessitate their own
|
|
49
60
|
separate enumeration.
|
|
50
61
|
|
|
62
|
+
Supported supertypes include:
|
|
63
|
+
|
|
51
64
|
- Special Real Number (`Infinity`, `-Infinity`, `-0`) - Used with IndexedDB keys (even though -0 apparently [to be converted](https://github.com/w3c/IndexedDB/issues/375) to 0)
|
|
52
65
|
- Special Number (`Infinity`, `-Infinity`, `-0`, `NaN`) - Used with Structured Cloning values
|
|
53
66
|
|
|
67
|
+
## Known issues
|
|
68
|
+
|
|
69
|
+
- Cannot provide maps with object keys pointing to the same objects as used
|
|
70
|
+
as map values; likewise with Sets?
|
|
71
|
+
- Certain cyclical structures may have issues
|
|
72
|
+
- `typeson-registry`'s structured cloning should throw on more objects, so
|
|
73
|
+
bad data doesn't end up stored
|
|
74
|
+
- Lacks support for certain Structured Cloning types. See to-dos below.
|
|
75
|
+
|
|
54
76
|
## To-dos
|
|
55
77
|
|
|
56
78
|
1. Add tests of demo (lower priority as have tests in `idb-manager`)
|
|
@@ -58,28 +80,32 @@ separate enumeration.
|
|
|
58
80
|
1. Expand fundamental types
|
|
59
81
|
1. Not in typeson-registry
|
|
60
82
|
1. Structured Cloning
|
|
61
|
-
1.
|
|
83
|
+
1. Web/API types (besides those listed below)
|
|
84
|
+
1. See <https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#webapi_types>
|
|
62
85
|
1. Already in typeson-registry
|
|
63
86
|
1. Structured Cloning
|
|
64
|
-
1.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
1.
|
|
87
|
+
1. JavaScript types
|
|
88
|
+
1. ArrayBuffer
|
|
89
|
+
1. arraybuffer
|
|
90
|
+
1. DataView
|
|
91
|
+
1. dataview
|
|
92
|
+
1. TypedArray
|
|
93
|
+
1. int8array
|
|
94
|
+
1. uint8array
|
|
95
|
+
1. uint8clampedarray
|
|
96
|
+
1. int16array
|
|
97
|
+
1. uint16array
|
|
98
|
+
1. int32array
|
|
99
|
+
1. uint32array
|
|
100
|
+
1. float32array
|
|
101
|
+
1. float64array
|
|
102
|
+
1. bigint64arrayconstructor
|
|
103
|
+
1. biguint64arrayconstructor
|
|
104
|
+
1. Web/API types
|
|
105
|
+
1. blob (besides HTML), file, filelist
|
|
106
|
+
1. imagedata, imagebitmap
|
|
83
107
|
1. Expand subtypes
|
|
84
108
|
1. As supported by Zod, JSON Schema, etc. (e.g., email addresses as
|
|
85
|
-
subtype of `string
|
|
109
|
+
subtype of `string`, color as a subtype of string)
|
|
110
|
+
1. Might put views and data into separate repos
|
|
111
|
+
1. Implement as Custom Elements?
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {defineConfig} from 'cypress';
|
|
2
|
+
import plugins from './cypress/plugins/index.js';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
defaultCommandTimeout: 8000,
|
|
6
|
+
video: false,
|
|
7
|
+
e2e: {
|
|
8
|
+
baseUrl: 'http://127.0.0.1:8087',
|
|
9
|
+
setupNodeEvents (on, config) {
|
|
10
|
+
return plugins(on, config);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>JSOE Demo</title>
|
|
6
|
+
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
|
|
7
|
+
<link rel="stylesheet" href="../src/jsoe.css" />
|
|
8
|
+
<!-- SCEditor (CKEditor was appealing for features but won't support unrecognized tags:
|
|
9
|
+
https://github.com/ckeditor/ckeditor5/issues/592 )
|
|
10
|
+
Filed https://github.com/samclarke/SCEditor/issues/584 to be able to import as ES6 module
|
|
11
|
+
-->
|
|
12
|
+
<link rel="stylesheet" href="../node_modules/sceditor/minified/themes/default.min.css" />
|
|
13
|
+
|
|
14
|
+
<script src="../node_modules/sceditor/minified/sceditor.min.js"></script>
|
|
15
|
+
<script src="../node_modules/sceditor/minified/formats/bbcode.js"></script>
|
|
16
|
+
<script src="../node_modules/sceditor/minified/formats/xhtml.js"></script>
|
|
17
|
+
<script type="importmap">
|
|
18
|
+
{
|
|
19
|
+
"imports": {
|
|
20
|
+
"jamilih": "../vendor/jamilih/dist/jml-es.js",
|
|
21
|
+
"typeson-registry": "../vendor/typeson-registry/dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
<script type="module" src="../instrumented/demo/index.js"></script>
|
|
26
|
+
</head>
|
|
27
|
+
<body>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
package/demo/index.html
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
2
|
+
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title>JSOE Demo</title>
|
|
6
6
|
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
|
|
7
7
|
<link rel="stylesheet" href="../src/jsoe.css" />
|
|
8
|
+
<!-- SCEditor (CKEditor was appealing for features but won't support unrecognized tags:
|
|
9
|
+
https://github.com/ckeditor/ckeditor5/issues/592 )
|
|
10
|
+
Filed https://github.com/samclarke/SCEditor/issues/584 to be able to import as ES6 module
|
|
11
|
+
-->
|
|
12
|
+
<link rel="stylesheet" href="../node_modules/sceditor/minified/themes/default.min.css" />
|
|
13
|
+
|
|
14
|
+
<script src="../node_modules/sceditor/minified/sceditor.min.js"></script>
|
|
15
|
+
<script src="../node_modules/sceditor/minified/formats/bbcode.js"></script>
|
|
16
|
+
<script src="../node_modules/sceditor/minified/formats/xhtml.js"></script>
|
|
8
17
|
<script type="importmap">
|
|
9
18
|
{
|
|
10
19
|
"imports": {
|