@vinena/knobs 0.5.3 → 0.6.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 +32 -0
- package/README.md +7 -6
- package/dist/context-amfyasb5.js +23 -0
- package/dist/context-svtr7vwt.js +22 -0
- package/dist/early.global.js +5 -5
- package/dist/edit/css.d.ts +59 -0
- package/dist/edit/html.d.ts +91 -0
- package/dist/edit/keep.d.ts +175 -0
- package/dist/edit/log.d.ts +107 -0
- package/dist/edit/replay.d.ts +28 -0
- package/dist/edit/risk.d.ts +33 -0
- package/dist/edit/rule.d.ts +31 -0
- package/dist/edit/source.d.ts +12 -0
- package/dist/edit/text.d.ts +66 -0
- package/dist/elementsview-dm5v3z5a.js +3761 -0
- package/dist/elementsview-xm82cvs2.js +3762 -0
- package/dist/engine/dock.d.ts +3 -4
- package/dist/engine/frame.d.ts +1 -1
- package/dist/engine/style.d.ts +15 -0
- package/dist/{framekit-cjz0e4y8.js → framekit-622h6w1f.js} +54 -47
- package/dist/{framekit-yk1jxjv7.js → framekit-yx612r28.js} +54 -47
- package/dist/index-0zp9py56.js +859 -0
- package/dist/{index-prjpx67p.js → index-1mstjadm.js} +126 -2167
- package/dist/{index-begsqdm0.js → index-4a4x1bt2.js} +1 -1
- package/dist/index-58jdczmj.js +44 -0
- package/dist/index-5tv6sr74.js +23 -0
- package/dist/index-6bc2ztfd.js +688 -0
- package/dist/index-7cb4x1vj.js +1885 -0
- package/dist/index-a974q3aa.js +34 -0
- package/dist/{index-q73py563.js → index-aymfvd8s.js} +1 -1
- package/dist/{index-zt3rheck.js → index-aynkv7qk.js} +11 -8
- package/dist/{index-p57fdttx.js → index-dzm8ywq0.js} +492 -2365
- package/dist/{index-9jhatmky.js → index-f60yax1j.js} +13 -8
- package/dist/index-f67wctn3.js +1858 -0
- package/dist/{index-vgfn2n1h.js → index-ftjdt358.js} +8 -171
- package/dist/{index-j1h13ahg.js → index-gm51cthv.js} +2 -45
- package/dist/index-kfdzsyyw.js +1859 -0
- package/dist/index-t4kssacm.js +208 -0
- package/dist/index-v0ht9q0g.js +1518 -0
- package/dist/{index-6wbgqkdz.js → index-x59vz1xx.js} +247 -905
- package/dist/index-xh39jtkq.js +32 -0
- package/dist/index-yb7fc59g.js +718 -0
- package/dist/index-zd6adby9.js +496 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.global.js +438 -153
- package/dist/index.js +594 -486
- package/dist/react-0wepdf60.js +1519 -0
- package/dist/{react-gefkdkdz.js → react-1gqwa2yw.js} +1 -1
- package/dist/{index-sn2y6j09.js → react-3mfz1x2a.js} +126 -2167
- package/dist/react-4rbjw9af.js +33 -0
- package/dist/react-5rq7bnsy.js +210 -0
- package/dist/react-6bz05qk1.js +860 -0
- package/dist/{react-qgz9afa2.js → react-6fnxxs30.js} +8 -171
- package/dist/react-6q2cw2ya.js +689 -0
- package/dist/{react-7vjfsh40.js → react-6t4dbdzn.js} +11 -8
- package/dist/react-88es9b5q.js +719 -0
- package/dist/react-97b5b8j4.js +46 -0
- package/dist/{react-mmq2zya3.js → react-bxzn8vq5.js} +1 -1
- package/dist/{react-3rhdj2k1.js → react-cs62p9qh.js} +62 -720
- package/dist/react-ethftdxp.js +497 -0
- package/dist/react-fp73vhyd.js +36 -0
- package/dist/{react-qfpg79hs.js → react-me102s1a.js} +2 -45
- package/dist/react-t2qnewz2.js +24 -0
- package/dist/react-ttj8f9qp.js +1886 -0
- package/dist/{react-806qmkyz.js → react-v8497a41.js} +13 -8
- package/dist/{react-6tss0r9f.js → react-wqn4sx0n.js} +265 -2137
- package/dist/react.js +590 -486
- package/dist/replay-j18rw92k.js +258 -0
- package/dist/replay-vtg0vqj2.js +257 -0
- package/dist/{storageview-7cv0vpdm.js → storageview-6xj7zb63.js} +11 -7
- package/dist/{storageview-dyhpgt8f.js → storageview-pzn8yaad.js} +11 -7
- package/dist/styles/force.d.ts +66 -0
- package/dist/ui/bindings.d.ts +31 -5
- package/dist/ui/changes.d.ts +49 -0
- package/dist/ui/cssauto.d.ts +119 -0
- package/dist/ui/cssedit.d.ts +80 -0
- package/dist/ui/domedit.d.ts +99 -0
- package/dist/ui/domtree.d.ts +26 -1
- package/dist/ui/elementsview.d.ts +17 -2
- package/dist/ui/htmledit.d.ts +62 -0
- package/dist/ui/inspector.d.ts +6 -1
- package/dist/ui/keys.d.ts +12 -8
- package/dist/ui/pane.d.ts +0 -2
- package/dist/ui/panel.d.ts +3 -0
- package/dist/ui/prefs.d.ts +30 -10
- package/dist/ui/settings.d.ts +22 -1
- package/dist/ui/size.d.ts +14 -22
- package/dist/ui/stylesview.d.ts +30 -1
- package/package.json +1 -1
- package/skills/devknobs/SKILL.md +95 -0
- package/dist/elementsview-1wsxcdtj.js +0 -2874
- package/dist/elementsview-3kv34jfx.js +0 -2873
- package/dist/index-78r0f8pw.js +0 -27
- package/dist/react-adky72h9.js +0 -29
package/dist/react.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
FADE_CURVE,
|
|
4
|
-
PAGE_MIN,
|
|
5
|
-
dockRoom,
|
|
6
|
-
dockWidth,
|
|
7
4
|
ease,
|
|
8
5
|
keepMounted,
|
|
9
|
-
lerp
|
|
10
|
-
|
|
11
|
-
watchColumn
|
|
12
|
-
} from "./react-qfpg79hs.js";
|
|
6
|
+
lerp
|
|
7
|
+
} from "./react-me102s1a.js";
|
|
13
8
|
import {
|
|
14
9
|
GRAB_COLORS as GRAB_COLORS2,
|
|
15
10
|
GRAB_COLOR_NAMES,
|
|
@@ -18,15 +13,52 @@ import {
|
|
|
18
13
|
createGrab,
|
|
19
14
|
createInspect,
|
|
20
15
|
oneAtATime
|
|
21
|
-
} from "./react-
|
|
16
|
+
} from "./react-v8497a41.js";
|
|
22
17
|
import {
|
|
23
18
|
hushOnce
|
|
24
|
-
} from "./react-
|
|
19
|
+
} from "./react-1gqwa2yw.js";
|
|
20
|
+
import {
|
|
21
|
+
DRAG_SLOP,
|
|
22
|
+
FLING_SPAN,
|
|
23
|
+
FLING_TRAVEL,
|
|
24
|
+
GLIDE,
|
|
25
|
+
between,
|
|
26
|
+
clearForced,
|
|
27
|
+
cornerAt,
|
|
28
|
+
createPrefs,
|
|
29
|
+
createSizer,
|
|
30
|
+
dockedHandle,
|
|
31
|
+
dragDocked,
|
|
32
|
+
dragTarget,
|
|
33
|
+
dragTo,
|
|
34
|
+
forceState,
|
|
35
|
+
glideTime,
|
|
36
|
+
landSide,
|
|
37
|
+
otherSide,
|
|
38
|
+
settle,
|
|
39
|
+
translateOf,
|
|
40
|
+
velocity
|
|
41
|
+
} from "./react-88es9b5q.js";
|
|
42
|
+
import {
|
|
43
|
+
dockRoom,
|
|
44
|
+
dockWidth,
|
|
45
|
+
setDockWidth,
|
|
46
|
+
watchColumn
|
|
47
|
+
} from "./react-97b5b8j4.js";
|
|
48
|
+
import {
|
|
49
|
+
edits,
|
|
50
|
+
forgetReplay,
|
|
51
|
+
framedPage,
|
|
52
|
+
keeper,
|
|
53
|
+
pageSettled,
|
|
54
|
+
pathNow,
|
|
55
|
+
startKeep,
|
|
56
|
+
stopKeep
|
|
57
|
+
} from "./react-6bz05qk1.js";
|
|
25
58
|
import {
|
|
26
59
|
label
|
|
27
|
-
} from "./react-
|
|
60
|
+
} from "./react-ethftdxp.js";
|
|
28
61
|
import {
|
|
29
|
-
PANE_WIDTH,
|
|
30
62
|
appliedOnLoad,
|
|
31
63
|
applyOnLoad,
|
|
32
64
|
closePane,
|
|
@@ -39,7 +71,7 @@ import {
|
|
|
39
71
|
showPane,
|
|
40
72
|
stopOnLoad,
|
|
41
73
|
viewHead
|
|
42
|
-
} from "./react-
|
|
74
|
+
} from "./react-6t4dbdzn.js";
|
|
43
75
|
import {
|
|
44
76
|
actButton,
|
|
45
77
|
button,
|
|
@@ -68,59 +100,40 @@ import {
|
|
|
68
100
|
tabBar,
|
|
69
101
|
textField,
|
|
70
102
|
toolbar
|
|
71
|
-
} from "./react-
|
|
103
|
+
} from "./react-bxzn8vq5.js";
|
|
72
104
|
import {
|
|
73
|
-
BINDING_ICONS,
|
|
74
105
|
BODY_CAP,
|
|
75
106
|
HOST_RESET,
|
|
76
|
-
KEYS_FIELD,
|
|
77
107
|
LAYER,
|
|
78
108
|
LOCALE_PRESETS,
|
|
79
109
|
READ_MS,
|
|
80
|
-
ROW_ICONS,
|
|
81
110
|
SPEED_MAX,
|
|
82
111
|
SPEED_MIN,
|
|
83
112
|
TIME_ZONE_PRESETS,
|
|
84
113
|
canonicalTag,
|
|
85
114
|
canonicalZone,
|
|
86
|
-
comboLabel,
|
|
87
|
-
comboSpoken,
|
|
88
|
-
comboText,
|
|
89
|
-
defaultKeys,
|
|
90
115
|
devIconFor,
|
|
91
116
|
devIconShown,
|
|
92
|
-
escapeStep,
|
|
93
117
|
exports_engine,
|
|
94
118
|
foldRest,
|
|
95
|
-
forwardKeys,
|
|
96
119
|
frameWindow,
|
|
97
120
|
getState,
|
|
98
|
-
glyph,
|
|
99
|
-
highlightAt,
|
|
100
121
|
holdInTopLayer,
|
|
101
122
|
holdingHinge,
|
|
102
123
|
hostSendsUa,
|
|
103
|
-
icon,
|
|
104
|
-
isFunctionKey,
|
|
105
|
-
isSearchKey,
|
|
106
124
|
keepPlace,
|
|
107
|
-
keyAction,
|
|
108
125
|
landSplash,
|
|
109
126
|
letGo,
|
|
110
|
-
lowerKey,
|
|
111
127
|
moveHinge,
|
|
112
128
|
nativeSwitch,
|
|
113
129
|
onCount,
|
|
114
130
|
overflowCount,
|
|
115
|
-
paletteMove,
|
|
116
131
|
panelSized,
|
|
117
|
-
parseCombo,
|
|
118
132
|
ready,
|
|
119
133
|
replay,
|
|
120
134
|
requestLog,
|
|
121
135
|
reset,
|
|
122
136
|
resolveTimeZone,
|
|
123
|
-
rowIcon,
|
|
124
137
|
sends,
|
|
125
138
|
setNative,
|
|
126
139
|
setState,
|
|
@@ -128,13 +141,49 @@ import {
|
|
|
128
141
|
stop,
|
|
129
142
|
subscribe,
|
|
130
143
|
takeHinge,
|
|
131
|
-
typeAhead,
|
|
132
144
|
watchFold,
|
|
133
145
|
watchHinge,
|
|
134
146
|
watchPanel,
|
|
135
|
-
zoomAction,
|
|
136
147
|
zoomKey
|
|
137
|
-
} from "./react-
|
|
148
|
+
} from "./react-cs62p9qh.js";
|
|
149
|
+
import {
|
|
150
|
+
MAT_COLORS,
|
|
151
|
+
MAT_COLOR_NAMES,
|
|
152
|
+
UA_PRESETS,
|
|
153
|
+
isMac,
|
|
154
|
+
isMatName,
|
|
155
|
+
layoutOf,
|
|
156
|
+
layoutOptions,
|
|
157
|
+
matGradient,
|
|
158
|
+
mockOf,
|
|
159
|
+
platformOf,
|
|
160
|
+
runsUnderBars,
|
|
161
|
+
uaPreset,
|
|
162
|
+
userAgentOf
|
|
163
|
+
} from "./react-ttj8f9qp.js";
|
|
164
|
+
import {
|
|
165
|
+
BINDING_ICONS,
|
|
166
|
+
KEYS_FIELD,
|
|
167
|
+
ROW_ICONS,
|
|
168
|
+
comboLabel,
|
|
169
|
+
comboSpoken,
|
|
170
|
+
comboText,
|
|
171
|
+
defaultKeys,
|
|
172
|
+
escapeStep,
|
|
173
|
+
forwardKeys,
|
|
174
|
+
glyph,
|
|
175
|
+
highlightAt,
|
|
176
|
+
icon,
|
|
177
|
+
isFunctionKey,
|
|
178
|
+
isSearchKey,
|
|
179
|
+
keyAction,
|
|
180
|
+
lowerKey,
|
|
181
|
+
paletteMove,
|
|
182
|
+
parseCombo,
|
|
183
|
+
rowIcon,
|
|
184
|
+
typeAhead,
|
|
185
|
+
zoomAction
|
|
186
|
+
} from "./react-6q2cw2ya.js";
|
|
138
187
|
import {
|
|
139
188
|
BARS,
|
|
140
189
|
BROWSERS,
|
|
@@ -155,8 +204,6 @@ import {
|
|
|
155
204
|
GEO_ERRORS,
|
|
156
205
|
GEO_PRESETS,
|
|
157
206
|
GRAB_COLORS,
|
|
158
|
-
MAT_COLORS,
|
|
159
|
-
MAT_COLOR_NAMES,
|
|
160
207
|
MOTIONS,
|
|
161
208
|
NativeDate,
|
|
162
209
|
ONLINES,
|
|
@@ -170,12 +217,10 @@ import {
|
|
|
170
217
|
TEXT_MAX,
|
|
171
218
|
TEXT_MIN,
|
|
172
219
|
TRANSPARENCIES,
|
|
173
|
-
UA_PRESETS,
|
|
174
220
|
VISIONS,
|
|
175
221
|
ZOOM_MAX,
|
|
176
222
|
ZOOM_MIN,
|
|
177
223
|
ZOOM_PRESETS,
|
|
178
|
-
__require,
|
|
179
224
|
addStyle,
|
|
180
225
|
deviceOf,
|
|
181
226
|
formId,
|
|
@@ -185,34 +230,28 @@ import {
|
|
|
185
230
|
hasTouch,
|
|
186
231
|
isCustomColor,
|
|
187
232
|
isDevknobsFrame,
|
|
188
|
-
isMac,
|
|
189
|
-
isMatName,
|
|
190
233
|
knobFrame,
|
|
191
|
-
layoutOf,
|
|
192
|
-
layoutOptions,
|
|
193
|
-
matGradient,
|
|
194
|
-
mockOf,
|
|
195
234
|
needsFrame,
|
|
196
235
|
newer,
|
|
197
236
|
now,
|
|
198
237
|
openOf,
|
|
199
238
|
parseColor,
|
|
200
239
|
percent,
|
|
201
|
-
platformOf,
|
|
202
240
|
readColor,
|
|
203
241
|
readMessage,
|
|
204
242
|
realNow,
|
|
205
243
|
resolveGeo,
|
|
206
244
|
rewriteMediaText,
|
|
207
|
-
runsUnderBars,
|
|
208
245
|
stamped,
|
|
209
246
|
still,
|
|
210
247
|
toHex,
|
|
211
|
-
uaPreset,
|
|
212
|
-
userAgentOf,
|
|
213
248
|
watchSystemMedia,
|
|
214
249
|
webStorage
|
|
215
|
-
} from "./react-
|
|
250
|
+
} from "./react-wqn4sx0n.js";
|
|
251
|
+
import"./react-fp73vhyd.js";
|
|
252
|
+
import {
|
|
253
|
+
__require
|
|
254
|
+
} from "./react-t2qnewz2.js";
|
|
216
255
|
|
|
217
256
|
// src/react.tsx
|
|
218
257
|
import { useEffect, useRef } from "react";
|
|
@@ -1707,6 +1746,8 @@ var BINDINGS = [
|
|
|
1707
1746
|
"replay",
|
|
1708
1747
|
"requests",
|
|
1709
1748
|
"storage",
|
|
1749
|
+
"elements",
|
|
1750
|
+
"settings",
|
|
1710
1751
|
"reset"
|
|
1711
1752
|
];
|
|
1712
1753
|
var BINDING_WORDS = {
|
|
@@ -1716,7 +1757,9 @@ var BINDING_WORDS = {
|
|
|
1716
1757
|
replay: "replay animations",
|
|
1717
1758
|
requests: "requests",
|
|
1718
1759
|
storage: "storage",
|
|
1719
|
-
reset: "reset"
|
|
1760
|
+
reset: "reset",
|
|
1761
|
+
elements: "elements",
|
|
1762
|
+
settings: "settings"
|
|
1720
1763
|
};
|
|
1721
1764
|
var RESERVED_LETTERS = new Set([..."cvxzawrtqlnfpshm"]);
|
|
1722
1765
|
var ZOOM_KEYS = new Set(["=", "-", "_", "0"]);
|
|
@@ -1746,8 +1789,6 @@ function clashText(combo) {
|
|
|
1746
1789
|
function comboProblem(combo, binding, others = {}) {
|
|
1747
1790
|
if (!keepable(combo.key))
|
|
1748
1791
|
return "use a letter, digit, symbol or F1 to F12";
|
|
1749
|
-
if (bare(combo) && !isFunctionKey(combo.key))
|
|
1750
|
-
return "add a modifier, alone it types";
|
|
1751
1792
|
if (isReserved(combo))
|
|
1752
1793
|
return "the browser uses it";
|
|
1753
1794
|
if (combo.key === "/" && !combo.meta && !combo.ctrl && !combo.alt)
|
|
@@ -1811,6 +1852,9 @@ function readKeys(json) {
|
|
|
1811
1852
|
} catch {
|
|
1812
1853
|
return {};
|
|
1813
1854
|
}
|
|
1855
|
+
return keysOf(value);
|
|
1856
|
+
}
|
|
1857
|
+
function keysOf(value) {
|
|
1814
1858
|
if (newer(value, KEYS_VERSION))
|
|
1815
1859
|
return {};
|
|
1816
1860
|
const stored = record(value);
|
|
@@ -1872,10 +1916,41 @@ function keepKeys(keys) {
|
|
|
1872
1916
|
webStorage("local")?.setItem(KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
|
|
1873
1917
|
} catch {}
|
|
1874
1918
|
}
|
|
1919
|
+
function keysListed(keys, listed) {
|
|
1920
|
+
const here = { ...keys };
|
|
1921
|
+
for (const binding of BINDINGS) {
|
|
1922
|
+
if (binding !== "panel" && !listed.includes(binding))
|
|
1923
|
+
here[binding] = null;
|
|
1924
|
+
}
|
|
1925
|
+
return here;
|
|
1926
|
+
}
|
|
1875
1927
|
function createKeys(options2 = {}) {
|
|
1876
1928
|
const base = defaultKeys(options2);
|
|
1877
1929
|
const grab = options2.grab !== false;
|
|
1878
|
-
|
|
1930
|
+
const store = options2.store ?? null;
|
|
1931
|
+
function load() {
|
|
1932
|
+
if (!store)
|
|
1933
|
+
return loadKeys();
|
|
1934
|
+
if (fresh())
|
|
1935
|
+
return {};
|
|
1936
|
+
try {
|
|
1937
|
+
return keysOf(store.load());
|
|
1938
|
+
} catch {
|
|
1939
|
+
return {};
|
|
1940
|
+
}
|
|
1941
|
+
}
|
|
1942
|
+
function keep(keys2) {
|
|
1943
|
+
if (!store) {
|
|
1944
|
+
keepKeys(keys2);
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
if (fresh())
|
|
1948
|
+
return;
|
|
1949
|
+
try {
|
|
1950
|
+
store.save(stamped(keys2, KEYS_VERSION));
|
|
1951
|
+
} catch {}
|
|
1952
|
+
}
|
|
1953
|
+
let stored = load();
|
|
1879
1954
|
let keys = resolveKeys(base, stored, grab);
|
|
1880
1955
|
const listeners = new Set;
|
|
1881
1956
|
function changed() {
|
|
@@ -1886,12 +1961,16 @@ function createKeys(options2 = {}) {
|
|
|
1886
1961
|
function onStorage(event) {
|
|
1887
1962
|
if (event.key !== KEYS_KEY && event.key !== null)
|
|
1888
1963
|
return;
|
|
1964
|
+
heard();
|
|
1965
|
+
}
|
|
1966
|
+
function heard() {
|
|
1889
1967
|
if (fresh())
|
|
1890
1968
|
return;
|
|
1891
|
-
stored =
|
|
1969
|
+
stored = load();
|
|
1892
1970
|
changed();
|
|
1893
1971
|
}
|
|
1894
|
-
|
|
1972
|
+
const stopStore = store?.subscribe(heard) ?? null;
|
|
1973
|
+
if (!store && typeof window !== "undefined")
|
|
1895
1974
|
window.addEventListener("storage", onStorage);
|
|
1896
1975
|
return {
|
|
1897
1976
|
get: () => keys,
|
|
@@ -1906,7 +1985,7 @@ function createKeys(options2 = {}) {
|
|
|
1906
1985
|
else
|
|
1907
1986
|
next[binding] = comboText(combo);
|
|
1908
1987
|
stored = next;
|
|
1909
|
-
|
|
1988
|
+
keep(stored);
|
|
1910
1989
|
changed();
|
|
1911
1990
|
},
|
|
1912
1991
|
subscribe(listener) {
|
|
@@ -1918,6 +1997,7 @@ function createKeys(options2 = {}) {
|
|
|
1918
1997
|
recording: false,
|
|
1919
1998
|
destroy() {
|
|
1920
1999
|
listeners.clear();
|
|
2000
|
+
stopStore?.();
|
|
1921
2001
|
if (typeof window !== "undefined")
|
|
1922
2002
|
window.removeEventListener("storage", onStorage);
|
|
1923
2003
|
}
|
|
@@ -2280,122 +2360,6 @@ function createDockSlide(context) {
|
|
|
2280
2360
|
};
|
|
2281
2361
|
}
|
|
2282
2362
|
|
|
2283
|
-
// src/ui/place.ts
|
|
2284
|
-
var DRAG_SLOP = 4;
|
|
2285
|
-
var FLING_SPAN = 150;
|
|
2286
|
-
var FLING_STRETCH = 40;
|
|
2287
|
-
var FLING_LEAST = 8;
|
|
2288
|
-
var FLING = 0.5;
|
|
2289
|
-
var FLING_LEAN = 1.5;
|
|
2290
|
-
var FLING_TRAVEL = 16;
|
|
2291
|
-
var GLIDE = 220;
|
|
2292
|
-
var GLIDE_MAX = 440;
|
|
2293
|
-
var GLIDE_SPEED = 6;
|
|
2294
|
-
var PANEL_GAP = 8;
|
|
2295
|
-
var SNAP = 24;
|
|
2296
|
-
function dragTarget(shift, open) {
|
|
2297
|
-
return open && !shift ? "panel" : "handle";
|
|
2298
|
-
}
|
|
2299
|
-
function otherSide(side) {
|
|
2300
|
-
return side === "right" ? "left" : "right";
|
|
2301
|
-
}
|
|
2302
|
-
function between(value, min, max) {
|
|
2303
|
-
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
2304
|
-
}
|
|
2305
|
-
function snap(value, min, max) {
|
|
2306
|
-
const end = Math.max(min, max);
|
|
2307
|
-
const at = between(value, min, end);
|
|
2308
|
-
if (at - min <= SNAP && at - min <= end - at)
|
|
2309
|
-
return min;
|
|
2310
|
-
return end - at <= SNAP ? end : at;
|
|
2311
|
-
}
|
|
2312
|
-
function edgeOf(value, min, max, had) {
|
|
2313
|
-
const top = Math.abs(value - min) < 0.5;
|
|
2314
|
-
const bottom = Math.abs(value - max) < 0.5;
|
|
2315
|
-
if (top && bottom)
|
|
2316
|
-
return had === "none" ? "top" : had;
|
|
2317
|
-
return top ? "top" : bottom ? "bottom" : "none";
|
|
2318
|
-
}
|
|
2319
|
-
function settle(place, room, anchor = "edge") {
|
|
2320
|
-
const last = room.view - PANEL_GAP - room.panel;
|
|
2321
|
-
const pull = anchor === "top" ? between : snap;
|
|
2322
|
-
const top = pull(anchor === "top" || place.edge === "none" ? place.top : place.edge === "top" ? PANEL_GAP : last, PANEL_GAP, last);
|
|
2323
|
-
const low = top + room.panel - room.handle;
|
|
2324
|
-
const y = pull(place.tab === "top" ? top : place.tab === "bottom" ? low : place.y, top, low);
|
|
2325
|
-
return {
|
|
2326
|
-
y,
|
|
2327
|
-
top,
|
|
2328
|
-
edge: edgeOf(top, PANEL_GAP, last, place.edge),
|
|
2329
|
-
tab: edgeOf(y, top, low, place.tab)
|
|
2330
|
-
};
|
|
2331
|
-
}
|
|
2332
|
-
function cornerAt(y, top, room) {
|
|
2333
|
-
return edgeOf(y, top, top + room.panel - room.handle, "none");
|
|
2334
|
-
}
|
|
2335
|
-
function dragTo(target, open, to, from, room) {
|
|
2336
|
-
const offset = from.y - from.top;
|
|
2337
|
-
if (target === "panel") {
|
|
2338
|
-
const top = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.panel);
|
|
2339
|
-
return settle({ y: top + offset, top, edge: "none", tab: "none" }, room);
|
|
2340
|
-
}
|
|
2341
|
-
if (open)
|
|
2342
|
-
return settle({ ...from, y: to, tab: "none" }, room);
|
|
2343
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2344
|
-
return settle({ y, top: y - offset, edge: "none", tab: "none" }, room);
|
|
2345
|
-
}
|
|
2346
|
-
function dragDocked(to, from, room) {
|
|
2347
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2348
|
-
return { y, top: y - (from.y - from.top), edge: "none", tab: from.tab };
|
|
2349
|
-
}
|
|
2350
|
-
function dockedHandle(y, room) {
|
|
2351
|
-
return between(y, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2352
|
-
}
|
|
2353
|
-
function speedOf(from, to) {
|
|
2354
|
-
const time = to.t - from.t;
|
|
2355
|
-
return { x: (to.x - from.x) / time, y: (to.y - from.y) / time };
|
|
2356
|
-
}
|
|
2357
|
-
function velocity(samples, at) {
|
|
2358
|
-
const recent = samples.filter((sample) => sample.t >= at - FLING_SPAN && sample.t <= at);
|
|
2359
|
-
let fastest = { x: 0, y: 0 };
|
|
2360
|
-
let read = false;
|
|
2361
|
-
for (const [index, end] of recent.entries()) {
|
|
2362
|
-
let start2;
|
|
2363
|
-
for (const sample of recent.slice(0, index)) {
|
|
2364
|
-
if (end.t - sample.t >= FLING_STRETCH)
|
|
2365
|
-
start2 = sample;
|
|
2366
|
-
}
|
|
2367
|
-
if (!start2)
|
|
2368
|
-
continue;
|
|
2369
|
-
const speed = speedOf(start2, end);
|
|
2370
|
-
if (!read || Math.hypot(speed.x, speed.y) > Math.hypot(fastest.x, fastest.y))
|
|
2371
|
-
fastest = speed;
|
|
2372
|
-
read = true;
|
|
2373
|
-
}
|
|
2374
|
-
const first = recent[0];
|
|
2375
|
-
const last = recent[recent.length - 1];
|
|
2376
|
-
if (!read && first && last && last.t - first.t >= FLING_LEAST)
|
|
2377
|
-
return speedOf(first, last);
|
|
2378
|
-
return fastest;
|
|
2379
|
-
}
|
|
2380
|
-
function glideTime(distance) {
|
|
2381
|
-
return between(distance / GLIDE_SPEED, GLIDE, GLIDE_MAX);
|
|
2382
|
-
}
|
|
2383
|
-
function landSide(side, x, width, vx, vy) {
|
|
2384
|
-
const other = otherSide(side);
|
|
2385
|
-
const toward = side === "right" ? -vx : vx;
|
|
2386
|
-
const across = Math.abs(vx) >= FLING && Math.abs(vx) > FLING_LEAN * Math.abs(vy);
|
|
2387
|
-
const past = side === "right" ? x < width / 2 : x > width / 2;
|
|
2388
|
-
if (across && toward > 0)
|
|
2389
|
-
return other;
|
|
2390
|
-
if (across && toward < 0)
|
|
2391
|
-
return side;
|
|
2392
|
-
return past ? other : side;
|
|
2393
|
-
}
|
|
2394
|
-
function translateOf(value) {
|
|
2395
|
-
const [x = 0, y = 0] = value === "none" ? [] : value.split(" ").map((part) => parseFloat(part));
|
|
2396
|
-
return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
|
|
2397
|
-
}
|
|
2398
|
-
|
|
2399
2363
|
// src/ui/drag.ts
|
|
2400
2364
|
function createDrag(context) {
|
|
2401
2365
|
const { host, wrap, handle, panel } = context;
|
|
@@ -2674,7 +2638,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2674
2638
|
function here(element) {
|
|
2675
2639
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2676
2640
|
}
|
|
2677
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2641
|
+
function createInspector(context, load = () => import("./elementsview-xm82cvs2.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2678
2642
|
const { inspect, tips, prefs } = context;
|
|
2679
2643
|
const listeners = new Set;
|
|
2680
2644
|
let view = null;
|
|
@@ -2692,6 +2656,14 @@ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.j
|
|
|
2692
2656
|
function current() {
|
|
2693
2657
|
return held && here(held) ? held : null;
|
|
2694
2658
|
}
|
|
2659
|
+
function pageBody() {
|
|
2660
|
+
try {
|
|
2661
|
+
const page = framed ? frameWindow()?.document : typeof document === "undefined" ? undefined : document;
|
|
2662
|
+
return page?.body ?? null;
|
|
2663
|
+
} catch {
|
|
2664
|
+
return null;
|
|
2665
|
+
}
|
|
2666
|
+
}
|
|
2695
2667
|
function point(element) {
|
|
2696
2668
|
if (element && inspect.isOn())
|
|
2697
2669
|
return;
|
|
@@ -2727,7 +2699,9 @@ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.j
|
|
|
2727
2699
|
},
|
|
2728
2700
|
...prefs && {
|
|
2729
2701
|
mode: { get: () => prefs.get().stylesMode, set: prefs.setStylesMode },
|
|
2730
|
-
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox }
|
|
2702
|
+
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox },
|
|
2703
|
+
diff: { get: () => prefs.get().changesDiff, set: prefs.setChangesDiff },
|
|
2704
|
+
htmlSize: { get: () => ({ height: prefs.get().htmlHeight, full: prefs.get().htmlFull }), set: prefs.setHtmlSize }
|
|
2731
2705
|
}
|
|
2732
2706
|
});
|
|
2733
2707
|
view = made;
|
|
@@ -2811,6 +2785,18 @@ function createInspector(context, load = () => import("./elementsview-1wsxcdtj.j
|
|
|
2811
2785
|
else
|
|
2812
2786
|
inspect.set(true);
|
|
2813
2787
|
},
|
|
2788
|
+
elements() {
|
|
2789
|
+
if (inspect.isOn())
|
|
2790
|
+
inspect.set(false);
|
|
2791
|
+
if (!current()) {
|
|
2792
|
+
const body = pageBody();
|
|
2793
|
+
if (view)
|
|
2794
|
+
view.show(body);
|
|
2795
|
+
else
|
|
2796
|
+
hold(body);
|
|
2797
|
+
}
|
|
2798
|
+
reveal2();
|
|
2799
|
+
},
|
|
2814
2800
|
picked() {
|
|
2815
2801
|
const element = current();
|
|
2816
2802
|
return element ? label(element) : null;
|
|
@@ -4079,296 +4065,6 @@ function createPalette(context) {
|
|
|
4079
4065
|
};
|
|
4080
4066
|
}
|
|
4081
4067
|
|
|
4082
|
-
// src/ui/size.ts
|
|
4083
|
-
var LIST_WIDTH = 240;
|
|
4084
|
-
var VIEW_WIDTH = PANE_WIDTH;
|
|
4085
|
-
var LIST_MIN = 240;
|
|
4086
|
-
var VIEW_MIN = 280;
|
|
4087
|
-
var WIDTH_MAX = 720;
|
|
4088
|
-
var PAGE_ROOM = 96;
|
|
4089
|
-
function pageRoom(docked) {
|
|
4090
|
-
return docked ? PAGE_MIN : PAGE_ROOM;
|
|
4091
|
-
}
|
|
4092
|
-
var WIDTH_STEP = 16;
|
|
4093
|
-
var HANDLE_REACH = 21;
|
|
4094
|
-
function widthLimits(showing, view, page = PAGE_ROOM) {
|
|
4095
|
-
const min = showing === "view" ? VIEW_MIN : LIST_MIN;
|
|
4096
|
-
return { min, max: Math.max(min, Math.min(WIDTH_MAX, view - page)) };
|
|
4097
|
-
}
|
|
4098
|
-
function widthIn(showing, wanted, view, page = PAGE_ROOM) {
|
|
4099
|
-
const { min, max } = widthLimits(showing, view, page);
|
|
4100
|
-
const room = view - HANDLE_REACH - PANEL_GAP;
|
|
4101
|
-
return Math.max(LIST_MIN, Math.min(Math.round(between(wanted, min, max)), room));
|
|
4102
|
-
}
|
|
4103
|
-
function dragWidth(from, travel, side) {
|
|
4104
|
-
return from + (side === "right" ? -travel : travel);
|
|
4105
|
-
}
|
|
4106
|
-
function keyWidth(key, width, limits, side) {
|
|
4107
|
-
if (key === "Home")
|
|
4108
|
-
return limits.min;
|
|
4109
|
-
if (key === "End")
|
|
4110
|
-
return limits.max;
|
|
4111
|
-
if (key !== "ArrowLeft" && key !== "ArrowRight")
|
|
4112
|
-
return null;
|
|
4113
|
-
const wider = key === "ArrowLeft" === (side === "right");
|
|
4114
|
-
return between(width + (wider ? WIDTH_STEP : -WIDTH_STEP), limits.min, limits.max);
|
|
4115
|
-
}
|
|
4116
|
-
function widthGlides(cue) {
|
|
4117
|
-
return !cue.first && !cue.dragging && !cue.resizing;
|
|
4118
|
-
}
|
|
4119
|
-
function createSizer(context) {
|
|
4120
|
-
const { host, wrap, panel, prefs } = context;
|
|
4121
|
-
const strip = document.createElement("div");
|
|
4122
|
-
strip.className = "sizer";
|
|
4123
|
-
strip.tabIndex = 0;
|
|
4124
|
-
strip.setAttribute("role", "separator");
|
|
4125
|
-
strip.setAttribute("aria-orientation", "vertical");
|
|
4126
|
-
strip.setAttribute("aria-label", "panel width");
|
|
4127
|
-
let shown2 = null;
|
|
4128
|
-
let held = null;
|
|
4129
|
-
function viewWidth() {
|
|
4130
|
-
return document.documentElement.clientWidth || window.innerWidth;
|
|
4131
|
-
}
|
|
4132
|
-
function put(width) {
|
|
4133
|
-
wrap.style.setProperty("--panel-width", `${width}px`);
|
|
4134
|
-
}
|
|
4135
|
-
function apply(draw, resizing) {
|
|
4136
|
-
const showing = context.showing();
|
|
4137
|
-
const view = viewWidth();
|
|
4138
|
-
const kept = showing === "view" ? prefs.get().viewWidth : prefs.get().listWidth;
|
|
4139
|
-
const page = pageRoom(context.place().docked);
|
|
4140
|
-
const next = widthIn(showing, held?.showing === showing ? held.width : kept, view, page);
|
|
4141
|
-
const from = shown2;
|
|
4142
|
-
const limits = widthLimits(showing, view, page);
|
|
4143
|
-
strip.setAttribute("aria-valuemin", String(limits.min));
|
|
4144
|
-
strip.setAttribute("aria-valuemax", String(limits.max));
|
|
4145
|
-
if (next === from || from !== null && !context.place().open) {
|
|
4146
|
-
draw?.();
|
|
4147
|
-
return;
|
|
4148
|
-
}
|
|
4149
|
-
strip.setAttribute("aria-valuenow", String(next));
|
|
4150
|
-
const glide = widthGlides({ first: from === null, dragging: held !== null, resizing });
|
|
4151
|
-
shown2 = next;
|
|
4152
|
-
context.wide(next);
|
|
4153
|
-
host.style.width = `${HANDLE_REACH + next}px`;
|
|
4154
|
-
panel.style.transitionProperty = "none";
|
|
4155
|
-
put(next);
|
|
4156
|
-
draw?.();
|
|
4157
|
-
if (glide && from !== null)
|
|
4158
|
-
put(from);
|
|
4159
|
-
panel.getBoundingClientRect();
|
|
4160
|
-
panel.style.transitionProperty = "";
|
|
4161
|
-
put(next);
|
|
4162
|
-
if (from !== null)
|
|
4163
|
-
context.sized(glide);
|
|
4164
|
-
}
|
|
4165
|
-
function end(keep) {
|
|
4166
|
-
if (!held)
|
|
4167
|
-
return;
|
|
4168
|
-
const { showing, pointer, width, moved } = held;
|
|
4169
|
-
held = null;
|
|
4170
|
-
delete wrap.dataset.sizing;
|
|
4171
|
-
if (strip.hasPointerCapture(pointer))
|
|
4172
|
-
strip.releasePointerCapture(pointer);
|
|
4173
|
-
if (keep && moved)
|
|
4174
|
-
prefs.setWidth(showing, width);
|
|
4175
|
-
else
|
|
4176
|
-
apply(undefined, false);
|
|
4177
|
-
}
|
|
4178
|
-
strip.addEventListener("pointerdown", (event) => {
|
|
4179
|
-
if (event.button !== 0 || held || shown2 === null)
|
|
4180
|
-
return;
|
|
4181
|
-
held = {
|
|
4182
|
-
showing: context.showing(),
|
|
4183
|
-
pointer: event.pointerId,
|
|
4184
|
-
from: shown2,
|
|
4185
|
-
x: event.clientX,
|
|
4186
|
-
width: shown2,
|
|
4187
|
-
moved: false
|
|
4188
|
-
};
|
|
4189
|
-
wrap.dataset.sizing = "true";
|
|
4190
|
-
strip.setPointerCapture(event.pointerId);
|
|
4191
|
-
});
|
|
4192
|
-
strip.addEventListener("pointermove", (event) => {
|
|
4193
|
-
if (!held || event.pointerId !== held.pointer)
|
|
4194
|
-
return;
|
|
4195
|
-
const { side, docked } = context.place();
|
|
4196
|
-
const wanted = dragWidth(held.from, event.clientX - held.x, side);
|
|
4197
|
-
const width = widthIn(held.showing, wanted, viewWidth(), pageRoom(docked));
|
|
4198
|
-
if (width === held.width)
|
|
4199
|
-
return;
|
|
4200
|
-
held.width = width;
|
|
4201
|
-
held.moved = true;
|
|
4202
|
-
apply(undefined, false);
|
|
4203
|
-
});
|
|
4204
|
-
strip.addEventListener("pointerup", (event) => {
|
|
4205
|
-
if (event.pointerId === held?.pointer)
|
|
4206
|
-
end(true);
|
|
4207
|
-
});
|
|
4208
|
-
strip.addEventListener("pointercancel", (event) => {
|
|
4209
|
-
if (event.pointerId === held?.pointer)
|
|
4210
|
-
end(false);
|
|
4211
|
-
});
|
|
4212
|
-
strip.addEventListener("lostpointercapture", (event) => {
|
|
4213
|
-
if (event.pointerId === held?.pointer)
|
|
4214
|
-
end(false);
|
|
4215
|
-
});
|
|
4216
|
-
strip.addEventListener("dblclick", () => {
|
|
4217
|
-
const showing = context.showing();
|
|
4218
|
-
prefs.setWidth(showing, showing === "view" ? VIEW_WIDTH : LIST_WIDTH);
|
|
4219
|
-
});
|
|
4220
|
-
strip.addEventListener("keydown", (event) => {
|
|
4221
|
-
if (shown2 === null || event.altKey || event.ctrlKey || event.metaKey)
|
|
4222
|
-
return;
|
|
4223
|
-
const showing = context.showing();
|
|
4224
|
-
const { side, docked } = context.place();
|
|
4225
|
-
const limits = widthLimits(showing, viewWidth(), pageRoom(docked));
|
|
4226
|
-
const next = keyWidth(event.key, shown2, limits, side);
|
|
4227
|
-
if (next === null)
|
|
4228
|
-
return;
|
|
4229
|
-
event.preventDefault();
|
|
4230
|
-
prefs.setWidth(showing, next);
|
|
4231
|
-
});
|
|
4232
|
-
return {
|
|
4233
|
-
strip,
|
|
4234
|
-
size: (draw) => apply(draw, false),
|
|
4235
|
-
fit: () => apply(undefined, true),
|
|
4236
|
-
cancel: () => end(false)
|
|
4237
|
-
};
|
|
4238
|
-
}
|
|
4239
|
-
|
|
4240
|
-
// src/ui/prefs.ts
|
|
4241
|
-
var PREFS_KEY = "devknobs:prefs";
|
|
4242
|
-
var PREFS_VERSION = 4;
|
|
4243
|
-
var STYLES_MODE = "simple";
|
|
4244
|
-
var STYLES_BOX = true;
|
|
4245
|
-
var WIDTH_OF = { list: "listWidth", view: "viewWidth" };
|
|
4246
|
-
function readPrefs(json) {
|
|
4247
|
-
let value = null;
|
|
4248
|
-
try {
|
|
4249
|
-
value = json ? JSON.parse(json) : null;
|
|
4250
|
-
} catch {
|
|
4251
|
-
return {};
|
|
4252
|
-
}
|
|
4253
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
4254
|
-
return {};
|
|
4255
|
-
if (newer(value, PREFS_VERSION))
|
|
4256
|
-
return {};
|
|
4257
|
-
const prefs = {};
|
|
4258
|
-
const handle = Reflect.get(value, "handle");
|
|
4259
|
-
if (typeof handle === "boolean")
|
|
4260
|
-
prefs.handle = handle;
|
|
4261
|
-
for (const key of [WIDTH_OF.list, WIDTH_OF.view]) {
|
|
4262
|
-
const width = Reflect.get(value, key);
|
|
4263
|
-
if (typeof width === "number" && Number.isFinite(width) && width > 0)
|
|
4264
|
-
prefs[key] = width;
|
|
4265
|
-
}
|
|
4266
|
-
const mode = Reflect.get(value, "stylesMode");
|
|
4267
|
-
if (mode === "simple" || mode === "advanced")
|
|
4268
|
-
prefs.stylesMode = mode;
|
|
4269
|
-
const box = Reflect.get(value, "stylesBox");
|
|
4270
|
-
if (typeof box === "boolean")
|
|
4271
|
-
prefs.stylesBox = box;
|
|
4272
|
-
return prefs;
|
|
4273
|
-
}
|
|
4274
|
-
function resolvePrefs(base, stored) {
|
|
4275
|
-
return { ...base, ...stored };
|
|
4276
|
-
}
|
|
4277
|
-
function loadPrefs() {
|
|
4278
|
-
try {
|
|
4279
|
-
return readPrefs(webStorage("local")?.getItem(PREFS_KEY));
|
|
4280
|
-
} catch {
|
|
4281
|
-
return {};
|
|
4282
|
-
}
|
|
4283
|
-
}
|
|
4284
|
-
function keepPrefs(prefs) {
|
|
4285
|
-
try {
|
|
4286
|
-
if (Object.keys(prefs).length === 0)
|
|
4287
|
-
webStorage("local")?.removeItem(PREFS_KEY);
|
|
4288
|
-
else
|
|
4289
|
-
webStorage("local")?.setItem(PREFS_KEY, JSON.stringify(stamped(prefs, PREFS_VERSION)));
|
|
4290
|
-
} catch {}
|
|
4291
|
-
}
|
|
4292
|
-
function createPrefs(options2 = {}) {
|
|
4293
|
-
const base = {
|
|
4294
|
-
handle: options2.handle !== false,
|
|
4295
|
-
listWidth: LIST_WIDTH,
|
|
4296
|
-
viewWidth: VIEW_WIDTH,
|
|
4297
|
-
stylesMode: STYLES_MODE,
|
|
4298
|
-
stylesBox: STYLES_BOX
|
|
4299
|
-
};
|
|
4300
|
-
let stored = loadPrefs();
|
|
4301
|
-
let prefs = resolvePrefs(base, stored);
|
|
4302
|
-
const listeners = new Set;
|
|
4303
|
-
function changed() {
|
|
4304
|
-
prefs = resolvePrefs(base, stored);
|
|
4305
|
-
for (const listener of Array.from(listeners))
|
|
4306
|
-
listener();
|
|
4307
|
-
}
|
|
4308
|
-
function keep(next) {
|
|
4309
|
-
stored = next;
|
|
4310
|
-
keepPrefs(stored);
|
|
4311
|
-
changed();
|
|
4312
|
-
}
|
|
4313
|
-
function onStorage(event) {
|
|
4314
|
-
if (event.key !== PREFS_KEY && event.key !== null)
|
|
4315
|
-
return;
|
|
4316
|
-
if (fresh())
|
|
4317
|
-
return;
|
|
4318
|
-
stored = loadPrefs();
|
|
4319
|
-
changed();
|
|
4320
|
-
}
|
|
4321
|
-
if (typeof window !== "undefined")
|
|
4322
|
-
window.addEventListener("storage", onStorage);
|
|
4323
|
-
return {
|
|
4324
|
-
get: () => prefs,
|
|
4325
|
-
setHandle(on) {
|
|
4326
|
-
const next = { ...stored };
|
|
4327
|
-
if (on === base.handle)
|
|
4328
|
-
delete next.handle;
|
|
4329
|
-
else
|
|
4330
|
-
next.handle = on;
|
|
4331
|
-
keep(next);
|
|
4332
|
-
},
|
|
4333
|
-
setWidth(showing, px) {
|
|
4334
|
-
const key = WIDTH_OF[showing];
|
|
4335
|
-
const next = { ...stored };
|
|
4336
|
-
if (px === base[key])
|
|
4337
|
-
delete next[key];
|
|
4338
|
-
else
|
|
4339
|
-
next[key] = px;
|
|
4340
|
-
keep(next);
|
|
4341
|
-
},
|
|
4342
|
-
setStylesMode(mode) {
|
|
4343
|
-
const next = { ...stored };
|
|
4344
|
-
if (mode === base.stylesMode)
|
|
4345
|
-
delete next.stylesMode;
|
|
4346
|
-
else
|
|
4347
|
-
next.stylesMode = mode;
|
|
4348
|
-
keep(next);
|
|
4349
|
-
},
|
|
4350
|
-
setStylesBox(open) {
|
|
4351
|
-
const next = { ...stored };
|
|
4352
|
-
if (open === base.stylesBox)
|
|
4353
|
-
delete next.stylesBox;
|
|
4354
|
-
else
|
|
4355
|
-
next.stylesBox = open;
|
|
4356
|
-
keep(next);
|
|
4357
|
-
},
|
|
4358
|
-
subscribe(listener) {
|
|
4359
|
-
listeners.add(listener);
|
|
4360
|
-
return () => {
|
|
4361
|
-
listeners.delete(listener);
|
|
4362
|
-
};
|
|
4363
|
-
},
|
|
4364
|
-
destroy() {
|
|
4365
|
-
listeners.clear();
|
|
4366
|
-
if (typeof window !== "undefined")
|
|
4367
|
-
window.removeEventListener("storage", onStorage);
|
|
4368
|
-
}
|
|
4369
|
-
};
|
|
4370
|
-
}
|
|
4371
|
-
|
|
4372
4068
|
// src/ui/requestformat.ts
|
|
4373
4069
|
var LIGHT_WHY = "the browser gives a page only timing and size for this";
|
|
4374
4070
|
var HIDDEN = "<hidden>";
|
|
@@ -6638,6 +6334,51 @@ function handleHint(keys, mac) {
|
|
|
6638
6334
|
return `press ${comboLabel(keys.panel, mac)} to open knobs`;
|
|
6639
6335
|
}
|
|
6640
6336
|
var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
|
|
6337
|
+
var KEEP_LABEL = "keep edits after reload";
|
|
6338
|
+
var KEEP_HINT = "keeps your Elements edits on this page after a reload.";
|
|
6339
|
+
function keepRow(resolve) {
|
|
6340
|
+
const control = button("switch row-control", "");
|
|
6341
|
+
control.setAttribute("role", "switch");
|
|
6342
|
+
control.setAttribute("aria-label", KEEP_LABEL);
|
|
6343
|
+
const hint = el("div", "row-hint", KEEP_HINT);
|
|
6344
|
+
hint.id = "devknobs-keep-hint";
|
|
6345
|
+
control.setAttribute("aria-describedby", hint.id);
|
|
6346
|
+
const node = rowBox({
|
|
6347
|
+
main: el("div", "main"),
|
|
6348
|
+
glyph: icon("rotate-ccw"),
|
|
6349
|
+
title: KEEP_LABEL,
|
|
6350
|
+
ends: [control]
|
|
6351
|
+
}).box;
|
|
6352
|
+
node.append(hint);
|
|
6353
|
+
let keep = null;
|
|
6354
|
+
let stop2 = null;
|
|
6355
|
+
const draw = () => {
|
|
6356
|
+
if (!keep)
|
|
6357
|
+
return;
|
|
6358
|
+
mark(control, keep.on(), "aria-checked");
|
|
6359
|
+
control.disabled = !keep.known();
|
|
6360
|
+
};
|
|
6361
|
+
control.addEventListener("click", () => keep?.set(!keep.on()));
|
|
6362
|
+
function sync() {
|
|
6363
|
+
const now2 = resolve();
|
|
6364
|
+
if (now2 !== keep) {
|
|
6365
|
+
stop2?.();
|
|
6366
|
+
keep = now2;
|
|
6367
|
+
stop2 = keep ? keep.subscribe(draw) : null;
|
|
6368
|
+
}
|
|
6369
|
+
node.hidden = !keep;
|
|
6370
|
+
draw();
|
|
6371
|
+
}
|
|
6372
|
+
sync();
|
|
6373
|
+
return {
|
|
6374
|
+
node,
|
|
6375
|
+
sync,
|
|
6376
|
+
destroy() {
|
|
6377
|
+
stop2?.();
|
|
6378
|
+
stop2 = null;
|
|
6379
|
+
}
|
|
6380
|
+
};
|
|
6381
|
+
}
|
|
6641
6382
|
function createSettings(context) {
|
|
6642
6383
|
const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
|
|
6643
6384
|
const keysView = el("div", "keys pane");
|
|
@@ -6724,12 +6465,20 @@ function createSettings(context) {
|
|
|
6724
6465
|
const devIconSwitch = button("switch row-control", "");
|
|
6725
6466
|
devIconSwitch.setAttribute("role", "switch");
|
|
6726
6467
|
devIconSwitch.setAttribute("aria-label", "dev tab icon");
|
|
6727
|
-
|
|
6468
|
+
const devIconRow = rowBox({
|
|
6728
6469
|
main: el("div", "main"),
|
|
6729
6470
|
glyph: icon("image"),
|
|
6730
6471
|
title: "dev tab icon",
|
|
6731
6472
|
ends: [devIconSwitch]
|
|
6732
|
-
}).box
|
|
6473
|
+
}).box;
|
|
6474
|
+
keysView.append(devIconRow);
|
|
6475
|
+
const keepEdits = keepRow(context.keep);
|
|
6476
|
+
const placeKeep = () => {
|
|
6477
|
+
keepEdits.sync();
|
|
6478
|
+
if (!keepEdits.node.hidden && !keysView.contains(keepEdits.node))
|
|
6479
|
+
keysView.insertBefore(keepEdits.node, devIconRow);
|
|
6480
|
+
};
|
|
6481
|
+
placeKeep();
|
|
6733
6482
|
devIconSwitch.addEventListener("click", () => context.setDevIcon(!context.devIconShown()));
|
|
6734
6483
|
keysView.append(rowsLabel("shortcuts"));
|
|
6735
6484
|
const keyViews = new Map;
|
|
@@ -6809,6 +6558,7 @@ function createSettings(context) {
|
|
|
6809
6558
|
if (context.searching())
|
|
6810
6559
|
context.leaveSearch();
|
|
6811
6560
|
editingKeys = true;
|
|
6561
|
+
placeKeep();
|
|
6812
6562
|
render();
|
|
6813
6563
|
focusView("keys");
|
|
6814
6564
|
}
|
|
@@ -6888,8 +6638,12 @@ function createSettings(context) {
|
|
|
6888
6638
|
return true;
|
|
6889
6639
|
},
|
|
6890
6640
|
stopRecording,
|
|
6641
|
+
openKeys,
|
|
6891
6642
|
leaveKeys,
|
|
6892
|
-
destroy
|
|
6643
|
+
destroy() {
|
|
6644
|
+
stopRefusing();
|
|
6645
|
+
keepEdits.destroy();
|
|
6646
|
+
}
|
|
6893
6647
|
};
|
|
6894
6648
|
}
|
|
6895
6649
|
|
|
@@ -6937,7 +6691,7 @@ var CSS = `
|
|
|
6937
6691
|
--edge: 0px;
|
|
6938
6692
|
--edge-line: transparent;
|
|
6939
6693
|
--glide: 220ms;
|
|
6940
|
-
--panel-width:
|
|
6694
|
+
--panel-width: 320px;
|
|
6941
6695
|
/* The columns: what a row keeps clear inside its edges, an icon's width,
|
|
6942
6696
|
the room between an icon and its word, and how far in a line of words
|
|
6943
6697
|
starts and ends. */
|
|
@@ -7044,6 +6798,7 @@ button {
|
|
|
7044
6798
|
}
|
|
7045
6799
|
:focus { outline: none; }
|
|
7046
6800
|
button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
6801
|
+
input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-offset: 1px; }
|
|
7047
6802
|
|
|
7048
6803
|
.handle {
|
|
7049
6804
|
flex: none;
|
|
@@ -7131,7 +6886,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
7131
6886
|
would stay on the window's edge as a line the panel's height. It hides
|
|
7132
6887
|
once the slide is over. The edge side's border and the padding that pays
|
|
7133
6888
|
for it go once its color has eased out. The width glides to a new one, as
|
|
7134
|
-
|
|
6889
|
+
the strip's keys set it, and the panel turns that off under the strip. */
|
|
7135
6890
|
visibility: hidden;
|
|
7136
6891
|
transition: visibility 0s linear 150ms, border-top-right-radius var(--glide) ease-out,
|
|
7137
6892
|
border-bottom-right-radius var(--glide) ease-out, border-right-color var(--glide) ease-out,
|
|
@@ -8280,12 +8035,41 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8280
8035
|
min-height: 96px;
|
|
8281
8036
|
max-height: 85vh;
|
|
8282
8037
|
overflow: auto;
|
|
8283
|
-
resize: vertical;
|
|
8284
8038
|
overscroll-behavior: contain;
|
|
8285
8039
|
scrollbar-width: thin;
|
|
8286
8040
|
scrollbar-color: var(--line) transparent;
|
|
8287
8041
|
}
|
|
8288
8042
|
.dom[style*="height"] { flex-grow: 0; }
|
|
8043
|
+
/* The line between the tree and the styles, which drags for the tree's
|
|
8044
|
+
height as the browser's own does: 7 tall to the pointer, -4 in the flow
|
|
8045
|
+
so with the two 4px gaps 4 stay between the tree and the styles, a
|
|
8046
|
+
hairline at 2 of them that darkens under the pointer, the keys' focus or a
|
|
8047
|
+
drag. */
|
|
8048
|
+
.dom-split {
|
|
8049
|
+
position: relative;
|
|
8050
|
+
flex: none;
|
|
8051
|
+
height: 7px;
|
|
8052
|
+
margin: -5px 0 -6px;
|
|
8053
|
+
cursor: row-resize;
|
|
8054
|
+
touch-action: none;
|
|
8055
|
+
user-select: none;
|
|
8056
|
+
-webkit-user-select: none;
|
|
8057
|
+
outline: none;
|
|
8058
|
+
z-index: 1;
|
|
8059
|
+
}
|
|
8060
|
+
.dom-split::after {
|
|
8061
|
+
content: "";
|
|
8062
|
+
position: absolute;
|
|
8063
|
+
left: 0;
|
|
8064
|
+
right: 0;
|
|
8065
|
+
top: 3px;
|
|
8066
|
+
height: 1px;
|
|
8067
|
+
background: var(--line);
|
|
8068
|
+
transition: background-color 120ms ease-out;
|
|
8069
|
+
}
|
|
8070
|
+
.dom-split:hover::after,
|
|
8071
|
+
.dom-split:focus-visible::after,
|
|
8072
|
+
.dom-split[data-drag]::after { background: var(--faint); }
|
|
8289
8073
|
.dom-tree { width: min-content; min-width: 100%; font: 11px/1.6 var(--mono); }
|
|
8290
8074
|
.dom-row {
|
|
8291
8075
|
display: flex;
|
|
@@ -8295,6 +8079,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8295
8079
|
user-select: text;
|
|
8296
8080
|
-webkit-user-select: text;
|
|
8297
8081
|
}
|
|
8082
|
+
.dom-row { position: relative; }
|
|
8298
8083
|
.dom-row:hover { background: var(--card); }
|
|
8299
8084
|
.dom-row.on { background: var(--card); }
|
|
8300
8085
|
.dom-tree:focus-within .dom-row.on { background: var(--pick); }
|
|
@@ -8302,6 +8087,110 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8302
8087
|
.dom-code { flex: 0 1 auto; min-width: 30ch; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
|
|
8303
8088
|
.dom-ref { white-space: pre; color: var(--faint); }
|
|
8304
8089
|
.dom-code > .act { margin-left: var(--col-pad); height: 1.6em; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.6em; vertical-align: top; }
|
|
8090
|
+
/* A line whose element the panel hid, faint as its box on the page is gone. */
|
|
8091
|
+
.dom-hid > .dom-code { opacity: 0.5; }
|
|
8092
|
+
/* The html editor: line numbers on the card's fill beside the text, which is
|
|
8093
|
+
colored by the pre under a clear text box, the two set alike to the
|
|
8094
|
+
pixel, a scrollbar's room kept in both, so a long line wraps at the same
|
|
8095
|
+
place in each and its number stays at its first row. The grip under it
|
|
8096
|
+
drags its height, the button makes it the panel's. */
|
|
8097
|
+
.dom-code:has(> .html-ed), .dom-code:has(> .dom-edit) { flex: 1 1 auto; }
|
|
8098
|
+
.dom-code > .html-ed { display: block; width: 100%; min-width: 30ch; margin: 2px 0; }
|
|
8099
|
+
.html-ed-body {
|
|
8100
|
+
overflow: hidden;
|
|
8101
|
+
background: var(--bg);
|
|
8102
|
+
border-radius: 4px;
|
|
8103
|
+
box-shadow: inset 0 0 0 1px var(--faint);
|
|
8104
|
+
}
|
|
8105
|
+
.html-ed-code {
|
|
8106
|
+
position: relative;
|
|
8107
|
+
height: 100%;
|
|
8108
|
+
overflow: hidden;
|
|
8109
|
+
background: linear-gradient(var(--card), var(--card)) no-repeat;
|
|
8110
|
+
}
|
|
8111
|
+
.html-ed-hl, .html-ed .dom-html {
|
|
8112
|
+
position: absolute;
|
|
8113
|
+
inset: 0;
|
|
8114
|
+
margin: 0;
|
|
8115
|
+
padding: 4px var(--col-pad);
|
|
8116
|
+
font: 11px/1.6 var(--mono);
|
|
8117
|
+
letter-spacing: normal;
|
|
8118
|
+
white-space: pre-wrap;
|
|
8119
|
+
tab-size: 2;
|
|
8120
|
+
overflow-wrap: anywhere;
|
|
8121
|
+
word-break: normal;
|
|
8122
|
+
scrollbar-gutter: stable;
|
|
8123
|
+
scrollbar-width: thin;
|
|
8124
|
+
}
|
|
8125
|
+
.html-ed-hl { padding-left: 0; overflow: hidden; color: var(--fg); pointer-events: none; }
|
|
8126
|
+
.html-ed-hl > .html-ed-inner { display: grid; }
|
|
8127
|
+
.html-ed-num {
|
|
8128
|
+
padding: 0 var(--col-pad);
|
|
8129
|
+
color: var(--faint);
|
|
8130
|
+
text-align: right;
|
|
8131
|
+
user-select: none;
|
|
8132
|
+
-webkit-user-select: none;
|
|
8133
|
+
}
|
|
8134
|
+
.html-ed-text { min-height: 1.6em; padding-left: var(--col-pad); }
|
|
8135
|
+
.html-ed .dom-html {
|
|
8136
|
+
width: 100%;
|
|
8137
|
+
height: 100%;
|
|
8138
|
+
max-height: none;
|
|
8139
|
+
overflow: auto;
|
|
8140
|
+
resize: none;
|
|
8141
|
+
color: transparent;
|
|
8142
|
+
caret-color: var(--fg);
|
|
8143
|
+
background: transparent;
|
|
8144
|
+
border-radius: 0;
|
|
8145
|
+
box-shadow: none;
|
|
8146
|
+
scrollbar-width: thin;
|
|
8147
|
+
}
|
|
8148
|
+
.html-ed .dom-html::selection { background: color-mix(in srgb, var(--faint) 35%, transparent); }
|
|
8149
|
+
.html-ed .dom-html.bad { caret-color: var(--hot); }
|
|
8150
|
+
.html-ed:has(.bad) > .html-ed-body { box-shadow: inset 0 0 0 1px var(--hot); }
|
|
8151
|
+
.html-ed-foot { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
|
|
8152
|
+
.html-ed-grip { flex: 1 1 auto; display: grid; place-items: center; height: 12px; cursor: ns-resize; touch-action: none; }
|
|
8153
|
+
.html-ed-grip::after { content: ""; width: 32px; height: 3px; background: var(--line); border-radius: 2px; transition: background 120ms ease-out; }
|
|
8154
|
+
.html-ed-grip:hover::after { background: var(--faint); }
|
|
8155
|
+
.dom-code > .dom-apply { margin: 4px 0 2px; }
|
|
8156
|
+
/* The selected line's actions, kept in sight at the foot of the tree as it scrolls either way. */
|
|
8157
|
+
.dom-acts {
|
|
8158
|
+
position: sticky;
|
|
8159
|
+
left: 0;
|
|
8160
|
+
bottom: 0;
|
|
8161
|
+
display: flex;
|
|
8162
|
+
flex-wrap: wrap;
|
|
8163
|
+
gap: 4px;
|
|
8164
|
+
padding: 4px var(--view-end) 4px var(--view-start);
|
|
8165
|
+
background: var(--bg);
|
|
8166
|
+
border-top: 1px solid var(--line);
|
|
8167
|
+
}
|
|
8168
|
+
/* The handle that drags an element's line, at the start of its step in: on
|
|
8169
|
+
hover and on the selected line, and always under a finger. The line being
|
|
8170
|
+
dragged is faint; where it would go is a line over or under another, or
|
|
8171
|
+
a ring around the element it would go into. */
|
|
8172
|
+
.dom-grip {
|
|
8173
|
+
position: absolute;
|
|
8174
|
+
top: 0;
|
|
8175
|
+
width: 1.2em;
|
|
8176
|
+
line-height: 1.6;
|
|
8177
|
+
text-align: center;
|
|
8178
|
+
color: var(--faint);
|
|
8179
|
+
cursor: grab;
|
|
8180
|
+
opacity: 0;
|
|
8181
|
+
touch-action: none;
|
|
8182
|
+
user-select: none;
|
|
8183
|
+
-webkit-user-select: none;
|
|
8184
|
+
transition: opacity 120ms ease-out;
|
|
8185
|
+
}
|
|
8186
|
+
.dom-row:hover > .dom-grip, .dom-row.on > .dom-grip { opacity: 1; }
|
|
8187
|
+
@media (hover: none) { .dom-grip { opacity: 0.6; } }
|
|
8188
|
+
.dom-grip:hover { color: var(--fg); }
|
|
8189
|
+
.dom-drag, .dom-drag * { cursor: grabbing; }
|
|
8190
|
+
.dom-dragging > .dom-code { opacity: 0.45; }
|
|
8191
|
+
.dom-drop-before { box-shadow: inset 0 2px 0 var(--fg); }
|
|
8192
|
+
.dom-drop-after { box-shadow: inset 0 -2px 0 var(--fg); }
|
|
8193
|
+
.dom-drop-into { box-shadow: inset 0 0 0 1px var(--fg); }
|
|
8305
8194
|
.dom-flash { animation: dom-flash 900ms ease-out; }
|
|
8306
8195
|
@keyframes dom-flash {
|
|
8307
8196
|
from { background: var(--pick); }
|
|
@@ -8366,8 +8255,9 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8366
8255
|
text-overflow: ellipsis;
|
|
8367
8256
|
white-space: nowrap;
|
|
8368
8257
|
}
|
|
8369
|
-
/* A declaration that wraps goes on further in than it starts.
|
|
8370
|
-
|
|
8258
|
+
/* A declaration that wraps goes on further in than it starts. Every line
|
|
8259
|
+
keeps the gutter an editable line's box stands in, so no text moves. */
|
|
8260
|
+
.css-decl { display: block; padding-left: 30px; text-indent: -12px; text-decoration: none; }
|
|
8371
8261
|
/* A name has the color of a key, its value the text's, and the marks between
|
|
8372
8262
|
them are quiet. A declaration that is struck through is quiet all over. */
|
|
8373
8263
|
.css-name { color: var(--key); }
|
|
@@ -8415,10 +8305,141 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
|
|
|
8415
8305
|
padding-right: var(--view-end);
|
|
8416
8306
|
padding-left: var(--view-start);
|
|
8417
8307
|
}
|
|
8418
|
-
.css-applied .css-decl { padding-left: 12px; }
|
|
8419
8308
|
.css-label { font-size: 10.5px; color: var(--faint); }
|
|
8420
8309
|
.css-comes { color: var(--faint); }
|
|
8421
8310
|
.css-hidden { padding: 2px var(--view-end) 2px var(--view-start); font-size: 10.5px; color: var(--faint); overflow-wrap: anywhere; }
|
|
8311
|
+
/* Editing, as in the browsers' tools: a checkbox in a line's gutter turns
|
|
8312
|
+
it off and on, shown on hover, on focus and on a line that is off. Its
|
|
8313
|
+
ring and its check are cut out of a fill by a mask, so they follow the
|
|
8314
|
+
theme with no line drawn. A value is a
|
|
8315
|
+
field on a click, as wide as what it holds, on the track's fill, its text
|
|
8316
|
+
red where the page did not take it. Adding a property is a quiet line
|
|
8317
|
+
under a block, in from its edge as a declaration's first line is. */
|
|
8318
|
+
.css-decl.can-edit { position: relative; }
|
|
8319
|
+
.css-toggle {
|
|
8320
|
+
position: absolute;
|
|
8321
|
+
top: 2.5px;
|
|
8322
|
+
left: 2px;
|
|
8323
|
+
width: 12px;
|
|
8324
|
+
height: 12px;
|
|
8325
|
+
opacity: 0;
|
|
8326
|
+
background: var(--faint);
|
|
8327
|
+
border-radius: 3px;
|
|
8328
|
+
cursor: pointer;
|
|
8329
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zm0 1.25C2 1.25 1.25 2 1.25 3v6c0 1 .75 1.75 1.75 1.75h6c1 0 1.75-.75 1.75-1.75V3c0-1-.75-1.75-1.75-1.75z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
|
|
8330
|
+
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zm0 1.25C2 1.25 1.25 2 1.25 3v6c0 1 .75 1.75 1.75 1.75h6c1 0 1.75-.75 1.75-1.75V3c0-1-.75-1.75-1.75-1.75z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
|
|
8331
|
+
transition: opacity 120ms ease-out;
|
|
8332
|
+
}
|
|
8333
|
+
.css-toggle:checked {
|
|
8334
|
+
background: var(--fg);
|
|
8335
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zM2.6 6.1 3.7 5l1.6 1.6 3.4-3.4 1.1 1.1-4.5 4.5z'/%3E%3C/svg%3E");
|
|
8336
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill-rule='evenodd' d='M3 0h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V3a3 3 0 0 1 3-3zM2.6 6.1 3.7 5l1.6 1.6 3.4-3.4 1.1 1.1-4.5 4.5z'/%3E%3C/svg%3E");
|
|
8337
|
+
}
|
|
8338
|
+
.css-decl.can-edit:hover > .css-toggle, .css-toggle:focus-visible, .css-decl.off > .css-toggle { opacity: 1; }
|
|
8339
|
+
.css-editable { border-radius: 2px; cursor: text; }
|
|
8340
|
+
.css-editable:hover, .css-editable:focus-visible { background: var(--track); }
|
|
8341
|
+
/* A field wraps where its value is wider than its line, and grows down, as
|
|
8342
|
+
tall as what it holds up to a height it scrolls in: nothing scrolls sideways. */
|
|
8343
|
+
.css-edit {
|
|
8344
|
+
max-width: 100%;
|
|
8345
|
+
max-height: 18em;
|
|
8346
|
+
padding: 0;
|
|
8347
|
+
font: inherit;
|
|
8348
|
+
text-indent: 0;
|
|
8349
|
+
vertical-align: top;
|
|
8350
|
+
white-space: pre-wrap;
|
|
8351
|
+
overflow-wrap: anywhere;
|
|
8352
|
+
overflow: hidden auto;
|
|
8353
|
+
resize: none;
|
|
8354
|
+
scrollbar-width: thin;
|
|
8355
|
+
color: var(--fg);
|
|
8356
|
+
background: var(--track);
|
|
8357
|
+
border-radius: 2px;
|
|
8358
|
+
}
|
|
8359
|
+
.css-edit.bad { color: var(--hot); }
|
|
8360
|
+
/* The field's ring, as a chip's field has it while focused, in place of the browser's border. */
|
|
8361
|
+
.inline-field { border: 0; box-shadow: inset 0 0 0 1px var(--faint); }
|
|
8362
|
+
.css-add, .css-adding { padding-left: 18px; }
|
|
8363
|
+
.css-add, .css-new-rule {
|
|
8364
|
+
display: block;
|
|
8365
|
+
font: 11px/1.5 var(--mono);
|
|
8366
|
+
color: var(--faint);
|
|
8367
|
+
border-radius: 2px;
|
|
8368
|
+
transition: color 120ms ease-out;
|
|
8369
|
+
}
|
|
8370
|
+
.css-add:hover, .css-new-rule:hover { color: var(--fg); }
|
|
8371
|
+
.css-adding { text-indent: 0; }
|
|
8372
|
+
/* The suggestions under a field of the styles view: a raised list placed
|
|
8373
|
+
under the field, the one marked in the selected line's tint. */
|
|
8374
|
+
.ac-list {
|
|
8375
|
+
position: absolute;
|
|
8376
|
+
z-index: 3;
|
|
8377
|
+
display: grid;
|
|
8378
|
+
min-width: 16ch;
|
|
8379
|
+
max-width: 100%;
|
|
8380
|
+
max-height: 12.8em;
|
|
8381
|
+
overflow-y: auto;
|
|
8382
|
+
padding: 2px 0;
|
|
8383
|
+
font: 11px/1.6 var(--mono);
|
|
8384
|
+
text-indent: 0;
|
|
8385
|
+
white-space: nowrap;
|
|
8386
|
+
color: var(--fg);
|
|
8387
|
+
background: var(--raised);
|
|
8388
|
+
border-radius: 4px;
|
|
8389
|
+
box-shadow: var(--lift), 0 0 0 1px var(--line);
|
|
8390
|
+
scrollbar-width: thin;
|
|
8391
|
+
}
|
|
8392
|
+
.ac-item { padding: 0 var(--col-pad); overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
|
|
8393
|
+
.ac-item:hover { background: var(--card); }
|
|
8394
|
+
.ac-item[aria-selected="true"] { background: var(--pick); }
|
|
8395
|
+
/* The line that adds a rule stands under the blocks, as the start of one. */
|
|
8396
|
+
.css-new-rule { justify-self: start; padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8397
|
+
.css-rule-adding { padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8398
|
+
/* The states a chip forces, in the editors' chips, the selector's font. */
|
|
8399
|
+
.force-states { padding: 0 var(--view-end) 4px var(--view-start); }
|
|
8400
|
+
.force-states .chip { font: 11px/22px var(--mono); }
|
|
8401
|
+
|
|
8402
|
+
/* The changes at the foot of the Elements view, which stay in sight while
|
|
8403
|
+
the styles scroll: a quiet head, each edit as diff lines tinted for what
|
|
8404
|
+
went and what came, then the buttons, the prompt the filled one. */
|
|
8405
|
+
.changes {
|
|
8406
|
+
position: sticky;
|
|
8407
|
+
bottom: 0;
|
|
8408
|
+
/* Over the styles' bar where the two meet, with a long list. */
|
|
8409
|
+
z-index: 2;
|
|
8410
|
+
display: grid;
|
|
8411
|
+
grid-template-columns: minmax(0, 1fr);
|
|
8412
|
+
gap: 6px;
|
|
8413
|
+
padding: 8px var(--view-end) 8px var(--view-start);
|
|
8414
|
+
background: var(--bg);
|
|
8415
|
+
border-top: 1px solid var(--line);
|
|
8416
|
+
}
|
|
8417
|
+
.changes-head, .changes-note { font-size: 10.5px; color: var(--faint); }
|
|
8418
|
+
/* The count is the button that folds the diff out, its chevron turned while it shows. */
|
|
8419
|
+
.changes-toggle { color: inherit; border-radius: 2px; transition: color 120ms ease-out; }
|
|
8420
|
+
.changes-toggle:hover { color: var(--fg); }
|
|
8421
|
+
.changes-toggle::before { content: "›"; display: inline-block; width: 2ch; text-align: left; transform-origin: 0.5ch 50%; transition: transform 120ms ease-out; }
|
|
8422
|
+
.changes-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
|
|
8423
|
+
/* What was made again as the page loaded, and the edits that were not. */
|
|
8424
|
+
.changes-kept { display: grid; gap: 2px; font-size: 11px; }
|
|
8425
|
+
.changes-kept-line { color: var(--fg); }
|
|
8426
|
+
.changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
|
8427
|
+
.changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
|
|
8428
|
+
/* The switch that keeps the edits after a reload, over the tree. */
|
|
8429
|
+
.changes-list {
|
|
8430
|
+
max-height: 30vh;
|
|
8431
|
+
overflow: auto;
|
|
8432
|
+
font: 11px/1.5 var(--mono);
|
|
8433
|
+
overflow-wrap: anywhere;
|
|
8434
|
+
scrollbar-width: thin;
|
|
8435
|
+
}
|
|
8436
|
+
.diff-place { padding: 4px var(--col-pad) 0; color: var(--faint); }
|
|
8437
|
+
.diff-place:first-child { padding-top: 0; }
|
|
8438
|
+
.diff-del, .diff-add { padding: 0 var(--col-pad); border-radius: 2px; }
|
|
8439
|
+
.diff-del { background: color-mix(in srgb, var(--hot) 14%, transparent); }
|
|
8440
|
+
.diff-add { background: color-mix(in srgb, var(--ok) 14%, transparent); }
|
|
8441
|
+
.changes-acts { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
8442
|
+
.chip.changes-go, .chip.changes-go:hover { color: var(--bg); background: var(--fg); }
|
|
8422
8443
|
|
|
8423
8444
|
/* The element's box, in a fold of the kit's: a picture of the element, so
|
|
8424
8445
|
its areas are filled, each in the hue the page's own tint of it has, mixed
|
|
@@ -8736,6 +8757,11 @@ function ownCss(media) {
|
|
|
8736
8757
|
};
|
|
8737
8758
|
return CSS.replace(/@media ([^{]+)\{/g, settle2).replaceAll("color-scheme: light dark", `color-scheme: ${media.scheme}`);
|
|
8738
8759
|
}
|
|
8760
|
+
function resetPage(log = edits, reset2 = reset) {
|
|
8761
|
+
log.undoAll();
|
|
8762
|
+
clearForced();
|
|
8763
|
+
reset2();
|
|
8764
|
+
}
|
|
8739
8765
|
function createPanel(options2 = {}) {
|
|
8740
8766
|
const keys = options2.keys ?? createKeys();
|
|
8741
8767
|
const prefs = createPrefs({ handle: options2.handle });
|
|
@@ -8761,7 +8787,7 @@ function createPanel(options2 = {}) {
|
|
|
8761
8787
|
const flip = () => drag.flip();
|
|
8762
8788
|
stage.flip = flip;
|
|
8763
8789
|
const actionsHere = availableActions();
|
|
8764
|
-
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" || inspect !== null));
|
|
8790
|
+
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
|
|
8765
8791
|
const host = document.createElement("div");
|
|
8766
8792
|
host.setAttribute("data-devknobs", "panel");
|
|
8767
8793
|
host.style.cssText = HOST_STYLE;
|
|
@@ -8837,6 +8863,7 @@ function createPanel(options2 = {}) {
|
|
|
8837
8863
|
setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
|
|
8838
8864
|
realPhone: hostSendsUa(),
|
|
8839
8865
|
setRealPhone: (on) => setState({ panel: { realPhone: on } }),
|
|
8866
|
+
keep: keeper,
|
|
8840
8867
|
native: nativeSwitch()?.setting ?? null,
|
|
8841
8868
|
setNative: (on) => {
|
|
8842
8869
|
nativeSwitch()?.setting.change(on);
|
|
@@ -8870,7 +8897,6 @@ function createPanel(options2 = {}) {
|
|
|
8870
8897
|
wrap,
|
|
8871
8898
|
panel,
|
|
8872
8899
|
prefs,
|
|
8873
|
-
showing: () => viewing() ? "view" : "list",
|
|
8874
8900
|
place: () => getState().panel,
|
|
8875
8901
|
wide: setDockWidth,
|
|
8876
8902
|
sized: panelSized
|
|
@@ -8960,7 +8986,7 @@ function createPanel(options2 = {}) {
|
|
|
8960
8986
|
rows.hidden = !anyShown;
|
|
8961
8987
|
const resetHint = hints.get("reset");
|
|
8962
8988
|
if (resetHint)
|
|
8963
|
-
resetHint.disabled = isReset(state);
|
|
8989
|
+
resetHint.disabled = isReset(state) && edits.list().length === 0;
|
|
8964
8990
|
badge.textContent = overflowBadge(state.overflow, live.overflow);
|
|
8965
8991
|
badge.hidden = badge.textContent === "";
|
|
8966
8992
|
badge.classList.toggle("hot", hot);
|
|
@@ -9024,7 +9050,7 @@ function createPanel(options2 = {}) {
|
|
|
9024
9050
|
searchInput.value = "";
|
|
9025
9051
|
for (const action of actionsHere)
|
|
9026
9052
|
stopAction(action);
|
|
9027
|
-
|
|
9053
|
+
resetPage();
|
|
9028
9054
|
}
|
|
9029
9055
|
function onInspect(on) {
|
|
9030
9056
|
const at = root.activeElement;
|
|
@@ -9071,9 +9097,17 @@ function createPanel(options2 = {}) {
|
|
|
9071
9097
|
actionOf("storage")?.run();
|
|
9072
9098
|
return;
|
|
9073
9099
|
}
|
|
9100
|
+
if (action === "requests" || action === "elements") {
|
|
9101
|
+
showView(action);
|
|
9102
|
+
return;
|
|
9103
|
+
}
|
|
9104
|
+
if (action === "settings") {
|
|
9105
|
+
showSettings();
|
|
9106
|
+
return;
|
|
9107
|
+
}
|
|
9074
9108
|
if (!getState().panel.open)
|
|
9075
9109
|
return;
|
|
9076
|
-
if (action === "replay"
|
|
9110
|
+
if (action === "replay")
|
|
9077
9111
|
actionOf(action)?.run();
|
|
9078
9112
|
else if (action === "reset")
|
|
9079
9113
|
runCommand("reset");
|
|
@@ -9082,6 +9116,31 @@ function createPanel(options2 = {}) {
|
|
|
9082
9116
|
else
|
|
9083
9117
|
toggle(false);
|
|
9084
9118
|
}
|
|
9119
|
+
function opensPanel(action) {
|
|
9120
|
+
return action === "toggle" || action === "storage" || action === "requests" || action === "settings" || action === "elements";
|
|
9121
|
+
}
|
|
9122
|
+
function showView(action) {
|
|
9123
|
+
const id = side.view();
|
|
9124
|
+
const mine = action === "requests" ? requests.shows() : id === STYLES_VIEW;
|
|
9125
|
+
if (mine && getState().panel.open && viewing()) {
|
|
9126
|
+
side.close();
|
|
9127
|
+
return;
|
|
9128
|
+
}
|
|
9129
|
+
if (mine && id !== null)
|
|
9130
|
+
side.show(id);
|
|
9131
|
+
else if (action === "requests")
|
|
9132
|
+
requestsHere.toggle();
|
|
9133
|
+
else
|
|
9134
|
+
inspector?.elements();
|
|
9135
|
+
}
|
|
9136
|
+
function showSettings() {
|
|
9137
|
+
if (getState().panel.open && settings.editing()) {
|
|
9138
|
+
settings.leaveKeys();
|
|
9139
|
+
return;
|
|
9140
|
+
}
|
|
9141
|
+
toggle(true);
|
|
9142
|
+
settings.openKeys();
|
|
9143
|
+
}
|
|
9085
9144
|
function escape() {
|
|
9086
9145
|
if (drag.dragging() || !getState().panel.open)
|
|
9087
9146
|
return;
|
|
@@ -9131,8 +9190,8 @@ function createPanel(options2 = {}) {
|
|
|
9131
9190
|
event.stopPropagation();
|
|
9132
9191
|
return;
|
|
9133
9192
|
}
|
|
9134
|
-
const action = keyAction(event, keys.get());
|
|
9135
|
-
const acts = action !== null && action !== "close" && !drag.dragging() && (action
|
|
9193
|
+
const action = keyAction(event, keysListed(keys.get(), bindingsHere));
|
|
9194
|
+
const acts = action !== null && action !== "close" && !drag.dragging() && (opensPanel(action) || getState().panel.open);
|
|
9136
9195
|
const inSearch = event.composedPath()[0] === searchInput;
|
|
9137
9196
|
if (acts || action && action !== "close" && inSearch)
|
|
9138
9197
|
event.preventDefault();
|
|
@@ -9181,6 +9240,7 @@ function createPanel(options2 = {}) {
|
|
|
9181
9240
|
stage.inspector = inspector;
|
|
9182
9241
|
const stopModes = actionsHere.flatMap((action) => action.watch?.(render) ?? []);
|
|
9183
9242
|
const stopCount = onCount(render);
|
|
9243
|
+
const stopEdits = edits.subscribe(render);
|
|
9184
9244
|
window.addEventListener("keydown", onKeydown, true);
|
|
9185
9245
|
window.addEventListener("pointerdown", onPointerDown, true);
|
|
9186
9246
|
window.addEventListener("pointerup", onPointerUp, true);
|
|
@@ -9232,6 +9292,7 @@ function createPanel(options2 = {}) {
|
|
|
9232
9292
|
if (stage.inspector === inspector)
|
|
9233
9293
|
stage.inspector = null;
|
|
9234
9294
|
stopCount();
|
|
9295
|
+
stopEdits();
|
|
9235
9296
|
clearInterval(ticker);
|
|
9236
9297
|
tips.destroy();
|
|
9237
9298
|
settings.destroy();
|
|
@@ -9259,7 +9320,7 @@ function createPanel(options2 = {}) {
|
|
|
9259
9320
|
}
|
|
9260
9321
|
|
|
9261
9322
|
// src/version.ts
|
|
9262
|
-
var VERSION = "0.
|
|
9323
|
+
var VERSION = "0.6.1";
|
|
9263
9324
|
// src/index.ts
|
|
9264
9325
|
var panel = null;
|
|
9265
9326
|
var stopKeys = null;
|
|
@@ -9310,12 +9371,20 @@ function mount(options2 = {}) {
|
|
|
9310
9371
|
start(options2);
|
|
9311
9372
|
mounted = options2;
|
|
9312
9373
|
attach(options2);
|
|
9374
|
+
if (!isDevknobsFrame() && !fresh())
|
|
9375
|
+
keepEdits(options2.editsStore);
|
|
9376
|
+
}
|
|
9377
|
+
function keepEdits(store) {
|
|
9378
|
+
const path = pathNow();
|
|
9379
|
+
const frame = () => framedPage(window, frameWindow(), path, needsFrame(getState()));
|
|
9380
|
+
startKeep(store, { frame, settled: () => pageSettled(window, () => needsFrame(getState()), frame) });
|
|
9313
9381
|
}
|
|
9314
9382
|
function attach(options2) {
|
|
9315
9383
|
const live = createKeys({
|
|
9316
9384
|
hotkey: options2.hotkey,
|
|
9317
9385
|
grabKey: options2.grabKey,
|
|
9318
|
-
grab: options2.grab !== false
|
|
9386
|
+
grab: options2.grab !== false,
|
|
9387
|
+
store: options2.keysStore
|
|
9319
9388
|
});
|
|
9320
9389
|
keys = live;
|
|
9321
9390
|
if (options2.grab !== false) {
|
|
@@ -9420,6 +9489,7 @@ function adopt(options2, take) {
|
|
|
9420
9489
|
detach();
|
|
9421
9490
|
attach(mounted);
|
|
9422
9491
|
}
|
|
9492
|
+
var handing = false;
|
|
9423
9493
|
function handOver() {
|
|
9424
9494
|
const take = waiting;
|
|
9425
9495
|
const options2 = mounted;
|
|
@@ -9431,7 +9501,12 @@ function handOver() {
|
|
|
9431
9501
|
return;
|
|
9432
9502
|
}
|
|
9433
9503
|
const native = nativeSwitch();
|
|
9434
|
-
|
|
9504
|
+
handing = true;
|
|
9505
|
+
try {
|
|
9506
|
+
unmount();
|
|
9507
|
+
} finally {
|
|
9508
|
+
handing = false;
|
|
9509
|
+
}
|
|
9435
9510
|
const prefer = options2.prefer;
|
|
9436
9511
|
let took = false;
|
|
9437
9512
|
try {
|
|
@@ -9459,6 +9534,12 @@ function unmount() {
|
|
|
9459
9534
|
if (superseded(window, unmount))
|
|
9460
9535
|
return;
|
|
9461
9536
|
detach();
|
|
9537
|
+
stopKeep();
|
|
9538
|
+
if (!handing) {
|
|
9539
|
+
edits.undoAll();
|
|
9540
|
+
forgetReplay();
|
|
9541
|
+
clearForced();
|
|
9542
|
+
}
|
|
9462
9543
|
const native = mounted?.host ? nativeSwitch() : null;
|
|
9463
9544
|
stop();
|
|
9464
9545
|
withdraw(window, api);
|
|
@@ -9533,10 +9614,33 @@ async function grab(elements, options2) {
|
|
|
9533
9614
|
const host = hosted("grab");
|
|
9534
9615
|
if (host)
|
|
9535
9616
|
return host(elements, options2);
|
|
9536
|
-
const loaded = await import("./index-
|
|
9617
|
+
const loaded = await import("./index-kfdzsyyw.js");
|
|
9537
9618
|
return loaded.grab(elements, options2);
|
|
9538
9619
|
}
|
|
9539
|
-
|
|
9620
|
+
function edits2() {
|
|
9621
|
+
return (hosted("edits") ?? edits.list)();
|
|
9622
|
+
}
|
|
9623
|
+
async function setEdits(list) {
|
|
9624
|
+
const host = hosted("setEdits");
|
|
9625
|
+
if (host)
|
|
9626
|
+
return host(list);
|
|
9627
|
+
if (!Array.isArray(list))
|
|
9628
|
+
throw new TypeError("devknobs.setEdits takes a list of edits, as edits() gives them");
|
|
9629
|
+
const { replayEdits } = await import("./replay-j18rw92k.js");
|
|
9630
|
+
const { applied, skipped } = replayEdits(edits, list);
|
|
9631
|
+
return { applied, skipped };
|
|
9632
|
+
}
|
|
9633
|
+
function undoEdit() {
|
|
9634
|
+
return (hosted("undoEdit") ?? edits.undo)();
|
|
9635
|
+
}
|
|
9636
|
+
function forceState2(target, states = []) {
|
|
9637
|
+
const host = hosted("forceState");
|
|
9638
|
+
if (host)
|
|
9639
|
+
return host(target, states);
|
|
9640
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
9641
|
+
return forceState(element, states);
|
|
9642
|
+
}
|
|
9643
|
+
var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2, edits: edits2, setEdits, undoEdit, forceState: forceState2 };
|
|
9540
9644
|
|
|
9541
9645
|
// src/react.tsx
|
|
9542
9646
|
function DevKnobs(props) {
|