@profullstack/css 0.3.0 → 0.3.1

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 CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1 — 2026-12-02
4
+
5
+ - New example: `examples/charts.html`, an analytics dashboard drawn with [@profullstack/charts](https://profullstack.com/charts/) 0.3 and laid out with the framework's cards, grid, badges, `.segmented` theme switch and tables. Charts 0.3 reads the `--pf-*` tokens, so light, dark and `data-theme` carry over with no extra CSS.
6
+ - README: a "Charts" section.
7
+
3
8
  ## 0.3.0 — 2026-12-02
4
9
 
5
10
  Widgets layer and TV mode.
package/README.md CHANGED
@@ -139,6 +139,23 @@ Set `data-input="tv"` on `<html>` for a 10-foot interface: larger type and targe
139
139
 
140
140
  See `examples/widgets.html`, `examples/tv.html`, `examples/calendar.html` and `examples/inbox.html`.
141
141
 
142
+ ## Charts
143
+
144
+ For charts, use [@profullstack/charts](https://profullstack.com/charts/) 0.3 or newer. It reads the `--pf-*` tokens (ink, muted ink, surface, border, focus, success and danger, radius and the sans font), so its charts match the page in light, dark and either `data-theme` with no extra CSS, and its canvas trading chart repaints when the theme changes. Put each chart in a `.card` and give its element a height.
145
+
146
+ ```html
147
+ <article class="card stack">
148
+ <h2>Revenue</h2>
149
+ <div id="revenue" style="min-height: 220px"></div>
150
+ </article>
151
+ <script type="module">
152
+ import $ from 'https://unpkg.com/@profullstack/charts@0.3.0/dist/charts.js';
153
+ $('#revenue').chart('area', [{ month: 'Jan', revenue: 31000 }, { month: 'Feb', revenue: 34500 }]);
154
+ </script>
155
+ ```
156
+
157
+ See `examples/charts.html`.
158
+
142
159
  ## Documentation
143
160
 
144
161
  - `docs/agent-guide.md` — complete generation and usage guide.
@@ -0,0 +1,211 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Charts — @profullstack/css example</title>
7
+ <meta name="description" content="An analytics dashboard drawn with @profullstack/charts and styled by @profullstack/css. Charts read the css tokens, so light, dark and data-theme just work.">
8
+ <link rel="stylesheet" href="../css/profullstack.css">
9
+ <style>
10
+ .app-header { border-bottom: 1px solid var(--pf-color-border); }
11
+ .app-header .container { align-items: center; display: flex; flex-wrap: wrap; gap: var(--pf-space-3); justify-content: space-between; min-height: 4.5rem; }
12
+ .app-header a { text-decoration: none; }
13
+ .main-content { padding-block: clamp(2rem, 6vw, 4.5rem); }
14
+ .chart { min-height: 220px; }
15
+ .chart[data-size="sm"] { min-height: 110px; }
16
+ .chart[data-size="lg"] { min-height: 420px; }
17
+ .wide { grid-column: 1 / -1; }
18
+ .card h2 { font-size: var(--pf-text-lg); }
19
+ .table-wrap { overflow-x: auto; }
20
+ .table-wrap table { min-width: 36rem; }
21
+ td .spark { display: inline-block; width: 120px; }
22
+ .num { font-variant-numeric: tabular-nums; text-align: end; }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <header class="app-header">
27
+ <div class="container">
28
+ <a href="index.html"><strong>Ledgerline</strong></a>
29
+ <div class="segmented" role="radiogroup" aria-label="Theme">
30
+ <label><input type="radio" name="theme" value="system" checked> System</label>
31
+ <label><input type="radio" name="theme" value="light"> Light</label>
32
+ <label><input type="radio" name="theme" value="dark"> Dark</label>
33
+ </div>
34
+ </div>
35
+ </header>
36
+
37
+ <main class="container stack main-content">
38
+ <header class="stack" data-space="sm">
39
+ <p class="eyebrow">Examples / Charts</p>
40
+ <h1>Revenue analytics</h1>
41
+ <p class="muted prose">Every chart here is <a href="https://profullstack.com/charts/">@profullstack/charts</a> with no theme CSS of its own. The charts read the <code>--pf-*</code> tokens, so switching the theme above repaints them, the canvas trading chart included. Each chart has a keyboard-focusable plot, a screen-reader summary and a data table. The numbers are made up.</p>
42
+ </header>
43
+
44
+ <section class="grid" data-columns="4" aria-label="Key numbers">
45
+ <article class="card"><div class="chart" data-size="sm" id="kpi-mrr"></div></article>
46
+ <article class="card"><div class="chart" data-size="sm" id="kpi-users"></div></article>
47
+ <article class="card"><div class="chart" data-size="sm" id="kpi-churn"></div></article>
48
+ <article class="card"><div class="chart" data-size="sm" id="kpi-conv"></div></article>
49
+ </section>
50
+
51
+ <section class="grid" data-columns="3" aria-label="Charts">
52
+ <article class="card stack wide">
53
+ <div class="cluster" data-justify="between">
54
+ <h2>Revenue and costs</h2>
55
+ <span class="badge" data-tone="success">+18% YoY</span>
56
+ </div>
57
+ <div class="chart" id="revenue"></div>
58
+ </article>
59
+
60
+ <article class="card stack">
61
+ <h2>Plan mix</h2>
62
+ <div class="chart" id="plans"></div>
63
+ </article>
64
+ <article class="card stack">
65
+ <h2>Signups by channel</h2>
66
+ <div class="chart" id="channels"></div>
67
+ </article>
68
+ <article class="card stack">
69
+ <h2>Uptime this month</h2>
70
+ <div class="chart" id="uptime"></div>
71
+ </article>
72
+
73
+ <article class="card stack">
74
+ <h2>Trial funnel</h2>
75
+ <div class="chart" id="funnel"></div>
76
+ </article>
77
+ <article class="card stack">
78
+ <h2>Response time by region</h2>
79
+ <div class="chart" id="latency"></div>
80
+ </article>
81
+ <article class="card stack">
82
+ <h2>Revenue by country</h2>
83
+ <div class="chart" id="countries"></div>
84
+ </article>
85
+ <article class="card stack wide">
86
+ <h2>Where MRR moved</h2>
87
+ <div class="chart" id="waterfall"></div>
88
+ </article>
89
+
90
+ <article class="card stack wide">
91
+ <h2>Deploys per day</h2>
92
+ <div class="chart" id="deploys"></div>
93
+ </article>
94
+
95
+ <article class="card stack wide">
96
+ <div class="cluster" data-justify="between">
97
+ <div class="stack" data-space="sm">
98
+ <h2>LDG/USD</h2>
99
+ <p class="muted">A simulated live price feed: one tick a second updates the forming candle.</p>
100
+ </div>
101
+ <button type="button" data-variant="secondary" id="feed" aria-pressed="true">Pause feed</button>
102
+ </div>
103
+ <div class="chart" data-size="lg" id="price"></div>
104
+ </article>
105
+ </section>
106
+
107
+ <section class="card stack" aria-labelledby="products-h">
108
+ <h2 id="products-h">Top products</h2>
109
+ <div class="table-wrap">
110
+ <table>
111
+ <thead><tr><th scope="col">Product</th><th scope="col" class="num">Revenue</th><th scope="col">Last 12 weeks</th><th scope="col">Status</th></tr></thead>
112
+ <tbody id="products"></tbody>
113
+ </table>
114
+ </div>
115
+ </section>
116
+ </main>
117
+
118
+ <script type="module">
119
+ import $ from 'https://unpkg.com/@profullstack/charts@0.3.0/dist/charts.js';
120
+
121
+ // Theme switch: data-theme on <html> is all @profullstack/css (and so the charts) needs.
122
+ for (const input of document.querySelectorAll('input[name="theme"]')) {
123
+ input.addEventListener('change', () => {
124
+ if (input.value === 'system') document.documentElement.removeAttribute('data-theme');
125
+ else document.documentElement.dataset.theme = input.value;
126
+ });
127
+ }
128
+
129
+ // Seeded random numbers, so the page looks the same on every load.
130
+ let seed = 7;
131
+ const rand = () => ((seed = (seed * 16807) % 2147483647) - 1) / 2147483646;
132
+ const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
133
+ const weeks = (start, drift) => Array.from({ length: 12 }, (_, i) => Math.round(start * (1 + drift * i + (rand() - 0.5) * 0.12)));
134
+
135
+ $('#kpi-mrr').chart('stat', { value: 48200, previous: 42900, trend: weeks(40000, 0.02) }, { title: 'MRR', prefix: '$' });
136
+ $('#kpi-users').chart('stat', { value: 12840, previous: 11910, trend: weeks(11000, 0.015) }, { title: 'Active users' });
137
+ $('#kpi-churn').chart('stat', { value: 2.1, previous: 2.6, trend: [3.1, 2.9, 3, 2.8, 2.7, 2.6, 2.6, 2.4, 2.3, 2.2, 2.2, 2.1] }, { title: 'Churn', suffix: '%', goodWhen: 'down' });
138
+ $('#kpi-conv').chart('stat', { value: 6.4, previous: 6.9, trend: [7.2, 7, 7.1, 6.9, 6.8, 6.9, 6.7, 6.6, 6.6, 6.5, 6.4, 6.4] }, { title: 'Trial conversion', suffix: '%' });
139
+
140
+ $('#revenue').chart('area', months.map((month, i) => ({
141
+ month,
142
+ revenue: Math.round(31000 + i * 1600 + rand() * 2500),
143
+ costs: Math.round(21000 + i * 700 + rand() * 1800),
144
+ })), { title: 'Revenue and costs by month', smooth: true, format: '$,.0f', labels: { revenue: 'Revenue', costs: 'Costs' } });
145
+
146
+ $('#plans').chart('donut', { Starter: 412, Team: 268, Business: 97, Enterprise: 14 }, { title: 'Customers by plan' });
147
+
148
+ $('#channels').chart('bar', months.slice(6).map((month) => ({
149
+ month,
150
+ search: Math.round(180 + rand() * 90),
151
+ referral: Math.round(90 + rand() * 60),
152
+ social: Math.round(40 + rand() * 50),
153
+ })), { title: 'Signups by channel, last 6 months', stacked: true });
154
+
155
+ $('#uptime').chart('gauge', { value: 99.93, min: 99, max: 100 }, {
156
+ title: 'Uptime, percent', label: 'Uptime',
157
+ bands: [{ to: 99.5, color: 'var(--pf-color-danger)' }, { to: 99.9, color: 'var(--pf-color-warning)' }, { to: 100, color: 'var(--pf-color-success)' }],
158
+ });
159
+
160
+ $('#funnel').chart('funnel', { 'Visited pricing': 18400, 'Started trial': 2210, 'Invited team': 1130, 'Paid': 142 }, { title: 'Trial funnel, last 30 days' });
161
+
162
+ $('#waterfall').chart('waterfall', { New: 6400, Expansion: 2100, Contraction: -900, Churn: -1300 }, { title: 'MRR movement this month', start: 42900, total: true, totalLabel: 'Now', format: '$,.0f' });
163
+
164
+ $('#countries').chart('treemap', { 'United States': 21400, Germany: 6900, 'United Kingdom': 5200, Canada: 3800, France: 3100, Japan: 2600, Brazil: 1900, Other: 3300 }, { title: 'MRR by country', format: '$,.0f' });
165
+
166
+ $('#latency').chart('boxplot', {
167
+ 'US East': Array.from({ length: 60 }, () => 80 + rand() * 60 + (rand() > 0.95 ? 120 : 0)),
168
+ 'EU West': Array.from({ length: 60 }, () => 95 + rand() * 70),
169
+ 'AP South': Array.from({ length: 60 }, () => 140 + rand() * 90 + (rand() > 0.93 ? 160 : 0)),
170
+ }, { title: 'Response time in ms by region' });
171
+
172
+ const today = new Date();
173
+ const deploys = {};
174
+ for (let d = 0; d < 180; d++) {
175
+ const day = new Date(today); day.setDate(day.getDate() - d);
176
+ const weekend = day.getDay() === 0 || day.getDay() === 6;
177
+ const n = Math.floor(rand() * (weekend ? 2 : 7));
178
+ if (n) deploys[day.toISOString().slice(0, 10)] = n;
179
+ }
180
+ $('#deploys').chart('calendar', deploys, { title: 'Deploys per day, last 6 months', unit: 'deploys', from: new Date(today.getTime() - 179 * 864e5), to: today });
181
+
182
+ // Simulated price feed for the trading chart.
183
+ let t = Date.now() - 120 * 60_000, last = 42.5;
184
+ const bars = Array.from({ length: 120 }, () => {
185
+ const open = last, close = Math.max(1, open + (rand() - 0.48) * 0.8);
186
+ const bar = { time: t, open, high: Math.max(open, close) + rand() * 0.3, low: Math.min(open, close) - rand() * 0.3, close, volume: Math.round(200 + rand() * 900) };
187
+ t += 60_000; last = close;
188
+ return bar;
189
+ });
190
+ const price = $('#price').chart('candlestick', bars, { title: 'LDG/USD, 1 minute (simulated)', indicators: ['volume', 'sma:20', 'ema:50'] });
191
+ let feed = setInterval(tick, 1000);
192
+ function tick() { last = Math.max(1, last + (Math.random() - 0.48) * 0.25); price.push({ price: last, volume: Math.round(Math.random() * 40) }); }
193
+ document.getElementById('feed').addEventListener('click', (e) => {
194
+ const on = e.currentTarget.getAttribute('aria-pressed') === 'true';
195
+ if (on) clearInterval(feed); else feed = setInterval(tick, 1000);
196
+ e.currentTarget.setAttribute('aria-pressed', String(!on));
197
+ e.currentTarget.textContent = on ? 'Resume feed' : 'Pause feed';
198
+ });
199
+
200
+ // Sparklines inside a plain table.
201
+ const products = [['Ledger Pro', 182400, 0.03, 'success', 'Growing'], ['Invoices', 96100, 0.01, 'success', 'Steady'], ['Payroll add-on', 41700, -0.015, 'warning', 'Slipping'], ['Legacy API', 8300, -0.04, 'danger', 'Sunsetting']];
202
+ const tbody = document.getElementById('products');
203
+ for (const [name, revenue, drift, tone, status] of products) {
204
+ const tr = document.createElement('tr');
205
+ tr.innerHTML = `<th scope="row">${name}</th><td class="num">$${revenue.toLocaleString('en-US')}</td><td><span class="spark"></span></td><td><span class="badge" data-tone="${tone}">${status}</span></td>`;
206
+ tbody.append(tr);
207
+ $(tr.querySelector('.spark')).chart('sparkline', weeks(revenue / 12, drift), { title: `${name}, weekly revenue` });
208
+ }
209
+ </script>
210
+ </body>
211
+ </html>
@@ -61,6 +61,11 @@
61
61
  <h2>Inbox ↗</h2>
62
62
  <p class="muted">Three panes that scroll on their own and stack on phones: folders, an unread-aware message list and a reading pane.</p>
63
63
  </a>
64
+ <a class="card stack example-link" href="charts.html">
65
+ <span class="badge" data-tone="success">WITH @PROFULLSTACK/CHARTS</span>
66
+ <h2>Charts dashboard ↗</h2>
67
+ <p class="muted">KPI tiles, area, stacked bar, donut, gauge, funnel, treemap, waterfall, boxplot, a calendar heatmap, a live candlestick and table sparklines. They follow the theme with no glue CSS.</p>
68
+ </a>
64
69
  </section>
65
70
  </main>
66
71
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@profullstack/css",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A semantic, agent-friendly CSS foundation for real interfaces, with widgets and a TV mode.",
5
5
  "license": "MIT",
6
6
  "type": "module",