@praxical/ui 0.0.0-stage → 0.11.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.
- package/LICENSE +21 -0
- package/README.md +23 -2
- package/dist/activity-calendar.d.ts +13 -0
- package/dist/activity-calendar.js +7 -0
- package/dist/activity-heatmap.d.ts +14 -0
- package/dist/activity-heatmap.js +13 -0
- package/dist/chart-data.d.ts +9 -0
- package/dist/chart-data.js +9 -0
- package/dist/charts.d.ts +56 -0
- package/dist/charts.js +424 -0
- package/dist/chunk-7RMPDKZV.js +541 -0
- package/dist/chunk-7RTW3X7C.js +142 -0
- package/dist/chunk-EBF2F3LN.js +1523 -0
- package/dist/chunk-FCYIZANU.js +385 -0
- package/dist/chunk-HMO4VQZN.js +58 -0
- package/dist/chunk-II677WPC.js +177 -0
- package/dist/chunk-KZHUBPY6.js +102 -0
- package/dist/chunk-OLGZOPLD.js +166 -0
- package/dist/chunk-PDSV773E.js +52 -0
- package/dist/chunk-Q4ARHP76.js +457 -0
- package/dist/chunk-U5W7O3QV.js +22 -0
- package/dist/chunk-V6MXR4P2.js +275 -0
- package/dist/chunk-VZZDLRM5.js +152 -0
- package/dist/chunk-WEM2UQPR.js +110 -0
- package/dist/chunk-XFNDEA5M.js +104 -0
- package/dist/chunk-YKFAA7GU.js +72 -0
- package/dist/code-editor.css +76 -0
- package/dist/code-editor.d.ts +44 -0
- package/dist/code-editor.js +287 -0
- package/dist/code-value.d.ts +13 -0
- package/dist/code-value.js +10 -0
- package/dist/code.d.ts +36 -0
- package/dist/code.js +198 -0
- package/dist/collection.d.ts +21 -0
- package/dist/collection.js +48 -0
- package/dist/content.d.ts +42 -0
- package/dist/content.js +122 -0
- package/dist/display.d.ts +58 -0
- package/dist/display.js +27 -0
- package/dist/feedback.d.ts +34 -0
- package/dist/feedback.js +184 -0
- package/dist/file-tree.d.ts +17 -0
- package/dist/file-tree.js +11 -0
- package/dist/forms.d.ts +69 -0
- package/dist/forms.js +273 -0
- package/dist/git-graph.d.ts +8 -0
- package/dist/git-graph.js +15 -0
- package/dist/git-layout.d.ts +24 -0
- package/dist/git-layout.js +7 -0
- package/dist/image-viewer.d.ts +18 -0
- package/dist/image-viewer.js +11 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.js +98 -0
- package/dist/inputs.d.ts +112 -0
- package/dist/inputs.js +938 -0
- package/dist/layout.d.ts +56 -0
- package/dist/layout.js +180 -0
- package/dist/map-frame.d.ts +37 -0
- package/dist/map-frame.js +13 -0
- package/dist/media.d.ts +40 -0
- package/dist/media.js +19 -0
- package/dist/network-layout.d.ts +94 -0
- package/dist/network-layout.js +19 -0
- package/dist/network.d.ts +111 -0
- package/dist/network.js +354 -0
- package/dist/overlays.d.ts +95 -0
- package/dist/overlays.js +25 -0
- package/dist/patterns.d.ts +117 -0
- package/dist/patterns.js +387 -0
- package/dist/power-layout.d.ts +91 -0
- package/dist/power-layout.js +13 -0
- package/dist/power.d.ts +91 -0
- package/dist/power.js +353 -0
- package/dist/signal-context.d.ts +11 -0
- package/dist/signal-context.js +15 -0
- package/dist/strings-es-419.d.ts +13 -0
- package/dist/strings-es-419.js +357 -0
- package/dist/strings-fr.d.ts +15 -0
- package/dist/strings-fr.js +359 -0
- package/dist/strings-ja.d.ts +16 -0
- package/dist/strings-ja.js +357 -0
- package/dist/strings-pt-BR.d.ts +13 -0
- package/dist/strings-pt-BR.js +357 -0
- package/dist/strings.d.ts +394 -0
- package/dist/strings.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/tab-bar.d.ts +20 -0
- package/dist/tab-bar.js +114 -0
- package/package.json +199 -3
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// packages/ui/src/strings.ts
|
|
4
|
+
var defaultStrings = {
|
|
5
|
+
appearance: {
|
|
6
|
+
label: "Appearance",
|
|
7
|
+
system: "System",
|
|
8
|
+
light: "Light",
|
|
9
|
+
dark: "Dark"
|
|
10
|
+
},
|
|
11
|
+
density: {
|
|
12
|
+
label: "Density",
|
|
13
|
+
comfortable: "Comfortable",
|
|
14
|
+
compact: "Compact",
|
|
15
|
+
editor: "Editor"
|
|
16
|
+
},
|
|
17
|
+
face: {
|
|
18
|
+
label: "Face",
|
|
19
|
+
control: "Interface face",
|
|
20
|
+
sans: "Sans",
|
|
21
|
+
chrome: "Chrome",
|
|
22
|
+
mono: "Mono"
|
|
23
|
+
},
|
|
24
|
+
statusBar: { label: "Status" },
|
|
25
|
+
select: { placeholder: "Choose\u2026" },
|
|
26
|
+
combobox: {
|
|
27
|
+
placeholder: "Find\u2026",
|
|
28
|
+
empty: "No matches",
|
|
29
|
+
clear: (label) => `Clear ${label}`,
|
|
30
|
+
showOptions: (label) => `Show ${label} options`
|
|
31
|
+
},
|
|
32
|
+
pane: { collapse: "Collapse", expand: "Expand" },
|
|
33
|
+
dialog: { close: "Close dialog", cancel: "Cancel" },
|
|
34
|
+
menu: { options: (label) => `${label} options` },
|
|
35
|
+
command: {
|
|
36
|
+
label: "Search commands",
|
|
37
|
+
description: "Find and run an action. Use the arrow keys to browse.",
|
|
38
|
+
close: "Close commands",
|
|
39
|
+
inputLabel: "Command",
|
|
40
|
+
placeholder: "Type a command\u2026",
|
|
41
|
+
empty: "No commands found",
|
|
42
|
+
shortcut: "\u2318 / Ctrl K"
|
|
43
|
+
},
|
|
44
|
+
inbox: {
|
|
45
|
+
label: "Inbox",
|
|
46
|
+
close: "Close inbox",
|
|
47
|
+
unreadBadge: (count) => `${count} unread`,
|
|
48
|
+
unreadCount: (count) => `${count} unread notification${count === 1 ? "" : "s"}`,
|
|
49
|
+
empty: "You\u2019re all caught up.",
|
|
50
|
+
unreadMark: "New",
|
|
51
|
+
markRead: "Mark as read",
|
|
52
|
+
dismiss: "Dismiss"
|
|
53
|
+
},
|
|
54
|
+
panel: { close: (title) => `Close ${title.toLowerCase()}` },
|
|
55
|
+
picker: {
|
|
56
|
+
category: "Category",
|
|
57
|
+
allCategories: "All categories",
|
|
58
|
+
search: (label) => `Search ${label.toLowerCase()}`,
|
|
59
|
+
placeholder: "Search\u2026",
|
|
60
|
+
empty: "No matching content",
|
|
61
|
+
addReaction: "Add reaction"
|
|
62
|
+
},
|
|
63
|
+
table: {
|
|
64
|
+
empty: "No records",
|
|
65
|
+
actions: "Actions",
|
|
66
|
+
selectAll: "Select all rows",
|
|
67
|
+
selectRow: (name) => `Select ${name}`
|
|
68
|
+
},
|
|
69
|
+
search: {
|
|
70
|
+
clear: "Clear search",
|
|
71
|
+
submit: "Search",
|
|
72
|
+
noSuggestions: "No suggestions",
|
|
73
|
+
shortcutControl: "Ctrl K",
|
|
74
|
+
shortcutCommand: "\u2318K"
|
|
75
|
+
},
|
|
76
|
+
pagination: {
|
|
77
|
+
label: "Pagination",
|
|
78
|
+
previous: "Previous page",
|
|
79
|
+
next: "Next page",
|
|
80
|
+
page: (page) => `Page ${page}`,
|
|
81
|
+
summary: (page, total) => `Page ${page} of ${total}`,
|
|
82
|
+
none: "No pages"
|
|
83
|
+
},
|
|
84
|
+
breadcrumbs: { label: "Breadcrumbs" },
|
|
85
|
+
accordion: { label: "Content sections" },
|
|
86
|
+
progress: { indeterminate: "In progress" },
|
|
87
|
+
loading: { label: "Loading", table: "Loading table" },
|
|
88
|
+
collection: { error: "This could not be loaded.", retry: "Try again" },
|
|
89
|
+
form: { errors: "Check the form" },
|
|
90
|
+
input: { clear: "Clear" },
|
|
91
|
+
password: { show: "Show password", hide: "Hide password" },
|
|
92
|
+
tagInput: { placeholder: "Add\u2026" },
|
|
93
|
+
tag: { remove: "Remove" },
|
|
94
|
+
banner: { dismiss: "Dismiss" },
|
|
95
|
+
toast: { dismiss: "Dismiss toast" },
|
|
96
|
+
slider: {
|
|
97
|
+
minimum: (label) => `${label} minimum`,
|
|
98
|
+
maximum: (label) => `${label} maximum`
|
|
99
|
+
},
|
|
100
|
+
numberField: {
|
|
101
|
+
decrease: (label) => `Decrease ${label}`,
|
|
102
|
+
increase: (label) => `Increase ${label}`
|
|
103
|
+
},
|
|
104
|
+
stepper: {
|
|
105
|
+
label: "Steps",
|
|
106
|
+
step: (index, total, label) => `Step ${index} of ${total}: ${label}`,
|
|
107
|
+
position: (index, total) => `Step ${index} of ${total}`
|
|
108
|
+
},
|
|
109
|
+
eventState: {
|
|
110
|
+
complete: "complete",
|
|
111
|
+
current: "current",
|
|
112
|
+
pending: "pending",
|
|
113
|
+
failed: "failed"
|
|
114
|
+
},
|
|
115
|
+
calendar: {
|
|
116
|
+
monthGrid: "Months",
|
|
117
|
+
chooseMonth: "Choose month",
|
|
118
|
+
year: "Year",
|
|
119
|
+
previousMonth: "Previous month",
|
|
120
|
+
nextMonth: "Next month",
|
|
121
|
+
chooseDate: "Choose date",
|
|
122
|
+
clearDate: "Clear date",
|
|
123
|
+
chooseRange: "Choose range",
|
|
124
|
+
clearRange: "Clear range",
|
|
125
|
+
applyRange: "Apply range",
|
|
126
|
+
rangeStart: (label) => `${label} start`,
|
|
127
|
+
rangeEnd: (label) => `${label} end`,
|
|
128
|
+
rangeDisplay: (from, to) => `${from} \u2192 ${to || "\u2026"}`,
|
|
129
|
+
fieldValue: (label, value) => `${label}: ${value}`,
|
|
130
|
+
datePlaceholder: "YYYY-MM-DD",
|
|
131
|
+
dateError: (min, max) => `Enter a valid YYYY-MM-DD date${min ? ` on or after ${min}` : ""}${max ? ` on or before ${max}` : ""}.`,
|
|
132
|
+
time: "Time",
|
|
133
|
+
today: (date) => `Today, ${date}`,
|
|
134
|
+
selected: (date) => `${date}, selected`
|
|
135
|
+
},
|
|
136
|
+
dropzone: {
|
|
137
|
+
label: "Drop files here",
|
|
138
|
+
choose: "Choose files",
|
|
139
|
+
tooMany: (max) => `Choose up to ${max} files.`,
|
|
140
|
+
rejected: (name) => `${name} does not match the file requirements.`
|
|
141
|
+
},
|
|
142
|
+
otp: {
|
|
143
|
+
label: "Authentication code",
|
|
144
|
+
digit: (label, index, total) => `${label}, digit ${index} of ${total}`,
|
|
145
|
+
hint: (length) => `Enter the ${length}-digit code from your authenticator.`
|
|
146
|
+
},
|
|
147
|
+
fileTree: { label: "Files", empty: "No files" },
|
|
148
|
+
git: {
|
|
149
|
+
label: "Commit history",
|
|
150
|
+
empty: "No commits",
|
|
151
|
+
parents: (ids) => `Parents: ${ids}`,
|
|
152
|
+
root: "Root commit",
|
|
153
|
+
hint: "Lines connect commits to their parents. Dashed lines continue beyond this history."
|
|
154
|
+
},
|
|
155
|
+
code: {
|
|
156
|
+
label: "Code",
|
|
157
|
+
copy: "Copy",
|
|
158
|
+
copied: "Copied",
|
|
159
|
+
copyFailed: "Copy failed"
|
|
160
|
+
},
|
|
161
|
+
diff: {
|
|
162
|
+
label: "Changes",
|
|
163
|
+
before: "Before",
|
|
164
|
+
after: "After",
|
|
165
|
+
unified: (label) => `${label}, unified diff`,
|
|
166
|
+
none: "No changes"
|
|
167
|
+
},
|
|
168
|
+
network: {
|
|
169
|
+
health: { up: "Up", problem: "Up, with a problem", down: "No link", off: "Shut down", unknown: "Not reported" },
|
|
170
|
+
portOff: "off",
|
|
171
|
+
tiers: ["Up to 100 Mb/s", "1 Gb/s", "2.5\u20135 Gb/s", "10 Gb/s", "25 Gb/s and faster"],
|
|
172
|
+
upUnknownSpeed: "Up, speed not reported",
|
|
173
|
+
mustStayUp: "Down, must stay up",
|
|
174
|
+
faceplateLegend: "Port colours",
|
|
175
|
+
map: "Network map",
|
|
176
|
+
mapLegend: "Map key",
|
|
177
|
+
mapHint: "Up and Down move through the devices, Right goes to a device's first connection and Left to its parent.",
|
|
178
|
+
empty: "No devices to show",
|
|
179
|
+
faster: "Up (thicker is faster)",
|
|
180
|
+
wireless: "Wi-Fi",
|
|
181
|
+
measured: "measured",
|
|
182
|
+
declared: "declared",
|
|
183
|
+
link: (state) => `Link: ${state}`
|
|
184
|
+
},
|
|
185
|
+
map: { zoomIn: "Zoom in", zoomOut: "Zoom out", fit: "Fit the map to its frame" },
|
|
186
|
+
power: {
|
|
187
|
+
map: "Power map",
|
|
188
|
+
mapLegend: "Map key",
|
|
189
|
+
mapHint: "Up and Down move through the supply, circuits and devices, Right goes to the first thing below and Left to what it is plugged into.",
|
|
190
|
+
empty: "No circuits to show",
|
|
191
|
+
source: "Mains",
|
|
192
|
+
watts: (value) => `${value} W`,
|
|
193
|
+
kilowatts: (value) => `${value} kW`,
|
|
194
|
+
amps: (value) => `${value} A`,
|
|
195
|
+
estimated: (value) => `~${value}`,
|
|
196
|
+
partial: (value) => `\u2265 ${value}`,
|
|
197
|
+
unknown: "No reading",
|
|
198
|
+
free: (value) => `${value} free`,
|
|
199
|
+
over: (value) => `${value} over`,
|
|
200
|
+
circuits: (count) => count === 1 ? "1 circuit" : `${count} circuits`,
|
|
201
|
+
share: (percent, capacity) => `${percent} of ${capacity}`,
|
|
202
|
+
overLimit: (percent) => `Over its ${percent} limit`,
|
|
203
|
+
overLimitKey: "Over its limit",
|
|
204
|
+
overRating: "Over its rating",
|
|
205
|
+
alert: "An alert is firing",
|
|
206
|
+
current: "Current (thicker is more)",
|
|
207
|
+
nothing: "Nothing measured",
|
|
208
|
+
measured: "measured",
|
|
209
|
+
estimatedKey: "estimated",
|
|
210
|
+
partialKey: "at least",
|
|
211
|
+
animate: "Animate the current"
|
|
212
|
+
},
|
|
213
|
+
heatmap: {
|
|
214
|
+
less: "Less",
|
|
215
|
+
more: "More",
|
|
216
|
+
cell: (label, value) => `${label}: ${value}`
|
|
217
|
+
},
|
|
218
|
+
codeValue: {
|
|
219
|
+
copy: (label) => `Copy ${label}`,
|
|
220
|
+
copying: (label) => `Copying ${label}.`,
|
|
221
|
+
/** Translations should prefer a shape that does not make a participle
|
|
222
|
+
* agree with the interpolated label, e.g. `Copiado: ${label}.` */
|
|
223
|
+
copied: (label) => `${label} copied.`,
|
|
224
|
+
failed: (label) => `Could not copy ${label}. Select the value and copy it manually.`
|
|
225
|
+
},
|
|
226
|
+
imageViewer: {
|
|
227
|
+
title: "Image viewer",
|
|
228
|
+
fit: "Fit image to window",
|
|
229
|
+
zoom: "Zoom to actual size",
|
|
230
|
+
close: "Close image viewer",
|
|
231
|
+
fullSize: "Full-size image. Scroll to explore.",
|
|
232
|
+
swipe: "Swipe to change image.",
|
|
233
|
+
previous: "Previous enlarged image",
|
|
234
|
+
next: "Next enlarged image",
|
|
235
|
+
position: (index, total) => `${index} / ${total}`
|
|
236
|
+
},
|
|
237
|
+
tabBar: {
|
|
238
|
+
add: "New tab",
|
|
239
|
+
close: (name) => `Close ${name}`,
|
|
240
|
+
closeHint: ", press Delete to close"
|
|
241
|
+
},
|
|
242
|
+
audio: {
|
|
243
|
+
playbackFailed: "Playback could not start. Try again or check the media source.",
|
|
244
|
+
unavailable: "Audio is unavailable or its codec is unsupported.",
|
|
245
|
+
seek: (label) => `Seek ${label}`,
|
|
246
|
+
timeOf: (time, duration) => `${time} of ${duration}`,
|
|
247
|
+
volume: "Audio volume",
|
|
248
|
+
play: (label) => `Play ${label}`,
|
|
249
|
+
pause: (label) => `Pause ${label}`,
|
|
250
|
+
mute: "Mute",
|
|
251
|
+
unmute: "Unmute",
|
|
252
|
+
muteAudio: "Mute audio",
|
|
253
|
+
unmuteAudio: "Unmute audio",
|
|
254
|
+
speed: "Playback speed",
|
|
255
|
+
speedValue: (rate) => `Playback speed ${rate}\xD7. Change speed`,
|
|
256
|
+
changeSpeed: "Change playback speed",
|
|
257
|
+
back: "Back 10 seconds",
|
|
258
|
+
forward: "Forward 10 seconds",
|
|
259
|
+
seekHelp: (waveform) => `${waveform ? "Waveform" : "Timeline"} \xB7 drag to seek \xB7 \u2190 \u2192 fine seek \xB7 Home / End`,
|
|
260
|
+
timestamp: "Timestamp",
|
|
261
|
+
length: "Length",
|
|
262
|
+
codec: "Codec",
|
|
263
|
+
unknown: "Unknown",
|
|
264
|
+
buffering: "Buffering\u2026",
|
|
265
|
+
transcript: "Transcript"
|
|
266
|
+
},
|
|
267
|
+
recording: {
|
|
268
|
+
status: (kind, state) => `${kind === "audio" ? "Audio" : "Video"} ${state === "recording" ? "recording" : state === "paused" ? "paused" : "stopped"}`,
|
|
269
|
+
elapsed: (minutes, seconds) => `Elapsed: ${minutes} minutes ${seconds} seconds`
|
|
270
|
+
},
|
|
271
|
+
message: {
|
|
272
|
+
reactions: (author) => `Reactions to ${author}\u2019s message`,
|
|
273
|
+
reaction: (label, count, mine) => `${label}, ${count}${mine ? ", including you" : ""}`,
|
|
274
|
+
openImage: (alt) => `Open image: ${alt}`,
|
|
275
|
+
delivery: {
|
|
276
|
+
sending: "Sending",
|
|
277
|
+
sent: "Sent",
|
|
278
|
+
delivered: "Delivered",
|
|
279
|
+
read: "Read",
|
|
280
|
+
failed: "Failed"
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
resource: {
|
|
284
|
+
summary: (label, segments, free, over) => `${label}: ${segments}; ${free} free${over ? "; over capacity" : ""}`,
|
|
285
|
+
segment: (label, value) => `${label} ${value}`,
|
|
286
|
+
overCapacity: (amount) => `${amount} over capacity`,
|
|
287
|
+
limit: (value) => `Limit ${value}`,
|
|
288
|
+
overLimit: (amount) => `${amount} over the limit`
|
|
289
|
+
},
|
|
290
|
+
chart: {
|
|
291
|
+
dailyGroup: (label) => `${label}, daily in UTC`,
|
|
292
|
+
dailyCaption: (label) => `${label} \xB7 Daily, UTC`,
|
|
293
|
+
dailyHelp: (label) => `${label} \xB7 Daily, UTC. Focus the plot and use Left and Right arrows to inspect observations.`,
|
|
294
|
+
dailyPlot: (label) => `${label}. Left and Right arrows inspect daily measurements.`,
|
|
295
|
+
tooltipDay: (day) => `${day} \xB7 UTC`,
|
|
296
|
+
notRecorded: "Not recorded",
|
|
297
|
+
noMeasurements: "No measurements recorded.",
|
|
298
|
+
viewDaily: "View daily numbers",
|
|
299
|
+
dataRegion: (label) => `${label} data`,
|
|
300
|
+
dataCaption: (label) => `${label} \xB7 UTC`,
|
|
301
|
+
dateHeader: "Date (UTC)",
|
|
302
|
+
viewValues: "View values",
|
|
303
|
+
category: "Category",
|
|
304
|
+
sparkline: (label, count, latest) => `${label}: ${count} values, latest ${latest}`,
|
|
305
|
+
sparklineEmpty: (label) => `${label}: no values`
|
|
306
|
+
},
|
|
307
|
+
emoji: {
|
|
308
|
+
smile: { label: "Smile", keywords: "happy face" },
|
|
309
|
+
joy: { label: "Joy", keywords: "laugh tears" },
|
|
310
|
+
grateful: { label: "Grateful", keywords: "tears touched" },
|
|
311
|
+
"love-it": { label: "Love it", keywords: "heart eyes" },
|
|
312
|
+
thinking: { label: "Thinking", keywords: "consider question" },
|
|
313
|
+
cool: { label: "Cool", keywords: "sunglasses" },
|
|
314
|
+
celebration: { label: "Celebration", keywords: "party" },
|
|
315
|
+
sad: { label: "Sad", keywords: "cry" },
|
|
316
|
+
surprised: { label: "Surprised", keywords: "wow" },
|
|
317
|
+
sleepy: { label: "Sleepy", keywords: "tired" },
|
|
318
|
+
salute: { label: "Salute", keywords: "respect" },
|
|
319
|
+
"mind-blown": { label: "Mind blown", keywords: "amazing" },
|
|
320
|
+
"thumbs-up": { label: "Thumbs up", keywords: "yes approve" },
|
|
321
|
+
"thumbs-down": { label: "Thumbs down", keywords: "no disagree" },
|
|
322
|
+
clapping: { label: "Clapping", keywords: "applause" },
|
|
323
|
+
"raised-hands": { label: "Raised hands", keywords: "hooray" },
|
|
324
|
+
wave: { label: "Wave", keywords: "hello goodbye" },
|
|
325
|
+
thanks: { label: "Thanks", keywords: "please" },
|
|
326
|
+
heart: { label: "Heart", keywords: "love" },
|
|
327
|
+
"blue-heart": { label: "Blue heart", keywords: "love" },
|
|
328
|
+
fire: { label: "Fire", keywords: "hot" },
|
|
329
|
+
sparkles: { label: "Sparkles", keywords: "shine" },
|
|
330
|
+
"party-popper": { label: "Party popper", keywords: "celebrate" },
|
|
331
|
+
rocket: { label: "Rocket", keywords: "launch ship" },
|
|
332
|
+
approved: { label: "Approved", keywords: "check done success" },
|
|
333
|
+
eyes: { label: "Eyes", keywords: "looking review" },
|
|
334
|
+
idea: { label: "Idea", keywords: "light bulb" },
|
|
335
|
+
hundred: { label: "Hundred", keywords: "perfect" },
|
|
336
|
+
bug: { label: "Bug", keywords: "error" },
|
|
337
|
+
tools: { label: "Tools", keywords: "work fix" },
|
|
338
|
+
package: { label: "Package", keywords: "release" },
|
|
339
|
+
notes: { label: "Notes", keywords: "write" },
|
|
340
|
+
target: { label: "Target", keywords: "goal" },
|
|
341
|
+
star: { label: "Star", keywords: "favorite" },
|
|
342
|
+
coffee: { label: "Coffee", keywords: "break" },
|
|
343
|
+
seedling: { label: "Seedling", keywords: "growth" }
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
function mergeStrings(base, overrides) {
|
|
347
|
+
if (!overrides) return base;
|
|
348
|
+
const merged = { ...base };
|
|
349
|
+
for (const key of Object.keys(overrides)) {
|
|
350
|
+
const group = overrides[key];
|
|
351
|
+
if (group)
|
|
352
|
+
merged[key] = { ...base[key], ...group };
|
|
353
|
+
}
|
|
354
|
+
return merged;
|
|
355
|
+
}
|
|
356
|
+
function localeMonthNames(locale, style = "long") {
|
|
357
|
+
const format = new Intl.DateTimeFormat(locale, { month: style });
|
|
358
|
+
return Array.from(
|
|
359
|
+
{ length: 12 },
|
|
360
|
+
(_, month) => format.format(new Date(2021, month, 15, 12))
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
function localeDayNumber(locale, date) {
|
|
364
|
+
return new Intl.NumberFormat(locale, { useGrouping: false }).format(
|
|
365
|
+
date.getDate()
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
function localeFirstDayOfWeek(locale) {
|
|
369
|
+
try {
|
|
370
|
+
const info = new Intl.Locale(locale);
|
|
371
|
+
const first = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;
|
|
372
|
+
if (typeof first === "number" && first >= 1 && first <= 7)
|
|
373
|
+
return first % 7;
|
|
374
|
+
} catch {
|
|
375
|
+
}
|
|
376
|
+
return 1;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export {
|
|
380
|
+
defaultStrings,
|
|
381
|
+
mergeStrings,
|
|
382
|
+
localeMonthNames,
|
|
383
|
+
localeDayNumber,
|
|
384
|
+
localeFirstDayOfWeek
|
|
385
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// packages/ui/src/chart-data.ts
|
|
4
|
+
var DAY = 864e5;
|
|
5
|
+
function normalizeDailyData(data, keys) {
|
|
6
|
+
const days = /* @__PURE__ */ new Map();
|
|
7
|
+
for (const row of data) {
|
|
8
|
+
const timestamp = Date.parse(`${row.day}T00:00:00Z`);
|
|
9
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(row.day) || !Number.isFinite(timestamp) || new Date(timestamp).toISOString().slice(0, 10) !== row.day)
|
|
10
|
+
throw new Error(`Invalid UTC date: ${row.day}`);
|
|
11
|
+
if (days.has(timestamp)) throw new Error(`Duplicate UTC date: ${row.day}`);
|
|
12
|
+
days.set(timestamp, {
|
|
13
|
+
day: row.day,
|
|
14
|
+
...Object.fromEntries(
|
|
15
|
+
keys.map((key) => [
|
|
16
|
+
key,
|
|
17
|
+
typeof row[key] === "number" && Number.isFinite(row[key]) ? row[key] : null
|
|
18
|
+
])
|
|
19
|
+
)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const times = [...days.keys()].sort((a, b) => a - b);
|
|
23
|
+
if (!times.length) return [];
|
|
24
|
+
if ((times.at(-1) - times[0]) / DAY > 3660)
|
|
25
|
+
throw new Error(
|
|
26
|
+
"Daily charts support at most 3661 days; aggregate longer periods in the consumer."
|
|
27
|
+
);
|
|
28
|
+
const result = [];
|
|
29
|
+
for (let timestamp = times[0]; timestamp <= times.at(-1); timestamp += DAY)
|
|
30
|
+
result.push(
|
|
31
|
+
days.get(timestamp) ?? {
|
|
32
|
+
day: new Date(timestamp).toISOString().slice(0, 10),
|
|
33
|
+
...Object.fromEntries(keys.map((key) => [key, null]))
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
function chartTicks(values) {
|
|
39
|
+
const finite = values.filter(Number.isFinite);
|
|
40
|
+
const low = Math.min(0, ...finite), high = Math.max(0, ...finite);
|
|
41
|
+
if (low === high) return [0, 0.25, 0.5, 0.75, 1];
|
|
42
|
+
const raw = (high - low) / 4, power = 10 ** Math.floor(Math.log10(raw));
|
|
43
|
+
for (const factor of [1, 2, 2.5, 5, 10]) {
|
|
44
|
+
const step = factor * power, first = Math.floor(low / step + 1e-9), last = Math.ceil(high / step - 1e-9);
|
|
45
|
+
if (last - first > 4) continue;
|
|
46
|
+
const digits = Math.max(0, -Math.floor(Math.log10(step)) + (factor === 2.5 ? 1 : 0));
|
|
47
|
+
return Array.from(
|
|
48
|
+
{ length: last - first + 1 },
|
|
49
|
+
(_, i) => Number(((first + i) * step).toFixed(digits))
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return [low, high];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {
|
|
56
|
+
normalizeDailyData,
|
|
57
|
+
chartTicks
|
|
58
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import {
|
|
3
|
+
Button
|
|
4
|
+
} from "./chunk-EBF2F3LN.js";
|
|
5
|
+
import {
|
|
6
|
+
useSignalLocale,
|
|
7
|
+
useSignalStrings
|
|
8
|
+
} from "./chunk-U5W7O3QV.js";
|
|
9
|
+
|
|
10
|
+
// packages/ui/src/map-frame.tsx
|
|
11
|
+
import {
|
|
12
|
+
useId,
|
|
13
|
+
useLayoutEffect,
|
|
14
|
+
useRef,
|
|
15
|
+
useState
|
|
16
|
+
} from "react";
|
|
17
|
+
import { Maximize2, Minus, Plus } from "lucide-react";
|
|
18
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
20
|
+
function MapFrame({
|
|
21
|
+
className,
|
|
22
|
+
label,
|
|
23
|
+
hint,
|
|
24
|
+
width,
|
|
25
|
+
height,
|
|
26
|
+
items,
|
|
27
|
+
tools,
|
|
28
|
+
after,
|
|
29
|
+
children
|
|
30
|
+
}) {
|
|
31
|
+
const strings = useSignalStrings().map;
|
|
32
|
+
const locale = useSignalLocale();
|
|
33
|
+
const id = useId();
|
|
34
|
+
const root = useRef(null);
|
|
35
|
+
const box = useRef(null);
|
|
36
|
+
const svg = useRef(null);
|
|
37
|
+
const tipEl = useRef(null);
|
|
38
|
+
const [frameWidth, setFrameWidth] = useState(0);
|
|
39
|
+
const [zoom, setZoom] = useState("fit");
|
|
40
|
+
const [active, setActive] = useState();
|
|
41
|
+
const [tip, setTip] = useState(null);
|
|
42
|
+
const drag = useRef(null);
|
|
43
|
+
useLayoutEffect(() => {
|
|
44
|
+
const el = box.current;
|
|
45
|
+
if (!el) return;
|
|
46
|
+
const ro = new ResizeObserver(() => setFrameWidth(el.clientWidth));
|
|
47
|
+
ro.observe(el);
|
|
48
|
+
setFrameWidth(el.clientWidth);
|
|
49
|
+
return () => ro.disconnect();
|
|
50
|
+
}, []);
|
|
51
|
+
const fit = frameWidth ? Math.max(0.4, Math.min(1, frameWidth / width)) : 1;
|
|
52
|
+
const scale = zoom === "fit" ? fit : zoom;
|
|
53
|
+
const percent = new Intl.NumberFormat(locale, { style: "percent" }).format(scale);
|
|
54
|
+
const step = (f) => setZoom(Math.max(0.4, Math.min(2, +(scale * f).toFixed(2))));
|
|
55
|
+
const current = active && items.some((i) => i.id === active) ? active : items[0]?.id;
|
|
56
|
+
const place = (clientX, clientY, body, target) => setTip({ x: clientX, y: clientY, body, for: target });
|
|
57
|
+
const position = () => {
|
|
58
|
+
const el = tipEl.current;
|
|
59
|
+
if (!el || !tip || !root.current || !box.current) return;
|
|
60
|
+
const wrap = root.current.getBoundingClientRect();
|
|
61
|
+
const view = box.current.getBoundingClientRect();
|
|
62
|
+
const top = view.top + box.current.clientTop;
|
|
63
|
+
const left = view.left + box.current.clientLeft;
|
|
64
|
+
const right = left + box.current.clientWidth;
|
|
65
|
+
const bottom = top + box.current.clientHeight;
|
|
66
|
+
const item = tip.for ? svg.current?.querySelector(`[data-map-item="${CSS.escape(tip.for)}"]`)?.getBoundingClientRect() : void 0;
|
|
67
|
+
const a = item ?? { left: tip.x, right: tip.x, top: tip.y, bottom: tip.y };
|
|
68
|
+
const gap = item ? 6 : 14;
|
|
69
|
+
const w = el.offsetWidth;
|
|
70
|
+
const h = el.offsetHeight;
|
|
71
|
+
let x = item ? a.left : a.right + gap;
|
|
72
|
+
if (x + w > right) x = item ? right - w : a.left - gap - w;
|
|
73
|
+
let y = a.bottom + gap;
|
|
74
|
+
if (y + h > bottom) y = a.top - gap - h;
|
|
75
|
+
x = Math.max(left, Math.min(x, right - w));
|
|
76
|
+
y = Math.max(top, Math.min(y, bottom - h));
|
|
77
|
+
el.style.left = `${x - wrap.left}px`;
|
|
78
|
+
el.style.top = `${y - wrap.top}px`;
|
|
79
|
+
};
|
|
80
|
+
useLayoutEffect(position);
|
|
81
|
+
const frame = {
|
|
82
|
+
item: (itemId, body) => ({
|
|
83
|
+
"data-map-item": itemId,
|
|
84
|
+
tabIndex: itemId === current ? 0 : -1,
|
|
85
|
+
"aria-describedby": tip?.for === itemId ? `${id}-tip` : void 0,
|
|
86
|
+
onFocus: (e) => {
|
|
87
|
+
setActive(itemId);
|
|
88
|
+
const r = e.currentTarget.getBoundingClientRect();
|
|
89
|
+
place(r.left + r.width / 2, r.top + r.height / 2, body, itemId);
|
|
90
|
+
},
|
|
91
|
+
onBlur: () => setTip(null),
|
|
92
|
+
onPointerMove: (e) => place(e.clientX, e.clientY, body),
|
|
93
|
+
onPointerLeave: () => setTip(null)
|
|
94
|
+
}),
|
|
95
|
+
hover: (body) => ({
|
|
96
|
+
onPointerMove: (e) => place(e.clientX, e.clientY, body),
|
|
97
|
+
onPointerLeave: () => setTip(null)
|
|
98
|
+
})
|
|
99
|
+
};
|
|
100
|
+
const keys = (e) => {
|
|
101
|
+
if (e.key === "Escape") return setTip(null);
|
|
102
|
+
const i = items.findIndex((x) => x.id === current);
|
|
103
|
+
const p = items[i];
|
|
104
|
+
if (!p) return;
|
|
105
|
+
const target = e.key === "ArrowDown" ? items[i + 1] : e.key === "ArrowUp" ? items[i - 1] : e.key === "ArrowRight" ? items.find((c) => c.parent === p.id) : e.key === "ArrowLeft" ? items.find((c) => c.id === p.parent) : e.key === "Home" ? items[0] : e.key === "End" ? items[items.length - 1] : void 0;
|
|
106
|
+
if (!target) return;
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
setActive(target.id);
|
|
109
|
+
svg.current?.querySelector(`[data-map-item="${CSS.escape(target.id)}"]`)?.focus();
|
|
110
|
+
};
|
|
111
|
+
return /* @__PURE__ */ jsxs("div", { ref: root, className: cx("signal-map", className), children: [
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "signal-map-tools", children: [
|
|
113
|
+
tools,
|
|
114
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", iconOnly: true, "aria-label": strings.zoomOut, tooltip: true, onClick: () => step(1 / 1.25), children: /* @__PURE__ */ jsx(Minus, { "aria-hidden": "true" }) }),
|
|
115
|
+
/* @__PURE__ */ jsxs(
|
|
116
|
+
Button,
|
|
117
|
+
{
|
|
118
|
+
variant: "ghost",
|
|
119
|
+
tooltip: strings.fit,
|
|
120
|
+
"aria-label": `${strings.fit}, ${percent}`,
|
|
121
|
+
"aria-pressed": zoom === "fit",
|
|
122
|
+
onClick: () => setZoom("fit"),
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ jsx(Maximize2, { "aria-hidden": "true" }),
|
|
125
|
+
percent
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", iconOnly: true, "aria-label": strings.zoomIn, tooltip: true, onClick: () => step(1.25), children: /* @__PURE__ */ jsx(Plus, { "aria-hidden": "true" }) })
|
|
130
|
+
] }),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
"div",
|
|
133
|
+
{
|
|
134
|
+
ref: box,
|
|
135
|
+
className: "signal-map-view",
|
|
136
|
+
onPointerDown: (e) => {
|
|
137
|
+
if (e.button !== 0 || e.target.closest("[data-map-item]")) return;
|
|
138
|
+
drag.current = { x: e.clientX, y: e.clientY, left: box.current.scrollLeft, top: box.current.scrollTop };
|
|
139
|
+
box.current.setPointerCapture(e.pointerId);
|
|
140
|
+
},
|
|
141
|
+
onPointerMove: (e) => {
|
|
142
|
+
if (!drag.current) return;
|
|
143
|
+
box.current.scrollLeft = drag.current.left - (e.clientX - drag.current.x);
|
|
144
|
+
box.current.scrollTop = drag.current.top - (e.clientY - drag.current.y);
|
|
145
|
+
},
|
|
146
|
+
onPointerUp: () => drag.current = null,
|
|
147
|
+
onPointerCancel: () => drag.current = null,
|
|
148
|
+
onPointerLeave: () => setTip((t) => t?.for ? t : null),
|
|
149
|
+
onScroll: () => tip?.for ? position() : tip && setTip(null),
|
|
150
|
+
children: /* @__PURE__ */ jsx(
|
|
151
|
+
"svg",
|
|
152
|
+
{
|
|
153
|
+
ref: svg,
|
|
154
|
+
className: "signal-map-svg",
|
|
155
|
+
width: width * scale,
|
|
156
|
+
height: height * scale,
|
|
157
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
158
|
+
role: "group",
|
|
159
|
+
"aria-label": label,
|
|
160
|
+
"aria-describedby": `${id}-hint`,
|
|
161
|
+
onKeyDown: keys,
|
|
162
|
+
children: children(frame)
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
tip && /* @__PURE__ */ jsx("div", { ref: tipEl, id: `${id}-tip`, role: "tooltip", className: "signal-tooltip signal-map-tip", children: tip.body }),
|
|
168
|
+
/* @__PURE__ */ jsx("p", { id: `${id}-hint`, className: "signal-sr-only", children: hint }),
|
|
169
|
+
after
|
|
170
|
+
] });
|
|
171
|
+
}
|
|
172
|
+
var clip = (s, n) => s.length > n ? `${s.slice(0, n - 1)}\u2026` : s;
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
MapFrame,
|
|
176
|
+
clip
|
|
177
|
+
};
|