@anchrd/intel-ui 0.18.0 → 0.19.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 (63) hide show
  1. package/package.json +2 -9
  2. package/src/app/app-tree/app-tree.tsx +59 -147
  3. package/src/app/settings-dialog/settings-dialog.tsx +10 -32
  4. package/src/data/intel-data-provider/intel-data-provider.ts +0 -163
  5. package/src/data/intel-data-provider/intel-data-provider.types.ts +0 -100
  6. package/src/entry-picker/entry-picker.tsx +6 -6
  7. package/src/i18n/de.json +6 -217
  8. package/src/i18n/en.json +6 -217
  9. package/src/i18n/es.json +6 -217
  10. package/src/import-bundle/import-bundle.tsx +152 -0
  11. package/src/kind-icon.ts +1 -15
  12. package/src/main.tsx +7 -10
  13. package/src/node-table/node-table.tsx +2 -2
  14. package/src/nodes/nodes.tsx +0 -34
  15. package/src/resource-menu/resource-menu.tsx +42 -14
  16. package/src/section-hint/section-hint.tsx +2 -2
  17. package/src/title-row/title-row.tsx +5 -22
  18. package/src/tools/tools.tsx +0 -2
  19. package/vite.config.ts +0 -4
  20. package/src/agent/agent-avatar/agent-avatar.tsx +0 -34
  21. package/src/agent/agent-calendar/agent-calendar.tsx +0 -160
  22. package/src/agent/agent-chat/agent-chat.tsx +0 -118
  23. package/src/agent/agent-costs/agent-costs.ts +0 -95
  24. package/src/agent/agent-cron/agent-cron.ts +0 -68
  25. package/src/agent/agent-definition/agent-definition.ts +0 -96
  26. package/src/agent/agent-delegation-notice/agent-delegation-notice.ts +0 -48
  27. package/src/agent/agent-entry-title/agent-entry-title.ts +0 -72
  28. package/src/agent/agent-log/agent-log.tsx +0 -308
  29. package/src/agent/agent-models/agent-models.ts +0 -166
  30. package/src/agent/agent-models/agent-models.types.ts +0 -24
  31. package/src/agent/agent-profile/agent-profile.tsx +0 -1006
  32. package/src/agent/agent-state/agent-state.ts +0 -85
  33. package/src/agent/agent-status-dot/agent-status-dot.ts +0 -73
  34. package/src/agent/agent.tsx +0 -507
  35. package/src/board/board-calendar/board-calendar.tsx +0 -89
  36. package/src/board/board-card/board-card.tsx +0 -106
  37. package/src/board/board-data/board-data.ts +0 -241
  38. package/src/board/board-data/board-data.types.ts +0 -63
  39. package/src/board/board-detail/board-detail.tsx +0 -629
  40. package/src/board/board-gantt/board-gantt.ts +0 -545
  41. package/src/board/board-gantt/board-gantt.tsx +0 -286
  42. package/src/board/board-graph/board-graph.ts +0 -174
  43. package/src/board/board-graph/board-graph.tsx +0 -168
  44. package/src/board/board-items/board-items.ts +0 -183
  45. package/src/board/board-kanban/board-kanban.ts +0 -137
  46. package/src/board/board-kanban/board-kanban.tsx +0 -257
  47. package/src/board/board-status/board-status.ts +0 -59
  48. package/src/board/board-statuses/board-statuses.ts +0 -63
  49. package/src/board/board-statuses/board-statuses.tsx +0 -228
  50. package/src/board/board-table/board-table.ts +0 -33
  51. package/src/board/board-table/board-table.tsx +0 -413
  52. package/src/board/board-views/board-views.tsx +0 -68
  53. package/src/board/board-views/board-views.types.ts +0 -29
  54. package/src/board/board.tsx +0 -251
  55. package/src/components/ui/item-calendar.tsx +0 -181
  56. package/src/components/ui/item-gantt.tsx +0 -463
  57. package/src/components/ui/kanban.tsx +0 -282
  58. package/src/data/agent-runtime/agent-runtime.ts +0 -131
  59. package/src/hooks/use-capabilities.ts +0 -22
  60. package/src/hooks/use-model-catalog.ts +0 -26
  61. package/src/timezone/timezone-combobox/timezone-combobox.tsx +0 -149
  62. package/src/timezone/timezone-context.tsx +0 -65
  63. package/src/timezone/timezone.ts +0 -174
