@es-joy/jsoe
v0.15.0
Published
Editing of arbitrary JavaScript objects
Downloads
33
Readme
@es-joy/jsoe
JavaScript Object Editor.
Editing of arbitrary JavaScript objects.
See a demo of this tool or a demo of an app using this tool.
Formats
Formats are a collection of allowed types.
Supported formats include:
- Structured Cloning (using typeson) (e.g., IndexedDB)
- JSON
- IndexedDB keys
Fundamental types
These are generally atomic types which correlate to JavaScript language structures.
Supported types include:
- Array reference (for cyclic arrays)
- Array
BigInt
Blob
Boolean
objectDate
DOMException
,Error
TypeError
,RangeError
,SyntaxError
,ReferenceError
,EvalError
,URIError
,AggregateError
,InternalError
File
FileList
Map
- Non-editable type (catch-all for not-yet-supported object types; allows for preexisting data to be passed on transparently)
null
Number
object- number
- Object reference (for cyclic objects)
- Object
RegExp
Set
String
object- string
undefined
Subtypes
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.
Supported subtypes include:
- Blob (text/html)
false
true
Supertypes
These are collections of individual types, justified by the subitems not being so frequent as to necessitate their own separate enumeration.
Supported supertypes include:
- Special Real Number (
Infinity
,-Infinity
,-0
) - Used with IndexedDB keys (even though -0 apparently to be converted to 0) - Special Number (
Infinity
,-Infinity
,-0
,NaN
) - Used with Structured Cloning values DOMMatrix
(also includesDOMMatrixReadOnly
)DOMPoint
(also includesDOMPointReadOnly
)DOMRect
(also includesDOMRectReadOnly
)buffersource
includesArrayBuffer
,DataView
, and TypedArrays (int8array, uint8array, uint8clampedarray, int16array, uint16array, int32array, uint32array, float32array, float64array, bigint64array, biguint64array)
Known issues
- Cannot provide maps with object keys pointing to the same objects as used as map values; likewise with Sets?
- Certain cyclical structures may have issues
typeson-registry
's structured cloning should throw on more objects, so bad data doesn't end up stored- Lacks support for certain Structured Cloning types. See to-dos below.
To-dos
- Add tests of demo (lower priority as have tests in
idb-manager
) - Support Schemas based on a JSON serialization of Zod
- Expand fundamental types
- Not in typeson-registry
- Structured Cloning
- Web/API types (besides those listed below)
- Structured Cloning
- Already in typeson-registry
- Structured Cloning
- (JavaScript types already complete)
- Web/API types
- imagedata, imagebitmap
- cryptokey
- domquad
- Our own custom derivative types? (e.g., MIDI using TypedArray)
- Structured Cloning
- Not in typeson-registry
- Expand subtypes
- String
- As supported by Zod, JSON Schema, etc. (e.g., email addresses as
subtype of
string
, color as a subtype of string)
- As supported by Zod, JSON Schema, etc. (e.g., email addresses as
subtype of
File
/Blob
- Drawing image for
image/png
, etc.File
's - Drawing SVG program for
application/svg
File
- JS/CSS/HTML/XML/Markdown/JSON/CSV/text text editor (including syntax highlighting in view mode); with text-to-speech
- OCR (
TextDetector
API if implemented) added as image pop-up utility
- Drawing image for
- String
- Might put views and data into separate repos
- Implement as Custom Elements?
- Add drag-and-drop support for
File
type - Import CSV as array