@vinena/knobs 0.6.6 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/README.md +13 -7
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/dist/cli.d.ts +95 -0
- package/dist/cli.js +527 -0
- package/dist/{context-eawqn680.js → context-2r76ext7.js} +3 -3
- package/dist/{context-vd2xep5t.js → context-h1bdt8w3.js} +3 -3
- package/dist/early.global.js +7 -8
- package/dist/edit/html.d.ts +7 -3
- package/dist/edit/keep.d.ts +2 -2
- package/dist/{elementsview-n26sp8m7.js → elementsview-mcg6d5zp.js} +21 -19
- package/dist/{elementsview-dpm0xmb2.js → elementsview-mwr1s17z.js} +21 -19
- package/dist/engine/bezels.d.ts +2 -2
- package/dist/engine/check.d.ts +2 -2
- package/dist/engine/describe.d.ts +2 -2
- package/dist/engine/devices.d.ts +3 -3
- package/dist/engine/fit.d.ts +4 -4
- package/dist/engine/foldhand.d.ts +2 -2
- package/dist/engine/frame.d.ts +6 -6
- package/dist/engine/frames.d.ts +4 -4
- package/dist/engine/fresh.d.ts +12 -5
- package/dist/engine/header.d.ts +3 -1
- package/dist/engine/identity.d.ts +4 -4
- package/dist/engine/index.d.ts +7 -7
- package/dist/engine/locale.d.ts +2 -2
- package/dist/engine/morph.d.ts +2 -2
- package/dist/engine/native.d.ts +8 -8
- package/dist/engine/placeholder.d.ts +3 -3
- package/dist/engine/reload.d.ts +2 -2
- package/dist/engine/screen.d.ts +2 -2
- package/dist/engine/scrollkeep.d.ts +1 -1
- package/dist/engine/store.d.ts +11 -11
- package/dist/engine/storekeys.d.ts +34 -0
- package/dist/engine/style.d.ts +1 -1
- package/dist/engine/tabicon.d.ts +2 -2
- package/dist/engine/underneath.d.ts +1 -0
- package/dist/engine/width.d.ts +3 -3
- package/dist/{framekit-0as9t6a7.js → framekit-4v7nc3ea.js} +25 -20
- package/dist/{framekit-dknq662p.js → framekit-wyppj1se.js} +25 -20
- package/dist/grab/clipboard.d.ts +2 -0
- package/dist/{index-jfv7vavj.js → index-311fys81.js} +93 -29
- package/dist/index-3dcgysws.js +77 -0
- package/dist/{index-7vb2ct4s.js → index-3s4v7gw5.js} +11 -10
- package/dist/{index-ztnjefrh.js → index-585hs9tp.js} +5 -1
- package/dist/{index-za4ppxay.js → index-6t0w5s7p.js} +1 -1
- package/dist/{index-r1rdj05c.js → index-82y8x8vv.js} +14 -11
- package/dist/{index-dxga6h10.js → index-9targr2f.js} +26 -16
- package/dist/{index-x3sxssbs.js → index-a23nv5j4.js} +65 -45
- package/dist/{index-t4kssacm.js → index-abwqw8jh.js} +6 -1
- package/dist/{index-s6yzsvs4.js → index-bgzyc7rz.js} +22 -15
- package/dist/{index-t4wrs2a3.js → index-c1t6knbf.js} +20 -14
- package/dist/{index-7w0nm76e.js → index-cqymjce4.js} +20 -14
- package/dist/{index-69fvtkcm.js → index-dvtbh3c8.js} +24 -18
- package/dist/{index-ajs4na3f.js → index-k4w5v53q.js} +2 -2
- package/dist/{index-df35z48z.js → index-n31pn4ax.js} +20 -16
- package/dist/{index-ymqm185m.js → index-rps0bdq9.js} +1 -1
- package/dist/{index-a8ffw5ft.js → index-szd9bddn.js} +1 -1
- package/dist/{index-whehz74d.js → index-vhda420r.js} +32 -6
- package/dist/{index-xs29b55n.js → index-vmprrfwe.js} +5 -2
- package/dist/{index-20bc9yrj.js → index-vmz7htwn.js} +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.global.js +176 -159
- package/dist/index.js +108 -43
- package/dist/instance.d.ts +7 -1
- package/dist/mark.d.ts +50 -0
- package/dist/{react-msn10fjb.js → react-4ezjf7mq.js} +24 -18
- package/dist/react-4qn9vsjw.js +78 -0
- package/dist/{react-73reavv4.js → react-4tcwpama.js} +1 -1
- package/dist/{react-k4pkm1p5.js → react-7eyps0cg.js} +2 -2
- package/dist/{react-10r2rczp.js → react-7tzwahsm.js} +14 -11
- package/dist/{react-yx3g9k55.js → react-amvrbng8.js} +5 -2
- package/dist/{react-5rq7bnsy.js → react-atw9y8ny.js} +5 -1
- package/dist/{react-4phtr2nd.js → react-dg4bjv3j.js} +1 -1
- package/dist/{react-vbk58f9m.js → react-hdneb4v3.js} +32 -6
- package/dist/{react-h9w04skh.js → react-j87bdhhe.js} +4 -1
- package/dist/{react-wtgvkf6g.js → react-mkafgzqf.js} +1 -1
- package/dist/{react-a1r0nr0g.js → react-ppyj3fg2.js} +65 -45
- package/dist/{react-0r5418av.js → react-rbmk30xk.js} +92 -29
- package/dist/{react-y9gr8yt2.js → react-rxw73n04.js} +1 -1
- package/dist/{react-5h7pxnax.js → react-tet7swk2.js} +22 -15
- package/dist/{react-5ekfj7g3.js → react-w94cfn87.js} +20 -16
- package/dist/{react-v08ywmtw.js → react-wzd3cfg8.js} +11 -10
- package/dist/{react-2b7725je.js → react-x209et38.js} +26 -16
- package/dist/react.d.ts +3 -1
- package/dist/react.js +111 -44
- package/dist/{replay-ehgxp9py.js → replay-3xqgt3xg.js} +8 -8
- package/dist/{replay-461gcdh1.js → replay-48gn27bj.js} +8 -8
- package/dist/storage/onload.d.ts +1 -1
- package/dist/{storageview-5p1y11b5.js → storageview-2rvwk0v7.js} +20 -17
- package/dist/{storageview-kxzpnfvr.js → storageview-6vq7nz02.js} +20 -17
- package/dist/styles/force.d.ts +3 -1
- package/dist/types.d.ts +4 -4
- package/dist/ui/actions.d.ts +3 -3
- package/dist/ui/bindings.d.ts +1 -1
- package/dist/ui/catalog.d.ts +14 -14
- package/dist/ui/changes.d.ts +1 -1
- package/dist/ui/colors.d.ts +1 -1
- package/dist/ui/deviceknobs.d.ts +2 -2
- package/dist/ui/editors.d.ts +3 -3
- package/dist/ui/foldslider.d.ts +2 -2
- package/dist/ui/icons.d.ts +5 -2
- package/dist/ui/keys.d.ts +1 -1
- package/dist/ui/list.d.ts +10 -10
- package/dist/ui/palette.d.ts +2 -2
- package/dist/ui/panel.d.ts +2 -0
- package/dist/ui/pin.d.ts +2 -2
- package/dist/ui/prefs.d.ts +1 -1
- package/dist/ui/rows.d.ts +3 -3
- package/dist/ui/settings.d.ts +11 -1
- package/dist/ui/storageview.d.ts +2 -2
- package/dist/ui/stylesview.d.ts +3 -3
- package/dist/ui/swatches.d.ts +2 -2
- package/package.json +5 -2
- package/skills/{devknobs → knobs}/SKILL.md +52 -51
- package/dist/index-5tv6sr74.js +0 -23
- package/dist/react-t2qnewz2.js +0 -24
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
cookieText,
|
|
6
6
|
put,
|
|
7
7
|
storedPresets
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-82y8x8vv.js";
|
|
9
9
|
import {
|
|
10
10
|
copyText
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-585hs9tp.js";
|
|
12
12
|
import {
|
|
13
13
|
branch,
|
|
14
14
|
codeBlock,
|
|
@@ -30,22 +30,25 @@ import {
|
|
|
30
30
|
textArea,
|
|
31
31
|
textField,
|
|
32
32
|
toolbar
|
|
33
|
-
} from "./index-
|
|
34
|
-
import"./index-
|
|
35
|
-
import"./index-
|
|
33
|
+
} from "./index-vmz7htwn.js";
|
|
34
|
+
import"./index-a23nv5j4.js";
|
|
35
|
+
import"./index-bgzyc7rz.js";
|
|
36
36
|
import {
|
|
37
37
|
icon
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-vhda420r.js";
|
|
39
39
|
import {
|
|
40
|
+
isOwnKey,
|
|
41
|
+
removeItem,
|
|
40
42
|
stamped,
|
|
41
|
-
webStorage
|
|
42
|
-
|
|
43
|
+
webStorage,
|
|
44
|
+
writeItem
|
|
45
|
+
} from "./index-311fys81.js";
|
|
43
46
|
import"./index-a974q3aa.js";
|
|
44
|
-
import"./index-
|
|
47
|
+
import"./index-3dcgysws.js";
|
|
45
48
|
|
|
46
49
|
// src/storage/site.ts
|
|
47
50
|
function isOwn(key) {
|
|
48
|
-
return key
|
|
51
|
+
return isOwnKey(key);
|
|
49
52
|
}
|
|
50
53
|
function nameOf(error) {
|
|
51
54
|
if (typeof error !== "object" || error === null)
|
|
@@ -1030,9 +1033,9 @@ function savePresets(presets) {
|
|
|
1030
1033
|
return "presets are not kept here";
|
|
1031
1034
|
try {
|
|
1032
1035
|
if (presets.length === 0)
|
|
1033
|
-
|
|
1036
|
+
removeItem(storage, PRESETS_KEY);
|
|
1034
1037
|
else
|
|
1035
|
-
storage
|
|
1038
|
+
writeItem(storage, PRESETS_KEY, JSON.stringify(stamped({ presets }, PRESETS_VERSION)));
|
|
1036
1039
|
return null;
|
|
1037
1040
|
} catch {
|
|
1038
1041
|
return "cannot keep the preset: the storage is full";
|
|
@@ -1653,7 +1656,7 @@ async function savePreset(shell, query) {
|
|
|
1653
1656
|
};
|
|
1654
1657
|
const name = textField({ placeholder: "preset name", onEnter: save });
|
|
1655
1658
|
const node = stack([
|
|
1656
|
-
noteLine(`keeps ${holds}${query.trim() === "" ? "" : ", as the filter shows them"}, without
|
|
1659
|
+
noteLine(`keeps ${holds}${query.trim() === "" ? "" : ", as the filter shows them"}, without knobs' own`),
|
|
1657
1660
|
name,
|
|
1658
1661
|
problem,
|
|
1659
1662
|
controls([
|
|
@@ -1999,7 +2002,7 @@ function webSection(shell, kind) {
|
|
|
1999
2002
|
if (!item.own)
|
|
2000
2003
|
run();
|
|
2001
2004
|
else
|
|
2002
|
-
askIn(shell, fold.body, `${key} is
|
|
2005
|
+
askIn(shell, fold.body, `${key} is knobs' own. ${doing} it anyway?`, doing, run, fill);
|
|
2003
2006
|
}
|
|
2004
2007
|
function edit() {
|
|
2005
2008
|
editing++;
|
|
@@ -2132,7 +2135,7 @@ var NODE_ICONS = { database: "database", store: "table-2", cache: "file" };
|
|
|
2132
2135
|
var POLL_MS = 1000;
|
|
2133
2136
|
var FOLD_MS = 200;
|
|
2134
2137
|
var NOT_READ = "cannot read";
|
|
2135
|
-
var OWN_GROUP = "
|
|
2138
|
+
var OWN_GROUP = "knobs";
|
|
2136
2139
|
var kept = { expanded: new Set, seeded: false };
|
|
2137
2140
|
function labelOf(kind) {
|
|
2138
2141
|
return STORAGE_KINDS.find((entry) => entry.value === kind)?.label ?? kind;
|
|
@@ -2341,7 +2344,7 @@ function storageView(options = {}) {
|
|
|
2341
2344
|
ownLine.replaceChildren();
|
|
2342
2345
|
return;
|
|
2343
2346
|
}
|
|
2344
|
-
ownToggle.textContent = own2 ? "hide
|
|
2347
|
+
ownToggle.textContent = own2 ? "hide knobs' own" : `${hidden} hidden (knobs' own)`;
|
|
2345
2348
|
if (ownLine.children.length === 0)
|
|
2346
2349
|
ownLine.replaceChildren(ownToggle);
|
|
2347
2350
|
}
|
|
@@ -2639,7 +2642,7 @@ ${each.version}`).join(`
|
|
|
2639
2642
|
function clearAll() {
|
|
2640
2643
|
const own2 = shell.own();
|
|
2641
2644
|
countSite(site, own2).then((counts) => {
|
|
2642
|
-
const kept2 = own2 ? ",
|
|
2645
|
+
const kept2 = own2 ? ", knobs' own items too" : ". knobs' own items are kept";
|
|
2643
2646
|
shell.ask(`clear site data? ${countsText(counts)}${kept2}`, "clear site data", () => {
|
|
2644
2647
|
clearSite(site, own2).then((report) => {
|
|
2645
2648
|
shell.say(reportLines(report), {
|
package/dist/styles/force.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* states is copied into a stylesheet of devknobs' own, with each such
|
|
9
9
|
* pseudo-class `:hover` written `:is(:hover, [data-devknobs-force~="hover"])`:
|
|
10
10
|
* as heavy as before, and true where the page has the state for real too.
|
|
11
|
+
* The element carries `data-knobs-force` too, which the copied rules leave
|
|
12
|
+
* out: every copy writes the old name, an older one on the page only that.
|
|
11
13
|
* The copy keeps the `@media`, `@supports`, `@container`, `@layer` and
|
|
12
14
|
* `@scope` around a rule, and nested rules come out whole. One element at a
|
|
13
15
|
* time. Forcing is no edit: the log never sees it. To use it:
|
|
@@ -33,7 +35,7 @@ import { type Scope } from "./tree";
|
|
|
33
35
|
export declare const FORCED_STATES: readonly ["hover", "focus", "focus-visible", "active", "focus-within"];
|
|
34
36
|
export type ForcedState = (typeof FORCED_STATES)[number];
|
|
35
37
|
/** The attribute that carries the states forced, on the element and on its ancestors. */
|
|
36
|
-
export declare const FORCE_ATTRIBUTE
|
|
38
|
+
export declare const FORCE_ATTRIBUTE: "data-devknobs-force";
|
|
37
39
|
/** A selector as it matches while states are forced. The same where it has none of them. */
|
|
38
40
|
export declare function forcedSelector(selector: string): string;
|
|
39
41
|
/** Whether a state is forced anywhere now. */
|
package/dist/types.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface ClockValue {
|
|
|
53
53
|
since: number;
|
|
54
54
|
/** Clock ms per real ms while it runs. */
|
|
55
55
|
speed: number;
|
|
56
|
-
/** Send the clock's instant to the page's own origin, in an `x-
|
|
56
|
+
/** Send the clock's instant to the page's own origin, in an `x-knobs-now` header, and the old `x-devknobs-now`. */
|
|
57
57
|
header: boolean;
|
|
58
58
|
}
|
|
59
59
|
/** Emulated `navigator.onLine`. Requests still go out: only the flag and its events change. */
|
|
@@ -170,7 +170,7 @@ export interface PanelValue {
|
|
|
170
170
|
*/
|
|
171
171
|
pinned: string[];
|
|
172
172
|
}
|
|
173
|
-
export interface
|
|
173
|
+
export interface KnobsState {
|
|
174
174
|
scheme: SchemeValue;
|
|
175
175
|
motion: MotionValue;
|
|
176
176
|
speed: SpeedValue;
|
|
@@ -225,8 +225,8 @@ export interface DevknobsState {
|
|
|
225
225
|
panel: PanelValue;
|
|
226
226
|
}
|
|
227
227
|
/** A partial state update. Object knobs may be patched field by field. */
|
|
228
|
-
export type
|
|
229
|
-
[K in keyof
|
|
228
|
+
export type KnobsStatePatch = {
|
|
229
|
+
[K in keyof KnobsState]?: KnobsState[K] extends object ? Partial<KnobsState[K]> : KnobsState[K];
|
|
230
230
|
};
|
|
231
231
|
/** Every knob module applies a value and can put the page back the way it was. */
|
|
232
232
|
export interface Knob<T> {
|
package/dist/ui/actions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState, KnobsStatePatch } from "../types";
|
|
2
2
|
import type { Action } from "./catalog";
|
|
3
3
|
import { type Keys } from "./keys";
|
|
4
4
|
/**
|
|
@@ -8,8 +8,8 @@ import { type Keys } from "./keys";
|
|
|
8
8
|
*/
|
|
9
9
|
/** Where the knobs are kept, as far as running an action goes. */
|
|
10
10
|
export interface Store {
|
|
11
|
-
getState():
|
|
12
|
-
setState(patch:
|
|
11
|
+
getState(): KnobsState;
|
|
12
|
+
setState(patch: KnobsStatePatch): unknown;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Run an action from the panel: from its row, the search, the browse list or
|
package/dist/ui/bindings.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { type BaseKeys, type Binding, type Combo, type KeyLike, type Keys } from
|
|
|
4
4
|
* hold across reloads and in new tabs of the origin. Reset all leaves them. A
|
|
5
5
|
* mount with a `keysStore` keeps them there instead.
|
|
6
6
|
*/
|
|
7
|
-
export declare const KEYS_KEY = "
|
|
7
|
+
export declare const KEYS_KEY = "knobs:keys";
|
|
8
8
|
/** The version of the keys `KEYS_KEY` keeps. Bump it with a new shape, see stored.ts. */
|
|
9
9
|
export declare const KEYS_VERSION = 1;
|
|
10
10
|
/** The bindings in the order the panel lists them. */
|
package/dist/ui/catalog.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CustomColor,
|
|
1
|
+
import type { CustomColor, KnobsState, KnobsStatePatch } from "../types";
|
|
2
2
|
import type { ColorList } from "./colors";
|
|
3
3
|
import type { IconName } from "./icons";
|
|
4
4
|
import type { Binding } from "./keys";
|
|
@@ -54,13 +54,13 @@ export interface Knob {
|
|
|
54
54
|
/** More words search finds the knob by. */
|
|
55
55
|
aliases: readonly string[];
|
|
56
56
|
/** The value that is on, as one of the option values where it is one. */
|
|
57
|
-
read(state:
|
|
57
|
+
read(state: KnobsState): string;
|
|
58
58
|
/** The patch that sets the knob to a value. */
|
|
59
|
-
write(value: string, state:
|
|
59
|
+
write(value: string, state: KnobsState): KnobsStatePatch;
|
|
60
60
|
/** The patch that puts the knob back to its default. */
|
|
61
|
-
reset:
|
|
61
|
+
reset: KnobsStatePatch;
|
|
62
62
|
/** The knob's part of its row's summary, asked only while it is off its default. */
|
|
63
|
-
brief?(state:
|
|
63
|
+
brief?(state: KnobsState, live: Live): string;
|
|
64
64
|
/** What a value outside the options is called. */
|
|
65
65
|
name?(value: string): string;
|
|
66
66
|
/** A value typed out in full that is not an option, or null. */
|
|
@@ -72,14 +72,14 @@ export interface Knob {
|
|
|
72
72
|
/** False where the browser has nothing for the knob to act on. */
|
|
73
73
|
available?(): boolean;
|
|
74
74
|
/** The option values the editor shows for this state, in order, where they depend on it. */
|
|
75
|
-
offers?(state:
|
|
75
|
+
offers?(state: KnobsState): readonly string[];
|
|
76
76
|
/** False while the knob does nothing, so the editor hides it. Search still sets it. */
|
|
77
|
-
shown?(state:
|
|
77
|
+
shown?(state: KnobsState): boolean;
|
|
78
78
|
/**
|
|
79
79
|
* The value another knob brought, which stands in for the default while it
|
|
80
80
|
* does: such a value puts the knob off nothing, and its row's `×` puts it back.
|
|
81
81
|
*/
|
|
82
|
-
base?(state:
|
|
82
|
+
base?(state: KnobsState): string | undefined;
|
|
83
83
|
/** The list of colors of the user's own its swatches take, each one a value as its hex. */
|
|
84
84
|
custom?: ColorList;
|
|
85
85
|
/** Show the value it has at once, with no way there, as a color still being picked asks. */
|
|
@@ -168,9 +168,9 @@ export declare function rowOf(id: KnobId): KnobRow;
|
|
|
168
168
|
export declare function availableKnobs(): Knob[];
|
|
169
169
|
/** The knobs of a row this browser can use. */
|
|
170
170
|
export declare function knobsOf(row: Row): Knob[];
|
|
171
|
-
export declare function offDefault(knob: Knob, state:
|
|
171
|
+
export declare function offDefault(knob: Knob, state: KnobsState): boolean;
|
|
172
172
|
/** The knob's part of a row summary, empty while it is at its default. */
|
|
173
|
-
export declare function brief(knob: Knob, state:
|
|
173
|
+
export declare function brief(knob: Knob, state: KnobsState, live: Live): string;
|
|
174
174
|
/** The actions this page has something for. */
|
|
175
175
|
export declare function availableActions(): Action[];
|
|
176
176
|
/** Whether the row has a place on this page: a row of knobs always, an action's where it has one. */
|
|
@@ -181,13 +181,13 @@ export declare function rowHere(row: Row): boolean;
|
|
|
181
181
|
* place is, not as a mode: it lists no row and reset all has nothing of it to
|
|
182
182
|
* put back.
|
|
183
183
|
*/
|
|
184
|
-
export declare function isActive(row: Row, state:
|
|
184
|
+
export declare function isActive(row: Row, state: KnobsState): boolean;
|
|
185
185
|
/** What the row says it emulates, such as `390 · dpr 2`. Empty while it emulates nothing. */
|
|
186
|
-
export declare function summary(row: Row, state:
|
|
186
|
+
export declare function summary(row: Row, state: KnobsState, live: Live): string;
|
|
187
187
|
/** Patches as one, merged a level deep like the store merges them. */
|
|
188
|
-
export declare function combine(patches: readonly
|
|
188
|
+
export declare function combine(patches: readonly KnobsStatePatch[]): KnobsStatePatch;
|
|
189
189
|
/** The patch that puts every knob of the row back to its default. */
|
|
190
|
-
export declare function resetPatch(row: Row):
|
|
190
|
+
export declare function resetPatch(row: Row): KnobsStatePatch;
|
|
191
191
|
/** The browse list: every knob the browser can use, by category. */
|
|
192
192
|
export declare function browse(): {
|
|
193
193
|
category: Category;
|
package/dist/ui/changes.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare const NOT_COPIED = "could not copy";
|
|
|
20
20
|
/** Copies a text, and says whether it went, at once or once the clipboard answers. */
|
|
21
21
|
export type Copy = (text: string) => boolean | Promise<boolean>;
|
|
22
22
|
/** What the line under the buttons says, for agents that run code in the page. */
|
|
23
|
-
export declare const AGENT_NOTE = "agents read and apply edits:
|
|
23
|
+
export declare const AGENT_NOTE = "agents read and apply edits: knobs.edits() / setEdits()";
|
|
24
24
|
/** What the line about edits made again as the page loaded says. */
|
|
25
25
|
export declare function keptLine(kept: number, missed: number): string;
|
|
26
26
|
/** What the line over the kept edits that wait says: how many html and attribute edits, and the edits after them. */
|
package/dist/ui/colors.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { CustomColor } from "../types";
|
|
|
4
4
|
* them across reloads and in new tabs of the origin. Reset all leaves them,
|
|
5
5
|
* and fresh mode starts with none and keeps none.
|
|
6
6
|
*/
|
|
7
|
-
export declare const COLORS_KEY = "
|
|
7
|
+
export declare const COLORS_KEY = "knobs:colors";
|
|
8
8
|
/** The version of the colors `COLORS_KEY` keeps. Bump it with a new shape, see stored.ts. */
|
|
9
9
|
export declare const COLORS_VERSION = 1;
|
|
10
10
|
/** The most colors of the user's own a knob lists. One more takes the oldest off. */
|
package/dist/ui/deviceknobs.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState } from "../types";
|
|
2
2
|
import type { Knob } from "./catalog";
|
|
3
3
|
export declare const DEVICE: Knob;
|
|
4
4
|
/** Does the device in use have a mock to draw? */
|
|
5
|
-
export declare function hasMock(state:
|
|
5
|
+
export declare function hasMock(state: KnobsState): boolean;
|
|
6
6
|
export declare const MOCK: Knob;
|
|
7
7
|
export declare const TOUCH_POINTER: Knob;
|
|
8
8
|
export declare const BROWSER: Knob;
|
package/dist/ui/editors.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState, KnobsStatePatch } from "../types";
|
|
2
2
|
import { type Knob, type Option, type Row, type RowId } from "./catalog";
|
|
3
3
|
import { type Tips } from "./tooltip";
|
|
4
4
|
/**
|
|
@@ -7,9 +7,9 @@ import { type Tips } from "./tooltip";
|
|
|
7
7
|
* Each control comes with an update that keeps it in step with the knobs.
|
|
8
8
|
*/
|
|
9
9
|
/** What an editor control keeps in step with the knobs. */
|
|
10
|
-
export type Update = (state:
|
|
10
|
+
export type Update = (state: KnobsState) => void;
|
|
11
11
|
/** Set knobs from the panel. Their row stays listed from here on. */
|
|
12
|
-
export declare function commit(row: RowId, patch:
|
|
12
|
+
export declare function commit(row: RowId, patch: KnobsStatePatch): void;
|
|
13
13
|
export declare function set(knob: Knob, value: string): void;
|
|
14
14
|
/** What the editors need from the panel. */
|
|
15
15
|
export interface EditorsContext {
|
package/dist/ui/foldslider.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState, PostureValue } from "../types";
|
|
2
2
|
/**
|
|
3
3
|
* A slider that folds a foldable open and shut by hand, as the one on Apple's
|
|
4
4
|
* iPhone Duo page does. Experimental: it may go again. The thumb follows the
|
|
@@ -40,7 +40,7 @@ export declare function foldChip(posture: PostureValue): {
|
|
|
40
40
|
};
|
|
41
41
|
export interface FoldSlider {
|
|
42
42
|
node: HTMLElement;
|
|
43
|
-
update(state:
|
|
43
|
+
update(state: KnobsState): void;
|
|
44
44
|
/** Stop listening to the fold and the hinge. */
|
|
45
45
|
destroy(): void;
|
|
46
46
|
}
|
package/dist/ui/icons.d.ts
CHANGED
|
@@ -119,16 +119,19 @@ export declare const ICONS: {
|
|
|
119
119
|
export type IconName = keyof typeof ICONS;
|
|
120
120
|
/** A mark: its color, its path, and what is drawn behind it where it has letters. */
|
|
121
121
|
type Brand = readonly [fill: string, d: string, behind?: readonly [fill: string, d: string]];
|
|
122
|
-
export type BrandName = "javascript" | "css" | "html5" | "webassembly" | "json";
|
|
122
|
+
export type BrandName = "javascript" | "css" | "html5" | "webassembly" | "json" | "github";
|
|
123
123
|
/**
|
|
124
124
|
* The marks of what a page loads, from Simple Icons 16.6.0 (CC0, see
|
|
125
125
|
* THIRD_PARTY_NOTICES.md): each the one path of its 24 by 24 svg as it is in
|
|
126
126
|
* the package, in the color the package lists for it. The path leaves a
|
|
127
127
|
* mark's letters open, so a plain box behind them gives them the color their
|
|
128
128
|
* owner draws them in, the same in a light panel and a dark one. JSON's black
|
|
129
|
-
* is the text's color instead, which shows in both.
|
|
129
|
+
* is the text's color instead, which shows in both. GitHub's, which the
|
|
130
|
+
* settings' link to the repo shows, is the text's color too.
|
|
130
131
|
*/
|
|
131
132
|
export declare const BRANDS: Record<BrandName, Brand>;
|
|
133
|
+
/** The Vinena wordmark in the text's color, named for assistive tech. Its size is the stylesheet's. */
|
|
134
|
+
export declare function vinenaMark(): SVGElement;
|
|
132
135
|
/** Any drawing the panel has, an icon or a mark. */
|
|
133
136
|
export type GlyphName = IconName | BrandName;
|
|
134
137
|
/** The icon each row of knobs shows by its label, and its knobs in the search. */
|
package/dist/ui/keys.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare function defaultKeys(options?: {
|
|
|
59
59
|
* Marks the panel's own field where the shift letters are the panel's keys
|
|
60
60
|
* and not text. Its search is one: it finds in lower case anyway.
|
|
61
61
|
*/
|
|
62
|
-
export declare const KEYS_FIELD
|
|
62
|
+
export declare const KEYS_FIELD: "data-devknobs-keys";
|
|
63
63
|
/** Whether a key goes into any field, one of the panel's too, its search included. */
|
|
64
64
|
export declare function inField(event: Pick<KeyLike, "target" | "composedPath">): boolean;
|
|
65
65
|
/**
|
package/dist/ui/list.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState, KnobsStatePatch } from "../types";
|
|
2
2
|
import { type Knob, type Live, type Row, type RowId } from "./catalog";
|
|
3
3
|
/**
|
|
4
4
|
* Which rows the panel lists, and what they say. A row is listed while a knob
|
|
@@ -16,9 +16,9 @@ import { type Knob, type Live, type Row, type RowId } from "./catalog";
|
|
|
16
16
|
* or dragged to, then the rest in the catalog's, so a row listed for being off
|
|
17
17
|
* its default stands at the end.
|
|
18
18
|
*/
|
|
19
|
-
export declare function rowOrder(state:
|
|
19
|
+
export declare function rowOrder(state: KnobsState): RowId[];
|
|
20
20
|
/** The rows listed, in the order they stand. */
|
|
21
|
-
export declare function listedOrder(state:
|
|
21
|
+
export declare function listedOrder(state: KnobsState): RowId[];
|
|
22
22
|
/** A list with the item at `from` taken out and put back at `to`, both held inside it. */
|
|
23
23
|
export declare function moveItem<T>(items: readonly T[], from: number, to: number): T[];
|
|
24
24
|
/**
|
|
@@ -34,27 +34,27 @@ export declare function arrange<T>(items: readonly T[], wanted: readonly T[], ke
|
|
|
34
34
|
* as it then stands, so a row listed only for being off its default is
|
|
35
35
|
* pinned where it was put.
|
|
36
36
|
*/
|
|
37
|
-
export declare function movePatch(state:
|
|
37
|
+
export declare function movePatch(state: KnobsState, from: number, to: number): KnobsStatePatch;
|
|
38
38
|
/** The patch that sets knobs from the panel and pins their row. */
|
|
39
|
-
export declare function pinPatch(state:
|
|
39
|
+
export declare function pinPatch(state: KnobsState, id: RowId, patch: KnobsStatePatch): KnobsStatePatch;
|
|
40
40
|
/**
|
|
41
41
|
* The patch a click on a row's `×` sends: its knobs back to their defaults,
|
|
42
42
|
* and the row pinned, so it stays listed. A value another knob brought stays,
|
|
43
43
|
* so the viewport's `×` leaves a device its size.
|
|
44
44
|
*/
|
|
45
|
-
export declare function resetRowPatch(state:
|
|
45
|
+
export declare function resetRowPatch(state: KnobsState, row: Row): KnobsStatePatch;
|
|
46
46
|
/**
|
|
47
47
|
* The patch a hold on a row's `×` sends: its knobs back as a click puts them,
|
|
48
48
|
* and the row off the list.
|
|
49
49
|
*/
|
|
50
|
-
export declare function removePatch(state:
|
|
50
|
+
export declare function removePatch(state: KnobsState, row: Row): KnobsStatePatch;
|
|
51
51
|
/**
|
|
52
52
|
* Would reset all change nothing: every knob at its default, and the default
|
|
53
53
|
* rows listed alone, in their order? An id no row has here, such as one an
|
|
54
54
|
* older or a newer version kept, is not listed and counts for nothing.
|
|
55
55
|
*/
|
|
56
|
-
export declare function isReset(state:
|
|
57
|
-
export declare function isListed(row: Row, state:
|
|
56
|
+
export declare function isReset(state: KnobsState): boolean;
|
|
57
|
+
export declare function isListed(row: Row, state: KnobsState): boolean;
|
|
58
58
|
/**
|
|
59
59
|
* Whether a knob shows its label over its control. A knob named as its row is
|
|
60
60
|
* already named by the row's title, so the label would only say it again.
|
|
@@ -65,4 +65,4 @@ export declare function showsLabel(row: Row, knob: Knob): boolean;
|
|
|
65
65
|
* back at. An action's says what it emulates, else whether its mode is on,
|
|
66
66
|
* and nothing with no mode.
|
|
67
67
|
*/
|
|
68
|
-
export declare function rowText(row: Row, state:
|
|
68
|
+
export declare function rowText(row: Row, state: KnobsState, live: Live): string;
|
package/dist/ui/palette.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState } from "../types";
|
|
2
2
|
import { type Action } from "./catalog";
|
|
3
3
|
import type { Rows } from "./rows";
|
|
4
4
|
import type { Slide } from "./slide";
|
|
@@ -49,7 +49,7 @@ export interface Palette {
|
|
|
49
49
|
searching(): boolean;
|
|
50
50
|
/** Stop browsing and drop the query, without drawing anything. */
|
|
51
51
|
clear(): void;
|
|
52
|
-
renderBody(state:
|
|
52
|
+
renderBody(state: KnobsState): void;
|
|
53
53
|
leaveSearch(): void;
|
|
54
54
|
startBrowsing(text?: string): void;
|
|
55
55
|
onGrab(on: boolean): void;
|
package/dist/ui/panel.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export interface PanelOptions {
|
|
|
22
22
|
handle?: boolean;
|
|
23
23
|
/** Who runs the panel, the host or the page, where a host gives the choice. */
|
|
24
24
|
prefer?: PanelPrefer;
|
|
25
|
+
/** A host, such as the extension, runs this copy, and not the page. */
|
|
26
|
+
host?: boolean;
|
|
25
27
|
}
|
|
26
28
|
/** A host's choice of who runs the panel, as the settings and the footer show it. */
|
|
27
29
|
export interface PanelPrefer {
|
package/dist/ui/pin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsStatePatch, PanelValue } from "../types";
|
|
2
2
|
import type { Action } from "./catalog";
|
|
3
3
|
/**
|
|
4
4
|
* Pinning the panel to its side, as devtools dock: the control in the footer
|
|
@@ -6,7 +6,7 @@ import type { Action } from "./catalog";
|
|
|
6
6
|
* controls a pinned panel shows beside it.
|
|
7
7
|
*/
|
|
8
8
|
/** The patch that pins a floating panel and lets a pinned one float. Nothing else of it changes. */
|
|
9
|
-
export declare function pinPatch(panel: Pick<PanelValue, "docked">):
|
|
9
|
+
export declare function pinPatch(panel: Pick<PanelValue, "docked">): KnobsStatePatch;
|
|
10
10
|
/**
|
|
11
11
|
* Pin the panel, or let it float again, and keep that for new tabs, as it is
|
|
12
12
|
* a move the user made.
|
package/dist/ui/prefs.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Where the panel's preferences the user set are kept, in `localStorage`, so
|
|
3
3
|
* they hold across reloads and in new tabs of the origin. Reset all leaves them.
|
|
4
4
|
*/
|
|
5
|
-
export declare const PREFS_KEY = "
|
|
5
|
+
export declare const PREFS_KEY = "knobs:prefs";
|
|
6
6
|
/** The version of the preferences `PREFS_KEY` keeps. Bump it with a new shape, see stored.ts. */
|
|
7
7
|
export declare const PREFS_VERSION = 6;
|
|
8
8
|
/** How the styles view shows an element: what applies to it, or every rule in cascade order. */
|
package/dist/ui/rows.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState } from "../types";
|
|
2
2
|
import { type Knob, type Live, type Row, type RowId } from "./catalog";
|
|
3
3
|
import { type Update } from "./editors";
|
|
4
4
|
import type { Keys } from "./keys";
|
|
@@ -59,9 +59,9 @@ export interface Rows {
|
|
|
59
59
|
focusCustom(knob: Knob): void;
|
|
60
60
|
showRow(id: RowId, knob: Knob): void;
|
|
61
61
|
/** Draw the rows for a state, and say whether any shows. */
|
|
62
|
-
renderRows(state:
|
|
62
|
+
renderRows(state: KnobsState, live: Live): boolean;
|
|
63
63
|
/** Draw the readouts that run with the clock. */
|
|
64
|
-
tick(state:
|
|
64
|
+
tick(state: KnobsState, live: Live): void;
|
|
65
65
|
/** Show the keys in force on the actions' rows. */
|
|
66
66
|
drawKeys(now: Keys): void;
|
|
67
67
|
/** Whether a row is being dragged by its grip. */
|
package/dist/ui/settings.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export interface SettingsContext {
|
|
|
64
64
|
} | null;
|
|
65
65
|
/** The user picked who runs the panel. */
|
|
66
66
|
setPrefer(value: PreferValue): void;
|
|
67
|
+
/** A host, such as the extension, runs this copy, and not the page. */
|
|
68
|
+
host: boolean;
|
|
67
69
|
/** Whether the search is open. */
|
|
68
70
|
searching(): boolean;
|
|
69
71
|
leaveSearch(): void;
|
|
@@ -111,8 +113,16 @@ export interface KeepRow {
|
|
|
111
113
|
* run from source has no version to give.
|
|
112
114
|
*/
|
|
113
115
|
export declare function feedbackUrl(version: string, page: string): string;
|
|
114
|
-
/**
|
|
116
|
+
/** A row of the settings: a link that opens the feedback page in a new tab, and sends nothing itself. */
|
|
115
117
|
export declare function feedbackRow(): HTMLElement;
|
|
118
|
+
/** The repo of devknobs. */
|
|
119
|
+
export declare const REPO_URL = "https://github.com/vinenastudio/knobs";
|
|
120
|
+
/** The row after send feedback: a link that opens the repo in a new tab. */
|
|
121
|
+
export declare function githubRow(): HTMLElement;
|
|
122
|
+
/** The studio's site, as knobs.dev links to it, with the copy the link is in: the extension's or a page's. */
|
|
123
|
+
export declare function vinenaUrl(host: boolean): string;
|
|
124
|
+
/** The last line of the settings: the studio's credit, its words and its wordmark one link. */
|
|
125
|
+
export declare function creditRow(host: boolean): HTMLElement;
|
|
116
126
|
/**
|
|
117
127
|
* The switch that keeps the page's edits after a reload, as the keeper has
|
|
118
128
|
* it, and off to a click until the keeper knows what the page keeps.
|
package/dist/ui/storageview.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ export declare const POLL_MS = 1000;
|
|
|
35
35
|
export declare const FOLD_MS = 200;
|
|
36
36
|
/** What a node says where its store cannot be read. Why is in its tooltip. */
|
|
37
37
|
export declare const NOT_READ = "cannot read";
|
|
38
|
-
/** What the presets' node stands under in the tree: they are
|
|
39
|
-
export declare const OWN_GROUP = "
|
|
38
|
+
/** What the presets' node stands under in the tree: they are knobs' own, and not the page's. */
|
|
39
|
+
export declare const OWN_GROUP = "knobs";
|
|
40
40
|
/** The keys nodes under a store are remembered by. */
|
|
41
41
|
export declare function databaseKey(name: string): string;
|
|
42
42
|
export declare function storeKey(database: string, store: string): string;
|
package/dist/ui/stylesview.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ import type { Locate } from "../edit/source";
|
|
|
35
35
|
import { inspect, invalidate } from "../styles";
|
|
36
36
|
import { type Forcing } from "../styles/force";
|
|
37
37
|
import type { BoxRing } from "../grab/boxmodel";
|
|
38
|
-
import type {
|
|
38
|
+
import type { KnobsState } from "../types";
|
|
39
39
|
import { type BoxReading } from "./boxdiagram";
|
|
40
40
|
import type { HtmlSize, StylesMode } from "./prefs";
|
|
41
41
|
import type { Tips } from "./tooltip";
|
|
@@ -111,8 +111,8 @@ export interface StylesContext {
|
|
|
111
111
|
export interface StylesPage {
|
|
112
112
|
inspect: typeof inspect;
|
|
113
113
|
invalidate: typeof invalidate;
|
|
114
|
-
getState():
|
|
115
|
-
subscribe(listener: (state:
|
|
114
|
+
getState(): KnobsState;
|
|
115
|
+
subscribe(listener: (state: KnobsState) => void): () => void;
|
|
116
116
|
/** The browser's word on whether a text is a color. */
|
|
117
117
|
isColor(text: string): boolean;
|
|
118
118
|
/** The element's box, or null where it has none to read. */
|
package/dist/ui/swatches.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KnobsState } from "../types";
|
|
2
2
|
import type { Knob } from "./catalog";
|
|
3
3
|
import { type LiveColors } from "./colors";
|
|
4
4
|
/**
|
|
@@ -23,4 +23,4 @@ export interface SwatchesContext {
|
|
|
23
23
|
/** Say no to what a control was given, and why. */
|
|
24
24
|
refuse(node: HTMLElement, reason: string): void;
|
|
25
25
|
}
|
|
26
|
-
export declare function swatchList(knob: Knob, context: SwatchesContext): [HTMLElement, (state:
|
|
26
|
+
export declare function swatchList(knob: Knob, context: SwatchesContext): [HTMLElement, (state: KnobsState) => void];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinena/knobs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Mert Düzgün",
|
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"type": "module",
|
|
19
19
|
"types": "./dist/index.d.ts",
|
|
20
20
|
"main": "./dist/index.js",
|
|
21
|
+
"bin": {
|
|
22
|
+
"knobs": "./dist/cli.js"
|
|
23
|
+
},
|
|
21
24
|
"files": [
|
|
22
25
|
"dist",
|
|
23
26
|
"skills",
|
|
@@ -38,7 +41,7 @@
|
|
|
38
41
|
"./bezels/*": "./dist/bezels/*"
|
|
39
42
|
},
|
|
40
43
|
"scripts": {
|
|
41
|
-
"build": "bun scripts/bezelurls.ts && bun -e 'require(\"fs\").rmSync(\"dist.tmp\",{recursive:true,force:true})' && bun build src/index.ts --outdir dist.tmp --format esm --splitting --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/react.tsx --outdir dist.tmp --format esm --splitting --external react --banner '\"use client\";' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/global.ts --outfile dist.tmp/index.global.js --format iife --minify --define 'import.meta.url=\"\"' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/early.ts --outfile dist.tmp/early.global.js --format iife --minify --define DEVKNOBS_TUNE=false && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist.tmp && rm -f dist.tmp/engine/foldtune.d.ts && if [ -d assets/bezels ]; then cp -R assets/bezels dist.tmp/bezels; fi && bun scripts/useclient.ts && bun scripts/tunefree.ts && bun -e 'const fs=require(\"fs\");fs.rmSync(\"dist\",{recursive:true,force:true});fs.renameSync(\"dist.tmp\",\"dist\")'",
|
|
44
|
+
"build": "bun scripts/bezelurls.ts && bun -e 'require(\"fs\").rmSync(\"dist.tmp\",{recursive:true,force:true})' && bun build src/index.ts --outdir dist.tmp --format esm --splitting --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/react.tsx --outdir dist.tmp --format esm --splitting --external react --banner '\"use client\";' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/global.ts --outfile dist.tmp/index.global.js --format iife --minify --define 'import.meta.url=\"\"' --define DEVKNOBS_TUNE=false --define DEVKNOBS_VERSION=\\\"${DEVKNOBS_VERSION:-$npm_package_version}\\\" && bun build src/early.ts --outfile dist.tmp/early.global.js --format iife --minify --define DEVKNOBS_TUNE=false && bun build src/cli.ts --outfile dist.tmp/cli.js --target node --format esm && tsc --emitDeclarationOnly --project tsconfig.build.json --outDir dist.tmp && rm -f dist.tmp/engine/foldtune.d.ts && if [ -d assets/bezels ]; then cp -R assets/bezels dist.tmp/bezels; fi && bun scripts/useclient.ts && bun scripts/tunefree.ts && bun -e 'const fs=require(\"fs\");fs.rmSync(\"dist\",{recursive:true,force:true});fs.renameSync(\"dist.tmp\",\"dist\")'",
|
|
42
45
|
"link": "bun scripts/link.ts link",
|
|
43
46
|
"unlink": "bun scripts/link.ts unlink",
|
|
44
47
|
"test": "bun test",
|