@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
package/dist/dev/index.js
CHANGED
|
@@ -63,6 +63,8 @@ import {
|
|
|
63
63
|
equal,
|
|
64
64
|
springMotion2,
|
|
65
65
|
springCss2,
|
|
66
|
+
SPRINGS2,
|
|
67
|
+
reducedSpring2,
|
|
66
68
|
RESHAPE,
|
|
67
69
|
RESET_KEYS,
|
|
68
70
|
REFRESHES,
|
|
@@ -73,8 +75,8 @@ import {
|
|
|
73
75
|
browserStorage,
|
|
74
76
|
urlFlag2,
|
|
75
77
|
storageKey
|
|
76
|
-
} from "./chunk-
|
|
77
|
-
__chunks(import.meta.url,["
|
|
78
|
+
} from "./chunk-3ygqgy1x.js";
|
|
79
|
+
__chunks(import.meta.url,["kdk2476q","5pb7ymrd","a7cjgy8x","3ygqgy1x","dyq4m24m"],[["./index.js",3],["./chunk-5pb7ymrd.js",3,4],["./chunk-a7cjgy8x.js",3,4],["./chunk-3ygqgy1x.js"],["./chunk-dyq4m24m.js",3]],0);
|
|
78
80
|
// src/core/random.ts
|
|
79
81
|
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;
|
|
80
82
|
function pick(field, random) {
|
|
@@ -589,7 +591,7 @@ function sameField(a, b) {
|
|
|
589
591
|
function defineControls(id, input, options = {}) {
|
|
590
592
|
if (!id.trim())
|
|
591
593
|
throw Error("Controls need a stable, nonempty id.");
|
|
592
|
-
let schema = Object.freeze({ ...input }), locked = normalize(schema, {}), actions = Object.freeze([...options.actions ?? []]), theme = options
|
|
594
|
+
let schema = Object.freeze({ ...input }), locked = normalize(schema, {}), actions = Object.freeze([...options.actions ?? []]), { theme, appearance } = options, density = options.density ?? "default", renderer = options.renderer ?? "auto", enabled = () => typeof options.enabled === "function" ? options.enabled() : options.enabled ?? (Boolean(options.ship) || isUnlocked() || typeof location < "u" && ["localhost", "127.0.0.1", "[::1]"].includes(location.hostname)), storage = () => options.storage === void 0 ? browserStorage() : options.storage, persistMode = options.persist ?? "all", valueStorage = () => persistMode === "all" ? storage() : null, variantStorage = () => persistMode === "none" ? null : storage(), draw = options.random ?? Math.random, hostHistory = options.history, unsubscribeHistory, unsubscribeUnlock, listeners = /* @__PURE__ */ new Set, refreshes = 0, notify = () => {
|
|
593
595
|
for (let cb of [...listeners])
|
|
594
596
|
cb();
|
|
595
597
|
}, mixed = /* @__PURE__ */ new Set, current = locked, read = !1, error = null, locks = /* @__PURE__ */ new Set, bindings = /* @__PURE__ */ new Map, comparing = null, landing = !1, echo = Math.max(0, options.echo ?? 0), grabbed = /* @__PURE__ */ new Set, changedAt = /* @__PURE__ */ new Map, sent = /* @__PURE__ */ new Map, pending = /* @__PURE__ */ new Map, echoTimer, now = () => typeof performance < "u" ? performance.now() : Date.now(), isHeld = (key) => grabbed.has(key) || echo > 0 && now() - (changedAt.get(key) ?? -1 / 0) < echo, NO_BASE = Object.freeze({ preset: null, groups: Object.freeze({}) }), base = NO_BASE, past = [], future = [], HISTORY = 100, stateKey = storageKey(id, "state"), buildPresets = () => Object.freeze(Object.fromEntries([
|
|
@@ -1050,6 +1052,7 @@ function defineControls(id, input, options = {}) {
|
|
|
1050
1052
|
},
|
|
1051
1053
|
actions,
|
|
1052
1054
|
theme,
|
|
1055
|
+
appearance,
|
|
1053
1056
|
density,
|
|
1054
1057
|
renderer,
|
|
1055
1058
|
keys: options.keys,
|
|
@@ -1375,11 +1378,11 @@ function defineControls(id, input, options = {}) {
|
|
|
1375
1378
|
code: (format, values) => formatCode(values ?? get(), format),
|
|
1376
1379
|
variants,
|
|
1377
1380
|
attach(element, chip) {
|
|
1378
|
-
let load = options.ship ? () => options.ship().then((m) => m.attach) : () => (__preload("
|
|
1381
|
+
let load = options.ship ? () => options.ship().then((m) => m.attach) : () => (__preload("a7cjgy8x"), import("./chunk-a7cjgy8x.js")).then((m) => m.attach);
|
|
1379
1382
|
return live(load, (attach) => attach(controls, element, chip), (detach) => detach());
|
|
1380
1383
|
},
|
|
1381
1384
|
mount(container, mountOptions) {
|
|
1382
|
-
let load = options.ship ? () => options.ship().then((m) => m.mountPanel) : () => (__preload("
|
|
1385
|
+
let load = options.ship ? () => options.ship().then((m) => m.mountPanel) : () => (__preload("5pb7ymrd"), import("./chunk-5pb7ymrd.js")).then((m) => m.mountPanel);
|
|
1383
1386
|
return live(load, (mountPanel) => {
|
|
1384
1387
|
let panel = mountPanel(controls, container, mountOptions);
|
|
1385
1388
|
return mountOptions?.onReady?.(panel), panel;
|
|
@@ -1759,6 +1762,7 @@ export {
|
|
|
1759
1762
|
EASINGS2 as EASINGS,
|
|
1760
1763
|
KONAMI,
|
|
1761
1764
|
SPRING2 as SPRING,
|
|
1765
|
+
SPRINGS2 as SPRINGS,
|
|
1762
1766
|
action2 as action,
|
|
1763
1767
|
actionShortcut2 as actionShortcut,
|
|
1764
1768
|
angle2 as angle,
|
|
@@ -1796,6 +1800,7 @@ export {
|
|
|
1796
1800
|
parseColor2 as parseColor,
|
|
1797
1801
|
point2 as point,
|
|
1798
1802
|
range2 as range,
|
|
1803
|
+
reducedSpring2 as reducedSpring,
|
|
1799
1804
|
sampleCurve2 as sampleCurve,
|
|
1800
1805
|
sampleGradient2 as sampleGradient,
|
|
1801
1806
|
seed2 as seed,
|
package/dist/index.js
CHANGED
|
@@ -933,6 +933,27 @@ function springCss(value) {
|
|
|
933
933
|
let { omega, zeta } = springMotion(value), { easing, ms } = springEasing(omega, zeta);
|
|
934
934
|
return { easing, duration: ms };
|
|
935
935
|
}
|
|
936
|
+
// src/core/motion.ts
|
|
937
|
+
var SPRINGS = {
|
|
938
|
+
instant: { duration: 0.1, bounce: 0 },
|
|
939
|
+
snappy: { duration: 0.25, bounce: 0 },
|
|
940
|
+
default: { duration: 0.3, bounce: 0 },
|
|
941
|
+
calm: { duration: 0.4, bounce: 0 },
|
|
942
|
+
smooth: { duration: 0.45, bounce: 0 }
|
|
943
|
+
}, FADE = { duration: 0.16, bounce: 0 };
|
|
944
|
+
var MOTION = Object.fromEntries(Object.entries(SPRINGS).map(([name, spring]) => [name, springMotion(spring)]));
|
|
945
|
+
function reducedSpring(spring, kind, reduced) {
|
|
946
|
+
if (!reduced)
|
|
947
|
+
return spring;
|
|
948
|
+
if (kind === "move")
|
|
949
|
+
return null;
|
|
950
|
+
return spring.duration <= FADE.duration ? spring : FADE;
|
|
951
|
+
}
|
|
952
|
+
var springLinear = (spring) => {
|
|
953
|
+
let { omega, zeta } = springMotion(spring);
|
|
954
|
+
return springEasing(omega, zeta);
|
|
955
|
+
}, names = Object.keys(SPRINGS), linear2 = Object.fromEntries(names.map((n) => [n, springLinear(SPRINGS[n])])), SPRING_TOKEN = `${SPRINGS.default.duration} ${SPRINGS.default.bounce}`, DEFAULT_LINEAR = linear2.default, motionCss = `:where(:root,:host){${names.map((n) => `--_k-motion-${n}:${linear2[n].easing};--_k-motion-${n}-ms:${linear2[n].ms}`).join(";")}}
|
|
956
|
+
@media(prefers-reduced-motion:reduce){:where(:root,:host){${names.map((n) => `--_k-motion-${n}-ms:0`).join(";")}}}`;
|
|
936
957
|
// src/core/random.ts
|
|
937
958
|
var lattice = (min, max, step, r) => min + Math.floor(r * (Math.floor((max - min) / step + 0.000000001) + 1)) * step, between2 = (min, max, r) => min + (max - min) * r;
|
|
938
959
|
function pick(field, random) {
|
|
@@ -1588,7 +1609,7 @@ function sameField(a, b) {
|
|
|
1588
1609
|
function defineControls(id, input, options = {}) {
|
|
1589
1610
|
if (!id.trim())
|
|
1590
1611
|
throw Error("Controls need a stable, nonempty id.");
|
|
1591
|
-
let schema = Object.freeze({ ...input }), locked = normalize(schema, {}), actions = Object.freeze([...options.actions ?? []]), theme = options
|
|
1612
|
+
let schema = Object.freeze({ ...input }), locked = normalize(schema, {}), actions = Object.freeze([...options.actions ?? []]), { theme, appearance } = options, density = options.density ?? "default", renderer = options.renderer ?? "auto", enabled = () => (Boolean(options.ship) || isUnlocked()) && (typeof options.enabled === "function" ? options.enabled() : options.enabled ?? (Boolean(options.ship) || isUnlocked() || typeof location < "u" && ["localhost", "127.0.0.1", "[::1]"].includes(location.hostname))), storage = () => options.storage === void 0 ? browserStorage() : options.storage, persistMode = options.persist ?? "all", valueStorage = () => persistMode === "all" ? storage() : null, variantStorage = () => persistMode === "none" ? null : storage(), draw = options.random ?? Math.random, hostHistory = options.history, unsubscribeHistory, unsubscribeUnlock, listeners = /* @__PURE__ */ new Set, refreshes = 0, notify = () => {
|
|
1592
1613
|
for (let cb of [...listeners])
|
|
1593
1614
|
cb();
|
|
1594
1615
|
}, mixed = /* @__PURE__ */ new Set, current = locked, read = !1, error = null, locks = /* @__PURE__ */ new Set, bindings = /* @__PURE__ */ new Map, comparing = null, landing = !1, echo = Math.max(0, options.echo ?? 0), grabbed = /* @__PURE__ */ new Set, changedAt = /* @__PURE__ */ new Map, sent = /* @__PURE__ */ new Map, pending = /* @__PURE__ */ new Map, echoTimer, now = () => typeof performance < "u" ? performance.now() : Date.now(), isHeld = (key) => grabbed.has(key) || echo > 0 && now() - (changedAt.get(key) ?? -1 / 0) < echo, NO_BASE = Object.freeze({ preset: null, groups: Object.freeze({}) }), base = NO_BASE, past = [], future = [], HISTORY = 100, stateKey = storageKey(id, "state"), buildPresets = () => Object.freeze(Object.fromEntries([
|
|
@@ -2049,6 +2070,7 @@ function defineControls(id, input, options = {}) {
|
|
|
2049
2070
|
},
|
|
2050
2071
|
actions,
|
|
2051
2072
|
theme,
|
|
2073
|
+
appearance,
|
|
2052
2074
|
density,
|
|
2053
2075
|
renderer,
|
|
2054
2076
|
keys: options.keys,
|
|
@@ -2758,6 +2780,7 @@ export {
|
|
|
2758
2780
|
EASINGS,
|
|
2759
2781
|
KONAMI,
|
|
2760
2782
|
SPRING,
|
|
2783
|
+
SPRINGS,
|
|
2761
2784
|
action,
|
|
2762
2785
|
actionShortcut,
|
|
2763
2786
|
angle,
|
|
@@ -2795,6 +2818,7 @@ export {
|
|
|
2795
2818
|
parseColor,
|
|
2796
2819
|
point,
|
|
2797
2820
|
range,
|
|
2821
|
+
reducedSpring,
|
|
2798
2822
|
sampleCurve,
|
|
2799
2823
|
sampleGradient,
|
|
2800
2824
|
seed,
|