@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/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-pewcdh28.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,51 @@ 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
|
+
pageSettled,
|
|
52
|
+
pathNow,
|
|
53
|
+
startKeep,
|
|
54
|
+
stopKeep
|
|
55
|
+
} from "./index-0zp9py56.js";
|
|
24
56
|
import {
|
|
25
57
|
label
|
|
26
|
-
} from "./index-
|
|
58
|
+
} from "./index-zd6adby9.js";
|
|
27
59
|
import {
|
|
28
|
-
PANE_WIDTH,
|
|
29
60
|
appliedOnLoad,
|
|
30
61
|
applyOnLoad,
|
|
31
62
|
closePane,
|
|
@@ -38,7 +69,7 @@ import {
|
|
|
38
69
|
showPane,
|
|
39
70
|
stopOnLoad,
|
|
40
71
|
viewHead
|
|
41
|
-
} from "./index-
|
|
72
|
+
} from "./index-aynkv7qk.js";
|
|
42
73
|
import {
|
|
43
74
|
actButton,
|
|
44
75
|
button,
|
|
@@ -67,58 +98,40 @@ import {
|
|
|
67
98
|
tabBar,
|
|
68
99
|
textField,
|
|
69
100
|
toolbar
|
|
70
|
-
} from "./index-
|
|
101
|
+
} from "./index-4a4x1bt2.js";
|
|
71
102
|
import {
|
|
72
|
-
BINDING_ICONS,
|
|
73
103
|
BODY_CAP,
|
|
74
104
|
HOST_RESET,
|
|
75
|
-
KEYS_FIELD,
|
|
76
105
|
LAYER,
|
|
77
106
|
LOCALE_PRESETS,
|
|
78
107
|
READ_MS,
|
|
79
|
-
ROW_ICONS,
|
|
80
108
|
SPEED_MAX,
|
|
81
109
|
SPEED_MIN,
|
|
82
110
|
TIME_ZONE_PRESETS,
|
|
83
111
|
canonicalTag,
|
|
84
112
|
canonicalZone,
|
|
85
|
-
comboLabel,
|
|
86
|
-
comboSpoken,
|
|
87
|
-
comboText,
|
|
88
|
-
defaultKeys,
|
|
89
113
|
devIconFor,
|
|
90
114
|
devIconShown,
|
|
91
|
-
escapeStep,
|
|
92
115
|
exports_engine,
|
|
93
116
|
foldRest,
|
|
94
|
-
forwardKeys,
|
|
95
117
|
frameWindow,
|
|
96
118
|
getState,
|
|
97
|
-
glyph,
|
|
98
|
-
highlightAt,
|
|
99
119
|
holdInTopLayer,
|
|
100
120
|
holdingHinge,
|
|
101
|
-
|
|
102
|
-
isFunctionKey,
|
|
103
|
-
isSearchKey,
|
|
121
|
+
hostSendsUa,
|
|
104
122
|
keepPlace,
|
|
105
|
-
keyAction,
|
|
106
123
|
landSplash,
|
|
107
124
|
letGo,
|
|
108
|
-
lowerKey,
|
|
109
125
|
moveHinge,
|
|
110
126
|
nativeSwitch,
|
|
111
127
|
onCount,
|
|
112
128
|
overflowCount,
|
|
113
|
-
paletteMove,
|
|
114
129
|
panelSized,
|
|
115
|
-
parseCombo,
|
|
116
130
|
ready,
|
|
117
131
|
replay,
|
|
118
132
|
requestLog,
|
|
119
133
|
reset,
|
|
120
134
|
resolveTimeZone,
|
|
121
|
-
rowIcon,
|
|
122
135
|
sends,
|
|
123
136
|
setNative,
|
|
124
137
|
setState,
|
|
@@ -126,13 +139,49 @@ import {
|
|
|
126
139
|
stop,
|
|
127
140
|
subscribe,
|
|
128
141
|
takeHinge,
|
|
129
|
-
typeAhead,
|
|
130
142
|
watchFold,
|
|
131
143
|
watchHinge,
|
|
132
144
|
watchPanel,
|
|
133
|
-
zoomAction,
|
|
134
145
|
zoomKey
|
|
135
|
-
} from "./index-
|
|
146
|
+
} from "./index-x59vz1xx.js";
|
|
147
|
+
import {
|
|
148
|
+
MAT_COLORS,
|
|
149
|
+
MAT_COLOR_NAMES,
|
|
150
|
+
UA_PRESETS,
|
|
151
|
+
isMac,
|
|
152
|
+
isMatName,
|
|
153
|
+
layoutOf,
|
|
154
|
+
layoutOptions,
|
|
155
|
+
matGradient,
|
|
156
|
+
mockOf,
|
|
157
|
+
platformOf,
|
|
158
|
+
runsUnderBars,
|
|
159
|
+
uaPreset,
|
|
160
|
+
userAgentOf
|
|
161
|
+
} from "./index-7cb4x1vj.js";
|
|
162
|
+
import {
|
|
163
|
+
BINDING_ICONS,
|
|
164
|
+
KEYS_FIELD,
|
|
165
|
+
ROW_ICONS,
|
|
166
|
+
comboLabel,
|
|
167
|
+
comboSpoken,
|
|
168
|
+
comboText,
|
|
169
|
+
defaultKeys,
|
|
170
|
+
escapeStep,
|
|
171
|
+
forwardKeys,
|
|
172
|
+
glyph,
|
|
173
|
+
highlightAt,
|
|
174
|
+
icon,
|
|
175
|
+
isFunctionKey,
|
|
176
|
+
isSearchKey,
|
|
177
|
+
keyAction,
|
|
178
|
+
lowerKey,
|
|
179
|
+
paletteMove,
|
|
180
|
+
parseCombo,
|
|
181
|
+
rowIcon,
|
|
182
|
+
typeAhead,
|
|
183
|
+
zoomAction
|
|
184
|
+
} from "./index-6bc2ztfd.js";
|
|
136
185
|
import {
|
|
137
186
|
BARS,
|
|
138
187
|
BROWSERS,
|
|
@@ -153,8 +202,6 @@ import {
|
|
|
153
202
|
GEO_ERRORS,
|
|
154
203
|
GEO_PRESETS,
|
|
155
204
|
GRAB_COLORS,
|
|
156
|
-
MAT_COLORS,
|
|
157
|
-
MAT_COLOR_NAMES,
|
|
158
205
|
MOTIONS,
|
|
159
206
|
NativeDate,
|
|
160
207
|
ONLINES,
|
|
@@ -168,12 +215,10 @@ import {
|
|
|
168
215
|
TEXT_MAX,
|
|
169
216
|
TEXT_MIN,
|
|
170
217
|
TRANSPARENCIES,
|
|
171
|
-
UA_PRESETS,
|
|
172
218
|
VISIONS,
|
|
173
219
|
ZOOM_MAX,
|
|
174
220
|
ZOOM_MIN,
|
|
175
221
|
ZOOM_PRESETS,
|
|
176
|
-
__require,
|
|
177
222
|
addStyle,
|
|
178
223
|
deviceOf,
|
|
179
224
|
formId,
|
|
@@ -183,35 +228,29 @@ import {
|
|
|
183
228
|
hasTouch,
|
|
184
229
|
isCustomColor,
|
|
185
230
|
isDevknobsFrame,
|
|
186
|
-
isMac,
|
|
187
|
-
isMatName,
|
|
188
231
|
knobFrame,
|
|
189
|
-
layoutOf,
|
|
190
|
-
layoutOptions,
|
|
191
|
-
matGradient,
|
|
192
|
-
mockOf,
|
|
193
232
|
needsFrame,
|
|
194
233
|
newer,
|
|
195
234
|
now,
|
|
196
235
|
openOf,
|
|
197
236
|
parseColor,
|
|
198
237
|
percent,
|
|
199
|
-
platformOf,
|
|
200
238
|
readColor,
|
|
201
239
|
readMessage,
|
|
202
240
|
realNow,
|
|
203
241
|
resolveGeo,
|
|
204
242
|
rewriteMediaText,
|
|
205
|
-
runsUnderBars,
|
|
206
243
|
setSystemMedia,
|
|
207
244
|
stamped,
|
|
208
245
|
still,
|
|
209
246
|
toHex,
|
|
210
|
-
uaPreset,
|
|
211
|
-
userAgentOf,
|
|
212
247
|
watchSystemMedia,
|
|
213
248
|
webStorage
|
|
214
|
-
} from "./index-
|
|
249
|
+
} from "./index-dzm8ywq0.js";
|
|
250
|
+
import"./index-a974q3aa.js";
|
|
251
|
+
import {
|
|
252
|
+
__require
|
|
253
|
+
} from "./index-5tv6sr74.js";
|
|
215
254
|
|
|
216
255
|
// src/ui/knobs.ts
|
|
217
256
|
var MINUTE = 60000;
|
|
@@ -1452,7 +1491,8 @@ function knobs() {
|
|
|
1452
1491
|
open: field2("The panel is open.", flag2),
|
|
1453
1492
|
docked: field2("Pinned to its side as a column, with the page in a frame beside it.", flag2),
|
|
1454
1493
|
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),
|
|
1455
|
-
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))
|
|
1494
|
+
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)),
|
|
1495
|
+
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)
|
|
1456
1496
|
}
|
|
1457
1497
|
}, "frame")
|
|
1458
1498
|
};
|
|
@@ -1464,8 +1504,8 @@ function describe() {
|
|
|
1464
1504
|
}
|
|
1465
1505
|
function defaultOf(key) {
|
|
1466
1506
|
if (key === "panel") {
|
|
1467
|
-
const { open, docked, handle, devIcon } = DEFAULT_STATE.panel;
|
|
1468
|
-
return { open, docked, handle, devIcon };
|
|
1507
|
+
const { open, docked, handle, devIcon, realPhone } = DEFAULT_STATE.panel;
|
|
1508
|
+
return { open, docked, handle, devIcon, realPhone };
|
|
1469
1509
|
}
|
|
1470
1510
|
if (key === "clock") {
|
|
1471
1511
|
const { mode, at, speed, header } = DEFAULT_STATE.clock;
|
|
@@ -1702,6 +1742,8 @@ var BINDINGS = [
|
|
|
1702
1742
|
"replay",
|
|
1703
1743
|
"requests",
|
|
1704
1744
|
"storage",
|
|
1745
|
+
"elements",
|
|
1746
|
+
"settings",
|
|
1705
1747
|
"reset"
|
|
1706
1748
|
];
|
|
1707
1749
|
var BINDING_WORDS = {
|
|
@@ -1711,7 +1753,9 @@ var BINDING_WORDS = {
|
|
|
1711
1753
|
replay: "replay animations",
|
|
1712
1754
|
requests: "requests",
|
|
1713
1755
|
storage: "storage",
|
|
1714
|
-
reset: "reset"
|
|
1756
|
+
reset: "reset",
|
|
1757
|
+
elements: "elements",
|
|
1758
|
+
settings: "settings"
|
|
1715
1759
|
};
|
|
1716
1760
|
var RESERVED_LETTERS = new Set([..."cvxzawrtqlnfpshm"]);
|
|
1717
1761
|
var ZOOM_KEYS = new Set(["=", "-", "_", "0"]);
|
|
@@ -1741,8 +1785,6 @@ function clashText(combo) {
|
|
|
1741
1785
|
function comboProblem(combo, binding, others = {}) {
|
|
1742
1786
|
if (!keepable(combo.key))
|
|
1743
1787
|
return "use a letter, digit, symbol or F1 to F12";
|
|
1744
|
-
if (bare(combo) && !isFunctionKey(combo.key))
|
|
1745
|
-
return "add a modifier, alone it types";
|
|
1746
1788
|
if (isReserved(combo))
|
|
1747
1789
|
return "the browser uses it";
|
|
1748
1790
|
if (combo.key === "/" && !combo.meta && !combo.ctrl && !combo.alt)
|
|
@@ -1806,6 +1848,9 @@ function readKeys(json) {
|
|
|
1806
1848
|
} catch {
|
|
1807
1849
|
return {};
|
|
1808
1850
|
}
|
|
1851
|
+
return keysOf(value);
|
|
1852
|
+
}
|
|
1853
|
+
function keysOf(value) {
|
|
1809
1854
|
if (newer(value, KEYS_VERSION))
|
|
1810
1855
|
return {};
|
|
1811
1856
|
const stored = record(value);
|
|
@@ -1867,10 +1912,41 @@ function keepKeys(keys) {
|
|
|
1867
1912
|
webStorage("local")?.setItem(KEYS_KEY, JSON.stringify(stamped(keys, KEYS_VERSION)));
|
|
1868
1913
|
} catch {}
|
|
1869
1914
|
}
|
|
1915
|
+
function keysListed(keys, listed) {
|
|
1916
|
+
const here = { ...keys };
|
|
1917
|
+
for (const binding of BINDINGS) {
|
|
1918
|
+
if (binding !== "panel" && !listed.includes(binding))
|
|
1919
|
+
here[binding] = null;
|
|
1920
|
+
}
|
|
1921
|
+
return here;
|
|
1922
|
+
}
|
|
1870
1923
|
function createKeys(options2 = {}) {
|
|
1871
1924
|
const base = defaultKeys(options2);
|
|
1872
1925
|
const grab = options2.grab !== false;
|
|
1873
|
-
|
|
1926
|
+
const store = options2.store ?? null;
|
|
1927
|
+
function load() {
|
|
1928
|
+
if (!store)
|
|
1929
|
+
return loadKeys();
|
|
1930
|
+
if (fresh())
|
|
1931
|
+
return {};
|
|
1932
|
+
try {
|
|
1933
|
+
return keysOf(store.load());
|
|
1934
|
+
} catch {
|
|
1935
|
+
return {};
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
function keep(keys2) {
|
|
1939
|
+
if (!store) {
|
|
1940
|
+
keepKeys(keys2);
|
|
1941
|
+
return;
|
|
1942
|
+
}
|
|
1943
|
+
if (fresh())
|
|
1944
|
+
return;
|
|
1945
|
+
try {
|
|
1946
|
+
store.save(stamped(keys2, KEYS_VERSION));
|
|
1947
|
+
} catch {}
|
|
1948
|
+
}
|
|
1949
|
+
let stored = load();
|
|
1874
1950
|
let keys = resolveKeys(base, stored, grab);
|
|
1875
1951
|
const listeners = new Set;
|
|
1876
1952
|
function changed() {
|
|
@@ -1881,12 +1957,16 @@ function createKeys(options2 = {}) {
|
|
|
1881
1957
|
function onStorage(event) {
|
|
1882
1958
|
if (event.key !== KEYS_KEY && event.key !== null)
|
|
1883
1959
|
return;
|
|
1960
|
+
heard();
|
|
1961
|
+
}
|
|
1962
|
+
function heard() {
|
|
1884
1963
|
if (fresh())
|
|
1885
1964
|
return;
|
|
1886
|
-
stored =
|
|
1965
|
+
stored = load();
|
|
1887
1966
|
changed();
|
|
1888
1967
|
}
|
|
1889
|
-
|
|
1968
|
+
const stopStore = store?.subscribe(heard) ?? null;
|
|
1969
|
+
if (!store && typeof window !== "undefined")
|
|
1890
1970
|
window.addEventListener("storage", onStorage);
|
|
1891
1971
|
return {
|
|
1892
1972
|
get: () => keys,
|
|
@@ -1901,7 +1981,7 @@ function createKeys(options2 = {}) {
|
|
|
1901
1981
|
else
|
|
1902
1982
|
next[binding] = comboText(combo);
|
|
1903
1983
|
stored = next;
|
|
1904
|
-
|
|
1984
|
+
keep(stored);
|
|
1905
1985
|
changed();
|
|
1906
1986
|
},
|
|
1907
1987
|
subscribe(listener) {
|
|
@@ -1913,6 +1993,7 @@ function createKeys(options2 = {}) {
|
|
|
1913
1993
|
recording: false,
|
|
1914
1994
|
destroy() {
|
|
1915
1995
|
listeners.clear();
|
|
1996
|
+
stopStore?.();
|
|
1916
1997
|
if (typeof window !== "undefined")
|
|
1917
1998
|
window.removeEventListener("storage", onStorage);
|
|
1918
1999
|
}
|
|
@@ -2275,122 +2356,6 @@ function createDockSlide(context) {
|
|
|
2275
2356
|
};
|
|
2276
2357
|
}
|
|
2277
2358
|
|
|
2278
|
-
// src/ui/place.ts
|
|
2279
|
-
var DRAG_SLOP = 4;
|
|
2280
|
-
var FLING_SPAN = 150;
|
|
2281
|
-
var FLING_STRETCH = 40;
|
|
2282
|
-
var FLING_LEAST = 8;
|
|
2283
|
-
var FLING = 0.5;
|
|
2284
|
-
var FLING_LEAN = 1.5;
|
|
2285
|
-
var FLING_TRAVEL = 16;
|
|
2286
|
-
var GLIDE = 220;
|
|
2287
|
-
var GLIDE_MAX = 440;
|
|
2288
|
-
var GLIDE_SPEED = 6;
|
|
2289
|
-
var PANEL_GAP = 8;
|
|
2290
|
-
var SNAP = 24;
|
|
2291
|
-
function dragTarget(shift, open) {
|
|
2292
|
-
return open && !shift ? "panel" : "handle";
|
|
2293
|
-
}
|
|
2294
|
-
function otherSide(side) {
|
|
2295
|
-
return side === "right" ? "left" : "right";
|
|
2296
|
-
}
|
|
2297
|
-
function between(value, min, max) {
|
|
2298
|
-
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
2299
|
-
}
|
|
2300
|
-
function snap(value, min, max) {
|
|
2301
|
-
const end = Math.max(min, max);
|
|
2302
|
-
const at = between(value, min, end);
|
|
2303
|
-
if (at - min <= SNAP && at - min <= end - at)
|
|
2304
|
-
return min;
|
|
2305
|
-
return end - at <= SNAP ? end : at;
|
|
2306
|
-
}
|
|
2307
|
-
function edgeOf(value, min, max, had) {
|
|
2308
|
-
const top = Math.abs(value - min) < 0.5;
|
|
2309
|
-
const bottom = Math.abs(value - max) < 0.5;
|
|
2310
|
-
if (top && bottom)
|
|
2311
|
-
return had === "none" ? "top" : had;
|
|
2312
|
-
return top ? "top" : bottom ? "bottom" : "none";
|
|
2313
|
-
}
|
|
2314
|
-
function settle(place, room, anchor = "edge") {
|
|
2315
|
-
const last = room.view - PANEL_GAP - room.panel;
|
|
2316
|
-
const pull = anchor === "top" ? between : snap;
|
|
2317
|
-
const top = pull(anchor === "top" || place.edge === "none" ? place.top : place.edge === "top" ? PANEL_GAP : last, PANEL_GAP, last);
|
|
2318
|
-
const low = top + room.panel - room.handle;
|
|
2319
|
-
const y = pull(place.tab === "top" ? top : place.tab === "bottom" ? low : place.y, top, low);
|
|
2320
|
-
return {
|
|
2321
|
-
y,
|
|
2322
|
-
top,
|
|
2323
|
-
edge: edgeOf(top, PANEL_GAP, last, place.edge),
|
|
2324
|
-
tab: edgeOf(y, top, low, place.tab)
|
|
2325
|
-
};
|
|
2326
|
-
}
|
|
2327
|
-
function cornerAt(y, top, room) {
|
|
2328
|
-
return edgeOf(y, top, top + room.panel - room.handle, "none");
|
|
2329
|
-
}
|
|
2330
|
-
function dragTo(target, open, to, from, room) {
|
|
2331
|
-
const offset = from.y - from.top;
|
|
2332
|
-
if (target === "panel") {
|
|
2333
|
-
const top = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.panel);
|
|
2334
|
-
return settle({ y: top + offset, top, edge: "none", tab: "none" }, room);
|
|
2335
|
-
}
|
|
2336
|
-
if (open)
|
|
2337
|
-
return settle({ ...from, y: to, tab: "none" }, room);
|
|
2338
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2339
|
-
return settle({ y, top: y - offset, edge: "none", tab: "none" }, room);
|
|
2340
|
-
}
|
|
2341
|
-
function dragDocked(to, from, room) {
|
|
2342
|
-
const y = snap(to, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2343
|
-
return { y, top: y - (from.y - from.top), edge: "none", tab: from.tab };
|
|
2344
|
-
}
|
|
2345
|
-
function dockedHandle(y, room) {
|
|
2346
|
-
return between(y, PANEL_GAP, room.view - PANEL_GAP - room.handle);
|
|
2347
|
-
}
|
|
2348
|
-
function speedOf(from, to) {
|
|
2349
|
-
const time = to.t - from.t;
|
|
2350
|
-
return { x: (to.x - from.x) / time, y: (to.y - from.y) / time };
|
|
2351
|
-
}
|
|
2352
|
-
function velocity(samples, at) {
|
|
2353
|
-
const recent = samples.filter((sample) => sample.t >= at - FLING_SPAN && sample.t <= at);
|
|
2354
|
-
let fastest = { x: 0, y: 0 };
|
|
2355
|
-
let read = false;
|
|
2356
|
-
for (const [index, end] of recent.entries()) {
|
|
2357
|
-
let start2;
|
|
2358
|
-
for (const sample of recent.slice(0, index)) {
|
|
2359
|
-
if (end.t - sample.t >= FLING_STRETCH)
|
|
2360
|
-
start2 = sample;
|
|
2361
|
-
}
|
|
2362
|
-
if (!start2)
|
|
2363
|
-
continue;
|
|
2364
|
-
const speed = speedOf(start2, end);
|
|
2365
|
-
if (!read || Math.hypot(speed.x, speed.y) > Math.hypot(fastest.x, fastest.y))
|
|
2366
|
-
fastest = speed;
|
|
2367
|
-
read = true;
|
|
2368
|
-
}
|
|
2369
|
-
const first = recent[0];
|
|
2370
|
-
const last = recent[recent.length - 1];
|
|
2371
|
-
if (!read && first && last && last.t - first.t >= FLING_LEAST)
|
|
2372
|
-
return speedOf(first, last);
|
|
2373
|
-
return fastest;
|
|
2374
|
-
}
|
|
2375
|
-
function glideTime(distance) {
|
|
2376
|
-
return between(distance / GLIDE_SPEED, GLIDE, GLIDE_MAX);
|
|
2377
|
-
}
|
|
2378
|
-
function landSide(side, x, width, vx, vy) {
|
|
2379
|
-
const other = otherSide(side);
|
|
2380
|
-
const toward = side === "right" ? -vx : vx;
|
|
2381
|
-
const across = Math.abs(vx) >= FLING && Math.abs(vx) > FLING_LEAN * Math.abs(vy);
|
|
2382
|
-
const past = side === "right" ? x < width / 2 : x > width / 2;
|
|
2383
|
-
if (across && toward > 0)
|
|
2384
|
-
return other;
|
|
2385
|
-
if (across && toward < 0)
|
|
2386
|
-
return side;
|
|
2387
|
-
return past ? other : side;
|
|
2388
|
-
}
|
|
2389
|
-
function translateOf(value) {
|
|
2390
|
-
const [x = 0, y = 0] = value === "none" ? [] : value.split(" ").map((part) => parseFloat(part));
|
|
2391
|
-
return { x: Number.isFinite(x) ? x : 0, y: Number.isFinite(y) ? y : 0 };
|
|
2392
|
-
}
|
|
2393
|
-
|
|
2394
2359
|
// src/ui/drag.ts
|
|
2395
2360
|
function createDrag(context) {
|
|
2396
2361
|
const { host, wrap, handle, panel } = context;
|
|
@@ -2669,7 +2634,7 @@ var PANE = { openPane, paneView, onPane, retitlePane, showPane };
|
|
|
2669
2634
|
function here(element) {
|
|
2670
2635
|
return element.isConnected && element.ownerDocument.defaultView !== null;
|
|
2671
2636
|
}
|
|
2672
|
-
function createInspector(context, load = () => import("./elementsview-
|
|
2637
|
+
function createInspector(context, load = () => import("./elementsview-k6zvvcne.js").then(({ createElementsView }) => ({ createStylesView: createElementsView })), pane = PANE) {
|
|
2673
2638
|
const { inspect, tips, prefs } = context;
|
|
2674
2639
|
const listeners = new Set;
|
|
2675
2640
|
let view = null;
|
|
@@ -2687,6 +2652,14 @@ function createInspector(context, load = () => import("./elementsview-2z4pkrdz.j
|
|
|
2687
2652
|
function current() {
|
|
2688
2653
|
return held && here(held) ? held : null;
|
|
2689
2654
|
}
|
|
2655
|
+
function pageBody() {
|
|
2656
|
+
try {
|
|
2657
|
+
const page = framed ? frameWindow()?.document : typeof document === "undefined" ? undefined : document;
|
|
2658
|
+
return page?.body ?? null;
|
|
2659
|
+
} catch {
|
|
2660
|
+
return null;
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2690
2663
|
function point(element) {
|
|
2691
2664
|
if (element && inspect.isOn())
|
|
2692
2665
|
return;
|
|
@@ -2722,7 +2695,9 @@ function createInspector(context, load = () => import("./elementsview-2z4pkrdz.j
|
|
|
2722
2695
|
},
|
|
2723
2696
|
...prefs && {
|
|
2724
2697
|
mode: { get: () => prefs.get().stylesMode, set: prefs.setStylesMode },
|
|
2725
|
-
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox }
|
|
2698
|
+
box: { get: () => prefs.get().stylesBox, set: prefs.setStylesBox },
|
|
2699
|
+
diff: { get: () => prefs.get().changesDiff, set: prefs.setChangesDiff },
|
|
2700
|
+
htmlSize: { get: () => ({ height: prefs.get().htmlHeight, full: prefs.get().htmlFull }), set: prefs.setHtmlSize }
|
|
2726
2701
|
}
|
|
2727
2702
|
});
|
|
2728
2703
|
view = made;
|
|
@@ -2806,6 +2781,18 @@ function createInspector(context, load = () => import("./elementsview-2z4pkrdz.j
|
|
|
2806
2781
|
else
|
|
2807
2782
|
inspect.set(true);
|
|
2808
2783
|
},
|
|
2784
|
+
elements() {
|
|
2785
|
+
if (inspect.isOn())
|
|
2786
|
+
inspect.set(false);
|
|
2787
|
+
if (!current()) {
|
|
2788
|
+
const body = pageBody();
|
|
2789
|
+
if (view)
|
|
2790
|
+
view.show(body);
|
|
2791
|
+
else
|
|
2792
|
+
hold(body);
|
|
2793
|
+
}
|
|
2794
|
+
reveal2();
|
|
2795
|
+
},
|
|
2809
2796
|
picked() {
|
|
2810
2797
|
const element = current();
|
|
2811
2798
|
return element ? label(element) : null;
|
|
@@ -4074,296 +4061,6 @@ function createPalette(context) {
|
|
|
4074
4061
|
};
|
|
4075
4062
|
}
|
|
4076
4063
|
|
|
4077
|
-
// src/ui/size.ts
|
|
4078
|
-
var LIST_WIDTH = 240;
|
|
4079
|
-
var VIEW_WIDTH = PANE_WIDTH;
|
|
4080
|
-
var LIST_MIN = 240;
|
|
4081
|
-
var VIEW_MIN = 280;
|
|
4082
|
-
var WIDTH_MAX = 720;
|
|
4083
|
-
var PAGE_ROOM = 96;
|
|
4084
|
-
function pageRoom(docked) {
|
|
4085
|
-
return docked ? PAGE_MIN : PAGE_ROOM;
|
|
4086
|
-
}
|
|
4087
|
-
var WIDTH_STEP = 16;
|
|
4088
|
-
var HANDLE_REACH = 21;
|
|
4089
|
-
function widthLimits(showing, view, page = PAGE_ROOM) {
|
|
4090
|
-
const min = showing === "view" ? VIEW_MIN : LIST_MIN;
|
|
4091
|
-
return { min, max: Math.max(min, Math.min(WIDTH_MAX, view - page)) };
|
|
4092
|
-
}
|
|
4093
|
-
function widthIn(showing, wanted, view, page = PAGE_ROOM) {
|
|
4094
|
-
const { min, max } = widthLimits(showing, view, page);
|
|
4095
|
-
const room = view - HANDLE_REACH - PANEL_GAP;
|
|
4096
|
-
return Math.max(LIST_MIN, Math.min(Math.round(between(wanted, min, max)), room));
|
|
4097
|
-
}
|
|
4098
|
-
function dragWidth(from, travel, side) {
|
|
4099
|
-
return from + (side === "right" ? -travel : travel);
|
|
4100
|
-
}
|
|
4101
|
-
function keyWidth(key, width, limits, side) {
|
|
4102
|
-
if (key === "Home")
|
|
4103
|
-
return limits.min;
|
|
4104
|
-
if (key === "End")
|
|
4105
|
-
return limits.max;
|
|
4106
|
-
if (key !== "ArrowLeft" && key !== "ArrowRight")
|
|
4107
|
-
return null;
|
|
4108
|
-
const wider = key === "ArrowLeft" === (side === "right");
|
|
4109
|
-
return between(width + (wider ? WIDTH_STEP : -WIDTH_STEP), limits.min, limits.max);
|
|
4110
|
-
}
|
|
4111
|
-
function widthGlides(cue) {
|
|
4112
|
-
return !cue.first && !cue.dragging && !cue.resizing;
|
|
4113
|
-
}
|
|
4114
|
-
function createSizer(context) {
|
|
4115
|
-
const { host, wrap, panel, prefs } = context;
|
|
4116
|
-
const strip = document.createElement("div");
|
|
4117
|
-
strip.className = "sizer";
|
|
4118
|
-
strip.tabIndex = 0;
|
|
4119
|
-
strip.setAttribute("role", "separator");
|
|
4120
|
-
strip.setAttribute("aria-orientation", "vertical");
|
|
4121
|
-
strip.setAttribute("aria-label", "panel width");
|
|
4122
|
-
let shown2 = null;
|
|
4123
|
-
let held = null;
|
|
4124
|
-
function viewWidth() {
|
|
4125
|
-
return document.documentElement.clientWidth || window.innerWidth;
|
|
4126
|
-
}
|
|
4127
|
-
function put(width) {
|
|
4128
|
-
wrap.style.setProperty("--panel-width", `${width}px`);
|
|
4129
|
-
}
|
|
4130
|
-
function apply(draw, resizing) {
|
|
4131
|
-
const showing = context.showing();
|
|
4132
|
-
const view = viewWidth();
|
|
4133
|
-
const kept = showing === "view" ? prefs.get().viewWidth : prefs.get().listWidth;
|
|
4134
|
-
const page = pageRoom(context.place().docked);
|
|
4135
|
-
const next = widthIn(showing, held?.showing === showing ? held.width : kept, view, page);
|
|
4136
|
-
const from = shown2;
|
|
4137
|
-
const limits = widthLimits(showing, view, page);
|
|
4138
|
-
strip.setAttribute("aria-valuemin", String(limits.min));
|
|
4139
|
-
strip.setAttribute("aria-valuemax", String(limits.max));
|
|
4140
|
-
if (next === from || from !== null && !context.place().open) {
|
|
4141
|
-
draw?.();
|
|
4142
|
-
return;
|
|
4143
|
-
}
|
|
4144
|
-
strip.setAttribute("aria-valuenow", String(next));
|
|
4145
|
-
const glide = widthGlides({ first: from === null, dragging: held !== null, resizing });
|
|
4146
|
-
shown2 = next;
|
|
4147
|
-
context.wide(next);
|
|
4148
|
-
host.style.width = `${HANDLE_REACH + next}px`;
|
|
4149
|
-
panel.style.transitionProperty = "none";
|
|
4150
|
-
put(next);
|
|
4151
|
-
draw?.();
|
|
4152
|
-
if (glide && from !== null)
|
|
4153
|
-
put(from);
|
|
4154
|
-
panel.getBoundingClientRect();
|
|
4155
|
-
panel.style.transitionProperty = "";
|
|
4156
|
-
put(next);
|
|
4157
|
-
if (from !== null)
|
|
4158
|
-
context.sized(glide);
|
|
4159
|
-
}
|
|
4160
|
-
function end(keep) {
|
|
4161
|
-
if (!held)
|
|
4162
|
-
return;
|
|
4163
|
-
const { showing, pointer, width, moved } = held;
|
|
4164
|
-
held = null;
|
|
4165
|
-
delete wrap.dataset.sizing;
|
|
4166
|
-
if (strip.hasPointerCapture(pointer))
|
|
4167
|
-
strip.releasePointerCapture(pointer);
|
|
4168
|
-
if (keep && moved)
|
|
4169
|
-
prefs.setWidth(showing, width);
|
|
4170
|
-
else
|
|
4171
|
-
apply(undefined, false);
|
|
4172
|
-
}
|
|
4173
|
-
strip.addEventListener("pointerdown", (event) => {
|
|
4174
|
-
if (event.button !== 0 || held || shown2 === null)
|
|
4175
|
-
return;
|
|
4176
|
-
held = {
|
|
4177
|
-
showing: context.showing(),
|
|
4178
|
-
pointer: event.pointerId,
|
|
4179
|
-
from: shown2,
|
|
4180
|
-
x: event.clientX,
|
|
4181
|
-
width: shown2,
|
|
4182
|
-
moved: false
|
|
4183
|
-
};
|
|
4184
|
-
wrap.dataset.sizing = "true";
|
|
4185
|
-
strip.setPointerCapture(event.pointerId);
|
|
4186
|
-
});
|
|
4187
|
-
strip.addEventListener("pointermove", (event) => {
|
|
4188
|
-
if (!held || event.pointerId !== held.pointer)
|
|
4189
|
-
return;
|
|
4190
|
-
const { side, docked } = context.place();
|
|
4191
|
-
const wanted = dragWidth(held.from, event.clientX - held.x, side);
|
|
4192
|
-
const width = widthIn(held.showing, wanted, viewWidth(), pageRoom(docked));
|
|
4193
|
-
if (width === held.width)
|
|
4194
|
-
return;
|
|
4195
|
-
held.width = width;
|
|
4196
|
-
held.moved = true;
|
|
4197
|
-
apply(undefined, false);
|
|
4198
|
-
});
|
|
4199
|
-
strip.addEventListener("pointerup", (event) => {
|
|
4200
|
-
if (event.pointerId === held?.pointer)
|
|
4201
|
-
end(true);
|
|
4202
|
-
});
|
|
4203
|
-
strip.addEventListener("pointercancel", (event) => {
|
|
4204
|
-
if (event.pointerId === held?.pointer)
|
|
4205
|
-
end(false);
|
|
4206
|
-
});
|
|
4207
|
-
strip.addEventListener("lostpointercapture", (event) => {
|
|
4208
|
-
if (event.pointerId === held?.pointer)
|
|
4209
|
-
end(false);
|
|
4210
|
-
});
|
|
4211
|
-
strip.addEventListener("dblclick", () => {
|
|
4212
|
-
const showing = context.showing();
|
|
4213
|
-
prefs.setWidth(showing, showing === "view" ? VIEW_WIDTH : LIST_WIDTH);
|
|
4214
|
-
});
|
|
4215
|
-
strip.addEventListener("keydown", (event) => {
|
|
4216
|
-
if (shown2 === null || event.altKey || event.ctrlKey || event.metaKey)
|
|
4217
|
-
return;
|
|
4218
|
-
const showing = context.showing();
|
|
4219
|
-
const { side, docked } = context.place();
|
|
4220
|
-
const limits = widthLimits(showing, viewWidth(), pageRoom(docked));
|
|
4221
|
-
const next = keyWidth(event.key, shown2, limits, side);
|
|
4222
|
-
if (next === null)
|
|
4223
|
-
return;
|
|
4224
|
-
event.preventDefault();
|
|
4225
|
-
prefs.setWidth(showing, next);
|
|
4226
|
-
});
|
|
4227
|
-
return {
|
|
4228
|
-
strip,
|
|
4229
|
-
size: (draw) => apply(draw, false),
|
|
4230
|
-
fit: () => apply(undefined, true),
|
|
4231
|
-
cancel: () => end(false)
|
|
4232
|
-
};
|
|
4233
|
-
}
|
|
4234
|
-
|
|
4235
|
-
// src/ui/prefs.ts
|
|
4236
|
-
var PREFS_KEY = "devknobs:prefs";
|
|
4237
|
-
var PREFS_VERSION = 4;
|
|
4238
|
-
var STYLES_MODE = "simple";
|
|
4239
|
-
var STYLES_BOX = true;
|
|
4240
|
-
var WIDTH_OF = { list: "listWidth", view: "viewWidth" };
|
|
4241
|
-
function readPrefs(json) {
|
|
4242
|
-
let value = null;
|
|
4243
|
-
try {
|
|
4244
|
-
value = json ? JSON.parse(json) : null;
|
|
4245
|
-
} catch {
|
|
4246
|
-
return {};
|
|
4247
|
-
}
|
|
4248
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
4249
|
-
return {};
|
|
4250
|
-
if (newer(value, PREFS_VERSION))
|
|
4251
|
-
return {};
|
|
4252
|
-
const prefs = {};
|
|
4253
|
-
const handle = Reflect.get(value, "handle");
|
|
4254
|
-
if (typeof handle === "boolean")
|
|
4255
|
-
prefs.handle = handle;
|
|
4256
|
-
for (const key of [WIDTH_OF.list, WIDTH_OF.view]) {
|
|
4257
|
-
const width = Reflect.get(value, key);
|
|
4258
|
-
if (typeof width === "number" && Number.isFinite(width) && width > 0)
|
|
4259
|
-
prefs[key] = width;
|
|
4260
|
-
}
|
|
4261
|
-
const mode = Reflect.get(value, "stylesMode");
|
|
4262
|
-
if (mode === "simple" || mode === "advanced")
|
|
4263
|
-
prefs.stylesMode = mode;
|
|
4264
|
-
const box = Reflect.get(value, "stylesBox");
|
|
4265
|
-
if (typeof box === "boolean")
|
|
4266
|
-
prefs.stylesBox = box;
|
|
4267
|
-
return prefs;
|
|
4268
|
-
}
|
|
4269
|
-
function resolvePrefs(base, stored) {
|
|
4270
|
-
return { ...base, ...stored };
|
|
4271
|
-
}
|
|
4272
|
-
function loadPrefs() {
|
|
4273
|
-
try {
|
|
4274
|
-
return readPrefs(webStorage("local")?.getItem(PREFS_KEY));
|
|
4275
|
-
} catch {
|
|
4276
|
-
return {};
|
|
4277
|
-
}
|
|
4278
|
-
}
|
|
4279
|
-
function keepPrefs(prefs) {
|
|
4280
|
-
try {
|
|
4281
|
-
if (Object.keys(prefs).length === 0)
|
|
4282
|
-
webStorage("local")?.removeItem(PREFS_KEY);
|
|
4283
|
-
else
|
|
4284
|
-
webStorage("local")?.setItem(PREFS_KEY, JSON.stringify(stamped(prefs, PREFS_VERSION)));
|
|
4285
|
-
} catch {}
|
|
4286
|
-
}
|
|
4287
|
-
function createPrefs(options2 = {}) {
|
|
4288
|
-
const base = {
|
|
4289
|
-
handle: options2.handle !== false,
|
|
4290
|
-
listWidth: LIST_WIDTH,
|
|
4291
|
-
viewWidth: VIEW_WIDTH,
|
|
4292
|
-
stylesMode: STYLES_MODE,
|
|
4293
|
-
stylesBox: STYLES_BOX
|
|
4294
|
-
};
|
|
4295
|
-
let stored = loadPrefs();
|
|
4296
|
-
let prefs = resolvePrefs(base, stored);
|
|
4297
|
-
const listeners = new Set;
|
|
4298
|
-
function changed() {
|
|
4299
|
-
prefs = resolvePrefs(base, stored);
|
|
4300
|
-
for (const listener of Array.from(listeners))
|
|
4301
|
-
listener();
|
|
4302
|
-
}
|
|
4303
|
-
function keep(next) {
|
|
4304
|
-
stored = next;
|
|
4305
|
-
keepPrefs(stored);
|
|
4306
|
-
changed();
|
|
4307
|
-
}
|
|
4308
|
-
function onStorage(event) {
|
|
4309
|
-
if (event.key !== PREFS_KEY && event.key !== null)
|
|
4310
|
-
return;
|
|
4311
|
-
if (fresh())
|
|
4312
|
-
return;
|
|
4313
|
-
stored = loadPrefs();
|
|
4314
|
-
changed();
|
|
4315
|
-
}
|
|
4316
|
-
if (typeof window !== "undefined")
|
|
4317
|
-
window.addEventListener("storage", onStorage);
|
|
4318
|
-
return {
|
|
4319
|
-
get: () => prefs,
|
|
4320
|
-
setHandle(on) {
|
|
4321
|
-
const next = { ...stored };
|
|
4322
|
-
if (on === base.handle)
|
|
4323
|
-
delete next.handle;
|
|
4324
|
-
else
|
|
4325
|
-
next.handle = on;
|
|
4326
|
-
keep(next);
|
|
4327
|
-
},
|
|
4328
|
-
setWidth(showing, px) {
|
|
4329
|
-
const key = WIDTH_OF[showing];
|
|
4330
|
-
const next = { ...stored };
|
|
4331
|
-
if (px === base[key])
|
|
4332
|
-
delete next[key];
|
|
4333
|
-
else
|
|
4334
|
-
next[key] = px;
|
|
4335
|
-
keep(next);
|
|
4336
|
-
},
|
|
4337
|
-
setStylesMode(mode) {
|
|
4338
|
-
const next = { ...stored };
|
|
4339
|
-
if (mode === base.stylesMode)
|
|
4340
|
-
delete next.stylesMode;
|
|
4341
|
-
else
|
|
4342
|
-
next.stylesMode = mode;
|
|
4343
|
-
keep(next);
|
|
4344
|
-
},
|
|
4345
|
-
setStylesBox(open) {
|
|
4346
|
-
const next = { ...stored };
|
|
4347
|
-
if (open === base.stylesBox)
|
|
4348
|
-
delete next.stylesBox;
|
|
4349
|
-
else
|
|
4350
|
-
next.stylesBox = open;
|
|
4351
|
-
keep(next);
|
|
4352
|
-
},
|
|
4353
|
-
subscribe(listener) {
|
|
4354
|
-
listeners.add(listener);
|
|
4355
|
-
return () => {
|
|
4356
|
-
listeners.delete(listener);
|
|
4357
|
-
};
|
|
4358
|
-
},
|
|
4359
|
-
destroy() {
|
|
4360
|
-
listeners.clear();
|
|
4361
|
-
if (typeof window !== "undefined")
|
|
4362
|
-
window.removeEventListener("storage", onStorage);
|
|
4363
|
-
}
|
|
4364
|
-
};
|
|
4365
|
-
}
|
|
4366
|
-
|
|
4367
4064
|
// src/ui/requestformat.ts
|
|
4368
4065
|
var LIGHT_WHY = "the browser gives a page only timing and size for this";
|
|
4369
4066
|
var HIDDEN = "<hidden>";
|
|
@@ -6632,6 +6329,7 @@ var HANDLE_HINT = 4000;
|
|
|
6632
6329
|
function handleHint(keys, mac) {
|
|
6633
6330
|
return `press ${comboLabel(keys.panel, mac)} to open knobs`;
|
|
6634
6331
|
}
|
|
6332
|
+
var REAL_PHONE_HINT = "sends the phone's user agent to sites, so they serve their mobile site. some sites may sign you out.";
|
|
6635
6333
|
function createSettings(context) {
|
|
6636
6334
|
const { keys, prefs, grab, mac, bindingsHere, keysToggle, said, tips, render, renderKeys } = context;
|
|
6637
6335
|
const keysView = el("div", "keys pane");
|
|
@@ -6698,6 +6396,23 @@ function createSettings(context) {
|
|
|
6698
6396
|
row.append(hint);
|
|
6699
6397
|
keysView.append(row);
|
|
6700
6398
|
}
|
|
6399
|
+
const realPhoneSwitch = button("switch row-control", "");
|
|
6400
|
+
if (context.realPhone) {
|
|
6401
|
+
realPhoneSwitch.setAttribute("role", "switch");
|
|
6402
|
+
realPhoneSwitch.setAttribute("aria-label", "real phone mode");
|
|
6403
|
+
const hint = el("div", "row-hint", REAL_PHONE_HINT);
|
|
6404
|
+
hint.id = "devknobs-real-phone-hint";
|
|
6405
|
+
realPhoneSwitch.setAttribute("aria-describedby", hint.id);
|
|
6406
|
+
const row = rowBox({
|
|
6407
|
+
main: el("div", "main"),
|
|
6408
|
+
glyph: icon("smartphone"),
|
|
6409
|
+
title: "real phone mode",
|
|
6410
|
+
ends: [realPhoneSwitch]
|
|
6411
|
+
}).box;
|
|
6412
|
+
row.append(hint);
|
|
6413
|
+
keysView.append(row);
|
|
6414
|
+
realPhoneSwitch.addEventListener("click", () => context.setRealPhone(realPhoneSwitch.getAttribute("aria-checked") !== "true"));
|
|
6415
|
+
}
|
|
6701
6416
|
const devIconSwitch = button("switch row-control", "");
|
|
6702
6417
|
devIconSwitch.setAttribute("role", "switch");
|
|
6703
6418
|
devIconSwitch.setAttribute("aria-label", "dev tab icon");
|
|
@@ -6842,6 +6557,9 @@ function createSettings(context) {
|
|
|
6842
6557
|
drawDevIcon(shown2) {
|
|
6843
6558
|
mark(devIconSwitch, shown2, "aria-checked");
|
|
6844
6559
|
},
|
|
6560
|
+
drawRealPhone(on) {
|
|
6561
|
+
mark(realPhoneSwitch, on, "aria-checked");
|
|
6562
|
+
},
|
|
6845
6563
|
drawNative(on, note) {
|
|
6846
6564
|
mark(nativeSwitch2, on, "aria-checked");
|
|
6847
6565
|
const hint = note ?? native?.hint ?? "";
|
|
@@ -6862,6 +6580,7 @@ function createSettings(context) {
|
|
|
6862
6580
|
return true;
|
|
6863
6581
|
},
|
|
6864
6582
|
stopRecording,
|
|
6583
|
+
openKeys,
|
|
6865
6584
|
leaveKeys,
|
|
6866
6585
|
destroy: stopRefusing
|
|
6867
6586
|
};
|
|
@@ -6911,7 +6630,7 @@ var CSS = `
|
|
|
6911
6630
|
--edge: 0px;
|
|
6912
6631
|
--edge-line: transparent;
|
|
6913
6632
|
--glide: 220ms;
|
|
6914
|
-
--panel-width:
|
|
6633
|
+
--panel-width: 320px;
|
|
6915
6634
|
/* The columns: what a row keeps clear inside its edges, an icon's width,
|
|
6916
6635
|
the room between an icon and its word, and how far in a line of words
|
|
6917
6636
|
starts and ends. */
|
|
@@ -7018,6 +6737,7 @@ button {
|
|
|
7018
6737
|
}
|
|
7019
6738
|
:focus { outline: none; }
|
|
7020
6739
|
button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
6740
|
+
input[type="checkbox"]:focus-visible { outline: 1px solid var(--faint); outline-offset: 1px; }
|
|
7021
6741
|
|
|
7022
6742
|
.handle {
|
|
7023
6743
|
flex: none;
|
|
@@ -7105,7 +6825,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
7105
6825
|
would stay on the window's edge as a line the panel's height. It hides
|
|
7106
6826
|
once the slide is over. The edge side's border and the padding that pays
|
|
7107
6827
|
for it go once its color has eased out. The width glides to a new one, as
|
|
7108
|
-
|
|
6828
|
+
the strip's keys set it, and the panel turns that off under the strip. */
|
|
7109
6829
|
visibility: hidden;
|
|
7110
6830
|
transition: visibility 0s linear 150ms, border-top-right-radius var(--glide) ease-out,
|
|
7111
6831
|
border-bottom-right-radius var(--glide) ease-out, border-right-color var(--glide) ease-out,
|
|
@@ -8269,6 +7989,7 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8269
7989
|
user-select: text;
|
|
8270
7990
|
-webkit-user-select: text;
|
|
8271
7991
|
}
|
|
7992
|
+
.dom-row { position: relative; }
|
|
8272
7993
|
.dom-row:hover { background: var(--card); }
|
|
8273
7994
|
.dom-row.on { background: var(--card); }
|
|
8274
7995
|
.dom-tree:focus-within .dom-row.on { background: var(--pick); }
|
|
@@ -8276,6 +7997,110 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8276
7997
|
.dom-code { flex: 0 1 auto; min-width: 30ch; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--fg); }
|
|
8277
7998
|
.dom-ref { white-space: pre; color: var(--faint); }
|
|
8278
7999
|
.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; }
|
|
8000
|
+
/* A line whose element the panel hid, faint as its box on the page is gone. */
|
|
8001
|
+
.dom-hid > .dom-code { opacity: 0.5; }
|
|
8002
|
+
/* The html editor: line numbers on the card's fill beside the text, which is
|
|
8003
|
+
colored by the pre under a clear text box, the two set alike to the
|
|
8004
|
+
pixel, a scrollbar's room kept in both, so a long line wraps at the same
|
|
8005
|
+
place in each and its number stays at its first row. The grip under it
|
|
8006
|
+
drags its height, the button makes it the panel's. */
|
|
8007
|
+
.dom-code:has(> .html-ed), .dom-code:has(> .dom-edit) { flex: 1 1 auto; }
|
|
8008
|
+
.dom-code > .html-ed { display: block; width: 100%; min-width: 30ch; margin: 2px 0; }
|
|
8009
|
+
.html-ed-body {
|
|
8010
|
+
overflow: hidden;
|
|
8011
|
+
background: var(--bg);
|
|
8012
|
+
border-radius: 4px;
|
|
8013
|
+
box-shadow: inset 0 0 0 1px var(--faint);
|
|
8014
|
+
}
|
|
8015
|
+
.html-ed-code {
|
|
8016
|
+
position: relative;
|
|
8017
|
+
height: 100%;
|
|
8018
|
+
overflow: hidden;
|
|
8019
|
+
background: linear-gradient(var(--card), var(--card)) no-repeat;
|
|
8020
|
+
}
|
|
8021
|
+
.html-ed-hl, .html-ed .dom-html {
|
|
8022
|
+
position: absolute;
|
|
8023
|
+
inset: 0;
|
|
8024
|
+
margin: 0;
|
|
8025
|
+
padding: 4px var(--col-pad);
|
|
8026
|
+
font: 11px/1.6 var(--mono);
|
|
8027
|
+
letter-spacing: normal;
|
|
8028
|
+
white-space: pre-wrap;
|
|
8029
|
+
tab-size: 2;
|
|
8030
|
+
overflow-wrap: anywhere;
|
|
8031
|
+
word-break: normal;
|
|
8032
|
+
scrollbar-gutter: stable;
|
|
8033
|
+
scrollbar-width: thin;
|
|
8034
|
+
}
|
|
8035
|
+
.html-ed-hl { padding-left: 0; overflow: hidden; color: var(--fg); pointer-events: none; }
|
|
8036
|
+
.html-ed-hl > .html-ed-inner { display: grid; }
|
|
8037
|
+
.html-ed-num {
|
|
8038
|
+
padding: 0 var(--col-pad);
|
|
8039
|
+
color: var(--faint);
|
|
8040
|
+
text-align: right;
|
|
8041
|
+
user-select: none;
|
|
8042
|
+
-webkit-user-select: none;
|
|
8043
|
+
}
|
|
8044
|
+
.html-ed-text { min-height: 1.6em; padding-left: var(--col-pad); }
|
|
8045
|
+
.html-ed .dom-html {
|
|
8046
|
+
width: 100%;
|
|
8047
|
+
height: 100%;
|
|
8048
|
+
max-height: none;
|
|
8049
|
+
overflow: auto;
|
|
8050
|
+
resize: none;
|
|
8051
|
+
color: transparent;
|
|
8052
|
+
caret-color: var(--fg);
|
|
8053
|
+
background: transparent;
|
|
8054
|
+
border-radius: 0;
|
|
8055
|
+
box-shadow: none;
|
|
8056
|
+
scrollbar-width: thin;
|
|
8057
|
+
}
|
|
8058
|
+
.html-ed .dom-html::selection { background: color-mix(in srgb, var(--faint) 35%, transparent); }
|
|
8059
|
+
.html-ed .dom-html.bad { caret-color: var(--hot); }
|
|
8060
|
+
.html-ed:has(.bad) > .html-ed-body { box-shadow: inset 0 0 0 1px var(--hot); }
|
|
8061
|
+
.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; }
|
|
8062
|
+
.html-ed-grip { flex: 1 1 auto; display: grid; place-items: center; height: 12px; cursor: ns-resize; touch-action: none; }
|
|
8063
|
+
.html-ed-grip::after { content: ""; width: 32px; height: 3px; background: var(--line); border-radius: 2px; transition: background 120ms ease-out; }
|
|
8064
|
+
.html-ed-grip:hover::after { background: var(--faint); }
|
|
8065
|
+
.dom-code > .dom-apply { margin: 4px 0 2px; }
|
|
8066
|
+
/* The selected line's actions, kept in sight at the foot of the tree as it scrolls either way. */
|
|
8067
|
+
.dom-acts {
|
|
8068
|
+
position: sticky;
|
|
8069
|
+
left: 0;
|
|
8070
|
+
bottom: 0;
|
|
8071
|
+
display: flex;
|
|
8072
|
+
flex-wrap: wrap;
|
|
8073
|
+
gap: 4px;
|
|
8074
|
+
padding: 4px var(--view-end) 4px var(--view-start);
|
|
8075
|
+
background: var(--bg);
|
|
8076
|
+
border-top: 1px solid var(--line);
|
|
8077
|
+
}
|
|
8078
|
+
/* The handle that drags an element's line, at the start of its step in: on
|
|
8079
|
+
hover and on the selected line, and always under a finger. The line being
|
|
8080
|
+
dragged is faint; where it would go is a line over or under another, or
|
|
8081
|
+
a ring around the element it would go into. */
|
|
8082
|
+
.dom-grip {
|
|
8083
|
+
position: absolute;
|
|
8084
|
+
top: 0;
|
|
8085
|
+
width: 1.2em;
|
|
8086
|
+
line-height: 1.6;
|
|
8087
|
+
text-align: center;
|
|
8088
|
+
color: var(--faint);
|
|
8089
|
+
cursor: grab;
|
|
8090
|
+
opacity: 0;
|
|
8091
|
+
touch-action: none;
|
|
8092
|
+
user-select: none;
|
|
8093
|
+
-webkit-user-select: none;
|
|
8094
|
+
transition: opacity 120ms ease-out;
|
|
8095
|
+
}
|
|
8096
|
+
.dom-row:hover > .dom-grip, .dom-row.on > .dom-grip { opacity: 1; }
|
|
8097
|
+
@media (hover: none) { .dom-grip { opacity: 0.6; } }
|
|
8098
|
+
.dom-grip:hover { color: var(--fg); }
|
|
8099
|
+
.dom-drag, .dom-drag * { cursor: grabbing; }
|
|
8100
|
+
.dom-dragging > .dom-code { opacity: 0.45; }
|
|
8101
|
+
.dom-drop-before { box-shadow: inset 0 2px 0 var(--fg); }
|
|
8102
|
+
.dom-drop-after { box-shadow: inset 0 -2px 0 var(--fg); }
|
|
8103
|
+
.dom-drop-into { box-shadow: inset 0 0 0 1px var(--fg); }
|
|
8279
8104
|
.dom-flash { animation: dom-flash 900ms ease-out; }
|
|
8280
8105
|
@keyframes dom-flash {
|
|
8281
8106
|
from { background: var(--pick); }
|
|
@@ -8340,8 +8165,9 @@ button:focus-visible { outline: 1px solid var(--faint); outline-offset: -1px; }
|
|
|
8340
8165
|
text-overflow: ellipsis;
|
|
8341
8166
|
white-space: nowrap;
|
|
8342
8167
|
}
|
|
8343
|
-
/* A declaration that wraps goes on further in than it starts.
|
|
8344
|
-
|
|
8168
|
+
/* A declaration that wraps goes on further in than it starts. Every line
|
|
8169
|
+
keeps the gutter an editable line's box stands in, so no text moves. */
|
|
8170
|
+
.css-decl { display: block; padding-left: 30px; text-indent: -12px; text-decoration: none; }
|
|
8345
8171
|
/* A name has the color of a key, its value the text's, and the marks between
|
|
8346
8172
|
them are quiet. A declaration that is struck through is quiet all over. */
|
|
8347
8173
|
.css-name { color: var(--key); }
|
|
@@ -8389,10 +8215,143 @@ s.css-decl, s.css-decl .css-var, s.css-decl .css-name { color: var(--faint); tex
|
|
|
8389
8215
|
padding-right: var(--view-end);
|
|
8390
8216
|
padding-left: var(--view-start);
|
|
8391
8217
|
}
|
|
8392
|
-
.css-applied .css-decl { padding-left: 12px; }
|
|
8393
8218
|
.css-label { font-size: 10.5px; color: var(--faint); }
|
|
8394
8219
|
.css-comes { color: var(--faint); }
|
|
8395
8220
|
.css-hidden { padding: 2px var(--view-end) 2px var(--view-start); font-size: 10.5px; color: var(--faint); overflow-wrap: anywhere; }
|
|
8221
|
+
/* Editing, as in the browsers' tools: a checkbox in a line's gutter turns
|
|
8222
|
+
it off and on, shown on hover, on focus and on a line that is off. Its
|
|
8223
|
+
ring and its check are cut out of a fill by a mask, so they follow the
|
|
8224
|
+
theme with no line drawn. A value is a
|
|
8225
|
+
field on a click, as wide as what it holds, on the track's fill, its text
|
|
8226
|
+
red where the page did not take it. Adding a property is a quiet line
|
|
8227
|
+
under a block, in from its edge as a declaration's first line is. */
|
|
8228
|
+
.css-decl.can-edit { position: relative; }
|
|
8229
|
+
.css-toggle {
|
|
8230
|
+
position: absolute;
|
|
8231
|
+
top: 2.5px;
|
|
8232
|
+
left: 2px;
|
|
8233
|
+
width: 12px;
|
|
8234
|
+
height: 12px;
|
|
8235
|
+
opacity: 0;
|
|
8236
|
+
background: var(--faint);
|
|
8237
|
+
border-radius: 3px;
|
|
8238
|
+
cursor: pointer;
|
|
8239
|
+
-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;
|
|
8240
|
+
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;
|
|
8241
|
+
transition: opacity 120ms ease-out;
|
|
8242
|
+
}
|
|
8243
|
+
.css-toggle:checked {
|
|
8244
|
+
background: var(--fg);
|
|
8245
|
+
-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");
|
|
8246
|
+
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");
|
|
8247
|
+
}
|
|
8248
|
+
.css-decl.can-edit:hover > .css-toggle, .css-toggle:focus-visible, .css-decl.off > .css-toggle { opacity: 1; }
|
|
8249
|
+
.css-editable { border-radius: 2px; cursor: text; }
|
|
8250
|
+
.css-editable:hover, .css-editable:focus-visible { background: var(--track); }
|
|
8251
|
+
/* A field wraps where its value is wider than its line, and grows down, as
|
|
8252
|
+
tall as what it holds up to a height it scrolls in: nothing scrolls sideways. */
|
|
8253
|
+
.css-edit {
|
|
8254
|
+
max-width: 100%;
|
|
8255
|
+
max-height: 18em;
|
|
8256
|
+
padding: 0;
|
|
8257
|
+
font: inherit;
|
|
8258
|
+
text-indent: 0;
|
|
8259
|
+
vertical-align: top;
|
|
8260
|
+
white-space: pre-wrap;
|
|
8261
|
+
overflow-wrap: anywhere;
|
|
8262
|
+
overflow: hidden auto;
|
|
8263
|
+
resize: none;
|
|
8264
|
+
scrollbar-width: thin;
|
|
8265
|
+
color: var(--fg);
|
|
8266
|
+
background: var(--track);
|
|
8267
|
+
border-radius: 2px;
|
|
8268
|
+
}
|
|
8269
|
+
.css-edit.bad { color: var(--hot); }
|
|
8270
|
+
/* The field's ring, as a chip's field has it while focused, in place of the browser's border. */
|
|
8271
|
+
.inline-field { border: 0; box-shadow: inset 0 0 0 1px var(--faint); }
|
|
8272
|
+
.css-add, .css-adding { padding-left: 18px; }
|
|
8273
|
+
.css-add, .css-new-rule {
|
|
8274
|
+
display: block;
|
|
8275
|
+
font: 11px/1.5 var(--mono);
|
|
8276
|
+
color: var(--faint);
|
|
8277
|
+
border-radius: 2px;
|
|
8278
|
+
transition: color 120ms ease-out;
|
|
8279
|
+
}
|
|
8280
|
+
.css-add:hover, .css-new-rule:hover { color: var(--fg); }
|
|
8281
|
+
.css-adding { text-indent: 0; }
|
|
8282
|
+
/* The suggestions under a field of the styles view: a raised list placed
|
|
8283
|
+
under the field, the one marked in the selected line's tint. */
|
|
8284
|
+
.ac-list {
|
|
8285
|
+
position: absolute;
|
|
8286
|
+
z-index: 3;
|
|
8287
|
+
display: grid;
|
|
8288
|
+
min-width: 16ch;
|
|
8289
|
+
max-width: 100%;
|
|
8290
|
+
max-height: 12.8em;
|
|
8291
|
+
overflow-y: auto;
|
|
8292
|
+
padding: 2px 0;
|
|
8293
|
+
font: 11px/1.6 var(--mono);
|
|
8294
|
+
text-indent: 0;
|
|
8295
|
+
white-space: nowrap;
|
|
8296
|
+
color: var(--fg);
|
|
8297
|
+
background: var(--raised);
|
|
8298
|
+
border-radius: 4px;
|
|
8299
|
+
box-shadow: var(--lift), 0 0 0 1px var(--line);
|
|
8300
|
+
scrollbar-width: thin;
|
|
8301
|
+
}
|
|
8302
|
+
.ac-item { padding: 0 var(--col-pad); overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
|
|
8303
|
+
.ac-item:hover { background: var(--card); }
|
|
8304
|
+
.ac-item[aria-selected="true"] { background: var(--pick); }
|
|
8305
|
+
/* The line that adds a rule stands under the blocks, as the start of one. */
|
|
8306
|
+
.css-new-rule { justify-self: start; padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8307
|
+
.css-rule-adding { padding: 2px var(--view-end) 2px var(--view-start); }
|
|
8308
|
+
/* The states a chip forces, in the editors' chips, the selector's font. */
|
|
8309
|
+
.force-states { padding: 0 var(--view-end) 4px var(--view-start); }
|
|
8310
|
+
.force-states .chip { font: 11px/22px var(--mono); }
|
|
8311
|
+
|
|
8312
|
+
/* The changes at the foot of the Elements view, which stay in sight while
|
|
8313
|
+
the styles scroll: a quiet head, each edit as diff lines tinted for what
|
|
8314
|
+
went and what came, then the buttons, the prompt the filled one. */
|
|
8315
|
+
.changes {
|
|
8316
|
+
position: sticky;
|
|
8317
|
+
bottom: 0;
|
|
8318
|
+
/* Over the styles' bar where the two meet, with a long list. */
|
|
8319
|
+
z-index: 2;
|
|
8320
|
+
display: grid;
|
|
8321
|
+
grid-template-columns: minmax(0, 1fr);
|
|
8322
|
+
gap: 6px;
|
|
8323
|
+
padding: 8px var(--view-end) 8px var(--view-start);
|
|
8324
|
+
background: var(--bg);
|
|
8325
|
+
border-top: 1px solid var(--line);
|
|
8326
|
+
}
|
|
8327
|
+
.changes-head, .changes-note { font-size: 10.5px; color: var(--faint); }
|
|
8328
|
+
/* The count is the button that folds the diff out, its chevron turned while it shows. */
|
|
8329
|
+
.changes-toggle { color: inherit; border-radius: 2px; transition: color 120ms ease-out; }
|
|
8330
|
+
.changes-toggle:hover { color: var(--fg); }
|
|
8331
|
+
.changes-toggle::before { content: "›"; display: inline-block; width: 2ch; text-align: left; transform-origin: 0.5ch 50%; transition: transform 120ms ease-out; }
|
|
8332
|
+
.changes-toggle[aria-expanded="true"]::before { transform: rotate(90deg); }
|
|
8333
|
+
/* What was made again as the page loaded, and the edits that were not. */
|
|
8334
|
+
.changes-kept { display: grid; gap: 2px; font-size: 11px; }
|
|
8335
|
+
.changes-kept-line { color: var(--fg); }
|
|
8336
|
+
.changes-wait { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
|
8337
|
+
.changes-missed { padding-left: var(--col-pad); font: 10.5px/1.5 var(--mono); color: var(--faint); overflow-wrap: anywhere; }
|
|
8338
|
+
/* The switch that keeps the edits after a reload, over the tree. */
|
|
8339
|
+
.keep-line { padding: 4px 0 6px; border-bottom: 1px solid var(--line); }
|
|
8340
|
+
.keep-line .knob-label { color: var(--fg); }
|
|
8341
|
+
.changes-list {
|
|
8342
|
+
max-height: 30vh;
|
|
8343
|
+
overflow: auto;
|
|
8344
|
+
font: 11px/1.5 var(--mono);
|
|
8345
|
+
overflow-wrap: anywhere;
|
|
8346
|
+
scrollbar-width: thin;
|
|
8347
|
+
}
|
|
8348
|
+
.diff-place { padding: 4px var(--col-pad) 0; color: var(--faint); }
|
|
8349
|
+
.diff-place:first-child { padding-top: 0; }
|
|
8350
|
+
.diff-del, .diff-add { padding: 0 var(--col-pad); border-radius: 2px; }
|
|
8351
|
+
.diff-del { background: color-mix(in srgb, var(--hot) 14%, transparent); }
|
|
8352
|
+
.diff-add { background: color-mix(in srgb, var(--ok) 14%, transparent); }
|
|
8353
|
+
.changes-acts { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
8354
|
+
.chip.changes-go, .chip.changes-go:hover { color: var(--bg); background: var(--fg); }
|
|
8396
8355
|
|
|
8397
8356
|
/* The element's box, in a fold of the kit's: a picture of the element, so
|
|
8398
8357
|
its areas are filled, each in the hue the page's own tint of it has, mixed
|
|
@@ -8710,6 +8669,11 @@ function ownCss(media) {
|
|
|
8710
8669
|
};
|
|
8711
8670
|
return CSS.replace(/@media ([^{]+)\{/g, settle2).replaceAll("color-scheme: light dark", `color-scheme: ${media.scheme}`);
|
|
8712
8671
|
}
|
|
8672
|
+
function resetPage(log = edits, reset2 = reset) {
|
|
8673
|
+
log.undoAll();
|
|
8674
|
+
clearForced();
|
|
8675
|
+
reset2();
|
|
8676
|
+
}
|
|
8713
8677
|
function createPanel(options2 = {}) {
|
|
8714
8678
|
const keys = options2.keys ?? createKeys();
|
|
8715
8679
|
const prefs = createPrefs({ handle: options2.handle });
|
|
@@ -8735,7 +8699,7 @@ function createPanel(options2 = {}) {
|
|
|
8735
8699
|
const flip = () => drag.flip();
|
|
8736
8700
|
stage.flip = flip;
|
|
8737
8701
|
const actionsHere = availableActions();
|
|
8738
|
-
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" || inspect !== null));
|
|
8702
|
+
const bindingsHere = BINDINGS.filter((binding) => (binding !== "grab" || grab !== null) && (binding !== "inspect" && binding !== "elements" || inspect !== null));
|
|
8739
8703
|
const host = document.createElement("div");
|
|
8740
8704
|
host.setAttribute("data-devknobs", "panel");
|
|
8741
8705
|
host.style.cssText = HOST_STYLE;
|
|
@@ -8809,6 +8773,8 @@ function createPanel(options2 = {}) {
|
|
|
8809
8773
|
showHandle: () => setState({ panel: { handle: true } }),
|
|
8810
8774
|
devIconShown: () => devIconShown(getState().panel.devIcon, window.location.hostname),
|
|
8811
8775
|
setDevIcon: (on) => setState({ panel: { devIcon: devIconFor(on, window.location.hostname) } }),
|
|
8776
|
+
realPhone: hostSendsUa(),
|
|
8777
|
+
setRealPhone: (on) => setState({ panel: { realPhone: on } }),
|
|
8812
8778
|
native: nativeSwitch()?.setting ?? null,
|
|
8813
8779
|
setNative: (on) => {
|
|
8814
8780
|
nativeSwitch()?.setting.change(on);
|
|
@@ -8842,7 +8808,6 @@ function createPanel(options2 = {}) {
|
|
|
8842
8808
|
wrap,
|
|
8843
8809
|
panel,
|
|
8844
8810
|
prefs,
|
|
8845
|
-
showing: () => viewing() ? "view" : "list",
|
|
8846
8811
|
place: () => getState().panel,
|
|
8847
8812
|
wide: setDockWidth,
|
|
8848
8813
|
sized: panelSized
|
|
@@ -8910,6 +8875,7 @@ function createPanel(options2 = {}) {
|
|
|
8910
8875
|
wrap.dataset.handle = handleShown ? "shown" : "hidden";
|
|
8911
8876
|
settings.drawHandle(handleShown);
|
|
8912
8877
|
settings.drawDevIcon(devIconShown(state.panel.devIcon, window.location.hostname));
|
|
8878
|
+
settings.drawRealPhone(state.panel.realPhone);
|
|
8913
8879
|
const nativeNow = nativeSwitch();
|
|
8914
8880
|
if (nativeNow)
|
|
8915
8881
|
settings.drawNative(nativeNow.on, nativeNow.note);
|
|
@@ -8931,7 +8897,7 @@ function createPanel(options2 = {}) {
|
|
|
8931
8897
|
rows.hidden = !anyShown;
|
|
8932
8898
|
const resetHint = hints.get("reset");
|
|
8933
8899
|
if (resetHint)
|
|
8934
|
-
resetHint.disabled = isReset(state);
|
|
8900
|
+
resetHint.disabled = isReset(state) && edits.list().length === 0;
|
|
8935
8901
|
badge.textContent = overflowBadge(state.overflow, live.overflow);
|
|
8936
8902
|
badge.hidden = badge.textContent === "";
|
|
8937
8903
|
badge.classList.toggle("hot", hot);
|
|
@@ -8995,7 +8961,7 @@ function createPanel(options2 = {}) {
|
|
|
8995
8961
|
searchInput.value = "";
|
|
8996
8962
|
for (const action of actionsHere)
|
|
8997
8963
|
stopAction(action);
|
|
8998
|
-
|
|
8964
|
+
resetPage();
|
|
8999
8965
|
}
|
|
9000
8966
|
function onInspect(on) {
|
|
9001
8967
|
const at = root.activeElement;
|
|
@@ -9042,9 +9008,17 @@ function createPanel(options2 = {}) {
|
|
|
9042
9008
|
actionOf("storage")?.run();
|
|
9043
9009
|
return;
|
|
9044
9010
|
}
|
|
9011
|
+
if (action === "requests" || action === "elements") {
|
|
9012
|
+
showView(action);
|
|
9013
|
+
return;
|
|
9014
|
+
}
|
|
9015
|
+
if (action === "settings") {
|
|
9016
|
+
showSettings();
|
|
9017
|
+
return;
|
|
9018
|
+
}
|
|
9045
9019
|
if (!getState().panel.open)
|
|
9046
9020
|
return;
|
|
9047
|
-
if (action === "replay"
|
|
9021
|
+
if (action === "replay")
|
|
9048
9022
|
actionOf(action)?.run();
|
|
9049
9023
|
else if (action === "reset")
|
|
9050
9024
|
runCommand("reset");
|
|
@@ -9053,6 +9027,31 @@ function createPanel(options2 = {}) {
|
|
|
9053
9027
|
else
|
|
9054
9028
|
toggle(false);
|
|
9055
9029
|
}
|
|
9030
|
+
function opensPanel(action) {
|
|
9031
|
+
return action === "toggle" || action === "storage" || action === "requests" || action === "settings" || action === "elements";
|
|
9032
|
+
}
|
|
9033
|
+
function showView(action) {
|
|
9034
|
+
const id = side.view();
|
|
9035
|
+
const mine = action === "requests" ? requests.shows() : id === STYLES_VIEW;
|
|
9036
|
+
if (mine && getState().panel.open && viewing()) {
|
|
9037
|
+
side.close();
|
|
9038
|
+
return;
|
|
9039
|
+
}
|
|
9040
|
+
if (mine && id !== null)
|
|
9041
|
+
side.show(id);
|
|
9042
|
+
else if (action === "requests")
|
|
9043
|
+
requestsHere.toggle();
|
|
9044
|
+
else
|
|
9045
|
+
inspector?.elements();
|
|
9046
|
+
}
|
|
9047
|
+
function showSettings() {
|
|
9048
|
+
if (getState().panel.open && settings.editing()) {
|
|
9049
|
+
settings.leaveKeys();
|
|
9050
|
+
return;
|
|
9051
|
+
}
|
|
9052
|
+
toggle(true);
|
|
9053
|
+
settings.openKeys();
|
|
9054
|
+
}
|
|
9056
9055
|
function escape() {
|
|
9057
9056
|
if (drag.dragging() || !getState().panel.open)
|
|
9058
9057
|
return;
|
|
@@ -9102,8 +9101,8 @@ function createPanel(options2 = {}) {
|
|
|
9102
9101
|
event.stopPropagation();
|
|
9103
9102
|
return;
|
|
9104
9103
|
}
|
|
9105
|
-
const action = keyAction(event, keys.get());
|
|
9106
|
-
const acts = action !== null && action !== "close" && !drag.dragging() && (action
|
|
9104
|
+
const action = keyAction(event, keysListed(keys.get(), bindingsHere));
|
|
9105
|
+
const acts = action !== null && action !== "close" && !drag.dragging() && (opensPanel(action) || getState().panel.open);
|
|
9107
9106
|
const inSearch = event.composedPath()[0] === searchInput;
|
|
9108
9107
|
if (acts || action && action !== "close" && inSearch)
|
|
9109
9108
|
event.preventDefault();
|
|
@@ -9152,6 +9151,7 @@ function createPanel(options2 = {}) {
|
|
|
9152
9151
|
stage.inspector = inspector;
|
|
9153
9152
|
const stopModes = actionsHere.flatMap((action) => action.watch?.(render) ?? []);
|
|
9154
9153
|
const stopCount = onCount(render);
|
|
9154
|
+
const stopEdits = edits.subscribe(render);
|
|
9155
9155
|
window.addEventListener("keydown", onKeydown, true);
|
|
9156
9156
|
window.addEventListener("pointerdown", onPointerDown, true);
|
|
9157
9157
|
window.addEventListener("pointerup", onPointerUp, true);
|
|
@@ -9203,6 +9203,7 @@ function createPanel(options2 = {}) {
|
|
|
9203
9203
|
if (stage.inspector === inspector)
|
|
9204
9204
|
stage.inspector = null;
|
|
9205
9205
|
stopCount();
|
|
9206
|
+
stopEdits();
|
|
9206
9207
|
clearInterval(ticker);
|
|
9207
9208
|
tips.destroy();
|
|
9208
9209
|
settings.destroy();
|
|
@@ -9230,7 +9231,7 @@ function createPanel(options2 = {}) {
|
|
|
9230
9231
|
}
|
|
9231
9232
|
|
|
9232
9233
|
// src/version.ts
|
|
9233
|
-
var VERSION = "0.
|
|
9234
|
+
var VERSION = "0.6.0";
|
|
9234
9235
|
|
|
9235
9236
|
// src/index.ts
|
|
9236
9237
|
var PRESETS = {
|
|
@@ -9289,12 +9290,20 @@ function mount(options2 = {}) {
|
|
|
9289
9290
|
start(options2);
|
|
9290
9291
|
mounted = options2;
|
|
9291
9292
|
attach(options2);
|
|
9293
|
+
if (!isDevknobsFrame() && !fresh())
|
|
9294
|
+
keepEdits(options2.editsStore);
|
|
9295
|
+
}
|
|
9296
|
+
function keepEdits(store) {
|
|
9297
|
+
const path = pathNow();
|
|
9298
|
+
const frame = () => framedPage(window, frameWindow(), path, needsFrame(getState()));
|
|
9299
|
+
startKeep(store, { frame, settled: () => pageSettled(window, () => needsFrame(getState()), frame) });
|
|
9292
9300
|
}
|
|
9293
9301
|
function attach(options2) {
|
|
9294
9302
|
const live = createKeys({
|
|
9295
9303
|
hotkey: options2.hotkey,
|
|
9296
9304
|
grabKey: options2.grabKey,
|
|
9297
|
-
grab: options2.grab !== false
|
|
9305
|
+
grab: options2.grab !== false,
|
|
9306
|
+
store: options2.keysStore
|
|
9298
9307
|
});
|
|
9299
9308
|
keys = live;
|
|
9300
9309
|
if (options2.grab !== false) {
|
|
@@ -9399,6 +9408,7 @@ function adopt(options2, take) {
|
|
|
9399
9408
|
detach();
|
|
9400
9409
|
attach(mounted);
|
|
9401
9410
|
}
|
|
9411
|
+
var handing = false;
|
|
9402
9412
|
function handOver() {
|
|
9403
9413
|
const take = waiting;
|
|
9404
9414
|
const options2 = mounted;
|
|
@@ -9410,7 +9420,12 @@ function handOver() {
|
|
|
9410
9420
|
return;
|
|
9411
9421
|
}
|
|
9412
9422
|
const native = nativeSwitch();
|
|
9413
|
-
|
|
9423
|
+
handing = true;
|
|
9424
|
+
try {
|
|
9425
|
+
unmount();
|
|
9426
|
+
} finally {
|
|
9427
|
+
handing = false;
|
|
9428
|
+
}
|
|
9414
9429
|
const prefer = options2.prefer;
|
|
9415
9430
|
let took = false;
|
|
9416
9431
|
try {
|
|
@@ -9438,6 +9453,12 @@ function unmount() {
|
|
|
9438
9453
|
if (superseded(window, unmount))
|
|
9439
9454
|
return;
|
|
9440
9455
|
detach();
|
|
9456
|
+
stopKeep();
|
|
9457
|
+
if (!handing) {
|
|
9458
|
+
edits.undoAll();
|
|
9459
|
+
forgetReplay();
|
|
9460
|
+
clearForced();
|
|
9461
|
+
}
|
|
9441
9462
|
const native = mounted?.host ? nativeSwitch() : null;
|
|
9442
9463
|
stop();
|
|
9443
9464
|
withdraw(window, api);
|
|
@@ -9513,16 +9534,41 @@ async function grab(elements, options2) {
|
|
|
9513
9534
|
const host = hosted("grab");
|
|
9514
9535
|
if (host)
|
|
9515
9536
|
return host(elements, options2);
|
|
9516
|
-
const loaded = await import("./index-
|
|
9537
|
+
const loaded = await import("./index-f67wctn3.js");
|
|
9517
9538
|
return loaded.grab(elements, options2);
|
|
9518
9539
|
}
|
|
9519
|
-
|
|
9540
|
+
function edits2() {
|
|
9541
|
+
return (hosted("edits") ?? edits.list)();
|
|
9542
|
+
}
|
|
9543
|
+
async function setEdits(list) {
|
|
9544
|
+
const host = hosted("setEdits");
|
|
9545
|
+
if (host)
|
|
9546
|
+
return host(list);
|
|
9547
|
+
if (!Array.isArray(list))
|
|
9548
|
+
throw new TypeError("devknobs.setEdits takes a list of edits, as edits() gives them");
|
|
9549
|
+
const { replayEdits } = await import("./replay-vtg0vqj2.js");
|
|
9550
|
+
const { applied, skipped } = replayEdits(edits, list);
|
|
9551
|
+
return { applied, skipped };
|
|
9552
|
+
}
|
|
9553
|
+
function undoEdit() {
|
|
9554
|
+
return (hosted("undoEdit") ?? edits.undo)();
|
|
9555
|
+
}
|
|
9556
|
+
function forceState2(target, states = []) {
|
|
9557
|
+
const host = hosted("forceState");
|
|
9558
|
+
if (host)
|
|
9559
|
+
return host(target, states);
|
|
9560
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
9561
|
+
return forceState(element, states);
|
|
9562
|
+
}
|
|
9563
|
+
var api = { mount, unmount, getState: getState2, setState: setState2, reset: reset2, replay: replay2, grab, describe: describe2, ready: ready2, edits: edits2, setEdits, undoEdit, forceState: forceState2 };
|
|
9520
9564
|
export {
|
|
9521
9565
|
unmount,
|
|
9566
|
+
undoEdit,
|
|
9522
9567
|
setSystemMedia,
|
|
9523
9568
|
setState2 as setState,
|
|
9524
9569
|
setPrefer,
|
|
9525
9570
|
setNative2 as setNative,
|
|
9571
|
+
setEdits,
|
|
9526
9572
|
reset2 as reset,
|
|
9527
9573
|
replay2 as replay,
|
|
9528
9574
|
ready2 as ready,
|
|
@@ -9530,6 +9576,8 @@ export {
|
|
|
9530
9576
|
holdInTopLayer,
|
|
9531
9577
|
grab,
|
|
9532
9578
|
getState2 as getState,
|
|
9579
|
+
forceState2 as forceState,
|
|
9580
|
+
edits2 as edits,
|
|
9533
9581
|
describe2 as describe,
|
|
9534
9582
|
PRESETS,
|
|
9535
9583
|
LAYER
|