@youcan/celeste 0.13.0 → 0.14.0

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 (65) hide show
  1. package/ai/component-registry.json +49 -2
  2. package/ai/component-registry.md +24 -2
  3. package/ai/icons.md +1 -1
  4. package/ai/tokens.md +1 -1
  5. package/dist/celeste.css +299 -86
  6. package/dist/cjs/chunks/calendar.cjs +71 -72
  7. package/dist/cjs/chunks/combobox-root.cjs +6 -6
  8. package/dist/cjs/chunks/components.cjs +2 -0
  9. package/dist/cjs/chunks/digit-input.cjs +13 -12
  10. package/dist/cjs/chunks/dropdown-menu.cjs +9 -6
  11. package/dist/cjs/chunks/mochi.cjs +168 -0
  12. package/dist/cjs/chunks/radio-group.cjs +4 -8
  13. package/dist/cjs/chunks/range-calendar.cjs +71 -72
  14. package/dist/cjs/chunks/scroll-area.cjs +16 -17
  15. package/dist/cjs/chunks/segmented-control.cjs +20 -21
  16. package/dist/cjs/chunks/select.cjs +8 -5
  17. package/dist/cjs/chunks/slider.cjs +14 -15
  18. package/dist/cjs/chunks/tab-menu.cjs +8 -9
  19. package/dist/cjs/command-root.cjs +8 -5
  20. package/dist/cjs/index.cjs +2 -0
  21. package/dist/cjs/mochi.cjs +2 -0
  22. package/dist/cjs/use-direction.cjs +4 -4
  23. package/dist/components/index.d.ts +1 -0
  24. package/dist/components/mochi/index.d.ts +2 -0
  25. package/dist/components/mochi/mochi.d.ts +22 -0
  26. package/dist/components/radio-group/radio-group.d.ts +2 -2
  27. package/dist/components/scroll-area/scroll-area.d.ts +2 -2
  28. package/dist/components/segmented-control/segmented-control.d.ts +2 -2
  29. package/dist/components/tab-menu/tab-menu.d.ts +2 -2
  30. package/dist/composables/use-direction.d.ts +2 -2
  31. package/dist/es/chunks/calendar.js +71 -72
  32. package/dist/es/chunks/combobox-root.js +6 -6
  33. package/dist/es/chunks/components.js +2 -0
  34. package/dist/es/chunks/digit-input.js +14 -13
  35. package/dist/es/chunks/dropdown-menu.js +9 -6
  36. package/dist/es/chunks/mochi.js +162 -0
  37. package/dist/es/chunks/radio-group.js +5 -9
  38. package/dist/es/chunks/range-calendar.js +71 -72
  39. package/dist/es/chunks/scroll-area.js +16 -17
  40. package/dist/es/chunks/segmented-control.js +21 -22
  41. package/dist/es/chunks/select.js +8 -5
  42. package/dist/es/chunks/slider.js +14 -15
  43. package/dist/es/chunks/tab-menu.js +9 -10
  44. package/dist/es/command-root.js +8 -5
  45. package/dist/es/index.js +2 -1
  46. package/dist/es/mochi.js +2 -0
  47. package/dist/es/use-direction.js +5 -5
  48. package/package.json +3 -3
  49. package/src/components/calendar/calendar.vue +62 -64
  50. package/src/components/combobox/combobox-root.vue +9 -5
  51. package/src/components/command/command-root.vue +10 -9
  52. package/src/components/digit-input/digit-input.vue +10 -11
  53. package/src/components/dropdown-menu/dropdown-menu.vue +9 -8
  54. package/src/components/index.ts +1 -0
  55. package/src/components/mochi/index.ts +2 -0
  56. package/src/components/mochi/mochi.vue +480 -0
  57. package/src/components/mochi/stories/mochi.stories.ts +105 -0
  58. package/src/components/radio-group/radio-group.vue +9 -10
  59. package/src/components/range-calendar/range-calendar.vue +63 -65
  60. package/src/components/scroll-area/scroll-area.vue +14 -15
  61. package/src/components/segmented-control/segmented-control.vue +20 -21
  62. package/src/components/select/select.vue +9 -8
  63. package/src/components/slider/slider.vue +16 -17
  64. package/src/components/tab-menu/tab-menu.vue +9 -10
  65. package/src/composables/use-direction.ts +6 -6
