@vinena/knobs 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -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 +6 -6
- 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-fyc06wjt.js +3702 -0
- package/dist/elementsview-k6zvvcne.js +3701 -0
- package/dist/engine/browserdraw.d.ts +5 -0
- package/dist/engine/browserkit.d.ts +2 -0
- package/dist/engine/devices.d.ts +3 -2
- package/dist/engine/dock.d.ts +3 -4
- package/dist/engine/frame.d.ts +1 -1
- package/dist/engine/frames.d.ts +1 -0
- package/dist/engine/identity.d.ts +5 -1
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/mock.d.ts +0 -2
- package/dist/engine/mockdata.d.ts +4 -3
- package/dist/engine/mockdraw.d.ts +2 -14
- package/dist/engine/morphrun.d.ts +4 -0
- package/dist/engine/native.d.ts +31 -3
- package/dist/engine/notice.d.ts +1 -2
- package/dist/engine/style.d.ts +15 -0
- package/dist/engine/width.d.ts +3 -0
- package/dist/{framekit-w0v516w5.js → framekit-622h6w1f.js} +264 -105
- package/dist/{framekit-te90cjs0.js → framekit-yx612r28.js} +264 -105
- package/dist/index-0zp9py56.js +859 -0
- package/dist/{index-9re7sv56.js → index-1mstjadm.js} +126 -2167
- package/dist/{index-30fc6php.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-r72tz2vn.js → index-aymfvd8s.js} +1 -1
- package/dist/{index-trx7bxdk.js → index-aynkv7qk.js} +11 -8
- package/dist/{index-xjhwp5cj.js → index-dzm8ywq0.js} +504 -2362
- package/dist/{index-dan2kpsd.js → index-f60yax1j.js} +13 -8
- package/dist/index-f67wctn3.js +1858 -0
- package/dist/{index-agwr37gw.js → index-ftjdt358.js} +8 -171
- package/dist/{index-pewcdh28.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-sxe5079a.js → index-x59vz1xx.js} +262 -901
- 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 +447 -160
- package/dist/index.js +533 -485
- package/dist/react-0wepdf60.js +1519 -0
- package/dist/{react-4pvp6amm.js → react-1gqwa2yw.js} +1 -1
- package/dist/{index-hv02xka3.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-05jh9jv5.js → react-6fnxxs30.js} +8 -171
- package/dist/react-6q2cw2ya.js +689 -0
- package/dist/{react-sw8d8c94.js → react-6t4dbdzn.js} +11 -8
- package/dist/react-88es9b5q.js +719 -0
- package/dist/react-97b5b8j4.js +46 -0
- package/dist/{react-16spgn0h.js → react-bxzn8vq5.js} +1 -1
- package/dist/{react-ayg1bgw3.js → react-cs62p9qh.js} +83 -722
- package/dist/react-ethftdxp.js +497 -0
- package/dist/react-fp73vhyd.js +36 -0
- package/dist/{react-exjcpxma.js → react-me102s1a.js} +2 -45
- package/dist/react-t2qnewz2.js +24 -0
- package/dist/react-ttj8f9qp.js +1886 -0
- package/dist/{react-zy1mmhgz.js → react-v8497a41.js} +13 -8
- package/dist/{react-fm9y8dbn.js → react-wqn4sx0n.js} +276 -2133
- package/dist/react.js +529 -485
- package/dist/replay-j18rw92k.js +258 -0
- package/dist/replay-vtg0vqj2.js +257 -0
- package/dist/{storageview-s7heg93p.js → storageview-6xj7zb63.js} +11 -7
- package/dist/{storageview-r595qpt9.js → storageview-pzn8yaad.js} +11 -7
- package/dist/styles/force.d.ts +66 -0
- package/dist/types.d.ts +7 -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 +19 -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 +10 -0
- 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-2z4pkrdz.js +0 -2873
- package/dist/elementsview-qn8qyksa.js +0 -2874
- 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-exjcpxma.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,51 @@ 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
|
+
pageSettled,
|
|
53
|
+
pathNow,
|
|
54
|
+
startKeep,
|
|
55
|
+
stopKeep
|
|
56
|
+
} from "./react-6bz05qk1.js";
|
|
25
57
|
import {
|
|
26
58
|
label
|
|
27
|
-
} from "./react-
|
|
59
|
+
} from "./react-ethftdxp.js";
|
|
28
60
|
import {
|
|
29
|
-
PANE_WIDTH,
|
|
30
61
|
appliedOnLoad,
|
|
31
62
|
applyOnLoad,
|
|
32
63
|
closePane,
|
|
@@ -39,7 +70,7 @@ import {
|
|
|
39
70
|
showPane,
|
|
40
71
|
stopOnLoad,
|
|
41
72
|
viewHead
|
|
42
|
-
} from "./react-
|
|
73
|
+
} from "./react-6t4dbdzn.js";
|
|
43
74
|
import {
|
|
44
75
|
actButton,
|
|
45
76
|
button,
|
|
@@ -68,58 +99,40 @@ import {
|
|
|
68
99
|
tabBar,
|
|
69
100
|
textField,
|
|
70
101
|
toolbar
|
|
71
|
-
} from "./react-
|
|
102
|
+
} from "./react-bxzn8vq5.js";
|
|
72
103
|
import {
|
|
73
|
-
BINDING_ICONS,
|
|
74
104
|
BODY_CAP,
|
|
75
105
|
HOST_RESET,
|
|
76
|
-
KEYS_FIELD,
|
|
77
106
|
LAYER,
|
|
78
107
|
LOCALE_PRESETS,
|
|
79
108
|
READ_MS,
|
|
80
|
-
ROW_ICONS,
|
|
81
109
|
SPEED_MAX,
|
|
82
110
|
SPEED_MIN,
|
|
83
111
|
TIME_ZONE_PRESETS,
|
|
84
112
|
canonicalTag,
|
|
85
113
|
canonicalZone,
|
|
86
|
-
comboLabel,
|
|
87
|
-
comboSpoken,
|
|
88
|
-
comboText,
|
|
89
|
-
defaultKeys,
|
|
90
114
|
devIconFor,
|
|
91
115
|
devIconShown,
|
|
92
|
-
escapeStep,
|
|
93
116
|
exports_engine,
|
|
94
117
|
foldRest,
|
|
95
|
-
forwardKeys,
|
|
96
118
|
frameWindow,
|
|
97
119
|
getState,
|
|
98
|
-
glyph,
|
|
99
|
-
highlightAt,
|
|
100
120
|
holdInTopLayer,
|
|
101
121
|
holdingHinge,
|
|
102
|
-
|
|
103
|
-
isFunctionKey,
|
|
104
|
-
isSearchKey,
|
|
122
|
+
hostSendsUa,
|
|
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 "./react-
|
|
147
|
+
} from "./react-cs62p9qh.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 "./react-ttj8f9qp.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 "./react-6q2cw2ya.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,34 +229,28 @@ 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
|
stamped,
|
|
208
245
|
still,
|
|
209
246
|
toHex,
|
|
210
|
-
uaPreset,
|
|
211
|
-
userAgentOf,
|
|
212
247
|
watchSystemMedia,
|
|
213
248
|
webStorage
|
|
214
|
-
} from "./react-
|
|
249
|
+
} from "./react-wqn4sx0n.js";
|
|
250
|
+
import"./react-fp73vhyd.js";
|
|
251
|
+
import {
|
|
252
|
+
__require
|
|
253
|
+
} from "./react-t2qnewz2.js";
|
|
215
254
|
|
|
216
255
|
// src/react.tsx
|
|
217
256
|
import { useEffect, useRef } from "react";
|
|
@@ -1455,7 +1494,8 @@ function knobs() {
|
|
|
1455
1494
|
open: field2("The panel is open.", flag2),
|
|
1456
1495
|
docked: field2("Pinned to its side as a column, with the page in a frame beside it.", flag2),
|
|
1457
1496
|
handle: field2("Show the knobs handle on the window's edge while the panel is closed. false keeps it out of screenshots for this tab.", flag2),
|
|
1458
|
-
devIcon: field2("The yellow DEV ribbon on the tab's icon and the apple-touch-icon. auto shows it on a local host only: localhost, *.localhost, *.local, 0.0.0.0, a loopback or private network address.", oneOf(DEV_ICONS))
|
|
1497
|
+
devIcon: field2("The yellow DEV ribbon on the tab's icon and the apple-touch-icon. auto shows it on a local host only: localhost, *.localhost, *.local, 0.0.0.0, a loopback or private network address.", oneOf(DEV_ICONS)),
|
|
1498
|
+
realPhone: field2("Real phone mode. true has a host that sends requests as another browser, the extension, send the device's user agent to servers for the frame's page loads, so a site serves its mobile site; some sites may sign you out. false sends none for a device in the frame. The extension saves a change made during a user gesture, such as a click (the panel's switch included), for every tab and site; a change a script makes without one stays in this tab.", flag2)
|
|
1459
1499
|
}
|
|
1460
1500
|
}, "frame")
|
|
1461
1501
|
};
|
|
@@ -1467,8 +1507,8 @@ function describe() {
|
|
|
1467
1507
|
}
|
|
1468
1508
|
function defaultOf(key) {
|
|
1469
1509
|
if (key === "panel") {
|
|
1470
|
-
const { open, docked, handle, devIcon } = DEFAULT_STATE.panel;
|
|
1471
|
-
return { open, docked, handle, devIcon };
|
|
1510
|
+
const { open, docked, handle, devIcon, realPhone } = DEFAULT_STATE.panel;
|
|
1511
|
+
return { open, docked, handle, devIcon, realPhone };
|
|
1472
1512
|
}
|
|
1473
1513
|
if (key === "clock") {
|
|
1474
1514
|
const { mode, at, speed, header } = DEFAULT_STATE.clock;
|
|
@@ -1705,6 +1745,8 @@ var BINDINGS = [
|
|
|
1705
1745
|
"replay",
|
|
1706
1746
|
"requests",
|
|
1707
1747
|
"storage",
|
|
1748
|
+
"elements",
|
|
1749
|
+
"settings",
|
|
1708
1750
|
"reset"
|
|
1709
1751
|
];
|
|
1710
1752
|
var BINDING_WORDS = {
|
|
@@ -1714,7 +1756,9 @@ var BINDING_WORDS = {
|
|
|
1714
1756
|
replay: "replay animations",
|
|
1715
1757
|
requests: "requests",
|
|
1716
1758
|
storage: "storage",
|
|
1717
|
-
reset: "reset"
|
|
1759
|
+
reset: "reset",
|
|
1760
|
+
elements: "elements",
|
|
1761
|
+
settings: "settings"
|
|
1718
1762
|
};
|
|
1719
1763
|
var RESERVED_LETTERS = new Set([..."cvxzawrtqlnfpshm"]);
|
|
1720
1764
|
var ZOOM_KEYS = new Set(["=", "-", "_", "0"]);
|
|
@@ -1744,8 +1788,6 @@ function clashText(combo) {
|
|
|
1744
1788
|
function comboProblem(combo, binding, others = {}) {
|
|
1745
1789
|
if (!keepable(combo.key))
|
|
1746
1790
|
return "use a letter, digit, symbol or F1 to F12";
|
|
1747
|
-
if (bare(combo) && !isFunctionKey(combo.key))
|
|
1748
|
-
return "add a modifier, alone it types";
|
|
1749
1791
|
if (isReserved(combo))
|
|
1750
1792
|
return "the browser uses it";
|
|
1751
1793
|
if (combo.key === "/" && !combo.meta && !combo.ctrl && !combo.alt)
|
|
@@ -1809,6 +1851,9 @@ function readKeys(json) {
|
|
|
1809
1851
|
} catch {
|
|
1810
1852
|
return {};
|
|
1811
1853
|
}
|
|
1854
|
+
return keysOf(value);
|
|
1855
|
+
}
|
|
1856
|
+
function keysOf(value) {
|
|
1812
1857
|
if (newer(value, KEYS_VERSION))
|
|
1813
1858
|
return {};
|
|
1814
1859
|
const stored = record(value);
|
|
@@ -1870,10 +1915,41 @@ function keepKeys(keys) {
|
|
|
1870
1915
|
webStorage("local")?.setItem(KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
|
|
1871
1916
|
} catch {}
|
|
1872
1917
|
}
|
|
1918
|
+
function keysListed(keys, listed) {
|
|
1919
|
+
const here = { ...keys };
|
|
1920
|
+
for (const binding of BINDINGS) {
|
|
1921
|
+
if (binding !== "panel" && !listed.includes(binding))
|
|
1922
|
+
here[binding] = null;
|
|
1923
|
+
}
|
|
1924
|
+
return here;
|
|
1925
|
+
}
|
|
1873
1926
|
function createKeys(options2 = {}) {
|
|
1874
1927
|
const base = defaultKeys(options2);
|
|
1875
1928
|
const grab = options2.grab !== false;
|
|
1876
|
-
|
|
1929
|
+
const store = options2.store ?? null;
|
|
1930
|
+
function load() {
|
|
1931
|
+
if (!store)
|
|
1932
|
+
return loadKeys();
|
|
1933
|
+
if (fresh())
|
|
1934
|
+
return {};
|
|
1935
|
+
try {
|
|
1936
|
+
return keysOf(store.load());
|
|
1937
|
+
} catch {
|
|
1938
|
+
return {};
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
function keep(keys2) {
|
|
1942
|
+
if (!store) {
|
|
1943
|
+
keepKeys(keys2);
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
if (fresh())
|
|
1947
|
+
return;
|
|
1948
|
+
try {
|
|
1949
|
+
store.save(stamped(keys2, KEYS_VERSION));
|
|
1950
|
+
} catch {}
|
|
1951
|
+
}
|
|
1952
|
+
let stored = load();
|
|
1877
1953
|
let keys = resolveKeys(base, stored, grab);
|
|
1878
1954
|
const listeners = new Set;
|
|
1879
1955
|
function changed() {
|
|
@@ -1884,12 +1960,16 @@ function createKeys(options2 = {}) {
|
|
|
1884
1960
|
function onStorage(event) {
|
|
1885
1961
|
if (event.key !== KEYS_KEY && event.key !== null)
|
|
1886
1962
|
return;
|
|
1963
|
+
heard();
|
|
1964
|
+
}
|
|
1965
|
+
function heard() {
|
|
1887
1966
|
if (fresh())
|
|
1888
1967
|
return;
|
|
1889
|
-
stored =
|
|
1968
|
+
stored = load();
|
|
1890
1969
|
changed();
|
|
1891
1970
|
}
|
|
1892
|
-
|
|
1971
|
+
const stopStore = store?.subscribe(heard) ?? null;
|
|
1972
|
+
if (!store && typeof window !== "undefined")
|
|
1893
1973
|
window.addEventListener("storage", onStorage);
|
|
1894
1974
|
return {
|
|
1895
1975
|
get: () => keys,
|
|
@@ -1904,7 +1984,7 @@ function createKeys(options2 = {}) {
|
|
|
1904
1984
|
else
|
|
1905
1985
|
next[binding] = comboText(combo);
|
|
1906
1986
|
stored = next;
|
|
1907
|
-
|
|
1987
|
+
keep(stored);
|
|
1908
1988
|
changed();
|
|
1909
1989
|
},
|
|
1910
1990
|
subscribe(listener) {
|
|
@@ -1916,6 +1996,7 @@ function createKeys(options2 = {}) {
|
|
|
1916
1996
|
recording: false,
|
|
1917
1997
|
destroy() {
|
|
1918
1998
|
listeners.clear();
|
|
1999
|
+
stopStore?.();
|
|
1919
2000
|
if (typeof window !== "undefined")
|
|
1920
2001
|
window.removeEventListener("storage", onStorage);
|
|
1921
2002
|
}
|
|
@@ -2278,122 +2359,6 @@ function createDockSlide(context) {
|
|
|
2278
2359
|
};
|
|
2279
2360
|
}
|
|
2280
2361
|
|
|
2281
|
-
// src/ui/place.ts
|
|
2282
|
-
var DRAG_SLOP = 4;
|
|
2283
|
-
var FLING_SPAN = 150;
|
|
2284
|
-
var FLING_STRETCH = 40;
|
|
2285
|
-
var FLING_LEAST = 8;
|
|
2286
|
-
var FLING = 0.5;
|
|
2287
|
-
var FLING_LEAN = 1.5;
|
|
2288
|
-
var FLING_TRAVEL = 16;
|
|
2289
|
-
var GLIDE = 220;
|
|
2290
|
-
var GLIDE_MAX = 440;
|
|
2291
|
-
var GLIDE_SPEED = 6;
|
|
2292
|
-
var PANEL_GAP = 8;
|
|
2293
|
-
var SNAP = 24;
|
|
2294
|
-
function dragTarget(shift, open) {
|
|
2295
|
-
return open && !shift ? "panel" : "handle";
|
|
2296
|
-
}
|
|
2297
|
-
function otherSide(side) {
|
|
2298
|
-
return side === "right" ? "left" : "right";
|
|
2299
|
-
}
|
|
2300
|
-
function between(value, min, max) {
|
|
2301
|
-
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
2302
|
-
}
|
|
2303
|
-
function snap(value, min, max) {
|
|
2304
|
-
const end = Math.max(min, max);
|
|
2305
|
-
const at = between(value, min, end);
|
|
2306
|
-
if (at - min <= SNAP && at - min <= end - at)
|
|
2307
|
-
return min;
|
|
2308
|
-
return end - at <= SNAP ? end : at;
|
|
2309
|
-
}
|
|
2310
|
-
function edgeOf(value, min, max, had) {
|
|
2311
|
-
const top = Math.abs(value - min) < 0.5;
|
|
2312
|
-
const bottom = Math.abs(value - max) < 0.5;
|
|
2313
|
-
if (top && bottom)
|
|
2314
|
-
return had === "none" ? "top" : had;
|
|
2315
|
-
return top ? "top" : bottom ? "bottom" : "none";
|
|
2316
|
-
}
|
|
2317
|
-
function settle(place, room, anchor = "edge") {
|
|
2318
|
-
const last = room.view - PANEL_GAP - room.panel;
|
|
2319
|
-
const pull = anchor === "top" ? between : snap;
|
|
2320
|
-
const top = pull(anchor === "top" || place.edge === "none" ? place.top : place.edge === "top" ? PANEL_GAP : last, PANEL_GAP, last);
|
|
2321
|
-
const low = top + room.panel - room.handle;
|
|
2322
|
-
const y = pull(place.tab === "top" ? top : place.tab === "bottom" ? low : place.y, top, low);
|
|
2323
|
-
return {
|
|
2324
|
-
y,
|
|
2325
|
-
top,
|
|
2326
|
-
edge: edgeOf(top, PANEL_GAP, last, place.edge),
|
|
2327
|
-
tab: edgeOf(y, top, low, place.tab)
|
|
2328
|
-
};
|
|
2329
|
-
}
|
|
2330
|
-
function cornerAt(y, top, room) {
|
|
2331
|
-
return edgeOf(y, top, top + room.panel - room.handle, "none");
|
|
2332
|
-
}
|
|
2333
|
-
function dragTo(target, open, to, from, room) {
|
|
2334
|
-
const offset = from.y - from.top;
|
|
2335
|
-
if (target === "panel") {
|
|
2336
|
-
const top = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.panel);
|
|
2337
|
-
return settle({ y: top + offset, top, edge: "none", tab: "none" }, room);
|
|
2338
|
-
}
|
|
2339
|
-
if (open)
|
|
2340
|
-
return settle({ ...from, y: to, tab: "none" }, room);
|
|
2341
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2342
|
-
return settle({ y, top: y - offset, edge: "none", tab: "none" }, room);
|
|
2343
|
-
}
|
|
2344
|
-
function dragDocked(to, from, room) {
|
|
2345
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2346
|
-
return { y, top: y - (from.y - from.top), edge: "none", tab: from.tab };
|
|
2347
|
-
}
|
|
2348
|
-
function dockedHandle(y, room) {
|
|
2349
|
-
return between(y, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2350
|
-
}
|
|
2351
|
-
function speedOf(from, to) {
|
|
2352
|
-
const time = to.t - from.t;
|
|
2353
|
-
return { x: (to.x - from.x) / time, y: (to.y - from.y) / time };
|
|
2354
|
-
}
|
|
2355
|
-
function velocity(samples, at) {
|
|
2356
|
-
const recent = samples.filter((sample) => sample.t >= at - FLING_SPAN && sample.t <= at);
|
|
2357
|
-
let fastest = { x: 0, y: 0 };
|
|
2358
|
-
let read = false;
|
|
2359
|
-
for (const [index, end] of recent.entries()) {
|
|
2360
|
-
let start2;
|
|
2361
|
-
for (const sample of recent.slice(0, index)) {
|
|
2362
|
-
if (end.t - sample.t >= FLING_STRETCH)
|
|
2363
|
-
start2 = sample;
|
|
2364
|
-
}
|
|
2365
|
-
if (!start2)
|
|
2366
|
-
continue;
|
|
2367
|
-
const speed = speedOf(start2, end);
|
|
2368
|
-
if (!read || Math.hypot(speed.x, speed.y) > Math.hypot(fastest.x, fastest.y))
|
|
2369
|
-
fastest = speed;
|
|
2370
|
-
read = true;
|
|
2371
|
-
}
|
|
2372
|
-
const first = recent[0];
|
|
2373
|
-
const last = recent[recent.length - 1];
|
|
2374
|
-
if (!read && first && last && last.t - first.t >= FLING_LEAST)
|
|
2375
|
-
return speedOf(first, last);
|
|
2376
|
-
return fastest;
|
|
2377
|
-
}
|
|
2378
|
-
function glideTime(distance) {
|
|
2379
|
-
return between(distance / GLIDE_SPEED, GLIDE, GLIDE_MAX);
|
|
2380
|
-
}
|
|
2381
|
-
function landSide(side, x, width, vx, vy) {
|
|
2382
|
-
const other = otherSide(side);
|
|
2383
|
-
const toward = side === "right" ? -vx : vx;
|
|
2384
|
-
const across = Math.abs(vx) >= FLING && Math.abs(vx) > FLING_LEAN * Math.abs(vy);
|
|
2385
|
-
const past = side === "right" ? x < width / 2 : x > width / 2;
|
|
2386
|
-
if (across && toward > 0)
|
|
2387
|
-
return other;
|
|
2388
|
-
if (across && toward < 0)
|
|
2389
|
-
return side;
|
|
2390
|
-
return past ? other : side;
|
|
2391
|
-
}
|
|
2392
|
-
function translateOf(value) {
|
|
2393
|
-
const [x = 0, y = 0] = value === "none" ? [] : value.split(" ").map((part) => parseFloat(part));
|
|
2394
|
-
return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
|
|
2395
|
-
}
|
|
2396
|
-
|
|
2397
2362
|
// src/ui/drag.ts
|
|
2398
2363
|
function createDrag(context) {
|
|
2399
2364
|
const { host, wrap, handle, panel } = context;
|
|
@@ -2672,7 +2637,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2672
2637
|
function here(element) {
|
|
2673
2638
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2674
2639
|
}
|
|
2675
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2640
|
+
function createInspector(context, load = () => import("./elementsview-fyc06wjt.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2676
2641
|
const { inspect, tips, prefs } = context;
|
|
2677
2642
|
const listeners = new Set;
|
|
2678
2643
|
let view = null;
|
|
@@ -2690,6 +2655,14 @@ function createInspector(context, load = () => import("./elementsview-qn8qyksa.j
|
|
|
2690
2655
|
function current() {
|
|
2691
2656
|
return held && here(held) ? held : null;
|
|
2692
2657
|
}
|
|
2658
|
+
function pageBody() {
|
|
2659
|
+
try {
|
|
2660
|
+
const page = framed ? frameWindow()?.document : typeof document === "undefined" ? undefined : document;
|
|
2661
|
+
return page?.body ?? null;
|
|
2662
|
+
} catch {
|
|
2663
|
+
return null;
|
|
2664
|
+
}
|
|
2665
|
+
}
|
|
2693
2666
|
function point(element) {
|
|
2694
2667
|
if (element && inspect.isOn())
|
|
2695
2668
|
return;
|
|
@@ -2725,7 +2698,9 @@ function createInspector(context, load = () => import("./elementsview-qn8qyksa.j
|
|
|
2725
2698
|
},
|
|
2726
2699
|
...prefs && {
|
|
2727
2700
|
mode: { get: () => prefs.get().stylesMode, set: prefs.setStylesMode },
|
|
2728
|
-
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox }
|
|
2701
|
+
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox },
|
|
2702
|
+
diff: { get: () => prefs.get().changesDiff, set: prefs.setChangesDiff },
|
|
2703
|
+
htmlSize: { get: () => ({ height: prefs.get().htmlHeight, full: prefs.get().htmlFull }), set: prefs.setHtmlSize }
|
|
2729
2704
|
}
|
|
2730
2705
|
});
|
|
2731
2706
|
view = made;
|
|
@@ -2809,6 +2784,18 @@ function createInspector(context, load = () => import("./elementsview-qn8qyksa.j
|
|
|
2809
2784
|
else
|
|
2810
2785
|
inspect.set(true);
|
|
2811
2786
|
},
|
|
2787
|
+
elements() {
|
|
2788
|
+
if (inspect.isOn())
|
|
2789
|
+
inspect.set(false);
|
|
2790
|
+
if (!current()) {
|
|
2791
|
+
const body = pageBody();
|
|
2792
|
+
if (view)
|
|
2793
|
+
view.show(body);
|
|
2794
|
+
else
|
|
2795
|
+
hold(body);
|
|
2796
|
+
}
|
|
2797
|
+
reveal2();
|
|
2798
|
+
},
|
|
2812
2799
|
picked() {
|
|
2813
2800
|
const element = current();
|
|
2814
2801
|
return element ? label(element) : null;
|
|
@@ -4077,296 +4064,6 @@ function createPalette(context) {
|
|
|
4077
4064
|
};
|
|
4078
4065
|
}
|
|
4079
4066
|
|
|
4080
|
-
// src/ui/size.ts
|
|
4081
|
-
var LIST_WIDTH = 240;
|
|
4082
|
-
var VIEW_WIDTH = PANE_WIDTH;
|
|
4083
|
-
var LIST_MIN = 240;
|
|
4084
|
-
var VIEW_MIN = 280;
|
|
4085
|
-
var WIDTH_MAX = 720;
|
|
4086
|
-
var PAGE_ROOM = 96;
|
|
4087
|
-
function pageRoom(docked) {
|
|
4088
|
-
return docked ? PAGE_MIN : PAGE_ROOM;
|
|
4089
|
-
}
|
|
4090
|
-
var WIDTH_STEP = 16;
|
|
4091
|
-
var HANDLE_REACH = 21;
|
|
4092
|
-
function widthLimits(showing, view, page = PAGE_ROOM) {
|
|
4093
|
-
const min = showing === "view" ? VIEW_MIN : LIST_MIN;
|
|
4094
|
-
return { min, max: Math.max(min, Math.min(WIDTH_MAX, view - page)) };
|
|
4095
|
-
}
|
|
4096
|
-
function widthIn(showing, wanted, view, page = PAGE_ROOM) {
|
|
4097
|
-
const { min, max } = widthLimits(showing, view, page);
|
|
4098
|
-
const room = view - HANDLE_REACH - PANEL_GAP;
|
|
4099
|
-
return Math.max(LIST_MIN, Math.min(Math.round(between(wanted, min, max)), room));
|
|
4100
|
-
}
|
|
4101
|
-
function dragWidth(from, travel, side) {
|
|
4102
|
-
return from + (side === "right" ? -travel : travel);
|
|
4103
|
-
}
|
|
4104
|
-
function keyWidth(key, width, limits, side) {
|
|
4105
|
-
if (key === "Home")
|
|
4106
|
-
return limits.min;
|
|
4107
|
-
if (key === "End")
|
|
4108
|
-
return limits.max;
|
|
4109
|
-
if (key !== "ArrowLeft" && key !== "ArrowRight")
|
|
4110
|
-
return null;
|
|
4111
|
-
const wider = key === "ArrowLeft" === (side === "right");
|
|
4112
|
-
return between(width + (wider ? WIDTH_STEP : -WIDTH_STEP), limits.min, limits.max);
|
|
4113
|
-
}
|
|
4114
|
-
function widthGlides(cue) {
|
|
4115
|
-
return !cue.first && !cue.dragging && !cue.resizing;
|
|
4116
|
-
}
|
|
4117
|
-
function createSizer(context) {
|
|
4118
|
-
const { host, wrap, panel, prefs } = context;
|
|
4119
|
-
const strip = document.createElement("div");
|
|
4120
|
-
strip.className = "sizer";
|
|
4121
|
-
strip.tabIndex = 0;
|
|
4122
|
-
strip.setAttribute("role", "separator");
|
|
4123
|
-
strip.setAttribute("aria-orientation", "vertical");
|
|
4124
|
-
strip.setAttribute("aria-label", "panel width");
|
|
4125
|
-
let shown2 = null;
|
|
4126
|
-
let held = null;
|
|
4127
|
-
function viewWidth() {
|
|
4128
|
-
return document.documentElement.clientWidth || window.innerWidth;
|
|
4129
|
-
}
|
|
4130
|
-
function put(width) {
|
|
4131
|
-
wrap.style.setProperty("--panel-width", `${width}px`);
|
|
4132
|
-
}
|
|
4133
|
-
function apply(draw, resizing) {
|
|
4134
|
-
const showing = context.showing();
|
|
4135
|
-
const view = viewWidth();
|
|
4136
|
-
const kept = showing === "view" ? prefs.get().viewWidth : prefs.get().listWidth;
|
|
4137
|
-
const page = pageRoom(context.place().docked);
|
|
4138
|
-
const next = widthIn(showing, held?.showing === showing ? held.width : kept, view, page);
|
|
4139
|
-
const from = shown2;
|
|
4140
|
-
const limits = widthLimits(showing, view, page);
|
|
4141
|
-
strip.setAttribute("aria-valuemin", String(limits.min));
|
|
4142
|
-
strip.setAttribute("aria-valuemax", String(limits.max));
|
|
4143
|
-
if (next === from || from !== null && !context.place().open) {
|
|
4144
|
-
draw?.();
|
|
4145
|
-
return;
|
|
4146
|
-
}
|
|
4147
|
-
strip.setAttribute("aria-valuenow", String(next));
|
|
4148
|
-
const glide = widthGlides({ first: from === null, dragging: held !== null, resizing });
|
|
4149
|
-
shown2 = next;
|
|
4150
|
-
context.wide(next);
|
|
4151
|
-
host.style.width = `${HANDLE_REACH + next}px`;
|
|
4152
|
-
panel.style.transitionProperty = "none";
|
|
4153
|
-
put(next);
|
|
4154
|
-
draw?.();
|
|
4155
|
-
if (glide && from !== null)
|
|
4156
|
-
put(from);
|
|
4157
|
-
panel.getBoundingClientRect();
|
|
4158
|
-
panel.style.transitionProperty = "";
|
|
4159
|
-
put(next);
|
|
4160
|
-
if (from !== null)
|
|
4161
|
-
context.sized(glide);
|
|
4162
|
-
}
|
|
4163
|
-
function end(keep) {
|
|
4164
|
-
if (!held)
|
|
4165
|
-
return;
|
|
4166
|
-
const { showing, pointer, width, moved } = held;
|
|
4167
|
-
held = null;
|
|
4168
|
-
delete wrap.dataset.sizing;
|
|
4169
|
-
if (strip.hasPointerCapture(pointer))
|
|
4170
|
-
strip.releasePointerCapture(pointer);
|
|
4171
|
-
if (keep && moved)
|
|
4172
|
-
prefs.setWidth(showing, width);
|
|
4173
|
-
else
|
|
4174
|
-
apply(undefined, false);
|
|
4175
|
-
}
|
|
4176
|
-
strip.addEventListener("pointerdown", (event) => {
|
|
4177
|
-
if (event.button !== 0 || held || shown2 === null)
|
|
4178
|
-
return;
|
|
4179
|
-
held = {
|
|
4180
|
-
showing: context.showing(),
|
|
4181
|
-
pointer: event.pointerId,
|
|
4182
|
-
from: shown2,
|
|
4183
|
-
x: event.clientX,
|
|
4184
|
-
width: shown2,
|
|
4185
|
-
moved: false
|
|
4186
|
-
};
|
|
4187
|
-
wrap.dataset.sizing = "true";
|
|
4188
|
-
strip.setPointerCapture(event.pointerId);
|
|
4189
|
-
});
|
|
4190
|
-
strip.addEventListener("pointermove", (event) => {
|
|
4191
|
-
if (!held || event.pointerId !== held.pointer)
|
|
4192
|
-
return;
|
|
4193
|
-
const { side, docked } = context.place();
|
|
4194
|
-
const wanted = dragWidth(held.from, event.clientX - held.x, side);
|
|
4195
|
-
const width = widthIn(held.showing, wanted, viewWidth(), pageRoom(docked));
|
|
4196
|
-
if (width === held.width)
|
|
4197
|
-
return;
|
|
4198
|
-
held.width = width;
|
|
4199
|
-
held.moved = true;
|
|
4200
|
-
apply(undefined, false);
|
|
4201
|
-
});
|
|
4202
|
-
strip.addEventListener("pointerup", (event) => {
|
|
4203
|
-
if (event.pointerId === held?.pointer)
|
|
4204
|
-
end(true);
|
|
4205
|
-
});
|
|
4206
|
-
strip.addEventListener("pointercancel", (event) => {
|
|
4207
|
-
if (event.pointerId === held?.pointer)
|
|
4208
|
-
end(false);
|
|
4209
|
-
});
|
|
4210
|
-
strip.addEventListener("lostpointercapture", (event) => {
|
|
4211
|
-
if (event.pointerId === held?.pointer)
|
|
4212
|
-
end(false);
|
|
4213
|
-
});
|
|
4214
|
-
strip.addEventListener("dblclick", () => {
|
|
4215
|
-
const showing = context.showing();
|
|
4216
|
-
prefs.setWidth(showing, showing === "view" ? VIEW_WIDTH : LIST_WIDTH);
|
|
4217
|
-
});
|
|
4218
|
-
strip.addEventListener("keydown", (event) => {
|
|
4219
|
-
if (shown2 === null || event.altKey || event.ctrlKey || event.metaKey)
|
|
4220
|
-
return;
|
|
4221
|
-
const showing = context.showing();
|
|
4222
|
-
const { side, docked } = context.place();
|
|
4223
|
-
const limits = widthLimits(showing, viewWidth(), pageRoom(docked));
|
|
4224
|
-
const next = keyWidth(event.key, shown2, limits, side);
|
|
4225
|
-
if (next === null)
|
|
4226
|
-
return;
|
|
4227
|
-
event.preventDefault();
|
|
4228
|
-
prefs.setWidth(showing, next);
|
|
4229
|
-
});
|
|
4230
|
-
return {
|
|
4231
|
-
strip,
|
|
4232
|
-
size: (draw) => apply(draw, false),
|
|
4233
|
-
fit: () => apply(undefined, true),
|
|
4234
|
-
cancel: () => end(false)
|
|
4235
|
-
};
|
|
4236
|
-
}
|
|
4237
|
-
|
|
4238
|
-
// src/ui/prefs.ts
|
|
4239
|
-
var PREFS_KEY = "devknobs:prefs";
|
|
4240
|
-
var PREFS_VERSION = 4;
|
|
4241
|
-
var STYLES_MODE = "simple";
|
|
4242
|
-
var STYLES_BOX = true;
|
|
4243
|
-
var WIDTH_OF = { list: "listWidth", view: "viewWidth" };
|
|
4244
|
-
function readPrefs(json) {
|
|
4245
|
-
let value = null;
|
|
4246
|
-
try {
|
|
4247
|
-
value = json ? JSON.parse(json) : null;
|
|
4248
|
-
} catch {
|
|
4249
|
-
return {};
|
|
4250
|
-
}
|
|
4251
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
4252
|
-
return {};
|
|
4253
|
-
if (newer(value, PREFS_VERSION))
|
|
4254
|
-
return {};
|
|
4255
|
-
const prefs = {};
|
|
4256
|
-
const handle = Reflect.get(value, "handle");
|
|
4257
|
-
if (typeof handle === "boolean")
|
|
4258
|
-
prefs.handle = handle;
|
|
4259
|
-
for (const key of [WIDTH_OF.list, WIDTH_OF.view]) {
|
|
4260
|
-
const width = Reflect.get(value, key);
|
|
4261
|
-
if (typeof width === "number" && Number.isFinite(width) && width > 0)
|
|
4262
|
-
prefs[key] = width;
|
|
4263
|
-
}
|
|
4264
|
-
const mode = Reflect.get(value, "stylesMode");
|
|
4265
|
-
if (mode === "simple" || mode === "advanced")
|
|
4266
|
-
prefs.stylesMode = mode;
|
|
4267
|
-
const box = Reflect.get(value, "stylesBox");
|
|
4268
|
-
if (typeof box === "boolean")
|
|
4269
|
-
prefs.stylesBox = box;
|
|
4270
|
-
return prefs;
|
|
4271
|
-
}
|
|
4272
|
-
function resolvePrefs(base, stored) {
|
|
4273
|
-
return { ...base, ...stored };
|
|
4274
|
-
}
|
|
4275
|
-
function loadPrefs() {
|
|
4276
|
-
try {
|
|
4277
|
-
return readPrefs(webStorage("local")?.getItem(PREFS_KEY));
|
|
4278
|
-
} catch {
|
|
4279
|
-
return {};
|
|
4280
|
-
}
|
|
4281
|
-
}
|
|
4282
|
-
function keepPrefs(prefs) {
|
|
4283
|
-
try {
|
|
4284
|
-
if (Object.keys(prefs).length === 0)
|
|
4285
|
-
webStorage("local")?.removeItem(PREFS_KEY);
|
|
4286
|
-
else
|
|
4287
|
-
webStorage("local")?.setItem(PREFS_KEY, JSON.stringify(stamped(prefs, PREFS_VERSION)));
|
|
4288
|
-
} catch {}
|
|
4289
|
-
}
|
|
4290
|
-
function createPrefs(options2 = {}) {
|
|
4291
|
-
const base = {
|
|
4292
|
-
handle: options2.handle !== false,
|
|
4293
|
-
listWidth: LIST_WIDTH,
|
|
4294
|
-
viewWidth: VIEW_WIDTH,
|
|
4295
|
-
stylesMode: STYLES_MODE,
|
|
4296
|
-
stylesBox: STYLES_BOX
|
|
4297
|
-
};
|
|
4298
|
-
let stored = loadPrefs();
|
|
4299
|
-
let prefs = resolvePrefs(base, stored);
|
|
4300
|
-
const listeners = new Set;
|
|
4301
|
-
function changed() {
|
|
4302
|
-
prefs = resolvePrefs(base, stored);
|
|
4303
|
-
for (const listener of Array.from(listeners))
|
|
4304
|
-
listener();
|
|
4305
|
-
}
|
|
4306
|
-
function keep(next) {
|
|
4307
|
-
stored = next;
|
|
4308
|
-
keepPrefs(stored);
|
|
4309
|
-
changed();
|
|
4310
|
-
}
|
|
4311
|
-
function onStorage(event) {
|
|
4312
|
-
if (event.key !== PREFS_KEY && event.key !== null)
|
|
4313
|
-
return;
|
|
4314
|
-
if (fresh())
|
|
4315
|
-
return;
|
|
4316
|
-
stored = loadPrefs();
|
|
4317
|
-
changed();
|
|
4318
|
-
}
|
|
4319
|
-
if (typeof window !== "undefined")
|
|
4320
|
-
window.addEventListener("storage", onStorage);
|
|
4321
|
-
return {
|
|
4322
|
-
get: () => prefs,
|
|
4323
|
-
setHandle(on) {
|
|
4324
|
-
const next = { ...stored };
|
|
4325
|
-
if (on === base.handle)
|
|
4326
|
-
delete next.handle;
|
|
4327
|
-
else
|
|
4328
|
-
next.handle = on;
|
|
4329
|
-
keep(next);
|
|
4330
|
-
},
|
|
4331
|
-
setWidth(showing, px) {
|
|
4332
|
-
const key = WIDTH_OF[showing];
|
|
4333
|
-
const next = { ...stored };
|
|
4334
|
-
if (px === base[key])
|
|
4335
|
-
delete next[key];
|
|
4336
|
-
else
|
|
4337
|
-
next[key] = px;
|
|
4338
|
-
keep(next);
|
|
4339
|
-
},
|
|
4340
|
-
setStylesMode(mode) {
|
|
4341
|
-
const next = { ...stored };
|
|
4342
|
-
if (mode === base.stylesMode)
|
|
4343
|
-
delete next.stylesMode;
|
|
4344
|
-
else
|
|
4345
|
-
next.stylesMode = mode;
|
|
4346
|
-
keep(next);
|
|
4347
|
-
},
|
|
4348
|
-
setStylesBox(open) {
|
|
4349
|
-
const next = { ...stored };
|
|
4350
|
-
if (open === base.stylesBox)
|
|
4351
|
-
delete next.stylesBox;
|
|
4352
|
-
else
|
|
4353
|
-
next.stylesBox = open;
|
|
4354
|
-
keep(next);
|
|
4355
|
-
},
|
|
4356
|
-
subscribe(listener) {
|
|
4357
|
-
listeners.add(listener);
|
|
4358
|
-
return () => {
|
|
4359
|
-
listeners.delete(listener);
|
|
4360
|
-
};
|
|
4361
|
-
},
|
|
4362
|
-
destroy() {
|
|
4363
|
-
listeners.clear();
|
|
4364
|
-
if (typeof window !== "undefined")
|
|
4365
|
-
window.removeEventListener("storage", onStorage);
|
|
4366
|
-
}
|
|
4367
|
-
};
|
|
4368
|
-
}
|
|
4369
|
-
|
|
4370
4067
|
// src/ui/requestformat.ts
|
|
4371
4068
|
var LIGHT_WHY = "the browser gives a page only timing and size for this";
|
|
4372
4069
|
var HIDDEN = "<hidden>";
|
|
@@ -6635,6 +6332,7 @@ var HANDLE_HINT = 4000;
|
|
|
6635
6332
|
function handleHint(keys, mac) {
|
|
6636
6333
|
return `press ${comboLabel(keys.panel, mac)} to open knobs`;
|
|
6637
6334
|
}
|
|
6335
|
+
var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
|
|
6638
6336
|
function createSettings(context) {
|
|
6639
6337
|
const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
|
|
6640
6338
|
const keysView = el("div", "keys pane");
|
|
@@ -6701,6 +6399,23 @@ function createSettings(context) {
|
|
|
6701
6399
|
row.append(hint);
|
|
6702
6400
|
keysView.append(row);
|
|
6703
6401
|
}
|
|
6402
|
+
const realPhoneSwitch = button("switch row-control", "");
|
|
6403
|
+
if (context.realPhone) {
|
|
6404
|
+
realPhoneSwitch.setAttribute("role", "switch");
|
|
6405
|
+
realPhoneSwitch.setAttribute("aria-label", "real phone mode");
|
|
6406
|
+
const hint = el("div", "row-hint", REAL_PHONE_HINT);
|
|
6407
|
+
hint.id = "devknobs-real-phone-hint";
|
|
6408
|
+
realPhoneSwitch.setAttribute("aria-describedby", hint.id);
|
|
6409
|
+
const row = rowBox({
|
|
6410
|
+
main: el("div", "main"),
|
|
6411
|
+
glyph: icon("smartphone"),
|
|
6412
|
+
title: "real phone mode",
|
|
6413
|
+
ends: [realPhoneSwitch]
|
|
6414
|
+
}).box;
|
|
6415
|
+
row.append(hint);
|
|
6416
|
+
keysView.append(row);
|
|
6417
|
+
realPhoneSwitch.addEventListener("click", () => context.setRealPhone(realPhoneSwitch.getAttribute("aria-checked") !== "true"));
|
|
6418
|
+
}
|
|
6704
6419
|
const devIconSwitch = button("switch row-control", "");
|
|
6705
6420
|
devIconSwitch.setAttribute("role", "switch");
|
|
6706
6421
|
devIconSwitch.setAttribute("aria-label", "dev tab icon");
|
|
@@ -6845,6 +6560,9 @@ function createSettings(context) {
|
|
|
6845
6560
|
drawDevIcon(shown2) {
|
|
6846
6561
|
mark(devIconSwitch, shown2, "aria-checked");
|
|
6847
6562
|
},
|
|
6563
|
+
drawRealPhone(on) {
|
|
6564
|
+
mark(realPhoneSwitch, on, "aria-checked");
|
|
6565
|
+
},
|
|
6848
6566
|
drawNative(on, note) {
|
|
6849
6567
|
mark(nativeSwitch2, on, "aria-checked");
|
|
6850
6568
|
const hint = note ?? native?.hint ?? "";
|
|
@@ -6865,6 +6583,7 @@ function createSettings(context) {
|
|
|
6865
6583
|
return true;
|
|
6866
6584
|
},
|
|
6867
6585
|
stopRecording,
|
|
6586
|
+
openKeys,
|
|
6868
6587
|
leaveKeys,
|
|
6869
6588
|
destroy: stopRefusing
|
|
6870
6589
|
};
|
|
@@ -6914,7 +6633,7 @@ var CSS = `
|
|
|
6914
6633
|
--edge: 0px;
|
|
6915
6634
|
--edge-line: transparent;
|
|
6916
6635
|
--glide: 220ms;
|
|
6917
|
-
--panel-width:
|
|
6636
|
+
--panel-width: 320px;
|
|
6918
6637
|
/* The columns: what a row keeps clear inside its edges, an icon's width,
|
|
6919
6638
|
the room between an icon and its word, and how far in a line of words
|
|
6920
6639
|
starts and ends. */
|
|
@@ -7021,6 +6740,7 @@ button {
|
|
|
7021
6740
|
}
|
|
7022
6741
|
:focus { outline: none; }
|
|
7023
6742
|
button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
6743
|
+
input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-offset: 1px; }
|
|
7024
6744
|
|
|
7025
6745
|
.handle {
|
|
7026
6746
|
flex: none;
|
|
@@ -7108,7 +6828,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
7108
6828
|
would stay on the window's edge as a line the panel's height. It hides
|
|
7109
6829
|
once the slide is over. The edge side's border and the padding that pays
|
|
7110
6830
|
for it go once its color has eased out. The width glides to a new one, as
|
|
7111
|
-
|
|
6831
|
+
the strip's keys set it, and the panel turns that off under the strip. */
|
|
7112
6832
|
visibility: hidden;
|
|
7113
6833
|
transition: visibility 0s linear 150ms, border-top-right-radius var(--glide) ease-out,
|
|
7114
6834
|
border-bottom-right-radius var(--glide) ease-out, border-right-color var(--glide) ease-out,
|
|
@@ -8272,6 +7992,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8272
7992
|
user-select: text;
|
|
8273
7993
|
-webkit-user-select: text;
|
|
8274
7994
|
}
|
|
7995
|
+
.dom-row { position: relative; }
|
|
8275
7996
|
.dom-row:hover { background: var(--card); }
|
|
8276
7997
|
.dom-row.on { background: var(--card); }
|
|
8277
7998
|
.dom-tree:focus-within .dom-row.on { background: var(--pick); }
|
|
@@ -8279,6 +8000,110 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8279
8000
|
.dom-code { flex: 0 1 auto; min-width: 30ch; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
|
|
8280
8001
|
.dom-ref { white-space: pre; color: var(--faint); }
|
|
8281
8002
|
.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; }
|
|
8003
|
+
/* A line whose element the panel hid, faint as its box on the page is gone. */
|
|
8004
|
+
.dom-hid > .dom-code { opacity: 0.5; }
|
|
8005
|
+
/* The html editor: line numbers on the card's fill beside the text, which is
|
|
8006
|
+
colored by the pre under a clear text box, the two set alike to the
|
|
8007
|
+
pixel, a scrollbar's room kept in both, so a long line wraps at the same
|
|
8008
|
+
place in each and its number stays at its first row. The grip under it
|
|
8009
|
+
drags its height, the button makes it the panel's. */
|
|
8010
|
+
.dom-code:has(> .html-ed), .dom-code:has(> .dom-edit) { flex: 1 1 auto; }
|
|
8011
|
+
.dom-code > .html-ed { display: block; width: 100%; min-width: 30ch; margin: 2px 0; }
|
|
8012
|
+
.html-ed-body {
|
|
8013
|
+
overflow: hidden;
|
|
8014
|
+
background: var(--bg);
|
|
8015
|
+
border-radius: 4px;
|
|
8016
|
+
box-shadow: inset 0 0 0 1px var(--faint);
|
|
8017
|
+
}
|
|
8018
|
+
.html-ed-code {
|
|
8019
|
+
position: relative;
|
|
8020
|
+
height: 100%;
|
|
8021
|
+
overflow: hidden;
|
|
8022
|
+
background: linear-gradient(var(--card), var(--card)) no-repeat;
|
|
8023
|
+
}
|
|
8024
|
+
.html-ed-hl, .html-ed .dom-html {
|
|
8025
|
+
position: absolute;
|
|
8026
|
+
inset: 0;
|
|
8027
|
+
margin: 0;
|
|
8028
|
+
padding: 4px var(--col-pad);
|
|
8029
|
+
font: 11px/1.6 var(--mono);
|
|
8030
|
+
letter-spacing: normal;
|
|
8031
|
+
white-space: pre-wrap;
|
|
8032
|
+
tab-size: 2;
|
|
8033
|
+
overflow-wrap: anywhere;
|
|
8034
|
+
word-break: normal;
|
|
8035
|
+
scrollbar-gutter: stable;
|
|
8036
|
+
scrollbar-width: thin;
|
|
8037
|
+
}
|
|
8038
|
+
.html-ed-hl { padding-left: 0; overflow: hidden; color: var(--fg); pointer-events: none; }
|
|
8039
|
+
.html-ed-hl > .html-ed-inner { display: grid; }
|
|
8040
|
+
.html-ed-num {
|
|
8041
|
+
padding: 0 var(--col-pad);
|
|
8042
|
+
color: var(--faint);
|
|
8043
|
+
text-align: right;
|
|
8044
|
+
user-select: none;
|
|
8045
|
+
-webkit-user-select: none;
|
|
8046
|
+
}
|
|
8047
|
+
.html-ed-text { min-height: 1.6em; padding-left: var(--col-pad); }
|
|
8048
|
+
.html-ed .dom-html {
|
|
8049
|
+
width: 100%;
|
|
8050
|
+
height: 100%;
|
|
8051
|
+
max-height: none;
|
|
8052
|
+
overflow: auto;
|
|
8053
|
+
resize: none;
|
|
8054
|
+
color: transparent;
|
|
8055
|
+
caret-color: var(--fg);
|
|
8056
|
+
background: transparent;
|
|
8057
|
+
border-radius: 0;
|
|
8058
|
+
box-shadow: none;
|
|
8059
|
+
scrollbar-width: thin;
|
|
8060
|
+
}
|
|
8061
|
+
.html-ed .dom-html::selection { background: color-mix(in srgb, var(--faint) 35%, transparent); }
|
|
8062
|
+
.html-ed .dom-html.bad { caret-color: var(--hot); }
|
|
8063
|
+
.html-ed:has(.bad) > .html-ed-body { box-shadow: inset 0 0 0 1px var(--hot); }
|
|
8064
|
+
.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; }
|
|
8065
|
+
.html-ed-grip { flex: 1 1 auto; display: grid; place-items: center; height: 12px; cursor: ns-resize; touch-action: none; }
|
|
8066
|
+
.html-ed-grip::after { content: ""; width: 32px; height: 3px; background: var(--line); border-radius: 2px; transition: background 120ms ease-out; }
|
|
8067
|
+
.html-ed-grip:hover::after { background: var(--faint); }
|
|
8068
|
+
.dom-code > .dom-apply { margin: 4px 0 2px; }
|
|
8069
|
+
/* The selected line's actions, kept in sight at the foot of the tree as it scrolls either way. */
|
|
8070
|
+
.dom-acts {
|
|
8071
|
+
position: sticky;
|
|
8072
|
+
left: 0;
|
|
8073
|
+
bottom: 0;
|
|
8074
|
+
display: flex;
|
|
8075
|
+
flex-wrap: wrap;
|
|
8076
|
+
gap: 4px;
|
|
8077
|
+
padding: 4px var(--view-end) 4px var(--view-start);
|
|
8078
|
+
background: var(--bg);
|
|
8079
|
+
border-top: 1px solid var(--line);
|
|
8080
|
+
}
|
|
8081
|
+
/* The handle that drags an element's line, at the start of its step in: on
|
|
8082
|
+
hover and on the selected line, and always under a finger. The line being
|
|
8083
|
+
dragged is faint; where it would go is a line over or under another, or
|
|
8084
|
+
a ring around the element it would go into. */
|
|
8085
|
+
.dom-grip {
|
|
8086
|
+
position: absolute;
|
|
8087
|
+
top: 0;
|
|
8088
|
+
width: 1.2em;
|
|
8089
|
+
line-height: 1.6;
|
|
8090
|
+
text-align: center;
|
|
8091
|
+
color: var(--faint);
|
|
8092
|
+
cursor: grab;
|
|
8093
|
+
opacity: 0;
|
|
8094
|
+
touch-action: none;
|
|
8095
|
+
user-select: none;
|
|
8096
|
+
-webkit-user-select: none;
|
|
8097
|
+
transition: opacity 120ms ease-out;
|
|
8098
|
+
}
|
|
8099
|
+
.dom-row:hover > .dom-grip, .dom-row.on > .dom-grip { opacity: 1; }
|
|
8100
|
+
@media (hover: none) { .dom-grip { opacity: 0.6; } }
|
|
8101
|
+
.dom-grip:hover { color: var(--fg); }
|
|
8102
|
+
.dom-drag, .dom-drag * { cursor: grabbing; }
|
|
8103
|
+
.dom-dragging > .dom-code { opacity: 0.45; }
|
|
8104
|
+
.dom-drop-before { box-shadow: inset 0 2px 0 var(--fg); }
|
|
8105
|
+
.dom-drop-after { box-shadow: inset 0 -2px 0 var(--fg); }
|
|
8106
|
+
.dom-drop-into { box-shadow: inset 0 0 0 1px var(--fg); }
|
|
8282
8107
|
.dom-flash { animation: dom-flash 900ms ease-out; }
|
|
8283
8108
|
@keyframes dom-flash {
|
|
8284
8109
|
from { background: var(--pick); }
|
|
@@ -8343,8 +8168,9 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8343
8168
|
text-overflow: ellipsis;
|
|
8344
8169
|
white-space: nowrap;
|
|
8345
8170
|
}
|
|
8346
|
-
/* A declaration that wraps goes on further in than it starts.
|
|
8347
|
-
|
|
8171
|
+
/* A declaration that wraps goes on further in than it starts. Every line
|
|
8172
|
+
keeps the gutter an editable line's box stands in, so no text moves. */
|
|
8173
|
+
.css-decl { display: block; padding-left: 30px; text-indent: -12px; text-decoration: none; }
|
|
8348
8174
|
/* A name has the color of a key, its value the text's, and the marks between
|
|
8349
8175
|
them are quiet. A declaration that is struck through is quiet all over. */
|
|
8350
8176
|
.css-name { color: var(--key); }
|
|
@@ -8392,10 +8218,143 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
|
|
|
8392
8218
|
padding-right: var(--view-end);
|
|
8393
8219
|
padding-left: var(--view-start);
|
|
8394
8220
|
}
|
|
8395
|
-
.css-applied .css-decl { padding-left: 12px; }
|
|
8396
8221
|
.css-label { font-size: 10.5px; color: var(--faint); }
|
|
8397
8222
|
.css-comes { color: var(--faint); }
|
|
8398
8223
|
.css-hidden { padding: 2px var(--view-end) 2px var(--view-start); font-size: 10.5px; color: var(--faint); overflow-wrap: anywhere; }
|
|
8224
|
+
/* Editing, as in the browsers' tools: a checkbox in a line's gutter turns
|
|
8225
|
+
it off and on, shown on hover, on focus and on a line that is off. Its
|
|
8226
|
+
ring and its check are cut out of a fill by a mask, so they follow the
|
|
8227
|
+
theme with no line drawn. A value is a
|
|
8228
|
+
field on a click, as wide as what it holds, on the track's fill, its text
|
|
8229
|
+
red where the page did not take it. Adding a property is a quiet line
|
|
8230
|
+
under a block, in from its edge as a declaration's first line is. */
|
|
8231
|
+
.css-decl.can-edit { position: relative; }
|
|
8232
|
+
.css-toggle {
|
|
8233
|
+
position: absolute;
|
|
8234
|
+
top: 2.5px;
|
|
8235
|
+
left: 2px;
|
|
8236
|
+
width: 12px;
|
|
8237
|
+
height: 12px;
|
|
8238
|
+
opacity: 0;
|
|
8239
|
+
background: var(--faint);
|
|
8240
|
+
border-radius: 3px;
|
|
8241
|
+
cursor: pointer;
|
|
8242
|
+
-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;
|
|
8243
|
+
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;
|
|
8244
|
+
transition: opacity 120ms ease-out;
|
|
8245
|
+
}
|
|
8246
|
+
.css-toggle:checked {
|
|
8247
|
+
background: var(--fg);
|
|
8248
|
+
-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");
|
|
8249
|
+
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");
|
|
8250
|
+
}
|
|
8251
|
+
.css-decl.can-edit:hover > .css-toggle, .css-toggle:focus-visible, .css-decl.off > .css-toggle { opacity: 1; }
|
|
8252
|
+
.css-editable { border-radius: 2px; cursor: text; }
|
|
8253
|
+
.css-editable:hover, .css-editable:focus-visible { background: var(--track); }
|
|
8254
|
+
/* A field wraps where its value is wider than its line, and grows down, as
|
|
8255
|
+
tall as what it holds up to a height it scrolls in: nothing scrolls sideways. */
|
|
8256
|
+
.css-edit {
|
|
8257
|
+
max-width: 100%;
|
|
8258
|
+
max-height: 18em;
|
|
8259
|
+
padding: 0;
|
|
8260
|
+
font: inherit;
|
|
8261
|
+
text-indent: 0;
|
|
8262
|
+
vertical-align: top;
|
|
8263
|
+
white-space: pre-wrap;
|
|
8264
|
+
overflow-wrap: anywhere;
|
|
8265
|
+
overflow: hidden auto;
|
|
8266
|
+
resize: none;
|
|
8267
|
+
scrollbar-width: thin;
|
|
8268
|
+
color: var(--fg);
|
|
8269
|
+
background: var(--track);
|
|
8270
|
+
border-radius: 2px;
|
|
8271
|
+
}
|
|
8272
|
+
.css-edit.bad { color: var(--hot); }
|
|
8273
|
+
/* The field's ring, as a chip's field has it while focused, in place of the browser's border. */
|
|
8274
|
+
.inline-field { border: 0; box-shadow: inset 0 0 0 1px var(--faint); }
|
|
8275
|
+
.css-add, .css-adding { padding-left: 18px; }
|
|
8276
|
+
.css-add, .css-new-rule {
|
|
8277
|
+
display: block;
|
|
8278
|
+
font: 11px/1.5 var(--mono);
|
|
8279
|
+
color: var(--faint);
|
|
8280
|
+
border-radius: 2px;
|
|
8281
|
+
transition: color 120ms ease-out;
|
|
8282
|
+
}
|
|
8283
|
+
.css-add:hover, .css-new-rule:hover { color: var(--fg); }
|
|
8284
|
+
.css-adding { text-indent: 0; }
|
|
8285
|
+
/* The suggestions under a field of the styles view: a raised list placed
|
|
8286
|
+
under the field, the one marked in the selected line's tint. */
|
|
8287
|
+
.ac-list {
|
|
8288
|
+
position: absolute;
|
|
8289
|
+
z-index: 3;
|
|
8290
|
+
display: grid;
|
|
8291
|
+
min-width: 16ch;
|
|
8292
|
+
max-width: 100%;
|
|
8293
|
+
max-height: 12.8em;
|
|
8294
|
+
overflow-y: auto;
|
|
8295
|
+
padding: 2px 0;
|
|
8296
|
+
font: 11px/1.6 var(--mono);
|
|
8297
|
+
text-indent: 0;
|
|
8298
|
+
white-space: nowrap;
|
|
8299
|
+
color: var(--fg);
|
|
8300
|
+
background: var(--raised);
|
|
8301
|
+
border-radius: 4px;
|
|
8302
|
+
box-shadow: var(--lift), 0 0 0 1px var(--line);
|
|
8303
|
+
scrollbar-width: thin;
|
|
8304
|
+
}
|
|
8305
|
+
.ac-item { padding: 0 var(--col-pad); overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
|
|
8306
|
+
.ac-item:hover { background: var(--card); }
|
|
8307
|
+
.ac-item[aria-selected="true"] { background: var(--pick); }
|
|
8308
|
+
/* The line that adds a rule stands under the blocks, as the start of one. */
|
|
8309
|
+
.css-new-rule { justify-self: start; padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8310
|
+
.css-rule-adding { padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8311
|
+
/* The states a chip forces, in the editors' chips, the selector's font. */
|
|
8312
|
+
.force-states { padding: 0 var(--view-end) 4px var(--view-start); }
|
|
8313
|
+
.force-states .chip { font: 11px/22px var(--mono); }
|
|
8314
|
+
|
|
8315
|
+
/* The changes at the foot of the Elements view, which stay in sight while
|
|
8316
|
+
the styles scroll: a quiet head, each edit as diff lines tinted for what
|
|
8317
|
+
went and what came, then the buttons, the prompt the filled one. */
|
|
8318
|
+
.changes {
|
|
8319
|
+
position: sticky;
|
|
8320
|
+
bottom: 0;
|
|
8321
|
+
/* Over the styles' bar where the two meet, with a long list. */
|
|
8322
|
+
z-index: 2;
|
|
8323
|
+
display: grid;
|
|
8324
|
+
grid-template-columns: minmax(0, 1fr);
|
|
8325
|
+
gap: 6px;
|
|
8326
|
+
padding: 8px var(--view-end) 8px var(--view-start);
|
|
8327
|
+
background: var(--bg);
|
|
8328
|
+
border-top: 1px solid var(--line);
|
|
8329
|
+
}
|
|
8330
|
+
.changes-head, .changes-note { font-size: 10.5px; color: var(--faint); }
|
|
8331
|
+
/* The count is the button that folds the diff out, its chevron turned while it shows. */
|
|
8332
|
+
.changes-toggle { color: inherit; border-radius: 2px; transition: color 120ms ease-out; }
|
|
8333
|
+
.changes-toggle:hover { color: var(--fg); }
|
|
8334
|
+
.changes-toggle::before { content: "›"; display: inline-block; width: 2ch; text-align: left; transform-origin: 0.5ch 50%; transition: transform 120ms ease-out; }
|
|
8335
|
+
.changes-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
|
|
8336
|
+
/* What was made again as the page loaded, and the edits that were not. */
|
|
8337
|
+
.changes-kept { display: grid; gap: 2px; font-size: 11px; }
|
|
8338
|
+
.changes-kept-line { color: var(--fg); }
|
|
8339
|
+
.changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
|
8340
|
+
.changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
|
|
8341
|
+
/* The switch that keeps the edits after a reload, over the tree. */
|
|
8342
|
+
.keep-line { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
|
|
8343
|
+
.keep-line .knob-label { color: var(--fg); }
|
|
8344
|
+
.changes-list {
|
|
8345
|
+
max-height: 30vh;
|
|
8346
|
+
overflow: auto;
|
|
8347
|
+
font: 11px/1.5 var(--mono);
|
|
8348
|
+
overflow-wrap: anywhere;
|
|
8349
|
+
scrollbar-width: thin;
|
|
8350
|
+
}
|
|
8351
|
+
.diff-place { padding: 4px var(--col-pad) 0; color: var(--faint); }
|
|
8352
|
+
.diff-place:first-child { padding-top: 0; }
|
|
8353
|
+
.diff-del, .diff-add { padding: 0 var(--col-pad); border-radius: 2px; }
|
|
8354
|
+
.diff-del { background: color-mix(in srgb, var(--hot) 14%, transparent); }
|
|
8355
|
+
.diff-add { background: color-mix(in srgb, var(--ok) 14%, transparent); }
|
|
8356
|
+
.changes-acts { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
8357
|
+
.chip.changes-go, .chip.changes-go:hover { color: var(--bg); background: var(--fg); }
|
|
8399
8358
|
|
|
8400
8359
|
/* The element's box, in a fold of the kit's: a picture of the element, so
|
|
8401
8360
|
its areas are filled, each in the hue the page's own tint of it has, mixed
|
|
@@ -8713,6 +8672,11 @@ function ownCss(media) {
|
|
|
8713
8672
|
};
|
|
8714
8673
|
return CSS.replace(/@media ([^{]+)\{/g, settle2).replaceAll("color-scheme: light dark", `color-scheme: ${media.scheme}`);
|
|
8715
8674
|
}
|
|
8675
|
+
function resetPage(log = edits, reset2 = reset) {
|
|
8676
|
+
log.undoAll();
|
|
8677
|
+
clearForced();
|
|
8678
|
+
reset2();
|
|
8679
|
+
}
|
|
8716
8680
|
function createPanel(options2 = {}) {
|
|
8717
8681
|
const keys = options2.keys ?? createKeys();
|
|
8718
8682
|
const prefs = createPrefs({ handle: options2.handle });
|
|
@@ -8738,7 +8702,7 @@ function createPanel(options2 = {}) {
|
|
|
8738
8702
|
const flip = () => drag.flip();
|
|
8739
8703
|
stage.flip = flip;
|
|
8740
8704
|
const actionsHere = availableActions();
|
|
8741
|
-
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" || inspect !== null));
|
|
8705
|
+
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
|
|
8742
8706
|
const host = document.createElement("div");
|
|
8743
8707
|
host.setAttribute("data-devknobs", "panel");
|
|
8744
8708
|
host.style.cssText = HOST_STYLE;
|
|
@@ -8812,6 +8776,8 @@ function createPanel(options2 = {}) {
|
|
|
8812
8776
|
showHandle: () => setState({ panel: { handle: true } }),
|
|
8813
8777
|
devIconShown: () => devIconShown(getState().panel.devIcon, window.location.hostname),
|
|
8814
8778
|
setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
|
|
8779
|
+
realPhone: hostSendsUa(),
|
|
8780
|
+
setRealPhone: (on) => setState({ panel: { realPhone: on } }),
|
|
8815
8781
|
native: nativeSwitch()?.setting ?? null,
|
|
8816
8782
|
setNative: (on) => {
|
|
8817
8783
|
nativeSwitch()?.setting.change(on);
|
|
@@ -8845,7 +8811,6 @@ function createPanel(options2 = {}) {
|
|
|
8845
8811
|
wrap,
|
|
8846
8812
|
panel,
|
|
8847
8813
|
prefs,
|
|
8848
|
-
showing: () => viewing() ? "view" : "list",
|
|
8849
8814
|
place: () => getState().panel,
|
|
8850
8815
|
wide: setDockWidth,
|
|
8851
8816
|
sized: panelSized
|
|
@@ -8913,6 +8878,7 @@ function createPanel(options2 = {}) {
|
|
|
8913
8878
|
wrap.dataset.handle = handleShown ? "shown" : "hidden";
|
|
8914
8879
|
settings.drawHandle(handleShown);
|
|
8915
8880
|
settings.drawDevIcon(devIconShown(state.panel.devIcon, window.location.hostname));
|
|
8881
|
+
settings.drawRealPhone(state.panel.realPhone);
|
|
8916
8882
|
const nativeNow = nativeSwitch();
|
|
8917
8883
|
if (nativeNow)
|
|
8918
8884
|
settings.drawNative(nativeNow.on, nativeNow.note);
|
|
@@ -8934,7 +8900,7 @@ function createPanel(options2 = {}) {
|
|
|
8934
8900
|
rows.hidden = !anyShown;
|
|
8935
8901
|
const resetHint = hints.get("reset");
|
|
8936
8902
|
if (resetHint)
|
|
8937
|
-
resetHint.disabled = isReset(state);
|
|
8903
|
+
resetHint.disabled = isReset(state) && edits.list().length === 0;
|
|
8938
8904
|
badge.textContent = overflowBadge(state.overflow, live.overflow);
|
|
8939
8905
|
badge.hidden = badge.textContent === "";
|
|
8940
8906
|
badge.classList.toggle("hot", hot);
|
|
@@ -8998,7 +8964,7 @@ function createPanel(options2 = {}) {
|
|
|
8998
8964
|
searchInput.value = "";
|
|
8999
8965
|
for (const action of actionsHere)
|
|
9000
8966
|
stopAction(action);
|
|
9001
|
-
|
|
8967
|
+
resetPage();
|
|
9002
8968
|
}
|
|
9003
8969
|
function onInspect(on) {
|
|
9004
8970
|
const at = root.activeElement;
|
|
@@ -9045,9 +9011,17 @@ function createPanel(options2 = {}) {
|
|
|
9045
9011
|
actionOf("storage")?.run();
|
|
9046
9012
|
return;
|
|
9047
9013
|
}
|
|
9014
|
+
if (action === "requests" || action === "elements") {
|
|
9015
|
+
showView(action);
|
|
9016
|
+
return;
|
|
9017
|
+
}
|
|
9018
|
+
if (action === "settings") {
|
|
9019
|
+
showSettings();
|
|
9020
|
+
return;
|
|
9021
|
+
}
|
|
9048
9022
|
if (!getState().panel.open)
|
|
9049
9023
|
return;
|
|
9050
|
-
if (action === "replay"
|
|
9024
|
+
if (action === "replay")
|
|
9051
9025
|
actionOf(action)?.run();
|
|
9052
9026
|
else if (action === "reset")
|
|
9053
9027
|
runCommand("reset");
|
|
@@ -9056,6 +9030,31 @@ function createPanel(options2 = {}) {
|
|
|
9056
9030
|
else
|
|
9057
9031
|
toggle(false);
|
|
9058
9032
|
}
|
|
9033
|
+
function opensPanel(action) {
|
|
9034
|
+
return action === "toggle" || action === "storage" || action === "requests" || action === "settings" || action === "elements";
|
|
9035
|
+
}
|
|
9036
|
+
function showView(action) {
|
|
9037
|
+
const id = side.view();
|
|
9038
|
+
const mine = action === "requests" ? requests.shows() : id === STYLES_VIEW;
|
|
9039
|
+
if (mine && getState().panel.open && viewing()) {
|
|
9040
|
+
side.close();
|
|
9041
|
+
return;
|
|
9042
|
+
}
|
|
9043
|
+
if (mine && id !== null)
|
|
9044
|
+
side.show(id);
|
|
9045
|
+
else if (action === "requests")
|
|
9046
|
+
requestsHere.toggle();
|
|
9047
|
+
else
|
|
9048
|
+
inspector?.elements();
|
|
9049
|
+
}
|
|
9050
|
+
function showSettings() {
|
|
9051
|
+
if (getState().panel.open && settings.editing()) {
|
|
9052
|
+
settings.leaveKeys();
|
|
9053
|
+
return;
|
|
9054
|
+
}
|
|
9055
|
+
toggle(true);
|
|
9056
|
+
settings.openKeys();
|
|
9057
|
+
}
|
|
9059
9058
|
function escape() {
|
|
9060
9059
|
if (drag.dragging() || !getState().panel.open)
|
|
9061
9060
|
return;
|
|
@@ -9105,8 +9104,8 @@ function createPanel(options2 = {}) {
|
|
|
9105
9104
|
event.stopPropagation();
|
|
9106
9105
|
return;
|
|
9107
9106
|
}
|
|
9108
|
-
const action = keyAction(event, keys.get());
|
|
9109
|
-
const acts = action !== null && action !== "close" && !drag.dragging() && (action
|
|
9107
|
+
const action = keyAction(event, keysListed(keys.get(), bindingsHere));
|
|
9108
|
+
const acts = action !== null && action !== "close" && !drag.dragging() && (opensPanel(action) || getState().panel.open);
|
|
9110
9109
|
const inSearch = event.composedPath()[0] === searchInput;
|
|
9111
9110
|
if (acts || action && action !== "close" && inSearch)
|
|
9112
9111
|
event.preventDefault();
|
|
@@ -9155,6 +9154,7 @@ function createPanel(options2 = {}) {
|
|
|
9155
9154
|
stage.inspector = inspector;
|
|
9156
9155
|
const stopModes = actionsHere.flatMap((action) => action.watch?.(render) ?? []);
|
|
9157
9156
|
const stopCount = onCount(render);
|
|
9157
|
+
const stopEdits = edits.subscribe(render);
|
|
9158
9158
|
window.addEventListener("keydown", onKeydown, true);
|
|
9159
9159
|
window.addEventListener("pointerdown", onPointerDown, true);
|
|
9160
9160
|
window.addEventListener("pointerup", onPointerUp, true);
|
|
@@ -9206,6 +9206,7 @@ function createPanel(options2 = {}) {
|
|
|
9206
9206
|
if (stage.inspector === inspector)
|
|
9207
9207
|
stage.inspector = null;
|
|
9208
9208
|
stopCount();
|
|
9209
|
+
stopEdits();
|
|
9209
9210
|
clearInterval(ticker);
|
|
9210
9211
|
tips.destroy();
|
|
9211
9212
|
settings.destroy();
|
|
@@ -9233,7 +9234,7 @@ function createPanel(options2 = {}) {
|
|
|
9233
9234
|
}
|
|
9234
9235
|
|
|
9235
9236
|
// src/version.ts
|
|
9236
|
-
var VERSION = "0.
|
|
9237
|
+
var VERSION = "0.6.0";
|
|
9237
9238
|
// src/index.ts
|
|
9238
9239
|
var panel = null;
|
|
9239
9240
|
var stopKeys = null;
|
|
@@ -9284,12 +9285,20 @@ function mount(options2 = {}) {
|
|
|
9284
9285
|
start(options2);
|
|
9285
9286
|
mounted = options2;
|
|
9286
9287
|
attach(options2);
|
|
9288
|
+
if (!isDevknobsFrame() && !fresh())
|
|
9289
|
+
keepEdits(options2.editsStore);
|
|
9290
|
+
}
|
|
9291
|
+
function keepEdits(store) {
|
|
9292
|
+
const path = pathNow();
|
|
9293
|
+
const frame = () => framedPage(window, frameWindow(), path, needsFrame(getState()));
|
|
9294
|
+
startKeep(store, { frame, settled: () => pageSettled(window, () => needsFrame(getState()), frame) });
|
|
9287
9295
|
}
|
|
9288
9296
|
function attach(options2) {
|
|
9289
9297
|
const live = createKeys({
|
|
9290
9298
|
hotkey: options2.hotkey,
|
|
9291
9299
|
grabKey: options2.grabKey,
|
|
9292
|
-
grab: options2.grab !== false
|
|
9300
|
+
grab: options2.grab !== false,
|
|
9301
|
+
store: options2.keysStore
|
|
9293
9302
|
});
|
|
9294
9303
|
keys = live;
|
|
9295
9304
|
if (options2.grab !== false) {
|
|
@@ -9394,6 +9403,7 @@ function adopt(options2, take) {
|
|
|
9394
9403
|
detach();
|
|
9395
9404
|
attach(mounted);
|
|
9396
9405
|
}
|
|
9406
|
+
var handing = false;
|
|
9397
9407
|
function handOver() {
|
|
9398
9408
|
const take = waiting;
|
|
9399
9409
|
const options2 = mounted;
|
|
@@ -9405,7 +9415,12 @@ function handOver() {
|
|
|
9405
9415
|
return;
|
|
9406
9416
|
}
|
|
9407
9417
|
const native = nativeSwitch();
|
|
9408
|
-
|
|
9418
|
+
handing = true;
|
|
9419
|
+
try {
|
|
9420
|
+
unmount();
|
|
9421
|
+
} finally {
|
|
9422
|
+
handing = false;
|
|
9423
|
+
}
|
|
9409
9424
|
const prefer = options2.prefer;
|
|
9410
9425
|
let took = false;
|
|
9411
9426
|
try {
|
|
@@ -9433,6 +9448,12 @@ function unmount() {
|
|
|
9433
9448
|
if (superseded(window, unmount))
|
|
9434
9449
|
return;
|
|
9435
9450
|
detach();
|
|
9451
|
+
stopKeep();
|
|
9452
|
+
if (!handing) {
|
|
9453
|
+
edits.undoAll();
|
|
9454
|
+
forgetReplay();
|
|
9455
|
+
clearForced();
|
|
9456
|
+
}
|
|
9436
9457
|
const native = mounted?.host ? nativeSwitch() : null;
|
|
9437
9458
|
stop();
|
|
9438
9459
|
withdraw(window, api);
|
|
@@ -9507,10 +9528,33 @@ async function grab(elements, options2) {
|
|
|
9507
9528
|
const host = hosted("grab");
|
|
9508
9529
|
if (host)
|
|
9509
9530
|
return host(elements, options2);
|
|
9510
|
-
const loaded = await import("./index-
|
|
9531
|
+
const loaded = await import("./index-kfdzsyyw.js");
|
|
9511
9532
|
return loaded.grab(elements, options2);
|
|
9512
9533
|
}
|
|
9513
|
-
|
|
9534
|
+
function edits2() {
|
|
9535
|
+
return (hosted("edits") ?? edits.list)();
|
|
9536
|
+
}
|
|
9537
|
+
async function setEdits(list) {
|
|
9538
|
+
const host = hosted("setEdits");
|
|
9539
|
+
if (host)
|
|
9540
|
+
return host(list);
|
|
9541
|
+
if (!Array.isArray(list))
|
|
9542
|
+
throw new TypeError("devknobs.setEdits takes a list of edits, as edits() gives them");
|
|
9543
|
+
const { replayEdits } = await import("./replay-j18rw92k.js");
|
|
9544
|
+
const { applied, skipped } = replayEdits(edits, list);
|
|
9545
|
+
return { applied, skipped };
|
|
9546
|
+
}
|
|
9547
|
+
function undoEdit() {
|
|
9548
|
+
return (hosted("undoEdit") ?? edits.undo)();
|
|
9549
|
+
}
|
|
9550
|
+
function forceState2(target, states = []) {
|
|
9551
|
+
const host = hosted("forceState");
|
|
9552
|
+
if (host)
|
|
9553
|
+
return host(target, states);
|
|
9554
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
9555
|
+
return forceState(element, states);
|
|
9556
|
+
}
|
|
9557
|
+
var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2, edits: edits2, setEdits, undoEdit, forceState: forceState2 };
|
|
9514
9558
|
|
|
9515
9559
|
// src/react.tsx
|
|
9516
9560
|
function DevKnobs(props) {
|