@es-joy/jsoe 0.5.1 → 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.
Files changed (80) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.cjs +2 -0
  3. package/.nyc_output/out.json +121296 -0
  4. package/CHANGES.md +6 -0
  5. package/README.md +47 -21
  6. package/cypress.config.ts +13 -0
  7. package/demo/index-instrumented.html +29 -0
  8. package/demo/index.html +10 -1
  9. package/demo/index.js +482 -126
  10. package/dist/formatAndTypeChoices.d.ts +2 -2
  11. package/dist/formatAndTypeChoices.d.ts.map +1 -1
  12. package/dist/formats/json.d.ts.map +1 -1
  13. package/dist/formats/structuredCloning.d.ts +2 -1
  14. package/dist/formats/structuredCloning.d.ts.map +1 -1
  15. package/dist/fundamentalTypes/arrayType.d.ts +6 -37
  16. package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
  17. package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
  18. package/dist/fundamentalTypes/errorType.d.ts +6 -0
  19. package/dist/fundamentalTypes/errorType.d.ts.map +1 -0
  20. package/dist/fundamentalTypes/mapType.d.ts +6 -0
  21. package/dist/fundamentalTypes/mapType.d.ts.map +1 -0
  22. package/dist/fundamentalTypes/nullType.d.ts.map +1 -1
  23. package/dist/fundamentalTypes/objectReferenceType.d.ts.map +1 -1
  24. package/dist/fundamentalTypes/setType.d.ts +6 -0
  25. package/dist/fundamentalTypes/setType.d.ts.map +1 -0
  26. package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -1
  27. package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
  28. package/dist/subTypes/blobHTMLType.d.ts +12 -6
  29. package/dist/subTypes/blobHTMLType.d.ts.map +1 -1
  30. package/dist/superTypes/SpecialNumberType.d.ts +14 -0
  31. package/dist/superTypes/SpecialNumberType.d.ts.map +1 -0
  32. package/dist/superTypes/SpecialRealNumberType.d.ts +6 -0
  33. package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -0
  34. package/dist/superTypes/errorsSpecialType.d.ts +8 -0
  35. package/dist/superTypes/errorsSpecialType.d.ts.map +1 -0
  36. package/dist/typeChoices.d.ts +4 -2
  37. package/dist/typeChoices.d.ts.map +1 -1
  38. package/dist/types.d.ts +83 -231
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/utils/dialogs.d.ts +22 -22
  41. package/dist/utils/dialogs.d.ts.map +1 -1
  42. package/dist/utils/templateUtils.d.ts +6 -6
  43. package/dist/utils/templateUtils.d.ts.map +1 -1
  44. package/dist/vendor-imports.d.ts +1 -1
  45. package/package.json +39 -34
  46. package/rollup.config.js +14 -2
  47. package/server.js +1 -1
  48. package/src/formatAndTypeChoices.js +9 -9
  49. package/src/formats/indexedDBKey.js +2 -2
  50. package/src/formats/json.js +1 -2
  51. package/src/formats/structuredCloning.js +104 -29
  52. package/src/formats.js +2 -2
  53. package/src/fundamentalTypes/arrayReferenceType.js +3 -3
  54. package/src/fundamentalTypes/arrayType.js +384 -79
  55. package/src/fundamentalTypes/dateType.js +4 -6
  56. package/src/fundamentalTypes/errorType.js +416 -0
  57. package/src/fundamentalTypes/mapType.js +34 -0
  58. package/src/fundamentalTypes/nullType.js +1 -2
  59. package/src/fundamentalTypes/objectReferenceType.js +2 -1
  60. package/src/fundamentalTypes/regexpType.js +2 -2
  61. package/src/fundamentalTypes/setType.js +34 -0
  62. package/src/fundamentalTypes/sparseUndefinedType.js +2 -3
  63. package/src/fundamentalTypes/undefinedType.js +2 -3
  64. package/src/jsoe.css +3 -0
  65. package/src/subTypes/blobHTMLType.js +37 -33
  66. package/src/subTypes/falseType.js +2 -2
  67. package/src/subTypes/trueType.js +2 -2
  68. package/src/superTypes/{SpecialNumberSuperType.js → SpecialNumberType.js} +1 -1
  69. package/src/superTypes/{SpecialRealNumberSuperType.js → SpecialRealNumberType.js} +3 -2
  70. package/src/superTypes/errorsSpecialType.js +768 -0
  71. package/src/typeChoices.js +27 -20
  72. package/src/types.js +71 -39
  73. package/src/utils/dialogs.js +11 -12
  74. package/src/utils/jsonPointer.js +3 -3
  75. package/src/utils/templateUtils.js +4 -4
  76. package/src/vendor-imports.js +2 -2
  77. package/tsconfig.json +1 -1
  78. package/typings/CypressPlugins.d.ts +10 -0
  79. package/vendor/jamilih/dist/jml-es.js +126 -106
  80. package/vendor/typeson-registry/dist/index.js +188 -44