@@ -3,7 +3,6 @@ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-hel
3
3
  import { t as createContext } from "./createContext.js";
4
4
  import { p as useVModel } from "./dist2.js";
5
5
  import { t as Primitive } from "./Primitive.js";
6
- import { t as ConfigProvider_default } from "./ConfigProvider.js";
7
6
  import { a as handleCalendarInitialFocus, d as toDate, g as $ad063034c8620db8$export$aa8b41735afcabd2, h as $ad063034c8620db8$export$a18c89cbd24170ff, i as getWeekStartsOn, m as $ad063034c8620db8$export$91b62ebf2ba703ee, n as useCalendarState, p as $ad063034c8620db8$export$629b0a497aa65267, s as getDefaultDate, t as useCalendar, v as $ad063034c8620db8$export$ea39ec197993aef0 } from "./useCalendar.js";
8
7
  import { t as useDirection } from "./useDirection.js";
9
8
  import { t as useForwardPropsEmits } from "./useForwardPropsEmits.js";
@@ -837,7 +836,7 @@ var calendar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
837
836
  const emits = __emit;
838
837
  const delegatedProps = useDelegatedProps(props, ["class", "markedDates"]);
839
838
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
840
- const direction = useDirection$1();
839
+ const dir = useDirection$1(() => props.dir);
841
840
  function isMarked(date) {
842
841
  return props.markedDates?.some((marked) => $ad063034c8620db8$export$91b62ebf2ba703ee(marked, date)) ?? false;
843
842
  }
@@ -845,85 +844,85 @@ var calendar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
845
844
  return /^[a-z]/i.test(day.trim()) ? day.slice(0, 2) : day;
846
845
  }
