@umriss-ui/core 0.2.0 → 0.3.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/CHANGELOG.md +65 -0
- package/README.md +1 -0
- package/dist/core.js +2282 -2278
- package/dist/de.d.ts +67 -0
- package/dist/formats-DrB9TuzO.js +65 -0
- package/dist/index.d.ts +89 -9
- package/dist/wording/de.js +18 -3
- package/package.json +1 -1
package/dist/de.d.ts
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
+
/** Everything the library knows about formatting. */
|
|
2
|
+
declare interface Formats {
|
|
3
|
+
/** Date as displayed: 17/03/2026 */
|
|
4
|
+
date: (d: Date) => string;
|
|
5
|
+
/** Short form without the year, in the range footer: 17/03 */
|
|
6
|
+
dateShort: (d: Date) => string;
|
|
7
|
+
/** The calendar's month header: March 2026 */
|
|
8
|
+
month: (d: Date) => string;
|
|
9
|
+
/** Accessible name of a calendar cell: Tuesday, 17 March 2026 */
|
|
10
|
+
dateLong: (d: Date) => string;
|
|
11
|
+
/** Time of day, optionally with seconds: 09:05 or 09:05:03 */
|
|
12
|
+
time: (d: Date, withSeconds: boolean) => string;
|
|
13
|
+
/** Date and time together: 17/03/2026, 09:05 */
|
|
14
|
+
dateTime: (d: Date, withSeconds: boolean) => string;
|
|
15
|
+
/** Short form of the UTC offset: GMT+2 */
|
|
16
|
+
offset: (d: Date) => string;
|
|
17
|
+
/**
|
|
18
|
+
* A number in the set's notation. Without a digit count the value stands to
|
|
19
|
+
* the tenth decimal place; with one it is padded and rounded to exactly that
|
|
20
|
+
* many places.
|
|
21
|
+
*/
|
|
22
|
+
number: (n: number, decimals?: number) => string;
|
|
23
|
+
/**
|
|
24
|
+
* A count. Kept apart from `number` because it makes a different promise: a
|
|
25
|
+
* count is whole, and Intl's default (at most three decimal places) is right
|
|
26
|
+
* for it and wrong for a measurement.
|
|
27
|
+
*/
|
|
28
|
+
count: (n: number) => string;
|
|
29
|
+
/** A share from 0 to 1 as whole per cent: 74 % */
|
|
30
|
+
percent: (share: number) => string;
|
|
31
|
+
/** The ordering of two texts by the set's collation. */
|
|
32
|
+
compareText: (a: string, b: string) => number;
|
|
33
|
+
/** An elapsed duration as a phrase: "3 minutes ago".
|
|
34
|
+
The amount comes in milliseconds, counted back from now. */
|
|
35
|
+
relative: (ms: number) => string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The German notation: 17.03.2026, 09:05, 1.204,5, "vor 3 Minuten" - and
|
|
39
|
+
German collation, which files Ä with A. The clock is 24-hour here as it is
|
|
40
|
+
in the default; that never was a question of language. */
|
|
41
|
+
export declare const GERMAN_FORMATS: Formats;
|
|
42
|
+
|
|
1
43
|
/** The German instance. Complete, because it is typed `Wording`. */
|
|
2
44
|
export declare const GERMAN_WORDING: Wording;
|
|
3
45
|
|
|
@@ -299,6 +341,31 @@ declare interface Wording {
|
|
|
299
341
|
remove: string;
|
|
300
342
|
/** The cross on a tag with text content. */
|
|
301
343
|
removeTag: (beschriftung: string) => string;
|
|
344
|
+
/** The two findings, named on the ghost of a drag. */
|
|
345
|
+
scheduleOverlap: string;
|
|
346
|
+
scheduleLateTransport: string;
|
|
347
|
+
/** The new times on the ghost: "08:15–10:00" - the times come from the
|
|
348
|
+
formats. */
|
|
349
|
+
scheduleGhostTimes: (from: string, to: string) => string;
|
|
350
|
+
/** The parts of a subtask and a transport, named in the tooltip. */
|
|
351
|
+
scheduleSetup: string;
|
|
352
|
+
scheduleTeardown: string;
|
|
353
|
+
scheduleTransport: string;
|
|
354
|
+
/** "A-2041-1 → A-2041-2": where a transport goes. */
|
|
355
|
+
scheduleRoute: (from: string, to: string) => string;
|
|
356
|
+
/** "Overlap with A-2043-2" - the other subtask on the lane. */
|
|
357
|
+
scheduleOverlapWith: (other: string) => string;
|
|
358
|
+
/** "Late transport, 15 min short" - the amount from `minutesShort`. */
|
|
359
|
+
scheduleLateBy: (amount: string) => string;
|
|
360
|
+
/** On the ghost of a drag over a lane the subtask may not go to. */
|
|
361
|
+
scheduleLaneRefused: string;
|
|
362
|
+
/** The chevron of a lane group's header, which folds it into one row and
|
|
363
|
+
unfolds it again. The group's own label stands beside the button, so the
|
|
364
|
+
name is what the ACTION is, not which group it acts on. */
|
|
365
|
+
scheduleFoldGroup: string;
|
|
366
|
+
scheduleUnfoldGroup: string;
|
|
367
|
+
/** How many lanes a group holds, beside its name in the header. */
|
|
368
|
+
scheduleLaneCount: (count: number) => string;
|
|
302
369
|
}
|
|
303
370
|
|
|
304
371
|
export { }
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const y = [
|
|
2
|
+
["day", 86400],
|
|
3
|
+
["hour", 3600],
|
|
4
|
+
["minute", 60]
|
|
5
|
+
];
|
|
6
|
+
function D(e) {
|
|
7
|
+
const r = new Intl.DateTimeFormat(e, { day: "2-digit", month: "2-digit", year: "numeric" }), a = new Intl.DateTimeFormat(e, { day: "2-digit", month: "2-digit" }), f = new Intl.DateTimeFormat(e, { month: "long", year: "numeric" }), F = new Intl.DateTimeFormat(e, {
|
|
8
|
+
weekday: "long",
|
|
9
|
+
day: "numeric",
|
|
10
|
+
month: "long",
|
|
11
|
+
year: "numeric"
|
|
12
|
+
}), m = { hour: "2-digit", minute: "2-digit", hour12: !1, hourCycle: "h23" }, i = {
|
|
13
|
+
without: new Intl.DateTimeFormat(e, m),
|
|
14
|
+
with: new Intl.DateTimeFormat(e, { ...m, second: "2-digit" })
|
|
15
|
+
}, s = {
|
|
16
|
+
without: new Intl.DateTimeFormat(e, { day: "2-digit", month: "2-digit", year: "numeric", ...m }),
|
|
17
|
+
with: new Intl.DateTimeFormat(e, {
|
|
18
|
+
day: "2-digit",
|
|
19
|
+
month: "2-digit",
|
|
20
|
+
year: "numeric",
|
|
21
|
+
...m,
|
|
22
|
+
second: "2-digit"
|
|
23
|
+
})
|
|
24
|
+
}, h = new Intl.DateTimeFormat(e, { timeZoneName: "shortOffset" }), u = /* @__PURE__ */ new Map(), g = new Intl.NumberFormat(e), w = new Intl.NumberFormat(e, { style: "percent", maximumFractionDigits: 0 }), T = new Intl.Collator(e), c = new Intl.RelativeTimeFormat(e, { numeric: "auto" });
|
|
25
|
+
return {
|
|
26
|
+
date: (t) => r.format(t),
|
|
27
|
+
dateShort: (t) => a.format(t),
|
|
28
|
+
month: (t) => f.format(t),
|
|
29
|
+
dateLong: (t) => F.format(t),
|
|
30
|
+
time: (t, n) => (n ? i.with : i.without).format(t),
|
|
31
|
+
dateTime: (t, n) => (n ? s.with : s.without).format(t),
|
|
32
|
+
offset: (t) => {
|
|
33
|
+
var n;
|
|
34
|
+
return ((n = h.formatToParts(t).find((o) => o.type === "timeZoneName")) == null ? void 0 : n.value) ?? "";
|
|
35
|
+
},
|
|
36
|
+
number: (t, n) => {
|
|
37
|
+
let o = u.get(n);
|
|
38
|
+
return o || (o = new Intl.NumberFormat(e, {
|
|
39
|
+
minimumFractionDigits: n,
|
|
40
|
+
maximumFractionDigits: n ?? 10
|
|
41
|
+
}), u.set(n, o)), o.format(t);
|
|
42
|
+
},
|
|
43
|
+
count: (t) => g.format(t),
|
|
44
|
+
percent: (t) => w.format(t),
|
|
45
|
+
compareText: (t, n) => T.compare(t, n),
|
|
46
|
+
relative: (t) => {
|
|
47
|
+
const n = Math.max(0, Math.round(t / 1e3));
|
|
48
|
+
for (const [o, d] of y)
|
|
49
|
+
if (n >= d) return c.format(-Math.floor(n / d), o);
|
|
50
|
+
return c.format(-n, "second");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const I = D("en-GB");
|
|
55
|
+
function p(e) {
|
|
56
|
+
const r = [...e.number(1234.5, 1).replace(/[\d-]/g, "")], a = r[r.length - 1] ?? ".";
|
|
57
|
+
return { group: r.length > 1 ? r[0] : "", decimal: a };
|
|
58
|
+
}
|
|
59
|
+
const S = p(I);
|
|
60
|
+
export {
|
|
61
|
+
I as D,
|
|
62
|
+
S as a,
|
|
63
|
+
D as f,
|
|
64
|
+
p as s
|
|
65
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -316,6 +316,37 @@ export declare interface ConfirmDialogProps {
|
|
|
316
316
|
loading?: boolean;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
/**
|
|
320
|
+
* A menu that opens at a point instead of under a trigger – for a right-click
|
|
321
|
+
* on something that is not a button: a canvas, a row, a subtask.
|
|
322
|
+
*
|
|
323
|
+
* It hangs from an invisible anchor that stands at the point, so the one
|
|
324
|
+
* popover does the placing, the dismissal and the portal. The focus goes to
|
|
325
|
+
* the first entry and, on closing, back to where it was when the menu opened.
|
|
326
|
+
*/
|
|
327
|
+
export declare function ContextMenu({ open, onOpenChange, position, ariaLabel, children }: ContextMenuProps): JSX.Element;
|
|
328
|
+
|
|
329
|
+
export declare interface ContextMenuProps {
|
|
330
|
+
/** Whether the menu stands. Controlled, like `Popover`: a right-click
|
|
331
|
+
opens it only because the caller says so. */
|
|
332
|
+
open: boolean;
|
|
333
|
+
/** Reports every wish to change the state – an entry chosen, Escape, an
|
|
334
|
+
outside click. */
|
|
335
|
+
onOpenChange: (open: boolean) => void;
|
|
336
|
+
/** Where the menu opens, in client coordinates – typically `clientX` and
|
|
337
|
+
`clientY` of the event that asked for it. At a window edge the panel
|
|
338
|
+
flips and clamps as every popover does. */
|
|
339
|
+
position: {
|
|
340
|
+
x: number;
|
|
341
|
+
y: number;
|
|
342
|
+
};
|
|
343
|
+
/** Accessible name of the menu: what it acts on. A context menu has no
|
|
344
|
+
trigger whose label could name it. */
|
|
345
|
+
ariaLabel: string;
|
|
346
|
+
/** The entries – `MenuItem` and `MenuSeparator`, as in `Menu`. */
|
|
347
|
+
children: ReactNode;
|
|
348
|
+
}
|
|
349
|
+
|
|
319
350
|
/** The cross that clears a field. Six times in the set, identical. */
|
|
320
351
|
export declare const CrossGlyph: ForwardRefExoticComponent<Omit<GlyphProps, "ref"> & RefAttributes<SVGSVGElement>>;
|
|
321
352
|
|
|
@@ -494,6 +525,8 @@ export declare interface DateTimeRangePickerProps {
|
|
|
494
525
|
presets?: RangePreset[];
|
|
495
526
|
}
|
|
496
527
|
|
|
528
|
+
/** The instance shipped by default: English notation on a 24-hour clock
|
|
529
|
+
(ADR-0024). German is `GERMAN_FORMATS` in `@umriss-ui/core/wording/de`. */
|
|
497
530
|
export declare const DEFAULT_FORMATS: Formats;
|
|
498
531
|
|
|
499
532
|
export declare const DEFAULT_LANGUAGE: Language;
|
|
@@ -501,6 +534,9 @@ export declare const DEFAULT_LANGUAGE: Language;
|
|
|
501
534
|
/** The same time spans with the preset labels. */
|
|
502
535
|
export declare const DEFAULT_PRESETS: RangePreset[];
|
|
503
536
|
|
|
537
|
+
/** The separators of the default notation. */
|
|
538
|
+
export declare const DEFAULT_SEPARATORS: Separators;
|
|
539
|
+
|
|
504
540
|
/** The instance shipped by default. English; German is `GERMAN_WORDING` in
|
|
505
541
|
`@umriss-ui/core/wording/de` (ADR-0019). */
|
|
506
542
|
export declare const DEFAULT_WORDING: Wording;
|
|
@@ -640,23 +676,23 @@ export declare interface FlatteningEntry<K, S extends Key = string> {
|
|
|
640
676
|
|
|
641
677
|
/** Everything the library knows about formatting. */
|
|
642
678
|
export declare interface Formats {
|
|
643
|
-
/** Date as displayed: 17
|
|
679
|
+
/** Date as displayed: 17/03/2026 */
|
|
644
680
|
date: (d: Date) => string;
|
|
645
|
-
/** Short form without the year, in the range footer: 17
|
|
681
|
+
/** Short form without the year, in the range footer: 17/03 */
|
|
646
682
|
dateShort: (d: Date) => string;
|
|
647
|
-
/** The calendar's month header:
|
|
683
|
+
/** The calendar's month header: March 2026 */
|
|
648
684
|
month: (d: Date) => string;
|
|
649
|
-
/** Accessible name of a calendar cell:
|
|
685
|
+
/** Accessible name of a calendar cell: Tuesday, 17 March 2026 */
|
|
650
686
|
dateLong: (d: Date) => string;
|
|
651
687
|
/** Time of day, optionally with seconds: 09:05 or 09:05:03 */
|
|
652
688
|
time: (d: Date, withSeconds: boolean) => string;
|
|
653
|
-
/** Date and time together: 17
|
|
689
|
+
/** Date and time together: 17/03/2026, 09:05 */
|
|
654
690
|
dateTime: (d: Date, withSeconds: boolean) => string;
|
|
655
691
|
/** Short form of the UTC offset: GMT+2 */
|
|
656
692
|
offset: (d: Date) => string;
|
|
657
693
|
/**
|
|
658
|
-
* A number in
|
|
659
|
-
* tenth decimal place; with one it is padded and rounded to exactly that
|
|
694
|
+
* A number in the set's notation. Without a digit count the value stands to
|
|
695
|
+
* the tenth decimal place; with one it is padded and rounded to exactly that
|
|
660
696
|
* many places.
|
|
661
697
|
*/
|
|
662
698
|
number: (n: number, decimals?: number) => string;
|
|
@@ -668,9 +704,9 @@ export declare interface Formats {
|
|
|
668
704
|
count: (n: number) => string;
|
|
669
705
|
/** A share from 0 to 1 as whole per cent: 74 % */
|
|
670
706
|
percent: (share: number) => string;
|
|
671
|
-
/** The ordering of two texts by
|
|
707
|
+
/** The ordering of two texts by the set's collation. */
|
|
672
708
|
compareText: (a: string, b: string) => number;
|
|
673
|
-
/** An elapsed duration as a phrase: "
|
|
709
|
+
/** An elapsed duration as a phrase: "3 minutes ago".
|
|
674
710
|
The amount comes in milliseconds, counted back from now. */
|
|
675
711
|
relative: (ms: number) => string;
|
|
676
712
|
}
|
|
@@ -1319,6 +1355,25 @@ export declare interface SelectProps extends SelectHTMLAttributes<HTMLSelectElem
|
|
|
1319
1355
|
onClear?: () => void;
|
|
1320
1356
|
}
|
|
1321
1357
|
|
|
1358
|
+
/** The two characters a notation separates with. */
|
|
1359
|
+
export declare interface Separators {
|
|
1360
|
+
/** Between thousands: "," in English, "." in German, empty where a notation
|
|
1361
|
+
does not group. */
|
|
1362
|
+
readonly group: string;
|
|
1363
|
+
/** Before the decimals: "." in English, "," in German. */
|
|
1364
|
+
readonly decimal: string;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/** The separators a set of formats writes, read off the formats themselves.
|
|
1368
|
+
|
|
1369
|
+
A field that formats a number must be able to read its own output back, and
|
|
1370
|
+
an application may have replaced `number` with anything (ADR-0024 moved the
|
|
1371
|
+
default from German to English, which is how this came up). So the
|
|
1372
|
+
separators are not declared a second time but measured: one number with one
|
|
1373
|
+
decimal place, digits struck out, and what remains is the notation's own
|
|
1374
|
+
punctuation. */
|
|
1375
|
+
export declare function separatorsOf(formats: Formats): Separators;
|
|
1376
|
+
|
|
1322
1377
|
export declare function setActive<S extends Key>(snapshot: TreeSnapshot<S>, key: S | null): TreeSnapshot<S>;
|
|
1323
1378
|
|
|
1324
1379
|
export declare function setAnchor<S extends Key>(snapshot: TreeSnapshot<S>, key: S | null): TreeSnapshot<S>;
|
|
@@ -2244,6 +2299,31 @@ export declare interface Wording {
|
|
|
2244
2299
|
remove: string;
|
|
2245
2300
|
/** The cross on a tag with text content. */
|
|
2246
2301
|
removeTag: (beschriftung: string) => string;
|
|
2302
|
+
/** The two findings, named on the ghost of a drag. */
|
|
2303
|
+
scheduleOverlap: string;
|
|
2304
|
+
scheduleLateTransport: string;
|
|
2305
|
+
/** The new times on the ghost: "08:15–10:00" - the times come from the
|
|
2306
|
+
formats. */
|
|
2307
|
+
scheduleGhostTimes: (from: string, to: string) => string;
|
|
2308
|
+
/** The parts of a subtask and a transport, named in the tooltip. */
|
|
2309
|
+
scheduleSetup: string;
|
|
2310
|
+
scheduleTeardown: string;
|
|
2311
|
+
scheduleTransport: string;
|
|
2312
|
+
/** "A-2041-1 → A-2041-2": where a transport goes. */
|
|
2313
|
+
scheduleRoute: (from: string, to: string) => string;
|
|
2314
|
+
/** "Overlap with A-2043-2" - the other subtask on the lane. */
|
|
2315
|
+
scheduleOverlapWith: (other: string) => string;
|
|
2316
|
+
/** "Late transport, 15 min short" - the amount from `minutesShort`. */
|
|
2317
|
+
scheduleLateBy: (amount: string) => string;
|
|
2318
|
+
/** On the ghost of a drag over a lane the subtask may not go to. */
|
|
2319
|
+
scheduleLaneRefused: string;
|
|
2320
|
+
/** The chevron of a lane group's header, which folds it into one row and
|
|
2321
|
+
unfolds it again. The group's own label stands beside the button, so the
|
|
2322
|
+
name is what the ACTION is, not which group it acts on. */
|
|
2323
|
+
scheduleFoldGroup: string;
|
|
2324
|
+
scheduleUnfoldGroup: string;
|
|
2325
|
+
/** How many lanes a group holds, beside its name in the header. */
|
|
2326
|
+
scheduleLaneCount: (count: number) => string;
|
|
2247
2327
|
}
|
|
2248
2328
|
|
|
2249
2329
|
export { }
|
package/dist/wording/de.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { f as r } from "../formats-DrB9TuzO.js";
|
|
2
|
+
const a = r("de-DE"), l = {
|
|
2
3
|
clearInput: "Eingabe leeren",
|
|
3
4
|
clearSelection: "Auswahl leeren",
|
|
4
5
|
decreaseValue: "Wert verringern",
|
|
@@ -190,8 +191,22 @@ const i = {
|
|
|
190
191
|
hide: "Ausblenden",
|
|
191
192
|
moreActions: "Weitere Aktionen",
|
|
192
193
|
remove: "Entfernen",
|
|
193
|
-
removeTag: (e) => `${e} entfernen
|
|
194
|
+
removeTag: (e) => `${e} entfernen`,
|
|
195
|
+
scheduleOverlap: "Überschneidung",
|
|
196
|
+
scheduleLateTransport: "Transport verspätet",
|
|
197
|
+
scheduleGhostTimes: (e, n) => `${e}–${n}`,
|
|
198
|
+
scheduleSetup: "Rüsten",
|
|
199
|
+
scheduleTeardown: "Abrüsten",
|
|
200
|
+
scheduleTransport: "Transport",
|
|
201
|
+
scheduleRoute: (e, n) => `${e} → ${n}`,
|
|
202
|
+
scheduleOverlapWith: (e) => `Überschneidung mit ${e}`,
|
|
203
|
+
scheduleLateBy: (e) => `Transport verspätet, ${e} zu knapp`,
|
|
204
|
+
scheduleLaneRefused: "Nicht hierher",
|
|
205
|
+
scheduleFoldGroup: "Gruppe einklappen",
|
|
206
|
+
scheduleUnfoldGroup: "Gruppe ausklappen",
|
|
207
|
+
scheduleLaneCount: (e) => e === 1 ? "1 Bahn" : `${e} Bahnen`
|
|
194
208
|
};
|
|
195
209
|
export {
|
|
196
|
-
|
|
210
|
+
a as GERMAN_FORMATS,
|
|
211
|
+
l as GERMAN_WORDING
|
|
197
212
|
};
|