pulpweaver4-cli 0.0.88 → 0.0.185
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/dist/add.d.ts +15 -0
- package/dist/add.js +103 -0
- package/dist/add.js.map +1 -0
- package/dist/app/app.css +154 -0
- package/dist/app/app.js +3003 -0
- package/dist/bridge.d.ts +15 -3
- package/dist/bridge.js +29 -20
- package/dist/bridge.js.map +1 -1
- package/dist/chromium.d.ts +43 -0
- package/dist/chromium.js +90 -35
- package/dist/chromium.js.map +1 -1
- package/dist/commands.d.ts +54 -0
- package/dist/commands.js +33 -0
- package/dist/commands.js.map +1 -1
- package/dist/convert.d.ts +10 -0
- package/dist/convert.js +70 -0
- package/dist/convert.js.map +1 -0
- package/dist/dev.d.ts +82 -0
- package/dist/dev.js +366 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/paint-corpus.js +11 -14
- package/dist/paint-corpus.js.map +1 -1
- package/dist/plugins.d.ts +21 -0
- package/dist/plugins.js +79 -9
- package/dist/plugins.js.map +1 -1
- package/dist/spike.js +13 -8
- package/dist/spike.js.map +1 -1
- package/dist/test.d.ts +0 -4
- package/dist/test.js +39 -9
- package/dist/test.js.map +1 -1
- package/docs/reference/commands/add.md +28 -0
- package/docs/reference/commands/convert.md +29 -0
- package/docs/reference/commands/dev.md +41 -0
- package/docs/reference/commands/index.md +3 -0
- package/package.json +2 -2
package/dist/add.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Puts `name` in the project at `dir`. Tests pass their own installer. */
|
|
2
|
+
export type PluginInstaller = (name: string, dir: string) => Promise<void>;
|
|
3
|
+
/** `npm install --save <name>` in `dir`, which makes a `package.json` if the project has none. */
|
|
4
|
+
export declare function npmInstall(name: string, dir: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* Installs `name` in the project at `dir` and adds `name = {}` to `[plugins]`
|
|
7
|
+
* when it is not already there. Returns whether the table gained a row.
|
|
8
|
+
*/
|
|
9
|
+
export declare function addPlugin(dir: string, name: string, install?: PluginInstaller): Promise<'added' | 'present'>;
|
|
10
|
+
export declare function addCommand(args: readonly string[], out: (line: string) => void, options?: {
|
|
11
|
+
dir?: string;
|
|
12
|
+
install?: PluginInstaller;
|
|
13
|
+
}): Promise<number>;
|
|
14
|
+
/** `name = {}` just under `[plugins]`, or a new `[plugins]` table, or a dotted key when the table is only implicit. */
|
|
15
|
+
export declare function insertPlugin(text: string, name: string): string;
|
package/dist/add.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pw add <plugin>` (https://plans.inkylabs.com/pulpweaver#commands):
|
|
3
|
+
* install an npm plugin in the project and add it to `[plugins]` in
|
|
4
|
+
* `pulpweaver4.toml`. A plugin already named there is left as it is, and
|
|
5
|
+
* installed again. The installer is `npm install` unless a test supplies one.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
8
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { TomlDocument } from 'pulpweaver4';
|
|
11
|
+
import { NPM_PACKAGE_NAME } from './plugins.js';
|
|
12
|
+
/** `npm install --save <name>` in `dir`, which makes a `package.json` if the project has none. */
|
|
13
|
+
export function npmInstall(name, dir) {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const child = spawn('npm', ['install', '--save', name], { cwd: dir, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
16
|
+
let err = '';
|
|
17
|
+
child.stderr.on('data', (chunk) => { err += chunk.toString(); });
|
|
18
|
+
child.on('error', reject);
|
|
19
|
+
child.on('close', (code) => (code === 0 ? resolve() : reject(new Error(err.trim() || `npm install ${name} exited ${code}`))));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Installs `name` in the project at `dir` and adds `name = {}` to `[plugins]`
|
|
24
|
+
* when it is not already there. Returns whether the table gained a row.
|
|
25
|
+
*/
|
|
26
|
+
export async function addPlugin(dir, name, install = npmInstall) {
|
|
27
|
+
if (!NPM_PACKAGE_NAME.test(name))
|
|
28
|
+
throw new Error(`${JSON.stringify(name)} isn't an npm package's name`);
|
|
29
|
+
const file = join(dir, 'pulpweaver4.toml');
|
|
30
|
+
const text = await readFile(file, 'utf8').catch((e) => {
|
|
31
|
+
if (e.code === 'ENOENT')
|
|
32
|
+
throw new Error(`${dir} has no pulpweaver4.toml`);
|
|
33
|
+
throw e;
|
|
34
|
+
});
|
|
35
|
+
const doc = TomlDocument.parse(text, 'pulpweaver4.toml');
|
|
36
|
+
if (doc.problems.length)
|
|
37
|
+
throw new Error(doc.problems[0].message);
|
|
38
|
+
const plugins = doc.value?.['plugins'];
|
|
39
|
+
if (plugins !== undefined && !isTable(plugins))
|
|
40
|
+
throw new Error('plugins is not a table');
|
|
41
|
+
const present = plugins !== undefined && Object.hasOwn(plugins, name);
|
|
42
|
+
await install(name, dir);
|
|
43
|
+
if (present)
|
|
44
|
+
return 'present';
|
|
45
|
+
await writeFile(file, insertPlugin(text, name));
|
|
46
|
+
return 'added';
|
|
47
|
+
}
|
|
48
|
+
export async function addCommand(args, out, options = {}) {
|
|
49
|
+
let name;
|
|
50
|
+
for (const a of args) {
|
|
51
|
+
if (a.startsWith('-'))
|
|
52
|
+
return usage(out, `unknown option ${a}`);
|
|
53
|
+
if (name === undefined)
|
|
54
|
+
name = a;
|
|
55
|
+
else
|
|
56
|
+
return usage(out, `one plugin, not ${name} and ${a}`);
|
|
57
|
+
}
|
|
58
|
+
if (name === undefined)
|
|
59
|
+
return usage(out, 'name the plugin to install: pw add <plugin>');
|
|
60
|
+
const dir = options.dir ?? process.cwd();
|
|
61
|
+
try {
|
|
62
|
+
const result = await addPlugin(dir, name, options.install);
|
|
63
|
+
out(result === 'added'
|
|
64
|
+
? `pw add: installed ${name} and added it to pulpweaver4.toml`
|
|
65
|
+
: `pw add: ${name} is already in pulpweaver4.toml; installed it`);
|
|
66
|
+
return 0;
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
out(`pw add: ${e instanceof Error ? e.message : String(e)}`);
|
|
70
|
+
return 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** A TOML key for `name`: bare when it can be, quoted for a scope. */
|
|
74
|
+
function tomlKey(name) {
|
|
75
|
+
return /^[A-Za-z0-9_-]+$/.test(name) ? name : JSON.stringify(name);
|
|
76
|
+
}
|
|
77
|
+
function isTable(value) {
|
|
78
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
79
|
+
}
|
|
80
|
+
/** `name = {}` just under `[plugins]`, or a new `[plugins]` table, or a dotted key when the table is only implicit. */
|
|
81
|
+
export function insertPlugin(text, name) {
|
|
82
|
+
const key = tomlKey(name);
|
|
83
|
+
const row = `${key} = {}`;
|
|
84
|
+
const lines = text.split('\n');
|
|
85
|
+
const header = lines.findIndex((line) => line.trim() === '[plugins]');
|
|
86
|
+
if (header >= 0) {
|
|
87
|
+
lines.splice(header + 1, 0, row);
|
|
88
|
+
return lines.join('\n');
|
|
89
|
+
}
|
|
90
|
+
const doc = TomlDocument.parse(text, 'pulpweaver4.toml');
|
|
91
|
+
const plugins = doc.value?.['plugins'];
|
|
92
|
+
if (isTable(plugins)) {
|
|
93
|
+
const suffix = text.endsWith('\n') ? '' : '\n';
|
|
94
|
+
return `${text}${suffix}plugins.${row}\n`;
|
|
95
|
+
}
|
|
96
|
+
const suffix = text.length === 0 || text.endsWith('\n') ? '' : '\n';
|
|
97
|
+
return `${text}${suffix}\n[plugins]\n${row}\n`;
|
|
98
|
+
}
|
|
99
|
+
function usage(out, message) {
|
|
100
|
+
out(`pw add: ${message}`);
|
|
101
|
+
return 2;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=add.js.map
|
package/dist/add.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
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AAM,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;IACnE,OAAO,GAAG,IAAI,GAAG,MAAM,gBAAgB,GAAG,IAAI,CAAA;AAChD,CAAC;AAED,SAAS,KAAK,CAAC,GAA2B,EAAE,OAAe;IACzD,GAAG,CAAC,WAAW,OAAO,EAAE,CAAC,CAAA;IACzB,OAAO,CAAC,CAAA;AACV,CAAC"}
|
package/dist/app/app.css
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/* The browser app, after the plan's mockup (plans/pulpweaver/mockups/preview.html): a bar of
|
|
2
|
+
editions and downloads, the source beside the pages, the problems below. The pages are the
|
|
3
|
+
build's own .pw-page elements, styled by the edition.
|
|
4
|
+
|
|
5
|
+
The book's stylesheet is the document's, as in a pw build, so the app keeps out of its way and
|
|
6
|
+
it out of the app's: the app's classes and variables are pwa-, it sets its own font on its own
|
|
7
|
+
panes rather than inheriting one, and the stage starts from the initial values, so the pages
|
|
8
|
+
inherit nothing from the app and lay out as they do in pw build's page. */
|
|
9
|
+
:root {
|
|
10
|
+
color-scheme: light dark;
|
|
11
|
+
--pwa-bg: #f6f3ec;
|
|
12
|
+
--pwa-panel: #fffdf8;
|
|
13
|
+
--pwa-ink: #1d1a16;
|
|
14
|
+
--pwa-muted: #6b645a;
|
|
15
|
+
--pwa-rule: #d8d0c3;
|
|
16
|
+
--pwa-accent: #6a4c93;
|
|
17
|
+
--pwa-error: #a3261f;
|
|
18
|
+
--pwa-warn: #9a6a00;
|
|
19
|
+
--pwa-ok: #2d6a4f;
|
|
20
|
+
--pwa-sheet: #fff;
|
|
21
|
+
background: var(--pwa-bg);
|
|
22
|
+
}
|
|
23
|
+
@media (prefers-color-scheme: dark) {
|
|
24
|
+
:root {
|
|
25
|
+
--pwa-bg: #1c1b19;
|
|
26
|
+
--pwa-panel: #24231f;
|
|
27
|
+
--pwa-ink: #f1ede5;
|
|
28
|
+
--pwa-muted: #a59d90;
|
|
29
|
+
--pwa-rule: #3a3834;
|
|
30
|
+
--pwa-accent: #b9a0e0;
|
|
31
|
+
--pwa-error: #ff8a80;
|
|
32
|
+
--pwa-warn: #e7c36a;
|
|
33
|
+
--pwa-ok: #7fd1a6;
|
|
34
|
+
--pwa-sheet: #f4f1ea;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
body { margin: 0; background: var(--pwa-bg); }
|
|
38
|
+
.pw-app { height: 100vh; display: grid; grid-template-rows: auto minmax(0, 1fr) minmax(120px, 30vh); }
|
|
39
|
+
.pwa-bar, .pwa-editor, .pwa-thumbs, .pwa-note, .pwa-problems {
|
|
40
|
+
font: 14px/1.45 system-ui, sans-serif; color: var(--pwa-ink); text-align: start; text-indent: 0; letter-spacing: normal;
|
|
41
|
+
}
|
|
42
|
+
:is(.pwa-bar, .pwa-file-bar, .pwa-problems) :is(button, select), .pwa-open-zip {
|
|
43
|
+
font: inherit; color: inherit; background: var(--pwa-panel);
|
|
44
|
+
border: 1px solid var(--pwa-rule); border-radius: 6px; padding: 3px 9px; cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
.pw-app button:disabled { opacity: 0.55; cursor: default; }
|
|
47
|
+
.pw-app :is(button, select):focus-visible, .pwa-open-zip:focus-within { outline: 2px solid var(--pwa-accent); outline-offset: 1px; }
|
|
48
|
+
|
|
49
|
+
.pwa-bar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--pwa-rule); background: var(--pwa-panel); }
|
|
50
|
+
.pwa-title { margin: 0 6px 0 0; font-weight: 650; }
|
|
51
|
+
.pwa-open-zip { position: relative; overflow: hidden; }
|
|
52
|
+
.pwa-open-zip input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
|
|
53
|
+
.pwa-editions { display: inline-flex; }
|
|
54
|
+
.pwa-editions button { border-radius: 0; margin-left: -1px; }
|
|
55
|
+
.pwa-editions button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
|
|
56
|
+
.pwa-editions button:last-child { border-radius: 0 6px 6px 0; }
|
|
57
|
+
.pwa-editions button[aria-pressed="true"] { background: var(--pwa-accent); border-color: var(--pwa-accent); color: var(--pwa-panel); }
|
|
58
|
+
.pwa-toggle { display: inline-flex; gap: 4px; align-items: center; }
|
|
59
|
+
.pwa-status { margin: 0; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--pwa-rule); color: var(--pwa-muted); }
|
|
60
|
+
.pwa-status[data-state="ready"] { color: var(--pwa-ok); border-color: currentColor; }
|
|
61
|
+
.pwa-status[data-state="ready"]::before { content: "✓ "; }
|
|
62
|
+
.pwa-status[data-state="rebuilding"] { color: var(--pwa-warn); border-color: currentColor; }
|
|
63
|
+
.pwa-status[data-state="error"] { color: var(--pwa-error); border-color: currentColor; }
|
|
64
|
+
.pwa-status[data-pages="approximate"]::after { content: " · approximate"; opacity: 0.7; }
|
|
65
|
+
.pwa-download-current { margin-left: auto; }
|
|
66
|
+
.pwa-downloads { position: relative; }
|
|
67
|
+
.pwa-downloads summary { cursor: pointer; padding: 3px 9px; border: 1px solid var(--pwa-rule); border-radius: 6px; list-style: none; }
|
|
68
|
+
.pwa-downloads summary::-webkit-details-marker { display: none; }
|
|
69
|
+
.pwa-download-menu {
|
|
70
|
+
position: absolute; right: 0; top: calc(100% + 4px); z-index: 10; display: flex; flex-direction: column; gap: 4px;
|
|
71
|
+
padding: 6px; background: var(--pwa-panel); border: 1px solid var(--pwa-rule); border-radius: 6px; box-shadow: 0 4px 12px rgb(0 0 0 / 18%);
|
|
72
|
+
}
|
|
73
|
+
.pwa-download-menu button { text-align: start; white-space: nowrap; }
|
|
74
|
+
.pwa-editions button { white-space: nowrap; }
|
|
75
|
+
|
|
76
|
+
.pwa-work { display: grid; grid-template-columns: minmax(288px, 2fr) minmax(320px, 3fr); min-height: 0; }
|
|
77
|
+
@media (max-width: 800px) {
|
|
78
|
+
.pw-app { height: auto; grid-template-rows: auto auto auto; }
|
|
79
|
+
.pwa-work { grid-template-columns: 1fr; }
|
|
80
|
+
.pwa-editor { min-height: 288px; }
|
|
81
|
+
.pwa-viewer { min-height: 384px; }
|
|
82
|
+
}
|
|
83
|
+
.pwa-editor { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--pwa-rule); }
|
|
84
|
+
.pwa-file-bar { display: flex; gap: 8px; align-items: center; padding: 6px 8px; }
|
|
85
|
+
.pwa-files { max-width: 100%; min-width: 0; }
|
|
86
|
+
.pwa-saved { color: var(--pwa-muted); }
|
|
87
|
+
/* The source (editor.ts, CodeMirror): line numbers, and each problem underlined, its line tinted, its message on hover. */
|
|
88
|
+
.pwa-source { flex: 1; min-height: 0; display: flex; border-top: 1px solid var(--pwa-rule); background: var(--pwa-panel); }
|
|
89
|
+
.pwa-source .cm-editor { flex: 1; min-width: 0; height: 100%; color: inherit; background: var(--pwa-panel); }
|
|
90
|
+
.pwa-source .cm-editor.cm-focused { outline: 2px solid var(--pwa-accent); outline-offset: -2px; }
|
|
91
|
+
.pwa-source .cm-scroller { font: 13px/1.5 ui-monospace, "SFMono-Regular", Menlo, monospace; }
|
|
92
|
+
.pwa-source .cm-content { padding: 8px 0; caret-color: var(--pwa-ink); }
|
|
93
|
+
.pwa-source .cm-line { padding: 0 12px 0 8px; }
|
|
94
|
+
.pwa-source .cm-gutters { background: var(--pwa-panel); color: var(--pwa-muted); border-right: 1px solid var(--pwa-rule); }
|
|
95
|
+
.pwa-source .cm-lineNumbers .cm-gutterElement { min-width: 3ch; padding: 0 8px 0 10px; }
|
|
96
|
+
.pwa-source .cm-activeLine, .pwa-source .cm-activeLineGutter { background: color-mix(in srgb, var(--pwa-accent) 7%, transparent); }
|
|
97
|
+
.pwa-source .cm-activeLineGutter { color: var(--pwa-ink); }
|
|
98
|
+
.pwa-source .cm-selectionBackground, .pwa-source .cm-content ::selection { background: color-mix(in srgb, var(--pwa-accent) 28%, transparent) !important; }
|
|
99
|
+
.pwa-source .cm-line.pwa-line-error { background: color-mix(in srgb, var(--pwa-error) 10%, transparent); }
|
|
100
|
+
.pwa-source .cm-line.pwa-line-warning { background: color-mix(in srgb, var(--pwa-warn) 10%, transparent); }
|
|
101
|
+
.pwa-source .cm-lintRange { background-image: none; text-decoration: underline wavy; text-decoration-skip-ink: none; text-underline-offset: 3px; }
|
|
102
|
+
.pwa-source .cm-lintRange-error { text-decoration-color: var(--pwa-error); }
|
|
103
|
+
.pwa-source .cm-lintRange-warning { text-decoration-color: var(--pwa-warn); }
|
|
104
|
+
.pwa-source .cm-lintRange-info, .pwa-source .cm-lintRange-hint { text-decoration-color: var(--pwa-muted); }
|
|
105
|
+
.pwa-source .cm-tooltip { font: 13px/1.4 system-ui, sans-serif; color: var(--pwa-ink); background: var(--pwa-panel); border: 1px solid var(--pwa-rule); border-radius: 6px; box-shadow: 0 4px 12px rgb(0 0 0 / 18%); }
|
|
106
|
+
.pwa-source .cm-diagnostic { max-width: 40em; }
|
|
107
|
+
.pwa-source .cm-diagnostic-error { border-left-color: var(--pwa-error); }
|
|
108
|
+
.pwa-source .cm-diagnostic-warning { border-left-color: var(--pwa-warn); }
|
|
109
|
+
.pwa-source .cm-diagnosticSource { color: var(--pwa-muted); opacity: 1; }
|
|
110
|
+
|
|
111
|
+
.pwa-viewer { display: grid; grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
|
|
112
|
+
.pwa-thumbs { grid-row: 1 / 3; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 10px; border-right: 1px solid var(--pwa-rule); }
|
|
113
|
+
.pwa-thumb { padding: 0; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--pwa-muted); font-size: 11px; }
|
|
114
|
+
.pwa-thumb .pwa-sheet { position: relative; display: block; width: 60px; aspect-ratio: 2 / 3; background: var(--pwa-sheet); box-shadow: 0 1px 3px rgb(0 0 0 / 30%); outline: 1px solid transparent; }
|
|
115
|
+
.pwa-thumb.pwa-on .pwa-sheet { outline: 2px solid var(--pwa-accent); }
|
|
116
|
+
.pwa-thumb .pwa-sheet i { position: absolute; height: 1px; background: rgb(90 85 78 / 55%); }
|
|
117
|
+
.pwa-thumb .pwa-sheet i.pwa-warn { background: var(--pwa-warn); height: 2px; }
|
|
118
|
+
.pwa-note { margin: 8px 12px 0; color: var(--pwa-muted); }
|
|
119
|
+
.pwa-note:empty { display: none; }
|
|
120
|
+
.pwa-stage { all: initial; display: block; overflow: auto; padding: 16px; color-scheme: light; min-height: 0; }
|
|
121
|
+
/* The build's container is left as pw build has it, a block: the pages are centred by their margins. */
|
|
122
|
+
:where(.pwa-stage .pw-page) { margin: 0 auto 18px; }
|
|
123
|
+
.pwa-stage .pw-page { box-shadow: 0 1px 5px rgb(0 0 0 / 28%); contain: layout paint; }
|
|
124
|
+
/* White paper under a page the book gives no background, which any rule of the book's overrides. */
|
|
125
|
+
:where(.pwa-stage .pw-page) { background-color: #fff; }
|
|
126
|
+
.pwa-stage.pwa-show-badness .pw-line.pwa-loose { background: rgb(230 160 30 / 22%); }
|
|
127
|
+
.pwa-thumbs.pwa-show-badness .pwa-folio::after { content: " · " attr(data-badness); }
|
|
128
|
+
.pwa-stage.pwa-show-badness .pw-line.pwa-flagged { background: rgb(230 120 30 / 38%); position: relative; }
|
|
129
|
+
.pwa-stage.pwa-show-badness .pw-line.pwa-flagged::after {
|
|
130
|
+
content: attr(data-pw-badness); position: absolute; left: 100%; margin-left: 6px; padding: 0 4px;
|
|
131
|
+
font: 600 9px/1.6 system-ui, sans-serif; color: #fff; background: #b06000; border-radius: 3px; white-space: nowrap;
|
|
132
|
+
}
|
|
133
|
+
.pwa-stage.pwa-show-badness .pw-line.pwa-overfull { background: rgb(200 0 30 / 30%); }
|
|
134
|
+
.pwa-stage.pwa-show-badness .pw-line.pwa-overfull::after { content: "overfull"; background: #b00020; }
|
|
135
|
+
|
|
136
|
+
.pwa-problems { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--pwa-rule); background: var(--pwa-panel); }
|
|
137
|
+
.pwa-problems > header { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--pwa-rule); color: var(--pwa-muted); }
|
|
138
|
+
.pwa-problems > header b { color: var(--pwa-ink); }
|
|
139
|
+
.pwa-run-tests { margin-left: auto; }
|
|
140
|
+
.pwa-problem-list, .pwa-test-list { overflow-y: auto; }
|
|
141
|
+
.pwa-problems { overflow-y: auto; }
|
|
142
|
+
.pwa-problem, .pwa-test { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--pwa-rule); }
|
|
143
|
+
.pwa-icon { font-weight: 700; text-align: center; }
|
|
144
|
+
.pwa-problem.pwa-error .pwa-icon, .pwa-test.pwa-fail .pwa-icon { color: var(--pwa-error); }
|
|
145
|
+
.pwa-problem.pwa-warning .pwa-icon { color: var(--pwa-warn); }
|
|
146
|
+
.pwa-test.pwa-pass .pwa-icon { color: var(--pwa-ok); }
|
|
147
|
+
.pwa-advice { color: var(--pwa-muted); }
|
|
148
|
+
.pwa-message pre { margin: 4px 0 0; font: 12px/1.4 ui-monospace, monospace; white-space: pre-wrap; color: var(--pwa-muted); }
|
|
149
|
+
.pwa-fix { margin-top: 4px; }
|
|
150
|
+
.pwa-where { color: var(--pwa-muted); font: 12px/1.4 ui-monospace, monospace; border: 0; background: none; padding: 0; text-align: right; align-self: start; }
|
|
151
|
+
button.pwa-where:hover { text-decoration: underline; }
|
|
152
|
+
.pwa-empty { margin: 0; padding: 6px 12px; color: var(--pwa-muted); }
|
|
153
|
+
.pwa-test-host { position: absolute; left: -100000px; top: 0; width: 398px; }
|
|
154
|
+
.pwa-stage .pwa-screen { width: min(100%, 672px); padding: 24px 32px; background: #fff; color: #000; box-shadow: 0 1px 5px rgb(0 0 0 / 28%); box-sizing: border-box; }
|