@es-joy/jsoe 0.29.0 → 0.30.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.
Files changed (85) hide show
  1. package/.claude/scheduled_tasks.lock +1 -0
  2. package/CHANGES.md +6 -0
  3. package/README.md +2 -0
  4. package/dist/fundamentalTypes/dateType.d.ts +8 -3
  5. package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/index.js.map +1 -1
  8. package/dist/search/fundamentalTypes/arraySearchType.d.ts +11 -4
  9. package/dist/search/fundamentalTypes/arraySearchType.d.ts.map +1 -1
  10. package/dist/search/fundamentalTypes/bigintSearchType.d.ts.map +1 -1
  11. package/dist/search/fundamentalTypes/blobSearchType.d.ts.map +1 -1
  12. package/dist/search/fundamentalTypes/dateSearchType.d.ts +8 -3
  13. package/dist/search/fundamentalTypes/dateSearchType.d.ts.map +1 -1
  14. package/dist/search/fundamentalTypes/domexceptionSearchType.d.ts +5 -5
  15. package/dist/search/fundamentalTypes/domexceptionSearchType.d.ts.map +1 -1
  16. package/dist/search/fundamentalTypes/enumSearchType.d.ts +4 -0
  17. package/dist/search/fundamentalTypes/enumSearchType.d.ts.map +1 -1
  18. package/dist/search/fundamentalTypes/fileSearchType.d.ts +19 -10
  19. package/dist/search/fundamentalTypes/fileSearchType.d.ts.map +1 -1
  20. package/dist/search/fundamentalTypes/filelistSearchType.d.ts +4 -12
  21. package/dist/search/fundamentalTypes/filelistSearchType.d.ts.map +1 -1
  22. package/dist/search/fundamentalTypes/functionSearchType.d.ts +4 -4
  23. package/dist/search/fundamentalTypes/functionSearchType.d.ts.map +1 -1
  24. package/dist/search/fundamentalTypes/mapSearchType.d.ts +8 -4
  25. package/dist/search/fundamentalTypes/mapSearchType.d.ts.map +1 -1
  26. package/dist/search/fundamentalTypes/numberSearchType.d.ts.map +1 -1
  27. package/dist/search/fundamentalTypes/objectSearchType.d.ts +10 -4
  28. package/dist/search/fundamentalTypes/objectSearchType.d.ts.map +1 -1
  29. package/dist/search/fundamentalTypes/regexpSearchType.d.ts +7 -1
  30. package/dist/search/fundamentalTypes/regexpSearchType.d.ts.map +1 -1
  31. package/dist/search/fundamentalTypes/setSearchType.d.ts +5 -4
  32. package/dist/search/fundamentalTypes/setSearchType.d.ts.map +1 -1
  33. package/dist/search/fundamentalTypes/stringSearchType.d.ts +9 -1
  34. package/dist/search/fundamentalTypes/stringSearchType.d.ts.map +1 -1
  35. package/dist/search/fundamentalTypes/symbolSearchType.d.ts.map +1 -1
  36. package/dist/search/index.d.ts +18 -8
  37. package/dist/search/index.d.ts.map +1 -1
  38. package/dist/search/queryTree.d.ts +12 -1
  39. package/dist/search/queryTree.d.ts.map +1 -1
  40. package/dist/search/queryTreeBuilders.d.ts +6 -0
  41. package/dist/search/queryTreeBuilders.d.ts.map +1 -1
  42. package/dist/search/searchElementUtils.d.ts +17 -8
  43. package/dist/search/searchElementUtils.d.ts.map +1 -1
  44. package/dist/search/searchUtils.d.ts +343 -18
  45. package/dist/search/searchUtils.d.ts.map +1 -1
  46. package/dist/search/subTypes/blobHTMLSearchType.d.ts +22 -2
  47. package/dist/search/subTypes/blobHTMLSearchType.d.ts.map +1 -1
  48. package/dist/search/subTypes/recordSearchType.d.ts +4 -4
  49. package/dist/search/subTypes/recordSearchType.d.ts.map +1 -1
  50. package/dist/search/subTypes/tupleSearchType.d.ts +3 -3
  51. package/dist/search/subTypes/tupleSearchType.d.ts.map +1 -1
  52. package/dist/search/superTypes/buffersourceSearchType.d.ts.map +1 -1
  53. package/dist/search/unions/unionFamilySearchType.d.ts.map +1 -1
  54. package/package.json +1 -1
  55. package/src/fundamentalTypes/dateType.js +9 -4
  56. package/src/fundamentalTypes/regexpType.js +1 -1
  57. package/src/jsoe.css +204 -0
  58. package/src/search/fundamentalTypes/arraySearchType.js +42 -7
  59. package/src/search/fundamentalTypes/bigintSearchType.js +7 -1
  60. package/src/search/fundamentalTypes/blobSearchType.js +2 -1
  61. package/src/search/fundamentalTypes/booleanSearchType.js +1 -1
  62. package/src/search/fundamentalTypes/dateSearchType.js +113 -20
  63. package/src/search/fundamentalTypes/domexceptionSearchType.js +39 -10
  64. package/src/search/fundamentalTypes/enumSearchType.js +5 -1
  65. package/src/search/fundamentalTypes/fileSearchType.js +64 -11
  66. package/src/search/fundamentalTypes/filelistSearchType.js +32 -7
  67. package/src/search/fundamentalTypes/functionSearchType.js +36 -12
  68. package/src/search/fundamentalTypes/mapSearchType.js +43 -13
  69. package/src/search/fundamentalTypes/numberSearchType.js +8 -1
  70. package/src/search/fundamentalTypes/objectSearchType.js +236 -17
  71. package/src/search/fundamentalTypes/regexpSearchType.js +29 -5
  72. package/src/search/fundamentalTypes/setSearchType.js +33 -7
  73. package/src/search/fundamentalTypes/stringSearchType.js +11 -2
  74. package/src/search/fundamentalTypes/symbolSearchType.js +2 -1
  75. package/src/search/index.js +26 -9
  76. package/src/search/queryTree.js +10 -1
  77. package/src/search/queryTreeBuilders.js +9 -0
  78. package/src/search/searchElementUtils.js +108 -24
  79. package/src/search/searchUtils.js +516 -24
  80. package/src/search/subTypes/blobHTMLSearchType.js +64 -7
  81. package/src/search/subTypes/recordSearchType.js +34 -13
  82. package/src/search/subTypes/tupleSearchType.js +51 -10
  83. package/src/search/superTypes/SpecialRealNumberSearchType.js +1 -1
  84. package/src/search/superTypes/buffersourceSearchType.js +7 -1
  85. package/src/search/unions/unionFamilySearchType.js +8 -0
