@es-joy/jsoe 0.2.0 → 0.4.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 +3 -0
- package/.eslintrc.cjs +2 -0
- package/.ncurc.cjs +9 -0
- package/CHANGES.md +9 -0
- package/README.md +2 -2
- package/demo/index.html +8 -0
- package/demo/index.js +1 -1
- package/dist/formatAndTypeChoices.d.ts +56 -0
- package/dist/formatAndTypeChoices.d.ts.map +1 -0
- package/dist/formats/indexedDBKey.d.ts +4 -0
- package/dist/formats/indexedDBKey.d.ts.map +1 -0
- package/dist/formats/json.d.ts +4 -0
- package/dist/formats/json.d.ts.map +1 -0
- package/dist/formats/schemaAndArbitrary.d.ts +6 -0
- package/dist/formats/schemaAndArbitrary.d.ts.map +1 -0
- package/dist/formats/schemaOnly.d.ts +6 -0
- package/dist/formats/schemaOnly.d.ts.map +1 -0
- package/dist/formats/structuredCloning.d.ts +20 -0
- package/dist/formats/structuredCloning.d.ts.map +1 -0
- package/dist/formats.d.ts +26 -0
- package/dist/formats.d.ts.map +1 -0
- package/dist/fundamentalTypes/BooleanObjectType.d.ts +8 -0
- package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
- package/dist/fundamentalTypes/NumberObjectType.d.ts +6 -0
- package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
- package/dist/fundamentalTypes/StringObjectType.d.ts +6 -0
- package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -0
- package/dist/fundamentalTypes/arrayReferenceType.d.ts +8 -0
- package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
- package/dist/fundamentalTypes/arrayType.d.ts +60 -0
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -0
- package/dist/fundamentalTypes/bigintType.d.ts +6 -0
- package/dist/fundamentalTypes/bigintType.d.ts.map +1 -0
- package/dist/fundamentalTypes/dateType.d.ts +26 -0
- package/dist/fundamentalTypes/dateType.d.ts.map +1 -0
- package/dist/fundamentalTypes/nullType.d.ts +6 -0
- package/dist/fundamentalTypes/nullType.d.ts.map +1 -0
- package/dist/fundamentalTypes/numberType.d.ts +6 -0
- package/dist/fundamentalTypes/numberType.d.ts.map +1 -0
- package/dist/fundamentalTypes/objectReferenceType.d.ts +8 -0
- package/dist/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
- package/dist/fundamentalTypes/objectType.d.ts +6 -0
- package/dist/fundamentalTypes/objectType.d.ts.map +1 -0
- package/dist/fundamentalTypes/regexpType.d.ts +8 -0
- package/dist/fundamentalTypes/regexpType.d.ts.map +1 -0
- package/dist/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
- package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
- package/dist/fundamentalTypes/stringType.d.ts +6 -0
- package/dist/fundamentalTypes/stringType.d.ts.map +1 -0
- package/dist/fundamentalTypes/undefinedType.d.ts +6 -0
- package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/src/deepEqual.d.ts +3 -0
- package/dist/src/deepEqual.d.ts.map +1 -0
- package/dist/src/formatAndTypeChoices.d.ts +47 -0
- package/dist/src/formatAndTypeChoices.d.ts.map +1 -0
- package/dist/src/formats/indexedDBKey.d.ts +9 -0
- package/dist/src/formats/indexedDBKey.d.ts.map +1 -0
- package/dist/src/formats/json.d.ts +9 -0
- package/dist/src/formats/json.d.ts.map +1 -0
- package/dist/src/formats/schemaAndArbitrary.d.ts +6 -0
- package/dist/src/formats/schemaAndArbitrary.d.ts.map +1 -0
- package/dist/src/formats/schemaOnly.d.ts +6 -0
- package/dist/src/formats/schemaOnly.d.ts.map +1 -0
- package/dist/src/formats/structuredCloning.d.ts +15 -0
- package/dist/src/formats/structuredCloning.d.ts.map +1 -0
- package/dist/src/formats.d.ts +18 -0
- package/dist/src/formats.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/BooleanObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/NumberObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/StringObjectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/StringObjectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/arrayReferenceType.d.ts +6 -0
- package/dist/src/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/arrayType.d.ts +6 -0
- package/dist/src/fundamentalTypes/arrayType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/bigintType.d.ts +6 -0
- package/dist/src/fundamentalTypes/bigintType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/dateType.d.ts +6 -0
- package/dist/src/fundamentalTypes/dateType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/nullType.d.ts +6 -0
- package/dist/src/fundamentalTypes/nullType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/numberType.d.ts +6 -0
- package/dist/src/fundamentalTypes/numberType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/objectReferenceType.d.ts +6 -0
- package/dist/src/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/objectType.d.ts +6 -0
- package/dist/src/fundamentalTypes/objectType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/regexpType.d.ts +6 -0
- package/dist/src/fundamentalTypes/regexpType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
- package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/stringType.d.ts +6 -0
- package/dist/src/fundamentalTypes/stringType.d.ts.map +1 -0
- package/dist/src/fundamentalTypes/undefinedType.d.ts +6 -0
- package/dist/src/fundamentalTypes/undefinedType.d.ts.map +1 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/subTypes/blobHTMLType.d.ts +26 -0
- package/dist/src/subTypes/blobHTMLType.d.ts.map +1 -0
- package/dist/src/subTypes/falseType.d.ts +6 -0
- package/dist/src/subTypes/falseType.d.ts.map +1 -0
- package/dist/src/subTypes/trueType.d.ts +6 -0
- package/dist/src/subTypes/trueType.d.ts.map +1 -0
- package/dist/src/superTypes/SpecialNumberSuperType.d.ts +11 -0
- package/dist/src/superTypes/SpecialNumberSuperType.d.ts.map +1 -0
- package/dist/src/superTypes/SpecialRealNumberSuperType.d.ts +6 -0
- package/dist/src/superTypes/SpecialRealNumberSuperType.d.ts.map +1 -0
- package/dist/src/typeChoices.d.ts +30 -0
- package/dist/src/typeChoices.d.ts.map +1 -0
- package/dist/src/types.d.ts +333 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils/dialogs.d.ts +29 -0
- package/dist/src/utils/dialogs.d.ts.map +1 -0
- package/dist/src/utils/jsonPointer.d.ts +42 -0
- package/dist/src/utils/jsonPointer.d.ts.map +1 -0
- package/dist/src/utils/templateUtils.d.ts +59 -0
- package/dist/src/utils/templateUtils.d.ts.map +1 -0
- package/dist/src/utils/types.d.ts +2 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/subTypes/blobHTMLType.d.ts +14 -0
- package/dist/subTypes/blobHTMLType.d.ts.map +1 -0
- package/dist/subTypes/falseType.d.ts +8 -0
- package/dist/subTypes/falseType.d.ts.map +1 -0
- package/dist/subTypes/trueType.d.ts +8 -0
- package/dist/subTypes/trueType.d.ts.map +1 -0
- package/dist/superTypes/SpecialNumberSuperType.d.ts +14 -0
- package/dist/superTypes/SpecialNumberSuperType.d.ts.map +1 -0
- package/dist/superTypes/SpecialRealNumberSuperType.d.ts +6 -0
- package/dist/superTypes/SpecialRealNumberSuperType.d.ts.map +1 -0
- package/dist/typeChoices.d.ts +103 -0
- package/dist/typeChoices.d.ts.map +1 -0
- package/dist/types.d.ts +523 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/dialogs.d.ts +109 -0
- package/dist/utils/dialogs.d.ts.map +1 -0
- package/dist/utils/jsonPointer.d.ts +46 -0
- package/dist/utils/jsonPointer.d.ts.map +1 -0
- package/dist/utils/templateUtils.d.ts +59 -0
- package/dist/utils/templateUtils.d.ts.map +1 -0
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/vendor/jamilih/dist/jml-es.d.ts +436 -0
- package/dist/vendor/jamilih/dist/jml-es.d.ts.map +1 -0
- package/dist/vendor/typeson-registry/dist/index.d.ts +400 -0
- package/dist/vendor/typeson-registry/dist/index.d.ts.map +1 -0
- package/dist/vendor-imports.d.ts +3 -0
- package/dist/vendor-imports.d.ts.map +1 -0
- package/package.json +19 -14
- package/postorder-traversal.js +58 -0
- package/src/formatAndTypeChoices.js +95 -50
- package/src/formats/indexedDBKey.js +49 -56
- package/src/formats/json.js +47 -56
- package/src/formats/schemaOnly.js +12 -2
- package/src/formats/structuredCloning.js +162 -105
- package/src/formats.js +38 -10
- package/src/fundamentalTypes/BooleanObjectType.js +6 -4
- package/src/fundamentalTypes/NumberObjectType.js +5 -3
- package/src/fundamentalTypes/StringObjectType.js +1 -1
- package/src/fundamentalTypes/arrayReferenceType.js +29 -14
- package/src/fundamentalTypes/arrayType.js +789 -278
- package/src/fundamentalTypes/bigintType.js +2 -2
- package/src/fundamentalTypes/dateType.js +42 -14
- package/src/fundamentalTypes/nullType.js +1 -1
- package/src/fundamentalTypes/numberType.js +2 -2
- package/src/fundamentalTypes/objectReferenceType.js +7 -5
- package/src/fundamentalTypes/regexpType.js +45 -24
- package/src/fundamentalTypes/sparseUndefinedType.js +7 -1
- package/src/fundamentalTypes/stringType.js +1 -1
- package/src/fundamentalTypes/undefinedType.js +2 -2
- package/src/jsoe.css +1 -1
- package/src/subTypes/blobHTMLType.js +42 -22
- package/src/subTypes/falseType.js +2 -2
- package/src/subTypes/trueType.js +2 -2
- package/src/superTypes/SpecialNumberSuperType.js +30 -16
- package/src/superTypes/SpecialRealNumberSuperType.js +62 -0
- package/src/typeChoices.js +137 -55
- package/src/types.js +312 -148
- package/src/utils/dialogs.js +98 -29
- package/src/utils/jsonPointer.js +4 -0
- package/src/utils/templateUtils.js +27 -12
- package/src/vendor-imports.js +8 -0
- package/tsconfig.json +18 -0
- package/typings/sceditor.d.ts +20 -0
- package/vendor/jamilih/dist/jml-es.js +1019 -389
- package/vendor/jamilih/dist/jml.d.ts +436 -0
- package/vendor/jamilih/package.json +136 -0
- package/vendor/typeson-registry/dist/index.js +382 -84
- package/src/superTypes/InfinitiesSuperType.js +0 -49
package/.eslintignore
CHANGED
package/.eslintrc.cjs
CHANGED
|
@@ -37,11 +37,13 @@ module.exports = {
|
|
|
37
37
|
'location.hash',
|
|
38
38
|
'location.href',
|
|
39
39
|
'location.pathname',
|
|
40
|
+
'Map',
|
|
40
41
|
'MutationObserver',
|
|
41
42
|
'Number.isNaN',
|
|
42
43
|
'Number.parseFloat',
|
|
43
44
|
'Number.parseInt',
|
|
44
45
|
'Object.assign',
|
|
46
|
+
'Object.is',
|
|
45
47
|
'Object.keys',
|
|
46
48
|
'Object.entries',
|
|
47
49
|
'Object.values',
|
package/.ncurc.cjs
ADDED
package/CHANGES.md
CHANGED
package/README.md
CHANGED
|
@@ -48,8 +48,8 @@ These map to a subset of JavaScript language structures. Note that false and tru
|
|
|
48
48
|
These are collections of individual types, justified by the subitems not being so frequent as to necessitate their own
|
|
49
49
|
separate enumeration.
|
|
50
50
|
|
|
51
|
-
-
|
|
52
|
-
- Special Number (`Infinity`, `-Infinity`, `NaN`) - Used with Structured Cloning values
|
|
51
|
+
- 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
|
+
- Special Number (`Infinity`, `-Infinity`, `-0`, `NaN`) - Used with Structured Cloning values
|
|
53
53
|
|
|
54
54
|
## To-dos
|
|
55
55
|
|
package/demo/index.html
CHANGED
|
@@ -5,6 +5,14 @@
|
|
|
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
|
+
<script type="importmap">
|
|
9
|
+
{
|
|
10
|
+
"imports": {
|
|
11
|
+
"jamilih": "../vendor/jamilih/dist/jml-es.js",
|
|
12
|
+
"typeson-registry": "../vendor/typeson-registry/dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
8
16
|
<script type="module" src="index.js"></script>
|
|
9
17
|
</head>
|
|
10
18
|
<body>
|
package/demo/index.js
CHANGED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @callback SetValue
|
|
3
|
+
* @param {import('./formats.js').StructuredCloneValue} value
|
|
4
|
+
* @param {import('./types.js').StateObject} stateObj
|
|
5
|
+
* @returns {Promise<void>}
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Builds a selector and container for types.
|
|
9
|
+
* @param {object} cfg
|
|
10
|
+
* @param {string} [cfg.schema] The schema name (NOT IN USE)
|
|
11
|
+
* @param {object} [cfg.schemaContent] The schema content (NOT IN USE)
|
|
12
|
+
* @param {boolean} [cfg.hasValue] Set to `true` if you are supplying
|
|
13
|
+
* your own value. If `false` and `hasKeyPath` is `true`,
|
|
14
|
+
* will initialize with an object.
|
|
15
|
+
* @param {boolean} [cfg.singleValue] (NOT IN USE)
|
|
16
|
+
* @param {boolean} [cfg.hasKeyPath] If this is set (because there is a keyPath
|
|
17
|
+
* to be found within the object) and `hasValue` is true, an object type
|
|
18
|
+
* will be set and required at the root level. This option will also
|
|
19
|
+
* prevent selection of indexedDB key at root (since a key cannot be a
|
|
20
|
+
* plain object).
|
|
21
|
+
* @param {string} [cfg.typeNamespace] Used to prevent conflicts with other
|
|
22
|
+
* instances of typeChoices on the page
|
|
23
|
+
* @returns {{
|
|
24
|
+
* formatChoices: FormatChoices,
|
|
25
|
+
* typesHolder: TypesHolder,
|
|
26
|
+
* domArray: [formatChoices: FormatChoices, typesHolder: TypesHolder],
|
|
27
|
+
* getValue: (stateObj: import('./types.js').StateObject,
|
|
28
|
+
* currentPath: string) => import('./formats.js').StructuredCloneValue,
|
|
29
|
+
* getType: () => string|null|undefined,
|
|
30
|
+
* validValuesSet: () => boolean,
|
|
31
|
+
* setValue: SetValue
|
|
32
|
+
* }} The selector for types and the container for them. Both should be
|
|
33
|
+
* added to the page.
|
|
34
|
+
*/
|
|
35
|
+
export function formatAndTypeChoices({ schema, schemaContent, hasValue, singleValue, hasKeyPath, typeNamespace }: {
|
|
36
|
+
schema?: string | undefined;
|
|
37
|
+
schemaContent?: object | undefined;
|
|
38
|
+
hasValue?: boolean | undefined;
|
|
39
|
+
singleValue?: boolean | undefined;
|
|
40
|
+
hasKeyPath?: boolean | undefined;
|
|
41
|
+
typeNamespace?: string | undefined;
|
|
42
|
+
}): {
|
|
43
|
+
formatChoices: HTMLSelectElement;
|
|
44
|
+
typesHolder: HTMLDivElement;
|
|
45
|
+
domArray: [formatChoices: HTMLSelectElement, typesHolder: HTMLDivElement];
|
|
46
|
+
getValue: (stateObj: import('./types.js').StateObject, currentPath: string) => import('./formats.js').StructuredCloneValue;
|
|
47
|
+
getType: () => string | null | undefined;
|
|
48
|
+
validValuesSet: () => boolean;
|
|
49
|
+
setValue: SetValue;
|
|
50
|
+
};
|
|
51
|
+
export function getFormatAndSchemaChoices({ schema, hasKeyPath }?: {
|
|
52
|
+
schema?: string | undefined;
|
|
53
|
+
hasKeyPath?: boolean | undefined;
|
|
54
|
+
}): DocumentFragment;
|
|
55
|
+
export type SetValue = (value: import('./formats.js').StructuredCloneValue, stateObj: import('./types.js').StateObject) => Promise<void>;
|
|
56
|
+
//# sourceMappingURL=formatAndTypeChoices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatAndTypeChoices.d.ts","sourceRoot":"","sources":["../src/formatAndTypeChoices.js"],"names":[],"mappings":"AAgEA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAzBwB,MAAM;IACN,aAAa;IACZ,QAAQ;IAGR,WAAW;IACX,UAAU;IAKX,aAAa;;;;;yBAMX,OAAO,YAAY,EAAE,WAAW,eACtC,MAAM,KAAK,OAAO,cAAc,EAAE,oBAAoB;aAC5D,MAAM,MAAM,GAAC,IAAI,GAAC,SAAS;oBACpB,MAAM,OAAO;cACnB,QAAQ;EAkMtB;AAjRM;IANiB,MAAM;IACL,UAAU;IAGtB,gBAAgB,CAgD5B;+BAIU,OAAO,cAAc,EAAE,oBAAoB,YAC3C,OAAO,YAAY,EAAE,WAAW,KAC9B,QAAQ,IAAI,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexedDBKey.d.ts","sourceRoot":"","sources":["../../src/formats/indexedDBKey.js"],"names":[],"mappings":";AAEA,6CAA6C;AAC7C,4BADW,OAAO,eAAe,EAAE,MAAM,CAuCvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/formats/json.js"],"names":[],"mappings":";AAWA,6CAA6C;AAC7C,oBADW,OAAO,eAAe,EAAE,MAAM,CAyCvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaAndArbitrary.d.ts","sourceRoot":"","sources":["../../src/formats/schemaAndArbitrary.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,sBAFU,OAAO,wBAAwB,EAAE,cAAc,CAMvD;AAMK,wCAHI,MAAM,GACJ,MAAM,EAAE,CAMpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaOnly.d.ts","sourceRoot":"","sources":["../../src/formats/schemaOnly.js"],"names":[],"mappings":"AASA;;GAEG;AACH,sBAFU,OAAO,wBAAwB,EAAE,cAAc,CA4fvD;AAMK,wCAHI,MAAM,GACJ,MAAM,EAAE,CAMpB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default structuredCloning;
|
|
2
|
+
export type AddAndSetArrayElement = (info: {
|
|
3
|
+
propName: string;
|
|
4
|
+
type: import('../types.js').AvailableType;
|
|
5
|
+
value: import('../formats.js').StructuredCloneValue;
|
|
6
|
+
bringIntoFocus?: boolean;
|
|
7
|
+
schemaContent?: object;
|
|
8
|
+
schemaState?: import('../types.js').GetPossibleSchemasForPathAndType;
|
|
9
|
+
}) => Element;
|
|
10
|
+
export type EncapsulateObserver = import('typeson-registry').ObserverData;
|
|
11
|
+
export type FormatIterator = (records: import('../formats.js').StructuredCloneValue, stateObj: import('../types.js').StateObject) => Promise<Element>;
|
|
12
|
+
/**
|
|
13
|
+
* @callback FormatIterator
|
|
14
|
+
* @param {import('../formats.js').StructuredCloneValue} records
|
|
15
|
+
* @param {import('../types.js').StateObject} stateObj
|
|
16
|
+
* @returns {Promise<Element>}
|
|
17
|
+
*/
|
|
18
|
+
/** @type {import('../formats.js').Format} */
|
|
19
|
+
declare const structuredCloning: import('../formats.js').Format;
|
|
20
|
+
//# sourceMappingURL=structuredCloning.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structuredCloning.d.ts","sourceRoot":"","sources":["../../src/formats/structuredCloning.js"],"names":[],"mappings":";2CAcoB;IACnB,QAAY,EAAE,MAAM,CAAC;IACrB,IAAQ,EAAE,OAAO,aAAa,EAAE,aAAa,CAAC;IAC9C,KAAS,EAAE,OAAO,eAAe,EAAE,oBAAoB,CAAC;IACxD,cAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,aAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAe,CAAC,EAAE,OAAO,aAAa,EAAE,gCAAgC,CAAA;CACrE,KAAK,OAAO;kCAIH,OAAO,kBAAkB,EAAE,YAAY;uCA4RzC,OAAO,eAAe,EAAE,oBAAoB,YAC5C,OAAO,aAAa,EAAE,WAAW,KAC/B,QAAQ,OAAO,CAAC;AAJ7B;;;;;GAKG;AAEH,6CAA6C;AAC7C,iCADW,OAAO,eAAe,EAAE,MAAM,CA8FvC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {AvailableFormat} format
|
|
3
|
+
* @param {StructuredCloneValue} record
|
|
4
|
+
* @param {import('./types.js').StateObject} stateObj
|
|
5
|
+
* @returns {Promise<Element>}
|
|
6
|
+
*/
|
|
7
|
+
export function getControlsForFormatAndValue(format: AvailableFormat, record: StructuredCloneValue, stateObj: import('./types.js').StateObject): Promise<Element>;
|
|
8
|
+
export default Formats;
|
|
9
|
+
/**
|
|
10
|
+
* An arbitrary Structured Clone, JSON, etc. value.
|
|
11
|
+
*/
|
|
12
|
+
export type StructuredCloneValue = any;
|
|
13
|
+
export type AvailableFormat = "indexedDBKey" | "json" | "structuredCloning";
|
|
14
|
+
export type Format = {
|
|
15
|
+
types: () => (import('./types.js').AvailableType)[];
|
|
16
|
+
testInvalid?: ((newType: string, value: Date | Array<StructuredCloneValue>) => boolean | undefined) | undefined;
|
|
17
|
+
convertFromTypeson?: ((typesonType: import('./types.js').AvailableType) => import('./types.js').AvailableType | undefined) | undefined;
|
|
18
|
+
iterate: import('./formats/structuredCloning.js').FormatIterator;
|
|
19
|
+
getTypesForState: (state?: string) => undefined | (import('./types.js').AvailableType)[];
|
|
20
|
+
};
|
|
21
|
+
declare namespace Formats {
|
|
22
|
+
const availableFormats: {
|
|
23
|
+
[key: string]: Format;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=formats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formats.d.ts","sourceRoot":"","sources":["../src/formats.js"],"names":[],"mappings":"AAmDA;;;;;GAKG;AACH,qDALW,eAAe,UACf,oBAAoB,YACpB,OAAO,YAAY,EAAE,WAAW,GAC9B,QAAQ,OAAO,CAAC,CAU5B;;;;;mCA3DY,GAAG;8BAaH,cAAc,GAAC,MAAM,GAAC,mBAAmB;;WAK1C,MAAM,CAAC,OAAO,YAAY,EAAE,aAAa,CAAC,EAAE;6BAExC,MAAM,SAAS,IAAI,GAAC,MAAM,oBAAoB,CAAC,KACrD,OAAO,GAAC,SAAS;wCAEP,OAAO,YAAY,EAAE,aAAa,KAC5C,OAAO,YAAY,EAAE,aAAa,GAAC,SAAS;aACxC,OAAO,gCAAgC,EAAE,cAAc;+BACrC,MAAM,KAAK,SAAS,GACnD,CAAO,OAAO,YAAY,EAAE,aAAa,CAAC,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BooleanObjectType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/BooleanObjectType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,iCAFU,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,EAAE,EAAE,MAAM,CAAA;CAAC,CAmDvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberObjectType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/NumberObjectType.js"],"names":[],"mappings":";AAGA;;GAEG;AACH,gCAFU,OAAO,aAAa,EAAE,UAAU,CAoCxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringObjectType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/StringObjectType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,gCAFU,OAAO,aAAa,EAAE,UAAU,CA+BxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayReferenceType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayReferenceType.js"],"names":[],"mappings":";AAMA;;GAEG;AACH,kCAFU,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,IAAI,EAAE,OAAO,CAAA;CAAC,CAgN1D"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export default arrayType;
|
|
2
|
+
export type Integer = number;
|
|
3
|
+
export type ParseInt = () => any;
|
|
4
|
+
export type InputsExceedingLength = () => HTMLInputElement[];
|
|
5
|
+
export type GetPropertyInputs = () => HTMLInputElement[];
|
|
6
|
+
export type RedrawMoveArrows = () => void;
|
|
7
|
+
export type GetArrayItems = () => HTMLDivElement & {
|
|
8
|
+
$inputsExceedingLength: InputsExceedingLength;
|
|
9
|
+
$getPropertyInputs: GetPropertyInputs;
|
|
10
|
+
$redrawMoveArrows: RedrawMoveArrows;
|
|
11
|
+
};
|
|
12
|
+
export type Validate = () => Promise<void>;
|
|
13
|
+
export type Resort = (cfg: {
|
|
14
|
+
alwaysFocus?: true;
|
|
15
|
+
}) => void;
|
|
16
|
+
export type GetPropertyInput = () => HTMLInputElement | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {number} Integer
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @callback ParseInt
|
|
22
|
+
* @this {HTMLInputElement}
|
|
23
|
+
* @returns {false|Integer}
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {() => HTMLInputElement[]} InputsExceedingLength
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* @callback GetPropertyInputs
|
|
30
|
+
* @returns {HTMLInputElement[]}
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* @callback RedrawMoveArrows
|
|
34
|
+
* @returns {void}
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef {() => HTMLDivElement & {
|
|
38
|
+
* $inputsExceedingLength: InputsExceedingLength,
|
|
39
|
+
* $getPropertyInputs: GetPropertyInputs,
|
|
40
|
+
* $redrawMoveArrows: RedrawMoveArrows
|
|
41
|
+
* }} GetArrayItems
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {() => Promise<void>} Validate
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* @callback Resort
|
|
48
|
+
* @param {{alwaysFocus?: true}} cfg
|
|
49
|
+
* @returns {void}
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {() => HTMLInputElement|undefined} GetPropertyInput
|
|
53
|
+
*/
|
|
54
|
+
/**
|
|
55
|
+
* @type {import('../types.js').TypeObject & {sparse?: boolean|undefined}}
|
|
56
|
+
*/
|
|
57
|
+
declare const arrayType: import('../types.js').TypeObject & {
|
|
58
|
+
sparse?: boolean | undefined;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=arrayType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";sBAUa,MAAM;;oCAQN,MAAM,gBAAgB,EAAE;sCAIxB,gBAAgB,EAAE;qCAKlB,IAAI;4BAGJ,MAAM,cAAc,GAAG;IACnC,sBAA0B,EAAE,qBAAqB,CAAC;IAClD,kBAAsB,EAAE,iBAAiB,CAAC;IAC1C,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;AAtC7C;;GAEG;AACH;;;;GAIG;AACH;;GAEG;AACH;;;GAGG;AAEH;;;GAGG;AACH;;;;;;GAMG;AACH;;GAEG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,MAAM,CAAC,EAAE,OAAO,GAAC,SAAS,CAAA;CAAC,CA60CvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bigintType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/bigintType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,0BAFU,OAAO,aAAa,EAAE,UAAU,CA+CxC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default dateType;
|
|
2
|
+
export type SetValidity = (legitimateInvalid?: true | undefined) => void;
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {(
|
|
5
|
+
* legitimateInvalid?: true|undefined
|
|
6
|
+
* ) => void} SetValidity
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @type {import('../types.js').TypeObject & {
|
|
10
|
+
* dateRegex: RegExp,
|
|
11
|
+
* isInvalid: (cfg: {root: HTMLDivElement}) => boolean,
|
|
12
|
+
* isValueInvalid: (
|
|
13
|
+
* value: import('../formats.js').StructuredCloneValue
|
|
14
|
+
* ) => boolean
|
|
15
|
+
* valid?: true
|
|
16
|
+
* }}
|
|
17
|
+
*/
|
|
18
|
+
declare const dateType: import("../types.js").TypeObject & {
|
|
19
|
+
dateRegex: RegExp;
|
|
20
|
+
isInvalid: (cfg: {
|
|
21
|
+
root: HTMLDivElement;
|
|
22
|
+
}) => boolean;
|
|
23
|
+
isValueInvalid: (value: import('../formats.js').StructuredCloneValue) => boolean;
|
|
24
|
+
valid?: true | undefined;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=dateType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/dateType.js"],"names":[],"mappings":";+CAMyB,IAAI,GAAC,SAAS,KAC/B,IAAI;AAHZ;;;;GAIG;AAEH;;;;;;;;;GASG;AACH;eARgB,MAAM;qBACA;QAAC,IAAI,EAAE,cAAc,CAAA;KAAC,KAAK,OAAO;4BAE1C,OAAO,eAAe,EAAE,oBAAoB,KAChD,OAAO;;EA0If"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nullType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/nullType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,wBAFU,OAAO,aAAa,EAAE,UAAU,CA2BxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/numberType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,0BAFU,OAAO,aAAa,EAAE,UAAU,CAkDxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectReferenceType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/objectReferenceType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,mCAFU,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CA+CzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/objectType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,0BAFU,OAAO,aAAa,EAAE,UAAU,CAwBxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"regexpType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/regexpType.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,0BAFU,OAAO,aAAa,EAAE,UAAU,GAAG;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAC,CA4GnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sparseUndefinedType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/sparseUndefinedType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,mCAFU,OAAO,aAAa,EAAE,UAAU,CA2CxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/stringType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,0BAFU,OAAO,aAAa,EAAE,UAAU,CAyBxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undefinedType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/undefinedType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,6BAFU,OAAO,aAAa,EAAE,UAAU,CA+BxC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as Types } from "./types.js";
|
|
2
|
+
export { buildTypeChoices as typeChoices } from "./typeChoices.js";
|
|
3
|
+
export { default as Formats, getControlsForFormatAndValue } from "./formats.js";
|
|
4
|
+
export { formatAndTypeChoices, getFormatAndSchemaChoices } from "./formatAndTypeChoices.js";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepEqual.d.ts","sourceRoot":"","sources":["../../src/deepEqual.js"],"names":[],"mappings":";AAqEA,uBAAsD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a selector and container for types.
|
|
3
|
+
* @param {object} cfg
|
|
4
|
+
* @param {string} [cfg.schema] The schema name (NOT IN USE)
|
|
5
|
+
* @param {object} [cfg.schemaContent] The schema content (NOT IN USE)
|
|
6
|
+
* @param {boolean} [cfg.hasValue] Set to `true` if you are supplying
|
|
7
|
+
* your own value. If `false` and `hasKeyPath` is `true`,
|
|
8
|
+
* will initialize with an object.
|
|
9
|
+
* @param {boolean} [cfg.singleValue] (NOT IN USE)
|
|
10
|
+
* @param {boolean} [cfg.hasKeyPath] If this is set (because there is a keyPath
|
|
11
|
+
* to be found within the object) and `hasValue` is true, an object type
|
|
12
|
+
* will be set and required at the root level. This option will also
|
|
13
|
+
* prevent selection of indexedDB key at root (since a key cannot be a
|
|
14
|
+
* plain object).
|
|
15
|
+
* @param {string} [cfg.typeNamespace] Used to prevent conflicts with other
|
|
16
|
+
* instances of typeChoices on the page
|
|
17
|
+
* @returns {{
|
|
18
|
+
* formatChoices: FormatChoices,
|
|
19
|
+
* typesHolder: TypesHolder,
|
|
20
|
+
* domArray: [formatChoices: FormatChoices, typesHolder: TypesHolder],
|
|
21
|
+
* getValue: (stateObj: import('./types.js').StateObject,
|
|
22
|
+
* currentPath: string) => StructuredCloneValue,
|
|
23
|
+
* getType: () => string|undefined,
|
|
24
|
+
* validValuesSet: () => boolean
|
|
25
|
+
* }} The selector for types and the container for them. Both should be
|
|
26
|
+
* added to the page.
|
|
27
|
+
*/
|
|
28
|
+
export function formatAndTypeChoices({ schema, schemaContent, hasValue, singleValue, hasKeyPath, typeNamespace }: {
|
|
29
|
+
schema?: string | undefined;
|
|
30
|
+
schemaContent?: object | undefined;
|
|
31
|
+
hasValue?: boolean | undefined;
|
|
32
|
+
singleValue?: boolean | undefined;
|
|
33
|
+
hasKeyPath?: boolean | undefined;
|
|
34
|
+
typeNamespace?: string | undefined;
|
|
35
|
+
}): {
|
|
36
|
+
formatChoices: HTMLSelectElement;
|
|
37
|
+
typesHolder: HTMLDivElement;
|
|
38
|
+
domArray: [formatChoices: HTMLSelectElement, typesHolder: HTMLDivElement];
|
|
39
|
+
getValue: (stateObj: import('./types.js').StateObject, currentPath: string) => StructuredCloneValue;
|
|
40
|
+
getType: () => string | undefined;
|
|
41
|
+
validValuesSet: () => boolean;
|
|
42
|
+
};
|
|
43
|
+
export function getFormatAndSchemaChoices({ schema, hasKeyPath }?: {
|
|
44
|
+
schema?: string | undefined;
|
|
45
|
+
hasKeyPath?: boolean | undefined;
|
|
46
|
+
}): DocumentFragment;
|
|
47
|
+
//# sourceMappingURL=formatAndTypeChoices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatAndTypeChoices.d.ts","sourceRoot":"","sources":["../../src/formatAndTypeChoices.js"],"names":[],"mappings":"AA0DA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IAxBwB,MAAM;IACN,aAAa;IACZ,QAAQ;IAGR,WAAW;IACX,UAAU;IAKX,aAAa;;;;;yBAMX,OAAO,YAAY,EAAE,WAAW,eACtC,MAAM;aACZ,MAAM,MAAM,GAAC,SAAS;oBACf,MAAM,OAAO;EAmKjC;AApOM;IANiB,MAAM;IACL,UAAU;IAGtB,gBAAgB,CA0C5B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function types(): string[];
|
|
2
|
+
export function testInvalid(newType: string, value: Date | GenericArray): boolean;
|
|
3
|
+
export function convertFromTypeson(typesonType: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* @type {import('./structuredCloning.js').FormatIterator}
|
|
6
|
+
*/
|
|
7
|
+
export const iterate: import('./structuredCloning.js').FormatIterator;
|
|
8
|
+
export function getTypesForState(state: "array" | undefined): undefined | string[];
|
|
9
|
+
//# sourceMappingURL=indexedDBKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexedDBKey.d.ts","sourceRoot":"","sources":["../../../src/formats/indexedDBKey.js"],"names":[],"mappings":"AAMO,yBAFM,MAAM,EAAE,CAIpB;AASM,qCAJI,MAAM,SACN,IAAI,eAAa,GACf,OAAO,CAiBnB;AAMM,gDAHI,MAAM,GACJ,MAAM,CAUlB;AAED;;GAEG;AACH,sBAFU,OAAO,wBAAwB,EAAE,cAAc,CAKvD;AAMK,wCAHI,OAAO,GAAC,SAAS,GACf,SAAS,GAAC,MAAM,EAAE,CAQ9B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function types(): string[];
|
|
2
|
+
/**
|
|
3
|
+
* @type {import('./structuredCloning.js').FormatIterator}
|
|
4
|
+
*/
|
|
5
|
+
export const iterate: import('./structuredCloning.js').FormatIterator;
|
|
6
|
+
export function convertFromTypeson(typesonType: string): string;
|
|
7
|
+
export function testInvalid(newType: string, value: GenericArray): boolean | undefined;
|
|
8
|
+
export function getTypesForState(state: string): string[] | undefined;
|
|
9
|
+
//# sourceMappingURL=json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/formats/json.js"],"names":[],"mappings":"AAKO,yBAFM,MAAM,EAAE,CAIpB;AAED;;GAEG;AACH,sBAFU,OAAO,wBAAwB,EAAE,cAAc,CAWvD;AAOK,gDAHI,MAAM,GACJ,MAAM,CAOlB;AAOM,qCAJI,MAAM,wBAEJ,OAAO,GAAC,SAAS,CAW7B;AAMM,wCAHI,MAAM,GACJ,MAAM,EAAE,GAAC,SAAS,CAU9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaAndArbitrary.d.ts","sourceRoot":"","sources":["../../../src/formats/schemaAndArbitrary.js"],"names":[],"mappings":"AAEA;;GAEG;AACH,sBAFU,OAAO,wBAAwB,EAAE,cAAc,CAMvD;AAMK,wCAHI,MAAM,GACJ,MAAM,EAAE,CAMpB"}
|