@vinena/knobs 0.5.3 → 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.
Files changed (94) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +7 -6
  3. package/dist/context-amfyasb5.js +23 -0
  4. package/dist/context-svtr7vwt.js +22 -0
  5. package/dist/early.global.js +5 -5
  6. package/dist/edit/css.d.ts +59 -0
  7. package/dist/edit/html.d.ts +91 -0
  8. package/dist/edit/keep.d.ts +175 -0
  9. package/dist/edit/log.d.ts +107 -0
  10. package/dist/edit/replay.d.ts +28 -0
  11. package/dist/edit/risk.d.ts +33 -0
  12. package/dist/edit/rule.d.ts +31 -0
  13. package/dist/edit/source.d.ts +12 -0
  14. package/dist/edit/text.d.ts +66 -0
  15. package/dist/elementsview-fyc06wjt.js +3702 -0
  16. package/dist/elementsview-k6zvvcne.js +3701 -0
  17. package/dist/engine/dock.d.ts +3 -4
  18. package/dist/engine/frame.d.ts +1 -1
  19. package/dist/engine/style.d.ts +15 -0
  20. package/dist/{framekit-cjz0e4y8.js → framekit-622h6w1f.js} +54 -47
  21. package/dist/{framekit-yk1jxjv7.js → framekit-yx612r28.js} +54 -47
  22. package/dist/index-0zp9py56.js +859 -0
  23. package/dist/{index-prjpx67p.js → index-1mstjadm.js} +126 -2167
  24. package/dist/{index-begsqdm0.js → index-4a4x1bt2.js} +1 -1
  25. package/dist/index-58jdczmj.js +44 -0
  26. package/dist/index-5tv6sr74.js +23 -0
  27. package/dist/index-6bc2ztfd.js +688 -0
  28. package/dist/index-7cb4x1vj.js +1885 -0
  29. package/dist/index-a974q3aa.js +34 -0
  30. package/dist/{index-q73py563.js → index-aymfvd8s.js} +1 -1
  31. package/dist/{index-zt3rheck.js → index-aynkv7qk.js} +11 -8
  32. package/dist/{index-p57fdttx.js → index-dzm8ywq0.js} +492 -2365
  33. package/dist/{index-9jhatmky.js → index-f60yax1j.js} +13 -8
  34. package/dist/index-f67wctn3.js +1858 -0
  35. package/dist/{index-vgfn2n1h.js → index-ftjdt358.js} +8 -171
  36. package/dist/{index-j1h13ahg.js → index-gm51cthv.js} +2 -45
  37. package/dist/index-kfdzsyyw.js +1859 -0
  38. package/dist/index-t4kssacm.js +208 -0
  39. package/dist/index-v0ht9q0g.js +1518 -0
  40. package/dist/{index-6wbgqkdz.js → index-x59vz1xx.js} +247 -905
  41. package/dist/index-xh39jtkq.js +32 -0
  42. package/dist/index-yb7fc59g.js +718 -0
  43. package/dist/index-zd6adby9.js +496 -0
  44. package/dist/index.d.ts +62 -0
  45. package/dist/index.global.js +410 -152
  46. package/dist/index.js +504 -482
  47. package/dist/react-0wepdf60.js +1519 -0
  48. package/dist/{react-gefkdkdz.js → react-1gqwa2yw.js} +1 -1
  49. package/dist/{index-sn2y6j09.js → react-3mfz1x2a.js} +126 -2167
  50. package/dist/react-4rbjw9af.js +33 -0
  51. package/dist/react-5rq7bnsy.js +210 -0
  52. package/dist/react-6bz05qk1.js +860 -0
  53. package/dist/{react-qgz9afa2.js → react-6fnxxs30.js} +8 -171
  54. package/dist/react-6q2cw2ya.js +689 -0
  55. package/dist/{react-7vjfsh40.js → react-6t4dbdzn.js} +11 -8
  56. package/dist/react-88es9b5q.js +719 -0
  57. package/dist/react-97b5b8j4.js +46 -0
  58. package/dist/{react-mmq2zya3.js → react-bxzn8vq5.js} +1 -1
  59. package/dist/{react-3rhdj2k1.js → react-cs62p9qh.js} +62 -720
  60. package/dist/react-ethftdxp.js +497 -0
  61. package/dist/react-fp73vhyd.js +36 -0
  62. package/dist/{react-qfpg79hs.js → react-me102s1a.js} +2 -45
  63. package/dist/react-t2qnewz2.js +24 -0
  64. package/dist/react-ttj8f9qp.js +1886 -0
  65. package/dist/{react-806qmkyz.js → react-v8497a41.js} +13 -8
  66. package/dist/{react-6tss0r9f.js → react-wqn4sx0n.js} +265 -2137
  67. package/dist/react.js +500 -482
  68. package/dist/replay-j18rw92k.js +258 -0
  69. package/dist/replay-vtg0vqj2.js +257 -0
  70. package/dist/{storageview-7cv0vpdm.js → storageview-6xj7zb63.js} +11 -7
  71. package/dist/{storageview-dyhpgt8f.js → storageview-pzn8yaad.js} +11 -7
  72. package/dist/styles/force.d.ts +66 -0
  73. package/dist/ui/bindings.d.ts +31 -5
  74. package/dist/ui/changes.d.ts +49 -0
  75. package/dist/ui/cssauto.d.ts +119 -0
  76. package/dist/ui/cssedit.d.ts +80 -0
  77. package/dist/ui/domedit.d.ts +99 -0
  78. package/dist/ui/domtree.d.ts +26 -1
  79. package/dist/ui/elementsview.d.ts +19 -2
  80. package/dist/ui/htmledit.d.ts +62 -0
  81. package/dist/ui/inspector.d.ts +6 -1
  82. package/dist/ui/keys.d.ts +12 -8
  83. package/dist/ui/pane.d.ts +0 -2
  84. package/dist/ui/panel.d.ts +3 -0
  85. package/dist/ui/prefs.d.ts +30 -10
  86. package/dist/ui/settings.d.ts +2 -0
  87. package/dist/ui/size.d.ts +14 -22
  88. package/dist/ui/stylesview.d.ts +30 -1
  89. package/package.json +1 -1
  90. package/skills/devknobs/SKILL.md +95 -0
  91. package/dist/elementsview-1wsxcdtj.js +0 -2874
  92. package/dist/elementsview-3kv34jfx.js +0 -2873
  93. package/dist/index-78r0f8pw.js +0 -27
  94. package/dist/react-adky72h9.js +0 -29