@@ -2,55 +2,24 @@ export default arrayType;
2
2
  export type Integer = number;
3
3
  export type ParseInt = () => any;
4
4
  export type InputsExceedingLength = () => HTMLInputElement[];
5
+ export type GetMapKeySelects = () => (HTMLSelectElement & {
6
+ $getValue: import('../typeChoices.js').GetValue;
7
+ })[];
8
+ export type ValidateMapKey = () => void;
5
9
  export type GetPropertyInputs = () => HTMLInputElement[];
6
10
  export type RedrawMoveArrows = () => void;
7
11
  export type GetArrayItems = () => HTMLDivElement & {
8
12
  $inputsExceedingLength: InputsExceedingLength;
9
13
  $getPropertyInputs: GetPropertyInputs;
10
14
  $redrawMoveArrows: RedrawMoveArrows;
15
+ $getMapKeySelects: GetMapKeySelects;
11
16
  };
12
17
  export type Validate = () => Promise<void>;
13
18
  export type Resort = (cfg: {
14
19
  alwaysFocus?: true;
15
20
  }) => void;
16
21
  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
- */
22
+ export type AnyValue = any;
54
23
  /**
55
24
  * @type {import('../types.js').TypeObject & {sparse?: boolean|undefined}}
56
25
  */
@@ -1 +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,CA40CvE"}
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,CAomDvE"}
@@ -1 +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;;EA4If"}
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,6 @@
1
+ export default errorType;
2
+ /**
3
+ * @type {import('../types.js').TypeObject}
4
+ */
5
+ declare const errorType: import('../types.js').TypeObject;
6
+ //# sourceMappingURL=errorType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/errorType.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,CAwZxC"}
@@ -0,0 +1,6 @@
1
+ export default mapType;
2
+ /**
3
+ * @type {import('../types.js').TypeObject}
4
+ */
5
+ declare const mapType: import('../types.js').TypeObject;
6
+ //# sourceMappingURL=mapType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mapType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/mapType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,uBAFU,OAAO,aAAa,EAAE,UAAU,CA4BxC"}
@@ -1 +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"}
1
+ {"version":3,"file":"nullType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/nullType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,wBAFU,OAAO,aAAa,EAAE,UAAU,CA0BxC"}
@@ -1 +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"}
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,CAgDzD"}
@@ -0,0 +1,6 @@
1
+ export default setType;
2
+ /**
3
+ * @type {import('../types.js').TypeObject}
4
+ */
5
+ declare const setType: import('../types.js').TypeObject;
6
+ //# sourceMappingURL=setType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/setType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,uBAFU,OAAO,aAAa,EAAE,UAAU,CA4BxC"}
@@ -1 +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"}
1
+ {"version":3,"file":"sparseUndefinedType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/sparseUndefinedType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,mCAFU,OAAO,aAAa,EAAE,UAAU,CA0CxC"}
@@ -1 +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"}
1
+ {"version":3,"file":"undefinedType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/undefinedType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,6BAFU,OAAO,aAAa,EAAE,UAAU,CA8BxC"}
@@ -1,14 +1,20 @@
1
1
  export default blobHTMLType;
