@heyramzi/ui 2.23.0 → 2.24.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/COMPONENTS.md +3 -6
- package/dist/ai/confirmation/index.js +3 -6
- package/dist/ai/index.js +1 -5
- package/dist/charts/dashboard/index.js +1 -3
- package/dist/charts/primitives/chart-utils.js +14 -0
- package/dist/components/chip/index.js +1 -0
- package/dist/components/language-flag/flags.js +5 -0
- package/dist/components/language-flag/index.js +1 -0
- package/dist/components/list-page/index.js +1 -3
- package/dist/components/work-parts/index.js +1 -1
- package/dist/editor/doc-blocks.js +2 -1
- package/dist/effects/animated-beam/path-calculator.svelte.js +13 -6
- package/dist/lib/dates.js +41 -0
- package/dist/lib/panel.js +2 -2
- package/dist/lib/tone.js +13 -0
- package/dist/record/format.js +2 -18
- package/dist/record/logic.js +3 -6
- package/dist/status/index.js +1 -1
- package/dist/work/dates.js +2 -3
- package/dist/work/detail/detail-types.js +0 -8
- package/dist/work/docs/edited.js +8 -7
- package/dist/work/inbox/inbox-logic.js +5 -20
- package/dist/work/index.js +0 -2
- package/dist/work/time/duration.js +2 -3
- package/package.json +1 -21
- package/src/ai/confirmation/Confirmation.svelte +2 -2
- package/src/ai/confirmation/{ConfirmationRequest.svelte → ConfirmationState.svelte} +6 -3
- package/src/ai/confirmation/confirmation-context.svelte.ts +2 -2
- package/src/ai/confirmation/confirmation-parts.test.svelte +17 -0
- package/src/ai/confirmation/confirmation-parts.test.ts +23 -0
- package/src/ai/confirmation/index.ts +6 -21
- package/src/ai/index.ts +3 -13
- package/src/ai/typing-dots/TypingDots.svelte +32 -12
- package/src/ai/typing-dots/typing-dots.test.ts +36 -0
- package/src/canvas/ui/canvas-ui.css +12 -0
- package/src/charts/README.md +2 -2
- package/src/charts/area-chart.svelte +3 -10
- package/src/charts/bar-chart.svelte +4 -12
- package/src/charts/dashboard/data-table.svelte +21 -21
- package/src/charts/dashboard/index.ts +1 -3
- package/src/charts/dashboard/rating-chip.svelte +9 -11
- package/src/charts/dashboard/stat-tile.svelte +3 -4
- package/src/charts/line-chart.svelte +3 -10
- package/src/charts/primitives/chart-utils.test.ts +17 -0
- package/src/charts/primitives/chart-utils.ts +16 -0
- package/src/charts/time-series-chart.svelte +8 -4
- package/src/components/chip/count-chip.svelte +35 -0
- package/src/components/chip/index.ts +1 -0
- package/src/components/data-table/data-table.ts +1 -1
- package/src/components/data-table/row-context-menu.svelte +3 -4
- package/src/components/data-table/sortable-head.svelte +45 -10
- package/src/components/language-flag/flags.ts +5 -0
- package/src/components/language-flag/index.ts +1 -0
- package/src/components/language-flag/language-flag.svelte +3 -11
- package/src/components/list-page/empty-state.svelte +90 -12
- package/src/components/list-page/filter-popover.svelte +2 -5
- package/src/components/list-page/grouped-list.svelte +2 -4
- package/src/components/list-page/index.ts +1 -3
- package/src/components/section-header/section-header.svelte +2 -6
- package/src/components/segmented/segment.svelte +13 -19
- package/src/components/segmented/segmented-filter.svelte +1 -2
- package/src/components/table-view/table-view.svelte +31 -45
- package/src/components/table-view/table-view.test.ts +6 -3
- package/src/components/work-parts/group-head.svelte +1 -1
- package/src/components/work-parts/index.ts +1 -1
- package/src/editor/doc-blocks.ts +2 -1
- package/src/effects/animated-beam/path-calculator.svelte.ts +19 -5
- package/src/effects/marquee/Marquee.css +6 -3
- package/src/effects/marquee/Marquee.svelte +6 -2
- package/src/inbox/thread-inbox.svelte +6 -4
- package/src/lib/dates.test.ts +63 -0
- package/src/lib/dates.ts +63 -0
- package/src/lib/panel.svelte +116 -0
- package/src/lib/panel.ts +2 -2
- package/src/lib/tone.ts +15 -0
- package/src/panel/side-panel.svelte +4 -4
- package/src/record/format.ts +3 -15
- package/src/record/logic.ts +2 -6
- package/src/record/record-stats.svelte +4 -3
- package/src/record/steps-rail.svelte +7 -4
- package/src/status/index.ts +1 -1
- package/src/status/status-pill.svelte +2 -8
- package/src/thread/thread.svelte +3 -6
- package/src/work/README.md +0 -1
- package/src/work/dates.ts +3 -3
- package/src/work/demo.svelte +9 -1
- package/src/work/detail/detail-demo.svelte +30 -27
- package/src/work/detail/detail-types.ts +1 -29
- package/src/work/detail/task-detail.svelte +18 -17
- package/src/work/docs/doc-menu.svelte +2 -1
- package/src/work/docs/edited.ts +4 -7
- package/src/work/inbox/inbox-card.svelte +4 -9
- package/src/work/inbox/inbox-logic.ts +4 -16
- package/src/work/index.ts +1 -3
- package/src/work/time/duration.ts +2 -3
- package/dist/ai/thinking-dots/index.js +0 -3
- package/dist/components/icon/index.js +0 -1
- package/dist/components/locale-switch/index.js +0 -1
- package/dist/icons/trades.js +0 -49
- package/dist/status/pill-tint.js +0 -13
- package/dist/work/presets/sales.js +0 -39
- package/src/ai/confirmation/ConfirmationAccepted.svelte +0 -23
- package/src/ai/confirmation/ConfirmationFailed.svelte +0 -23
- package/src/ai/confirmation/ConfirmationRejected.svelte +0 -23
- package/src/ai/thinking-dots/ThinkingDots.svelte +0 -42
- package/src/ai/thinking-dots/index.ts +0 -5
- package/src/charts/dashboard/dashboard-empty.svelte +0 -55
- package/src/charts/dashboard/data-panel.svelte +0 -81
- package/src/charts/dashboard/data-sort-head.svelte +0 -102
- package/src/components/icon/icon.svelte +0 -23
- package/src/components/icon/index.ts +0 -1
- package/src/components/list-page/detail-empty.svelte +0 -45
- package/src/components/list-page/detail-panel.svelte +0 -82
- package/src/components/list-page/rail-empty.svelte +0 -44
- package/src/components/locale-switch/index.ts +0 -1
- package/src/components/locale-switch/locale-switch.svelte +0 -59
- package/src/components/work-parts/count-chip.svelte +0 -20
- package/src/icons/TradeIcon.svelte +0 -16
- package/src/icons/trades.ts +0 -89
- package/src/status/pill-tint.ts +0 -16
- package/src/work/detail/task-property.svelte +0 -17
- package/src/work/detail/task-thread.svelte +0 -221
- package/src/work/presets/sales.ts +0 -16
package/COMPONENTS.md
CHANGED
|
@@ -64,11 +64,9 @@ Generic pieces built on the primitives, imported from `@heyramzi/ui/components/<
|
|
|
64
64
|
- `copy` — CopyButton, copyText, copyRichText, htmlToPlainText, Copied
|
|
65
65
|
- `data-table` — SortableHead, Pagination, InfiniteScroll, RowContextMenu, TableSkeleton, and the sort, page and filter helpers
|
|
66
66
|
- `hold-to-confirm` — HoldToConfirm, press and hold to confirm
|
|
67
|
-
- `
|
|
68
|
-
- `language-flag` — LanguageFlag
|
|
67
|
+
- `language-flag` — LanguageFlag, LANGUAGE_FLAGS (code to `/flags/*.svg`, also a SegmentedFilter option's `image`)
|
|
69
68
|
- `list-page` — ListPageShell, MasterDetail, GroupedList, RailRow and the rest of the master-detail page kit, NoticeBar, EmptyState, FilterPopover, setSectionHost
|
|
70
69
|
- `toolbar` — Toolbar: one row at any width; search, tabs and the view switch fold into menus in a narrow pane
|
|
71
|
-
- `locale-switch` — LocaleSwitch, a language switch on SegmentedFilter
|
|
72
70
|
- `mark` — Mark, a logo or photo glyph with an initial fallback
|
|
73
71
|
- `open-in` — OpenIn, a link out to a tool that takes the tool's name, label and mark as a prop
|
|
74
72
|
- `picker` — Picker, MarkPicker, pickerTriggerClass, a command palette at popover scale
|
|
@@ -122,15 +120,14 @@ Generic pieces built on the primitives, imported from `@heyramzi/ui/components/<
|
|
|
122
120
|
## AI and chat (`src/ai`)
|
|
123
121
|
|
|
124
122
|
- `ai-button` — AiButton
|
|
125
|
-
- `confirmation` — Confirmation, ConfirmationTitle,
|
|
123
|
+
- `confirmation` — Confirmation, ConfirmationTitle, ConfirmationState (`when` names the kind it shows), ConfirmationActions, ConfirmationAction, type ConfirmationKind
|
|
126
124
|
- `generation-progress` — GenerationProgress
|
|
127
125
|
- `loading-state` — PixelLoader
|
|
128
126
|
- `prompt-input` — PromptInput, PromptInputBody, PromptInputToolbar, PromptInputTextarea, PromptInputSubmit
|
|
129
127
|
- `reasoning` — Reasoning, ReasoningTrigger, ReasoningContent
|
|
130
128
|
- `response` — Response
|
|
131
129
|
- `suggestion` — Suggestion, Suggestions
|
|
132
|
-
- `
|
|
133
|
-
- `typing-dots` — TypingDots
|
|
130
|
+
- `typing-dots` — TypingDots. A `label` makes it a `role="status"` line
|
|
134
131
|
- `voice-waveform` — VoiceWaveform
|
|
135
132
|
|
|
136
133
|
## Record (`src/record`)
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import Confirmation from "../../../src/ai/confirmation/Confirmation.svelte";
|
|
2
2
|
import ConfirmationTitle from "../../../src/ai/confirmation/ConfirmationTitle.svelte";
|
|
3
|
-
import
|
|
4
|
-
import ConfirmationAccepted from "../../../src/ai/confirmation/ConfirmationAccepted.svelte";
|
|
5
|
-
import ConfirmationRejected from "../../../src/ai/confirmation/ConfirmationRejected.svelte";
|
|
6
|
-
import ConfirmationFailed from "../../../src/ai/confirmation/ConfirmationFailed.svelte";
|
|
3
|
+
import ConfirmationState from "../../../src/ai/confirmation/ConfirmationState.svelte";
|
|
7
4
|
import ConfirmationActions from "../../../src/ai/confirmation/ConfirmationActions.svelte";
|
|
8
5
|
import ConfirmationAction from "../../../src/ai/confirmation/ConfirmationAction.svelte";
|
|
9
|
-
export { Confirmation, ConfirmationTitle,
|
|
6
|
+
export { Confirmation, ConfirmationTitle, ConfirmationState, ConfirmationActions, ConfirmationAction,
|
|
10
7
|
//
|
|
11
|
-
Confirmation as Root, ConfirmationTitle as Title,
|
|
8
|
+
Confirmation as Root, ConfirmationTitle as Title, ConfirmationState as State, ConfirmationActions as Actions, ConfirmationAction as Action };
|
package/dist/ai/index.js
CHANGED
|
@@ -17,11 +17,7 @@ export { PromptInput, PromptInputBody, PromptInputToolbar, PromptInputTextarea,
|
|
|
17
17
|
// =========================
|
|
18
18
|
// CONFIRMATION
|
|
19
19
|
// =========================
|
|
20
|
-
export { Confirmation, ConfirmationTitle,
|
|
21
|
-
// =========================
|
|
22
|
-
// THINKING DOTS
|
|
23
|
-
// =========================
|
|
24
|
-
export { ThinkingDots } from "./thinking-dots/index.js";
|
|
20
|
+
export { Confirmation, ConfirmationTitle, ConfirmationState, ConfirmationActions, ConfirmationAction } from "./confirmation/index.js";
|
|
25
21
|
// =========================
|
|
26
22
|
// VOICE WAVEFORM
|
|
27
23
|
// =========================
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export { default as DataPanel } from "../../../src/
|
|
2
|
-
export { default as DataSortHead } from "../../../src/charts/dashboard/data-sort-head.svelte";
|
|
1
|
+
export { default as DataPanel } from "../../../src/lib/panel.svelte";
|
|
3
2
|
export { default as DataTable } from "../../../src/charts/dashboard/data-table.svelte";
|
|
4
3
|
export { default as RatingChip } from "../../../src/charts/dashboard/rating-chip.svelte";
|
|
5
|
-
export { default as DashboardEmpty } from "../../../src/charts/dashboard/dashboard-empty.svelte";
|
|
6
4
|
export { default as DashboardSection } from "../../../src/charts/dashboard/dashboard-section.svelte";
|
|
7
5
|
export { default as PanelGrid } from "../../../src/charts/dashboard/panel-grid.svelte";
|
|
8
6
|
export { default as PeriodFilter } from "../../../src/charts/dashboard/period-filter.svelte";
|
|
@@ -13,6 +13,20 @@ export function getPayloadConfigFromPayload(config, item, key) {
|
|
|
13
13
|
}
|
|
14
14
|
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
15
15
|
}
|
|
16
|
+
const compact = new Intl.NumberFormat(undefined, {
|
|
17
|
+
notation: "compact",
|
|
18
|
+
maximumFractionDigits: 1
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* An axis tick formatter. "1,000,000" overflows the 48px gutter and the gap between ticks, so a
|
|
22
|
+
* label over 6 characters falls back to "1M"; the tooltip keeps the full value.
|
|
23
|
+
*/
|
|
24
|
+
export function valueTick(format) {
|
|
25
|
+
return (v) => {
|
|
26
|
+
const full = format(v);
|
|
27
|
+
return full.length > 6 && Number.isFinite(v) ? compact.format(v) : full;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
16
30
|
const chartContextKey = Symbol("chart-context");
|
|
17
31
|
export function setChartContext(value) {
|
|
18
32
|
return setContext(chartContextKey, value);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { default as DetailEmpty } from "../../../src/components/list-page/detail-empty.svelte";
|
|
2
1
|
export { default as DetailHeader } from "../../../src/components/list-page/detail-header.svelte";
|
|
3
|
-
export { default as DetailPanel } from "../../../src/
|
|
2
|
+
export { default as DetailPanel } from "../../../src/lib/panel.svelte";
|
|
4
3
|
export { default as DetailRow } from "../../../src/components/list-page/detail-row.svelte";
|
|
5
4
|
export { default as DetailStack } from "../../../src/components/list-page/detail-stack.svelte";
|
|
6
5
|
export { default as EmptyState } from "../../../src/components/list-page/empty-state.svelte";
|
|
@@ -9,7 +8,6 @@ export { default as PrevNext } from "../../../src/components/list-page/prev-next
|
|
|
9
8
|
export { stepTo } from "./step.js";
|
|
10
9
|
export { default as NoticeBar } from "../../../src/components/list-page/notice-bar.svelte";
|
|
11
10
|
export { default as RailBody } from "../../../src/components/list-page/rail-body.svelte";
|
|
12
|
-
export { default as RailEmpty } from "../../../src/components/list-page/rail-empty.svelte";
|
|
13
11
|
export { default as RailHead } from "../../../src/components/list-page/rail-head.svelte";
|
|
14
12
|
export { default as RailRow } from "../../../src/components/list-page/rail-row.svelte";
|
|
15
13
|
export { default as SectionLabel } from "../../../src/components/section-header/section-label.svelte";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as CountChip } from "../../../src/components/
|
|
1
|
+
export { default as CountChip } from "../../../src/components/chip/count-chip.svelte";
|
|
2
2
|
export { default as GroupHead } from "../../../src/components/work-parts/group-head.svelte";
|
|
3
3
|
export { default as PropertyRow } from "../../../src/components/work-parts/property-row.svelte";
|
|
4
4
|
export { default as WorkCard } from "../../../src/components/work-parts/work-card.svelte";
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { Extension } from "@tiptap/core";
|
|
6
6
|
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
7
7
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
8
|
+
import { copyText } from "../components/copy/clipboard.js";
|
|
8
9
|
import { anchorIds } from "./anchors.js";
|
|
9
10
|
const LINK_ICON = `<svg width="12" height="12" viewBox="0 0 256 256" fill="currentColor" aria-hidden="true"><path d="M240 88.23a54.43 54.43 0 0 1-16 37L189.25 160a54.27 54.27 0 0 1-38.63 16h-.05A54.63 54.63 0 0 1 96 119.84a8 8 0 0 1 16 .45A38.62 38.62 0 0 0 150.58 160a38.4 38.4 0 0 0 27.31-11.31l34.75-34.75a38.63 38.63 0 0 0-54.63-54.63l-11 11A8 8 0 0 1 135.7 59l11-11a54.65 54.65 0 0 1 77.3 0A54.86 54.86 0 0 1 240 88.23ZM109 185.66l-11 11A38.41 38.41 0 0 1 70.6 208a38.63 38.63 0 0 1-27.29-65.94L78 107.31a38.63 38.63 0 0 1 54.63 0 8 8 0 0 0 11.31-11.31 54.65 54.65 0 0 0-77.3 0L32 130.75A54.62 54.62 0 0 0 70.56 224a54.28 54.28 0 0 0 38.64-16l11-11a8 8 0 0 0-11.2-11.34Z"/></svg>`;
|
|
10
11
|
const anchorsKey = new PluginKey("headingAnchors");
|
|
@@ -48,7 +49,7 @@ export const HeadingAnchors = Extension.create({
|
|
|
48
49
|
button.addEventListener("click", () => {
|
|
49
50
|
const { origin, pathname, search } = window.location;
|
|
50
51
|
const url = `${origin}${pathname}${search}#${id}`;
|
|
51
|
-
void
|
|
52
|
+
void copyText(url);
|
|
52
53
|
button.dataset.copied = "true";
|
|
53
54
|
setTimeout(() => delete button.dataset.copied, 1400);
|
|
54
55
|
options.oncopy?.(url, id);
|
|
@@ -15,14 +15,21 @@ export function usePathCalculator() {
|
|
|
15
15
|
const containerRect = containerRef.getBoundingClientRect();
|
|
16
16
|
const rectA = fromRef.getBoundingClientRect();
|
|
17
17
|
const rectB = toRef.getBoundingClientRect();
|
|
18
|
+
// A scaled ancestor shrinks every rect, but the SVG draws in the container's own pixels.
|
|
19
|
+
// Divide the scale out, or the beams stop short of their nodes.
|
|
20
|
+
const scaleX = containerRef.offsetWidth ? containerRect.width / containerRef.offsetWidth : 1;
|
|
21
|
+
const scaleY = containerRef.offsetHeight ? containerRect.height / containerRef.offsetHeight : 1;
|
|
22
|
+
const local = (rect) => new DOMRect((rect.left - containerRect.left) / scaleX, (rect.top - containerRect.top) / scaleY, rect.width / scaleX, rect.height / scaleY);
|
|
23
|
+
const a = local(rectA);
|
|
24
|
+
const b = local(rectB);
|
|
18
25
|
svgDimensions = {
|
|
19
|
-
width: containerRect.width,
|
|
20
|
-
height: containerRect.height
|
|
26
|
+
width: containerRect.width / scaleX,
|
|
27
|
+
height: containerRect.height / scaleY
|
|
21
28
|
};
|
|
22
|
-
const startX = anchorX(
|
|
23
|
-
const startY =
|
|
24
|
-
const endX = anchorX(
|
|
25
|
-
const endY =
|
|
29
|
+
const startX = anchorX(a, 0, fromAnchor, startXOffset);
|
|
30
|
+
const startY = a.top + a.height / 2 + startYOffset;
|
|
31
|
+
const endX = anchorX(b, 0, toAnchor, endXOffset);
|
|
32
|
+
const endY = b.top + b.height / 2 + endYOffset;
|
|
26
33
|
// A cubic with horizontal handles, not a quadratic through a raised midpoint.
|
|
27
34
|
// The quadratic put its single control point at `midY` minus `curvature`, which for a fan into one node lands past the far end:
|
|
28
35
|
// the top beam dove below the hub and crossed the middle beam before arriving, and three beams bundled into a lens for the last stretch.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** "Oct 23" in the caller's locale. */
|
|
2
|
+
export function shortDate(at, { locale, timeZone, year } = {}) {
|
|
3
|
+
return new Intl.DateTimeFormat(locale, {
|
|
4
|
+
month: "short",
|
|
5
|
+
day: "numeric",
|
|
6
|
+
year: year ? "numeric" : undefined,
|
|
7
|
+
timeZone
|
|
8
|
+
}).format(new Date(at));
|
|
9
|
+
}
|
|
10
|
+
const UNITS = [
|
|
11
|
+
[31536e3, "year"],
|
|
12
|
+
[2592e3, "month"],
|
|
13
|
+
[604800, "week"],
|
|
14
|
+
[86400, "day"],
|
|
15
|
+
[3600, "hour"],
|
|
16
|
+
[60, "minute"]
|
|
17
|
+
];
|
|
18
|
+
/** "3 days ago", "in 2 weeks", "now": the largest whole unit between `at` and `now`. */
|
|
19
|
+
export function relativeTime(at, now = Date.now(), { locale, style = "long" } = {}) {
|
|
20
|
+
const seconds = Math.round((new Date(at).getTime() - new Date(now).getTime()) / 1e3);
|
|
21
|
+
const age = Math.abs(seconds);
|
|
22
|
+
const rtf = new Intl.RelativeTimeFormat(locale, {
|
|
23
|
+
numeric: "auto",
|
|
24
|
+
style
|
|
25
|
+
});
|
|
26
|
+
for (const [size, unit] of UNITS) {
|
|
27
|
+
if (age >= size) return rtf.format(Math.round(seconds / size), unit);
|
|
28
|
+
}
|
|
29
|
+
return rtf.format(0, "second");
|
|
30
|
+
}
|
|
31
|
+
/** The calendar day of a moment as `YYYY-MM-DD`, in the given zone or the viewer's own. Today by default. */
|
|
32
|
+
export function localDay(at = new Date(), timeZone) {
|
|
33
|
+
const parts = new Intl.DateTimeFormat("en-US", {
|
|
34
|
+
year: "numeric",
|
|
35
|
+
month: "2-digit",
|
|
36
|
+
day: "2-digit",
|
|
37
|
+
timeZone
|
|
38
|
+
}).formatToParts(new Date(at));
|
|
39
|
+
const part = (type) => parts.find((p) => p.type === type)?.value ?? "";
|
|
40
|
+
return `${part("year")}-${part("month")}-${part("day")}`;
|
|
41
|
+
}
|
package/dist/lib/panel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The one panel shell: a titled box holding a table, a chart or a stack. */
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// Tokens beside `panel.svelte`, because skeletons and hand-built cards draw this
|
|
3
|
+
// same edge without the panel's header.
|
|
4
4
|
// Dashboards used `Card`, so /ads had a ring and a shadow where /social had a
|
|
5
5
|
// hairline. Flat, one hairline, `rounded-xl`.
|
|
6
6
|
export const panelShellClass = "overflow-hidden rounded-xl border border-border bg-card";
|
package/dist/lib/tone.js
CHANGED
|
@@ -10,6 +10,19 @@ export const TONE_CLASS = {
|
|
|
10
10
|
warning: "border-warning/30 bg-warning/10 text-warning-800 dark:text-warning-400",
|
|
11
11
|
destructive: "border-destructive/30 bg-destructive/10 text-destructive-ink"
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* The scale as a quiet tint with no border: the icon and the text carry the tone, the fill only
|
|
15
|
+
* groups them. Neutral reads off the foreground, not `bg-muted`, because muted sits 0.005 L from
|
|
16
|
+
* the canvas and vanishes there (tokens board, "what fights the new scale").
|
|
17
|
+
*/
|
|
18
|
+
export const TONE_TINT = {
|
|
19
|
+
neutral: "bg-foreground/6 text-muted-foreground",
|
|
20
|
+
accent: "bg-[color-mix(in_oklab,var(--tone-accent,var(--color-primary))_12%,transparent)] text-[color:var(--tone-accent,var(--color-primary))]",
|
|
21
|
+
info: "bg-info/12 text-info-800 dark:text-info-400",
|
|
22
|
+
success: "bg-success/12 text-success-800 dark:text-success-400",
|
|
23
|
+
warning: "bg-warning/14 text-warning-800 dark:text-warning-400",
|
|
24
|
+
destructive: "bg-destructive/10 text-destructive-ink"
|
|
25
|
+
};
|
|
13
26
|
/** The same scale as text, for a verdict inside a line of muted facts. */
|
|
14
27
|
export const TONE_TEXT = {
|
|
15
28
|
neutral: "text-muted-foreground",
|
package/dist/record/format.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Display formatting through Intl, so a locale string is all a host passes.
|
|
2
2
|
// A date-only value ("2026-10-26") is a calendar day, read in UTC so no zone shifts it.
|
|
3
|
+
import { relativeTime } from "../lib/dates.js";
|
|
3
4
|
const DAY_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
4
5
|
function parse(iso) {
|
|
5
6
|
return DAY_ONLY.test(iso) ? {
|
|
@@ -55,24 +56,7 @@ export function formatTime(iso, locale = "en-GB", timeZone) {
|
|
|
55
56
|
}
|
|
56
57
|
/** "3 days ago", "in 2 weeks", "now". */
|
|
57
58
|
export function formatAge(iso, now = Date.now(), locale = "en-GB") {
|
|
58
|
-
|
|
59
|
-
const abs = Math.abs(seconds);
|
|
60
|
-
const rtf = new Intl.RelativeTimeFormat(locale, {
|
|
61
|
-
numeric: "auto",
|
|
62
|
-
style: "long"
|
|
63
|
-
});
|
|
64
|
-
const units = [
|
|
65
|
-
[31536e3, "year"],
|
|
66
|
-
[2592e3, "month"],
|
|
67
|
-
[604800, "week"],
|
|
68
|
-
[86400, "day"],
|
|
69
|
-
[3600, "hour"],
|
|
70
|
-
[60, "minute"]
|
|
71
|
-
];
|
|
72
|
-
for (const [size, unit] of units) {
|
|
73
|
-
if (abs >= size) return rtf.format(Math.round(seconds / size), unit);
|
|
74
|
-
}
|
|
75
|
-
return rtf.format(0, "second");
|
|
59
|
+
return relativeTime(iso, now, { locale });
|
|
76
60
|
}
|
|
77
61
|
/** "€12,000". `compact` gives "€12K". */
|
|
78
62
|
export function formatMoney(amount, currency = "EUR", locale = "en-GB", compact = false) {
|
package/dist/record/logic.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
|
+
// The record's pure logic: grouping, merging, picking. No DOM, no clock of its own.
|
|
2
|
+
import { localDay as dayOf } from "../lib/dates.js";
|
|
1
3
|
// =========================
|
|
2
4
|
// EVENTS
|
|
3
5
|
// =========================
|
|
4
6
|
/** The calendar day of a timestamp as `YYYY-MM-DD`, in the given zone or the viewer's own. */
|
|
5
7
|
export function localDay(iso, timeZone) {
|
|
6
|
-
return
|
|
7
|
-
year: "numeric",
|
|
8
|
-
month: "2-digit",
|
|
9
|
-
day: "2-digit",
|
|
10
|
-
timeZone
|
|
11
|
-
}).format(new Date(iso));
|
|
8
|
+
return dayOf(iso, timeZone);
|
|
12
9
|
}
|
|
13
10
|
/** Newest day first, newest event first inside a day. */
|
|
14
11
|
export function groupEventsByDay(events, timeZone) {
|
package/dist/status/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { default as StatusDot } from "../../src/status/status-dot.svelte";
|
|
|
3
3
|
export { default as StatusIcon } from "../../src/status/status-icon.svelte";
|
|
4
4
|
export { defineStatuses } from "./define-statuses.js";
|
|
5
5
|
export { default as StatusPill } from "../../src/status/status-pill.svelte";
|
|
6
|
-
export { PILL_TINT } from "
|
|
6
|
+
export { TONE_TINT as PILL_TINT } from "../lib/tone.js";
|
package/dist/work/dates.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Dates are plain "YYYY-MM-DD" strings, counted as whole UTC days. A timeline
|
|
2
2
|
// only needs days, and day numbers dodge every timezone and DST edge.
|
|
3
|
+
import { localDay } from "../lib/dates.js";
|
|
3
4
|
const DAY_MS = 864e5;
|
|
4
5
|
/** Days since 1970-01-01 for an ISO date. Anything after the date part is ignored. */
|
|
5
6
|
export function dayNumber(iso) {
|
|
@@ -16,9 +17,7 @@ export function addDays(iso, days) {
|
|
|
16
17
|
}
|
|
17
18
|
/** Today in the viewer's own timezone, as an ISO date. */
|
|
18
19
|
export function todayIso() {
|
|
19
|
-
|
|
20
|
-
const local = new Date(now.getTime() - now.getTimezoneOffset() * 6e4);
|
|
21
|
-
return local.toISOString().slice(0, 10);
|
|
20
|
+
return localDay();
|
|
22
21
|
}
|
|
23
22
|
/** 0 is Sunday, as in `Date.getUTCDay`. */
|
|
24
23
|
export function weekday(day) {
|
|
@@ -8,13 +8,5 @@ export const DEFAULT_TASK_DETAIL_LABELS = {
|
|
|
8
8
|
save: "Save",
|
|
9
9
|
saving: "Saving",
|
|
10
10
|
cancel: "Cancel",
|
|
11
|
-
comments: "Activity",
|
|
12
|
-
commentPlaceholder: "Leave a comment",
|
|
13
|
-
commentSend: "Comment",
|
|
14
|
-
commentEdit: "Edit comment",
|
|
15
|
-
commentDelete: "Delete comment",
|
|
16
|
-
commentEdited: "edited",
|
|
17
|
-
commentsEmpty: "No comments yet",
|
|
18
|
-
ai: "AI",
|
|
19
11
|
properties: "Properties"
|
|
20
12
|
};
|
package/dist/work/docs/edited.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** The "Edited Oct 23" chip: how a stamp reads, and what to show when it can't be read. */
|
|
2
|
+
import { shortDate as monthDay } from "../../lib/dates.js";
|
|
1
3
|
export function parseStamp(value) {
|
|
2
4
|
if (value === null || value === undefined || value === "") return null;
|
|
3
5
|
const date = value instanceof Date ? value : new Date(value);
|
|
@@ -14,13 +16,12 @@ export function shortDate(value, options = {}) {
|
|
|
14
16
|
const date = parseStamp(value);
|
|
15
17
|
if (!date) return "";
|
|
16
18
|
const { locale = "en-US", timeZone, now = new Date() } = options;
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
year
|
|
22
|
-
|
|
23
|
-
}).format(date);
|
|
19
|
+
const year = yearOf(date, options) !== yearOf(now, options);
|
|
20
|
+
return monthDay(date, {
|
|
21
|
+
locale,
|
|
22
|
+
timeZone,
|
|
23
|
+
year
|
|
24
|
+
});
|
|
24
25
|
}
|
|
25
26
|
/** "Oct 23, 14:44" for the last-edit row. Empty when the date can't be read. */
|
|
26
27
|
export function editStamp(value, options = {}) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { relativeTime, shortDate } from "../../lib/dates.js";
|
|
1
2
|
/** The draft to open on: the agent's pick, else the first. */
|
|
2
3
|
export function startDraft(drafts, recommended) {
|
|
3
4
|
return drafts.find((draft) => draft.templateId === recommended) ?? drafts[0];
|
|
@@ -52,12 +53,6 @@ export function freshReasoning(item, facts) {
|
|
|
52
53
|
return said.some((line) => line.includes(key) || key.includes(line)) ? "" : reasoning;
|
|
53
54
|
}
|
|
54
55
|
const ISO = /^\d{4}-\d{2}-\d{2}T/;
|
|
55
|
-
const UNITS = [
|
|
56
|
-
[604800, "week"],
|
|
57
|
-
[86400, "day"],
|
|
58
|
-
[3600, "hour"],
|
|
59
|
-
[60, "minute"]
|
|
60
|
-
];
|
|
61
56
|
/**
|
|
62
57
|
* A time as a person says it: "3 hr. ago", "Oct 12". A host-formatted string stays as written,
|
|
63
58
|
* and a raw ISO string never reaches the screen.
|
|
@@ -66,22 +61,12 @@ export function whenOf(at, now = Date.now(), locale = "en-GB") {
|
|
|
66
61
|
if (!ISO.test(at)) return at;
|
|
67
62
|
const time = Date.parse(at);
|
|
68
63
|
if (Number.isNaN(time)) return "";
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
month: "short",
|
|
74
|
-
day: "numeric"
|
|
75
|
-
}).format(time);
|
|
76
|
-
}
|
|
77
|
-
const rtf = new Intl.RelativeTimeFormat(locale, {
|
|
78
|
-
numeric: "auto",
|
|
64
|
+
const age = Math.abs(Math.round((time - now) / 1e3));
|
|
65
|
+
if (age >= 4 * 604800) return shortDate(time, { locale });
|
|
66
|
+
return relativeTime(time, now, {
|
|
67
|
+
locale,
|
|
79
68
|
style: "short"
|
|
80
69
|
});
|
|
81
|
-
for (const [size, unit] of UNITS) {
|
|
82
|
-
if (age >= size) return rtf.format(Math.round(seconds / size), unit);
|
|
83
|
-
}
|
|
84
|
-
return rtf.format(0, "second");
|
|
85
70
|
}
|
|
86
71
|
/** True when a key press belongs to a text field and so isn't a shortcut. */
|
|
87
72
|
export function isTyping(target) {
|
package/dist/work/index.js
CHANGED
|
@@ -8,8 +8,6 @@ export { default as TaskList } from "../../src/work/task-list.svelte";
|
|
|
8
8
|
export { default as TaskGantt } from "../../src/work/task-gantt.svelte";
|
|
9
9
|
export { addDays, dayNumber, isoFromDay, todayIso } from "./dates.js";
|
|
10
10
|
export { default as TaskDetail } from "../../src/work/detail/task-detail.svelte";
|
|
11
|
-
export { default as TaskThread } from "../../src/work/detail/task-thread.svelte";
|
|
12
|
-
export { default as TaskProperty } from "../../src/work/detail/task-property.svelte";
|
|
13
11
|
export { default as TaskChip } from "../../src/work/detail/task-chip.svelte";
|
|
14
12
|
export { DEFAULT_TASK_DETAIL_LABELS } from "./detail/detail-types.js";
|
|
15
13
|
export { default as TimeTracker } from "../../src/work/time/time-tracker.svelte";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { localDay as dayOf } from "../../lib/dates.js";
|
|
1
2
|
/** "90", "45m", "1h", "1.5h", "1h30", "1h 30m" and "1:30" to whole minutes. Null when it isn't a duration. */
|
|
2
3
|
export function parseMinutes(text) {
|
|
3
4
|
const value = text.trim().toLowerCase();
|
|
@@ -30,9 +31,7 @@ export function formatClock(ms) {
|
|
|
30
31
|
}
|
|
31
32
|
/** The reader's own calendar day as `YYYY-MM-DD`. */
|
|
32
33
|
export function localDay(date = new Date()) {
|
|
33
|
-
|
|
34
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
35
|
-
return `${date.getFullYear()}-${month}-${day}`;
|
|
34
|
+
return dayOf(date);
|
|
36
35
|
}
|
|
37
36
|
/** "Today", "Yesterday", then "Mon, Oct 12", in the given locale. */
|
|
38
37
|
export function dayLabel(day, locale) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@heyramzi/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "Svelte 5 UI for apps: primitives, effects and animations, plus work (tasks and docs), charts, slides, an editor, onboarding and a canvas as subpaths.",
|
|
5
5
|
"homepage": "https://ui.heyramzi.com",
|
|
6
6
|
"license": "MIT",
|
|
@@ -126,16 +126,6 @@
|
|
|
126
126
|
"node": "./dist/icons/sf-symbols.js",
|
|
127
127
|
"default": "./src/icons/sf-symbols.ts"
|
|
128
128
|
},
|
|
129
|
-
"./icons/trades": {
|
|
130
|
-
"svelte": "./src/icons/trades.ts",
|
|
131
|
-
"types": "./src/icons/trades.ts",
|
|
132
|
-
"node": "./dist/icons/trades.js",
|
|
133
|
-
"default": "./src/icons/trades.ts"
|
|
134
|
-
},
|
|
135
|
-
"./icons/TradeIcon": {
|
|
136
|
-
"svelte": "./src/icons/TradeIcon.svelte",
|
|
137
|
-
"default": "./src/icons/TradeIcon.svelte"
|
|
138
|
-
},
|
|
139
129
|
"./design": {
|
|
140
130
|
"style": "./src/design/index.css",
|
|
141
131
|
"default": "./src/design/index.css"
|
|
@@ -263,12 +253,6 @@
|
|
|
263
253
|
"node": "./dist/work/inbox/index.js",
|
|
264
254
|
"default": "./src/work/inbox/index.ts"
|
|
265
255
|
},
|
|
266
|
-
"./work/presets/sales": {
|
|
267
|
-
"svelte": "./src/work/presets/sales.ts",
|
|
268
|
-
"types": "./src/work/presets/sales.ts",
|
|
269
|
-
"node": "./dist/work/presets/sales.js",
|
|
270
|
-
"default": "./src/work/presets/sales.ts"
|
|
271
|
-
},
|
|
272
256
|
"./work/detail": {
|
|
273
257
|
"svelte": "./src/work/detail/task-detail.svelte",
|
|
274
258
|
"types": "./src/work/detail/task-detail.svelte",
|
|
@@ -436,7 +420,6 @@
|
|
|
436
420
|
},
|
|
437
421
|
"peerDependencies": {
|
|
438
422
|
"@internationalized/date": "^3.12.4",
|
|
439
|
-
"@tabler/icons-svelte-runes": "^3.46.0",
|
|
440
423
|
"@xyflow/svelte": "^1.7.0",
|
|
441
424
|
"bits-ui": "^2.19.5",
|
|
442
425
|
"mode-watcher": "^1.1.0",
|
|
@@ -453,9 +436,6 @@
|
|
|
453
436
|
"@internationalized/date": {
|
|
454
437
|
"optional": true
|
|
455
438
|
},
|
|
456
|
-
"@tabler/icons-svelte-runes": {
|
|
457
|
-
"optional": true
|
|
458
|
-
},
|
|
459
439
|
"@xyflow/svelte": {
|
|
460
440
|
"optional": true
|
|
461
441
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
3
|
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ConfirmationKind } from "./confirmation-context.svelte.js";
|
|
5
5
|
|
|
6
6
|
export interface ConfirmationProps extends HTMLAttributes<HTMLElement> {
|
|
7
|
-
kind:
|
|
7
|
+
kind: ConfirmationKind;
|
|
8
8
|
executing?: boolean;
|
|
9
9
|
class?: string;
|
|
10
10
|
children?: Snippet;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import type { Snippet } from "svelte";
|
|
3
|
+
import type { ConfirmationKind } from "./confirmation-context.svelte.js";
|
|
3
4
|
|
|
4
|
-
export interface
|
|
5
|
+
export interface ConfirmationStateProps {
|
|
6
|
+
/** The state whose content this shows. */
|
|
7
|
+
when: Exclude<ConfirmationKind, "idle">;
|
|
5
8
|
children?: Snippet;
|
|
6
9
|
}
|
|
7
10
|
</script>
|
|
@@ -9,12 +12,12 @@
|
|
|
9
12
|
<script lang="ts">
|
|
10
13
|
import { getConfirmationContext } from "./confirmation-context.svelte.js";
|
|
11
14
|
|
|
12
|
-
let { children }:
|
|
15
|
+
let { when, children }: ConfirmationStateProps = $props();
|
|
13
16
|
|
|
14
17
|
const ctx = getConfirmationContext();
|
|
15
18
|
</script>
|
|
16
19
|
|
|
17
|
-
{#if ctx.kind ===
|
|
20
|
+
{#if ctx.kind === when}
|
|
18
21
|
<!-- WHY: the wrapper mirrors the parent section's stack so the state swap can
|
|
19
22
|
animate as one block without changing the children's layout. -->
|
|
20
23
|
<div
|
|
@@ -2,10 +2,10 @@ import { getContext, setContext } from "svelte";
|
|
|
2
2
|
|
|
3
3
|
const CONFIRMATION_CONTEXT_KEY = Symbol("confirmation-context");
|
|
4
4
|
|
|
5
|
-
export type
|
|
5
|
+
export type ConfirmationKind = "idle" | "requested" | "accepted" | "rejected" | "failed";
|
|
6
6
|
|
|
7
7
|
export interface ConfirmationContextValue {
|
|
8
|
-
readonly kind:
|
|
8
|
+
readonly kind: ConfirmationKind;
|
|
9
9
|
readonly executing: boolean;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
// Every state part under one Confirmation, for the state-swap test.
|
|
3
|
+
import {
|
|
4
|
+
Confirmation,
|
|
5
|
+
ConfirmationState,
|
|
6
|
+
type ConfirmationKind,
|
|
7
|
+
} from "./index.js";
|
|
8
|
+
|
|
9
|
+
let { kind }: { kind: ConfirmationKind } = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Confirmation {kind}>
|
|
13
|
+
<ConfirmationState when="requested">request</ConfirmationState>
|
|
14
|
+
<ConfirmationState when="accepted">accepted</ConfirmationState>
|
|
15
|
+
<ConfirmationState when="rejected">rejected</ConfirmationState>
|
|
16
|
+
<ConfirmationState when="failed">failed</ConfirmationState>
|
|
17
|
+
</Confirmation>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { flushSync, mount, unmount } from "svelte";
|
|
2
|
+
import { describe, expect, it } from "vite-plus/test";
|
|
3
|
+
import type { ConfirmationKind } from "./index.js";
|
|
4
|
+
import Parts from "./confirmation-parts.test.svelte";
|
|
5
|
+
|
|
6
|
+
function shown(kind: ConfirmationKind): string {
|
|
7
|
+
const target = document.createElement("div");
|
|
8
|
+
const app = mount(Parts, { target, props: { kind } });
|
|
9
|
+
flushSync();
|
|
10
|
+
const text = target.textContent?.replace(/\s+/g, " ").trim() ?? "";
|
|
11
|
+
void unmount(app);
|
|
12
|
+
return text;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe("ConfirmationState", () => {
|
|
16
|
+
it("shows only the part whose `when` matches the kind", () => {
|
|
17
|
+
expect(shown("requested")).toBe("request");
|
|
18
|
+
expect(shown("accepted")).toBe("accepted");
|
|
19
|
+
expect(shown("rejected")).toBe("rejected");
|
|
20
|
+
expect(shown("failed")).toBe("failed");
|
|
21
|
+
expect(shown("idle")).toBe("");
|
|
22
|
+
});
|
|
23
|
+
});
|