@vinena/knobs 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +7 -0
- package/dist/early.global.js +6 -6
- package/dist/{elementsview-6g274ptr.js → elementsview-2z4pkrdz.js} +4 -4
- package/dist/{elementsview-pkzp9kc6.js → elementsview-qn8qyksa.js} +4 -4
- package/dist/engine/browserdraw.d.ts +24 -2
- package/dist/engine/browserkit.d.ts +18 -1
- package/dist/engine/browserui.d.ts +162 -22
- package/dist/engine/devicon.d.ts +59 -0
- package/dist/engine/fit.d.ts +4 -3
- package/dist/engine/foldflip.d.ts +40 -0
- package/dist/engine/identity.d.ts +7 -4
- package/dist/engine/mock.d.ts +16 -0
- package/dist/engine/mockdata.d.ts +4 -1
- package/dist/engine/mockdraw.d.ts +14 -2
- package/dist/engine/pageshot.d.ts +5 -2
- package/dist/engine/safaridraw.d.ts +162 -10
- package/dist/engine/screen.d.ts +24 -0
- package/dist/engine/store.d.ts +2 -1
- package/dist/engine/tabicon.d.ts +43 -0
- package/dist/engine/toplayer.d.ts +62 -0
- package/dist/engine/touchpointer.d.ts +0 -21
- package/dist/engine/underbar.d.ts +61 -0
- package/dist/{framekit-g96t6nmq.js → framekit-te90cjs0.js} +2325 -1572
- package/dist/{framekit-3n7p79ht.js → framekit-w0v516w5.js} +2325 -1572
- package/dist/host.d.ts +51 -0
- package/dist/{index-64rd634h.js → index-30fc6php.js} +1 -1
- package/dist/{index-dvr4x91q.js → index-9re7sv56.js} +20 -8
- package/dist/{index-0casarhy.js → index-agwr37gw.js} +1 -1
- package/dist/{index-2d6wvs8h.js → index-dan2kpsd.js} +4 -4
- package/dist/{index-kzsb9drs.js → index-hv02xka3.js} +20 -8
- package/dist/{index-peh33xjv.js → index-pewcdh28.js} +1 -1
- package/dist/{index-d0cjxjsm.js → index-r72tz2vn.js} +1 -1
- package/dist/{index-33x9hxe3.js → index-sxe5079a.js} +605 -187
- package/dist/{index-5d6qzte3.js → index-trx7bxdk.js} +4 -4
- package/dist/{index-5baxvd3v.js → index-xjhwp5cj.js} +275 -112
- package/dist/index.d.ts +26 -1
- package/dist/index.global.js +270 -176
- package/dist/index.js +398 -124
- package/dist/instance.d.ts +23 -4
- package/dist/{react-pdvseef0.js → react-05jh9jv5.js} +1 -1
- package/dist/{react-4kbj1t4h.js → react-16spgn0h.js} +1 -1
- package/dist/{react-65tgdbs8.js → react-4pvp6amm.js} +1 -1
- package/dist/{react-qv0nykcv.js → react-ayg1bgw3.js} +602 -184
- package/dist/{react-xxfpfddf.js → react-exjcpxma.js} +1 -1
- package/dist/{react-carf84xv.js → react-fm9y8dbn.js} +275 -112
- package/dist/{react-mv9y20jy.js → react-sw8d8c94.js} +4 -4
- package/dist/{react-71a9ypex.js → react-zy1mmhgz.js} +4 -4
- package/dist/react.js +394 -123
- package/dist/{storageview-vdkbp6rt.js → storageview-r595qpt9.js} +4 -4
- package/dist/{storageview-j9d44f99.js → storageview-s7heg93p.js} +4 -4
- package/dist/types.d.ts +7 -0
- package/dist/ui/footer.d.ts +9 -2
- package/dist/ui/panel.d.ts +16 -2
- package/dist/ui/settings.d.ts +17 -1
- package/dist/version.d.ts +2 -0
- package/package.json +3 -2
- package/skills/devknobs/SKILL.md +1 -1
- package/dist/elementsview-jnkbhzkj.js +0 -2873
- package/dist/elementsview-tf4qzmtw.js +0 -2874
- package/dist/engine/endroom.d.ts +0 -21
- package/dist/framekit-095qevka.js +0 -8838
- package/dist/framekit-q5aad770.js +0 -8839
- package/dist/index-hw56t3zy.js +0 -4800
- package/dist/index-k015tb6c.js +0 -357
- package/dist/index-ke6v7919.js +0 -4801
- package/dist/index-qxye1j73.js +0 -528
- package/dist/index-z5ytnj01.js +0 -4563
- package/dist/index-zvze25nf.js +0 -686
- package/dist/react-eygws6cx.js +0 -358
- package/dist/react-sq9pkw4k.js +0 -687
- package/dist/react-vjm88w4t.js +0 -4564
- package/dist/react-znfrjqk8.js +0 -529
- package/dist/storageview-sb23henh.js +0 -2729
- package/dist/storageview-vf8v8q8j.js +0 -2728
package/dist/index-k015tb6c.js
DELETED
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
button,
|
|
3
|
-
el,
|
|
4
|
-
lay,
|
|
5
|
-
rowBox,
|
|
6
|
-
rowButton
|
|
7
|
-
} from "./index-zvze25nf.js";
|
|
8
|
-
import {
|
|
9
|
-
getState,
|
|
10
|
-
icon
|
|
11
|
-
} from "./index-33x9hxe3.js";
|
|
12
|
-
import {
|
|
13
|
-
__require,
|
|
14
|
-
isDevknobsFrame,
|
|
15
|
-
newer,
|
|
16
|
-
webStorage
|
|
17
|
-
} from "./index-5baxvd3v.js";
|
|
18
|
-
|
|
19
|
-
// src/storage/onload.ts
|
|
20
|
-
var PRESETS_KEY = "devknobs:storage-presets";
|
|
21
|
-
var PRESETS_VERSION = 1;
|
|
22
|
-
var DONE = Symbol.for("devknobs.presets");
|
|
23
|
-
function fields(value) {
|
|
24
|
-
return typeof value === "object" && value !== null && !Array.isArray(value) ? Object.fromEntries(Object.entries(value)) : {};
|
|
25
|
-
}
|
|
26
|
-
function list(value) {
|
|
27
|
-
return Array.isArray(value) ? value.map(fields) : [];
|
|
28
|
-
}
|
|
29
|
-
function storedPresets() {
|
|
30
|
-
try {
|
|
31
|
-
const raw = JSON.parse(webStorage("local")?.getItem(PRESETS_KEY) ?? "null");
|
|
32
|
-
return newer(raw, PRESETS_VERSION) ? [] : list(fields(raw).presets);
|
|
33
|
-
} catch {
|
|
34
|
-
return [];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function cookieText(entry) {
|
|
38
|
-
let text = `${String(entry.name)}=${String(entry.value)}`;
|
|
39
|
-
text += `; path=${typeof entry.path === "string" ? entry.path : "/"}`;
|
|
40
|
-
if (typeof entry.domain === "string")
|
|
41
|
-
text += `; domain=${entry.domain}`;
|
|
42
|
-
if (typeof entry.maxAge === "number")
|
|
43
|
-
text += `; max-age=${entry.maxAge}`;
|
|
44
|
-
if (typeof entry.expires === "string")
|
|
45
|
-
text += `; expires=${entry.expires}`;
|
|
46
|
-
if (typeof entry.sameSite === "string")
|
|
47
|
-
text += `; samesite=${entry.sameSite}`;
|
|
48
|
-
if (entry.secure === true)
|
|
49
|
-
text += "; secure";
|
|
50
|
-
return text;
|
|
51
|
-
}
|
|
52
|
-
function empty(storage) {
|
|
53
|
-
const keys = [];
|
|
54
|
-
for (let index = 0;index < storage.length; index++) {
|
|
55
|
-
const key = storage.key(index);
|
|
56
|
-
if (key !== null && key !== "devknobs" && !key.startsWith("devknobs:"))
|
|
57
|
-
keys.push(key);
|
|
58
|
-
}
|
|
59
|
-
for (const key of keys)
|
|
60
|
-
storage.removeItem(key);
|
|
61
|
-
}
|
|
62
|
-
function put(target, preset, clear) {
|
|
63
|
-
const failed = [];
|
|
64
|
-
for (const kind of ["local", "session"]) {
|
|
65
|
-
try {
|
|
66
|
-
const storage = kind === "local" ? target.localStorage : target.sessionStorage;
|
|
67
|
-
if (clear)
|
|
68
|
-
empty(storage);
|
|
69
|
-
for (const entry of list(preset[kind])) {
|
|
70
|
-
try {
|
|
71
|
-
if (typeof entry.name === "string" && typeof entry.value === "string") {
|
|
72
|
-
storage.setItem(entry.name, entry.value);
|
|
73
|
-
}
|
|
74
|
-
} catch {
|
|
75
|
-
failed.push(String(entry.name));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} catch {
|
|
79
|
-
failed.push(`${kind}Storage`);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
for (const entry of list(preset.cookies)) {
|
|
83
|
-
try {
|
|
84
|
-
if (typeof entry.name === "string" && typeof entry.value === "string") {
|
|
85
|
-
target.document.cookie = cookieText(entry);
|
|
86
|
-
}
|
|
87
|
-
} catch {
|
|
88
|
-
failed.push(String(entry.name));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return failed;
|
|
92
|
-
}
|
|
93
|
-
function applyOnLoad() {
|
|
94
|
-
if (typeof window === "undefined")
|
|
95
|
-
return 0;
|
|
96
|
-
const known = Reflect.get(window, DONE);
|
|
97
|
-
if (typeof known === "number")
|
|
98
|
-
return known;
|
|
99
|
-
let count = 0;
|
|
100
|
-
try {
|
|
101
|
-
if (!isDevknobsFrame()) {
|
|
102
|
-
for (const preset of storedPresets()) {
|
|
103
|
-
if (preset.onLoad !== true)
|
|
104
|
-
continue;
|
|
105
|
-
put(window, preset, preset.clearFirst === true);
|
|
106
|
-
count++;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
} catch {}
|
|
110
|
-
Reflect.set(window, DONE, count);
|
|
111
|
-
return count;
|
|
112
|
-
}
|
|
113
|
-
function appliedOnLoad() {
|
|
114
|
-
if (typeof window === "undefined")
|
|
115
|
-
return 0;
|
|
116
|
-
const known = Reflect.get(window, DONE);
|
|
117
|
-
return typeof known === "number" ? known : 0;
|
|
118
|
-
}
|
|
119
|
-
function forgetApplied() {
|
|
120
|
-
if (typeof window !== "undefined")
|
|
121
|
-
Reflect.set(window, DONE, 0);
|
|
122
|
-
}
|
|
123
|
-
function stopOnLoad() {
|
|
124
|
-
try {
|
|
125
|
-
const presets = storedPresets();
|
|
126
|
-
if (presets.some((preset) => preset.onLoad === true)) {
|
|
127
|
-
const off = presets.map((preset) => ({ ...preset, onLoad: false }));
|
|
128
|
-
webStorage("local")?.setItem(PRESETS_KEY, JSON.stringify({ v: PRESETS_VERSION, presets: off }));
|
|
129
|
-
}
|
|
130
|
-
} catch {}
|
|
131
|
-
forgetApplied();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// src/ui/pane.ts
|
|
135
|
-
var PANE_WIDTH = 340;
|
|
136
|
-
var listeners = new Set;
|
|
137
|
-
var shell = null;
|
|
138
|
-
function emit(view) {
|
|
139
|
-
for (const listener of [...listeners])
|
|
140
|
-
listener(view);
|
|
141
|
-
}
|
|
142
|
-
function openPane(view) {
|
|
143
|
-
shell?.open(view);
|
|
144
|
-
}
|
|
145
|
-
function closePane() {
|
|
146
|
-
shell?.close();
|
|
147
|
-
}
|
|
148
|
-
function paneView() {
|
|
149
|
-
return shell?.view() ?? null;
|
|
150
|
-
}
|
|
151
|
-
function showPane(id) {
|
|
152
|
-
shell?.show(id);
|
|
153
|
-
}
|
|
154
|
-
function retitlePane(id, title) {
|
|
155
|
-
shell?.retitle(id, title);
|
|
156
|
-
}
|
|
157
|
-
function onPane(listener) {
|
|
158
|
-
listeners.add(listener);
|
|
159
|
-
return () => {
|
|
160
|
-
listeners.delete(listener);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function viewHead() {
|
|
164
|
-
const back = button("main", "");
|
|
165
|
-
const actions = el("div", "view-actions");
|
|
166
|
-
const { box, label } = rowBox({
|
|
167
|
-
main: back,
|
|
168
|
-
glyph: icon("chevron-left"),
|
|
169
|
-
title: "",
|
|
170
|
-
after: [actions]
|
|
171
|
-
});
|
|
172
|
-
box.className = `${box.className} view-head`;
|
|
173
|
-
return { box, back, title: label, actions };
|
|
174
|
-
}
|
|
175
|
-
function focused() {
|
|
176
|
-
let at = document.activeElement;
|
|
177
|
-
while (at?.shadowRoot?.activeElement)
|
|
178
|
-
at = at.shadowRoot.activeElement;
|
|
179
|
-
return at;
|
|
180
|
-
}
|
|
181
|
-
function showing(node) {
|
|
182
|
-
return node.isConnected && node.getClientRects().length > 0;
|
|
183
|
-
}
|
|
184
|
-
function createPane(context) {
|
|
185
|
-
const { root, tips } = context;
|
|
186
|
-
const node = el("div", "view pane");
|
|
187
|
-
node.setAttribute("role", "group");
|
|
188
|
-
const { box: head, back, title, actions } = viewHead();
|
|
189
|
-
back.addEventListener("click", leave);
|
|
190
|
-
back.addEventListener("pointerenter", () => shown?.point?.(true));
|
|
191
|
-
back.addEventListener("pointerleave", () => shown?.point?.(false));
|
|
192
|
-
const body = el("div", "view-body");
|
|
193
|
-
node.append(head, body);
|
|
194
|
-
let shown = null;
|
|
195
|
-
let cleanup = null;
|
|
196
|
-
let watches = [];
|
|
197
|
-
let opener = null;
|
|
198
|
-
function holdsFocus() {
|
|
199
|
-
const at = root.activeElement;
|
|
200
|
-
return at !== null && node.contains(at);
|
|
201
|
-
}
|
|
202
|
-
function name(text) {
|
|
203
|
-
title.textContent = text;
|
|
204
|
-
node.setAttribute("aria-label", text);
|
|
205
|
-
back.setAttribute("aria-label", `back from ${text}`);
|
|
206
|
-
}
|
|
207
|
-
function actionButton(action) {
|
|
208
|
-
const control = rowButton("view-action", icon(action.icon), action.label);
|
|
209
|
-
const { hint, pressed } = action;
|
|
210
|
-
const told = hint ? () => [action.label, hint()].filter(Boolean).join(" · ") : action.label;
|
|
211
|
-
tips.tooltip(control, told);
|
|
212
|
-
control.addEventListener("click", () => action.run());
|
|
213
|
-
if (pressed) {
|
|
214
|
-
const mark = () => control.setAttribute("aria-pressed", pressed() ? "true" : "false");
|
|
215
|
-
mark();
|
|
216
|
-
if (action.watch)
|
|
217
|
-
watches.push(action.watch(mark));
|
|
218
|
-
}
|
|
219
|
-
return control;
|
|
220
|
-
}
|
|
221
|
-
function unmount() {
|
|
222
|
-
tips.hide();
|
|
223
|
-
const done = cleanup;
|
|
224
|
-
cleanup = null;
|
|
225
|
-
shown = null;
|
|
226
|
-
for (const stop of watches.splice(0))
|
|
227
|
-
stop();
|
|
228
|
-
done?.();
|
|
229
|
-
}
|
|
230
|
-
function open(view) {
|
|
231
|
-
if (shown?.id === view.id)
|
|
232
|
-
return;
|
|
233
|
-
if (shown)
|
|
234
|
-
unmount();
|
|
235
|
-
else
|
|
236
|
-
opener = focused();
|
|
237
|
-
body.replaceChildren();
|
|
238
|
-
body.scrollTop = 0;
|
|
239
|
-
shown = view;
|
|
240
|
-
lay(node, view.layout);
|
|
241
|
-
name(view.title);
|
|
242
|
-
actions.replaceChildren(...(view.actions ?? []).map(actionButton));
|
|
243
|
-
const made = view.mount(body);
|
|
244
|
-
cleanup = typeof made === "function" ? made : null;
|
|
245
|
-
context.uncover();
|
|
246
|
-
context.openPanel();
|
|
247
|
-
context.render();
|
|
248
|
-
back.focus({ preventScroll: true });
|
|
249
|
-
emit(view.id);
|
|
250
|
-
}
|
|
251
|
-
function close() {
|
|
252
|
-
if (!shown)
|
|
253
|
-
return;
|
|
254
|
-
const inside = holdsFocus();
|
|
255
|
-
unmount();
|
|
256
|
-
context.render();
|
|
257
|
-
if (!node.classList.contains("leaving"))
|
|
258
|
-
body.replaceChildren();
|
|
259
|
-
if (inside) {
|
|
260
|
-
const to = opener instanceof HTMLElement && showing(opener) ? opener : context.home;
|
|
261
|
-
to.focus({ preventScroll: true });
|
|
262
|
-
}
|
|
263
|
-
opener = null;
|
|
264
|
-
emit(null);
|
|
265
|
-
}
|
|
266
|
-
function leave() {
|
|
267
|
-
if (shown?.back)
|
|
268
|
-
shown.back();
|
|
269
|
-
else
|
|
270
|
-
close();
|
|
271
|
-
}
|
|
272
|
-
const pane = {
|
|
273
|
-
node,
|
|
274
|
-
open,
|
|
275
|
-
close,
|
|
276
|
-
drop() {
|
|
277
|
-
if (!shown)
|
|
278
|
-
return;
|
|
279
|
-
unmount();
|
|
280
|
-
opener = null;
|
|
281
|
-
emit(null);
|
|
282
|
-
},
|
|
283
|
-
retitle(id, text) {
|
|
284
|
-
if (shown?.id === id)
|
|
285
|
-
name(text);
|
|
286
|
-
},
|
|
287
|
-
show(id) {
|
|
288
|
-
if (shown?.id !== id)
|
|
289
|
-
return;
|
|
290
|
-
context.uncover();
|
|
291
|
-
context.openPanel();
|
|
292
|
-
context.render();
|
|
293
|
-
},
|
|
294
|
-
view: () => shown?.id ?? null,
|
|
295
|
-
focus() {
|
|
296
|
-
if (shown)
|
|
297
|
-
back.focus({ preventScroll: true });
|
|
298
|
-
return shown !== null;
|
|
299
|
-
},
|
|
300
|
-
escape() {
|
|
301
|
-
if (shown && shown.escape?.() !== true)
|
|
302
|
-
leave();
|
|
303
|
-
},
|
|
304
|
-
landed() {
|
|
305
|
-
if (!shown)
|
|
306
|
-
body.replaceChildren();
|
|
307
|
-
},
|
|
308
|
-
destroy() {
|
|
309
|
-
if (shown) {
|
|
310
|
-
unmount();
|
|
311
|
-
emit(null);
|
|
312
|
-
}
|
|
313
|
-
if (shell === pane)
|
|
314
|
-
shell = null;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
shell = pane;
|
|
318
|
-
return pane;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// src/ui/storageaction.ts
|
|
322
|
-
var STORAGE_VIEW = "storage";
|
|
323
|
-
function load() {
|
|
324
|
-
return import("./storageview-vf8v8q8j.js").then((loaded) => loaded.storageView({
|
|
325
|
-
visible: () => getState().panel.open && !document.hidden
|
|
326
|
-
}));
|
|
327
|
-
}
|
|
328
|
-
function createStorageControl(loadView = load) {
|
|
329
|
-
let asked = 0;
|
|
330
|
-
const isOn = () => paneView() === STORAGE_VIEW;
|
|
331
|
-
const close = () => {
|
|
332
|
-
asked++;
|
|
333
|
-
if (isOn())
|
|
334
|
-
closePane();
|
|
335
|
-
};
|
|
336
|
-
return {
|
|
337
|
-
toggle() {
|
|
338
|
-
if (isOn()) {
|
|
339
|
-
close();
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
const mine = ++asked;
|
|
343
|
-
loadView().then((view) => {
|
|
344
|
-
if (mine === asked)
|
|
345
|
-
openPane(view);
|
|
346
|
-
}, () => {});
|
|
347
|
-
},
|
|
348
|
-
isOn,
|
|
349
|
-
close,
|
|
350
|
-
subscribe: (listener) => onPane(() => listener()),
|
|
351
|
-
destroy() {
|
|
352
|
-
close();
|
|
353
|
-
}
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
export { PRESETS_KEY, PRESETS_VERSION, storedPresets, cookieText, put, applyOnLoad, appliedOnLoad, stopOnLoad, PANE_WIDTH, openPane, closePane, paneView, showPane, retitlePane, onPane, viewHead, createPane, STORAGE_VIEW, createStorageControl };
|