@kitlangton/knobs 0.4.0-next.0 → 0.4.0-next.10

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 (74) hide show
  1. package/README.md +451 -54
  2. package/dist/dev/{chunk-7xgkerd2.js → chunk-3ygqgy1x.js} +23 -1
  3. package/dist/dev/{chunk-stbcgz1y.js → chunk-5pb7ymrd.js} +567 -471
  4. package/dist/dev/{chunk-t68smqkc.js → chunk-a7cjgy8x.js} +13 -11
  5. package/dist/dev/{chunk-pmkvb9ep.js → chunk-dyq4m24m.js} +2081 -507
  6. package/dist/dev/index.js +10 -5
  7. package/dist/index.js +25 -1
  8. package/dist/panel.js +3187 -1341
  9. package/dist/react.js +294 -6
  10. package/dist/review-react.js +18580 -0
  11. package/dist/review-solid.js +18482 -0
  12. package/dist/review.js +18488 -0
  13. package/dist/solid.js +292 -4
  14. package/dist/themes.js +1767 -7
  15. package/dist/types/core/adapter.d.ts +6 -2
  16. package/dist/types/core/appearance.d.ts +44 -0
  17. package/dist/types/core/glide.d.ts +7 -0
  18. package/dist/types/core/motion.d.ts +66 -0
  19. package/dist/types/core/root.d.ts +13 -0
  20. package/dist/types/core/store.d.ts +18 -5
  21. package/dist/types/core/theme.d.ts +10 -3
  22. package/dist/types/index.d.ts +2 -1
  23. package/dist/types/panel/gpu/color.d.ts +6 -0
  24. package/dist/types/panel/motion.d.ts +1 -1
  25. package/dist/types/panel/styles.d.ts +2 -3
  26. package/dist/types/review/font.d.ts +13 -0
  27. package/dist/types/review/foundations.d.ts +175 -0
  28. package/dist/types/review/index.d.ts +13 -0
  29. package/dist/types/review/react.d.ts +1 -0
  30. package/dist/types/review/solid.d.ts +1 -0
  31. package/dist/types/themes/define.d.ts +104 -0
  32. package/dist/types/themes/index.d.ts +16 -0
  33. package/dist/types/themes/knobs.d.ts +5 -0
  34. package/dist/types/themes/review.d.ts +8 -0
  35. package/dist/types/themes/void.d.ts +8 -0
  36. package/dist/types/tokens/color.d.ts +42 -0
  37. package/dist/types/tokens/css.d.ts +13 -0
  38. package/dist/types/tokens/evaluate.d.ts +8 -0
  39. package/dist/types/tokens/index.d.ts +4 -0
  40. package/dist/types/tokens/schema.d.ts +1280 -0
  41. package/dist/types/ui/bento-css.d.ts +1 -1
  42. package/dist/types/ui/compare-css.d.ts +1 -1
  43. package/dist/types/ui/compare-gpu.d.ts +6 -6
  44. package/dist/types/ui/compare-model.d.ts +85 -2
  45. package/dist/types/ui/compare.d.ts +18 -4
  46. package/dist/types/ui/diff.d.ts +4 -5
  47. package/dist/types/ui/history-css.d.ts +1 -0
  48. package/dist/types/ui/history-model.d.ts +249 -0
  49. package/dist/types/ui/history.d.ts +38 -0
  50. package/dist/types/ui/icons.d.ts +40 -0
  51. package/dist/types/ui/index.d.ts +9 -5
  52. package/dist/types/ui/look.d.ts +18 -13
  53. package/dist/types/ui/overlay-css.d.ts +1 -1
  54. package/dist/types/ui/player-css.d.ts +1 -0
  55. package/dist/types/ui/player.d.ts +51 -0
  56. package/dist/types/ui/readout-css.d.ts +1 -1
  57. package/dist/types/ui/readout-model.d.ts +5 -1
  58. package/dist/types/ui/review-look.d.ts +6 -0
  59. package/dist/types/ui/review-options.d.ts +28 -0
  60. package/dist/types/ui/rgba.d.ts +11 -0
  61. package/dist/types/ui/selection-pill-css.d.ts +1 -0
  62. package/dist/types/ui/selection-pill.d.ts +106 -0
  63. package/dist/types/ui/timeline-model.d.ts +27 -0
  64. package/dist/types/ui/timeline.d.ts +16 -1
  65. package/dist/types/ui/tree.d.ts +3 -2
  66. package/dist/types/ui/walkthrough-annotations.d.ts +42 -0
  67. package/dist/types/ui/walkthrough-blocks.d.ts +87 -0
  68. package/dist/types/ui/walkthrough-media.d.ts +30 -1
  69. package/dist/types/ui/walkthrough-model.d.ts +469 -5
  70. package/dist/types/ui/walkthrough.d.ts +27 -5
  71. package/dist/ui-react.js +8087 -2350
  72. package/dist/ui-solid.js +8100 -2363
  73. package/dist/ui.js +9751 -3963
  74. package/package.json +13 -1