847
846
  return (_ctx, _cache) => {
848
- return openBlock(), createBlock(unref(ConfigProvider_default), { dir: props.dir ?? unref(direction) }, {
849
- default: withCtx(() => [createVNode(unref(CalendarRoot_default), mergeProps(unref(forwarded), { class: unref(clsx)("celeste-calendar", props.class) }), {
850
- default: withCtx(({ weekDays, grid }) => [createElementVNode("div", _hoisted_1, [
851
- createVNode(unref(CalendarPrev_default), { "as-child": "" }, {
852
- default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("button", {
853
- type: "button",
854
- class: "celeste-calendar-nav"
855
- }, [createElementVNode("i", { class: "i-celeste-arrow-left-s-line" })], -1)])]),
856
- _: 1
857
- }),
858
- createVNode(unref(CalendarHeading_default), { class: "celeste-calendar-heading" }),
859
- createVNode(unref(CalendarNext_default), { "as-child": "" }, {
860
- default: withCtx(() => [..._cache[1] || (_cache[1] = [createElementVNode("button", {
861
- type: "button",
862
- class: "celeste-calendar-nav"
863
- }, [createElementVNode("i", { class: "i-celeste-arrow-right-s-line" })], -1)])]),
864
- _: 1
865
- })
866
- ]), createElementVNode("div", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(grid, (month) => {
867
- return openBlock(), createBlock(unref(CalendarGrid_default), {
868
- key: month.value.toString(),
869
- class: "celeste-calendar-grid"
870
- }, {
871
- default: withCtx(() => [createVNode(unref(CalendarGridHead_default), null, {
872
- default: withCtx(() => [createVNode(unref(CalendarGridRow_default), { class: "celeste-calendar-week" }, {
873
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(weekDays, (day) => {
874
- return openBlock(), createBlock(unref(CalendarHeadCell_default), {
875
- key: day,
876
- class: "celeste-calendar-weekday"
877
- }, {
878
- default: withCtx(() => [createTextVNode(toDisplayString(weekdayLabel(day)), 1)]),
879
- _: 2
880
- }, 1024);
881
- }), 128))]),
882
- _: 2
883
- }, 1024)]),
884
- _: 2
885
- }, 1024), createVNode(unref(CalendarGridBody_default), { class: "celeste-calendar-body" }, {
886
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(month.rows, (weekDates, index) => {
887
- return openBlock(), createBlock(unref(CalendarGridRow_default), {
888
- key: `week-${index}`,
889
- class: "celeste-calendar-week"
847
+ return openBlock(), createBlock(unref(CalendarRoot_default), mergeProps(unref(forwarded), {
848
+ class: unref(clsx)("celeste-calendar", props.class),
849
+ dir: unref(dir)
850
+ }), {
851
+ default: withCtx(({ weekDays, grid }) => [createElementVNode("div", _hoisted_1, [
852
+ createVNode(unref(CalendarPrev_default), { "as-child": "" }, {
853
+ default: withCtx(() => [..._cache[0] || (_cache[0] = [createElementVNode("button", {
854
+ type: "button",
855
+ class: "celeste-calendar-nav"
856
+ }, [createElementVNode("i", { class: "i-celeste-arrow-left-s-line" })], -1)])]),
857
+ _: 1
858
+ }),
859
+ createVNode(unref(CalendarHeading_default), { class: "celeste-calendar-heading" }),
860
+ createVNode(unref(CalendarNext_default), { "as-child": "" }, {
861
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [createElementVNode("button", {
862
+ type: "button",
863
+ class: "celeste-calendar-nav"
864
+ }, [createElementVNode("i", { class: "i-celeste-arrow-right-s-line" })], -1)])]),
865
+ _: 1
866
+ })
867
+ ]), createElementVNode("div", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(grid, (month) => {
868
+ return openBlock(), createBlock(unref(CalendarGrid_default), {
869
+ key: month.value.toString(),
870
+ class: "celeste-calendar-grid"
871
+ }, {
872
+ default: withCtx(() => [createVNode(unref(CalendarGridHead_default), null, {
873
+ default: withCtx(() => [createVNode(unref(CalendarGridRow_default), { class: "celeste-calendar-week" }, {
874
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(weekDays, (day) => {
875
+ return openBlock(), createBlock(unref(CalendarHeadCell_default), {
876
+ key: day,
877
+ class: "celeste-calendar-weekday"
890
878
  }, {
891
- default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(weekDates, (weekDate) => {
892
- return openBlock(), createBlock(unref(CalendarCell_default), {
893
- key: weekDate.toString(),
894
- date: weekDate,
895
- class: "celeste-calendar-cell"
896
- }, {
897
- default: withCtx(() => [createVNode(unref(CalendarCellTrigger_default), {
898
- day: weekDate,
899
- month: month.value,
900
- class: "celeste-calendar-day",
901
- "data-marked": isMarked(weekDate) ? "" : void 0
902
- }, {
903
- default: withCtx(() => [createElementVNode("span", _hoisted_3, toDisplayString(weekDate.day), 1)]),
904
- _: 2
905
- }, 1032, [
906
- "day",
907
- "month",
908
- "data-marked"
909
- ])]),
910
- _: 2
911
- }, 1032, ["date"]);
912
- }), 128))]),
879
+ default: withCtx(() => [createTextVNode(toDisplayString(weekdayLabel(day)), 1)]),
913
880
  _: 2
914
881
  }, 1024);
915
882
  }), 128))]),
916
883
  _: 2
917
884
  }, 1024)]),
918
885
  _: 2
919
- }, 1024);
920
- }), 128))])]),
921
- _: 1
922
- }, 16, ["class"])]),
886
+ }, 1024), createVNode(unref(CalendarGridBody_default), { class: "celeste-calendar-body" }, {
887
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(month.rows, (weekDates, index) => {
888
+ return openBlock(), createBlock(unref(CalendarGridRow_default), {
889
+ key: `week-${index}`,
890
+ class: "celeste-calendar-week"
891
+ }, {
892
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(weekDates, (weekDate) => {
893
+ return openBlock(), createBlock(unref(CalendarCell_default), {
894
+ key: weekDate.toString(),
895
+ date: weekDate,
896
+ class: "celeste-calendar-cell"
897
+ }, {
898
+ default: withCtx(() => [createVNode(unref(CalendarCellTrigger_default), {
899
+ day: weekDate,
900
+ month: month.value,
901
+ class: "celeste-calendar-day",
902
+ "data-marked": isMarked(weekDate) ? "" : void 0
903
+ }, {
904
+ default: withCtx(() => [createElementVNode("span", _hoisted_3, toDisplayString(weekDate.day), 1)]),
905
+ _: 2
906
+ }, 1032, [
907
+ "day",
908
+ "month",
909
+ "data-marked"
910
+ ])]),
911
+ _: 2
912
+ }, 1032, ["date"]);
913
+ }), 128))]),
914
+ _: 2
915
+ }, 1024);
916
+ }), 128))]),
917
+ _: 2
918
+ }, 1024)]),
919
+ _: 2
920
+ }, 1024);
921
+ }), 128))])]),
923
922
  _: 1
