@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
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
turnOf,
|
|
25
25
|
turnedPose,
|
|
26
26
|
windowRect
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-k4w5v53q.js";
|
|
28
28
|
import {
|
|
29
29
|
hush,
|
|
30
30
|
hushOnce,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from "./index-58jdczmj.js";
|
|
39
39
|
import {
|
|
40
40
|
copyText
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-585hs9tp.js";
|
|
42
42
|
import {
|
|
43
43
|
BARS_START,
|
|
44
44
|
DOT_LOOK,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
uaPreset,
|
|
83
83
|
userAgentOf,
|
|
84
84
|
viewportOf
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-bgzyc7rz.js";
|
|
86
86
|
import {
|
|
87
87
|
FRAME_ATTRIBUTE,
|
|
88
88
|
FRAME_NAME,
|
|
@@ -124,11 +124,16 @@ import {
|
|
|
124
124
|
turn,
|
|
125
125
|
walkRules,
|
|
126
126
|
wheelZoom
|
|
127
|
-
} from "./index-
|
|
127
|
+
} from "./index-311fys81.js";
|
|
128
128
|
import"./index-a974q3aa.js";
|
|
129
129
|
import {
|
|
130
|
-
__export
|
|
131
|
-
|
|
130
|
+
__export,
|
|
131
|
+
findOwn,
|
|
132
|
+
isMarked,
|
|
133
|
+
markOwn,
|
|
134
|
+
ownSelector,
|
|
135
|
+
setMark
|
|
136
|
+
} from "./index-3dcgysws.js";
|
|
132
137
|
|
|
133
138
|
// src/engine/width.ts
|
|
134
139
|
var exports_width = {};
|
|
@@ -3269,7 +3274,7 @@ async function loadAll(files) {
|
|
|
3269
3274
|
if (ok)
|
|
3270
3275
|
return image;
|
|
3271
3276
|
}
|
|
3272
|
-
throw new Error(`
|
|
3277
|
+
throw new Error(`knobs: ${file} did not load`);
|
|
3273
3278
|
};
|
|
3274
3279
|
return Promise.all(files.map(loaded));
|
|
3275
3280
|
}
|
|
@@ -4829,7 +4834,7 @@ function shootPage(frame2, glass, size, color, layout = "") {
|
|
|
4829
4834
|
const draw = (node, alpha, lifted) => {
|
|
4830
4835
|
if (seen++ > MOST || seen % 50 === 0 && performance.now() > deadline)
|
|
4831
4836
|
return;
|
|
4832
|
-
if (node
|
|
4837
|
+
if (isMarked(node))
|
|
4833
4838
|
return;
|
|
4834
4839
|
const style = view.getComputedStyle(node);
|
|
4835
4840
|
if (style.display === "none")
|
|
@@ -5035,12 +5040,12 @@ ${own.join(`
|
|
|
5035
5040
|
if (!node || !copy)
|
|
5036
5041
|
continue;
|
|
5037
5042
|
if (leave?.(node))
|
|
5038
|
-
copy
|
|
5043
|
+
markOwn(copy);
|
|
5039
5044
|
pin(node, copy);
|
|
5040
5045
|
}
|
|
5041
5046
|
}
|
|
5042
5047
|
blankPictures(doc.documentElement, root);
|
|
5043
|
-
for (const node of root.querySelectorAll(
|
|
5048
|
+
for (const node of root.querySelectorAll(`script, link, style, noscript, ${ownSelector()}`))
|
|
5044
5049
|
node.remove();
|
|
5045
5050
|
const style = inert.createElement("style");
|
|
5046
5051
|
style.textContent = frozen.rules.join(`
|
|
@@ -5088,7 +5093,7 @@ async function paintPage(frame2, glass, size, color, copy) {
|
|
|
5088
5093
|
const at = { x: (box2.left - screen.left) * css, y: (box2.top - screen.top) * css };
|
|
5089
5094
|
let over2 = null;
|
|
5090
5095
|
for (const node of doc.querySelectorAll(MEDIA)) {
|
|
5091
|
-
const media = node.closest(
|
|
5096
|
+
const media = node.closest(ownSelector()) ? null : mediaOf(node);
|
|
5092
5097
|
const rect = node.getBoundingClientRect();
|
|
5093
5098
|
if (!media || rect.bottom <= 0 || rect.top >= height || rect.width <= 0)
|
|
5094
5099
|
continue;
|
|
@@ -8493,7 +8498,7 @@ var bodyObserver = null;
|
|
|
8493
8498
|
function hide(node) {
|
|
8494
8499
|
if (!(node instanceof HTMLElement || node instanceof SVGElement))
|
|
8495
8500
|
return;
|
|
8496
|
-
if (node
|
|
8501
|
+
if (isMarked(node) || hidden.has(node))
|
|
8497
8502
|
return;
|
|
8498
8503
|
const style = node.style;
|
|
8499
8504
|
hidden.set(node, {
|
|
@@ -8524,7 +8529,7 @@ function holdModals() {
|
|
|
8524
8529
|
const native = HTMLDialogElement.prototype.showModal;
|
|
8525
8530
|
showModal = native;
|
|
8526
8531
|
HTMLDialogElement.prototype.showModal = function() {
|
|
8527
|
-
if (this.closest(
|
|
8532
|
+
if (this.closest(ownSelector()))
|
|
8528
8533
|
native.call(this);
|
|
8529
8534
|
else
|
|
8530
8535
|
this.show();
|
|
@@ -8534,7 +8539,7 @@ function holdModals() {
|
|
|
8534
8539
|
modals = Array.from(document.querySelectorAll("dialog:modal"));
|
|
8535
8540
|
} catch {}
|
|
8536
8541
|
for (const dialog of modals) {
|
|
8537
|
-
if (dialog.closest(
|
|
8542
|
+
if (dialog.closest(ownSelector()))
|
|
8538
8543
|
continue;
|
|
8539
8544
|
dialog.close();
|
|
8540
8545
|
dialog.show();
|
|
@@ -9091,7 +9096,7 @@ function showZoom(place2) {
|
|
|
9091
9096
|
picker.value = String(zoom);
|
|
9092
9097
|
}
|
|
9093
9098
|
function panelWidth() {
|
|
9094
|
-
return document
|
|
9099
|
+
return findOwn(document, "panel")?.offsetWidth ?? 0;
|
|
9095
9100
|
}
|
|
9096
9101
|
function asideOf(panel) {
|
|
9097
9102
|
return panel.open && !panel.docked ? panelWidth() : 0;
|
|
@@ -9524,7 +9529,7 @@ function hidePage() {
|
|
|
9524
9529
|
covered = true;
|
|
9525
9530
|
cover2(body);
|
|
9526
9531
|
const style = ensureStyle(NAME);
|
|
9527
|
-
style.textContent =
|
|
9532
|
+
style.textContent = `html{overflow:hidden!important}:popover-open:not(${ownSelector()}){display:none!important}`;
|
|
9528
9533
|
const node = styleNode(style);
|
|
9529
9534
|
if (node)
|
|
9530
9535
|
stopKeepingStyle = keepMounted(node, { home: () => document.head ?? document.documentElement });
|
|
@@ -9649,7 +9654,7 @@ function open(veiled, first) {
|
|
|
9649
9654
|
if (host || !needsFrame(current) || !body)
|
|
9650
9655
|
return;
|
|
9651
9656
|
host = document.createElement("div");
|
|
9652
|
-
host
|
|
9657
|
+
markOwn(host, "viewport");
|
|
9653
9658
|
host.style.cssText = `position:fixed;inset:0;z-index:${Z_INDEX}`;
|
|
9654
9659
|
const root = host.attachShadow({ mode: "open" });
|
|
9655
9660
|
addStyle(root, VIEWPORT_CSS);
|
|
@@ -9676,11 +9681,11 @@ function open(veiled, first) {
|
|
|
9676
9681
|
glass = document.createElement("div");
|
|
9677
9682
|
glass.className = "glass";
|
|
9678
9683
|
frame3 = document.createElement("iframe");
|
|
9679
|
-
frame3
|
|
9684
|
+
setMark(frame3, FRAME_ATTRIBUTE);
|
|
9680
9685
|
if (fresh())
|
|
9681
|
-
frame3
|
|
9686
|
+
setMark(frame3, FRESH_ATTRIBUTE);
|
|
9682
9687
|
frame3.name = FRAME_NAME;
|
|
9683
|
-
frame3.title = "
|
|
9688
|
+
frame3.title = "knobs viewport";
|
|
9684
9689
|
frame3.setAttribute("sandbox", SANDBOX);
|
|
9685
9690
|
frameUrl = window.location.href;
|
|
9686
9691
|
follow3({ page: frameDocument, locate, refresh: () => browser?.refresh() });
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
turnOf,
|
|
26
26
|
turnedPose,
|
|
27
27
|
windowRect
|
|
28
|
-
} from "./react-
|
|
28
|
+
} from "./react-7eyps0cg.js";
|
|
29
29
|
import {
|
|
30
30
|
hush,
|
|
31
31
|
hushOnce,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
} from "./react-97b5b8j4.js";
|
|
40
40
|
import {
|
|
41
41
|
copyText
|
|
42
|
-
} from "./react-
|
|
42
|
+
} from "./react-j87bdhhe.js";
|
|
43
43
|
import {
|
|
44
44
|
BARS_START,
|
|
45
45
|
DOT_LOOK,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
uaPreset,
|
|
84
84
|
userAgentOf,
|
|
85
85
|
viewportOf
|
|
86
|
-
} from "./react-
|
|
86
|
+
} from "./react-tet7swk2.js";
|
|
87
87
|
import {
|
|
88
88
|
FRAME_ATTRIBUTE,
|
|
89
89
|
FRAME_NAME,
|
|
@@ -125,11 +125,16 @@ import {
|
|
|
125
125
|
turn,
|
|
126
126
|
walkRules,
|
|
127
127
|
wheelZoom
|
|
128
|
-
} from "./react-
|
|
128
|
+
} from "./react-rbmk30xk.js";
|
|
129
129
|
import"./react-fp73vhyd.js";
|
|
130
130
|
import {
|
|
131
|
-
__export
|
|
132
|
-
|
|
131
|
+
__export,
|
|
132
|
+
findOwn,
|
|
133
|
+
isMarked,
|
|
134
|
+
markOwn,
|
|
135
|
+
ownSelector,
|
|
136
|
+
setMark
|
|
137
|
+
} from "./react-4qn9vsjw.js";
|
|
133
138
|
|
|
134
139
|
// src/engine/width.ts
|
|
135
140
|
var exports_width = {};
|
|
@@ -3270,7 +3275,7 @@ async function loadAll(files) {
|
|
|
3270
3275
|
if (ok)
|
|
3271
3276
|
return image;
|
|
3272
3277
|
}
|
|
3273
|
-
throw new Error(`
|
|
3278
|
+
throw new Error(`knobs: ${file} did not load`);
|
|
3274
3279
|
};
|
|
3275
3280
|
return Promise.all(files.map(loaded));
|
|
3276
3281
|
}
|
|
@@ -4830,7 +4835,7 @@ function shootPage(frame2, glass, size, color, layout = "") {
|
|
|
4830
4835
|
const draw = (node, alpha, lifted) => {
|
|
4831
4836
|
if (seen++ > MOST || seen % 50 === 0 && performance.now() > deadline)
|
|
4832
4837
|
return;
|
|
4833
|
-
if (node
|
|
4838
|
+
if (isMarked(node))
|
|
4834
4839
|
return;
|
|
4835
4840
|
const style = view.getComputedStyle(node);
|
|
4836
4841
|
if (style.display === "none")
|
|
@@ -5036,12 +5041,12 @@ ${own.join(`
|
|
|
5036
5041
|
if (!node || !copy)
|
|
5037
5042
|
continue;
|
|
5038
5043
|
if (leave?.(node))
|
|
5039
|
-
copy
|
|
5044
|
+
markOwn(copy);
|
|
5040
5045
|
pin(node, copy);
|
|
5041
5046
|
}
|
|
5042
5047
|
}
|
|
5043
5048
|
blankPictures(doc.documentElement, root);
|
|
5044
|
-
for (const node of root.querySelectorAll(
|
|
5049
|
+
for (const node of root.querySelectorAll(`script, link, style, noscript, ${ownSelector()}`))
|
|
5045
5050
|
node.remove();
|
|
5046
5051
|
const style = inert.createElement("style");
|
|
5047
5052
|
style.textContent = frozen.rules.join(`
|
|
@@ -5089,7 +5094,7 @@ async function paintPage(frame2, glass, size, color, copy) {
|
|
|
5089
5094
|
const at = { x: (box2.left - screen.left) * css, y: (box2.top - screen.top) * css };
|
|
5090
5095
|
let over2 = null;
|
|
5091
5096
|
for (const node of doc.querySelectorAll(MEDIA)) {
|
|
5092
|
-
const media = node.closest(
|
|
5097
|
+
const media = node.closest(ownSelector()) ? null : mediaOf(node);
|
|
5093
5098
|
const rect = node.getBoundingClientRect();
|
|
5094
5099
|
if (!media || rect.bottom <= 0 || rect.top >= height || rect.width <= 0)
|
|
5095
5100
|
continue;
|
|
@@ -8494,7 +8499,7 @@ var bodyObserver = null;
|
|
|
8494
8499
|
function hide(node) {
|
|
8495
8500
|
if (!(node instanceof HTMLElement || node instanceof SVGElement))
|
|
8496
8501
|
return;
|
|
8497
|
-
if (node
|
|
8502
|
+
if (isMarked(node) || hidden.has(node))
|
|
8498
8503
|
return;
|
|
8499
8504
|
const style = node.style;
|
|
8500
8505
|
hidden.set(node, {
|
|
@@ -8525,7 +8530,7 @@ function holdModals() {
|
|
|
8525
8530
|
const native = HTMLDialogElement.prototype.showModal;
|
|
8526
8531
|
showModal = native;
|
|
8527
8532
|
HTMLDialogElement.prototype.showModal = function() {
|
|
8528
|
-
if (this.closest(
|
|
8533
|
+
if (this.closest(ownSelector()))
|
|
8529
8534
|
native.call(this);
|
|
8530
8535
|
else
|
|
8531
8536
|
this.show();
|
|
@@ -8535,7 +8540,7 @@ function holdModals() {
|
|
|
8535
8540
|
modals = Array.from(document.querySelectorAll("dialog:modal"));
|
|
8536
8541
|
} catch {}
|
|
8537
8542
|
for (const dialog of modals) {
|
|
8538
|
-
if (dialog.closest(
|
|
8543
|
+
if (dialog.closest(ownSelector()))
|
|
8539
8544
|
continue;
|
|
8540
8545
|
dialog.close();
|
|
8541
8546
|
dialog.show();
|
|
@@ -9092,7 +9097,7 @@ function showZoom(place2) {
|
|
|
9092
9097
|
picker.value = String(zoom);
|
|
9093
9098
|
}
|
|
9094
9099
|
function panelWidth() {
|
|
9095
|
-
return document
|
|
9100
|
+
return findOwn(document, "panel")?.offsetWidth ?? 0;
|
|
9096
9101
|
}
|
|
9097
9102
|
function asideOf(panel) {
|
|
9098
9103
|
return panel.open && !panel.docked ? panelWidth() : 0;
|
|
@@ -9525,7 +9530,7 @@ function hidePage() {
|
|
|
9525
9530
|
covered = true;
|
|
9526
9531
|
cover2(body);
|
|
9527
9532
|
const style = ensureStyle(NAME);
|
|
9528
|
-
style.textContent =
|
|
9533
|
+
style.textContent = `html{overflow:hidden!important}:popover-open:not(${ownSelector()}){display:none!important}`;
|
|
9529
9534
|
const node = styleNode(style);
|
|
9530
9535
|
if (node)
|
|
9531
9536
|
stopKeepingStyle = keepMounted(node, { home: () => document.head ?? document.documentElement });
|
|
@@ -9650,7 +9655,7 @@ function open(veiled, first) {
|
|
|
9650
9655
|
if (host || !needsFrame(current) || !body)
|
|
9651
9656
|
return;
|
|
9652
9657
|
host = document.createElement("div");
|
|
9653
|
-
host
|
|
9658
|
+
markOwn(host, "viewport");
|
|
9654
9659
|
host.style.cssText = `position:fixed;inset:0;z-index:${Z_INDEX}`;
|
|
9655
9660
|
const root = host.attachShadow({ mode: "open" });
|
|
9656
9661
|
addStyle(root, VIEWPORT_CSS);
|
|
@@ -9677,11 +9682,11 @@ function open(veiled, first) {
|
|
|
9677
9682
|
glass = document.createElement("div");
|
|
9678
9683
|
glass.className = "glass";
|
|
9679
9684
|
frame3 = document.createElement("iframe");
|
|
9680
|
-
frame3
|
|
9685
|
+
setMark(frame3, FRAME_ATTRIBUTE);
|
|
9681
9686
|
if (fresh())
|
|
9682
|
-
frame3
|
|
9687
|
+
setMark(frame3, FRESH_ATTRIBUTE);
|
|
9683
9688
|
frame3.name = FRAME_NAME;
|
|
9684
|
-
frame3.title = "
|
|
9689
|
+
frame3.title = "knobs viewport";
|
|
9685
9690
|
frame3.setAttribute("sandbox", SANDBOX);
|
|
9686
9691
|
frameUrl = window.location.href;
|
|
9687
9692
|
follow3({ page: frameDocument, locate, refresh: () => browser?.refresh() });
|
package/dist/grab/clipboard.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { GrabPayload } from "./types";
|
|
2
|
+
export declare const KNOBS_TYPE = "application/x-knobs-grab";
|
|
3
|
+
/** The type's old name, written beside it with the same payload until 1.0. */
|
|
2
4
|
export declare const DEVKNOBS_TYPE = "application/x-devknobs-grab";
|
|
3
5
|
/** react-grab's own type, which agents that paste from it already read. */
|
|
4
6
|
export declare const REACT_GRAB_TYPE = "application/x-react-grab";
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ATTRIBUTES,
|
|
3
|
+
findOwn,
|
|
4
|
+
hasMark,
|
|
5
|
+
isMarked,
|
|
6
|
+
markOwn
|
|
7
|
+
} from "./index-3dcgysws.js";
|
|
8
|
+
|
|
1
9
|
// src/engine/devices.ts
|
|
2
10
|
var POSTURES = ["closed", "open"];
|
|
3
11
|
function openOf(posture) {
|
|
@@ -1076,6 +1084,60 @@ function stamped(value, v) {
|
|
|
1076
1084
|
return { v, ...value };
|
|
1077
1085
|
}
|
|
1078
1086
|
|
|
1087
|
+
// src/engine/storekeys.ts
|
|
1088
|
+
var NAME = "knobs";
|
|
1089
|
+
var OLD_NAME = "devknobs";
|
|
1090
|
+
function oldKey(key) {
|
|
1091
|
+
if (key === NAME)
|
|
1092
|
+
return OLD_NAME;
|
|
1093
|
+
return key.startsWith(`${NAME}:`) ? `${OLD_NAME}${key.slice(NAME.length)}` : key;
|
|
1094
|
+
}
|
|
1095
|
+
function ownName(key) {
|
|
1096
|
+
if (key === NAME || key.startsWith(`${NAME}:`))
|
|
1097
|
+
return key;
|
|
1098
|
+
if (key === OLD_NAME)
|
|
1099
|
+
return NAME;
|
|
1100
|
+
return key.startsWith(`${OLD_NAME}:`) ? `${NAME}${key.slice(OLD_NAME.length)}` : null;
|
|
1101
|
+
}
|
|
1102
|
+
function isOwnKey(key) {
|
|
1103
|
+
return ownName(key) !== null;
|
|
1104
|
+
}
|
|
1105
|
+
function sameItem(eventKey, key) {
|
|
1106
|
+
return eventKey === key || eventKey === oldKey(key);
|
|
1107
|
+
}
|
|
1108
|
+
function readItem(storage, key) {
|
|
1109
|
+
if (!storage)
|
|
1110
|
+
return null;
|
|
1111
|
+
return storage.getItem(oldKey(key));
|
|
1112
|
+
}
|
|
1113
|
+
function writeItem(storage, key, value) {
|
|
1114
|
+
if (!storage)
|
|
1115
|
+
return;
|
|
1116
|
+
const old = oldKey(key);
|
|
1117
|
+
storage.setItem(old, value);
|
|
1118
|
+
if (old !== key)
|
|
1119
|
+
storage.setItem(key, value);
|
|
1120
|
+
}
|
|
1121
|
+
function removeItem(storage, key) {
|
|
1122
|
+
if (!storage)
|
|
1123
|
+
return;
|
|
1124
|
+
storage.removeItem(key);
|
|
1125
|
+
storage.removeItem(oldKey(key));
|
|
1126
|
+
}
|
|
1127
|
+
function itemKeys(storage, prefix) {
|
|
1128
|
+
const old = oldKey(prefix);
|
|
1129
|
+
const keys = [];
|
|
1130
|
+
for (let index = 0;index < storage.length; index++) {
|
|
1131
|
+
const key = storage.key(index);
|
|
1132
|
+
if (key === null || !key.startsWith(old))
|
|
1133
|
+
continue;
|
|
1134
|
+
const name = ownName(key) ?? key;
|
|
1135
|
+
if (name.startsWith(prefix))
|
|
1136
|
+
keys.push(name);
|
|
1137
|
+
}
|
|
1138
|
+
return keys;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1079
1141
|
// src/engine/zoom.ts
|
|
1080
1142
|
var ZOOM_PRESETS = [0.5, 0.75, 1, 1.25, 1.5];
|
|
1081
1143
|
var ZOOM_MIN = 0.25;
|
|
@@ -1124,9 +1186,9 @@ function anchorScroll(pointer, scroll, before, after) {
|
|
|
1124
1186
|
}
|
|
1125
1187
|
|
|
1126
1188
|
// src/engine/store.ts
|
|
1127
|
-
var STORAGE_KEY = "
|
|
1189
|
+
var STORAGE_KEY = "knobs";
|
|
1128
1190
|
var STATE_VERSION = 2;
|
|
1129
|
-
var PLACE_KEY = "
|
|
1191
|
+
var PLACE_KEY = "knobs:place";
|
|
1130
1192
|
var PLACE_VERSION = 2;
|
|
1131
1193
|
var DEFAULT_PINNED = ["device", "scheme", "text", "locale"];
|
|
1132
1194
|
var PANEL_START = 128;
|
|
@@ -1385,7 +1447,7 @@ function merge(state, patch) {
|
|
|
1385
1447
|
}
|
|
1386
1448
|
function item(kind, key) {
|
|
1387
1449
|
try {
|
|
1388
|
-
return webStorage(kind)
|
|
1450
|
+
return readItem(webStorage(kind), key);
|
|
1389
1451
|
} catch {
|
|
1390
1452
|
return null;
|
|
1391
1453
|
}
|
|
@@ -1397,17 +1459,17 @@ function load() {
|
|
|
1397
1459
|
function save(state) {
|
|
1398
1460
|
try {
|
|
1399
1461
|
const { realPhone: _, ...panel } = state.panel;
|
|
1400
|
-
webStorage("session")
|
|
1462
|
+
writeItem(webStorage("session"), STORAGE_KEY, JSON.stringify(stamped({ ...state, panel }, STATE_VERSION)));
|
|
1401
1463
|
} catch {}
|
|
1402
1464
|
}
|
|
1403
1465
|
function keepPlace(state) {
|
|
1404
1466
|
try {
|
|
1405
|
-
webStorage("local")
|
|
1467
|
+
writeItem(webStorage("local"), PLACE_KEY, placeText(state));
|
|
1406
1468
|
} catch {}
|
|
1407
1469
|
}
|
|
1408
1470
|
|
|
1409
1471
|
// src/engine/frame.ts
|
|
1410
|
-
var FRAME_ATTRIBUTE =
|
|
1472
|
+
var FRAME_ATTRIBUTE = ATTRIBUTES.frame;
|
|
1411
1473
|
var FRAME_NAME = "devknobs-frame";
|
|
1412
1474
|
var SIZE_MIN = 120;
|
|
1413
1475
|
var SIZE_MAX = 8192;
|
|
@@ -1429,7 +1491,8 @@ var KEY_ACTIONS = [
|
|
|
1429
1491
|
];
|
|
1430
1492
|
function isDevknobsFrame() {
|
|
1431
1493
|
try {
|
|
1432
|
-
|
|
1494
|
+
const owner = window.frameElement;
|
|
1495
|
+
if (owner && hasMark(owner, FRAME_ATTRIBUTE))
|
|
1433
1496
|
return true;
|
|
1434
1497
|
} catch {}
|
|
1435
1498
|
return window.name === FRAME_NAME;
|
|
@@ -1565,23 +1628,24 @@ function post(target, message) {
|
|
|
1565
1628
|
// src/engine/fresh.ts
|
|
1566
1629
|
var FRESH_PARAM = "devknobs";
|
|
1567
1630
|
var FRESH_VALUE = "fresh";
|
|
1568
|
-
var
|
|
1569
|
-
var
|
|
1631
|
+
var KNOBS_FRESH_PARAM = "knobs";
|
|
1632
|
+
var FRESH_ATTRIBUTE = ATTRIBUTES.fresh;
|
|
1633
|
+
var FRESH_RELOAD_KEY = "knobs:fresh-reload";
|
|
1570
1634
|
var FRESH_RELOAD_VERSION = 1;
|
|
1571
1635
|
var FRESH_RELOAD_WINDOW = 1e4;
|
|
1572
|
-
var KEPT = "
|
|
1636
|
+
var KEPT = "knobs:locale-";
|
|
1573
1637
|
var MODE = Symbol.for("devknobs.fresh");
|
|
1574
1638
|
function freshIn(search) {
|
|
1575
1639
|
try {
|
|
1576
|
-
|
|
1640
|
+
const query = new URLSearchParams(search);
|
|
1641
|
+
return [KNOBS_FRESH_PARAM, FRESH_PARAM].some((name) => query.getAll(name).includes(FRESH_VALUE));
|
|
1577
1642
|
} catch {
|
|
1578
1643
|
return false;
|
|
1579
1644
|
}
|
|
1580
1645
|
}
|
|
1581
1646
|
function wiped(key) {
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
return key.startsWith(`${FRESH_PARAM}:`) && !key.startsWith(KEPT);
|
|
1647
|
+
const name = ownName(key);
|
|
1648
|
+
return name !== null && !name.startsWith(KEPT);
|
|
1585
1649
|
}
|
|
1586
1650
|
function reloadAt(text2) {
|
|
1587
1651
|
if (!text2)
|
|
@@ -1599,8 +1663,8 @@ function reloadAt(text2) {
|
|
|
1599
1663
|
function begin() {
|
|
1600
1664
|
try {
|
|
1601
1665
|
const session = window.sessionStorage;
|
|
1602
|
-
const age = realNow() - reloadAt(session
|
|
1603
|
-
|
|
1666
|
+
const age = realNow() - reloadAt(readItem(session, FRESH_RELOAD_KEY));
|
|
1667
|
+
removeItem(session, FRESH_RELOAD_KEY);
|
|
1604
1668
|
if (age >= 0 && age < FRESH_RELOAD_WINDOW)
|
|
1605
1669
|
return;
|
|
1606
1670
|
const keys = [];
|
|
@@ -1615,14 +1679,14 @@ function begin() {
|
|
|
1615
1679
|
}
|
|
1616
1680
|
function settle2() {
|
|
1617
1681
|
try {
|
|
1618
|
-
window.sessionStorage
|
|
1682
|
+
removeItem(window.sessionStorage, FRESH_RELOAD_KEY);
|
|
1619
1683
|
} catch {}
|
|
1620
1684
|
}
|
|
1621
1685
|
function framedFresh() {
|
|
1622
1686
|
try {
|
|
1623
1687
|
const owner = window.frameElement;
|
|
1624
1688
|
if (owner)
|
|
1625
|
-
return owner
|
|
1689
|
+
return hasMark(owner, FRESH_ATTRIBUTE);
|
|
1626
1690
|
} catch {}
|
|
1627
1691
|
return window.name === FRAME_NAME && freshIn(window.location?.search ?? "");
|
|
1628
1692
|
}
|
|
@@ -1688,7 +1752,7 @@ function ownReload() {
|
|
|
1688
1752
|
return;
|
|
1689
1753
|
try {
|
|
1690
1754
|
const record2 = stamped({ at: realNow() }, FRESH_RELOAD_VERSION);
|
|
1691
|
-
window.sessionStorage
|
|
1755
|
+
writeItem(window.sessionStorage, FRESH_RELOAD_KEY, JSON.stringify(record2));
|
|
1692
1756
|
} catch {}
|
|
1693
1757
|
}
|
|
1694
1758
|
|
|
@@ -2119,13 +2183,13 @@ function watchSheets() {
|
|
|
2119
2183
|
observer = new MutationObserver((records) => {
|
|
2120
2184
|
for (const record2 of records) {
|
|
2121
2185
|
const target = record2.target;
|
|
2122
|
-
if (target.nodeName === "STYLE" && !target
|
|
2186
|
+
if (target.nodeName === "STYLE" && !isMarked(target))
|
|
2123
2187
|
schedule();
|
|
2124
2188
|
for (const node of Array.from(record2.addedNodes)) {
|
|
2125
2189
|
const name = node.nodeName;
|
|
2126
2190
|
if (name !== "STYLE" && name !== "LINK")
|
|
2127
2191
|
continue;
|
|
2128
|
-
if (node
|
|
2192
|
+
if (isMarked(node))
|
|
2129
2193
|
continue;
|
|
2130
2194
|
if (name === "LINK")
|
|
2131
2195
|
node.addEventListener("load", schedule, { once: true });
|
|
@@ -2350,7 +2414,7 @@ function ensureObserver() {
|
|
|
2350
2414
|
const name = node.nodeName;
|
|
2351
2415
|
if (name !== "STYLE" && name !== "LINK")
|
|
2352
2416
|
continue;
|
|
2353
|
-
if (node
|
|
2417
|
+
if (isMarked(node))
|
|
2354
2418
|
continue;
|
|
2355
2419
|
if (name === "LINK")
|
|
2356
2420
|
node.addEventListener("load", schedule2, { once: true });
|
|
@@ -2578,7 +2642,7 @@ function destroy() {
|
|
|
2578
2642
|
|
|
2579
2643
|
// src/engine/style.ts
|
|
2580
2644
|
var OWN2 = Symbol.for("devknobs.own");
|
|
2581
|
-
var
|
|
2645
|
+
var NAME2 = Symbol.for("devknobs.name");
|
|
2582
2646
|
var TEXT = Symbol.for("devknobs.text");
|
|
2583
2647
|
var wrapped = new WeakMap;
|
|
2584
2648
|
function isDocument(root) {
|
|
@@ -2625,7 +2689,7 @@ function adopt(root, Sheet, name) {
|
|
|
2625
2689
|
const sheet = new Sheet;
|
|
2626
2690
|
Reflect.set(sheet, OWN2, true);
|
|
2627
2691
|
if (name !== undefined)
|
|
2628
|
-
Reflect.set(sheet,
|
|
2692
|
+
Reflect.set(sheet, NAME2, name);
|
|
2629
2693
|
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
2630
2694
|
return wrap(root, sheet);
|
|
2631
2695
|
}
|
|
@@ -2667,7 +2731,7 @@ function switchedSheet(root, name) {
|
|
|
2667
2731
|
};
|
|
2668
2732
|
}
|
|
2669
2733
|
const style = documentOf(root).createElement("style");
|
|
2670
|
-
style
|
|
2734
|
+
markOwn(style, name);
|
|
2671
2735
|
if (isDocument(root))
|
|
2672
2736
|
(root.head ?? root.documentElement).appendChild(style);
|
|
2673
2737
|
else
|
|
@@ -2690,8 +2754,8 @@ function switchedSheet(root, name) {
|
|
|
2690
2754
|
};
|
|
2691
2755
|
}
|
|
2692
2756
|
function findStyle(name, doc = document) {
|
|
2693
|
-
const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own,
|
|
2694
|
-
return sheet ? wrap(doc, sheet) : doc
|
|
2757
|
+
const sheet = "adoptedStyleSheets" in doc ? doc.adoptedStyleSheets.find((own) => Reflect.get(own, NAME2) === name) : undefined;
|
|
2758
|
+
return sheet ? wrap(doc, sheet) : findOwn(doc, name, "style");
|
|
2695
2759
|
}
|
|
2696
2760
|
function ensureStyle(name, doc = document) {
|
|
2697
2761
|
const existing = findStyle(name, doc);
|
|
@@ -2701,7 +2765,7 @@ function ensureStyle(name, doc = document) {
|
|
|
2701
2765
|
if (Sheet)
|
|
2702
2766
|
return adopt(doc, Sheet, name);
|
|
2703
2767
|
const style = doc.createElement("style");
|
|
2704
|
-
style
|
|
2768
|
+
markOwn(style, name);
|
|
2705
2769
|
(doc.head ?? doc.documentElement).appendChild(style);
|
|
2706
2770
|
return style;
|
|
2707
2771
|
}
|
|
@@ -2709,4 +2773,4 @@ function removeStyle(name, doc = document) {
|
|
|
2709
2773
|
findStyle(name, doc)?.remove();
|
|
2710
2774
|
}
|
|
2711
2775
|
|
|
2712
|
-
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, setSystemMedia, 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 };
|
|
2776
|
+
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, setSystemMedia, 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 };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __returnValue = (v) => v;
|
|
3
|
+
function __exportSetter(name, newValue) {
|
|
4
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
+
}
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
set: __exportSetter.bind(all, name)
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
16
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
17
|
+
}) : x)(function(x) {
|
|
18
|
+
if (typeof require !== "undefined")
|
|
19
|
+
return require.apply(this, arguments);
|
|
20
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// src/mark.ts
|
|
24
|
+
var ATTRIBUTES = {
|
|
25
|
+
mark: "data-devknobs",
|
|
26
|
+
frame: "data-devknobs-frame",
|
|
27
|
+
force: "data-devknobs-force",
|
|
28
|
+
hide: "data-devknobs-hide",
|
|
29
|
+
replay: "data-devknobs-replay",
|
|
30
|
+
href: "data-devknobs-href",
|
|
31
|
+
icon: "data-devknobs-icon",
|
|
32
|
+
keys: "data-devknobs-keys",
|
|
33
|
+
fresh: "data-devknobs-fresh",
|
|
34
|
+
early: "data-devknobs-early"
|
|
35
|
+
};
|
|
36
|
+
var OLD_MARK = ATTRIBUTES.mark;
|
|
37
|
+
var MARK = "data-knobs";
|
|
38
|
+
function newName(old) {
|
|
39
|
+
return `${MARK}${old.slice(OLD_MARK.length)}`;
|
|
40
|
+
}
|
|
41
|
+
var NAMES = new Set(Object.values(ATTRIBUTES).map(newName));
|
|
42
|
+
function isOwnName(name) {
|
|
43
|
+
const lower = name.toLowerCase();
|
|
44
|
+
return lower.startsWith(OLD_MARK) || NAMES.has(lower);
|
|
45
|
+
}
|
|
46
|
+
function setMark(element, old, value = "") {
|
|
47
|
+
element.setAttribute(newName(old), value);
|
|
48
|
+
element.setAttribute(old, value);
|
|
49
|
+
}
|
|
50
|
+
function removeMark(element, old) {
|
|
51
|
+
element.removeAttribute(newName(old));
|
|
52
|
+
element.removeAttribute(old);
|
|
53
|
+
}
|
|
54
|
+
function hasMark(element, old) {
|
|
55
|
+
return element.hasAttribute(newName(old)) || element.hasAttribute(old);
|
|
56
|
+
}
|
|
57
|
+
function getMark(element, old) {
|
|
58
|
+
return element.getAttribute(newName(old)) ?? element.getAttribute(old);
|
|
59
|
+
}
|
|
60
|
+
function either(old, rest = "]") {
|
|
61
|
+
return `[${newName(old)}${rest},[${old}${rest}`;
|
|
62
|
+
}
|
|
63
|
+
function markOwn(element, value = "") {
|
|
64
|
+
setMark(element, OLD_MARK, value);
|
|
65
|
+
}
|
|
66
|
+
function isMarked(element) {
|
|
67
|
+
return hasMark(element, OLD_MARK);
|
|
68
|
+
}
|
|
69
|
+
function ownSelector(value) {
|
|
70
|
+
return either(OLD_MARK, value === undefined ? "]" : `="${value}"]`);
|
|
71
|
+
}
|
|
72
|
+
function findOwn(root, value, tag = "") {
|
|
73
|
+
return root.querySelector(`${tag}[${MARK}="${value}"]`) ?? root.querySelector(`${tag}[${OLD_MARK}="${value}"]`);
|
|
74
|
+
}
|
|
75
|
+
var OWN_AND_IN = `${ownSelector()},${either(OLD_MARK, "] *")}`;
|
|
76
|
+
|
|
77
|
+
export { __export, __require, ATTRIBUTES, OLD_MARK, newName, isOwnName, setMark, removeMark, hasMark, getMark, either, markOwn, isMarked, ownSelector, findOwn, OWN_AND_IN };
|