2
+ export type SCEditorTextarea = HTMLTextAreaElement & {
3
+ sceditorInstance: {
4
+ val: (val?: string) => string | void;
5
+ };
6
+ };
2
7
  /**
3
- * @type {import('../types.js').TypeObject & {
4
- * loadBlob: (blob: Blob) => Promise<FileReader>,
8
+ * @typedef {HTMLTextAreaElement & {
5
9
  * sceditorInstance: {val: (val?: string) => string|void}
10
+ * }} SCEditorTextarea
11
+ */
12
+ /**
13
+ * @type {import('../types.js').TypeObject & {
14
+ * loadBlob: (blob: Blob) => Promise<string>
6
15
  * }}
7
16
  */
8
17
  declare const blobHTMLType: import("../types.js").TypeObject & {
9
- loadBlob: (blob: Blob) => Promise<FileReader>;
10
- sceditorInstance: {
11
- val: (val?: string) => string | void;
12
- };
18
+ loadBlob: (blob: Blob) => Promise<string>;
13
19
  };
14
20
  //# sourceMappingURL=blobHTMLType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"blobHTMLType.d.ts","sourceRoot":"","sources":["../../src/subTypes/blobHTMLType.js"],"names":[],"mappings":";AAOA;;;;;GAKG;AACH;qBAJsB,IAAI,KAAK,QAAQ,UAAU,CAAC;;oBACd,MAAM,KAAK,MAAM,GAAC,IAAI;;EAuKxD"}
1
+ {"version":3,"file":"blobHTMLType.d.ts","sourceRoot":"","sources":["../../src/subTypes/blobHTMLType.js"],"names":[],"mappings":";;;oBASoC,MAAM,KAAK,MAAM,GAAC,IAAI;;;AAF1D;;;;GAIG;AAEH;;;;GAIG;AACH;qBAHsB,IAAI,KAAK,QAAQ,MAAM,CAAC;EAsK5C"}
@@ -0,0 +1,14 @@
1
+ export default SpecialNumberSuperType;
2
+ export type SuperTypeObject = import('../types.js').TypeObject & {
3
+ childTypes: string[];
4
+ };
5
+ /**
6
+ * @typedef {import('../types.js').TypeObject & {
7
+ * childTypes: string[]
8
+ * }} SuperTypeObject
9
+ */
10
+ /**
11
+ * @type {SuperTypeObject}
12
+ */
13
+ declare const SpecialNumberSuperType: SuperTypeObject;
14
+ //# sourceMappingURL=SpecialNumberType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecialNumberType.d.ts","sourceRoot":"","sources":["../../src/superTypes/SpecialNumberType.js"],"names":[],"mappings":";8BAGa,OAAO,aAAa,EAAE,UAAU,GAAG;IAC/C,UAAc,EAAE,MAAM,EAAE,CAAA;CACrB;AAHJ;;;;GAIG;AAEH;;GAEG;AACH,sCAFU,eAAe,CAgEvB"}
@@ -0,0 +1,6 @@
1
+ export default SpecialRealNumberSuperType;
2
+ /**
3
+ * @type {import('./SpecialNumberType.js').SuperTypeObject}
4
+ */
5
+ declare const SpecialRealNumberSuperType: import('./SpecialNumberType.js').SuperTypeObject;
6
+ //# sourceMappingURL=SpecialRealNumberType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SpecialRealNumberType.d.ts","sourceRoot":"","sources":["../../src/superTypes/SpecialRealNumberType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,0CAFU,OAAO,wBAAwB,EAAE,eAAe,CAyDxD"}
@@ -0,0 +1,8 @@
1
+ export default errorsSpecialType;
2
+ export type Integer = number;
3
+ export type SpecialErrorType = ErrorConstructor | AggregateErrorConstructor;
4
+ /**
5
+ * @type {import('./SpecialNumberType.js').SuperTypeObject}
6
+ */
7
+ declare const errorsSpecialType: import('./SpecialNumberType.js').SuperTypeObject;
8
+ //# sourceMappingURL=errorsSpecialType.d.ts.map
@@ -0,0 +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,CAuvBxD"}
@@ -28,7 +28,7 @@
28
28
  */
29
29
  /**
30
30
  * @callback GetType
31
- * @returns {string|null|undefined}
31
+ * @returns {string}
32
32
  */
