@kitlangton/knobs 0.4.0-next.15 → 0.4.0-next.17

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 (41) hide show
  1. package/README.md +46 -14
  2. package/dist/dev/{chunk-v2g91mrm.js → chunk-2g0znytq.js} +1 -0
  3. package/dist/dev/{chunk-bejz4qcg.js → chunk-3vag4n3q.js} +47 -10
  4. package/dist/dev/{chunk-49hkdggk.js → chunk-5cv3g7ca.js} +395 -104
  5. package/dist/dev/{chunk-902v1jgd.js → chunk-xzm0zawh.js} +6 -6
  6. package/dist/dev/index.js +9 -8
  7. package/dist/index.js +7 -5
  8. package/dist/panel.js +549 -121
  9. package/dist/review-react.js +1341 -880
  10. package/dist/review-solid.js +1341 -880
  11. package/dist/review.js +1711 -1248
  12. package/dist/themes.js +8 -0
  13. package/dist/types/core/schema.d.ts +11 -2
  14. package/dist/types/core/store.d.ts +29 -1
  15. package/dist/types/index.d.ts +1 -1
  16. package/dist/types/panel/active.d.ts +53 -0
  17. package/dist/types/panel/description-ids.d.ts +6 -0
  18. package/dist/types/panel/folds.d.ts +7 -4
  19. package/dist/types/panel/gpu/color.d.ts +2 -0
  20. package/dist/types/panel/gpu/renderer.d.ts +8 -2
  21. package/dist/types/panel/index.d.ts +1 -0
  22. package/dist/types/panel/page-hints.d.ts +3 -2
  23. package/dist/types/panel/page.d.ts +2 -15
  24. package/dist/types/panel/position.d.ts +23 -0
  25. package/dist/types/panel/summary.d.ts +22 -0
  26. package/dist/types/tokens/schema.d.ts +9 -0
  27. package/dist/types/ui/compare-css.d.ts +1 -1
  28. package/dist/types/ui/compare-frames.d.ts +64 -2
  29. package/dist/types/ui/compare-model.d.ts +23 -0
  30. package/dist/types/ui/compare.d.ts +6 -4
  31. package/dist/types/ui/player-css.d.ts +1 -1
  32. package/dist/types/ui/player.d.ts +6 -0
  33. package/dist/types/ui/react.d.ts +1 -1
  34. package/dist/types/ui/solid.d.ts +1 -1
  35. package/dist/types/ui/tooltip-model.d.ts +35 -0
  36. package/dist/types/ui/tooltip.d.ts +1 -1
  37. package/dist/types/ui/walkthrough-model.d.ts +4 -2
  38. package/dist/ui-react.js +2015 -1507
  39. package/dist/ui-solid.js +2014 -1506
  40. package/dist/ui.js +2013 -1505
  41. package/package.json +1 -1
@@ -6,7 +6,7 @@ import {
6
6
  writeSession,
7
7
  injectStyles,
8
8
  toggleLayer
9
- } from "./chunk-bejz4qcg.js";
9
+ } from "./chunk-3vag4n3q.js";
10
10
 
11
11
  // src/panel/attach.ts
