@heyramzi/tasks 0.3.0 → 0.4.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.
@@ -0,0 +1,74 @@
1
+ /** A running timer. The host persists it, the tracker only reads it. */
2
+ export type TimeRunning = {
3
+ startedAt: Date | string | number;
4
+ };
5
+
6
+ /** What the tracker hands back when a manual entry is submitted. */
7
+ export type TimeLogInput = {
8
+ minutes: number;
9
+ /** The day worked, `YYYY-MM-DD`. */
10
+ day: string;
11
+ note?: string;
12
+ };
13
+
14
+ /** What the tracker hands back when the timer stops. */
15
+ export type TimeStopInfo = {
16
+ /** Elapsed whole minutes, never below 1. */
17
+ minutes: number;
18
+ startedAt: Date;
19
+ stoppedAt: Date;
20
+ /** The day it started, `YYYY-MM-DD`, in the reader's calendar. */
21
+ day: string;
22
+ };
23
+
24
+ export type TimeLabels = {
25
+ title: string;
26
+ timer: string;
27
+ start: string;
28
+ stop: string;
29
+ running: string;
30
+ since: (time: string) => string;
31
+ started: string;
32
+ runningFor: (duration: string) => string;
33
+ stopped: (duration: string) => string;
34
+ elapsed: string;
35
+ logged: string;
36
+ duration: string;
37
+ durationPlaceholder: string;
38
+ date: string;
39
+ note: string;
40
+ notePlaceholder: string;
41
+ log: string;
42
+ saving: string;
43
+ invalid: string;
44
+ empty: string;
45
+ remaining: (left: string, estimate: string) => string;
46
+ over: (over: string, estimate: string) => string;
47
+ deleteEntry: (duration: string) => string;
48
+ };
49
+
50
+ export const DEFAULT_TIME_LABELS: TimeLabels = {
51
+ title: "Time",
52
+ timer: "Timer",
53
+ start: "Start timer",
54
+ stop: "Stop timer",
55
+ running: "Running",
56
+ since: (time) => `Since ${time}`,
57
+ started: "Timer started",
58
+ runningFor: (duration) => `Timer running, ${duration}`,
59
+ stopped: (duration) => `Timer stopped, ${duration} to log`,
60
+ elapsed: "Elapsed time",
61
+ logged: "Logged",
62
+ duration: "Time spent",
63
+ durationPlaceholder: "1h30",
64
+ date: "Date worked",
65
+ note: "Note",
66
+ notePlaceholder: "What was done",
67
+ log: "Log",
68
+ saving: "Saving",
69
+ invalid: "Try 45m, 1h30 or 1.5h",
70
+ empty: "Log your first hour",
71
+ remaining: (left, estimate) => `${left} left of ${estimate}`,
72
+ over: (over, estimate) => `${over} over ${estimate}`,
73
+ deleteEntry: (duration) => `Delete ${duration} entry`,
74
+ };
package/src/tone.ts CHANGED
@@ -2,12 +2,15 @@ import type { Tone } from "./status-types.js";
2
2
 
3
3
  /**
4
4
  * The severity scale, as Tailwind classes for a chip and as CSS colors for the
5
- * dot. Tokens are plain CSS variables, so a host app can retheme them.
5
+ * dot. Tokens are plain CSS variables, so a host app can retheme them. The
6
+ * accent tone reads `--tone-accent` and falls back to `--color-primary`, for a
7
+ * host whose primary is a neutral and whose accent is a brand color.
6
8
  */
7
9
 
8
10
  export const TONE_CLASS: Record<Tone, string> = {
9
11
  neutral: "border-border bg-muted/40 text-muted-foreground",
10
- accent: "border-primary/30 bg-primary/10 text-primary",
12
+ accent:
13
+ "border-[color-mix(in_oklab,var(--tone-accent,var(--color-primary))_30%,transparent)] bg-[color-mix(in_oklab,var(--tone-accent,var(--color-primary))_10%,transparent)] text-[color:var(--tone-accent,var(--color-primary))]",
11
14
  info: "border-info/30 bg-info/10 text-info-800 dark:text-info-400",
12
15
  success: "border-success/30 bg-success/10 text-success-800 dark:text-success-400",
13
16
  warning: "border-warning/30 bg-warning/10 text-warning-800 dark:text-warning-400",
@@ -17,7 +20,7 @@ export const TONE_CLASS: Record<Tone, string> = {
17
20
  /** The same scale as text, for a verdict inside a line of muted facts. */
18
21
  export const TONE_TEXT: Record<Tone, string> = {
19
22
  neutral: "text-muted-foreground",
20
- accent: "text-primary",
23
+ accent: "text-[color:var(--tone-accent,var(--color-primary))]",
21
24
  info: "text-info-800 dark:text-info-400",
22
25
  success: "text-success-800 dark:text-success-400",
23
26
  warning: "text-warning-800 dark:text-warning-400",
@@ -27,7 +30,7 @@ export const TONE_TEXT: Record<Tone, string> = {
27
30
  /** The same scale as icon color. */
28
31
  export const TONE_ICON: Record<Tone, string> = {
29
32
  neutral: "text-muted-foreground",
30
- accent: "text-primary",
33
+ accent: "text-[color:var(--tone-accent,var(--color-primary))]",
31
34
  info: "text-info",
32
35
  success: "text-success",
33
36
  warning: "text-warning",
@@ -37,7 +40,7 @@ export const TONE_ICON: Record<Tone, string> = {
37
40
  /** The scale as CSS colors, for the SVG dot. */
38
41
  export const TONE_COLOR: Record<Tone, string> = {
39
42
  neutral: "var(--color-muted-foreground)",
40
- accent: "var(--color-primary)",
43
+ accent: "var(--tone-accent,var(--color-primary))",
41
44
  info: "var(--color-info)",
42
45
  success: "var(--color-success)",
43
46
  warning: "var(--color-warning)",
@@ -132,9 +132,14 @@ export function createKanbanDnd<T>(config: KanbanDndConfig<T>) {
132
132
  .getColumnItems(targetColumnId)
133
133
  .filter((entry) => config.getId(entry) !== movedId);
134
134
  const index = manualInsertIndex(column, overId, targetColumnId);
135
+ const before = column[index - 1];
136
+ const after = column[index];
137
+ const orderOf = config.boardOrder;
135
138
  void config.onMove(movedId, {
136
139
  columnId: targetColumnId,
137
- boardOrder: boardOrderAt(column, index, config.boardOrder ?? (() => null)),
140
+ ...(orderOf ? { boardOrder: boardOrderAt(column, index, orderOf) } : {}),
141
+ beforeId: before === undefined ? null : config.getId(before),
142
+ afterId: after === undefined ? null : config.getId(after),
138
143
  });
139
144
  }
140
145