924
- }, 8, ["dir"]);
923
+ }, 16, ["class", "dir"]);
925
924
  };
926
925
  }
927
- }), [["__scopeId", "data-v-f067ca68"]]);
926
+ }), [["__scopeId", "data-v-8b6a5725"]]);
928
927
  //#endregion
929
928
  export { calendar_default as t };
@@ -37,17 +37,17 @@ var combobox_root_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
37
37
  setup(__props, { emit: __emit }) {
38
38
  const props = __props;
39
39
  const forwarded = useForwardPropsEmits(props, __emit);
40
- const direction = useDirection();
40
+ const dir = useDirection(() => props.dir);
41
41
  return (_ctx, _cache) => {
42
- return openBlock(), createBlock(unref(ConfigProvider_default), { dir: props.dir ?? unref(direction) }, {
43
- default: withCtx(() => [createVNode(unref(ComboboxRoot_default), mergeProps({ class: "celeste-combobox-root" }, unref(forwarded)), {
42
+ return openBlock(), createBlock(unref(ComboboxRoot_default), mergeProps({ class: "celeste-combobox-root" }, unref(forwarded), { dir: unref(dir) }), {
43
+ default: withCtx(() => [createVNode(unref(ConfigProvider_default), { dir: unref(dir) }, {
44
44
  default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
45
45
  _: 3
46
- }, 16)]),
46
+ }, 8, ["dir"])]),
47
47
  _: 3
48
- }, 8, ["dir"]);
48
+ }, 16, ["dir"]);
49
49
  };
50
50
  }
51
- }), [["__scopeId", "data-v-7e1e8d15"]]);
51
+ }), [["__scopeId", "data-v-bfdab687"]]);
52
52
  //#endregion
53
53
  export { combobox_root_default as t };
@@ -91,6 +91,7 @@ import { t as tooltip_provider_default } from "./tooltip-provider.js";
91
91
  import { t as tooltip_root_default } from "./tooltip-root.js";
92
92
  import { t as tooltip_default } from "./tooltip.js";
93
93
  import { t as label_default } from "./label2.js";
94
+ import { t as mochi_default } from "./mochi.js";
94
95
  import { t as modal_body_default } from "./modal-body.js";
95
96
  import { t as modal_close_default } from "./modal-close.js";
96
97
  import { t as modal_content_default } from "./modal-content.js";