12
12
  function attach(controls, element, options = {}) {
@@ -69,26 +69,26 @@ function attach(controls, element, options = {}) {
69
69
  update();
70
70
  }, open = async (restored = !1) => {
71
71
  if (panel) {
72
- unpress(), panel.focus();
72
+ unpress(), focusPanel(panel);
73
73
  return;
74
74
  }
75
75
  if (leaving?.reopen()) {
76
76
  if (unpress(), panel = leaving, leaving = void 0, remember)
77
77
  writeSession(controls.id, { open: !0 });
78
- chip.setAttribute("aria-expanded", "true"), update(), panel.focus();
78
+ chip.setAttribute("aria-expanded", "true"), update(), focusPanel(panel);
79
79
  return;
80
80
  }
81
81
  if (leaving = void 0, loading)
82
82
  return;
83
83
  loading = !0;
84
84
  try {
85
- let { createPanel } = await import("./chunk-49hkdggk.js");
85
+ let { createPanel } = await import("./chunk-5cv3g7ca.js");
86
86
  if (disposed || !controls.enabled || panel)
87
87
  return;
88
88
  if (panel = createPanel(controls, element, close, { restored, chip }), remember)
89
89
  writeSession(controls.id, { open: !0 });
90
90
  if (chip.setAttribute("aria-expanded", "true"), update(), !restored)
91
- panel.focus();
91
+ focusPanel(panel);
92
92
  } catch (cause) {
93
93
  chip.title = String(cause), renderFace("Retry knobs");
94
94
  } finally {
@@ -124,7 +124,7 @@ function attach(controls, element, options = {}) {
124
124
  element.removeAttribute("tabindex");
125
125
  };
126
126
  }
127
- var MODE_KEY = "knobs:mode", MODE_EVENT = "knobs-mode";
127
+ var focusPanel = (panel) => panel.element.focus({ preventScroll: !0 }), MODE_KEY = "knobs:mode", MODE_EVENT = "knobs-mode";
128
128
  function knobsMode(win) {
129
129
  try {
130
130
  return win.sessionStorage.getItem(MODE_KEY) === "on";
package/dist/dev/index.js CHANGED
@@ -77,7 +77,7 @@ import {
77
77
  browserStorage,
78
78
  urlFlag2,
79
79
  storageKey
80
- } from "./chunk-v2g91mrm.js";
80
+ } from "./chunk-2g0znytq.js";
81
81
  // src/core/random.ts
82
82
  var lattice = (min, max, step, r) => min + Math.floor(r * (Math.floor((max - min) / step + 0.000000001) + 1)) * step, between = (min, max, r) => min + (max - min) * r;
83
83
  function pick(field, random) {
@@ -945,11 +945,12 @@ function defineControls(id, input, options = {}) {
945
945
  ...setOpts?.base ? { base: !0 } : {}
946
946
  });
947
947
  }
948
- function step(to, source) {
949
- let before = load(), left = { values: before, base: activeBase() }, diff = changes(before, to.values);
948
+ function step(to, source, into) {
949
+ let before = load();
950
+ into.push({ values: before, base: activeBase() });
951
+ let diff = changes(before, to.values);
950
952
  if (base = validBase(to.base), markChanged(diff), commit(to.values), Object.keys(diff).length)
951
953
  options.onChange?.(diff, to.values, { source });
952
- return left;
953
954
  }
954
955
  function place(values, replace, land) {
955
956
  let previous = load(), applied = applyPatch(replace ? locked : previous, previous, values);
@@ -1285,7 +1286,7 @@ function defineControls(id, input, options = {}) {
1285
1286
  let previous = past.pop();
1286
1287
  if (!previous)
1287
1288
  return;
1288
- future.push(step(previous, "undo"));
1289
+ step(previous, "undo", future);
1289
1290
  },
1290
1291
  redo() {
1291
1292
  if (release(), hostHistory)
@@ -1293,7 +1294,7 @@ function defineControls(id, input, options = {}) {
1293
1294
  let next = future.pop();
1294
1295
  if (!next)
1295
1296
  return;
1296
- past.push(step(next, "redo"));
1297
+ step(next, "redo", past);
1297
1298
  },
1298
1299
  getServerSnapshot: () => locked,
1299
1300
  subscribe(cb) {
@@ -1526,11 +1527,11 @@ function defineControls(id, input, options = {}) {
1526
1527
  code: (format, values) => formatCode(values ?? get(), format),
1527
1528
  variants,
1528
1529
  attach(element, chip) {
1529
- let load = options.ship ? () => options.ship().then((m) => m.attach) : () => import("./chunk-902v1jgd.js").then((m) => m.attach);
1530
+ let load = options.ship ? () => options.ship().then((m) => m.attach) : () => import("./chunk-xzm0zawh.js").then((m) => m.attach);
1530
1531
  return live(load, (attach) => attach(controls, element, chip), (detach) => detach());
1531
1532
  },
1532
1533
  mount(container, mountOptions) {
1533
- let load = options.ship ? () => options.ship().then((m) => m.mountPanel) : () => import("./chunk-49hkdggk.js").then((m) => m.mountPanel);
1534
+ let load = options.ship ? () => options.ship().then((m) => m.mountPanel) : () => import("./chunk-5cv3g7ca.js").then((m) => m.mountPanel);
1534
1535
  return live(load, (mountPanel) => {
1535
1536
  let panel = mountPanel(controls, container, mountOptions);
1536
1537
  return mountOptions?.onReady?.(panel), panel;
package/dist/index.js CHANGED
@@ -447,6 +447,7 @@ function mutatePoints(points, range, random, share) {
447
447
  // src/core/schema.ts
448
448
  var META_KEYS = [
449
449
  "label",
450
+ "description",
450
451
  "group",
451
452
  "groupLabel",
452
453
  "section",
@@ -2008,11 +2009,12 @@ function defineControls(id, input, options = {}) {
2008
2009
  ...setOpts?.base ? { base: !0 } : {}
2009
2010
  });
2010
2011
  }
2011
- function step(to, source) {
2012
- let before = load(), left = { values: before, base: activeBase() }, diff = changes(before, to.values);
2012
+ function step(to, source, into) {
2013
+ let before = load();
2014
+ into.push({ values: before, base: activeBase() });
2015
+ let diff = changes(before, to.values);
2013
2016
  if (base = validBase(to.base), markChanged(diff), commit(to.values), Object.keys(diff).length)
2014
2017
  options.onChange?.(diff, to.values, { source });
2015
- return left;
2016
2018
  }
2017
2019
  function place(values, replace, land) {
2018
2020
  let previous = load(), applied = applyPatch(replace ? locked : previous, previous, values);
@@ -2348,7 +2350,7 @@ function defineControls(id, input, options = {}) {
2348
2350
  let previous = past.pop();
2349
2351
  if (!previous)
2350
2352
  return;
2351
- future.push(step(previous, "undo"));
2353
+ step(previous, "undo", future);
2352
2354
  },
2353
2355
  redo() {
2354
2356
  if (release(), hostHistory)
@@ -2356,7 +2358,7 @@ function defineControls(id, input, options = {}) {
2356
2358
  let next = future.pop();
2357
2359
  if (!next)
2358
2360
  return;
2359
- past.push(step(next, "redo"));
2361
+ step(next, "redo", past);
2360
2362
  },
2361
2363
  getServerSnapshot: () => locked,
2362
2364
  subscribe(cb) {