@kernel4632/kima 0.9.3 → 0.9.4

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/dist/style.css CHANGED
@@ -264,7 +264,7 @@ kima-affix{display:contents}.kima-affix[data-v-f21e108b]{z-index:10;color:var(--
264
264
  /*$vite$:1*/
265
265
  .kima-qr-code[data-v-3ef776fe]{max-width:100%;color:var(--kima-color-on-surface);font-family:var(--kima-font-family);display:inline-block}.kima-qr-code svg[data-v-3ef776fe]{max-width:100%;height:auto;fill:var(--kima-color-on-surface);display:block}.kima-qr-code__paper[data-v-3ef776fe]{fill:var(--kima-color-surface)}
266
266
  /*$vite$:1*/
267
- .kima-tag-group[data-v-892954ad]{color:var(--kima-color-on-surface);font-family:var(--kima-font-family)}.kima-tag-group__items[data-v-892954ad]{gap:var(--kima-space-2);flex-wrap:wrap;display:flex;position:relative}
267
+ .kima-tag-group[data-v-b575c982]{color:var(--kima-color-on-surface);font-family:var(--kima-font-family)}.kima-tag-group__items[data-v-b575c982]{gap:var(--kima-space-2);flex-wrap:wrap;display:flex;position:relative}
268
268
  /*$vite$:1*/
269
269
  @keyframes kima-ripple-glow-b5823fc3{0%{opacity:.14}55%{opacity:.1}to{opacity:0}}.kima-tour[data-v-b5823fc3]{font-family:var(--kima-font-family);color:var(--kima-color-on-surface)}.kima-tour__dialog[data-v-b5823fc3]{width:100%;max-width:none;height:100%;max-height:none;color:inherit;background:var(--kima-color-transparent);transition:opacity var(--kima-duration-medium), display var(--kima-duration-medium) allow-discrete, overlay var(--kima-duration-medium) allow-discrete;border:0;margin:0;padding:0;position:fixed;inset:0}.kima-tour__dialog[data-v-b5823fc3]::backdrop{background:var(--kima-color-transparent)}.kima-tour__dialog[data-v-b5823fc3]:not([open]){opacity:0}@starting-style{.kima-tour__dialog[open][data-v-b5823fc3]{opacity:0}}.kima-tour__mask[data-v-b5823fc3]{background:color-mix(in srgb, var(--kima-color-scrim) var(--kima-scrim-opacity), transparent);-webkit-backdrop-filter:blur(var(--kima-backdrop-blur));backdrop-filter:blur(var(--kima-backdrop-blur));pointer-events:auto;position:fixed}.kima-tour__spotlight[data-v-b5823fc3]{outline:3px solid var(--kima-color-primary);border-radius:var(--kima-radius-s);pointer-events:none;transition:top var(--kima-duration-medium) var(--kima-curve-emphasized), left var(--kima-duration-medium) var(--kima-curve-emphasized), width var(--kima-duration-medium), height var(--kima-duration-medium);position:fixed}.kima-tour__panel[data-v-b5823fc3]{background:var(--kima-color-popup);box-shadow:var(--kima-elevation-3);box-sizing:border-box;max-height:calc(100vh - 32px);padding:var(--kima-space-5);border-radius:var(--kima-radius-xl);border:0;position:fixed;overflow:auto}.kima-tour__panel h2[data-v-b5823fc3]{margin:var(--kima-space-2) 0}.kima-tour__actions[data-v-b5823fc3]{gap:var(--kima-space-2);flex-wrap:wrap;display:flex}@media (prefers-reduced-motion:reduce){.kima-tour__dialog[data-v-b5823fc3],.kima-tour__spotlight[data-v-b5823fc3]{transition:none}}
270
270
  /*$vite$:1*/
@@ -3,4 +3,4 @@
3
3
  @import "../components/core/icon.ce.vue_vue_type_style_index_0_scoped_5c94f2ca_lang.css";
4
4
  @import "../components/core/icon-button.ce.vue_vue_type_style_index_0_scoped_a18b4478_lang.css";
5
5
  @import "../components/interaction/chip.ce.vue_vue_type_style_index_0_scoped_541c9ed1_lang.css";
6
- @import "../components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_892954ad_lang.css";
6
+ @import "../components/utility/tag-group.ce.vue_vue_type_style_index_0_scoped_b575c982_lang.css";
@@ -1,16 +1,16 @@
1
1
  import e from "../../_virtual/_plugin-vue_export-helper.js";
2
- import { freezeLeaveLayout as t, presenceTransition as n } from "../../utils/motion.js";
3
- import { useInteractionModel as r, useInteractionReset as i, useInteractionRoot as a } from "../../utils/interaction.js";
4
- import { useContentMotion as o } from "../../utils/content-motion.js";
5
- import s from "../interaction/chip.ce.js";
2
+ import { freezeLeaveLayout as t, presenceTransition as n, useLayoutFlip as r } from "../../utils/motion.js";
3
+ import { useInteractionModel as i, useInteractionReset as a, useInteractionRoot as o } from "../../utils/interaction.js";
4
+ import { useContentMotion as s } from "../../utils/content-motion.js";
5
+ import c from "../interaction/chip.ce.js";
6
6
  /* empty css */
7
- import { Fragment as c, TransitionGroup as l, computed as u, createBlock as d, createElementBlock as f, createVNode as p, mergeProps as m, nextTick as h, onMounted as g, openBlock as _, ref as v, renderList as y, unref as b, watch as x, withCtx as S } from "vue";
7
+ import { Fragment as l, TransitionGroup as u, computed as d, createBlock as f, createElementBlock as p, createVNode as m, mergeProps as h, nextTick as g, onMounted as _, openBlock as v, ref as y, renderList as b, unref as x, watch as S, withCtx as C } from "vue";
8
8
  // src/components/utility/tag-group.ce.vue
9
- var C = ["aria-label"], w = [
9
+ var w = ["aria-label"], T = [
10
10
  "name",
11
11
  "value",
12
12
  "disabled"
13
- ], T = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
13
+ ], E = /*#__PURE__*/ e(/* @__PURE__ */ Object.assign({ inheritAttrs: !1 }, {
14
14
  __name: "tag-group.ce",
15
15
  props: {
16
16
  items: {
@@ -36,77 +36,81 @@ var C = ["aria-label"], w = [
36
36
  "change",
37
37
  "remove"
38
38
  ],
39
- setup(e, { emit: T }) {
40
- let E = e, D = T, { root: O, forwardedAttrs: k } = a(), [A, j] = r(E, "items", D), [M, N] = r(E, "modelValue", D), P = v(0), F = u(() => A.value.map((e) => typeof e == "object" ? e : {
39
+ setup(e, { emit: E }) {
40
+ let D = e, O = E, { root: k, forwardedAttrs: A } = o(), [j, M] = i(D, "items", O), [N, P] = i(D, "modelValue", O), F = y(0), I = d(() => j.value.map((e) => typeof e == "object" ? e : {
41
41
  value: e,
42
42
  label: String(e)
43
43
  }));
44
- o(O, () => F.value);
45
- let I = (e) => M.value.includes(e.value);
46
- function L(e) {
47
- E.disabled || e.disabled || (N(I(e) ? M.value.filter((t) => t !== e.value) : [...M.value, e.value]), D("change", M.value));
44
+ s(k, () => I.value);
45
+ let L = y(null), R = r(L, "[data-kima-flip-key]"), z = (e) => N.value.includes(e.value);
46
+ function B(e) {
47
+ D.disabled || e.disabled || (P(z(e) ? N.value.filter((t) => t !== e.value) : [...N.value, e.value]), O("change", N.value));
48
48
  }
49
- function R() {
50
- return [...O.value?.querySelectorAll("button:not(:disabled)") || []].filter((e) => !e.closest("[inert]"));
49
+ function V() {
50
+ return [...k.value?.querySelectorAll("button:not(:disabled)") || []].filter((e) => !e.closest("[inert]"));
51
51
  }
52
- async function z(e = !1) {
53
- await h();
54
- let t = R();
55
- P.value = Math.max(0, Math.min(P.value, t.length - 1)), t.forEach((e, t) => {
56
- e.tabIndex = t === P.value ? 0 : -1;
57
- }), e && t[P.value]?.focus();
52
+ async function H(e = !1) {
53
+ await g();
54
+ let t = V();
55
+ F.value = Math.max(0, Math.min(F.value, t.length - 1)), t.forEach((e, t) => {
56
+ e.tabIndex = t === F.value ? 0 : -1;
57
+ }), e && t[F.value]?.focus();
58
58
  }
59
- function B(e) {
60
- E.disabled || e.disabled || (j(A.value.filter((t) => (typeof t == "object" ? t.value : t) !== e.value)), N(M.value.filter((t) => t !== e.value)), D("remove", e), z(!0));
59
+ function U(e) {
60
+ D.disabled || e.disabled || (R.capture(), M(j.value.filter((t) => (typeof t == "object" ? t.value : t) !== e.value)), P(N.value.filter((t) => t !== e.value)), O("remove", e), R.play(), H(!0));
61
61
  }
62
- function V(e) {
63
- let t = R(), n = t.indexOf(e.target);
62
+ function W(e) {
63
+ let t = V(), n = t.indexOf(e.target);
64
64
  if (!(n < 0) && ([
65
65
  "ArrowRight",
66
66
  "ArrowLeft",
67
67
  "Home",
68
68
  "End"
69
- ].includes(e.key) && (e.preventDefault(), P.value = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowLeft" ? -1 : 1) + t.length) % t.length, z(!0)), ["Delete", "Backspace"].includes(e.key) && E.removable)) {
69
+ ].includes(e.key) && (e.preventDefault(), F.value = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : (n + (e.key === "ArrowLeft" ? -1 : 1) + t.length) % t.length, H(!0)), ["Delete", "Backspace"].includes(e.key) && D.removable)) {
70
70
  let t = e.target.closest("[data-tag-index]")?.dataset.tagIndex;
71
- t != null && (e.preventDefault(), B(F.value[Number(t)]));
71
+ t != null && (e.preventDefault(), U(I.value[Number(t)]));
72
72
  }
73
73
  }
74
- return x([
75
- F,
76
- () => E.disabled,
77
- () => E.selectable,
78
- () => E.removable
79
- ], () => z(), {
74
+ return S([
75
+ I,
76
+ () => D.disabled,
77
+ () => D.selectable,
78
+ () => D.removable
79
+ ], () => H(), {
80
80
  immediate: !0,
81
81
  flush: "post"
82
- }), g(() => z()), i(O, M, N), i(O, A, j), (r, i) => (_(), f("div", m({
82
+ }), _(() => H()), a(k, N, P), a(k, j, M), (r, i) => (v(), p("div", h({
83
83
  ref_key: "root",
84
- ref: O
85
- }, b(k), {
84
+ ref: k
85
+ }, x(A), {
86
86
  class: "kima-tag-group",
87
87
  role: "group",
88
88
  "aria-label": e.label,
89
- onKeydown: V
90
- }), [p(l, m({
89
+ onKeydown: W
90
+ }), [m(u, h({
91
+ ref_key: "flipRoot",
92
+ ref: L,
91
93
  name: "kima-list",
92
94
  tag: "div",
93
95
  class: "kima-tag-group__items"
94
96
  }, {
95
- ...b(n),
96
- onBeforeLeave: b(t)
97
+ ...x(n),
98
+ onBeforeLeave: x(t)
97
99
  }), {
98
- default: S(() => [(_(!0), f(c, null, y(F.value, (t, n) => (_(), d(s, {
100
+ default: C(() => [(v(!0), p(l, null, b(I.value, (t, n) => (v(), f(c, {
99
101
  key: t.value,
102
+ "data-kima-flip-key": t.value,
100
103
  "data-tag-index": n,
101
104
  label: t.label,
102
105
  value: t.value,
103
106
  selectable: e.selectable,
104
107
  removable: e.removable,
105
108
  disabled: e.disabled || t.disabled,
106
- "model-value": I(t),
107
- onChange: (e) => L(t),
108
- onRemove: (e) => B(t)
109
+ "model-value": z(t),
110
+ onChange: (e) => B(t),
111
+ onRemove: (e) => U(t)
109
112
  }, null, 8, [
113
+ "data-kima-flip-key",
110
114
  "data-tag-index",
111
115
  "label",
112
116
  "value",
@@ -118,13 +122,13 @@ var C = ["aria-label"], w = [
118
122
  "onRemove"
119
123
  ]))), 128))]),
120
124
  _: 1
121
- }, 16), (_(!0), f(c, null, y(b(M), (t) => (_(), f("input", {
125
+ }, 16), (v(!0), p(l, null, b(x(N), (t) => (v(), p("input", {
122
126
  key: t,
123
127
  type: "hidden",
124
128
  name: e.name,
125
129
  value: t,
126
130
  disabled: e.disabled
127
- }, null, 8, w))), 128))], 16, C));
131
+ }, null, 8, T))), 128))], 16, w));
128
132
  }
129
- }), [["__scopeId", "data-v-892954ad"]]);
130
- export { T as default };
133
+ }), [["__scopeId", "data-v-b575c982"]]);
134
+ export { E as default };
@@ -1,31 +1,84 @@
1
+ import { onBeforeUnmount as e } from "vue";
1
2
  // src/utils/motion.js
2
- var e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
3
- function n(e) {
3
+ var t = /* @__PURE__ */ new WeakMap();
4
+ function n(t, n = "[data-kima-flip-key]") {
5
+ let r = /* @__PURE__ */ new Map(), a = 0, o = !1;
6
+ function s() {
7
+ let e = t?.value ?? t;
8
+ return e?.nodeType === 1 ? e : e?.$el?.nodeType === 1 ? e.$el : null;
9
+ }
10
+ function c(e) {
11
+ return e.getAttribute(n.slice(1, -1)) || e.dataset.kimaFlipKey || e;
12
+ }
13
+ function l() {
14
+ let e = s();
15
+ e && (r = new Map([...e.children].map((e) => {
16
+ let t = e.getBoundingClientRect();
17
+ return [c(e), {
18
+ node: e,
19
+ x: t.x,
20
+ y: t.y
21
+ }];
22
+ })));
23
+ }
24
+ function u() {
25
+ cancelAnimationFrame(a), a = requestAnimationFrame(() => {
26
+ if (o) return;
27
+ let e = s();
28
+ if (!e || i(e) || !e.animate) {
29
+ r.clear();
30
+ return;
31
+ }
32
+ let t = getComputedStyle(e), n = t.getPropertyValue("--kima-duration-slow").trim(), a = n ? parseFloat(n) * (n.endsWith("ms") ? 1 : 1e3) : 300;
33
+ if (!Number.isFinite(a) || a <= 0) r.clear();
34
+ else {
35
+ for (let n of e.children) {
36
+ let e = r.get(c(n));
37
+ if (!e) continue;
38
+ let i = n.getBoundingClientRect(), o = e.x - i.x, s = e.y - i.y;
39
+ Math.abs(o) < .5 && Math.abs(s) < .5 || n.animate([{ transform: `translate(${o}px, ${s}px)` }, { transform: "translate(0, 0)" }], {
40
+ duration: a,
41
+ easing: t.getPropertyValue("--kima-curve-emphasized").trim() || "ease-out"
42
+ });
43
+ }
44
+ r.clear();
45
+ }
46
+ });
47
+ }
48
+ return e(() => {
49
+ o = !0, cancelAnimationFrame(a);
50
+ }), {
51
+ capture: l,
52
+ play: u
53
+ };
54
+ }
55
+ var r = /* @__PURE__ */ new WeakMap();
56
+ function i(e) {
4
57
  return (e?.closest?.("[data-kima-reduced-motion]"))?.getAttribute("data-kima-reduced-motion") === "reduce" ? !0 : e?.ownerDocument?.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
5
58
  }
6
- function r(e) {
59
+ function a(e) {
7
60
  let t = parseFloat(e) || 0;
8
61
  return e.trim().endsWith("ms") ? t : t * 1e3;
9
62
  }
10
- function i(e) {
63
+ function o(e) {
11
64
  e.inert = !0, e.setAttribute("aria-hidden", "true");
12
65
  }
13
- function a(e) {
66
+ function s(e) {
14
67
  e.inert = !1, e.removeAttribute("aria-hidden");
15
68
  }
16
- var o = {
17
- onBeforeEnter: a,
18
- onBeforeLeave: i
19
- }, s = /* @__PURE__ */ new WeakMap();
20
- function c(e) {
21
- let t = s.get(e);
22
- t && (Object.assign(e.style, t), s.delete(e)), a(e);
69
+ var c = {
70
+ onBeforeEnter: s,
71
+ onBeforeLeave: o
72
+ }, l = /* @__PURE__ */ new WeakMap();
73
+ function u(e) {
74
+ let t = l.get(e);
75
+ t && (Object.assign(e.style, t), l.delete(e)), s(e);
23
76
  }
24
- function l(e) {
77
+ function d(e) {
25
78
  let t = e.parentElement;
26
79
  if (!t) return;
27
80
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
28
- e.ownerDocument.defaultView.getComputedStyle(t).position === "static" && (t.style.position = "relative"), s.has(e) || s.set(e, Object.fromEntries([
81
+ e.ownerDocument.defaultView.getComputedStyle(t).position === "static" && (t.style.position = "relative"), l.has(e) || l.set(e, Object.fromEntries([
29
82
  "position",
30
83
  "top",
31
84
  "left",
@@ -45,41 +98,41 @@ function l(e) {
45
98
  height: `${n.height}px`,
46
99
  boxSizing: "border-box",
47
100
  margin: "0"
48
- }), i(e);
101
+ }), o(e);
49
102
  }
50
- var u = /* @__PURE__ */ new WeakMap();
51
- function d(e) {
103
+ var f = /* @__PURE__ */ new WeakMap();
104
+ function p(e) {
52
105
  let t = e?.getBoundingClientRect().height || 0;
53
- t > 0 && u.set(e, t);
106
+ t > 0 && f.set(e, t);
54
107
  }
55
- function f(n) {
56
- let r = e.get(n);
57
- r && (t.set(n, {
58
- height: n.getBoundingClientRect().height,
59
- opacity: getComputedStyle(n).opacity
60
- }), r.observer?.disconnect(), e.delete(n), r.animation?.cancel(), n.style.overflow = r.overflow);
108
+ function m(e) {
109
+ let n = t.get(e);
110
+ n && (r.set(e, {
111
+ height: e.getBoundingClientRect().height,
112
+ opacity: getComputedStyle(e).opacity
113
+ }), n.observer?.disconnect(), t.delete(e), n.animation?.cancel(), e.style.overflow = n.overflow);
61
114
  }
62
- function p(i, a, o) {
63
- let s = i.ownerDocument.defaultView, c = i.style.display === "none" || s.getComputedStyle(i).display === "none";
64
- o && c && (i.style.display = "");
65
- let l = s.getComputedStyle(i), d = t.get(i);
66
- t.delete(i);
67
- let f = i.getBoundingClientRect().height || u.get(i) || 0, p = n(i) ? 0 : r(l.getPropertyValue("--kima-duration-slow") || "300ms"), m = l.getPropertyValue("--kima-curve-emphasized").trim() || "ease-out";
68
- if (!p || !i.animate) {
69
- a();
115
+ function h(e, n, o) {
116
+ let s = e.ownerDocument.defaultView, c = e.style.display === "none" || s.getComputedStyle(e).display === "none";
117
+ o && c && (e.style.display = "");
118
+ let l = s.getComputedStyle(e), u = r.get(e);
119
+ r.delete(e);
120
+ let d = e.getBoundingClientRect().height || f.get(e) || 0, p = i(e) ? 0 : a(l.getPropertyValue("--kima-duration-slow") || "300ms"), m = l.getPropertyValue("--kima-curve-emphasized").trim() || "ease-out";
121
+ if (!p || !e.animate) {
122
+ n();
70
123
  return;
71
124
  }
72
125
  let h = {
73
- overflow: i.style.overflow,
126
+ overflow: e.style.overflow,
74
127
  animation: null,
75
128
  observer: null
76
129
  };
77
- e.set(i, h), i.style.overflow = "clip";
78
- let g = o ? f : 0;
79
- function _(t, n) {
80
- let r = i.animate([{
81
- height: `${t}px`,
82
- opacity: n
130
+ t.set(e, h), e.style.overflow = "clip";
131
+ let g = o ? d : 0;
132
+ function _(r, i) {
133
+ let a = e.animate([{
134
+ height: `${r}px`,
135
+ opacity: i
83
136
  }, {
84
137
  height: `${g}px`,
85
138
  opacity: +!!o
@@ -88,24 +141,24 @@ function p(i, a, o) {
88
141
  easing: m,
89
142
  fill: "both"
90
143
  });
91
- h.animation = r, r.finished.then(() => {
92
- e.get(i) === h && h.animation === r && (h.observer?.disconnect(), e.delete(i), i.style.overflow = h.overflow, a(), r.cancel());
144
+ h.animation = a, a.finished.then(() => {
145
+ t.get(e) === h && h.animation === a && (h.observer?.disconnect(), t.delete(e), e.style.overflow = h.overflow, n(), a.cancel());
93
146
  }).catch(() => {});
94
147
  }
95
- if (_(d?.height ?? (o ? 0 : f), d?.opacity ?? (o ? 0 : l.opacity)), o && s.ResizeObserver && i.firstElementChild) {
96
- let t = i.firstElementChild.getBoundingClientRect().height;
148
+ if (_(u?.height ?? (o ? 0 : d), u?.opacity ?? (o ? 0 : l.opacity)), o && s.ResizeObserver && e.firstElementChild) {
149
+ let n = e.firstElementChild.getBoundingClientRect().height;
97
150
  h.observer = new s.ResizeObserver(() => {
98
- let n = i.firstElementChild?.getBoundingClientRect().height ?? t;
99
- if (Math.abs(n - t) < .5 || e.get(i) !== h) return;
100
- let r = i.getBoundingClientRect().height, a = s.getComputedStyle(i).opacity;
101
- g += n - t, t = n, h.animation.cancel(), _(r, a);
102
- }), h.observer.observe(i.firstElementChild);
151
+ let r = e.firstElementChild?.getBoundingClientRect().height ?? n;
152
+ if (Math.abs(r - n) < .5 || t.get(e) !== h) return;
153
+ let i = e.getBoundingClientRect().height, a = s.getComputedStyle(e).opacity;
154
+ g += r - n, n = r, h.animation.cancel(), _(i, a);
155
+ }), h.observer.observe(e.firstElementChild);
103
156
  }
104
157
  }
105
- var m = {
106
- onEnter: (e, t) => p(e, t, !0),
107
- onLeave: (e, t) => p(e, t, !1),
108
- onEnterCancelled: f,
109
- onLeaveCancelled: f
158
+ var g = {
159
+ onEnter: (e, t) => h(e, t, !0),
160
+ onLeave: (e, t) => h(e, t, !1),
161
+ onEnterCancelled: m,
162
+ onLeaveCancelled: m
110
163
  };
111
- export { a as activateMotionElement, m as collapseTransition, l as freezeLeaveLayout, n as prefersReducedMotion, o as presenceTransition, d as rememberCollapseHeight, c as restoreLeaveLayout, i as retireMotionElement };
164
+ export { s as activateMotionElement, g as collapseTransition, d as freezeLeaveLayout, i as prefersReducedMotion, c as presenceTransition, p as rememberCollapseHeight, u as restoreLeaveLayout, o as retireMotionElement, n as useLayoutFlip };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernel4632/kima",
3
- "version": "0.9.3",
3
+ "version": "0.9.4",
4
4
  "description": "KIMA (Kinetic, Interaction, Motion, Alive) - a Material 3 style Web UI design system and component library.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1 +0,0 @@
1
- .kima-tag-group[data-v-892954ad]{color:var(--kima-color-on-surface);font-family:var(--kima-font-family)}.kima-tag-group__items[data-v-892954ad]{gap:var(--kima-space-2);flex-wrap:wrap;display:flex;position:relative}