@es-joy/jsoe 0.3.0 → 0.4.1

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 (189) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +1 -0
  3. package/.ncurc.cjs +9 -0
  4. package/CHANGES.md +8 -0
  5. package/demo/index.html +8 -0
  6. package/demo/index.js +1 -1
  7. package/dist/formatAndTypeChoices.d.ts +56 -0
  8. package/dist/formatAndTypeChoices.d.ts.map +1 -0
  9. package/dist/formats/indexedDBKey.d.ts +4 -0
  10. package/dist/formats/indexedDBKey.d.ts.map +1 -0
  11. package/dist/formats/json.d.ts +4 -0
  12. package/dist/formats/json.d.ts.map +1 -0
  13. package/dist/formats/schemaAndArbitrary.d.ts +6 -0
  14. package/dist/formats/schemaAndArbitrary.d.ts.map +1 -0
  15. package/dist/formats/schemaOnly.d.ts +6 -0
  16. package/dist/formats/schemaOnly.d.ts.map +1 -0
  17. package/dist/formats/structuredCloning.d.ts +20 -0
  18. package/dist/formats/structuredCloning.d.ts.map +1 -0
  19. package/dist/formats.d.ts +26 -0
  20. package/dist/formats.d.ts.map +1 -0
  21. package/dist/fundamentalTypes/BooleanObjectType.d.ts +8 -0
  22. package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
  23. package/dist/fundamentalTypes/NumberObjectType.d.ts +6 -0
  24. package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
  25. package/dist/fundamentalTypes/StringObjectType.d.ts +6 -0
  26. package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -0
  27. package/dist/fundamentalTypes/arrayReferenceType.d.ts +8 -0
  28. package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
  29. package/dist/fundamentalTypes/arrayType.d.ts +60 -0
  30. package/dist/fundamentalTypes/arrayType.d.ts.map +1 -0
  31. package/dist/fundamentalTypes/bigintType.d.ts +6 -0
  32. package/dist/fundamentalTypes/bigintType.d.ts.map +1 -0
  33. package/dist/fundamentalTypes/dateType.d.ts +26 -0
  34. package/dist/fundamentalTypes/dateType.d.ts.map +1 -0
  35. package/dist/fundamentalTypes/nullType.d.ts +6 -0
  36. package/dist/fundamentalTypes/nullType.d.ts.map +1 -0
  37. package/dist/fundamentalTypes/numberType.d.ts +6 -0
  38. package/dist/fundamentalTypes/numberType.d.ts.map +1 -0
  39. package/dist/fundamentalTypes/objectReferenceType.d.ts +8 -0
  40. package/dist/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
  41. package/dist/fundamentalTypes/objectType.d.ts +6 -0
  42. package/dist/fundamentalTypes/objectType.d.ts.map +1 -0
  43. package/dist/fundamentalTypes/regexpType.d.ts +8 -0
  44. package/dist/fundamentalTypes/regexpType.d.ts.map +1 -0
  45. package/dist/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
  46. package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
  47. package/dist/fundamentalTypes/stringType.d.ts +6 -0
  48. package/dist/fundamentalTypes/stringType.d.ts.map +1 -0
  49. package/dist/fundamentalTypes/undefinedType.d.ts +6 -0
  50. package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -0
  51. package/dist/index.d.ts +5 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/src/deepEqual.d.ts +3 -0
  54. package/dist/src/deepEqual.d.ts.map +1 -0
  55. package/dist/src/formatAndTypeChoices.d.ts +47 -0
  56. package/dist/src/formatAndTypeChoices.d.ts.map +1 -0
  57. package/dist/src/formats/indexedDBKey.d.ts +9 -0
  58. package/dist/src/formats/indexedDBKey.d.ts.map +1 -0
  59. package/dist/src/formats/json.d.ts +9 -0
  60. package/dist/src/formats/json.d.ts.map +1 -0
  61. package/dist/src/formats/schemaAndArbitrary.d.ts +6 -0
  62. package/dist/src/formats/schemaAndArbitrary.d.ts.map +1 -0
  63. package/dist/src/formats/schemaOnly.d.ts +6 -0
  64. package/dist/src/formats/schemaOnly.d.ts.map +1 -0
  65. package/dist/src/formats/structuredCloning.d.ts +15 -0
  66. package/dist/src/formats/structuredCloning.d.ts.map +1 -0
  67. package/dist/src/formats.d.ts +18 -0
  68. package/dist/src/formats.d.ts.map +1 -0
  69. package/dist/src/fundamentalTypes/BooleanObjectType.d.ts +6 -0
  70. package/dist/src/fundamentalTypes/BooleanObjectType.d.ts.map +1 -0
  71. package/dist/src/fundamentalTypes/NumberObjectType.d.ts +6 -0
  72. package/dist/src/fundamentalTypes/NumberObjectType.d.ts.map +1 -0
  73. package/dist/src/fundamentalTypes/StringObjectType.d.ts +6 -0
  74. package/dist/src/fundamentalTypes/StringObjectType.d.ts.map +1 -0
  75. package/dist/src/fundamentalTypes/arrayReferenceType.d.ts +6 -0
  76. package/dist/src/fundamentalTypes/arrayReferenceType.d.ts.map +1 -0
  77. package/dist/src/fundamentalTypes/arrayType.d.ts +6 -0
  78. package/dist/src/fundamentalTypes/arrayType.d.ts.map +1 -0
  79. package/dist/src/fundamentalTypes/bigintType.d.ts +6 -0
  80. package/dist/src/fundamentalTypes/bigintType.d.ts.map +1 -0
  81. package/dist/src/fundamentalTypes/dateType.d.ts +6 -0
  82. package/dist/src/fundamentalTypes/dateType.d.ts.map +1 -0
  83. package/dist/src/fundamentalTypes/nullType.d.ts +6 -0
  84. package/dist/src/fundamentalTypes/nullType.d.ts.map +1 -0
  85. package/dist/src/fundamentalTypes/numberType.d.ts +6 -0
  86. package/dist/src/fundamentalTypes/numberType.d.ts.map +1 -0
  87. package/dist/src/fundamentalTypes/objectReferenceType.d.ts +6 -0
  88. package/dist/src/fundamentalTypes/objectReferenceType.d.ts.map +1 -0
  89. package/dist/src/fundamentalTypes/objectType.d.ts +6 -0
  90. package/dist/src/fundamentalTypes/objectType.d.ts.map +1 -0
  91. package/dist/src/fundamentalTypes/regexpType.d.ts +6 -0
  92. package/dist/src/fundamentalTypes/regexpType.d.ts.map +1 -0
  93. package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts +6 -0
  94. package/dist/src/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -0
  95. package/dist/src/fundamentalTypes/stringType.d.ts +6 -0
  96. package/dist/src/fundamentalTypes/stringType.d.ts.map +1 -0
  97. package/dist/src/fundamentalTypes/undefinedType.d.ts +6 -0
  98. package/dist/src/fundamentalTypes/undefinedType.d.ts.map +1 -0
  99. package/dist/src/index.d.ts +5 -0
  100. package/dist/src/index.d.ts.map +1 -0
  101. package/dist/src/subTypes/blobHTMLType.d.ts +26 -0
  102. package/dist/src/subTypes/blobHTMLType.d.ts.map +1 -0
  103. package/dist/src/subTypes/falseType.d.ts +6 -0
  104. package/dist/src/subTypes/falseType.d.ts.map +1 -0
  105. package/dist/src/subTypes/trueType.d.ts +6 -0
  106. package/dist/src/subTypes/trueType.d.ts.map +1 -0
  107. package/dist/src/superTypes/SpecialNumberSuperType.d.ts +11 -0
  108. package/dist/src/superTypes/SpecialNumberSuperType.d.ts.map +1 -0
  109. package/dist/src/superTypes/SpecialRealNumberSuperType.d.ts +6 -0
  110. package/dist/src/superTypes/SpecialRealNumberSuperType.d.ts.map +1 -0
  111. package/dist/src/typeChoices.d.ts +30 -0
  112. package/dist/src/typeChoices.d.ts.map +1 -0
  113. package/dist/src/types.d.ts +333 -0
  114. package/dist/src/types.d.ts.map +1 -0
  115. package/dist/src/utils/dialogs.d.ts +29 -0
  116. package/dist/src/utils/dialogs.d.ts.map +1 -0
  117. package/dist/src/utils/jsonPointer.d.ts +42 -0
  118. package/dist/src/utils/jsonPointer.d.ts.map +1 -0
  119. package/dist/src/utils/templateUtils.d.ts +59 -0
  120. package/dist/src/utils/templateUtils.d.ts.map +1 -0
  121. package/dist/src/utils/types.d.ts +2 -0
  122. package/dist/src/utils/types.d.ts.map +1 -0
  123. package/dist/subTypes/blobHTMLType.d.ts +14 -0
  124. package/dist/subTypes/blobHTMLType.d.ts.map +1 -0
  125. package/dist/subTypes/falseType.d.ts +8 -0
  126. package/dist/subTypes/falseType.d.ts.map +1 -0
  127. package/dist/subTypes/trueType.d.ts +8 -0
  128. package/dist/subTypes/trueType.d.ts.map +1 -0
  129. package/dist/superTypes/SpecialNumberSuperType.d.ts +14 -0
  130. package/dist/superTypes/SpecialNumberSuperType.d.ts.map +1 -0
  131. package/dist/superTypes/SpecialRealNumberSuperType.d.ts +6 -0
  132. package/dist/superTypes/SpecialRealNumberSuperType.d.ts.map +1 -0
  133. package/dist/typeChoices.d.ts +103 -0
  134. package/dist/typeChoices.d.ts.map +1 -0
  135. package/dist/types.d.ts +523 -0
  136. package/dist/types.d.ts.map +1 -0
  137. package/dist/utils/dialogs.d.ts +109 -0
  138. package/dist/utils/dialogs.d.ts.map +1 -0
  139. package/dist/utils/jsonPointer.d.ts +46 -0
  140. package/dist/utils/jsonPointer.d.ts.map +1 -0
  141. package/dist/utils/templateUtils.d.ts +59 -0
  142. package/dist/utils/templateUtils.d.ts.map +1 -0
  143. package/dist/utils/types.d.ts +2 -0
  144. package/dist/utils/types.d.ts.map +1 -0
  145. package/dist/vendor/jamilih/dist/jml-es.d.ts +436 -0
  146. package/dist/vendor/jamilih/dist/jml-es.d.ts.map +1 -0
  147. package/dist/vendor/typeson-registry/dist/index.d.ts +400 -0
  148. package/dist/vendor/typeson-registry/dist/index.d.ts.map +1 -0
  149. package/dist/vendor-imports.d.ts +3 -0
  150. package/dist/vendor-imports.d.ts.map +1 -0
  151. package/package.json +17 -11
  152. package/postorder-traversal.js +58 -0
  153. package/src/formatAndTypeChoices.js +95 -50
  154. package/src/formats/indexedDBKey.js +49 -57
  155. package/src/formats/json.js +47 -56
  156. package/src/formats/schemaOnly.js +12 -2
  157. package/src/formats/structuredCloning.js +162 -105
  158. package/src/formats.js +38 -10
  159. package/src/fundamentalTypes/BooleanObjectType.js +6 -4
  160. package/src/fundamentalTypes/NumberObjectType.js +5 -3
  161. package/src/fundamentalTypes/StringObjectType.js +1 -1
  162. package/src/fundamentalTypes/arrayReferenceType.js +29 -14
  163. package/src/fundamentalTypes/arrayType.js +789 -278
  164. package/src/fundamentalTypes/bigintType.js +2 -2
  165. package/src/fundamentalTypes/dateType.js +42 -14
  166. package/src/fundamentalTypes/nullType.js +1 -1
  167. package/src/fundamentalTypes/numberType.js +2 -2
  168. package/src/fundamentalTypes/objectReferenceType.js +7 -5
  169. package/src/fundamentalTypes/regexpType.js +45 -24
  170. package/src/fundamentalTypes/sparseUndefinedType.js +7 -1
  171. package/src/fundamentalTypes/stringType.js +1 -1
  172. package/src/fundamentalTypes/undefinedType.js +2 -2
  173. package/src/subTypes/blobHTMLType.js +42 -22
  174. package/src/subTypes/falseType.js +2 -2
  175. package/src/subTypes/trueType.js +2 -2
  176. package/src/superTypes/SpecialNumberSuperType.js +13 -6
  177. package/src/superTypes/SpecialRealNumberSuperType.js +11 -5
  178. package/src/typeChoices.js +137 -55
  179. package/src/types.js +309 -146
  180. package/src/utils/dialogs.js +98 -29
  181. package/src/utils/jsonPointer.js +4 -0
  182. package/src/utils/templateUtils.js +27 -12
  183. package/src/vendor-imports.js +8 -0
  184. package/tsconfig.json +18 -0
  185. package/typings/sceditor.d.ts +20 -0
  186. package/vendor/jamilih/dist/jml-es.js +1019 -389
  187. package/vendor/jamilih/dist/jml.d.ts +436 -0
  188. package/vendor/jamilih/package.json +136 -0
  189. package/vendor/typeson-registry/dist/index.js +365 -83
