zois-core 2.2.0 → 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 +18 -0
- 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 +37 -15
- 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
- package/scripts/zois-core.mjs +0 -184
|
@@ -0,0 +1,419 @@
|
|
|
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 { createThemesDialog } from "../toastThemesDialog";
|
|
10
|
+
import { getSettings } from "../settings";
|
|
11
|
+
import heartSvg from "../assets/icons/toast-themes/abdl/heart.svg";
|
|
12
|
+
import starSvg from "../assets/icons/toast-themes/abdl/star.svg";
|
|
13
|
+
import sparkleSvg from "../assets/icons/toast-themes/abdl/sparkle.svg";
|
|
14
|
+
import bottleSvg from "../assets/icons/toast-themes/abdl/bottle.svg";
|
|
15
|
+
import diaperSvg from "../assets/icons/toast-themes/abdl/diaper.svg";
|
|
16
|
+
import teddySvg from "../assets/icons/toast-themes/abdl/teddy.svg";
|
|
17
|
+
import { hookFunction, HookPriority } from "../patching";
|
|
18
|
+
import { jsx, jsxs } from "tsx-dom/jsx-runtime";
|
|
19
|
+
const FIXED_UNIT = 10;
|
|
20
|
+
const OUTLINE_COLOR = "#6b4f7a";
|
|
21
|
+
const TITLE_COLOR = "#5a3f6b";
|
|
22
|
+
const TEXT_COLOR = "#6f5a7e";
|
|
23
|
+
const ART_STROKE = "#b9a5d8";
|
|
24
|
+
const NURSERY_ROOM_NAME = "ABDL Nursery";
|
|
25
|
+
const ACCENT_COLOR = {
|
|
26
|
+
info: "#6fb8f0",
|
|
27
|
+
warning: "#f7b84b",
|
|
28
|
+
error: "#ff6f9c",
|
|
29
|
+
success: "#5fd3a5",
|
|
30
|
+
spinner: "#b69cf0"
|
|
31
|
+
};
|
|
32
|
+
const TINT_COLOR = {
|
|
33
|
+
info: "#eaf5ff",
|
|
34
|
+
warning: "#fff6df",
|
|
35
|
+
error: "#ffe9f1",
|
|
36
|
+
success: "#e8faf2",
|
|
37
|
+
spinner: "#f2ecff"
|
|
38
|
+
};
|
|
39
|
+
const FLOATERS = [
|
|
40
|
+
{ left: "30%", size: "0.9em", source: heartSvg, color: "#ffb3cf", duration: "5.2s", delay: "0s" },
|
|
41
|
+
{ left: "55%", size: "0.75em", source: starSvg, color: "#ffe08a", duration: "6s", delay: "1.6s" },
|
|
42
|
+
{ left: "76%", size: "0.9em", source: heartSvg, color: "#cdb8f5", duration: "5.6s", delay: "2.8s" },
|
|
43
|
+
{ left: "91%", size: "0.675em", source: starSvg, color: "#a8dcfa", duration: "6.4s", delay: "0.9s" }
|
|
44
|
+
];
|
|
45
|
+
let keyframes;
|
|
46
|
+
function ensureStyles() {
|
|
47
|
+
if (keyframes) return keyframes;
|
|
48
|
+
keyframes = {
|
|
49
|
+
float: getDynamicKeyframes("abdl-float", {
|
|
50
|
+
"0%": { opacity: "0", transform: "translate(0, 0) rotate(0deg) scale(0.6)" },
|
|
51
|
+
"15%": { opacity: "0.9" },
|
|
52
|
+
"100%": { opacity: "0", transform: "translate(0.8em, -5em) rotate(25deg) scale(1)" }
|
|
53
|
+
}),
|
|
54
|
+
sway: getDynamicKeyframes("abdl-sway", {
|
|
55
|
+
"0%, 100%": { transform: "rotate(-4deg) scale(1)" },
|
|
56
|
+
"50%": { transform: "rotate(4deg) scale(1.08)" }
|
|
57
|
+
}),
|
|
58
|
+
beat: getDynamicKeyframes("abdl-beat", {
|
|
59
|
+
"0%, 100%": { transform: "scale(1)" },
|
|
60
|
+
"15%": { transform: "scale(1.3)" },
|
|
61
|
+
"30%": { transform: "scale(1)" },
|
|
62
|
+
"45%": { transform: "scale(1.2)" },
|
|
63
|
+
"60%": { transform: "scale(1)" }
|
|
64
|
+
})
|
|
65
|
+
};
|
|
66
|
+
return keyframes;
|
|
67
|
+
}
|
|
68
|
+
function decodeSvg(source) {
|
|
69
|
+
if (!source.startsWith("data:")) {
|
|
70
|
+
return new TextDecoder().decode(Uint8Array.from(atob(source), (c) => c.charCodeAt(0)));
|
|
71
|
+
}
|
|
72
|
+
const comma = source.indexOf(",");
|
|
73
|
+
const payload = source.slice(comma + 1);
|
|
74
|
+
if (!source.slice(0, comma).includes(";base64")) return decodeURIComponent(payload);
|
|
75
|
+
return new TextDecoder().decode(Uint8Array.from(atob(payload), (c) => c.charCodeAt(0)));
|
|
76
|
+
}
|
|
77
|
+
function toDataUrl(svg) {
|
|
78
|
+
return `url("data:image/svg+xml,${encodeURIComponent(svg)}")`;
|
|
79
|
+
}
|
|
80
|
+
function parseSvg(source) {
|
|
81
|
+
const svg = decodeSvg(source);
|
|
82
|
+
const match = svg.match(/<svg([^>]*)>([\s\S]*)<\/svg>/);
|
|
83
|
+
const viewBox = match?.[1].match(/viewBox="([^"]+)"/)?.[1] ?? "0 0 32 32";
|
|
84
|
+
return { viewBox, inner: match?.[2] ?? "" };
|
|
85
|
+
}
|
|
86
|
+
function recolorSvg(source, color) {
|
|
87
|
+
return decodeSvg(source).replace(/style="color:[^"]*"/, `style="color:${color}"`).split(OUTLINE_COLOR).join(ART_STROKE);
|
|
88
|
+
}
|
|
89
|
+
const ART = [
|
|
90
|
+
{ source: bottleSvg, x: 32, y: 46, rot: -14, scale: 0.72 },
|
|
91
|
+
{ source: starSvg, x: 68, y: 18, scale: 1.2, color: "#ffe08a" },
|
|
92
|
+
{ source: heartSvg, x: 76, y: 72, rot: -10, scale: 0.825, color: "#cdb8f5" },
|
|
93
|
+
{ source: sparkleSvg, x: 132, y: 16, scale: 0.9, color: "#ffffff" },
|
|
94
|
+
{ source: heartSvg, x: 134, y: 74, rot: 12, scale: 0.75, color: "#ffb3cf" },
|
|
95
|
+
{ source: diaperSvg, x: 164, y: 46, rot: -8, scale: 0.7 },
|
|
96
|
+
{ source: starSvg, x: 198, y: 16, scale: 1.05, color: "#a8dcfa" },
|
|
97
|
+
{ source: heartSvg, x: 198, y: 74, rot: -12, scale: 0.825, color: "#9fe3c8" },
|
|
98
|
+
{ source: teddySvg, x: 228, y: 46, rot: 6, scale: 0.62 },
|
|
99
|
+
{ source: sparkleSvg, x: 250, y: 76, scale: 0.8, color: "#ffffff" },
|
|
100
|
+
{ source: heartSvg, x: 248, y: 14, rot: 14, scale: 0.675, color: "#ffcfae" }
|
|
101
|
+
];
|
|
102
|
+
let backgroundArt;
|
|
103
|
+
function getBackgroundArt() {
|
|
104
|
+
if (backgroundArt) return backgroundArt;
|
|
105
|
+
const parts = ART.map(({ source, x, y, scale, rot = 0, color }) => {
|
|
106
|
+
const { viewBox, inner } = parseSvg(source);
|
|
107
|
+
const [, , vw, vh] = viewBox.split(/\s+/).map(Number);
|
|
108
|
+
const w = vw * scale;
|
|
109
|
+
const h = vh * scale;
|
|
110
|
+
const style = color ? ` style="color:${color}"` : "";
|
|
111
|
+
return `<g transform="rotate(${rot} ${x} ${y})"><svg x="${x - w / 2}" y="${y - h / 2}" width="${w}" height="${h}" viewBox="${viewBox}" overflow="visible"${style}>${inner}</svg></g>`;
|
|
112
|
+
});
|
|
113
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="260" height="90" viewBox="0 0 260 90"><g opacity="0.62">${parts.join("")}</g></svg>`;
|
|
114
|
+
backgroundArt = toDataUrl(svg.split(OUTLINE_COLOR).join(ART_STROKE));
|
|
115
|
+
return backgroundArt;
|
|
116
|
+
}
|
|
117
|
+
function getHeartIcon(accent, animation) {
|
|
118
|
+
const className = getDynamicClass({
|
|
119
|
+
base: {
|
|
120
|
+
display: "flex",
|
|
121
|
+
width: "1.6em",
|
|
122
|
+
height: "1.6em",
|
|
123
|
+
position: "relative",
|
|
124
|
+
zIndex: "1",
|
|
125
|
+
transformOrigin: "50% 60%",
|
|
126
|
+
animation
|
|
127
|
+
},
|
|
128
|
+
">svg": {
|
|
129
|
+
width: "100%",
|
|
130
|
+
height: "100%",
|
|
131
|
+
display: "block",
|
|
132
|
+
overflow: "visible",
|
|
133
|
+
filter: `drop-shadow(0 0.08em 0.14em ${accent}88)`
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const holder = document.createElement("span");
|
|
137
|
+
holder.className = className;
|
|
138
|
+
holder.innerHTML = decodeSvg(heartSvg);
|
|
139
|
+
const svg = holder.querySelector("svg");
|
|
140
|
+
if (svg) svg.style.color = accent;
|
|
141
|
+
return holder;
|
|
142
|
+
}
|
|
143
|
+
class AbdlToastTheme extends ToastTheme {
|
|
144
|
+
name = "ABDL";
|
|
145
|
+
details = "Cute pastel theme for ABDL lovers.\nColorful hearts, bottles, diapers and teddy bears.\nUnlocked after entering ABDL Nursery.";
|
|
146
|
+
tier = ToastThemeTier.SR;
|
|
147
|
+
init() {
|
|
148
|
+
if (!this.isUnlocked && ChatRoomData?.Name.toLowerCase() === NURSERY_ROOM_NAME.toLowerCase()) this.unlock();
|
|
149
|
+
hookFunction("ChatRoomSync", HookPriority.OBSERVE, (args, next) => {
|
|
150
|
+
if (this.isUnlocked) return next(args);
|
|
151
|
+
const [data] = args;
|
|
152
|
+
if (data.Name.toLowerCase() === NURSERY_ROOM_NAME.toLowerCase()) this.unlock();
|
|
153
|
+
return next(args);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
render(renderData) {
|
|
157
|
+
renderData.isInteractable ??= true;
|
|
158
|
+
const kf = ensureStyles();
|
|
159
|
+
const pos = getSettings().toasts?.position ?? "bottom-left";
|
|
160
|
+
const accent = ACCENT_COLOR[renderData.type];
|
|
161
|
+
const tint = TINT_COLOR[renderData.type];
|
|
162
|
+
const toastClassName = getDynamicClass({
|
|
163
|
+
base: {
|
|
164
|
+
display: "flex",
|
|
165
|
+
columnGap: "0.55em",
|
|
166
|
+
alignItems: "flex-start",
|
|
167
|
+
maxWidth: "25vw",
|
|
168
|
+
position: "relative",
|
|
169
|
+
overflow: "hidden",
|
|
170
|
+
backgroundColor: tint,
|
|
171
|
+
backgroundImage: `${getBackgroundArt()}, linear-gradient(135deg, #fffafc 0%, ${tint} 100%)`,
|
|
172
|
+
backgroundRepeat: "repeat-x, no-repeat",
|
|
173
|
+
backgroundPosition: "right center, center",
|
|
174
|
+
backgroundSize: "auto 4.2em, 100% 100%",
|
|
175
|
+
border: `1.5px solid ${accent}`,
|
|
176
|
+
borderRadius: "0.35em",
|
|
177
|
+
boxShadow: `0 6px 18px ${accent}40, 0 0 0 1px rgba(0,0,0,0.04)`,
|
|
178
|
+
boxSizing: "border-box"
|
|
179
|
+
},
|
|
180
|
+
"::before": {
|
|
181
|
+
content: '""',
|
|
182
|
+
position: "absolute",
|
|
183
|
+
top: "0",
|
|
184
|
+
left: "0",
|
|
185
|
+
right: "0",
|
|
186
|
+
bottom: "0",
|
|
187
|
+
background: "linear-gradient(90deg, rgba(255,251,253,0.82) 0%, rgba(255,251,253,0.58) 45%, rgba(255,251,253,0.28) 100%)",
|
|
188
|
+
pointerEvents: "none",
|
|
189
|
+
zIndex: "0"
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const iconColumnClass = getDynamicClass({
|
|
193
|
+
base: {
|
|
194
|
+
flexShrink: "0",
|
|
195
|
+
alignSelf: "flex-start",
|
|
196
|
+
position: "relative",
|
|
197
|
+
zIndex: "1",
|
|
198
|
+
margin: "0"
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
const buttonsContainerClassName = getDynamicClass({
|
|
202
|
+
base: {
|
|
203
|
+
display: "flex",
|
|
204
|
+
gap: "0.4em",
|
|
205
|
+
marginTop: "0.4em",
|
|
206
|
+
flexWrap: "wrap",
|
|
207
|
+
position: "relative",
|
|
208
|
+
zIndex: "3"
|
|
209
|
+
},
|
|
210
|
+
">button": {
|
|
211
|
+
flexShrink: "0",
|
|
212
|
+
background: `${accent}2e`,
|
|
213
|
+
border: `1px solid ${accent}80`,
|
|
214
|
+
color: TITLE_COLOR,
|
|
215
|
+
fontWeight: "600",
|
|
216
|
+
fontSize: "0.8em",
|
|
217
|
+
padding: "0.15em 0.8em",
|
|
218
|
+
borderRadius: "0.3em",
|
|
219
|
+
cursor: "pointer",
|
|
220
|
+
transition: "background 0.15s ease, border-color 0.15s ease"
|
|
221
|
+
},
|
|
222
|
+
">button:hover": {
|
|
223
|
+
background: `${accent}52`,
|
|
224
|
+
borderColor: accent
|
|
225
|
+
},
|
|
226
|
+
">button:active": {
|
|
227
|
+
background: `${accent}70`
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
const actionsClassName = getDynamicClass({
|
|
231
|
+
base: {
|
|
232
|
+
position: "absolute",
|
|
233
|
+
top: "0.35em",
|
|
234
|
+
right: "0.35em",
|
|
235
|
+
display: "flex",
|
|
236
|
+
gap: "0.15em",
|
|
237
|
+
zIndex: "10"
|
|
238
|
+
},
|
|
239
|
+
">button": {
|
|
240
|
+
background: "rgba(255,255,255,0.7)",
|
|
241
|
+
border: `1px solid ${accent}88`,
|
|
242
|
+
cursor: "pointer",
|
|
243
|
+
padding: "0.1em",
|
|
244
|
+
display: "flex",
|
|
245
|
+
alignItems: "center",
|
|
246
|
+
justifyContent: "center",
|
|
247
|
+
opacity: "0.8",
|
|
248
|
+
color: TITLE_COLOR,
|
|
249
|
+
borderRadius: "0.3em",
|
|
250
|
+
transition: "opacity 0.15s ease, background 0.15s ease"
|
|
251
|
+
},
|
|
252
|
+
">button:hover": {
|
|
253
|
+
opacity: "1",
|
|
254
|
+
background: "#fff"
|
|
255
|
+
},
|
|
256
|
+
">button>svg": {
|
|
257
|
+
width: "0.85em",
|
|
258
|
+
height: "0.85em"
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
const floaterClassName = getDynamicClass({
|
|
262
|
+
base: {
|
|
263
|
+
position: "absolute",
|
|
264
|
+
bottom: "-0.7em",
|
|
265
|
+
opacity: "0",
|
|
266
|
+
backgroundRepeat: "no-repeat",
|
|
267
|
+
backgroundSize: "contain",
|
|
268
|
+
pointerEvents: "none",
|
|
269
|
+
zIndex: "1"
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
const closeIcon = createElement(X);
|
|
273
|
+
const paletteIcon = createElement(Palette);
|
|
274
|
+
const icon = getHeartIcon(
|
|
275
|
+
accent,
|
|
276
|
+
renderData.type === "spinner" ? `${kf.beat} 0.9s ease-in-out infinite` : `${kf.sway} 2.8s ease-in-out infinite`
|
|
277
|
+
);
|
|
278
|
+
const toast = /* @__PURE__ */ jsxs(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
class: toastClassName,
|
|
282
|
+
"data-zc-toast-type": renderData.type,
|
|
283
|
+
"data-zc-toast-id": renderData.id,
|
|
284
|
+
children: [
|
|
285
|
+
renderData.type !== "spinner" && renderData.duration !== 0 && /* @__PURE__ */ jsx(
|
|
286
|
+
"div",
|
|
287
|
+
{
|
|
288
|
+
class: "zcToast-ProgressBar",
|
|
289
|
+
style: {
|
|
290
|
+
animation: `zcToast-progress ${renderData.duration}ms linear 0s 1 alternate none`,
|
|
291
|
+
position: "absolute",
|
|
292
|
+
top: "0",
|
|
293
|
+
left: "0",
|
|
294
|
+
height: "100%",
|
|
295
|
+
background: `linear-gradient(90deg, ${accent}40, ${accent}12)`,
|
|
296
|
+
zIndex: "0"
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
FLOATERS.map((f) => /* @__PURE__ */ jsx(
|
|
301
|
+
"span",
|
|
302
|
+
{
|
|
303
|
+
class: floaterClassName,
|
|
304
|
+
style: {
|
|
305
|
+
left: f.left,
|
|
306
|
+
width: f.size,
|
|
307
|
+
height: f.size,
|
|
308
|
+
backgroundImage: toDataUrl(recolorSvg(f.source, f.color)),
|
|
309
|
+
animation: `${kf.float} ${f.duration} ease-out ${f.delay} infinite`
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
)),
|
|
313
|
+
/* @__PURE__ */ jsxs("div", { class: actionsClassName, children: [
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
"button",
|
|
316
|
+
{
|
|
317
|
+
type: "button",
|
|
318
|
+
title: "Theme menu",
|
|
319
|
+
onClick: (e) => {
|
|
320
|
+
e.stopPropagation();
|
|
321
|
+
if (!renderData.isInteractable) return;
|
|
322
|
+
createThemesDialog();
|
|
323
|
+
},
|
|
324
|
+
children: paletteIcon
|
|
325
|
+
}
|
|
326
|
+
),
|
|
327
|
+
/* @__PURE__ */ jsx(
|
|
328
|
+
"button",
|
|
329
|
+
{
|
|
330
|
+
type: "button",
|
|
331
|
+
title: "Close",
|
|
332
|
+
onClick: (e) => {
|
|
333
|
+
e.stopPropagation();
|
|
334
|
+
if (!renderData.isInteractable) return;
|
|
335
|
+
dismissToast(toast);
|
|
336
|
+
},
|
|
337
|
+
children: closeIcon
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
] }),
|
|
341
|
+
/* @__PURE__ */ jsx("div", { class: iconColumnClass, children: icon }),
|
|
342
|
+
/* @__PURE__ */ jsxs(
|
|
343
|
+
"div",
|
|
344
|
+
{
|
|
345
|
+
style: {
|
|
346
|
+
width: "100%",
|
|
347
|
+
minWidth: "0",
|
|
348
|
+
paddingRight: "2.5em",
|
|
349
|
+
position: "relative",
|
|
350
|
+
zIndex: "1"
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
!!renderData.title && /* @__PURE__ */ jsx(
|
|
354
|
+
"p",
|
|
355
|
+
{
|
|
356
|
+
style: {
|
|
357
|
+
color: TITLE_COLOR,
|
|
358
|
+
fontWeight: "700",
|
|
359
|
+
fontSize: "0.9em",
|
|
360
|
+
margin: "0",
|
|
361
|
+
overflow: "hidden",
|
|
362
|
+
textOverflow: "ellipsis",
|
|
363
|
+
whiteSpace: "nowrap",
|
|
364
|
+
width: "100%"
|
|
365
|
+
},
|
|
366
|
+
children: renderData.title
|
|
367
|
+
}
|
|
368
|
+
),
|
|
369
|
+
/* @__PURE__ */ jsx(
|
|
370
|
+
"p",
|
|
371
|
+
{
|
|
372
|
+
style: {
|
|
373
|
+
color: TEXT_COLOR,
|
|
374
|
+
fontSize: !!renderData.title ? "0.72em" : "0.85em",
|
|
375
|
+
overflowWrap: "anywhere",
|
|
376
|
+
fontWeight: !!renderData.title ? "500" : "700",
|
|
377
|
+
margin: "0",
|
|
378
|
+
marginTop: !!renderData.title ? "0.15em" : void 0,
|
|
379
|
+
lineHeight: "1.35"
|
|
380
|
+
},
|
|
381
|
+
children: renderData.message
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
renderData.buttons !== void 0 && /* @__PURE__ */ jsx("div", { class: buttonsContainerClassName, children: renderData.buttons.map((b) => /* @__PURE__ */ jsx(
|
|
385
|
+
"button",
|
|
386
|
+
{
|
|
387
|
+
type: "button",
|
|
388
|
+
onClick: () => {
|
|
389
|
+
if (!renderData.isInteractable) return;
|
|
390
|
+
b.action();
|
|
391
|
+
},
|
|
392
|
+
children: b.name
|
|
393
|
+
}
|
|
394
|
+
)) })
|
|
395
|
+
]
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
const sz = (value) => renderData.size.scaleWithCanvas ? `calc(var(--size-unit) * ${value * renderData.size.scaleFactor}px)` : `${value * renderData.size.scaleFactor * FIXED_UNIT}px`;
|
|
402
|
+
toast.style.fontSize = sz(2.15);
|
|
403
|
+
toast.style.padding = `${sz(0.85)} ${sz(0.95)}`;
|
|
404
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideInFromLeft" : "zcSlideInFromRight"} 0.3s ease-out forwards`;
|
|
405
|
+
void toast.offsetHeight;
|
|
406
|
+
if (renderData.type !== "spinner" && renderData.duration !== 0) {
|
|
407
|
+
setTimeout(() => {
|
|
408
|
+
toast.style.animation = `${pos.includes("left") ? "zcSlideOutToLeft" : "zcSlideOutToRight"} 0.3s ease-out forwards`;
|
|
409
|
+
}, renderData.duration);
|
|
410
|
+
setTimeout(() => toast.remove(), renderData.duration + 300);
|
|
411
|
+
}
|
|
412
|
+
return toast;
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
const abdlToastTheme = new AbdlToastTheme();
|
|
416
|
+
export {
|
|
417
|
+
AbdlToastTheme,
|
|
418
|
+
abdlToastTheme
|
|
419
|
+
};
|