zois-core 2.2.1 → 3.0.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.
- package/dist/assets/icons/toast-themes/abdl/bottle.svg +10 -0
- package/dist/assets/icons/toast-themes/abdl/diaper.svg +11 -0
- package/dist/assets/icons/toast-themes/abdl/heart.svg +7 -0
- package/dist/assets/icons/toast-themes/abdl/sparkle.svg +5 -0
- package/dist/assets/icons/toast-themes/abdl/star.svg +5 -0
- package/dist/assets/icons/toast-themes/abdl/teddy.svg +18 -0
- package/dist/assets/icons/toast-themes/anime/error.svg +20 -0
- package/dist/assets/icons/toast-themes/anime/info.svg +20 -0
- package/dist/assets/icons/toast-themes/anime/success.svg +16 -0
- package/dist/assets/icons/toast-themes/anime/warning.svg +19 -0
- package/dist/changelogs.js +628 -295
- package/dist/cssVars.js +46 -0
- package/dist/dialogs.js +523 -83
- package/dist/events.js +28 -6
- package/dist/index.js +27 -70
- package/dist/localization.js +250 -40
- package/dist/messaging.js +1 -1
- package/dist/migration.js +37 -0
- package/dist/modules/baseModule.js +110 -0
- package/dist/modules/index.js +4 -0
- package/dist/modules/loadingStrategy.js +20 -0
- package/dist/modules/moduleContext.js +56 -0
- package/dist/modules/modulesManager.js +175 -0
- package/dist/{modSdk.js → patching.js} +33 -9
- package/dist/rpc.js +139 -0
- package/dist/scripts/zois-core.js +14 -14
- package/dist/settings.js +90 -0
- package/dist/settingsDialog.js +1361 -0
- package/dist/shard-modules/{attributesModule.js → attributes.js} +2 -2
- package/dist/shard-modules/{shardModule.js → base.js} +2 -2
- package/dist/shard-modules/{centerModule.js → center.js} +4 -2
- package/dist/shard-modules/{clickModule.js → click.js} +2 -2
- package/dist/shard-modules/{counterUpModule.js → counterUp.js} +2 -2
- package/dist/shard-modules/{dynamicClassModule.js → dynamicClass.js} +2 -2
- package/dist/shard-modules/index.js +9 -9
- package/dist/shard-modules/{multiClickModule.js → multiClick.js} +2 -2
- package/dist/shard-modules/{styleModule.js → style.js} +2 -2
- package/dist/shard-modules/{typeModule.js → type.js} +2 -2
- package/dist/shards/backNextButton.js +173 -0
- package/dist/shards/{shard.js → base.js} +15 -15
- package/dist/shards/{buttonShard.js → button.js} +30 -52
- package/dist/shards/{cardShard.js → card.js} +4 -4
- package/dist/shards/{checkboxShard.js → checkbox.js} +6 -13
- package/dist/shards/{containerShard.js → container.js} +2 -2
- package/dist/shards/extensionsStorageBar.js +377 -0
- package/dist/shards/fileInput.js +180 -0
- package/dist/shards/flexContainer.js +30 -0
- package/dist/shards/gridContainer.js +34 -0
- package/dist/shards/{imageShard.js → image.js} +8 -6
- package/dist/shards/index.js +17 -13
- package/dist/shards/{inputShard.js → input.js} +4 -4
- package/dist/shards/{inputListShard.js → inputList.js} +22 -4
- package/dist/shards/select.js +201 -0
- package/dist/shards/svg.js +28 -0
- package/dist/shards/{tabsShard.js → tabs.js} +18 -19
- package/dist/shards/{textShard.js → text.js} +4 -4
- package/dist/shared.js +215 -0
- package/dist/styles.css +0 -51
- package/dist/subscreens/customTranslations.js +239 -0
- package/dist/subscreens/languageDetails.js +194 -0
- package/dist/subscreens/localization.js +115 -0
- package/dist/toast-themes/abdl.js +419 -0
- package/dist/toast-themes/anime.js +483 -0
- package/dist/toast-themes/base.js +40 -0
- package/dist/toast-themes/cyber.js +538 -0
- package/dist/toast-themes/default.js +282 -0
- package/dist/toastThemesDialog.js +274 -0
- package/dist/toasts.js +195 -174
- package/dist/types/cssVars.d.ts +1 -0
- package/dist/types/dialogs.d.ts +46 -18
- package/dist/types/events.d.ts +11 -2
- package/dist/types/global.d.ts +4 -3
- package/dist/types/index.d.ts +12 -19
- package/dist/types/localization.d.ts +25 -3
- package/dist/types/migration.d.ts +6 -0
- package/dist/types/modules/baseModule.d.ts +108 -0
- package/dist/types/modules/index.d.ts +4 -0
- package/dist/types/modules/loadingStrategy.d.ts +7 -0
- package/dist/types/modules/moduleContext.d.ts +9 -0
- package/dist/types/modules/modulesManager.d.ts +23 -0
- package/dist/types/{modSdk.d.ts → patching.d.ts} +2 -3
- package/dist/types/rpc.d.ts +72 -0
- package/dist/types/settings.d.ts +19 -0
- package/dist/types/settingsDialog.d.ts +4 -0
- package/dist/types/shard-modules/{attributesModule.d.ts → attributes.d.ts} +2 -2
- package/dist/types/shard-modules/{shardModule.d.ts → base.d.ts} +2 -2
- package/dist/types/shard-modules/{centerModule.d.ts → center.d.ts} +2 -1
- package/dist/types/shard-modules/{clickModule.d.ts → click.d.ts} +2 -2
- package/dist/types/shard-modules/{counterUpModule.d.ts → counterUp.d.ts} +2 -2
- package/dist/types/shard-modules/{dynamicClassModule.d.ts → dynamicClass.d.ts} +2 -2
- package/dist/types/shard-modules/index.d.ts +9 -9
- package/dist/types/shard-modules/{multiClickModule.d.ts → multiClick.d.ts} +2 -2
- package/dist/types/shard-modules/{styleModule.d.ts → style.d.ts} +2 -2
- package/dist/types/shard-modules/{typeModule.d.ts → type.d.ts} +2 -2
- package/dist/types/shards/{backNextButtonShard.d.ts → backNextButton.d.ts} +4 -3
- package/dist/types/shards/{shard.d.ts → base.d.ts} +3 -2
- package/dist/types/shards/{buttonShard.d.ts → button.d.ts} +6 -6
- package/dist/types/shards/{cardShard.d.ts → card.d.ts} +3 -3
- package/dist/types/shards/{checkboxShard.d.ts → checkbox.d.ts} +5 -5
- package/dist/types/shards/{containerShard.d.ts → container.d.ts} +2 -2
- package/dist/types/shards/extensionsStorageBar.d.ts +28 -0
- package/dist/types/shards/fileInput.d.ts +10 -0
- package/dist/types/shards/flexContainer.d.ts +14 -0
- package/dist/types/shards/gridContainer.d.ts +18 -0
- package/dist/types/shards/{imageShard.d.ts → image.d.ts} +2 -2
- package/dist/types/shards/index.d.ts +17 -13
- package/dist/types/shards/{inputShard.d.ts → input.d.ts} +3 -3
- package/dist/types/shards/{inputListShard.d.ts → inputList.d.ts} +3 -2
- package/dist/types/shards/{selectShard.d.ts → select.d.ts} +6 -4
- package/dist/types/shards/svg.d.ts +11 -0
- package/dist/types/shards/{tabsShard.d.ts → tabs.d.ts} +3 -6
- package/dist/types/shards/{textShard.d.ts → text.d.ts} +3 -3
- package/dist/types/shared.d.ts +7 -0
- package/dist/types/subscreens/customTranslations.d.ts +10 -0
- package/dist/types/subscreens/languageDetails.d.ts +14 -0
- package/dist/types/subscreens/localization.d.ts +5 -0
- package/dist/types/toast-themes/abdl.d.ts +9 -0
- package/dist/types/toast-themes/anime.d.ts +9 -0
- package/dist/types/toast-themes/base.d.ts +39 -0
- package/dist/types/toast-themes/cyber.d.ts +10 -0
- package/dist/types/toast-themes/default.d.ts +9 -0
- package/dist/types/toastThemesDialog.d.ts +1 -0
- package/dist/types/toasts.d.ts +48 -36
- package/dist/types/ui.d.ts +128 -49
- package/dist/types/validation.d.ts +5 -0
- package/dist/ui.js +414 -79
- package/dist/validation.js +79 -1
- package/dist/wardrobe.js +2 -2
- package/package.json +36 -14
- package/dist/core-subscreen/coreSubscreen.js +0 -81
- package/dist/core-subscreen/developmentSubscreen.js +0 -22
- package/dist/core-subscreen/generalSubscreen.js +0 -23
- package/dist/core-subscreen/mainSubscreen.js +0 -58
- package/dist/core-subscreen/shards/coreButtonShard.js +0 -30
- package/dist/core-subscreen/shards/coreCheckboxShard.js +0 -33
- package/dist/core-subscreen/shards/coreInputListShard.js +0 -38
- package/dist/core-subscreen/shards/coreSelectShard.js +0 -17
- package/dist/core-subscreen/shards/coreTextShard.js +0 -9
- package/dist/core-subscreen/shards/index.js +0 -5
- package/dist/core-subscreen/toastsSubscreen.js +0 -111
- package/dist/core.js +0 -192
- package/dist/shards/backNextButtonShard.js +0 -99
- package/dist/shards/selectShard.js +0 -131
- package/dist/shards/svgShard.js +0 -29
- package/dist/types/core-subscreen/coreSubscreen.d.ts +0 -15
- package/dist/types/core-subscreen/developmentSubscreen.d.ts +0 -5
- package/dist/types/core-subscreen/generalSubscreen.d.ts +0 -5
- package/dist/types/core-subscreen/mainSubscreen.d.ts +0 -6
- package/dist/types/core-subscreen/shards/coreButtonShard.d.ts +0 -5
- package/dist/types/core-subscreen/shards/coreCheckboxShard.d.ts +0 -6
- package/dist/types/core-subscreen/shards/coreInputListShard.d.ts +0 -6
- package/dist/types/core-subscreen/shards/coreSelectShard.d.ts +0 -5
- package/dist/types/core-subscreen/shards/coreTextShard.d.ts +0 -4
- package/dist/types/core-subscreen/shards/index.d.ts +0 -5
- package/dist/types/core-subscreen/toastsSubscreen.d.ts +0 -5
- package/dist/types/core.d.ts +0 -18
- package/dist/types/shards/svgShard.d.ts +0 -12
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
import {
|
|
2
|
+
X,
|
|
3
|
+
Palette,
|
|
4
|
+
createElement
|
|
5
|
+
} from "lucide";
|
|
6
|
+
import { getDynamicClass, getDynamicKeyframes } from "../ui";
|
|
7
|
+
import { ToastTheme, ToastThemeTier } from "./base";
|
|
8
|
+
import { dismissToast } from "../toasts";
|
|
9
|
+
import infoSvg from "../assets/icons/toast-themes/anime/info.svg";
|
|
10
|
+
import warningSvg from "../assets/icons/toast-themes/anime/warning.svg";
|
|
11
|
+
import errorSvg from "../assets/icons/toast-themes/anime/error.svg";
|
|
12
|
+
import successSvg from "../assets/icons/toast-themes/anime/success.svg";
|
|
13
|
+
import { hookFunction, HookPriority } from "../patching";
|
|
14
|
+
import { createThemesDialog } from "../toastThemesDialog";
|
|
15
|
+
import { getSettings } from "../settings";
|
|
16
|
+
import { jsx, jsxs } from "tsx-dom/jsx-runtime";
|
|
17
|
+
const FIXED_UNIT = 10;
|
|
18
|
+
const BACKGROUND_COLOR = "#15122b";
|
|
19
|
+
const ACCENT_COLOR = {
|
|
20
|
+
info: "#5cc8ff",
|
|
21
|
+
warning: "#ffcf3d",
|
|
22
|
+
error: "#ff4d6d",
|
|
23
|
+
success: "#6dffb0",
|
|
24
|
+
spinner: "#ff9ecb"
|
|
25
|
+
};
|
|
26
|
+
const LABEL = {
|
|
27
|
+
info: "\u60C5\u5831",
|
|
28
|
+
warning: "\u8B66\u544A",
|
|
29
|
+
error: "\u30A8\u30E9\u30FC",
|
|
30
|
+
success: "\u6210\u529F",
|
|
31
|
+
spinner: "\u8AAD\u8FBC\u4E2D"
|
|
32
|
+
};
|
|
33
|
+
const ICON_SVG = {
|
|
34
|
+
info: infoSvg,
|
|
35
|
+
warning: warningSvg,
|
|
36
|
+
error: errorSvg,
|
|
37
|
+
success: successSvg
|
|
38
|
+
};
|
|
39
|
+
const PETALS = [
|
|
40
|
+
{ left: "28%", duration: "4.2s", delay: "0s" },
|
|
41
|
+
{ left: "52%", duration: "5.1s", delay: "1.3s" },
|
|
42
|
+
{ left: "74%", duration: "4.6s", delay: "2.4s" },
|
|
43
|
+
{ left: "90%", duration: "5.6s", delay: "0.7s" }
|
|
44
|
+
];
|
|
45
|
+
let keyframes;
|
|
46
|
+
function \u0441haracterIsWearingFullCosplayGirl(C) {
|
|
47
|
+
const requiredPieces = [
|
|
48
|
+
{ group: "Cloth", name: "AnimeGirl" },
|
|
49
|
+
{ group: "Shoes", name: "AnimeGirlBoots" },
|
|
50
|
+
{ group: "Gloves", name: "AnimeGirlGloves" },
|
|
51
|
+
{ group: "Hat", name: "AnimeGirlTiara" },
|
|
52
|
+
{ group: "Necklace", name: "AnimeGirlNecklace" }
|
|
53
|
+
];
|
|
54
|
+
if (!C || !C.Appearance) return false;
|
|
55
|
+
return requiredPieces.every(({ group, name }) => {
|
|
56
|
+
const item = InventoryGet(C, group);
|
|
57
|
+
return !!item && item.Asset.Name === name;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function ensureStyles() {
|
|
61
|
+
if (keyframes) return keyframes;
|
|
62
|
+
keyframes = {
|
|
63
|
+
burst: getDynamicKeyframes("anime-burst", {
|
|
64
|
+
from: { transform: "translate(-50%, -50%) rotate(0deg)" },
|
|
65
|
+
to: { transform: "translate(-50%, -50%) rotate(360deg)" }
|
|
66
|
+
}),
|
|
67
|
+
petal: getDynamicKeyframes("anime-petal", {
|
|
68
|
+
"0%": { opacity: "0", transform: "translate(0, 0) rotate(0deg)" },
|
|
69
|
+
"12%": { opacity: "0.9" },
|
|
70
|
+
"100%": { opacity: "0", transform: "translate(-3.2em, 5.5em) rotate(540deg)" }
|
|
71
|
+
}),
|
|
72
|
+
ring: getDynamicKeyframes("anime-ring", {
|
|
73
|
+
"0%": { transform: "scale(1)", opacity: "0.9" },
|
|
74
|
+
"100%": { transform: "scale(1.8)", opacity: "0" }
|
|
75
|
+
}),
|
|
76
|
+
spin: getDynamicKeyframes("anime-spin", {
|
|
77
|
+
from: { transform: "rotate(0deg)" },
|
|
78
|
+
to: { transform: "rotate(360deg)" }
|
|
79
|
+
}),
|
|
80
|
+
spinReverse: getDynamicKeyframes("anime-spin-reverse", {
|
|
81
|
+
from: { transform: "rotate(360deg)" },
|
|
82
|
+
to: { transform: "rotate(0deg)" }
|
|
83
|
+
}),
|
|
84
|
+
pulse: getDynamicKeyframes("anime-pulse", {
|
|
85
|
+
"0%": { transform: "scale(0.6)", opacity: "0.6" },
|
|
86
|
+
"50%": { transform: "scale(1.15)", opacity: "1" },
|
|
87
|
+
"100%": { transform: "scale(0.6)", opacity: "0.6" }
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
return keyframes;
|
|
91
|
+
}
|
|
92
|
+
function decodeSvg(source) {
|
|
93
|
+
if (!source.startsWith("data:")) {
|
|
94
|
+
return new TextDecoder().decode(Uint8Array.from(atob(source), (c) => c.charCodeAt(0)));
|
|
95
|
+
}
|
|
96
|
+
const comma = source.indexOf(",");
|
|
97
|
+
const payload = source.slice(comma + 1);
|
|
98
|
+
if (!source.slice(0, comma).includes(";base64")) return decodeURIComponent(payload);
|
|
99
|
+
return new TextDecoder().decode(Uint8Array.from(atob(payload), (c) => c.charCodeAt(0)));
|
|
100
|
+
}
|
|
101
|
+
function getCharacterIcon(type, accent) {
|
|
102
|
+
const o = "0.045em";
|
|
103
|
+
const className = getDynamicClass({
|
|
104
|
+
base: { display: "flex", width: "1.68em", height: "1.68em", position: "relative", zIndex: "1" },
|
|
105
|
+
">svg": {
|
|
106
|
+
width: "100%",
|
|
107
|
+
height: "100%",
|
|
108
|
+
display: "block",
|
|
109
|
+
overflow: "visible",
|
|
110
|
+
filter: `drop-shadow(${o} 0 0 ${accent}) drop-shadow(-${o} 0 0 ${accent}) drop-shadow(0 ${o} 0 ${accent}) drop-shadow(0 -${o} 0 ${accent})`
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const holder = document.createElement("span");
|
|
114
|
+
holder.className = className;
|
|
115
|
+
holder.innerHTML = decodeSvg(ICON_SVG[type]);
|
|
116
|
+
const svg = holder.querySelector("svg");
|
|
117
|
+
if (svg) svg.style.color = accent;
|
|
118
|
+
return holder;
|
|
119
|
+
}
|
|
120
|
+
function getSpinnerIcon(accent, kf) {
|
|
121
|
+
const containerClass = getDynamicClass({
|
|
122
|
+
base: {
|
|
123
|
+
position: "relative",
|
|
124
|
+
width: "1.68em",
|
|
125
|
+
height: "1.68em",
|
|
126
|
+
zIndex: "1"
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
const outerClass = getDynamicClass({
|
|
130
|
+
base: {
|
|
131
|
+
position: "absolute",
|
|
132
|
+
top: "0",
|
|
133
|
+
left: "0",
|
|
134
|
+
right: "0",
|
|
135
|
+
bottom: "0",
|
|
136
|
+
boxSizing: "border-box",
|
|
137
|
+
borderRadius: "50%",
|
|
138
|
+
border: "0.12em solid transparent",
|
|
139
|
+
borderTopColor: accent,
|
|
140
|
+
borderBottomColor: `${accent}55`,
|
|
141
|
+
animation: `${kf.spin} 1.1s linear infinite`
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
const innerClass = getDynamicClass({
|
|
145
|
+
base: {
|
|
146
|
+
position: "absolute",
|
|
147
|
+
top: "20%",
|
|
148
|
+
left: "20%",
|
|
149
|
+
right: "20%",
|
|
150
|
+
bottom: "20%",
|
|
151
|
+
boxSizing: "border-box",
|
|
152
|
+
borderRadius: "50%",
|
|
153
|
+
border: "0.1em solid transparent",
|
|
154
|
+
borderLeftColor: "#ffffff",
|
|
155
|
+
borderRightColor: `${accent}88`,
|
|
156
|
+
animation: `${kf.spinReverse} 0.8s linear infinite`
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
const dotClass = getDynamicClass({
|
|
160
|
+
base: {
|
|
161
|
+
position: "absolute",
|
|
162
|
+
top: "40%",
|
|
163
|
+
left: "40%",
|
|
164
|
+
right: "40%",
|
|
165
|
+
bottom: "40%",
|
|
166
|
+
borderRadius: "50%",
|
|
167
|
+
background: accent,
|
|
168
|
+
boxShadow: `0 0 0.4em ${accent}`,
|
|
169
|
+
animation: `${kf.pulse} 1s ease-in-out infinite`
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const el = /* @__PURE__ */ jsxs("div", { class: containerClass, children: [
|
|
173
|
+
/* @__PURE__ */ jsx("div", { class: outerClass }),
|
|
174
|
+
/* @__PURE__ */ jsx("div", { class: innerClass }),
|
|
175
|
+
/* @__PURE__ */ jsx("div", { class: dotClass })
|
|
176
|
+
] });
|
|
177
|
+
return el;
|
|
178
|
+
}
|
|
179
|
+
class AnimeToastTheme extends ToastTheme {
|
|
180
|
+
name = "Anime";
|
|
181
|
+
details = "Very first SSR theme with amazing style.\nUnlocks when you put on a full Cosplay Girl suit.";
|
|
182
|
+
tier = ToastThemeTier.SSR;
|
|
183
|
+
init() {
|
|
184
|
+
hookFunction("CharacterRefresh", HookPriority.OBSERVE, (args, next) => {
|
|
185
|
+
const result = next(args);
|
|
186
|
+
if (this.isUnlocked) return;
|
|
187
|
+
const C = args[0];
|
|
188
|
+
if (C && C.IsPlayer?.()) {
|
|
189
|
+
if (\u0441haracterIsWearingFullCosplayGirl(C)) this.unlock();
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
render(renderData) {
|
|
195
|
+
renderData.isInteractable ??= true;
|
|
196
|
+
const kf = ensureStyles();
|
|
197
|
+
const pos = getSettings().toasts?.position ?? "bottom-left";
|
|
198
|
+
const accent = ACCENT_COLOR[renderData.type];
|
|
199
|
+
const textColor = "#d9d4f2";
|
|
200
|
+
const titleColor = "#ffffff";
|
|
201
|
+
const toastClassName = getDynamicClass({
|
|
202
|
+
base: {
|
|
203
|
+
display: "flex",
|
|
204
|
+
columnGap: "0.6em",
|
|
205
|
+
alignItems: "flex-start",
|
|
206
|
+
maxWidth: "25vw",
|
|
207
|
+
position: "relative",
|
|
208
|
+
overflow: "hidden",
|
|
209
|
+
background: `linear-gradient(135deg, ${BACKGROUND_COLOR} 0%, #231a45 100%)`,
|
|
210
|
+
border: `2px solid ${accent}`,
|
|
211
|
+
borderRadius: "0.15em",
|
|
212
|
+
clipPath: "polygon(0.8em 0, 100% 0, 100% calc(100% - 0.8em), calc(100% - 0.8em) 100%, 0 100%, 0 0.8em)"
|
|
213
|
+
},
|
|
214
|
+
"::before": {
|
|
215
|
+
content: '""',
|
|
216
|
+
position: "absolute",
|
|
217
|
+
top: "50%",
|
|
218
|
+
left: "1.6em",
|
|
219
|
+
width: "26em",
|
|
220
|
+
height: "26em",
|
|
221
|
+
background: `repeating-conic-gradient(from 0deg, ${accent}40 0deg 3deg, transparent 3deg 9deg)`,
|
|
222
|
+
maskImage: "radial-gradient(circle, black 5%, transparent 62%)",
|
|
223
|
+
animation: `${kf.burst} 18s linear infinite`,
|
|
224
|
+
pointerEvents: "none",
|
|
225
|
+
zIndex: "0"
|
|
226
|
+
},
|
|
227
|
+
"::after": {
|
|
228
|
+
content: '""',
|
|
229
|
+
position: "absolute",
|
|
230
|
+
top: "0",
|
|
231
|
+
right: "0",
|
|
232
|
+
width: "55%",
|
|
233
|
+
height: "100%",
|
|
234
|
+
backgroundImage: `radial-gradient(circle, ${accent}77 0.07em, transparent 0.1em)`,
|
|
235
|
+
backgroundSize: "0.45em 0.45em",
|
|
236
|
+
maskImage: "linear-gradient(115deg, transparent 40%, black 100%)",
|
|
237
|
+
opacity: "0.55",
|
|
238
|
+
pointerEvents: "none",
|
|
239
|
+
zIndex: "0"
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
const iconColumnClass = getDynamicClass({
|
|
243
|
+
base: {
|
|
244
|
+
flexShrink: "0",
|
|
245
|
+
alignSelf: "flex-start",
|
|
246
|
+
position: "relative",
|
|
247
|
+
zIndex: "1",
|
|
248
|
+
margin: "0"
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
const petalClassName = getDynamicClass({
|
|
252
|
+
base: {
|
|
253
|
+
position: "absolute",
|
|
254
|
+
top: "-0.8em",
|
|
255
|
+
width: "0.55em",
|
|
256
|
+
height: "0.4em",
|
|
257
|
+
background: "#ffb7d5",
|
|
258
|
+
borderRadius: "100% 0 100% 0",
|
|
259
|
+
opacity: "0",
|
|
260
|
+
pointerEvents: "none",
|
|
261
|
+
zIndex: "1"
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
const tagClassName = getDynamicClass({
|
|
265
|
+
base: {
|
|
266
|
+
display: "block",
|
|
267
|
+
width: "fit-content",
|
|
268
|
+
marginBottom: "0.25em",
|
|
269
|
+
padding: "0.05em 0.9em 0.05em 0.7em",
|
|
270
|
+
fontSize: "0.55em",
|
|
271
|
+
fontWeight: "800",
|
|
272
|
+
letterSpacing: "0.1em",
|
|
273
|
+
color: BACKGROUND_COLOR,
|
|
274
|
+
background: accent,
|
|
275
|
+
clipPath: "polygon(0 0, 100% 0, calc(100% - 0.6em) 100%, 0 100%)"
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
const buttonsContainerClassName = getDynamicClass({
|
|
279
|
+
base: {
|
|
280
|
+
display: "flex",
|
|
281
|
+
gap: "0.4em",
|
|
282
|
+
marginTop: "0.4em",
|
|
283
|
+
flexWrap: "wrap",
|
|
284
|
+
position: "relative",
|
|
285
|
+
zIndex: "3"
|
|
286
|
+
},
|
|
287
|
+
">button": {
|
|
288
|
+
flexShrink: "0",
|
|
289
|
+
background: accent,
|
|
290
|
+
border: "none",
|
|
291
|
+
color: BACKGROUND_COLOR,
|
|
292
|
+
fontWeight: "800",
|
|
293
|
+
fontSize: "0.8em",
|
|
294
|
+
padding: "0.2em 1em",
|
|
295
|
+
clipPath: "polygon(0.4em 0, 100% 0, calc(100% - 0.4em) 100%, 0 100%)",
|
|
296
|
+
cursor: "pointer",
|
|
297
|
+
transition: "transform 0.15s ease, filter 0.15s ease"
|
|
298
|
+
},
|
|
299
|
+
">button:hover": {
|
|
300
|
+
transform: "translateY(-0.1em)",
|
|
301
|
+
filter: "brightness(1.15)"
|
|
302
|
+
},
|
|
303
|
+
">button:active": {
|
|
304
|
+
transform: "translateY(0.05em)"
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
const actionsClassName = getDynamicClass({
|
|
308
|
+
base: {
|
|
309
|
+
position: "absolute",
|
|
310
|
+
top: "0.4em",
|
|
311
|
+
right: "0.35em",
|
|
312
|
+
display: "flex",
|
|
313
|
+
gap: "0.1em",
|
|
314
|
+
zIndex: "10"
|
|
315
|
+
},
|
|
316
|
+
">button": {
|
|
317
|
+
background: "transparent",
|
|
318
|
+
border: "none",
|
|
319
|
+
cursor: "pointer",
|
|
320
|
+
padding: "0.1em",
|
|
321
|
+
display: "flex",
|
|
322
|
+
alignItems: "center",
|
|
323
|
+
justifyContent: "center",
|
|
324
|
+
opacity: "0.75",
|
|
325
|
+
color: titleColor,
|
|
326
|
+
borderRadius: "0.15em",
|
|
327
|
+
transition: "opacity 0.15s ease, background 0.15s ease, transform 0.15s ease"
|
|
328
|
+
},
|
|
329
|
+
">button:hover": {
|
|
330
|
+
opacity: "1",
|
|
331
|
+
background: `${accent}44`,
|
|
332
|
+
transform: "rotate(90deg)"
|
|
333
|
+
},
|
|
334
|
+
">button>svg": {
|
|
335
|
+
width: "0.9em",
|
|
336
|
+
height: "0.9em"
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
const closeIcon = createElement(X);
|
|
340
|
+
const paletteIcon = createElement(Palette);
|
|
341
|
+
const icon = renderData.type === "spinner" ? getSpinnerIcon(accent, kf) : getCharacterIcon(renderData.type, accent);
|
|
342
|
+
const toast = /* @__PURE__ */ jsxs(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
class: toastClassName,
|
|
346
|
+
"data-zc-toast-type": renderData.type,
|
|
347
|
+
"data-zc-toast-id": renderData.id,
|
|
348
|
+
children: [
|
|
349
|
+
renderData.type !== "spinner" && renderData.duration !== 0 && /* @__PURE__ */ jsx(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
class: "zcToast-ProgressBar",
|
|
353
|
+
style: {
|
|
354
|
+
animation: `zcToast-progress ${renderData.duration}ms linear 0s 1 alternate none`,
|
|
355
|
+
position: "absolute",
|
|
356
|
+
top: "0",
|
|
357
|
+
left: "0",
|
|
358
|
+
height: "100%",
|
|
359
|
+
background: `linear-gradient(90deg, ${accent}38, ${accent}10)`,
|
|
360
|
+
zIndex: "0"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
PETALS.map((p) => /* @__PURE__ */ jsx(
|
|
365
|
+
"span",
|
|
366
|
+
{
|
|
367
|
+
class: petalClassName,
|
|
368
|
+
style: {
|
|
369
|
+
left: p.left,
|
|
370
|
+
animation: `${kf.petal} ${p.duration} linear ${p.delay} infinite`
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
)),
|
|
374
|
+
/* @__PURE__ */ jsxs("div", { class: actionsClassName, children: [
|
|
375
|
+
/* @__PURE__ */ jsx(
|
|
376
|
+
"button",
|
|
377
|
+
{
|
|
378
|
+
type: "button",
|
|
379
|
+
title: "Theme menu",
|
|
380
|
+
onClick: (e) => {
|
|
381
|
+
e.stopPropagation();
|
|
382
|
+
if (!renderData.isInteractable) return;
|
|
383
|
+
createThemesDialog();
|
|
384
|
+
},
|
|
385
|
+
children: paletteIcon
|
|
386
|
+
}
|
|
387
|
+
),
|
|
388
|
+
/* @__PURE__ */ jsx(
|
|
389
|
+
"button",
|
|
390
|
+
{
|
|
391
|
+
type: "button",
|
|
392
|
+
title: "Close",
|
|
393
|
+
onClick: (e) => {
|
|
394
|
+
e.stopPropagation();
|
|
395
|
+
if (!renderData.isInteractable) return;
|
|
396
|
+
dismissToast(toast);
|
|
397
|
+
},
|
|
398
|
+
children: closeIcon
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
] }),
|
|
402
|
+
/* @__PURE__ */ jsx("div", { class: iconColumnClass, children: icon }),
|
|
403
|
+
/* @__PURE__ */ jsxs(
|
|
404
|
+
"div",
|
|
405
|
+
{
|
|
406
|
+
style: {
|
|
407
|
+
width: "100%",
|
|
408
|
+
minWidth: "0",
|
|
409
|
+
paddingRight: "2.5em",
|
|
410
|
+
position: "relative",
|
|
411
|
+
zIndex: "1"
|
|
412
|
+
},
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ jsx("span", { class: tagClassName, children: LABEL[renderData.type] }),
|
|
415
|
+
!!renderData.title && /* @__PURE__ */ jsx(
|
|
416
|
+
"p",
|
|
417
|
+
{
|
|
418
|
+
style: {
|
|
419
|
+
color: titleColor,
|
|
420
|
+
fontWeight: "800",
|
|
421
|
+
fontStyle: "italic",
|
|
422
|
+
fontSize: "0.9em",
|
|
423
|
+
margin: "0",
|
|
424
|
+
overflow: "hidden",
|
|
425
|
+
textOverflow: "ellipsis",
|
|
426
|
+
whiteSpace: "nowrap",
|
|
427
|
+
width: "100%",
|
|
428
|
+
textShadow: `0.06em 0.06em 0 ${accent}88`
|
|
429
|
+
},
|
|
430
|
+
children: renderData.title
|
|
431
|
+
}
|
|
432
|
+
),
|
|
433
|
+
/* @__PURE__ */ jsx(
|
|
434
|
+
"p",
|
|
435
|
+
{
|
|
436
|
+
style: {
|
|
437
|
+
color: textColor,
|
|
438
|
+
fontSize: !!renderData.title ? "0.72em" : "0.85em",
|
|
439
|
+
overflowWrap: "anywhere",
|
|
440
|
+
fontWeight: !!renderData.title ? "400" : "700",
|
|
441
|
+
margin: "0",
|
|
442
|
+
marginTop: !!renderData.title ? "0.15em" : void 0,
|
|
443
|
+
lineHeight: "1.3"
|
|
444
|
+
},
|
|
445
|
+
children: renderData.message
|
|
446
|
+
}
|
|
447
|
+
),
|
|
448
|
+
renderData.buttons !== void 0 && /* @__PURE__ */ jsx("div", { class: buttonsContainerClassName, children: renderData.buttons.map((b) => /* @__PURE__ */ jsx(
|
|
449
|
+
"button",
|
|
450
|
+
{
|
|
451
|
+
type: "button",
|
|
452
|
+
onClick: () => {
|
|
453
|
+
if (!renderData.isInteractable) return;
|
|
454
|
+
b.action();
|
|
455
|
+
},
|
|
456
|
+
children: b.name
|
|
457
|
+
}
|
|
458
|
+
)) })
|
|
459
|
+
]
|
|
460
|
+
}
|
|
461
|
+
)
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
);
|
|
465
|
+
const sz = (value) => renderData.size.scaleWithCanvas ? `calc(var(--size-unit) * ${value * renderData.size.scaleFactor}px)` : `${value * renderData.size.scaleFactor * FIXED_UNIT}px`;
|
|
466
|
+
toast.style.fontSize = sz(2.15);
|
|
467
|
+
toast.style.padding = `${sz(0.85)} ${sz(0.95)}`;
|
|
468
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideInFromLeft" : "zcSlideInFromRight"} 0.3s ease-out forwards`;
|
|
469
|
+
void toast.offsetHeight;
|
|
470
|
+
if (renderData.type !== "spinner" && renderData.duration !== 0) {
|
|
471
|
+
setTimeout(() => {
|
|
472
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideOutToLeft" : "zcSlideOutToRight"} 0.3s ease-out forwards`;
|
|
473
|
+
}, renderData.duration);
|
|
474
|
+
setTimeout(() => toast.remove(), renderData.duration + 300);
|
|
475
|
+
}
|
|
476
|
+
return toast;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
const animeToastTheme = new AnimeToastTheme();
|
|
480
|
+
export {
|
|
481
|
+
AnimeToastTheme,
|
|
482
|
+
animeToastTheme
|
|
483
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getOrCreateToastsContainer } from "../toasts";
|
|
2
|
+
import { getSettings } from "../settings";
|
|
3
|
+
import { isToastThemeUnlocked, setActiveToastTheme, unlockToastTheme } from "../toasts";
|
|
4
|
+
var ToastThemeTier = /* @__PURE__ */ ((ToastThemeTier2) => {
|
|
5
|
+
ToastThemeTier2["R"] = "R";
|
|
6
|
+
ToastThemeTier2["SR"] = "SR";
|
|
7
|
+
ToastThemeTier2["SSR"] = "SSR";
|
|
8
|
+
return ToastThemeTier2;
|
|
9
|
+
})(ToastThemeTier || {});
|
|
10
|
+
class ToastTheme {
|
|
11
|
+
get isUnlocked() {
|
|
12
|
+
return isToastThemeUnlocked(this);
|
|
13
|
+
}
|
|
14
|
+
unlock() {
|
|
15
|
+
unlockToastTheme(this);
|
|
16
|
+
const toast = this.render({
|
|
17
|
+
message: `Toast theme "${this.name}" unlocked`,
|
|
18
|
+
type: "info",
|
|
19
|
+
size: {
|
|
20
|
+
scaleWithCanvas: true,
|
|
21
|
+
scaleFactor: getSettings().toasts?.scaleFactor ?? 1
|
|
22
|
+
},
|
|
23
|
+
id: `${this.name}-unlocking-notification`,
|
|
24
|
+
duration: 1e4,
|
|
25
|
+
buttons: [
|
|
26
|
+
{
|
|
27
|
+
name: "Apply theme",
|
|
28
|
+
action: () => {
|
|
29
|
+
setActiveToastTheme(this);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
getOrCreateToastsContainer().append(toast);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
ToastTheme,
|
|
39
|
+
ToastThemeTier
|
|
40
|
+
};
|