@@ -222,6 +223,7 @@ var components_exports = /* @__PURE__ */ __exportAll({
222
223
  HueSlider: () => hue_slider_default,
223
224
  Label: () => label_default,
224
225
  LinkButton: () => link_button_default,
226
+ Mochi: () => mochi_default,
225
227
  Modal: () => modal_default,
226
228
  ModalBody: () => modal_body_default,
227
229
  ModalClose: () => modal_close_default,
@@ -1,11 +1,10 @@
1
1
  import { t as clsx } from "./clsx.js";
2
2
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
3
3
  import { f as reactiveOmit } from "./dist.js";
4
- import { t as ConfigProvider_default } from "./ConfigProvider.js";
5
4
  import { t as useForwardPropsEmits } from "./useForwardPropsEmits.js";
6
5
  import { t as PinInputRoot_default } from "./PinInputRoot.js";
7
6
  import { useDirection } from "../use-direction.js";
8
- import { createBlock, createVNode, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
7
+ import { createBlock, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
9
8
  //#endregion
10
9
  //#region src/components/digit-input/digit-input.vue
11
10
  var digit_input_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -42,20 +41,22 @@ var digit_input_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__
42
41
  const emits = __emit;
43
42
  const delegatedProps = reactiveOmit(props, "class", "hasError");
44
43
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
45
- const direction = useDirection();
44
+ const dir = useDirection(() => props.dir);
46
45
  return (_ctx, _cache) => {
47
- return openBlock(), createBlock(unref(ConfigProvider_default), { dir: props.dir ?? unref(direction) }, {
48
- default: withCtx(() => [createVNode(unref(PinInputRoot_default), mergeProps(unref(forwarded), {
49
- class: unref(clsx)("celeste-digit-input", props.class),
50
- "data-error": __props.hasError
51
- }), {
52
- default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
53
- _: 3
54
- }, 16, ["class", "data-error"])]),
46
+ return openBlock(), createBlock(unref(PinInputRoot_default), mergeProps(unref(forwarded), {
47
+ class: unref(clsx)("celeste-digit-input", props.class),
48
+ "data-error": __props.hasError,
49
+ dir: unref(dir)
50
+ }), {
51
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
55
52
  _: 3
56
- }, 8, ["dir"]);
53
+ }, 16, [
54
+ "class",
55
+ "data-error",
56
+ "dir"
57
+ ]);
57
58
  };
58
59
  }
59
- }), [["__scopeId", "data-v-20a3fbb5"]]);
60
+ }), [["__scopeId", "data-v-12ddf69b"]]);
60
61
  //#endregion
61
62
  export { digit_input_default as t };
@@ -29,17 +29,20 @@ var dropdown_menu_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
29
29
  const emits = __emit;
30
30
  const delegatedProps = useDelegatedProps(props, "class");
31
31
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
32
- const direction = useDirection();
32
+ const dir = useDirection(() => props.dir);
33
33
  return (_ctx, _cache) => {
34
- return openBlock(), createBlock(unref(ConfigProvider_default), { dir: props.dir ?? unref(direction) }, {
35
- default: withCtx(() => [createVNode(unref(DropdownMenuRoot_default), mergeProps(unref(forwarded), { class: unref(clsx)("celeste-dropdown-menu", props.class) }), {
34
+ return openBlock(), createBlock(unref(DropdownMenuRoot_default), mergeProps(unref(forwarded), {
35
+ class: unref(clsx)("celeste-dropdown-menu", props.class),
36
+ dir: unref(dir)
37
+ }), {
38
+ default: withCtx(() => [createVNode(unref(ConfigProvider_default), { dir: unref(dir) }, {
36
39
  default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, void 0, true)]),
37
40
  _: 3
38
- }, 16, ["class"])]),
41
+ }, 8, ["dir"])]),
39
42
  _: 3
40
- }, 8, ["dir"]);
43
+ }, 16, ["class", "dir"]);
41
44
  };
42
45
  }
43
- }), [["__scopeId", "data-v-fa4c1e84"]]);
46
+ }), [["__scopeId", "data-v-154e9b38"]]);
44
47
  //#endregion
45
48
  export { dropdown_menu_default as t };
