basalt-ui 2.13.3 → 2.15.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 +66 -0
- package/MIGRATING.md +42 -12
- package/agent/agents/basalt-design-reviewer.md +83 -0
- package/agent/rules/basalt-batteries.md +1 -2
- package/agent/rules/basalt-charts.md +1 -1
- package/agent/rules/basalt-controls.md +3 -3
- package/agent/rules/basalt-mantine.md +1 -2
- package/agent/rules/basalt-state.md +1 -2
- package/agent/rules/basalt-tokens.md +1 -3
- package/agent/skills/basalt-design/SKILL.md +26 -8
- package/agent/templates/AGENTS-block.md.tpl +7 -0
- package/configs/oxlint-plugin.js +39 -2
- package/configs/oxlint-plugin.test.ts +48 -0
- package/dist/agent/chat/thread-feed-row.d.ts.map +1 -1
- package/dist/agent/chat/thread-feed-row.js +2 -2
- package/dist/agent/chat/thread-message.d.ts.map +1 -1
- package/dist/agent/chat/thread-message.js +2 -2
- package/dist/agent/chat/thread-outcome-card.js +2 -2
- package/dist/charts/DualPanel.d.ts.map +1 -1
- package/dist/charts/DualPanel.js +1 -0
- package/dist/charts/compile.d.ts.map +1 -1
- package/dist/charts/compile.js +3 -2
- package/dist/charts/cursor.d.ts +10 -6
- package/dist/charts/cursor.d.ts.map +1 -1
- package/dist/charts/cursor.js +20 -13
- package/dist/charts/legend.d.ts +7 -6
- package/dist/charts/legend.d.ts.map +1 -1
- package/dist/charts/legend.js +3 -3
- package/dist/charts/panel.d.ts +2 -0
- package/dist/charts/panel.d.ts.map +1 -1
- package/dist/charts/panel.js +1 -0
- package/dist/cli/board-freshness.d.ts +25 -0
- package/dist/cli/board-freshness.d.ts.map +1 -0
- package/dist/cli/board-freshness.js +88 -0
- package/dist/cli/doctor.d.ts +2 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +3 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +9 -3
- package/dist/cli/index.d.ts +15 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +57 -7
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +6 -1
- package/dist/cli/shot/board.d.ts +5 -0
- package/dist/cli/shot/board.d.ts.map +1 -0
- package/dist/cli/shot/board.js +96 -0
- package/dist/cli/shot/capture.d.ts +59 -0
- package/dist/cli/shot/capture.d.ts.map +1 -0
- package/dist/cli/shot/capture.js +473 -0
- package/dist/cli/shot/index.d.ts +45 -0
- package/dist/cli/shot/index.d.ts.map +1 -0
- package/dist/cli/shot/index.js +289 -0
- package/dist/cli/shot/measure.d.ts +28 -0
- package/dist/cli/shot/measure.d.ts.map +1 -0
- package/dist/cli/shot/measure.js +176 -0
- package/dist/cli/shot/playwright.d.ts +101 -0
- package/dist/cli/shot/playwright.d.ts.map +1 -0
- package/dist/cli/shot/playwright.js +60 -0
- package/dist/cli/shot/serve.d.ts +6 -0
- package/dist/cli/shot/serve.d.ts.map +1 -0
- package/dist/cli/shot/serve.js +33 -0
- package/dist/cli/shot/types.d.ts +97 -0
- package/dist/cli/shot/types.d.ts.map +1 -0
- package/dist/cli/shot/types.js +17 -0
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +2 -1
- package/dist/commands/notifications/center.d.ts.map +1 -1
- package/dist/commands/notifications/center.js +2 -11
- package/dist/controls/control-name.d.ts +27 -0
- package/dist/controls/control-name.d.ts.map +1 -0
- package/dist/controls/control-name.js +11 -0
- package/dist/controls/enum-filter.d.ts +3 -6
- package/dist/controls/enum-filter.d.ts.map +1 -1
- package/dist/controls/enum-filter.js +8 -4
- package/dist/controls/filter-base.d.ts +30 -0
- package/dist/controls/filter-base.d.ts.map +1 -0
- package/dist/controls/filter-base.js +0 -0
- package/dist/controls/filter-pill.d.ts +3 -1
- package/dist/controls/filter-pill.d.ts.map +1 -1
- package/dist/controls/filter-pill.js +2 -0
- package/dist/controls/filter-sheet.d.ts +0 -32
- package/dist/controls/filter-sheet.d.ts.map +1 -1
- package/dist/controls/filter-sheet.js +1 -28
- package/dist/controls/glyphs.d.ts +12 -0
- package/dist/controls/glyphs.d.ts.map +1 -1
- package/dist/controls/glyphs.js +23 -2
- package/dist/controls/index.d.ts +2 -1
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.d.ts +8 -3
- package/dist/controls/multi-select-filter.d.ts.map +1 -1
- package/dist/controls/multi-select-filter.js +27 -10
- package/dist/controls/number-filter.d.ts +3 -12
- package/dist/controls/number-filter.d.ts.map +1 -1
- package/dist/controls/number-filter.js +17 -6
- package/dist/controls/panel-row.d.ts +5 -8
- package/dist/controls/panel-row.d.ts.map +1 -1
- package/dist/controls/panel-row.js +3 -0
- package/dist/controls/range-filter.d.ts +14 -14
- package/dist/controls/range-filter.d.ts.map +1 -1
- package/dist/controls/range-filter.js +18 -41
- package/dist/controls/search-filter.d.ts +5 -2
- package/dist/controls/search-filter.d.ts.map +1 -1
- package/dist/controls/search-filter.js +74 -40
- package/dist/controls/select-filter.d.ts +2 -15
- package/dist/controls/select-filter.d.ts.map +1 -1
- package/dist/controls/sync-button.d.ts +0 -6
- package/dist/controls/sync-button.d.ts.map +1 -1
- package/dist/controls/sync-button.js +6 -36
- package/dist/controls/toggle-filter.d.ts +2 -2
- package/dist/controls/toggle-filter.d.ts.map +1 -1
- package/dist/controls/toggle-filter.js +3 -2
- package/dist/controls/view-tabs.d.ts +3 -4
- package/dist/controls/view-tabs.d.ts.map +1 -1
- package/dist/controls/view-tabs.js +24 -5
- package/dist/format/date.d.ts +43 -10
- package/dist/format/date.d.ts.map +1 -1
- package/dist/format/date.js +109 -18
- package/dist/format/index.d.ts +12 -11
- package/dist/format/index.d.ts.map +1 -1
- package/dist/format/index.js +11 -2
- package/dist/format/measure.d.ts +9 -9
- package/dist/format/measure.d.ts.map +1 -1
- package/dist/format/measure.js +19 -8
- package/dist/format/number.d.ts +35 -27
- package/dist/format/number.d.ts.map +1 -1
- package/dist/format/number.js +41 -20
- package/dist/format/shared.d.ts +38 -7
- package/dist/format/shared.d.ts.map +1 -1
- package/dist/format/shared.js +61 -13
- package/dist/provider/index.d.ts +13 -1
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +8 -0
- package/dist/surfaces.d.ts +2 -0
- package/dist/surfaces.d.ts.map +1 -1
- package/dist/surfaces.js +2 -0
- package/llms.txt +35 -14
- package/package.json +1 -1
- package/src/agent/chat/thread-feed-row.tsx +2 -2
- package/src/agent/chat/thread-message.tsx +2 -2
- package/src/agent/chat/thread-outcome-card.tsx +2 -2
- package/src/charts/DualPanel.tsx +1 -0
- package/src/charts/compile.ts +3 -2
- package/src/charts/cursor.ts +44 -27
- package/src/charts/legend.tsx +11 -8
- package/src/charts/panel.tsx +3 -0
- package/src/cli/board-freshness.ts +132 -0
- package/src/cli/doctor.ts +10 -1
- package/src/cli/help.ts +14 -2
- package/src/cli/index.ts +80 -10
- package/src/cli/init.ts +8 -1
- package/src/cli/shot/board.ts +154 -0
- package/src/cli/shot/capture.ts +650 -0
- package/src/cli/shot/index.ts +362 -0
- package/src/cli/shot/measure.ts +225 -0
- package/src/cli/shot/playwright.ts +152 -0
- package/src/cli/shot/serve.ts +35 -0
- package/src/cli/shot/types.ts +91 -0
- package/src/cli/sync.ts +2 -1
- package/src/commands/notifications/center.tsx +2 -14
- package/src/controls/control-name.ts +33 -0
- package/src/controls/enum-filter.tsx +29 -27
- package/src/controls/filter-base.ts +31 -0
- package/src/controls/filter-pill.tsx +4 -0
- package/src/controls/filter-sheet.tsx +0 -56
- package/src/controls/glyphs.tsx +45 -2
- package/src/controls/index.ts +2 -1
- package/src/controls/multi-select-filter.tsx +67 -43
- package/src/controls/number-filter.tsx +47 -47
- package/src/controls/panel-row.tsx +7 -8
- package/src/controls/range-filter.tsx +54 -78
- package/src/controls/search-filter.tsx +107 -54
- package/src/controls/select-filter.tsx +2 -18
- package/src/controls/sync-button.tsx +7 -40
- package/src/controls/toggle-filter.tsx +9 -7
- package/src/controls/view-tabs.tsx +41 -21
- package/src/format/date.ts +189 -36
- package/src/format/index.ts +12 -11
- package/src/format/measure.ts +29 -18
- package/src/format/number.ts +76 -37
- package/src/format/shared.ts +116 -25
- package/src/provider/index.tsx +23 -0
- package/src/surfaces.ts +5 -0
- package/dist/agent/chat/relative-time.d.ts +0 -27
- package/dist/agent/chat/relative-time.d.ts.map +0 -1
- package/dist/agent/chat/relative-time.js +0 -27
- package/src/agent/chat/relative-time.ts +0 -55
|
@@ -1,42 +1,73 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { TextInput } from "@mantine/core";
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CloseButton, TextInput } from "@mantine/core";
|
|
3
3
|
import { useDebouncedCallback } from "@mantine/hooks";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
|
+
import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
|
|
5
6
|
import { assertRequiredProps } from "../common/validate.js";
|
|
7
|
+
import { useControlName } from "./control-name.js";
|
|
6
8
|
import { useFilterRegistration, useFilterSurface } from "./filter-context.js";
|
|
7
|
-
import {
|
|
9
|
+
import { SearchGlyph } from "./glyphs.js";
|
|
8
10
|
import { PanelRow } from "./panel-row.js";
|
|
9
11
|
const DEBOUNCE_MS = 200;
|
|
10
12
|
function SearchFilter(props) {
|
|
11
13
|
assertRequiredProps("SearchFilter", props, ["field"], {
|
|
12
14
|
field: "bind it to a store field (`store.field.<name>`), never a value/onChange pair."
|
|
13
15
|
});
|
|
14
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
field,
|
|
18
|
+
placeholder,
|
|
19
|
+
label = "Search",
|
|
20
|
+
clearable = true,
|
|
21
|
+
disabled,
|
|
22
|
+
className,
|
|
23
|
+
style
|
|
24
|
+
} = props;
|
|
15
25
|
const [value, setValue] = field.use();
|
|
16
26
|
const surface = useFilterSurface();
|
|
17
|
-
const draft = useDebouncedField(value, setValue)
|
|
18
|
-
useFilterRegistration(!field.isDefault(value), () => {
|
|
27
|
+
const draft = useDebouncedField(value, setValue, () => {
|
|
19
28
|
field.clear();
|
|
20
29
|
});
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
const
|
|
30
|
+
useFilterRegistration(!field.isDefault(value), draft.clear);
|
|
31
|
+
const inRow = surface === "sheet" || surface === "panel";
|
|
32
|
+
const { labelId, nameProps } = useControlName(label, inRow);
|
|
24
33
|
const input = /* @__PURE__ */ jsx(
|
|
25
34
|
TextInput,
|
|
26
35
|
{
|
|
27
36
|
...nameProps,
|
|
28
37
|
size: "ctl",
|
|
38
|
+
type: "search",
|
|
39
|
+
enterKeyHint: "search",
|
|
29
40
|
value: draft.value,
|
|
30
|
-
leftSection: /* @__PURE__ */ jsx(
|
|
41
|
+
leftSection: /* @__PURE__ */ jsx(SearchGlyph, {}),
|
|
42
|
+
rightSectionPointerEvents: "all",
|
|
43
|
+
...clearable && draft.value !== "" && {
|
|
44
|
+
rightSection: /* @__PURE__ */ jsx(
|
|
45
|
+
CloseButton,
|
|
46
|
+
{
|
|
47
|
+
size: "sm",
|
|
48
|
+
"aria-label": "Clear search",
|
|
49
|
+
disabled: disabled === true,
|
|
50
|
+
onMouseDown: (event) => {
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
},
|
|
53
|
+
onClick: draft.clear
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
},
|
|
57
|
+
...disabled === true && { disabled: true },
|
|
31
58
|
...placeholder !== void 0 && { placeholder },
|
|
32
59
|
onChange: (event) => {
|
|
33
60
|
draft.set(event.currentTarget.value);
|
|
34
61
|
},
|
|
35
|
-
|
|
36
|
-
|
|
62
|
+
onBlur: draft.flush,
|
|
63
|
+
onKeyDown: (event) => {
|
|
64
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing) draft.flush();
|
|
65
|
+
},
|
|
66
|
+
...!inRow && className !== void 0 && { className },
|
|
67
|
+
...!inRow && style !== void 0 && { style }
|
|
37
68
|
}
|
|
38
69
|
);
|
|
39
|
-
if (
|
|
70
|
+
if (inRow) {
|
|
40
71
|
return /* @__PURE__ */ jsx(
|
|
41
72
|
PanelRow,
|
|
42
73
|
{
|
|
@@ -50,18 +81,30 @@ function SearchFilter(props) {
|
|
|
50
81
|
}
|
|
51
82
|
return input;
|
|
52
83
|
}
|
|
53
|
-
function useDebouncedField(value, setValue) {
|
|
84
|
+
function useDebouncedField(value, setValue, clearField) {
|
|
54
85
|
const [draft, setDraft] = useState(value);
|
|
55
86
|
const seen = useRef(value);
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
held.current = value;
|
|
59
|
-
});
|
|
60
|
-
const commit = useDebouncedCallback((next) => {
|
|
61
|
-
if (next === held.current) return;
|
|
87
|
+
const rendered = useRef(value);
|
|
88
|
+
const write = (next) => {
|
|
62
89
|
seen.current = next;
|
|
63
90
|
setValue(next);
|
|
91
|
+
};
|
|
92
|
+
const commit = useDebouncedCallback((next) => {
|
|
93
|
+
if (next === seen.current) return;
|
|
94
|
+
write(next);
|
|
64
95
|
}, DEBOUNCE_MS);
|
|
96
|
+
const commitRef = useRef(commit);
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
rendered.current = value;
|
|
99
|
+
commitRef.current = commit;
|
|
100
|
+
});
|
|
101
|
+
useIsomorphicLayoutEffect(
|
|
102
|
+
() => () => {
|
|
103
|
+
if (rendered.current === seen.current) commitRef.current.flush();
|
|
104
|
+
else commitRef.current.cancel();
|
|
105
|
+
},
|
|
106
|
+
[]
|
|
107
|
+
);
|
|
65
108
|
useEffect(() => {
|
|
66
109
|
if (seen.current === value) return;
|
|
67
110
|
seen.current = value;
|
|
@@ -73,29 +116,20 @@ function useDebouncedField(value, setValue) {
|
|
|
73
116
|
set: (next) => {
|
|
74
117
|
setDraft(next);
|
|
75
118
|
commit(next);
|
|
119
|
+
},
|
|
120
|
+
flush: () => {
|
|
121
|
+
commit.flush();
|
|
122
|
+
},
|
|
123
|
+
// Through the field's own `clear()` — it unsets rather than writing the fallback over it — and
|
|
124
|
+
// unconditional: the store may still hold the old phrase, or an unflushed one.
|
|
125
|
+
clear: () => {
|
|
126
|
+
commit.cancel();
|
|
127
|
+
setDraft("");
|
|
128
|
+
seen.current = rendered.current;
|
|
129
|
+
clearField();
|
|
76
130
|
}
|
|
77
131
|
};
|
|
78
132
|
}
|
|
79
|
-
function SearchIcon() {
|
|
80
|
-
return /* @__PURE__ */ jsxs(
|
|
81
|
-
"svg",
|
|
82
|
-
{
|
|
83
|
-
width: 16,
|
|
84
|
-
height: 16,
|
|
85
|
-
viewBox: "0 0 24 24",
|
|
86
|
-
fill: "none",
|
|
87
|
-
stroke: "currentColor",
|
|
88
|
-
strokeWidth: 2,
|
|
89
|
-
strokeLinecap: "round",
|
|
90
|
-
strokeLinejoin: "round",
|
|
91
|
-
"aria-hidden": true,
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
|
|
94
|
-
/* @__PURE__ */ jsx("path", { d: "M21 21l-4.35 -4.35" })
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
133
|
export {
|
|
100
134
|
SearchFilter
|
|
101
135
|
};
|
|
@@ -32,23 +32,10 @@
|
|
|
32
32
|
import type { ReactNode } from 'react';
|
|
33
33
|
import type { EnumField, FieldHandle } from '../state.js';
|
|
34
34
|
import type { StringField } from '../state/fields.js';
|
|
35
|
+
import type { FilterBase, FilterOption } from './filter-base.js';
|
|
35
36
|
import type { UncontrolledProps } from './uncontrolled.js';
|
|
36
|
-
|
|
37
|
-
* One row of a runtime catalogue. Wider than the store's own `FieldOption` by exactly one member:
|
|
38
|
-
* `disabled` renders the row and refuses the selection, which a declared enum expresses by leaving
|
|
39
|
-
* the value out and a live catalogue cannot (an archived project still labels the rows already
|
|
40
|
-
* pointing at it).
|
|
41
|
-
*/
|
|
42
|
-
export type FilterOption = {
|
|
43
|
-
readonly value: string;
|
|
44
|
-
readonly label: string;
|
|
45
|
-
readonly disabled?: boolean;
|
|
46
|
-
};
|
|
47
|
-
type SelectFilterCommon = UncontrolledProps & {
|
|
37
|
+
type SelectFilterCommon = UncontrolledProps & FilterBase & {
|
|
48
38
|
readonly label: string;
|
|
49
|
-
readonly icon?: ReactNode;
|
|
50
|
-
/** Adds a `Clear` action that writes the field back to its fallback. */
|
|
51
|
-
readonly clearable?: boolean;
|
|
52
39
|
};
|
|
53
40
|
/** A closed enum field: `options` relabels rows the field already declares, so it is optional. */
|
|
54
41
|
export type SelectFilterEnumProps<T extends string> = SelectFilterCommon & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-filter.d.ts","sourceRoot":"","sources":["../../src/controls/select-filter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"select-filter.d.ts","sourceRoot":"","sources":["../../src/controls/select-filter.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,KAAK,kBAAkB,GAAG,iBAAiB,GAAG,UAAU,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAErF,kGAAkG;AAClG,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI,kBAAkB,GAAG;IACzE,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACzC,kFAAkF;IAClF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAA;CAC3C,CAAA;AAED,kGAAkG;AAClG,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG;IACzD,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,WAAW,CAAC,CAAA;IACxC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,MAAM,IAAI,qBAAqB,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAA;AAEpG;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;AAC1F,wBAAgB,YAAY,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,CAAA"}
|
|
@@ -20,12 +20,6 @@ export type SyncButtonProps = BasaltProps & {
|
|
|
20
20
|
};
|
|
21
21
|
/** How often the relative age re-renders. One interval, only while mounted. */
|
|
22
22
|
export declare const AGE_REFRESH_MS = 30000;
|
|
23
|
-
/**
|
|
24
|
-
* Relative age, coarse on purpose: a sync indicator answers "is this stale?", not "how stale to
|
|
25
|
-
* the second". Anything under a minute is `just now`, so the label stops flickering while a sync
|
|
26
|
-
* has just landed.
|
|
27
|
-
*/
|
|
28
|
-
export declare function formatAge(ms: number): string;
|
|
29
23
|
/**
|
|
30
24
|
* @example
|
|
31
25
|
* // page scope — the page's own data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-button.d.ts","sourceRoot":"","sources":["../../src/controls/sync-button.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"sync-button.d.ts","sourceRoot":"","sources":["../../src/controls/sync-button.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAMlD,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAC1C,OAAO,EAAE,OAAO,CAAA;IAChB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IACtC,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB;sEACkE;IAClE,KAAK,EAAE,MAAM,GAAG,QAAQ,CAAA;IACxB;yBACqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,+EAA+E;AAC/E,eAAO,MAAM,cAAc,QAAS,CAAA;AAmCpC;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,eAAe,EACf,MAAM,EACN,KAAK,EACL,KAAc,EACd,KAAK,EACL,SAAS,EACT,KAAK,GACN,EAAE,eAAe,GAAG,SAAS,CAkE7B"}
|
|
@@ -2,17 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ActionIcon, Button, Tooltip } from "@mantine/core";
|
|
3
3
|
import { useSyncExternalStore } from "react";
|
|
4
4
|
import { cx } from "../common/props.js";
|
|
5
|
+
import { relativeTime } from "../format/index.js";
|
|
5
6
|
import { IconSlot } from "../theme/icon-slot.js";
|
|
7
|
+
import { RefreshGlyph } from "./glyphs.js";
|
|
6
8
|
import classes from "./sync-button.module.css";
|
|
7
9
|
const AGE_REFRESH_MS = 3e4;
|
|
8
|
-
function formatAge(ms) {
|
|
9
|
-
if (ms < 6e4) return "just now";
|
|
10
|
-
const minutes = Math.floor(ms / 6e4);
|
|
11
|
-
if (minutes < 60) return `${minutes}m ago`;
|
|
12
|
-
const hours = Math.floor(minutes / 60);
|
|
13
|
-
if (hours < 24) return `${hours}h ago`;
|
|
14
|
-
return `${Math.floor(hours / 24)}d ago`;
|
|
15
|
-
}
|
|
16
10
|
function toMillis(at) {
|
|
17
11
|
if (at === null || at === void 0) return void 0;
|
|
18
12
|
return at instanceof Date ? at.getTime() : at;
|
|
@@ -21,7 +15,7 @@ function useRelativeAge(at) {
|
|
|
21
15
|
const timestamp = toMillis(at);
|
|
22
16
|
return useSyncExternalStore(
|
|
23
17
|
timestamp === void 0 ? subscribeNever : subscribeAgeTick,
|
|
24
|
-
() => timestamp === void 0 ? void 0 :
|
|
18
|
+
() => timestamp === void 0 ? void 0 : relativeTime(timestamp, { style: "short" }),
|
|
25
19
|
() => void 0
|
|
26
20
|
);
|
|
27
21
|
}
|
|
@@ -31,29 +25,6 @@ function subscribeAgeTick(onTick) {
|
|
|
31
25
|
const id = setInterval(onTick, AGE_REFRESH_MS);
|
|
32
26
|
return () => clearInterval(id);
|
|
33
27
|
}
|
|
34
|
-
function RefreshGlyph({ spinning }) {
|
|
35
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
-
"svg",
|
|
37
|
-
{
|
|
38
|
-
width: 16,
|
|
39
|
-
height: 16,
|
|
40
|
-
viewBox: "0 0 24 24",
|
|
41
|
-
fill: "none",
|
|
42
|
-
"aria-hidden": true,
|
|
43
|
-
className: spinning ? classes.spin : void 0,
|
|
44
|
-
children: /* @__PURE__ */ jsx(
|
|
45
|
-
"path",
|
|
46
|
-
{
|
|
47
|
-
d: "M20 11a8 8 0 1 0-2.34 5.66M20 5v6h-6",
|
|
48
|
-
stroke: "currentColor",
|
|
49
|
-
strokeWidth: 2,
|
|
50
|
-
strokeLinecap: "round",
|
|
51
|
-
strokeLinejoin: "round"
|
|
52
|
-
}
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
28
|
function SyncButton({
|
|
58
29
|
syncing,
|
|
59
30
|
lastCompletedAt,
|
|
@@ -102,7 +73,7 @@ function SyncButton({
|
|
|
102
73
|
...control,
|
|
103
74
|
...className !== void 0 && { className },
|
|
104
75
|
...style !== void 0 && { style },
|
|
105
|
-
children: /* @__PURE__ */ jsx(IconSlot, { children: /* @__PURE__ */ jsx(RefreshGlyph, {
|
|
76
|
+
children: /* @__PURE__ */ jsx(IconSlot, { children: /* @__PURE__ */ jsx(RefreshGlyph, { className: syncing ? classes.spin : void 0 }) })
|
|
106
77
|
}
|
|
107
78
|
) : /* @__PURE__ */ jsxs(
|
|
108
79
|
Button,
|
|
@@ -110,7 +81,7 @@ function SyncButton({
|
|
|
110
81
|
variant: "default",
|
|
111
82
|
className: cx(classes.pageButton, className),
|
|
112
83
|
...style !== void 0 && { style },
|
|
113
|
-
leftSection: /* @__PURE__ */ jsx(IconSlot, { children: /* @__PURE__ */ jsx(RefreshGlyph, {
|
|
84
|
+
leftSection: /* @__PURE__ */ jsx(IconSlot, { children: /* @__PURE__ */ jsx(RefreshGlyph, { className: syncing ? classes.spin : void 0 }) }),
|
|
114
85
|
...control,
|
|
115
86
|
children: [
|
|
116
87
|
/* @__PURE__ */ jsx("span", { className: classes.label, children: label }),
|
|
@@ -124,6 +95,5 @@ function SyncButton({
|
|
|
124
95
|
}
|
|
125
96
|
export {
|
|
126
97
|
AGE_REFRESH_MS,
|
|
127
|
-
SyncButton
|
|
128
|
-
formatAge
|
|
98
|
+
SyncButton
|
|
129
99
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { FieldHandle } from '../state.js';
|
|
3
3
|
import type { BooleanField } from '../state/fields.js';
|
|
4
|
+
import type { FilterBase } from './filter-base.js';
|
|
4
5
|
import type { UncontrolledProps } from './uncontrolled.js';
|
|
5
|
-
export type ToggleFilterProps = UncontrolledProps & {
|
|
6
|
+
export type ToggleFilterProps = UncontrolledProps & Omit<FilterBase, 'clearable'> & {
|
|
6
7
|
readonly field: FieldHandle<BooleanField>;
|
|
7
8
|
readonly label: string;
|
|
8
|
-
readonly icon?: ReactNode;
|
|
9
9
|
};
|
|
10
10
|
export declare function ToggleFilter(props: ToggleFilterProps): ReactNode;
|
|
11
11
|
//# sourceMappingURL=toggle-filter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle-filter.d.ts","sourceRoot":"","sources":["../../src/controls/toggle-filter.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"toggle-filter.d.ts","sourceRoot":"","sources":["../../src/controls/toggle-filter.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAC/C,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG;IAC9B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAEH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAoDhE"}
|
|
@@ -9,7 +9,7 @@ function ToggleFilter(props) {
|
|
|
9
9
|
assertRequiredProps("ToggleFilter", props, ["field"], {
|
|
10
10
|
field: "bind it to a store field (`store.field.<name>`), never a value/onChange pair."
|
|
11
11
|
});
|
|
12
|
-
const { field, label, icon, className, style } = props;
|
|
12
|
+
const { field, label, icon, disabled, className, style } = props;
|
|
13
13
|
const [value, setValue] = field.use();
|
|
14
14
|
const surface = useFilterSurface();
|
|
15
15
|
const id = useId();
|
|
@@ -26,7 +26,7 @@ function ToggleFilter(props) {
|
|
|
26
26
|
Switch,
|
|
27
27
|
{
|
|
28
28
|
id,
|
|
29
|
-
|
|
29
|
+
...disabled === true && { disabled: true },
|
|
30
30
|
checked: value,
|
|
31
31
|
onChange: (event) => {
|
|
32
32
|
setValue(event.currentTarget.checked);
|
|
@@ -45,6 +45,7 @@ function ToggleFilter(props) {
|
|
|
45
45
|
active: value,
|
|
46
46
|
pressed: value,
|
|
47
47
|
hideGlyph: true,
|
|
48
|
+
...disabled === true && { disabled: true },
|
|
48
49
|
...icon !== void 0 && { icon },
|
|
49
50
|
onClick: () => {
|
|
50
51
|
setValue(!value);
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { EnumField, FieldHandle } from '../state.js';
|
|
3
|
+
import type { FilterBase, FilterOption } from './filter-base.js';
|
|
3
4
|
import type { UncontrolledProps } from './uncontrolled.js';
|
|
4
|
-
export type ViewTabsOption<T extends string> = {
|
|
5
|
-
readonly value: T;
|
|
6
|
-
readonly label: string;
|
|
5
|
+
export type ViewTabsOption<T extends string> = FilterOption<T> & {
|
|
7
6
|
/** Render this option on ONE viewport only. Omitted → both. */
|
|
8
7
|
readonly only?: 'sm-up' | 'sm-down';
|
|
9
8
|
};
|
|
10
|
-
export type ViewTabsProps<T extends string> = UncontrolledProps & {
|
|
9
|
+
export type ViewTabsProps<T extends string> = UncontrolledProps & Pick<FilterBase, 'disabled'> & {
|
|
11
10
|
readonly field: FieldHandle<EnumField<T>>;
|
|
12
11
|
/** Defaults to `field.options` (every declared value, labelled by `store.labels()`). */
|
|
13
12
|
readonly options?: readonly ViewTabsOption<T>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-tabs.d.ts","sourceRoot":"","sources":["../../src/controls/view-tabs.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"view-tabs.d.ts","sourceRoot":"","sources":["../../src/controls/view-tabs.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAItD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAgBvD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC,GAAG;IAC/D,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CACpC,CAAA;AAED,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,GAC7D,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG;IAC7B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAA;IACzC,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,cAAc,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,SAAS,CA0G7E"}
|
|
@@ -4,14 +4,21 @@ import { cx } from "../common/props.js";
|
|
|
4
4
|
import { assertRequiredProps } from "../common/validate.js";
|
|
5
5
|
import classes from "./controls.module.css";
|
|
6
6
|
import { useFilterSurface } from "./filter-context.js";
|
|
7
|
-
import { useControlName } from "./
|
|
7
|
+
import { useControlName } from "./control-name.js";
|
|
8
8
|
import { PanelChoice, PanelRow, useTrackFits } from "./panel-row.js";
|
|
9
|
+
function toSegmentData(options) {
|
|
10
|
+
return options.map((option) => ({
|
|
11
|
+
value: option.value,
|
|
12
|
+
label: option.label,
|
|
13
|
+
disabled: option.disabled === true
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
9
16
|
const PHONE_TRACK_MAX = 3;
|
|
10
17
|
function ViewTabs(props) {
|
|
11
18
|
assertRequiredProps("ViewTabs", props, ["field"], {
|
|
12
19
|
field: "bind it to a store field (`store.field.<name>`), never a value/onChange pair."
|
|
13
20
|
});
|
|
14
|
-
const { field, options, label = "View", className, style } = props;
|
|
21
|
+
const { field, options, label = "View", disabled, className, style } = props;
|
|
15
22
|
const [value, setValue] = field.use();
|
|
16
23
|
const surface = useFilterSurface();
|
|
17
24
|
const inPanel = surface === "panel";
|
|
@@ -22,7 +29,7 @@ function ViewTabs(props) {
|
|
|
22
29
|
const commit = (next) => {
|
|
23
30
|
setValue(next);
|
|
24
31
|
};
|
|
25
|
-
const phoneData = phone
|
|
32
|
+
const phoneData = toSegmentData(phone);
|
|
26
33
|
const phoneCountFits = phone.length <= PHONE_TRACK_MAX;
|
|
27
34
|
const { rootRef: phoneRootRef, fits: phoneFits } = useTrackFits(
|
|
28
35
|
phoneCountFits,
|
|
@@ -36,7 +43,16 @@ function ViewTabs(props) {
|
|
|
36
43
|
labelId,
|
|
37
44
|
...className !== void 0 && { className },
|
|
38
45
|
...style !== void 0 && { style },
|
|
39
|
-
children: /* @__PURE__ */ jsx(
|
|
46
|
+
children: /* @__PURE__ */ jsx(
|
|
47
|
+
PanelChoice,
|
|
48
|
+
{
|
|
49
|
+
nameProps,
|
|
50
|
+
value,
|
|
51
|
+
options: all,
|
|
52
|
+
onChange: commit,
|
|
53
|
+
...disabled === true && { disabled: true }
|
|
54
|
+
}
|
|
55
|
+
)
|
|
40
56
|
}
|
|
41
57
|
);
|
|
42
58
|
}
|
|
@@ -47,8 +63,9 @@ function ViewTabs(props) {
|
|
|
47
63
|
"aria-label": label,
|
|
48
64
|
visibleFrom: "sm",
|
|
49
65
|
size: "ctl",
|
|
66
|
+
...disabled === true && { disabled: true },
|
|
50
67
|
value,
|
|
51
|
-
data: desktop
|
|
68
|
+
data: toSegmentData(desktop),
|
|
52
69
|
onChange: commit,
|
|
53
70
|
...className !== void 0 && { className },
|
|
54
71
|
...style !== void 0 && { style }
|
|
@@ -62,6 +79,7 @@ function ViewTabs(props) {
|
|
|
62
79
|
hiddenFrom: "sm",
|
|
63
80
|
size: "ctl",
|
|
64
81
|
fullWidth: true,
|
|
82
|
+
...disabled === true && { disabled: true },
|
|
65
83
|
value,
|
|
66
84
|
data: phoneData,
|
|
67
85
|
onChange: commit,
|
|
@@ -78,6 +96,7 @@ function ViewTabs(props) {
|
|
|
78
96
|
...style !== void 0 && { style },
|
|
79
97
|
value,
|
|
80
98
|
allowDeselect: false,
|
|
99
|
+
...disabled === true && { disabled: true },
|
|
81
100
|
data: phoneData,
|
|
82
101
|
onChange: (next) => {
|
|
83
102
|
if (next !== null) commit(next);
|
package/dist/format/date.d.ts
CHANGED
|
@@ -1,28 +1,61 @@
|
|
|
1
1
|
import type { LocaleOption } from './shared.js';
|
|
2
|
+
type DateInput = Date | number | string | null | undefined;
|
|
2
3
|
export type WeekdayOptions = LocaleOption & {
|
|
3
4
|
/** `Intl.DateTimeFormat`'s own weekday widths. Default `'short'` (`"Mon"`). */
|
|
4
5
|
format?: 'short' | 'long' | 'narrow';
|
|
5
6
|
};
|
|
6
7
|
/** Weekday name — seeded from `astro-window/formulas.ts#fmtWeekday`. A plain `YYYY-MM-DD` string
|
|
7
8
|
* is parsed as a LOCAL calendar date (never UTC), matching that seed's own rationale: the weekday
|
|
8
|
-
* must not shift a day depending on the reader's timezone. A non-finite/unparseable input
|
|
9
|
-
* {@link NON_FINITE}. */
|
|
9
|
+
* must not shift a day depending on the reader's timezone. A non-finite/unparseable input (or a
|
|
10
|
+
* day that does not exist, `2026-02-31`) prints {@link NON_FINITE}. */
|
|
10
11
|
export declare function weekday(value: Date | number | string, options?: WeekdayOptions): string;
|
|
11
12
|
export type RelativeTimeOptions = LocaleOption & {
|
|
13
|
+
/** `Intl.RelativeTimeFormat` width. Default `'long'` (`"3 hours ago"`); `'short'` is `"3 hr. ago"`. */
|
|
14
|
+
style?: 'long' | 'short' | 'narrow';
|
|
15
|
+
/** `'auto'` (default) uses idioms (`"yesterday"`, `"now"`); `'always'` keeps the number. */
|
|
16
|
+
numeric?: 'auto' | 'always';
|
|
12
17
|
/** The reference "now" instant, epoch ms. Default `Date.now()` — mainly for tests. */
|
|
13
18
|
now?: number;
|
|
14
19
|
};
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* render-path code where one bad timestamp must not blank a whole list.
|
|
21
|
+
* THE relative-time formatter on `Intl.RelativeTimeFormat` — `"3 hours ago"`, `"in 2 days"`,
|
|
22
|
+
* `"now"`. Under a minute is `format(0, 'second')`, so "now" is the locale's own word. The count is
|
|
23
|
+
* rounded before the unit is chosen, so 59.98 minutes reads `"1 hour ago"`, never
|
|
24
|
+
* `"60 minutes ago"`. Accepts epoch ms, `Date` or an ISO string; `null`/`undefined`/unparseable
|
|
25
|
+
* prints {@link NON_FINITE} (`Intl` throws a `RangeError` on non-finite input, and this is
|
|
26
|
+
* render-path code where one bad timestamp must not blank a list).
|
|
23
27
|
*/
|
|
24
|
-
export declare function relativeTime(value:
|
|
28
|
+
export declare function relativeTime(value: DateInput, options?: RelativeTimeOptions): string;
|
|
29
|
+
export type DateOptions = LocaleOption & {
|
|
30
|
+
/** `Intl.DateTimeFormat` `dateStyle`/`timeStyle` width. Default `'medium'`. */
|
|
31
|
+
format?: 'short' | 'medium' | 'long';
|
|
32
|
+
/** IANA zone. Default `undefined` — passed straight through to `Intl`. Ignored for a plain
|
|
33
|
+
* `YYYY-MM-DD` string, which is a calendar date and prints the same day in every zone. */
|
|
34
|
+
timeZone?: string;
|
|
35
|
+
};
|
|
36
|
+
/** Calendar date — `"Sep 2, 2026"`. `null`/`undefined`/unparseable prints {@link NON_FINITE}. */
|
|
37
|
+
export declare function date(value: DateInput, options?: DateOptions): string;
|
|
38
|
+
/** Time of day — `"3:04:05 PM"` (`format: 'short'`: `"3:04 PM"`). A plain `YYYY-MM-DD` string reads as midnight UTC. */
|
|
39
|
+
export declare function time(value: DateInput, options?: DateOptions): string;
|
|
40
|
+
/** Date and time — `"Sep 2, 2026, 3:04:05 PM"` (`format: 'short'`: `"9/2/26, 3:04 PM"`; the date/time
|
|
41
|
+
* separator is the runtime's). */
|
|
42
|
+
export declare function dateTime(value: DateInput, options?: DateOptions): string;
|
|
25
43
|
/** Clock-style duration — `"1:02:03"`, `"04:12"`. Seeded from `walking-pad/
|
|
26
44
|
* formatters.ts#formatDurationClock`. A non-finite value prints {@link NON_FINITE}. */
|
|
27
45
|
export declare function durationClock(seconds: number): string;
|
|
46
|
+
export type DurationOptions = LocaleOption & {
|
|
47
|
+
/** `'clock'` (default) `"1:02:03"`; `'compact'` `"1h 02m 03s"`; `'long'` `"1 hour 2 minutes 3 seconds"`. */
|
|
48
|
+
style?: 'clock' | 'compact' | 'long';
|
|
49
|
+
/** Largest unit `'compact'`/`'long'` break down to. Default `'hour'` (90 000 s is `"25h"`). */
|
|
50
|
+
largest?: 'day' | 'hour' | 'minute';
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* THE duration formatter. `'clock'` is {@link durationClock}; `'compact'` and `'long'` trim leading
|
|
54
|
+
* and trailing zero units but keep a zero between two non-zero ones (`"1h 00m 03s"`); zero is
|
|
55
|
+
* `"0s"` / `"0 seconds"`. `'long'` labels through `Intl.NumberFormat` unit style (locale-aware) —
|
|
56
|
+
* `Intl.DurationFormat` is not in the pinned TS lib. `null`/`undefined`/non-finite prints
|
|
57
|
+
* {@link NON_FINITE}; negatives clamp to zero.
|
|
58
|
+
*/
|
|
59
|
+
export declare function duration(seconds: number | null | undefined, options?: DurationOptions): string;
|
|
60
|
+
export {};
|
|
28
61
|
//# sourceMappingURL=date.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/format/date.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;CACrC,CAAA;AAED;;;
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/format/date.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAE5C,KAAK,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;AAiC1D,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;CACrC,CAAA;AAED;;;uEAGuE;AACvE,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,MAAM,CAM3F;AAED,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG;IAC/C,uGAAuG;IACvG,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnC,4FAA4F;IAC5F,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IAC3B,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,CAAA;AAqCD;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,mBAAwB,GAAG,MAAM,CAmBxF;AAED,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG;IACvC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IACpC;8FAC0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAeD,iGAAiG;AACjG,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAOxE;AAED,wHAAwH;AACxH,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAOxE;AAED;kCACkC;AAClC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAS5E;AAED;uFACuF;AACvF,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CASrD;AAED,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG;IAC3C,4GAA4G;IAC5G,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;IACpC,+FAA+F;IAC/F,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAA;CACpC,CAAA;AASD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,OAAO,GAAE,eAAoB,GAC5B,MAAM,CAwBR"}
|