@vinena/knobs 0.7.0 → 0.7.2
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 +23 -0
- package/README.md +2 -2
- package/dist/cli.js +2 -2
- 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 +1 -1
- package/dist/{elementsview-m33ejs4r.js → elementsview-1bar694x.js} +21 -19
- package/dist/{elementsview-jg4edt86.js → elementsview-p2wc9b0s.js} +21 -19
- package/dist/engine/bandmedia.d.ts +119 -0
- package/dist/engine/bezels.d.ts +2 -2
- package/dist/engine/browserui.d.ts +3 -1
- 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/pageshot.d.ts +24 -4
- package/dist/engine/placeholder.d.ts +3 -3
- package/dist/engine/reload.d.ts +2 -2
- package/dist/engine/safaridraw.d.ts +24 -3
- 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/underbar.d.ts +26 -7
- package/dist/engine/underneath.d.ts +1 -0
- package/dist/engine/width.d.ts +3 -3
- package/dist/{framekit-r16k97n7.js → framekit-n57ts9zt.js} +959 -87
- package/dist/{framekit-40pzennw.js → framekit-wqp811a2.js} +959 -87
- 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-ztnjefrh.js → index-585hs9tp.js} +5 -1
- package/dist/{index-za4ppxay.js → index-6t0w5s7p.js} +1 -1
- package/dist/{index-tqq2ygpj.js → index-9targr2f.js} +26 -16
- package/dist/{index-t4kssacm.js → index-abwqw8jh.js} +6 -1
- package/dist/{index-s6yzsvs4.js → index-b8cnnbpr.js} +25 -18
- package/dist/{index-xxbb8y41.js → index-cfrnrg24.js} +20 -14
- package/dist/{index-v2v4rmpe.js → index-dvtbh3c8.js} +24 -18
- package/dist/{index-0qkj2mgb.js → index-j8hrzag1.js} +14 -11
- package/dist/{index-cb91vcka.js → index-k4w5v53q.js} +1 -1
- package/dist/{index-q53j8wg5.js → index-n31pn4ax.js} +19 -15
- package/dist/{index-s6fya8pm.js → index-pvknvvkw.js} +11 -10
- package/dist/{index-3nwycv3p.js → index-qz04adp5.js} +20 -14
- package/dist/{index-ymqm185m.js → index-rps0bdq9.js} +1 -1
- package/dist/{index-a8ffw5ft.js → index-szd9bddn.js} +1 -1
- package/dist/{index-8d1yk9d2.js → index-t7a07nm9.js} +59 -39
- package/dist/{index-2jc9dnta.js → index-vhda420r.js} +11 -5
- package/dist/{index-xs29b55n.js → index-vmprrfwe.js} +5 -2
- package/dist/{index-fjrrgd9h.js → index-vmz7htwn.js} +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.global.js +182 -165
- package/dist/index.js +57 -32
- package/dist/instance.d.ts +7 -1
- package/dist/mark.d.ts +50 -0
- package/dist/{react-vvc4x9kq.js → react-0tbd51s3.js} +14 -11
- package/dist/{react-0gxs9aef.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-6ngtb6p9.js → react-7eyps0cg.js} +1 -1
- package/dist/{react-zp7fdw8e.js → react-881wvm1z.js} +59 -39
- 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-meve34wp.js → react-hdneb4v3.js} +11 -5
- package/dist/{react-h9w04skh.js → react-j87bdhhe.js} +4 -1
- package/dist/{react-wtgvkf6g.js → react-mkafgzqf.js} +1 -1
- package/dist/{react-fq4551ks.js → react-pf7fc2f3.js} +11 -10
- package/dist/{react-0r5418av.js → react-rbmk30xk.js} +92 -29
- package/dist/{react-actmnkwp.js → react-rxw73n04.js} +1 -1
- package/dist/{react-8nmtt0ge.js → react-w94cfn87.js} +19 -15
- package/dist/{react-3ev6rwqz.js → react-x209et38.js} +26 -16
- package/dist/{react-5h7pxnax.js → react-zj0dbpdg.js} +25 -18
- package/dist/react.d.ts +3 -1
- package/dist/react.js +60 -33
- package/dist/{replay-pmesjfa3.js → replay-3xqgt3xg.js} +8 -8
- package/dist/{replay-m5g8km9y.js → replay-48gn27bj.js} +8 -8
- package/dist/storage/onload.d.ts +1 -1
- package/dist/{storageview-9a6zm47z.js → storageview-5tvmca8y.js} +16 -13
- package/dist/{storageview-x62v1c3j.js → storageview-ec52x60p.js} +16 -13
- 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/keys.d.ts +1 -1
- package/dist/ui/list.d.ts +10 -10
- package/dist/ui/palette.d.ts +2 -2
- 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/storageview.d.ts +2 -2
- package/dist/ui/stylesview.d.ts +3 -3
- package/dist/ui/swatches.d.ts +2 -2
- package/package.json +2 -1
- package/skills/knobs/SKILL.md +36 -35
- 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-pvknvvkw.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-j8hrzag1.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-t7a07nm9.js";
|
|
148
148
|
import {
|
|
149
149
|
MAT_COLORS,
|
|
150
150
|
MAT_COLOR_NAMES,
|
|
@@ -159,7 +159,7 @@ import {
|
|
|
159
159
|
runsUnderBars,
|
|
160
160
|
uaPreset,
|
|
161
161
|
userAgentOf
|
|
162
|
-
} from "./index-
|
|
162
|
+
} from "./index-b8cnnbpr.js";
|
|
163
163
|
import {
|
|
164
164
|
BINDING_ICONS,
|
|
165
165
|
KEYS_FIELD,
|
|
@@ -184,7 +184,7 @@ import {
|
|
|
184
184
|
typeAhead,
|
|
185
185
|
vinenaMark,
|
|
186
186
|
zoomAction
|
|
187
|
-
} from "./index-
|
|
187
|
+
} from "./index-vhda420r.js";
|
|
188
188
|
import {
|
|
189
189
|
BARS,
|
|
190
190
|
BROWSERS,
|
|
@@ -239,21 +239,27 @@ import {
|
|
|
239
239
|
parseColor,
|
|
240
240
|
percent,
|
|
241
241
|
readColor,
|
|
242
|
+
readItem,
|
|
242
243
|
readMessage,
|
|
243
244
|
realNow,
|
|
245
|
+
removeItem,
|
|
244
246
|
resolveGeo,
|
|
245
247
|
rewriteMediaText,
|
|
248
|
+
sameItem,
|
|
246
249
|
setSystemMedia,
|
|
247
250
|
stamped,
|
|
248
251
|
still,
|
|
249
252
|
toHex,
|
|
250
253
|
watchSystemMedia,
|
|
251
|
-
webStorage
|
|
252
|
-
|
|
254
|
+
webStorage,
|
|
255
|
+
writeItem
|
|
256
|
+
} from "./index-311fys81.js";
|
|
253
257
|
import"./index-a974q3aa.js";
|
|
254
258
|
import {
|
|
255
|
-
__require
|
|
256
|
-
|
|
259
|
+
__require,
|
|
260
|
+
markOwn,
|
|
261
|
+
setMark
|
|
262
|
+
} from "./index-3dcgysws.js";
|
|
257
263
|
|
|
258
264
|
// src/ui/knobs.ts
|
|
259
265
|
var MINUTE = 60000;
|
|
@@ -661,7 +667,7 @@ var HEADER = {
|
|
|
661
667
|
category: "location and time",
|
|
662
668
|
control: "switch",
|
|
663
669
|
options: OFF_ON,
|
|
664
|
-
aliases: ["header", "server", "x-devknobs-now", "backend"],
|
|
670
|
+
aliases: ["header", "server", "x-knobs-now", "x-devknobs-now", "backend"],
|
|
665
671
|
read: (state) => flag(state.clock.header),
|
|
666
672
|
write: (value) => ({ clock: { header: value === "on" } }),
|
|
667
673
|
reset: { clock: { header: DEFAULT_STATE.clock.header } },
|
|
@@ -1442,7 +1448,7 @@ function knobs() {
|
|
|
1442
1448
|
min: CLOCK_SPEED_MIN,
|
|
1443
1449
|
max: CLOCK_SPEED_MAX
|
|
1444
1450
|
}),
|
|
1445
|
-
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)
|
|
1446
1452
|
}
|
|
1447
1453
|
}),
|
|
1448
1454
|
network: spec("navigator.onLine and navigator.connection. Requests still go out.", {
|
|
@@ -1725,18 +1731,37 @@ function free(scope, release) {
|
|
|
1725
1731
|
Reflect.deleteProperty(scope, HOST);
|
|
1726
1732
|
}
|
|
1727
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
|
+
}
|
|
1728
1739
|
function expose(scope, api) {
|
|
1729
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
|
+
});
|
|
1730
1753
|
}
|
|
1731
1754
|
function withdraw(scope, api) {
|
|
1732
1755
|
if (Reflect.get(scope, PINNED) === true)
|
|
1733
1756
|
return;
|
|
1734
1757
|
if (Reflect.get(scope, "devknobs") === api)
|
|
1735
1758
|
Reflect.deleteProperty(scope, "devknobs");
|
|
1759
|
+
if (ourKnobs(scope)?.api === api)
|
|
1760
|
+
Reflect.deleteProperty(scope, "knobs");
|
|
1736
1761
|
}
|
|
1737
1762
|
|
|
1738
1763
|
// src/ui/bindings.ts
|
|
1739
|
-
var KEYS_KEY = "
|
|
1764
|
+
var KEYS_KEY = "knobs:keys";
|
|
1740
1765
|
var KEYS_VERSION = 1;
|
|
1741
1766
|
var BINDINGS = [
|
|
1742
1767
|
"panel",
|
|
@@ -1902,7 +1927,7 @@ function resolveKeys(base, stored, grab = true) {
|
|
|
1902
1927
|
}
|
|
1903
1928
|
function loadKeys() {
|
|
1904
1929
|
try {
|
|
1905
|
-
return readKeys(webStorage("local")
|
|
1930
|
+
return readKeys(readItem(webStorage("local"), KEYS_KEY));
|
|
1906
1931
|
} catch {
|
|
1907
1932
|
return {};
|
|
1908
1933
|
}
|
|
@@ -1910,9 +1935,9 @@ function loadKeys() {
|
|
|
1910
1935
|
function keepKeys(keys) {
|
|
1911
1936
|
try {
|
|
1912
1937
|
if (Object.keys(keys).length === 0)
|
|
1913
|
-
webStorage("local")
|
|
1938
|
+
removeItem(webStorage("local"), KEYS_KEY);
|
|
1914
1939
|
else
|
|
1915
|
-
webStorage("local")
|
|
1940
|
+
writeItem(webStorage("local"), KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
|
|
1916
1941
|
} catch {}
|
|
1917
1942
|
}
|
|
1918
1943
|
function keysListed(keys, listed) {
|
|
@@ -1958,7 +1983,7 @@ function createKeys(options2 = {}) {
|
|
|
1958
1983
|
listener();
|
|
1959
1984
|
}
|
|
1960
1985
|
function onStorage(event) {
|
|
1961
|
-
if (event.key !==
|
|
1986
|
+
if (event.key !== null && !sameItem(event.key, KEYS_KEY))
|
|
1962
1987
|
return;
|
|
1963
1988
|
heard();
|
|
1964
1989
|
}
|
|
@@ -2637,7 +2662,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2637
2662
|
function here(element) {
|
|
2638
2663
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2639
2664
|
}
|
|
2640
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2665
|
+
function createInspector(context, load = () => import("./elementsview-p2wc9b0s.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2641
2666
|
const { inspect, tips, prefs } = context;
|
|
2642
2667
|
const listeners = new Set;
|
|
2643
2668
|
let view = null;
|
|
@@ -2825,7 +2850,7 @@ function createInspector(context, load = () => import("./elementsview-jg4edt86.j
|
|
|
2825
2850
|
}
|
|
2826
2851
|
|
|
2827
2852
|
// src/ui/colors.ts
|
|
2828
|
-
var COLORS_KEY = "
|
|
2853
|
+
var COLORS_KEY = "knobs:colors";
|
|
2829
2854
|
var COLORS_VERSION = 1;
|
|
2830
2855
|
var MOST_COLORS = 8;
|
|
2831
2856
|
function listOf(value) {
|
|
@@ -2865,7 +2890,7 @@ function pickColor(text, options2, list) {
|
|
|
2865
2890
|
}
|
|
2866
2891
|
function loadColors() {
|
|
2867
2892
|
try {
|
|
2868
|
-
return readColors(webStorage("local")
|
|
2893
|
+
return readColors(readItem(webStorage("local"), COLORS_KEY));
|
|
2869
2894
|
} catch {
|
|
2870
2895
|
return readColors(null);
|
|
2871
2896
|
}
|
|
@@ -2874,9 +2899,9 @@ function keepColors(colors) {
|
|
|
2874
2899
|
try {
|
|
2875
2900
|
const local = webStorage("local");
|
|
2876
2901
|
if (colors.mat.length + colors.grab.length === 0)
|
|
2877
|
-
|
|
2902
|
+
removeItem(local, COLORS_KEY);
|
|
2878
2903
|
else
|
|
2879
|
-
local
|
|
2904
|
+
writeItem(local, COLORS_KEY, colorsText(colors));
|
|
2880
2905
|
} catch {}
|
|
2881
2906
|
}
|
|
2882
2907
|
function createColors() {
|
|
@@ -2887,7 +2912,7 @@ function createColors() {
|
|
|
2887
2912
|
listener();
|
|
2888
2913
|
}
|
|
2889
2914
|
function onStorage(event) {
|
|
2890
|
-
if (event.key !==
|
|
2915
|
+
if (event.key !== null && !sameItem(event.key, COLORS_KEY))
|
|
2891
2916
|
return;
|
|
2892
2917
|
if (fresh())
|
|
2893
2918
|
return;
|
|
@@ -6327,7 +6352,7 @@ function isZero(duration) {
|
|
|
6327
6352
|
}
|
|
6328
6353
|
|
|
6329
6354
|
// src/version.ts
|
|
6330
|
-
var VERSION = "0.7.
|
|
6355
|
+
var VERSION = "0.7.2";
|
|
6331
6356
|
|
|
6332
6357
|
// src/ui/settings.ts
|
|
6333
6358
|
var NO_KEY = "not set";
|
|
@@ -8857,7 +8882,7 @@ function createPanel(options2 = {}) {
|
|
|
8857
8882
|
const actionsHere = availableActions();
|
|
8858
8883
|
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
|
|
8859
8884
|
const host = document.createElement("div");
|
|
8860
|
-
host
|
|
8885
|
+
markOwn(host, "panel");
|
|
8861
8886
|
host.style.cssText = HOST_STYLE;
|
|
8862
8887
|
const root = host.attachShadow({ mode: "open" });
|
|
8863
8888
|
addStyle(root, HOST_RESET);
|
|
@@ -8876,7 +8901,7 @@ function createPanel(options2 = {}) {
|
|
|
8876
8901
|
searchInput.placeholder = "search knobs";
|
|
8877
8902
|
searchInput.autocomplete = "off";
|
|
8878
8903
|
searchInput.spellcheck = false;
|
|
8879
|
-
searchInput
|
|
8904
|
+
setMark(searchInput, KEYS_FIELD);
|
|
8880
8905
|
searchInput.setAttribute("role", "combobox");
|
|
8881
8906
|
searchInput.setAttribute("aria-label", "find a knob");
|
|
8882
8907
|
searchInput.setAttribute("aria-autocomplete", "list");
|
|
@@ -9690,7 +9715,7 @@ async function grab(elements, options2) {
|
|
|
9690
9715
|
const host = hosted("grab");
|
|
9691
9716
|
if (host)
|
|
9692
9717
|
return host(elements, options2);
|
|
9693
|
-
const loaded = await import("./index-
|
|
9718
|
+
const loaded = await import("./index-cfrnrg24.js");
|
|
9694
9719
|
return loaded.grab(elements, options2);
|
|
9695
9720
|
}
|
|
9696
9721
|
function edits2() {
|
|
@@ -9702,7 +9727,7 @@ async function setEdits(list) {
|
|
|
9702
9727
|
return host(list);
|
|
9703
9728
|
if (!Array.isArray(list))
|
|
9704
9729
|
throw new TypeError("knobs: setEdits takes a list of edits, as edits() gives them");
|
|
9705
|
-
const { replayEdits } = await import("./replay-
|
|
9730
|
+
const { replayEdits } = await import("./replay-3xqgt3xg.js");
|
|
9706
9731
|
const { applied, skipped } = replayEdits(edits, list);
|
|
9707
9732
|
return { applied, skipped };
|
|
9708
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;
|
|
@@ -5,21 +5,24 @@ import {
|
|
|
5
5
|
lay,
|
|
6
6
|
rowBox,
|
|
7
7
|
rowButton
|
|
8
|
-
} from "./react-
|
|
8
|
+
} from "./react-rxw73n04.js";
|
|
9
9
|
import {
|
|
10
10
|
getState
|
|
11
|
-
} from "./react-
|
|
11
|
+
} from "./react-881wvm1z.js";
|
|
12
12
|
import {
|
|
13
13
|
icon
|
|
14
|
-
} from "./react-
|
|
14
|
+
} from "./react-hdneb4v3.js";
|
|
15
15
|
import {
|
|
16
16
|
isDevknobsFrame,
|
|
17
|
+
isOwnKey,
|
|
17
18
|
newer,
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
readItem,
|
|
20
|
+
webStorage,
|
|
21
|
+
writeItem
|
|
22
|
+
} from "./react-rbmk30xk.js";
|
|
20
23
|
import {
|
|
21
24
|
__require
|
|
22
|
-
} from "./react-
|
|
25
|
+
} from "./react-4qn9vsjw.js";
|
|
23
26
|
|
|
24
27
|
// src/ui/pane.ts
|
|
25
28
|
var listeners = new Set;
|
|
@@ -210,7 +213,7 @@ function createPane(context) {
|
|
|
210
213
|
// src/ui/storageaction.ts
|
|
211
214
|
var STORAGE_VIEW = "storage";
|
|
212
215
|
function load() {
|
|
213
|
-
return import("./storageview-
|
|
216
|
+
return import("./storageview-5tvmca8y.js").then((loaded) => loaded.storageView({
|
|
214
217
|
visible: () => getState().panel.open && !document.hidden
|
|
215
218
|
}));
|
|
216
219
|
}
|
|
@@ -244,7 +247,7 @@ function createStorageControl(loadView = load) {
|
|
|
244
247
|
}
|
|
245
248
|
|
|
246
249
|
// src/storage/onload.ts
|
|
247
|
-
var PRESETS_KEY = "
|
|
250
|
+
var PRESETS_KEY = "knobs:storage-presets";
|
|
248
251
|
var PRESETS_VERSION = 1;
|
|
249
252
|
var DONE = Symbol.for("devknobs.presets");
|
|
250
253
|
function fields(value) {
|
|
@@ -255,7 +258,7 @@ function list(value) {
|
|
|
255
258
|
}
|
|
256
259
|
function storedPresets() {
|
|
257
260
|
try {
|
|
258
|
-
const raw = JSON.parse(webStorage("local")
|
|
261
|
+
const raw = JSON.parse(readItem(webStorage("local"), PRESETS_KEY) ?? "null");
|
|
259
262
|
return newer(raw, PRESETS_VERSION) ? [] : list(fields(raw).presets);
|
|
260
263
|
} catch {
|
|
261
264
|
return [];
|
|
@@ -280,7 +283,7 @@ function empty(storage) {
|
|
|
280
283
|
const keys = [];
|
|
281
284
|
for (let index = 0;index < storage.length; index++) {
|
|
282
285
|
const key = storage.key(index);
|
|
283
|
-
if (key !== null &&
|
|
286
|
+
if (key !== null && !isOwnKey(key))
|
|
284
287
|
keys.push(key);
|
|
285
288
|
}
|
|
286
289
|
for (const key of keys)
|
|
@@ -352,7 +355,7 @@ function stopOnLoad() {
|
|
|
352
355
|
const presets = storedPresets();
|
|
353
356
|
if (presets.some((preset) => preset.onLoad === true)) {
|
|
354
357
|
const off = presets.map((preset) => ({ ...preset, onLoad: false }));
|
|
355
|
-
webStorage("local")
|
|
358
|
+
writeItem(webStorage("local"), PRESETS_KEY, JSON.stringify({ v: PRESETS_VERSION, presets: off }));
|
|
356
359
|
}
|
|
357
360
|
} catch {}
|
|
358
361
|
forgetApplied();
|
|
@@ -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;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
17
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
18
|
+
}) : x)(function(x) {
|
|
19
|
+
if (typeof require !== "undefined")
|
|
20
|
+
return require.apply(this, arguments);
|
|
21
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// src/mark.ts
|
|
25
|
+
var ATTRIBUTES = {
|
|
26
|
+
mark: "data-devknobs",
|
|
27
|
+
frame: "data-devknobs-frame",
|
|
28
|
+
force: "data-devknobs-force",
|
|
29
|
+
hide: "data-devknobs-hide",
|
|
30
|
+
replay: "data-devknobs-replay",
|
|
31
|
+
href: "data-devknobs-href",
|
|
32
|
+
icon: "data-devknobs-icon",
|
|
33
|
+
keys: "data-devknobs-keys",
|
|
34
|
+
fresh: "data-devknobs-fresh",
|
|
35
|
+
early: "data-devknobs-early"
|
|
36
|
+
};
|
|
37
|
+
var OLD_MARK = ATTRIBUTES.mark;
|
|
38
|
+
var MARK = "data-knobs";
|
|
39
|
+
function newName(old) {
|
|
40
|
+
return `${MARK}${old.slice(OLD_MARK.length)}`;
|
|
41
|
+
}
|
|
42
|
+
var NAMES = new Set(Object.values(ATTRIBUTES).map(newName));
|
|
43
|
+
function isOwnName(name) {
|
|
44
|
+
const lower = name.toLowerCase();
|
|
45
|
+
return lower.startsWith(OLD_MARK) || NAMES.has(lower);
|
|
46
|
+
}
|
|
47
|
+
function setMark(element, old, value = "") {
|
|
48
|
+
element.setAttribute(newName(old), value);
|
|
49
|
+
element.setAttribute(old, value);
|
|
50
|
+
}
|
|
51
|
+
function removeMark(element, old) {
|
|
52
|
+
element.removeAttribute(newName(old));
|
|
53
|
+
element.removeAttribute(old);
|
|
54
|
+
}
|
|
55
|
+
function hasMark(element, old) {
|
|
56
|
+
return element.hasAttribute(newName(old)) || element.hasAttribute(old);
|
|
57
|
+
}
|
|
58
|
+
function getMark(element, old) {
|
|
59
|
+
return element.getAttribute(newName(old)) ?? element.getAttribute(old);
|
|
60
|
+
}
|
|
61
|
+
function either(old, rest = "]") {
|
|
62
|
+
return `[${newName(old)}${rest},[${old}${rest}`;
|
|
63
|
+
}
|
|
64
|
+
function markOwn(element, value = "") {
|
|
65
|
+
setMark(element, OLD_MARK, value);
|
|
66
|
+
}
|
|
67
|
+
function isMarked(element) {
|
|
68
|
+
return hasMark(element, OLD_MARK);
|
|
69
|
+
}
|
|
70
|
+
function ownSelector(value) {
|
|
71
|
+
return either(OLD_MARK, value === undefined ? "]" : `="${value}"]`);
|
|
72
|
+
}
|
|
73
|
+
function findOwn(root, value, tag = "") {
|
|
74
|
+
return root.querySelector(`${tag}[${MARK}="${value}"]`) ?? root.querySelector(`${tag}[${OLD_MARK}="${value}"]`);
|
|
75
|
+
}
|
|
76
|
+
var OWN_AND_IN = `${ownSelector()},${either(OLD_MARK, "] *")}`;
|
|
77
|
+
|
|
78
|
+
export { __export, __require, ATTRIBUTES, OLD_MARK, newName, isOwnName, setMark, removeMark, hasMark, getMark, either, markOwn, isMarked, ownSelector, findOwn, OWN_AND_IN };
|