udi-yac 0.2.4 → 0.3.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 (36) hide show
  1. package/README.md +38 -25
  2. package/dist/{ce-entry-CLKEbGj8.js → ce-entry-BN36qTNy.js} +21608 -21351
  3. package/dist/src/app/ErrorBoundary.d.ts +1 -1
  4. package/dist/src/app/UDIChatConfig.d.ts +9 -0
  5. package/dist/src/app/validateConfig.d.ts +0 -12
  6. package/dist/src/components/FieldTooltipContent.d.ts +12 -0
  7. package/dist/src/components/ui/accordion.d.ts +8 -1
  8. package/dist/src/features/chat/components/BrushFilterWidgets.d.ts +8 -0
  9. package/dist/src/features/dashboard/components/VizTweakComponent.types.d.ts +9 -0
  10. package/dist/src/features/dashboard/hooks/useBrushFilters.d.ts +45 -0
  11. package/dist/src/features/dashboard/hooks/useBrushFilters.test.d.ts +1 -0
  12. package/dist/src/features/dashboard/index.d.ts +1 -0
  13. package/dist/src/features/dashboard/utils/relevantTableMapping.d.ts +21 -0
  14. package/dist/src/features/dashboard/utils/relevantTableMapping.test.d.ts +1 -0
  15. package/dist/src/features/dashboard/utils/tweakability.d.ts +31 -14
  16. package/dist/src/features/data-package/components/DataOverviewPanel.d.ts +10 -0
  17. package/dist/src/features/data-package/components/DataOverviewPanel.test.d.ts +1 -0
  18. package/dist/src/features/data-package/components/EntityOverview.d.ts +10 -0
  19. package/dist/src/features/data-package/index.d.ts +1 -0
  20. package/dist/src/features/data-package/stores/dataPackageStore.d.ts +14 -0
  21. package/dist/src/features/data-package/utils/entityOverview.d.ts +136 -0
  22. package/dist/src/features/data-package/utils/entityOverview.test.d.ts +1 -0
  23. package/dist/src/features/tool-calls/components/IntervalFilterComponent.d.ts +8 -1
  24. package/dist/src/features/tool-calls/components/PointFilterComponent.d.ts +7 -1
  25. package/dist/src/features/tool-calls/components/PointFilterComponent.test.d.ts +1 -0
  26. package/dist/src/features/tool-calls/index.d.ts +2 -0
  27. package/dist/src/lib/chatRoot.d.ts +7 -0
  28. package/dist/src/stores/globalStore.d.ts +10 -0
  29. package/dist/src/utils/entityIcons.d.ts +10 -0
  30. package/dist/src/utils/highlightMatch.d.ts +7 -0
  31. package/dist/src/utils/httpError.d.ts +11 -0
  32. package/dist/src/utils/httpError.test.d.ts +1 -0
  33. package/dist/src/utils/specMutations.d.ts +73 -17
  34. package/dist/udi-yac.css +1 -1
  35. package/dist/udi-yac.js +29237 -27904
  36. package/package.json +5 -4
@@ -20,26 +20,82 @@ import { UDIGrammar } from 'udi-toolkit/react';
20
20
  */
21
21
  export declare function setMappingFieldByEncoding(spec: UDIGrammar, encoding: string, newField: string): UDIGrammar;
22
22
  /**
23
- * Collect the set of source-field names that are referenced by any
24
- * schema-defining operator in `spec.transformation`. A mapping whose
25
- * `field` belongs to this set should not be offered as tweakable — swapping
26
- * it via VizTweak would leave the transformation pipeline referencing the
27
- * old field while the mapping points at a new field that the pipeline's
28
- * output no longer contains, producing a silently-broken chart.
29
- *
30
- * Schema-defining operators — covered here:
31
- * groupby row keys of the output
23
+ * Collect the set of source-field names referenced by an operator we cannot
24
+ * swap in-place. A mapping whose `field` belongs to this set is not offered as
25
+ * a plain field swap — rewriting only the mapping would leave the pipeline
26
+ * pointing at the old field, producing a silently-broken chart.
27
+ *
28
+ * Locked operators — no supported swap:
32
29
  * binby `.field` becomes bin input; output replaces the row schema
33
- * rollup each aggregation's `.field` is an input to the op; when a
34
- * mapping references that same field elsewhere, orphaning it
35
- * breaks the rollup
36
- * kde `.field` is the density-estimation input
37
30
  * join `.on` fields define the join key
38
31
  *
39
- * Schema-preserving / free-form operators — skipped intentionally:
40
- * filter string expression; row-count-only effect, schema unchanged
32
+ * NOT locked (swappable via a transform-aware mutation instead):
33
+ * groupby swappable via swapDimensionField — rewrites the groupby entry
34
+ * (and dependent rollup output columns) alongside the mapping
35
+ * rollup each aggregation's `.field` is swappable via swapMeasureField —
36
+ * the mapping references the rollup *output* column, not the input
37
+ * kde swappable via swapPlainField — the density input; its output
38
+ * `sample` column is named after the field, so a plain field swap
39
+ * renames kde.field + kde.output.sample alongside the mapping
40
+ *
41
+ * Skipped (schema-preserving; don't lock a swap, but ARE followed when the
42
+ * swapped field is fully replaced — see swapPlainField / applyRenamePlan):
43
+ * filter row-count-only effect, schema unchanged
41
44
  * orderby sort only; schema unchanged
42
- * derive only creates new output fields; expressions are opaque strings
43
- * (would need a parser to extract source-field references safely)
45
+ * derive only creates new output fields
44
46
  */