@@ -1,148 +1,9 @@
1
1
  "use client";
2
2
  import {
3
- SIDES,
4
- pxOf
5
- } from "./react-6tss0r9f.js";
6
-
7
- // src/styles/varrefs.ts
8
- var SPACE = /\s/;
9
- var IDENT = /[\w\-\\\u0080-￿]/;
10
- function pastString(value, at) {
11
- const quote = value[at];
12
- let i = at + 1;
13
- while (i < value.length && value[i] !== quote)
14
- i += value[i] === "\\" ? 2 : 1;
15
- return Math.min(i + 1, value.length);
16
- }
17
- function calls(value, at, name) {
18
- if (value.slice(at, at + name.length + 1).toLowerCase() !== `${name}(`)
19
- return false;
20
- return at === 0 || !IDENT.test(value[at - 1] ?? "");
21
- }
22
- function past(value, at) {
23
- const char = value[at];
24
- if (char === "\\")
25
- return Math.min(at + 2, value.length);
26
- if (char === '"' || char === "'")
27
- return pastString(value, at);
28
- if (char === "/" && value[at + 1] === "*") {
29
- const stop = value.indexOf("*/", at + 2);
30
- return stop < 0 ? value.length : stop + 2;
31
- }
32
- if (!calls(value, at, "url"))
33
- return at;
34
- let i = at + 4;
35
- while (i < value.length && SPACE.test(value[i] ?? ""))
36
- i++;
37
- if (value[i] === '"' || value[i] === "'")
38
- return at;
39
- while (i < value.length && value[i] !== ")")
40
- i += value[i] === "\\" ? 2 : 1;
41
- return Math.min(i + 1, value.length);
42
- }
43
- function pastSpace(value, at) {
44
- let i = at;
45
- while (i < value.length) {
46
- if (SPACE.test(value[i] ?? ""))
47
- i++;
48
- else if (value[i] === "/" && value[i + 1] === "*")
49
- i = past(value, i);
50
- else
51
- break;
52
- }
53
- return i;
54
- }
55
- function closeOf(value, from) {
56
- let depth = 1;
57
- let i = from;
58
- while (i < value.length) {
59
- const next = past(value, i);
60
- if (next > i) {
61
- i = next;
62
- continue;
63
- }
64
- if (value[i] === "(")
65
- depth++;
66
- else if (value[i] === ")" && --depth === 0)
67
- return i;
68
- i++;
69
- }
70
- return value.length;
71
- }
72
- function plain(value) {
73
- let text = "";
74
- let i = 0;
75
- while (i < value.length) {
76
- const next = past(value, i);
77
- const comment = value[i] === "/" && value[i + 1] === "*";
78
- if (!comment)
79
- text += value.slice(i, Math.max(next, i + 1));
80
- i = Math.max(next, i + 1);
81
- }
82
- return text;
83
- }
84
- function referenceAt(value, start) {
85
- const at = pastSpace(value, start + 4);
86
- if (!value.startsWith("--", at))
87
- return null;
88
- let stop = at;
89
- while (stop < value.length) {
90
- const char = value[stop] ?? "";
91
- if (SPACE.test(char) || char === "," || char === ")")
92
- break;
93
- if (char === "/" && value[stop + 1] === "*")
94
- break;
95
- stop += char === "\\" ? 2 : 1;
96
- }
97
- stop = Math.min(stop, value.length);
98
- const name = value.slice(at, stop);
99
- if (name.length < 3)
100
- return null;
101
- const after = pastSpace(value, stop);
102
- if (after >= value.length || value[after] === ")") {
103
- const closed2 = after < value.length;
104
- return { start, end: closed2 ? after + 1 : value.length, name, at, fallback: null, closed: closed2 };
105
- }
106
- if (value[after] !== ",")
107
- return null;
108
- const close = closeOf(value, after + 1);
109
- const fallback = plain(value.slice(after + 1, close)).trim();
110
- const closed = close < value.length;
111
- return { start, end: closed ? close + 1 : value.length, name, at, fallback, closed };
112
- }
113
- function varReferences(value) {
114
- const found = [];
115
- let i = 0;
116
- while (i < value.length) {
117
- const next = past(value, i);
118
- if (next > i) {
119
- i = next;
120
- continue;
121
- }
122
- const reference = calls(value, i, "var") ? referenceAt(value, i) : null;
123
- if (reference)
124
- found.push(reference);
125
- i = reference ? reference.at + reference.name.length : i + 1;
126
- }
127
- return found;
128
- }
129
- function resolveVars(value, read) {
130
- let text = "";
131
- let at = 0;
132
- for (const reference of varReferences(value)) {
133
- if (reference.start < at)
134
- continue;
135
- if (!reference.closed)
136
- return null;
137
- const seen = read(reference.name);
138
- const comes = seen !== "" ? seen : reference.fallback === null ? null : resolveVars(reference.fallback, read);
139
- if (comes === null)
140
- return null;
141
- text += value.slice(at, reference.start) + comes;
142
- at = reference.end;
143
- }
144
- return text + value.slice(at);
145
- }
3
+ NEW_RULE_SHEET,
4
+ resolveVars,
5
+ varReferences
6
+ } from "./react-ethftdxp.js";
146
7
 
