@es-joy/jsoe 0.28.0 → 0.28.2

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 (126) hide show
  1. package/CHANGES.md +8 -0
  2. package/badges/coverage-badge.svg +1 -1
  3. package/badges/tests-badge.svg +1 -1
  4. package/dist/deepEqual.d.ts +3 -0
  5. package/dist/deepEqual.d.ts.map +1 -0
  6. package/dist/formats/schema.d.ts.map +1 -1
  7. package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
  8. package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
  9. package/dist/index.js +2 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/search/queryTree.d.ts +180 -0
  12. package/dist/search/queryTree.d.ts.map +1 -0
  13. package/dist/search/queryTreeBuilders.d.ts +156 -0
  14. package/dist/search/queryTreeBuilders.d.ts.map +1 -0
  15. package/dist/search/searchDispatch.d.ts +77 -0
  16. package/dist/search/searchDispatch.d.ts.map +1 -0
  17. package/dist/typeChoices.d.ts.map +1 -1
  18. package/dist/types.d.ts.map +1 -1
  19. package/dist/utils/rawTypesonEditor.d.ts.map +1 -1
  20. package/docs/proposals/search-plan.md +166 -0
  21. package/package.json +22 -9
  22. package/pnpm-workspace.yaml +31 -30
  23. package/src/formats/schema.js +8 -14
  24. package/src/fundamentalTypes/arrayType.js +14 -22
  25. package/src/fundamentalTypes/blobType.js +16 -16
  26. package/src/fundamentalTypes/fileType.js +13 -13
  27. package/src/fundamentalTypes/regexpType.js +1 -1
  28. package/src/fundamentalTypes/stringType.js +5 -0
  29. package/src/subTypes/blobHTMLType.js +1 -1
  30. package/src/superTypes/dommatrixType.js +1 -1
  31. package/src/superTypes/errorsSpecialType.js +1 -1
  32. package/src/typeChoices.js +1 -3
  33. package/src/types.js +0 -6
  34. package/src/utils/media.js +3 -3
  35. package/src/utils/rawTypesonEditor.js +12 -2
  36. package/tsconfig.json +1 -1
  37. package/vendor/jamilih/dist/jml.mjs +898 -25
  38. package/vendor/zod/classic/checks.d.ts +1 -1
  39. package/vendor/zod/classic/checks.js +1 -1
  40. package/vendor/zod/classic/schemas.d.ts +2 -6
  41. package/vendor/zod/classic/schemas.js +9 -13
  42. package/vendor/zod/core/api.d.ts +8 -4
  43. package/vendor/zod/core/api.js +11 -23
  44. package/vendor/zod/core/checks.d.ts +16 -0
  45. package/vendor/zod/core/checks.js +31 -0
  46. package/vendor/zod/core/compile.js +20 -24
  47. package/vendor/zod/core/core.js +1 -1
  48. package/vendor/zod/core/json-schema-processors.d.ts +0 -1
  49. package/vendor/zod/core/json-schema-processors.js +8 -43
  50. package/vendor/zod/core/memoizer.js +2 -5
  51. package/vendor/zod/core/regexes.d.ts +1 -0
  52. package/vendor/zod/core/regexes.js +2 -0
  53. package/vendor/zod/core/schemas.d.ts +8 -23
  54. package/vendor/zod/core/schemas.js +39 -80
  55. package/vendor/zod/core/to-json-schema.d.ts +0 -3
  56. package/vendor/zod/core/to-json-schema.js +1 -1
  57. package/vendor/zod/core/util.js +0 -4
  58. package/vendor/zod/core/versions.js +1 -1
  59. package/vendor/zod/core/visit.js +0 -12
  60. package/vendor/zod/locales/ar.js +1 -0
  61. package/vendor/zod/locales/az.js +1 -0
  62. package/vendor/zod/locales/be.js +1 -0
  63. package/vendor/zod/locales/bg.js +1 -0
  64. package/vendor/zod/locales/bn.js +1 -0
  65. package/vendor/zod/locales/ca.js +1 -0
  66. package/vendor/zod/locales/ckb.js +1 -0
  67. package/vendor/zod/locales/cs.js +1 -0
  68. package/vendor/zod/locales/da.js +1 -0
  69. package/vendor/zod/locales/de.js +1 -0
  70. package/vendor/zod/locales/el.js +1 -0
  71. package/vendor/zod/locales/en.js +1 -0
  72. package/vendor/zod/locales/eo.js +1 -0
  73. package/vendor/zod/locales/es.js +1 -0
  74. package/vendor/zod/locales/fa.js +1 -0
  75. package/vendor/zod/locales/fi.js +1 -0
  76. package/vendor/zod/locales/fr-CA.js +1 -0
  77. package/vendor/zod/locales/fr.js +1 -0
  78. package/vendor/zod/locales/gu.js +1 -0
  79. package/vendor/zod/locales/he.js +1 -0
  80. package/vendor/zod/locales/hi.js +1 -0
  81. package/vendor/zod/locales/hr.js +1 -0
  82. package/vendor/zod/locales/hu.js +1 -0
  83. package/vendor/zod/locales/hy.js +1 -0
  84. package/vendor/zod/locales/id.js +1 -0
  85. package/vendor/zod/locales/is.js +1 -0
  86. package/vendor/zod/locales/it.js +1 -0
  87. package/vendor/zod/locales/ja.js +1 -0
  88. package/vendor/zod/locales/ka.js +1 -0
  89. package/vendor/zod/locales/km.js +1 -0
  90. package/vendor/zod/locales/kn.js +1 -0
  91. package/vendor/zod/locales/ko.js +1 -0
  92. package/vendor/zod/locales/lt.js +1 -0
  93. package/vendor/zod/locales/mk.js +1 -0
  94. package/vendor/zod/locales/ms.js +1 -0
  95. package/vendor/zod/locales/ne.js +1 -0
  96. package/vendor/zod/locales/nl.js +1 -0
  97. package/vendor/zod/locales/nn.js +1 -0
  98. package/vendor/zod/locales/no.js +1 -0
  99. package/vendor/zod/locales/ota.js +1 -0
  100. package/vendor/zod/locales/pl.js +1 -0
  101. package/vendor/zod/locales/ps.js +1 -0
  102. package/vendor/zod/locales/pt-BR.js +1 -0
  103. package/vendor/zod/locales/pt.js +1 -0
  104. package/vendor/zod/locales/ro.js +1 -0
  105. package/vendor/zod/locales/ru.js +1 -0
  106. package/vendor/zod/locales/sk.js +1 -0
  107. package/vendor/zod/locales/sl.js +1 -0
  108. package/vendor/zod/locales/sv.js +1 -0
  109. package/vendor/zod/locales/ta.js +1 -0
  110. package/vendor/zod/locales/tg.js +1 -0
  111. package/vendor/zod/locales/th.js +1 -0
  112. package/vendor/zod/locales/tk.js +1 -0
  113. package/vendor/zod/locales/tr.js +1 -0
  114. package/vendor/zod/locales/uk.js +1 -0
  115. package/vendor/zod/locales/ur.js +1 -0
  116. package/vendor/zod/locales/uz.js +1 -0
  117. package/vendor/zod/locales/vi.js +1 -0
  118. package/vendor/zod/locales/yo.js +1 -0
  119. package/vendor/zod/locales/zh-CN.js +1 -0
  120. package/vendor/zod/locales/zh-TW.js +1 -0
  121. package/vendor/zod/mini/checks.d.ts +1 -1
  122. package/vendor/zod/mini/checks.js +1 -1
  123. package/vendor/zod/mini/schemas.d.ts +2 -5
  124. package/vendor/zod/mini/schemas.js +9 -11
  125. package/vendor/zodexy/dist/esm/index.js +4 -33
  126. package/vendor/zodexy/dist/schema.zodexy.json +1 -17
