mol_view_tree2_lib 1.0.217 → 1.0.219

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/node.mjs CHANGED
@@ -2201,12 +2201,15 @@ var $;
2201
2201
  return result;
2202
2202
  }
2203
2203
  function primitive_type(input) {
2204
- let type = 'string';
2205
- if (input.type && $mol_tree2_js_is_number(input.type))
2206
- type = 'number';
2204
+ if (!input.type)
2205
+ return input.data('string');
2207
2206
  if (input.type === 'true' || input.type === 'false')
2208
- type = 'boolean';
2209
- return input.data(type);
2207
+ return input.data('boolean');
2208
+ if ($mol_tree2_js_is_number(input.type))
2209
+ return input.data('number');
2210
+ if (/^[+-]?[\d_]+n$/.test(input.type))
2211
+ return input.data('bigint');
2212
+ return $mol_fail(new Error('Wrong primitive type', { cause: { type: input.type } }));
2210
2213
  }
2211
2214
  function readonly_arr(input, infered) {
2212
2215
  return [
package/node.test.js CHANGED
@@ -2192,12 +2192,15 @@ var $;
2192
2192
  return result;
2193
2193
  }
2194
2194
  function primitive_type(input) {
2195
- let type = 'string';
2196
- if (input.type && $mol_tree2_js_is_number(input.type))
2197
- type = 'number';
2195
+ if (!input.type)
2196
+ return input.data('string');
2198
2197
  if (input.type === 'true' || input.type === 'false')
2199
- type = 'boolean';
2200
- return input.data(type);
2198
+ return input.data('boolean');
2199
+ if ($mol_tree2_js_is_number(input.type))
2200
+ return input.data('number');
2201
+ if (/^[+-]?[\d_]+n$/.test(input.type))
2202
+ return input.data('bigint');
2203
+ return $mol_fail(new Error('Wrong primitive type', { cause: { type: input.type } }));
2201
2204
  }
2202
2205
  function readonly_arr(input, infered) {
2203
2206
  return [
@@ -11140,22 +11143,27 @@ var $;
11140
11143
  const el = this.dom_node();
11141
11144
  const from = el.selectionStart;
11142
11145
  const to = el.selectionEnd;
11146
+ el.value = this.value_changed(el.value);
11147
+ if (to === null)
11148
+ return;
11149
+ el.selectionEnd = to;
11150
+ el.selectionStart = from;
11151
+ this.selection_change(next);
11152
+ }
11153
+ value_changed(next) {
11154
+ const el = this.dom_node();
11143
11155
  try {
11144
- el.value = this.value_changed(el.value);
11156
+ el.setCustomValidity('');
11157
+ return this.value(next);
11145
11158
  }
11146
11159
  catch (error) {
11147
- const el = this.dom_node();
11160
+ $mol_fail_log(error);
11148
11161
  if (error instanceof Error) {
11149
11162
  el.setCustomValidity(error.message);
11150
11163
  el.reportValidity();
11151
11164
  }
11152
- $mol_fail_hidden(error);
11165
+ return next ?? $mol_mem_cached(() => this.value_changed()) ?? '';
11153
11166
  }
11154
- if (to === null)
11155
- return;
11156
- el.selectionEnd = to;
11157
- el.selectionStart = from;
11158
- this.selection_change(next);
11159
11167
  }
11160
11168
  error_report() {
11161
11169
  try {
@@ -11216,6 +11224,9 @@ var $;
11216
11224
  __decorate([
11217
11225
  $mol_action
11218
11226
  ], $mol_string.prototype, "event_change", null);
11227
+ __decorate([
11228
+ $mol_mem
11229
+ ], $mol_string.prototype, "value_changed", null);
11219
11230
  __decorate([
11220
11231
  $mol_mem
11221
11232
  ], $mol_string.prototype, "error_report", null);