147
8
  // src/ui/stylesformat.ts
148
9
  var TITLE_MAX = 44;
@@ -163,7 +24,7 @@ function crumbText(label) {
163
24
  return middle(`${match[1] ?? ""}${match[2] ?? match[3] ?? ""}`, CRUMB_MAX);
164
25
  }
165
26
  function fileName(sheet) {
166
- if (sheet === "<style>" || sheet === "constructed")
27
+ if (sheet === "<style>" || sheet === "constructed" || sheet === NEW_RULE_SHEET)
167
28
  return sheet;
168
29
  const path = sheet.split(/[?#]/)[0] ?? sheet;
169
30
  const segments = path.split("/").filter((segment) => segment !== "");
@@ -173,6 +34,8 @@ function sourceOf(origin) {
173
34
  const text = fileName(origin.sheet);
174
35
  if (origin.sheet === "constructed")
175
36
  return { text, tip: "a stylesheet made by script" };
37
+ if (origin.sheet === NEW_RULE_SHEET)
38
+ return { text, tip: "made in the panel: it is on the page only, until it is in the code" };
176
39
  if (origin.sheet === "<style>") {
177
40
  return { text, tip: origin.owner ? `a style element, ${origin.owner}` : "a style element" };
178
41
  }
@@ -296,30 +159,4 @@ function declaredIn(found, name) {
296
159
  return null;
297
160
  }
298
161
 
299
- // src/grab/boxtext.ts
300
- var NONE = "-";
301
- function short(value) {
302
- const rounded = Math.round(value * 100) / 100;
303
- return String(Object.is(rounded, -0) ? 0 : rounded);
304
- }
305
- function boxValue(value) {
306
- if (value === null)
307
- return NONE;
308
- const text = short(value);
309
- return text === "0" ? NONE : text;
310
- }
311
- function sizeText(width, height) {
312
- return `${short(width)} × ${short(height)}`;
313
- }
314
- function tidy(value) {
315
- const px = pxOf(value);
316
- return px === null ? value : `${short(px)}px`;
317
- }
318
- function shorthand(sides) {
319
- const texts = SIDES.map((side) => short(sides[side]));
320
- if (texts.every((text) => text === "0"))
321
- return null;
322
- return texts.map((text) => text === "0" ? "0" : `${text}px`).join(" ");
323
- }
324
-
325
- export { varReferences, resolveVars, TITLE_MAX, middle, crumbText, sourceOf, matchesFilter, hiddenLine, valueParts, swatchOf, variableTip, declaredIn, boxValue, sizeText, tidy, shorthand };
162
+ export { TITLE_MAX, middle, crumbText, sourceOf, matchesFilter, hiddenLine, valueParts, swatchOf, variableTip, declaredIn };