@vinena/knobs 0.6.6 → 0.7.0
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 +8 -0
- package/README.md +11 -5
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/dist/cli.d.ts +95 -0
- package/dist/cli.js +527 -0
- package/dist/edit/keep.d.ts +1 -1
- package/dist/{elementsview-dpm0xmb2.js → elementsview-jg4edt86.js} +6 -6
- package/dist/{elementsview-n26sp8m7.js → elementsview-m33ejs4r.js} +6 -6
- package/dist/{framekit-0as9t6a7.js → framekit-40pzennw.js} +3 -3
- package/dist/{framekit-dknq662p.js → framekit-r16k97n7.js} +3 -3
- package/dist/{index-r1rdj05c.js → index-0qkj2mgb.js} +4 -4
- package/dist/{index-whehz74d.js → index-2jc9dnta.js} +21 -1
- package/dist/{index-7w0nm76e.js → index-3nwycv3p.js} +3 -3
- package/dist/{index-x3sxssbs.js → index-8d1yk9d2.js} +8 -8
- package/dist/{index-ajs4na3f.js → index-cb91vcka.js} +1 -1
- package/dist/{index-20bc9yrj.js → index-fjrrgd9h.js} +1 -1
- package/dist/{index-df35z48z.js → index-q53j8wg5.js} +2 -2
- package/dist/{index-7vb2ct4s.js → index-s6fya8pm.js} +4 -4
- package/dist/{index-dxga6h10.js → index-tqq2ygpj.js} +2 -2
- package/dist/{index-69fvtkcm.js → index-v2v4rmpe.js} +3 -3
- package/dist/{index-t4wrs2a3.js → index-xxbb8y41.js} +3 -3
- package/dist/index.global.js +127 -110
- package/dist/index.js +63 -23
- package/dist/{react-msn10fjb.js → react-0gxs9aef.js} +3 -3
- package/dist/{react-2b7725je.js → react-3ev6rwqz.js} +2 -2
- package/dist/{react-k4pkm1p5.js → react-6ngtb6p9.js} +1 -1
- package/dist/{react-5ekfj7g3.js → react-8nmtt0ge.js} +2 -2
- package/dist/{react-y9gr8yt2.js → react-actmnkwp.js} +1 -1
- package/dist/{react-v08ywmtw.js → react-fq4551ks.js} +4 -4
- package/dist/{react-vbk58f9m.js → react-meve34wp.js} +21 -1
- package/dist/{react-10r2rczp.js → react-vvc4x9kq.js} +4 -4
- package/dist/{react-a1r0nr0g.js → react-zp7fdw8e.js} +8 -8
- package/dist/react.js +63 -23
- package/dist/{replay-461gcdh1.js → replay-m5g8km9y.js} +4 -4
- package/dist/{replay-ehgxp9py.js → replay-pmesjfa3.js} +4 -4
- package/dist/{storageview-5p1y11b5.js → storageview-9a6zm47z.js} +8 -8
- package/dist/{storageview-kxzpnfvr.js → storageview-x62v1c3j.js} +8 -8
- package/dist/ui/icons.d.ts +5 -2
- package/dist/ui/panel.d.ts +2 -0
- package/dist/ui/settings.d.ts +11 -1
- package/package.json +5 -2
- package/skills/{devknobs → knobs}/SKILL.md +18 -18
package/dist/react.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
ease,
|
|
5
5
|
keepMounted,
|
|
6
6
|
lerp
|
|
7
|
-
} from "./react-
|
|
7
|
+
} from "./react-6ngtb6p9.js";
|
|
8
8
|
import {
|
|
9
9
|
GRAB_COLORS as GRAB_COLORS2,
|
|
10
10
|
GRAB_COLOR_NAMES,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
createGrab,
|
|
14
14
|
createInspect,
|
|
15
15
|
oneAtATime
|
|
16
|
-
} from "./react-
|
|
16
|
+
} from "./react-fq4551ks.js";
|
|
17
17
|
import {
|
|
18
18
|
hushOnce
|
|
19
19
|
} from "./react-1gqwa2yw.js";
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
settle,
|
|
39
39
|
translateOf,
|
|
40
40
|
velocity
|
|
41
|
-
} from "./react-
|
|
41
|
+
} from "./react-3ev6rwqz.js";
|
|
42
42
|
import {
|
|
43
43
|
dockRoom,
|
|
44
44
|
dockWidth,
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
pathNow,
|
|
55
55
|
startKeep,
|
|
56
56
|
stopKeep
|
|
57
|
-
} from "./react-
|
|
57
|
+
} from "./react-8nmtt0ge.js";
|
|
58
58
|
import {
|
|
59
59
|
label
|
|
60
60
|
} from "./react-4phtr2nd.js";
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
showPane,
|
|
72
72
|
stopOnLoad,
|
|
73
73
|
viewHead
|
|
74
|
-
} from "./react-
|
|
74
|
+
} from "./react-vvc4x9kq.js";
|
|
75
75
|
import {
|
|
76
76
|
actButton,
|
|
77
77
|
button,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
tabBar,
|
|
101
101
|
textField,
|
|
102
102
|
toolbar
|
|
103
|
-
} from "./react-
|
|
103
|
+
} from "./react-actmnkwp.js";
|
|
104
104
|
import {
|
|
105
105
|
BODY_CAP,
|
|
106
106
|
HOST_RESET,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
watchHinge,
|
|
146
146
|
watchPanel,
|
|
147
147
|
zoomKey
|
|
148
|
-
} from "./react-
|
|
148
|
+
} from "./react-zp7fdw8e.js";
|
|
149
149
|
import {
|
|
150
150
|
MAT_COLORS,
|
|
151
151
|
MAT_COLOR_NAMES,
|
|
@@ -165,6 +165,7 @@ import {
|
|
|
165
165
|
BINDING_ICONS,
|
|
166
166
|
KEYS_FIELD,
|
|
167
167
|
ROW_ICONS,
|
|
168
|
+
brand,
|
|
168
169
|
comboLabel,
|
|
169
170
|
comboSpoken,
|
|
170
171
|
comboText,
|
|
@@ -182,8 +183,9 @@ import {
|
|
|
182
183
|
parseCombo,
|
|
183
184
|
rowIcon,
|
|
184
185
|
typeAhead,
|
|
186
|
+
vinenaMark,
|
|
185
187
|
zoomAction
|
|
186
|
-
} from "./react-
|
|
188
|
+
} from "./react-meve34wp.js";
|
|
187
189
|
import {
|
|
188
190
|
BARS,
|
|
189
191
|
BROWSERS,
|
|
@@ -1318,13 +1320,13 @@ var ROWS = [...KNOB_ROWS, ...ACTIONS.map(actionRow)];
|
|
|
1318
1320
|
function knobOf(id) {
|
|
1319
1321
|
const knob = KNOBS.find((entry) => entry.id === id);
|
|
1320
1322
|
if (!knob)
|
|
1321
|
-
throw new Error(`
|
|
1323
|
+
throw new Error(`knobs: no knob ${id}`);
|
|
1322
1324
|
return knob;
|
|
1323
1325
|
}
|
|
1324
1326
|
function rowOf(id) {
|
|
1325
1327
|
const row = KNOB_ROWS.find((entry) => entry.knobs.includes(id));
|
|
1326
1328
|
if (!row)
|
|
1327
|
-
throw new Error(`
|
|
1329
|
+
throw new Error(`knobs: no row for ${id}`);
|
|
1328
1330
|
return row;
|
|
1329
1331
|
}
|
|
1330
1332
|
function availableKnobs() {
|
|
@@ -1489,7 +1491,7 @@ function knobs() {
|
|
|
1489
1491
|
}, "frame"),
|
|
1490
1492
|
overflow: spec("Mark the boxes that stick out of the viewport sideways.", flag2),
|
|
1491
1493
|
outlines: spec("Outline every element.", flag2),
|
|
1492
|
-
panel: spec("The
|
|
1494
|
+
panel: spec("The knobs panel. Close it and hide its handle to keep it out of screenshots. reset() leaves it as it is, open or closed, docked or not.", {
|
|
1493
1495
|
type: "object",
|
|
1494
1496
|
fields: {
|
|
1495
1497
|
open: field2("The panel is open.", flag2),
|
|
@@ -1563,7 +1565,7 @@ function fits(path, shape, value) {
|
|
|
1563
1565
|
}
|
|
1564
1566
|
function checkPatch(patch) {
|
|
1565
1567
|
if (!isRecord2(patch))
|
|
1566
|
-
throw new TypeError("
|
|
1568
|
+
throw new TypeError("knobs: setState takes an object");
|
|
1567
1569
|
const shapes = new Map(describe().map((knob) => [knob.key, knob.value]));
|
|
1568
1570
|
for (const [key, value] of Object.entries(patch)) {
|
|
1569
1571
|
const shape = shapes.get(key);
|
|
@@ -1591,12 +1593,12 @@ function checkPatch(patch) {
|
|
|
1591
1593
|
function unlisted(path, value) {
|
|
1592
1594
|
const takes = UNLISTED.get(path);
|
|
1593
1595
|
if (!takes)
|
|
1594
|
-
throw new TypeError(`
|
|
1596
|
+
throw new TypeError(`knobs: unknown knob ${path}`);
|
|
1595
1597
|
if (!takes(value))
|
|
1596
1598
|
throw bad(path, value);
|
|
1597
1599
|
}
|
|
1598
1600
|
function bad(path, value) {
|
|
1599
|
-
return new TypeError(`
|
|
1601
|
+
return new TypeError(`knobs: bad value for ${path}: ${shown(value)}`);
|
|
1600
1602
|
}
|
|
1601
1603
|
function shown(value) {
|
|
1602
1604
|
if (typeof value === "number" && !Number.isFinite(value))
|
|
@@ -2638,7 +2640,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2638
2640
|
function here(element) {
|
|
2639
2641
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2640
2642
|
}
|
|
2641
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2643
|
+
function createInspector(context, load = () => import("./elementsview-m33ejs4r.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2642
2644
|
const { inspect, tips, prefs } = context;
|
|
2643
2645
|
const listeners = new Set;
|
|
2644
2646
|
let view = null;
|
|
@@ -6328,7 +6330,7 @@ function isZero(duration) {
|
|
|
6328
6330
|
}
|
|
6329
6331
|
|
|
6330
6332
|
// src/version.ts
|
|
6331
|
-
var VERSION = "0.
|
|
6333
|
+
var VERSION = "0.7.0";
|
|
6332
6334
|
|
|
6333
6335
|
// src/ui/settings.ts
|
|
6334
6336
|
var NO_KEY = "not set";
|
|
@@ -6366,6 +6368,25 @@ function feedbackRow() {
|
|
|
6366
6368
|
link.addEventListener(type, aim);
|
|
6367
6369
|
return rowBox({ main: link, glyph: icon("message-square"), title: "send feedback" }).box;
|
|
6368
6370
|
}
|
|
6371
|
+
function outLink(className, href) {
|
|
6372
|
+
const link = el("a", className);
|
|
6373
|
+
link.setAttribute("href", href);
|
|
6374
|
+
link.setAttribute("target", "_blank");
|
|
6375
|
+
link.setAttribute("rel", "noopener noreferrer");
|
|
6376
|
+
return link;
|
|
6377
|
+
}
|
|
6378
|
+
var REPO_URL = "https://github.com/vinenastudio/knobs";
|
|
6379
|
+
function githubRow() {
|
|
6380
|
+
return rowBox({ main: outLink("main feedback", REPO_URL), glyph: brand("github"), title: "github" }).box;
|
|
6381
|
+
}
|
|
6382
|
+
function vinenaUrl(host) {
|
|
6383
|
+
return `https://vinena.studio/?utm_source=knobs.dev&utm_medium=referral&utm_campaign=${host ? "extension" : "panel"}`;
|
|
6384
|
+
}
|
|
6385
|
+
function creditRow(host) {
|
|
6386
|
+
const link = outLink("credit", vinenaUrl(host));
|
|
6387
|
+
link.append(el("span", "", "crafted at"), vinenaMark());
|
|
6388
|
+
return link;
|
|
6389
|
+
}
|
|
6369
6390
|
function keepRow(resolve) {
|
|
6370
6391
|
const control = button("switch row-control", "");
|
|
6371
6392
|
control.setAttribute("role", "switch");
|
|
@@ -6524,7 +6545,7 @@ function createSettings(context) {
|
|
|
6524
6545
|
}).box);
|
|
6525
6546
|
keyViews.set(binding, { set: set2, back });
|
|
6526
6547
|
}
|
|
6527
|
-
keysView.append(feedbackRow());
|
|
6548
|
+
keysView.append(feedbackRow(), githubRow(), creditRow(context.host));
|
|
6528
6549
|
let editingKeys = false;
|
|
6529
6550
|
let recording = null;
|
|
6530
6551
|
const { refuse, unrefuse, destroy: stopRefusing } = createRefusal(tips, said);
|
|
@@ -7640,6 +7661,23 @@ input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-
|
|
|
7640
7661
|
.row-key { flex: none; align-self: center; font-size: 10px; line-height: 1.4; color: var(--faint); }
|
|
7641
7662
|
.feedback { color: inherit; text-decoration: none; cursor: pointer; }
|
|
7642
7663
|
.feedback:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
7664
|
+
/* The studio's credit under the settings' rows: its words and its wordmark, as quiet as the footer's text. */
|
|
7665
|
+
.credit {
|
|
7666
|
+
display: flex;
|
|
7667
|
+
align-items: center;
|
|
7668
|
+
justify-content: center;
|
|
7669
|
+
gap: 0.4em;
|
|
7670
|
+
padding: 8px var(--view-end) 4px var(--view-start);
|
|
7671
|
+
font-size: 10px;
|
|
7672
|
+
line-height: 1.4;
|
|
7673
|
+
color: var(--faint);
|
|
7674
|
+
text-decoration: none;
|
|
7675
|
+
white-space: nowrap;
|
|
7676
|
+
border-radius: 8px;
|
|
7677
|
+
}
|
|
7678
|
+
.credit:hover { color: var(--fg); }
|
|
7679
|
+
.credit:focus-visible { color: var(--fg); outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
7680
|
+
.credit .wordmark { flex: none; width: auto; height: 0.85em; }
|
|
7643
7681
|
.row-control { flex: none; align-self: center; margin-left: auto; }
|
|
7644
7682
|
/* A row's small button inside its main, before what the main ends with,
|
|
7645
7683
|
takes no height of its own, so the row is as tall as any. */
|
|
@@ -8904,6 +8942,7 @@ function createPanel(options2 = {}) {
|
|
|
8904
8942
|
},
|
|
8905
8943
|
prefer: options2.prefer ?? null,
|
|
8906
8944
|
setPrefer: (value) => options2.prefer?.change(value),
|
|
8945
|
+
host: options2.host === true,
|
|
8907
8946
|
searching: () => palette.searching(),
|
|
8908
8947
|
leaveSearch: () => palette.leaveSearch()
|
|
8909
8948
|
});
|
|
@@ -9032,7 +9071,7 @@ function createPanel(options2 = {}) {
|
|
|
9032
9071
|
}
|
|
9033
9072
|
function renderKeys() {
|
|
9034
9073
|
const now2 = keys.get();
|
|
9035
|
-
handle.setAttribute("aria-label", `
|
|
9074
|
+
handle.setAttribute("aria-label", `knobs, press ${comboSpoken(now2.panel)}`);
|
|
9036
9075
|
footer.drawKeys(now2);
|
|
9037
9076
|
settings.drawKeys(now2);
|
|
9038
9077
|
knobRows.drawKeys(now2);
|
|
@@ -9434,7 +9473,8 @@ function attach(options2) {
|
|
|
9434
9473
|
grab: grabControl,
|
|
9435
9474
|
inspect,
|
|
9436
9475
|
handle: options2.handle,
|
|
9437
|
-
prefer: panelPrefer(options2)
|
|
9476
|
+
prefer: panelPrefer(options2),
|
|
9477
|
+
host: options2.host === true
|
|
9438
9478
|
});
|
|
9439
9479
|
}
|
|
9440
9480
|
function panelPrefer(options2) {
|
|
@@ -9601,7 +9641,7 @@ function retake(options2, native) {
|
|
|
9601
9641
|
}
|
|
9602
9642
|
if (retaken++ >= RETAKES) {
|
|
9603
9643
|
if (retaken === RETAKES + 1) {
|
|
9604
|
-
console.warn("
|
|
9644
|
+
console.warn("knobs: this page runs its own copy of knobs, which does not know hosts; it keeps the page");
|
|
9605
9645
|
}
|
|
9606
9646
|
return;
|
|
9607
9647
|
}
|
|
@@ -9644,7 +9684,7 @@ async function grab(elements, options2) {
|
|
|
9644
9684
|
const host = hosted("grab");
|
|
9645
9685
|
if (host)
|
|
9646
9686
|
return host(elements, options2);
|
|
9647
|
-
const loaded = await import("./index-
|
|
9687
|
+
const loaded = await import("./index-3nwycv3p.js");
|
|
9648
9688
|
return loaded.grab(elements, options2);
|
|
9649
9689
|
}
|
|
9650
9690
|
function edits2() {
|
|
@@ -9655,8 +9695,8 @@ async function setEdits(list) {
|
|
|
9655
9695
|
if (host)
|
|
9656
9696
|
return host(list);
|
|
9657
9697
|
if (!Array.isArray(list))
|
|
9658
|
-
throw new TypeError("
|
|
9659
|
-
const { replayEdits } = await import("./replay-
|
|
9698
|
+
throw new TypeError("knobs: setEdits takes a list of edits, as edits() gives them");
|
|
9699
|
+
const { replayEdits } = await import("./replay-m5g8km9y.js");
|
|
9660
9700
|
const { applied, skipped } = replayEdits(edits, list);
|
|
9661
9701
|
return { applied, skipped };
|
|
9662
9702
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
parseHtml,
|
|
11
11
|
rulesOf,
|
|
12
12
|
textEdit
|
|
13
|
-
} from "./react-
|
|
13
|
+
} from "./react-0gxs9aef.js";
|
|
14
14
|
import {
|
|
15
15
|
REASONS,
|
|
16
16
|
RISK,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
riskyAttribute,
|
|
19
19
|
riskyElement,
|
|
20
20
|
riskyNodes
|
|
21
|
-
} from "./react-
|
|
21
|
+
} from "./react-8nmtt0ge.js";
|
|
22
22
|
import"./react-73reavv4.js";
|
|
23
23
|
import {
|
|
24
24
|
NEW_RULE_SHEET,
|
|
@@ -30,8 +30,8 @@ import {
|
|
|
30
30
|
ruleOf,
|
|
31
31
|
sheetIdOf
|
|
32
32
|
} from "./react-4phtr2nd.js";
|
|
33
|
-
import"./react-
|
|
34
|
-
import"./react-
|
|
33
|
+
import"./react-actmnkwp.js";
|
|
34
|
+
import"./react-meve34wp.js";
|
|
35
35
|
import"./react-0r5418av.js";
|
|
36
36
|
import"./react-t2qnewz2.js";
|
|
37
37
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseHtml,
|
|
10
10
|
rulesOf,
|
|
11
11
|
textEdit
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-v2v4rmpe.js";
|
|
13
13
|
import {
|
|
14
14
|
REASONS,
|
|
15
15
|
RISK,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
riskyAttribute,
|
|
18
18
|
riskyElement,
|
|
19
19
|
riskyNodes
|
|
20
|
-
} from "./index-
|
|
20
|
+
} from "./index-q53j8wg5.js";
|
|
21
21
|
import"./index-za4ppxay.js";
|
|
22
22
|
import {
|
|
23
23
|
NEW_RULE_SHEET,
|
|
@@ -29,8 +29,8 @@ import {
|
|
|
29
29
|
ruleOf,
|
|
30
30
|
sheetIdOf
|
|
31
31
|
} from "./index-a8ffw5ft.js";
|
|
32
|
-
import"./index-
|
|
33
|
-
import"./index-
|
|
32
|
+
import"./index-fjrrgd9h.js";
|
|
33
|
+
import"./index-2jc9dnta.js";
|
|
34
34
|
import"./index-jfv7vavj.js";
|
|
35
35
|
import"./index-5tv6sr74.js";
|
|
36
36
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
cookieText,
|
|
7
7
|
put,
|
|
8
8
|
storedPresets
|
|
9
|
-
} from "./react-
|
|
9
|
+
} from "./react-vvc4x9kq.js";
|
|
10
10
|
import {
|
|
11
11
|
copyText
|
|
12
12
|
} from "./react-h9w04skh.js";
|
|
@@ -31,12 +31,12 @@ import {
|
|
|
31
31
|
textArea,
|
|
32
32
|
textField,
|
|
33
33
|
toolbar
|
|
34
|
-
} from "./react-
|
|
35
|
-
import"./react-
|
|
34
|
+
} from "./react-actmnkwp.js";
|
|
35
|
+
import"./react-zp7fdw8e.js";
|
|
36
36
|
import"./react-5h7pxnax.js";
|
|
37
37
|
import {
|
|
38
38
|
icon
|
|
39
|
-
} from "./react-
|
|
39
|
+
} from "./react-meve34wp.js";
|
|
40
40
|
import {
|
|
41
41
|
stamped,
|
|
42
42
|
webStorage
|
|
@@ -1654,7 +1654,7 @@ async function savePreset(shell, query) {
|
|
|
1654
1654
|
};
|
|
1655
1655
|
const name = textField({ placeholder: "preset name", onEnter: save });
|
|
1656
1656
|
const node = stack([
|
|
1657
|
-
noteLine(`keeps ${holds}${query.trim() === "" ? "" : ", as the filter shows them"}, without
|
|
1657
|
+
noteLine(`keeps ${holds}${query.trim() === "" ? "" : ", as the filter shows them"}, without knobs' own`),
|
|
1658
1658
|
name,
|
|
1659
1659
|
problem,
|
|
1660
1660
|
controls([
|
|
@@ -2000,7 +2000,7 @@ function webSection(shell, kind) {
|
|
|
2000
2000
|
if (!item.own)
|
|
2001
2001
|
run();
|
|
2002
2002
|
else
|
|
2003
|
-
askIn(shell, fold.body, `${key} is
|
|
2003
|
+
askIn(shell, fold.body, `${key} is knobs' own. ${doing} it anyway?`, doing, run, fill);
|
|
2004
2004
|
}
|
|
2005
2005
|
function edit() {
|
|
2006
2006
|
editing++;
|
|
@@ -2342,7 +2342,7 @@ function storageView(options = {}) {
|
|
|
2342
2342
|
ownLine.replaceChildren();
|
|
2343
2343
|
return;
|
|
2344
2344
|
}
|
|
2345
|
-
ownToggle.textContent = own2 ? "hide
|
|
2345
|
+
ownToggle.textContent = own2 ? "hide knobs' own" : `${hidden} hidden (knobs' own)`;
|
|
2346
2346
|
if (ownLine.children.length === 0)
|
|
2347
2347
|
ownLine.replaceChildren(ownToggle);
|
|
2348
2348
|
}
|
|
@@ -2640,7 +2640,7 @@ ${each.version}`).join(`
|
|
|
2640
2640
|
function clearAll() {
|
|
2641
2641
|
const own2 = shell.own();
|
|
2642
2642
|
countSite(site, own2).then((counts) => {
|
|
2643
|
-
const kept2 = own2 ? ",
|
|
2643
|
+
const kept2 = own2 ? ", knobs' own items too" : ". knobs' own items are kept";
|
|
2644
2644
|
shell.ask(`clear site data? ${countsText(counts)}${kept2}`, "clear site data", () => {
|
|
2645
2645
|
clearSite(site, own2).then((report) => {
|
|
2646
2646
|
shell.say(reportLines(report), {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
cookieText,
|
|
6
6
|
put,
|
|
7
7
|
storedPresets
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-0qkj2mgb.js";
|
|
9
9
|
import {
|
|
10
10
|
copyText
|
|
11
11
|
} from "./index-ztnjefrh.js";
|
|
@@ -30,12 +30,12 @@ import {
|
|
|
30
30
|
textArea,
|
|
31
31
|
textField,
|
|
32
32
|
toolbar
|
|
33
|
-
} from "./index-
|
|
34
|
-
import"./index-
|
|
33
|
+
} from "./index-fjrrgd9h.js";
|
|
34
|
+
import"./index-8d1yk9d2.js";
|
|
35
35
|
import"./index-s6yzsvs4.js";
|
|
36
36
|
import {
|
|
37
37
|
icon
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-2jc9dnta.js";
|
|
39
39
|
import {
|
|
40
40
|
stamped,
|
|
41
41
|
webStorage
|
|
@@ -1653,7 +1653,7 @@ async function savePreset(shell, query) {
|
|
|
1653
1653
|
};
|
|
1654
1654
|
const name = textField({ placeholder: "preset name", onEnter: save });
|
|
1655
1655
|
const node = stack([
|
|
1656
|
-
noteLine(`keeps ${holds}${query.trim() === "" ? "" : ", as the filter shows them"}, without
|
|
1656
|
+
noteLine(`keeps ${holds}${query.trim() === "" ? "" : ", as the filter shows them"}, without knobs' own`),
|
|
1657
1657
|
name,
|
|
1658
1658
|
problem,
|
|
1659
1659
|
controls([
|
|
@@ -1999,7 +1999,7 @@ function webSection(shell, kind) {
|
|
|
1999
1999
|
if (!item.own)
|
|
2000
2000
|
run();
|
|
2001
2001
|
else
|
|
2002
|
-
askIn(shell, fold.body, `${key} is
|
|
2002
|
+
askIn(shell, fold.body, `${key} is knobs' own. ${doing} it anyway?`, doing, run, fill);
|
|
2003
2003
|
}
|
|
2004
2004
|
function edit() {
|
|
2005
2005
|
editing++;
|
|
@@ -2341,7 +2341,7 @@ function storageView(options = {}) {
|
|
|
2341
2341
|
ownLine.replaceChildren();
|
|
2342
2342
|
return;
|
|
2343
2343
|
}
|
|
2344
|
-
ownToggle.textContent = own2 ? "hide
|
|
2344
|
+
ownToggle.textContent = own2 ? "hide knobs' own" : `${hidden} hidden (knobs' own)`;
|
|
2345
2345
|
if (ownLine.children.length === 0)
|
|
2346
2346
|
ownLine.replaceChildren(ownToggle);
|
|
2347
2347
|
}
|
|
@@ -2639,7 +2639,7 @@ ${each.version}`).join(`
|
|
|
2639
2639
|
function clearAll() {
|
|
2640
2640
|
const own2 = shell.own();
|
|
2641
2641
|
countSite(site, own2).then((counts) => {
|
|
2642
|
-
const kept2 = own2 ? ",
|
|
2642
|
+
const kept2 = own2 ? ", knobs' own items too" : ". knobs' own items are kept";
|
|
2643
2643
|
shell.ask(`clear site data? ${countsText(counts)}${kept2}`, "clear site data", () => {
|
|
2644
2644
|
clearSite(site, own2).then((report) => {
|
|
2645
2645
|
shell.say(reportLines(report), {
|
package/dist/ui/icons.d.ts
CHANGED
|
@@ -119,16 +119,19 @@ export declare const ICONS: {
|
|
|
119
119
|
export type IconName = keyof typeof ICONS;
|
|
120
120
|
/** A mark: its color, its path, and what is drawn behind it where it has letters. */
|
|
121
121
|
type Brand = readonly [fill: string, d: string, behind?: readonly [fill: string, d: string]];
|
|
122
|
-
export type BrandName = "javascript" | "css" | "html5" | "webassembly" | "json";
|
|
122
|
+
export type BrandName = "javascript" | "css" | "html5" | "webassembly" | "json" | "github";
|
|
123
123
|
/**
|
|
124
124
|
* The marks of what a page loads, from Simple Icons 16.6.0 (CC0, see
|
|
125
125
|
* THIRD_PARTY_NOTICES.md): each the one path of its 24 by 24 svg as it is in
|
|
126
126
|
* the package, in the color the package lists for it. The path leaves a
|
|
127
127
|
* mark's letters open, so a plain box behind them gives them the color their
|
|
128
128
|
* owner draws them in, the same in a light panel and a dark one. JSON's black
|
|
129
|
-
* is the text's color instead, which shows in both.
|
|
129
|
+
* is the text's color instead, which shows in both. GitHub's, which the
|
|
130
|
+
* settings' link to the repo shows, is the text's color too.
|
|
130
131
|
*/
|
|
131
132
|
export declare const BRANDS: Record<BrandName, Brand>;
|
|
133
|
+
/** The Vinena wordmark in the text's color, named for assistive tech. Its size is the stylesheet's. */
|
|
134
|
+
export declare function vinenaMark(): SVGElement;
|
|
132
135
|
/** Any drawing the panel has, an icon or a mark. */
|
|
133
136
|
export type GlyphName = IconName | BrandName;
|
|
134
137
|
/** The icon each row of knobs shows by its label, and its knobs in the search. */
|
package/dist/ui/panel.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface PanelOptions {
|
|
|
22
22
|
handle?: boolean;
|
|
23
23
|
/** Who runs the panel, the host or the page, where a host gives the choice. */
|
|
24
24
|
prefer?: PanelPrefer;
|
|
25
|
+
/** A host, such as the extension, runs this copy, and not the page. */
|
|
26
|
+
host?: boolean;
|
|
25
27
|
}
|
|
26
28
|
/** A host's choice of who runs the panel, as the settings and the footer show it. */
|
|
27
29
|
export interface PanelPrefer {
|
package/dist/ui/settings.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export interface SettingsContext {
|
|
|
64
64
|
} | null;
|
|
65
65
|
/** The user picked who runs the panel. */
|
|
66
66
|
setPrefer(value: PreferValue): void;
|
|
67
|
+
/** A host, such as the extension, runs this copy, and not the page. */
|
|
68
|
+
host: boolean;
|
|
67
69
|
/** Whether the search is open. */
|
|
68
70
|
searching(): boolean;
|
|
69
71
|
leaveSearch(): void;
|
|
@@ -111,8 +113,16 @@ export interface KeepRow {
|
|
|
111
113
|
* run from source has no version to give.
|
|
112
114
|
*/
|
|
113
115
|
export declare function feedbackUrl(version: string, page: string): string;
|
|
114
|
-
/**
|
|
116
|
+
/** A row of the settings: a link that opens the feedback page in a new tab, and sends nothing itself. */
|
|
115
117
|
export declare function feedbackRow(): HTMLElement;
|
|
118
|
+
/** The repo of devknobs. */
|
|
119
|
+
export declare const REPO_URL = "https://github.com/vinenastudio/knobs";
|
|
120
|
+
/** The row after send feedback: a link that opens the repo in a new tab. */
|
|
121
|
+
export declare function githubRow(): HTMLElement;
|
|
122
|
+
/** The studio's site, as knobs.dev links to it, with the copy the link is in: the extension's or a page's. */
|
|
123
|
+
export declare function vinenaUrl(host: boolean): string;
|
|
124
|
+
/** The last line of the settings: the studio's credit, its words and its wordmark one link. */
|
|
125
|
+
export declare function creditRow(host: boolean): HTMLElement;
|
|
116
126
|
/**
|
|
117
127
|
* The switch that keeps the page's edits after a reload, as the keeper has
|
|
118
128
|
* it, and off to a click until the keeper knows what the page keeps.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinena/knobs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mert Düzgün",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"type": "module",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"knobs": "./dist/cli.js"
|
|
23
|
+
},
|
|
21
24
|
"files": [
|
|
22
25
|
"dist",
|
|
23
26
|
"skills",
|
|
@@ -38,7 +41,7 @@
|
|
|
38
41
|
"./bezels/*": "./dist/bezels/*"
|
|
39
42
|
},
|
|
40
43
|
"scripts": {
|
|
41
|
-
"build": "bun scripts/bezelurls.ts && bun -e 'require(\"fs\").rmSync(\"dist.tmp\",{recursive:true,force:true})' && bun build src/index.ts --outdir dist.tmp --format esm --splitting --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/react.tsx --outdir dist.tmp --format esm --splitting --external react --banner '\"use client\";' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/global.ts --outfile dist.tmp/index.global.js --format iife --minify --define 'import.meta.url=\"\"' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/early.ts --outfile dist.tmp/early.global.js --format iife --minify --define DEVKNOBS_TUNE=false && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist.tmp && rm -f dist.tmp/engine/foldtune.d.ts && if [ -d assets/bezels ]; then cp -R assets/bezels dist.tmp/bezels; fi && bun scripts/useclient.ts && bun scripts/tunefree.ts && bun -e 'const fs=require(\"fs\");fs.rmSync(\"dist\",{recursive:true,force:true});fs.renameSync(\"dist.tmp\",\"dist\")'",
|
|
44
|
+
"build": "bun scripts/bezelurls.ts && bun -e 'require(\"fs\").rmSync(\"dist.tmp\",{recursive:true,force:true})' && bun build src/index.ts --outdir dist.tmp --format esm --splitting --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/react.tsx --outdir dist.tmp --format esm --splitting --external react --banner '\"use client\";' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/global.ts --outfile dist.tmp/index.global.js --format iife --minify --define 'import.meta.url=\"\"' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/early.ts --outfile dist.tmp/early.global.js --format iife --minify --define DEVKNOBS_TUNE=false && bun build src/cli.ts --outfile dist.tmp/cli.js --target node --format esm && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist.tmp && rm -f dist.tmp/engine/foldtune.d.ts && if [ -d assets/bezels ]; then cp -R assets/bezels dist.tmp/bezels; fi && bun scripts/useclient.ts && bun scripts/tunefree.ts && bun -e 'const fs=require(\"fs\");fs.rmSync(\"dist\",{recursive:true,force:true});fs.renameSync(\"dist.tmp\",\"dist\")'",
|
|
42
45
|
"link": "bun scripts/link.ts link",
|
|
43
46
|
"unlink": "bun scripts/link.ts unlink",
|
|
44
47
|
"test": "bun test",
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Test a web page under different conditions with
|
|
2
|
+
name: knobs
|
|
3
|
+
description: Test a web page under different conditions with knobs and fix what breaks. Use when an agent needs to check a page in dark mode, with reduced motion or more contrast, in another locale or right to left, with larger text, offline or on a slow connection, on another device or width, in another time zone or at another time, and then find and fix the code behind anything that looks wrong.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# knobs
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
knobs is a dev panel that emulates browser conditions from inside the page.
|
|
9
9
|
You drive it from any browser tool that can run JavaScript in the page:
|
|
10
10
|
Playwright `page.evaluate`, Chrome DevTools MCP `evaluate_script`, or similar.
|
|
11
11
|
|
|
12
12
|
## Before you start
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
knobs must be installed in the app. See the install section of the
|
|
15
|
+
knobs README (`node_modules/@vinena/knobs/README.md`).
|
|
16
16
|
|
|
17
|
-
Check that
|
|
17
|
+
Check that knobs is mounted:
|
|
18
18
|
|
|
19
19
|
```js
|
|
20
20
|
await window.devknobs.ready();
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Every way of mounting
|
|
23
|
+
Every way of mounting knobs puts the api on `window.devknobs`: the script
|
|
24
24
|
tag, `mount()` and `<DevKnobs />`. Inside the width knob's frame the frame's own
|
|
25
|
-
copy has it too. If `window.devknobs` is undefined,
|
|
25
|
+
copy has it too. If `window.devknobs` is undefined, knobs is not on this
|
|
26
26
|
page. The script tag build keeps the api after `unmount()`, so the api alone
|
|
27
27
|
does not prove a mount. `ready()` does: it rejects at once with
|
|
28
|
-
`
|
|
28
|
+
`knobs: not mounted` when nothing is mounted.
|
|
29
29
|
|
|
30
30
|
Then note the panel as the user left it. Keep the result in your notes, as a
|
|
31
31
|
later evaluate or a reload loses page variables:
|
|
@@ -68,14 +68,14 @@ as `grabColor` and the panel's place. Do not compare the two key for key.
|
|
|
68
68
|
|
|
69
69
|
1. Call `setState(patch)`. It is sync and returns the new state.
|
|
70
70
|
A wrong key or value throws a TypeError, and then nothing changes:
|
|
71
|
-
`
|
|
72
|
-
`
|
|
71
|
+
`knobs: unknown knob <key>[.<field>]` or
|
|
72
|
+
`knobs: bad value for <key>[.<field>]: <value>`. Fix the patch from
|
|
73
73
|
`describe()`. Combinations are not checked: `orientation` is dropped
|
|
74
74
|
without a numeric width and height, and `posture` without a device that
|
|
75
75
|
folds. Compare `getState()` with what you set.
|
|
76
76
|
2. Wait for it to apply:
|
|
77
77
|
- `reload` is `none` or `frame`: `await window.devknobs.ready()`.
|
|
78
|
-
- `reload` is `page`: the page may reload, or it may not.
|
|
78
|
+
- `reload` is `page`: the page may reload, or it may not. knobs skips a
|
|
79
79
|
reload that comes less than 5 seconds after the last one. Call
|
|
80
80
|
`await window.devknobs.ready()` either way. If the page navigates
|
|
81
81
|
instead, wait for the load in your browser tool and call
|
|
@@ -87,7 +87,7 @@ as `grabColor` and the panel's place. Do not compare the two key for key.
|
|
|
87
87
|
|
|
88
88
|
`ready()` resolves with the state once the device frame has caught up, the
|
|
89
89
|
pseudo text is in and the panel has finished its slide. After 10 seconds it rejects with the error
|
|
90
|
-
`
|
|
90
|
+
`knobs: not settled after 10 seconds`. A rejection is not success: check the
|
|
91
91
|
page before you trust it.
|
|
92
92
|
|
|
93
93
|
To leave a device, call `reset()` or set
|
|
@@ -132,10 +132,10 @@ await window.devknobs.ready();
|
|
|
132
132
|
frame?.contentDocument;
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
Read the DOM there. The page in the frame runs its own
|
|
135
|
+
Read the DOM there. The page in the frame runs its own knobs, so call
|
|
136
136
|
`grab` on `frame.contentWindow.devknobs` for elements in the frame. The top
|
|
137
137
|
page's `grab` on such an element gives component names with no file or line.
|
|
138
|
-
After `ready()` the frame's
|
|
138
|
+
After `ready()` the frame's knobs is there if the app mounts knobs on
|
|
139
139
|
that page.
|
|
140
140
|
|
|
141
141
|
## Find the code
|
|
@@ -152,8 +152,8 @@ payload?.content;
|
|
|
152
152
|
`content` is one line per element: its html, the components that rendered it
|
|
153
153
|
and their source files with line and column. `entries[i].source?.filePath`
|
|
154
154
|
holds the file, relative to the app's dev server root (the vite root), not the
|
|
155
|
-
repo. In a monorepo, find the app first. `source` is null when
|
|
156
|
-
find one. `source.lineNumber` and `columnNumber` are null when
|
|
155
|
+
repo. In a monorepo, find the app first. `source` is null when knobs cannot
|
|
156
|
+
find one. `source.lineNumber` and `columnNumber` are null when knobs finds
|
|
157
157
|
the file but not the line, and `content` then names the file alone. Search
|
|
158
158
|
that file for the element's tag and class names. A line that is there points
|
|
159
159
|
at the element's tag in the file. Open that file and fix the code.
|