@profullstack/css 0.2.1 → 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/AGENTS.md +20 -1
- package/CHANGELOG.md +20 -0
- package/README.md +49 -1
- package/css/manifest.json +214 -3
- package/css/profullstack.css +2 -1
- package/css/widgets.css +1399 -0
- package/docs/agent-guide.md +39 -0
- package/docs/index.html +33 -1
- package/examples/calendar.html +112 -0
- package/examples/charts.html +211 -0
- package/examples/examples.js +207 -0
- package/examples/inbox.html +121 -0
- package/examples/index.html +26 -1
- package/examples/tv.html +166 -0
- package/examples/widgets.html +303 -0
- package/package.json +10 -4
package/docs/agent-guide.md
CHANGED
|
@@ -103,6 +103,45 @@ Automatic upgrades need no markup: a single `<select>` gets a themed picker, a `
|
|
|
103
103
|
|
|
104
104
|
Corner shape is one token: `:root { --pf-corner-shape: squircle; }` reshapes cards, buttons, inputs, dialogs, and popovers.
|
|
105
105
|
|
|
106
|
+
## Widgets
|
|
107
|
+
|
|
108
|
+
The widgets layer covers the pieces apps keep rebuilding. Compose them from these names only.
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<!-- App bar: icon buttons with counts open anchored popovers -->
|
|
112
|
+
<button type="button" class="icon-button" aria-label="Cart, 3 items" data-count="3" popovertarget="cart"><svg aria-hidden="true">…</svg></button>
|
|
113
|
+
<div id="cart" popover data-anchor>
|
|
114
|
+
<ul role="list" class="stack">
|
|
115
|
+
<li class="media"><span class="thumb">…</span><div><strong>Headphones</strong><small>Qty 1</small></div><span>$189</span></li>
|
|
116
|
+
</ul>
|
|
117
|
+
<a class="button" href="/checkout">Checkout</a>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
<!-- Scroller with arrows; the app pages it with scrollBy() -->
|
|
121
|
+
<div class="scroller-frame">
|
|
122
|
+
<button type="button" data-scroll="prev" aria-label="Previous" tabindex="-1">‹</button>
|
|
123
|
+
<ul class="scroller" role="list" aria-label="Trending">
|
|
124
|
+
<li><a class="tile" href="/t/1" data-shape="poster"><img src="/p.jpg" alt=""><strong>Title</strong></a></li>
|
|
125
|
+
</ul>
|
|
126
|
+
<button type="button" data-scroll="next" aria-label="Next" tabindex="-1">›</button>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<!-- Date range: joined inputs plus a picker in a popover -->
|
|
130
|
+
<div class="field-group">
|
|
131
|
+
<input type="date" aria-label="Check in"><span>→</span><input type="date" aria-label="Check out">
|
|
132
|
+
<button type="button" popovertarget="stay" aria-label="Choose dates">📅</button>
|
|
133
|
+
</div>
|
|
134
|
+
<div id="stay" popover data-anchor><table class="calendar">…</table></div>
|
|
135
|
+
|
|
136
|
+
<!-- Color: native picker plus preset swatches -->
|
|
137
|
+
<div class="swatches" role="radiogroup" aria-label="Brand color">
|
|
138
|
+
<input type="radio" name="c" value="#126b55" style="--swatch: #126b55" aria-label="Teal" checked>
|
|
139
|
+
</div>
|
|
140
|
+
<input type="color" value="#126b55" aria-label="Custom color">
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
TV apps: set `data-input="tv"` on `<html>`. Build shelves from `section > h2 + .scroller-frame` with `.tile` links; D-pad focus does the rest.
|
|
144
|
+
|
|
106
145
|
## Theme control
|
|
107
146
|
|
|
108
147
|
The browser preference is the default. An app with a theme setting can write `data-theme="light"` or `data-theme="dark"` onto the root `<html>` element. The application owns persistence and the control; the stylesheet only provides the colors.
|
package/docs/index.html
CHANGED
|
@@ -63,6 +63,8 @@
|
|
|
63
63
|
<li><a href="#start">Quick start</a></li>
|
|
64
64
|
<li><a href="#layout">Layout</a></li>
|
|
65
65
|
<li><a href="#components">Components</a></li>
|
|
66
|
+
<li><a href="#widgets">Widgets</a></li>
|
|
67
|
+
<li><a href="#tv">TV mode</a></li>
|
|
66
68
|
<li><a href="#themes">Themes</a></li>
|
|
67
69
|
<li><a href="#customize">Customize</a></li>
|
|
68
70
|
<li><a href="#agents">Agents</a></li>
|
|
@@ -71,7 +73,7 @@
|
|
|
71
73
|
|
|
72
74
|
<article class="docs-content">
|
|
73
75
|
<header class="stack" data-space="sm">
|
|
74
|
-
<p class="eyebrow">Documentation / 0.
|
|
76
|
+
<p class="eyebrow">Documentation / 0.3.0</p>
|
|
75
77
|
<h1>Make the browser do more.</h1>
|
|
76
78
|
<p class="muted">A small stylesheet that starts with semantic HTML, gives it considered defaults, and makes its interface clear to the next person or agent who reads it.</p>
|
|
77
79
|
</header>
|
|
@@ -130,6 +132,36 @@
|
|
|
130
132
|
</div>
|
|
131
133
|
</section>
|
|
132
134
|
|
|
135
|
+
<section class="docs-section" id="widgets">
|
|
136
|
+
<h2>Widgets</h2>
|
|
137
|
+
<p>The widgets layer styles the pieces apps keep rebuilding. It is still plain CSS: paging a scroller, switching a tab or picking a date is your app's code, and <code>examples/examples.js</code> shows each in a few lines.</p>
|
|
138
|
+
<div class="component-list">
|
|
139
|
+
<article class="card stack" data-space="sm"><h3>Icon buttons and menus</h3><p><code>.icon-button</code> with <code>data-count</code> for carts, inboxes and bells; <code>.menu</code> inside a popover for account and action menus.</p><div class="cluster"><button type="button" class="icon-button" aria-label="Cart, 3 items" data-count="3" popovertarget="docs-cart"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3h2l2.4 12.2a2 2 0 0 0 2 1.6h8.2a2 2 0 0 0 2-1.6L21 7H6"/><circle cx="10" cy="20.5" r="1.3"/><circle cx="18" cy="20.5" r="1.3"/></svg></button><div id="docs-cart" popover data-anchor><ul class="menu"><li><small>Cart</small></li><li><a href="#widgets">Headphones<span class="badge">$189</span></a></li><li><a href="#widgets">Keyboard<span class="badge">$129</span></a></li><hr><li><a href="#widgets">Checkout</a></li></ul></div></div></article>
|
|
140
|
+
<article class="card stack" data-space="sm"><h3>Scrollers</h3><p><code>.scroller</code> on a list of focusable items, in a <code>.scroller-frame</code> with <code>data-scroll="prev|next"</code> arrows. Keyboard, touch and TV remotes scroll it by moving focus.</p><ul class="scroller" role="list" aria-label="Sample row" style="--pf-scroller-item: 6rem"><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">1</span><small>One</small></a></li><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">2</span><small>Two</small></a></li><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">3</span><small>Three</small></a></li><li><a class="tile" href="#widgets" data-shape="square"><span aria-hidden="true">4</span><small>Four</small></a></li></ul></article>
|
|
141
|
+
<article class="card stack" data-space="sm"><h3>Dates</h3><p>Native date inputs match the theme. <code>table.calendar</code> is a picker or, with <code>data-view="month"</code>, a calendar display with <code>.event</code> chips; <code>.field-group</code> joins a range.</p><div class="field-group"><input type="date" aria-label="From" value="2026-12-18"><span>→</span><input type="date" aria-label="To" value="2026-12-23"></div></article>
|
|
142
|
+
<article class="card stack" data-space="sm"><h3>Color and controls</h3><p>A styled <code>input[type="color"]</code>, <code>.swatches</code> radios, <code>role="switch"</code>, <code>.segmented</code>, <code>.rating</code> and tabs.</p><div class="cluster"><input type="color" value="#126b55" aria-label="Color"><label><input type="checkbox" role="switch" checked>On</label><span class="ring" data-size="sm" style="--value: 72" role="img" aria-label="72 percent">72</span></div></article>
|
|
143
|
+
</div>
|
|
144
|
+
<p>Also included: <code>.media</code> rows, <code>.avatar</code>, <code>.toasts</code>, <code>.steps</code>, <code>.skeleton</code>, <code>.stat</code>, <code>.timeline</code>, <code>.breadcrumbs</code>, <code>.pagination</code>, <code>.dropzone</code> and a three-pane <code>.inbox</code>. See them together in <a href="../examples/widgets.html">widgets</a>, <a href="../examples/calendar.html">dates and calendars</a> and <a href="../examples/inbox.html">inbox</a>.</p>
|
|
145
|
+
</section>
|
|
146
|
+
|
|
147
|
+
<section class="docs-section" id="tv">
|
|
148
|
+
<h2>TV mode</h2>
|
|
149
|
+
<p>Set <code>data-input="tv"</code> on <code><html></code> for a 10-foot interface: larger type and targets, an overscan-safe inset, a loud focus ring that also shows on TV browsers without <code>:focus-visible</code>, zooming tiles and always-visible scroller arrows.</p>
|
|
150
|
+
<pre class="code-sample"><code><html data-input="tv" data-theme="dark">
|
|
151
|
+
…
|
|
152
|
+
<section>
|
|
153
|
+
<h2>Continue watching</h2>
|
|
154
|
+
<div class="scroller-frame">
|
|
155
|
+
<button type="button" data-scroll="prev" aria-label="Back" tabindex="-1">‹</button>
|
|
156
|
+
<ul class="scroller" role="list">
|
|
157
|
+
<li><a class="tile" href="/watch/1"><img src="/still.jpg" alt=""><strong>Night Shift</strong></a></li>
|
|
158
|
+
</ul>
|
|
159
|
+
<button type="button" data-scroll="next" aria-label="Forward" tabindex="-1">›</button>
|
|
160
|
+
</div>
|
|
161
|
+
</section></code></pre>
|
|
162
|
+
<p>TV browsers move focus with the D-pad on their own, so make every item a real link or button. Try <a href="../examples/tv.html">the TV example</a> with the arrow keys. The framework uses cascade layers, so a TV browser needs Chromium 99 or newer.</p>
|
|
163
|
+
</section>
|
|
164
|
+
|
|
133
165
|
<section class="docs-section" id="themes">
|
|
134
166
|
<h2>Color themes</h2>
|
|
135
167
|
<p>Without an explicit choice, colors follow <code>prefers-color-scheme</code>. Set one attribute on the root element to choose a theme:</p>
|
|
@@ -0,0 +1,112 @@
|
|
|
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>Calendar — @profullstack/css</title>
|
|
7
|
+
<link rel="stylesheet" href="../css/profullstack.css">
|
|
8
|
+
<style>
|
|
9
|
+
.example-nav { border-bottom: 1px solid var(--pf-color-border); padding-block: 1rem; }
|
|
10
|
+
.example-nav .container { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
|
|
11
|
+
.example-nav a { text-decoration: none; }
|
|
12
|
+
|
|
13
|
+
.pickers { align-items: start; grid-template-columns: minmax(12rem, 1fr) minmax(19rem, 1.5fr) minmax(16rem, 19rem); }
|
|
14
|
+
@media (max-width: 70rem) { .pickers { grid-template-columns: minmax(0, 1fr); } }
|
|
15
|
+
.field-group svg, aside svg { block-size: 1.1rem; inline-size: 1.1rem; }
|
|
16
|
+
@media (max-width: 60rem) { main .grid[style] { grid-template-columns: minmax(0, 1fr) !important; } }
|
|
17
|
+
</style>
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<header class="example-nav">
|
|
21
|
+
<div class="container"><a href="index.html"><strong>@profullstack/css</strong> examples</a><a href="../docs/index.html">Docs →</a></div>
|
|
22
|
+
</header>
|
|
23
|
+
<main class="container stack section" data-space="lg">
|
|
24
|
+
<header class="stack" data-space="sm">
|
|
25
|
+
<p class="eyebrow">Dates · 0.3</p>
|
|
26
|
+
<h1>Date pickers and calendars.</h1>
|
|
27
|
+
<p class="muted prose">Native date inputs styled to match, a picker and a range picker in anchored popovers, a full month calendar with events, and a day agenda. The calendar is a real <code><table></code>; today is <code>aria-current="date"</code>, chosen days <code>aria-pressed="true"</code>.</p>
|
|
28
|
+
</header>
|
|
29
|
+
|
|
30
|
+
<section class="stack" aria-labelledby="native-heading">
|
|
31
|
+
<h2 id="native-heading">Native inputs</h2>
|
|
32
|
+
<div class="grid" data-columns="4">
|
|
33
|
+
<div><label for="d1">Date</label><input id="d1" type="date" value="2026-12-02"></div>
|
|
34
|
+
<div><label for="d2">Time</label><input id="d2" type="time" value="09:30"></div>
|
|
35
|
+
<div><label for="d3">Date and time</label><input id="d3" type="datetime-local" value="2026-12-02T09:30"></div>
|
|
36
|
+
<div><label for="d4">Month</label><input id="d4" type="month" value="2026-12"></div>
|
|
37
|
+
</div>
|
|
38
|
+
</section>
|
|
39
|
+
|
|
40
|
+
<section class="stack" aria-labelledby="picker-heading">
|
|
41
|
+
<h2 id="picker-heading">Pickers</h2>
|
|
42
|
+
<div class="grid pickers">
|
|
43
|
+
<div class="stack" data-space="sm">
|
|
44
|
+
<label for="due">Due date</label>
|
|
45
|
+
<div class="field-group">
|
|
46
|
+
<input id="due" type="date" min="2026-12-02" value="2026-12-12">
|
|
47
|
+
<button type="button" popovertarget="due-picker" aria-label="Choose due date"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg></button>
|
|
48
|
+
</div>
|
|
49
|
+
<div id="due-picker" popover data-anchor><table class="calendar" data-pick="single" data-target="due"><caption>December 2026</caption><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody><tr><td data-outside></td><td data-outside></td><td><button type="button" data-date="2026-12-01" aria-label="Tuesday, December 1, 2026" disabled>1</button></td><td><button type="button" data-date="2026-12-02" aria-label="Wednesday, December 2, 2026" aria-current="date">2</button></td><td><button type="button" data-date="2026-12-03" aria-label="Thursday, December 3, 2026">3</button></td><td><button type="button" data-date="2026-12-04" aria-label="Friday, December 4, 2026">4</button></td><td><button type="button" data-date="2026-12-05" aria-label="Saturday, December 5, 2026">5</button></td></tr><tr><td><button type="button" data-date="2026-12-06" aria-label="Sunday, December 6, 2026">6</button></td><td><button type="button" data-date="2026-12-07" aria-label="Monday, December 7, 2026">7</button></td><td><button type="button" data-date="2026-12-08" aria-label="Tuesday, December 8, 2026">8</button></td><td><button type="button" data-date="2026-12-09" aria-label="Wednesday, December 9, 2026">9</button></td><td><button type="button" data-date="2026-12-10" aria-label="Thursday, December 10, 2026">10</button></td><td><button type="button" data-date="2026-12-11" aria-label="Friday, December 11, 2026">11</button></td><td><button type="button" data-date="2026-12-12" aria-label="Saturday, December 12, 2026" aria-pressed="true">12</button></td></tr><tr><td><button type="button" data-date="2026-12-13" aria-label="Sunday, December 13, 2026">13</button></td><td><button type="button" data-date="2026-12-14" aria-label="Monday, December 14, 2026">14</button></td><td><button type="button" data-date="2026-12-15" aria-label="Tuesday, December 15, 2026">15</button></td><td><button type="button" data-date="2026-12-16" aria-label="Wednesday, December 16, 2026">16</button></td><td><button type="button" data-date="2026-12-17" aria-label="Thursday, December 17, 2026">17</button></td><td><button type="button" data-date="2026-12-18" aria-label="Friday, December 18, 2026">18</button></td><td><button type="button" data-date="2026-12-19" aria-label="Saturday, December 19, 2026">19</button></td></tr><tr><td><button type="button" data-date="2026-12-20" aria-label="Sunday, December 20, 2026">20</button></td><td><button type="button" data-date="2026-12-21" aria-label="Monday, December 21, 2026">21</button></td><td><button type="button" data-date="2026-12-22" aria-label="Tuesday, December 22, 2026">22</button></td><td><button type="button" data-date="2026-12-23" aria-label="Wednesday, December 23, 2026">23</button></td><td><button type="button" data-date="2026-12-24" aria-label="Thursday, December 24, 2026">24</button></td><td><button type="button" data-date="2026-12-25" aria-label="Friday, December 25, 2026">25</button></td><td><button type="button" data-date="2026-12-26" aria-label="Saturday, December 26, 2026">26</button></td></tr><tr><td><button type="button" data-date="2026-12-27" aria-label="Sunday, December 27, 2026">27</button></td><td><button type="button" data-date="2026-12-28" aria-label="Monday, December 28, 2026">28</button></td><td><button type="button" data-date="2026-12-29" aria-label="Tuesday, December 29, 2026">29</button></td><td><button type="button" data-date="2026-12-30" aria-label="Wednesday, December 30, 2026">30</button></td><td><button type="button" data-date="2026-12-31" aria-label="Thursday, December 31, 2026">31</button></td><td data-outside></td><td data-outside></td></tr></tbody></table></div>
|
|
50
|
+
<small>Past days are disabled. Picking a day fills the input and closes the popover.</small>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="stack" data-space="sm">
|
|
53
|
+
<span id="stay-label" style="font-weight: 580">Stay</span>
|
|
54
|
+
<div class="field-group" role="group" aria-labelledby="stay-label">
|
|
55
|
+
<input id="check-in" type="date" aria-label="Check in" value="2026-12-18">
|
|
56
|
+
<span>→</span>
|
|
57
|
+
<input id="check-out" type="date" aria-label="Check out" value="2026-12-23">
|
|
58
|
+
<button type="button" popovertarget="stay-picker" aria-label="Choose dates"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="4" width="18" height="18" rx="2"/><path d="M16 2v4M8 2v4M3 10h18"/></svg></button>
|
|
59
|
+
</div>
|
|
60
|
+
<div id="stay-picker" popover data-anchor><table class="calendar" data-pick="range" data-target="check-in check-out"><caption>December 2026</caption><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody><tr><td data-outside></td><td data-outside></td><td><button type="button" data-date="2026-12-01" aria-label="Tuesday, December 1, 2026">1</button></td><td><button type="button" data-date="2026-12-02" aria-label="Wednesday, December 2, 2026" aria-current="date">2</button></td><td><button type="button" data-date="2026-12-03" aria-label="Thursday, December 3, 2026">3</button></td><td><button type="button" data-date="2026-12-04" aria-label="Friday, December 4, 2026">4</button></td><td><button type="button" data-date="2026-12-05" aria-label="Saturday, December 5, 2026">5</button></td></tr><tr><td><button type="button" data-date="2026-12-06" aria-label="Sunday, December 6, 2026">6</button></td><td><button type="button" data-date="2026-12-07" aria-label="Monday, December 7, 2026">7</button></td><td><button type="button" data-date="2026-12-08" aria-label="Tuesday, December 8, 2026">8</button></td><td><button type="button" data-date="2026-12-09" aria-label="Wednesday, December 9, 2026">9</button></td><td><button type="button" data-date="2026-12-10" aria-label="Thursday, December 10, 2026">10</button></td><td><button type="button" data-date="2026-12-11" aria-label="Friday, December 11, 2026">11</button></td><td><button type="button" data-date="2026-12-12" aria-label="Saturday, December 12, 2026">12</button></td></tr><tr><td><button type="button" data-date="2026-12-13" aria-label="Sunday, December 13, 2026">13</button></td><td><button type="button" data-date="2026-12-14" aria-label="Monday, December 14, 2026">14</button></td><td><button type="button" data-date="2026-12-15" aria-label="Tuesday, December 15, 2026">15</button></td><td><button type="button" data-date="2026-12-16" aria-label="Wednesday, December 16, 2026">16</button></td><td><button type="button" data-date="2026-12-17" aria-label="Thursday, December 17, 2026">17</button></td><td><button type="button" data-date="2026-12-18" aria-label="Friday, December 18, 2026" aria-pressed="true">18</button></td><td><button type="button" data-date="2026-12-19" aria-label="Saturday, December 19, 2026">19</button></td></tr><tr><td><button type="button" data-date="2026-12-20" aria-label="Sunday, December 20, 2026">20</button></td><td><button type="button" data-date="2026-12-21" aria-label="Monday, December 21, 2026">21</button></td><td><button type="button" data-date="2026-12-22" aria-label="Tuesday, December 22, 2026">22</button></td><td><button type="button" data-date="2026-12-23" aria-label="Wednesday, December 23, 2026" aria-pressed="true">23</button></td><td><button type="button" data-date="2026-12-24" aria-label="Thursday, December 24, 2026">24</button></td><td><button type="button" data-date="2026-12-25" aria-label="Friday, December 25, 2026">25</button></td><td><button type="button" data-date="2026-12-26" aria-label="Saturday, December 26, 2026">26</button></td></tr><tr><td><button type="button" data-date="2026-12-27" aria-label="Sunday, December 27, 2026">27</button></td><td><button type="button" data-date="2026-12-28" aria-label="Monday, December 28, 2026">28</button></td><td><button type="button" data-date="2026-12-29" aria-label="Tuesday, December 29, 2026">29</button></td><td><button type="button" data-date="2026-12-30" aria-label="Wednesday, December 30, 2026">30</button></td><td><button type="button" data-date="2026-12-31" aria-label="Thursday, December 31, 2026">31</button></td><td data-outside></td><td data-outside></td></tr></tbody></table></div>
|
|
61
|
+
<small>A range: first click is check-in, second is check-out; days between are shaded.</small>
|
|
62
|
+
</div>
|
|
63
|
+
<div class="card stack" data-space="sm">
|
|
64
|
+
<table class="calendar" data-pick="single" data-target="inline-date"><caption>January 2027</caption><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody><tr><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td><button type="button" data-date="2027-01-01" aria-label="Friday, January 1, 2027">1</button></td><td><button type="button" data-date="2027-01-02" aria-label="Saturday, January 2, 2027">2</button></td></tr><tr><td><button type="button" data-date="2027-01-03" aria-label="Sunday, January 3, 2027">3</button></td><td><button type="button" data-date="2027-01-04" aria-label="Monday, January 4, 2027">4</button></td><td><button type="button" data-date="2027-01-05" aria-label="Tuesday, January 5, 2027">5</button></td><td><button type="button" data-date="2027-01-06" aria-label="Wednesday, January 6, 2027">6</button></td><td><button type="button" data-date="2027-01-07" aria-label="Thursday, January 7, 2027">7</button></td><td><button type="button" data-date="2027-01-08" aria-label="Friday, January 8, 2027" aria-pressed="true">8</button></td><td><button type="button" data-date="2027-01-09" aria-label="Saturday, January 9, 2027">9</button></td></tr><tr><td><button type="button" data-date="2027-01-10" aria-label="Sunday, January 10, 2027">10</button></td><td><button type="button" data-date="2027-01-11" aria-label="Monday, January 11, 2027">11</button></td><td><button type="button" data-date="2027-01-12" aria-label="Tuesday, January 12, 2027">12</button></td><td><button type="button" data-date="2027-01-13" aria-label="Wednesday, January 13, 2027">13</button></td><td><button type="button" data-date="2027-01-14" aria-label="Thursday, January 14, 2027">14</button></td><td><button type="button" data-date="2027-01-15" aria-label="Friday, January 15, 2027">15</button></td><td><button type="button" data-date="2027-01-16" aria-label="Saturday, January 16, 2027">16</button></td></tr><tr><td><button type="button" data-date="2027-01-17" aria-label="Sunday, January 17, 2027">17</button></td><td><button type="button" data-date="2027-01-18" aria-label="Monday, January 18, 2027">18</button></td><td><button type="button" data-date="2027-01-19" aria-label="Tuesday, January 19, 2027">19</button></td><td><button type="button" data-date="2027-01-20" aria-label="Wednesday, January 20, 2027">20</button></td><td><button type="button" data-date="2027-01-21" aria-label="Thursday, January 21, 2027">21</button></td><td><button type="button" data-date="2027-01-22" aria-label="Friday, January 22, 2027">22</button></td><td><button type="button" data-date="2027-01-23" aria-label="Saturday, January 23, 2027">23</button></td></tr><tr><td><button type="button" data-date="2027-01-24" aria-label="Sunday, January 24, 2027">24</button></td><td><button type="button" data-date="2027-01-25" aria-label="Monday, January 25, 2027">25</button></td><td><button type="button" data-date="2027-01-26" aria-label="Tuesday, January 26, 2027">26</button></td><td><button type="button" data-date="2027-01-27" aria-label="Wednesday, January 27, 2027">27</button></td><td><button type="button" data-date="2027-01-28" aria-label="Thursday, January 28, 2027">28</button></td><td><button type="button" data-date="2027-01-29" aria-label="Friday, January 29, 2027">29</button></td><td><button type="button" data-date="2027-01-30" aria-label="Saturday, January 30, 2027">30</button></td></tr><tr><td><button type="button" data-date="2027-01-31" aria-label="Sunday, January 31, 2027">31</button></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td><td data-outside></td></tr></tbody></table>
|
|
65
|
+
<div class="cluster" data-justify="between"><label for="inline-date" style="margin: 0">Selected</label><input id="inline-date" type="date" value="2027-01-08" style="inline-size: auto"></div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
</section>
|
|
69
|
+
|
|
70
|
+
<section class="stack" aria-labelledby="month-heading">
|
|
71
|
+
<div class="cluster" data-justify="between">
|
|
72
|
+
<h2 id="month-heading"><span id="month-title">December 2026</span></h2>
|
|
73
|
+
<div class="cluster" style="gap: var(--pf-space-2)">
|
|
74
|
+
<div class="field-group">
|
|
75
|
+
<button type="button" aria-label="Previous month" data-toast="Month paging is app code: re-render the table."><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></button>
|
|
76
|
+
<button type="button" data-toast="Already showing today.">Today</button>
|
|
77
|
+
<button type="button" aria-label="Next month" data-toast="Month paging is app code: re-render the table."><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></button>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="segmented" role="radiogroup" aria-label="Calendar view">
|
|
80
|
+
<label><input type="radio" name="view" checked>Month</label>
|
|
81
|
+
<label><input type="radio" name="view">Week</label>
|
|
82
|
+
<label><input type="radio" name="view">Day</label>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="grid" style="grid-template-columns: minmax(0, 1fr) minmax(14rem, 18rem); align-items: start">
|
|
87
|
+
<table class="calendar" data-view="month" aria-labelledby="month-title"><thead><tr><th scope="col"><abbr title="Sunday">Su</abbr></th><th scope="col"><abbr title="Monday">Mo</abbr></th><th scope="col"><abbr title="Tuesday">Tu</abbr></th><th scope="col"><abbr title="Wednesday">We</abbr></th><th scope="col"><abbr title="Thursday">Th</abbr></th><th scope="col"><abbr title="Friday">Fr</abbr></th><th scope="col"><abbr title="Saturday">Sa</abbr></th></tr></thead><tbody>
|
|
88
|
+
<tr><td data-outside><time datetime="2026-11-29">29</time></td><td data-outside><time datetime="2026-11-30">30</time></td><td><time datetime="2026-12-01">1</time><a class="event" href="#e-1-0">Sprint planning</a></td><td><time datetime="2026-12-02" aria-current="date">2</time><a class="event" href="#e-2-0" data-tone="info">Design review</a><a class="event" href="#e-2-1">1:1 with Maya</a></td><td><time datetime="2026-12-03">3</time><a class="event" href="#e-3-0" data-tone="warning">Launch prep</a></td><td><time datetime="2026-12-04">4</time><a class="event" href="#e-4-0" data-tone="success">Ship v2.4</a></td><td><time datetime="2026-12-05">5</time></td></tr>
|
|
89
|
+
<tr><td><time datetime="2026-12-06">6</time></td><td><time datetime="2026-12-07">7</time></td><td><time datetime="2026-12-08">8</time><a class="event" href="#e-8-0" data-tone="accent">Board update</a></td><td><time datetime="2026-12-09">9</time><a class="event" href="#e-9-0" data-tone="info">Customer call</a></td><td><time datetime="2026-12-10">10</time><a class="event" href="#e-10-0" data-tone="danger">Security audit</a><a class="event" href="#e-10-1">Lunch & learn</a></td><td><time datetime="2026-12-11">11</time><a class="event" href="#e-11-0" data-tone="success">Payroll</a></td><td><time datetime="2026-12-12">12</time></td></tr>
|
|
90
|
+
<tr><td><time datetime="2026-12-13">13</time></td><td><time datetime="2026-12-14">14</time><a class="event" href="#e-14-0">Q4 planning</a></td><td><time datetime="2026-12-15">15</time><a class="event" href="#e-15-0" data-tone="info">Hiring loop</a><a class="event" href="#e-15-1">Retro</a><a class="event" href="#e-15-2" data-tone="accent">Team dinner</a></td><td><time datetime="2026-12-16">16</time></td><td><time datetime="2026-12-17">17</time><a class="event" href="#e-17-0" data-tone="warning">Release freeze</a></td><td><time datetime="2026-12-18">18</time><a class="event" href="#e-18-0" data-tone="accent">Holiday party</a></td><td><time datetime="2026-12-19">19</time></td></tr>
|
|
91
|
+
<tr><td><time datetime="2026-12-20">20</time></td><td><time datetime="2026-12-21">21</time></td><td><time datetime="2026-12-22">22</time><a class="event" href="#e-22-0" data-tone="danger">Year-end close</a></td><td><time datetime="2026-12-23">23</time></td><td><time datetime="2026-12-24">24</time><a class="event" href="#e-24-0">Office closed</a></td><td><time datetime="2026-12-25">25</time><a class="event" href="#e-25-0">Office closed</a></td><td><time datetime="2026-12-26">26</time></td></tr>
|
|
92
|
+
<tr><td><time datetime="2026-12-27">27</time></td><td><time datetime="2026-12-28">28</time></td><td><time datetime="2026-12-29">29</time></td><td><time datetime="2026-12-30">30</time></td><td><time datetime="2026-12-31">31</time><a class="event" href="#e-31-0" data-tone="success">Backups verified</a></td><td data-outside><time datetime="2027-01-01">1</time></td><td data-outside><time datetime="2027-01-02">2</time></td></tr>
|
|
93
|
+
</tbody></table>
|
|
94
|
+
<aside class="card stack" aria-labelledby="agenda-heading">
|
|
95
|
+
<h3 id="agenda-heading">Today · Wed, Dec 2</h3>
|
|
96
|
+
<ol class="timeline">
|
|
97
|
+
<li data-tone="info"><time datetime="2026-12-02T09:30">9:30</time><strong>Design review</strong><small class="muted">Figma · 45 min</small></li>
|
|
98
|
+
<li><time datetime="2026-12-02T11:00">11:00</time><strong>1:1 with Maya</strong><small class="muted">Room 4 · 30 min</small></li>
|
|
99
|
+
<li data-tone="success"><time datetime="2026-12-02T14:00">14:00</time><strong>Customer onboarding</strong><small class="muted">Zoom · 1 h</small></li>
|
|
100
|
+
<li data-tone="warning"><time datetime="2026-12-02T17:30">17:30</time><strong>Deploy window</strong><small class="muted">On call: Jordan</small></li>
|
|
101
|
+
</ol>
|
|
102
|
+
<button type="button" data-variant="secondary"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>New event</button>
|
|
103
|
+
</aside>
|
|
104
|
+
</div>
|
|
105
|
+
</section>
|
|
106
|
+
</main>
|
|
107
|
+
|
|
108
|
+
<ol class="toasts" role="status" aria-live="polite"></ol>
|
|
109
|
+
<script type="module" src="examples.js"></script>
|
|
110
|
+
</body>
|
|
111
|
+
</html>
|
|
112
|
+
|
|
@@ -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>
|