@es-joy/jsoe 0.5.1 → 0.6.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 (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 +10 -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 +101 -29
  52. package/src/formats.js +2 -2
  53. package/src/fundamentalTypes/arrayReferenceType.js +3 -3
  54. package/src/fundamentalTypes/arrayType.js +390 -87
  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
@@ -21,7 +21,7 @@ import Types from '../types.js';
21
21
  const dateType = {
22
22
  option: ['Date'],
23
23
  // ISO Date string
24
- dateRegex: /^(?:\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}\.\d{3}Z)?|(?:\+|-)\d{6}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)$/u, // eslint-disable-line unicorn/no-unsafe-regex
24
+ dateRegex: /^(?:\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}\.\d{3}Z)?|(?:\+|-)\d{6}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z)$/u,
25
25
  stringRegex () {
26
26
  const regex = this.dateRegex;
27
27
  if (!this.valid) {
@@ -47,7 +47,7 @@ const dateType = {
47
47
  const dateStr = new Date(Date.parse(value)).toISOString();
48
48
  this.getInput({root}).value = dateStr.length === 24
49
49
  ? dateStr.slice(0, 10)
50
- // eslint-disable-next-line max-len -- Long
50
+ // eslint-disable-next-line @stylistic/max-len -- Long
51
51
  /* istanbul ignore next -- 6 digits year not reliable through `Date.parse` */
52
52
  : dateStr.slice(3, 13); // Will cut off ten/hundred thousand years
53
53
  },
@@ -111,9 +111,8 @@ const dateType = {
111
111
  * @type {SetValidity}
112
112
  */
113
113
  $setValidity (legitimateInvalid) {
114
- console.log('legitimateInvalid', legitimateInvalid);
114
+ // console.log('legitimateInvalid', legitimateInvalid);
115
115
  if (legitimateInvalid === true) {
116
- // @ts-ignore Erring out of IDE
117
116
  /** @type {HTMLInputElement} */ (this).checked = true;
118
117
  }
119
118
  const label = /** @type {HTMLLabelElement} */ (
@@ -129,8 +128,7 @@ const dateType = {
129
128
  }
130
129
  },
131
130
  $on: {
132
- // @ts-ignore Erring out of IDE
133
- click (e) {
131
+ click (/* e */) {
134
132
  /** @type {HTMLElement & {$setValidity: SetValidity}} */ (
135
133
  this
136
134
  ).$setValidity();
@@ -0,0 +1,416 @@
1
+ import {error as errorTypesonRegistry} from 'typeson-registry';
2
+ import {$e} from '../utils/templateUtils.js';
3
+ import {jml} from '../vendor-imports.js';
4
+
5
+ /**
6
+ * @type {import('../types.js').TypeObject}
7
+ */
8
+ const errorType = {
9
+ option: ['Error'],
10
+ stringRegex: /^Error\((.*)\)$/u,
11
+ toValue (s) {
12
+ const obj = JSON.parse(s);
13
+ const errObj = /** @type {{revive: import('typeson-registry').Reviver}} */ (
14
+ errorTypesonRegistry.error
15
+ ).revive(obj, {});
16
+ return {value: errObj};
17
+ },
18
+ getInput ({root}) { // Which one to get here?
19
+ return /** @type {HTMLInputElement} */ ($e(root, 'input:not([type])'));
20
+ },
21
+ setValue ({root, value}) {
22
+ if (typeof value.message === 'string') {
23
+ /** @type {HTMLInputElement} */ (
24
+ $e(root, 'input.message:not([type])')
25
+ ).value = value.message;
26
+ } else {
27
+ /** @type {HTMLInputElement} */ (
28
+ $e(root, 'input.message[type=checkbox]')
29
+ ).click();
30
+ }
31
+ if (typeof value.name === 'string') {
32
+ /** @type {HTMLInputElement} */ (
33
+ $e(root, 'input.name:not([type])')
34
+ ).value = value.name;
35
+ } else {
36
+ /** @type {HTMLInputElement} */ (
37
+ $e(root, 'input.name[type=checkbox]')
38
+ ).click();
39
+ }
40
+ if (typeof value.fileName === 'string') {
41
+ /** @type {HTMLInputElement} */ (
42
+ $e(root, 'input.fileName:not([type])')
43
+ ).value = value.fileName;
44
+ } else {
45
+ /** @type {HTMLInputElement} */ (
46
+ $e(root, 'input.fileName[type=checkbox]')
47
+ ).click();
48
+ }
49
+
50
+ if (typeof value.lineNumber === 'number') {
51
+ /** @type {HTMLInputElement} */ (
52
+ $e(root, 'input.lineNumber[type=number]')
53
+ ).value = value.lineNumber;
54
+ } else {
55
+ /** @type {HTMLInputElement} */ (
56
+ $e(root, 'input.lineNumber[type=number]')
57
+ ).value = '';
58
+ }
59
+
60
+ if (typeof value.columnNumber === 'number') {
61
+ /** @type {HTMLInputElement} */ (
62
+ $e(root, 'input.columnNumber[type=number]')
63
+ ).value = value.columnNumber;
64
+ } else {
65
+ /** @type {HTMLInputElement} */ (
66
+ $e(root, 'input.columnNumber[type=number]')
67
+ ).value = '';
68
+ }
69
+
70
+ if (typeof value.stack === 'string') {
71
+ /** @type {HTMLTextAreaElement} */ (
72
+ $e(root, 'textarea.stack:not([type])')
73
+ ).value = value.stack;
74
+ } else {
75
+ /** @type {HTMLInputElement} */ (
76
+ $e(root, 'input.stack[type=checkbox]')
77
+ ).click();
78
+ }
79
+
80
+ setTimeout(() => {
81
+ if (typeof value.cause === 'object') {
82
+ /** @type {HTMLElement} */ ($e(root, '.cause')).click();
83
+ /** @type {import('../types.js').TypeObjectSetValue} */ (
84
+ this.setValue
85
+ )({
86
+ root: /** @type {HTMLDivElement} */ ($e(root, '.causeContents')),
87
+ value: value.cause
88
+ });
89
+ }
90
+ });
91
+ },
92
+ getValue ({root}) {
93
+ /**
94
+ * @type {{
95
+ * name: string|undefined,
96
+ * stack?: string|undefined,
97
+ * cause?: unknown,
98
+ * message?: string|undefined
99
+ * fileName?: string,
100
+ * lineNumber?: number|undefined,
101
+ * columnNumber?: number|undefined
102
+ * }}
103
+ */
104
+ let errObj;
105
+ if (/** @type {HTMLInputElement} */ (
106
+ $e(root, 'input.message[type=checkbox]')
107
+ ).checked) {
108
+ const message = /** @type {HTMLInputElement} */ (
109
+ $e(root, 'input.message:not([type])')
110
+ ).value;
111
+ errObj = new Error(message);
112
+ } else {
113
+ // eslint-disable-next-line unicorn/error-message -- User requested
114
+ errObj = new Error();
115
+ errObj.message = undefined; // Force (at least needed for Chrome)
116
+ }
117
+ if (/** @type {HTMLInputElement} */ (
118
+ $e(root, 'input.name[type=checkbox]')
119
+ ).checked) {
120
+ const name = /** @type {HTMLInputElement} */ (
121
+ $e(root, 'input.name:not([type])')
122
+ ).value;
123
+ errObj.name = name;
124
+ } else {
125
+ errObj.name = undefined;
126
+ }
127
+ if (/** @type {HTMLInputElement} */ (
128
+ $e(root, 'input.fileName[type=checkbox]')
129
+ ).checked) {
130
+ const fileName = /** @type {HTMLInputElement} */ (
131
+ $e(root, 'input.fileName:not([type])')
132
+ ).value;
133
+ errObj.fileName = fileName;
134
+ } else {
135
+ errObj.fileName = undefined;
136
+ }
137
+ if (/** @type {HTMLInputElement} */ (
138
+ $e(root, 'input.stack[type=checkbox]')
139
+ ).checked) {
140
+ const stack = /** @type {HTMLTextAreaElement} */ (
141
+ $e(root, 'textarea.stack:not([type])')
142
+ ).value;
143
+ errObj.stack = stack;
144
+ } else {
145
+ errObj.stack = undefined;
146
+ }
147
+
148
+ const lineNumber = /** @type {HTMLInputElement} */ (
149
+ $e(root, 'input.lineNumber[type=number]')
150
+ ).value;
151
+ errObj.lineNumber = lineNumber === '' ? undefined : Number(lineNumber);
152
+
153
+ const columnNumber = /** @type {HTMLInputElement} */ (
154
+ $e(root, 'input.columnNumber[type=number]')
155
+ ).value;
156
+ errObj.columnNumber = columnNumber === ''
157
+ ? undefined
158
+ : Number(columnNumber);
159
+
160
+ const causeContents = /** @type {HTMLDivElement} */ (
161
+ $e(root, '.causeContents')
162
+ );
163
+ if (causeContents.children.length) {
164
+ errObj.cause = this.getValue({
165
+ root: causeContents
166
+ });
167
+ }
168
+
169
+ return errObj;
170
+ },
171
+ viewUI (
172
+ {value: o, format}
173
+ ) {
174
+ return /** @type {import('jamilih').JamilihArray} */ ([
175
+ 'div', {dataset: {type: 'error'}}, [
176
+ typeof o.message === 'string'
177
+ ? ['div', [['b', ['Message: ']], ['span', [o.message]]]]
178
+ : [],
179
+ typeof o.name === 'string'
180
+ ? ['div', [['b', ['Name: ']], ['span', [o.name]]]]
181
+ : [],
182
+ typeof o.fileName === 'string'
183
+ ? ['div', [['b', ['File name: ']], ['span', [o.fileName]]]]
184
+ : [],
185
+ typeof o.lineNumber === 'number'
186
+ ? ['div', [['b', ['Line number: ']], ['span', [o.lineNumber]]]]
187
+ : [],
188
+ typeof o.columnNumber === 'number'
189
+ ? ['div', [['b', ['Column number: ']], ['span', [o.columnNumber]]]]
190
+ : [],
191
+ typeof o.stack === 'string'
192
+ ? ['div', [['b', ['Stack: ']], ['span', [o.stack]]]]
193
+ : [],
194
+ ['b', ['Cause: ']], ['div', {class: 'causeHolder'}, [
195
+ ['button', {$on: {click (/** @type {Event} */ e) {
196
+ e.preventDefault();
197
+ const {target} = e;
198
+ const causeContents = /** @type {HTMLDivElement} */ (
199
+ /** @type {HTMLElement} */ (target).nextElementSibling
200
+ );
201
+ causeContents.hidden = !causeContents.hidden;
202
+ /** @type {HTMLElement} */ (
203
+ target
204
+ ).textContent = causeContents.hidden ? '+' : '-';
205
+ }}}, ['-']],
206
+ ['div', {class: 'causeContents'}, [
207
+ o.cause
208
+ ? this.viewUI({
209
+ format,
210
+ value: o.cause
211
+ })
212
+ : ''
213
+ ]]
214
+ ]]
215
+ ]
216
+ ]);
217
+ },
218
+ editUI ({typeNamespace, value = {
219
+ message: '',
220
+ name: '',
221
+ fileName: '',
222
+ lineNumber: '',
223
+ columnNumber: '',
224
+ stack: '',
225
+ cause: undefined
226
+ }}) {
227
+ /**
228
+ * @param {Event} e
229
+ * @this {HTMLInputElement}
230
+ * @returns {void}
231
+ */
232
+ const click = function (e) {
233
+ /** @type {HTMLElement} */ (
234
+ /** @type {HTMLElement} */ (
235
+ this.parentNode
236
+ ).nextElementSibling
237
+ // eslint-disable-next-line @stylistic/space-unary-ops -- TS
238
+ ).hidden = !
239
+ /** @type {HTMLInputElement} */
240
+ (e.target).checked;
241
+ };
242
+ // eslint-disable-next-line consistent-this -- Clearer
243
+ const component = this;
244
+
245
+ if (typeof value.cause === 'object') {
246
+ setTimeout(() => {
247
+ /** @type {HTMLElement} */ ($e(
248
+ div, '.cause'
249
+ )).click();
250
+ });
251
+ }
252
+
253
+ const div = /** @type {HTMLDivElement} */ (jml(
254
+ 'div',
255
+ {dataset: {type: 'error'}},
256
+ /** @type {import('jamilih').JamilihChildren} */ ([
257
+ ['div', [
258
+ ['label', [
259
+ 'Message? ',
260
+ ['input', {
261
+ class: 'message',
262
+ type: 'checkbox', checked: typeof value.message === 'string',
263
+ $on: {
264
+ click
265
+ }
266
+ }]
267
+ ]],
268
+ ' ',
269
+ ['label', {
270
+ hidden: typeof value.message !== 'string'
271
+ }, [
272
+ 'Message ',
273
+ ['input', {
274
+ class: 'message',
275
+ name: `${typeNamespace}-error-message`,
276
+ value: value.message
277
+ }]
278
+ ]]
279
+ ]],
280
+ ['div', [
281
+ ['label', [
282
+ 'Name? ',
283
+ ['input', {
284
+ class: 'name',
285
+ type: 'checkbox', checked: typeof value.name === 'string',
286
+ $on: {
287
+ click
288
+ }
289
+ }]
290
+ ]],
291
+ ' ',
292
+ ['label', {
293
+ hidden: typeof value.name !== 'string'
294
+ }, [
295
+ 'Name ',
296
+ ['input', {
297
+ class: 'name',
298
+ name: `${typeNamespace}-error-name`,
299
+ value: value.name
300
+ }]
301
+ ]]
302
+ ]],
303
+ ['br'],
304
+ ['div', [
305
+ ['label', [
306
+ 'File name? ',
307
+ ['input', {
308
+ class: 'fileName',
309
+ type: 'checkbox', checked: typeof value.fileName === 'string',
310
+ $on: {
311
+ click
312
+ }
313
+ }]
314
+ ]],
315
+ ' ',
316
+ ['label', {
317
+ hidden: typeof value.fileName !== 'string'
318
+ }, [
319
+ 'File name ',
320
+ ['input', {
321
+ class: 'fileName',
322
+ name: `${typeNamespace}-error-fileName`,
323
+ value: value.fileName
324
+ }]
325
+ ]]
326
+ ]],
327
+ ['label', [
328
+ 'Line number ',
329
+ ['input', {
330
+ class: 'lineNumber',
331
+ name: `${typeNamespace}-error-lineNumber`,
332
+ type: 'number', step: 'any', value: value.lineNumber
333
+ }]
334
+ ]],
335
+ ['br'],
336
+ ['label', [
337
+ 'Column number ',
338
+ ['input', {
339
+ class: 'columnNumber',
340
+ name: `${typeNamespace}-error-columnNumber`,
341
+ type: 'number', step: 'any', value: value.columnNumber
342
+ }]
343
+ ]],
344
+ ['div', [
345
+ ['label', [
346
+ 'Stack? ',
347
+ ['input', {
348
+ class: 'stack',
349
+ type: 'checkbox', checked: typeof value.stack === 'string',
350
+ $on: {
351
+ click
352
+ }
353
+ }]
354
+ ]],
355
+ ['label', {
356
+ hidden: typeof value.stack !== 'string'
357
+ }, [
358
+ 'Stack ',
359
+ ['textarea', {
360
+ class: 'stack',
361
+ name: `${typeNamespace}-error-stack`
362
+ }, [
363
+ value.stack
364
+ ]]
365
+ ]]
366
+ ]],
367
+ ['label', [
368
+ 'Cause? ',
369
+ ['input', {
370
+ class: 'cause',
371
+ type: 'checkbox',
372
+ $on: {
373
+ click (e) {
374
+ click.call(/** @type {HTMLInputElement} */ (this), e);
375
+ const causeHolder = /** @type {Element} */ (
376
+ /** @type {Element} */ (
377
+ this.parentElement
378
+ ).nextElementSibling
379
+ );
380
+ const causeContents = $e(causeHolder, '.causeContents');
381
+ if (!causeContents?.children.length) {
382
+ const editui = component.editUI({
383
+ typeNamespace,
384
+ value: value.cause
385
+ });
386
+ jml(...editui, causeContents);
387
+ }
388
+ }
389
+ }
390
+ }]
391
+ ]],
392
+ ['div', {class: 'causeHolder', hidden: true}, [
393
+ ['label', ['Cause ']],
394
+ ['button', {$on: {click (/** @type {Event} */ e) {
395
+ e.preventDefault();
396
+ const {target} = e;
397
+ const causeContents = /** @type {HTMLDivElement} */ ($e(
398
+ /** @type {HTMLElement} */
399
+ (/** @type {HTMLElement} */ (target).closest('.causeHolder')),
400
+ '.causeContents'
401
+ ));
402
+ causeContents.hidden = !causeContents.hidden;
403
+ /** @type {HTMLElement} */ (
404
+ target
405
+ ).textContent = causeContents.hidden ? '+' : '-';
406
+ }}}, ['-']],
407
+ ['div', {class: 'causeContents'}]
408
+ ]]
409
+ ])
410
+ ));
411
+
412
+ return [div];
413
+ }
414
+ };
415
+
416
+ export default errorType;
@@ -0,0 +1,34 @@
1
+ import arrayType from './arrayType.js';
2
+
3
+ /**
4
+ * @type {import('../types.js').TypeObject}
5
+ */
6
+ const mapType = {
7
+ option: ['Map'],
8
+ array: true,
9
+ map: true,
10
+ regexEndings: [',', ')'],
11
+ stringRegexBegin: /^Map\(/u,
12
+ stringRegexEnd: /^\)/u,
13
+ toValue (...args) {
14
+ return arrayType.toValue.apply(this, args);
15
+ },
16
+ getValue (...args) {
17
+ return arrayType.getValue.apply(this, args);
18
+ },
19
+ getInput (...args) {
20
+ return arrayType.getInput.apply(this, args);
21
+ },
22
+ viewUI ({...args}) {
23
+ return arrayType.viewUI.call(this, {
24
+ ...args, type: 'map'
25
+ });
26
+ },
27
+ editUI ({...args}) {
28
+ return arrayType.editUI.call(this, {
29
+ ...args, type: 'map'
30
+ });
31
+ }
32
+ };
33
+
34
+ export default mapType;
@@ -22,8 +22,7 @@ const nullType = {
22
22
  ['input', {
23
23
  type: 'checkbox',
24
24
  name: `${typeNamespace}-null`,
25
- checked: true,
26
- disabled: true
25
+ checked: true
27
26
  }]
28
27
  ]]
29
28
  ]];
@@ -21,7 +21,8 @@ const objectReferenceType = {
21
21
  contexts: [
22
22
  'arrayNonindexKeys',
23
23
  // 'sparseArrays',
24
- 'object'
24
+ 'object',
25
+ 'set'
25
26
  ]
26
27
  }
27
28
  },
@@ -20,11 +20,11 @@ const regexpType = {
20
20
  if (typeof this.stringRegex !== 'function') {
21
21
  throw new TypeError('Guard for TS');
22
22
  }
23
- const [, str, flags] = s.match(
23
+ const [, str, flags] = /** @type {RegExpMatchArray} */ (s.match(
24
24
  /** @type {Required<import('../types.js').TypeObject>} */ (
25
25
  this
26
26
  ).stringRegex()
27
- ) || [];
27
+ ));
28
28
  return {value: new RegExp(str, flags)};
29
29
  },
30
30
  getInput ({root}) {
@@ -0,0 +1,34 @@
1
+ import arrayType from './arrayType.js';
2
+
3
+ /**
4
+ * @type {import('../types.js').TypeObject}
5
+ */
6
+ const setType = {
7
+ option: ['Set'],
8
+ array: true,
9
+ set: true,
10
+ regexEndings: [',', ')'],
11
+ stringRegexBegin: /^Set\(/u,
12
+ stringRegexEnd: /^\)/u,
13
+ toValue (...args) {
14
+ return arrayType.toValue.apply(this, args);
15
+ },
16
+ getValue (...args) {
17
+ return arrayType.getValue.apply(this, args);
18
+ },
19
+ getInput (...args) {
20
+ return arrayType.getInput.apply(this, args);
21
+ },
22
+ viewUI ({...args}) {
23
+ return arrayType.viewUI.call(this, {
24
+ ...args, type: 'set'
25
+ });
26
+ },
27
+ editUI ({...args}) {
28
+ return arrayType.editUI.call(this, {
29
+ ...args, type: 'set'
30
+ });
31
+ }
32
+ };
33
+
34
+ export default setType;
@@ -14,7 +14,7 @@ const sparseUndefinedType = {
14
14
  ]
15
15
  }
16
16
  },
17
- toValue (_s) {
17
+ toValue (/* _s */) {
18
18
  return {value: undefined};
19
19
  },
20
20
  getValue () {
@@ -38,8 +38,7 @@ const sparseUndefinedType = {
38
38
  ['input', {
39
39
  type: 'checkbox',
40
40
  name: `${typeNamespace}-sparseUndefined`,
41
- checked: true,
42
- disabled: true
41
+ checked: true
43
42
  }]
44
43
  ]]
45
44
  ]];
@@ -6,7 +6,7 @@ import {$e} from '../utils/templateUtils.js';
6
6
  const undefinedType = {
7
7
  stringRegex: /^undefined$/u,
8
8
  option: ['Explicit undefined'], // Explicit undefined only
9
- toValue (_s) {
9
+ toValue (/* _s */) {
10
10
  return {value: undefined};
11
11
  },
12
12
  getValue () {
@@ -26,8 +26,7 @@ const undefinedType = {
26
26
  ['input', {
27
27
  type: 'checkbox',
28
28
  name: `${typeNamespace}-undef`,
29
- checked: true,
30
- disabled: true
29
+ checked: true
31
30
  }]
32
31
  ]]
33
32
  ]];
package/src/jsoe.css CHANGED
@@ -52,6 +52,9 @@ input:invalid {
52
52
  [data-type="blobHTML"] {
53
53
  background-color: sandybrown;
54
54
  }
55
+ [data-type="error"], [data-type="errors"] {
56
+ background-color: red;
57
+ }
55
58
 
56
59
  [class^="propertyName-"] {
57
60
  background-color: yellow;