@adea-ai/ui 0.152.0 → 0.152.2

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 (49) hide show
  1. package/dist/components/composites/about-dialog/about-dialog.js +2 -2
  2. package/dist/components/composites/about-dialog/about-dialog.js.map +1 -1
  3. package/dist/components/composites/appearance-editor/appearance-editor.js +3 -3
  4. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  5. package/dist/components/composites/terminal/terminal.js +1 -1
  6. package/dist/components/composites/terminal/terminal.js.map +1 -1
  7. package/dist/components/composites/update-dialog/channel-control.js +3 -3
  8. package/dist/components/composites/update-dialog/channel-control.js.map +1 -1
  9. package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
  10. package/dist/components/composites/update-dialog/update-dialog.js +3 -3
  11. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  12. package/dist/components/conversation/internal/chat-composer-shell.js +1 -1
  13. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  14. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  15. package/dist/components/conversation/message-composer.js +1 -1
  16. package/dist/components/conversation/message-composer.js.map +1 -1
  17. package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
  18. package/dist/components/conversation/scroll-follow.js +14 -1
  19. package/dist/components/conversation/scroll-follow.js.map +1 -1
  20. package/dist/components/layout/split-layout/split-layout.js +1 -1
  21. package/dist/components/layout/split-layout/split-layout.js.map +1 -1
  22. package/dist/components/theme/appearance-panel.d.ts.map +1 -1
  23. package/dist/components/theme/appearance-panel.js +1 -1
  24. package/dist/components/theme/appearance-panel.js.map +1 -1
  25. package/dist/r/src/components/composites/about-dialog/about-dialog.tsx +2 -2
  26. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
  27. package/dist/r/src/components/composites/terminal/terminal.tsx +2 -2
  28. package/dist/r/src/components/composites/update-dialog/channel-control.tsx +3 -3
  29. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +3 -5
  30. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  31. package/dist/r/src/components/conversation/message-composer.tsx +1 -2
  32. package/dist/r/src/components/conversation/scroll-follow.ts +24 -1
  33. package/dist/r/src/components/layout/split-layout/split-layout.tsx +1 -1
  34. package/dist/r/src/components/theme/appearance-panel.tsx +2 -4
  35. package/dist/vite/tailwind-sources.d.ts.map +1 -1
  36. package/dist/vite/tailwind-sources.js +49 -9
  37. package/dist/vite/tailwind-sources.js.map +1 -1
  38. package/package.json +1 -1
  39. package/src/components/composites/about-dialog/about-dialog.tsx +2 -2
  40. package/src/components/composites/appearance-editor/appearance-editor.tsx +4 -4
  41. package/src/components/composites/terminal/terminal.tsx +2 -2
  42. package/src/components/composites/update-dialog/channel-control.tsx +3 -3
  43. package/src/components/composites/update-dialog/update-dialog.tsx +3 -5
  44. package/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  45. package/src/components/conversation/message-composer.tsx +1 -2
  46. package/src/components/conversation/scroll-follow.ts +24 -1
  47. package/src/components/layout/split-layout/split-layout.tsx +1 -1
  48. package/src/components/theme/appearance-panel.tsx +2 -4
  49. package/src/vite/tailwind-sources.ts +67 -7