@@ -0,0 +1,162 @@
1
+ import { t as clsx } from "./clsx.js";
2
+ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
3
+ import { computed, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, unref, useCssVars, useModel, watch } from "vue";
4
+ //#region src/components/mochi/mochi.vue?vue&type=script&setup=true&lang.ts
5
+ var _hoisted_1 = ["data-anim"];
6
+ var DROP_DURATION = 2010;
7
+ var HIDE_DURATION = 420;
8
+ var SETTLE_DURATION = 500;
9
+ //#endregion
10
+ //#region src/components/mochi/mochi.vue
11
+ var mochi_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
12
+ __name: "mochi",
13
+ props: /*@__PURE__*/ mergeModels({
14
+ class: { type: [
15
+ Boolean,
16
+ null,
17
+ String,
18
+ Object,
19
+ Array
20
+ ] },
21
+ size: { default: 40 },
22
+ animate: {
23
+ type: Boolean,
24
+ default: false
25
+ },
26
+ thinking: {
27
+ type: Boolean,
28
+ default: false
29
+ }
30
+ }, {
31
+ "idle": {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ "idleModifiers": {}
36
+ }),
37
+ emits: ["update:idle"],
38
+ setup(__props) {
39
+ useCssVars((_ctx) => ({
40
+ "v51b30026": sizePx.value,
41
+ "v54792142": rotate.value
42
+ }));
43
+ const props = __props;
44
+ const idle = useModel(__props, "idle");
45
+ const durations = {
46
+ "blink-twice": 440,
47
+ "blink-once": 160,
48
+ "look-blink-twice": 3e3,
49
+ "look-blink-once": 2800
50
+ };
51
+ const weights = [
52
+ ["blink-twice", 35],
53
+ ["blink-once", 35],
54
+ ["look-blink-twice", 15],
55
+ ["look-blink-once", 15]
56
+ ];
57
+ const rotation = {
58
+ bottom: "0deg",
59
+ right: "-90deg",
60
+ top: "180deg",
61
+ left: "90deg"
62
+ };
63
+ const order = [
64
+ "bottom",
65
+ "right",
66
+ "top",
67
+ "left"
68
+ ];
69
+ const anim = ref("");
70
+ const peek = ref("");
71
+ const peekSide = ref("bottom");
72
+ const sizePx = computed(() => `${props.size}px`);
73
+ const rotate = computed(() => rotation[peekSide.value]);
74
+ let retired = false;
75
+ let frame;
76
+ let timer;
77
+ let peekTimer;
78
+ function pick() {
79
+ let r = Math.random() * 100;
80
+ for (const [name, weight] of weights) {
81
+ r -= weight;
82
+ if (r <= 0) return name;
83
+ }
84
+ return "blink-twice";
85
+ }
86
+ function cycle() {
87
+ clearTimeout(timer);
88
+ cancelAnimationFrame(frame ?? 0);
89
+ anim.value = "";
90
+ if (!props.animate || peek.value) return;
91
+ frame = requestAnimationFrame(() => {
92
+ const next = pick();
93
+ anim.value = next;
94
+ timer = setTimeout(cycle, durations[next] + 800 + Math.random() * 1600);
95
+ });
96
+ }
97
+ function later(fn, ms) {
98
+ clearTimeout(peekTimer);
99
+ peekTimer = setTimeout(fn, ms);
100
+ }
101
+ function drop() {
102
+ peekSide.value = "bottom";
103
+ peek.value = "drop";
104
+ cycle();
105
+ later(() => {
106
+ peek.value = "out";
107
+ }, DROP_DURATION);
108
+ }
109
+ function settle() {
110
+ peekSide.value = "bottom";
111
+ peek.value = "home";
112
+ later(() => {
113
+ peek.value = "";
114
+ cycle();
115
+ }, SETTLE_DURATION);
116
+ }
117
+ function hop() {
118
+ peek.value = "hidden";
119
+ later(() => {
120
+ const next = order[(order.indexOf(peekSide.value) + 1) % order.length];
121
+ if (next === "bottom") {
122
+ retired = true;
123
+ settle();
124
+ idle.value = false;
125
+ return;
126
+ }
127
+ peekSide.value = next;
128
+ peek.value = "out";
129
+ }, HIDE_DURATION);
130
+ }
131
+ function poke() {
132
+ if (peek.value === "out") hop();
133
+ else if (!peek.value && props.animate && !retired) idle.value = true;
134
+ }
135
+ watch(() => idle.value && props.animate, (active) => {
136
+ if (active && !retired && !peek.value) drop();
137
+ else if (!active && peek.value && peek.value !== "home") {
138
+ peek.value = "hidden";
139
+ later(settle, HIDE_DURATION);
140
+ }
141
+ }, { immediate: true });
142
+ watch(() => props.animate, cycle);
143
+ onMounted(cycle);
144
+ onBeforeUnmount(() => {
145
+ cancelAnimationFrame(frame ?? 0);
146
+ clearTimeout(timer);
147
+ clearTimeout(peekTimer);
148
+ });
149
+ return (_ctx, _cache) => {
150
+ return openBlock(), createElementBlock("div", {
151
+ class: normalizeClass(unref(clsx)("celeste-mochi", peek.value && `celeste-mochi-peek-${peek.value}`, props.thinking && "celeste-mochi-thinking", props.class)),
152
+ "data-anim": anim.value || void 0,
153
+ "aria-hidden": "true"
154
+ }, [createElementVNode("div", { class: "celeste-mochi-stage" }, [createElementVNode("div", { class: "celeste-mochi-chan" }, [createElementVNode("div", {
155
+ class: "celeste-mochi-body",
156
+ onClick: poke
157
+ }), _cache[0] || (_cache[0] = createElementVNode("div", { class: "celeste-mochi-eyes" }, [createElementVNode("div", { class: "celeste-mochi-eye celeste-mochi-eye-l" }), createElementVNode("div", { class: "celeste-mochi-eye celeste-mochi-eye-r" })], -1))])])], 10, _hoisted_1);
158
+ };
159
+ }
160
+ }), [["__scopeId", "data-v-ce7048d3"]]);
161
+ //#endregion
162
+ export { mochi_default as t };
@@ -1,10 +1,9 @@
1
1
  import { t as clsx } from "./clsx.js";
