Skip to content

Commit 71c3268

Browse files
Merge pull request #19 from webdevnerdstuff/dev
v3.0.2
2 parents c259708 + 580bf12 commit 71c3268

File tree

6 files changed

+31
-23
lines changed

6 files changed

+31
-23
lines changed

Diff for: CHANGELOG.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
2-
All notable changes to the "vue3-easter-egg-trigger" plugin will be documented in this file.
2+
All notable changes to the "vue-easter-egg-trigger" plugin will be documented in this file.
3+
4+
## v3.0.2
5+
2024-01-19
6+
[main] (@webdevnerdstuff)
7+
* Fix issue when only using single key press
38

49
## v3.0.1
510
2024-01-17

Diff for: dist/vue-easter-egg-trigger.cjs.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: dist/vue-easter-egg-trigger.es.js

+19-16
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,37 @@ import { defineComponent as D, inject as O, reactive as l, watchEffect as R, onM
22
import { includes as m, isEqual as U, uniq as E } from "lodash";
33
/**
44
* @name @wdns/vue-easter-egg-trigger
5-
* @version 3.0.1
5+
* @version 3.0.2
66
* @description Presenting the Vue Easter Egg Trigger, a tool that discreetly injects a touch of unexpectedness into Vue.js projects. This unassuming plugin, which operates on both keystrokes (with click events also available), brings hidden surprises to your applications.
77
* @author WebDevNerdStuff & Bunnies... lots and lots of bunnies! <[email protected]> (https://webdevnerdstuff.com)
88
* @copyright Copyright 2024, WebDevNerdStuff
99
* @homepage https://github.com/webdevnerdstuff/vue-easter-egg-trigger
1010
* @repository https://github.com/webdevnerdstuff/vue-easter-egg-trigger
1111
* @license MIT License
1212
*/
13-
const v = D({ __name: "VEasterEggTrigger", props: { callback: {}, destroy: { type: Boolean }, delay: { default: 500 }, pattern: { default: () => ["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "b", "a"] }, persist: { type: Boolean, default: !1 }, target: { default: "body" }, type: { default: "keydown" } }, emits: ["triggered"], setup(c, { emit: a }) {
14-
const N = a, g = c, y = O(L, {}), e = l({ ...g, ...y });
13+
const y = D({ __name: "VEasterEggTrigger", props: { callback: {}, destroy: { type: Boolean }, delay: { default: 500 }, pattern: { default: () => ["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "b", "a"] }, persist: { type: Boolean, default: !1 }, target: { default: "body" }, type: { default: "keydown" } }, emits: ["triggered"], setup(c, { emit: o }) {
14+
const N = o, g = c, v = O(L, {}), e = l({ ...g, ...v });
1515
R(() => {
16-
Object.assign(e, { ...g, ...y });
16+
Object.assign(e, { ...g, ...v });
1717
});
1818
let d = l([]), r = null, s = setTimeout(() => {
1919
});
20-
const w = l(["click", "dblclick", "mouseup", "mousedown"]), o = l({ classNames: [], ids: [], nodes: [] });
20+
const w = l(["click", "dblclick", "mouseup", "mousedown"]), a = l({ classNames: [], ids: [], nodes: [] });
2121
function p(t) {
2222
const i = u("");
2323
if (s !== null && clearTimeout(s), t.key !== void 0 && (i.value = t.key), m(w, t.type)) {
2424
const n = t.currentTarget;
25-
i.value = t.type, o.nodes.push(n.nodeName.toLowerCase()), o.ids.push(n.id), o.classNames.push(n.classList.value);
25+
i.value = t.type, a.nodes.push(n.nodeName.toLowerCase()), a.ids.push(n.id), a.classNames.push(n.classList.value);
2626
}
2727
d.push(i.value), function(n) {
28-
if (U(e.pattern, d))
29-
return m(w, n.type) ? void function() {
30-
const f = e.target, V = f.replace("#", ""), q = f.replace(".", ""), T = E(o.nodes), k = E(o.ids), A = E(o.classNames), j = u(T.length === 1 && T[0] === f), B = u(k.length === 1 && k[0] === V), C = u(A.length === 1 && m(A[0], q));
31-
(j.value || B.value || C.value) && h(), b();
32-
}() : void h();
28+
if (U(e.pattern, d)) {
29+
if (m(w, n.type))
30+
return void function() {
31+
const f = e.target, V = f.replace("#", ""), q = f.replace(".", ""), T = E(a.nodes), k = E(a.ids), A = E(a.classNames), j = u(T.length === 1 && T[0] === f), B = u(k.length === 1 && k[0] === V), C = u(A.length === 1 && m(A[0], q));
32+
(j.value || B.value || C.value) && h(), b();
33+
}();
34+
h();
35+
}
3336
b();
3437
}(t);
3538
}
@@ -54,15 +57,15 @@ const v = D({ __name: "VEasterEggTrigger", props: { callback: {}, destroy: { typ
5457
}), (t, i) => null;
5558
} }), L = Symbol();
5659
function M(c = {}) {
57-
return (a) => {
58-
a.provide(L, c), a.component("EasterEggTrigger", v), a.component("VEasterEggTrigger", v);
60+
return (o) => {
61+
o.provide(L, c), o.component("EasterEggTrigger", y), o.component("VEasterEggTrigger", y);
5962
};
6063
}
61-
const $ = v;
64+
const $ = y;
6265
export {
6366
$ as EasterEggTrigger,
64-
v as VEasterEggTrigger,
67+
y as VEasterEggTrigger,
6568
M as createVEasterEggTrigger,
66-
v as default,
69+
y as default,
6770
L as globalOptions
6871
};

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wdns/vue-easter-egg-trigger",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Presenting the Vue Easter Egg Trigger, a tool that discreetly injects a touch of unexpectedness into Vue.js projects. This unassuming plugin, which operates on both keystrokes (with click events also available), brings hidden surprises to your applications.",
55
"private": false,
66
"publishConfig": {

Diff for: src/playground/configs/templates/PlaygroundPage.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
color="primary"
3939
:disabled="clickClassTriggered"
4040
>
41-
Triggered by Class
41+
Triggered by Class (3 clicks)
4242
</v-btn>
4343

4444
<VEasterEggTrigger
@@ -53,7 +53,7 @@
5353
class="callback-triggered"
5454
:class="callbackTriggeredClass"
5555
>
56-
Class element clicked
56+
Class element clicked 3 times
5757
</div>
5858
</v-col>
5959

Diff for: src/plugin/VEasterEggTrigger.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ function checkPattern(e: Event | MouseEvent | KeyboardEvent): void {
105105
}
106106
107107
emitEvent();
108-
return;
109108
}
110109
111110
reset();
@@ -139,6 +138,7 @@ function checkTarget(): void {
139138
140139
// Reset //
141140
function reset(): void {
141+
142142
// Reset timeout and clear input keys //
143143
timeout = setTimeout(() => {
144144
clearTimeout(timeout);

0 commit comments

Comments
 (0)