@es-joy/jsoe 0.20.5 → 0.21.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/CHANGES.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGES TO `@es-joy/jsoe`
2
2
 
3
+ ## 0.21.0
4
+
5
+ - feat: use sourcemaps
6
+
7
+ ## 0.20.6
8
+
9
+ - fix(`recordType`): failing `toValue` conversion
10
+ - fix(`objectType`): resume reporting duplicate property names
11
+ - fix(schema demo): allow for non-schema choices
12
+ - fix: ensure tooltip exists for base property if just an array/set
13
+ element description
14
+
3
15
  ## 0.20.5
4
16
 
5
17
  - fix: supply flattened schema for type choices
@@ -1 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="orange" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 98.33%</text><text class="high" x="5" y="14">Statements 98.33%</text><text class="shadow" x="125.5" y="15">Branches 95.39%</text><text class="high" x="125" y="14">Branches 95.39%</text><text class="shadow" x="234.5" y="15">Lines 98.64%</text><text class="high" x="234" y="14">Lines 98.64%</text><text class="shadow" x="321.5" y="15">Functions 98.15%</text><text class="high" x="321" y="14">Functions 98.15%</text></g></svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="428" height="20"><defs><style>text{font-size:11px;font-family:Verdana,DejaVu Sans,Geneva,sans-serif}text.shadow{fill:#010101;fill-opacity:.3}text.high{fill:#fff}</style><linearGradient id="smooth" x2="0" y2="100%"><stop offset="0" stop-color="#aaa" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><mask id="round"><rect width="100%" height="100%" rx="3" fill="#fff"/></mask></defs><g id="bg" mask="url(#round)"><path fill="orange" stroke="#000" d="M0 0h120v20H0zM120 0h109v20H120zM229 0h87v20h-87zM316 0h112v20H316z"/><path fill="url(#smooth)" d="M0 0h428v20H0z"/></g><g id="fg"><text class="shadow" x="5.5" y="15">Statements 99.85%</text><text class="high" x="5" y="14">Statements 99.85%</text><text class="shadow" x="125.5" y="15">Branches 98.12%</text><text class="high" x="125" y="14">Branches 98.12%</text><text class="shadow" x="234.5" y="15">Lines 99.84%</text><text class="high" x="234" y="14">Lines 99.84%</text><text class="shadow" x="321.5" y="15">Functions 99.87%</text><text class="high" x="321" y="14">Functions 99.87%</text></g></svg>
@@ -1 +1 @@
1
- {"version":3,"file":"formatAndTypeChoices.d.ts","sourceRoot":"","sources":["../src/formatAndTypeChoices.js"],"names":[],"mappings":"AAuDA;;;;;GAKG;AAEH;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,sJA/BG;IAAuB,OAAO;IACyB,gBAAgB,aAAtD,MAAM,KAAK,OAAO,CAAC,WAAW,CAAC;IAE1B,QAAQ;IAGR,WAAW;IACX,UAAU;IAKX,aAAa;IAEb,cAAc;IACU,OAAO;IACT,KAAK;CAChD,GAAU,OAAO,CAAC;IACpB,aAAiB;;;;qDAmDC,OAAO,CAAC,IAAI,CAAC;gBAlBf;YACV,WAAe,CAAC,EAAE,OAAO,cAAc,EAAE,eAAe,CAAC;YACzD,WAAe,EAAE,OAAO,CAAC;YACzB,MAAU,CAAC,EAAE,MAAM,CAAA;SAChB,KAIS,OAAO,CAAC,IAAI,CAAC;;;iDAUb,OAAO,CAAC,IAAI,CAAC;MAnDE;IACjC,WAAe,iBAAc;IAC7B,QAAY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1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/formats/schema.js"],"names":[],"mappings":"AAkMA;;;;GAIG;AACH,gDAJW,WAAW,gBACX,WAAW,GACT,GAAG,CAAC,WAAW,CAAC,CAiX5B;;0BA5fY,OAAO,OAAO,EAAE,MAAM;2BAGtB,OAAO,qBAAqB,EAAE,YAAY;;;;oBAlD1C,CAAC,IADD,CAAC,CAAC,MAAM,CAAC,CAAC;iCAMV,OAAO,CAChB,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACrC;AAsiBH,6CAA6C;AAC7C,sBADW,OAAO,eAAe,EAAE,MAAM,CA2MvC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/formats/schema.js"],"names":[],"mappings":"AAuMA;;;;GAIG;AACH,gDAJW,WAAW,gBACX,WAAW,GACT,GAAG,CAAC,WAAW,CAAC,CAiX5B;;0BAjgBY,OAAO,OAAO,EAAE,MAAM;2BAGtB,OAAO,qBAAqB,EAAE,YAAY;;;;oBAlD1C,CAAC,IADD,CAAC,CAAC,MAAM,CAAC,CAAC;iCAMV,OAAO,CAChB,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACrC;AA2iBH,6CAA6C;AAC7C,sBADW,OAAO,eAAe,EAAE,MAAM,CA8MvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";sBAaa,MAAM;mDAKN,KAAK,GAAC,OAAO;oCAGb,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,OAAO,CAAC,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,CAm2EvE"}
1
+ {"version":3,"file":"arrayType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/arrayType.js"],"names":[],"mappings":";sBAaa,MAAM;mDAKN,KAAK,GAAC,OAAO;oCAGb,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,OAAO,CAAC,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,CAg3EvE"}
@@ -1 +1 @@
1
- {"version":3,"file":"nativeEnumType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/nativeEnumType.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,8BAFU,OAAO,aAAa,EAAE,UAAU,CAmJxC"}
1
+ {"version":3,"file":"nativeEnumType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/nativeEnumType.js"],"names":[],"mappings":";AAIA;;GAEG;AACH,8BAFU,OAAO,aAAa,EAAE,UAAU,CAqJxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"neverType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/neverType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,CAgDxC"}
1
+ {"version":3,"file":"neverType.d.ts","sourceRoot":"","sources":["../../src/fundamentalTypes/neverType.js"],"names":[],"mappings":";AAEA;;GAEG;AACH,yBAFU,OAAO,aAAa,EAAE,UAAU,CA2CxC"}
package/dist/index.js CHANGED
@@ -2792,7 +2792,6 @@ const buildTypeChoices = ({
2792
2792
  return JSON.stringify(obj);
2793
2793
  }).indexOf(JSON.stringify(specificSchema));