@@ -66,8 +66,7 @@ export function AppearancePanel(props: AppearancePanelProps) {
66
66
  Appearance
67
67
  </Heading>
68
68
  <p class="max-w-prose text-sm text-muted-foreground">
69
- Follow the system, or pin one. The theme below is chosen per appearance, so switching at
70
- sunset does not make you choose again.
69
+ Follow the system, or pin one. Each appearance keeps its own theme.
71
70
  </p>
72
71
  </header>
73
72
  <RadioGroup
@@ -140,8 +139,7 @@ export function AppearancePanel(props: AppearancePanelProps) {
140
139
  Fonts
141
140
  </Heading>
142
141
  <p class="max-w-prose text-sm text-muted-foreground">
143
- Choose separate families and sizes for the interface, reading, and code. Font families
144
- come from the shared catalogue and are self-hosted.
142
+ Interface, reading and code fonts.
145
143
  </p>
146
144
  </header>
147
145
  <AppearanceFontSettingsGroup
@@ -1,3 +1,4 @@
1
+ import { AsyncLocalStorage } from 'node:async_hooks'
1
2
  import {
2
3
  existsSync,
3
4
  mkdirSync,
@@ -63,14 +64,38 @@ export interface SourceDirectiveOptions {
63
64
 
64
65
  const defaultLabel = 'ui-tailwind-sources'
65
66
 
67
+ /**
68
+ * One walk's memo: the same files are reached, resolved and parsed many times in a walk, and the
69
+ * checks the plugin runs walk the same graph again. It lives in the walk's async context, so a
70
+ * nested walk (the check inside a generation) shares it, while an independent walk that overlaps
71
+ * it (a hot update, or a second call after a file changed) starts with its own, and a later walk
72
+ * never reads an earlier answer.
73
+ */
74
+ interface WalkMemo {
75
+ realpaths: Map<string, string>
76
+ modules: Map<string, ParsedModule>
77
+ }
78
+ const walkMemoStore = new AsyncLocalStorage<WalkMemo>()
79
+ const currentWalkMemo = (): WalkMemo | undefined => walkMemoStore.getStore()
80
+
81
+ function withWalkMemo<T>(walk: () => Promise<T>): Promise<T> {
82
+ if (currentWalkMemo()) return walk()
83
+ return walkMemoStore.run({ realpaths: new Map(), modules: new Map() }, walk)
84
+ }
85
+
66
86
  function modulePath(id: string): string {
67
87
  const withoutQuery = id.split('?')[0] ?? id
68
88
  const absolute = resolve(withoutQuery)
89
+ const known = currentWalkMemo()?.realpaths.get(absolute)
90
+ if (known) return known
91
+ let file = absolute
69
92
  try {
70
- return realpathSync(absolute)
93
+ file = realpathSync(absolute)
71
94
  } catch {
72
- return absolute
95
+ // A path that does not exist (yet) stands for itself.
73
96
  }
97
+ currentWalkMemo()?.realpaths.set(absolute, file)
98
+ return file
74
99
  }
75
100
 
76
101
  function inside(path: string, root: string): boolean {
@@ -110,7 +135,19 @@ function readModule(path: string, cache: Map<string, ParsedModule>): ParsedModul
110
135
  return parsed
111
136
  }
112
137
 
138
+ // A module's runtime imports depend only on its parsed source, and a walk asks for them each time
139
+ // it reaches the module with another selection.
140
+ const runtimeImportsByModule = new WeakMap<ParsedModule, RuntimeImport[]>()
141
+
113
142
  function runtimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {
143
+ const known = runtimeImportsByModule.get(parsed)
144
+ if (known) return known
145
+ const imports = moduleRuntimeImports(parsed, label)
146
+ runtimeImportsByModule.set(parsed, imports)
147
+ return imports
148
+ }
149
+
150
+ function moduleRuntimeImports(parsed: ParsedModule, label: string): RuntimeImport[] {
114
151
  const imports: RuntimeImport[] = []
115
152
 
116
153
  for (const entry of staticRuntimeImports(parsed.syntax)) {
@@ -170,7 +207,11 @@ function modifierExport(file: string, name: string, cache: Map<string, ParsedMod
170
207
  return directRuntimeExports(readModule(file, cache).syntax).includes(name)
171
208
  }
172
209
 
173
- export async function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
210
+ export function collectUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
211
+ return withWalkMemo(() => walkUiSourceFiles(options))
212
+ }
213
+
214
+ async function walkUiSourceFiles(options: SourceDiscoveryOptions): Promise<string[]> {
174
215
  const label = options.label ?? defaultLabel
175
216
  const repositoryRoot = realpathSync(options.repositoryRoot)
176
217
  const uiSourceRoot = realpathSync(options.uiSourceRoot)
@@ -178,7 +219,7 @@ export async function collectUiSourceFiles(options: SourceDiscoveryOptions): Pro
178
219
  const entrypoints = (
179
220
  Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]
180
221
  ).map((entrypoint) => realpathSync(entrypoint))
181
- const cache = new Map<string, ParsedModule>()
222
+ const cache = currentWalkMemo()?.modules ?? new Map<string, ParsedModule>()
182
223
  const visited = new Set<string>()
183
224
  const files = new Set<string>()
184
225
  const publishedUiResolutions: string[] = []
@@ -517,7 +558,11 @@ export interface LinkedImportOptions {
517
558
  * imports are included without executing them, so a lazy feature cannot fail
518
559
  * later on an import the check never saw.
519
560
  */
520
- export async function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
561
+ export function collectLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
562
+ return withWalkMemo(() => walkLinkedImports(options))
563
+ }
564
+
565
+ async function walkLinkedImports(options: LinkedImportOptions): Promise<LinkedImport[]> {
521
566
  const label = options.label ?? defaultLabel
522
567
  const repositoryRoot = realpathSync(options.repositoryRoot)
523
568
  const uiSourceRoot = realpathSync(options.uiSourceRoot)
@@ -525,7 +570,7 @@ export async function collectLinkedImports(options: LinkedImportOptions): Promis
525
570
  const entrypoints = (
526
571
  Array.isArray(options.entrypoint) ? options.entrypoint : [options.entrypoint]
527
572
  ).map((entrypoint) => realpathSync(entrypoint))
528
- const cache = new Map<string, ParsedModule>()
573
+ const cache = currentWalkMemo()?.modules ?? new Map<string, ParsedModule>()
529
574
  const visited = new Set<string>()
530
575
  const linked: LinkedImport[] = []
531
576
  const reached = (file: string) =>
@@ -640,7 +685,22 @@ export function tailwindSources(options: TailwindSourcesOptions): Plugin {
640
685
  let repositoryRoot = ''
641
686
  let generatedFiles: string[] = []
642
687
 
643
- const generate = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
688
+ // The discovery walk and the consumer's check share one memo, and each (specifier, importer)
689
+ // pair is resolved once per generation.
690
+ const generate = (uncachedResolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
691
+ const resolutions = new Map<string, Promise<string | undefined>>()
692
+ const resolveId: Resolver = (specifier, importer) => {
693
+ const key = `${specifier}\0${importer}`
694
+ let resolved = resolutions.get(key)
695
+ if (!resolved) {
696
+ resolved = uncachedResolveId(specifier, importer)
697
+ resolutions.set(key, resolved)
698
+ }
699
+ return resolved
700
+ }
701
+ return withWalkMemo(() => generateWith(resolveId, config))
702
+ }
703
+ const generateWith = async (resolveId: Resolver, config: ResolvedConfig): Promise<string[]> => {
644
704
  const files = await collectUiSourceFiles({
645
705
  entrypoint: paths.entrypoints,
646
706
  repositoryRoot,