33
33
  /**
34
34
  * @callback ValidValuesSet
@@ -48,6 +48,7 @@
48
48
  * value?: import('./formats.js').StructuredCloneValue,
49
49
  * setValue?: boolean,
50
50
  * state?: string,
51
+ * arrayState?: string,
51
52
  * keySelectClass?: string,
52
53
  * requireObject?: boolean,
53
54
  * objectHasValue?: boolean,
@@ -82,7 +83,7 @@ export type TypeChoicesElementAPI = HTMLElement & {
82
83
  $setStyles: SetStyles;
83
84
  };
84
85
  export type GetValue = (stateObj?: import("./types.js").StateObject | undefined, currentPath?: string | undefined) => import('./formats.js').StructuredCloneValue;
85
- export type GetType = () => string | null | undefined;
86
+ export type GetType = () => string;
86
87
  export type ValidValuesSet = () => boolean;
87
88
  export type SetValue = (value: import('./formats.js').StructuredCloneValue, stateObj: import('./types.js').StateObject) => Promise<void>;
88
89
  export type BuildTypeChoices = (cfg: {
@@ -91,6 +92,7 @@ export type BuildTypeChoices = (cfg: {
91
92
  value?: import('./formats.js').StructuredCloneValue;
92
93
  setValue?: boolean;
93
94
  state?: string;
95
+ arrayState?: string;
94
96
  keySelectClass?: string;
95
97
  requireObject?: boolean;
96
98
  objectHasValue?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"typeChoices.d.ts","sourceRoot":"","sources":["../src/typeChoices.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;GAEG;AACH,+BAFU,gBAAgB,CAqPxB;sBAhUW,OAAO,YAAY,EAAE,OAAO;sCAIrB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,KAAK,IAAI;2CAIvC;IACpB,SAAa,CAAC,EAAE,OAAO,cAAc,EAAE,oBAAoB,CAAC;IAC5D,cAAkB,CAAC,EAAE,OAAO,CAAA;CACzB,KAAK,IAAI;wBAIA,MAAM,IAAI;oCAIV,WAAW,GAAG;IAC1B,qBAAyB,EAAE,oBAAoB,CAAC;IAChD,UAAc,EAAE,SAAS,CAAA;CACtB;sHAQS,OAAO,cAAc,EAAE,oBAAoB;4BAK3C,MAAM,GAAC,IAAI,GAAC,SAAS;mCAKrB,OAAO;+BAKT,OAAO,cAAc,EAAE,oBAAoB,YAC3C,OAAO,YAAY,EAAE,WAAW,KAC9B,QAAQ,IAAI,CAAC;qCAKf;IACV,MAAU,EAAE,OAAO,cAAc,EAAE,eAAe,CAAC;IACnD,aAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAS,CAAC,EAAE,OAAO,cAAc,EAAE,oBAAoB,CAAC;IACxD,QAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAW,CAAC,EAAE,OAAO,YAAY,EAAE,WAAW,CAAC;IAC/C,MAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAiB,CAAC,EAAE,MAAM,CAAC;CACxB,KACS;IACZ,QAAY,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAChE,QAAY,EAAE,QAAQ,CAAC;IACvB,OAAW,EAAE,OAAO,CAAC;IACrB,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAA;CACnB"}
1
+ {"version":3,"file":"typeChoices.d.ts","sourceRoot":"","sources":["../src/typeChoices.js"],"names":[],"mappings":"AAOA;;GAEG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH;;GAEG;AACH,+BAFU,gBAAgB,CA2PxB;sBAvUW,OAAO,YAAY,EAAE,OAAO;sCAIrB;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,KAAK,IAAI;2CAIvC;IACpB,SAAa,CAAC,EAAE,OAAO,cAAc,EAAE,oBAAoB,CAAC;IAC5D,cAAkB,CAAC,EAAE,OAAO,CAAA;CACzB,KAAK,IAAI;wBAIA,MAAM,IAAI;oCAIV,WAAW,GAAG;IAC1B,qBAAyB,EAAE,oBAAoB,CAAC;IAChD,UAAc,EAAE,SAAS,CAAA;CACtB;sHAQS,OAAO,cAAc,EAAE,oBAAoB;4BAK3C,MAAM;mCAKN,OAAO;+BAKT,OAAO,cAAc,EAAE,oBAAoB,YAC3C,OAAO,YAAY,EAAE,WAAW,KAC9B,QAAQ,IAAI,CAAC;qCAKf;IACV,MAAU,EAAE,OAAO,cAAc,EAAE,eAAe,CAAC;IACnD,aAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAS,CAAC,EAAE,OAAO,cAAc,EAAE,oBAAoB,CAAC;IACxD,QAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAW,CAAC,EAAE,OAAO,YAAY,EAAE,WAAW,CAAC;IAC/C,MAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAiB,CAAC,EAAE,MAAM,CAAC;CACxB,KACS;IACZ,QAAY,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC;IAChE,QAAY,EAAE,QAAQ,CAAC;IACvB,OAAW,EAAE,OAAO,CAAC;IACrB,cAAkB,EAAE,cAAc,CAAC;IACnC,QAAY,EAAE,QAAQ,CAAA;CACnB"}
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ export default Types;
3
3
  /**
4
4
  * Utility to retrieve the type out of a type root element.
5
5
  */
