@k2b/ui 0.60.0 → 0.61.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/dist/browser/chat/ChatPrimitives.js +435 -420
- package/dist/browser/chat/ChatPrimitives.js.map +1 -1
- package/dist/browser/chat/ChatTasks.js +78 -73
- package/dist/browser/chat/ChatTasks.js.map +1 -1
- package/dist/browser/chat/ChatTimeline.js +3 -0
- package/dist/browser/chat/ChatTimeline.js.map +1 -1
- package/dist/browser/content/Lightbox.js +31 -11
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/PdfPages.js +26 -1
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/RunLog.js +719 -0
- package/dist/browser/content/RunLog.js.map +1 -0
- package/dist/browser/content/index.js +1 -0
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/run-log-messages.js +134 -0
- package/dist/browser/content/run-log-messages.js.map +1 -0
- package/dist/browser/feedback/toast.js +11 -1
- package/dist/browser/feedback/toast.js.map +1 -1
- package/dist/browser/internal/step-row.js +78 -0
- package/dist/browser/internal/step-row.js.map +1 -0
- package/dist/browser/layout/PullToRefresh.js +76 -23
- package/dist/browser/layout/PullToRefresh.js.map +1 -1
- package/dist/browser/layout/refresh-messages.js +4 -2
- package/dist/browser/layout/refresh-messages.js.map +1 -1
- package/dist/ssr/chat/ChatPrimitives.js +109 -71
- package/dist/ssr/chat/ChatPrimitives.js.map +1 -1
- package/dist/ssr/chat/ChatTasks.js +31 -16
- package/dist/ssr/chat/ChatTasks.js.map +1 -1
- package/dist/ssr/chat/ChatTimeline.js +3 -0
- package/dist/ssr/chat/ChatTimeline.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +31 -11
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +26 -1
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/RunLog.js +471 -0
- package/dist/ssr/content/RunLog.js.map +1 -0
- package/dist/ssr/content/index.js +1 -0
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/run-log-messages.js +134 -0
- package/dist/ssr/content/run-log-messages.js.map +1 -0
- package/dist/ssr/feedback/toast.js +11 -1
- package/dist/ssr/feedback/toast.js.map +1 -1
- package/dist/ssr/internal/step-row.js +35 -0
- package/dist/ssr/internal/step-row.js.map +1 -0
- package/dist/ssr/layout/PullToRefresh.js +67 -16
- package/dist/ssr/layout/PullToRefresh.js.map +1 -1
- package/dist/ssr/layout/refresh-messages.js +4 -2
- package/dist/ssr/layout/refresh-messages.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/chat/ChatPrimitives.d.ts +6 -0
- package/dist/types/chat/ChatTimeline.d.ts +2 -0
- package/dist/types/content/Lightbox.d.ts +7 -5
- package/dist/types/content/RunLog.d.ts +53 -0
- package/dist/types/content/index.d.ts +1 -0
- package/dist/types/content/run-log-messages.d.ts +61 -0
- package/dist/types/feedback/toast.d.ts +9 -1
- package/dist/types/internal/step-row.d.ts +19 -0
- package/dist/types/layout/PullToRefresh.d.ts +2 -2
- package/dist/types/layout/refresh-messages.d.ts +1 -0
- package/package.json +9 -7
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { i18n } from "@k2b/stdlib";
|
|
2
|
+
import { useLocale } from "../intl/locale";
|
|
3
|
+
const messages = i18n.define({
|
|
4
|
+
baseLocale: "en",
|
|
5
|
+
messages: {
|
|
6
|
+
en: {
|
|
7
|
+
run: "Run",
|
|
8
|
+
idle: "Not run yet",
|
|
9
|
+
starting: "Starting …",
|
|
10
|
+
running: "Running",
|
|
11
|
+
since: ({
|
|
12
|
+
duration
|
|
13
|
+
}) => `Running for ${duration}`,
|
|
14
|
+
succeeded: "Done",
|
|
15
|
+
doneAfter: ({
|
|
16
|
+
duration
|
|
17
|
+
}) => `Done in ${duration}`,
|
|
18
|
+
failed: "Failed",
|
|
19
|
+
failedAfter: ({
|
|
20
|
+
duration
|
|
21
|
+
}) => `Failed after ${duration}`,
|
|
22
|
+
pending: "pending",
|
|
23
|
+
active: "running",
|
|
24
|
+
completed: "succeeded",
|
|
25
|
+
skipped: "skipped",
|
|
26
|
+
stepFailed: "failed",
|
|
27
|
+
output: "Output",
|
|
28
|
+
noLines: "no lines yet",
|
|
29
|
+
lines: ({
|
|
30
|
+
count
|
|
31
|
+
}) => `${count} lines`,
|
|
32
|
+
line: "1 line",
|
|
33
|
+
warnings: ({
|
|
34
|
+
count
|
|
35
|
+
}) => `${count} warnings`,
|
|
36
|
+
warning: "1 warning",
|
|
37
|
+
warningLevel: "Warning",
|
|
38
|
+
errors: ({
|
|
39
|
+
count
|
|
40
|
+
}) => `${count} errors`,
|
|
41
|
+
error: "1 error",
|
|
42
|
+
errorLevel: "Error",
|
|
43
|
+
older: ({
|
|
44
|
+
count
|
|
45
|
+
}) => `Show ${count} older lines`,
|
|
46
|
+
earlier: ({
|
|
47
|
+
count
|
|
48
|
+
}) => `Show ${count} earlier steps`,
|
|
49
|
+
later: ({
|
|
50
|
+
count
|
|
51
|
+
}) => `Show ${count} more steps`,
|
|
52
|
+
current: "Show current steps",
|
|
53
|
+
details: ({
|
|
54
|
+
label
|
|
55
|
+
}) => `Details for ${label}`,
|
|
56
|
+
toggle: "Expand or collapse run",
|
|
57
|
+
actions: "Actions",
|
|
58
|
+
progress: ({
|
|
59
|
+
current,
|
|
60
|
+
count
|
|
61
|
+
}) => `Step ${current} of ${count}`,
|
|
62
|
+
steps: ({
|
|
63
|
+
count
|
|
64
|
+
}) => `${count} steps`,
|
|
65
|
+
step: "1 step"
|
|
66
|
+
},
|
|
67
|
+
de: {
|
|
68
|
+
run: "Lauf",
|
|
69
|
+
idle: "Noch nicht ausgeführt",
|
|
70
|
+
starting: "Startet …",
|
|
71
|
+
running: "Läuft",
|
|
72
|
+
since: ({
|
|
73
|
+
duration
|
|
74
|
+
}) => `Läuft seit ${duration}`,
|
|
75
|
+
succeeded: "Fertig",
|
|
76
|
+
doneAfter: ({
|
|
77
|
+
duration
|
|
78
|
+
}) => `Fertig nach ${duration}`,
|
|
79
|
+
failed: "Gescheitert",
|
|
80
|
+
failedAfter: ({
|
|
81
|
+
duration
|
|
82
|
+
}) => `Gescheitert nach ${duration}`,
|
|
83
|
+
pending: "ausstehend",
|
|
84
|
+
active: "läuft",
|
|
85
|
+
completed: "erledigt",
|
|
86
|
+
skipped: "übersprungen",
|
|
87
|
+
stepFailed: "fehlgeschlagen",
|
|
88
|
+
output: "Ausgabe",
|
|
89
|
+
noLines: "noch keine Zeilen",
|
|
90
|
+
lines: ({
|
|
91
|
+
count
|
|
92
|
+
}) => `${count} Zeilen`,
|
|
93
|
+
line: "1 Zeile",
|
|
94
|
+
warnings: ({
|
|
95
|
+
count
|
|
96
|
+
}) => `${count} Warnungen`,
|
|
97
|
+
warning: "1 Warnung",
|
|
98
|
+
warningLevel: "Warnung",
|
|
99
|
+
errors: ({
|
|
100
|
+
count
|
|
101
|
+
}) => `${count} Fehler`,
|
|
102
|
+
error: "1 Fehler",
|
|
103
|
+
errorLevel: "Fehler",
|
|
104
|
+
older: ({
|
|
105
|
+
count
|
|
106
|
+
}) => `${count} ältere Zeilen anzeigen`,
|
|
107
|
+
earlier: ({
|
|
108
|
+
count
|
|
109
|
+
}) => `${count} frühere Schritte anzeigen`,
|
|
110
|
+
later: ({
|
|
111
|
+
count
|
|
112
|
+
}) => `${count} weitere Schritte anzeigen`,
|
|
113
|
+
current: "Aktuelle Schritte anzeigen",
|
|
114
|
+
details: ({
|
|
115
|
+
label
|
|
116
|
+
}) => `Details zu ${label}`,
|
|
117
|
+
toggle: "Lauf auf- oder zuklappen",
|
|
118
|
+
actions: "Aktionen",
|
|
119
|
+
progress: ({
|
|
120
|
+
current,
|
|
121
|
+
count
|
|
122
|
+
}) => `Schritt ${current} von ${count}`,
|
|
123
|
+
steps: ({
|
|
124
|
+
count
|
|
125
|
+
}) => `${count} Schritte`,
|
|
126
|
+
step: "1 Schritt"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
export function useRunLogMessages() {
|
|
131
|
+
const locale = useLocale();
|
|
132
|
+
return () => messages.resolve([locale()]).t;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=run-log-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["content/run-log-messages.ts"],"sourcesContent":["import { i18n } from \"@k2b/stdlib\";\nimport { useLocale } from \"../intl/locale\";\n\nconst messages = i18n.define({\n baseLocale: \"en\",\n messages: {\n en: {\n run: \"Run\",\n idle: \"Not run yet\",\n starting: \"Starting …\",\n running: \"Running\",\n since: ({ duration }: { duration: string }) => `Running for ${duration}`,\n succeeded: \"Done\",\n doneAfter: ({ duration }: { duration: string }) => `Done in ${duration}`,\n failed: \"Failed\",\n failedAfter: ({ duration }: { duration: string }) => `Failed after ${duration}`,\n pending: \"pending\",\n active: \"running\",\n completed: \"succeeded\",\n skipped: \"skipped\",\n stepFailed: \"failed\",\n output: \"Output\",\n noLines: \"no lines yet\",\n lines: ({ count }: { count: number }) => `${count} lines`,\n line: \"1 line\",\n warnings: ({ count }: { count: number }) => `${count} warnings`,\n warning: \"1 warning\",\n warningLevel: \"Warning\",\n errors: ({ count }: { count: number }) => `${count} errors`,\n error: \"1 error\",\n errorLevel: \"Error\",\n older: ({ count }: { count: number }) => `Show ${count} older lines`,\n earlier: ({ count }: { count: number }) => `Show ${count} earlier steps`,\n later: ({ count }: { count: number }) => `Show ${count} more steps`,\n current: \"Show current steps\",\n details: ({ label }: { label: string }) => `Details for ${label}`,\n toggle: \"Expand or collapse run\",\n actions: \"Actions\",\n progress: ({ current, count }: { current: number; count: number }) => `Step ${current} of ${count}`,\n steps: ({ count }: { count: number }) => `${count} steps`,\n step: \"1 step\",\n },\n de: {\n run: \"Lauf\",\n idle: \"Noch nicht ausgeführt\",\n starting: \"Startet …\",\n running: \"Läuft\",\n since: ({ duration }) => `Läuft seit ${duration}`,\n succeeded: \"Fertig\",\n doneAfter: ({ duration }) => `Fertig nach ${duration}`,\n failed: \"Gescheitert\",\n failedAfter: ({ duration }) => `Gescheitert nach ${duration}`,\n pending: \"ausstehend\",\n active: \"läuft\",\n completed: \"erledigt\",\n skipped: \"übersprungen\",\n stepFailed: \"fehlgeschlagen\",\n output: \"Ausgabe\",\n noLines: \"noch keine Zeilen\",\n lines: ({ count }) => `${count} Zeilen`,\n line: \"1 Zeile\",\n warnings: ({ count }) => `${count} Warnungen`,\n warning: \"1 Warnung\",\n warningLevel: \"Warnung\",\n errors: ({ count }) => `${count} Fehler`,\n error: \"1 Fehler\",\n errorLevel: \"Fehler\",\n older: ({ count }) => `${count} ältere Zeilen anzeigen`,\n earlier: ({ count }) => `${count} frühere Schritte anzeigen`,\n later: ({ count }) => `${count} weitere Schritte anzeigen`,\n current: \"Aktuelle Schritte anzeigen\",\n details: ({ label }) => `Details zu ${label}`,\n toggle: \"Lauf auf- oder zuklappen\",\n actions: \"Aktionen\",\n progress: ({ current, count }) => `Schritt ${current} von ${count}`,\n steps: ({ count }) => `${count} Schritte`,\n step: \"1 Schritt\",\n },\n },\n});\n\nexport function useRunLogMessages() {\n const locale = useLocale();\n return () => messages.resolve([locale()]).t;\n}\n"],"mappings":"AAAA,SAAS,IAAI,QAAQ,aAAa;AAClC,SAAS,SAAS,QAAQ,gBAAgB;AAE1C,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;EAC3B,UAAU,EAAE,IAAI;EAChB,QAAQ,EAAE;IACR,EAAE,EAAE;MACF,GAAG,EAAE,KAAK;MACV,IAAI,EAAE,aAAa;MACnB,QAAQ,EAAE,YAAY;MACtB,OAAO,EAAE,SAAS;MAClB,KAAK,EAAE,CAAC;QAAE;MAA+B,CAAC,KAAK,eAAe,QAAQ,EAAE;MACxE,SAAS,EAAE,MAAM;MACjB,SAAS,EAAE,CAAC;QAAE;MAA+B,CAAC,KAAK,WAAW,QAAQ,EAAE;MACxE,MAAM,EAAE,QAAQ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CAAC,KAAK,GAAG,KAAK,WAAW;MACzC,IAAI,EAAE;IACR;EACF;AACF,CAAC,CAAC;AAEF,OAAO,SAAS,iBAAiB,GAAG;EAClC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC;EAC1B,OAAO,MAAM,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7C","ignoreList":[]}
|
|
@@ -7,6 +7,13 @@ import { resolveToastMessages } from "./toast-messages";
|
|
|
7
7
|
|
|
8
8
|
/** A link at the end of the message, such as "Open settings". Following it closes the toast. */
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A title names the outcome in at most three words and 32 characters: one semibold line beside the icon tile in the
|
|
12
|
+
* narrowest toast (about 260 px of text on a 390 px phone). The repository rule `toast-copy` checks the same limits.
|
|
13
|
+
*/
|
|
14
|
+
const TITLE_MAX_WORDS = 3;
|
|
15
|
+
const TITLE_MAX_CHARACTERS = 32;
|
|
16
|
+
const isShortLabel = text => text.trim().length <= TITLE_MAX_CHARACTERS && text.trim().split(/\s+/).filter(Boolean).length <= TITLE_MAX_WORDS;
|
|
10
17
|
/** Toasts in the stack at every width; older ones leave by the eviction rule below. */
|
|
11
18
|
const MAX_VISIBLE_TOASTS = 3;
|
|
12
19
|
/** The same media query that moves the rail to the top edge in the stylesheet. */
|
|
@@ -724,6 +731,9 @@ const showToast = (description, options) => {
|
|
|
724
731
|
titleElement.textContent = currentTitle ?? "";
|
|
725
732
|
titleElement.hidden = !currentTitle;
|
|
726
733
|
descriptionText.data = currentDescription;
|
|
734
|
+
// A short message without a title, such as "Link copied", is the outcome itself: it reads in the title's type.
|
|
735
|
+
// Anything longer stays calm body text, so an old sentence never turns into a bold paragraph.
|
|
736
|
+
if (!currentTitle && currentProgress === null && !currentLink && isShortLabel(currentDescription)) contentElement.dataset.short = "true";else delete contentElement.dataset.short;
|
|
727
737
|
const href = currentLink ? safeHref(currentLink.href) : null;
|
|
728
738
|
if (currentLink && href !== null) {
|
|
729
739
|
linkElement.href = href;
|
|
@@ -862,7 +872,6 @@ const showToast = (description, options) => {
|
|
|
862
872
|
if (has("title")) currentTitle = nextOptions.title;
|
|
863
873
|
if (has("link")) currentLink = nextOptions.link ?? null;
|
|
864
874
|
if (nextOptions?.dismissLabel) dismissLabel = nextOptions.dismissLabel;
|
|
865
|
-
renderText();
|
|
866
875
|
if (has("action") || has("secondaryAction")) {
|
|
867
876
|
if (has("action")) currentAction = nextOptions.action ?? null;
|
|
868
877
|
if (has("secondaryAction")) currentSecondary = nextOptions.secondaryAction ?? null;
|
|
@@ -871,6 +880,7 @@ const showToast = (description, options) => {
|
|
|
871
880
|
if (has("duration")) explicitDuration = nextOptions.duration;
|
|
872
881
|
if (has("progress")) currentProgress = nextOptions.progress ?? null;
|
|
873
882
|
if (has("celebrate")) currentCelebrate = nextOptions.celebrate ?? false;
|
|
883
|
+
renderText();
|
|
874
884
|
renderProgress();
|
|
875
885
|
renderCheck();
|
|
876
886
|
resetDismissTimer();
|