@uipath/apollo-wind 2.67.1 → 2.68.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.
@@ -33,6 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
33
33
  inferValueType: ()=>inferValueType,
34
34
  isArrayItemTemplateRoot: ()=>isArrayItemTemplateRoot,
35
35
  isJsonObject: ()=>isJsonObject,
36
+ isPathCollapsed: ()=>isPathCollapsed,
36
37
  removeValueAtPath: ()=>removeValueAtPath,
37
38
  schemaDisplayType: ()=>schemaDisplayType,
38
39
  setValueAtPath: ()=>setValueAtPath
@@ -41,6 +42,9 @@ const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
41
42
  function hasOwn(object, key) {
42
43
  return Object.prototype.hasOwnProperty.call(object, key);
43
44
  }
45
+ function isPathCollapsed(collapsed, path) {
46
+ return hasOwn(collapsed, path) && !!collapsed[path];
47
+ }
44
48
  function isJsonObject(value) {
45
49
  return 'object' == typeof value && null !== value && !Array.isArray(value);
46
50
  }
@@ -79,7 +83,29 @@ function schemaDisplayType(schema) {
79
83
  if (void 0 !== enumSample) return inferValueType(enumSample);
80
84
  return 'null';
81
85
  }
82
- function buildNode(input) {
86
+ function buildNodes(inputs) {
87
+ const roots = [];
88
+ const stack = [];
89
+ for(let index = inputs.length - 1; index >= 0; index -= 1)stack.push({
90
+ input: inputs[index],
91
+ siblings: roots
92
+ });
93
+ while(stack.length > 0){
94
+ const { input, siblings } = stack.pop();
95
+ const node = createNode(input);
96
+ siblings.push(node);
97
+ const childInputs = 'object' === node.type ? objectChildInputs(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate) : 'array' === node.type ? arrayChildInputs(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate) : void 0;
98
+ if (!childInputs) continue;
99
+ const children = [];
100
+ node.children = children;
101
+ for(let index = childInputs.length - 1; index >= 0; index -= 1)stack.push({
102
+ input: childInputs[index],
103
+ siblings: children
104
+ });
105
+ }
106
+ return roots;
107
+ }
108
+ function createNode(input) {
83
109
  const type = input.hasValue ? inferValueType(input.value) : schemaDisplayType(input.schema);
84
110
  const node = {
85
111
  key: input.key,
@@ -91,13 +117,11 @@ function buildNode(input) {
91
117
  };
92
118
  if (input.hasValue) node.value = input.value;
93
119
  if (input.isTemplate) node.isArrayItemTemplate = true;
94
- if ('object' === type) node.children = buildObjectChildren(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate);
95
- else if ('array' === type) node.children = buildArrayChildren(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate);
96
120
  return node;
97
121
  }
98
- function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate) {
122
+ function arrayChildInputs(schema, value, hasValue, segments, path, isTemplate) {
99
123
  const items = hasValue && Array.isArray(value) ? value : [];
100
- if (items.length > 0) return items.map((item, index)=>buildNode({
124
+ if (items.length > 0) return items.map((item, index)=>({
101
125
  key: String(index),
102
126
  segments: [
103
127
  ...segments,
@@ -110,7 +134,7 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
110
134
  isTemplate
111
135
  }));
112
136
  if (schema?.items) return [
113
- buildNode({
137
+ {
114
138
  key: '0',
115
139
  segments: [
116
140
  ...segments,
@@ -120,18 +144,18 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
120
144
  schema: schema.items,
121
145
  hasValue: false,
122
146
  isTemplate: true
123
- })
147
+ }
124
148
  ];
125
149
  return [];
126
150
  }
127
- function buildObjectChildren(value, schema, segments, path, isTemplate) {
151
+ function objectChildInputs(value, schema, segments, path, isTemplate) {
128
152
  const properties = schema?.properties ?? {};
129
153
  const required = new Set(schema?.required ?? []);
130
154
  const additional = 'object' == typeof schema?.additionalProperties ? schema.additionalProperties : void 0;
131
155
  const children = [];
132
156
  for (const [key, childSchema] of Object.entries(properties)){
133
157
  const hasValue = void 0 !== value && hasOwn(value, key);
134
- children.push(buildNode({
158
+ children.push({
135
159
  key,
136
160
  segments: [
137
161
  ...segments,
@@ -143,10 +167,10 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
143
167
  hasValue,
144
168
  required: required.has(key),
145
169
  isTemplate
146
- }));
170
+ });
147
171
  }
148
172
  if (void 0 !== value) {
149
- for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push(buildNode({
173
+ for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push({
150
174
  key,
151
175
  segments: [
152
176
  ...segments,
@@ -156,15 +180,15 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
156
180
  schema: additional,
157
181
  value: childValue,
158
182
  hasValue: true
159
- }));
183
+ });
160
184
  }
161
185
  return children;
162
186
  }
163
187
  function buildJsonTree(options) {
164
188
  const { schema, value, basePath = '' } = options;
165
189
  const rootIsArray = void 0 !== value ? Array.isArray(value) : !!schema && 'array' === schemaDisplayType(schema);
166
- if (rootIsArray) return buildArrayChildren(schema, value, void 0 !== value, [], basePath);
167
- return buildObjectChildren(isJsonObject(value) ? value : void 0, schema, [], basePath);
190
+ if (rootIsArray) return buildNodes(arrayChildInputs(schema, value, void 0 !== value, [], basePath));
191
+ return buildNodes(objectChildInputs(isJsonObject(value) ? value : void 0, schema, [], basePath));
168
192
  }
169
193
  function isArrayItemTemplateRoot(node) {
170
194
  return !!node.isArrayItemTemplate && 'number' == typeof node.segments[node.segments.length - 1];
@@ -176,47 +200,76 @@ function nodeSelfMatchesQuery(node, query, displayTexts) {
176
200
  if (display?.sublabel?.toLowerCase().includes(query)) return true;
177
201
  return void 0 !== node.value && null !== node.value && 'object' != typeof node.value && String(node.value).toLowerCase().includes(query);
178
202
  }
179
- function nodeMatchesQuery(node, query, displayTexts) {
180
- if (nodeSelfMatchesQuery(node, query, displayTexts)) return true;
181
- return node.children?.some((c)=>nodeMatchesQuery(c, query, displayTexts)) ?? false;
182
- }
183
- function nodeOrDescendantMatches(node, predicate) {
184
- if (predicate(node)) return true;
185
- return node.children?.some((c)=>nodeOrDescendantMatches(c, predicate)) ?? false;
203
+ function indexMatches(nodes, test) {
204
+ const self = new Set();
205
+ const below = new Set();
206
+ const order = [];
207
+ const stack = [
208
+ ...nodes
209
+ ];
210
+ while(stack.length > 0){
211
+ const node = stack.pop();
212
+ order.push(node);
213
+ if (node.children) for (const child of node.children)stack.push(child);
214
+ }
215
+ for(let index = order.length - 1; index >= 0; index -= 1){
216
+ const node = order[index];
217
+ if (test(node)) self.add(node);
218
+ if (node.children?.some((child)=>self.has(child) || below.has(child))) below.add(node);
219
+ }
220
+ return {
221
+ self,
222
+ below
223
+ };
186
224
  }
187
225
  function flattenJsonTree(nodes, options = {}, depth = 0) {
188
- const { collapsed = {}, filterPredicate } = options;
189
- const query = options.query?.trim().toLowerCase() ?? '';
226
+ const { collapsed = {}, displayTexts } = options;
190
227
  const rows = [];
191
- for (const node of nodes){
192
- const selfQueryMatch = !!query && nodeSelfMatchesQuery(node, query, options.displayTexts);
193
- if (query && !selfQueryMatch && !(node.children?.some((c)=>nodeMatchesQuery(c, query, options.displayTexts)) ?? false)) continue;
194
- const selfPredicateMatch = !!filterPredicate && filterPredicate(node);
195
- if (!filterPredicate || selfPredicateMatch || (node.children?.some((c)=>nodeOrDescendantMatches(c, filterPredicate)) ?? false)) {
196
- rows.push({
197
- node,
198
- depth
199
- });
200
- if (node.children && !collapsed[node.path]) {
201
- const childOptions = selfQueryMatch || selfPredicateMatch ? {
202
- ...options,
203
- query: selfQueryMatch ? '' : options.query,
204
- filterPredicate: selfPredicateMatch ? void 0 : filterPredicate
205
- } : options;
206
- for (const row of flattenJsonTree(node.children, childOptions, depth + 1))rows.push(row);
207
- }
208
- }
228
+ const stack = [];
229
+ const pushChildren = (children, childDepth, query, filterPredicate)=>{
230
+ for(let index = children.length - 1; index >= 0; index -= 1)stack.push({
231
+ node: children[index],
232
+ depth: childDepth,
233
+ query,
234
+ filterPredicate
235
+ });
236
+ };
237
+ const rootQuery = options.query?.trim().toLowerCase() ?? '';
238
+ pushChildren(nodes, depth, rootQuery, options.filterPredicate);
239
+ const queryMatches = rootQuery ? indexMatches(nodes, (node)=>nodeSelfMatchesQuery(node, rootQuery, displayTexts)) : void 0;
240
+ const predicateMatches = options.filterPredicate ? indexMatches(nodes, options.filterPredicate) : void 0;
241
+ while(stack.length > 0){
242
+ const { node, depth: nodeDepth, query, filterPredicate } = stack.pop();
243
+ const selfQueryMatch = !!query && !!queryMatches?.self.has(node);
244
+ if (query && !selfQueryMatch && !queryMatches?.below.has(node)) continue;
245
+ const selfPredicateMatch = !!filterPredicate && !!predicateMatches?.self.has(node);
246
+ if (filterPredicate && !selfPredicateMatch && !predicateMatches?.below.has(node)) continue;
247
+ rows.push({
248
+ node,
249
+ depth: nodeDepth
250
+ });
251
+ if (node.children && !isPathCollapsed(collapsed, node.path)) pushChildren(node.children, nodeDepth + 1, selfQueryMatch ? '' : query, selfPredicateMatch ? void 0 : filterPredicate);
209
252
  }
210
253
  return rows;
211
254
  }
212
255
  function collectContainerPaths(nodes, depth = 0) {
213
256
  const paths = [];
214
- for (const node of nodes)if (node.children) {
257
+ const stack = [];
258
+ for(let index = nodes.length - 1; index >= 0; index -= 1)stack.push({
259
+ node: nodes[index],
260
+ depth
261
+ });
262
+ while(stack.length > 0){
263
+ const { node, depth: nodeDepth } = stack.pop();
264
+ if (!node.children) continue;
215
265
  paths.push({
216
266
  path: node.path,
217
- depth
267
+ depth: nodeDepth
268
+ });
269
+ for(let index = node.children.length - 1; index >= 0; index -= 1)stack.push({
270
+ node: node.children[index],
271
+ depth: nodeDepth + 1
218
272
  });
219
- for (const child of collectContainerPaths(node.children, depth + 1))paths.push(child);
220
273
  }
221
274
  return paths;
222
275
  }
@@ -302,6 +355,7 @@ exports.getValueAtPath = __webpack_exports__.getValueAtPath;
302
355
  exports.inferValueType = __webpack_exports__.inferValueType;
303
356
  exports.isArrayItemTemplateRoot = __webpack_exports__.isArrayItemTemplateRoot;
304
357
  exports.isJsonObject = __webpack_exports__.isJsonObject;
358
+ exports.isPathCollapsed = __webpack_exports__.isPathCollapsed;
305
359
  exports.removeValueAtPath = __webpack_exports__.removeValueAtPath;
306
360
  exports.schemaDisplayType = __webpack_exports__.schemaDisplayType;
307
361
  exports.setValueAtPath = __webpack_exports__.setValueAtPath;
@@ -315,6 +369,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
315
369
  "inferValueType",
316
370
  "isArrayItemTemplateRoot",
317
371
  "isJsonObject",
372
+ "isPathCollapsed",
318
373
  "removeValueAtPath",
319
374
  "schemaDisplayType",
320
375
  "setValueAtPath"
@@ -1,4 +1,10 @@
1
1
  import type { JsonContainer, JsonObject, JsonSchema, JsonTreeNode, JsonTreeNodeType, JsonValue, PathSegment } from './JsonTree.types';
2
+ /**
3
+ * Whether `path` is collapsed. Own keys only: paths are arbitrary JSON keys, and
4
+ * one named after an Object.prototype member (`constructor`, `toString`, …)
5
+ * would otherwise read the inherited function and stay collapsed.
6
+ */
7
+ export declare function isPathCollapsed(collapsed: Record<string, boolean>, path: string): boolean;
2
8
  export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
3
9
  /** Appends a segment to an expression path (`a.b`, `a["x-y"]`, `a[0]`). */
4
10
  export declare function appendPathSegment(path: string, segment: PathSegment): string;
@@ -48,13 +54,20 @@ export interface FlattenOptions {
48
54
  /** Lets search also match consumer display labels (e.g. decoration labels). */
49
55
  displayTexts?: NodeDisplayTexts;
50
56
  }
51
- /** Flattens the tree to visible rows, honoring collapse state, search, and filter. */
57
+ /**
58
+ * Flattens the tree to visible rows, honoring collapse state, search, and filter.
59
+ * Walks depth-first with an explicit stack rather than recursion, so a deeply
60
+ * nested tree can't overflow the call stack.
61
+ */
52
62
  export declare function flattenJsonTree(nodes: JsonTreeNode[], options?: FlattenOptions, depth?: number): FlatJsonTreeRow[];
53
63
  export interface ContainerPath {
54
64
  path: string;
55
65
  depth: number;
56
66
  }
57
- /** All container (object/array) paths in the tree, with their depth. */
67
+ /**
68
+ * All container (object/array) paths in the tree, with their depth, in tree
69
+ * order. Walks with an explicit stack, so deep trees can't overflow the call stack.
70
+ */
58
71
  export declare function collectContainerPaths(nodes: JsonTreeNode[], depth?: number): ContainerPath[];
59
72
  export declare function getValueAtPath(root: JsonValue | undefined, segments: PathSegment[]): JsonValue | undefined;
60
73
  /**
@@ -2,6 +2,9 @@ const IDENTIFIER_RE = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
2
2
  function hasOwn(object, key) {
3
3
  return Object.prototype.hasOwnProperty.call(object, key);
4
4
  }
5
+ function isPathCollapsed(collapsed, path) {
6
+ return hasOwn(collapsed, path) && !!collapsed[path];
7
+ }
5
8
  function isJsonObject(value) {
6
9
  return 'object' == typeof value && null !== value && !Array.isArray(value);
7
10
  }
@@ -40,7 +43,29 @@ function schemaDisplayType(schema) {
40
43
  if (void 0 !== enumSample) return inferValueType(enumSample);
41
44
  return 'null';
42
45
  }
43
- function buildNode(input) {
46
+ function buildNodes(inputs) {
47
+ const roots = [];
48
+ const stack = [];
49
+ for(let index = inputs.length - 1; index >= 0; index -= 1)stack.push({
50
+ input: inputs[index],
51
+ siblings: roots
52
+ });
53
+ while(stack.length > 0){
54
+ const { input, siblings } = stack.pop();
55
+ const node = createNode(input);
56
+ siblings.push(node);
57
+ const childInputs = 'object' === node.type ? objectChildInputs(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate) : 'array' === node.type ? arrayChildInputs(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate) : void 0;
58
+ if (!childInputs) continue;
59
+ const children = [];
60
+ node.children = children;
61
+ for(let index = childInputs.length - 1; index >= 0; index -= 1)stack.push({
62
+ input: childInputs[index],
63
+ siblings: children
64
+ });
65
+ }
66
+ return roots;
67
+ }
68
+ function createNode(input) {
44
69
  const type = input.hasValue ? inferValueType(input.value) : schemaDisplayType(input.schema);
45
70
  const node = {
46
71
  key: input.key,
@@ -52,13 +77,11 @@ function buildNode(input) {
52
77
  };
53
78
  if (input.hasValue) node.value = input.value;
54
79
  if (input.isTemplate) node.isArrayItemTemplate = true;
55
- if ('object' === type) node.children = buildObjectChildren(input.hasValue ? input.value : void 0, input.schema, input.segments, input.path, input.isTemplate);
56
- else if ('array' === type) node.children = buildArrayChildren(input.schema, input.value, input.hasValue, input.segments, input.path, input.isTemplate);
57
80
  return node;
58
81
  }
59
- function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate) {
82
+ function arrayChildInputs(schema, value, hasValue, segments, path, isTemplate) {
60
83
  const items = hasValue && Array.isArray(value) ? value : [];
61
- if (items.length > 0) return items.map((item, index)=>buildNode({
84
+ if (items.length > 0) return items.map((item, index)=>({
62
85
  key: String(index),
63
86
  segments: [
64
87
  ...segments,
@@ -71,7 +94,7 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
71
94
  isTemplate
72
95
  }));
73
96
  if (schema?.items) return [
74
- buildNode({
97
+ {
75
98
  key: '0',
76
99
  segments: [
77
100
  ...segments,
@@ -81,18 +104,18 @@ function buildArrayChildren(schema, value, hasValue, segments, path, isTemplate)
81
104
  schema: schema.items,
82
105
  hasValue: false,
83
106
  isTemplate: true
84
- })
107
+ }
85
108
  ];
86
109
  return [];
87
110
  }
88
- function buildObjectChildren(value, schema, segments, path, isTemplate) {
111
+ function objectChildInputs(value, schema, segments, path, isTemplate) {
89
112
  const properties = schema?.properties ?? {};
90
113
  const required = new Set(schema?.required ?? []);
91
114
  const additional = 'object' == typeof schema?.additionalProperties ? schema.additionalProperties : void 0;
92
115
  const children = [];
93
116
  for (const [key, childSchema] of Object.entries(properties)){
94
117
  const hasValue = void 0 !== value && hasOwn(value, key);
95
- children.push(buildNode({
118
+ children.push({
96
119
  key,
97
120
  segments: [
98
121
  ...segments,
@@ -104,10 +127,10 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
104
127
  hasValue,
105
128
  required: required.has(key),
106
129
  isTemplate
107
- }));
130
+ });
108
131
  }
109
132
  if (void 0 !== value) {
110
- for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push(buildNode({
133
+ for (const [key, childValue] of Object.entries(value))if (!hasOwn(properties, key)) children.push({
111
134
  key,
112
135
  segments: [
113
136
  ...segments,
@@ -117,15 +140,15 @@ function buildObjectChildren(value, schema, segments, path, isTemplate) {
117
140
  schema: additional,
118
141
  value: childValue,
119
142
  hasValue: true
120
- }));
143
+ });
121
144
  }
122
145
  return children;
123
146
  }
124
147
  function buildJsonTree(options) {
125
148
  const { schema, value, basePath = '' } = options;
126
149
  const rootIsArray = void 0 !== value ? Array.isArray(value) : !!schema && 'array' === schemaDisplayType(schema);
127
- if (rootIsArray) return buildArrayChildren(schema, value, void 0 !== value, [], basePath);
128
- return buildObjectChildren(isJsonObject(value) ? value : void 0, schema, [], basePath);
150
+ if (rootIsArray) return buildNodes(arrayChildInputs(schema, value, void 0 !== value, [], basePath));
151
+ return buildNodes(objectChildInputs(isJsonObject(value) ? value : void 0, schema, [], basePath));
129
152
  }
130
153
  function isArrayItemTemplateRoot(node) {
131
154
  return !!node.isArrayItemTemplate && 'number' == typeof node.segments[node.segments.length - 1];
@@ -137,47 +160,76 @@ function nodeSelfMatchesQuery(node, query, displayTexts) {
137
160
  if (display?.sublabel?.toLowerCase().includes(query)) return true;
138
161
  return void 0 !== node.value && null !== node.value && 'object' != typeof node.value && String(node.value).toLowerCase().includes(query);
139
162
  }
140
- function nodeMatchesQuery(node, query, displayTexts) {
141
- if (nodeSelfMatchesQuery(node, query, displayTexts)) return true;
142
- return node.children?.some((c)=>nodeMatchesQuery(c, query, displayTexts)) ?? false;
143
- }
144
- function nodeOrDescendantMatches(node, predicate) {
145
- if (predicate(node)) return true;
146
- return node.children?.some((c)=>nodeOrDescendantMatches(c, predicate)) ?? false;
163
+ function indexMatches(nodes, test) {
164
+ const self = new Set();
165
+ const below = new Set();
166
+ const order = [];
167
+ const stack = [
168
+ ...nodes
169
+ ];
170
+ while(stack.length > 0){
171
+ const node = stack.pop();
172
+ order.push(node);
173
+ if (node.children) for (const child of node.children)stack.push(child);
174
+ }
175
+ for(let index = order.length - 1; index >= 0; index -= 1){
176
+ const node = order[index];
177
+ if (test(node)) self.add(node);
178
+ if (node.children?.some((child)=>self.has(child) || below.has(child))) below.add(node);
179
+ }
180
+ return {
181
+ self,
182
+ below
183
+ };
147
184
  }
148
185
  function flattenJsonTree(nodes, options = {}, depth = 0) {
149
- const { collapsed = {}, filterPredicate } = options;
150
- const query = options.query?.trim().toLowerCase() ?? '';
186
+ const { collapsed = {}, displayTexts } = options;
151
187
  const rows = [];
152
- for (const node of nodes){
153
- const selfQueryMatch = !!query && nodeSelfMatchesQuery(node, query, options.displayTexts);
154
- if (query && !selfQueryMatch && !(node.children?.some((c)=>nodeMatchesQuery(c, query, options.displayTexts)) ?? false)) continue;
155
- const selfPredicateMatch = !!filterPredicate && filterPredicate(node);
156
- if (!filterPredicate || selfPredicateMatch || (node.children?.some((c)=>nodeOrDescendantMatches(c, filterPredicate)) ?? false)) {
157
- rows.push({
158
- node,
159
- depth
160
- });
161
- if (node.children && !collapsed[node.path]) {
162
- const childOptions = selfQueryMatch || selfPredicateMatch ? {
163
- ...options,
164
- query: selfQueryMatch ? '' : options.query,
165
- filterPredicate: selfPredicateMatch ? void 0 : filterPredicate
166
- } : options;
167
- for (const row of flattenJsonTree(node.children, childOptions, depth + 1))rows.push(row);
168
- }
169
- }
188
+ const stack = [];
189
+ const pushChildren = (children, childDepth, query, filterPredicate)=>{
190
+ for(let index = children.length - 1; index >= 0; index -= 1)stack.push({
191
+ node: children[index],
192
+ depth: childDepth,
193
+ query,
194
+ filterPredicate
195
+ });
196
+ };
197
+ const rootQuery = options.query?.trim().toLowerCase() ?? '';
198
+ pushChildren(nodes, depth, rootQuery, options.filterPredicate);
199
+ const queryMatches = rootQuery ? indexMatches(nodes, (node)=>nodeSelfMatchesQuery(node, rootQuery, displayTexts)) : void 0;
200
+ const predicateMatches = options.filterPredicate ? indexMatches(nodes, options.filterPredicate) : void 0;
201
+ while(stack.length > 0){
202
+ const { node, depth: nodeDepth, query, filterPredicate } = stack.pop();
203
+ const selfQueryMatch = !!query && !!queryMatches?.self.has(node);
204
+ if (query && !selfQueryMatch && !queryMatches?.below.has(node)) continue;
205
+ const selfPredicateMatch = !!filterPredicate && !!predicateMatches?.self.has(node);
206
+ if (filterPredicate && !selfPredicateMatch && !predicateMatches?.below.has(node)) continue;
207
+ rows.push({
208
+ node,
209
+ depth: nodeDepth
210
+ });
211
+ if (node.children && !isPathCollapsed(collapsed, node.path)) pushChildren(node.children, nodeDepth + 1, selfQueryMatch ? '' : query, selfPredicateMatch ? void 0 : filterPredicate);
170
212
  }
171
213
  return rows;
172
214
  }
173
215
  function collectContainerPaths(nodes, depth = 0) {
174
216
  const paths = [];
175
- for (const node of nodes)if (node.children) {
217
+ const stack = [];
218
+ for(let index = nodes.length - 1; index >= 0; index -= 1)stack.push({
219
+ node: nodes[index],
220
+ depth
221
+ });
222
+ while(stack.length > 0){
223
+ const { node, depth: nodeDepth } = stack.pop();
224
+ if (!node.children) continue;
176
225
  paths.push({
177
226
  path: node.path,
178
- depth
227
+ depth: nodeDepth
228
+ });
229
+ for(let index = node.children.length - 1; index >= 0; index -= 1)stack.push({
230
+ node: node.children[index],
231
+ depth: nodeDepth + 1
179
232
  });
180
- for (const child of collectContainerPaths(node.children, depth + 1))paths.push(child);
181
233
  }
182
234
  return paths;
183
235
  }
@@ -254,4 +306,4 @@ function formatLeafValue(type, value, options) {
254
306
  if ('string' === type) return options?.preserveStringWhitespace ? `"${value}"` : JSON.stringify(value);
255
307
  return String(value);
256
308
  }
257
- export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, inferValueType, isArrayItemTemplateRoot, isJsonObject, removeValueAtPath, schemaDisplayType, setValueAtPath };
309
+ export { appendPathSegment, buildJsonTree, collectContainerPaths, flattenJsonTree, formatLeafValue, getValueAtPath, inferValueType, isArrayItemTemplateRoot, isJsonObject, isPathCollapsed, removeValueAtPath, schemaDisplayType, setValueAtPath };
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ PanelTabsList: ()=>PanelTabsList,
28
+ PanelTabsStrip: ()=>PanelTabsStrip,
29
+ PanelTabs: ()=>PanelTabs,
30
+ PanelTabsTrigger: ()=>PanelTabsTrigger,
31
+ PanelTabsContent: ()=>PanelTabsContent
32
+ });
33
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
34
+ const external_react_namespaceObject = require("react");
35
+ const index_cjs_namespaceObject = require("../../lib/index.cjs");
36
+ const external_tabs_cjs_namespaceObject = require("./tabs.cjs");
37
+ const PanelTabs = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.Tabs, {
38
+ ref: ref,
39
+ "data-slot": "panel-tabs",
40
+ className: (0, index_cjs_namespaceObject.cn)('flex min-h-0 flex-1 flex-col gap-1', className),
41
+ ...props
42
+ }));
43
+ PanelTabs.displayName = 'PanelTabs';
44
+ const PanelTabsStrip = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, containerClassName, scrollButtonClassName, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.ScrollableTabsList, {
45
+ ref: ref,
46
+ "data-slot": "panel-tabs-strip",
47
+ containerClassName: (0, index_cjs_namespaceObject.cn)('w-auto', containerClassName),
48
+ className: (0, index_cjs_namespaceObject.cn)('h-auto justify-start gap-0.5 rounded-lg bg-transparent p-0 text-muted-foreground', className),
49
+ scrollButtonClassName: (0, index_cjs_namespaceObject.cn)('size-6 hover:bg-surface-overlay', scrollButtonClassName),
50
+ ...props
51
+ }));
52
+ PanelTabsStrip.displayName = 'PanelTabsStrip';
53
+ const PanelTabsList = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ trailing, rowClassName, className, containerClassName, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
54
+ "data-slot": "panel-tabs-list",
55
+ className: (0, index_cjs_namespaceObject.cn)('flex shrink-0 items-center gap-2 pt-3 pb-0.5 [padding-inline:var(--mf-content-inset,0px)]', rowClassName),
56
+ children: [
57
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PanelTabsStrip, {
58
+ ref: ref,
59
+ className: className,
60
+ containerClassName: (0, index_cjs_namespaceObject.cn)('flex-1', containerClassName),
61
+ ...props
62
+ }),
63
+ trailing
64
+ ]
65
+ }));
66
+ PanelTabsList.displayName = 'PanelTabsList';
67
+ const PanelTabsTrigger = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.TabsTrigger, {
68
+ ref: ref,
69
+ "data-slot": "panel-tabs-trigger",
70
+ className: (0, index_cjs_namespaceObject.cn)('inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-md px-2.5 text-xs font-medium text-muted-foreground shadow-none transition-colors hover:text-foreground data-[state=active]:bg-surface-overlay data-[state=active]:text-foreground data-[state=active]:shadow-sm', className),
71
+ ...props
72
+ }));
73
+ PanelTabsTrigger.displayName = 'PanelTabsTrigger';
74
+ const PanelTabsContent = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ padded = true, innerClassName, className, children, ...props }, ref)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_tabs_cjs_namespaceObject.TabsContent, {
75
+ ref: ref,
76
+ "data-slot": "panel-tabs-content",
77
+ className: (0, index_cjs_namespaceObject.cn)('mt-0 min-h-0 flex-1 overflow-auto', className),
78
+ ...props,
79
+ children: padded ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
80
+ className: (0, index_cjs_namespaceObject.cn)('pt-1.5 pb-6 [padding-inline:var(--mf-content-inset,0px)]', innerClassName),
81
+ children: children
82
+ }) : children
83
+ }));
84
+ PanelTabsContent.displayName = 'PanelTabsContent';
85
+ exports.PanelTabs = __webpack_exports__.PanelTabs;
86
+ exports.PanelTabsContent = __webpack_exports__.PanelTabsContent;
87
+ exports.PanelTabsList = __webpack_exports__.PanelTabsList;
88
+ exports.PanelTabsStrip = __webpack_exports__.PanelTabsStrip;
89
+ exports.PanelTabsTrigger = __webpack_exports__.PanelTabsTrigger;
90
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
91
+ "PanelTabs",
92
+ "PanelTabsContent",
93
+ "PanelTabsList",
94
+ "PanelTabsStrip",
95
+ "PanelTabsTrigger"
96
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
97
+ Object.defineProperty(exports, '__esModule', {
98
+ value: true
99
+ });
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import { type ScrollableTabsListProps, TabsContent } from './tabs';
3
+ /** Root: a column whose content area fills the remaining height. */
4
+ declare const PanelTabs: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-tabs").TabsProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ /**
6
+ * The tab strip alone, for a row that also holds other controls (e.g. a tree
7
+ * toolbar). In a narrow panel it reveals prev/next chevrons and keeps the active
8
+ * tab in view; in a wide one it reads as a plain strip.
9
+ */
10
+ declare const PanelTabsStrip: React.ForwardRefExoticComponent<ScrollableTabsListProps & React.RefAttributes<HTMLDivElement>>;
11
+ interface PanelTabsListProps extends ScrollableTabsListProps {
12
+ /** Content after the tabs, at the end of the row (e.g. a notes toggle). */
13
+ trailing?: React.ReactNode;
14
+ /** Classes for the row around the strip. */
15
+ rowClassName?: string;
16
+ }
17
+ /** The pinned tab row: the strip, inset like the content, 12px below what sits above it. */
18
+ declare const PanelTabsList: React.ForwardRefExoticComponent<PanelTabsListProps & React.RefAttributes<HTMLDivElement>>;
19
+ /** A segmented pill tab. */
20
+ declare const PanelTabsTrigger: React.ForwardRefExoticComponent<Omit<Omit<import("@radix-ui/react-tabs").TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
+ interface PanelTabsContentProps extends React.ComponentPropsWithoutRef<typeof TabsContent> {
22
+ /**
23
+ * Wraps the children in the standard padding: the content inset, pt-1.5 (12px
24
+ * below the tabs), and pb-6. Default true. Turn it off for content that pads
25
+ * itself (its first block must then start with the same 6px).
26
+ */
27
+ padded?: boolean;
28
+ /** Classes for the padded wrapper (e.g. its own vertical rhythm). */
29
+ innerClassName?: string;
30
+ }
31
+ /** The active tab's content. It is the scroll container, so the tab row stays pinned. */
32
+ declare const PanelTabsContent: React.ForwardRefExoticComponent<PanelTabsContentProps & React.RefAttributes<HTMLDivElement>>;
33
+ export { PanelTabs, PanelTabsContent, PanelTabsList, PanelTabsStrip, PanelTabsTrigger };
34
+ export type { PanelTabsContentProps, PanelTabsListProps };