6
- export type GetTypeForRoot = (root: RootElement | null) => string | undefined | null;
6
+ export type GetTypeForRoot = (root: RootElement | null) => string;
7
7
  /**
8
8
  * Utility to get the value out of a type root element with a given
9
9
  * state and path.
@@ -85,6 +85,7 @@ export type StructuredCloneValue = import('./formats.js').StructuredCloneValue;
85
85
  export type JamilihArray = import('jamilih').JamilihArray;
86
86
  export type RootInfo = {
87
87
  format: import('./formats.js').AvailableFormat;
88
+ match: boolean | RegExpMatchArray | null;
88
89
  endMatchTypeObjs: TypeObject[];
89
90
  remnant: string;
90
91
  rootHolder: [
@@ -96,6 +97,10 @@ export type RootInfo = {
96
97
  parent?: object;
97
98
  parentPath?: string | number;
98
99
  };
100
+ export type TypeObjectSetValue = (info: {
101
+ root: HTMLDivElement;
102
+ value: StructuredCloneValue;
103
+ }) => void;
99
104
  export type TypeObject = {
100
105
  /**
101
106
  * Creates the option HTML. May set an option `title` or `value`
@@ -112,6 +117,26 @@ export type TypeObject = {
112
117
  * it is an array. Do not use in other types.
113
118
  */
114
119
  array?: boolean | undefined;
120
+ /**
121
+ * Private context variable. Whether or not
122
+ * it is a Map. Do not use in other types.
123
+ */
124
+ map?: boolean | undefined;
125
+ /**
126
+ * Private context variable. Whether or not
127
+ * it is a set. Do not use in other types.
128
+ */
129
+ set?: boolean | undefined;
130
+ /**
131
+ * Private context variable. Whether or not
132
+ * it is a sparse array. Do not use in other types.
133
+ */
134
+ sparse?: boolean | undefined;
135
+ /**
136
+ * Private context variable. Whether or not
137
+ * it is a valid date. Do not use in other types.
138
+ */
139
+ valid?: boolean | undefined;
115
140
  /**
116
141
  * Used for string parsing.
117
142
  */
@@ -146,7 +171,11 @@ export type TypeObject = {
146
171
  * Converts from string to value. May use
147
172
  * `stringRegex` to find components.
148
173
  */
149
- toValue: (s: string, info?: RootInfo) => StructuredCloneValue;
174
+ toValue: (s: string, info?: RootInfo) => {
175
+ value?: StructuredCloneValue;
176
+ remnant?: string;
177
+ assign?: false;
178
+ };
150
179
  /**
151
180
  * Gets the value for the type
152
181
  */
@@ -156,12 +185,10 @@ export type TypeObject = {
156
185
  currentPath?: string;
157
186
  }) => StructuredCloneValue;
158
187
  /**
159
- * Should set the value of the form's `getInput` element
188
+ * Should set the value of the
189
+ * form's `getInput` element
160
190
  */
