@es-joy/jsoe 0.28.1 → 0.29.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 (171) hide show
  1. package/CHANGES.md +23 -0
  2. package/README.md +2 -0
  3. package/badges/coverage-badge.svg +1 -1
  4. package/badges/tests-badge.svg +1 -1
  5. package/dist/deepEqual.d.ts +3 -0
  6. package/dist/deepEqual.d.ts.map +1 -0
  7. package/dist/formatAndTypeChoices.d.ts +6 -6
  8. package/dist/formatAndTypeChoices.d.ts.map +1 -1
  9. package/dist/formats/schema.d.ts +5 -0
  10. package/dist/formats/schema.d.ts.map +1 -1
  11. package/dist/formats.d.ts +2 -2
  12. package/dist/formats.d.ts.map +1 -1
  13. package/dist/fundamentalTypes/dateType.d.ts +21 -2
  14. package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
  15. package/dist/fundamentalTypes/domexceptionType.d.ts +7 -0
  16. package/dist/fundamentalTypes/domexceptionType.d.ts.map +1 -1
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +2 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/jtltExtensions.d.ts +112 -0
  22. package/dist/jtltExtensions.d.ts.map +1 -0
  23. package/dist/search/fundamentalTypes/arraySearchType.d.ts +15 -0
  24. package/dist/search/fundamentalTypes/arraySearchType.d.ts.map +1 -0
  25. package/dist/search/fundamentalTypes/bigintSearchType.d.ts +10 -0
  26. package/dist/search/fundamentalTypes/bigintSearchType.d.ts.map +1 -0
  27. package/dist/search/fundamentalTypes/blobSearchType.d.ts +19 -0
  28. package/dist/search/fundamentalTypes/blobSearchType.d.ts.map +1 -0
  29. package/dist/search/fundamentalTypes/booleanSearchType.d.ts +11 -0
  30. package/dist/search/fundamentalTypes/booleanSearchType.d.ts.map +1 -0
  31. package/dist/search/fundamentalTypes/catchSearchType.d.ts +18 -0
  32. package/dist/search/fundamentalTypes/catchSearchType.d.ts.map +1 -0
  33. package/dist/search/fundamentalTypes/dateSearchType.d.ts +10 -0
  34. package/dist/search/fundamentalTypes/dateSearchType.d.ts.map +1 -0
  35. package/dist/search/fundamentalTypes/domexceptionSearchType.d.ts +16 -0
  36. package/dist/search/fundamentalTypes/domexceptionSearchType.d.ts.map +1 -0
  37. package/dist/search/fundamentalTypes/enumSearchType.d.ts +22 -0
  38. package/dist/search/fundamentalTypes/enumSearchType.d.ts.map +1 -0
  39. package/dist/search/fundamentalTypes/errorSearchType.d.ts +9 -0
  40. package/dist/search/fundamentalTypes/errorSearchType.d.ts.map +1 -0
  41. package/dist/search/fundamentalTypes/fileSearchType.d.ts +19 -0
  42. package/dist/search/fundamentalTypes/fileSearchType.d.ts.map +1 -0
  43. package/dist/search/fundamentalTypes/filelistSearchType.d.ts +32 -0
  44. package/dist/search/fundamentalTypes/filelistSearchType.d.ts.map +1 -0
  45. package/dist/search/fundamentalTypes/functionSearchType.d.ts +18 -0
  46. package/dist/search/fundamentalTypes/functionSearchType.d.ts.map +1 -0
  47. package/dist/search/fundamentalTypes/mapSearchType.d.ts +18 -0
  48. package/dist/search/fundamentalTypes/mapSearchType.d.ts.map +1 -0
  49. package/dist/search/fundamentalTypes/nanSearchType.d.ts +7 -0
  50. package/dist/search/fundamentalTypes/nanSearchType.d.ts.map +1 -0
  51. package/dist/search/fundamentalTypes/nullSearchType.d.ts +7 -0
  52. package/dist/search/fundamentalTypes/nullSearchType.d.ts.map +1 -0
  53. package/dist/search/fundamentalTypes/numberSearchType.d.ts +11 -0
  54. package/dist/search/fundamentalTypes/numberSearchType.d.ts.map +1 -0
  55. package/dist/search/fundamentalTypes/objectSearchType.d.ts +15 -0
  56. package/dist/search/fundamentalTypes/objectSearchType.d.ts.map +1 -0
  57. package/dist/search/fundamentalTypes/promiseSearchType.d.ts +20 -0
  58. package/dist/search/fundamentalTypes/promiseSearchType.d.ts.map +1 -0
  59. package/dist/search/fundamentalTypes/regexpSearchType.d.ts +14 -0
  60. package/dist/search/fundamentalTypes/regexpSearchType.d.ts.map +1 -0
  61. package/dist/search/fundamentalTypes/setSearchType.d.ts +14 -0
  62. package/dist/search/fundamentalTypes/setSearchType.d.ts.map +1 -0
  63. package/dist/search/fundamentalTypes/stringSearchType.d.ts +13 -0
  64. package/dist/search/fundamentalTypes/stringSearchType.d.ts.map +1 -0
  65. package/dist/search/fundamentalTypes/symbolSearchType.d.ts +16 -0
  66. package/dist/search/fundamentalTypes/symbolSearchType.d.ts.map +1 -0
  67. package/dist/search/fundamentalTypes/undefinedSearchType.d.ts +7 -0
  68. package/dist/search/fundamentalTypes/undefinedSearchType.d.ts.map +1 -0
  69. package/dist/search/index.d.ts +60 -0
  70. package/dist/search/index.d.ts.map +1 -0
  71. package/dist/search/queryTree.d.ts +180 -0
  72. package/dist/search/queryTree.d.ts.map +1 -0
  73. package/dist/search/queryTreeBuilders.d.ts +168 -0
  74. package/dist/search/queryTreeBuilders.d.ts.map +1 -0
  75. package/dist/search/searchDispatch.d.ts +121 -0
  76. package/dist/search/searchDispatch.d.ts.map +1 -0
  77. package/dist/search/searchElementUtils.d.ts +97 -0
  78. package/dist/search/searchElementUtils.d.ts.map +1 -0
  79. package/dist/search/searchUtils.d.ts +225 -0
  80. package/dist/search/searchUtils.d.ts.map +1 -0
  81. package/dist/search/subTypes/blobHTMLSearchType.d.ts +16 -0
  82. package/dist/search/subTypes/blobHTMLSearchType.d.ts.map +1 -0
  83. package/dist/search/subTypes/recordSearchType.d.ts +18 -0
  84. package/dist/search/subTypes/recordSearchType.d.ts.map +1 -0
  85. package/dist/search/subTypes/tupleSearchType.d.ts +21 -0
  86. package/dist/search/subTypes/tupleSearchType.d.ts.map +1 -0
  87. package/dist/search/superTypes/SpecialRealNumberSearchType.d.ts +14 -0
  88. package/dist/search/superTypes/SpecialRealNumberSearchType.d.ts.map +1 -0
  89. package/dist/search/superTypes/buffersourceSearchType.d.ts +17 -0
  90. package/dist/search/superTypes/buffersourceSearchType.d.ts.map +1 -0
  91. package/dist/search/superTypes/dommatrixSearchType.d.ts +11 -0
  92. package/dist/search/superTypes/dommatrixSearchType.d.ts.map +1 -0
  93. package/dist/search/superTypes/dompointSearchType.d.ts +9 -0
  94. package/dist/search/superTypes/dompointSearchType.d.ts.map +1 -0
  95. package/dist/search/superTypes/domrectSearchType.d.ts +9 -0
  96. package/dist/search/superTypes/domrectSearchType.d.ts.map +1 -0
  97. package/dist/search/superTypes/errorsSpecialSearchType.d.ts +11 -0
  98. package/dist/search/superTypes/errorsSpecialSearchType.d.ts.map +1 -0
  99. package/dist/search/unions/discriminatedUnionSearchType.d.ts +12 -0
  100. package/dist/search/unions/discriminatedUnionSearchType.d.ts.map +1 -0
  101. package/dist/search/unions/unionFamilySearchType.d.ts +36 -0
  102. package/dist/search/unions/unionFamilySearchType.d.ts.map +1 -0
  103. package/dist/search/unions/unionSearchType.d.ts +8 -0
  104. package/dist/search/unions/unionSearchType.d.ts.map +1 -0
  105. package/dist/search/unions/xorSearchType.d.ts +12 -0
  106. package/dist/search/unions/xorSearchType.d.ts.map +1 -0
  107. package/dist/superTypes/buffersourceType.d.ts.map +1 -1
  108. package/dist/typeChoices.d.ts +3 -3
  109. package/dist/typeChoices.d.ts.map +1 -1
  110. package/dist/types.d.ts +3 -3
  111. package/dist/types.d.ts.map +1 -1
  112. package/dist/utils/rawTypesonEditor.d.ts.map +1 -1
  113. package/docs/proposals/search-plan.md +166 -0
  114. package/package.json +5 -4
  115. package/pnpm-workspace.yaml +1 -1
  116. package/rollup.config.js +12 -0
  117. package/src/formatAndTypeChoices.js +4 -4
  118. package/src/formats/schema.js +2 -1
  119. package/src/formats.js +1 -1
  120. package/src/fundamentalTypes/dateType.js +35 -14
  121. package/src/fundamentalTypes/domexceptionType.js +41 -33
  122. package/src/index.js +6 -0
  123. package/src/jtltExtensions.js +103 -0
  124. package/src/search/fundamentalTypes/arraySearchType.js +66 -0
  125. package/src/search/fundamentalTypes/bigintSearchType.js +62 -0
  126. package/src/search/fundamentalTypes/blobSearchType.js +41 -0
  127. package/src/search/fundamentalTypes/booleanSearchType.js +40 -0
  128. package/src/search/fundamentalTypes/catchSearchType.js +59 -0
  129. package/src/search/fundamentalTypes/dateSearchType.js +73 -0
  130. package/src/search/fundamentalTypes/domexceptionSearchType.js +55 -0
  131. package/src/search/fundamentalTypes/enumSearchType.js +58 -0
  132. package/src/search/fundamentalTypes/errorSearchType.js +11 -0
  133. package/src/search/fundamentalTypes/fileSearchType.js +41 -0
  134. package/src/search/fundamentalTypes/filelistSearchType.js +78 -0
  135. package/src/search/fundamentalTypes/functionSearchType.js +78 -0
  136. package/src/search/fundamentalTypes/mapSearchType.js +87 -0
  137. package/src/search/fundamentalTypes/nanSearchType.js +11 -0
  138. package/src/search/fundamentalTypes/nullSearchType.js +11 -0
  139. package/src/search/fundamentalTypes/numberSearchType.js +52 -0
  140. package/src/search/fundamentalTypes/objectSearchType.js +148 -0
  141. package/src/search/fundamentalTypes/promiseSearchType.js +61 -0
  142. package/src/search/fundamentalTypes/regexpSearchType.js +48 -0
  143. package/src/search/fundamentalTypes/setSearchType.js +65 -0
  144. package/src/search/fundamentalTypes/stringSearchType.js +35 -0
  145. package/src/search/fundamentalTypes/symbolSearchType.js +38 -0
  146. package/src/search/fundamentalTypes/undefinedSearchType.js +11 -0
  147. package/src/search/index.js +79 -0
  148. package/src/search/queryTree.js +235 -0
  149. package/src/search/queryTreeBuilders.js +224 -0
  150. package/src/search/searchDispatch.js +291 -0
  151. package/src/search/searchElementUtils.js +289 -0
  152. package/src/search/searchUtils.js +355 -0
  153. package/src/search/subTypes/blobHTMLSearchType.js +65 -0
  154. package/src/search/subTypes/recordSearchType.js +84 -0
  155. package/src/search/subTypes/tupleSearchType.js +111 -0
  156. package/src/search/superTypes/SpecialRealNumberSearchType.js +42 -0
  157. package/src/search/superTypes/buffersourceSearchType.js +47 -0
  158. package/src/search/superTypes/dommatrixSearchType.js +24 -0
  159. package/src/search/superTypes/dompointSearchType.js +15 -0
  160. package/src/search/superTypes/domrectSearchType.js +15 -0
  161. package/src/search/superTypes/errorsSpecialSearchType.js +15 -0
  162. package/src/search/unions/discriminatedUnionSearchType.js +16 -0
  163. package/src/search/unions/unionFamilySearchType.js +160 -0
  164. package/src/search/unions/unionSearchType.js +12 -0
  165. package/src/search/unions/xorSearchType.js +16 -0
  166. package/src/superTypes/buffersourceType.js +13 -15
  167. package/src/typeChoices.js +2 -2
  168. package/src/types.js +2 -2
  169. package/src/utils/rawTypesonEditor.js +12 -2
  170. package/tsconfig-prod.json +12 -0
  171. package/tsconfig.json +5 -10
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @typedef {{
3
+ * container: HTMLDivElement,
4
+ * $getQuery: () => import('./queryTree.js').QueryAnd,
5
+ * whenReady: Promise<void>
6
+ * }} SearchChoicesControl
7
+ */
8
+ /**
9
+ * The top-level entry point (search plan §5): builds the whole recursive
10
+ * search widget tree for `schemaContent` via `buildSearchWidget`
11
+ * (`searchDispatch.js`), starting at `path = '#/'`. Does not route through
12
+ * `getTypesForSchema` for the general case - that function flattens union
13
+ * members into one flat `Set` of leaf types for a type-choice pull-down,
14
+ * whereas search needs union branches to stay distinguishable nested
15
+ * sub-widgets for the "has type" affordance (`unionSearchType.js` et al.) -
16
+ * `getTypesForSchema` is only reused narrowly, for intersection resolution,
17
+ * inside `buildSearchWidget`/`resolveIntersection` - which run at *every*
18
+ * recursive call site (every composite module's own child recursion uses
19
+ * `buildSearchWidget` too), not just here at the root, so an intersection
20
+ * schema nested anywhere in the tree resolves the same way a top-level one
21
+ * does rather than falling through to the `noneditableSearchType` escape
22
+ * hatch.
23
+ *
24
+ * `resolveIntersection` is called here too (redundantly, but cheaply, since
25
+ * it's a no-op for anything that isn't itself an `intersection`) purely so
26
+ * `$getQuery()` below dispatches through the *same* resolved schema
27
+ * `buildSearchWidget` actually built the UI for, rather than the original
28
+ * (possibly-`intersection`) one.
29
+ *
30
+ * Mirrors `buildTypeChoices`'s (`src/typeChoices.js`) `whenReady`/
31
+ * pull-based convention rather than inventing a push/callback API:
32
+ * `$getQuery()` reads the live DOM into a `QueryAnd` on demand (`{$and:
33
+ * []}` when nothing has been entered anywhere, matching the empty-`$and`
34
+ * convention of "no constraint"), and a host that wants live updates wraps
35
+ * it in its own `container.addEventListener('input', ...)` since
36
+ * `container` is a plain `HTMLDivElement`. Every widget built so far is
37
+ * synchronous, so `whenReady` (unlike `buildTypeChoices`'s) has no deferred
38
+ * work to wait on and settles immediately - it's still returned, so a
39
+ * caller can `await` either function uniformly without checking which one
40
+ * it has.
41
+ * @param {{
42
+ * schemaContent: import('../formats/schema.js').ZodexSchema,
43
+ * typeNamespace?: string,
44
+ * topRoot?: import('../types.js').RootElement,
45
+ * types?: import('../types.js').default
46
+ * }} cfg
47
+ * @returns {SearchChoicesControl}
48
+ */
49
+ export function buildSearchChoices({ schemaContent, typeNamespace, topRoot, types }: {
50
+ schemaContent: import("../formats/schema.js").ZodexSchema;
51
+ typeNamespace?: string;
52
+ topRoot?: import("../types.js").RootElement;
53
+ types?: import("../types.js").default;
54
+ }): SearchChoicesControl;
55
+ export type SearchChoicesControl = {
56
+ container: HTMLDivElement;
57
+ $getQuery: () => import("./queryTree.js").QueryAnd;
58
+ whenReady: Promise<void>;
59
+ };
60
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/search/index.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,qFARW;IACN,aAAa,EAAE,OAAO,sBAAsB,EAAE,WAAW,CAAC;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,aAAa,EAAE,WAAW,CAAC;IAC5C,KAAK,CAAC,EAAE,OAAO,aAAa,EAAE,OAAO,CAAA;CACtC,GACS,oBAAoB,CA4BhC;mCA1EY;IACR,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,MAAM,OAAO,gBAAgB,EAAE,QAAQ,CAAC;IACnD,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB"}
@@ -0,0 +1,180 @@
1
+ export type QueryAnd = {
2
+ $and: QueryNode[];
3
+ };
4
+ export type QueryOr = {
5
+ $or: QueryNode[];
6
+ };
7
+ /**
8
+ * `object` (via `$exists: true/false`).
9
+ */
10
+ export type QueryHasPropertyLeaf = {
11
+ kind: "hasProperty";
12
+ path: string;
13
+ $exists: boolean;
14
+ };
15
+ /**
16
+ * `array`/`set`/tuple-with-rest/`filelist` (via `$size`, or a range of
17
+ * operators when the schema doesn't pin an exact length), +`sparseCheck`
18
+ * for array sparse/not-sparse.
19
+ */
20
+ export type QueryLengthSizeLeaf = {
21
+ kind: "lengthSize";
22
+ path: string;
23
+ $size?: number;
24
+ $gt?: number;
25
+ $gte?: number;
26
+ $lt?: number;
27
+ $lte?: number;
28
+ sparseCheck?: boolean;
29
+ };
30
+ /**
31
+ * `number`/`NumberObject`/`bigint`/`date`/`buffersource`, with `valueType`
32
+ * distinguishing them. Bounds are Mongo-style `$gt`/`$gte`/`$lt`/`$lte`
33
+ * rather than a `min`/`max` pair plus an inclusive boolean - inclusivity is
34
+ * simply which operator is present. The README's "Is Not Range" variant
35
+ * wraps the same leaf in `$not` rather than being a separate kind.
36
+ */
37
+ export type QueryRangeLeaf = {
38
+ kind: "range";
39
+ path: string;
40
+ valueType: "number" | "NumberObject" | "bigint" | "date" | "buffersource";
41
+ $gt?: number | bigint | string;
42
+ $gte?: number | bigint | string;
43
+ $lt?: number | bigint | string;
44
+ $lte?: number | bigint | string;
45
+ };
46
+ export type QueryNotLeaf = {
47
+ kind: "not";
48
+ query: QueryNode;
49
+ };
50
+ /**
51
+ * `number`/`NumberObject`: is/is-not an integer.
52
+ */
53
+ export type QueryIntegerCheckLeaf = {
54
+ kind: "integerCheck";
55
+ path: string;
56
+ isInteger: boolean;
57
+ };
58
+ /**
59
+ * `string`/`StringObject`/`Blob`/`File`/regexp-source/symbol-description
60
+ * (via `$in`/`$nin`).
61
+ */
62
+ export type QueryLiteralSetLeaf = {
63
+ kind: "literalSet";
64
+ path: string;
65
+ $in?: unknown[];
66
+ $nin?: unknown[];
67
+ };
68
+ /**
69
+ * `string`/`StringObject`/`Blob`/`File`/regexp-source/symbol-description
70
+ * (via `$regex`/`$options`, matching Mongo's own field names).
71
+ */
72
+ export type QueryRegexLeaf = {
73
+ kind: "regex";
74
+ path: string;
75
+ $regex: string;
76
+ $options?: string;
77
+ };
78
+ /**
79
+ * `string`/`StringObject`/`Blob`/`File`/regexp-source/symbol-description:
80
+ * a substring the value must not contain.
81
+ */
82
+ export type QueryNotContainsLeaf = {
83
+ kind: "notContains";
84
+ path: string;
85
+ value: string;
86
+ };
87
+ /**
88
+ * `enum`, SpecialNumber's `Infinity`/`-Infinity`/`NaN`/`-0` (via
89
+ * `$in`/`$nin`).
90
+ */
91
+ export type QueryMultiSelectLeaf = {
92
+ kind: "multiSelect";
93
+ path: string;
94
+ $in?: unknown[];
95
+ $nin?: unknown[];
96
+ };
97
+ /**
98
+ * Native enum key-vs-value; no Mongo equivalent, stays custom.
99
+ */
100
+ export type QueryKeyValueEnumLeaf = {
101
+ kind: "keyValueEnum";
102
+ path: string;
103
+ matchKeys: boolean;
104
+ values: unknown[];
105
+ };
106
+ /**
107
+ * Union/xor/discriminatedUnion "has type", carrying `discriminatorValue`
108
+ * when applicable, including when nested under a Map/Record key or value;
109
+ * no Mongo equivalent, stays custom.
110
+ */
111
+ export type QueryTypeOfLeaf = {
112
+ kind: "typeOf";
113
+ path: string;
114
+ searchType: string;
115
+ discriminatorValue?: unknown;
116
+ };
117
+ /**
118
+ * XPath/CSS-selector/full-text/raw-HTML-regex; no Mongo equivalent.
119
+ */
120
+ export type QueryBlobHTMLLeaf = {
121
+ kind: "blobHTML";
122
+ path: string;
123
+ mode: "xpath" | "cssSelector" | "fullText" | "rawHTMLRegex";
124
+ value: string;
125
+ };
126
+ /**
127
+ * Per-dimension ranges for DOMRect/Point/Matrix, each dimension itself a
128
+ * `range` leaf, + `readonlyCheck`/`dimensionCheck` (is/is-not readonly,
129
+ * is/is-not 3d); no Mongo equivalent.
130
+ */
131
+ export type QueryDomShapeLeaf = {
132
+ kind: "domShape";
133
+ path: string;
134
+ dimensions: {
135
+ [dimension: string]: QueryRangeLeaf;
136
+ };
137
+ readonlyCheck?: boolean;
138
+ dimensionCheck?: 2 | 3;
139
+ };
140
+ /**
141
+ * Paired key+value leaves with a joint-match flag; no Mongo equivalent.
142
+ */
143
+ export type QueryMapRecordJointLeaf = {
144
+ kind: "mapRecordJoint";
145
+ path: string;
146
+ keyQuery?: QueryNode;
147
+ valueQuery?: QueryNode;
148
+ joint: boolean;
149
+ };
150
+ /**
151
+ * Promise/literal/catch/function: forwards to a nested `QueryNode` for the
152
+ * child schema so the tree stays uniform even where a type adds no
153
+ * constraint of its own; purely structural, no Mongo equivalent.
154
+ */
155
+ export type QueryPassThroughLeaf = {
156
+ kind: "passThrough";
157
+ path: string;
158
+ query?: QueryNode;
159
+ };
160
+ /**
161
+ * Undefined/void/null (via `$exists`).
162
+ */
163
+ export type QueryPresenceLeaf = {
164
+ kind: "presence";
165
+ path: string;
166
+ $exists: boolean;
167
+ };
168
+ /**
169
+ * Boolean/BooleanObject - Mongo would normally express this as a bare
170
+ * `{field: true}` shorthand, which doesn't fit our path-carrying leaf
171
+ * shape, so this stays a custom kind.
172
+ */
173
+ export type QueryBooleanEqualsLeaf = {
174
+ kind: "booleanEquals";
175
+ path: string;
176
+ value: boolean;
177
+ };
178
+ export type QueryLeaf = QueryHasPropertyLeaf | QueryLengthSizeLeaf | QueryRangeLeaf | QueryNotLeaf | QueryIntegerCheckLeaf | QueryLiteralSetLeaf | QueryRegexLeaf | QueryNotContainsLeaf | QueryMultiSelectLeaf | QueryKeyValueEnumLeaf | QueryTypeOfLeaf | QueryBlobHTMLLeaf | QueryDomShapeLeaf | QueryMapRecordJointLeaf | QueryPassThroughLeaf | QueryPresenceLeaf | QueryBooleanEqualsLeaf;
179
+ export type QueryNode = QueryAnd | QueryOr | QueryLeaf;
180
+ //# sourceMappingURL=queryTree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryTree.d.ts","sourceRoot":"","sources":["../../src/search/queryTree.js"],"names":[],"mappings":"uBA2Ca;IAAC,IAAI,EAAE,SAAS,EAAE,CAAA;CAAC;sBAInB;IAAC,GAAG,EAAE,SAAS,EAAE,CAAA;CAAC;;;;mCAKlB;IAAC,IAAI,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC;;;;;;kCAOrD;IACR,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACzD,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;;;;;;;;6BASS;IACR,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,QAAQ,GAAC,cAAc,GAAC,QAAQ,GAAC,MAAM,GAAC,cAAc,CAAC;IAClE,GAAG,CAAC,EAAE,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,GAAC,MAAM,GAAC,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAC,MAAM,GAAC,MAAM,CAAA;CAC5B;2BAIS;IAAC,IAAI,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAC;;;;oCAK/B;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC;;;;;kCAMxD;IACR,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB;;;;;6BAMS;IACR,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;;;;;mCAMS;IACR,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAA;CACd;;;;;mCAMS;IACR,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB;;;;oCAKS;IACR,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,OAAO,EAAE,CAAA;CAClB;;;;;;8BAOS;IACR,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B;;;;gCAKS;IACR,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,GAAC,aAAa,GAAC,UAAU,GAAC,cAAc,CAAC;IACtD,KAAK,EAAE,MAAM,CAAA;CACd;;;;;;gCAOS;IACR,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QAAC,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,CAAA;KAAC,CAAC;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,CAAC,GAAC,CAAC,CAAA;CACrB;;;;sCAKS;IACR,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,KAAK,EAAE,OAAO,CAAA;CACf;;;;;;mCAOS;IACR,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;;;;gCAKS;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAC;;;;;;qCAOlD;IACR,IAAI,EAAE,eAAe,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAA;CACf;wBAIS,oBAAoB,GAAC,mBAAmB,GAAC,cAAc,GAC/D,YAAY,GAAC,qBAAqB,GAAC,mBAAmB,GAAC,cAAc,GACrE,oBAAoB,GAAC,oBAAoB,GAAC,qBAAqB,GAC/D,eAAe,GAAC,iBAAiB,GAAC,iBAAiB,GACnD,uBAAuB,GAAC,oBAAoB,GAAC,iBAAiB,GAC9D,sBAAsB;wBAKd,QAAQ,GAAC,OAAO,GAAC,SAAS"}
@@ -0,0 +1,168 @@
1
+ /**
2
+ * The only runtime pieces for building `queryTree.js` nodes - every search
3
+ * module builds nodes through these factories rather than hand-rolling leaf
4
+ * objects, so tests can import the same constructors to build expected-value
5
+ * fixtures.
6
+ */
7
+ /**
8
+ * @param {import('./queryTree.js').QueryNode[]} nodes
9
+ * @returns {import('./queryTree.js').QueryAnd}
10
+ */
11
+ export function makeAndNode(nodes: import("./queryTree.js").QueryNode[]): import("./queryTree.js").QueryAnd;
12
+ /**
13
+ * Combines the leaves a single widget contributes (e.g. a number leaf's
14
+ * range plus its separate "Is/Is Not Integer" check) into one `QueryNode`:
15
+ * drops any `undefined` (no constraint entered there), returns `undefined`
16
+ * if nothing is left, the bare node if only one is left, else an `$and` of
17
+ * the rest - so a widget with several independent controls still honors
18
+ * `getQuery`'s "`undefined` means no constraint" convention without every
19
+ * such widget re-implementing this collapsing logic itself.
20
+ * @param {(import('./queryTree.js').QueryNode|undefined)[]} nodes
21
+ * @returns {import('./queryTree.js').QueryNode|undefined}
22
+ */
23
+ export function combineAnd(nodes: (import("./queryTree.js").QueryNode | undefined)[]): import("./queryTree.js").QueryNode | undefined;
24
+ /**
25
+ * @param {import('./queryTree.js').QueryNode[]} nodes
26
+ * @returns {import('./queryTree.js').QueryOr}
27
+ */
28
+ export function makeOrNode(nodes: import("./queryTree.js").QueryNode[]): import("./queryTree.js").QueryOr;
29
+ /**
30
+ * @param {string} path
31
+ * @param {boolean} $exists
32
+ * @returns {import('./queryTree.js').QueryHasPropertyLeaf}
33
+ */
34
+ export function makeHasPropertyLeaf(path: string, $exists: boolean): import("./queryTree.js").QueryHasPropertyLeaf;
35
+ /**
36
+ * @param {string} path
37
+ * @param {{
38
+ * $size?: number,
39
+ * $gt?: number, $gte?: number, $lt?: number, $lte?: number,
40
+ * sparseCheck?: boolean
41
+ * }} cfg
42
+ * @returns {import('./queryTree.js').QueryLengthSizeLeaf}
43
+ */
44
+ export function makeLengthSizeLeaf(path: string, cfg?: {
45
+ $size?: number;
46
+ $gt?: number;
47
+ $gte?: number;
48
+ $lt?: number;
49
+ $lte?: number;
50
+ sparseCheck?: boolean;
51
+ }): import("./queryTree.js").QueryLengthSizeLeaf;
52
+ /**
53
+ * @param {string} path
54
+ * @param {import('./queryTree.js').QueryRangeLeaf['valueType']} valueType
55
+ * @param {{
56
+ * $gt?: number|bigint|string, $gte?: number|bigint|string,
57
+ * $lt?: number|bigint|string, $lte?: number|bigint|string
58
+ * }} cfg
59
+ * @returns {import('./queryTree.js').QueryRangeLeaf}
60
+ */
61
+ export function makeRangeLeaf(path: string, valueType: import("./queryTree.js").QueryRangeLeaf["valueType"], cfg?: {
62
+ $gt?: number | bigint | string;
63
+ $gte?: number | bigint | string;
64
+ $lt?: number | bigint | string;
65
+ $lte?: number | bigint | string;
66
+ }): import("./queryTree.js").QueryRangeLeaf;
67
+ /**
68
+ * @param {import('./queryTree.js').QueryNode} query
69
+ * @returns {import('./queryTree.js').QueryNotLeaf}
70
+ */
71
+ export function makeNotLeaf(query: import("./queryTree.js").QueryNode): import("./queryTree.js").QueryNotLeaf;
72
+ /**
73
+ * @param {string} path
74
+ * @param {boolean} isInteger
75
+ * @returns {import('./queryTree.js').QueryIntegerCheckLeaf}
76
+ */
77
+ export function makeIntegerCheckLeaf(path: string, isInteger: boolean): import("./queryTree.js").QueryIntegerCheckLeaf;
78
+ /**
79
+ * @param {string} path
80
+ * @param {{$in?: unknown[], $nin?: unknown[]}} cfg
81
+ * @returns {import('./queryTree.js').QueryLiteralSetLeaf}
82
+ */
83
+ export function makeLiteralSetLeaf(path: string, cfg?: {
84
+ $in?: unknown[];
85
+ $nin?: unknown[];
86
+ }): import("./queryTree.js").QueryLiteralSetLeaf;
87
+ /**
88
+ * @param {string} path
89
+ * @param {string} $regex
90
+ * @param {string} [$options]
91
+ * @returns {import('./queryTree.js').QueryRegexLeaf}
92
+ */
93
+ export function makeRegexLeaf(path: string, $regex: string, $options?: string): import("./queryTree.js").QueryRegexLeaf;
94
+ /**
95
+ * @param {string} path
96
+ * @param {string} value
97
+ * @returns {import('./queryTree.js').QueryNotContainsLeaf}
98
+ */
99
+ export function makeNotContainsLeaf(path: string, value: string): import("./queryTree.js").QueryNotContainsLeaf;
100
+ /**
101
+ * @param {string} path
102
+ * @param {{$in?: unknown[], $nin?: unknown[]}} cfg
103
+ * @returns {import('./queryTree.js').QueryMultiSelectLeaf}
104
+ */
105
+ export function makeMultiSelectLeaf(path: string, cfg?: {
106
+ $in?: unknown[];
107
+ $nin?: unknown[];
108
+ }): import("./queryTree.js").QueryMultiSelectLeaf;
109
+ /**
110
+ * @param {string} path
111
+ * @param {boolean} matchKeys
112
+ * @param {unknown[]} values
113
+ * @returns {import('./queryTree.js').QueryKeyValueEnumLeaf}
114
+ */
115
+ export function makeKeyValueEnumLeaf(path: string, matchKeys: boolean, values: unknown[]): import("./queryTree.js").QueryKeyValueEnumLeaf;
116
+ /**
117
+ * @param {string} path
118
+ * @param {string} searchType
119
+ * @param {unknown} [discriminatorValue]
120
+ * @returns {import('./queryTree.js').QueryTypeOfLeaf}
121
+ */
122
+ export function makeTypeOfLeaf(path: string, searchType: string, discriminatorValue?: unknown): import("./queryTree.js").QueryTypeOfLeaf;
123
+ /**
124
+ * @param {string} path
125
+ * @param {import('./queryTree.js').QueryBlobHTMLLeaf['mode']} mode
126
+ * @param {string} value
127
+ * @returns {import('./queryTree.js').QueryBlobHTMLLeaf}
128
+ */
129
+ export function makeBlobHTMLLeaf(path: string, mode: import("./queryTree.js").QueryBlobHTMLLeaf["mode"], value: string): import("./queryTree.js").QueryBlobHTMLLeaf;
130
+ /**
131
+ * @param {string} path
132
+ * @param {{[dimension: string]: import('./queryTree.js').QueryRangeLeaf}} dimensions
133
+ * @param {{readonlyCheck?: boolean, dimensionCheck?: 2|3}} [cfg]
134
+ * @returns {import('./queryTree.js').QueryDomShapeLeaf}
135
+ */
136
+ export function makeDomShapeLeaf(path: string, dimensions: {
137
+ [dimension: string]: import("./queryTree.js").QueryRangeLeaf;
138
+ }, cfg?: {
139
+ readonlyCheck?: boolean;
140
+ dimensionCheck?: 2 | 3;
141
+ }): import("./queryTree.js").QueryDomShapeLeaf;
142
+ /**
143
+ * @param {string} path
144
+ * @param {boolean} joint
145
+ * @param {import('./queryTree.js').QueryNode} [keyQuery]
146
+ * @param {import('./queryTree.js').QueryNode} [valueQuery]
147
+ * @returns {import('./queryTree.js').QueryMapRecordJointLeaf}
148
+ */
149
+ export function makeMapRecordJointLeaf(path: string, joint: boolean, keyQuery?: import("./queryTree.js").QueryNode, valueQuery?: import("./queryTree.js").QueryNode): import("./queryTree.js").QueryMapRecordJointLeaf;
150
+ /**
151
+ * @param {string} path
152
+ * @param {import('./queryTree.js').QueryNode} [query]
153
+ * @returns {import('./queryTree.js').QueryPassThroughLeaf}
154
+ */
155
+ export function makePassThroughLeaf(path: string, query?: import("./queryTree.js").QueryNode): import("./queryTree.js").QueryPassThroughLeaf;
156
+ /**
157
+ * @param {string} path
158
+ * @param {boolean} $exists
159
+ * @returns {import('./queryTree.js').QueryPresenceLeaf}
160
+ */
161
+ export function makePresenceLeaf(path: string, $exists: boolean): import("./queryTree.js").QueryPresenceLeaf;
162
+ /**
163
+ * @param {string} path
164
+ * @param {boolean} value
165
+ * @returns {import('./queryTree.js').QueryBooleanEqualsLeaf}
166
+ */
167
+ export function makeBooleanEqualsLeaf(path: string, value: boolean): import("./queryTree.js").QueryBooleanEqualsLeaf;
168
+ //# sourceMappingURL=queryTreeBuilders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryTreeBuilders.d.ts","sourceRoot":"","sources":["../../src/search/queryTreeBuilders.js"],"names":[],"mappings":"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"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Schema-only analogue of `getSchemaType` (`src/formats/schema.js:145-166`).
3
+ * Must not reimplement that function's special-casing (stringbool pipe,
4
+ * `codec`/filelist, `instanceof`, `literal`, `enum`, `templateLiteral`,
5
+ * `getCheckedType` fallback) - it calls straight through to it, and only
6
+ * adds the extra shape distinctions `getSchemaType`'s own
7
+ * `AvailableArbitraryType` output collapses (tuple, record/looseRecord,
8
+ * union/xor/discriminatedUnion all currently reduce to `'array'`/`'object'`/
9
+ * nothing, per `zodexToStructuredCloningTypeMap`,
10
+ * `src/formats/schema.js:30-56`).
11
+ *
12
+ * Intersection schemas are deliberately not a case here - they're resolved
13
+ * before dispatch, by the search-widget walker calling `getTypesForSchema`
14
+ * (search plan §3), reusing jsoe's existing intersection-merging machinery
15
+ * rather than this function reinventing it.
16
+ * @param {import('../formats/schema.js').ZodexSchema} schemaObject
17
+ * @returns {string}
18
+ */
19
+ export function getSearchSchemaType(schemaObject: import("../formats/schema.js").ZodexSchema): string;
20
+ /**
21
+ * The one exported call site every recursive search widget uses (analogous
22
+ * to `types.getTypeObject(type)`, `src/types.js:1106-1108`, but schema-in
23
+ * rather than type-string-in, since there's no value to key off). Falls
24
+ * back to `noneditableSearchType` for any schema shape `getSearchSchemaType`
25
+ * reports that isn't (yet) registered, rather than throwing - the same
26
+ * escape hatch a bare top-level `instanceof` schema falls through to.
27
+ * @param {import('../formats/schema.js').ZodexSchema} schemaObject
28
+ * @returns {SearchTypeObject}
29
+ */
30
+ export function getSearchTypeObject(schemaObject: import("../formats/schema.js").ZodexSchema): SearchTypeObject;
31
+ /**
32
+ * The call site every *recursive* search widget uses in place of calling
33
+ * `getSearchTypeObject(...).buildUI(...)` directly - it's the same thing,
34
+ * plus `resolveIntersection` run first, so an intersection schema at any
35
+ * depth (not just the one `buildSearchChoices` is called with) still
36
+ * resolves instead of falling through to the `noneditableSearchType`
37
+ * escape hatch. `originalJSON` (needed for the `getTypesForSchema` call's
38
+ * own `$ref` resolution) defaults to `schemaObject` itself only as a last
39
+ * resort for a call site that has none to pass down - every recursive
40
+ * caller should be threading the true document root through via its own
41
+ * `originalJSON` parameter instead.
42
+ * @param {{
43
+ * schemaObject: import('../formats/schema.js').ZodexSchema,
44
+ * path: string,
45
+ * typeNamespace?: string,
46
+ * topRoot?: import('../types.js').RootElement,
47
+ * types?: import('../types.js').default,
48
+ * originalJSON?: import('../formats/schema.js').ZodexSchema
49
+ * }} cfg
50
+ * @returns {import('../types.js').JamilihArray}
51
+ */
52
+ export function buildSearchWidget({ schemaObject, path, typeNamespace, topRoot, types, originalJSON }: {
53
+ schemaObject: import("../formats/schema.js").ZodexSchema;
54
+ path: string;
55
+ typeNamespace?: string;
56
+ topRoot?: import("../types.js").RootElement;
57
+ types?: import("../types.js").default;
58
+ originalJSON?: import("../formats/schema.js").ZodexSchema;
59
+ }): import("../types.js").JamilihArray;
60
+ export type QueryNode = import("./queryTree.js").QueryNode;
61
+ /**
62
+ * The search-side analogue of `TypeObject` (`src/types.js:308-408`): two
63
+ * methods, `buildUI` (a `jml` array) and `getQuery` (reads the built DOM
64
+ * back into a `QueryNode`, or `undefined` when no constraint was entered).
65
+ */
66
+ export type SearchTypeObject = {
67
+ buildUI: (cfg: {
68
+ schemaObject: import("../formats/schema.js").ZodexSchema;
69
+ path: string;
70
+ typeNamespace?: string;
71
+ topRoot?: import("../types.js").RootElement;
72
+ types?: import("../types.js").default;
73
+ originalJSON?: import("../formats/schema.js").ZodexSchema;
74
+ }) => import("../types.js").JamilihArray;
75
+ getQuery: (cfg: {
76
+ root: HTMLElement;
77
+ path: string;
78
+ }) => QueryNode | undefined;
79
+ };
80
+ /**
81
+ * `Record<string, SearchTypeObject>` registry, analogous to
82
+ * `Types.prototype.availableTypes` (`src/types.js:473-581`). Every entry is
83
+ * a stub for now (build order step 1); later steps replace individual
84
+ * entries with their real `*SearchType.js` module, one at a time, without
85
+ * touching this shape.
86
+ *
87
+ * A few keys deliberately share one module reference rather than getting
88
+ * their own: `BooleanObject`/`NumberObject`/`StringObject`/`bigintObject`
89
+ * point at their primitive counterpart's module because a search leaf only
90
+ * cares about the query semantics (e.g. "true or false"), never about how
91
+ * the value-editing side constructs the boxed wrapper at runtime. Likewise
92
+ * `arrayNonindexKeys` mirrors `array`, `looseRecord` mirrors `record`, and
93
+ * `templateLiteral` mirrors `string` (README: a template literal is still
94
+ * fundamentally a string-shape constraint for this pass; see §3 of the
95
+ * search plan).
96
+ * @type {{[key: string]: SearchTypeObject}}
97
+ */
98
+ export const availableSearchTypes: {
99
+ [key: string]: SearchTypeObject;
100
+ };
101
+ /**
102
+ * Escape hatch for `instanceof`-outside-`FileList` and any schema shape not
103
+ * (yet) recognized: no widget is rendered for it, only this stand-in.
104
+ * @type {SearchTypeObject}
105
+ */
106
+ export const noneditableSearchType: SearchTypeObject;
107
+ /**
108
+ * Intersection schemas are never registered in `availableSearchTypes` -
109
+ * resolved here instead of in `getSearchSchemaType`, reusing jsoe's
110
+ * existing intersection-merging machinery (`getTypesForSchema`,
111
+ * `src/formats/schema.js`) rather than reinventing it (search plan §3/§5).
112
+ * A single merged result replaces the intersection outright; more than one
113
+ * (e.g. one side of the intersection is itself a union) is handed to
114
+ * `unionSearchType.js` unchanged via a synthesized `union` wrapper, the
115
+ * same way `unionSearchType.js` already treats distinguishable branches.
116
+ * @param {import('../formats/schema.js').ZodexSchema} schemaObject
117
+ * @param {import('../formats/schema.js').ZodexSchema} originalJSON
118
+ * @returns {import('../formats/schema.js').ZodexSchema}
119
+ */
120
+ export function resolveIntersection(schemaObject: import("../formats/schema.js").ZodexSchema, originalJSON: import("../formats/schema.js").ZodexSchema): import("../formats/schema.js").ZodexSchema;
121
+ //# sourceMappingURL=searchDispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchDispatch.d.ts","sourceRoot":"","sources":["../../src/search/searchDispatch.js"],"names":[],"mappings":"AAqKA;;;;;;;;;;;;;;;;;GAiBG;AACH,kDAHW,OAAO,sBAAsB,EAAE,WAAW,GACxC,MAAM,CA+BlB;AAED;;;;;;;;;GASG;AACH,kDAHW,OAAO,sBAAsB,EAAE,WAAW,GACxC,gBAAgB,CAK5B;AA2BD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uGAVW;IACN,YAAY,EAAE,OAAO,sBAAsB,EAAE,WAAW,CAAC;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,aAAa,EAAE,WAAW,CAAC;IAC5C,KAAK,CAAC,EAAE,OAAO,aAAa,EAAE,OAAO,CAAC;IACtC,YAAY,CAAC,EAAE,OAAO,sBAAsB,EAAE,WAAW,CAAA;CAC1D,GACS,OAAO,aAAa,EAAE,YAAY,CAe9C;wBAzPY,OAAO,gBAAgB,EAAE,SAAS;;;;;;+BAOlC;IACR,OAAO,EAAE,CAAC,GAAG,EAAE;QACb,YAAY,EAAE,OAAO,sBAAsB,EAAE,WAAW,CAAC;QACzD,IAAI,EAAE,MAAM,CAAC;QACb,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,OAAO,aAAa,EAAE,WAAW,CAAC;QAC5C,KAAK,CAAC,EAAE,OAAO,aAAa,EAAE,OAAO,CAAC;QACtC,YAAY,CAAC,EAAE,OAAO,sBAAsB,EAAE,WAAW,CAAA;KAC1D,KAAK,OAAO,aAAa,EAAE,YAAY,CAAC;IACzC,QAAQ,EAAE,CAAC,GAAG,EAAE;QACd,IAAI,EAAE,WAAW,CAAC;QAClB,IAAI,EAAE,MAAM,CAAA;KACb,KAAK,SAAS,GAAC,SAAS,CAAA;CAC1B;AAyBJ;;;;;;;;;;;;;;;;;GAiBG;AACH,mCAFU;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAC,CA+DzC;AAtFF;;;;GAIG;AACH,oCAFU,gBAAgB,CAEkC;AAmJ5D;;;;;;;;;;;;GAYG;AACH,kDAJW,OAAO,sBAAsB,EAAE,WAAW,gBAC1C,OAAO,sBAAsB,EAAE,WAAW,GACxC,OAAO,sBAAsB,EAAE,WAAW,CAYtD"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Locates a built search element by the JSON-Pointer path it was built for.
3
+ * Compares `dataset.searchPath` in JS rather than interpolating `path` into
4
+ * a `querySelector` attribute-value string, since a schema path can embed
5
+ * arbitrary property-name characters (only `~`/`/` are escaped by
6
+ * `makeJSONPointer`) that would otherwise need CSS-selector escaping.
7
+ * @param {ParentNode} root
8
+ * @param {string} path
9
+ * @returns {HTMLElement|undefined}
10
+ */
11
+ export function findSearchElement(root: ParentNode, path: string): HTMLElement | undefined;
12
+ /**
13
+ * @typedef {HTMLElement & {
14
+ * getQuery: () => import('./queryTree.js').QueryNode|undefined
15
+ * }} SearchElement
16
+ */
17
+ /**
18
+ * The `SearchTypeObject.getQuery` every leaf module implements identically:
19
+ * locate the element it built under `root` and delegate to its own
20
+ * (per-element, `dataset`-driven) `getQuery()` method.
21
+ * @param {{root: HTMLElement, path: string}} cfg
22
+ * @returns {import('./queryTree.js').QueryNode|undefined}
23
+ */
24
+ export function getQueryViaElement({ root, path }: {
25
+ root: HTMLElement;
26
+ path: string;
27
+ }): import("./queryTree.js").QueryNode | undefined;
28
+ /**
29
+ * Type-predicate guard distinguishing a built search element (leaf or
30
+ * container, either answers to `.getQuery()`) from a plain DOM node - used
31
+ * by container elements (e.g. `objectSearchType.js`'s `<jsoe-search-object>`)
32
+ * that walk `this.children` polymorphically (search plan §8) without
33
+ * knowing which children are search elements and which are plain layout
34
+ * (a controls `<div>`, etc.).
35
+ * @param {Element} el
36
+ * @returns {el is SearchElement}
37
+ */
38
+ export function hasGetQuery(el: Element): el is SearchElement;
39
+ /**
40
+ * Factory for the README's "no variants to allow for distinct search"
41
+ * leaves (`undefined`/`void`, `null`, `NaN`): the only meaningful question
42
+ * is whether the path is present at all, which only matters once the path
43
+ * is optional or nested in a union - so all three share one tiny, single-
44
+ * checkbox implementation, differing only in tag name/label.
45
+ * @param {{tagName: string}} cfg
46
+ * @returns {import('./searchDispatch.js').SearchTypeObject}
47
+ */
48
+ export function makePresenceOnlySearchType({ tagName }: {
49
+ tagName: string;
50
+ }): import("./searchDispatch.js").SearchTypeObject;
51
+ /**
52
+ * Factory for `errorSearchType.js`/`errorsSpecialSearchType.js`, offering
53
+ * literal/regex search of child string properties, numeric of number
54
+ * children (README) - one `buildLiteralRegexControls`/`buildRangeInputsPair` pair
55
+ * per known property (`key`-distinguished so they coexist in one widget;
56
+ * see those helpers' docs), combined via `$and`. `.cause` (a recursive,
57
+ * arbitrarily-typed property) and `errorsSpecial`'s `AggregateError.errors`
58
+ * array are deliberately left out of this pass - the README's bullet asks
59
+ * only for the flat string/number children, and open-ended recursion into
60
+ * an arbitrary `cause` chain is a materially bigger feature than "the same
61
+ * shape, twice more".
62
+ * @param {{tagName: string}} cfg
63
+ * @returns {import('./searchDispatch.js').SearchTypeObject}
64
+ */
65
+ export function makeErrorFamilySearchType({ tagName }: {
66
+ tagName: string;
67
+ }): import("./searchDispatch.js").SearchTypeObject;
68
+ /**
69
+ * Factory for `domrectSearchType.js`/`dompointSearchType.js`/
70
+ * `dommatrixSearchType.js`: numeric search ranges for children; "Is/Is not
71
+ * Readonly"; DOMMatrix: "Is/Is not 3d" (README) - one `buildRangeInputsPair`
72
+ * per known dimension (`key`-distinguished so they coexist in one widget;
73
+ * `dimensionKeys` covers DOMMatrix's 2D (`a`-`f`) *and* 3D (`m11`-`m44`)
74
+ * shapes at once rather than switching the control set on an "Is/Is not 3d"
75
+ * answer that's itself just another optional search constraint, not a
76
+ * schema fact - `domrect`/`dompoint`/`dommatrix` are all "checked" types
77
+ * with no structural schema to derive dimension names from in the first
78
+ * place, same reasoning as `makeErrorFamilySearchType`), combined into one
79
+ * `domShape` leaf (`queryTree.js`) rather than separate leaves via `$and`.
80
+ * @param {{
81
+ * tagName: string,
82
+ * dimensionKeys: string[],
83
+ * includeReadonly?: boolean,
84
+ * includeDimensionCheck?: boolean
85
+ * }} cfg
86
+ * @returns {import('./searchDispatch.js').SearchTypeObject}
87
+ */
88
+ export function makeDomShapeSearchType({ tagName, dimensionKeys, includeReadonly, includeDimensionCheck }: {
89
+ tagName: string;
90
+ dimensionKeys: string[];
91
+ includeReadonly?: boolean;
92
+ includeDimensionCheck?: boolean;
93
+ }): import("./searchDispatch.js").SearchTypeObject;
94
+ export type SearchElement = HTMLElement & {
95
+ getQuery: () => import("./queryTree.js").QueryNode | undefined;
96
+ };
97
+ //# sourceMappingURL=searchElementUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"searchElementUtils.d.ts","sourceRoot":"","sources":["../../src/search/searchElementUtils.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,wCAJW,UAAU,QACV,MAAM,GACJ,WAAW,GAAC,SAAS,CAMjC;AAED;;;;GAIG;AAEH;;;;;;GAMG;AACH,mDAHW;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,GAC/B,OAAO,gBAAgB,EAAE,SAAS,GAAC,SAAS,CAOxD;AAED;;;;;;;;;GASG;AACH,gCAHW,OAAO,GACL,EAAE,IAAI,aAAa,CAK/B;AAED;;;;;;;;GAQG;AACH,wDAHW;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GACf,OAAO,qBAAqB,EAAE,gBAAgB,CA0B1D;AAqCD;;;;;;;;;;;;;GAaG;AACH,uDAHW;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,GACf,OAAO,qBAAqB,EAAE,gBAAgB,CAkC1D;AAyCD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2GARW;IACN,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC,GACS,OAAO,qBAAqB,EAAE,gBAAgB,CAsD1D;4BAvQY,WAAW,GAAG;IACtB,QAAQ,EAAE,MAAM,OAAO,gBAAgB,EAAE,SAAS,GAAC,SAAS,CAAA;CAC7D"}