2
- import { t as ConfigProvider_default } from "./ConfigProvider.js";
3
2
  import { t as useForwardPropsEmits } from "./useForwardPropsEmits.js";
4
3
  import { t as RadioGroupRoot_default } from "./RadioGroupRoot.js";
5
4
  import { useDelegatedProps } from "../use-delegated-props.js";
6
5
  import { useDirection } from "../use-direction.js";
7
- import { createBlock, createVNode, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
6
+ import { createBlock, defineComponent, mergeProps, openBlock, renderSlot, unref, withCtx } from "vue";
8
7
  //#endregion
9
8
  //#region src/components/radio-group/radio-group.vue
10
9
  var radio_group_default = /* @__PURE__ */ defineComponent({
@@ -34,15 +33,12 @@ var radio_group_default = /* @__PURE__ */ defineComponent({
34
33
  const emits = __emit;
35
34
  const delegatedProps = useDelegatedProps(props, "class");
36
35
  const forwarded = useForwardPropsEmits(delegatedProps, emits);
37
- const direction = useDirection();
36
+ const dir = useDirection(() => props.dir);
38
37
  return (_ctx, _cache) => {
39
- return openBlock(), createBlock(unref(ConfigProvider_default), { dir: props.dir ?? unref(direction) }, {
40
- default: withCtx(() => [createVNode(unref(RadioGroupRoot_default), mergeProps({ class: unref(clsx)("celeste-radio-wrapper", props.class) }, unref(forwarded)), {
41
- default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
42
- _: 3
43
- }, 16, ["class"])]),
38
+ return openBlock(), createBlock(unref(RadioGroupRoot_default), mergeProps({ class: unref(clsx)("celeste-radio-wrapper", props.class) }, unref(forwarded), { dir: unref(dir) }), {
39
+ default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
44
40
  _: 3
45
- }, 8, ["dir"]);
41
+ }, 16, ["class", "dir"]);
46
42
  };
47
43
  }
48
44
  });