@@ -232,7 +232,7 @@ function binaryButton (
232
232
  ['textarea', {
233
233
  class: 'view-binary'
234
234
  }, [
235
- /* istanbul ignore next */
235
+ /* istanbul ignore next -- Guard */
236
236
  /** @type {string|null} */ (reader.result) ?? ''
237
237
  ]]
238
238
  ]]
@@ -242,11 +242,11 @@ function binaryButton (
242
242
  // Seems not feasible to accurately simulate
243
243
  reader.addEventListener(
244
244
  'error',
245
- /* istanbul ignore next */
245
+ /* istanbul ignore next -- Should not err */
246
246
  async function () {
247
- /* istanbul ignore next */
247
+ /* istanbul ignore next -- Should not err */
248
248
  console.error(reader.error);
249
- /* istanbul ignore next */
249
+ /* istanbul ignore next -- Should not err */
250
250
  await dialogs.alert(/** @type {string} */ (
251
251
  /** @type {DOMException} */ (reader.error).message
252
252
  ));
@@ -341,7 +341,7 @@ const fileType = {
341
341
  'Text source',
342
342
  ['br'],
343
343
  ['textarea', {class: 'view-text'}, [
344
- /* istanbul ignore next */
344
+ /* istanbul ignore next -- Guard */
345
345
  /** @type {string|null} */ (reader.result) ?? ''
346
346
  ]]
347
347
  ]));
@@ -349,11 +349,11 @@ const fileType = {
349
349
  // Seems not feasible to accurately simulate
350
350
  reader.addEventListener(
351
351
  'error',
352
- /* istanbul ignore next */
352
+ /* istanbul ignore next -- Should not err */
353
353
  function () {
354
- /* istanbul ignore next */
354
+ /* istanbul ignore next -- Should not err */
355
355
  console.error(reader.error);
356
- /* istanbul ignore next */
356
+ /* istanbul ignore next -- Should not err */
357
357
  div.append(
358
358
  /** @type {DOMException} */ (reader.error).message
359
359
  );
@@ -882,7 +882,7 @@ const fileType = {
882
882
 
883
883
  if (constraints) {
884
884
  const mediaStream = await getUserMedia(constraints);
885
- /* istanbul ignore if */
885
+ /* istanbul ignore if -- Should be present */
886
886
  if (!mediaStream) {
887
887
  await dialogs.alert('Error getting user media');
888
888
  return;
@@ -930,7 +930,7 @@ const fileType = {
930
930
  const mediaStream = await startScreenCapture(
931
931
  screenShareConstraints
932
932
  );
933
- /* istanbul ignore if */
933
+ /* istanbul ignore if -- Should not err */
934
934
  if (!mediaStream) {
935
935
  await dialogs.alert('Error getting user media');
936
936
  return;
@@ -1010,7 +1010,7 @@ const fileType = {
1010
1010
  'video.previewMedia'
1011
1011
  ));
1012
1012
 
1013
- /* istanbul ignore if */
1013
+ /* istanbul ignore if -- Should not err */
1014
1014
  if (!previewMedia.srcObject) {
1015
1015
  dialogs.alert('No stream found to record');
1016
1016
  return;
@@ -1044,7 +1044,7 @@ const fileType = {
1044
1044
 
1045
1045
  try {
1046
1046
  mediaRecorder.start();
1047
- } catch /* istanbul ignore next */ {
1047
+ } catch /* istanbul ignore next -- Should not err */ {
1048
1048
  dialogs.alert('Error starting media recorder');
1049
1049
  return;
1050
1050
  }
@@ -1195,7 +1195,7 @@ const fileType = {
1195
1195
  ($e(videoContainer, 'img.photo'));
1196
1196
 
1197
1197
  canvas.toBlob((blob) => {
1198
- /* istanbul ignore if */
1198
+ /* istanbul ignore if -- Should not err */
1199
1199
  if (!blob) {
1200
1200
  dialogs.alert('Error converting canvas to Blob');
1201
1201
  return;
@@ -19,7 +19,7 @@ const regexpType = {
19
19
  return toStringTag(x) === 'RegExp';
20
20
  },
21
21
  toValue (s) {
22
- /* istanbul ignore if */
22
+ /* istanbul ignore if -- TS */
23
23
  if (typeof this.stringRegex !== 'function') {
24
24
  throw new TypeError('Guard for TS');
25
25
  }
@@ -128,6 +128,11 @@ const stringType = {
128
128
  }
129
129
  if (kind) {
130
130
  switch (kind) {
131
+ case 'currency_code':
132
+ if (!regexes.currencyCode.test(value)) {
133
+ return `Value doesn't match currency code pattern.`;
134
+ }
135
+ break;
131
136
  case 'credit_card':
132
137
  if (!regexes.creditCard.test(value)) {
133
138
  return `Value doesn't match credit card pattern.`;
@@ -127,7 +127,7 @@ const blobHTMLType = {
127
127
  jml('textarea', {name: `${typeNamespace}-blobHTML`})
128
128
  );
129
129
  textarea.sceditorInstance = {
130
- /* istanbul ignore next */
130
+ /* istanbul ignore next -- Guard */
131
131
  val () {
132
132
  throw new Error('Not yet instantiated');
133
133
  }
@@ -348,7 +348,7 @@ const dommatrixType = {
348
348
  $on: {
349
349
  click (e) {
350
350
  const {target} = e;
351
- /* istanbul ignore if */
351
+ /* istanbul ignore if -- Guard */
352
352
  if (/** @type {HTMLInputElement} */ (target).type !== 'radio') {
353
353
  return;
354
354
  }
@@ -36,7 +36,7 @@ if (typeof AggregateError !== 'undefined') {
36
36
  specialErrorsMap.set('AggregateError', AggregateError);
37
37
  }
38
38
 
39
- /* istanbul ignore next 5 */
39
+ /* istanbul ignore next 5 -- May not exist */
40
40
  // @ts-expect-error Only use if available
41
41
  if (typeof InternalError !== 'undefined') {
42
42
  // @ts-expect-error Only use if available
@@ -193,9 +193,7 @@ function deriveXorBranchLabel (schemaObj, optText, idx) {
193
193
  return String(values[0]);
194
194
  }
195
195
  }
196
- if (schemaObj &&
197
- (schemaObj.type === 'object' || schemaObj.type === 'properties')
198
- ) {
196
+ if (schemaObj && schemaObj.type === 'object') {
199
197
  const {properties} = /** @type {import('zodexy').SzObject} */ (schemaObj);
200
198
  const keys = properties && typeof properties === 'object'
201
199
  ? Object.keys(properties)
package/src/types.js CHANGED
@@ -732,12 +732,6 @@ class Types {
732
732
  // `record`/`tuple` are not shown as their own pull-down entries; they render
733
733
  // as `Object`/`Array` (their schema, incl. child descriptions, informs the
734
734
  // layout — see `arrayType.js`).
735
- // `z.properties()` likewise renders through the `object` type/UI; when the
736
- // schema supplies no label of its own, name it "Properties" so it is not
737
- // shown as an indistinguishable "Object".
738
- if (type === 'object' && schemaContent?.type === 'properties') {
739
- optInfo[0] = 'Properties';
740
- }
741
735
 
742
736
  const schemaContentLabel = resolveSchemaMeta(schemaContent).label;
743
737
  if (schemaContentLabel) {
@@ -77,9 +77,9 @@ async function getUserMedia (constraints) {
77
77
  try {
78
78
  stream = await navigator.mediaDevices.getUserMedia(constraints);
79
79
  } catch (err) {
80
- /* istanbul ignore next */
80
+ /* istanbul ignore next -- Should be present */
81
81
  console.error('err', err);
82
- /* istanbul ignore next */
82
+ /* istanbul ignore next -- Should be present */
83
83
  return null;
84
84
  }
85
85
  return stream;
@@ -96,7 +96,7 @@ async function startScreenCapture (displayMediaOptions) {
96
96
  captureStream =
97
97
  await navigator.mediaDevices.getDisplayMedia(displayMediaOptions);
98
98
  } catch (err) {
99
- /* istanbul ignore next */
99
+ /* istanbul ignore next -- Should not err */
100
100
  console.error(`Error: ${err}`);
101
101
  }
102
102
  return captureStream;
@@ -613,11 +613,22 @@ export async function openRawEditorDialog ({
613
613
  ['div', {class: editorClass}]
614
614
  ];
615
615
 
616
+ // `dialogs.js`'s default `remove` behavior detaches the `<dialog>` from
617
+ // the document on close, but never tears down the `EditorView` mounted
618
+ // into it; left as-is, every "Edit raw"/"View raw" use leaks a live
619
+ // `EditorView` (and its internal `ResizeObserver`/DOM observers) bound
620
+ // to an already-detached subtree. Destroy it alongside the dialog.
621
+ const close = () => {
622
+ view.destroy();
623
+ };
624
+
616
625
  const dialog = readonly
617
626
  // @ts-expect-error TS bug
618
- ? dialogs.makeCancelDialog({children})
627
+ ? dialogs.makeCancelDialog({children, close})
619
628
  : dialogs.makeSubmitDialog({
620
629
  submitText: 'Save',
630
+ // @ts-expect-error TS bug
631
+ close,
621
632
  async submit ({dialog: dlg}) {
622
633
  const text = view.state.doc.toString();
623
634
  showError(dlg, '');
@@ -652,7 +663,6 @@ export async function openRawEditorDialog ({
652
663
  }
653
664
  dlg.close();
654
665
  },
655
- // @ts-expect-error TS bug
656
666
  children
657
667
  });
658
668
 
package/tsconfig.json CHANGED
@@ -16,5 +16,5 @@
16
16
  "outDir": "dist"
17
17
  },
18
18
  "include": ["src/**/*.js", "typings/sceditor.d.ts", "typings/json-6.d.ts"],
19
- "exclude": ["node_modules", "src/deepEqual.js", "src/formats/schema.js", "./src/index.ts", "./dist/**/*.js"]
19
+ "exclude": ["node_modules", "src/deepEqual.js"]
20
20
  }