@@ -1,13 +1,15 @@
1
1
  import {
2
2
  __preload
3
- } from "./chunk-7xgkerd2.js";
3
+ } from "./chunk-3ygqgy1x.js";
4
4
  import {
5
+ applyLook,
6
+ panelLook,
5
7
  iconSvg,
6
8
  readSession,
7
9
  writeSession,
8
10
  injectStyles,
9
11
  toggleLayer
10
- } from "./chunk-pmkvb9ep.js";
12
+ } from "./chunk-dyq4m24m.js";
11
13
 
12
14
  // src/panel/attach.ts
13
15
  function attach(controls, element, options = {}) {
@@ -16,7 +18,7 @@ function attach(controls, element, options = {}) {
16
18
  let doc = element.ownerDocument, win = doc.defaultView;
17
19
  injectStyles(doc);
18
20
  let label = options.label ?? controls.chip.label, reveal = options.reveal ?? controls.chip.reveal, shortcut = options.shortcut ?? controls.chip.shortcut, chip = doc.createElement("button");
19
- chip.className = "knobs-chip", chip.dataset.theme = controls.theme, chip.type = "button";
21
+ chip.className = "knobs-root knobs-chip", applyLook(chip, panelLook(controls)), chip.type = "button";
20
22
  let renderFace = (text) => {
21
23
  let face = [iconSvg(doc, "gear")];
22
24
  if (text) {
@@ -83,7 +85,7 @@ function attach(controls, element, options = {}) {
83
85
  return;
84
86
  loading = !0;
85
87
  try {
86
- let { createPanel } = await (__preload("stbcgz1y"), import("./chunk-stbcgz1y.js"));
88
+ let { createPanel } = await (__preload("5pb7ymrd"), import("./chunk-5pb7ymrd.js"));
87
89
  if (disposed || !controls.enabled || panel)
88
90
  return;
89
91
  if (panel = createPanel(controls, element, close, { restored, chip }), remember)
@@ -104,7 +106,7 @@ function attach(controls, element, options = {}) {
104
106
  if (!revealed())
105
107
  close(!1);
106
108
  update();
107
- }, offShortcut = reveal === "shortcut" ? listenForShortcut(win, shortcut, controls.theme) : void 0;
109
+ }, offShortcut = reveal === "shortcut" ? listenForShortcut(win, shortcut, panelLook(controls)) : void 0;
108
110
  win.addEventListener(MODE_EVENT, onMode);
109
111
  let toggled = controls.toggleKey ? toggleLayer(doc).register({
110
112
  id: controls.id,
@@ -137,7 +139,7 @@ function matchShortcut(shortcut) {
137
139
  let parts = shortcut.split("+").map((p) => p.trim().toLowerCase()), key = parts.pop() ?? "", has = (...names) => parts.some((p) => names.includes(p)), alt = has("alt", "option", "opt", "⌥"), shift = has("shift", "⇧"), ctrl = has("ctrl", "control", "⌃"), meta = has("meta", "cmd", "command", "⌘"), code = /^[a-z]$/.test(key) ? `Key${key.toUpperCase()}` : /^\d$/.test(key) ? `Digit${key}` : "";
138
140
  return (event) => event.altKey === alt && event.shiftKey === shift && event.ctrlKey === ctrl && event.metaKey === meta && (code ? event.code === code : event.key.toLowerCase() === key);
139
141
  }
140
- function listenForShortcut(win, shortcut, theme) {
142
+ function listenForShortcut(win, shortcut, look) {
141
143
  let matches = matchShortcut(shortcut), onKey = (event) => {
142
144
  if (event.defaultPrevented || event.repeat || !matches(event))
143
145
  return;
@@ -148,16 +150,16 @@ function listenForShortcut(win, shortcut, theme) {
148
150
  try {
149
151
  win.sessionStorage.setItem(MODE_KEY, on ? "on" : "off");
150
152
  } catch {}
151
- showStatus(win.document, on ? "knobs on" : "knobs off", theme), win.dispatchEvent(new CustomEvent(MODE_EVENT));
153
+ showStatus(win.document, on ? "knobs on" : "knobs off", look), win.dispatchEvent(new CustomEvent(MODE_EVENT));
152
154
  };
153
155
  return win.addEventListener("keydown", onKey, !0), () => win.removeEventListener("keydown", onKey, !0);
154
156
  }
155
157
  var statusTimers = /* @__PURE__ */ new WeakMap;
156
- function showStatus(doc, text, theme) {
157
- let toast = doc.querySelector(".knobs-toast");
158
+ function showStatus(doc, text, look) {
159
+ let toast = doc.querySelector(".knobs-notice");
158
160
  if (!toast)
159
- toast = doc.createElement("div"), toast.className = "knobs-toast", toast.setAttribute("role", "status"), toast.dataset.shown = "false", doc.body.append(toast), toast.getBoundingClientRect();
160
- toast.dataset.theme = theme, toast.textContent = text, toast.dataset.shown = "true", clearTimeout(statusTimers.get(doc));
161
+ toast = doc.createElement("div"), toast.className = "knobs-root knobs-notice", toast.setAttribute("role", "status"), toast.dataset.shown = "false", doc.body.append(toast), toast.getBoundingClientRect();
162
+ applyLook(toast, look), toast.textContent = text, toast.dataset.shown = "true", clearTimeout(statusTimers.get(doc));
161
163
  let el = toast;
162
164
  statusTimers.set(doc, setTimeout(() => el.dataset.shown = "false", 1200));
163
165
  }