@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.
- package/README.md +451 -54
- package/dist/dev/{chunk-7xgkerd2.js → chunk-3ygqgy1x.js} +23 -1
- package/dist/dev/{chunk-stbcgz1y.js → chunk-5pb7ymrd.js} +567 -471
- package/dist/dev/{chunk-t68smqkc.js → chunk-a7cjgy8x.js} +13 -11
- package/dist/dev/{chunk-pmkvb9ep.js → chunk-dyq4m24m.js} +2081 -507
- package/dist/dev/index.js +10 -5
- package/dist/index.js +25 -1
- package/dist/panel.js +3187 -1341
- package/dist/react.js +294 -6
- package/dist/review-react.js +18580 -0
- package/dist/review-solid.js +18482 -0
- package/dist/review.js +18488 -0
- package/dist/solid.js +292 -4
- package/dist/themes.js +1767 -7
- package/dist/types/core/adapter.d.ts +6 -2
- package/dist/types/core/appearance.d.ts +44 -0
- package/dist/types/core/glide.d.ts +7 -0
- package/dist/types/core/motion.d.ts +66 -0
- package/dist/types/core/root.d.ts +13 -0
- package/dist/types/core/store.d.ts +18 -5
- package/dist/types/core/theme.d.ts +10 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/panel/gpu/color.d.ts +6 -0
- package/dist/types/panel/motion.d.ts +1 -1
- package/dist/types/panel/styles.d.ts +2 -3
- package/dist/types/review/font.d.ts +13 -0
- package/dist/types/review/foundations.d.ts +175 -0
- package/dist/types/review/index.d.ts +13 -0
- package/dist/types/review/react.d.ts +1 -0
- package/dist/types/review/solid.d.ts +1 -0
- package/dist/types/themes/define.d.ts +104 -0
- package/dist/types/themes/index.d.ts +16 -0
- package/dist/types/themes/knobs.d.ts +5 -0
- package/dist/types/themes/review.d.ts +8 -0
- package/dist/types/themes/void.d.ts +8 -0
- package/dist/types/tokens/color.d.ts +42 -0
- package/dist/types/tokens/css.d.ts +13 -0
- package/dist/types/tokens/evaluate.d.ts +8 -0
- package/dist/types/tokens/index.d.ts +4 -0
- package/dist/types/tokens/schema.d.ts +1280 -0
- package/dist/types/ui/bento-css.d.ts +1 -1
- package/dist/types/ui/compare-css.d.ts +1 -1
- package/dist/types/ui/compare-gpu.d.ts +6 -6
- package/dist/types/ui/compare-model.d.ts +85 -2
- package/dist/types/ui/compare.d.ts +18 -4
- package/dist/types/ui/diff.d.ts +4 -5
- package/dist/types/ui/history-css.d.ts +1 -0
- package/dist/types/ui/history-model.d.ts +249 -0
- package/dist/types/ui/history.d.ts +38 -0
- package/dist/types/ui/icons.d.ts +40 -0
- package/dist/types/ui/index.d.ts +9 -5
- package/dist/types/ui/look.d.ts +18 -13
- package/dist/types/ui/overlay-css.d.ts +1 -1
- package/dist/types/ui/player-css.d.ts +1 -0
- package/dist/types/ui/player.d.ts +51 -0
- package/dist/types/ui/readout-css.d.ts +1 -1
- package/dist/types/ui/readout-model.d.ts +5 -1
- package/dist/types/ui/review-look.d.ts +6 -0
- package/dist/types/ui/review-options.d.ts +28 -0
- package/dist/types/ui/rgba.d.ts +11 -0
- package/dist/types/ui/selection-pill-css.d.ts +1 -0
- package/dist/types/ui/selection-pill.d.ts +106 -0
- package/dist/types/ui/timeline-model.d.ts +27 -0
- package/dist/types/ui/timeline.d.ts +16 -1
- package/dist/types/ui/tree.d.ts +3 -2
- package/dist/types/ui/walkthrough-annotations.d.ts +42 -0
- package/dist/types/ui/walkthrough-blocks.d.ts +87 -0
- package/dist/types/ui/walkthrough-media.d.ts +30 -1
- package/dist/types/ui/walkthrough-model.d.ts +469 -5
- package/dist/types/ui/walkthrough.d.ts +27 -5
- package/dist/ui-react.js +8087 -2350
- package/dist/ui-solid.js +8100 -2363
- package/dist/ui.js +9751 -3963
- package/package.json +13 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__preload
|
|
3
|
-
} from "./chunk-
|
|
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-
|
|
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
|
|
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("
|
|
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
|
|
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,
|
|
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",
|
|
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,
|
|
157
|
-
let toast = doc.querySelector(".knobs-
|
|
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-
|
|
160
|
-
toast
|
|
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
|
}
|