driggsby 0.7.1 → 0.7.3
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 +3 -1
- package/assets/Inter-LICENSE.txt +92 -0
- package/assets/Inter.woff2 +0 -0
- package/dist/dev/dashboard-font.js +14 -0
- package/dist/dev/dev-command.js +3 -0
- package/dist/dev/dev-servers.js +14 -4
- package/dist/init/template-styles.js +86 -9
- package/dist/init/templates.js +67 -9
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -123,4 +123,6 @@ signed in with an earlier version of the CLI, run
|
|
|
123
123
|
|
|
124
124
|
## License
|
|
125
125
|
|
|
126
|
-
Apache-2.0
|
|
126
|
+
Apache-2.0. The bundled Inter font (`assets/Inter.woff2`), which
|
|
127
|
+
`driggsby dev` serves to the app it previews, is under the SIL Open Font
|
|
128
|
+
License 1.1; see `assets/Inter-LICENSE.txt`.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
9
|
+
-----------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
PREAMBLE
|
|
12
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
13
|
+
development of collaborative font projects, to support the font creation
|
|
14
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
15
|
+
open framework in which fonts may be shared and improved in partnership
|
|
16
|
+
with others.
|
|
17
|
+
|
|
18
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
19
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
20
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
21
|
+
redistributed and/or sold with any software provided that any reserved
|
|
22
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
23
|
+
however, cannot be released under any other type of license. The
|
|
24
|
+
requirement for fonts to remain under this license does not apply
|
|
25
|
+
to any document created using the fonts or their derivatives.
|
|
26
|
+
|
|
27
|
+
DEFINITIONS
|
|
28
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
29
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
30
|
+
include source files, build scripts and documentation.
|
|
31
|
+
|
|
32
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
33
|
+
copyright statement(s).
|
|
34
|
+
|
|
35
|
+
"Original Version" refers to the collection of Font Software components as
|
|
36
|
+
distributed by the Copyright Holder(s).
|
|
37
|
+
|
|
38
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
39
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
40
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
41
|
+
new environment.
|
|
42
|
+
|
|
43
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
44
|
+
writer or other person who contributed to the Font Software.
|
|
45
|
+
|
|
46
|
+
PERMISSION AND CONDITIONS
|
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
48
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
49
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
50
|
+
Software, subject to the following conditions:
|
|
51
|
+
|
|
52
|
+
1) Neither the Font Software nor any of its individual components,
|
|
53
|
+
in Original or Modified Versions, may be sold by itself.
|
|
54
|
+
|
|
55
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
56
|
+
redistributed and/or sold with any software, provided that each copy
|
|
57
|
+
contains the above copyright notice and this license. These can be
|
|
58
|
+
included either as stand-alone text files, human-readable headers or
|
|
59
|
+
in the appropriate machine-readable metadata fields within text or
|
|
60
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
61
|
+
|
|
62
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
63
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
64
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
65
|
+
presented to the users.
|
|
66
|
+
|
|
67
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
68
|
+
Software shall not be used to promote, endorse or advertise any
|
|
69
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
70
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
71
|
+
permission.
|
|
72
|
+
|
|
73
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
74
|
+
must be distributed entirely under this license, and must not be
|
|
75
|
+
distributed under any other license. The requirement for fonts to
|
|
76
|
+
remain under this license does not apply to any document created
|
|
77
|
+
using the Font Software.
|
|
78
|
+
|
|
79
|
+
TERMINATION
|
|
80
|
+
This license becomes null and void if any of the above conditions are
|
|
81
|
+
not met.
|
|
82
|
+
|
|
83
|
+
DISCLAIMER
|
|
84
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
87
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
88
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
89
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
90
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
92
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Inter, the face Driggsby apps set their text in. Driggsby serves it on
|
|
2
|
+
// every deployed app's own origin at DASHBOARD_FONT_PATH, and the scaffold
|
|
3
|
+
// loads it from there; dev serves the same bytes at the same path, from
|
|
4
|
+
// this package (assets/Inter.woff2, under the SIL Open Font License 1.1 in
|
|
5
|
+
// assets/Inter-LICENSE.txt). So the preview draws the letters the deployed
|
|
6
|
+
// page draws, and nothing reaches the internet for them.
|
|
7
|
+
import { readFile } from "node:fs/promises";
|
|
8
|
+
export const DASHBOARD_FONT_PATH = "/-/inter.woff2";
|
|
9
|
+
export const DASHBOARD_FONT_TYPE = "font/woff2";
|
|
10
|
+
// src/dev/ and dist/dev/ both sit two levels under the package root.
|
|
11
|
+
const FONT_FILE = new URL("../../assets/Inter.woff2", import.meta.url);
|
|
12
|
+
export async function loadDashboardFont() {
|
|
13
|
+
return await readFile(FONT_FILE);
|
|
14
|
+
}
|
package/dist/dev/dev-command.js
CHANGED
|
@@ -13,6 +13,7 @@ import { defaultCredentialEnvironment, } from "../credentials/store.js";
|
|
|
13
13
|
import { requireDeploySession } from "../deploy/api-session.js";
|
|
14
14
|
import { tryOpenUrl } from "../login/open-url.js";
|
|
15
15
|
import { wrapProse } from "../terminal-text.js";
|
|
16
|
+
import { loadDashboardFont } from "./dashboard-font.js";
|
|
16
17
|
import { DEV_IDLE_MINUTES, DEV_START_COMMAND, DEV_STOP_COMMAND } from "./dev-commands.js";
|
|
17
18
|
import { startDevServers } from "./dev-servers.js";
|
|
18
19
|
import { pruneDevStatesForPorts, readDevStates, removeDevState, writeDevState } from "./dev-state.js";
|
|
@@ -63,6 +64,7 @@ export async function runDev(options = {}, environment = defaultCredentialEnviro
|
|
|
63
64
|
const session = await requireDeploySession(environment);
|
|
64
65
|
await refuseSecondPreview(environment.homeDirectory, projectDirectory);
|
|
65
66
|
const sdkBundle = await loadSdkBundle();
|
|
67
|
+
const dashboardFont = await loadDashboardFont();
|
|
66
68
|
// Retries like the production host, so the preview loads the way the
|
|
67
69
|
// deployed app would.
|
|
68
70
|
const broker = new McpBroker({ baseUrl: session.baseUrl, token: session.token, retries: true });
|
|
@@ -83,6 +85,7 @@ export async function runDev(options = {}, environment = defaultCredentialEnviro
|
|
|
83
85
|
background: config.background,
|
|
84
86
|
serveDirectory: config.serveDirectory,
|
|
85
87
|
sdkBundle,
|
|
88
|
+
dashboardFont,
|
|
86
89
|
runToolCall: async (tool, argumentsObject) => {
|
|
87
90
|
const started = Date.now();
|
|
88
91
|
const calledIn = documentGeneration;
|
package/dist/dev/dev-servers.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// The two local servers behind `driggsby dev`, mirroring production's
|
|
2
2
|
// topology: the host origin (the page a person opens; serves the host page
|
|
3
3
|
// and the CLI's tool-call endpoint) and the app origin (the app's own
|
|
4
|
-
// files, plus the Driggsby SDK at /-/driggsby-sdk.js
|
|
5
|
-
// only. The app token never appears
|
|
6
|
-
// the CLI process.
|
|
4
|
+
// files, plus the Driggsby SDK at /-/driggsby-sdk.js and the dashboard font
|
|
5
|
+
// at /-/inter.woff2). Both bind loopback only. The app token never appears
|
|
6
|
+
// here — the broker callback holds it in the CLI process.
|
|
7
7
|
import { createServer } from "node:http";
|
|
8
8
|
import { appResponseHeaders, INERT_SERVICE_WORKER } from "./app-policy.js";
|
|
9
|
+
import { DASHBOARD_FONT_PATH, DASHBOARD_FONT_TYPE } from "./dashboard-font.js";
|
|
9
10
|
import { DEV_IDENTITY_PATH } from "./dev-state.js";
|
|
10
11
|
import { hostPageHtml, HOST_PAGE_JS } from "./host-page.js";
|
|
11
12
|
import { serveStaticFile } from "./static-files.js";
|
|
@@ -71,7 +72,7 @@ export async function startDevServers(options) {
|
|
|
71
72
|
};
|
|
72
73
|
}
|
|
73
74
|
// ---------------------------------------------------------------------------
|
|
74
|
-
// The app origin: the SDK
|
|
75
|
+
// The app origin: the SDK and font paths, then the project's own files.
|
|
75
76
|
// ---------------------------------------------------------------------------
|
|
76
77
|
async function handleAppRequest(options, appPort, hostOrigin, request, response) {
|
|
77
78
|
// Every response carries the deployed app's headers (app-policy.ts). Their
|
|
@@ -100,6 +101,15 @@ async function handleAppRequest(options, appPort, hostOrigin, request, response)
|
|
|
100
101
|
sendText(response, 200, JAVASCRIPT, options.sdkBundle, appResponseHeaders(hostOrigin, JAVASCRIPT));
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
104
|
+
if (path === DASHBOARD_FONT_PATH) {
|
|
105
|
+
response.writeHead(200, {
|
|
106
|
+
"Content-Type": DASHBOARD_FONT_TYPE,
|
|
107
|
+
"Cache-Control": "no-store",
|
|
108
|
+
...appResponseHeaders(hostOrigin, DASHBOARD_FONT_TYPE),
|
|
109
|
+
});
|
|
110
|
+
response.end(options.dashboardFont);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
103
113
|
const file = await serveStaticFile(options.serveDirectory, path);
|
|
104
114
|
if (file === null) {
|
|
105
115
|
sendText(response, 404, PLAIN_TEXT, "Not found.", plainTextHeaders);
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
// console's stylesheet, so each gray is written as the console paints it
|
|
6
6
|
// on its black page (the console's cards and fills are translucent over
|
|
7
7
|
// that ground) and each hue verbatim. The :root block is the same one
|
|
8
|
-
// Driggsby's own example dashboard carries
|
|
9
|
-
//
|
|
10
|
-
//
|
|
8
|
+
// Driggsby's own example dashboard carries, --font-sans leading with
|
|
9
|
+
// Inter, the face Driggsby serves every app (dev/dashboard-font.ts).
|
|
10
|
+
// --bg-app must stay equal to driggsby.json's "background"
|
|
11
|
+
// (init-command.test.ts pins the two together): Driggsby paints that color
|
|
12
|
+
// while the app loads.
|
|
11
13
|
export const STYLES_CSS = `/* Driggsby's console palette, so this page reads as part of the app it
|
|
12
|
-
opens inside. Change these together if you re-theme
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
opens inside. Change these together if you re-theme (all but
|
|
15
|
+
--font-sans, which stays as it is); keep --bg-app equal to the
|
|
16
|
+
"background" in driggsby.json. The status tones are the console's own,
|
|
17
|
+
for gains, losses, warnings, and a live dot. */
|
|
15
18
|
:root {
|
|
16
19
|
color-scheme: dark;
|
|
17
20
|
--bg-app: #000000;
|
|
@@ -28,10 +31,30 @@ export const STYLES_CSS = `/* Driggsby's console palette, so this page reads as
|
|
|
28
31
|
--text-error: oklch(0.8 0.13 25);
|
|
29
32
|
--radius-card: 8px;
|
|
30
33
|
--radius-bar: 4px;
|
|
31
|
-
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
|
34
|
+
--font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
|
32
35
|
--ease: cubic-bezier(0.2, 0, 0, 1);
|
|
33
36
|
}
|
|
34
37
|
|
|
38
|
+
/* Inter, which Driggsby serves at /-/inter.woff2 on this app's own origin
|
|
39
|
+
(driggsby dev serves the same file there), so nothing loads from another
|
|
40
|
+
site. Inter is the only font a dashboard uses: set all text with
|
|
41
|
+
var(--font-sans), keep that stack as it is (the faces after Inter only
|
|
42
|
+
stand in if the font is slow or fails to load, or lacks a character),
|
|
43
|
+
and name no other font anywhere else. A <canvas> or a chart library's
|
|
44
|
+
font setting can't read var(): name "Inter" there, followed only by
|
|
45
|
+
sans-serif, and draw a canvas after document.fonts.ready. The
|
|
46
|
+
Dashboards page shows a picture of this page, taken on a server with
|
|
47
|
+
none of your fonts, and any other face looks different there than on
|
|
48
|
+
the live page. Text waits for the font (font-display: block,
|
|
49
|
+
preloaded) rather than flash another face first. */
|
|
50
|
+
@font-face {
|
|
51
|
+
font-family: "Inter";
|
|
52
|
+
src: url("/-/inter.woff2") format("woff2");
|
|
53
|
+
font-weight: 100 900;
|
|
54
|
+
font-style: normal;
|
|
55
|
+
font-display: block;
|
|
56
|
+
}
|
|
57
|
+
|
|
35
58
|
* {
|
|
36
59
|
box-sizing: border-box;
|
|
37
60
|
}
|
|
@@ -46,6 +69,15 @@ body {
|
|
|
46
69
|
-webkit-font-smoothing: antialiased;
|
|
47
70
|
}
|
|
48
71
|
|
|
72
|
+
/* Browsers set form controls in the system font on their own, whatever
|
|
73
|
+
the body's; these take the page's Inter instead. */
|
|
74
|
+
button,
|
|
75
|
+
input,
|
|
76
|
+
select,
|
|
77
|
+
textarea {
|
|
78
|
+
font: inherit;
|
|
79
|
+
}
|
|
80
|
+
|
|
49
81
|
/* A compact column: a few figures and a short list read best close
|
|
50
82
|
together. The console's own pages run wider (75rem); widen this as the
|
|
51
83
|
page grows. */
|
|
@@ -95,6 +127,10 @@ h2 {
|
|
|
95
127
|
}
|
|
96
128
|
|
|
97
129
|
.stat {
|
|
130
|
+
/* The figure inside sizes itself to this card (see .stat-value), so
|
|
131
|
+
the card takes its width from the grid, never from its content: in a
|
|
132
|
+
content-sized track it would collapse. */
|
|
133
|
+
container-type: inline-size;
|
|
98
134
|
display: flex;
|
|
99
135
|
flex-direction: column;
|
|
100
136
|
padding: 14px 16px;
|
|
@@ -110,15 +146,34 @@ h2 {
|
|
|
110
146
|
|
|
111
147
|
.stat-value {
|
|
112
148
|
margin-top: 2px;
|
|
149
|
+
/* 20px, and 20px wherever container units aren't known; the @supports
|
|
150
|
+
rule below shrinks a figure too long for its card. The line stays
|
|
151
|
+
30px whatever size the figure draws at, so it measures the same as
|
|
152
|
+
the skeleton bar it replaces. */
|
|
113
153
|
font-size: 20px;
|
|
154
|
+
line-height: 30px;
|
|
114
155
|
font-weight: 600;
|
|
115
156
|
letter-spacing: -0.01em;
|
|
116
157
|
font-variant-numeric: tabular-nums;
|
|
117
|
-
/*
|
|
118
|
-
|
|
158
|
+
/* Past the 12px floor a figure wraps rather than spill out of its
|
|
159
|
+
card: a clipped balance is a wrong number. */
|
|
119
160
|
overflow-wrap: anywhere;
|
|
120
161
|
}
|
|
121
162
|
|
|
163
|
+
/* A figure keeps 20px unless it is too long for its card, and then
|
|
164
|
+
shrinks just enough to stay one number: its length (--chars, which
|
|
165
|
+
renderOverview sets) at 0.6em a character, the widest these figures
|
|
166
|
+
run with a little room, fills at most the card (100cqi). A short
|
|
167
|
+
balance never shrinks; $99,999,999.99 in a desktop card draws near
|
|
168
|
+
17px. Inside @supports, so a browser without container units keeps
|
|
169
|
+
20px: outside it, the var() would let the line override 20px and
|
|
170
|
+
then fail. */
|
|
171
|
+
@supports (width: 1cqi) {
|
|
172
|
+
.stat-value {
|
|
173
|
+
font-size: clamp(12px, calc(100cqi / (var(--chars, 1) * 0.6)), 20px);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
122
177
|
#accounts {
|
|
123
178
|
border: 1px solid var(--hairline);
|
|
124
179
|
border-radius: var(--radius-card);
|
|
@@ -143,6 +198,28 @@ h2 {
|
|
|
143
198
|
color: var(--text-secondary);
|
|
144
199
|
}
|
|
145
200
|
|
|
201
|
+
/* A section whose call failed says why in its own place (see "When a call
|
|
202
|
+
fails" in app.js): in the list, in a row's inset under any rows it
|
|
203
|
+
keeps; across the stat row, as a card of its own. A long reason (one
|
|
204
|
+
can quote your SQL) wraps inside it. */
|
|
205
|
+
.problem {
|
|
206
|
+
padding: 14px 16px;
|
|
207
|
+
color: var(--text-warning);
|
|
208
|
+
overflow-wrap: anywhere;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.stat-grid > .problem {
|
|
212
|
+
grid-column: 1 / -1;
|
|
213
|
+
border: 1px solid var(--hairline);
|
|
214
|
+
border-radius: var(--radius-card);
|
|
215
|
+
background: var(--bg-card);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.account-row + .problem,
|
|
219
|
+
.empty-row + .problem {
|
|
220
|
+
border-top: 1px solid var(--hairline);
|
|
221
|
+
}
|
|
222
|
+
|
|
146
223
|
/* The institution's initial on a round pill, as the console draws it. */
|
|
147
224
|
.account-glyph {
|
|
148
225
|
flex: none;
|
package/dist/init/templates.js
CHANGED
|
@@ -15,6 +15,7 @@ export function indexHtml(slug) {
|
|
|
15
15
|
<meta charset="utf-8">
|
|
16
16
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
17
17
|
<title>${slug}</title>
|
|
18
|
+
<link rel="preload" href="/-/inter.woff2" as="font" type="font/woff2" crossorigin>
|
|
18
19
|
<link rel="stylesheet" href="styles.css">
|
|
19
20
|
</head>
|
|
20
21
|
<body>
|
|
@@ -87,11 +88,13 @@ export const APP_JS = `// Your app's code. Edit anything — driggsby dev reload
|
|
|
87
88
|
//
|
|
88
89
|
// Reading data is one call:
|
|
89
90
|
//
|
|
90
|
-
// driggsby.watch(tool, params, callback)
|
|
91
|
+
// driggsby.watch(tool, params, callback, { onError })
|
|
91
92
|
//
|
|
92
93
|
// Each watch is a live subscription: the callback runs with a fresh result
|
|
93
|
-
// whenever your Driggsby data changes
|
|
94
|
-
//
|
|
94
|
+
// whenever your Driggsby data changes, and onError runs instead when a call
|
|
95
|
+
// fails (see "When a call fails" below; watchSection wires one section
|
|
96
|
+
// that way, so add yours with it). The sample data below matches the real
|
|
97
|
+
// result shapes, so the render functions work unchanged either way.
|
|
95
98
|
//
|
|
96
99
|
// These are the tools an app can watch — read-only, nothing else responds:
|
|
97
100
|
//
|
|
@@ -203,10 +206,11 @@ function renderOverview(result) {
|
|
|
203
206
|
];
|
|
204
207
|
for (const [label, value] of stats) {
|
|
205
208
|
const stat = element("div", "stat");
|
|
206
|
-
stat
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
);
|
|
209
|
+
const figure = element("div", "stat-value", formatMoney(value));
|
|
210
|
+
// Its length, so a long figure can shrink to fit its card while a
|
|
211
|
+
// short one keeps its full size (see .stat-value in styles.css).
|
|
212
|
+
figure.style.setProperty("--chars", String(figure.textContent.length));
|
|
213
|
+
stat.append(element("div", "stat-label", label), figure);
|
|
210
214
|
container.append(stat);
|
|
211
215
|
}
|
|
212
216
|
// aria-busy ships in the HTML so assistive tech hears "loading" until
|
|
@@ -347,6 +351,60 @@ function settledRenderer(render) {
|
|
|
347
351
|
};
|
|
348
352
|
}
|
|
349
353
|
|
|
354
|
+
// ---------------------------------------------------------------------------
|
|
355
|
+
// When a call fails. A watch whose call fails never runs its callback; it
|
|
356
|
+
// runs onError instead, with { message, kind }, once for each new failure —
|
|
357
|
+
// after Driggsby has already retried a call that failed because it was busy
|
|
358
|
+
// or slow. The section says why where its data would be: in place of its
|
|
359
|
+
// skeleton, so a failure never looks like a page still loading, or under
|
|
360
|
+
// the data it already shows, which stays. The watch asks again on its own
|
|
361
|
+
// the next time your data changes, and the next good result repaints the
|
|
362
|
+
// section, reason and all. A section counts as still loading while its
|
|
363
|
+
// container is aria-busy="true": the HTML ships every container that way,
|
|
364
|
+
// and every render clears it and replaces everything in its container,
|
|
365
|
+
// so keep all three true for a section you add.
|
|
366
|
+
// ---------------------------------------------------------------------------
|
|
367
|
+
|
|
368
|
+
function showProblem(containerId, error) {
|
|
369
|
+
const container = document.getElementById(containerId);
|
|
370
|
+
const message =
|
|
371
|
+
error && typeof error.message === "string" && error.message
|
|
372
|
+
? error.message
|
|
373
|
+
: "This didn't load. It tries again when your data next changes.";
|
|
374
|
+
const note = element("div", "problem", message);
|
|
375
|
+
note.setAttribute("role", "status");
|
|
376
|
+
if (container.getAttribute("aria-busy") === "true") {
|
|
377
|
+
container.replaceChildren(note);
|
|
378
|
+
container.removeAttribute("aria-busy");
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const earlier = container.querySelector(".problem");
|
|
382
|
+
if (earlier) earlier.remove();
|
|
383
|
+
container.append(note);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// One section's live data: its watch, its render, and its failures. A
|
|
387
|
+
// failure that lands while the section's first result waits for its
|
|
388
|
+
// dissolve still shows once that result paints, under it. It returns the
|
|
389
|
+
// watch's stop function: call it before watching the same section again
|
|
390
|
+
// with new params.
|
|
391
|
+
function watchSection(tool, params, containerId, render) {
|
|
392
|
+
let problem = null;
|
|
393
|
+
const paint = settledRenderer((result) => {
|
|
394
|
+
render(result);
|
|
395
|
+
if (problem) showProblem(containerId, problem);
|
|
396
|
+
});
|
|
397
|
+
return driggsby.watch(tool, params, (result) => {
|
|
398
|
+
problem = null;
|
|
399
|
+
paint(result);
|
|
400
|
+
}, {
|
|
401
|
+
onError: (error) => {
|
|
402
|
+
problem = error;
|
|
403
|
+
showProblem(containerId, error);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
350
408
|
// ---------------------------------------------------------------------------
|
|
351
409
|
// Live data. window.driggsby exists when the Driggsby SDK loaded — inside
|
|
352
410
|
// Driggsby, or under driggsby dev. Whether anything embeds this page is
|
|
@@ -366,8 +424,8 @@ if (standalone) {
|
|
|
366
424
|
}
|
|
367
425
|
|
|
368
426
|
if (window.driggsby) {
|
|
369
|
-
|
|
370
|
-
|
|
427
|
+
watchSection("get_overview", {}, "overview", renderOverview);
|
|
428
|
+
watchSection("list_accounts", {}, "accounts", renderAccounts);
|
|
371
429
|
}
|
|
372
430
|
`;
|
|
373
431
|
// "background" is the template's own page background (styles.css
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "driggsby",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Set up and build on Driggsby, the MCP server for personal finance.",
|
|
5
|
-
"license": "Apache-2.0",
|
|
5
|
+
"license": "Apache-2.0 AND OFL-1.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/driggsby/driggsby.git"
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"driggsby": "bin/driggsby.js"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
+
"assets/Inter.woff2",
|
|
17
|
+
"assets/Inter-LICENSE.txt",
|
|
16
18
|
"bin",
|
|
17
19
|
"dist",
|
|
18
20
|
"LICENSE",
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
"node": ">=18"
|
|
29
31
|
},
|
|
30
32
|
"dependencies": {
|
|
31
|
-
"@driggsby/deploy": "0.7.
|
|
32
|
-
"@driggsby/sdk": "0.7.
|
|
33
|
+
"@driggsby/deploy": "0.7.3",
|
|
34
|
+
"@driggsby/sdk": "0.7.3"
|
|
33
35
|
}
|
|
34
36
|
}
|