45
47
  export declare function collectLockedFields(spec: UDIGrammar): Set<string>;
48
+ /** The group-by dimension field names referenced anywhere in the pipeline. */
49
+ export declare function collectGroupbyFields(spec: UDIGrammar): Set<string>;
50
+ export interface RollupOutput {
51
+ op?: string;
52
+ field?: string;
53
+ }
54
+ /**
55
+ * Map each rollup *output column name* to its aggregation. Encoding mappings
56
+ * reference these output names (e.g. `sex_count`, `avg_age`), not the raw
57
+ * input field — so this is how the tweak UI recognises an aggregated measure
58
+ * and decides whether it has a swappable input `field` (count/frequency don't).
59
+ * Last write wins if two rollups reuse a name (grammar disallows this anyway).
60
+ */
61
+ export declare function collectRollupOutputs(spec: UDIGrammar): Record<string, RollupOutput>;
62
+ /**
63
+ * Swap the group-by dimension shown on ONE encoding (e.g. the x axis, sex →
64
+ * race), keeping the aggregation. The mapping rewrite is scoped to `encoding`,
65
+ * so a field shared by another encoding (a bar with `x=sex` AND `color=sex`) is
66
+ * not disturbed.
67
+ *
68
+ * The groupby is kept consistent with what the chart displays:
69
+ * - if the old field is no longer shown anywhere, it is replaced by `newField`
70
+ * in the groupby, and any rollup output column embedding it (`sex_count`) is
71
+ * renamed (`race_count`) so labels track the swap;
72
+ * - if the old field is still shown on another encoding, `newField` is instead
73
+ * added to the groupby (the chart now groups by both) and nothing else is
74
+ * renamed.
75
+ *
76
+ * Returns the same reference on a no-op (encoding absent, or already newField).
77
+ */
78
+ export declare function swapDimensionField(spec: UDIGrammar, encoding: string, newField: string): UDIGrammar;
79
+ /**
80
+ * Swap a plain (non-aggregated, non-groupby) field shown on ONE encoding, and
81
+ * follow that field through the pipeline. A raw source field can also drive
82
+ * `orderby` and `filter` steps (e.g. a CDF orders by the plotted field and
83
+ * derives a percentile from that order, and drops its nulls) — rewriting only
84
+ * the mapping would leave the chart ordered/filtered by the old field while
85
+ * plotted against the new one. So:
86
+ * - rewrite only the edited encoding's mapping (scoped, like the dimension swap);
87
+ * - if the old field is still shown on another encoding, stop there (ambiguous
88
+ * which axis the transforms belong to — mirror swapDimensionField);
89
+ * - otherwise rename the old field → new field in orderby + filter refs.
90
+ *
91
+ * Returns the same reference on a no-op.
92
+ */
93
+ export declare function swapPlainField(spec: UDIGrammar, encoding: string, newField: string): UDIGrammar;
94
+ /**
95
+ * Swap the input field of an aggregated measure (e.g. mean of age → mean of
96
+ * weight). `outputKey` is the rollup output column the encoding is bound to.
97
+ * Renames that rollup's `.field`, renames the output column if it embeds the
98
+ * old field name (`avg_age` → `avg_weight`), and updates the encoding / orderby
99
+ * refs that pointed at it. Leaves the group-by dimension untouched.
100
+ */
101
+ export declare function swapMeasureField(spec: UDIGrammar, outputKey: string, newField: string): UDIGrammar;