161
- setValue?: ((info: {
162
- root: HTMLDivElement;
163
- value: StructuredCloneValue;
164
- }) => void) | undefined;
191
+ setValue?: TypeObjectSetValue | undefined;
165
192
  viewUI: (info: {
166
193
  value?: StructuredCloneValue;
167
194
  typeNamespace?: string;
@@ -177,6 +204,7 @@ export type TypeObject = {
177
204
  format?: import('./formats.js').AvailableFormat;
178
205
  resultType?: "keys" | "values" | "both";
179
206
  type?: AvailableType;
207
+ arrayState?: string;
180
208
  buildTypeChoices?: import('./typeChoices.js').BuildTypeChoices;
181
209
  topRoot?: HTMLDivElement;
182
210
  }) => import("jamilih").JamilihArray;
@@ -222,7 +250,7 @@ export type TypeObject = {
222
250
  };
223
251
  } | undefined;
224
252
  };
225
- export type AvailableType = "null" | "true" | "false" | "number" | "bigint" | "string" | "arrayReference" | "objectReference" | "array" | "object" | "date" | "userObject" | "undef" | "SpecialRealNumber" | "SpecialNumber" | "regexp" | "BooleanObject" | "NumberObject" | "StringObject" | "map" | "set" | "file" | "filelist" | "blobHTML" | "arraybuffer" | "arraybufferview" | "dataview" | "imagedata" | "imagebitmap" | "int8array" | "uint8array" | "uint8clampedarray" | "int16array" | "uint16array" | "int32array" | "uint32array" | "float32array" | "float64array" | "IntlCollator" | "IntlDateTimeFormat" | "IntlNumberFormat" | "sparseUndefined" | "ValidDate" | "arrayNonindexKeys";
253
+ export type AvailableType = "null" | "true" | "false" | "number" | "bigint" | "string" | "arrayReference" | "objectReference" | "array" | "object" | "date" | "userObject" | "undef" | "SpecialRealNumber" | "SpecialNumber" | "regexp" | "BooleanObject" | "NumberObject" | "StringObject" | "map" | "set" | "file" | "filelist" | "blobHTML" | "arraybuffer" | "arraybufferview" | "dataview" | "imagedata" | "imagebitmap" | "int8array" | "uint8array" | "uint8clampedarray" | "int16array" | "uint16array" | "int32array" | "uint32array" | "float32array" | "float64array" | "IntlCollator" | "IntlDateTimeFormat" | "IntlNumberFormat" | "ValidDate" | "arrayNonindexKeys" | "error" | "errors";
226
254
  export type GetPossibleSchemasForPathAndType = (keypath: string, parentPath: string, arrayOrObjectPropertyName: string, valueType: string) => StateObject;
