udi-yac 0.1.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 (102) hide show
  1. package/README.md +373 -0
  2. package/dist/app/ErrorBoundary.d.ts +18 -0
  3. package/dist/app/UDIChat.d.ts +3 -0
  4. package/dist/app/UDIChatConfig.d.ts +23 -0
  5. package/dist/app/UDIChatContext.d.ts +26 -0
  6. package/dist/app/validateConfig.d.ts +14 -0
  7. package/dist/app/validateConfig.test.d.ts +1 -0
  8. package/dist/assets/domainWorker-Cd9KoNXV.js +16 -0
  9. package/dist/ce-entry-C4ngOj0B.js +42577 -0
  10. package/dist/components/ui/badge.d.ts +7 -0
  11. package/dist/components/ui/button.d.ts +8 -0
  12. package/dist/components/ui/card.d.ts +11 -0
  13. package/dist/components/ui/checkbox.d.ts +3 -0
  14. package/dist/components/ui/dialog.d.ts +17 -0
  15. package/dist/components/ui/dropdown-menu.d.ts +29 -0
  16. package/dist/components/ui/input.d.ts +3 -0
  17. package/dist/components/ui/label.d.ts +3 -0
  18. package/dist/components/ui/scroll-area.d.ts +4 -0
  19. package/dist/components/ui/select.d.ts +15 -0
  20. package/dist/components/ui/separator.d.ts +3 -0
  21. package/dist/components/ui/slider.d.ts +3 -0
  22. package/dist/components/ui/switch.d.ts +5 -0
  23. package/dist/components/ui/tabs.d.ts +10 -0
  24. package/dist/components/ui/textarea.d.ts +3 -0
  25. package/dist/components/ui/tooltip.d.ts +6 -0
  26. package/dist/data/hubmap_2025-05-05/datapackage_udi.json +19606 -0
  27. package/dist/data/hubmap_2025-05-05/datasets.csv +6324 -0
  28. package/dist/data/hubmap_2025-05-05/datasets.tsv +6324 -0
  29. package/dist/data/hubmap_2025-05-05/donors.csv +433 -0
  30. package/dist/data/hubmap_2025-05-05/donors.tsv +433 -0
  31. package/dist/data/hubmap_2025-05-05/samples.csv +4490 -0
  32. package/dist/data/hubmap_2025-05-05/samples.tsv +4490 -0
  33. package/dist/data/hubmap_api/datapackage.json +14110 -0
  34. package/dist/data/readme.md +41 -0
  35. package/dist/favicon.svg +1 -0
  36. package/dist/features/chat/api/completions.d.ts +12 -0
  37. package/dist/features/chat/components/ApiKeyInput.d.ts +5 -0
  38. package/dist/features/chat/components/ChatHeaderBar.d.ts +19 -0
  39. package/dist/features/chat/components/ChatInput.d.ts +7 -0
  40. package/dist/features/chat/components/ChatPanel.d.ts +13 -0
  41. package/dist/features/chat/components/ClosedVisualizationsPanel.d.ts +6 -0
  42. package/dist/features/chat/components/ConversationList.d.ts +1 -0
  43. package/dist/features/chat/components/DebugToggleSection.d.ts +13 -0
  44. package/dist/features/chat/components/MessageBubble.d.ts +8 -0
  45. package/dist/features/chat/components/MessageList.d.ts +7 -0
  46. package/dist/features/chat/hooks/useChatApi.d.ts +6 -0
  47. package/dist/features/chat/hooks/useDebugExports.d.ts +11 -0
  48. package/dist/features/chat/hooks/useExamplePrompts.d.ts +7 -0
  49. package/dist/features/chat/hooks/useResetHandlers.d.ts +8 -0
  50. package/dist/features/chat/index.d.ts +9 -0
  51. package/dist/features/chat/stores/conversationStore.d.ts +10 -0
  52. package/dist/features/chat/stores/conversationStore.test.d.ts +1 -0
  53. package/dist/features/dashboard/components/DashboardCard.d.ts +9 -0
  54. package/dist/features/dashboard/components/DashboardPanel.d.ts +1 -0
  55. package/dist/features/dashboard/components/DataCounts.d.ts +1 -0
  56. package/dist/features/dashboard/components/DownloadButton.d.ts +1 -0
  57. package/dist/features/dashboard/components/FilterToolbar.d.ts +1 -0
  58. package/dist/features/dashboard/components/VizTweakComponent.d.ts +8 -0
  59. package/dist/features/dashboard/components/VizTweakComponent.types.d.ts +20 -0
  60. package/dist/features/dashboard/components/WelcomeSplash.d.ts +1 -0
  61. package/dist/features/dashboard/index.d.ts +10 -0
  62. package/dist/features/dashboard/stores/dashboardStore.d.ts +70 -0
  63. package/dist/features/dashboard/stores/dashboardStore.test.d.ts +1 -0
  64. package/dist/features/dashboard/stores/dataFiltersStore.d.ts +34 -0
  65. package/dist/features/dashboard/stores/dataFiltersStore.test.d.ts +1 -0
  66. package/dist/features/dashboard/stores/memoryBankStore.d.ts +8 -0
  67. package/dist/features/dashboard/stores/memoryBankStore.test.d.ts +1 -0
  68. package/dist/features/dashboard/stores/selectionsStore.d.ts +7 -0
  69. package/dist/features/dashboard/stores/selectionsStore.test.d.ts +1 -0
  70. package/dist/features/data-package/index.d.ts +7 -0
  71. package/dist/features/data-package/stores/dataPackageStore.d.ts +25 -0
  72. package/dist/features/data-package/stores/dataPackageStore.test.d.ts +1 -0
  73. package/dist/features/data-package/types.d.ts +27 -0
  74. package/dist/features/data-package/utils/joinDataPath.d.ts +7 -0
  75. package/dist/features/data-package/utils/joinDataPath.test.d.ts +1 -0
  76. package/dist/features/data-package/utils/structuredTextParser.d.ts +7 -0
  77. package/dist/features/data-package/utils/structuredTextParser.test.d.ts +1 -0
  78. package/dist/features/data-package/workers/domainWorker.d.ts +13 -0
  79. package/dist/features/tool-calls/components/ClarifyVariable.d.ts +6 -0
  80. package/dist/features/tool-calls/components/FilterComponent.d.ts +9 -0
  81. package/dist/features/tool-calls/components/FreeTextExplain.d.ts +2 -0
  82. package/dist/features/tool-calls/components/IntervalFilterComponent.d.ts +9 -0
  83. package/dist/features/tool-calls/components/PointFilterComponent.d.ts +8 -0
  84. package/dist/features/tool-calls/components/RebuffNotice.d.ts +7 -0
  85. package/dist/features/tool-calls/components/ToolCallRenderer.d.ts +11 -0
  86. package/dist/features/tool-calls/components/VisualizationCard.d.ts +10 -0
  87. package/dist/features/tool-calls/index.d.ts +6 -0
  88. package/dist/features/tool-calls/types.d.ts +52 -0
  89. package/dist/icons.svg +24 -0
  90. package/dist/images/yac-mascot.svg +22 -0
  91. package/dist/index.d.ts +5 -0
  92. package/dist/lib/utils.d.ts +2 -0
  93. package/dist/stores/globalStore.d.ts +6 -0
  94. package/dist/stores/globalStore.test.d.ts +1 -0
  95. package/dist/test/setup.d.ts +0 -0
  96. package/dist/types/dataPackage.d.ts +64 -0
  97. package/dist/types/messages.d.ts +24 -0
  98. package/dist/udi-yac.css +3 -0
  99. package/dist/udi-yac.js +25877 -0
  100. package/dist/utils/specMutations.d.ts +45 -0
  101. package/dist/utils/specMutations.test.d.ts +1 -0
  102. package/package.json +110 -0
