@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/index.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FADE_CURVE,
|
|
3
|
-
PAGE_MIN,
|
|
4
|
-
dockRoom,
|
|
5
|
-
dockWidth,
|
|
6
3
|
ease,
|
|
7
4
|
keepMounted,
|
|
8
|
-
lerp
|
|
9
|
-
|
|
10
|
-
watchColumn
|
|
11
|
-
} from "./index-j1h13ahg.js";
|
|
5
|
+
lerp
|
|
6
|
+
} from "./index-gm51cthv.js";
|
|
12
7
|
import {
|
|
13
8
|
GRAB_COLORS as GRAB_COLORS2,
|
|
14
9
|
GRAB_COLOR_NAMES,
|
|
@@ -17,15 +12,52 @@ import {
|
|
|
17
12
|
createGrab,
|
|
18
13
|
createInspect,
|
|
19
14
|
oneAtATime
|
|
20
|
-
} from "./index-
|
|
15
|
+
} from "./index-f60yax1j.js";
|
|
21
16
|
import {
|
|
22
17
|
hushOnce
|
|
23
|
-
} from "./index-
|
|
18
|
+
} from "./index-aymfvd8s.js";
|
|
19
|
+
import {
|
|
20
|
+
DRAG_SLOP,
|
|
21
|
+
FLING_SPAN,
|
|
22
|
+
FLING_TRAVEL,
|
|
23
|
+
GLIDE,
|
|
24
|
+
between,
|
|
25
|
+
clearForced,
|
|
26
|
+
cornerAt,
|
|
27
|
+
createPrefs,
|
|
28
|
+
createSizer,
|
|
29
|
+
dockedHandle,
|
|
30
|
+
dragDocked,
|
|
31
|
+
dragTarget,
|
|
32
|
+
dragTo,
|
|
33
|
+
forceState,
|
|
34
|
+
glideTime,
|
|
35
|
+
landSide,
|
|
36
|
+
otherSide,
|
|
37
|
+
settle,
|
|
38
|
+
translateOf,
|
|
39
|
+
velocity
|
|
40
|
+
} from "./index-yb7fc59g.js";
|
|
41
|
+
import {
|
|
42
|
+
dockRoom,
|
|
43
|
+
dockWidth,
|
|
44
|
+
setDockWidth,
|
|
45
|
+
watchColumn
|
|
46
|
+
} from "./index-58jdczmj.js";
|
|
47
|
+
import {
|
|
48
|
+
edits,
|
|
49
|
+
forgetReplay,
|
|
50
|
+
framedPage,
|
|
51
|
+
keeper,
|
|
52
|
+
pageSettled,
|
|
53
|
+
pathNow,
|
|
54
|
+
startKeep,
|
|
55
|
+
stopKeep
|
|
56
|
+
} from "./index-0zp9py56.js";
|
|
24
57
|
import {
|
|
25
58
|
label
|
|
26
|
-
} from "./index-
|
|
59
|
+
} from "./index-zd6adby9.js";
|
|
27
60
|
import {
|
|
28
|
-
PANE_WIDTH,
|
|
29
61
|
appliedOnLoad,
|
|
30
62
|
applyOnLoad,
|
|
31
63
|
closePane,
|
|
@@ -38,7 +70,7 @@ import {
|
|
|
38
70
|
showPane,
|
|
39
71
|
stopOnLoad,
|
|
40
72
|
viewHead
|
|
41
|
-
} from "./index-
|
|
73
|
+
} from "./index-aynkv7qk.js";
|
|
42
74
|
import {
|
|
43
75
|
actButton,
|
|
44
76
|
button,
|
|
@@ -67,59 +99,40 @@ import {
|
|
|
67
99
|
tabBar,
|
|
68
100
|
textField,
|
|
69
101
|
toolbar
|
|
70
|
-
} from "./index-
|
|
102
|
+
} from "./index-4a4x1bt2.js";
|
|
71
103
|
import {
|
|
72
|
-
BINDING_ICONS,
|
|
73
104
|
BODY_CAP,
|
|
74
105
|
HOST_RESET,
|
|
75
|
-
KEYS_FIELD,
|
|
76
106
|
LAYER,
|
|
77
107
|
LOCALE_PRESETS,
|
|
78
108
|
READ_MS,
|
|
79
|
-
ROW_ICONS,
|
|
80
109
|
SPEED_MAX,
|
|
81
110
|
SPEED_MIN,
|
|
82
111
|
TIME_ZONE_PRESETS,
|
|
83
112
|
canonicalTag,
|
|
84
113
|
canonicalZone,
|
|
85
|
-
comboLabel,
|
|
86
|
-
comboSpoken,
|
|
87
|
-
comboText,
|
|
88
|
-
defaultKeys,
|
|
89
114
|
devIconFor,
|
|
90
115
|
devIconShown,
|
|
91
|
-
escapeStep,
|
|
92
116
|
exports_engine,
|
|
93
117
|
foldRest,
|
|
94
|
-
forwardKeys,
|
|
95
118
|
frameWindow,
|
|
96
119
|
getState,
|
|
97
|
-
glyph,
|
|
98
|
-
highlightAt,
|
|
99
120
|
holdInTopLayer,
|
|
100
121
|
holdingHinge,
|
|
101
122
|
hostSendsUa,
|
|
102
|
-
icon,
|
|
103
|
-
isFunctionKey,
|
|
104
|
-
isSearchKey,
|
|
105
123
|
keepPlace,
|
|
106
|
-
keyAction,
|
|
107
124
|
landSplash,
|
|
108
125
|
letGo,
|
|
109
|
-
lowerKey,
|
|
110
126
|
moveHinge,
|
|
111
127
|
nativeSwitch,
|
|
112
128
|
onCount,
|
|
113
129
|
overflowCount,
|
|
114
|
-
paletteMove,
|
|
115
130
|
panelSized,
|
|
116
|
-
parseCombo,
|
|
117
131
|
ready,
|
|
118
132
|
replay,
|
|
119
133
|
requestLog,
|
|
120
134
|
reset,
|
|
121
135
|
resolveTimeZone,
|
|
122
|
-
rowIcon,
|
|
123
136
|
sends,
|
|
124
137
|
setNative,
|
|
125
138
|
setState,
|
|
@@ -127,13 +140,49 @@ import {
|
|
|
127
140
|
stop,
|
|
128
141
|
subscribe,
|
|
129
142
|
takeHinge,
|
|
130
|
-
typeAhead,
|
|
131
143
|
watchFold,
|
|
132
144
|
watchHinge,
|
|
133
145
|
watchPanel,
|
|
134
|
-
zoomAction,
|
|
135
146
|
zoomKey
|
|
136
|
-
} from "./index-
|
|
147
|
+
} from "./index-x59vz1xx.js";
|
|
148
|
+
import {
|
|
149
|
+
MAT_COLORS,
|
|
150
|
+
MAT_COLOR_NAMES,
|
|
151
|
+
UA_PRESETS,
|
|
152
|
+
isMac,
|
|
153
|
+
isMatName,
|
|
154
|
+
layoutOf,
|
|
155
|
+
layoutOptions,
|
|
156
|
+
matGradient,
|
|
157
|
+
mockOf,
|
|
158
|
+
platformOf,
|
|
159
|
+
runsUnderBars,
|
|
160
|
+
uaPreset,
|
|
161
|
+
userAgentOf
|
|
162
|
+
} from "./index-7cb4x1vj.js";
|
|
163
|
+
import {
|
|
164
|
+
BINDING_ICONS,
|
|
165
|
+
KEYS_FIELD,
|
|
166
|
+
ROW_ICONS,
|
|
167
|
+
comboLabel,
|
|
168
|
+
comboSpoken,
|
|
169
|
+
comboText,
|
|
170
|
+
defaultKeys,
|
|
171
|
+
escapeStep,
|
|
172
|
+
forwardKeys,
|
|
173
|
+
glyph,
|
|
174
|
+
highlightAt,
|
|
175
|
+
icon,
|
|
176
|
+
isFunctionKey,
|
|
177
|
+
isSearchKey,
|
|
178
|
+
keyAction,
|
|
179
|
+
lowerKey,
|
|
180
|
+
paletteMove,
|
|
181
|
+
parseCombo,
|
|
182
|
+
rowIcon,
|
|
183
|
+
typeAhead,
|
|
184
|
+
zoomAction
|
|
185
|
+
} from "./index-6bc2ztfd.js";
|
|
137
186
|
import {
|
|
138
187
|
BARS,
|
|
139
188
|
BROWSERS,
|
|
@@ -154,8 +203,6 @@ import {
|
|
|
154
203
|
GEO_ERRORS,
|
|
155
204
|
GEO_PRESETS,
|
|
156
205
|
GRAB_COLORS,
|
|
157
|
-
MAT_COLORS,
|
|
158
|
-
MAT_COLOR_NAMES,
|
|
159
206
|
MOTIONS,
|
|
160
207
|
NativeDate,
|
|
161
208
|
ONLINES,
|
|
@@ -169,12 +216,10 @@ import {
|
|
|
169
216
|
TEXT_MAX,
|
|
170
217
|
TEXT_MIN,
|
|
171
218
|
TRANSPARENCIES,
|
|
172
|
-
UA_PRESETS,
|
|
173
219
|
VISIONS,
|
|
174
220
|
ZOOM_MAX,
|
|
175
221
|
ZOOM_MIN,
|
|
176
222
|
ZOOM_PRESETS,
|
|
177
|
-
__require,
|
|
178
223
|
addStyle,
|
|
179
224
|
deviceOf,
|
|
180
225
|
formId,
|
|
@@ -184,35 +229,29 @@ import {
|
|
|
184
229
|
hasTouch,
|
|
185
230
|
isCustomColor,
|
|
186
231
|
isDevknobsFrame,
|
|
187
|
-
isMac,
|
|
188
|
-
isMatName,
|
|
189
232
|
knobFrame,
|
|
190
|
-
layoutOf,
|
|
191
|
-
layoutOptions,
|
|
192
|
-
matGradient,
|
|
193
|
-
mockOf,
|
|
194
233
|
needsFrame,
|
|
195
234
|
newer,
|
|
196
235
|
now,
|
|
197
236
|
openOf,
|
|
198
237
|
parseColor,
|
|
199
238
|
percent,
|
|
200
|
-
platformOf,
|
|
201
239
|
readColor,
|
|
202
240
|
readMessage,
|
|
203
241
|
realNow,
|
|
204
242
|
resolveGeo,
|
|
205
243
|
rewriteMediaText,
|
|
206
|
-
runsUnderBars,
|
|
207
244
|
setSystemMedia,
|
|
208
245
|
stamped,
|
|
209
246
|
still,
|
|
210
247
|
toHex,
|
|
211
|
-
uaPreset,
|
|
212
|
-
userAgentOf,
|
|
213
248
|
watchSystemMedia,
|
|
214
249
|
webStorage
|
|
215
|
-
} from "./index-
|
|
250
|
+
} from "./index-dzm8ywq0.js";
|
|
251
|
+
import"./index-a974q3aa.js";
|
|
252
|
+
import {
|
|
253
|
+
__require
|
|
254
|
+
} from "./index-5tv6sr74.js";
|
|
216
255
|
|
|
217
256
|
// src/ui/knobs.ts
|
|
218
257
|
var MINUTE = 60000;
|
|
@@ -1704,6 +1743,8 @@ var BINDINGS = [
|
|
|
1704
1743
|
"replay",
|
|
1705
1744
|
"requests",
|
|
1706
1745
|
"storage",
|
|
1746
|
+
"elements",
|
|
1747
|
+
"settings",
|
|
1707
1748
|
"reset"
|
|
1708
1749
|
];
|
|
1709
1750
|
var BINDING_WORDS = {
|
|
@@ -1713,7 +1754,9 @@ var BINDING_WORDS = {
|
|
|
1713
1754
|
replay: "replay animations",
|
|
1714
1755
|
requests: "requests",
|
|
1715
1756
|
storage: "storage",
|
|
1716
|
-
reset: "reset"
|
|
1757
|
+
reset: "reset",
|
|
1758
|
+
elements: "elements",
|
|
1759
|
+
settings: "settings"
|
|
1717
1760
|
};
|
|
1718
1761
|
var RESERVED_LETTERS = new Set([..."cvxzawrtqlnfpshm"]);
|
|
1719
1762
|
var ZOOM_KEYS = new Set(["=", "-", "_", "0"]);
|
|
@@ -1743,8 +1786,6 @@ function clashText(combo) {
|
|
|
1743
1786
|
function comboProblem(combo, binding, others = {}) {
|
|
1744
1787
|
if (!keepable(combo.key))
|
|
1745
1788
|
return "use a letter, digit, symbol or F1 to F12";
|
|
1746
|
-
if (bare(combo) && !isFunctionKey(combo.key))
|
|
1747
|
-
return "add a modifier, alone it types";
|
|
1748
1789
|
if (isReserved(combo))
|
|
1749
1790
|
return "the browser uses it";
|
|
1750
1791
|
if (combo.key === "/" && !combo.meta && !combo.ctrl && !combo.alt)
|
|
@@ -1808,6 +1849,9 @@ function readKeys(json) {
|
|
|
1808
1849
|
} catch {
|
|
1809
1850
|
return {};
|
|
1810
1851
|
}
|
|
1852
|
+
return keysOf(value);
|
|
1853
|
+
}
|
|
1854
|
+
function keysOf(value) {
|
|
1811
1855
|
if (newer(value, KEYS_VERSION))
|
|
1812
1856
|
return {};
|
|
1813
1857
|
const stored = record(value);
|
|
@@ -1869,10 +1913,41 @@ function keepKeys(keys) {
|
|
|
1869
1913
|
webStorage("local")?.setItem(KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
|
|
1870
1914
|
} catch {}
|
|
1871
1915
|
}
|
|
1916
|
+
function keysListed(keys, listed) {
|
|
1917
|
+
const here = { ...keys };
|
|
1918
|
+
for (const binding of BINDINGS) {
|
|
1919
|
+
if (binding !== "panel" && !listed.includes(binding))
|
|
1920
|
+
here[binding] = null;
|
|
1921
|
+
}
|
|
1922
|
+
return here;
|
|
1923
|
+
}
|
|
1872
1924
|
function createKeys(options2 = {}) {
|
|
1873
1925
|
const base = defaultKeys(options2);
|
|
1874
1926
|
const grab = options2.grab !== false;
|
|
1875
|
-
|
|
1927
|
+
const store = options2.store ?? null;
|
|
1928
|
+
function load() {
|
|
1929
|
+
if (!store)
|
|
1930
|
+
return loadKeys();
|
|
1931
|
+
if (fresh())
|
|
1932
|
+
return {};
|
|
1933
|
+
try {
|
|
1934
|
+
return keysOf(store.load());
|
|
1935
|
+
} catch {
|
|
1936
|
+
return {};
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
function keep(keys2) {
|
|
1940
|
+
if (!store) {
|
|
1941
|
+
keepKeys(keys2);
|
|
1942
|
+
return;
|
|
1943
|
+
}
|
|
1944
|
+
if (fresh())
|
|
1945
|
+
return;
|
|
1946
|
+
try {
|
|
1947
|
+
store.save(stamped(keys2, KEYS_VERSION));
|
|
1948
|
+
} catch {}
|
|
1949
|
+
}
|
|
1950
|
+
let stored = load();
|
|
1876
1951
|
let keys = resolveKeys(base, stored, grab);
|
|
1877
1952
|
const listeners = new Set;
|
|
1878
1953
|
function changed() {
|
|
@@ -1883,12 +1958,16 @@ function createKeys(options2 = {}) {
|
|
|
1883
1958
|
function onStorage(event) {
|
|
1884
1959
|
if (event.key !== KEYS_KEY && event.key !== null)
|
|
1885
1960
|
return;
|
|
1961
|
+
heard();
|
|
1962
|
+
}
|
|
1963
|
+
function heard() {
|
|
1886
1964
|
if (fresh())
|
|
1887
1965
|
return;
|
|
1888
|
-
stored =
|
|
1966
|
+
stored = load();
|
|
1889
1967
|
changed();
|
|
1890
1968
|
}
|
|
1891
|
-
|
|
1969
|
+
const stopStore = store?.subscribe(heard) ?? null;
|
|
1970
|
+
if (!store && typeof window !== "undefined")
|
|
1892
1971
|
window.addEventListener("storage", onStorage);
|
|
1893
1972
|
return {
|
|
1894
1973
|
get: () => keys,
|
|
@@ -1903,7 +1982,7 @@ function createKeys(options2 = {}) {
|
|
|
1903
1982
|
else
|
|
1904
1983
|
next[binding] = comboText(combo);
|
|
1905
1984
|
stored = next;
|
|
1906
|
-
|
|
1985
|
+
keep(stored);
|
|
1907
1986
|
changed();
|
|
1908
1987
|
},
|
|
1909
1988
|
subscribe(listener) {
|
|
@@ -1915,6 +1994,7 @@ function createKeys(options2 = {}) {
|
|
|
1915
1994
|
recording: false,
|
|
1916
1995
|
destroy() {
|
|
1917
1996
|
listeners.clear();
|
|
1997
|
+
stopStore?.();
|
|
1918
1998
|
if (typeof window !== "undefined")
|
|
1919
1999
|
window.removeEventListener("storage", onStorage);
|
|
1920
2000
|
}
|
|
@@ -2277,122 +2357,6 @@ function createDockSlide(context) {
|
|
|
2277
2357
|
};
|
|
2278
2358
|
}
|
|
2279
2359
|
|
|
2280
|
-
// src/ui/place.ts
|
|
2281
|
-
var DRAG_SLOP = 4;
|
|
2282
|
-
var FLING_SPAN = 150;
|
|
2283
|
-
var FLING_STRETCH = 40;
|
|
2284
|
-
var FLING_LEAST = 8;
|
|
2285
|
-
var FLING = 0.5;
|
|
2286
|
-
var FLING_LEAN = 1.5;
|
|
2287
|
-
var FLING_TRAVEL = 16;
|
|
2288
|
-
var GLIDE = 220;
|
|
2289
|
-
var GLIDE_MAX = 440;
|
|
2290
|
-
var GLIDE_SPEED = 6;
|
|
2291
|
-
var PANEL_GAP = 8;
|
|
2292
|
-
var SNAP = 24;
|
|
2293
|
-
function dragTarget(shift, open) {
|
|
2294
|
-
return open && !shift ? "panel" : "handle";
|
|
2295
|
-
}
|
|
2296
|
-
function otherSide(side) {
|
|
2297
|
-
return side === "right" ? "left" : "right";
|
|
2298
|
-
}
|
|
2299
|
-
function between(value, min, max) {
|
|
2300
|
-
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
2301
|
-
}
|
|
2302
|
-
function snap(value, min, max) {
|
|
2303
|
-
const end = Math.max(min, max);
|
|
2304
|
-
const at = between(value, min, end);
|
|
2305
|
-
if (at - min <= SNAP && at - min <= end - at)
|
|
2306
|
-
return min;
|
|
2307
|
-
return end - at <= SNAP ? end : at;
|
|
2308
|
-
}
|
|
2309
|
-
function edgeOf(value, min, max, had) {
|
|
2310
|
-
const top = Math.abs(value - min) < 0.5;
|
|
2311
|
-
const bottom = Math.abs(value - max) < 0.5;
|
|
2312
|
-
if (top && bottom)
|
|
2313
|
-
return had === "none" ? "top" : had;
|
|
2314
|
-
return top ? "top" : bottom ? "bottom" : "none";
|
|
2315
|
-
}
|
|
2316
|
-
function settle(place, room, anchor = "edge") {
|
|
2317
|
-
const last = room.view - PANEL_GAP - room.panel;
|
|
2318
|
-
const pull = anchor === "top" ? between : snap;
|
|
2319
|
-
const top = pull(anchor === "top" || place.edge === "none" ? place.top : place.edge === "top" ? PANEL_GAP : last, PANEL_GAP, last);
|
|
2320
|
-
const low = top + room.panel - room.handle;
|
|
2321
|
-
const y = pull(place.tab === "top" ? top : place.tab === "bottom" ? low : place.y, top, low);
|
|
2322
|
-
return {
|
|
2323
|
-
y,
|
|
2324
|
-
top,
|
|
2325
|
-
edge: edgeOf(top, PANEL_GAP, last, place.edge),
|
|
2326
|
-
tab: edgeOf(y, top, low, place.tab)
|
|
2327
|
-
};
|
|
2328
|
-
}
|
|
2329
|
-
function cornerAt(y, top, room) {
|
|
2330
|
-
return edgeOf(y, top, top + room.panel - room.handle, "none");
|
|
2331
|
-
}
|
|
2332
|
-
function dragTo(target, open, to, from, room) {
|
|
2333
|
-
const offset = from.y - from.top;
|
|
2334
|
-
if (target === "panel") {
|
|
2335
|
-
const top = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.panel);
|
|
2336
|
-
return settle({ y: top + offset, top, edge: "none", tab: "none" }, room);
|
|
2337
|
-
}
|
|
2338
|
-
if (open)
|
|
2339
|
-
return settle({ ...from, y: to, tab: "none" }, room);
|
|
2340
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2341
|
-
return settle({ y, top: y - offset, edge: "none", tab: "none" }, room);
|
|
2342
|
-
}
|
|
2343
|
-
function dragDocked(to, from, room) {
|
|
2344
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2345
|
-
return { y, top: y - (from.y - from.top), edge: "none", tab: from.tab };
|
|
2346
|
-
}
|
|
2347
|
-
function dockedHandle(y, room) {
|
|
2348
|
-
return between(y, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2349
|
-
}
|
|
2350
|
-
function speedOf(from, to) {
|
|
2351
|
-
const time = to.t - from.t;
|
|
2352
|
-
return { x: (to.x - from.x) / time, y: (to.y - from.y) / time };
|
|
2353
|
-
}
|
|
2354
|
-
function velocity(samples, at) {
|
|
2355
|
-
const recent = samples.filter((sample) => sample.t >= at - FLING_SPAN && sample.t <= at);
|
|
2356
|
-
let fastest = { x: 0, y: 0 };
|
|
2357
|
-
let read = false;
|
|
2358
|
-
for (const [index, end] of recent.entries()) {
|
|
2359
|
-
let start2;
|
|
2360
|
-
for (const sample of recent.slice(0, index)) {
|
|
2361
|
-
if (end.t - sample.t >= FLING_STRETCH)
|
|
2362
|
-
start2 = sample;
|
|
2363
|
-
}
|
|
2364
|
-
if (!start2)
|
|
2365
|
-
continue;
|
|
2366
|
-
const speed = speedOf(start2, end);
|
|
2367
|
-
if (!read || Math.hypot(speed.x, speed.y) > Math.hypot(fastest.x, fastest.y))
|
|
2368
|
-
fastest = speed;
|
|
2369
|
-
read = true;
|
|
2370
|
-
}
|
|
2371
|
-
const first = recent[0];
|
|
2372
|
-
const last = recent[recent.length - 1];
|
|
2373
|
-
if (!read && first && last && last.t - first.t >= FLING_LEAST)
|
|
2374
|
-
return speedOf(first, last);
|
|
2375
|
-
return fastest;
|
|
2376
|
-
}
|
|
2377
|
-
function glideTime(distance) {
|
|
2378
|
-
return between(distance / GLIDE_SPEED, GLIDE, GLIDE_MAX);
|
|
2379
|
-
}
|
|
2380
|
-
function landSide(side, x, width, vx, vy) {
|
|
2381
|
-
const other = otherSide(side);
|
|
2382
|
-
const toward = side === "right" ? -vx : vx;
|
|
2383
|
-
const across = Math.abs(vx) >= FLING && Math.abs(vx) > FLING_LEAN * Math.abs(vy);
|
|
2384
|
-
const past = side === "right" ? x < width / 2 : x > width / 2;
|
|
2385
|
-
if (across && toward > 0)
|
|
2386
|
-
return other;
|
|
2387
|
-
if (across && toward < 0)
|
|
2388
|
-
return side;
|
|
2389
|
-
return past ? other : side;
|
|
2390
|
-
}
|
|
2391
|
-
function translateOf(value) {
|
|
2392
|
-
const [x = 0, y = 0] = value === "none" ? [] : value.split(" ").map((part) => parseFloat(part));
|
|
2393
|
-
return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
2360
|
// src/ui/drag.ts
|
|
2397
2361
|
function createDrag(context) {
|
|
2398
2362
|
const { host, wrap, handle, panel } = context;
|
|
@@ -2671,7 +2635,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2671
2635
|
function here(element) {
|
|
2672
2636
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2673
2637
|
}
|
|
2674
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2638
|
+
function createInspector(context, load = () => import("./elementsview-dm5v3z5a.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2675
2639
|
const { inspect, tips, prefs } = context;
|
|
2676
2640
|
const listeners = new Set;
|
|
2677
2641
|
let view = null;
|
|
@@ -2689,6 +2653,14 @@ function createInspector(context, load = () => import("./elementsview-3kv34jfx.j
|
|
|
2689
2653
|
function current() {
|
|
2690
2654
|
return held && here(held) ? held : null;
|
|
2691
2655
|
}
|
|
2656
|
+
function pageBody() {
|
|
2657
|
+
try {
|
|
2658
|
+
const page = framed ? frameWindow()?.document : typeof document === "undefined" ? undefined : document;
|
|
2659
|
+
return page?.body ?? null;
|
|
2660
|
+
} catch {
|
|
2661
|
+
return null;
|
|
2662
|
+
}
|
|
2663
|
+
}
|
|
2692
2664
|
function point(element) {
|
|
2693
2665
|
if (element && inspect.isOn())
|
|
2694
2666
|
return;
|
|
@@ -2724,7 +2696,9 @@ function createInspector(context, load = () => import("./elementsview-3kv34jfx.j
|
|
|
2724
2696
|
},
|
|
2725
2697
|
...prefs && {
|
|
2726
2698
|
mode: { get: () => prefs.get().stylesMode, set: prefs.setStylesMode },
|
|
2727
|
-
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox }
|
|
2699
|
+
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox },
|
|
2700
|
+
diff: { get: () => prefs.get().changesDiff, set: prefs.setChangesDiff },
|
|
2701
|
+
htmlSize: { get: () => ({ height: prefs.get().htmlHeight, full: prefs.get().htmlFull }), set: prefs.setHtmlSize }
|
|
2728
2702
|
}
|
|
2729
2703
|
});
|
|
2730
2704
|
view = made;
|
|
@@ -2808,6 +2782,18 @@ function createInspector(context, load = () => import("./elementsview-3kv34jfx.j
|
|
|
2808
2782
|
else
|
|
2809
2783
|
inspect.set(true);
|
|
2810
2784
|
},
|
|
2785
|
+
elements() {
|
|
2786
|
+
if (inspect.isOn())
|
|
2787
|
+
inspect.set(false);
|
|
2788
|
+
if (!current()) {
|
|
2789
|
+
const body = pageBody();
|
|
2790
|
+
if (view)
|
|
2791
|
+
view.show(body);
|
|
2792
|
+
else
|
|
2793
|
+
hold(body);
|
|
2794
|
+
}
|
|
2795
|
+
reveal2();
|
|
2796
|
+
},
|
|
2811
2797
|
picked() {
|
|
2812
2798
|
const element = current();
|
|
2813
2799
|
return element ? label(element) : null;
|
|
@@ -4076,296 +4062,6 @@ function createPalette(context) {
|
|
|
4076
4062
|
};
|
|
4077
4063
|
}
|
|
4078
4064
|
|
|
4079
|
-
// src/ui/size.ts
|
|
4080
|
-
var LIST_WIDTH = 240;
|
|
4081
|
-
var VIEW_WIDTH = PANE_WIDTH;
|
|
4082
|
-
var LIST_MIN = 240;
|
|
4083
|
-
var VIEW_MIN = 280;
|
|
4084
|
-
var WIDTH_MAX = 720;
|
|
4085
|
-
var PAGE_ROOM = 96;
|
|
4086
|
-
function pageRoom(docked) {
|
|
4087
|
-
return docked ? PAGE_MIN : PAGE_ROOM;
|
|
4088
|
-
}
|
|
4089
|
-
var WIDTH_STEP = 16;
|
|
4090
|
-
var HANDLE_REACH = 21;
|
|
4091
|
-
function widthLimits(showing, view, page = PAGE_ROOM) {
|
|
4092
|
-
const min = showing === "view" ? VIEW_MIN : LIST_MIN;
|
|
4093
|
-
return { min, max: Math.max(min, Math.min(WIDTH_MAX, view - page)) };
|
|
4094
|
-
}
|
|
4095
|
-
function widthIn(showing, wanted, view, page = PAGE_ROOM) {
|
|
4096
|
-
const { min, max } = widthLimits(showing, view, page);
|
|
4097
|
-
const room = view - HANDLE_REACH - PANEL_GAP;
|
|
4098
|
-
return Math.max(LIST_MIN, Math.min(Math.round(between(wanted, min, max)), room));
|
|
4099
|
-
}
|
|
4100
|
-
function dragWidth(from, travel, side) {
|
|
4101
|
-
return from + (side === "right" ? -travel : travel);
|
|
4102
|
-
}
|
|
4103
|
-
function keyWidth(key, width, limits, side) {
|
|
4104
|
-
if (key === "Home")
|
|
4105
|
-
return limits.min;
|
|
4106
|
-
if (key === "End")
|
|
4107
|
-
return limits.max;
|
|
4108
|
-
if (key !== "ArrowLeft" && key !== "ArrowRight")
|
|
4109
|
-
return null;
|
|
4110
|
-
const wider = key === "ArrowLeft" === (side === "right");
|
|
4111
|
-
return between(width + (wider ? WIDTH_STEP : -WIDTH_STEP), limits.min, limits.max);
|
|
4112
|
-
}
|
|
4113
|
-
function widthGlides(cue) {
|
|
4114
|
-
return !cue.first && !cue.dragging && !cue.resizing;
|
|
4115
|
-
}
|
|
4116
|
-
function createSizer(context) {
|
|
4117
|
-
const { host, wrap, panel, prefs } = context;
|
|
4118
|
-
const strip = document.createElement("div");
|
|
4119
|
-
strip.className = "sizer";
|
|
4120
|
-
strip.tabIndex = 0;
|
|
4121
|
-
strip.setAttribute("role", "separator");
|
|
4122
|
-
strip.setAttribute("aria-orientation", "vertical");
|
|
4123
|
-
strip.setAttribute("aria-label", "panel width");
|
|
4124
|
-
let shown2 = null;
|
|
4125
|
-
let held = null;
|
|
4126
|
-
function viewWidth() {
|
|
4127
|
-
return document.documentElement.clientWidth || window.innerWidth;
|
|
4128
|
-
}
|
|
4129
|
-
function put(width) {
|
|
4130
|
-
wrap.style.setProperty("--panel-width", `${width}px`);
|
|
4131
|
-
}
|
|
4132
|
-
function apply(draw, resizing) {
|
|
4133
|
-
const showing = context.showing();
|
|
4134
|
-
const view = viewWidth();
|
|
4135
|
-
const kept = showing === "view" ? prefs.get().viewWidth : prefs.get().listWidth;
|
|
4136
|
-
const page = pageRoom(context.place().docked);
|
|
4137
|
-
const next = widthIn(showing, held?.showing === showing ? held.width : kept, view, page);
|
|
4138
|
-
const from = shown2;
|
|
4139
|
-
const limits = widthLimits(showing, view, page);
|
|
4140
|
-
strip.setAttribute("aria-valuemin", String(limits.min));
|
|
4141
|
-
strip.setAttribute("aria-valuemax", String(limits.max));
|
|
4142
|
-
if (next === from || from !== null && !context.place().open) {
|
|
4143
|
-
draw?.();
|
|
4144
|
-
return;
|
|
4145
|
-
}
|
|
4146
|
-
strip.setAttribute("aria-valuenow", String(next));
|
|
4147
|
-
const glide = widthGlides({ first: from === null, dragging: held !== null, resizing });
|
|
4148
|
-
shown2 = next;
|
|
4149
|
-
context.wide(next);
|
|
4150
|
-
host.style.width = `${HANDLE_REACH + next}px`;
|
|
4151
|
-
panel.style.transitionProperty = "none";
|
|
4152
|
-
put(next);
|
|
4153
|
-
draw?.();
|
|
4154
|
-
if (glide && from !== null)
|
|
4155
|
-
put(from);
|
|
4156
|
-
panel.getBoundingClientRect();
|
|
4157
|
-
panel.style.transitionProperty = "";
|
|
4158
|
-
put(next);
|
|
4159
|
-
if (from !== null)
|
|
4160
|
-
context.sized(glide);
|
|
4161
|
-
}
|
|
4162
|
-
function end(keep) {
|
|
4163
|
-
if (!held)
|
|
4164
|
-
return;
|
|
4165
|
-
const { showing, pointer, width, moved } = held;
|
|
4166
|
-
held = null;
|
|
4167
|
-
delete wrap.dataset.sizing;
|
|
4168
|
-
if (strip.hasPointerCapture(pointer))
|
|
4169
|
-
strip.releasePointerCapture(pointer);
|
|
4170
|
-
if (keep && moved)
|
|
4171
|
-
prefs.setWidth(showing, width);
|
|
4172
|
-
else
|
|
4173
|
-
apply(undefined, false);
|
|
4174
|
-
}
|
|
4175
|
-
strip.addEventListener("pointerdown", (event) => {
|
|
4176
|
-
if (event.button !== 0 || held || shown2 === null)
|
|
4177
|
-
return;
|
|
4178
|
-
held = {
|
|
4179
|
-
showing: context.showing(),
|
|
4180
|
-
pointer: event.pointerId,
|
|
4181
|
-
from: shown2,
|
|
4182
|
-
x: event.clientX,
|
|
4183
|
-
width: shown2,
|
|
4184
|
-
moved: false
|
|
4185
|
-
};
|
|
4186
|
-
wrap.dataset.sizing = "true";
|
|
4187
|
-
strip.setPointerCapture(event.pointerId);
|
|
4188
|
-
});
|
|
4189
|
-
strip.addEventListener("pointermove", (event) => {
|
|
4190
|
-
if (!held || event.pointerId !== held.pointer)
|
|
4191
|
-
return;
|
|
4192
|
-
const { side, docked } = context.place();
|
|
4193
|
-
const wanted = dragWidth(held.from, event.clientX - held.x, side);
|
|
4194
|
-
const width = widthIn(held.showing, wanted, viewWidth(), pageRoom(docked));
|
|
4195
|
-
if (width === held.width)
|
|
4196
|
-
return;
|
|
4197
|
-
held.width = width;
|
|
4198
|
-
held.moved = true;
|
|
4199
|
-
apply(undefined, false);
|
|
4200
|
-
});
|
|
4201
|
-
strip.addEventListener("pointerup", (event) => {
|
|
4202
|
-
if (event.pointerId === held?.pointer)
|
|
4203
|
-
end(true);
|
|
4204
|
-
});
|
|
4205
|
-
strip.addEventListener("pointercancel", (event) => {
|
|
4206
|
-
if (event.pointerId === held?.pointer)
|
|
4207
|
-
end(false);
|
|
4208
|
-
});
|
|
4209
|
-
strip.addEventListener("lostpointercapture", (event) => {
|
|
4210
|
-
if (event.pointerId === held?.pointer)
|
|
4211
|
-
end(false);
|
|
4212
|
-
});
|
|
4213
|
-
strip.addEventListener("dblclick", () => {
|
|
4214
|
-
const showing = context.showing();
|
|
4215
|
-
prefs.setWidth(showing, showing === "view" ? VIEW_WIDTH : LIST_WIDTH);
|
|
4216
|
-
});
|
|
4217
|
-
strip.addEventListener("keydown", (event) => {
|
|
4218
|
-
if (shown2 === null || event.altKey || event.ctrlKey || event.metaKey)
|
|
4219
|
-
return;
|
|
4220
|
-
const showing = context.showing();
|
|
4221
|
-
const { side, docked } = context.place();
|
|
4222
|
-
const limits = widthLimits(showing, viewWidth(), pageRoom(docked));
|
|
4223
|
-
const next = keyWidth(event.key, shown2, limits, side);
|
|
4224
|
-
if (next === null)
|
|
4225
|
-
return;
|
|
4226
|
-
event.preventDefault();
|
|
4227
|
-
prefs.setWidth(showing, next);
|
|
4228
|
-
});
|
|
4229
|
-
return {
|
|
4230
|
-
strip,
|
|
4231
|
-
size: (draw) => apply(draw, false),
|
|
4232
|
-
fit: () => apply(undefined, true),
|
|
4233
|
-
cancel: () => end(false)
|
|
4234
|
-
};
|
|
4235
|
-
}
|
|
4236
|
-
|
|
4237
|
-
// src/ui/prefs.ts
|
|
4238
|
-
var PREFS_KEY = "devknobs:prefs";
|
|
4239
|
-
var PREFS_VERSION = 4;
|
|
4240
|
-
var STYLES_MODE = "simple";
|
|
4241
|
-
var STYLES_BOX = true;
|
|
4242
|
-
var WIDTH_OF = { list: "listWidth", view: "viewWidth" };
|
|
4243
|
-
function readPrefs(json) {
|
|
4244
|
-
let value = null;
|
|
4245
|
-
try {
|
|
4246
|
-
value = json ? JSON.parse(json) : null;
|
|
4247
|
-
} catch {
|
|
4248
|
-
return {};
|
|
4249
|
-
}
|
|
4250
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
4251
|
-
return {};
|
|
4252
|
-
if (newer(value, PREFS_VERSION))
|
|
4253
|
-
return {};
|
|
4254
|
-
const prefs = {};
|
|
4255
|
-
const handle = Reflect.get(value, "handle");
|
|
4256
|
-
if (typeof handle === "boolean")
|
|
4257
|
-
prefs.handle = handle;
|
|
4258
|
-
for (const key of [WIDTH_OF.list, WIDTH_OF.view]) {
|
|
4259
|
-
const width = Reflect.get(value, key);
|
|
4260
|
-
if (typeof width === "number" && Number.isFinite(width) && width > 0)
|
|
4261
|
-
prefs[key] = width;
|
|
4262
|
-
}
|
|
4263
|
-
const mode = Reflect.get(value, "stylesMode");
|
|
4264
|
-
if (mode === "simple" || mode === "advanced")
|
|
4265
|
-
prefs.stylesMode = mode;
|
|
4266
|
-
const box = Reflect.get(value, "stylesBox");
|
|
4267
|
-
if (typeof box === "boolean")
|
|
4268
|
-
prefs.stylesBox = box;
|
|
4269
|
-
return prefs;
|
|
4270
|
-
}
|
|
4271
|
-
function resolvePrefs(base, stored) {
|
|
4272
|
-
return { ...base, ...stored };
|
|
4273
|
-
}
|
|
4274
|
-
function loadPrefs() {
|
|
4275
|
-
try {
|
|
4276
|
-
return readPrefs(webStorage("local")?.getItem(PREFS_KEY));
|
|
4277
|
-
} catch {
|
|
4278
|
-
return {};
|
|
4279
|
-
}
|
|
4280
|
-
}
|
|
4281
|
-
function keepPrefs(prefs) {
|
|
4282
|
-
try {
|
|
4283
|
-
if (Object.keys(prefs).length === 0)
|
|
4284
|
-
webStorage("local")?.removeItem(PREFS_KEY);
|
|
4285
|
-
else
|
|
4286
|
-
webStorage("local")?.setItem(PREFS_KEY, JSON.stringify(stamped(prefs, PREFS_VERSION)));
|
|
4287
|
-
} catch {}
|
|
4288
|
-
}
|
|
4289
|
-
function createPrefs(options2 = {}) {
|
|
4290
|
-
const base = {
|
|
4291
|
-
handle: options2.handle !== false,
|
|
4292
|
-
listWidth: LIST_WIDTH,
|
|
4293
|
-
viewWidth: VIEW_WIDTH,
|
|
4294
|
-
stylesMode: STYLES_MODE,
|
|
4295
|
-
stylesBox: STYLES_BOX
|
|
4296
|
-
};
|
|
4297
|
-
let stored = loadPrefs();
|
|
4298
|
-
let prefs = resolvePrefs(base, stored);
|
|
4299
|
-
const listeners = new Set;
|
|
4300
|
-
function changed() {
|
|
4301
|
-
prefs = resolvePrefs(base, stored);
|
|
4302
|
-
for (const listener of Array.from(listeners))
|
|
4303
|
-
listener();
|
|
4304
|
-
}
|
|
4305
|
-
function keep(next) {
|
|
4306
|
-
stored = next;
|
|
4307
|
-
keepPrefs(stored);
|
|
4308
|
-
changed();
|
|
4309
|
-
}
|
|
4310
|
-
function onStorage(event) {
|
|
4311
|
-
if (event.key !== PREFS_KEY && event.key !== null)
|
|
4312
|
-
return;
|
|
4313
|
-
if (fresh())
|
|
4314
|
-
return;
|
|
4315
|
-
stored = loadPrefs();
|
|
4316
|
-
changed();
|
|
4317
|
-
}
|
|
4318
|
-
if (typeof window !== "undefined")
|
|
4319
|
-
window.addEventListener("storage", onStorage);
|
|
4320
|
-
return {
|
|
4321
|
-
get: () => prefs,
|
|
4322
|
-
setHandle(on) {
|
|
4323
|
-
const next = { ...stored };
|
|
4324
|
-
if (on === base.handle)
|
|
4325
|
-
delete next.handle;
|
|
4326
|
-
else
|
|
4327
|
-
next.handle = on;
|
|
4328
|
-
keep(next);
|
|
4329
|
-
},
|
|
4330
|
-
setWidth(showing, px) {
|
|
4331
|
-
const key = WIDTH_OF[showing];
|
|
4332
|
-
const next = { ...stored };
|
|
4333
|
-
if (px === base[key])
|
|
4334
|
-
delete next[key];
|
|
4335
|
-
else
|
|
4336
|
-
next[key] = px;
|
|
4337
|
-
keep(next);
|
|
4338
|
-
},
|
|
4339
|
-
setStylesMode(mode) {
|
|
4340
|
-
const next = { ...stored };
|
|
4341
|
-
if (mode === base.stylesMode)
|
|
4342
|
-
delete next.stylesMode;
|
|
4343
|
-
else
|
|
4344
|
-
next.stylesMode = mode;
|
|
4345
|
-
keep(next);
|
|
4346
|
-
},
|
|
4347
|
-
setStylesBox(open) {
|
|
4348
|
-
const next = { ...stored };
|
|
4349
|
-
if (open === base.stylesBox)
|
|
4350
|
-
delete next.stylesBox;
|
|
4351
|
-
else
|
|
4352
|
-
next.stylesBox = open;
|
|
4353
|
-
keep(next);
|
|
4354
|
-
},
|
|
4355
|
-
subscribe(listener) {
|
|
4356
|
-
listeners.add(listener);
|
|
4357
|
-
return () => {
|
|
4358
|
-
listeners.delete(listener);
|
|
4359
|
-
};
|
|
4360
|
-
},
|
|
4361
|
-
destroy() {
|
|
4362
|
-
listeners.clear();
|
|
4363
|
-
if (typeof window !== "undefined")
|
|
4364
|
-
window.removeEventListener("storage", onStorage);
|
|
4365
|
-
}
|
|
4366
|
-
};
|
|
4367
|
-
}
|
|
4368
|
-
|
|
4369
4065
|
// src/ui/requestformat.ts
|
|
4370
4066
|
var LIGHT_WHY = "the browser gives a page only timing and size for this";
|
|
4371
4067
|
var HIDDEN = "<hidden>";
|
|
@@ -6635,6 +6331,51 @@ function handleHint(keys, mac) {
|
|
|
6635
6331
|
return `press ${comboLabel(keys.panel, mac)} to open knobs`;
|
|
6636
6332
|
}
|
|
6637
6333
|
var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
|
|
6334
|
+
var KEEP_LABEL = "keep edits after reload";
|
|
6335
|
+
var KEEP_HINT = "keeps your Elements edits on this page after a reload.";
|
|
6336
|
+
function keepRow(resolve) {
|
|
6337
|
+
const control = button("switch row-control", "");
|
|
6338
|
+
control.setAttribute("role", "switch");
|
|
6339
|
+
control.setAttribute("aria-label", KEEP_LABEL);
|
|
6340
|
+
const hint = el("div", "row-hint", KEEP_HINT);
|
|
6341
|
+
hint.id = "devknobs-keep-hint";
|
|
6342
|
+
control.setAttribute("aria-describedby", hint.id);
|
|
6343
|
+
const node = rowBox({
|
|
6344
|
+
main: el("div", "main"),
|
|
6345
|
+
glyph: icon("rotate-ccw"),
|
|
6346
|
+
title: KEEP_LABEL,
|
|
6347
|
+
ends: [control]
|
|
6348
|
+
}).box;
|
|
6349
|
+
node.append(hint);
|
|
6350
|
+
let keep = null;
|
|
6351
|
+
let stop2 = null;
|
|
6352
|
+
const draw = () => {
|
|
6353
|
+
if (!keep)
|
|
6354
|
+
return;
|
|
6355
|
+
mark(control, keep.on(), "aria-checked");
|
|
6356
|
+
control.disabled = !keep.known();
|
|
6357
|
+
};
|
|
6358
|
+
control.addEventListener("click", () => keep?.set(!keep.on()));
|
|
6359
|
+
function sync() {
|
|
6360
|
+
const now2 = resolve();
|
|
6361
|
+
if (now2 !== keep) {
|
|
6362
|
+
stop2?.();
|
|
6363
|
+
keep = now2;
|
|
6364
|
+
stop2 = keep ? keep.subscribe(draw) : null;
|
|
6365
|
+
}
|
|
6366
|
+
node.hidden = !keep;
|
|
6367
|
+
draw();
|
|
6368
|
+
}
|
|
6369
|
+
sync();
|
|
6370
|
+
return {
|
|
6371
|
+
node,
|
|
6372
|
+
sync,
|
|
6373
|
+
destroy() {
|
|
6374
|
+
stop2?.();
|
|
6375
|
+
stop2 = null;
|
|
6376
|
+
}
|
|
6377
|
+
};
|
|
6378
|
+
}
|
|
6638
6379
|
function createSettings(context) {
|
|
6639
6380
|
const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
|
|
6640
6381
|
const keysView = el("div", "keys pane");
|
|
@@ -6721,12 +6462,20 @@ function createSettings(context) {
|
|
|
6721
6462
|
const devIconSwitch = button("switch row-control", "");
|
|
6722
6463
|
devIconSwitch.setAttribute("role", "switch");
|
|
6723
6464
|
devIconSwitch.setAttribute("aria-label", "dev tab icon");
|
|
6724
|
-
|
|
6465
|
+
const devIconRow = rowBox({
|
|
6725
6466
|
main: el("div", "main"),
|
|
6726
6467
|
glyph: icon("image"),
|
|
6727
6468
|
title: "dev tab icon",
|
|
6728
6469
|
ends: [devIconSwitch]
|
|
6729
|
-
}).box
|
|
6470
|
+
}).box;
|
|
6471
|
+
keysView.append(devIconRow);
|
|
6472
|
+
const keepEdits = keepRow(context.keep);
|
|
6473
|
+
const placeKeep = () => {
|
|
6474
|
+
keepEdits.sync();
|
|
6475
|
+
if (!keepEdits.node.hidden && !keysView.contains(keepEdits.node))
|
|
6476
|
+
keysView.insertBefore(keepEdits.node, devIconRow);
|
|
6477
|
+
};
|
|
6478
|
+
placeKeep();
|
|
6730
6479
|
devIconSwitch.addEventListener("click", () => context.setDevIcon(!context.devIconShown()));
|
|
6731
6480
|
keysView.append(rowsLabel("shortcuts"));
|
|
6732
6481
|
const keyViews = new Map;
|
|
@@ -6806,6 +6555,7 @@ function createSettings(context) {
|
|
|
6806
6555
|
if (context.searching())
|
|
6807
6556
|
context.leaveSearch();
|
|
6808
6557
|
editingKeys = true;
|
|
6558
|
+
placeKeep();
|
|
6809
6559
|
render();
|
|
6810
6560
|
focusView("keys");
|
|
6811
6561
|
}
|
|
@@ -6885,8 +6635,12 @@ function createSettings(context) {
|
|
|
6885
6635
|
return true;
|
|
6886
6636
|
},
|
|
6887
6637
|
stopRecording,
|
|
6638
|
+
openKeys,
|
|
6888
6639
|
leaveKeys,
|
|
6889
|
-
destroy
|
|
6640
|
+
destroy() {
|
|
6641
|
+
stopRefusing();
|
|
6642
|
+
keepEdits.destroy();
|
|
6643
|
+
}
|
|
6890
6644
|
};
|
|
6891
6645
|
}
|
|
6892
6646
|
|
|
@@ -6934,7 +6688,7 @@ var CSS = `
|
|
|
6934
6688
|
--edge: 0px;
|
|
6935
6689
|
--edge-line: transparent;
|
|
6936
6690
|
--glide: 220ms;
|
|
6937
|
-
--panel-width:
|
|
6691
|
+
--panel-width: 320px;
|
|
6938
6692
|
/* The columns: what a row keeps clear inside its edges, an icon's width,
|
|
6939
6693
|
the room between an icon and its word, and how far in a line of words
|
|
6940
6694
|
starts and ends. */
|
|
@@ -7041,6 +6795,7 @@ button {
|
|
|
7041
6795
|
}
|
|
7042
6796
|
:focus { outline: none; }
|
|
7043
6797
|
button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
6798
|
+
input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-offset: 1px; }
|
|
7044
6799
|
|
|
7045
6800
|
.handle {
|
|
7046
6801
|
flex: none;
|
|
@@ -7128,7 +6883,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
7128
6883
|
would stay on the window's edge as a line the panel's height. It hides
|
|
7129
6884
|
once the slide is over. The edge side's border and the padding that pays
|
|
7130
6885
|
for it go once its color has eased out. The width glides to a new one, as
|
|
7131
|
-
|
|
6886
|
+
the strip's keys set it, and the panel turns that off under the strip. */
|
|
7132
6887
|
visibility: hidden;
|
|
7133
6888
|
transition: visibility 0s linear 150ms, border-top-right-radius var(--glide) ease-out,
|
|
7134
6889
|
border-bottom-right-radius var(--glide) ease-out, border-right-color var(--glide) ease-out,
|
|
@@ -8277,12 +8032,41 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8277
8032
|
min-height: 96px;
|
|
8278
8033
|
max-height: 85vh;
|
|
8279
8034
|
overflow: auto;
|
|
8280
|
-
resize: vertical;
|
|
8281
8035
|
overscroll-behavior: contain;
|
|
8282
8036
|
scrollbar-width: thin;
|
|
8283
8037
|
scrollbar-color: var(--line) transparent;
|
|
8284
8038
|
}
|
|
8285
8039
|
.dom[style*="height"] { flex-grow: 0; }
|
|
8040
|
+
/* The line between the tree and the styles, which drags for the tree's
|
|
8041
|
+
height as the browser's own does: 7 tall to the pointer, -4 in the flow
|
|
8042
|
+
so with the two 4px gaps 4 stay between the tree and the styles, a
|
|
8043
|
+
hairline at 2 of them that darkens under the pointer, the keys' focus or a
|
|
8044
|
+
drag. */
|
|
8045
|
+
.dom-split {
|
|
8046
|
+
position: relative;
|
|
8047
|
+
flex: none;
|
|
8048
|
+
height: 7px;
|
|
8049
|
+
margin: -5px 0 -6px;
|
|
8050
|
+
cursor: row-resize;
|
|
8051
|
+
touch-action: none;
|
|
8052
|
+
user-select: none;
|
|
8053
|
+
-webkit-user-select: none;
|
|
8054
|
+
outline: none;
|
|
8055
|
+
z-index: 1;
|
|
8056
|
+
}
|
|
8057
|
+
.dom-split::after {
|
|
8058
|
+
content: "";
|
|
8059
|
+
position: absolute;
|
|
8060
|
+
left: 0;
|
|
8061
|
+
right: 0;
|
|
8062
|
+
top: 3px;
|
|
8063
|
+
height: 1px;
|
|
8064
|
+
background: var(--line);
|
|
8065
|
+
transition: background-color 120ms ease-out;
|
|
8066
|
+
}
|
|
8067
|
+
.dom-split:hover::after,
|
|
8068
|
+
.dom-split:focus-visible::after,
|
|
8069
|
+
.dom-split[data-drag]::after { background: var(--faint); }
|
|
8286
8070
|
.dom-tree { width: min-content; min-width: 100%; font: 11px/1.6 var(--mono); }
|
|
8287
8071
|
.dom-row {
|
|
8288
8072
|
display: flex;
|
|
@@ -8292,6 +8076,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8292
8076
|
user-select: text;
|
|
8293
8077
|
-webkit-user-select: text;
|
|
8294
8078
|
}
|
|
8079
|
+
.dom-row { position: relative; }
|
|
8295
8080
|
.dom-row:hover { background: var(--card); }
|
|
8296
8081
|
.dom-row.on { background: var(--card); }
|
|
8297
8082
|
.dom-tree:focus-within .dom-row.on { background: var(--pick); }
|
|
@@ -8299,6 +8084,110 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8299
8084
|
.dom-code { flex: 0 1 auto; min-width: 30ch; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
|
|
8300
8085
|
.dom-ref { white-space: pre; color: var(--faint); }
|
|
8301
8086
|
.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; }
|
|
8087
|
+
/* A line whose element the panel hid, faint as its box on the page is gone. */
|
|
8088
|
+
.dom-hid > .dom-code { opacity: 0.5; }
|
|
8089
|
+
/* The html editor: line numbers on the card's fill beside the text, which is
|
|
8090
|
+
colored by the pre under a clear text box, the two set alike to the
|
|
8091
|
+
pixel, a scrollbar's room kept in both, so a long line wraps at the same
|
|
8092
|
+
place in each and its number stays at its first row. The grip under it
|
|
8093
|
+
drags its height, the button makes it the panel's. */
|
|
8094
|
+
.dom-code:has(> .html-ed), .dom-code:has(> .dom-edit) { flex: 1 1 auto; }
|
|
8095
|
+
.dom-code > .html-ed { display: block; width: 100%; min-width: 30ch; margin: 2px 0; }
|
|
8096
|
+
.html-ed-body {
|
|
8097
|
+
overflow: hidden;
|
|
8098
|
+
background: var(--bg);
|
|
8099
|
+
border-radius: 4px;
|
|
8100
|
+
box-shadow: inset 0 0 0 1px var(--faint);
|
|
8101
|
+
}
|
|
8102
|
+
.html-ed-code {
|
|
8103
|
+
position: relative;
|
|
8104
|
+
height: 100%;
|
|
8105
|
+
overflow: hidden;
|
|
8106
|
+
background: linear-gradient(var(--card), var(--card)) no-repeat;
|
|
8107
|
+
}
|
|
8108
|
+
.html-ed-hl, .html-ed .dom-html {
|
|
8109
|
+
position: absolute;
|
|
8110
|
+
inset: 0;
|
|
8111
|
+
margin: 0;
|
|
8112
|
+
padding: 4px var(--col-pad);
|
|
8113
|
+
font: 11px/1.6 var(--mono);
|
|
8114
|
+
letter-spacing: normal;
|
|
8115
|
+
white-space: pre-wrap;
|
|
8116
|
+
tab-size: 2;
|
|
8117
|
+
overflow-wrap: anywhere;
|
|
8118
|
+
word-break: normal;
|
|
8119
|
+
scrollbar-gutter: stable;
|
|
8120
|
+
scrollbar-width: thin;
|
|
8121
|
+
}
|
|
8122
|
+
.html-ed-hl { padding-left: 0; overflow: hidden; color: var(--fg); pointer-events: none; }
|
|
8123
|
+
.html-ed-hl > .html-ed-inner { display: grid; }
|
|
8124
|
+
.html-ed-num {
|
|
8125
|
+
padding: 0 var(--col-pad);
|
|
8126
|
+
color: var(--faint);
|
|
8127
|
+
text-align: right;
|
|
8128
|
+
user-select: none;
|
|
8129
|
+
-webkit-user-select: none;
|
|
8130
|
+
}
|
|
8131
|
+
.html-ed-text { min-height: 1.6em; padding-left: var(--col-pad); }
|
|
8132
|
+
.html-ed .dom-html {
|
|
8133
|
+
width: 100%;
|
|
8134
|
+
height: 100%;
|
|
8135
|
+
max-height: none;
|
|
8136
|
+
overflow: auto;
|
|
8137
|
+
resize: none;
|
|
8138
|
+
color: transparent;
|
|
8139
|
+
caret-color: var(--fg);
|
|
8140
|
+
background: transparent;
|
|
8141
|
+
border-radius: 0;
|
|
8142
|
+
box-shadow: none;
|
|
8143
|
+
scrollbar-width: thin;
|
|
8144
|
+
}
|
|
8145
|
+
.html-ed .dom-html::selection { background: color-mix(in srgb, var(--faint) 35%, transparent); }
|
|
8146
|
+
.html-ed .dom-html.bad { caret-color: var(--hot); }
|
|
8147
|
+
.html-ed:has(.bad) > .html-ed-body { box-shadow: inset 0 0 0 1px var(--hot); }
|
|
8148
|
+
.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; }
|
|
8149
|
+
.html-ed-grip { flex: 1 1 auto; display: grid; place-items: center; height: 12px; cursor: ns-resize; touch-action: none; }
|
|
8150
|
+
.html-ed-grip::after { content: ""; width: 32px; height: 3px; background: var(--line); border-radius: 2px; transition: background 120ms ease-out; }
|
|
8151
|
+
.html-ed-grip:hover::after { background: var(--faint); }
|
|
8152
|
+
.dom-code > .dom-apply { margin: 4px 0 2px; }
|
|
8153
|
+
/* The selected line's actions, kept in sight at the foot of the tree as it scrolls either way. */
|
|
8154
|
+
.dom-acts {
|
|
8155
|
+
position: sticky;
|
|
8156
|
+
left: 0;
|
|
8157
|
+
bottom: 0;
|
|
8158
|
+
display: flex;
|
|
8159
|
+
flex-wrap: wrap;
|
|
8160
|
+
gap: 4px;
|
|
8161
|
+
padding: 4px var(--view-end) 4px var(--view-start);
|
|
8162
|
+
background: var(--bg);
|
|
8163
|
+
border-top: 1px solid var(--line);
|
|
8164
|
+
}
|
|
8165
|
+
/* The handle that drags an element's line, at the start of its step in: on
|
|
8166
|
+
hover and on the selected line, and always under a finger. The line being
|
|
8167
|
+
dragged is faint; where it would go is a line over or under another, or
|
|
8168
|
+
a ring around the element it would go into. */
|
|
8169
|
+
.dom-grip {
|
|
8170
|
+
position: absolute;
|
|
8171
|
+
top: 0;
|
|
8172
|
+
width: 1.2em;
|
|
8173
|
+
line-height: 1.6;
|
|
8174
|
+
text-align: center;
|
|
8175
|
+
color: var(--faint);
|
|
8176
|
+
cursor: grab;
|
|
8177
|
+
opacity: 0;
|
|
8178
|
+
touch-action: none;
|
|
8179
|
+
user-select: none;
|
|
8180
|
+
-webkit-user-select: none;
|
|
8181
|
+
transition: opacity 120ms ease-out;
|
|
8182
|
+
}
|
|
8183
|
+
.dom-row:hover > .dom-grip, .dom-row.on > .dom-grip { opacity: 1; }
|
|
8184
|
+
@media (hover: none) { .dom-grip { opacity: 0.6; } }
|
|
8185
|
+
.dom-grip:hover { color: var(--fg); }
|
|
8186
|
+
.dom-drag, .dom-drag * { cursor: grabbing; }
|
|
8187
|
+
.dom-dragging > .dom-code { opacity: 0.45; }
|
|
8188
|
+
.dom-drop-before { box-shadow: inset 0 2px 0 var(--fg); }
|
|
8189
|
+
.dom-drop-after { box-shadow: inset 0 -2px 0 var(--fg); }
|
|
8190
|
+
.dom-drop-into { box-shadow: inset 0 0 0 1px var(--fg); }
|
|
8302
8191
|
.dom-flash { animation: dom-flash 900ms ease-out; }
|
|
8303
8192
|
@keyframes dom-flash {
|
|
8304
8193
|
from { background: var(--pick); }
|
|
@@ -8363,8 +8252,9 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8363
8252
|
text-overflow: ellipsis;
|
|
8364
8253
|
white-space: nowrap;
|
|
8365
8254
|
}
|
|
8366
|
-
/* A declaration that wraps goes on further in than it starts.
|
|
8367
|
-
|
|
8255
|
+
/* A declaration that wraps goes on further in than it starts. Every line
|
|
8256
|
+
keeps the gutter an editable line's box stands in, so no text moves. */
|
|
8257
|
+
.css-decl { display: block; padding-left: 30px; text-indent: -12px; text-decoration: none; }
|
|
8368
8258
|
/* A name has the color of a key, its value the text's, and the marks between
|
|
8369
8259
|
them are quiet. A declaration that is struck through is quiet all over. */
|
|
8370
8260
|
.css-name { color: var(--key); }
|
|
@@ -8412,10 +8302,141 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
|
|
|
8412
8302
|
padding-right: var(--view-end);
|
|
8413
8303
|
padding-left: var(--view-start);
|
|
8414
8304
|
}
|
|
8415
|
-
.css-applied .css-decl { padding-left: 12px; }
|
|
8416
8305
|
.css-label { font-size: 10.5px; color: var(--faint); }
|
|
8417
8306
|
.css-comes { color: var(--faint); }
|
|
8418
8307
|
.css-hidden { padding: 2px var(--view-end) 2px var(--view-start); font-size: 10.5px; color: var(--faint); overflow-wrap: anywhere; }
|
|
8308
|
+
/* Editing, as in the browsers' tools: a checkbox in a line's gutter turns
|
|
8309
|
+
it off and on, shown on hover, on focus and on a line that is off. Its
|
|
8310
|
+
ring and its check are cut out of a fill by a mask, so they follow the
|
|
8311
|
+
theme with no line drawn. A value is a
|
|
8312
|
+
field on a click, as wide as what it holds, on the track's fill, its text
|
|
8313
|
+
red where the page did not take it. Adding a property is a quiet line
|
|
8314
|
+
under a block, in from its edge as a declaration's first line is. */
|
|
8315
|
+
.css-decl.can-edit { position: relative; }
|
|
8316
|
+
.css-toggle {
|
|
8317
|
+
position: absolute;
|
|
8318
|
+
top: 2.5px;
|
|
8319
|
+
left: 2px;
|
|
8320
|
+
width: 12px;
|
|
8321
|
+
height: 12px;
|
|
8322
|
+
opacity: 0;
|
|
8323
|
+
background: var(--faint);
|
|
8324
|
+
border-radius: 3px;
|
|
8325
|
+
cursor: pointer;
|
|
8326
|
+
-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;
|
|
8327
|
+
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;
|
|
8328
|
+
transition: opacity 120ms ease-out;
|
|
8329
|
+
}
|
|
8330
|
+
.css-toggle:checked {
|
|
8331
|
+
background: var(--fg);
|
|
8332
|
+
-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");
|
|
8333
|
+
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");
|
|
8334
|
+
}
|
|
8335
|
+
.css-decl.can-edit:hover > .css-toggle, .css-toggle:focus-visible, .css-decl.off > .css-toggle { opacity: 1; }
|
|
8336
|
+
.css-editable { border-radius: 2px; cursor: text; }
|
|
8337
|
+
.css-editable:hover, .css-editable:focus-visible { background: var(--track); }
|
|
8338
|
+
/* A field wraps where its value is wider than its line, and grows down, as
|
|
8339
|
+
tall as what it holds up to a height it scrolls in: nothing scrolls sideways. */
|
|
8340
|
+
.css-edit {
|
|
8341
|
+
max-width: 100%;
|
|
8342
|
+
max-height: 18em;
|
|
8343
|
+
padding: 0;
|
|
8344
|
+
font: inherit;
|
|
8345
|
+
text-indent: 0;
|
|
8346
|
+
vertical-align: top;
|
|
8347
|
+
white-space: pre-wrap;
|
|
8348
|
+
overflow-wrap: anywhere;
|
|
8349
|
+
overflow: hidden auto;
|
|
8350
|
+
resize: none;
|
|
8351
|
+
scrollbar-width: thin;
|
|
8352
|
+
color: var(--fg);
|
|
8353
|
+
background: var(--track);
|
|
8354
|
+
border-radius: 2px;
|
|
8355
|
+
}
|
|
8356
|
+
.css-edit.bad { color: var(--hot); }
|
|
8357
|
+
/* The field's ring, as a chip's field has it while focused, in place of the browser's border. */
|
|
8358
|
+
.inline-field { border: 0; box-shadow: inset 0 0 0 1px var(--faint); }
|
|
8359
|
+
.css-add, .css-adding { padding-left: 18px; }
|
|
8360
|
+
.css-add, .css-new-rule {
|
|
8361
|
+
display: block;
|
|
8362
|
+
font: 11px/1.5 var(--mono);
|
|
8363
|
+
color: var(--faint);
|
|
8364
|
+
border-radius: 2px;
|
|
8365
|
+
transition: color 120ms ease-out;
|
|
8366
|
+
}
|
|
8367
|
+
.css-add:hover, .css-new-rule:hover { color: var(--fg); }
|
|
8368
|
+
.css-adding { text-indent: 0; }
|
|
8369
|
+
/* The suggestions under a field of the styles view: a raised list placed
|
|
8370
|
+
under the field, the one marked in the selected line's tint. */
|
|
8371
|
+
.ac-list {
|
|
8372
|
+
position: absolute;
|
|
8373
|
+
z-index: 3;
|
|
8374
|
+
display: grid;
|
|
8375
|
+
min-width: 16ch;
|
|
8376
|
+
max-width: 100%;
|
|
8377
|
+
max-height: 12.8em;
|
|
8378
|
+
overflow-y: auto;
|
|
8379
|
+
padding: 2px 0;
|
|
8380
|
+
font: 11px/1.6 var(--mono);
|
|
8381
|
+
text-indent: 0;
|
|
8382
|
+
white-space: nowrap;
|
|
8383
|
+
color: var(--fg);
|
|
8384
|
+
background: var(--raised);
|
|
8385
|
+
border-radius: 4px;
|
|
8386
|
+
box-shadow: var(--lift), 0 0 0 1px var(--line);
|
|
8387
|
+
scrollbar-width: thin;
|
|
8388
|
+
}
|
|
8389
|
+
.ac-item { padding: 0 var(--col-pad); overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
|
|
8390
|
+
.ac-item:hover { background: var(--card); }
|
|
8391
|
+
.ac-item[aria-selected="true"] { background: var(--pick); }
|
|
8392
|
+
/* The line that adds a rule stands under the blocks, as the start of one. */
|
|
8393
|
+
.css-new-rule { justify-self: start; padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8394
|
+
.css-rule-adding { padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8395
|
+
/* The states a chip forces, in the editors' chips, the selector's font. */
|
|
8396
|
+
.force-states { padding: 0 var(--view-end) 4px var(--view-start); }
|
|
8397
|
+
.force-states .chip { font: 11px/22px var(--mono); }
|
|
8398
|
+
|
|
8399
|
+
/* The changes at the foot of the Elements view, which stay in sight while
|
|
8400
|
+
the styles scroll: a quiet head, each edit as diff lines tinted for what
|
|
8401
|
+
went and what came, then the buttons, the prompt the filled one. */
|
|
8402
|
+
.changes {
|
|
8403
|
+
position: sticky;
|
|
8404
|
+
bottom: 0;
|
|
8405
|
+
/* Over the styles' bar where the two meet, with a long list. */
|
|
8406
|
+
z-index: 2;
|
|
8407
|
+
display: grid;
|
|
8408
|
+
grid-template-columns: minmax(0, 1fr);
|
|
8409
|
+
gap: 6px;
|
|
8410
|
+
padding: 8px var(--view-end) 8px var(--view-start);
|
|
8411
|
+
background: var(--bg);
|
|
8412
|
+
border-top: 1px solid var(--line);
|
|
8413
|
+
}
|
|
8414
|
+
.changes-head, .changes-note { font-size: 10.5px; color: var(--faint); }
|
|
8415
|
+
/* The count is the button that folds the diff out, its chevron turned while it shows. */
|
|
8416
|
+
.changes-toggle { color: inherit; border-radius: 2px; transition: color 120ms ease-out; }
|
|
8417
|
+
.changes-toggle:hover { color: var(--fg); }
|
|
8418
|
+
.changes-toggle::before { content: "›"; display: inline-block; width: 2ch; text-align: left; transform-origin: 0.5ch 50%; transition: transform 120ms ease-out; }
|
|
8419
|
+
.changes-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
|
|
8420
|
+
/* What was made again as the page loaded, and the edits that were not. */
|
|
8421
|
+
.changes-kept { display: grid; gap: 2px; font-size: 11px; }
|
|
8422
|
+
.changes-kept-line { color: var(--fg); }
|
|
8423
|
+
.changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
|
8424
|
+
.changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
|
|
8425
|
+
/* The switch that keeps the edits after a reload, over the tree. */
|
|
8426
|
+
.changes-list {
|
|
8427
|
+
max-height: 30vh;
|
|
8428
|
+
overflow: auto;
|
|
8429
|
+
font: 11px/1.5 var(--mono);
|
|
8430
|
+
overflow-wrap: anywhere;
|
|
8431
|
+
scrollbar-width: thin;
|
|
8432
|
+
}
|
|
8433
|
+
.diff-place { padding: 4px var(--col-pad) 0; color: var(--faint); }
|
|
8434
|
+
.diff-place:first-child { padding-top: 0; }
|
|
8435
|
+
.diff-del, .diff-add { padding: 0 var(--col-pad); border-radius: 2px; }
|
|
8436
|
+
.diff-del { background: color-mix(in srgb, var(--hot) 14%, transparent); }
|
|
8437
|
+
.diff-add { background: color-mix(in srgb, var(--ok) 14%, transparent); }
|
|
8438
|
+
.changes-acts { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
8439
|
+
.chip.changes-go, .chip.changes-go:hover { color: var(--bg); background: var(--fg); }
|
|
8419
8440
|
|
|
8420
8441
|
/* The element's box, in a fold of the kit's: a picture of the element, so
|
|
8421
8442
|
its areas are filled, each in the hue the page's own tint of it has, mixed
|
|
@@ -8733,6 +8754,11 @@ function ownCss(media) {
|
|
|
8733
8754
|
};
|
|
8734
8755
|
return CSS.replace(/@media ([^{]+)\{/g, settle2).replaceAll("color-scheme: light dark", `color-scheme: ${media.scheme}`);
|
|
8735
8756
|
}
|
|
8757
|
+
function resetPage(log = edits, reset2 = reset) {
|
|
8758
|
+
log.undoAll();
|
|
8759
|
+
clearForced();
|
|
8760
|
+
reset2();
|
|
8761
|
+
}
|
|
8736
8762
|
function createPanel(options2 = {}) {
|
|
8737
8763
|
const keys = options2.keys ?? createKeys();
|
|
8738
8764
|
const prefs = createPrefs({ handle: options2.handle });
|
|
@@ -8758,7 +8784,7 @@ function createPanel(options2 = {}) {
|
|
|
8758
8784
|
const flip = () => drag.flip();
|
|
8759
8785
|
stage.flip = flip;
|
|
8760
8786
|
const actionsHere = availableActions();
|
|
8761
|
-
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" || inspect !== null));
|
|
8787
|
+
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
|
|
8762
8788
|
const host = document.createElement("div");
|
|
8763
8789
|
host.setAttribute("data-devknobs", "panel");
|
|
8764
8790
|
host.style.cssText = HOST_STYLE;
|
|
@@ -8834,6 +8860,7 @@ function createPanel(options2 = {}) {
|
|
|
8834
8860
|
setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
|
|
8835
8861
|
realPhone: hostSendsUa(),
|
|
8836
8862
|
setRealPhone: (on) => setState({ panel: { realPhone: on } }),
|
|
8863
|
+
keep: keeper,
|
|
8837
8864
|
native: nativeSwitch()?.setting ?? null,
|
|
8838
8865
|
setNative: (on) => {
|
|
8839
8866
|
nativeSwitch()?.setting.change(on);
|
|
@@ -8867,7 +8894,6 @@ function createPanel(options2 = {}) {
|
|
|
8867
8894
|
wrap,
|
|
8868
8895
|
panel,
|
|
8869
8896
|
prefs,
|
|
8870
|
-
showing: () => viewing() ? "view" : "list",
|
|
8871
8897
|
place: () => getState().panel,
|
|
8872
8898
|
wide: setDockWidth,
|
|
8873
8899
|
sized: panelSized
|
|
@@ -8957,7 +8983,7 @@ function createPanel(options2 = {}) {
|
|
|
8957
8983
|
rows.hidden = !anyShown;
|
|
8958
8984
|
const resetHint = hints.get("reset");
|
|
8959
8985
|
if (resetHint)
|
|
8960
|
-
resetHint.disabled = isReset(state);
|
|
8986
|
+
resetHint.disabled = isReset(state) && edits.list().length === 0;
|
|
8961
8987
|
badge.textContent = overflowBadge(state.overflow, live.overflow);
|
|
8962
8988
|
badge.hidden = badge.textContent === "";
|
|
8963
8989
|
badge.classList.toggle("hot", hot);
|
|
@@ -9021,7 +9047,7 @@ function createPanel(options2 = {}) {
|
|
|
9021
9047
|
searchInput.value = "";
|
|
9022
9048
|
for (const action of actionsHere)
|
|
9023
9049
|
stopAction(action);
|
|
9024
|
-
|
|
9050
|
+
resetPage();
|
|
9025
9051
|
}
|
|
9026
9052
|
function onInspect(on) {
|
|
9027
9053
|
const at = root.activeElement;
|
|
@@ -9068,9 +9094,17 @@ function createPanel(options2 = {}) {
|
|
|
9068
9094
|
actionOf("storage")?.run();
|
|
9069
9095
|
return;
|
|
9070
9096
|
}
|
|
9097
|
+
if (action === "requests" || action === "elements") {
|
|
9098
|
+
showView(action);
|
|
9099
|
+
return;
|
|
9100
|
+
}
|
|
9101
|
+
if (action === "settings") {
|
|
9102
|
+
showSettings();
|
|
9103
|
+
return;
|
|
9104
|
+
}
|
|
9071
9105
|
if (!getState().panel.open)
|
|
9072
9106
|
return;
|
|
9073
|
-
if (action === "replay"
|
|
9107
|
+
if (action === "replay")
|
|
9074
9108
|
actionOf(action)?.run();
|
|
9075
9109
|
else if (action === "reset")
|
|
9076
9110
|
runCommand("reset");
|
|
@@ -9079,6 +9113,31 @@ function createPanel(options2 = {}) {
|
|
|
9079
9113
|
else
|
|
9080
9114
|
toggle(false);
|
|
9081
9115
|
}
|
|
9116
|
+
function opensPanel(action) {
|
|
9117
|
+
return action === "toggle" || action === "storage" || action === "requests" || action === "settings" || action === "elements";
|
|
9118
|
+
}
|
|
9119
|
+
function showView(action) {
|
|
9120
|
+
const id = side.view();
|
|
9121
|
+
const mine = action === "requests" ? requests.shows() : id === STYLES_VIEW;
|
|
9122
|
+
if (mine && getState().panel.open && viewing()) {
|
|
9123
|
+
side.close();
|
|
9124
|
+
return;
|
|
9125
|
+
}
|
|
9126
|
+
if (mine && id !== null)
|
|
9127
|
+
side.show(id);
|
|
9128
|
+
else if (action === "requests")
|
|
9129
|
+
requestsHere.toggle();
|
|
9130
|
+
else
|
|
9131
|
+
inspector?.elements();
|
|
9132
|
+
}
|
|
9133
|
+
function showSettings() {
|
|
9134
|
+
if (getState().panel.open && settings.editing()) {
|
|
9135
|
+
settings.leaveKeys();
|
|
9136
|
+
return;
|
|
9137
|
+
}
|
|
9138
|
+
toggle(true);
|
|
9139
|
+
settings.openKeys();
|
|
9140
|
+
}
|
|
9082
9141
|
function escape() {
|
|
9083
9142
|
if (drag.dragging() || !getState().panel.open)
|
|
9084
9143
|
return;
|
|
@@ -9128,8 +9187,8 @@ function createPanel(options2 = {}) {
|
|
|
9128
9187
|
event.stopPropagation();
|
|
9129
9188
|
return;
|
|
9130
9189
|
}
|
|
9131
|
-
const action = keyAction(event, keys.get());
|
|
9132
|
-
const acts = action !== null && action !== "close" && !drag.dragging() && (action
|
|
9190
|
+
const action = keyAction(event, keysListed(keys.get(), bindingsHere));
|
|
9191
|
+
const acts = action !== null && action !== "close" && !drag.dragging() && (opensPanel(action) || getState().panel.open);
|
|
9133
9192
|
const inSearch = event.composedPath()[0] === searchInput;
|
|
9134
9193
|
if (acts || action && action !== "close" && inSearch)
|
|
9135
9194
|
event.preventDefault();
|
|
@@ -9178,6 +9237,7 @@ function createPanel(options2 = {}) {
|
|
|
9178
9237
|
stage.inspector = inspector;
|
|
9179
9238
|
const stopModes = actionsHere.flatMap((action) => action.watch?.(render) ?? []);
|
|
9180
9239
|
const stopCount = onCount(render);
|
|
9240
|
+
const stopEdits = edits.subscribe(render);
|
|
9181
9241
|
window.addEventListener("keydown", onKeydown, true);
|
|
9182
9242
|
window.addEventListener("pointerdown", onPointerDown, true);
|
|
9183
9243
|
window.addEventListener("pointerup", onPointerUp, true);
|
|
@@ -9229,6 +9289,7 @@ function createPanel(options2 = {}) {
|
|
|
9229
9289
|
if (stage.inspector === inspector)
|
|
9230
9290
|
stage.inspector = null;
|
|
9231
9291
|
stopCount();
|
|
9292
|
+
stopEdits();
|
|
9232
9293
|
clearInterval(ticker);
|
|
9233
9294
|
tips.destroy();
|
|
9234
9295
|
settings.destroy();
|
|
@@ -9256,7 +9317,7 @@ function createPanel(options2 = {}) {
|
|
|
9256
9317
|
}
|
|
9257
9318
|
|
|
9258
9319
|
// src/version.ts
|
|
9259
|
-
var VERSION = "0.
|
|
9320
|
+
var VERSION = "0.6.1";
|
|
9260
9321
|
|
|
9261
9322
|
// src/index.ts
|
|
9262
9323
|
var PRESETS = {
|
|
@@ -9315,12 +9376,20 @@ function mount(options2 = {}) {
|
|
|
9315
9376
|
start(options2);
|
|
9316
9377
|
mounted = options2;
|
|
9317
9378
|
attach(options2);
|
|
9379
|
+
if (!isDevknobsFrame() && !fresh())
|
|
9380
|
+
keepEdits(options2.editsStore);
|
|
9381
|
+
}
|
|
9382
|
+
function keepEdits(store) {
|
|
9383
|
+
const path = pathNow();
|
|
9384
|
+
const frame = () => framedPage(window, frameWindow(), path, needsFrame(getState()));
|
|
9385
|
+
startKeep(store, { frame, settled: () => pageSettled(window, () => needsFrame(getState()), frame) });
|
|
9318
9386
|
}
|
|
9319
9387
|
function attach(options2) {
|
|
9320
9388
|
const live = createKeys({
|
|
9321
9389
|
hotkey: options2.hotkey,
|
|
9322
9390
|
grabKey: options2.grabKey,
|
|
9323
|
-
grab: options2.grab !== false
|
|
9391
|
+
grab: options2.grab !== false,
|
|
9392
|
+
store: options2.keysStore
|
|
9324
9393
|
});
|
|
9325
9394
|
keys = live;
|
|
9326
9395
|
if (options2.grab !== false) {
|
|
@@ -9425,6 +9494,7 @@ function adopt(options2, take) {
|
|
|
9425
9494
|
detach();
|
|
9426
9495
|
attach(mounted);
|
|
9427
9496
|
}
|
|
9497
|
+
var handing = false;
|
|
9428
9498
|
function handOver() {
|
|
9429
9499
|
const take = waiting;
|
|
9430
9500
|
const options2 = mounted;
|
|
@@ -9436,7 +9506,12 @@ function handOver() {
|
|
|
9436
9506
|
return;
|
|
9437
9507
|
}
|
|
9438
9508
|
const native = nativeSwitch();
|
|
9439
|
-
|
|
9509
|
+
handing = true;
|
|
9510
|
+
try {
|
|
9511
|
+
unmount();
|
|
9512
|
+
} finally {
|
|
9513
|
+
handing = false;
|
|
9514
|
+
}
|
|
9440
9515
|
const prefer = options2.prefer;
|
|
9441
9516
|
let took = false;
|
|
9442
9517
|
try {
|
|
@@ -9464,6 +9539,12 @@ function unmount() {
|
|
|
9464
9539
|
if (superseded(window, unmount))
|
|
9465
9540
|
return;
|
|
9466
9541
|
detach();
|
|
9542
|
+
stopKeep();
|
|
9543
|
+
if (!handing) {
|
|
9544
|
+
edits.undoAll();
|
|
9545
|
+
forgetReplay();
|
|
9546
|
+
clearForced();
|
|
9547
|
+
}
|
|
9467
9548
|
const native = mounted?.host ? nativeSwitch() : null;
|
|
9468
9549
|
stop();
|
|
9469
9550
|
withdraw(window, api);
|
|
@@ -9539,16 +9620,41 @@ async function grab(elements, options2) {
|
|
|
9539
9620
|
const host = hosted("grab");
|
|
9540
9621
|
if (host)
|
|
9541
9622
|
return host(elements, options2);
|
|
9542
|
-
const loaded = await import("./index-
|
|
9623
|
+
const loaded = await import("./index-f67wctn3.js");
|
|
9543
9624
|
return loaded.grab(elements, options2);
|
|
9544
9625
|
}
|
|
9545
|
-
|
|
9626
|
+
function edits2() {
|
|
9627
|
+
return (hosted("edits") ?? edits.list)();
|
|
9628
|
+
}
|
|
9629
|
+
async function setEdits(list) {
|
|
9630
|
+
const host = hosted("setEdits");
|
|
9631
|
+
if (host)
|
|
9632
|
+
return host(list);
|
|
9633
|
+
if (!Array.isArray(list))
|
|
9634
|
+
throw new TypeError("devknobs.setEdits takes a list of edits, as edits() gives them");
|
|
9635
|
+
const { replayEdits } = await import("./replay-vtg0vqj2.js");
|
|
9636
|
+
const { applied, skipped } = replayEdits(edits, list);
|
|
9637
|
+
return { applied, skipped };
|
|
9638
|
+
}
|
|
9639
|
+
function undoEdit() {
|
|
9640
|
+
return (hosted("undoEdit") ?? edits.undo)();
|
|
9641
|
+
}
|
|
9642
|
+
function forceState2(target, states = []) {
|
|
9643
|
+
const host = hosted("forceState");
|
|
9644
|
+
if (host)
|
|
9645
|
+
return host(target, states);
|
|
9646
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
9647
|
+
return forceState(element, states);
|
|
9648
|
+
}
|
|
9649
|
+
var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2, edits: edits2, setEdits, undoEdit, forceState: forceState2 };
|
|
9546
9650
|
export {
|
|
9547
9651
|
unmount,
|
|
9652
|
+
undoEdit,
|
|
9548
9653
|
setSystemMedia,
|
|
9549
9654
|
setState2 as setState,
|
|
9550
9655
|
setPrefer,
|
|
9551
9656
|
setNative2 as setNative,
|
|
9657
|
+
setEdits,
|
|
9552
9658
|
reset2 as reset,
|
|
9553
9659
|
replay2 as replay,
|
|
9554
9660
|
ready2 as ready,
|
|
@@ -9556,6 +9662,8 @@ export {
|
|
|
9556
9662
|
holdInTopLayer,
|
|
9557
9663
|
grab,
|
|
9558
9664
|
getState2 as getState,
|
|
9665
|
+
forceState2 as forceState,
|
|
9666
|
+
edits2 as edits,
|
|
9559
9667
|
describe2 as describe,
|
|
9560
9668
|
PRESETS,
|
|
9561
9669
|
LAYER
|