snowies 0.1.0 → 0.3.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/README.md +3 -1
- package/dist/auto.cjs +156 -44
- package/dist/auto.cjs.map +1 -1
- package/dist/auto.d.cts +1 -1
- package/dist/auto.d.ts +1 -1
- package/dist/auto.js +7 -1
- package/dist/auto.js.map +1 -1
- package/dist/{chunk-XFLVBGZZ.js → chunk-FUI4H26T.js} +157 -47
- package/dist/chunk-FUI4H26T.js.map +1 -0
- package/dist/index.cjs +158 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -3
- package/dist/index.d.ts +19 -3
- package/dist/index.js +1 -1
- package/dist/snowies.global.js +60 -40
- package/dist/snowies.global.js.map +1 -1
- package/dist/{types-CMTuJTs7.d.cts → types-KVWKDlXl.d.cts} +24 -5
- package/dist/{types-CMTuJTs7.d.ts → types-KVWKDlXl.d.ts} +24 -5
- package/package.json +2 -2
- package/dist/chunk-XFLVBGZZ.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,9 +6,11 @@ Paquete navideño **cero dependencias**, escrito en **TypeScript puro** y optimi
|
|
|
6
6
|
|
|
7
7
|
- **Nieve en Canvas 2D**: 3 capas de profundidad, sprites pre-renderizados, pausa automática al cambiar de pestaña (`visibilitychange`) y modo `contrasting` para fondos claros.
|
|
8
8
|
- **Luces navideñas fijas arriba**: cable SVG, focos con filamento y halo, balanceo suave, iluminación al pasar el mouse y destello al hacer clic (encapsulado en Shadow DOM).
|
|
9
|
-
- **Snow Burst en botones**: explosión radial de nieve y cristales SVG al hacer clic en botones
|
|
9
|
+
- **Snow Burst en botones**: explosión radial de nieve y cristales SVG al hacer clic en botones.
|
|
10
|
+
- **Nieve encima de botones (`buttonSnow`)**: módulo independiente y desactivable con dos estilos orgánicos (`subtle` y `fluffy`) y dos modos: manual por defecto (`data-snowies-snow`) o automático (`mode: 'all'`, respetando `data-snowies-ignore`).
|
|
10
11
|
- **Botón flotante ON/OFF discreto y personalizable**: encapsulado en Shadow DOM, modo solo icono por defecto (`variant: 'icon' | 'pill'`), tamaños, temas, icono SVG propio, estilos custom y persistencia en `localStorage`.
|
|
11
12
|
- **Presets y programación por fechas**: activa Navidad automáticamente entre fechas (ej. `12-01` a `01-06`).
|
|
13
|
+
- **Multi-idioma (`es` / `en`)**: detección automática (`locale: 'auto'`) según `<html lang>` o idioma del navegador, o explícito (`'es'` | `'en'`).
|
|
12
14
|
- **Accesible**: respeta `prefers-reduced-motion: reduce`.
|
|
13
15
|
|
|
14
16
|
## Instalación
|
package/dist/auto.cjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/modules/buttonBurst.ts
|
|
4
|
-
var SNOW_CAP_SVG = encodeURIComponent(
|
|
5
|
-
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 14" preserveAspectRatio="none"><path d="M0 10 Q10 2 22 7 T48 6 T76 8 T102 5 T120 9 L120 0 L0 0 Z" fill="#ffffff"/><path d="M0 10 Q10 2 22 7 T48 6 T76 8 T102 5 T120 9" fill="none" stroke="#d7edff" stroke-width="1.2"/></svg>`
|
|
6
|
-
);
|
|
7
4
|
var CRYSTAL_SVG = `<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M8 1.5v13M2.4 4.75l11.2 6.5M13.6 4.75l-11.2 6.5"/></svg>`;
|
|
8
5
|
function createButtonBurst(options) {
|
|
9
6
|
if (typeof document === "undefined" || typeof window === "undefined") {
|
|
@@ -62,33 +59,6 @@ function createButtonBurst(options) {
|
|
|
62
59
|
`;
|
|
63
60
|
shadow.appendChild(style);
|
|
64
61
|
document.body.appendChild(overlayHost);
|
|
65
|
-
let snowCapStyleEl = null;
|
|
66
|
-
if (options.snowCap && options.snowCapSelector) {
|
|
67
|
-
const capSelectors = options.snowCapSelector.split(",").map((s) => s.trim()).filter(Boolean);
|
|
68
|
-
if (capSelectors.length > 0) {
|
|
69
|
-
const baseSelector = capSelectors.join(", ");
|
|
70
|
-
const afterSelector = capSelectors.map((s) => `${s}::after`).join(", ");
|
|
71
|
-
snowCapStyleEl = document.createElement("style");
|
|
72
|
-
snowCapStyleEl.setAttribute("data-snowies-snowcap", "");
|
|
73
|
-
snowCapStyleEl.textContent = `
|
|
74
|
-
${baseSelector} {
|
|
75
|
-
position: relative;
|
|
76
|
-
}
|
|
77
|
-
${afterSelector} {
|
|
78
|
-
content: "";
|
|
79
|
-
position: absolute;
|
|
80
|
-
top: -3px;
|
|
81
|
-
left: 8px;
|
|
82
|
-
right: 8px;
|
|
83
|
-
height: 9px;
|
|
84
|
-
pointer-events: none;
|
|
85
|
-
background: url("data:image/svg+xml,${SNOW_CAP_SVG}") no-repeat top center / 100% 100%;
|
|
86
|
-
filter: drop-shadow(0 1px 2px rgba(71, 130, 180, 0.45));
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
89
|
-
document.head.appendChild(snowCapStyleEl);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
62
|
const activeTimers = /* @__PURE__ */ new Set();
|
|
93
63
|
const isMobile = () => window.innerWidth <= 640;
|
|
94
64
|
const trigger = (target) => {
|
|
@@ -154,7 +124,81 @@ function createButtonBurst(options) {
|
|
|
154
124
|
activeTimers.forEach((id) => window.clearTimeout(id));
|
|
155
125
|
activeTimers.clear();
|
|
156
126
|
overlayHost.remove();
|
|
157
|
-
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/modules/buttonSnow.ts
|
|
132
|
+
var SUBTLE_SNOW_SVG = encodeURIComponent(
|
|
133
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 16" preserveAspectRatio="none">
|
|
134
|
+
<defs>
|
|
135
|
+
<linearGradient id="sg" x1="0" y1="0" x2="0" y2="1">
|
|
136
|
+
<stop offset="0%" stop-color="#ffffff"/>
|
|
137
|
+
<stop offset="72%" stop-color="#f2f8ff"/>
|
|
138
|
+
<stop offset="100%" stop-color="#dceeff"/>
|
|
139
|
+
</linearGradient>
|
|
140
|
+
</defs>
|
|
141
|
+
<path d="M4 9 C6 5.5, 16 4, 30 4.5 C46 5, 62 3.2, 82 4 C102 4.8, 120 3.4, 136 4.6 C148 5.5, 154 6.5, 156 9 C155 11.2, 148 11.5, 140 10 C130 8.2, 122 12.2, 110 11.4 C98 10.6, 90 8.5, 76 10.8 C64 12.6, 54 9.2, 42 10.6 C30 12, 20 8.8, 12 10.6 C7 11.6, 4.5 10.6, 4 9 Z" fill="url(#sg)" stroke="#cbe3fa" stroke-width="0.7" stroke-linejoin="round"/>
|
|
142
|
+
</svg>`
|
|
143
|
+
);
|
|
144
|
+
var FLUFFY_SNOW_SVG = encodeURIComponent(
|
|
145
|
+
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 160 24" preserveAspectRatio="none">
|
|
146
|
+
<defs>
|
|
147
|
+
<linearGradient id="fg" x1="0" y1="0" x2="0" y2="1">
|
|
148
|
+
<stop offset="0%" stop-color="#ffffff"/>
|
|
149
|
+
<stop offset="62%" stop-color="#f4f9ff"/>
|
|
150
|
+
<stop offset="100%" stop-color="#d4eaff"/>
|
|
151
|
+
</linearGradient>
|
|
152
|
+
</defs>
|
|
153
|
+
<path d="M3 13 C5 6, 18 3, 34 4.5 C46 5.6, 56 1.5, 74 2.8 C90 4, 102 1.8, 118 3.6 C134 5.4, 150 4.5, 157 12.5 C157 16, 151 17.2, 145 15 C140 13.2, 138 19.5, 131 19.5 C124 19.5, 122 13.8, 112 14.4 C100 15, 95 21.5, 86 21.5 C77 21.5, 74 14.5, 62 14.8 C50 15.1, 46 19.8, 38 19.6 C30 19.4, 28 14.2, 19 15.2 C11 16.2, 3.5 16.2, 3 13 Z" fill="url(#fg)" stroke="#c2dff8" stroke-width="0.85" stroke-linejoin="round"/>
|
|
154
|
+
</svg>`
|
|
155
|
+
);
|
|
156
|
+
var ALL_BUTTONS_SELECTOR = 'button:not([data-snowies-ignore]):not([disabled]), [role="button"]:not([data-snowies-ignore]):not([aria-disabled="true"])';
|
|
157
|
+
function buildSelectors(options) {
|
|
158
|
+
const raw = options.mode === "all" ? ALL_BUTTONS_SELECTOR : options.selector;
|
|
159
|
+
return raw.split(",").map((s) => s.trim()).filter(Boolean);
|
|
160
|
+
}
|
|
161
|
+
function createButtonSnow(options) {
|
|
162
|
+
if (typeof document === "undefined") {
|
|
163
|
+
return { destroy() {
|
|
164
|
+
} };
|
|
165
|
+
}
|
|
166
|
+
const selectors = buildSelectors(options);
|
|
167
|
+
if (selectors.length === 0) {
|
|
168
|
+
return { destroy() {
|
|
169
|
+
} };
|
|
170
|
+
}
|
|
171
|
+
const isFluffy = options.style === "fluffy";
|
|
172
|
+
const svg = isFluffy ? FLUFFY_SNOW_SVG : SUBTLE_SNOW_SVG;
|
|
173
|
+
const height = isFluffy ? "16px" : "11px";
|
|
174
|
+
const topOffset = isFluffy ? "-7px" : "-4px";
|
|
175
|
+
const insetX = isFluffy ? "3px" : "4px";
|
|
176
|
+
const baseRule = selectors.map((s) => `:where(${s})`).join(", ");
|
|
177
|
+
const afterRule = selectors.map((s) => `:where(${s})::after`).join(", ");
|
|
178
|
+
const styleEl = document.createElement("style");
|
|
179
|
+
styleEl.setAttribute("data-snowies-button-snow", "");
|
|
180
|
+
styleEl.textContent = `
|
|
181
|
+
${baseRule} {
|
|
182
|
+
position: relative;
|
|
183
|
+
overflow: visible;
|
|
184
|
+
}
|
|
185
|
+
${afterRule} {
|
|
186
|
+
content: "";
|
|
187
|
+
position: absolute;
|
|
188
|
+
top: ${topOffset};
|
|
189
|
+
left: ${insetX};
|
|
190
|
+
right: ${insetX};
|
|
191
|
+
height: ${height};
|
|
192
|
+
pointer-events: none;
|
|
193
|
+
z-index: 1;
|
|
194
|
+
background: url("data:image/svg+xml,${svg}") no-repeat top center / 100% 100%;
|
|
195
|
+
filter: drop-shadow(0 1.5px 2px rgba(30, 64, 110, 0.24));
|
|
196
|
+
}
|
|
197
|
+
`;
|
|
198
|
+
document.head.appendChild(styleEl);
|
|
199
|
+
return {
|
|
200
|
+
destroy() {
|
|
201
|
+
styleEl.remove();
|
|
158
202
|
}
|
|
159
203
|
};
|
|
160
204
|
}
|
|
@@ -401,7 +445,7 @@ function createLights(options) {
|
|
|
401
445
|
strip.className = "strip";
|
|
402
446
|
if (options.interactive) {
|
|
403
447
|
strip.setAttribute("type", "button");
|
|
404
|
-
strip.setAttribute("aria-label",
|
|
448
|
+
strip.setAttribute("aria-label", options.ariaLabel ?? "Illuminate Christmas lights");
|
|
405
449
|
} else {
|
|
406
450
|
strip.setAttribute("aria-hidden", "true");
|
|
407
451
|
}
|
|
@@ -869,10 +913,14 @@ var DEFAULT_CONFIG = {
|
|
|
869
913
|
selector: 'button, [role="button"], [data-snowies-burst]',
|
|
870
914
|
particles: 48,
|
|
871
915
|
crystals: true,
|
|
872
|
-
snowCap: true,
|
|
873
|
-
snowCapSelector: "[data-snowies-btn], .snowies-btn",
|
|
874
916
|
zIndex: 9998
|
|
875
917
|
},
|
|
918
|
+
buttonSnow: {
|
|
919
|
+
enabled: true,
|
|
920
|
+
mode: "manual",
|
|
921
|
+
style: "subtle",
|
|
922
|
+
selector: "[data-snowies-snow], [data-snowies-btn], .snowies-snow"
|
|
923
|
+
},
|
|
876
924
|
toggleButton: {
|
|
877
925
|
enabled: true,
|
|
878
926
|
position: "bottom-right",
|
|
@@ -893,41 +941,78 @@ var PRESETS = {
|
|
|
893
941
|
classic: {
|
|
894
942
|
snow: { enabled: true, density: "medium", contrasting: false },
|
|
895
943
|
lights: { enabled: true, position: "fixed", backdrop: "transparent", palette: "classic" },
|
|
896
|
-
buttonBurst: { enabled: true
|
|
944
|
+
buttonBurst: { enabled: true },
|
|
945
|
+
buttonSnow: { enabled: true, mode: "manual", style: "subtle" },
|
|
897
946
|
toggleButton: { enabled: true, variant: "icon", theme: "minimal" }
|
|
898
947
|
},
|
|
899
948
|
minimal: {
|
|
900
949
|
snow: { enabled: true, density: "light", contrasting: false, speed: 0.85 },
|
|
901
950
|
lights: { enabled: false },
|
|
902
|
-
buttonBurst: { enabled: false
|
|
951
|
+
buttonBurst: { enabled: false },
|
|
952
|
+
buttonSnow: { enabled: false },
|
|
903
953
|
toggleButton: { enabled: true, variant: "icon", theme: "minimal" }
|
|
904
954
|
},
|
|
905
955
|
festive: {
|
|
906
956
|
snow: { enabled: true, density: "heavy", contrasting: false, speed: 1.1 },
|
|
907
957
|
lights: { enabled: true, position: "fixed", backdrop: "pine", palette: "classic" },
|
|
908
|
-
buttonBurst: { enabled: true, particles: 56, crystals: true
|
|
958
|
+
buttonBurst: { enabled: true, particles: 56, crystals: true },
|
|
959
|
+
buttonSnow: { enabled: true, mode: "manual", style: "fluffy" },
|
|
909
960
|
toggleButton: { enabled: true, variant: "pill", theme: "festive" }
|
|
910
961
|
},
|
|
911
962
|
light: {
|
|
912
963
|
snow: { enabled: true, density: "medium", contrasting: true },
|
|
913
964
|
lights: { enabled: true, position: "fixed", backdrop: "transparent", palette: "ice" },
|
|
914
|
-
buttonBurst: { enabled: true
|
|
965
|
+
buttonBurst: { enabled: true },
|
|
966
|
+
buttonSnow: { enabled: true, mode: "manual", style: "subtle" },
|
|
915
967
|
toggleButton: { enabled: true, variant: "icon", theme: "light" }
|
|
916
968
|
},
|
|
917
969
|
"lights-only": {
|
|
918
970
|
snow: { enabled: false },
|
|
919
971
|
lights: { enabled: true, position: "fixed", backdrop: "transparent", palette: "classic" },
|
|
920
|
-
buttonBurst: { enabled: false
|
|
972
|
+
buttonBurst: { enabled: false },
|
|
973
|
+
buttonSnow: { enabled: false },
|
|
921
974
|
toggleButton: { enabled: true, variant: "icon", theme: "minimal" }
|
|
922
975
|
},
|
|
923
976
|
"snow-only": {
|
|
924
977
|
snow: { enabled: true, density: "medium", contrasting: false },
|
|
925
978
|
lights: { enabled: false },
|
|
926
|
-
buttonBurst: { enabled: false
|
|
979
|
+
buttonBurst: { enabled: false },
|
|
980
|
+
buttonSnow: { enabled: false },
|
|
927
981
|
toggleButton: { enabled: true, variant: "icon", theme: "minimal" }
|
|
928
982
|
}
|
|
929
983
|
};
|
|
930
984
|
|
|
985
|
+
// src/utils/i18n.ts
|
|
986
|
+
var MESSAGES = {
|
|
987
|
+
en: {
|
|
988
|
+
toggleLabelOn: "Disable Christmas effects",
|
|
989
|
+
toggleLabelOff: "Enable Christmas effects",
|
|
990
|
+
toggleTextOn: "Holiday",
|
|
991
|
+
toggleTextOff: "Paused",
|
|
992
|
+
lightsAriaLabel: "Illuminate Christmas lights"
|
|
993
|
+
},
|
|
994
|
+
es: {
|
|
995
|
+
toggleLabelOn: "Desactivar efectos navide\xF1os",
|
|
996
|
+
toggleLabelOff: "Activar efectos navide\xF1os",
|
|
997
|
+
toggleTextOn: "Navidad",
|
|
998
|
+
toggleTextOff: "Pausado",
|
|
999
|
+
lightsAriaLabel: "Hacer brillar las luces navide\xF1as"
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
function resolveLocale(locale = "auto") {
|
|
1003
|
+
if (locale === "es" || locale === "en") return locale;
|
|
1004
|
+
if (typeof document !== "undefined") {
|
|
1005
|
+
const docLang = document.documentElement?.lang?.toLowerCase();
|
|
1006
|
+
if (docLang) {
|
|
1007
|
+
return docLang.startsWith("es") ? "es" : "en";
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1011
|
+
return navigator.language.toLowerCase().startsWith("es") ? "es" : "en";
|
|
1012
|
+
}
|
|
1013
|
+
return "en";
|
|
1014
|
+
}
|
|
1015
|
+
|
|
931
1016
|
// src/utils/config.ts
|
|
932
1017
|
function mergeFeature(base, presetOverride, userOverride) {
|
|
933
1018
|
let result = { ...base };
|
|
@@ -947,18 +1032,35 @@ function resolveConfig(options = {}, previous) {
|
|
|
947
1032
|
const presetName = options.preset ?? previous?.preset ?? DEFAULT_CONFIG.preset;
|
|
948
1033
|
const presetDef = options.preset ? PRESETS[presetName] ?? {} : previous ? {} : PRESETS[presetName] ?? {};
|
|
949
1034
|
const base = previous && !options.preset ? previous : DEFAULT_CONFIG;
|
|
1035
|
+
const locale = resolveLocale(options.locale ?? previous?.locale ?? "auto");
|
|
1036
|
+
const msg = MESSAGES[locale];
|
|
1037
|
+
const localeChanged = !previous || options.locale !== void 0 || options.preset !== void 0;
|
|
1038
|
+
const lights = mergeFeature(base.lights, presetDef.lights, options.lights);
|
|
1039
|
+
const userLights = typeof options.lights === "object" ? options.lights : void 0;
|
|
1040
|
+
if (localeChanged && !userLights?.ariaLabel) {
|
|
1041
|
+
lights.ariaLabel = msg.lightsAriaLabel;
|
|
1042
|
+
}
|
|
950
1043
|
const toggleButton = mergeFeature(base.toggleButton, presetDef.toggleButton, options.toggleButton);
|
|
951
|
-
|
|
952
|
-
|
|
1044
|
+
const userToggle = typeof options.toggleButton === "object" ? options.toggleButton : void 0;
|
|
1045
|
+
if (localeChanged) {
|
|
1046
|
+
if (!userToggle?.labelOn) toggleButton.labelOn = msg.toggleLabelOn;
|
|
1047
|
+
if (!userToggle?.labelOff) toggleButton.labelOff = msg.toggleLabelOff;
|
|
1048
|
+
if (!userToggle?.textOn) toggleButton.textOn = msg.toggleTextOn;
|
|
1049
|
+
if (!userToggle?.textOff) toggleButton.textOff = msg.toggleTextOff;
|
|
1050
|
+
}
|
|
1051
|
+
if (userToggle?.style && base.toggleButton.style) {
|
|
1052
|
+
toggleButton.style = { ...base.toggleButton.style, ...userToggle.style };
|
|
953
1053
|
}
|
|
954
1054
|
return {
|
|
955
1055
|
preset: presetName,
|
|
1056
|
+
locale,
|
|
956
1057
|
enabled: options.enabled ?? base.enabled,
|
|
957
1058
|
respectReducedMotion: options.respectReducedMotion ?? base.respectReducedMotion,
|
|
958
1059
|
schedule: options.schedule !== void 0 ? options.schedule : base.schedule,
|
|
959
1060
|
snow: mergeFeature(base.snow, presetDef.snow, options.snow),
|
|
960
|
-
lights
|
|
1061
|
+
lights,
|
|
961
1062
|
buttonBurst: mergeFeature(base.buttonBurst, presetDef.buttonBurst, options.buttonBurst),
|
|
1063
|
+
buttonSnow: mergeFeature(base.buttonSnow, presetDef.buttonSnow, options.buttonSnow),
|
|
962
1064
|
toggleButton,
|
|
963
1065
|
onChange: options.onChange ?? base.onChange
|
|
964
1066
|
};
|
|
@@ -1034,6 +1136,7 @@ function createSnowies(options = {}) {
|
|
|
1034
1136
|
let snowMod = null;
|
|
1035
1137
|
let lightsMod = null;
|
|
1036
1138
|
let burstMod = null;
|
|
1139
|
+
let buttonSnowMod = null;
|
|
1037
1140
|
let toggleMod = null;
|
|
1038
1141
|
const computeState = () => {
|
|
1039
1142
|
const inSchedule = isWithinSchedule(config.schedule);
|
|
@@ -1062,6 +1165,8 @@ function createSnowies(options = {}) {
|
|
|
1062
1165
|
lightsMod = null;
|
|
1063
1166
|
burstMod?.destroy();
|
|
1064
1167
|
burstMod = null;
|
|
1168
|
+
buttonSnowMod?.destroy();
|
|
1169
|
+
buttonSnowMod = null;
|
|
1065
1170
|
};
|
|
1066
1171
|
const destroyToggle = () => {
|
|
1067
1172
|
toggleMod?.destroy();
|
|
@@ -1075,6 +1180,7 @@ function createSnowies(options = {}) {
|
|
|
1075
1180
|
if (config.snow.enabled) snowMod = createSnow(config.snow);
|
|
1076
1181
|
if (config.lights.enabled) lightsMod = createLights(config.lights);
|
|
1077
1182
|
if (config.buttonBurst.enabled) burstMod = createButtonBurst(config.buttonBurst);
|
|
1183
|
+
if (config.buttonSnow.enabled) buttonSnowMod = createButtonSnow(config.buttonSnow);
|
|
1078
1184
|
}
|
|
1079
1185
|
const shouldShowToggle = state.inSchedule && config.enabled && config.toggleButton.enabled;
|
|
1080
1186
|
destroyToggle();
|
|
@@ -1121,7 +1227,7 @@ function createSnowies(options = {}) {
|
|
|
1121
1227
|
if (burstMod) {
|
|
1122
1228
|
burstMod.trigger(target);
|
|
1123
1229
|
} else {
|
|
1124
|
-
const temp = createButtonBurst(
|
|
1230
|
+
const temp = createButtonBurst(config.buttonBurst);
|
|
1125
1231
|
temp.trigger(target);
|
|
1126
1232
|
window.setTimeout(() => temp.destroy(), 1500);
|
|
1127
1233
|
}
|
|
@@ -1161,12 +1267,18 @@ function autoInitFromScript(script) {
|
|
|
1161
1267
|
const options = {};
|
|
1162
1268
|
const preset = el.getAttribute("data-preset");
|
|
1163
1269
|
if (preset) options.preset = preset;
|
|
1270
|
+
const locale = el.getAttribute("data-locale");
|
|
1271
|
+
if (locale === "es" || locale === "en" || locale === "auto") {
|
|
1272
|
+
options.locale = locale;
|
|
1273
|
+
}
|
|
1164
1274
|
const snow = parseBoolAttr(el.getAttribute("data-snow"));
|
|
1165
1275
|
if (snow !== void 0) options.snow = snow;
|
|
1166
1276
|
const lights = parseBoolAttr(el.getAttribute("data-lights"));
|
|
1167
1277
|
if (lights !== void 0) options.lights = lights;
|
|
1168
1278
|
const burst = parseBoolAttr(el.getAttribute("data-burst"));
|
|
1169
1279
|
if (burst !== void 0) options.buttonBurst = burst;
|
|
1280
|
+
const buttonSnow = parseBoolAttr(el.getAttribute("data-button-snow"));
|
|
1281
|
+
if (buttonSnow !== void 0) options.buttonSnow = buttonSnow;
|
|
1170
1282
|
const toggle = parseBoolAttr(el.getAttribute("data-toggle"));
|
|
1171
1283
|
if (toggle !== void 0) options.toggleButton = toggle;
|
|
1172
1284
|
const from = el.getAttribute("data-from");
|