@youcan/celeste 0.13.1 → 0.14.1
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/ai/README.md +21 -0
- package/ai/component-registry.json +1864 -664
- package/ai/icons.json +12600 -0
- package/ai/tokens.json +2189 -0
- package/dist/celeste.css +228 -0
- package/dist/cjs/chunks/components.cjs +2 -0
- package/dist/cjs/chunks/mochi.cjs +168 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/mochi.cjs +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/mochi/index.d.ts +2 -0
- package/dist/components/mochi/mochi.d.ts +22 -0
- package/dist/es/chunks/components.js +2 -0
- package/dist/es/chunks/mochi.js +162 -0
- package/dist/es/index.js +2 -1
- package/dist/es/mochi.js +2 -0
- package/package.json +3 -3
- package/src/components/index.ts +1 -0
- package/src/components/mochi/index.ts +2 -0
- package/src/components/mochi/mochi.vue +480 -0
- package/src/components/mochi/stories/mochi.stories.ts +105 -0
- package/src/components/modal/stories/modal.stories.ts +3 -3
- package/src/components/sidebar/sidebar-menu-action.vue +3 -0
- package/src/components/sidebar/sidebar-menu-button.vue +4 -0
- package/src/components/sidebar/sidebar-menu-sub-button.vue +3 -0
- package/src/components/sidebar/sidebar-menu-sub.vue +2 -0
- package/src/components/sidebar/sidebar-menu.vue +3 -0
- package/src/components/sidebar/stories/sidebar.stories.ts +2 -2
- package/ai/component-registry.md +0 -3496
- package/ai/icons.md +0 -142
- package/ai/tokens.md +0 -444
package/dist/celeste.css
CHANGED
|
@@ -4615,6 +4615,219 @@ to {
|
|
|
4615
4615
|
.celeste-label[aria-disabled=true][data-v-5ae119db]::after, .celeste-label[aria-disabled=true][data-v-5ae119db] > a,
|
|
4616
4616
|
.celeste-label[aria-disabled=true] .celeste-sublabel[data-v-5ae119db] {
|
|
4617
4617
|
color: inherit;
|
|
4618
|
+
}.celeste-mochi[data-v-ce7048d3] {
|
|
4619
|
+
--mochi-size: var(--v51b30026);
|
|
4620
|
+
--mochi-rotate: var(--v54792142);
|
|
4621
|
+
position: relative;
|
|
4622
|
+
flex: none;
|
|
4623
|
+
width: var(--mochi-size);
|
|
4624
|
+
height: var(--mochi-size);
|
|
4625
|
+
overflow: hidden;
|
|
4626
|
+
border-radius: calc(var(--mochi-size) * 0.2222);
|
|
4627
|
+
background: linear-gradient(180deg, var(--color-brand-300) 0%, #f90171 100%);
|
|
4628
|
+
isolation: isolate;
|
|
4629
|
+
}
|
|
4630
|
+
.celeste-mochi[data-v-ce7048d3]::after {
|
|
4631
|
+
content: "";
|
|
4632
|
+
position: absolute;
|
|
4633
|
+
inset: 0;
|
|
4634
|
+
border-radius: inherit;
|
|
4635
|
+
box-shadow: inset 0 0 0 max(1px, var(--mochi-size) * 0.0278) var(--color-brand-200);
|
|
4636
|
+
pointer-events: none;
|
|
4637
|
+
}
|
|
4638
|
+
.celeste-mochi[data-v-ce7048d3] > * {
|
|
4639
|
+
position: absolute;
|
|
4640
|
+
}
|
|
4641
|
+
.celeste-mochi-stage[data-v-ce7048d3] {
|
|
4642
|
+
inset: 0;
|
|
4643
|
+
transform: rotate(var(--mochi-rotate));
|
|
4644
|
+
}
|
|
4645
|
+
.celeste-mochi-chan[data-v-ce7048d3] {
|
|
4646
|
+
position: absolute;
|
|
4647
|
+
top: 24%;
|
|
4648
|
+
left: -15%;
|
|
4649
|
+
width: 129.4%;
|
|
4650
|
+
height: 140.9%;
|
|
4651
|
+
transition: transform 0.38s cubic-bezier(0.3, -0.4, 0.7, 0.2);
|
|
4652
|
+
}
|
|
4653
|
+
.celeste-mochi-body[data-v-ce7048d3] {
|
|
4654
|
+
position: absolute;
|
|
4655
|
+
inset: 0;
|
|
4656
|
+
border-radius: 50%;
|
|
4657
|
+
background: var(--color-brand-400);
|
|
4658
|
+
box-shadow: inset 0 calc(var(--mochi-size) * 0.242) calc(var(--mochi-size) * 0.4015) rgba(255, 255, 255, 0.8), inset 0 calc(var(--mochi-size) * 0.363) calc(var(--mochi-size) * 0.2826) var(--color-brand-300);
|
|
4659
|
+
}
|
|
4660
|
+
.celeste-mochi-eyes[data-v-ce7048d3] {
|
|
4661
|
+
--eye-top: 12.8%;
|
|
4662
|
+
--eye-h: 19.4%;
|
|
4663
|
+
position: absolute;
|
|
4664
|
+
transform-origin: 50% calc(var(--eye-top) + var(--eye-h) / 2);
|
|
4665
|
+
transition: transform 0.7s ease-in-out;
|
|
4666
|
+
pointer-events: none;
|
|
4667
|
+
inset: 0;
|
|
4668
|
+
}
|
|
4669
|
+
.celeste-mochi-eye[data-v-ce7048d3] {
|
|
4670
|
+
position: absolute;
|
|
4671
|
+
top: var(--eye-top);
|
|
4672
|
+
width: 13.6%;
|
|
4673
|
+
height: var(--eye-h);
|
|
4674
|
+
overflow: hidden;
|
|
4675
|
+
border-radius: var(--radius-full);
|
|
4676
|
+
background: linear-gradient(180deg, var(--color-static-white) 0%, rgba(255, 255, 255, 0.6) 100%);
|
|
4677
|
+
filter: drop-shadow(0 calc(var(--mochi-size) * 0.0305) calc(var(--mochi-size) * 0.0153) var(--color-pink-500));
|
|
4678
|
+
}
|
|
4679
|
+
.celeste-mochi-eye-l[data-v-ce7048d3] {
|
|
4680
|
+
left: 31.5%;
|
|
4681
|
+
}
|
|
4682
|
+
.celeste-mochi-eye-r[data-v-ce7048d3] {
|
|
4683
|
+
right: 31.5%;
|
|
4684
|
+
}
|
|
4685
|
+
.celeste-mochi-peek-drop .celeste-mochi-eye[data-v-ce7048d3],
|
|
4686
|
+
.celeste-mochi-peek-hidden .celeste-mochi-eye[data-v-ce7048d3],
|
|
4687
|
+
.celeste-mochi-peek-out .celeste-mochi-eye[data-v-ce7048d3] {
|
|
4688
|
+
height: calc(var(--eye-h) * 80 / 112);
|
|
4689
|
+
border-bottom-right-radius: 0;
|
|
4690
|
+
border-bottom-left-radius: 0;
|
|
4691
|
+
}
|
|
4692
|
+
.celeste-mochi-peek-drop .celeste-mochi-eye[data-v-ce7048d3] {
|
|
4693
|
+
animation: celeste-mochi-squint-ce7048d3 0.25s ease-in-out 1s both;
|
|
4694
|
+
}
|
|
4695
|
+
.celeste-mochi[data-anim=blink-twice] .celeste-mochi-eye[data-v-ce7048d3],
|
|
4696
|
+
.celeste-mochi[data-anim=look-blink-twice] .celeste-mochi-eye[data-v-ce7048d3] {
|
|
4697
|
+
animation: celeste-mochi-blink-twice-ce7048d3 3.5s linear both;
|
|
4698
|
+
}
|
|
4699
|
+
.celeste-mochi[data-anim=blink-once] .celeste-mochi-eye[data-v-ce7048d3],
|
|
4700
|
+
.celeste-mochi[data-anim=look-blink-once] .celeste-mochi-eye[data-v-ce7048d3] {
|
|
4701
|
+
animation: celeste-mochi-blink-once-ce7048d3 3.5s linear both;
|
|
4702
|
+
}
|
|
4703
|
+
.celeste-mochi[data-anim=look-blink-twice] .celeste-mochi-eyes[data-v-ce7048d3] {
|
|
4704
|
+
animation: celeste-mochi-look-after-blink-twice-ce7048d3 3.5s linear both;
|
|
4705
|
+
}
|
|
4706
|
+
.celeste-mochi[data-anim=look-blink-once] .celeste-mochi-eyes[data-v-ce7048d3] {
|
|
4707
|
+
animation: celeste-mochi-look-after-blink-once-ce7048d3 3.5s linear both;
|
|
4708
|
+
}
|
|
4709
|
+
.celeste-mochi-thinking .celeste-mochi-eyes[data-v-ce7048d3] {
|
|
4710
|
+
transform: translate(3.77%, -3.118%) rotate(-7deg);
|
|
4711
|
+
transition: transform 0.6s ease-out;
|
|
4712
|
+
}
|
|
4713
|
+
.celeste-mochi-thinking .celeste-mochi-eye[data-v-ce7048d3] {
|
|
4714
|
+
animation: celeste-mochi-blink-twice-ce7048d3 3.5s linear 1s infinite;
|
|
4715
|
+
}
|
|
4716
|
+
.celeste-mochi-peek-drop .celeste-mochi-chan[data-v-ce7048d3] {
|
|
4717
|
+
animation: celeste-mochi-drop-ce7048d3 2.01s linear both;
|
|
4718
|
+
}
|
|
4719
|
+
.celeste-mochi-peek-hidden .celeste-mochi-chan[data-v-ce7048d3] {
|
|
4720
|
+
transform: translateY(calc(var(--mochi-size) * 0.754));
|
|
4721
|
+
}
|
|
4722
|
+
.celeste-mochi-peek-out .celeste-mochi-chan[data-v-ce7048d3] {
|
|
4723
|
+
transform: translateY(calc(var(--mochi-size) * 0.295));
|
|
4724
|
+
transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
4725
|
+
}
|
|
4726
|
+
.celeste-mochi-peek-home .celeste-mochi-chan[data-v-ce7048d3] {
|
|
4727
|
+
transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
4728
|
+
}
|
|
4729
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4730
|
+
.celeste-mochi[data-v-ce7048d3] * {
|
|
4731
|
+
transition-duration: 1ms !important;
|
|
4732
|
+
animation-duration: 1ms !important;
|
|
4733
|
+
animation-delay: 0s !important;
|
|
4734
|
+
animation-iteration-count: 1 !important;
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
@keyframes celeste-mochi-blink-twice-ce7048d3 {
|
|
4738
|
+
0%, 4.57%, 8% {
|
|
4739
|
+
top: var(--eye-top);
|
|
4740
|
+
height: var(--eye-h);
|
|
4741
|
+
animation-timing-function: ease-in;
|
|
4742
|
+
}
|
|
4743
|
+
2.29%, 10.29% {
|
|
4744
|
+
top: calc(var(--eye-top) + var(--eye-h) / 2);
|
|
4745
|
+
height: 0;
|
|
4746
|
+
animation-timing-function: ease-out;
|
|
4747
|
+
}
|
|
4748
|
+
12.57%, 100% {
|
|
4749
|
+
top: var(--eye-top);
|
|
4750
|
+
height: var(--eye-h);
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
@keyframes celeste-mochi-blink-once-ce7048d3 {
|
|
4754
|
+
0% {
|
|
4755
|
+
top: var(--eye-top);
|
|
4756
|
+
height: var(--eye-h);
|
|
4757
|
+
animation-timing-function: ease-in;
|
|
4758
|
+
}
|
|
4759
|
+
2.29% {
|
|
4760
|
+
top: calc(var(--eye-top) + var(--eye-h) / 2);
|
|
4761
|
+
height: 0;
|
|
4762
|
+
animation-timing-function: ease-out;
|
|
4763
|
+
}
|
|
4764
|
+
4.57%, 100% {
|
|
4765
|
+
top: var(--eye-top);
|
|
4766
|
+
height: var(--eye-h);
|
|
4767
|
+
}
|
|
4768
|
+
}
|
|
4769
|
+
@keyframes celeste-mochi-look-after-blink-twice-ce7048d3 {
|
|
4770
|
+
0%, 14.29% {
|
|
4771
|
+
transform: translate(0, 0);
|
|
4772
|
+
animation-timing-function: ease-out;
|
|
4773
|
+
}
|
|
4774
|
+
22.86%, 42.86% {
|
|
4775
|
+
transform: translate(3.393%, 1.386%);
|
|
4776
|
+
animation-timing-function: ease-in-out;
|
|
4777
|
+
}
|
|
4778
|
+
54.29%, 74.29% {
|
|
4779
|
+
transform: translate(-3.393%, 1.386%);
|
|
4780
|
+
animation-timing-function: ease-in-out;
|
|
4781
|
+
}
|
|
4782
|
+
85.71%, 100% {
|
|
4783
|
+
transform: translate(0, 0);
|
|
4784
|
+
}
|
|
4785
|
+
}
|
|
4786
|
+
@keyframes celeste-mochi-look-after-blink-once-ce7048d3 {
|
|
4787
|
+
0%, 8.57% {
|
|
4788
|
+
transform: translate(0, 0);
|
|
4789
|
+
animation-timing-function: ease-out;
|
|
4790
|
+
}
|
|
4791
|
+
17.14%, 37.14% {
|
|
4792
|
+
transform: translate(3.393%, 1.386%);
|
|
4793
|
+
animation-timing-function: ease-in-out;
|
|
4794
|
+
}
|
|
4795
|
+
48.57%, 68.57% {
|
|
4796
|
+
transform: translate(-3.393%, 1.386%);
|
|
4797
|
+
animation-timing-function: ease-in-out;
|
|
4798
|
+
}
|
|
4799
|
+
80%, 100% {
|
|
4800
|
+
transform: translate(0, 0);
|
|
4801
|
+
}
|
|
4802
|
+
}
|
|
4803
|
+
@keyframes celeste-mochi-squint-ce7048d3 {
|
|
4804
|
+
from {
|
|
4805
|
+
height: var(--eye-h);
|
|
4806
|
+
border-bottom-right-radius: var(--radius-full);
|
|
4807
|
+
border-bottom-left-radius: var(--radius-full);
|
|
4808
|
+
}
|
|
4809
|
+
to {
|
|
4810
|
+
height: calc(var(--eye-h) * 80 / 112);
|
|
4811
|
+
border-bottom-right-radius: 0;
|
|
4812
|
+
border-bottom-left-radius: 0;
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
@keyframes celeste-mochi-drop-ce7048d3 {
|
|
4816
|
+
0% {
|
|
4817
|
+
transform: translateY(0);
|
|
4818
|
+
animation-timing-function: cubic-bezier(0.43, -0.3, 0.74, 0.33);
|
|
4819
|
+
}
|
|
4820
|
+
21.4% {
|
|
4821
|
+
transform: translateY(calc(var(--mochi-size) * -0.0082));
|
|
4822
|
+
animation-timing-function: cubic-bezier(0.3, -0.05, 0.7, -0.5);
|
|
4823
|
+
}
|
|
4824
|
+
44.28%, 68.15% {
|
|
4825
|
+
transform: translateY(calc(var(--mochi-size) * 0.754));
|
|
4826
|
+
animation-timing-function: linear(0, 0.048, 0.168, 0.326, 0.497, 0.66, 0.804, 0.921, 1.009, 1.068, 1.103, 1.118, 1.118, 1.107, 1.089, 1.069, 1.049, 1.031, 1.015, 1.003, 0.995, 0.989, 0.986, 0.986, 0.987, 0.988, 0.991, 0.993, 0.995, 0.997, 0.999, 1, 1.001, 1.002, 1.002, 1.002, 1.001, 1.001, 1.001, 1.001, 1);
|
|
4827
|
+
}
|
|
4828
|
+
100% {
|
|
4829
|
+
transform: translateY(calc(var(--mochi-size) * 0.295));
|
|
4830
|
+
}
|
|
4618
4831
|
}.celeste-modal-body[data-v-8872ed90] {
|
|
4619
4832
|
padding: var(--spacing-16);
|
|
4620
4833
|
}
|
|
@@ -5739,9 +5952,12 @@ to {
|
|
|
5739
5952
|
width: 20px;
|
|
5740
5953
|
padding: 0;
|
|
5741
5954
|
transition: transform var(--animation-fast) ease-in-out;
|
|
5955
|
+
border: 0;
|
|
5742
5956
|
border-radius: var(--radius-8);
|
|
5743
5957
|
outline: none;
|
|
5958
|
+
background: none;
|
|
5744
5959
|
color: var(--sidebar-foreground);
|
|
5960
|
+
text-decoration: none;
|
|
5745
5961
|
inset-inline-end: var(--spacing-4);
|
|
5746
5962
|
inset-block-start: var(--spacing-8);
|
|
5747
5963
|
aspect-ratio: 1;
|
|
@@ -5845,10 +6061,14 @@ to {
|
|
|
5845
6061
|
height var(--animation-fast) linear,
|
|
5846
6062
|
padding var(--animation-fast) linear,
|
|
5847
6063
|
background-color var(--animation-fast);
|
|
6064
|
+
border: 0;
|
|
5848
6065
|
border-radius: var(--radius-8);
|
|
5849
6066
|
outline: none;
|
|
6067
|
+
background: none;
|
|
6068
|
+
color: var(--sidebar-foreground);
|
|
5850
6069
|
font: var(--label-sm);
|
|
5851
6070
|
text-align: start;
|
|
6071
|
+
text-decoration: none;
|
|
5852
6072
|
gap: var(--spacing-8);
|
|
5853
6073
|
}
|
|
5854
6074
|
.celeste-sidebar-menu-button:hover {
|
|
@@ -5931,9 +6151,12 @@ to {
|
|
|
5931
6151
|
overflow: hidden;
|
|
5932
6152
|
transform: translateX(-1px);
|
|
5933
6153
|
transition: background-color var(--animation-fast);
|
|
6154
|
+
border: 0;
|
|
5934
6155
|
border-radius: var(--radius-8);
|
|
5935
6156
|
outline: none;
|
|
6157
|
+
background: none;
|
|
5936
6158
|
color: var(--sidebar-foreground);
|
|
6159
|
+
text-decoration: none;
|
|
5937
6160
|
gap: var(--spacing-8);
|
|
5938
6161
|
}
|
|
5939
6162
|
.celeste-sidebar-menu-sub-button:hover {
|
|
@@ -5988,12 +6211,14 @@ to {
|
|
|
5988
6211
|
display: flex;
|
|
5989
6212
|
flex-direction: column;
|
|
5990
6213
|
min-width: 0;
|
|
6214
|
+
margin-block: 0;
|
|
5991
6215
|
margin-inline: var(--spacing-16);
|
|
5992
6216
|
padding-block: var(--spacing-4);
|
|
5993
6217
|
padding-inline: var(--spacing-10);
|
|
5994
6218
|
transform: translateX(1px);
|
|
5995
6219
|
gap: var(--spacing-4);
|
|
5996
6220
|
border-inline-start: 1px solid var(--sidebar-border);
|
|
6221
|
+
list-style: none;
|
|
5997
6222
|
}
|
|
5998
6223
|
[data-collapsible='icon'] .celeste-sidebar-menu-sub {
|
|
5999
6224
|
display: none;
|
|
@@ -6004,7 +6229,10 @@ to {
|
|
|
6004
6229
|
flex-direction: column;
|
|
6005
6230
|
width: 100%;
|
|
6006
6231
|
min-width: 0;
|
|
6232
|
+
margin: 0;
|
|
6233
|
+
padding: 0;
|
|
6007
6234
|
gap: var(--spacing-4);
|
|
6235
|
+
list-style: none;
|
|
6008
6236
|
}
|
|
6009
6237
|
|
|
6010
6238
|
:root {
|
|
@@ -91,6 +91,7 @@ const require_tooltip_provider = require("./tooltip-provider.cjs");
|
|
|
91
91
|
const require_tooltip_root = require("./tooltip-root.cjs");
|
|
92
92
|
const require_tooltip = require("./tooltip.cjs");
|
|
93
93
|
const require_label = require("./label2.cjs");
|
|
94
|
+
const require_mochi = require("./mochi.cjs");
|
|
94
95
|
const require_modal_body = require("./modal-body.cjs");
|
|
95
96
|
const require_modal_close = require("./modal-close.cjs");
|
|
96
97
|
const require_modal_content = require("./modal-content.cjs");
|
|
@@ -222,6 +223,7 @@ var components_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
|
222
223
|
HueSlider: () => require_hue_slider.hue_slider_default,
|
|
223
224
|
Label: () => require_label.label_default,
|
|
224
225
|
LinkButton: () => require_link_button.link_button_default,
|
|
226
|
+
Mochi: () => require_mochi.mochi_default,
|
|
225
227
|
Modal: () => require_modal.modal_default,
|
|
226
228
|
ModalBody: () => require_modal_body.modal_body_default,
|
|
227
229
|
ModalClose: () => require_modal_close.modal_close_default,
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
const require_clsx = require("./clsx.cjs");
|
|
2
|
+
const require__plugin_vue_export_helper = require("./_plugin-vue_export-helper.cjs");
|
|
3
|
+
let vue = require("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
|
+
var mochi_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
10
|
+
__name: "mochi",
|
|
11
|
+
props: /*@__PURE__*/ (0, vue.mergeModels)({
|
|
12
|
+
class: { type: [
|
|
13
|
+
Boolean,
|
|
14
|
+
null,
|
|
15
|
+
String,
|
|
16
|
+
Object,
|
|
17
|
+
Array
|
|
18
|
+
] },
|
|
19
|
+
size: { default: 40 },
|
|
20
|
+
animate: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
thinking: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
"idle": {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
"idleModifiers": {}
|
|
34
|
+
}),
|
|
35
|
+
emits: ["update:idle"],
|
|
36
|
+
setup(__props) {
|
|
37
|
+
(0, vue.useCssVars)((_ctx) => ({
|
|
38
|
+
"v51b30026": sizePx.value,
|
|
39
|
+
"v54792142": rotate.value
|
|
40
|
+
}));
|
|
41
|
+
const props = __props;
|
|
42
|
+
const idle = (0, vue.useModel)(__props, "idle");
|
|
43
|
+
const durations = {
|
|
44
|
+
"blink-twice": 440,
|
|
45
|
+
"blink-once": 160,
|
|
46
|
+
"look-blink-twice": 3e3,
|
|
47
|
+
"look-blink-once": 2800
|
|
48
|
+
};
|
|
49
|
+
const weights = [
|
|
50
|
+
["blink-twice", 35],
|
|
51
|
+
["blink-once", 35],
|
|
52
|
+
["look-blink-twice", 15],
|
|
53
|
+
["look-blink-once", 15]
|
|
54
|
+
];
|
|
55
|
+
const rotation = {
|
|
56
|
+
bottom: "0deg",
|
|
57
|
+
right: "-90deg",
|
|
58
|
+
top: "180deg",
|
|
59
|
+
left: "90deg"
|
|
60
|
+
};
|
|
61
|
+
const order = [
|
|
62
|
+
"bottom",
|
|
63
|
+
"right",
|
|
64
|
+
"top",
|
|
65
|
+
"left"
|
|
66
|
+
];
|
|
67
|
+
const anim = (0, vue.ref)("");
|
|
68
|
+
const peek = (0, vue.ref)("");
|
|
69
|
+
const peekSide = (0, vue.ref)("bottom");
|
|
70
|
+
const sizePx = (0, vue.computed)(() => `${props.size}px`);
|
|
71
|
+
const rotate = (0, vue.computed)(() => rotation[peekSide.value]);
|
|
72
|
+
let retired = false;
|
|
73
|
+
let frame;
|
|
74
|
+
let timer;
|
|
75
|
+
let peekTimer;
|
|
76
|
+
function pick() {
|
|
77
|
+
let r = Math.random() * 100;
|
|
78
|
+
for (const [name, weight] of weights) {
|
|
79
|
+
r -= weight;
|
|
80
|
+
if (r <= 0) return name;
|
|
81
|
+
}
|
|
82
|
+
return "blink-twice";
|
|
83
|
+
}
|
|
84
|
+
function cycle() {
|
|
85
|
+
clearTimeout(timer);
|
|
86
|
+
cancelAnimationFrame(frame ?? 0);
|
|
87
|
+
anim.value = "";
|
|
88
|
+
if (!props.animate || peek.value) return;
|
|
89
|
+
frame = requestAnimationFrame(() => {
|
|
90
|
+
const next = pick();
|
|
91
|
+
anim.value = next;
|
|
92
|
+
timer = setTimeout(cycle, durations[next] + 800 + Math.random() * 1600);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
function later(fn, ms) {
|
|
96
|
+
clearTimeout(peekTimer);
|
|
97
|
+
peekTimer = setTimeout(fn, ms);
|
|
98
|
+
}
|
|
99
|
+
function drop() {
|
|
100
|
+
peekSide.value = "bottom";
|
|
101
|
+
peek.value = "drop";
|
|
102
|
+
cycle();
|
|
103
|
+
later(() => {
|
|
104
|
+
peek.value = "out";
|
|
105
|
+
}, DROP_DURATION);
|
|
106
|
+
}
|
|
107
|
+
function settle() {
|
|
108
|
+
peekSide.value = "bottom";
|
|
109
|
+
peek.value = "home";
|
|
110
|
+
later(() => {
|
|
111
|
+
peek.value = "";
|
|
112
|
+
cycle();
|
|
113
|
+
}, SETTLE_DURATION);
|
|
114
|
+
}
|
|
115
|
+
function hop() {
|
|
116
|
+
peek.value = "hidden";
|
|
117
|
+
later(() => {
|
|
118
|
+
const next = order[(order.indexOf(peekSide.value) + 1) % order.length];
|
|
119
|
+
if (next === "bottom") {
|
|
120
|
+
retired = true;
|
|
121
|
+
settle();
|
|
122
|
+
idle.value = false;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
peekSide.value = next;
|
|
126
|
+
peek.value = "out";
|
|
127
|
+
}, HIDE_DURATION);
|
|
128
|
+
}
|
|
129
|
+
function poke() {
|
|
130
|
+
if (peek.value === "out") hop();
|
|
131
|
+
else if (!peek.value && props.animate && !retired) idle.value = true;
|
|
132
|
+
}
|
|
133
|
+
(0, vue.watch)(() => idle.value && props.animate, (active) => {
|
|
134
|
+
if (active && !retired && !peek.value) drop();
|
|
135
|
+
else if (!active && peek.value && peek.value !== "home") {
|
|
136
|
+
peek.value = "hidden";
|
|
137
|
+
later(settle, HIDE_DURATION);
|
|
138
|
+
}
|
|
139
|
+
}, { immediate: true });
|
|
140
|
+
(0, vue.watch)(() => props.animate, cycle);
|
|
141
|
+
(0, vue.onMounted)(cycle);
|
|
142
|
+
(0, vue.onBeforeUnmount)(() => {
|
|
143
|
+
cancelAnimationFrame(frame ?? 0);
|
|
144
|
+
clearTimeout(timer);
|
|
145
|
+
clearTimeout(peekTimer);
|
|
146
|
+
});
|
|
147
|
+
return (_ctx, _cache) => {
|
|
148
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
|
|
149
|
+
class: (0, vue.normalizeClass)((0, vue.unref)(require_clsx.clsx)("celeste-mochi", peek.value && `celeste-mochi-peek-${peek.value}`, props.thinking && "celeste-mochi-thinking", props.class)),
|
|
150
|
+
"data-anim": anim.value || void 0,
|
|
151
|
+
"aria-hidden": "true"
|
|
152
|
+
}, [(0, vue.createElementVNode)("div", { class: "celeste-mochi-stage" }, [(0, vue.createElementVNode)("div", { class: "celeste-mochi-chan" }, [(0, vue.createElementVNode)("div", {
|
|
153
|
+
class: "celeste-mochi-body",
|
|
154
|
+
onClick: poke
|
|
155
|
+
}), _cache[0] || (_cache[0] = (0, vue.createElementVNode)("div", { class: "celeste-mochi-eyes" }, [(0, vue.createElementVNode)("div", { class: "celeste-mochi-eye celeste-mochi-eye-l" }), (0, vue.createElementVNode)("div", { class: "celeste-mochi-eye celeste-mochi-eye-r" })], -1))])])], 10, _hoisted_1);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/components/mochi/mochi.vue
|
|
161
|
+
var mochi_default = /*#__PURE__*/ require__plugin_vue_export_helper._plugin_vue_export_helper_default(mochi_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-ce7048d3"]]);
|
|
162
|
+
//#endregion
|
|
163
|
+
Object.defineProperty(exports, "mochi_default", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function() {
|
|
166
|
+
return mochi_default;
|
|
167
|
+
}
|
|
168
|
+
});
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -99,6 +99,7 @@ const require_tooltip_provider = require("./chunks/tooltip-provider.cjs");
|
|
|
99
99
|
const require_tooltip_root = require("./chunks/tooltip-root.cjs");
|
|
100
100
|
const require_tooltip = require("./chunks/tooltip.cjs");
|
|
101
101
|
const require_label = require("./chunks/label2.cjs");
|
|
102
|
+
const require_mochi = require("./chunks/mochi.cjs");
|
|
102
103
|
const require_modal_body = require("./chunks/modal-body.cjs");
|
|
103
104
|
const require_modal_close = require("./chunks/modal-close.cjs");
|
|
104
105
|
const require_modal_content = require("./chunks/modal-content.cjs");
|
|
@@ -281,6 +282,7 @@ exports.HintText = require_hint_text.hint_text_default;
|
|
|
281
282
|
exports.HueSlider = require_hue_slider.hue_slider_default;
|
|
282
283
|
exports.Label = require_label.label_default;
|
|
283
284
|
exports.LinkButton = require_link_button.link_button_default;
|
|
285
|
+
exports.Mochi = require_mochi.mochi_default;
|
|
284
286
|
exports.Modal = require_modal.modal_default;
|
|
285
287
|
exports.ModalBody = require_modal_body.modal_body_default;
|
|
286
288
|
exports.ModalClose = require_modal_close.modal_close_default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'vue';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
class?: HTMLAttributes['class'];
|
|
4
|
+
size?: number;
|
|
5
|
+
animate?: boolean;
|
|
6
|
+
thinking?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_ModelProps = {
|
|
9
|
+
'idle'?: boolean;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
12
|
+
declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
13
|
+
"update:idle": (value: boolean) => any;
|
|
14
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
|
+
"onUpdate:idle"?: ((value: boolean) => any) | undefined;
|
|
16
|
+
}>, {
|
|
17
|
+
size: number;
|
|
18
|
+
animate: boolean;
|
|
19
|
+
thinking: boolean;
|
|
20
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
@@ -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,
|