@vinena/knobs 0.7.0 → 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 +18 -0
- package/README.md +2 -2
- package/dist/cli.js +2 -2
- 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 +1 -1
- package/dist/{elementsview-m33ejs4r.js → elementsview-mcg6d5zp.js} +21 -19
- package/dist/{elementsview-jg4edt86.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-40pzennw.js → framekit-4v7nc3ea.js} +23 -18
- package/dist/{framekit-r16k97n7.js → framekit-wyppj1se.js} +23 -18
- 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-s6fya8pm.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-0qkj2mgb.js → index-82y8x8vv.js} +14 -11
- package/dist/{index-tqq2ygpj.js → index-9targr2f.js} +26 -16
- package/dist/{index-8d1yk9d2.js → index-a23nv5j4.js} +59 -39
- package/dist/{index-t4kssacm.js → index-abwqw8jh.js} +6 -1
- package/dist/{index-s6yzsvs4.js → index-bgzyc7rz.js} +22 -15
- package/dist/{index-xxbb8y41.js → index-c1t6knbf.js} +20 -14
- package/dist/{index-3nwycv3p.js → index-cqymjce4.js} +20 -14
- package/dist/{index-v2v4rmpe.js → index-dvtbh3c8.js} +24 -18
- package/dist/{index-cb91vcka.js → index-k4w5v53q.js} +1 -1
- package/dist/{index-q53j8wg5.js → index-n31pn4ax.js} +19 -15
- package/dist/{index-ymqm185m.js → index-rps0bdq9.js} +1 -1
- package/dist/{index-a8ffw5ft.js → index-szd9bddn.js} +1 -1
- package/dist/{index-2jc9dnta.js → index-vhda420r.js} +11 -5
- package/dist/{index-xs29b55n.js → index-vmprrfwe.js} +5 -2
- package/dist/{index-fjrrgd9h.js → index-vmz7htwn.js} +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.global.js +159 -159
- package/dist/index.js +57 -32
- package/dist/instance.d.ts +7 -1
- package/dist/mark.d.ts +50 -0
- package/dist/{react-0gxs9aef.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-6ngtb6p9.js → react-7eyps0cg.js} +1 -1
- package/dist/{react-vvc4x9kq.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-meve34wp.js → react-hdneb4v3.js} +11 -5
- package/dist/{react-h9w04skh.js → react-j87bdhhe.js} +4 -1
- package/dist/{react-wtgvkf6g.js → react-mkafgzqf.js} +1 -1
- package/dist/{react-zp7fdw8e.js → react-ppyj3fg2.js} +59 -39
- package/dist/{react-0r5418av.js → react-rbmk30xk.js} +92 -29
- package/dist/{react-actmnkwp.js → react-rxw73n04.js} +1 -1
- package/dist/{react-5h7pxnax.js → react-tet7swk2.js} +22 -15
- package/dist/{react-8nmtt0ge.js → react-w94cfn87.js} +19 -15
- package/dist/{react-fq4551ks.js → react-wzd3cfg8.js} +11 -10
- package/dist/{react-3ev6rwqz.js → react-x209et38.js} +26 -16
- package/dist/react.d.ts +3 -1
- package/dist/react.js +60 -33
- package/dist/{replay-pmesjfa3.js → replay-3xqgt3xg.js} +8 -8
- package/dist/{replay-m5g8km9y.js → replay-48gn27bj.js} +8 -8
- package/dist/storage/onload.d.ts +1 -1
- package/dist/{storageview-9a6zm47z.js → storageview-2rvwk0v7.js} +16 -13
- package/dist/{storageview-x62v1c3j.js → storageview-6vq7nz02.js} +16 -13
- 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/keys.d.ts +1 -1
- package/dist/ui/list.d.ts +10 -10
- package/dist/ui/palette.d.ts +2 -2
- 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/storageview.d.ts +2 -2
- package/dist/ui/stylesview.d.ts +3 -3
- package/dist/ui/swatches.d.ts +2 -2
- package/package.json +1 -1
- package/skills/knobs/SKILL.md +36 -35
- package/dist/index-5tv6sr74.js +0 -23
- package/dist/react-t2qnewz2.js +0 -24
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
ATTRIBUTES,
|
|
4
|
+
findOwn,
|
|
5
|
+
hasMark,
|
|
6
|
+
isMarked,
|
|
7
|
+
markOwn
|
|
8
|
+
} from "./react-4qn9vsjw.js";
|
|
2
9
|
|
|
3
10
|
// src/engine/clock.ts
|
|
4
11
|
var HOUR = 3600000;
|
|
@@ -488,6 +495,60 @@ function stamped(value, v) {
|
|
|
488
495
|
return { v, ...value };
|
|
489
496
|
}
|
|
490
497
|
|
|
498
|
+
// src/engine/storekeys.ts
|
|
499
|
+
var NAME = "knobs";
|
|
500
|
+
var OLD_NAME = "devknobs";
|
|
501
|
+
function oldKey(key) {
|
|
502
|
+
if (key === NAME)
|
|
503
|
+
return OLD_NAME;
|
|
504
|
+
return key.startsWith(`${NAME}:`) ? `${OLD_NAME}${key.slice(NAME.length)}` : key;
|
|
505
|
+
}
|
|
506
|
+
function ownName(key) {
|
|
507
|
+
if (key === NAME || key.startsWith(`${NAME}:`))
|
|
508
|
+
return key;
|
|
509
|
+
if (key === OLD_NAME)
|
|
510
|
+
return NAME;
|
|
511
|
+
return key.startsWith(`${OLD_NAME}:`) ? `${NAME}${key.slice(OLD_NAME.length)}` : null;
|
|
512
|
+
}
|
|
513
|
+
function isOwnKey(key) {
|
|
514
|
+
return ownName(key) !== null;
|
|
515
|
+
}
|
|
516
|
+
function sameItem(eventKey, key) {
|
|
517
|
+
return eventKey === key || eventKey === oldKey(key);
|
|
518
|
+
}
|
|
519
|
+
function readItem(storage, key) {
|
|
520
|
+
if (!storage)
|
|
521
|
+
return null;
|
|
522
|
+
return storage.getItem(oldKey(key));
|
|
523
|
+
}
|
|
524
|
+
function writeItem(storage, key, value) {
|
|
525
|
+
if (!storage)
|
|
526
|
+
return;
|
|
527
|
+
const old = oldKey(key);
|
|
528
|
+
storage.setItem(old, value);
|
|
529
|
+
if (old !== key)
|
|
530
|
+
storage.setItem(key, value);
|
|
531
|
+
}
|
|
532
|
+
function removeItem(storage, key) {
|
|
533
|
+
if (!storage)
|
|
534
|
+
return;
|
|
535
|
+
storage.removeItem(key);
|
|
536
|
+
storage.removeItem(oldKey(key));
|
|
537
|
+
}
|
|
538
|
+
function itemKeys(storage, prefix) {
|
|
539
|
+
const old = oldKey(prefix);
|
|
540
|
+
const keys = [];
|
|
541
|
+
for (let index = 0;index < storage.length; index++) {
|
|
542
|
+
const key = storage.key(index);
|
|
543
|
+
if (key === null || !key.startsWith(old))
|
|
544
|
+
continue;
|
|
545
|
+
const name = ownName(key) ?? key;
|
|
546
|
+
if (name.startsWith(prefix))
|
|
547
|
+
keys.push(name);
|
|
548
|
+
}
|
|
549
|
+
return keys;
|
|
550
|
+
}
|
|
551
|
+
|
|
491
552
|
// src/grab/boxmodel.ts
|
|
492
553
|
var RINGS = ["margin", "border", "padding", "content"];
|
|
493
554
|
var SIDES = ["top", "right", "bottom", "left"];
|
|
@@ -1126,9 +1187,9 @@ function anchorScroll(pointer, scroll, before, after) {
|
|
|
1126
1187
|
}
|
|
1127
1188
|
|
|
1128
1189
|
// src/engine/store.ts
|
|
1129
|
-
var STORAGE_KEY = "
|
|
1190
|
+
var STORAGE_KEY = "knobs";
|
|
1130
1191
|
var STATE_VERSION = 2;
|
|
1131
|
-
var PLACE_KEY = "
|
|
1192
|
+
var PLACE_KEY = "knobs:place";
|
|
1132
1193
|
var PLACE_VERSION = 2;
|
|
1133
1194
|
var DEFAULT_PINNED = ["device", "scheme", "text", "locale"];
|
|
1134
1195
|
var PANEL_START = 128;
|
|
@@ -1387,7 +1448,7 @@ function merge(state, patch) {
|
|
|
1387
1448
|
}
|
|
1388
1449
|
function item(kind, key) {
|
|
1389
1450
|
try {
|
|
1390
|
-
return webStorage(kind)
|
|
1451
|
+
return readItem(webStorage(kind), key);
|
|
1391
1452
|
} catch {
|
|
1392
1453
|
return null;
|
|
1393
1454
|
}
|
|
@@ -1399,17 +1460,17 @@ function load() {
|
|
|
1399
1460
|
function save(state) {
|
|
1400
1461
|
try {
|
|
1401
1462
|
const { realPhone: _, ...panel } = state.panel;
|
|
1402
|
-
webStorage("session")
|
|
1463
|
+
writeItem(webStorage("session"), STORAGE_KEY, JSON.stringify(stamped({ ...state, panel }, STATE_VERSION)));
|
|
1403
1464
|
} catch {}
|
|
1404
1465
|
}
|
|
1405
1466
|
function keepPlace(state) {
|
|
1406
1467
|
try {
|
|
1407
|
-
webStorage("local")
|
|
1468
|
+
writeItem(webStorage("local"), PLACE_KEY, placeText(state));
|
|
1408
1469
|
} catch {}
|
|
1409
1470
|
}
|
|
1410
1471
|
|
|
1411
1472
|
// src/engine/frame.ts
|
|
1412
|
-
var FRAME_ATTRIBUTE =
|
|
1473
|
+
var FRAME_ATTRIBUTE = ATTRIBUTES.frame;
|
|
1413
1474
|
var FRAME_NAME = "devknobs-frame";
|
|
1414
1475
|
var SIZE_MIN = 120;
|
|
1415
1476
|
var SIZE_MAX = 8192;
|
|
@@ -1431,7 +1492,8 @@ var KEY_ACTIONS = [
|
|
|
1431
1492
|
];
|
|
1432
1493
|
function isDevknobsFrame() {
|
|
1433
1494
|
try {
|
|
1434
|
-
|
|
1495
|
+
const owner = window.frameElement;
|
|
1496
|
+
if (owner && hasMark(owner, FRAME_ATTRIBUTE))
|
|
1435
1497
|
return true;
|
|
1436
1498
|
} catch {}
|
|
1437
1499
|
return window.name === FRAME_NAME;
|
|
@@ -1567,23 +1629,24 @@ function post(target, message) {
|
|
|
1567
1629
|
// src/engine/fresh.ts
|
|
1568
1630
|
var FRESH_PARAM = "devknobs";
|
|
1569
1631
|
var FRESH_VALUE = "fresh";
|
|
1570
|
-
var
|
|
1571
|
-
var
|
|
1632
|
+
var KNOBS_FRESH_PARAM = "knobs";
|
|
1633
|
+
var FRESH_ATTRIBUTE = ATTRIBUTES.fresh;
|
|
1634
|
+
var FRESH_RELOAD_KEY = "knobs:fresh-reload";
|
|
1572
1635
|
var FRESH_RELOAD_VERSION = 1;
|
|
1573
1636
|
var FRESH_RELOAD_WINDOW = 1e4;
|
|
1574
|
-
var KEPT = "
|
|
1637
|
+
var KEPT = "knobs:locale-";
|
|
1575
1638
|
var MODE = Symbol.for("devknobs.fresh");
|
|
1576
1639
|
function freshIn(search) {
|
|
1577
1640
|
try {
|
|
1578
|
-
|
|
1641
|
+
const query = new URLSearchParams(search);
|
|
1642
|
+
return [KNOBS_FRESH_PARAM, FRESH_PARAM].some((name) => query.getAll(name).includes(FRESH_VALUE));
|
|
1579
1643
|
} catch {
|
|
1580
1644
|
return false;
|
|
1581
1645
|
}
|
|
1582
1646
|
}
|
|
1583
1647
|
function wiped(key) {
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
return key.startsWith(`${FRESH_PARAM}:`) && !key.startsWith(KEPT);
|
|
1648
|
+
const name = ownName(key);
|
|
1649
|
+
return name !== null && !name.startsWith(KEPT);
|
|
1587
1650
|
}
|
|
1588
1651
|
function reloadAt(text2) {
|
|
1589
1652
|
if (!text2)
|
|
@@ -1601,8 +1664,8 @@ function reloadAt(text2) {
|
|
|
1601
1664
|
function begin() {
|
|
1602
1665
|
try {
|
|
1603
1666
|
const session = window.sessionStorage;
|
|
1604
|
-
const age = realNow() - reloadAt(session
|
|
1605
|
-
|
|
1667
|
+
const age = realNow() - reloadAt(readItem(session, FRESH_RELOAD_KEY));
|
|
1668
|
+
removeItem(session, FRESH_RELOAD_KEY);
|
|
1606
1669
|
if (age >= 0 && age < FRESH_RELOAD_WINDOW)
|
|
1607
1670
|
return;
|
|
1608
1671
|
const keys = [];
|
|
@@ -1617,14 +1680,14 @@ function begin() {
|
|
|
1617
1680
|
}
|
|
1618
1681
|
function settle2() {
|
|
1619
1682
|
try {
|
|
1620
|
-
window.sessionStorage
|
|
1683
|
+
removeItem(window.sessionStorage, FRESH_RELOAD_KEY);
|
|
1621
1684
|
} catch {}
|
|
1622
1685
|
}
|
|
1623
1686
|
function framedFresh() {
|
|
1624
1687
|
try {
|
|
1625
1688
|
const owner = window.frameElement;
|
|
1626
1689
|
if (owner)
|
|
1627
|
-
return owner
|
|
1690
|
+
return hasMark(owner, FRESH_ATTRIBUTE);
|
|
1628
1691
|
} catch {}
|
|
1629
1692
|
return window.name === FRAME_NAME && freshIn(window.location?.search ?? "");
|
|
1630
1693
|
}
|
|
@@ -1690,7 +1753,7 @@ function ownReload() {
|
|
|
1690
1753
|
return;
|
|
1691
1754
|
try {
|
|
1692
1755
|
const record2 = stamped({ at: realNow() }, FRESH_RELOAD_VERSION);
|
|
1693
|
-
window.sessionStorage
|
|
1756
|
+
writeItem(window.sessionStorage, FRESH_RELOAD_KEY, JSON.stringify(record2));
|
|
1694
1757
|
} catch {}
|
|
1695
1758
|
}
|
|
1696
1759
|
|
|
@@ -2116,13 +2179,13 @@ function watchSheets() {
|
|
|
2116
2179
|
observer = new MutationObserver((records) => {
|
|
2117
2180
|
for (const record2 of records) {
|
|
2118
2181
|
const target = record2.target;
|
|
2119
|
-
if (target.nodeName === "STYLE" && !target
|
|
2182
|
+
if (target.nodeName === "STYLE" && !isMarked(target))
|
|
2120
2183
|
schedule();
|
|
2121
2184
|
for (const node of Array.from(record2.addedNodes)) {
|
|
2122
2185
|
const name = node.nodeName;
|
|
2123
2186
|
if (name !== "STYLE" && name !== "LINK")
|
|
2124
2187
|
continue;
|
|
2125
|
-
if (node
|
|
2188
|
+
if (isMarked(node))
|
|
2126
2189
|
continue;
|
|
2127
2190
|
if (name === "LINK")
|
|
2128
2191
|
node.addEventListener("load", schedule, { once: true });
|
|
@@ -2347,7 +2410,7 @@ function ensureObserver() {
|
|
|
2347
2410
|
const name = node.nodeName;
|
|
2348
2411
|
if (name !== "STYLE" && name !== "LINK")
|
|
2349
2412
|
continue;
|
|
2350
|
-
if (node
|
|
2413
|
+
if (isMarked(node))
|
|
2351
2414
|
continue;
|
|
2352
2415
|
if (name === "LINK")
|
|
2353
2416
|
node.addEventListener("load", schedule2, { once: true });
|
|
@@ -2575,7 +2638,7 @@ function destroy() {
|
|
|
2575
2638
|
|
|
2576
2639
|
// src/engine/style.ts
|
|
2577
2640
|
var OWN2 = Symbol.for("devknobs.own");
|
|
2578
|
-
var
|
|
2641
|
+
var NAME2 = Symbol.for("devknobs.name");
|
|
2579
2642
|
var TEXT = Symbol.for("devknobs.text");
|
|
2580
2643
|
var wrapped = new WeakMap;
|
|
2581
2644
|
function isDocument(root) {
|
|
@@ -2622,7 +2685,7 @@ function adopt(root, Sheet, name) {
|
|
|
2622
2685
|
const sheet = new Sheet;
|
|
2623
2686
|
Reflect.set(sheet, OWN2, true);
|
|
2624
2687
|
if (name !== undefined)
|
|
2625
|
-
Reflect.set(sheet,
|
|
2688
|
+
Reflect.set(sheet, NAME2, name);
|
|
2626
2689
|
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
2627
2690
|
return wrap(root, sheet);
|
|
2628
2691
|
}
|
|
@@ -2664,7 +2727,7 @@ function switchedSheet(root, name) {
|
|
|
2664
2727
|
};
|
|
2665
2728
|
}
|
|
2666
2729
|
const style = documentOf(root).createElement("style");
|
|
2667
|
-
style
|
|
2730
|
+
markOwn(style, name);
|
|
2668
2731
|
if (isDocument(root))
|
|
2669
2732
|
(root.head ?? root.documentElement).appendChild(style);
|
|
2670
2733
|
else
|
|
@@ -2687,8 +2750,8 @@ function switchedSheet(root, name) {
|
|
|
2687
2750
|
};
|
|
2688
2751
|
}
|
|
2689
2752
|
function findStyle(name, doc = document) {
|
|
2690
|
-
const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own,
|
|
2691
|
-
return sheet ? wrap(doc, sheet) : doc
|
|
2753
|
+
const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own, NAME2) === name) : undefined;
|
|
2754
|
+
return sheet ? wrap(doc, sheet) : findOwn(doc, name, "style");
|
|
2692
2755
|
}
|
|
2693
2756
|
function ensureStyle(name, doc = document) {
|
|
2694
2757
|
const existing = findStyle(name, doc);
|
|
@@ -2698,7 +2761,7 @@ function ensureStyle(name, doc = document) {
|
|
|
2698
2761
|
if (Sheet)
|
|
2699
2762
|
return adopt(doc, Sheet, name);
|
|
2700
2763
|
const style = doc.createElement("style");
|
|
2701
|
-
style
|
|
2764
|
+
markOwn(style, name);
|
|
2702
2765
|
(doc.head ?? doc.documentElement).appendChild(style);
|
|
2703
2766
|
return style;
|
|
2704
2767
|
}
|
|
@@ -2706,4 +2769,4 @@ function removeStyle(name, doc = document) {
|
|
|
2706
2769
|
findStyle(name, doc)?.remove();
|
|
2707
2770
|
}
|
|
2708
2771
|
|
|
2709
|
-
export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, mentionsFeature, authoredQuery, walkRules, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };
|
|
2772
|
+
export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, isOwnKey, sameItem, readItem, writeItem, removeItem, itemKeys, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, mentionsFeature, authoredQuery, walkRules, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };
|
|
@@ -10,16 +10,23 @@ import {
|
|
|
10
10
|
knobFrame,
|
|
11
11
|
newer,
|
|
12
12
|
parseHex,
|
|
13
|
+
readItem,
|
|
13
14
|
realNow,
|
|
15
|
+
removeItem,
|
|
14
16
|
removeStyle,
|
|
15
17
|
screenOf,
|
|
16
18
|
stamped,
|
|
17
19
|
turn,
|
|
18
|
-
webStorage
|
|
19
|
-
|
|
20
|
+
webStorage,
|
|
21
|
+
writeItem
|
|
22
|
+
} from "./react-rbmk30xk.js";
|
|
23
|
+
import {
|
|
24
|
+
findOwn,
|
|
25
|
+
ownSelector
|
|
26
|
+
} from "./react-4qn9vsjw.js";
|
|
20
27
|
|
|
21
28
|
// src/engine/scrollkeep.ts
|
|
22
|
-
var SCROLL_KEY = "
|
|
29
|
+
var SCROLL_KEY = "knobs:scroll";
|
|
23
30
|
var SCROLL_VERSION = 1;
|
|
24
31
|
var SCROLL_WINDOW = 1e4;
|
|
25
32
|
var HOLD = 2000;
|
|
@@ -148,11 +155,11 @@ function keep(view, role) {
|
|
|
148
155
|
const session = webStorage("session");
|
|
149
156
|
if (!session)
|
|
150
157
|
return;
|
|
151
|
-
const kept = keptWith(parseKept(session
|
|
158
|
+
const kept = keptWith(parseKept(readItem(session, SCROLL_KEY)), role, placeIn(view), realNow());
|
|
152
159
|
if (kept)
|
|
153
|
-
session
|
|
160
|
+
writeItem(session, SCROLL_KEY, JSON.stringify(stamped(kept, SCROLL_VERSION)));
|
|
154
161
|
else
|
|
155
|
-
|
|
162
|
+
removeItem(session, SCROLL_KEY);
|
|
156
163
|
} catch {}
|
|
157
164
|
}
|
|
158
165
|
function keepOwn() {
|
|
@@ -169,15 +176,15 @@ function resume() {
|
|
|
169
176
|
let target = null;
|
|
170
177
|
try {
|
|
171
178
|
const session = webStorage("session");
|
|
172
|
-
const text = session
|
|
179
|
+
const text = readItem(session, SCROLL_KEY);
|
|
173
180
|
if (!session || text === null)
|
|
174
181
|
return;
|
|
175
182
|
const role = isDevknobsFrame() ? "frame" : "page";
|
|
176
183
|
const { place, rest } = take(parseKept(text), role, window.location.pathname, realNow());
|
|
177
184
|
if (rest)
|
|
178
|
-
session
|
|
185
|
+
writeItem(session, SCROLL_KEY, JSON.stringify(stamped(rest, SCROLL_VERSION)));
|
|
179
186
|
else
|
|
180
|
-
|
|
187
|
+
removeItem(session, SCROLL_KEY);
|
|
181
188
|
target = place;
|
|
182
189
|
} catch {
|
|
183
190
|
return;
|
|
@@ -1532,7 +1539,7 @@ function putMat(node, mat) {
|
|
|
1532
1539
|
// src/engine/placeholder.ts
|
|
1533
1540
|
var Z_INDEX = 2147483645;
|
|
1534
1541
|
var EARLY = "early";
|
|
1535
|
-
var SNAPSHOT_KEY = "
|
|
1542
|
+
var SNAPSHOT_KEY = "knobs:snapshot";
|
|
1536
1543
|
var SNAPSHOT_VERSION = 1;
|
|
1537
1544
|
var EARLY_FRAMES = 60;
|
|
1538
1545
|
var earlyWait = 0;
|
|
@@ -1593,7 +1600,7 @@ function lookOf(value) {
|
|
|
1593
1600
|
}
|
|
1594
1601
|
function readSnapshot(knobs, view) {
|
|
1595
1602
|
try {
|
|
1596
|
-
const text = webStorage("session")
|
|
1603
|
+
const text = readItem(webStorage("session"), SNAPSHOT_KEY);
|
|
1597
1604
|
if (!text)
|
|
1598
1605
|
return null;
|
|
1599
1606
|
const data = JSON.parse(text);
|
|
@@ -1614,7 +1621,7 @@ function readSnapshot(knobs, view) {
|
|
|
1614
1621
|
}
|
|
1615
1622
|
function writeSnapshot(snapshot) {
|
|
1616
1623
|
try {
|
|
1617
|
-
webStorage("session")
|
|
1624
|
+
writeItem(webStorage("session"), SNAPSHOT_KEY, JSON.stringify(stamped(snapshot, SNAPSHOT_VERSION)));
|
|
1618
1625
|
} catch {
|
|
1619
1626
|
clearSnapshot();
|
|
1620
1627
|
}
|
|
@@ -1640,14 +1647,14 @@ function keepDrawing({ letterbox, zoom, key, css, look }) {
|
|
|
1640
1647
|
}
|
|
1641
1648
|
function clearSnapshot() {
|
|
1642
1649
|
try {
|
|
1643
|
-
webStorage("session")
|
|
1650
|
+
removeItem(webStorage("session"), SNAPSHOT_KEY);
|
|
1644
1651
|
} catch {}
|
|
1645
1652
|
}
|
|
1646
1653
|
function earlyHost() {
|
|
1647
|
-
return document
|
|
1654
|
+
return findOwn(document, EARLY, "div");
|
|
1648
1655
|
}
|
|
1649
1656
|
function dropEarly() {
|
|
1650
|
-
for (const node of Array.from(document.querySelectorAll(
|
|
1657
|
+
for (const node of Array.from(document.querySelectorAll(ownSelector(EARLY)))) {
|
|
1651
1658
|
node.remove();
|
|
1652
1659
|
}
|
|
1653
1660
|
removeStyle(EARLY);
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
+
itemKeys,
|
|
3
4
|
newer,
|
|
5
|
+
readItem,
|
|
4
6
|
realNow,
|
|
7
|
+
removeItem,
|
|
8
|
+
sameItem,
|
|
5
9
|
stamped,
|
|
6
|
-
webStorage
|
|
7
|
-
|
|
10
|
+
webStorage,
|
|
11
|
+
writeItem
|
|
12
|
+
} from "./react-rbmk30xk.js";
|
|
8
13
|
import {
|
|
9
14
|
__require
|
|
10
|
-
} from "./react-
|
|
15
|
+
} from "./react-4qn9vsjw.js";
|
|
11
16
|
|
|
12
17
|
// src/edit/log.ts
|
|
13
18
|
function copy(edit) {
|
|
@@ -181,7 +186,7 @@ function riskyEdit(edit) {
|
|
|
181
186
|
}
|
|
182
187
|
|
|
183
188
|
// src/edit/keep.ts
|
|
184
|
-
var EDITS_KEY = "
|
|
189
|
+
var EDITS_KEY = "knobs:edits:";
|
|
185
190
|
var EDITS_VERSION = 1;
|
|
186
191
|
var MAX_EDITS = 200;
|
|
187
192
|
var MAX_BYTES = 256 * 1024;
|
|
@@ -290,29 +295,28 @@ function writtenAt(text2) {
|
|
|
290
295
|
}
|
|
291
296
|
function otherPages(storage, kept) {
|
|
292
297
|
const pages = [];
|
|
293
|
-
for (
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
pages.push({ key, at: writtenAt(storage.getItem(key)) });
|
|
298
|
+
for (const key of itemKeys(storage, EDITS_KEY)) {
|
|
299
|
+
if (key !== kept)
|
|
300
|
+
pages.push({ key, at: writtenAt(readItem(storage, key)) });
|
|
297
301
|
}
|
|
298
302
|
return pages.sort((a, b) => b.at - a.at).map((page) => page.key);
|
|
299
303
|
}
|
|
300
304
|
function evict(storage, kept) {
|
|
301
305
|
for (const key of otherPages(storage, kept).slice(MAX_PAGES - 1))
|
|
302
|
-
|
|
306
|
+
removeItem(storage, key);
|
|
303
307
|
}
|
|
304
308
|
function write(storage, key, text2) {
|
|
305
309
|
let older = null;
|
|
306
310
|
for (;; ) {
|
|
307
311
|
try {
|
|
308
|
-
storage
|
|
312
|
+
writeItem(storage, key, text2);
|
|
309
313
|
return;
|
|
310
314
|
} catch (error) {
|
|
311
315
|
older ??= otherPages(storage, key);
|
|
312
316
|
const oldest = older.pop();
|
|
313
317
|
if (!oldest)
|
|
314
318
|
throw error;
|
|
315
|
-
|
|
319
|
+
removeItem(storage, oldest);
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
322
|
}
|
|
@@ -328,7 +332,7 @@ function localEditsStore(path = pathNow()) {
|
|
|
328
332
|
return {
|
|
329
333
|
load() {
|
|
330
334
|
try {
|
|
331
|
-
const kept = webStorage("local")
|
|
335
|
+
const kept = readItem(webStorage("local"), pageKey());
|
|
332
336
|
return kept ? JSON.parse(kept) : null;
|
|
333
337
|
} catch {
|
|
334
338
|
return null;
|
|
@@ -340,7 +344,7 @@ function localEditsStore(path = pathNow()) {
|
|
|
340
344
|
return;
|
|
341
345
|
try {
|
|
342
346
|
if (kept === null)
|
|
343
|
-
|
|
347
|
+
removeItem(storage, pageKey());
|
|
344
348
|
else {
|
|
345
349
|
write(storage, pageKey(), JSON.stringify({ ...kept, at: realNow() }));
|
|
346
350
|
evict(storage, pageKey());
|
|
@@ -349,7 +353,7 @@ function localEditsStore(path = pathNow()) {
|
|
|
349
353
|
},
|
|
350
354
|
subscribe(listener) {
|
|
351
355
|
const onStorage = (event) => {
|
|
352
|
-
if (event.key === null || event.key
|
|
356
|
+
if (event.key === null || sameItem(event.key, pageKey()))
|
|
353
357
|
listener();
|
|
354
358
|
};
|
|
355
359
|
window.addEventListener("storage", onStorage);
|
|
@@ -409,7 +413,7 @@ function settled(view, quiet = QUIET, longest = SETTLE_MAX) {
|
|
|
409
413
|
}
|
|
410
414
|
function createKeeper(options) {
|
|
411
415
|
const { log, store, view } = options;
|
|
412
|
-
const loadReplay = options.replay ?? (() => import("./replay-
|
|
416
|
+
const loadReplay = options.replay ?? (() => import("./replay-48gn27bj.js").then(({ replayEdits }) => replayEdits));
|
|
413
417
|
const wait = options.settled ?? (() => settled(view));
|
|
414
418
|
const frame = options.frame ?? (() => null);
|
|
415
419
|
const ours = new WeakMap;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
label
|
|
4
|
-
} from "./react-
|
|
4
|
+
} from "./react-dg4bjv3j.js";
|
|
5
5
|
import {
|
|
6
6
|
frameWindow,
|
|
7
7
|
subscribe
|
|
8
|
-
} from "./react-
|
|
8
|
+
} from "./react-ppyj3fg2.js";
|
|
9
9
|
import {
|
|
10
10
|
inField,
|
|
11
11
|
isFunctionKey,
|
|
12
12
|
keyIs,
|
|
13
13
|
typesInField,
|
|
14
14
|
withShift
|
|
15
|
-
} from "./react-
|
|
15
|
+
} from "./react-hdneb4v3.js";
|
|
16
16
|
import {
|
|
17
17
|
addStyle,
|
|
18
18
|
isDevknobsFrame,
|
|
@@ -20,10 +20,11 @@ import {
|
|
|
20
20
|
post,
|
|
21
21
|
readMessage,
|
|
22
22
|
systemMedia
|
|
23
|
-
} from "./react-
|
|
23
|
+
} from "./react-rbmk30xk.js";
|
|
24
24
|
import {
|
|
25
|
-
__require
|
|
26
|
-
|
|
25
|
+
__require,
|
|
26
|
+
markOwn
|
|
27
|
+
} from "./react-4qn9vsjw.js";
|
|
27
28
|
|
|
28
29
|
// src/grab/keys.ts
|
|
29
30
|
var HOLD = 100;
|
|
@@ -154,7 +155,7 @@ function systemScheme() {
|
|
|
154
155
|
if (own)
|
|
155
156
|
return own.scheme;
|
|
156
157
|
const host = document.createElement("div");
|
|
157
|
-
host
|
|
158
|
+
markOwn(host, "probe");
|
|
158
159
|
host.style.cssText = "position:fixed;width:0;height:0;overflow:hidden;pointer-events:none";
|
|
159
160
|
const root = host.attachShadow({ mode: "open" });
|
|
160
161
|
addStyle(root, "i{display:block;width:0}@media (prefers-color-scheme: dark){i{width:1px}}");
|
|
@@ -165,7 +166,7 @@ function systemScheme() {
|
|
|
165
166
|
host.remove();
|
|
166
167
|
return dark ? "dark" : "light";
|
|
167
168
|
}
|
|
168
|
-
function createGrab(options = {}, loadMode = () => import("./index-
|
|
169
|
+
function createGrab(options = {}, loadMode = () => import("./index-cqymjce4.js")) {
|
|
169
170
|
const keyNow = options.key ?? defaultGrabKey;
|
|
170
171
|
const { purpose } = options;
|
|
171
172
|
const channel = purpose?.channel ?? "grab";
|
|
@@ -374,7 +375,7 @@ function held(view) {
|
|
|
374
375
|
return null;
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
|
-
function createInspect(options = {}, load = () => import("./index-
|
|
378
|
+
function createInspect(options = {}, load = () => import("./index-cqymjce4.js"), frameOf = frameWindow) {
|
|
378
379
|
const inFrame = isDevknobsFrame();
|
|
379
380
|
const listeners = new Set;
|
|
380
381
|
let outliner = null;
|
|
@@ -482,7 +483,7 @@ async function copyText(text, data = { "text/plain": text }) {
|
|
|
482
483
|
};
|
|
483
484
|
const textarea = document.createElement("textarea");
|
|
484
485
|
textarea.value = text;
|
|
485
|
-
textarea
|
|
486
|
+
markOwn(textarea, "grab");
|
|
486
487
|
textarea.setAttribute("aria-hidden", "true");
|
|
487
488
|
textarea.style.cssText = "position:fixed;left:-9999px;top:0;opacity:0";
|
|
488
489
|
document.addEventListener("copy", onCopy);
|
|
@@ -6,31 +6,41 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
resolveNesting,
|
|
8
8
|
splitList
|
|
9
|
-
} from "./react-
|
|
9
|
+
} from "./react-w94cfn87.js";
|
|
10
10
|
import {
|
|
11
11
|
flatParent,
|
|
12
12
|
isNewRuleSheet,
|
|
13
13
|
isShadowRoot,
|
|
14
14
|
scopeOf
|
|
15
|
-
} from "./react-
|
|
15
|
+
} from "./react-dg4bjv3j.js";
|
|
16
16
|
import {
|
|
17
17
|
isDevknobs
|
|
18
|
-
} from "./react-
|
|
18
|
+
} from "./react-hdneb4v3.js";
|
|
19
19
|
import {
|
|
20
20
|
addStyle,
|
|
21
21
|
ensureStyle,
|
|
22
22
|
fresh,
|
|
23
23
|
isOwnSheet,
|
|
24
24
|
newer,
|
|
25
|
+
readItem,
|
|
26
|
+
removeItem,
|
|
25
27
|
removeStyle,
|
|
28
|
+
sameItem,
|
|
26
29
|
stamped,
|
|
27
30
|
versionOf,
|
|
28
|
-
webStorage
|
|
29
|
-
|
|
31
|
+
webStorage,
|
|
32
|
+
writeItem
|
|
33
|
+
} from "./react-rbmk30xk.js";
|
|
34
|
+
import {
|
|
35
|
+
ATTRIBUTES,
|
|
36
|
+
getMark,
|
|
37
|
+
removeMark,
|
|
38
|
+
setMark
|
|
39
|
+
} from "./react-4qn9vsjw.js";
|
|
30
40
|
|
|
31
41
|
// src/styles/force.ts
|
|
32
42
|
var FORCED_STATES = ["hover", "focus", "focus-visible", "active", "focus-within"];
|
|
33
|
-
var FORCE_ATTRIBUTE =
|
|
43
|
+
var FORCE_ATTRIBUTE = ATTRIBUTES.force;
|
|
34
44
|
var SHEET = "force";
|
|
35
45
|
var UP = {
|
|
36
46
|
hover: "hover",
|
|
@@ -235,7 +245,7 @@ function syncForced() {
|
|
|
235
245
|
const wanted = new Set;
|
|
236
246
|
const scopes = new Set;
|
|
237
247
|
for (const { element } of forced.marked) {
|
|
238
|
-
for (const state of (element
|
|
248
|
+
for (const state of (getMark(element, FORCE_ATTRIBUTE) ?? "").split(" "))
|
|
239
249
|
if (isState(state))
|
|
240
250
|
wanted.add(state);
|
|
241
251
|
scopes.add(scopeOf(element));
|
|
@@ -258,9 +268,9 @@ function clearForced() {
|
|
|
258
268
|
for (const { element, before } of forced.marked) {
|
|
259
269
|
try {
|
|
260
270
|
if (before === null)
|
|
261
|
-
element
|
|
271
|
+
removeMark(element, FORCE_ATTRIBUTE);
|
|
262
272
|
else
|
|
263
|
-
element
|
|
273
|
+
setMark(element, FORCE_ATTRIBUTE, before);
|
|
264
274
|
} catch {}
|
|
265
275
|
}
|
|
266
276
|
for (const [scope, style] of forced.sheets) {
|
|
@@ -282,8 +292,8 @@ function forceState(element, states) {
|
|
|
282
292
|
for (const [one, own] of marks(element, chosen)) {
|
|
283
293
|
if (own.length === 0)
|
|
284
294
|
continue;
|
|
285
|
-
forced.marked.push({ element: one, before: one
|
|
286
|
-
one
|
|
295
|
+
forced.marked.push({ element: one, before: getMark(one, FORCE_ATTRIBUTE) });
|
|
296
|
+
setMark(one, FORCE_ATTRIBUTE, own.join(" "));
|
|
287
297
|
}
|
|
288
298
|
current = forced;
|
|
289
299
|
syncForced();
|
|
@@ -555,7 +565,7 @@ function createSizer(context) {
|
|
|
555
565
|
}
|
|
556
566
|
|
|
557
567
|
// src/ui/prefs.ts
|
|
558
|
-
var PREFS_KEY = "
|
|
568
|
+
var PREFS_KEY = "knobs:prefs";
|
|
559
569
|
var PREFS_VERSION = 6;
|
|
560
570
|
var STYLES_MODE = "simple";
|
|
561
571
|
var STYLES_BOX = true;
|
|
@@ -602,7 +612,7 @@ function resolvePrefs(base, stored) {
|
|
|
602
612
|
}
|
|
603
613
|
function loadPrefs() {
|
|
604
614
|
try {
|
|
605
|
-
return readPrefs(webStorage("local")
|
|
615
|
+
return readPrefs(readItem(webStorage("local"), PREFS_KEY));
|
|
606
616
|
} catch {
|
|
607
617
|
return {};
|
|
608
618
|
}
|
|
@@ -610,9 +620,9 @@ function loadPrefs() {
|
|
|
610
620
|
function keepPrefs(prefs) {
|
|
611
621
|
try {
|
|
612
622
|
if (Object.keys(prefs).length === 0)
|
|
613
|
-
webStorage("local")
|
|
623
|
+
removeItem(webStorage("local"), PREFS_KEY);
|
|
614
624
|
else
|
|
615
|
-
webStorage("local")
|
|
625
|
+
writeItem(webStorage("local"), PREFS_KEY, JSON.stringify(stamped(prefs, PREFS_VERSION)));
|
|
616
626
|
} catch {}
|
|
617
627
|
}
|
|
618
628
|
function createPrefs(options = {}) {
|
|
@@ -639,7 +649,7 @@ function createPrefs(options = {}) {
|
|
|
639
649
|
changed();
|
|
640
650
|
}
|
|
641
651
|
function onStorage(event) {
|
|
642
|
-
if (event.key !==
|
|
652
|
+
if (event.key !== null && !sameItem(event.key, PREFS_KEY))
|
|
643
653
|
return;
|
|
644
654
|
if (fresh())
|
|
645
655
|
return;
|
package/dist/react.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ import { type MountOptions } from "./index";
|
|
|
3
3
|
* Mount the knobs from a React tree. Renders nothing, so drop it anywhere and
|
|
4
4
|
* render it in development only. Options are read once, on mount.
|
|
5
5
|
*/
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function Knobs(props: MountOptions): null;
|
|
7
|
+
/** @deprecated use Knobs */
|
|
8
|
+
export declare const DevKnobs: typeof Knobs;
|