@@ -1,174 +0,0 @@
1
- // The reader's timezone. Next to `intel.language` and `intel.theme`: the same kind of preference,
2
- // the same place.
3
- //
4
- // ⚠️ This is a preference, NOT the truth about when an agent fires. A schedule carries its own
5
- // timezone (#228); this value is the suggestion when one is created and the lens the calendar is
6
- // read through. The difference matters the day somebody travels: "08:00 Europe/Berlin" must stay
7
- // Berlin, and it would not if the schedule took whatever the reader's browser says today.
8
- const STORE_KEY = "intel.timezone";
9
-
10
- // What the browser thinks. Used when nothing was ever chosen — deliberately not "UTC": a default
11
- // nobody lives in is a default that produces schedules nobody meant.
12
- export function browserTimezone(): string {
13
- try {
14
- return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
15
- } catch {
16
- return "UTC";
17
- }
18
- }
19
-
20
- // Every IANA name this runtime knows, for the picker. An engine without `supportedValuesOf` (or one
21
- // built without full ICU) yields the empty list, and the caller falls back to offering just the
22
- // browser's own zone — one real choice beats a picker that throws.
23
- export function availableTimezones(): string[] {
24
- try {
25
- return Intl.supportedValuesOf("timeZone");
26
- } catch {
27
- return [];
28
- }
29
- }
30
-
31
- // Whether this runtime can actually format in that zone. The check is the formatting itself: a name
32
- // the engine rejects throws a RangeError here rather than in the middle of a calendar.
33
- export function isKnownTimezone(zone: string): boolean {
34
- try {
35
- new Intl.DateTimeFormat("en-US", { timeZone: zone });
36
- return true;
37
- } catch {
38
- return false;
39
- }
40
- }
41
-
42
- /**
43
- * The zone the reader actually CHOSE, or `null` when they never did.
44
- *
45
- * ⚠️ The difference from `readTimezone` is the whole reason this exists (#256). A screen that wants
46
- * to add "…and this is what it says on your clock" may only do so for a zone somebody set: falling
47
- * back to the browser would put a guess on screen dressed as a preference, and the agent's calendar
48
- * would start annotating every schedule for a reader who never asked for it.
49
- *
50
- * A stored zone the engine no longer knows counts as "never chose": IANA renames zones, and a name
51
- * that stopped resolving would otherwise throw on every date the calendar draws.
52
- */
53
- export function readChosenTimezone(store?: Pick<Storage, "getItem">): string | null {
54
- let stored: string | null = null;
55
- try {
56
- stored = store?.getItem(STORE_KEY) ?? null;
57
- } catch {
58
- return null;
59
- }
60
- return stored !== null && isKnownTimezone(stored) ? stored : null;
61
- }
62
-
63
- // The zone to read times in — the choice, and the browser's own where there is none. Never null: a
64
- // component that has to format a date needs an answer, and the browser's is the honest one.
65
- export function readTimezone(store?: Pick<Storage, "getItem">): string {
66
- return readChosenTimezone(store) ?? browserTimezone();
67
- }
68
-
69
- export function rememberTimezone(zone: string, store?: Pick<Storage, "setItem">): void {
70
- try {
71
- store?.setItem(STORE_KEY, zone);
72
- } catch {
73
- // A preference that cannot be written is still a preference for this session.
74
- }
75
- }
76
-
77
- /** One zone as the picker shows it. Everything here is derived, nothing is stored. */
78
- export interface TimezoneOption {
79
- zone: string;
80
- /** "GMT+02:00", "GMT-04:00", "GMT" — present for every zone, which is why it carries the column. */
81
- offsetLabel: string;
82
- /** "MESZ", "JST" … or null where the runtime only repeats the offset. */
83
- abbreviation: string | null;
84
- /** Minutes east of UTC at `at`, for sorting. */
85
- offsetMinutes: number;
86
- /** What the search matches on, lowercased. */
87
- keywords: string[];
88
- }
89
-
90
- function part(zone: string, style: "short" | "longOffset", at: Date, locale: string): string {
91
- try {
92
- return (
93
- new Intl.DateTimeFormat(locale, { timeZone: zone, timeZoneName: style })
94
- .formatToParts(at)
95
- .find((piece) => piece.type === "timeZoneName")?.value ?? ""
96
- );
97
- } catch {
98
- return "";
99
- }
100
- }
101
-
102
- // "GMT+02:00" → 120, "GMT-04:00" → -240, "GMT" → 0. Read from the same string the label shows, so
103
- // the sort order and the text can never tell different stories.
104
- function minutesFrom(offsetLabel: string): number {
105
- const match = /^GMT([+-])(\d{2}):(\d{2})$/.exec(offsetLabel);
106
- if (!match) return 0;
107
- const [, sign, hours, minutes] = match;
108
- const total = Number(hours) * 60 + Number(minutes);
109
- return sign === "-" ? -total : total;
110
- }
111
-
112
- /**
113
- * The label of one zone, at a given moment.
114
- *
115
- * ⚠️ Computed at display time and never stored. A zone's offset AND its abbreviation move with
116
- * daylight saving — Berlin is MEZ/+01:00 in January and MESZ/+02:00 in July — so a label written
117
- * into a field would be wrong for half of every year.
118
- *
119
- * ⚠️ The abbreviation is dropped where `Intl` only echoes the offset — and WHICH zones have one
120
- * depends on the READER'S LANGUAGE, not on the zone. CLDR ships short names only where a locale has
121
- * its own word for that zone: a German reader gets "MEZ/MESZ" for Berlin and a bare "GMT-4" for New
122
- * York; an English reader gets "EST/EDT" for New York and a bare "GMT+2" for Berlin. That is the
123
- * useful way round — you get the abbreviation for the zones your language actually names — but it
124
- * means this function's output is not the same in two languages, and a test has to say which one it
125
- * is asserting. `Asia/Kolkata` has none in either ("GMT+5:30"), which is the common case worldwide.
126
- */
127
- export function timezoneOption(zone: string, at: Date, locale: string): TimezoneOption {
128
- const offsetLabel = part(zone, "longOffset", at, locale) || "GMT";
129
- const short = part(zone, "short", at, locale);
130
- // Dropped when it repeats the offset, and also when it repeats the zone's own name: "UTC" would
131
- // otherwise render as "GMT · UTC UTC", which stutters without adding anything.
132
- const abbreviation =
133
- short && !short.startsWith("GMT") && short !== offsetLabel && short !== zone ? short : null;
134
- const city = zone.split("/").pop()?.replace(/_/g, " ") ?? zone;
135
- return {
136
- zone,
137
- offsetLabel,
138
- abbreviation,
139
- offsetMinutes: minutesFrom(offsetLabel),
140
- // The offset appears twice on purpose: as written ("GMT+02:00") and as typed ("+2"), because
141
- // nobody searches for the leading zero.
142
- keywords: [zone, city, offsetLabel, abbreviation ?? "", shorthandOffset(offsetLabel)]
143
- .filter(Boolean)
144
- .map((word) => word.toLowerCase()),
145
- };
146
- }
147
-
148
- // "GMT+02:00" → "+2", "GMT+05:30" → "+5:30", "GMT" → "+0". What a person types.
149
- function shorthandOffset(offsetLabel: string): string {
150
- const match = /^GMT([+-])(\d{2}):(\d{2})$/.exec(offsetLabel);
151
- if (!match) return "+0";
152
- const [, sign, hours, minutes] = match;
153
- return `${sign}${Number(hours)}${minutes === "00" ? "" : `:${minutes}`}`;
154
- }
155
-
156
- /**
157
- * Every selectable zone, sorted west to east.
158
- *
159
- * ⚠️ `current` is folded in even when `supportedValuesOf` does not list it. That is not a corner
160
- * case: the list holds only CANONICAL names, and "UTC" is not one of them (it is an alias of
161
- * Etc/UTC) — so the zone every CI machine and many servers report would otherwise be missing from
162
- * the picker that is supposed to be showing it.
163
- */
164
- export function timezoneOptions(current: string, at: Date, locale: string): TimezoneOption[] {
165
- const zones = availableTimezones();
166
- const all = zones.includes(current) ? zones : [current, ...zones];
167
- return all
168
- .map((zone) => timezoneOption(zone, at, locale))
169
- .sort((left, right) =>
170
- left.offsetMinutes === right.offsetMinutes
171
- ? left.zone.localeCompare(right.zone)
172
- : left.offsetMinutes - right.offsetMinutes,
173
- );
174
- }