@vinena/knobs 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/README.md +7 -6
- package/dist/context-amfyasb5.js +23 -0
- package/dist/context-svtr7vwt.js +22 -0
- package/dist/early.global.js +6 -6
- package/dist/edit/css.d.ts +59 -0
- package/dist/edit/html.d.ts +91 -0
- package/dist/edit/keep.d.ts +175 -0
- package/dist/edit/log.d.ts +107 -0
- package/dist/edit/replay.d.ts +28 -0
- package/dist/edit/risk.d.ts +33 -0
- package/dist/edit/rule.d.ts +31 -0
- package/dist/edit/source.d.ts +12 -0
- package/dist/edit/text.d.ts +66 -0
- package/dist/elementsview-fyc06wjt.js +3702 -0
- package/dist/elementsview-k6zvvcne.js +3701 -0
- package/dist/engine/browserdraw.d.ts +5 -0
- package/dist/engine/browserkit.d.ts +2 -0
- package/dist/engine/devices.d.ts +3 -2
- package/dist/engine/dock.d.ts +3 -4
- package/dist/engine/frame.d.ts +1 -1
- package/dist/engine/frames.d.ts +1 -0
- package/dist/engine/identity.d.ts +5 -1
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/mock.d.ts +0 -2
- package/dist/engine/mockdata.d.ts +4 -3
- package/dist/engine/mockdraw.d.ts +2 -14
- package/dist/engine/morphrun.d.ts +4 -0
- package/dist/engine/native.d.ts +31 -3
- package/dist/engine/notice.d.ts +1 -2
- package/dist/engine/style.d.ts +15 -0
- package/dist/engine/width.d.ts +3 -0
- package/dist/{framekit-w0v516w5.js → framekit-622h6w1f.js} +264 -105
- package/dist/{framekit-te90cjs0.js → framekit-yx612r28.js} +264 -105
- package/dist/index-0zp9py56.js +859 -0
- package/dist/{index-9re7sv56.js → index-1mstjadm.js} +126 -2167
- package/dist/{index-30fc6php.js → index-4a4x1bt2.js} +1 -1
- package/dist/index-58jdczmj.js +44 -0
- package/dist/index-5tv6sr74.js +23 -0
- package/dist/index-6bc2ztfd.js +688 -0
- package/dist/index-7cb4x1vj.js +1885 -0
- package/dist/index-a974q3aa.js +34 -0
- package/dist/{index-r72tz2vn.js → index-aymfvd8s.js} +1 -1
- package/dist/{index-trx7bxdk.js → index-aynkv7qk.js} +11 -8
- package/dist/{index-xjhwp5cj.js → index-dzm8ywq0.js} +504 -2362
- package/dist/{index-dan2kpsd.js → index-f60yax1j.js} +13 -8
- package/dist/index-f67wctn3.js +1858 -0
- package/dist/{index-agwr37gw.js → index-ftjdt358.js} +8 -171
- package/dist/{index-pewcdh28.js → index-gm51cthv.js} +2 -45
- package/dist/index-kfdzsyyw.js +1859 -0
- package/dist/index-t4kssacm.js +208 -0
- package/dist/index-v0ht9q0g.js +1518 -0
- package/dist/{index-sxe5079a.js → index-x59vz1xx.js} +262 -901
- package/dist/index-xh39jtkq.js +32 -0
- package/dist/index-yb7fc59g.js +718 -0
- package/dist/index-zd6adby9.js +496 -0
- package/dist/index.d.ts +62 -0
- package/dist/index.global.js +447 -160
- package/dist/index.js +533 -485
- package/dist/react-0wepdf60.js +1519 -0
- package/dist/{react-4pvp6amm.js → react-1gqwa2yw.js} +1 -1
- package/dist/{index-hv02xka3.js → react-3mfz1x2a.js} +126 -2167
- package/dist/react-4rbjw9af.js +33 -0
- package/dist/react-5rq7bnsy.js +210 -0
- package/dist/react-6bz05qk1.js +860 -0
- package/dist/{react-05jh9jv5.js → react-6fnxxs30.js} +8 -171
- package/dist/react-6q2cw2ya.js +689 -0
- package/dist/{react-sw8d8c94.js → react-6t4dbdzn.js} +11 -8
- package/dist/react-88es9b5q.js +719 -0
- package/dist/react-97b5b8j4.js +46 -0
- package/dist/{react-16spgn0h.js → react-bxzn8vq5.js} +1 -1
- package/dist/{react-ayg1bgw3.js → react-cs62p9qh.js} +83 -722
- package/dist/react-ethftdxp.js +497 -0
- package/dist/react-fp73vhyd.js +36 -0
- package/dist/{react-exjcpxma.js → react-me102s1a.js} +2 -45
- package/dist/react-t2qnewz2.js +24 -0
- package/dist/react-ttj8f9qp.js +1886 -0
- package/dist/{react-zy1mmhgz.js → react-v8497a41.js} +13 -8
- package/dist/{react-fm9y8dbn.js → react-wqn4sx0n.js} +276 -2133
- package/dist/react.js +529 -485
- package/dist/replay-j18rw92k.js +258 -0
- package/dist/replay-vtg0vqj2.js +257 -0
- package/dist/{storageview-s7heg93p.js → storageview-6xj7zb63.js} +11 -7
- package/dist/{storageview-r595qpt9.js → storageview-pzn8yaad.js} +11 -7
- package/dist/styles/force.d.ts +66 -0
- package/dist/types.d.ts +7 -0
- package/dist/ui/bindings.d.ts +31 -5
- package/dist/ui/changes.d.ts +49 -0
- package/dist/ui/cssauto.d.ts +119 -0
- package/dist/ui/cssedit.d.ts +80 -0
- package/dist/ui/domedit.d.ts +99 -0
- package/dist/ui/domtree.d.ts +26 -1
- package/dist/ui/elementsview.d.ts +19 -2
- package/dist/ui/htmledit.d.ts +62 -0
- package/dist/ui/inspector.d.ts +6 -1
- package/dist/ui/keys.d.ts +12 -8
- package/dist/ui/pane.d.ts +0 -2
- package/dist/ui/panel.d.ts +3 -0
- package/dist/ui/prefs.d.ts +30 -10
- package/dist/ui/settings.d.ts +10 -0
- package/dist/ui/size.d.ts +14 -22
- package/dist/ui/stylesview.d.ts +30 -1
- package/package.json +1 -1
- package/skills/devknobs/SKILL.md +95 -0
- package/dist/elementsview-2z4pkrdz.js +0 -2873
- package/dist/elementsview-qn8qyksa.js +0 -2874
- package/dist/index-78r0f8pw.js +0 -27
- package/dist/react-adky72h9.js +0 -29
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
switchedSheet
|
|
4
|
+
} from "./react-wqn4sx0n.js";
|
|
5
|
+
|
|
6
|
+
// src/styles/varrefs.ts
|
|
7
|
+
var SPACE = /\s/;
|
|
8
|
+
var IDENT = /[\w\-\\\u0080-]/;
|
|
9
|
+
function pastString(value, at) {
|
|
10
|
+
const quote = value[at];
|
|
11
|
+
let i = at + 1;
|
|
12
|
+
while (i < value.length && value[i] !== quote)
|
|
13
|
+
i += value[i] === "\\" ? 2 : 1;
|
|
14
|
+
return Math.min(i + 1, value.length);
|
|
15
|
+
}
|
|
16
|
+
function calls(value, at, name) {
|
|
17
|
+
if (value.slice(at, at + name.length + 1).toLowerCase() !== `${name}(`)
|
|
18
|
+
return false;
|
|
19
|
+
return at === 0 || !IDENT.test(value[at - 1] ?? "");
|
|
20
|
+
}
|
|
21
|
+
function past(value, at) {
|
|
22
|
+
const char = value[at];
|
|
23
|
+
if (char === "\\")
|
|
24
|
+
return Math.min(at + 2, value.length);
|
|
25
|
+
if (char === '"' || char === "'")
|
|
26
|
+
return pastString(value, at);
|
|
27
|
+
if (char === "/" && value[at + 1] === "*") {
|
|
28
|
+
const stop = value.indexOf("*/", at + 2);
|
|
29
|
+
return stop < 0 ? value.length : stop + 2;
|
|
30
|
+
}
|
|
31
|
+
if (!calls(value, at, "url"))
|
|
32
|
+
return at;
|
|
33
|
+
let i = at + 4;
|
|
34
|
+
while (i < value.length && SPACE.test(value[i] ?? ""))
|
|
35
|
+
i++;
|
|
36
|
+
if (value[i] === '"' || value[i] === "'")
|
|
37
|
+
return at;
|
|
38
|
+
while (i < value.length && value[i] !== ")")
|
|
39
|
+
i += value[i] === "\\" ? 2 : 1;
|
|
40
|
+
return Math.min(i + 1, value.length);
|
|
41
|
+
}
|
|
42
|
+
function pastSpace(value, at) {
|
|
43
|
+
let i = at;
|
|
44
|
+
while (i < value.length) {
|
|
45
|
+
if (SPACE.test(value[i] ?? ""))
|
|
46
|
+
i++;
|
|
47
|
+
else if (value[i] === "/" && value[i + 1] === "*")
|
|
48
|
+
i = past(value, i);
|
|
49
|
+
else
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
return i;
|
|
53
|
+
}
|
|
54
|
+
function closeOf(value, from) {
|
|
55
|
+
let depth = 1;
|
|
56
|
+
let i = from;
|
|
57
|
+
while (i < value.length) {
|
|
58
|
+
const next = past(value, i);
|
|
59
|
+
if (next > i) {
|
|
60
|
+
i = next;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (value[i] === "(")
|
|
64
|
+
depth++;
|
|
65
|
+
else if (value[i] === ")" && --depth === 0)
|
|
66
|
+
return i;
|
|
67
|
+
i++;
|
|
68
|
+
}
|
|
69
|
+
return value.length;
|
|
70
|
+
}
|
|
71
|
+
function plain(value) {
|
|
72
|
+
let text = "";
|
|
73
|
+
let i = 0;
|
|
74
|
+
while (i < value.length) {
|
|
75
|
+
const next = past(value, i);
|
|
76
|
+
const comment = value[i] === "/" && value[i + 1] === "*";
|
|
77
|
+
if (!comment)
|
|
78
|
+
text += value.slice(i, Math.max(next, i + 1));
|
|
79
|
+
i = Math.max(next, i + 1);
|
|
80
|
+
}
|
|
81
|
+
return text;
|
|
82
|
+
}
|
|
83
|
+
function referenceAt(value, start) {
|
|
84
|
+
const at = pastSpace(value, start + 4);
|
|
85
|
+
if (!value.startsWith("--", at))
|
|
86
|
+
return null;
|
|
87
|
+
let stop = at;
|
|
88
|
+
while (stop < value.length) {
|
|
89
|
+
const char = value[stop] ?? "";
|
|
90
|
+
if (SPACE.test(char) || char === "," || char === ")")
|
|
91
|
+
break;
|
|
92
|
+
if (char === "/" && value[stop + 1] === "*")
|
|
93
|
+
break;
|
|
94
|
+
stop += char === "\\" ? 2 : 1;
|
|
95
|
+
}
|
|
96
|
+
stop = Math.min(stop, value.length);
|
|
97
|
+
const name = value.slice(at, stop);
|
|
98
|
+
if (name.length < 3)
|
|
99
|
+
return null;
|
|
100
|
+
const after = pastSpace(value, stop);
|
|
101
|
+
if (after >= value.length || value[after] === ")") {
|
|
102
|
+
const closed2 = after < value.length;
|
|
103
|
+
return { start, end: closed2 ? after + 1 : value.length, name, at, fallback: null, closed: closed2 };
|
|
104
|
+
}
|
|
105
|
+
if (value[after] !== ",")
|
|
106
|
+
return null;
|
|
107
|
+
const close = closeOf(value, after + 1);
|
|
108
|
+
const fallback = plain(value.slice(after + 1, close)).trim();
|
|
109
|
+
const closed = close < value.length;
|
|
110
|
+
return { start, end: closed ? close + 1 : value.length, name, at, fallback, closed };
|
|
111
|
+
}
|
|
112
|
+
function varReferences(value) {
|
|
113
|
+
const found = [];
|
|
114
|
+
let i = 0;
|
|
115
|
+
while (i < value.length) {
|
|
116
|
+
const next = past(value, i);
|
|
117
|
+
if (next > i) {
|
|
118
|
+
i = next;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const reference = calls(value, i, "var") ? referenceAt(value, i) : null;
|
|
122
|
+
if (reference)
|
|
123
|
+
found.push(reference);
|
|
124
|
+
i = reference ? reference.at + reference.name.length : i + 1;
|
|
125
|
+
}
|
|
126
|
+
return found;
|
|
127
|
+
}
|
|
128
|
+
function resolveVars(value, read) {
|
|
129
|
+
let text = "";
|
|
130
|
+
let at = 0;
|
|
131
|
+
for (const reference of varReferences(value)) {
|
|
132
|
+
if (reference.start < at)
|
|
133
|
+
continue;
|
|
134
|
+
if (!reference.closed)
|
|
135
|
+
return null;
|
|
136
|
+
const seen = read(reference.name);
|
|
137
|
+
const comes = seen !== "" ? seen : reference.fallback === null ? null : resolveVars(reference.fallback, read);
|
|
138
|
+
if (comes === null)
|
|
139
|
+
return null;
|
|
140
|
+
text += value.slice(at, reference.start) + comes;
|
|
141
|
+
at = reference.end;
|
|
142
|
+
}
|
|
143
|
+
return text + value.slice(at);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/styles/declarations.ts
|
|
147
|
+
var IMPORTANT = /!\s*important\s*$/i;
|
|
148
|
+
function skipString(text, at) {
|
|
149
|
+
const quote = text[at];
|
|
150
|
+
let i = at + 1;
|
|
151
|
+
while (i < text.length && text[i] !== quote)
|
|
152
|
+
i += text[i] === "\\" ? 2 : 1;
|
|
153
|
+
return i + 1;
|
|
154
|
+
}
|
|
155
|
+
function split(text) {
|
|
156
|
+
const found = [];
|
|
157
|
+
let name = null;
|
|
158
|
+
let piece = "";
|
|
159
|
+
let depth = 0;
|
|
160
|
+
const close = () => {
|
|
161
|
+
if (name !== null && name.trim())
|
|
162
|
+
found.push({ name: name.trim(), value: piece.trim() });
|
|
163
|
+
name = null;
|
|
164
|
+
piece = "";
|
|
165
|
+
};
|
|
166
|
+
let i = 0;
|
|
167
|
+
while (i < text.length) {
|
|
168
|
+
const char = text[i] ?? "";
|
|
169
|
+
let end = i + 1;
|
|
170
|
+
if (char === "\\")
|
|
171
|
+
end = i + 2;
|
|
172
|
+
else if (char === '"' || char === "'")
|
|
173
|
+
end = skipString(text, i);
|
|
174
|
+
else if (char === "/" && text[i + 1] === "*") {
|
|
175
|
+
const stop = text.indexOf("*/", i + 2);
|
|
176
|
+
i = stop < 0 ? text.length : stop + 2;
|
|
177
|
+
continue;
|
|
178
|
+
} else if (char === "(" || char === "[" || char === "{")
|
|
179
|
+
depth++;
|
|
180
|
+
else if (char === ")" || char === "]" || char === "}")
|
|
181
|
+
depth = Math.max(0, depth - 1);
|
|
182
|
+
else if (depth === 0 && char === ";") {
|
|
183
|
+
close();
|
|
184
|
+
i = end;
|
|
185
|
+
continue;
|
|
186
|
+
} else if (depth === 0 && char === ":" && name === null) {
|
|
187
|
+
name = piece;
|
|
188
|
+
piece = "";
|
|
189
|
+
i = end;
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
piece += text.slice(i, end);
|
|
193
|
+
i = end;
|
|
194
|
+
}
|
|
195
|
+
close();
|
|
196
|
+
return found;
|
|
197
|
+
}
|
|
198
|
+
function parseDeclarations(cssText) {
|
|
199
|
+
return split(cssText).map(({ name, value }) => {
|
|
200
|
+
const important = IMPORTANT.test(value);
|
|
201
|
+
return {
|
|
202
|
+
name: name.startsWith("--") ? name : name.toLowerCase(),
|
|
203
|
+
value: important ? value.replace(IMPORTANT, "").trim() : value,
|
|
204
|
+
important
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function variableNames(value) {
|
|
209
|
+
return [...new Set(varReferences(value).map((reference) => reference.name))];
|
|
210
|
+
}
|
|
211
|
+
function listed(style) {
|
|
212
|
+
const names = [];
|
|
213
|
+
for (let i = 0;i < style.length; i++) {
|
|
214
|
+
const name = style.item(i);
|
|
215
|
+
if (name)
|
|
216
|
+
names.push(name);
|
|
217
|
+
}
|
|
218
|
+
return names;
|
|
219
|
+
}
|
|
220
|
+
function longhandsOf(name, names, expand) {
|
|
221
|
+
if (name.startsWith("--") || names.includes(name))
|
|
222
|
+
return [name];
|
|
223
|
+
const known = expand(name).filter((longhand) => names.includes(longhand));
|
|
224
|
+
if (known.length > 0)
|
|
225
|
+
return known;
|
|
226
|
+
const under = names.filter((longhand) => longhand.startsWith(`${name}-`));
|
|
227
|
+
return under.length > 0 ? under : [name];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// src/edit/css.ts
|
|
231
|
+
var IMPORTANT2 = /\s*!\s*important\s*$/i;
|
|
232
|
+
function valueText(written) {
|
|
233
|
+
return written.important ? `${written.value} !important` : written.value;
|
|
234
|
+
}
|
|
235
|
+
function written(name, text) {
|
|
236
|
+
const important = IMPORTANT2.test(text);
|
|
237
|
+
return { name, value: text.replace(IMPORTANT2, "").trim(), important };
|
|
238
|
+
}
|
|
239
|
+
function declarationIn(style, property) {
|
|
240
|
+
const list = parseDeclarations(style.cssText);
|
|
241
|
+
const index = list.findIndex((one) => one.name === property);
|
|
242
|
+
const found = list[index];
|
|
243
|
+
return found ? { text: valueText(found), index } : null;
|
|
244
|
+
}
|
|
245
|
+
function valueIn(style, property) {
|
|
246
|
+
const found = declarationIn(style, property);
|
|
247
|
+
if (found)
|
|
248
|
+
return found.text;
|
|
249
|
+
const value = style.getPropertyValue(property);
|
|
250
|
+
if (value === "")
|
|
251
|
+
return null;
|
|
252
|
+
return style.getPropertyPriority(property) === "important" ? `${value} !important` : value;
|
|
253
|
+
}
|
|
254
|
+
function supports(element, property, value) {
|
|
255
|
+
try {
|
|
256
|
+
const css = element.ownerDocument?.defaultView?.CSS ?? globalThis.CSS;
|
|
257
|
+
return css ? css.supports(property, value) : true;
|
|
258
|
+
} catch {
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function setText(style, element, property, text) {
|
|
263
|
+
if (text === null) {
|
|
264
|
+
style.removeProperty(property);
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
const { value, important } = written(property, text);
|
|
268
|
+
if (value === "" || !supports(element, property, value))
|
|
269
|
+
return false;
|
|
270
|
+
style.setProperty(property, value, important ? "important" : "");
|
|
271
|
+
return style.getPropertyValue(property) !== "";
|
|
272
|
+
}
|
|
273
|
+
function insertAt(style, element, property, text, at) {
|
|
274
|
+
const list = parseDeclarations(style.cssText);
|
|
275
|
+
if (list.some((one2) => one2.value === "") || list.some((one2) => one2.name === property)) {
|
|
276
|
+
return setText(style, element, property, text);
|
|
277
|
+
}
|
|
278
|
+
const one = written(property, text);
|
|
279
|
+
if (one.value === "" || !supports(element, property, one.value))
|
|
280
|
+
return false;
|
|
281
|
+
list.splice(Math.max(0, Math.min(at, list.length)), 0, one);
|
|
282
|
+
style.cssText = list.map((each) => `${each.name}: ${valueText(each)};`).join(" ");
|
|
283
|
+
return style.getPropertyValue(property) !== "";
|
|
284
|
+
}
|
|
285
|
+
var sheetIds = new WeakMap;
|
|
286
|
+
var sheetsSeen = 0;
|
|
287
|
+
function sheetIdOf(rule) {
|
|
288
|
+
const sheet = Reflect.get(rule, "parentStyleSheet");
|
|
289
|
+
const key = typeof sheet === "object" && sheet !== null ? sheet : rule;
|
|
290
|
+
let id = sheetIds.get(key);
|
|
291
|
+
if (id === undefined) {
|
|
292
|
+
id = ++sheetsSeen;
|
|
293
|
+
sheetIds.set(key, id);
|
|
294
|
+
}
|
|
295
|
+
return id;
|
|
296
|
+
}
|
|
297
|
+
var places = new WeakMap;
|
|
298
|
+
function nameOf(property) {
|
|
299
|
+
return property.startsWith("--") ? property.trim() : property.trim().toLowerCase();
|
|
300
|
+
}
|
|
301
|
+
function targetOf(place) {
|
|
302
|
+
const target = { selector: place.selector };
|
|
303
|
+
if (place.rule)
|
|
304
|
+
target.rule = { ...place.rule, path: [...place.rule.path], context: [...place.rule.context] };
|
|
305
|
+
return target;
|
|
306
|
+
}
|
|
307
|
+
function viewOf(place) {
|
|
308
|
+
try {
|
|
309
|
+
return place.element.ownerDocument?.defaultView ?? null;
|
|
310
|
+
} catch {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function cssValue(kind, place, property, after) {
|
|
315
|
+
const name = nameOf(property);
|
|
316
|
+
const next = after.trim();
|
|
317
|
+
if (name === "" || next === "")
|
|
318
|
+
return null;
|
|
319
|
+
const { style, element } = place;
|
|
320
|
+
const before = valueIn(style, name);
|
|
321
|
+
if (before === next)
|
|
322
|
+
return null;
|
|
323
|
+
const change = {
|
|
324
|
+
edit: { kind, target: targetOf(place), property: name, before, after: next },
|
|
325
|
+
apply: () => setText(style, element, name, next),
|
|
326
|
+
revert: () => void setText(style, element, name, before),
|
|
327
|
+
view: viewOf(place)
|
|
328
|
+
};
|
|
329
|
+
places.set(change, { style, index: -1 });
|
|
330
|
+
return change;
|
|
331
|
+
}
|
|
332
|
+
function offIn(recorded, style) {
|
|
333
|
+
const last = new Map;
|
|
334
|
+
for (const { edit, change } of recorded) {
|
|
335
|
+
const place = places.get(change);
|
|
336
|
+
if (place?.style !== style)
|
|
337
|
+
continue;
|
|
338
|
+
const off = edit.kind === "css-toggle" && edit.after === null && edit.before !== null && place.index >= 0;
|
|
339
|
+
last.set(edit.property, off && edit.before !== null ? { property: edit.property, text: edit.before, index: place.index } : null);
|
|
340
|
+
}
|
|
341
|
+
return [...last.values()].filter((one) => one !== null).sort((a, b) => a.index - b.index);
|
|
342
|
+
}
|
|
343
|
+
function othersOff(recorded, style, property) {
|
|
344
|
+
return offIn(recorded(), style).filter((one) => one.property !== property);
|
|
345
|
+
}
|
|
346
|
+
function putBack(recorded, place, property, text, index) {
|
|
347
|
+
const before = othersOff(recorded, place.style, property).filter((one) => one.index < index).length;
|
|
348
|
+
return insertAt(place.style, place.element, property, text, index - before);
|
|
349
|
+
}
|
|
350
|
+
function cssOff(place, property, recorded) {
|
|
351
|
+
const name = nameOf(property);
|
|
352
|
+
const { style, element } = place;
|
|
353
|
+
const before = valueIn(style, name);
|
|
354
|
+
if (before === null)
|
|
355
|
+
return null;
|
|
356
|
+
const found = declarationIn(style, name);
|
|
357
|
+
let index = -1;
|
|
358
|
+
if (found) {
|
|
359
|
+
index = found.index;
|
|
360
|
+
for (const one of othersOff(recorded, style, name))
|
|
361
|
+
if (one.index <= index)
|
|
362
|
+
index++;
|
|
363
|
+
}
|
|
364
|
+
const change = {
|
|
365
|
+
edit: { kind: "css-toggle", target: targetOf(place), property: name, before, after: null },
|
|
366
|
+
apply: () => setText(style, element, name, null),
|
|
367
|
+
revert: () => {
|
|
368
|
+
if (index < 0)
|
|
369
|
+
setText(style, element, name, before);
|
|
370
|
+
else
|
|
371
|
+
putBack(recorded, place, name, before, index);
|
|
372
|
+
},
|
|
373
|
+
view: viewOf(place)
|
|
374
|
+
};
|
|
375
|
+
places.set(change, { style, index });
|
|
376
|
+
return change;
|
|
377
|
+
}
|
|
378
|
+
function cssOn(place, off, recorded) {
|
|
379
|
+
const { style, element } = place;
|
|
380
|
+
const change = {
|
|
381
|
+
edit: { kind: "css-toggle", target: targetOf(place), property: off.property, before: null, after: off.text },
|
|
382
|
+
apply: () => putBack(recorded, place, off.property, off.text, off.index),
|
|
383
|
+
revert: () => void setText(style, element, off.property, null),
|
|
384
|
+
view: viewOf(place)
|
|
385
|
+
};
|
|
386
|
+
places.set(change, { style, index: off.index });
|
|
387
|
+
return change;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// src/edit/rule.ts
|
|
391
|
+
var NEW_RULE_SHEET = "new rule";
|
|
392
|
+
var NEW_RULE = Symbol.for("devknobs.newrule");
|
|
393
|
+
function isNewRuleSheet(sheet) {
|
|
394
|
+
return Reflect.get(sheet, NEW_RULE) === true;
|
|
395
|
+
}
|
|
396
|
+
var made = new WeakMap;
|
|
397
|
+
function isShadowRoot(node) {
|
|
398
|
+
return node.nodeType === 11 && "host" in node;
|
|
399
|
+
}
|
|
400
|
+
function isDocumentNode(node) {
|
|
401
|
+
return node.nodeType === 9;
|
|
402
|
+
}
|
|
403
|
+
function isStyleRule(rule) {
|
|
404
|
+
return rule?.constructor.name === "CSSStyleRule";
|
|
405
|
+
}
|
|
406
|
+
function viewOf2(element) {
|
|
407
|
+
try {
|
|
408
|
+
return element.ownerDocument?.defaultView ?? null;
|
|
409
|
+
} catch {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
function newRule(place, text) {
|
|
414
|
+
const selectorText = text.trim();
|
|
415
|
+
if (selectorText === "" || selectorText.startsWith("@"))
|
|
416
|
+
return null;
|
|
417
|
+
const { element } = place;
|
|
418
|
+
const root = element.getRootNode();
|
|
419
|
+
if (!isDocumentNode(root) && !isShadowRoot(root))
|
|
420
|
+
return null;
|
|
421
|
+
const switched = switchedSheet(root, "new-rule");
|
|
422
|
+
if (!switched)
|
|
423
|
+
return null;
|
|
424
|
+
const { sheet } = switched;
|
|
425
|
+
try {
|
|
426
|
+
sheet.insertRule(`${selectorText} {}`, 0);
|
|
427
|
+
} catch {
|
|
428
|
+
switched.remove();
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
const rule = sheet.cssRules[0];
|
|
432
|
+
if (sheet.cssRules.length !== 1 || !isStyleRule(rule)) {
|
|
433
|
+
switched.remove();
|
|
434
|
+
return null;
|
|
435
|
+
}
|
|
436
|
+
Reflect.set(sheet, NEW_RULE, true);
|
|
437
|
+
const change = {
|
|
438
|
+
edit: {
|
|
439
|
+
kind: "css-rule",
|
|
440
|
+
target: {
|
|
441
|
+
selector: place.selector,
|
|
442
|
+
rule: { selectorText: rule.selectorText, sheet: NEW_RULE_SHEET, owner: null, sheetId: sheetIdOf(rule), path: [0], context: [] }
|
|
443
|
+
},
|
|
444
|
+
property: "rule",
|
|
445
|
+
before: null,
|
|
446
|
+
after: rule.selectorText
|
|
447
|
+
},
|
|
448
|
+
apply() {
|
|
449
|
+
switched.on();
|
|
450
|
+
return true;
|
|
451
|
+
},
|
|
452
|
+
revert: () => switched.off(),
|
|
453
|
+
view: viewOf2(element)
|
|
454
|
+
};
|
|
455
|
+
made.set(change, { rule, element });
|
|
456
|
+
return change;
|
|
457
|
+
}
|
|
458
|
+
function ruleOf(change) {
|
|
459
|
+
return made.get(change)?.rule ?? null;
|
|
460
|
+
}
|
|
461
|
+
function newRulesFor(recorded, element) {
|
|
462
|
+
const rules = [];
|
|
463
|
+
for (const { change } of recorded) {
|
|
464
|
+
const one = made.get(change);
|
|
465
|
+
if (one?.element === element)
|
|
466
|
+
rules.push(one.rule);
|
|
467
|
+
}
|
|
468
|
+
return rules;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// src/styles/tree.ts
|
|
472
|
+
function isShadowRoot2(node) {
|
|
473
|
+
return "host" in node;
|
|
474
|
+
}
|
|
475
|
+
function scopeOf(element) {
|
|
476
|
+
const root = element.getRootNode();
|
|
477
|
+
return isShadowRoot2(root) ? root : element.ownerDocument;
|
|
478
|
+
}
|
|
479
|
+
function flatParent(element) {
|
|
480
|
+
if (element.assignedSlot)
|
|
481
|
+
return element.assignedSlot;
|
|
482
|
+
if (element.parentElement)
|
|
483
|
+
return element.parentElement;
|
|
484
|
+
const root = element.getRootNode();
|
|
485
|
+
return isShadowRoot2(root) ? root.host : null;
|
|
486
|
+
}
|
|
487
|
+
function label(element) {
|
|
488
|
+
const id = element.getAttribute("id");
|
|
489
|
+
const classes = (element.getAttribute("class") ?? "").split(/\s+/).filter(Boolean);
|
|
490
|
+
return [
|
|
491
|
+
element.tagName.toLowerCase(),
|
|
492
|
+
id ? `#${id}` : "",
|
|
493
|
+
...classes.map((name) => `.${name}`)
|
|
494
|
+
].join("");
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export { isShadowRoot2 as isShadowRoot, scopeOf, flatParent, label, varReferences, resolveVars, parseDeclarations, variableNames, listed, longhandsOf, valueText, sheetIdOf, cssValue, offIn, cssOff, cssOn, NEW_RULE_SHEET, isNewRuleSheet, newRule, ruleOf, newRulesFor };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/requests/shared.ts
|
|
4
|
+
var SHARED_VERSION = 2;
|
|
5
|
+
var SHARED = Symbol.for("devknobs.requests");
|
|
6
|
+
var QUIET = Symbol.for("devknobs.quiet");
|
|
7
|
+
function isShared(value) {
|
|
8
|
+
return typeof value === "object" && value !== null && Reflect.get(value, "version") === SHARED_VERSION;
|
|
9
|
+
}
|
|
10
|
+
function shared(scope = globalThis) {
|
|
11
|
+
try {
|
|
12
|
+
const value = Reflect.get(scope, SHARED);
|
|
13
|
+
return isShared(value) ? value : null;
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function share(recorder) {
|
|
19
|
+
if (recorder)
|
|
20
|
+
Reflect.set(globalThis, SHARED, recorder);
|
|
21
|
+
else
|
|
22
|
+
Reflect.deleteProperty(globalThis, SHARED);
|
|
23
|
+
}
|
|
24
|
+
function evict() {
|
|
25
|
+
const other = Reflect.get(globalThis, SHARED);
|
|
26
|
+
if (typeof other !== "object" || other === null)
|
|
27
|
+
return;
|
|
28
|
+
const uninstall = Reflect.get(other, "uninstall");
|
|
29
|
+
try {
|
|
30
|
+
if (typeof uninstall === "function")
|
|
31
|
+
uninstall.call(other);
|
|
32
|
+
} catch {}
|
|
33
|
+
Reflect.deleteProperty(globalThis, SHARED);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { SHARED_VERSION, QUIET, shared, share, evict };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
deviceOf,
|
|
4
4
|
formOf,
|
|
5
5
|
needsFrame
|
|
6
|
-
} from "./react-
|
|
6
|
+
} from "./react-wqn4sx0n.js";
|
|
7
7
|
|
|
8
8
|
// src/engine/morph.ts
|
|
9
9
|
var MORPH_TIME = {
|
|
@@ -225,49 +225,6 @@ function sequence(steps, target) {
|
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
// src/engine/dock.ts
|
|
229
|
-
var DOCK_WIDTH = 240;
|
|
230
|
-
var PAGE_MIN = 320;
|
|
231
|
-
var width = DOCK_WIDTH;
|
|
232
|
-
var listeners = new Set;
|
|
233
|
-
function dockWidth() {
|
|
234
|
-
return width;
|
|
235
|
-
}
|
|
236
|
-
function setDockWidth(px) {
|
|
237
|
-
if (!(px > 0) || px === width)
|
|
238
|
-
return;
|
|
239
|
-
width = px;
|
|
240
|
-
for (const listener of [...listeners])
|
|
241
|
-
listener();
|
|
242
|
-
}
|
|
243
|
-
function onDockWidth(listener) {
|
|
244
|
-
listeners.add(listener);
|
|
245
|
-
return () => {
|
|
246
|
-
listeners.delete(listener);
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
var column = null;
|
|
250
|
-
function watchColumn(read) {
|
|
251
|
-
column = read;
|
|
252
|
-
return () => {
|
|
253
|
-
if (column === read)
|
|
254
|
-
column = null;
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
function columnEdge(side, time) {
|
|
258
|
-
return column?.(side, time) ?? null;
|
|
259
|
-
}
|
|
260
|
-
function dockRoom(view, column2) {
|
|
261
|
-
return view - column2 >= PAGE_MIN;
|
|
262
|
-
}
|
|
263
|
-
function dockInset(panel, view, column2) {
|
|
264
|
-
return panel.docked && panel.open && dockRoom(view, column2) ? column2 : 0;
|
|
265
|
-
}
|
|
266
|
-
function dockEdges(panel, view, column2) {
|
|
267
|
-
const inset = dockInset(panel, view, column2);
|
|
268
|
-
return { left: panel.side === "left" ? inset : 0, right: panel.side === "right" ? inset : 0 };
|
|
269
|
-
}
|
|
270
|
-
|
|
271
228
|
// src/engine/remount.ts
|
|
272
229
|
var BURST = 10;
|
|
273
230
|
var BURST_SPAN = 1000;
|
|
@@ -344,4 +301,4 @@ function keepMounted(node, options = {}) {
|
|
|
344
301
|
};
|
|
345
302
|
}
|
|
346
303
|
|
|
347
|
-
export { MORPH_TIME, FADE_CURVE, bezier, ease, lerp, holeAt, sameRect, sameHole, windowRect, rounded, fitCorners, readCorners, holePath, poseOf, turnedPose, coverAt, poseAt, poseTransform, turnOf, folds, shapeOf, moves, plan, sequence,
|
|
304
|
+
export { MORPH_TIME, FADE_CURVE, bezier, ease, lerp, holeAt, sameRect, sameHole, windowRect, rounded, fitCorners, readCorners, holePath, poseOf, turnedPose, coverAt, poseAt, poseTransform, turnOf, folds, shapeOf, moves, plan, sequence, keepMounted };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __returnValue = (v) => v;
|
|
4
|
+
function __exportSetter(name, newValue) {
|
|
5
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
+
}
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
set: __exportSetter.bind(all, name)
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
17
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
18
|
+
}) : x)(function(x) {
|
|
19
|
+
if (typeof require !== "undefined")
|
|
20
|
+
return require.apply(this, arguments);
|
|
21
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { __export, __require };
|