@monster-orange/den-ui 0.5.1 → 0.7.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 (45) hide show
  1. package/README.md +515 -1
  2. package/bin/den-ui-parity.mjs +440 -0
  3. package/inventory/fonts-dir.cjs +8 -0
  4. package/inventory/fonts-dir.mjs +10 -0
  5. package/inventory/nav-inventory.d.ts +133 -0
  6. package/inventory/nav-inventory.js +839 -0
  7. package/inventory/reference/den-chromium-1280.json +5388 -0
  8. package/inventory/reference/den-chromium-390.json +3834 -0
  9. package/inventory/reference/den-webkit-1280.json +5388 -0
  10. package/inventory/reference/den-webkit-390.json +3834 -0
  11. package/package.json +40 -3
  12. package/src/busy-words.d.ts +2 -0
  13. package/src/busy-words.js +6 -0
  14. package/src/busy.css +155 -0
  15. package/src/busy.d.ts +80 -0
  16. package/src/busy.js +105 -35
  17. package/src/dialog.css +103 -0
  18. package/src/dialog.d.ts +44 -0
  19. package/src/dialog.js +95 -30
  20. package/src/icons.d.ts +4 -0
  21. package/src/icons.js +43 -0
  22. package/src/kit.d.ts +217 -0
  23. package/src/kit.js +299 -0
  24. package/src/marks/den.svg +6 -0
  25. package/src/report-shot.d.ts +47 -0
  26. package/src/report-shot.js +437 -0
  27. package/src/report.css +387 -0
  28. package/src/report.d.ts +61 -0
  29. package/src/report.js +909 -0
  30. package/src/shell-client.d.ts +149 -0
  31. package/src/shell-client.js +820 -0
  32. package/src/shell-html.d.ts +305 -0
  33. package/src/shell-html.js +903 -0
  34. package/src/shell.css +1010 -0
  35. package/src/strings.d.ts +18 -0
  36. package/src/strings.js +565 -0
  37. package/src/time.d.ts +18 -0
  38. package/src/time.js +14 -2
  39. package/src/tokens.css +81 -67
  40. package/src/update-pill.d.ts +17 -0
  41. package/src/version.d.ts +7 -0
  42. package/src/version.js +31 -0
  43. package/src/whatsnew.css +235 -0
  44. package/src/whatsnew.d.ts +36 -0
  45. package/src/whatsnew.js +411 -0