@@ -0,0 +1,45 @@
1
+ import { UDIGrammar } from 'udi-toolkit/react';
2
+ /**
3
+ * Return a new spec with every mapping whose `encoding` matches `encoding`
4
+ * rewritten to use `newField`. All other parts of the spec — including
5
+ * mappings on different encodings, transformation pipelines, source.name,
6
+ * and named filters — are left untouched.
7
+ *
8
+ * Replaces the historical string-replace approach (`JSON.stringify(spec)
9
+ * .replace(/"oldField"/g, '"newField"')`), which had three problems:
10
+ * 1. It updated EVERY occurrence of the string, so two encodings bound to
11
+ * the same field (e.g. a density plot with both axes on `age_value`)
12
+ * would change together when only one was meant to.
13
+ * 2. It silently rewrote transformations and source references that
14
+ * happened to mention the field by name.
15
+ * 3. The regex was unescaped — field names containing `.` (e.g.
16
+ * `donor.hubmap_id`) matched arbitrary characters, causing collisions.
17
+ *
18
+ * If `encoding` is not present in any layer's mapping, returns the original
19
+ * spec object unchanged so callers can compare by reference to detect no-ops.
20
+ */
21
+ export declare function setMappingFieldByEncoding(spec: UDIGrammar, encoding: string, newField: string): UDIGrammar;
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
32
+ * 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
+ * join `.on` fields define the join key
38
+ *
39
+ * Schema-preserving / free-form operators — skipped intentionally:
40
+ * filter string expression; row-count-only effect, schema unchanged
41
+ * 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)
44
+ */
45
+ export declare function collectLockedFields(spec: UDIGrammar): Set<string>;
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,110 @@
1
+ {
2
+ "name": "udi-yac",
3
+ "version": "0.1.0",
4
+ "description": "React implementation of the Universal Discovery Interface (UDI) chat — natural-language querying and visualization of biomedical datasets. Publishable as a library (`UDIChat` component) or as a standalone SPA.",
5
+ "keywords": [
6
+ "udi",
7
+ "udi-yac",
8
+ "udi-chat",
9
+ "react",
10
+ "visualization",
11
+ "vega-lite",
12
+ "biomedical",
13
+ "hubmap",
14
+ "llm",
15
+ "chat"
16
+ ],
17
+ "homepage": "https://github.com/NickAkhmetov/udi-chat-react#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/NickAkhmetov/udi-chat-react/issues"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/NickAkhmetov/udi-chat-react.git"
24
+ },
25
+ "license": "MIT",
26
+ "type": "module",
27
+ "main": "dist/udi-yac.js",
28
+ "module": "dist/udi-yac.js",
29
+ "types": "dist/index.d.ts",
30
+ "files": [
31
+ "dist",
32
+ "README.md"
33
+ ],
34
+ "exports": {
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/udi-yac.js"
38
+ },
39
+ "./style.css": "./dist/udi-yac.css"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "peerDependencies": {
45
+ "react": "^18.0.0 || ^19.0.0",
46
+ "react-dom": "^18.0.0 || ^19.0.0"
47
+ },
48
+ "scripts": {
49
+ "dev": "vite",
50
+ "build": "tsc -b && vite build",
51
+ "build:lib": "tsc -b && vite build --mode lib",
52
+ "typecheck": "tsc -b --noEmit",
53
+ "lint": "eslint .",
54
+ "format": "prettier --write .",
55
+ "format:check": "prettier --check .",
56
+ "test": "vitest run",
57
+ "test:watch": "vitest",
58
+ "preview": "vite preview",
59
+ "prepare": "husky"
60
+ },
61
+ "packageManager": "pnpm@10.27.0",
62
+ "lint-staged": {
63
+ "*.{ts,tsx,js,jsx,json,css,md,html,yaml,yml}": "prettier --write"
64
+ },
65
+ "dependencies": {
66
+ "@base-ui/react": "^1.3.0",
67
+ "@fontsource-variable/geist": "^5.2.8",
68
+ "arquero": "^8.0.3",
69
+ "class-variance-authority": "^0.7.1",
70
+ "clsx": "^2.1.1",
71
+ "jszip": "^3.10.1",
72
+ "lucide-react": "^1.7.0",
73
+ "lz-string": "^1.5.0",
74
+ "react": "^19.2.4",
75
+ "react-dom": "^19.2.4",
76
+ "react-markdown": "^10.1.0",
77
+ "shadcn": "^4.1.2",
78
+ "tailwind-merge": "^3.5.0",
79
+ "tw-animate-css": "^1.4.0",
80
+ "udi-toolkit": "^0.0.55",
81
+ "zustand": "^5.0.12"
82
+ },
83
+ "devDependencies": {
84
+ "@eslint/js": "^9.39.4",
85
+ "@tailwindcss/vite": "^4.2.2",
86
+ "@testing-library/jest-dom": "^6.6.3",
87
+ "@testing-library/react": "^16.1.0",
88
+ "@testing-library/user-event": "^14.5.2",
89
+ "@types/lz-string": "^1.5.0",
90
+ "@types/node": "^24.12.0",
91
+ "@types/react": "^19.2.14",
92
+ "@types/react-dom": "^19.2.3",
93
+ "@vitejs/plugin-react": "^6.0.1",
94
+ "eslint": "^9.39.4",
95
+ "eslint-plugin-project-structure": "^3.14.3",
96
+ "eslint-plugin-react-hooks": "^7.0.1",
97
+ "eslint-plugin-react-refresh": "^0.5.2",
98
+ "globals": "^17.4.0",
99
+ "husky": "^9.1.7",
100
+ "jsdom": "^25.0.1",
101
+ "lint-staged": "^16.4.0",
102
+ "prettier": "^3.4.2",
103
+ "tailwindcss": "^4.2.2",
104
+ "typescript": "~5.9.3",
105
+ "typescript-eslint": "^8.57.0",
106
+ "vite": "^8.0.1",
107
+ "vite-plugin-dts": "^4.5.4",
108
+ "vitest": "^2.1.8"
109
+ }
110
+ }