@@ -1,7 +1,12 @@
1
1
  /* eslint-disable promise/avoid-new */
2
- import {jml, nbsp} from '../../vendor/jamilih/dist/jml-es.js';
2
+ import {jml, nbsp, body} from '../vendor-imports.js';
3
3
  import {$e} from './templateUtils.js';
4
4
 
5
+ /**
6
+ * @typedef {{[key: string]: string}} Locale
7
+ */
8
+
9
+ /** @type {Locale} */
5
10
  const localeStrings = {
6
11
  submit: 'Submit',
7
12
  cancel: 'Cancel',
@@ -10,19 +15,39 @@ const localeStrings = {
10
15
 
11
16
  // Todo: i18nize
12
17
  const dialogs = {
18
+ /** @type {Locale} */
19
+ localeStrings: {},
20
+ /**
21
+ * @param {Locale} [locale={}]
22
+ * @returns {void}
23
+ */
13
24
  setLocale (locale = {}) {
14
25
  this.localeStrings = {...localeStrings, ...locale};
15
26
  },
27
+
28
+ /**
29
+ * @typedef {object} MakeDialogArgs
30
+ * @property {import('jamilih').JamilihAttributes} [atts={}]
31
+ * @property {import('jamilih').JamilihChildren} [children=[]]
32
+ * @property {import('jamilih').EventHandler} [close]
33
+ * @property {boolean} [remove=true]
34
+ */
35
+ /**
36
+ * @param {MakeDialogArgs} cfg
37
+ * @returns {HTMLDialogElement}
38
+ */
16
39
  makeDialog ({atts = {}, children = [], close, remove = true} = {}) {
17
40
  if (close) {
18
41
  if (!atts.$on) {
19
42
  atts.$on = {};
20
43
  }
21
- if (!atts.$on.close) {
44
+ if (!('close' in atts.$on)) {
22
45
  atts.$on.close = close;
23
46
  }
24
47
  }
25
- const dialog = jml('dialog', atts, children, document.body);
48
+ const dialog = /** @type {HTMLDialogElement} */ (
49
+ jml('dialog', atts, children, body)
50
+ );
26
51
  dialog.showModal();
27
52
  if (remove) {
28
53
  dialog.addEventListener('close', () => {
@@ -31,35 +56,37 @@ const dialogs = {
31
56
  }
32
57
  return dialog;
33
58
  },
34
- makeSubmitDialog ({submit, submitClass = 'submit', ...args}) {
35
- const dialog = this.makeCancelDialog(args);
36
- $e(dialog, `button.${args.cancelClass || 'cancel'}`).before(
37
- jml('button', {
38
- class: submitClass,
39
- $on: {
40
- click (e) {
41
- submit.call(this, {e, dialog});
42
- }
43
- }
44
- }, [this.localeStrings.submit]),
45
- nbsp.repeat(2)
46
- );
47
- return dialog;
48
- },
59
+ /**
60
+ * @typedef {object} MakeCancelArgs
61
+ * @property {(
62
+ * info: {e: Event, dialog: HTMLDialogElement}
63
+ * ) => boolean} cancel
64
+ * @property {string} cancelClass
65
+ * @property {string} submitClass
66
+ * @property {...MakeDialogArgs} args
67
+ */
68
+ /**
69
+ * @param {MakeCancelArgs} cfg
70
+ * @returns {HTMLDialogElement}
71
+ */
49
72
  makeCancelDialog ({
50
- submit, // Don't pass this on to `args` if present
51
73
  cancel,
52
74
  cancelClass = 'cancel', submitClass = 'submit',
53
75
  ...args
54
76
  }) {
55
- const dialog = this.makeDialog(args);
77
+ const dialog = this.makeDialog(/** @type {MakeDialogArgs} */ (args));
56
78
  jml('div', {class: submitClass}, [
57
79
  ['br'], ['br'],
58
80
  ['button', {class: cancelClass, $on: {
59
81
  click (e) {
60
- e.preventDefault();
82
+ e?.preventDefault();
61
83
  if (cancel) {
62
- if (cancel.call(this, {e, dialog}) === false) {
84
+ if (
85
+ cancel.call(
86
+ // eslint-disable-next-line object-shorthand -- Needed for TS
87
+ this, {e: /** @type {Event} */ (e), dialog}
88
+ ) === false
89
+ ) {
63
90
  return;
64
91
  }
65
92
  }
@@ -69,13 +96,45 @@ const dialogs = {
69
96
  ], dialog);
70
97
  return dialog;
71
98
  },
99
+ /**
100
+ * @param {object} cfg
101
+ * @param {(info: {e: Event, dialog: HTMLDialogElement}) => void} cfg.submit
102
+ * @param {string} [cfg.submitClass="submit"]
103
+ * @param {MakeCancelArgs} [cfg.args]
104
+ * @returns {HTMLDialogElement}
105
+ */
106
+ makeSubmitDialog ({submit, submitClass = 'submit', ...args}) {
107
+ const dialog = this.makeCancelDialog(/** @type {MakeCancelArgs} */ (args));
108
+ $e(dialog, `button.${/** @type {MakeCancelArgs} */ (
109
+ args
110
+ ).cancelClass || 'cancel'}`)?.before(
111
+ jml('button', {
112
+ class: submitClass,
113
+ $on: {
114
+ click (e) {
115
+ // eslint-disable-next-line object-shorthand -- Needed for TS
116
+ submit.call(this, {e: /** @type {Event} */ (e), dialog});
117
+ }
118
+ }
119
+ }, [this.localeStrings.submit]),
120
+ nbsp.repeat(2)
121
+ );
122
+ return dialog;
123
+ },
124
+ /**
125
+ * @param {string|{
126
+ * submitClass?: string,
127
+ * message: string|import('jamilih').JamilihArray
128
+ * }} message
129
+ * @returns {Promise<void>}
130
+ */
72
131
  alert (message) {
73
132
  message = typeof message === 'string' ? {message} : message;
74
133
  const {submitClass = 'submit'} = message;
75
- ({message} = message);
134
+ const {message: outputMessage} = message;
76
135
  return new Promise((resolve, _reject) => {
77
- const dialog = jml('dialog', [
78
- message,
136
+ const dialog = /** @type {HTMLDialogElement} */ (jml('dialog', [
137
+ /** @type {string|import('jamilih').JamilihArray} */ (outputMessage),
79
138
  ['br'], ['br'],
80
139
  ['div', {class: submitClass}, [
81
140
  ['button', {$on: {click () {
@@ -83,14 +142,24 @@ const dialogs = {
83
142
  resolve();
84
143
  }}}, [this.localeStrings.ok]]
85
144
  ]]
86
- ], document.body);
145
+ ], body));
87
146
  dialog.showModal();
88
147
  });
89
148
  },
149
+ /**
150
+ * @param {object} cfg
151
+ * @param {import('jamilih').JamilihAttributes} [cfg.atts={}]
152
+ * @param {string|{message: string}} cfg.message
153
+ * @param {string} [cfg.submitClass="submit"]
154
+ */
90
155
  confirm ({atts = {}, message, submitClass = 'submit'}) {
91
156
  ({message} = typeof message === 'string' ? {message} : message);
92
- return new Promise((resolve, reject) => {
93
- const dialog = jml('dialog', atts, [
157
+ return new Promise((
158
+ /** @type {(value?: any) => void} */
159
+ resolve,
160
+ reject
161
+ ) => {
162
+ const dialog = /** @type {HTMLDialogElement} */ (jml('dialog', atts, [
94
163
  message,
95
164
  ['br'], ['br'],
96
165
  ['div', {class: submitClass}, [
@@ -104,7 +173,7 @@ const dialogs = {
104
173
  reject(new Error('cancelled'));
105
174
  }}}, [this.localeStrings.cancel]]
106
175
  ]]
107
- ], document.body);
176
+ ], body));
108
177
  dialog.showModal();
109
178
  });
110
179
  }
@@ -39,6 +39,10 @@ const getJSONPointerParts = (path) => {
39
39
  );
40
40
  };
41
41
 
42
+ /**
43
+ * @typedef {any} ArbitraryObject
44
+ */
45
+
42
46
  /**
43
47
  * @param {ArbitraryObject} obj
44
48
  * @param {string} pathPart
@@ -6,7 +6,7 @@ const U = {nbsp, upArrow, downArrow};
6
6
 
7
7
  /**
8
8
  * @param {string} sel
9
- * @returns {Element}
9
+ * @returns {Element|null}
10
10
  */
11
11
  const $ = (sel) => document.querySelector(sel);
12
12
 
@@ -19,11 +19,14 @@ const $$ = (sel) => [...document.querySelectorAll(sel)];
19
19
  /**
20
20
  * @param {Element|string} el
21
21
  * @param {string} descendentsSel
22
- * @returns {Element}
22
+ * @returns {HTMLElement|null}
23
23
  */
24
24
  const $e = (el, descendentsSel) => {
25
- el = typeof el === 'string' ? $(el) : el;
26
- return el.querySelector(descendentsSel);
25
+ const elem = typeof el === 'string' ? $(el) : el;
26
+ if (!elem) {
27
+ return null;
28
+ }
29
+ return elem.querySelector(descendentsSel);
27
30
  };
28
31
 
29
32
  /**
@@ -32,8 +35,11 @@ const $e = (el, descendentsSel) => {
32
35
  * @returns {Element[]}
33
36
  */
34
37
  const $$e = (el, descendentsSel) => {
35
- el = typeof el === 'string' ? $(el) : el;
36
- return [...el.querySelectorAll(descendentsSel)];
38
+ const elem = typeof el === 'string' ? $(el) : el;
39
+ if (!elem) {
40
+ return [];
41
+ }
42
+ return [...elem.querySelectorAll(descendentsSel)];
37
43
  };
38
44
 
39
45
  /**
@@ -41,9 +47,12 @@ const $$e = (el, descendentsSel) => {
41
47
  * @returns {void}
42
48
  */
43
49
  const removeChildren = (node) => {
44
- node = typeof node === 'string' ? $(node) : node;
45
- while (node.hasChildNodes()) {
46
- node.lastChild.remove();
50
+ const nde = typeof node === 'string' ? $(node) : node;
51
+ if (!nde) {
52
+ throw new Error('Node not found!');
53
+ }
54
+ while (nde.hasChildNodes()) {
55
+ nde.lastChild?.remove();
47
56
  }
48
57
  };
49
58
 
@@ -76,14 +85,20 @@ const filterChildElements = (el, selectors) => {
76
85
  });
77
86
  return matchingChildElements;
78
87
  };
79
- el = typeof el === 'string' ? $(el) : el;
80
- let filtered = [el];
88
+ const elem = typeof el === 'string' ? $(el) : el;
89
+ if (!elem) {
90
+ throw new Error('Element not found!');
91
+ }
92
+ let filtered = [elem];
81
93
  selectors = Array.isArray(selectors) ? selectors : [selectors];
82
94
  selectors.forEach((sel) => {
83
95
  filtered = filtered.reduce((els, childElement) => {
96
+ if (!childElement) {
97
+ return els;
98
+ }
84
99
  els.push(...getMatchingChildrenForElement(childElement, sel));
85
100
  return els;
86
- }, []);
101
+ }, /** @type {Element[]} */ ([]));
87
102
  });
88
103
  return filtered;
89
104
  };
@@ -0,0 +1,8 @@
1
+ export {jml, body, nbsp} from 'jamilih';
2
+ // export {jml, body, nbsp} from '../node_modules/jamilih/dist/jml-es.js';
3
+
4
+ export {
5
+ getJSONType,
6
+ Typeson, unescapeKeyPathComponent, structuredCloningThrowing
7
+ } from 'typeson-registry';
8
+ // } from '../node_modules/typeson-registry/dist/index.js';
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["es2022", "DOM"],
4
+ "moduleResolution": "node",
5
+ "module": "esnext",
6
+ "allowJs": true,
7
+ "checkJs": true,
8
+ "noEmit": false,
9
+ "declaration": true,
10
+ "declarationMap": true,
11
+ "emitDeclarationOnly": true,
12
+ "strict": true,
13
+ "target": "es6",
14
+ "outDir": "dist"
15
+ },
16
+ "include": ["src/**/*.js", "typings/sceditor.d.ts"],
17
+ "exclude": ["node_modules", "src/deepEqual.js", "src/formats/schemaOnly.js", "src/formats/schemaAndArbitrary.js"]
18
+ }
@@ -0,0 +1,20 @@
1
+ type sceditorOptions = {
2
+ width: string,
3
+ height: string,
4
+ autoUpdate: boolean,
5
+ resizeMaxHeight: number,
6
+ resizeMaxWidth: number,
7
+ plugins: string,
8
+ emoticonsRoot: string,
9
+ style: string
10
+ }
11
+ type sceditorInstance = {
12
+ val: (val?: string) => string|void
13
+ }
14
+
15
+ declare interface SCEditor {
16
+ instance: ((textarea: HTMLTextAreaElement) => sceditorInstance),
17
+ create: (textarea: HTMLTextAreaElement, opts: sceditorOptions) => void
18
+ }
19
+
20
+ declare var sceditor: SCEditor;