@vinena/knobs 0.6.6 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +13 -7
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/dist/cli.d.ts +95 -0
- package/dist/cli.js +527 -0
- package/dist/{context-eawqn680.js → context-2r76ext7.js} +3 -3
- package/dist/{context-vd2xep5t.js → context-h1bdt8w3.js} +3 -3
- package/dist/early.global.js +7 -8
- package/dist/edit/html.d.ts +7 -3
- package/dist/edit/keep.d.ts +2 -2
- package/dist/{elementsview-n26sp8m7.js → elementsview-mcg6d5zp.js} +21 -19
- package/dist/{elementsview-dpm0xmb2.js → elementsview-mwr1s17z.js} +21 -19
- package/dist/engine/bezels.d.ts +2 -2
- package/dist/engine/check.d.ts +2 -2
- package/dist/engine/describe.d.ts +2 -2
- package/dist/engine/devices.d.ts +3 -3
- package/dist/engine/fit.d.ts +4 -4
- package/dist/engine/foldhand.d.ts +2 -2
- package/dist/engine/frame.d.ts +6 -6
- package/dist/engine/frames.d.ts +4 -4
- package/dist/engine/fresh.d.ts +12 -5
- package/dist/engine/header.d.ts +3 -1
- package/dist/engine/identity.d.ts +4 -4
- package/dist/engine/index.d.ts +7 -7
- package/dist/engine/locale.d.ts +2 -2
- package/dist/engine/morph.d.ts +2 -2
- package/dist/engine/native.d.ts +8 -8
- package/dist/engine/placeholder.d.ts +3 -3
- package/dist/engine/reload.d.ts +2 -2
- package/dist/engine/screen.d.ts +2 -2
- package/dist/engine/scrollkeep.d.ts +1 -1
- package/dist/engine/store.d.ts +11 -11
- package/dist/engine/storekeys.d.ts +34 -0
- package/dist/engine/style.d.ts +1 -1
- package/dist/engine/tabicon.d.ts +2 -2
- package/dist/engine/underneath.d.ts +1 -0
- package/dist/engine/width.d.ts +3 -3
- package/dist/{framekit-0as9t6a7.js → framekit-4v7nc3ea.js} +25 -20
- package/dist/{framekit-dknq662p.js → framekit-wyppj1se.js} +25 -20
- package/dist/grab/clipboard.d.ts +2 -0
- package/dist/{index-jfv7vavj.js → index-311fys81.js} +93 -29
- package/dist/index-3dcgysws.js +77 -0
- package/dist/{index-7vb2ct4s.js → index-3s4v7gw5.js} +11 -10
- package/dist/{index-ztnjefrh.js → index-585hs9tp.js} +5 -1
- package/dist/{index-za4ppxay.js → index-6t0w5s7p.js} +1 -1
- package/dist/{index-r1rdj05c.js → index-82y8x8vv.js} +14 -11
- package/dist/{index-dxga6h10.js → index-9targr2f.js} +26 -16
- package/dist/{index-x3sxssbs.js → index-a23nv5j4.js} +65 -45
- package/dist/{index-t4kssacm.js → index-abwqw8jh.js} +6 -1
- package/dist/{index-s6yzsvs4.js → index-bgzyc7rz.js} +22 -15
- package/dist/{index-t4wrs2a3.js → index-c1t6knbf.js} +20 -14
- package/dist/{index-7w0nm76e.js → index-cqymjce4.js} +20 -14
- package/dist/{index-69fvtkcm.js → index-dvtbh3c8.js} +24 -18
- package/dist/{index-ajs4na3f.js → index-k4w5v53q.js} +2 -2
- package/dist/{index-df35z48z.js → index-n31pn4ax.js} +20 -16
- package/dist/{index-ymqm185m.js → index-rps0bdq9.js} +1 -1
- package/dist/{index-a8ffw5ft.js → index-szd9bddn.js} +1 -1
- package/dist/{index-whehz74d.js → index-vhda420r.js} +32 -6
- package/dist/{index-xs29b55n.js → index-vmprrfwe.js} +5 -2
- package/dist/{index-20bc9yrj.js → index-vmz7htwn.js} +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.global.js +176 -159
- package/dist/index.js +108 -43
- package/dist/instance.d.ts +7 -1
- package/dist/mark.d.ts +50 -0
- package/dist/{react-msn10fjb.js → react-4ezjf7mq.js} +24 -18
- package/dist/react-4qn9vsjw.js +78 -0
- package/dist/{react-73reavv4.js → react-4tcwpama.js} +1 -1
- package/dist/{react-k4pkm1p5.js → react-7eyps0cg.js} +2 -2
- package/dist/{react-10r2rczp.js → react-7tzwahsm.js} +14 -11
- package/dist/{react-yx3g9k55.js → react-amvrbng8.js} +5 -2
- package/dist/{react-5rq7bnsy.js → react-atw9y8ny.js} +5 -1
- package/dist/{react-4phtr2nd.js → react-dg4bjv3j.js} +1 -1
- package/dist/{react-vbk58f9m.js → react-hdneb4v3.js} +32 -6
- package/dist/{react-h9w04skh.js → react-j87bdhhe.js} +4 -1
- package/dist/{react-wtgvkf6g.js → react-mkafgzqf.js} +1 -1
- package/dist/{react-a1r0nr0g.js → react-ppyj3fg2.js} +65 -45
- package/dist/{react-0r5418av.js → react-rbmk30xk.js} +92 -29
- package/dist/{react-y9gr8yt2.js → react-rxw73n04.js} +1 -1
- package/dist/{react-5h7pxnax.js → react-tet7swk2.js} +22 -15
- package/dist/{react-5ekfj7g3.js → react-w94cfn87.js} +20 -16
- package/dist/{react-v08ywmtw.js → react-wzd3cfg8.js} +11 -10
- package/dist/{react-2b7725je.js → react-x209et38.js} +26 -16
- package/dist/react.d.ts +3 -1
- package/dist/react.js +111 -44
- package/dist/{replay-ehgxp9py.js → replay-3xqgt3xg.js} +8 -8
- package/dist/{replay-461gcdh1.js → replay-48gn27bj.js} +8 -8
- package/dist/storage/onload.d.ts +1 -1
- package/dist/{storageview-5p1y11b5.js → storageview-2rvwk0v7.js} +20 -17
- package/dist/{storageview-kxzpnfvr.js → storageview-6vq7nz02.js} +20 -17
- package/dist/styles/force.d.ts +3 -1
- package/dist/types.d.ts +4 -4
- package/dist/ui/actions.d.ts +3 -3
- package/dist/ui/bindings.d.ts +1 -1
- package/dist/ui/catalog.d.ts +14 -14
- package/dist/ui/changes.d.ts +1 -1
- package/dist/ui/colors.d.ts +1 -1
- package/dist/ui/deviceknobs.d.ts +2 -2
- package/dist/ui/editors.d.ts +3 -3
- package/dist/ui/foldslider.d.ts +2 -2
- package/dist/ui/icons.d.ts +5 -2
- package/dist/ui/keys.d.ts +1 -1
- package/dist/ui/list.d.ts +10 -10
- package/dist/ui/palette.d.ts +2 -2
- package/dist/ui/panel.d.ts +2 -0
- package/dist/ui/pin.d.ts +2 -2
- package/dist/ui/prefs.d.ts +1 -1
- package/dist/ui/rows.d.ts +3 -3
- package/dist/ui/settings.d.ts +11 -1
- package/dist/ui/storageview.d.ts +2 -2
- package/dist/ui/stylesview.d.ts +3 -3
- package/dist/ui/swatches.d.ts +2 -2
- package/package.json +5 -2
- package/skills/{devknobs → knobs}/SKILL.md +52 -51
- package/dist/index-5tv6sr74.js +0 -23
- package/dist/react-t2qnewz2.js +0 -24
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ease,
|
|
4
4
|
keepMounted,
|
|
5
5
|
lerp
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-k4w5v53q.js";
|
|
7
7
|
import {
|
|
8
8
|
GRAB_COLORS as GRAB_COLORS2,
|
|
9
9
|
GRAB_COLOR_NAMES,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createGrab,
|
|
13
13
|
createInspect,
|
|
14
14
|
oneAtATime
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-3s4v7gw5.js";
|
|
16
16
|
import {
|
|
17
17
|
hushOnce
|
|
18
18
|
} from "./index-aymfvd8s.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
settle,
|
|
38
38
|
translateOf,
|
|
39
39
|
velocity
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-9targr2f.js";
|
|
41
41
|
import {
|
|
42
42
|
dockRoom,
|
|
43
43
|
dockWidth,
|
|
@@ -53,10 +53,10 @@ import {
|
|
|
53
53
|
pathNow,
|
|
54
54
|
startKeep,
|
|
55
55
|
stopKeep
|
|
56
|
-
} from "./index-
|
|
56
|
+
} from "./index-n31pn4ax.js";
|
|
57
57
|
import {
|
|
58
58
|
label
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-szd9bddn.js";
|
|
60
60
|
import {
|
|
61
61
|
appliedOnLoad,
|
|
62
62
|
applyOnLoad,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
showPane,
|
|
71
71
|
stopOnLoad,
|
|
72
72
|
viewHead
|
|
73
|
-
} from "./index-
|
|
73
|
+
} from "./index-82y8x8vv.js";
|
|
74
74
|
import {
|
|
75
75
|
actButton,
|
|
76
76
|
button,
|
|
@@ -99,7 +99,7 @@ import {
|
|
|
99
99
|
tabBar,
|
|
100
100
|
textField,
|
|
101
101
|
toolbar
|
|
102
|
-
} from "./index-
|
|
102
|
+
} from "./index-vmz7htwn.js";
|
|
103
103
|
import {
|
|
104
104
|
BODY_CAP,
|
|
105
105
|
HOST_RESET,
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
watchHinge,
|
|
145
145
|
watchPanel,
|
|
146
146
|
zoomKey
|
|
147
|
-
} from "./index-
|
|
147
|
+
} from "./index-a23nv5j4.js";
|
|
148
148
|
import {
|
|
149
149
|
MAT_COLORS,
|
|
150
150
|
MAT_COLOR_NAMES,
|
|
@@ -159,11 +159,12 @@ import {
|
|
|
159
159
|
runsUnderBars,
|
|
160
160
|
uaPreset,
|
|
161
161
|
userAgentOf
|
|
162
|
-
} from "./index-
|
|
162
|
+
} from "./index-bgzyc7rz.js";
|
|
163
163
|
import {
|
|
164
164
|
BINDING_ICONS,
|
|
165
165
|
KEYS_FIELD,
|
|
166
166
|
ROW_ICONS,
|
|
167
|
+
brand,
|
|
167
168
|
comboLabel,
|
|
168
169
|
comboSpoken,
|
|
169
170
|
comboText,
|
|
@@ -181,8 +182,9 @@ import {
|
|
|
181
182
|
parseCombo,
|
|
182
183
|
rowIcon,
|
|
183
184
|
typeAhead,
|
|
185
|
+
vinenaMark,
|
|
184
186
|
zoomAction
|
|
185
|
-
} from "./index-
|
|
187
|
+
} from "./index-vhda420r.js";
|
|
186
188
|
import {
|
|
187
189
|
BARS,
|
|
188
190
|
BROWSERS,
|
|
@@ -237,21 +239,27 @@ import {
|
|
|
237
239
|
parseColor,
|
|
238
240
|
percent,
|
|
239
241
|
readColor,
|
|
242
|
+
readItem,
|
|
240
243
|
readMessage,
|
|
241
244
|
realNow,
|
|
245
|
+
removeItem,
|
|
242
246
|
resolveGeo,
|
|
243
247
|
rewriteMediaText,
|
|
248
|
+
sameItem,
|
|
244
249
|
setSystemMedia,
|
|
245
250
|
stamped,
|
|
246
251
|
still,
|
|
247
252
|
toHex,
|
|
248
253
|
watchSystemMedia,
|
|
249
|
-
webStorage
|
|
250
|
-
|
|
254
|
+
webStorage,
|
|
255
|
+
writeItem
|
|
256
|
+
} from "./index-311fys81.js";
|
|
251
257
|
import"./index-a974q3aa.js";
|
|
252
258
|
import {
|
|
253
|
-
__require
|
|
254
|
-
|
|
259
|
+
__require,
|
|
260
|
+
markOwn,
|
|
261
|
+
setMark
|
|
262
|
+
} from "./index-3dcgysws.js";
|
|
255
263
|
|
|
256
264
|
// src/ui/knobs.ts
|
|
257
265
|
var MINUTE = 60000;
|
|
@@ -659,7 +667,7 @@ var HEADER = {
|
|
|
659
667
|
category: "location and time",
|
|
660
668
|
control: "switch",
|
|
661
669
|
options: OFF_ON,
|
|
662
|
-
aliases: ["header", "server", "x-devknobs-now", "backend"],
|
|
670
|
+
aliases: ["header", "server", "x-knobs-now", "x-devknobs-now", "backend"],
|
|
663
671
|
read: (state) => flag(state.clock.header),
|
|
664
672
|
write: (value) => ({ clock: { header: value === "on" } }),
|
|
665
673
|
reset: { clock: { header: DEFAULT_STATE.clock.header } },
|
|
@@ -1315,13 +1323,13 @@ var ROWS = [...KNOB_ROWS, ...ACTIONS.map(actionRow)];
|
|
|
1315
1323
|
function knobOf(id) {
|
|
1316
1324
|
const knob = KNOBS.find((entry) => entry.id === id);
|
|
1317
1325
|
if (!knob)
|
|
1318
|
-
throw new Error(`
|
|
1326
|
+
throw new Error(`knobs: no knob ${id}`);
|
|
1319
1327
|
return knob;
|
|
1320
1328
|
}
|
|
1321
1329
|
function rowOf(id) {
|
|
1322
1330
|
const row = KNOB_ROWS.find((entry) => entry.knobs.includes(id));
|
|
1323
1331
|
if (!row)
|
|
1324
|
-
throw new Error(`
|
|
1332
|
+
throw new Error(`knobs: no row for ${id}`);
|
|
1325
1333
|
return row;
|
|
1326
1334
|
}
|
|
1327
1335
|
function availableKnobs() {
|
|
@@ -1440,7 +1448,7 @@ function knobs() {
|
|
|
1440
1448
|
min: CLOCK_SPEED_MIN,
|
|
1441
1449
|
max: CLOCK_SPEED_MAX
|
|
1442
1450
|
}),
|
|
1443
|
-
header: field2("Send the clock's instant to the page's own origin in an x-
|
|
1451
|
+
header: field2("Send the clock's instant to the page's own origin in an x-knobs-now header (and the old x-devknobs-now).", flag2)
|
|
1444
1452
|
}
|
|
1445
1453
|
}),
|
|
1446
1454
|
network: spec("navigator.onLine and navigator.connection. Requests still go out.", {
|
|
@@ -1486,7 +1494,7 @@ function knobs() {
|
|
|
1486
1494
|
}, "frame"),
|
|
1487
1495
|
overflow: spec("Mark the boxes that stick out of the viewport sideways.", flag2),
|
|
1488
1496
|
outlines: spec("Outline every element.", flag2),
|
|
1489
|
-
panel: spec("The
|
|
1497
|
+
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.", {
|
|
1490
1498
|
type: "object",
|
|
1491
1499
|
fields: {
|
|
1492
1500
|
open: field2("The panel is open.", flag2),
|
|
@@ -1560,7 +1568,7 @@ function fits(path, shape, value) {
|
|
|
1560
1568
|
}
|
|
1561
1569
|
function checkPatch(patch) {
|
|
1562
1570
|
if (!isRecord2(patch))
|
|
1563
|
-
throw new TypeError("
|
|
1571
|
+
throw new TypeError("knobs: setState takes an object");
|
|
1564
1572
|
const shapes = new Map(describe().map((knob) => [knob.key, knob.value]));
|
|
1565
1573
|
for (const [key, value] of Object.entries(patch)) {
|
|
1566
1574
|
const shape = shapes.get(key);
|
|
@@ -1588,12 +1596,12 @@ function checkPatch(patch) {
|
|
|
1588
1596
|
function unlisted(path, value) {
|
|
1589
1597
|
const takes = UNLISTED.get(path);
|
|
1590
1598
|
if (!takes)
|
|
1591
|
-
throw new TypeError(`
|
|
1599
|
+
throw new TypeError(`knobs: unknown knob ${path}`);
|
|
1592
1600
|
if (!takes(value))
|
|
1593
1601
|
throw bad(path, value);
|
|
1594
1602
|
}
|
|
1595
1603
|
function bad(path, value) {
|
|
1596
|
-
return new TypeError(`
|
|
1604
|
+
return new TypeError(`knobs: bad value for ${path}: ${shown(value)}`);
|
|
1597
1605
|
}
|
|
1598
1606
|
function shown(value) {
|
|
1599
1607
|
if (typeof value === "number" && !Number.isFinite(value))
|
|
@@ -1723,18 +1731,37 @@ function free(scope, release) {
|
|
|
1723
1731
|
Reflect.deleteProperty(scope, HOST);
|
|
1724
1732
|
}
|
|
1725
1733
|
var PINNED = Symbol.for("devknobs.pinned");
|
|
1734
|
+
var ACCESSOR = Symbol.for("devknobs.accessor");
|
|
1735
|
+
function ourKnobs(scope) {
|
|
1736
|
+
const get = Object.getOwnPropertyDescriptor(scope, "knobs")?.get;
|
|
1737
|
+
return get !== undefined && Reflect.get(get, ACCESSOR) === true ? { api: get() } : null;
|
|
1738
|
+
}
|
|
1726
1739
|
function expose(scope, api) {
|
|
1727
1740
|
Reflect.set(scope, "devknobs", api);
|
|
1741
|
+
if (Object.hasOwn(scope, "knobs") && ourKnobs(scope) === null)
|
|
1742
|
+
return;
|
|
1743
|
+
const get = () => api;
|
|
1744
|
+
Reflect.set(get, ACCESSOR, true);
|
|
1745
|
+
Object.defineProperty(scope, "knobs", {
|
|
1746
|
+
configurable: true,
|
|
1747
|
+
enumerable: true,
|
|
1748
|
+
get,
|
|
1749
|
+
set(value) {
|
|
1750
|
+
Object.defineProperty(scope, "knobs", { value, writable: true, configurable: true, enumerable: true });
|
|
1751
|
+
}
|
|
1752
|
+
});
|
|
1728
1753
|
}
|
|
1729
1754
|
function withdraw(scope, api) {
|
|
1730
1755
|
if (Reflect.get(scope, PINNED) === true)
|
|
1731
1756
|
return;
|
|
1732
1757
|
if (Reflect.get(scope, "devknobs") === api)
|
|
1733
1758
|
Reflect.deleteProperty(scope, "devknobs");
|
|
1759
|
+
if (ourKnobs(scope)?.api === api)
|
|
1760
|
+
Reflect.deleteProperty(scope, "knobs");
|
|
1734
1761
|
}
|
|
1735
1762
|
|
|
1736
1763
|
// src/ui/bindings.ts
|
|
1737
|
-
var KEYS_KEY = "
|
|
1764
|
+
var KEYS_KEY = "knobs:keys";
|
|
1738
1765
|
var KEYS_VERSION = 1;
|
|
1739
1766
|
var BINDINGS = [
|
|
1740
1767
|
"panel",
|
|
@@ -1900,7 +1927,7 @@ function resolveKeys(base, stored, grab = true) {
|
|
|
1900
1927
|
}
|
|
1901
1928
|
function loadKeys() {
|
|
1902
1929
|
try {
|
|
1903
|
-
return readKeys(webStorage("local")
|
|
1930
|
+
return readKeys(readItem(webStorage("local"), KEYS_KEY));
|
|
1904
1931
|
} catch {
|
|
1905
1932
|
return {};
|
|
1906
1933
|
}
|
|
@@ -1908,9 +1935,9 @@ function loadKeys() {
|
|
|
1908
1935
|
function keepKeys(keys) {
|
|
1909
1936
|
try {
|
|
1910
1937
|
if (Object.keys(keys).length === 0)
|
|
1911
|
-
webStorage("local")
|
|
1938
|
+
removeItem(webStorage("local"), KEYS_KEY);
|
|
1912
1939
|
else
|
|
1913
|
-
webStorage("local")
|
|
1940
|
+
writeItem(webStorage("local"), KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
|
|
1914
1941
|
} catch {}
|
|
1915
1942
|
}
|
|
1916
1943
|
function keysListed(keys, listed) {
|
|
@@ -1956,7 +1983,7 @@ function createKeys(options2 = {}) {
|
|
|
1956
1983
|
listener();
|
|
1957
1984
|
}
|
|
1958
1985
|
function onStorage(event) {
|
|
1959
|
-
if (event.key !==
|
|
1986
|
+
if (event.key !== null && !sameItem(event.key, KEYS_KEY))
|
|
1960
1987
|
return;
|
|
1961
1988
|
heard();
|
|
1962
1989
|
}
|
|
@@ -2635,7 +2662,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2635
2662
|
function here(element) {
|
|
2636
2663
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2637
2664
|
}
|
|
2638
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2665
|
+
function createInspector(context, load = () => import("./elementsview-mwr1s17z.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2639
2666
|
const { inspect, tips, prefs } = context;
|
|
2640
2667
|
const listeners = new Set;
|
|
2641
2668
|
let view = null;
|
|
@@ -2823,7 +2850,7 @@ function createInspector(context, load = () => import("./elementsview-dpm0xmb2.j
|
|
|
2823
2850
|
}
|
|
2824
2851
|
|
|
2825
2852
|
// src/ui/colors.ts
|
|
2826
|
-
var COLORS_KEY = "
|
|
2853
|
+
var COLORS_KEY = "knobs:colors";
|
|
2827
2854
|
var COLORS_VERSION = 1;
|
|
2828
2855
|
var MOST_COLORS = 8;
|
|
2829
2856
|
function listOf(value) {
|
|
@@ -2863,7 +2890,7 @@ function pickColor(text, options2, list) {
|
|
|
2863
2890
|
}
|
|
2864
2891
|
function loadColors() {
|
|
2865
2892
|
try {
|
|
2866
|
-
return readColors(webStorage("local")
|
|
2893
|
+
return readColors(readItem(webStorage("local"), COLORS_KEY));
|
|
2867
2894
|
} catch {
|
|
2868
2895
|
return readColors(null);
|
|
2869
2896
|
}
|
|
@@ -2872,9 +2899,9 @@ function keepColors(colors) {
|
|
|
2872
2899
|
try {
|
|
2873
2900
|
const local = webStorage("local");
|
|
2874
2901
|
if (colors.mat.length + colors.grab.length === 0)
|
|
2875
|
-
|
|
2902
|
+
removeItem(local, COLORS_KEY);
|
|
2876
2903
|
else
|
|
2877
|
-
local
|
|
2904
|
+
writeItem(local, COLORS_KEY, colorsText(colors));
|
|
2878
2905
|
} catch {}
|
|
2879
2906
|
}
|
|
2880
2907
|
function createColors() {
|
|
@@ -2885,7 +2912,7 @@ function createColors() {
|
|
|
2885
2912
|
listener();
|
|
2886
2913
|
}
|
|
2887
2914
|
function onStorage(event) {
|
|
2888
|
-
if (event.key !==
|
|
2915
|
+
if (event.key !== null && !sameItem(event.key, COLORS_KEY))
|
|
2889
2916
|
return;
|
|
2890
2917
|
if (fresh())
|
|
2891
2918
|
return;
|
|
@@ -6325,7 +6352,7 @@ function isZero(duration) {
|
|
|
6325
6352
|
}
|
|
6326
6353
|
|
|
6327
6354
|
// src/version.ts
|
|
6328
|
-
var VERSION = "0.
|
|
6355
|
+
var VERSION = "0.7.1";
|
|
6329
6356
|
|
|
6330
6357
|
// src/ui/settings.ts
|
|
6331
6358
|
var NO_KEY = "not set";
|
|
@@ -6363,6 +6390,25 @@ function feedbackRow() {
|
|
|
6363
6390
|
link.addEventListener(type, aim);
|
|
6364
6391
|
return rowBox({ main: link, glyph: icon("message-square"), title: "send feedback" }).box;
|
|
6365
6392
|
}
|
|
6393
|
+
function outLink(className, href) {
|
|
6394
|
+
const link = el("a", className);
|
|
6395
|
+
link.setAttribute("href", href);
|
|
6396
|
+
link.setAttribute("target", "_blank");
|
|
6397
|
+
link.setAttribute("rel", "noopener noreferrer");
|
|
6398
|
+
return link;
|
|
6399
|
+
}
|
|
6400
|
+
var REPO_URL = "https://github.com/vinenastudio/knobs";
|
|
6401
|
+
function githubRow() {
|
|
6402
|
+
return rowBox({ main: outLink("main feedback", REPO_URL), glyph: brand("github"), title: "github" }).box;
|
|
6403
|
+
}
|
|
6404
|
+
function vinenaUrl(host) {
|
|
6405
|
+
return `https://vinena.studio/?utm_source=knobs.dev&utm_medium=referral&utm_campaign=${host ? "extension" : "panel"}`;
|
|
6406
|
+
}
|
|
6407
|
+
function creditRow(host) {
|
|
6408
|
+
const link = outLink("credit", vinenaUrl(host));
|
|
6409
|
+
link.append(el("span", "", "crafted at"), vinenaMark());
|
|
6410
|
+
return link;
|
|
6411
|
+
}
|
|
6366
6412
|
function keepRow(resolve) {
|
|
6367
6413
|
const control = button("switch row-control", "");
|
|
6368
6414
|
control.setAttribute("role", "switch");
|
|
@@ -6521,7 +6567,7 @@ function createSettings(context) {
|
|
|
6521
6567
|
}).box);
|
|
6522
6568
|
keyViews.set(binding, { set: set2, back });
|
|
6523
6569
|
}
|
|
6524
|
-
keysView.append(feedbackRow());
|
|
6570
|
+
keysView.append(feedbackRow(), githubRow(), creditRow(context.host));
|
|
6525
6571
|
let editingKeys = false;
|
|
6526
6572
|
let recording = null;
|
|
6527
6573
|
const { refuse, unrefuse, destroy: stopRefusing } = createRefusal(tips, said);
|
|
@@ -7637,6 +7683,23 @@ input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-
|
|
|
7637
7683
|
.row-key { flex: none; align-self: center; font-size: 10px; line-height: 1.4; color: var(--faint); }
|
|
7638
7684
|
.feedback { color: inherit; text-decoration: none; cursor: pointer; }
|
|
7639
7685
|
.feedback:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
7686
|
+
/* The studio's credit under the settings' rows: its words and its wordmark, as quiet as the footer's text. */
|
|
7687
|
+
.credit {
|
|
7688
|
+
display: flex;
|
|
7689
|
+
align-items: center;
|
|
7690
|
+
justify-content: center;
|
|
7691
|
+
gap: 0.4em;
|
|
7692
|
+
padding: 8px var(--view-end) 4px var(--view-start);
|
|
7693
|
+
font-size: 10px;
|
|
7694
|
+
line-height: 1.4;
|
|
7695
|
+
color: var(--faint);
|
|
7696
|
+
text-decoration: none;
|
|
7697
|
+
white-space: nowrap;
|
|
7698
|
+
border-radius: 8px;
|
|
7699
|
+
}
|
|
7700
|
+
.credit:hover { color: var(--fg); }
|
|
7701
|
+
.credit:focus-visible { color: var(--fg); outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
7702
|
+
.credit .wordmark { flex: none; width: auto; height: 0.85em; }
|
|
7640
7703
|
.row-control { flex: none; align-self: center; margin-left: auto; }
|
|
7641
7704
|
/* A row's small button inside its main, before what the main ends with,
|
|
7642
7705
|
takes no height of its own, so the row is as tall as any. */
|
|
@@ -8819,7 +8882,7 @@ function createPanel(options2 = {}) {
|
|
|
8819
8882
|
const actionsHere = availableActions();
|
|
8820
8883
|
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
|
|
8821
8884
|
const host = document.createElement("div");
|
|
8822
|
-
host
|
|
8885
|
+
markOwn(host, "panel");
|
|
8823
8886
|
host.style.cssText = HOST_STYLE;
|
|
8824
8887
|
const root = host.attachShadow({ mode: "open" });
|
|
8825
8888
|
addStyle(root, HOST_RESET);
|
|
@@ -8838,7 +8901,7 @@ function createPanel(options2 = {}) {
|
|
|
8838
8901
|
searchInput.placeholder = "search knobs";
|
|
8839
8902
|
searchInput.autocomplete = "off";
|
|
8840
8903
|
searchInput.spellcheck = false;
|
|
8841
|
-
searchInput
|
|
8904
|
+
setMark(searchInput, KEYS_FIELD);
|
|
8842
8905
|
searchInput.setAttribute("role", "combobox");
|
|
8843
8906
|
searchInput.setAttribute("aria-label", "find a knob");
|
|
8844
8907
|
searchInput.setAttribute("aria-autocomplete", "list");
|
|
@@ -8901,6 +8964,7 @@ function createPanel(options2 = {}) {
|
|
|
8901
8964
|
},
|
|
8902
8965
|
prefer: options2.prefer ?? null,
|
|
8903
8966
|
setPrefer: (value) => options2.prefer?.change(value),
|
|
8967
|
+
host: options2.host === true,
|
|
8904
8968
|
searching: () => palette.searching(),
|
|
8905
8969
|
leaveSearch: () => palette.leaveSearch()
|
|
8906
8970
|
});
|
|
@@ -9029,7 +9093,7 @@ function createPanel(options2 = {}) {
|
|
|
9029
9093
|
}
|
|
9030
9094
|
function renderKeys() {
|
|
9031
9095
|
const now2 = keys.get();
|
|
9032
|
-
handle.setAttribute("aria-label", `
|
|
9096
|
+
handle.setAttribute("aria-label", `knobs, press ${comboSpoken(now2.panel)}`);
|
|
9033
9097
|
footer.drawKeys(now2);
|
|
9034
9098
|
settings.drawKeys(now2);
|
|
9035
9099
|
knobRows.drawKeys(now2);
|
|
@@ -9439,7 +9503,8 @@ function attach(options2) {
|
|
|
9439
9503
|
grab: grabControl,
|
|
9440
9504
|
inspect,
|
|
9441
9505
|
handle: options2.handle,
|
|
9442
|
-
prefer: panelPrefer(options2)
|
|
9506
|
+
prefer: panelPrefer(options2),
|
|
9507
|
+
host: options2.host === true
|
|
9443
9508
|
});
|
|
9444
9509
|
}
|
|
9445
9510
|
function panelPrefer(options2) {
|
|
@@ -9606,7 +9671,7 @@ function retake(options2, native) {
|
|
|
9606
9671
|
}
|
|
9607
9672
|
if (retaken++ >= RETAKES) {
|
|
9608
9673
|
if (retaken === RETAKES + 1) {
|
|
9609
|
-
console.warn("
|
|
9674
|
+
console.warn("knobs: this page runs its own copy of knobs, which does not know hosts; it keeps the page");
|
|
9610
9675
|
}
|
|
9611
9676
|
return;
|
|
9612
9677
|
}
|
|
@@ -9650,7 +9715,7 @@ async function grab(elements, options2) {
|
|
|
9650
9715
|
const host = hosted("grab");
|
|
9651
9716
|
if (host)
|
|
9652
9717
|
return host(elements, options2);
|
|
9653
|
-
const loaded = await import("./index-
|
|
9718
|
+
const loaded = await import("./index-c1t6knbf.js");
|
|
9654
9719
|
return loaded.grab(elements, options2);
|
|
9655
9720
|
}
|
|
9656
9721
|
function edits2() {
|
|
@@ -9661,8 +9726,8 @@ async function setEdits(list) {
|
|
|
9661
9726
|
if (host)
|
|
9662
9727
|
return host(list);
|
|
9663
9728
|
if (!Array.isArray(list))
|
|
9664
|
-
throw new TypeError("
|
|
9665
|
-
const { replayEdits } = await import("./replay-
|
|
9729
|
+
throw new TypeError("knobs: setEdits takes a list of edits, as edits() gives them");
|
|
9730
|
+
const { replayEdits } = await import("./replay-3xqgt3xg.js");
|
|
9666
9731
|
const { applied, skipped } = replayEdits(edits, list);
|
|
9667
9732
|
return { applied, skipped };
|
|
9668
9733
|
}
|
package/dist/instance.d.ts
CHANGED
|
@@ -40,7 +40,13 @@ export declare function owned(scope: object): boolean;
|
|
|
40
40
|
export declare function superseded(scope: object, release: () => void): boolean;
|
|
41
41
|
/** Let the page go, if `release` still holds it. */
|
|
42
42
|
export declare function free(scope: object, release: () => void): void;
|
|
43
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Hand the page's agents the api, at `window.knobs` and `window.devknobs`.
|
|
45
|
+
* `knobs` is a common name: where the page has one of its own, it keeps it,
|
|
46
|
+
* and where it sets one later, it takes the name over. Only the window's own
|
|
47
|
+
* `knobs` counts: a `var`, a `function` or a `window.knobs =`. An element with
|
|
48
|
+
* `id="knobs"` sits on the window's prototype chain, so the api goes over it.
|
|
49
|
+
*/
|
|
44
50
|
export declare function expose(scope: object, api: object): void;
|
|
45
51
|
/** Keep the api on the page after unmount, as the script tag build does, so it can mount again. */
|
|
46
52
|
export declare function pin(scope: object): void;
|
package/dist/mark.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The attributes knobs puts on the page's nodes, under the new name,
|
|
3
|
+
* `data-knobs…`, and the old one, `data-devknobs…`, until 1.0. A copy of an
|
|
4
|
+
* older version on the same page (the extension's, the page's own, the one in
|
|
5
|
+
* the frame) writes and reads only the old names, so every copy writes both
|
|
6
|
+
* and reads either. Each attribute goes by its old name here. Hide is the one
|
|
7
|
+
* exception: it is matched and read by the old name only (see `HIDE_ATTRIBUTE`).
|
|
8
|
+
*/
|
|
9
|
+
/** Every attribute knobs puts on the page, by its old name. */
|
|
10
|
+
export declare const ATTRIBUTES: {
|
|
11
|
+
/** The mark on every node knobs adds to the page, its value what the node is. */
|
|
12
|
+
readonly mark: "data-devknobs";
|
|
13
|
+
readonly frame: "data-devknobs-frame";
|
|
14
|
+
readonly force: "data-devknobs-force";
|
|
15
|
+
readonly hide: "data-devknobs-hide";
|
|
16
|
+
readonly replay: "data-devknobs-replay";
|
|
17
|
+
readonly href: "data-devknobs-href";
|
|
18
|
+
readonly icon: "data-devknobs-icon";
|
|
19
|
+
readonly keys: "data-devknobs-keys";
|
|
20
|
+
readonly fresh: "data-devknobs-fresh";
|
|
21
|
+
readonly early: "data-devknobs-early";
|
|
22
|
+
};
|
|
23
|
+
/** One of knobs' attributes, by its old name. */
|
|
24
|
+
export type OwnName = (typeof ATTRIBUTES)[keyof typeof ATTRIBUTES];
|
|
25
|
+
export declare const OLD_MARK: "data-devknobs";
|
|
26
|
+
export declare const MARK = "data-knobs";
|
|
27
|
+
/** The new name of an attribute, from its old one. */
|
|
28
|
+
export declare function newName(old: OwnName): string;
|
|
29
|
+
/** Whether an attribute is one knobs puts on the page: any of the old prefix, only knobs' own of the new. */
|
|
30
|
+
export declare function isOwnName(name: string): boolean;
|
|
31
|
+
/** Sets the attribute under both names. */
|
|
32
|
+
export declare function setMark(element: Element, old: OwnName, value?: string): void;
|
|
33
|
+
/** Takes the attribute off under both names. */
|
|
34
|
+
export declare function removeMark(element: Element, old: OwnName): void;
|
|
35
|
+
/** Whether the element has the attribute under either name. */
|
|
36
|
+
export declare function hasMark(element: Element, old: OwnName): boolean;
|
|
37
|
+
/** The attribute's value under the new name, else under the old one. */
|
|
38
|
+
export declare function getMark(element: Element, old: OwnName): string | null;
|
|
39
|
+
/** A selector list for the attribute under either name, `rest` after each, as `="panel"]` or `] *`. */
|
|
40
|
+
export declare function either(old: OwnName, rest?: string): string;
|
|
41
|
+
/** Marks a node as knobs' own, `value` what it is. */
|
|
42
|
+
export declare function markOwn(element: Element, value?: string): void;
|
|
43
|
+
/** Whether a node is knobs' own. */
|
|
44
|
+
export declare function isMarked(element: Element): boolean;
|
|
45
|
+
/** A selector list for knobs' own nodes, or those of them whose mark is `value`. */
|
|
46
|
+
export declare function ownSelector(value?: string): string;
|
|
47
|
+
/** The first of knobs' own nodes under `root` whose mark is `value`, of the `tag` given: by the new name, else the old one. */
|
|
48
|
+
export declare function findOwn<T extends Element = Element>(root: ParentNode, value: string, tag?: string): T | null;
|
|
49
|
+
/** A selector list for knobs' own nodes and all in them. */
|
|
50
|
+
export declare const OWN_AND_IN: string;
|
|
@@ -6,32 +6,41 @@ import {
|
|
|
6
6
|
riskyElement,
|
|
7
7
|
specificity,
|
|
8
8
|
splitList
|
|
9
|
-
} from "./react-
|
|
9
|
+
} from "./react-w94cfn87.js";
|
|
10
10
|
import {
|
|
11
11
|
middle
|
|
12
|
-
} from "./react-
|
|
12
|
+
} from "./react-4tcwpama.js";
|
|
13
13
|
import {
|
|
14
14
|
NEW_RULE_SHEET,
|
|
15
15
|
isNewRuleSheet,
|
|
16
16
|
isShadowRoot,
|
|
17
17
|
label
|
|
18
|
-
} from "./react-
|
|
18
|
+
} from "./react-dg4bjv3j.js";
|
|
19
19
|
import {
|
|
20
20
|
actButton,
|
|
21
21
|
el
|
|
22
|
-
} from "./react-
|
|
22
|
+
} from "./react-rxw73n04.js";
|
|
23
23
|
import {
|
|
24
24
|
icon,
|
|
25
25
|
isDevknobs,
|
|
26
26
|
typesInField
|
|
27
|
-
} from "./react-
|
|
27
|
+
} from "./react-hdneb4v3.js";
|
|
28
28
|
import {
|
|
29
29
|
addStyle,
|
|
30
30
|
authoredQuery,
|
|
31
31
|
ensureStyle,
|
|
32
32
|
isDocument,
|
|
33
33
|
isOwnSheet
|
|
34
|
-
} from "./react-
|
|
34
|
+
} from "./react-rbmk30xk.js";
|
|
35
|
+
import {
|
|
36
|
+
ATTRIBUTES,
|
|
37
|
+
isMarked,
|
|
38
|
+
isOwnName,
|
|
39
|
+
newName,
|
|
40
|
+
ownSelector,
|
|
41
|
+
removeMark,
|
|
42
|
+
setMark
|
|
43
|
+
} from "./react-4qn9vsjw.js";
|
|
35
44
|
|
|
36
45
|
// src/styles/collect.ts
|
|
37
46
|
function isKind(rule, kind) {
|
|
@@ -278,7 +287,7 @@ function layerRanks(marks, holds) {
|
|
|
278
287
|
}
|
|
279
288
|
|
|
280
289
|
// src/edit/html.ts
|
|
281
|
-
var HIDE_ATTRIBUTE =
|
|
290
|
+
var HIDE_ATTRIBUTE = ATTRIBUTES.hide;
|
|
282
291
|
var HIDE_CSS = `[${HIDE_ATTRIBUTE}], [${HIDE_ATTRIBUTE}] * { visibility: hidden !important; }`;
|
|
283
292
|
var HTML = "http://www.w3.org/1999/xhtml";
|
|
284
293
|
var successors = new WeakMap;
|
|
@@ -304,9 +313,6 @@ function isElement(node) {
|
|
|
304
313
|
function isShadowRoot2(node) {
|
|
305
314
|
return node.nodeType === 11 && "host" in node;
|
|
306
315
|
}
|
|
307
|
-
function isOwnName(name) {
|
|
308
|
-
return name.toLowerCase().startsWith("data-devknobs");
|
|
309
|
-
}
|
|
310
316
|
function ends(text) {
|
|
311
317
|
const lead = /^\s*/.exec(text)?.[0] ?? "";
|
|
312
318
|
const trail = lead.length === text.length ? "" : /\s*$/.exec(text)?.[0] ?? "";
|
|
@@ -429,9 +435,9 @@ function hideEdit(target, element, style = hideStyle) {
|
|
|
429
435
|
const hidden = element.hasAttribute(HIDE_ATTRIBUTE);
|
|
430
436
|
const set = (on) => {
|
|
431
437
|
if (on)
|
|
432
|
-
element
|
|
438
|
+
setMark(element, HIDE_ATTRIBUTE);
|
|
433
439
|
else
|
|
434
|
-
element
|
|
440
|
+
removeMark(element, HIDE_ATTRIBUTE);
|
|
435
441
|
};
|
|
436
442
|
return {
|
|
437
443
|
edit: { kind: "hide", target: { ...target }, property: "hidden", before: hidden ? "hidden" : null, after: hidden ? null : "hidden" },
|
|
@@ -482,7 +488,7 @@ function deleteEdit(target, node, before, property = "node") {
|
|
|
482
488
|
};
|
|
483
489
|
}
|
|
484
490
|
function isOwnElement(node) {
|
|
485
|
-
return isElement(node) && node
|
|
491
|
+
return isElement(node) && isMarked(node);
|
|
486
492
|
}
|
|
487
493
|
function nextElementOf(node) {
|
|
488
494
|
for (let at = node.nextSibling;at; at = at.nextSibling)
|
|
@@ -512,7 +518,7 @@ function movable(node) {
|
|
|
512
518
|
return false;
|
|
513
519
|
if (riskyElement(node) || Array.from(node.querySelectorAll("*")).some(riskyElement))
|
|
514
520
|
return false;
|
|
515
|
-
return node.querySelector(
|
|
521
|
+
return node.querySelector(ownSelector()) === null;
|
|
516
522
|
}
|
|
517
523
|
var EMPTY = new Set([
|
|
518
524
|
...["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr", "template"],
|
|
@@ -659,10 +665,10 @@ function isDocument2(node) {
|
|
|
659
665
|
return node.nodeType === DOCUMENT;
|
|
660
666
|
}
|
|
661
667
|
function isOwnNode(node) {
|
|
662
|
-
return isElement2(node) && node
|
|
668
|
+
return isElement2(node) && isMarked(node);
|
|
663
669
|
}
|
|
664
670
|
function isOwnAttribute(name) {
|
|
665
|
-
return name
|
|
671
|
+
return isOwnName(name);
|
|
666
672
|
}
|
|
667
673
|
function parentOf(node) {
|
|
668
674
|
if (isShadowRoot3(node))
|
|
@@ -981,7 +987,7 @@ function markupOf(node) {
|
|
|
981
987
|
const copy = node.cloneNode(true);
|
|
982
988
|
if (!isElement2(copy))
|
|
983
989
|
return "";
|
|
984
|
-
for (const own of Array.from(copy.querySelectorAll(
|
|
990
|
+
for (const own of Array.from(copy.querySelectorAll(ownSelector())))
|
|
985
991
|
own.remove();
|
|
986
992
|
for (const one of [copy, ...Array.from(copy.querySelectorAll("*"))]) {
|
|
987
993
|
for (const attr of Array.from(one.attributes))
|
|
@@ -1416,7 +1422,7 @@ function createDomTree(context, model = createTreeModel()) {
|
|
|
1416
1422
|
any = true;
|
|
1417
1423
|
} else if (record.type === "attributes") {
|
|
1418
1424
|
const name = record.attributeName ?? "";
|
|
1419
|
-
if (name === HIDE_ATTRIBUTE) {
|
|
1425
|
+
if (name === HIDE_ATTRIBUTE || name === newName(HIDE_ATTRIBUTE)) {
|
|
1420
1426
|
drop(target);
|
|
1421
1427
|
any = true;
|
|
1422
1428
|
continue;
|