@@ -0,0 +1,18 @@
1
+ /** The kit's words: every key starts `kit.`; en, es and ja hold the same keys. */
2
+ export type Words = Record<string, string>;
3
+ export declare const en: Words;
4
+ export declare const es: Words;
5
+ export declare const ja: Words;
6
+ export declare const STRINGS: { en: Words; es: Words; ja: Words };
7
+ /** The name `{product}` fills in. */
8
+ export declare function setProduct(name: string): void;
9
+ /** A product's own words, or its versions of the kit's, for a language. */
10
+ export declare function addStrings(lang: string, table: Words): void;
11
+ /** The word for `key` in `lang` (else en, else the key), vars filled in. */
12
+ export declare function kitT(
13
+ lang: string | undefined,
14
+ key: string,
15
+ vars?: Record<string, string | number>,
16
+ ): string;
17
+ /** HTML-escaped text. */
18
+ export declare function esc(v: unknown): string;
package/src/strings.js ADDED
@@ -0,0 +1,565 @@
1
+ /**
2
+ * den-ui strings: every word the kit shows, in en, es and ja, keyed
3
+ * "kit.<component>.<word>". Pure data plus a lookup: it runs in Node too,
4
+ * so a server can render the kit in the right language from the first
5
+ * byte. A product adds or overrides words with addStrings(lang, table)
6
+ * (DenUI.strings(lang, table) in the page).
7
+ *
8
+ * {name} a var; a number is formatted for the language
9
+ * key.one the form for n where Intl.PluralRules says "one"
10
+ * {product} the product name (setProduct, or vars.product)
11
+ *
12
+ * tests/unit/den-ui/strings-kit.test.ts fails when a language lacks a key.
13
+ */
14
+ export const en = {
15
+ "kit.update.msg": "A new version of {product} is available.",
16
+ "kit.update.reload": "Reload",
17
+ "kit.update.notNow": "Not now",
18
+ "kit.update.cancel": "Cancel",
19
+ "kit.update.ask": "You have unsaved text on this page. Reload anyway?",
20
+ "kit.update.region": "Update",
21
+ "kit.skip": "Skip to content",
22
+ "kit.menu": "Menu",
23
+ "kit.scope": "Scope",
24
+ "kit.search.ph": "Search…",
25
+ "kit.search.label": "Search",
26
+ "kit.bell": "Notifications",
27
+ "kit.bell.n": "Notifications: {n} unread",
28
+ "kit.bell.empty": "Nothing new.",
29
+ "kit.settings": "Settings",
30
+ "kit.appearance": "Appearance",
31
+ "kit.appearance.title": "Appearance and theme",
32
+ "kit.mode.system": "System",
33
+ "kit.mode.dark": "Dark",
34
+ "kit.mode.light": "Light",
35
+ "kit.theme": "Theme",
36
+ "kit.language": "Language",
37
+ "kit.menu.filter": "Filter {label}",
38
+ "kit.menu.filter.ph": "Filter…",
39
+ "kit.menu.none": "No match",
40
+ "kit.pages": "Pages",
41
+ "kit.collapse": "Collapse",
42
+ "kit.expand": "Expand",
43
+ "kit.from": "from {d}",
44
+ "kit.report.word": "Report",
45
+ "kit.report.tip": "Report an issue (⌘⇧F)",
46
+ "kit.version.title": "View changelog",
47
+ "kit.pin.pinX": "Pin {s}",
48
+ "kit.pin.unpinX": "Unpin {s}",
49
+ "kit.whatsnew.title": "What's new",
50
+ "kit.whatsnew.close": "Close",
51
+ "kit.whatsnew.gotIt": "Got it",
52
+ "kit.whatsnew.none": "No entries found.",
53
+ "kit.whatsnew.copyMd": "Copy as Markdown",
54
+ "kit.whatsnew.copyMdX": "Copy v{v} as Markdown",
55
+ "kit.whatsnew.copySlack": "Copy for Slack",
56
+ "kit.whatsnew.copySlackX": "Copy v{v} for Slack",
57
+ "kit.whatsnew.copyFailed": "Copy failed — try again",
58
+ "kit.whatsnew.latest": "Show latest only",
59
+ "kit.whatsnew.all": "Show all versions ({n} earlier)",
60
+ "kit.whatsnew.all.one": "Show all versions ({n} earlier)",
61
+ "kit.report.title": "Report an issue",
62
+ "kit.report.sub":
63
+ "Tell us what is wrong, or what you wish {product} did. It becomes a GitHub issue, filed as you.",
64
+ "kit.report.step1": "1 Write",
65
+ "kit.report.step2": "2 Include",
66
+ "kit.report.step3": "3 Review and send",
67
+ "kit.report.stepOf": "{i}/{n}",
68
+ "kit.report.kind": "What is it?",
69
+ "kit.report.k.bug": "Bug",
70
+ "kit.report.k.idea": "Idea",
71
+ "kit.report.k.question": "Question",
72
+ "kit.report.titleL": "Title",
73
+ "kit.report.desc": "What happened, and what did you expect?",
74
+ "kit.report.shot": "Screenshot of this page",
75
+ "kit.report.ncap":
76
+ "This page couldn't be captured. You can send the report without a screenshot.",
77
+ "kit.report.shotNote":
78
+ "Includes the open dialog or drawer. Drag on it to black out anything private.",
79
+ "kit.report.nos": "Don't include a screenshot",
80
+ "kit.report.undo": "Undo",
81
+ "kit.report.masks": "{n} areas hidden",
82
+ "kit.report.masks.one": "{n} area hidden",
83
+ "kit.report.kbdMask": "Mask by size and position",
84
+ "kit.report.mx": "Left %",
85
+ "kit.report.my": "Top %",
86
+ "kit.report.mw": "Width %",
87
+ "kit.report.mh": "Height %",
88
+ "kit.report.addMask": "Add area",
89
+ "kit.report.maskAll": "Mask the whole screenshot",
90
+ "kit.report.rmMask": "Remove",
91
+ "kit.report.area": "{x}% from the left, {y}% from the top, {w}% × {h}%",
92
+ "kit.report.revShot": "Screenshot after masking ({n} areas hidden)",
93
+ "kit.report.revShot.one": "Screenshot after masking ({n} area hidden)",
94
+ "kit.report.sentShot":
95
+ "The screenshot is saved and copied: paste it into the issue.",
96
+ "kit.report.sentShotSaved":
97
+ "The screenshot is saved as a file: add it to the issue.",
98
+ "kit.report.mine": "My reports",
99
+ "kit.report.next": "Next: Include",
100
+ "kit.report.back": "Back",
101
+ "kit.report.send": "Send as a GitHub issue",
102
+ "kit.report.later": "Finish later",
103
+ "kit.report.cancel": "Cancel",
104
+ "kit.report.dest": "Goes to",
105
+ "kit.report.pub": "Public repository",
106
+ "kit.report.pubW":
107
+ "Screenshots and text are visible to everyone. Mask anything private.",
108
+ "kit.report.incH": "What goes with your report",
109
+ "kit.report.incN":
110
+ "Each part says how {product} uses it. Secrets, tokens, emails, IP addresses and store references are always removed, whatever is ticked.",
111
+ "kit.report.all": "Include all",
112
+ "kit.report.none": "Include none",
113
+ "kit.report.remember": "Remember my choices",
114
+ "kit.report.redact":
115
+ "Redact names (companies, projects, repos, services) as <org-1>, <repo-1> …",
116
+ "kit.report.dgi": "How {product} uses this",
117
+ "kit.report.sec.Den": "{product}",
118
+ "kit.report.sec.Browser": "Browser",
119
+ "kit.report.sec.Machine": "Machine",
120
+ "kit.report.sec.Page": "Page",
121
+ "kit.report.use.Den":
122
+ "Which version you run, to find the change that caused it.",
123
+ "kit.report.use.Browser": "The browser and window size, to see it as you do.",
124
+ "kit.report.use.Machine": "The system it runs on, never who or where.",
125
+ "kit.report.use.Page": "Which page and dialog were open.",
126
+ "kit.report.revH": "Review: this is exactly what will be posted",
127
+ "kit.report.siH": "Sign in with GitHub to send",
128
+ "kit.report.siB":
129
+ "Reports are filed as you, so GitHub's replies reach you. {product} shows a code; enter it at github.com/login/device. This is not {product}'s own sign-in.",
130
+ "kit.report.noApp":
131
+ "Sending needs GitHub. Save it with Finish later, or file it in a GitHub tab.",
132
+ "kit.report.open": "Open github.com/login/device",
133
+ "kit.report.codeL": "Your code",
134
+ "kit.report.waiting": "Waiting for you to approve in GitHub…",
135
+ "kit.report.siAlt": "Or open a new GitHub tab with the report filled in.",
136
+ "kit.report.siAltLink": "Open a filled-in GitHub tab",
137
+ "kit.report.expired":
138
+ "The code expired before it was approved. Nothing was sent.",
139
+ "kit.report.denied": "GitHub sign-in was cancelled. Nothing was sent.",
140
+ "kit.report.dupH": "A report with this title is already open",
141
+ "kit.report.dupB":
142
+ "“{title}” is already open. Add your details to it instead of opening a second one?",
143
+ "kit.report.addTo": "Add to the existing report",
144
+ "kit.report.fileNew": "File a new report",
145
+ "kit.report.sentH": "Report sent",
146
+ "kit.report.sentB": "Your report is a GitHub issue now: “{title}”.",
147
+ "kit.report.addedB": "Your details were added to the open report.",
148
+ "kit.report.openIssue": "Open the issue",
149
+ "kit.report.done": "Done",
150
+ "kit.report.limH": "You have sent {n} reports this hour",
151
+ "kit.report.limB":
152
+ "Try again in {min} minutes. Your report is not lost: save it with Finish later and send it then.",
153
+ "kit.report.latH": "Saved. Nothing was sent.",
154
+ "kit.report.latB":
155
+ "It is saved on this computer with your text, choices and screenshot. Find it under My reports, at the top of Report an issue or in the command palette.",
156
+ "kit.report.failH": "Not sent",
157
+ "kit.report.retry": "Try again",
158
+ "kit.report.keepH": "Keep what you wrote?",
159
+ "kit.report.keep": "Keep it (Finish later)",
160
+ "kit.report.discard": "Discard",
161
+ "kit.report.needTitle": "A title is needed.",
162
+ "kit.report.filed": "Filed as #{n}",
163
+ "kit.report.copy": "Copy report",
164
+ "kit.report.copied": "Copied. Paste it where your team tracks issues.",
165
+ "kit.report.copyFailed":
166
+ "Could not copy. Select the text and copy it yourself.",
167
+ "kit.report.copyH": "Copy the report",
168
+ };
169
+
170
+ export const es = {
171
+ "kit.update.msg": "Hay una nueva versión de {product}.",
172
+ "kit.update.reload": "Recargar",
173
+ "kit.update.notNow": "Ahora no",
174
+ "kit.update.cancel": "Cancelar",
175
+ "kit.update.ask":
176
+ "Tienes texto sin guardar en esta página. ¿Recargar igualmente?",
177
+ "kit.update.region": "Actualización",
178
+ "kit.skip": "Saltar al contenido",
179
+ "kit.menu": "Menú",
180
+ "kit.scope": "Ámbito",
181
+ "kit.search.ph": "Buscar…",
182
+ "kit.search.label": "Buscar",
183
+ "kit.bell": "Notificaciones",
184
+ "kit.bell.n": "Notificaciones: {n} sin leer",
185
+ "kit.bell.empty": "Nada nuevo.",
186
+ "kit.settings": "Ajustes",
187
+ "kit.appearance": "Apariencia",
188
+ "kit.appearance.title": "Apariencia y tema",
189
+ "kit.mode.system": "Sistema",
190
+ "kit.mode.dark": "Oscuro",
191
+ "kit.mode.light": "Claro",
192
+ "kit.theme": "Tema",
193
+ "kit.language": "Idioma",
194
+ "kit.menu.filter": "Filtrar {label}",
195
+ "kit.menu.filter.ph": "Filtrar…",
196
+ "kit.menu.none": "Sin coincidencias",
197
+ "kit.pages": "Páginas",
198
+ "kit.collapse": "Contraer",
199
+ "kit.expand": "Expandir",
200
+ "kit.from": "de {d}",
201
+ "kit.report.word": "Informar",
202
+ "kit.report.tip": "Informar de un problema (⌘⇧F)",
203
+ "kit.version.title": "Ver el registro de cambios",
204
+ "kit.pin.pinX": "Fijar {s}",
205
+ "kit.pin.unpinX": "Quitar {s}",
206
+ "kit.whatsnew.title": "Novedades",
207
+ "kit.whatsnew.close": "Cerrar",
208
+ "kit.whatsnew.gotIt": "Entendido",
209
+ "kit.whatsnew.none": "No hay entradas.",
210
+ "kit.whatsnew.copyMd": "Copiar como Markdown",
211
+ "kit.whatsnew.copyMdX": "Copiar v{v} como Markdown",
212
+ "kit.whatsnew.copySlack": "Copiar para Slack",
213
+ "kit.whatsnew.copySlackX": "Copiar v{v} para Slack",
214
+ "kit.whatsnew.copyFailed": "No se pudo copiar; inténtalo de nuevo",
215
+ "kit.whatsnew.latest": "Mostrar solo la última",
216
+ "kit.whatsnew.all": "Mostrar todas las versiones ({n} anteriores)",
217
+ "kit.whatsnew.all.one": "Mostrar todas las versiones ({n} anterior)",
218
+ "kit.report.title": "Informar de un problema",
219
+ "kit.report.sub":
220
+ "Cuéntanos qué falla, o qué te gustaría que hiciera {product}. Se convierte en una incidencia de GitHub, a tu nombre.",
221
+ "kit.report.step1": "1 Escribir",
222
+ "kit.report.step2": "2 Incluir",
223
+ "kit.report.step3": "3 Revisar y enviar",
224
+ "kit.report.stepOf": "{i}/{n}",
225
+ "kit.report.kind": "¿Qué es?",
226
+ "kit.report.k.bug": "Error",
227
+ "kit.report.k.idea": "Idea",
228
+ "kit.report.k.question": "Pregunta",
229
+ "kit.report.titleL": "Título",
230
+ "kit.report.desc": "¿Qué pasó y qué esperabas?",
231
+ "kit.report.shot": "Captura de esta página",
232
+ "kit.report.ncap":
233
+ "No se pudo capturar esta página. Puedes enviar el informe sin captura.",
234
+ "kit.report.shotNote":
235
+ "Incluye el diálogo o panel abierto. Arrastra sobre ella para tapar lo privado.",
236
+ "kit.report.nos": "No incluir captura",
237
+ "kit.report.undo": "Deshacer",
238
+ "kit.report.masks": "{n} zonas tapadas",
239
+ "kit.report.masks.one": "{n} zona tapada",
240
+ "kit.report.kbdMask": "Tapar por tamaño y posición",
241
+ "kit.report.mx": "Izquierda %",
242
+ "kit.report.my": "Arriba %",
243
+ "kit.report.mw": "Ancho %",
244
+ "kit.report.mh": "Alto %",
245
+ "kit.report.addMask": "Añadir zona",
246
+ "kit.report.maskAll": "Tapar toda la captura",
247
+ "kit.report.rmMask": "Quitar",
248
+ "kit.report.area": "{x}% desde la izquierda, {y}% desde arriba, {w}% × {h}%",
249
+ "kit.report.revShot": "Captura tras ocultar ({n} zonas tapadas)",
250
+ "kit.report.revShot.one": "Captura tras ocultar ({n} zona tapada)",
251
+ "kit.report.sentShot":
252
+ "La captura está guardada y copiada: pégala en la incidencia.",
253
+ "kit.report.sentShotSaved":
254
+ "La captura está guardada como archivo: añádela a la incidencia.",
255
+ "kit.report.mine": "Mis informes",
256
+ "kit.report.next": "Siguiente: Incluir",
257
+ "kit.report.back": "Atrás",
258
+ "kit.report.send": "Enviar como incidencia de GitHub",
259
+ "kit.report.later": "Terminar luego",
260
+ "kit.report.cancel": "Cancelar",
261
+ "kit.report.dest": "Va a",
262
+ "kit.report.pub": "Repositorio público",
263
+ "kit.report.pubW":
264
+ "Las capturas y el texto los ve todo el mundo. Tapa lo que sea privado.",
265
+ "kit.report.incH": "Qué va con tu informe",
266
+ "kit.report.incN":
267
+ "Cada parte explica cómo la usa {product}. Los secretos, tokens, correos, direcciones IP y referencias a almacenes se quitan siempre, esté lo que esté marcado.",
268
+ "kit.report.all": "Incluir todo",
269
+ "kit.report.none": "No incluir nada",
270
+ "kit.report.remember": "Recordar mis elecciones",
271
+ "kit.report.redact":
272
+ "Ocultar nombres (empresas, proyectos, repos, servicios) como <org-1>, <repo-1> …",
273
+ "kit.report.dgi": "Cómo usa {product} esto",
274
+ "kit.report.sec.Den": "{product}",
275
+ "kit.report.sec.Browser": "Navegador",
276
+ "kit.report.sec.Machine": "Máquina",
277
+ "kit.report.sec.Page": "Página",
278
+ "kit.report.use.Den":
279
+ "Qué versión usas, para encontrar el cambio que lo causó.",
280
+ "kit.report.use.Browser":
281
+ "El navegador y el tamaño de la ventana, para verlo como tú.",
282
+ "kit.report.use.Machine":
283
+ "El sistema en el que funciona, nunca quién ni dónde.",
284
+ "kit.report.use.Page": "Qué página y qué diálogo estaban abiertos.",
285
+ "kit.report.revH": "Revisión: esto es exactamente lo que se publicará",
286
+ "kit.report.siH": "Inicia sesión en GitHub para enviar",
287
+ "kit.report.siB":
288
+ "Los informes se registran a tu nombre, así que las respuestas de GitHub te llegan a ti. {product} muestra un código; introdúcelo en github.com/login/device. Esto no es el inicio de sesión de {product}.",
289
+ "kit.report.noApp":
290
+ "Para enviar hace falta GitHub. Guárdalo con Terminar luego, o regístralo en una pestaña de GitHub.",
291
+ "kit.report.open": "Abrir github.com/login/device",
292
+ "kit.report.codeL": "Tu código",
293
+ "kit.report.waiting": "Esperando a que lo apruebes en GitHub…",
294
+ "kit.report.siAlt":
295
+ "O abre una pestaña nueva de GitHub con el informe rellenado.",
296
+ "kit.report.siAltLink": "Abrir una pestaña de GitHub rellenada",
297
+ "kit.report.expired":
298
+ "El código caducó antes de aprobarse. No se envió nada.",
299
+ "kit.report.denied":
300
+ "Se canceló el inicio de sesión en GitHub. No se envió nada.",
301
+ "kit.report.dupH": "Ya hay un informe abierto con este título",
302
+ "kit.report.dupB":
303
+ "«{title}» ya está abierto. ¿Añadir tus detalles a ese en lugar de abrir un segundo?",
304
+ "kit.report.addTo": "Añadir al informe existente",
305
+ "kit.report.fileNew": "Abrir un informe nuevo",
306
+ "kit.report.sentH": "Informe enviado",
307
+ "kit.report.sentB": "Tu informe ya es una incidencia de GitHub: «{title}».",
308
+ "kit.report.addedB": "Tus detalles se añadieron al informe abierto.",
309
+ "kit.report.openIssue": "Abrir la incidencia",
310
+ "kit.report.done": "Hecho",
311
+ "kit.report.limH": "Has enviado {n} informes esta hora",
312
+ "kit.report.limB":
313
+ "Inténtalo de nuevo en {min} minutos. Tu informe no se pierde: guárdalo con Terminar luego y envíalo entonces.",
314
+ "kit.report.latH": "Guardado. No se envió nada.",
315
+ "kit.report.latB":
316
+ "Está guardado en este ordenador con tu texto, tus elecciones y la captura. Lo encontrarás en Mis informes, arriba en Informar de un problema o en la paleta de comandos.",
317
+ "kit.report.failH": "No enviado",
318
+ "kit.report.retry": "Intentar de nuevo",
319
+ "kit.report.keepH": "¿Conservar lo que escribiste?",
320
+ "kit.report.keep": "Conservarlo (Terminar luego)",
321
+ "kit.report.discard": "Descartar",
322
+ "kit.report.needTitle": "Hace falta un título.",
323
+ "kit.report.filed": "Registrado como #{n}",
324
+ "kit.report.copy": "Copiar el informe",
325
+ "kit.report.copied": "Copiado. Pégalo donde tu equipo sigue las incidencias.",
326
+ "kit.report.copyFailed":
327
+ "No se pudo copiar. Selecciona el texto y cópialo tú.",
328
+ "kit.report.copyH": "Copia el informe",
329
+ };
330
+
331
+ export const ja = {
332
+ "kit.update.msg": "{product} の新しいバージョンがあります。",
333
+ "kit.update.reload": "再読み込み",
334
+ "kit.update.notNow": "後で",
335
+ "kit.update.cancel": "キャンセル",
336
+ "kit.update.ask":
337
+ "このページに保存していないテキストがあります。それでも再読み込みしますか?",
338
+ "kit.update.region": "更新",
339
+ "kit.skip": "本文へ移動",
340
+ "kit.menu": "メニュー",
341
+ "kit.scope": "スコープ",
342
+ "kit.search.ph": "検索…",
343
+ "kit.search.label": "検索",
344
+ "kit.bell": "通知",
345
+ "kit.bell.n": "通知: 未読 {n} 件",
346
+ "kit.bell.empty": "新しいものはありません。",
347
+ "kit.settings": "設定",
348
+ "kit.appearance": "外観",
349
+ "kit.appearance.title": "外観とテーマ",
350
+ "kit.mode.system": "システム",
351
+ "kit.mode.dark": "ダーク",
352
+ "kit.mode.light": "ライト",
353
+ "kit.theme": "テーマ",
354
+ "kit.language": "言語",
355
+ "kit.menu.filter": "{label}を絞り込む",
356
+ "kit.menu.filter.ph": "絞り込み…",
357
+ "kit.menu.none": "一致なし",
358
+ "kit.pages": "ページ",
359
+ "kit.collapse": "折りたたむ",
360
+ "kit.expand": "展開する",
361
+ "kit.from": "{d} から",
362
+ "kit.report.word": "報告",
363
+ "kit.report.tip": "問題を報告 (⌘⇧F)",
364
+ "kit.version.title": "変更履歴を見る",
365
+ "kit.pin.pinX": "{s} をピン留め",
366
+ "kit.pin.unpinX": "{s} のピン留めを外す",
367
+ "kit.whatsnew.title": "新着情報",
368
+ "kit.whatsnew.close": "閉じる",
369
+ "kit.whatsnew.gotIt": "OK",
370
+ "kit.whatsnew.none": "項目がありません。",
371
+ "kit.whatsnew.copyMd": "Markdown としてコピー",
372
+ "kit.whatsnew.copyMdX": "v{v} を Markdown としてコピー",
373
+ "kit.whatsnew.copySlack": "Slack 用にコピー",
374
+ "kit.whatsnew.copySlackX": "v{v} を Slack 用にコピー",
375
+ "kit.whatsnew.copyFailed": "コピーに失敗しました。もう一度お試しください",
376
+ "kit.whatsnew.latest": "最新のみ表示",
377
+ "kit.whatsnew.all": "すべてのバージョンを表示 (以前のもの {n} 件)",
378
+ "kit.report.title": "問題を報告",
379
+ "kit.report.sub":
380
+ "困っていること、{product} にしてほしいことを教えてください。あなた名義の GitHub の issue になります。",
381
+ "kit.report.step1": "1 書く",
382
+ "kit.report.step2": "2 含める",
383
+ "kit.report.step3": "3 確認して送る",
384
+ "kit.report.stepOf": "{i}/{n}",
385
+ "kit.report.kind": "種類",
386
+ "kit.report.k.bug": "不具合",
387
+ "kit.report.k.idea": "アイデア",
388
+ "kit.report.k.question": "質問",
389
+ "kit.report.titleL": "タイトル",
390
+ "kit.report.desc": "何が起きましたか。どうなってほしかったですか。",
391
+ "kit.report.shot": "このページのスクリーンショット",
392
+ "kit.report.ncap":
393
+ "このページは撮影できませんでした。スクリーンショットなしで送れます。",
394
+ "kit.report.shotNote":
395
+ "開いているダイアログやドロワーも入ります。ドラッグして、見せたくない部分を黒く塗れます。",
396
+ "kit.report.nos": "スクリーンショットを含めない",
397
+ "kit.report.undo": "元に戻す",
398
+ "kit.report.masks": "{n} か所を非表示",
399
+ "kit.report.kbdMask": "大きさと位置でマスク",
400
+ "kit.report.mx": "左 %",
401
+ "kit.report.my": "上 %",
402
+ "kit.report.mw": "幅 %",
403
+ "kit.report.mh": "高さ %",
404
+ "kit.report.addMask": "範囲を追加",
405
+ "kit.report.maskAll": "スクリーンショット全体をマスク",
406
+ "kit.report.rmMask": "削除",
407
+ "kit.report.area": "左から {x}%、上から {y}%、{w}% × {h}%",
408
+ "kit.report.revShot": "マスク後のスクリーンショット({n} か所を非表示)",
409
+ "kit.report.sentShot":
410
+ "スクリーンショットは保存してコピーしました。issue に貼り付けてください。",
411
+ "kit.report.sentShotSaved":
412
+ "スクリーンショットはファイルとして保存しました。issue に追加してください。",
413
+ "kit.report.mine": "自分の報告",
414
+ "kit.report.next": "次へ: 含める",
415
+ "kit.report.back": "戻る",
416
+ "kit.report.send": "GitHub の issue として送る",
417
+ "kit.report.later": "あとで仕上げる",
418
+ "kit.report.cancel": "キャンセル",
419
+ "kit.report.dest": "送り先",
420
+ "kit.report.pub": "公開リポジトリ",
421
+ "kit.report.pubW":
422
+ "スクリーンショットとテキストは誰でも見られます。見せたくない部分は隠してください。",
423
+ "kit.report.incH": "報告に添えるもの",
424
+ "kit.report.incN":
425
+ "各項目に、{product} がどう使うかを書いています。秘密、トークン、メール、IP アドレス、ストアの参照は、チェックに関係なく常に取り除かれます。",
426
+ "kit.report.all": "すべて含める",
427
+ "kit.report.none": "何も含めない",
428
+ "kit.report.remember": "選択を覚えておく",
429
+ "kit.report.redact":
430
+ "名前(会社、プロジェクト、リポジトリ、サービス)を <org-1>、<repo-1> … に置き換える",
431
+ "kit.report.dgi": "{product} はこれをこう使います",
432
+ "kit.report.sec.Den": "{product}",
433
+ "kit.report.sec.Browser": "ブラウザ",
434
+ "kit.report.sec.Machine": "マシン",
435
+ "kit.report.sec.Page": "ページ",
436
+ "kit.report.use.Den": "どのバージョンかを見て、原因になった変更を探します。",
437
+ "kit.report.use.Browser":
438
+ "ブラウザと画面の大きさを見て、同じ状態を再現します。",
439
+ "kit.report.use.Machine":
440
+ "動いているシステムです。誰か、どこかは含みません。",
441
+ "kit.report.use.Page": "どのページとダイアログが開いていたか。",
442
+ "kit.report.revH": "確認: 投稿される内容そのままです",
443
+ "kit.report.siH": "送るには GitHub にサインインしてください",
444
+ "kit.report.siB":
445
+ "報告はあなた名義で作られるので、GitHub の返信があなたに届きます。{product} がコードを表示するので、github.com/login/device で入力してください。これは {product} 自身のサインインではありません。",
446
+ "kit.report.noApp":
447
+ "送るには GitHub が必要です。「あとで仕上げる」で保存するか、GitHub のタブで作成してください。",
448
+ "kit.report.open": "github.com/login/device を開く",
449
+ "kit.report.codeL": "あなたのコード",
450
+ "kit.report.waiting": "GitHub での承認を待っています…",
451
+ "kit.report.siAlt":
452
+ "または、報告を入力済みの GitHub の新しいタブを開きます。",
453
+ "kit.report.siAltLink": "入力済みの GitHub タブを開く",
454
+ "kit.report.expired":
455
+ "承認される前にコードの期限が切れました。何も送っていません。",
456
+ "kit.report.denied":
457
+ "GitHub のサインインが取り消されました。何も送っていません。",
458
+ "kit.report.dupH": "同じタイトルの報告がすでに開いています",
459
+ "kit.report.dupB":
460
+ "「{title}」はすでに開いています。2つ目を作る代わりに、そこに内容を追加しますか。",
461
+ "kit.report.addTo": "既存の報告に追加",
462
+ "kit.report.fileNew": "新しい報告を作る",
463
+ "kit.report.sentH": "報告を送りました",
464
+ "kit.report.sentB": "報告は GitHub の issue になりました:「{title}」。",
465
+ "kit.report.addedB": "開いている報告に内容を追加しました。",
466
+ "kit.report.openIssue": "issue を開く",
467
+ "kit.report.done": "完了",
468
+ "kit.report.limH": "この1時間に {n} 件の報告を送りました",
469
+ "kit.report.limB":
470
+ "{min} 分後にもう一度お試しください。報告は消えません。「あとで仕上げる」で保存し、そのときに送れます。",
471
+ "kit.report.latH": "保存しました。何も送っていません。",
472
+ "kit.report.latB":
473
+ "テキスト、選択、スクリーンショットごと、このコンピューターに保存しました。「問題を報告」の上部かコマンドパレットの「自分の報告」にあります。",
474
+ "kit.report.failH": "送れませんでした",
475
+ "kit.report.retry": "もう一度試す",
476
+ "kit.report.keepH": "書いた内容を残しますか。",
477
+ "kit.report.keep": "残す(あとで仕上げる)",
478
+ "kit.report.discard": "破棄",
479
+ "kit.report.needTitle": "タイトルが必要です。",
480
+ "kit.report.filed": "#{n} として登録しました",
481
+ "kit.report.copy": "報告をコピー",
482
+ "kit.report.copied":
483
+ "コピーしました。チームが課題を管理している場所に貼り付けてください。",
484
+ "kit.report.copyFailed":
485
+ "コピーできませんでした。テキストを選んでコピーしてください。",
486
+ "kit.report.copyH": "報告をコピー",
487
+ };
488
+
489
+ /** The kit's tables, by language (en is the fallback for any key). */
490
+ export const STRINGS = { en, es, ja };
491
+
492
+ /** What a product added (addStrings), by language. */
493
+ const added = {};
494
+ let productName = "";
495
+
496
+ /** The product name {product} fills in (Den, say). */
497
+ export function setProduct(name) {
498
+ productName = String(name ?? "");
499
+ }
500
+
501
+ /**
502
+ * A product's own words, or its own versions of the kit's, for `lang`:
503
+ * { key: text }. Later calls add to earlier ones.
504
+ */
505
+ export function addStrings(lang, table) {
506
+ if (!lang || !table || typeof table !== "object") return;
507
+ added[lang] = Object.assign(added[lang] || {}, table);
508
+ }
509
+
510
+ const has = (t, k) => !!t && Object.prototype.hasOwnProperty.call(t, k);
511
+
512
+ function pluralOf(lang, n) {
513
+ try {
514
+ return new Intl.PluralRules(lang).select(n);
515
+ } catch {
516
+ return n === 1 ? "one" : "other";
517
+ }
518
+ }
519
+
520
+ function num(lang, n) {
521
+ try {
522
+ return new Intl.NumberFormat(lang).format(n);
523
+ } catch {
524
+ return String(n);
525
+ }
526
+ }
527
+
528
+ function lookup(lang, key, vars) {
529
+ for (const t of [added[lang], STRINGS[lang]]) {
530
+ if (!has(t, key)) continue;
531
+ if (vars && typeof vars.n === "number") {
532
+ const form = `${key}.${pluralOf(lang, vars.n)}`;
533
+ if (has(t, form)) return t[form];
534
+ }
535
+ return t[key];
536
+ }
537
+ return null;
538
+ }
539
+
540
+ /** The word for `key` in `lang` (else en, else the key), vars filled in. */
541
+ export function kitT(lang, key, vars) {
542
+ const l = has(STRINGS, lang) || has(added, lang) ? lang : "en";
543
+ let s = lookup(l, key, vars);
544
+ if (s == null && l !== "en") s = lookup("en", key, vars);
545
+ if (s == null) s = key;
546
+ const all = { product: productName, ...(vars || {}) };
547
+ return String(s).replace(/\{(\w+)\}/g, (m, k) =>
548
+ all[k] == null || all[k] === ""
549
+ ? m
550
+ : typeof all[k] === "number"
551
+ ? num(l, all[k])
552
+ : String(all[k]),
553
+ );
554
+ }
555
+
556
+ /** HTML-escaped text (for attributes and content). */
557
+ export function esc(v) {
558
+ return String(v == null ? "" : v).replace(
559
+ /[&<>"']/g,
560
+ (c) =>
561
+ ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[
562
+ c
563
+ ],
564
+ );
565
+ }
package/src/time.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ export interface TimeOptions {
2
+ style?: "datetime" | "date" | "time" | "relative";
3
+ seconds?: boolean;
4
+ /** An IANA zone (default: <html data-den-tz>, setTimeZone's, the browser's). */
5
+ zone?: string | null;
6
+ locale?: string;
7
+ now?: Date | number | string;
8
+ }
9
+ export type Stamp = Date | string | number | null | undefined;
10
+ export declare function browserTimeZone(): string;
11
+ export declare function timeZones(): string[];
12
+ export declare function isTimeZone(zone: unknown): boolean;
13
+ export declare function setTimeZone(zone: string | null | undefined): void;
14
+ export declare function currentTimeZone(zone?: string | null): string;
15
+ export declare function formatTime(iso: Stamp, opts?: TimeOptions): string;
16
+ export declare function formatTitle(iso: Stamp, opts?: TimeOptions): string;
17
+ export declare function timeHtml(iso: Stamp, opts?: TimeOptions): string;
18
+ export declare function upgradeTimes(root?: ParentNode | null): void;
package/src/time.js CHANGED
@@ -19,7 +19,8 @@
19
19
  * opts.zone an IANA zone. Else <html data-den-tz> (a page), else
20
20
  * setTimeZone's value, else the browser's (or process's).
21
21
  * opts.locale else <html lang> (in the browser's variant of it), else
22
- * the browser's.
22
+ * the browser's. upgradeTimes uses the nearest [lang] around
23
+ * each <time> first.
23
24
  * opts.now ms or ISO: "now" for relative and the year rule (tests,
24
25
  * server use).
25
26
  *
@@ -93,11 +94,15 @@ export function currentTimeZone(zone) {
93
94
  */
94
95
  function currentLocale(locale) {
95
96
  if (locale) return locale;
97
+ return localeOf(hasDoc() ? document.documentElement.lang : "");
98
+ }
99
+
100
+ /** A lang attribute's value as a locale, in the browser's variant of it. */
101
+ function localeOf(lang) {
96
102
  const nav =
97
103
  typeof navigator !== "undefined" && navigator.language
98
104
  ? navigator.language
99
105
  : undefined;
100
- const lang = hasDoc() ? document.documentElement.lang : "";
101
106
  if (!lang) return nav;
102
107
  if (nav && !lang.includes("-") && nav.split("-")[0] === lang) return nav;
103
108
  return lang;
@@ -234,6 +239,13 @@ export function upgradeTimes(root) {
234
239
  style: el.getAttribute("data-den-time"),
235
240
  seconds: el.hasAttribute("data-den-seconds"),
236
241
  };
242
+ // The language of the part the time sits in (a row still in English
243
+ // on a translated page reads in English), then the page's, then the
244
+ // browser's.
245
+ const near = typeof el.closest === "function" ? el.closest("[lang]") : null;
246
+ const page = hasDoc() ? document.documentElement : null;
247
+ if (near && near !== page)
248
+ opts.locale = localeOf(near.getAttribute("lang"));
237
249
  const text = formatTime(iso, opts);
238
250
  if (!text) continue;
239
251
  el.textContent = text;