@@ -30,11 +30,75 @@ export function buildPathLabel(schemaObject: import("../formats/schema.js").Zode
30
30
  * `typeNamespace` closed over inside a `$define` mixin, which is installed
31
31
  * once on the shared custom-element prototype the first time a tag is
32
32
  * defined - nothing here depends on a per-instance closure at all.
33
- * @param {HTMLElement} root
33
+ * @param {Element} root
34
34
  * @param {string} selector
35
35
  * @returns {HTMLElement|undefined}
36
36
  */
37
- export function findOwnControl(root: HTMLElement, selector: string): HTMLElement | undefined;
37
+ export function findOwnControl(root: Element, selector: string): HTMLElement | undefined;
38
+ /**
39
+ * Whether `el` sits inside an `objectSearchType.js` has-property row whose
40
+ * own "Has"/"Doesn't have" tri-state is *already* explicitly chosen (not
41
+ * "(any)") - if so, that existence assertion alone is already a complete
42
+ * constraint for the row, so a per-field "no absent values" requirement
43
+ * inside it (a range's own "at least one bound", `buildRangeInputsPair`'s
44
+ * doc) should be relaxed. `setDescendantsRequired` handles this for plain
45
+ * `required`-attribute controls, but a range pair's requirement is
46
+ * re-asserted imperatively on every `input`/`change` via `setCustomValidity`
47
+ * (`syncRangeValidity`, `dateSearchType.js`'s own equivalent) - clearing it
48
+ * once wouldn't stick past the next keystroke, so those call this directly,
49
+ * live, instead.
50
+ *
51
+ * Returns `false` (not exempted) when `el` also sits inside a
52
+ * `buildOptInFieldset` fieldset (`jsoeSearchOptInFieldset--*`), for the same
53
+ * reason `setDescendantsRequired` skips those controls: a dimension range
54
+ * nested in `makeDomShapeSearchType`'s per-dimension opt-in gate (say,
55
+ * DOMRect's "Width") is only reachable at all once its own checkbox is
56
+ * checked, and checking it is itself the user's explicit request to
57
+ * constrain *that* facet - an enclosing "Has property" shouldn't then let
58
+ * its "From"/"To" sit blank and still read as valid, any more than
59
+ * `fileSearchType.js`'s "Name" facet should once opted into.
60
+ * @param {Element} el
61
+ * @returns {boolean}
62
+ */
63
+ export function isExemptedByAncestorHasProperty(el: Element): boolean;
64
+ /**
65
+ * Re-runs every `input`/`change`-driven validator within `root` by
66
+ * re-dispatching those events on each descendant form control -
67
+ * `objectSearchType.js`'s `buildHasPropertyRow` calls this when its own
68
+ * "Has"/"Doesn't have" tri-state changes, since a range pair (or anything
69
+ * else reactive) nested anywhere inside the child widget needs to
70
+ * re-evaluate `isExemptedByAncestorHasProperty` against the *new* tri-state
71
+ * value - nothing else would otherwise prompt it to run again until the
72
+ * user happens to interact with that specific field themselves.
73
+ * @param {Element} root
74
+ * @returns {void}
75
+ */
76
+ export function revalidateDescendants(root: Element): void;
77
+ /**
78
+ * The `buildRangeInputsPair` cross-validation check, factored out so a
79
+ * consuming widget's own `$define.connectedCallback` (custom elements,
80
+ * search plan §8) can also call it - the `input`/`change` events
81
+ * `buildRangeInputsPair` wires below only fire from the user's *first*
82
+ * interaction, so a freshly-built pair with both ends still empty would
83
+ * otherwise stay "valid" by the browser's reckoning (no `setCustomValidity`
84
+ * call has ever run yet) until then, contradicting the "leaving both blank
85
+ * is invalid" rule documented below. `connectedCallback` is a native
86
+ * Custom Elements lifecycle method (invoked once per instance the moment it
87
+ * connects to the document), so calling this from there closes that gap
88
+ * without needing any build-time live element reference.
89
+ *
90
+ * "Leaving both blank is invalid" is itself relaxed when
91
+ * `isExemptedByAncestorHasProperty` says so - a range nested as a has-
92
+ * property row's own child widget (e.g. a `date`/`number` property) needs
93
+ * the same "'Has property X' is already a complete constraint" relief
94
+ * `setDescendantsRequired` gives `required`-attribute controls, just
95
+ * re-checked live on every call rather than toggled once, since this runs
96
+ * imperatively on every keystroke regardless.
97
+ * @param {Element} root
98
+ * @param {string} [key]
99
+ * @returns {void}
100
+ */
101
+ export function syncRangeValidity(root: Element, key?: string): void;
38
102
  /**
39
103
  * A "from"/"to" pair of native inputs sharing one `type`, for the OR-range/
40
104
  * Is-Not-Range README affordance (number/bigint/buffersource; `date` uses
@@ -48,6 +112,25 @@ export function findOwnControl(root: HTMLElement, selector: string): HTMLElement
48
112
  * apart two same-class controls belonging to the *same* widget, so those
49
113
  * need distinct classes. Leave it at the default `''` for the common case
50
114
  * of a widget with only one range pair.
115
+ *
116
+ * Cross-validates the pair via the native Constraint Validation API,
117
+ * surfaced by `jsoe.css`'s `input:invalid` styling and a real `<form>`'s
118
+ * `reportValidity`/`checkValidity` (`src/search/index.js`): leaving *both*
119
+ * ends blank is invalid - the same "no absent values" reasoning
120
+ * `buildLiteralRegexControls`'s Value input documents, an added range row
121
+ * needs at least one bound to mean anything - and if both ends are filled
122
+ * with "To" less than "From", that's invalid too. An open-ended range (only
123
+ * one end filled) stays valid. A row nested under an
124
+ * `objectSearchType.js` required-property's opt-in `<fieldset disabled>`
125
+ * (or, for `dateSearchType.js`'s own equivalent pair, its own
126
+ * "Invalid date" fieldset) is unaffected either way, since a disabled field
127
+ * is excluded from constraint validation entirely. Every caller must also
128
+ * call `syncRangeValidity` from its own `connectedCallback` (see that
129
+ * function's doc) so the initial both-blank state is actually invalid from
130
+ * the moment the widget exists, not just after the user's first keystroke.
131
+ * `dateSearchType.js`'s own `datetime-local` pair needs the same two checks
132
+ * but isn't built through this helper (`buildDateInputControl` handles its
133
+ * own ISO-slicing), so it wires an equivalent handler itself.
51
134
  * @param {{
52
135
  * name: string,
53
136
  * key?: string,
@@ -81,22 +164,34 @@ export function readRangeInputsPair(el: HTMLElement, key?: string): {
81
164
  * A `<select multiple>` populated from a fixed candidate list - used by
82
165
  * `enum`/`multiSelect`/`literalSet` leaf controls (README: "multiple
83
166
  * select").
167
+ *
168
+ * `required`, when set, makes leaving *every* option unselected invalid -
169
+ * `<select multiple required>` is natively satisfied by one or more
170
+ * selections, no custom validity code needed. `enumSearchType.js` passes
171
+ * this (an enum widget has nothing else to constrain, so an empty selection
172
+ * is never a meaningful "no constraint" state - same "no absent values"
173
+ * reasoning as `buildLiteralRegexControls`'s Value input); other callers
174
+ * (`regexpSearchType.js`'s Flags, `SpecialRealNumberSearchType.js`) leave it
175
+ * at the default `false`, since an empty selection there legitimately means
176
+ * "no constraint on this facet" alongside a widget that has other facets.
84
177
  * @param {{
85
178
  * name: string,
86
- * options: (string|[value: string, title: string])[]
179
+ * options: (string|[value: string, title: string])[],
180
+ * required?: boolean
87
181
  * }} cfg
88
182
  * @returns {JamilihArray}
89
183
  */
90
- export function buildMultiSelect({ name, options }: {
184
+ export function buildMultiSelect({ name, options, required }: {
91
185
  name: string;
92
186
  options: (string | [value: string, title: string])[];
187
+ required?: boolean;
93
188
  }): JamilihArray;
94
189
  /**
95
190
  * Reads back a `buildMultiSelect` into the selected values, `[]` if none.
96
- * @param {HTMLElement} el
191
+ * @param {Element} el
97
192
  * @returns {string[]}
98
193
  */
99
- export function readMultiSelect(el: HTMLElement): string[];
194
+ export function readMultiSelect(el: Element): string[];
100
195
  /**
101
196
  * A tri-state "has property" control for one already-chosen property name
102
197
  * (README: "Has property &lt;property pull-down&gt;", "avoid listing
@@ -126,35 +221,71 @@ export function buildHasPropertyToggle({ name, propertyName }: {
126
221
  * `dommatrixSearchType.js`'s "Is/Is not Readonly" and "Is/Is not 3d" side
127
222
  * by side); see `buildRangeInputsPair`'s doc for why. Leave it at the
128
223
  * default `''` for the common case of a widget with only one tri-state.
129
- * @param {{name: string, key?: string, trueLabel: string, falseLabel: string}} cfg
224
+ * `onChange`, when given, wires the select's own `change` event too (in
225
+ * addition to whatever the caller reads back via `readTriStateSelect` at
226
+ * `getQuery` time) - `dateSearchType.js`'s "Is valid/invalid date" tri-state
227
+ * uses it to disable the (otherwise irrelevant) From/To range while
228
+ * "Invalid date" is selected.
229
+ *
230
+ * `required`, when set, makes leaving the select at "(any)" invalid - the
231
+ * "(any)" option's `value: ''` below is exactly what native `required`
232
+ * treats as "nothing selected", the same trick `unionFamilySearchType.js`'s
233
+ * "Has type" select and `buildMultiSelect`'s `required` use.
234
+ * `booleanSearchType.js` passes this (a boolean widget has nothing else to
235
+ * constrain, so "(any)" is never a meaningful "no constraint" state - same
236
+ * "no absent values" reasoning as `buildLiteralRegexControls`'s Value
237
+ * input); other callers (`numberSearchType.js`'s "Is/Is Not Integer",
238
+ * `dommatrixSearchType.js`'s readonly/3d) leave it at the default `false`,
239
+ * since those are one of *several* facets in their own widget, where
240
+ * "(any)" legitimately means "no constraint on this facet".
241
+ * @param {{
242
+ * name: string, key?: string, trueLabel: string, falseLabel: string,
243
+ * onChange?: (this: HTMLElement) => void, required?: boolean
244
+ * }} cfg
130
245
  * @returns {JamilihArray}
131
246
  */
132
- export function buildTriStateSelect({ name, key, trueLabel, falseLabel }: {
247
+ export function buildTriStateSelect({ name, key, trueLabel, falseLabel, onChange, required }: {
133
248
  name: string;
134
249
  key?: string;
135
250
  trueLabel: string;
136
251
  falseLabel: string;
252
+ onChange?: (this: HTMLElement) => void;
253
+ required?: boolean;
137
254
  }): JamilihArray;
138
255
  /**
139
256
  * Reads back a `buildTriStateSelect`/`buildHasPropertyToggle` - pass the
140
257
  * same `key` it was built with. `''` (any) maps to `undefined`.
141
- * @param {HTMLElement} el
258
+ * @param {Element} el
142
259
  * @param {string} [key]
143
260
  * @returns {boolean|undefined}
144
261
  */
145
- export function readTriStateSelect(el: HTMLElement, key?: string): boolean | undefined;
262
+ export function readTriStateSelect(el: Element, key?: string): boolean | undefined;
146
263
  /**
147
264
  * A single checkbox - the only search affordance the README grants
148
265
  * `undefined`/`void`/`null`/`NaN` ("Require present"; they have "no
149
266
  * variants to allow for distinct search", since existence only becomes a
150
267
  * meaningful question once the path is optional or nested in a union), and
151
- * also used by `recordSearchType.js` for its "require same entry" toggle.
152
- * @param {{name: string, label: string}} cfg
268
+ * also used by `recordSearchType.js`/`mapSearchType.js` for their "require
269
+ * same entry" toggle.
270
+ *
271
+ * `checked`, when set, pre-checks the checkbox; `disabled` locks it there,
272
+ * non-interactive. `makePresenceOnlySearchType` passes both: the checkbox
273
+ * is that leaf's *only* possible constraint, and its whole schema type has
274
+ * exactly one value ("no variants to allow for distinct search" above) -
275
+ * there is no second state worth offering a choice between, so this simply
276
+ * asserts the one meaningful thing outright rather than making the user
277
+ * pointlessly check a box that could only ever mean one thing. "require
278
+ * same entry" leaves both at their `false` defaults (interactive,
279
+ * unchecked), since that's one optional facet alongside a map/record's own
280
+ * key/value matches, not the whole widget's sole, single-valued constraint.
281
+ * @param {{name: string, label: string, checked?: boolean, disabled?: boolean}} cfg
153
282
  * @returns {JamilihArray}
154
283
  */
155
- export function buildCheckbox({ name, label }: {
284
+ export function buildCheckbox({ name, label, checked, disabled }: {
156
285
  name: string;
157
286
  label: string;
287
+ checked?: boolean;
288
+ disabled?: boolean;
158
289
  }): JamilihArray;
159
290
  /**
160
291
  * Reads back a `buildCheckbox`.
@@ -174,17 +305,52 @@ export function readCheckbox(el: HTMLElement): boolean;
174
305
  * (e.g. `errorSearchType.js`'s `message`/`name`/`fileName`/`stack`); see
175
306
  * `buildRangeInputsPair`'s doc for why. Leave it at the default `''` for
176
307
  * the common case of a widget with only one such control.
177
- * @param {{name: string, key?: string}} cfg
308
+ *
309
+ * The Value input is `required`: unlike an untouched range/checkbox/select
310
+ * (whose empty/default state unambiguously means "no constraint"), a mode
311
+ * is always selected here (there is no "(any)" option), so an empty Value
312
+ * next to it is never a meaningful "no constraint" state - it just means
313
+ * the row was added and never finished. That leaves the whole form invalid
314
+ * from the moment such a row exists (`buildSearchChoices`'s `<form>`,
315
+ * `src/search/index.js`) until either a value is entered or (for an
316
+ * `objectSearchType.js` has-property row) the row is removed via its own
317
+ * "Remove" button.
318
+ *
319
+ * `onModeChange`, when given, wires the mode select's own `change` event
320
+ * too (in addition to whatever the caller reads back via
321
+ * `readLiteralRegexQuery` at `getQuery` time) - `regexpSearchType.js` uses
322
+ * it to show/hide its Flags multi-select, which only makes sense while
323
+ * "Matches regex" is the chosen mode.
324
+ *
325
+ * `flagOptions`, when given, adds a Flags multi-select (options passed in
326
+ * by the caller - `stringSearchType.js` passes `regexpType.js`'s own
327
+ * `allowedFlags`, the same list `regexpSearchType.js` uses for the actual
328
+ * regexp's own flags - kept out of this generic module to avoid it
329
+ * depending on a specific fundamental type), shown only while "Matches
330
+ * regex" is the chosen mode, the same `$options` a Mongo-flavored `$regex`
331
+ * accepts alongside it - a plain literal/substring match has no regex to
332
+ * apply flags to, so it stays hidden otherwise. Every other caller
333
+ * (`errorSearchType.js`'s props, `fileSearchType.js`'s name/type,
334
+ * `domexceptionSearchType.js`'s message) leaves this unset, matching the
335
+ * README's flags-for-regexp-only-plus-string bullet.
336
+ * @param {{
337
+ * name: string, key?: string, onModeChange?: (this: HTMLElement) => void,
338
+ * flagOptions?: string[]
339
+ * }} cfg
178
340
  * @returns {JamilihArray}
179
341
  */
180
- export function buildLiteralRegexControls({ name, key }: {
342
+ export function buildLiteralRegexControls({ name, key, onModeChange, flagOptions }: {
181
343
  name: string;
182
344
  key?: string;
345
+ onModeChange?: (this: HTMLElement) => void;
346
+ flagOptions?: string[];
183
347
  }): JamilihArray;
184
348
  /**
185
349
  * Reads back `buildLiteralRegexControls` into the corresponding
186
350
  * `literalSet`/`regex`/`notContains` leaf - pass the same `key` it was
187
- * built with.
351
+ * built with. A `regex` leaf's `$options` is only ever populated when the
352
+ * caller built this with `flagOptions` (see that function's doc) and at
353
+ * least one flag is currently selected.
188
354
  * @param {HTMLElement} el
189
355
  * @param {string} path
190
356
  * @param {string} [key]
@@ -216,10 +382,169 @@ export function buildLengthSizeControls({ name, min, max, includeSparse }: {
216
382
  /**
217
383
  * Reads back `buildLengthSizeControls` into one `lengthSize` leaf, or
218
384
  * `undefined` if neither the size nor the sparse control was set.
219
- * @param {HTMLElement} el
385
+ * @param {Element} el
220
386
  * @param {string} path
221
387
  * @returns {import('./queryTree.js').QueryLengthSizeLeaf|undefined}
222
388
  */
223
- export function readLengthSizeQuery(el: HTMLElement, path: string): import("./queryTree.js").QueryLengthSizeLeaf | undefined;
389
+ export function readLengthSizeQuery(el: Element, path: string): import("./queryTree.js").QueryLengthSizeLeaf | undefined;
390
+ /**
391
+ * Wraps arbitrary markup - a recursed child search widget's array, or a
392
+ * fixed facet's own controls (`buildLiteralRegexControls`'s output, say) -
393
+ * in an opt-in "Search on this" checkbox around a disabled `<fieldset>`.
394
+ * For a facet that's one of *several* independent, individually-optional
395
+ * constraints within a parent widget (array/set/tuple/filelist's element
396
+ * match(es); map/record's key/value; `fileSearchType.js`'s name/content-
397
+ * type), this keeps that facet's own `required` controls (if it has any)
398
+ * from forcing the *whole* form invalid just by the facet existing -
399
+ * generalizes `objectSearchType.js`'s original required-property row (see
400
+ * that file's history) into a shared helper once enough call sites needed
401
+ * the identical checkbox+fieldset shape.
402
+ *
403
+ * `key` distinguishes multiple opt-in fieldsets *within one widget* (e.g.
404
+ * `mapSearchType.js`'s "key" and "value"); see `buildRangeInputsPair`'s doc
405
+ * for why. Leave it at the default `''` for a widget with only one.
406
+ *
407
+ * The checkbox's own `name` attribute is `${name}-optIn`, not the bare
408
+ * `name` passed in: a caller's `name` is typically shared with (a prefix
409
+ * of) the wrapped content's own field names (`mapSearchType.js`'s "value"
410
+ * facet, say, names its checkbox from the same `name` its inner value
411
+ * widget builds its own `-value`-suffixed `<input>` from), and callers
412
+ * cannot always predict what suffix a given recursed `SearchTypeObject`
413
+ * will pick - the fixed `-optIn` suffix here guarantees no collision
414
+ * regardless, without every caller needing to reason about it.
415
+ *
416
+ * Call `wireOptInFieldset` once, right after this is built into real DOM
417
+ * (e.g. inside a `jml(...)` caller, same as `objectSearchType.js`'s rows
418
+ * do), to actually connect the checkbox to the fieldset's `disabled` state -
419
+ * this function only builds the static markup (default unchecked/disabled).
420
+ * @param {{
421
+ * name: string, key?: string, label: string, children: JamilihArray[]
422
+ * }} cfg
423
+ * @returns {JamilihArray[]}
424
+ */
425
+ export function buildOptInFieldset({ name, key, label, children }: {
426
+ name: string;
427
+ key?: string;
428
+ label: string;
429
+ children: JamilihArray[];
430
+ }): JamilihArray[];
431
+ /**
432
+ * Reads back a `buildOptInFieldset`'s checkbox - pass the same `key` it was
433
+ * built with.
434
+ * @param {Element} root
435
+ * @param {string} [key]
436
+ * @returns {boolean}
437
+ */
438
+ export function readOptInChecked(root: Element, key?: string): boolean;
439
+ /**
440
+ * Connects a `buildOptInFieldset`'s checkbox to toggle its own fieldset's
441
+ * `disabled` state - call once, synchronously, right after both are live
442
+ * DOM nodes (see that function's doc). Pass the same `key` it was built
443
+ * with.
444
+ *
445
+ * `onToggle`, when given, is called after each toggle (with the checkbox as
446
+ * `this`) - `mapSearchType.js`/`recordSearchType.js`/`fileSearchType.js`
447
+ * use it to re-run their own `syncAtLeastOneCheck` whenever one of their
448
+ * (exactly two) opt-in facets changes, since checking/unchecking either one
449
+ * can change whether "at least one" is satisfied.
450
+ * @param {Element} root
451
+ * @param {string} [key]
452
+ * @param {((this: HTMLInputElement) => void)} [onToggle]
453
+ * @returns {void}
454
+ */
455
+ export function wireOptInFieldset(root: Element, key?: string, onToggle?: ((this: HTMLInputElement) => void)): void;
456
+ /**
457
+ * A visually-hidden but still-rendered (and so still constraint-validation-
458
+ * eligible - see `jsoe.css`'s `.searchAtLeastOneSentinel`, the same
459
+ * "visually-hidden" pattern used for accessibility, which keeps an element
460
+ * off-screen without `display: none`/`hidden` triggering the Constraint
461
+ * Validation API's own "not rendered" exemption) sentinel control, for a
462
+ * widget with several independent optional facets where leaving *every one*
463
+ * unconfigured should be invalid even though no single facet is itself
464
+ * always required (`mapSearchType.js`/`recordSearchType.js`'s key/value,
465
+ * `fileSearchType.js`'s name/content-type). Pair with `syncAtLeastOneCheck`.
466
+ * @returns {JamilihArray}
467
+ */
468
+ export function buildAtLeastOneSentinel(): JamilihArray;
469
+ /**
470
+ * Sets a `buildAtLeastOneSentinel`'s custom validity from a live check -
471
+ * call once at `connectedCallback` time for the initial state (a freshly-
472
+ * built widget has satisfied none of its facets yet) and again whenever a
473
+ * facet that could change the answer does (an opt-in checkbox toggling, a
474
+ * recursed child's own `input`/`change`).
475
+ *
476
+ * Also relaxed, independently of `isSatisfied`, while
477
+ * `isExemptedByAncestorHasProperty` says an enclosing
478
+ * `objectSearchType.js` has-property row's own "Has"/"Doesn't have"
479
+ * already provides a complete constraint - the same relief
480
+ * `syncRangeValidity` and `dateSearchType.js`'s own range validator give
481
+ * their "at least one bound" rule, needed here too since a has-property
482
+ * row's own child could just as easily be an `array`/`map`/`file`/etc.
483
+ * whose *own* sole constraint is this same "at least one facet" sentinel
484
+ * rather than a plain `required` attribute or a range pair.
485
+ *
486
+ * Every call re-registers `isSatisfied` (keyed by `root` in a `WeakMap`, so
487
+ * it never leaks past the element's own lifetime) for `resyncAtLeastOne` to
488
+ * call later. This exists because not every "at least one" widget's own
489
+ * answer changes via a plain `input`/`change` event - `objectSearchType.js`
490
+ * itself is the reason: its sentinel changes when a row is added/removed
491
+ * (a button click, and a structural DOM change, not a value change on any
492
+ * control), which `revalidateDescendants`' blanket event-redispatch can
493
+ * never reach, unlike `array`/`map`/etc.'s own opt-in checkboxes and size
494
+ * inputs. `objectSearchType.js`'s `buildHasPropertyRow` calls
495
+ * `resyncAtLeastOne` directly instead, precisely because it can't rely on
496
+ * redispatched events reaching every possible child type.
497
+ * @param {Element} root
498
+ * @param {() => boolean} isSatisfied
499
+ * @returns {void}
500
+ */
501
+ export function syncAtLeastOneCheck(root: Element, isSatisfied: () => boolean): void;
502
+ /**
503
+ * Re-runs every `syncAtLeastOneCheck` registered anywhere within `root`
504
+ * (itself included) - see that function's doc for why this exists
505
+ * alongside `revalidateDescendants` rather than relying on it alone.
506
+ * @param {Element} root
507
+ * @returns {void}
508
+ */
509
+ export function resyncAtLeastOne(root: Element): void;
510
+ /**
511
+ * Toggles the native `required` attribute on every originally-`required`
512
+ * control inside `root`, leaving everything else (visibility, `disabled`)
513
+ * alone - unlike `buildOptInFieldset`'s `<fieldset disabled>`, this keeps
514
+ * the whole subtree fully interactive, for a case where an ancestor's own
515
+ * choice already provides a complete constraint on its own, but should
516
+ * still let the recursed child *optionally* add a further constraint on
517
+ * top rather than blocking interaction with it entirely.
518
+ * `objectSearchType.js`'s `buildHasPropertyRow` uses this for its "Has"/
519
+ * "Doesn't have" tri-state: once existence is explicitly asserted either
520
+ * way, the child's own required inputs (whatever type it turns out to be)
521
+ * should stop forcing it to be filled in, while a user who still wants to
522
+ * combine "Has property X" with "X matches Y" can keep typing into it -
523
+ * `dateSearchType.js`'s "Valid"/"Invalid date" tri-state needs the
524
+ * equivalent relaxation for its own (structurally different, so not built
525
+ * through this helper) range pair.
526
+ *
527
+ * Relaxing (`required: false`) marks each control it touches with
528
+ * `data-jsoe-was-required` before clearing the IDL `required` property -
529
+ * setting that property to `false` reflects back to *removing* the
530
+ * `required` content attribute entirely (standard boolean-attribute
531
+ * reflection), so a later call to restore it can't rely on `[required]`
532
+ * still matching that element; it looks for the marker instead.
533
+ *
534
+ * Skips any control inside a `buildOptInFieldset` fieldset
535
+ * (`jsoeSearchOptInFieldset--*`): that facet already has its own gate on
536
+ * whether it applies at all (the checkbox's `disabled` toggle exempts it
537
+ * from constraint validation while unchecked), so an enclosing "Has
538
+ * property" shouldn't also strip its `required` - a user who explicitly
539
+ * opts into e.g. `fileSearchType.js`'s "Name" facet under a "Has property"
540
+ * ancestor still needs to fill in the Value it requires, or uncheck "Name"
541
+ * again; only the widget's own `buildAtLeastOneSentinel` (which *is*
542
+ * exempted, via `isExemptedByAncestorHasProperty`) should be satisfied by
543
+ * "Has property" alone.
544
+ * @param {Element} root
545
+ * @param {boolean} required
546
+ * @returns {void}
547
+ */
548
+ export function setDescendantsRequired(root: Element, required: boolean): void;
224
549
  export type JamilihArray = import("../types.js").JamilihArray;
225
550
  //# sourceMappingURL=searchUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"searchUtils.d.ts","sourceRoot":"","sources":["../../src/search/searchUtils.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;;;;;GASG;AACH,6CAJW,OAAO,sBAAsB,EAAE,WAAW,GAAC,SAAS,QACpD,MAAM,GACJ,MAAM,CASlB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qCAJW,WAAW,YACX,MAAM,GACJ,WAAW,GAAC,SAAS,CAMjC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,0EAVW;IACN,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,GAAC,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAC,MAAM,CAAA;CACrB,GACS,YAAY,EAAE,CAe1B;AAED;;;;;;GAMG;AACH,wCAJW,WAAW,QACX,MAAM,GACJ;IAAC,GA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H,uCAHW,OAAO,GACL,IAAI,CAOhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,6CAJW,OAAO,YACP,OAAO,GACL,IAAI,CAehB;2BA10BY,OAAO,aAAa,EAAE,YAAY"}
@@ -5,11 +5,31 @@ export type SearchTypeObject = import("../searchDispatch.js").SearchTypeObject;
5
5
  */
6
6
  /**
7
7
  * Blob HTML: XPath, CSS selectors, full text search, regex search of raw
8
- * HTML (README) - a mode `<select>` plus one text `<input>`, the same
8
+ * HTML (README) - a mode `<select>` plus one value control, the same
9
9
  * "pick a mode, give it one value" shape as `buildLiteralRegexControls`
10
10
  * (`searchUtils.js`), but not built through it: the four modes and the
11
11
  * `blobHTML` leaf kind they produce are specific to this one type, with no
12
- * second caller to share the helper with.
12
+ * second caller to share the helper with. The value control is a single-line
13
+ * `<input>` for XPath/CSS-selector/regex, but swaps to a `<textarea>` for
14
+ * "Full text search" mode alone, since a search phrase in a body of text is
15
+ * the one mode actually expected to run to more than one line - both share
16
+ * the same class, so the mode `<select>`'s `change` handler (and `getQuery`)
17
+ * only need the tag name to tell them apart. Only the currently-visible one
18
+ * of the pair is ever `required` (toggled alongside `hidden` by the mode
19
+ * `change` handler): a `required` field that's merely hidden, rather than
20
+ * also un-required, still blocks the form's validity even though the user
21
+ * has no way to see or fill it.
22
+ *
23
+ * The `change` handler also checks `isExemptedByAncestorHasProperty` before
24
+ * (re-)asserting `required` on the now-visible control: nested as an
25
+ * optional object property's own child widget, an enclosing "Has property"
26
+ * already provides a complete constraint on its own (the same relief
27
+ * `setDescendantsRequired` gives other `required`-attribute controls), but
28
+ * that relief is a one-time toggle applied *before* `revalidateDescendants`
29
+ * re-dispatches a synthetic `change` on this very `<select>` - without this
30
+ * check, that synthetic event would immediately reassert `required` on
31
+ * whichever control the current mode makes visible, undoing the exemption
32
+ * `setDescendantsRequired` had just granted.
13
33
  * @type {SearchTypeObject}
14
34
  */
15
35
  declare const blobHTMLSearchType: SearchTypeObject;
@@ -1 +1 @@
1
- {"version":3,"file":"blobHTMLSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/subTypes/blobHTMLSearchType.js"],"names":[],"mappings":";+BAKa,OAAO,sBAAsB,EAAE,gBAAgB;AAD5D;;GAEG;AAEH;;;;;;;;GAQG;AACH,kCAFU,gBAAgB,CA+CxB"}
1
+ {"version":3,"file":"blobHTMLSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/subTypes/blobHTMLSearchType.js"],"names":[],"mappings":";+BAOa,OAAO,sBAAsB,EAAE,gBAAgB;AAD5D;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,kCAFU,gBAAgB,CAkFxB"}
@@ -1,8 +1,5 @@
1
1
  export default recordSearchType;
2
2
  export type SearchTypeObject = import("../searchDispatch.js").SearchTypeObject;
3
- /**
4
- * @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
5
- */
6
3
  /**
7
4
  * Record search is "key-schema search AND/OR value-schema search,"
8
5
  * structurally unlike object's additive "has property" (search plan §1) -
@@ -11,7 +8,10 @@ export type SearchTypeObject = import("../searchDispatch.js").SearchTypeObject;
11
8
  * whether a match must come from the *same* entry ("has key 2-4 and value
12
9
  * 7-9", README) via the "joint" toggle on the resulting `mapRecordJoint`
13
10
  * leaf - also used for `looseRecord`, aliased to this same module in
14
- * `searchDispatch.js` since the search semantics are identical.
11
+ * `searchDispatch.js` since the search semantics are identical. Key and
12
+ * value each get their own `buildOptInFieldset` (see `mapSearchType.js`'s
13
+ * matching doc for why), but leaving *both* unopted-in is itself invalid via
14
+ * `buildAtLeastOneSentinel`.
15
15
  * @type {SearchTypeObject}
16
16
  */
17
17
  declare const recordSearchType: SearchTypeObject;
@@ -1 +1 @@
1
- {"version":3,"file":"recordSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/subTypes/recordSearchType.js"],"names":[],"mappings":";+BAMa,OAAO,sBAAsB,EAAE,gBAAgB;AAD5D;;GAEG;AAEH;;;;;;;;;;GAUG;AACH,gCAFU,gBAAgB,CA+DxB"}
1
+ {"version":3,"file":"recordSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/subTypes/recordSearchType.js"],"names":[],"mappings":";+BASa,OAAO,sBAAsB,EAAE,gBAAgB;AAa5D;;;;;;;;;;;;;GAaG;AACH,gCAFU,gBAAgB,CAoExB"}
@@ -1,8 +1,5 @@
1
1
  export default tupleSearchType;
2
2
  export type SearchTypeObject = import("../searchDispatch.js").SearchTypeObject;
3
- /**
4
- * @typedef {import('../searchDispatch.js').SearchTypeObject} SearchTypeObject
5
- */
6
3
  /**
7
4
  * Each fixed position gets its own control from `.items[i]`, not one
8
5
  * control repeated per element (search plan §1 - unlike the value-editing
@@ -15,6 +12,9 @@ export type SearchTypeObject = import("../searchDispatch.js").SearchTypeObject;
15
12
  * items.length`, no sparse toggle - not applicable to a tuple), and the
16
13
  * `rest` element itself recurses into its own search widget under the same
17
14
  * `*` path-segment convention `arraySearchType.js` uses for its element.
15
+ * Leaving every position, the rest element, and (when present) the length
16
+ * unconfigured at once is invalid (`buildAtLeastOneSentinel`), the same as
17
+ * `arraySearchType.js`/`setSearchType.js`/`filelistSearchType.js`.
18
18
  * @type {SearchTypeObject}
19
19
  */
20
20
  declare const tupleSearchType: SearchTypeObject;
@@ -1 +1 @@
1
- {"version":3,"file":"tupleSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/subTypes/tupleSearchType.js"],"names":[],"mappings":";+BAMa,OAAO,sBAAsB,EAAE,gBAAgB;AAD5D;;GAEG;AAEH;;;;;;;;;;;;;GAaG;AACH,+BAFU,gBAAgB,CAuFxB"}
1
+ {"version":3,"file":"tupleSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/subTypes/tupleSearchType.js"],"names":[],"mappings":";+BAUa,OAAO,sBAAsB,EAAE,gBAAgB;AAkB5D;;;;;;;;;;;;;;;;GAgBG;AACH,+BAFU,gBAAgB,CA0GxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"buffersourceSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/superTypes/buffersourceSearchType.js"],"names":[],"mappings":";+BAKa,OAAO,sBAAsB,EAAE,gBAAgB;AAD5D;;GAEG;AAEH;;;;;;;;;GASG;AACH,sCAFU,gBAAgB,CA4BxB"}
1
+ {"version":3,"file":"buffersourceSearchType.d.ts","sourceRoot":"","sources":["../../../src/search/superTypes/buffersourceSearchType.js"],"names":[],"mappings":";+BAOa,OAAO,sBAAsB,EAAE,gBAAgB;AAD5D;;GAEG;AAEH;;;;;;;;;GASG;AACH,sCAFU,gBAAgB,CAgCxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"unionFamilySearchType.d.ts","sourceRoot":"","sources":["../../../src/search/unions/unionFamilySearchType.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sEAHW;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAC,GACvC,gBAAgB,CAoH5B;+BAxJY,OAAO,sBAAsB,EAAE,gBAAgB;oCAY/C;IACR,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,yBAAyB,EAAE,WAAW,EAAE,CAAA;CACzD"}
1
+ {"version":3,"file":"unionFamilySearchType.d.ts","sourceRoot":"","sources":["../../../src/search/unions/unionFamilySearchType.js"],"names":[],"mappings":"AAkBA;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,sEAHW;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAC,GACvC,gBAAgB,CA4H5B;+BAhKY,OAAO,sBAAsB,EAAE,gBAAgB;oCAY/C;IACR,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,yBAAyB,EAAE,WAAW,EAAE,CAAA;CACzD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@es-joy/jsoe",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./src/index.js",
@@ -12,17 +12,21 @@ import {schemaLabel} from '../utils/schemaMeta.js';
12
12
  * The `<input type="datetime-local">` construction shared between this
13
13
  * type's own `editUI` and the search subsystem's date-range widget
14
14
  * (`src/search/fundamentalTypes/dateSearchType.js` calls this twice, once
15
- * per range endpoint).
15
+ * per range endpoint, passing `onValidate` for its own from/to
16
+ * cross-validation - merged in here, rather than spread onto the returned
17
+ * array's props at the call site, since a `JamilihArray`'s props slot isn't
18
+ * statically indexable/spreadable outside this function).
16
19
  * @param {{
17
20
  * name: string,
18
21
  * value?: Date|string,
19
22
  * notANum?: boolean,
20
- * dateSchemaObject?: import('zodexy').SzDate
23
+ * dateSchemaObject?: import('zodexy').SzDate,
24
+ * onValidate?: (this: HTMLElement) => void
21
25
  * }} cfg
22
26
  * @returns {import('../types.js').JamilihArray}
23
27
  */
24
28
  export function buildDateInputControl ({
25
- name, value = '', notANum = false, dateSchemaObject
29
+ name, value = '', notANum = false, dateSchemaObject, onValidate
26
30
  }) {
27
31
  return ['input', {
28
32
  name,
@@ -36,7 +40,8 @@ export function buildDateInputControl ({
36
40
  : undefined,
37
41
  max: dateSchemaObject?.max
38
42
  ? new Date(dateSchemaObject.max).toISOString().slice(0, -8)
39
- : undefined
43
+ : undefined,
44
+ $on: onValidate ? {input: onValidate, change: onValidate} : undefined
40
45
  }];
41
46
  }
42
47
 
@@ -65,7 +65,7 @@ const regexpType = {
65
65
  }, '')
66
66
  );
67
67
  },
68
- allowedFlags: ['g', 'i', 'm', 'u', 'y', 's', 'v'],
68
+ allowedFlags: ['g', 'i', 'm', 'u', 'y', 's', 'v', 'd'],
69
69
  viewUI ({value, specificSchemaObject}) {
70
70
  return ['i', {
71
71
  dataset: {type: 'regexp'},