227
255
  export type StateObject = {
228
256
  typeNamespace?: string | undefined;
@@ -249,7 +277,7 @@ export type RootElement = HTMLDivElement;
249
277
  * Utility to retrieve the type out of a type root element.
250
278
  * @callback GetTypeForRoot
251
279
  * @param {?RootElement} root
252
- * @returns {string|undefined|null} Why would it not exist?
280
+ * @returns {string} Why would it not exist?
253
281
  */
254
282
  /**
255
283
  * Utility to get the value out of a type root element with a given
@@ -369,8 +397,7 @@ export type RootElement = HTMLDivElement;
369
397
  /**
370
398
  * @type {{
371
399
  * availableTypes: {
372
- * [key in AvailableType]: Partial<TypeObject>|string[]|
373
- * {valid: true}|{sparse: true}
400
+ * [key in AvailableType]: Partial<TypeObject>|string[]
374
401
  * },
375
402
  * getTypeForRoot: GetTypeForRoot,
376
403
  * getValueForRoot: GetValueForRoot,
@@ -396,226 +423,51 @@ export type RootElement = HTMLDivElement;
396
423
  */
397
424
  declare const Types: {
398
425
  availableTypes: {
399
- string: string[] | Partial<TypeObject> | {
400
- valid: true;
401
- } | {
402
- sparse: true;
403
- };
404
- number: string[] | Partial<TypeObject> | {
405
- valid: true;
406
- } | {
407
- sparse: true;
408
- };
409
- bigint: string[] | Partial<TypeObject> | {
410
- valid: true;
411
- } | {
412
- sparse: true;
413
- };
414
- object: string[] | Partial<TypeObject> | {
415
- valid: true;
416
- } | {
417
- sparse: true;
418
- };
419
- map: string[] | Partial<TypeObject> | {
420
- valid: true;
421
- } | {
422
- sparse: true;
423
- };
424
- set: string[] | Partial<TypeObject> | {
425
- valid: true;
426
- } | {
427
- sparse: true;
428
- };
429
- false: string[] | Partial<TypeObject> | {
430
- valid: true;
431
- } | {
432
- sparse: true;
433
- };
434
- file: string[] | Partial<TypeObject> | {
435
- valid: true;
436
- } | {
437
- sparse: true;
438
- };
439
- arraybuffer: string[] | Partial<TypeObject> | {
440
- valid: true;
441
- } | {
442
- sparse: true;
443
- };
444
- date: string[] | Partial<TypeObject> | {
445
- valid: true;
446
- } | {
447
- sparse: true;
448
- };
449
- null: string[] | Partial<TypeObject> | {
450
- valid: true;
451
- } | {
452
- sparse: true;
453
- };
454
- regexp: string[] | Partial<TypeObject> | {
455
- valid: true;
456
- } | {
457
- sparse: true;
458
- };
459
- array: string[] | Partial<TypeObject> | {
460
- valid: true;
461
- } | {
462
- sparse: true;
463
- };
464
- true: string[] | Partial<TypeObject> | {
465
- valid: true;
466
- } | {
467
- sparse: true;
468
- };
469
- arrayReference: string[] | Partial<TypeObject> | {
470
- valid: true;
471
- } | {
472
- sparse: true;
473
- };
474
- objectReference: string[] | Partial<TypeObject> | {
475
- valid: true;
476
- } | {
477
- sparse: true;
478
- };
479
- userObject: string[] | Partial<TypeObject> | {
480
- valid: true;
481
- } | {
482
- sparse: true;
483
- };
484
- undef: string[] | Partial<TypeObject> | {
485
- valid: true;
486
- } | {
487
- sparse: true;
488
- };
489
- SpecialRealNumber: string[] | Partial<TypeObject> | {
490
- valid: true;
491
- } | {
492
- sparse: true;
493
- };
494
- SpecialNumber: string[] | Partial<TypeObject> | {
495
- valid: true;
496
- } | {
497
- sparse: true;
498
- };
499
- BooleanObject: string[] | Partial<TypeObject> | {
500
- valid: true;
501
- } | {
502
- sparse: true;
503
- };
504
- NumberObject: string[] | Partial<TypeObject> | {
505
- valid: true;
506
- } | {
507
- sparse: true;
508
- };
509
- StringObject: string[] | Partial<TypeObject> | {
510
- valid: true;
511
- } | {
512
- sparse: true;
513
- };
514
- filelist: string[] | Partial<TypeObject> | {
515
- valid: true;
516
- } | {
517
- sparse: true;
518
- };
519
- blobHTML: string[] | Partial<TypeObject> | {
520
- valid: true;
521
- } | {
522
- sparse: true;
523
- };
524
- arraybufferview: string[] | Partial<TypeObject> | {
525
- valid: true;
526
- } | {
527
- sparse: true;
528
- };
529
- dataview: string[] | Partial<TypeObject> | {
530
- valid: true;
531
- } | {
532
- sparse: true;
533
- };
534
- imagedata: string[] | Partial<TypeObject> | {
535
- valid: true;
536
- } | {
537
- sparse: true;
538
- };
539
- imagebitmap: string[] | Partial<TypeObject> | {
540
- valid: true;
541
- } | {
542
- sparse: true;
543
- };
544
- int8array: string[] | Partial<TypeObject> | {
545
- valid: true;
546
- } | {
547
- sparse: true;
548
- };
549
- uint8array: string[] | Partial<TypeObject> | {
550
- valid: true;
551
- } | {
552
- sparse: true;
553
- };
554
- uint8clampedarray: string[] | Partial<TypeObject> | {
555
- valid: true;
556
- } | {
557
- sparse: true;
558
- };
559
- int16array: string[] | Partial<TypeObject> | {
560
- valid: true;
561
- } | {
562
- sparse: true;
563
- };
564
- uint16array: string[] | Partial<TypeObject> | {
565
- valid: true;
566
- } | {
567
- sparse: true;
568
- };
569
- int32array: string[] | Partial<TypeObject> | {
570
- valid: true;
571
- } | {
572
- sparse: true;
573
- };
574
- uint32array: string[] | Partial<TypeObject> | {
575
- valid: true;
576
- } | {
577
- sparse: true;
578
- };
579
- float32array: string[] | Partial<TypeObject> | {
580
- valid: true;
581
- } | {
582
- sparse: true;
583
- };
584
- float64array: string[] | Partial<TypeObject> | {
585
- valid: true;
586
- } | {
587
- sparse: true;
588
- };
589
- IntlCollator: string[] | Partial<TypeObject> | {
590
- valid: true;
591
- } | {
592
- sparse: true;
593
- };
594
- IntlDateTimeFormat: string[] | Partial<TypeObject> | {
595
- valid: true;
596
- } | {
597
- sparse: true;
598
- };
599
- IntlNumberFormat: string[] | Partial<TypeObject> | {
600
- valid: true;
601
- } | {
602
- sparse: true;
603
- };
604
- sparseUndefined: string[] | Partial<TypeObject> | {
605
- valid: true;
606
- } | {
607
- sparse: true;
608
- };
609
- ValidDate: string[] | Partial<TypeObject> | {
610
- valid: true;
611
- } | {
612
- sparse: true;
613
- };
614
- arrayNonindexKeys: string[] | Partial<TypeObject> | {
615
- valid: true;
616
- } | {
617
- sparse: true;
618
- };
426
+ string: string[] | Partial<TypeObject>;
427
+ number: string[] | Partial<TypeObject>;
428
+ bigint: string[] | Partial<TypeObject>;
429
+ object: string[] | Partial<TypeObject>;
430
+ map: string[] | Partial<TypeObject>;
431
+ set: string[] | Partial<TypeObject>;
432
+ false: string[] | Partial<TypeObject>;
433
+ error: string[] | Partial<TypeObject>;
434
+ file: string[] | Partial<TypeObject>;
435
+ arraybuffer: string[] | Partial<TypeObject>;
436
+ date: string[] | Partial<TypeObject>;
437
+ null: string[] | Partial<TypeObject>;
438
+ regexp: string[] | Partial<TypeObject>;
439
+ array: string[] | Partial<TypeObject>;
440
+ true: string[] | Partial<TypeObject>;
441
+ arrayReference: string[] | Partial<TypeObject>;
442
+ objectReference: string[] | Partial<TypeObject>;
443
+ userObject: string[] | Partial<TypeObject>;
444
+ undef: string[] | Partial<TypeObject>;
445
+ SpecialRealNumber: string[] | Partial<TypeObject>;
446
+ SpecialNumber: string[] | Partial<TypeObject>;
447
+ BooleanObject: string[] | Partial<TypeObject>;
448
+ NumberObject: string[] | Partial<TypeObject>;
449
+ StringObject: string[] | Partial<TypeObject>;
450
+ filelist: string[] | Partial<TypeObject>;
451
+ blobHTML: string[] | Partial<TypeObject>;
452
+ arraybufferview: string[] | Partial<TypeObject>;
453
+ dataview: string[] | Partial<TypeObject>;
454
+ imagedata: string[] | Partial<TypeObject>;
455
+ imagebitmap: string[] | Partial<TypeObject>;
456
+ int8array: string[] | Partial<TypeObject>;
457
+ uint8array: string[] | Partial<TypeObject>;
458
+ uint8clampedarray: string[] | Partial<TypeObject>;
459
+ int16array: string[] | Partial<TypeObject>;
460
+ uint16array: string[] | Partial<TypeObject>;
461
+ int32array: string[] | Partial<TypeObject>;
462
+ uint32array: string[] | Partial<TypeObject>;
463
+ float32array: string[] | Partial<TypeObject>;
464
+ float64array: string[] | Partial<TypeObject>;
465
+ IntlCollator: string[] | Partial<TypeObject>;
466
+ IntlDateTimeFormat: string[] | Partial<TypeObject>;
467
+ IntlNumberFormat: string[] | Partial<TypeObject>;
468
+ ValidDate: string[] | Partial<TypeObject>;
469
+ arrayNonindexKeys: string[] | Partial<TypeObject>;
470
+ errors: string[] | Partial<TypeObject>;
619
471
  };
620
472
  getTypeForRoot: GetTypeForRoot;
621
473
  getValueForRoot: GetValueForRoot;