2794
2794
  if (idx === -1) {
2795
- console.log('schemaObjs', schemaObjs, specificSchema);
2796
2795
  this.value = type;
2797
2796
  } else {
2798
2797
  this.selectedIndex = idx + 1;
@@ -2847,8 +2846,9 @@ const buildTypeChoices = ({
2847
2846
  },
2848
2847
 
2849
2848
  /** @type {AddAndValidateEditUI} */
2850
- $addAndValidateEditUI ({
2849
+ $addAndValidateEditUI (/* istanbul ignore next -- Backup */ {
2851
2850
  baseValue, bringIntoFocus, schemaObject, avoidReport
2851
+ /* istanbul ignore next -- Backup */
2852
2852
  } = {}) {
2853
2853
  const {value: type} = this;
2854
2854
 
@@ -2885,8 +2885,12 @@ const buildTypeChoices = ({
2885
2885
  // Avoid JSON references by using this by default (or only?)
2886
2886
  (schemaObjs?.[sel.selectedIndex - 1]) ??
2887
2887
 
2888
+ // eslint-disable-next-line @stylistic/max-len -- Long
2889
+ /* istanbul ignore next -- Can probably remove as `schemaObjs` will be set */
2888
2890
  (schemaContent?.type === 'union' && schemaIdx !== undefined
2891
+ /* istanbul ignore next -- Can probably remove */
2889
2892
  ? schemaContent.options[schemaIdx]
2893
+ // This is probably just `undefined` by here
2890
2894
  : schemaContent),
2891
2895
  schemaFallingBack: Boolean(!schemaObject && schemaContent)
2892
2896
  });
@@ -8580,10 +8584,12 @@ const zodexToStructuredCloningTypeMap = new Map([
8580
8584
  * @returns {ZodexSchema}
8581
8585
  */
8582
8586
  function mergeSchema (leftItem, rightItem) {
8587
+ /* istanbul ignore if -- Guard */
8583
8588
  if (leftItem.type !== 'object') {
8584
8589
  console.log('leftItem', leftItem);
8585
8590
  throw new Error('Unexpected leftItem of type ' + leftItem.type);
8586
8591
  }
8592
+ /* istanbul ignore if -- Guard */
8587
8593
  if (rightItem.type !== 'object') {
8588
8594
  console.log('rightItem', rightItem);
8589
8595
  throw new Error('Unexpected rightItem of type ' + rightItem.type);
@@ -8610,6 +8616,7 @@ function mergeSchema (leftItem, rightItem) {
8610
8616
 
8611
8617
  newLeftObj[prop] = val && typeof val === 'object'
8612
8618
  ? copyObject(val)
8619
+ /* istanbul ignore next -- Guard */
8613
8620
  : val;
8614
8621
  }
8615
8622
  }
@@ -8626,9 +8633,11 @@ function mergeSchema (leftItem, rightItem) {
8626
8633
  }
8627
8634
  /** @type {NestedObject} */ (
8628
8635
  newLeftObj.properties
8629
- )[prop] = val && typeof val === 'object'
8630
- ? copyObject(val)
8631
- : val;
8636
+ )[prop] = /* istanbul ignore next -- Guard */
8637
+ val && typeof val === 'object'
8638
+ ? copyObject(val)
8639
+ /* istanbul ignore next -- Guard */
8640
+ : val;
8632
8641
  }
8633
8642
 
8634
8643
  return newLeftObj;
@@ -9090,6 +9099,7 @@ const schema = {
9090
9099
  ) {
9091
9100
  // eslint-disable-next-line prefer-const -- Convenient
9092
9101
  let [parentSchema, parentSchemaIdx] = parentSchemaInfo ?? [];
9102
+ /* istanbul ignore if -- Guard */
9093
9103
  if (!stateObj) {
9094
9104
  throw new Error('State object expected for schema');
9095
9105
  }
@@ -9136,12 +9146,13 @@ const schema = {
9136
9146
  parentSchema
9137
9147
  ).inner;
9138
9148
  break;
9139
- // eslint-disable-next-line sonarjs/no-duplicated-branches -- Maintenance
9140
- case 'promise':
9141
- currentSchema = /** @type {import('zodex').SzPromise} */ (
9142
- parentSchema
9143
- ).value;
9144
- break;
9149
+ // Todo: Reenable
9150
+ // // eslint-disable-next-line sonarjs/no-duplicated-branches -- Maintenance
9151
+ // case 'promise':
9152
+ // currentSchema = /** @type {import('zodex').SzPromise} */ (
9153
+ // parentSchema
9154
+ // ).value;
9155
+ // break;
9145
9156
  case 'tuple':
9146
9157
  currentSchema = /** @type {import('zodex').SzTuple} */ (
9147
9158
  parentSchema
@@ -9151,6 +9162,8 @@ const schema = {
9151
9162
  ).rest;
9152
9163
  break;
9153
9164
  }
9165
+
9166
+ /* istanbul ignore if -- Guard */
9154
9167
  if (!currentSchema) {
9155
9168
  return {type: typesonType};
9156
9169
  }
@@ -9182,9 +9195,6 @@ const schema = {
9182
9195
  }
9183
9196
  // console.log('parsed', parsed.success, v, schema);
9184
9197
  if (parsed.success) {
9185
- if (currentSchema.type === 'any' && schema.description) {
9186
- schema.description += ' (any)';
9187
- }
9188
9198
  let type = zodexToStructuredCloningTypeMap.get(schema.type);
9189
9199
  if (!type && schema.type === 'effect') {
9190
9200
  type = /** @type {import('../types.js').AvailableType} */ (
@@ -9226,7 +9236,9 @@ const schema = {
9226
9236
  return {type: typesonType};
9227
9237
  },
9228
9238
 
9239
+ /* istanbul ignore next -- Not in use */
9229
9240
  types () {
9241
+ /* istanbul ignore next -- Not in use */
9230
9242
  return structuredCloning.types();
9231
9243
  },
9232
9244
 
@@ -10749,9 +10761,10 @@ const arrayType = {
10749
10761
  const state = sparse
10750
10762
  ? 'arrayNonindexKeys'
10751
10763
  // ? 'sparseArrays'
10752
- : (this.array ? 'array' : 'object');
10764
+ : (this.array && !this.record ? 'array' : 'object');
10753
10765
  /** @type {{[key: (string|number)]: any}} */
10754
- const retObj = this.array ? [] : {};
10766
+ const retObj = this.array && !this.record ? [] : {};
10767
+ /* istanbul ignore next -- Unreachable? */
10755
10768
  let stringVal = innerContents !== undefined
10756
10769
  ? innerContents
10757
10770
  /* istanbul ignore next -- Unreachable? */
@@ -10778,7 +10791,7 @@ const arrayType = {
10778
10791
  }
10779
10792
  return false;
10780
10793
  };
10781
- if (this.array) {
10794
+ if (this.array && !this.record) {
10782
10795
  let idx = 0;
10783
10796
  const parse = () => {
10784
10797
  if (!stringVal) {
@@ -11473,7 +11486,11 @@ const arrayType = {
11473
11486
  input.setCustomValidity(
11474
11487
  invalidStr
11475
11488
  );
11476
- // input.reportValidity(); // Might not want this as changes focus
11489
+ if (invalidStr) {
11490
+ // Might not want this as changes focus; if ok, will hopefully be
11491
+ // marked as such elsewhere
11492
+ input.reportValidity();
11493
+ }
11477
11494
  }
11478
11495
  return invalidStr; // Don't give a chance to become valid
11479
11496
  });
@@ -11690,8 +11707,11 @@ const arrayType = {
11690
11707
  ? elementDesc ?? 'Item'
11691
11708
  : {'#': required
11692
11709
  ? [
11693
- ['b', {className, title: description ? propName : undefined}, [
11694
- elementDesc ?? description ?? propName ?? ''
11710
+ ['b', {
11711
+ className,
11712
+ title: (elementDesc ?? description) ? propName : undefined
11713
+ }, [
11714
+ elementDesc ?? description ?? propName
11695
11715
  ]]
11696
11716
  ]
11697
11717
  : [
@@ -11712,6 +11732,7 @@ const arrayType = {
11712
11732
  ]?.description ?? propName
11713
11733
  : /** @type {import('zodex').SzObject} */ (
11714
11734
  specificSchemaObject
11735
+ /* istanbul ignore next -- Guard */
11715
11736
  )?.catchall?.description ?? propName
11716
11737
  ]]
11717
11738
  ]
@@ -12634,6 +12655,7 @@ const arrayType = {
12634
12655
  */
12635
12656
  async change () {
12636
12657
  if (preventAdding()) {
12658
+ /* istanbul ignore next -- Just a guard */
12637
12659
  this.value = this.$oldvalue ?? this.defaultValue;
12638
12660
  return;
12639
12661
  }
@@ -13060,6 +13082,7 @@ const arrayType = {
13060
13082
  Object.entries(
13061
13083
  /** @type {import('zodex').SzObject} */ (
13062
13084
  specificSchemaObject
13085
+ /* istanbul ignore next -- Should always have `properties` */
13063
13086
  ).properties ?? {}
13064
13087
  )
13065
13088
  ) {
@@ -13087,10 +13110,12 @@ const arrayType = {
13087
13110
  }
13088
13111
  }
13089
13112
  break;
13090
- } case 'array': case 'arrayNonindexKeys': {
13113
+ }
13114
+ // case 'array': // None with schemas?
13115
+ case 'arrayNonindexKeys': {
13091
13116
  const {minLength = 0} = /** @type {import('zodex').SzArray} */ (
13092
13117
  specificSchemaObject
13093
- ) ?? {};
13118
+ );
13094
13119
  const arrayLengthInput =
13095
13120
  /** @type {HTMLInputElement & {$oldvalue: string}} */ (
13096
13121
  $e(div, '.arrayLength')
@@ -13107,7 +13132,7 @@ const arrayType = {
13107
13132
  if (!schemaFallingBack) {
13108
13133
  const {minSize = 0} = /** @type {import('zodex').SzSet} */ (
13109
13134
  specificSchemaObject
13110
- ) ?? {};
13135
+ );
13111
13136
  for (let i = 0; i < minSize; i++) {
13112
13137
  div.$addArrayElement({required: true});
13113
13138
  }
@@ -14639,6 +14664,7 @@ const errorsSpecialType = {
14639
14664
  String.raw`)\((?<innerContent>.*)\)$`, 'u'
14640
14665
  ),
14641
14666
  toValue (s, rootInfo) {
14667
+ /* istanbul ignore next -- Just a guard */
14642
14668
  const {groups: {
14643
14669
  errorClass
14644
14670
  /* istanbul ignore next -- Should always be found */
@@ -14942,6 +14968,7 @@ const errorsSpecialType = {
14942
14968
  ).textContent = aggregateErrorsContents.hidden ? '+' : '-';
14943
14969
  }}}, ['-']],
14944
14970
  ['div', {class: 'aggregateErrorsContents'}, [
14971
+ /* istanbul ignore next -- Just a guard */
14945
14972
  (o.errors
14946
14973
  ? (() => {
14947
14974
  const [div] = arrayType.viewUI({
@@ -17753,6 +17780,7 @@ const domrectType = {
17753
17780
  return ['DOMRect', 'DOMRectReadOnly'].includes(toStringTag(x));
17754
17781
  },
17755
17782
  toValue (s, rootInfo) {
17783
+ /* istanbul ignore next -- Should always be found */
17756
17784
  const {groups: {
17757
17785
  domRectClass
17758
17786
  /* istanbul ignore next -- Should always be found */
@@ -17932,6 +17960,7 @@ const dompointType = {
17932
17960
  return ['DOMPoint', 'DOMPointReadOnly'].includes(toStringTag(x));
17933
17961
  },
17934
17962
  toValue (s, rootInfo) {
17963
+ /* istanbul ignore next -- Should always be found */
17935
17964
  const {groups: {
17936
17965
  domPointClass
17937
17966
  /* istanbul ignore next -- Should always be found */
@@ -18106,6 +18135,7 @@ const dommatrixType = {
18106
18135
  return ['DOMMatrix', 'DOMMatrixReadOnly'].includes(toStringTag(x));
18107
18136
  },
18108
18137
  toValue (s, rootInfo) {
18138
+ /* istanbul ignore next -- Should always be found */
18109
18139
  const {groups: {
18110
18140
  domMatrixClass
18111
18141
  /* istanbul ignore next -- Should always be found */
@@ -18651,6 +18681,7 @@ const buffersourceType = {
18651
18681
  return bufferSourceClasses.has(toStringTag(x));
18652
18682
  },
18653
18683
  toValue (s, rootInfo) {
18684
+ /* istanbul ignore next -- Should always be found */
18654
18685
  const {groups: {
18655
18686
  bufferSourceClass
18656
18687
  /* istanbul ignore next -- Should always be found */
@@ -20131,16 +20162,11 @@ const neverType = {
20131
20162
  /* istanbul ignore next -- Back-up in case shows */
20132
20163
  return false;
20133
20164
  },
20134
- /* istanbul ignore next -- Back-up in case shows */
20135
20165
  toValue (/* _s */) {
20136
- /* istanbul ignore next -- Back-up in case shows */
20137
20166
  throw new Error('Cannot convert to value');
20138
20167
  },
20139
- /* istanbul ignore next -- Back-up in case shows */
20140
20168
  getValue () {
20141
- /* istanbul ignore next -- Back-up in case shows */
20142
20169
  return /** @type {import('../types.js').ToValue} */ (
20143
- /* istanbul ignore next -- Back-up in case shows */
20144
20170
  this.toValue
20145
20171
  )('');
20146
20172
  },
@@ -20338,7 +20364,7 @@ const nativeEnumType = {
20338
20364
  return {value};
20339
20365
  },
20340
20366
  getInput ({root}) {
20341
- return /** @type {HTMLTextAreaElement} */ ($e(root, 'input'));
20367
+ return /** @type {HTMLTextAreaElement} */ ($e(root, 'input.nativeEnumKey'));
20342
20368
  },
20343
20369
  setValue ({root, value}) {
20344
20370
  const input = /**
@@ -20351,9 +20377,11 @@ const nativeEnumType = {
20351
20377
  ).find(([, val]) => {
20352
20378
  return val === value;
20353
20379
  })?.[0] ?? '';
20354
- /** @type {HTMLSpanElement} */ (
20355
- $e(root, '.enumeratedValue')
20356
- ).textContent = value;
20380
+ if (input.value) { // If key was found, the value is ok
20381
+ /** @type {HTMLSpanElement} */ (
20382
+ $e(root, '.enumeratedValue')
20383
+ ).textContent = value;
20384
+ }
20357
20385
  },
20358
20386
  getValue ({root}) {
20359
20387
  const {value, $schemaNativeEnumValues} =
@@ -21230,7 +21258,7 @@ class Types {
21230
21258
  valid
21231
21259
  ? ''
21232
21260
  /* istanbul ignore next -- Should always have a message */
21233
- : message || 'Invalid'
21261
+ : (message || 'Invalid')
21234
21262
  );
21235
21263
 
21236
21264
  // We don't want a focus as `reportValidity` does in at least
@@ -21658,9 +21686,11 @@ async function formatAndTypeChoices ({
21658
21686
  requireObject: hasKeyPath,
21659
21687
  objectHasValue: hasValue,
21660
21688
  schema,
21661
- schemaContent: await getSchemaContent?.(
21662
- /** @type {string} */ (schema)
21663
- )
21689
+ schemaContent: schema
21690
+ ? await getSchemaContent?.(
21691
+ /** @type {string} */ (schema)
21692
+ )
21693
+ : undefined
21664
21694
  }).domArray}, typesHolder);
21665
21695
  }
21666
21696
  },
@@ -21809,3 +21839,4 @@ async function formatAndTypeChoices ({
21809
21839
  }
21810
21840
 
21811
21841
  export { Formats, Types, formatAndTypeChoices, getFormatAndSchemaChoices, getTypesForSchema, buildTypeChoices as typeChoices };
21842
+ //# sourceMappingURL=index.js.map