@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,147 +1,8 @@
1
1
  import {
2
- SIDES,
3
- pxOf
4
- } from "./index-p57fdttx.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
- }
2
+ NEW_RULE_SHEET,
3
+ resolveVars,
4
+ varReferences
5
+ } from "./index-zd6adby9.js";
145
6
 
146
7
  // src/ui/stylesformat.ts
147
8
  var TITLE_MAX = 44;
@@ -162,7 +23,7 @@ function crumbText(label) {
162
23
  return middle(`${match[1] ?? ""}${match[2] ?? match[3] ?? ""}`, CRUMB_MAX);
163
24
  }
164
25
  function fileName(sheet) {
165
- if (sheet === "<style>" || sheet === "constructed")
26
+ if (sheet === "<style>" || sheet === "constructed" || sheet === NEW_RULE_SHEET)
166
27
  return sheet;
167
28
  const path = sheet.split(/[?#]/)[0] ?? sheet;
168
29
  const segments = path.split("/").filter((segment) => segment !== "");
@@ -172,6 +33,8 @@ function sourceOf(origin) {
172
33
  const text = fileName(origin.sheet);
173
34
  if (origin.sheet === "constructed")
174
35
  return { text, tip: "a stylesheet made by script" };
36
+ if (origin.sheet === NEW_RULE_SHEET)
37
+ return { text, tip: "made in the panel: it is on the page only, until it is in the code" };
175
38
  if (origin.sheet === "<style>") {
176
39
  return { text, tip: origin.owner ? `a style element, ${origin.owner}` : "a style element" };
177
40
  }
@@ -295,30 +158,4 @@ function declaredIn(found, name) {
295
158
  return null;
296
159
  }
297
160
 
298
- // src/grab/boxtext.ts
299
- var NONE = "-";
300
- function short(value) {
301
- const rounded = Math.round(value * 100) / 100;
302
- return String(Object.is(rounded, -0) ? 0 : rounded);
303
- }
304
- function boxValue(value) {
305
- if (value === null)
306
- return NONE;
307
- const text = short(value);
308
- return text === "0" ? NONE : text;
309
- }
310
- function sizeText(width, height) {
311
- return `${short(width)} × ${short(height)}`;
312
- }
313
- function tidy(value) {
314
- const px = pxOf(value);
315
- return px === null ? value : `${short(px)}px`;
316
- }
317
- function shorthand(sides) {
318
- const texts = SIDES.map((side) => short(sides[side]));
319
- if (texts.every((text) => text === "0"))
320
- return null;
321
- return texts.map((text) => text === "0" ? "0" : `${text}px`).join(" ");
322
- }
323
-
324
- export { varReferences, resolveVars, TITLE_MAX, middle, crumbText, sourceOf, matchesFilter, hiddenLine, valueParts, swatchOf, variableTip, declaredIn, boxValue, sizeText, tidy, shorthand };
161
+ export { TITLE_MAX, middle, crumbText, sourceOf, matchesFilter, hiddenLine, valueParts, swatchOf, variableTip, declaredIn };
@@ -2,7 +2,7 @@ import {
2
2
  deviceOf,
3
3
  formOf,
4
4
  needsFrame
5
- } from "./index-p57fdttx.js";
5
+ } from "./index-dzm8ywq0.js";
6
6
 
7
7
  // src/engine/morph.ts
8
8
  var MORPH_TIME = {
@@ -224,49 +224,6 @@ function sequence(steps, target) {
224
224
  };
225
225
  }
226
226
 
227
- // src/engine/dock.ts
228
- var DOCK_WIDTH = 240;
229
- var PAGE_MIN = 320;
230
- var width = DOCK_WIDTH;
231
- var listeners = new Set;
232
- function dockWidth() {
233
- return width;
234
- }
235
- function setDockWidth(px) {
236
- if (!(px > 0) || px === width)
237
- return;
238
- width = px;
239
- for (const listener of [...listeners])
240
- listener();
241
- }
242
- function onDockWidth(listener) {
243
- listeners.add(listener);
244
- return () => {
245
- listeners.delete(listener);
246
- };
247
- }
248
- var column = null;
249
- function watchColumn(read) {
250
- column = read;
251
- return () => {
252
- if (column === read)
253
- column = null;
254
- };
255
- }
256
- function columnEdge(side, time) {
257
- return column?.(side, time) ?? null;
258
- }
259
- function dockRoom(view, column2) {
260
- return view - column2 >= PAGE_MIN;
261
- }
262
- function dockInset(panel, view, column2) {
263
- return panel.docked && panel.open && dockRoom(view, column2) ? column2 : 0;
264
- }
265
- function dockEdges(panel, view, column2) {
266
- const inset = dockInset(panel, view, column2);
267
- return { left: panel.side === "left" ? inset : 0, right: panel.side === "right" ? inset : 0 };
268
- }
269
-
270
227
  // src/engine/remount.ts
271
228
  var BURST = 10;
272
229
  var BURST_SPAN = 1000;
@@ -343,4 +300,4 @@ function keepMounted(node, options = {}) {
343
300
  };
344
301
  }
345
302
 
346
- 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, PAGE_MIN, dockWidth, setDockWidth, onDockWidth, watchColumn, columnEdge, dockRoom, dockEdges, keepMounted };
303
+ 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 };