@poodle64/ui 2026.10.19 → 2026.10.20
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/README.md +2 -0
- package/dist/components/ui/ledger/ledger.d.ts +5 -3
- package/dist/components/ui/ledger/ledger.js +11 -4
- package/dist/components/ui/ledger/ledger.svelte +20 -8
- package/dist/components/ui/ledger/ledger.svelte.d.ts +8 -0
- package/package.json +1 -1
- package/registry/component-map.json +1 -1
- package/registry/component-map.md +1 -1
package/README.md
CHANGED
|
@@ -1000,6 +1000,8 @@ no module rebuilds them and a need one module finds becomes a toggle for all.
|
|
|
1000
1000
|
| `columns` | The module's columns, in order after the amount. The keys `date`, `title`, `amount` and `balance` are the ledger's own cells: list one to rename or resize it (the title reads "Description" until the module names it), and list `balance` to offer the running balance at all, with `text` saying what it counts (money, a coin, units). A column `on: 'wide'` is ticked only on a wide ledger. A `cell` snippet's links and buttons take their own clicks; the rest of the cell opens the row. A column's `sort` gives the real value its head sorts by (a number, not its text); a `text` column sorts by its text without one, a `cell`-only column does not sort, and the balance never does. |
|
|
1001
1001
|
| `preferences`, `onPreferencesChange` | The viewer's `{ columns, period }`. Missing fields take the module's defaults (each column's `on`, the balance off, grouped by month); an unknown column key is ignored. The ledger stores nothing. |
|
|
1002
1002
|
| `fyStart` | The month a financial year starts, 1–12. July by default; anything else groups from July and logs an error in development. |
|
|
1003
|
+
| `dateFormat` | `'short'` (default, "30 Jun 2026") or `'numeric'`, the household's "30/06/2026" ("30/06" narrow). |
|
|
1004
|
+
| `groupTotals` | `true` by default. `false` omits each group's net, in and out, for a list of `conversion` rows. |
|
|
1003
1005
|
| `locale`, `currency` | Every figure, amounts, nets and counts, in this locale (`AU_LOCALE` by default) and currency (AUD). Dates keep the drawn "15 Sep": the ledger's words are English. |
|
|
1004
1006
|
| `title`, `meta`, `actions`, `tools`, `action` | The bar on the page ground, a `ListToolbar`: its title (a heading), the count beside it, the module's own controls after the Columns menu, its icon actions (each named by its tooltip) and its one labelled action. |
|
|
1005
1007
|
| `selected`, `bulkActions` | Ticking exists only with `bulkActions`, whose snippet gets the ticked rows in the bar that replaces the toolbar. |
|
|
@@ -3,12 +3,14 @@ export declare const LEDGER_PERIODS: readonly {
|
|
|
3
3
|
value: LedgerPeriod;
|
|
4
4
|
label: string;
|
|
5
5
|
}[];
|
|
6
|
-
/** "15 Sep", or "15
|
|
7
|
-
export
|
|
6
|
+
/** How a date reads: "15 Sep 2026" (`short`), or the household's "15/09/2026" (`numeric`). */
|
|
7
|
+
export type LedgerDateFormat = 'short' | 'numeric';
|
|
8
|
+
/** "15 Sep", or "15 Sep 2026" with the year; `numeric` gives "15/09" and "15/09/2026". */
|
|
9
|
+
export declare function ledgerDate(iso: string, withYear?: boolean, format?: LedgerDateFormat): string;
|
|
8
10
|
/** The group a date falls in: sortable, so newer keys sort later. */
|
|
9
11
|
export declare function periodKey(iso: string, period: LedgerPeriod, fyStart?: number): string;
|
|
10
12
|
/** A group's label: "FY 2025–26", "2026", "September 2026", "15 to 21 Sep 2026", "Tuesday 15 Sep 2026". */
|
|
11
|
-
export declare function periodLabel(key: string, period: LedgerPeriod, fyStart?: number, withYear?: boolean): string;
|
|
13
|
+
export declare function periodLabel(key: string, period: LedgerPeriod, fyStart?: number, withYear?: boolean, format?: LedgerDateFormat): string;
|
|
12
14
|
/** "Jul 2025 to Jun 2026", or "Jul 2026 to now" for the year still open on `today`. */
|
|
13
15
|
export declare function fySpan(key: string, fyStart?: number, today?: string): string;
|
|
14
16
|
/** Rows newest first, a day's rows in the order given, grouped by period. */
|
|
@@ -40,9 +40,13 @@ function isoOf(t) {
|
|
|
40
40
|
const pad = (n) => String(n).padStart(2, '0');
|
|
41
41
|
return `${t.getUTCFullYear()}-${pad(t.getUTCMonth() + 1)}-${pad(t.getUTCDate())}`;
|
|
42
42
|
}
|
|
43
|
-
/** "15 Sep", or "15 Sep 2026" with the year. */
|
|
44
|
-
export function ledgerDate(iso, withYear = true) {
|
|
43
|
+
/** "15 Sep", or "15 Sep 2026" with the year; `numeric` gives "15/09" and "15/09/2026". */
|
|
44
|
+
export function ledgerDate(iso, withYear = true, format = 'short') {
|
|
45
45
|
const [y, m, d] = parts(iso);
|
|
46
|
+
if (format === 'numeric') {
|
|
47
|
+
const dm = `${String(d).padStart(2, '0')}/${String(m).padStart(2, '0')}`;
|
|
48
|
+
return withYear ? `${dm}/${y}` : dm;
|
|
49
|
+
}
|
|
46
50
|
return `${d} ${MONTHS[m - 1]}${withYear ? ` ${y}` : ''}`;
|
|
47
51
|
}
|
|
48
52
|
/** The year a financial year ends in. A January start makes it the calendar year. */
|
|
@@ -71,7 +75,7 @@ export function periodKey(iso, period, fyStart = 7) {
|
|
|
71
75
|
}
|
|
72
76
|
}
|
|
73
77
|
/** A group's label: "FY 2025–26", "2026", "September 2026", "15 to 21 Sep 2026", "Tuesday 15 Sep 2026". */
|
|
74
|
-
export function periodLabel(key, period, fyStart = 7, withYear = true) {
|
|
78
|
+
export function periodLabel(key, period, fyStart = 7, withYear = true, format = 'short') {
|
|
75
79
|
switch (period) {
|
|
76
80
|
case 'fy': {
|
|
77
81
|
const end = Number(key);
|
|
@@ -85,12 +89,15 @@ export function periodLabel(key, period, fyStart = 7, withYear = true) {
|
|
|
85
89
|
const end = isoOf(shift(key, 6));
|
|
86
90
|
const [sy, sm, sd] = parts(key);
|
|
87
91
|
const [ey, em] = parts(end);
|
|
92
|
+
if (format === 'numeric') {
|
|
93
|
+
return `${ledgerDate(key, withYear || sy !== ey, format)} to ${ledgerDate(end, withYear || sy !== ey, format)}`;
|
|
94
|
+
}
|
|
88
95
|
const start = `${sd}${sm !== em ? ` ${MONTHS[sm - 1]}` : ''}${sy !== ey ? ` ${sy}` : ''}`;
|
|
89
96
|
return `${start} to ${ledgerDate(end, withYear || sy !== ey)}`;
|
|
90
97
|
}
|
|
91
98
|
case 'day': {
|
|
92
99
|
const [y, m, d] = parts(key);
|
|
93
|
-
return `${WEEKDAYS[new Date(Date.UTC(y, m - 1, d)).getUTCDay()]} ${ledgerDate(key, withYear)}`;
|
|
100
|
+
return `${WEEKDAYS[new Date(Date.UTC(y, m - 1, d)).getUTCDay()]} ${ledgerDate(key, withYear, format)}`;
|
|
94
101
|
}
|
|
95
102
|
default:
|
|
96
103
|
return '';
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
sortRows,
|
|
61
61
|
windowOf
|
|
62
62
|
} from './ledger.js';
|
|
63
|
+
import type { LedgerDateFormat } from './ledger.js';
|
|
63
64
|
import type { LedgerColumn, LedgerOpenContext, LedgerPreferences, LedgerRow } from './types.js';
|
|
64
65
|
|
|
65
66
|
type Id = R['id'];
|
|
@@ -71,6 +72,8 @@
|
|
|
71
72
|
onPreferencesChange,
|
|
72
73
|
preferencesNote,
|
|
73
74
|
fyStart = 7,
|
|
75
|
+
dateFormat = 'short',
|
|
76
|
+
groupTotals = true,
|
|
74
77
|
currency = 'AUD',
|
|
75
78
|
locale = AU_LOCALE,
|
|
76
79
|
noun = ['transaction', 'transactions'],
|
|
@@ -102,6 +105,13 @@
|
|
|
102
105
|
preferencesNote?: string;
|
|
103
106
|
/** The month a financial year starts, 1–12. July by default. */
|
|
104
107
|
fyStart?: number;
|
|
108
|
+
/** How dates read: "30 Jun 2026" (`short`), or the household's "30/06/2026" (`numeric`). */
|
|
109
|
+
dateFormat?: LedgerDateFormat;
|
|
110
|
+
/**
|
|
111
|
+
* Show each group's net, and in and out. Turn off for rows that are all
|
|
112
|
+
* `conversion`, whose group totals would read $0.00.
|
|
113
|
+
*/
|
|
114
|
+
groupTotals?: boolean;
|
|
105
115
|
currency?: string;
|
|
106
116
|
/** BCP 47 locale for every figure: amounts, nets and counts. */
|
|
107
117
|
locale?: string;
|
|
@@ -425,6 +435,7 @@
|
|
|
425
435
|
return { net: (inn + out) / 100, inn: inn / 100, out: out / 100 };
|
|
426
436
|
}
|
|
427
437
|
|
|
438
|
+
const date = (iso: string, withYear = true) => ledgerDate(iso, withYear, dateFormat);
|
|
428
439
|
const money = (value: number | string) => ledgerMoney(value, currency, locale);
|
|
429
440
|
const number = (n: number) => n.toLocaleString(locale);
|
|
430
441
|
const titleColumn = $derived(resolved.find((c) => c.key === 'title'));
|
|
@@ -500,7 +511,7 @@
|
|
|
500
511
|
{@const through = openable && THROUGH}
|
|
501
512
|
{#if c.key === 'date'}
|
|
502
513
|
<span class={cn(CELL, through, 'text-muted-foreground self-center tabular-nums')} {style}>
|
|
503
|
-
{
|
|
514
|
+
{date(r.date, WIDE)}
|
|
504
515
|
{#if c.actions}<span class="pointer-events-auto flex flex-none items-center gap-1" data-slot="ledger-actions">{@render c.actions(r)}</span>{/if}
|
|
505
516
|
</span>
|
|
506
517
|
{:else if c.key === 'title'}
|
|
@@ -571,7 +582,7 @@
|
|
|
571
582
|
{#each og.lines as l, i (i)}
|
|
572
583
|
{#if PHONE}
|
|
573
584
|
<div role="listitem" class="flex items-center gap-3 px-3 py-1.5 text-xs">
|
|
574
|
-
<span class="text-muted-foreground tabular-nums">{
|
|
585
|
+
<span class="text-muted-foreground tabular-nums">{date(l.date, false)}</span>
|
|
575
586
|
<span class="flex min-w-0 flex-1 flex-col">
|
|
576
587
|
<span class="truncate">{l.description}</span>
|
|
577
588
|
{#if l.source}<span class="text-muted-foreground text-2xs truncate">{l.source}</span
|
|
@@ -593,7 +604,7 @@
|
|
|
593
604
|
class={cn(CELL, 'text-muted-foreground self-center tabular-nums')}
|
|
594
605
|
style="grid-column: {column('date')};"
|
|
595
606
|
>
|
|
596
|
-
{
|
|
607
|
+
{date(l.date, WIDE)}
|
|
597
608
|
</span>
|
|
598
609
|
{/if}
|
|
599
610
|
<span
|
|
@@ -641,9 +652,9 @@
|
|
|
641
652
|
|
|
642
653
|
{#snippet row(r: R, first: boolean)}
|
|
643
654
|
{@const on = ticked.has(r.id)}
|
|
644
|
-
{@const label = `${r.title}, ${
|
|
655
|
+
{@const label = `${r.title}, ${date(r.date)}, ${money(r.amount)}`}
|
|
645
656
|
{#if PHONE}
|
|
646
|
-
{@const two = [BY_DAY ? '' :
|
|
657
|
+
{@const two = [BY_DAY ? '' : date(r.date, false), r.note ?? '']
|
|
647
658
|
.filter(Boolean)
|
|
648
659
|
.join(' · ')}
|
|
649
660
|
<div
|
|
@@ -732,11 +743,12 @@
|
|
|
732
743
|
key,
|
|
733
744
|
prefs.period,
|
|
734
745
|
fy,
|
|
735
|
-
!(mode === 'narrow' && (BY_DAY || prefs.period === 'week'))
|
|
746
|
+
!(mode === 'narrow' && (BY_DAY || prefs.period === 'week')),
|
|
747
|
+
dateFormat
|
|
736
748
|
)}
|
|
737
749
|
{@const span = WIDE && prefs.period === 'fy' ? `${fySpan(key, fy)} · ` : ''}
|
|
738
750
|
{@const metaText = single ? '' : PHONE ? number(rs.length) : span + count(rs.length)}
|
|
739
|
-
{@const net = single ? '' : money(t.net)}
|
|
751
|
+
{@const net = single || !groupTotals ? '' : money(t.net)}
|
|
740
752
|
{@const netTone = t.net > 0 ? 'text-status-success' : 'text-muted-foreground'}
|
|
741
753
|
{@const klass = cn(
|
|
742
754
|
GROUP,
|
|
@@ -805,7 +817,7 @@
|
|
|
805
817
|
</span>
|
|
806
818
|
<span class={cn(CELL, END, 'tabular-nums', netTone)} style="grid-column: {cAmount};">{net}</span
|
|
807
819
|
>
|
|
808
|
-
{#if WIDE && afterAmount > 0 && !BY_DAY}
|
|
820
|
+
{#if WIDE && afterAmount > 0 && !BY_DAY && groupTotals}
|
|
809
821
|
<span class={CELL} style="grid-column: {cAmount + 1} / -1;">
|
|
810
822
|
In {money(t.inn)} · out {money(t.out)}
|
|
811
823
|
</span>
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import type { Snippet } from 'svelte';
|
|
14
14
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
15
15
|
import type { ListAction, ListIconAction } from '../list-toolbar/types.js';
|
|
16
|
+
import type { LedgerDateFormat } from './ledger.js';
|
|
16
17
|
import type { LedgerColumn, LedgerOpenContext, LedgerPreferences, LedgerRow } from './types.js';
|
|
17
18
|
declare function $$render<R extends LedgerRow>(): {
|
|
18
19
|
props: Omit<HTMLAttributes<HTMLDivElement>, "title"> & {
|
|
@@ -26,6 +27,13 @@ declare function $$render<R extends LedgerRow>(): {
|
|
|
26
27
|
preferencesNote?: string;
|
|
27
28
|
/** The month a financial year starts, 1–12. July by default. */
|
|
28
29
|
fyStart?: number;
|
|
30
|
+
/** How dates read: "30 Jun 2026" (`short`), or the household's "30/06/2026" (`numeric`). */
|
|
31
|
+
dateFormat?: LedgerDateFormat;
|
|
32
|
+
/**
|
|
33
|
+
* Show each group's net, and in and out. Turn off for rows that are all
|
|
34
|
+
* `conversion`, whose group totals would read $0.00.
|
|
35
|
+
*/
|
|
36
|
+
groupTotals?: boolean;
|
|
29
37
|
currency?: string;
|
|
30
38
|
/** BCP 47 locale for every figure: amounts, nets and counts. */
|
|
31
39
|
locale?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poodle64/ui",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.20",
|
|
4
4
|
"description": "Household shared component layer: shadcn-svelte primitives (bits-ui) plus the composed page chrome every app builds its routes from, restyled by each app's @poodle64/design-tokens alias layer. One fix reaches every app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @poodle64/ui — situation → component map
|
|
2
2
|
|
|
3
3
|
<!-- GENERATED by scripts/generate-registry.mjs from scripts/situations.json + package source. DO NOT EDIT. -->
|
|
4
|
-
Generated from `@poodle64/ui@2026.10.
|
|
4
|
+
Generated from `@poodle64/ui@2026.10.20`. 76 components, 20 situations.
|
|
5
5
|
|
|
6
6
|
**Read this before writing a `<div>`.** Find the SITUATION you are in below, then compose the component named for it — do not hand-build it from raw `Card` or utility classes. Import is `import { Name } from '<import path>'`. Props marked `?` are optional. This map is the retrieval step the [`frontend-design` skill] makes mandatory; the [CHI 2026 study] measured composing-from-a-registry at 95% design-system compliance against 71% for writing the CSS from a prose style guide.
|
|
7
7
|
|