Skip to content

Commit

Permalink
Merge pull request #19 from webdevnerdstuff/dev
Browse files Browse the repository at this point in the history
v3.0.2
  • Loading branch information
webdevnerdstuff authored Jan 19, 2024
2 parents c259708 + 580bf12 commit 71c3268
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log
All notable changes to the "vue3-easter-egg-trigger" plugin will be documented in this file.
All notable changes to the "vue-easter-egg-trigger" plugin will be documented in this file.

## v3.0.2
2024-01-19
[main] (@webdevnerdstuff)
* Fix issue when only using single key press

## v3.0.1
2024-01-17
Expand Down
4 changes: 2 additions & 2 deletions dist/vue-easter-egg-trigger.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions dist/vue-easter-egg-trigger.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@ import { defineComponent as D, inject as O, reactive as l, watchEffect as R, onM
import { includes as m, isEqual as U, uniq as E } from "lodash";
/**
* @name @wdns/vue-easter-egg-trigger
* @version 3.0.1
* @version 3.0.2
* @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.
* @author WebDevNerdStuff & Bunnies... lots and lots of bunnies! <[email protected]> (https://webdevnerdstuff.com)
* @copyright Copyright 2024, WebDevNerdStuff
* @homepage https://github.com/webdevnerdstuff/vue-easter-egg-trigger
* @repository https://github.com/webdevnerdstuff/vue-easter-egg-trigger
* @license MIT License
*/
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 }) {
const N = a, g = c, y = O(L, {}), e = l({ ...g, ...y });
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 }) {
const N = o, g = c, v = O(L, {}), e = l({ ...g, ...v });
R(() => {
Object.assign(e, { ...g, ...y });
Object.assign(e, { ...g, ...v });
});
let d = l([]), r = null, s = setTimeout(() => {
});
const w = l(["click", "dblclick", "mouseup", "mousedown"]), o = l({ classNames: [], ids: [], nodes: [] });
const w = l(["click", "dblclick", "mouseup", "mousedown"]), a = l({ classNames: [], ids: [], nodes: [] });
function p(t) {
const i = u("");
if (s !== null && clearTimeout(s), t.key !== void 0 && (i.value = t.key), m(w, t.type)) {
const n = t.currentTarget;
i.value = t.type, o.nodes.push(n.nodeName.toLowerCase()), o.ids.push(n.id), o.classNames.push(n.classList.value);
i.value = t.type, a.nodes.push(n.nodeName.toLowerCase()), a.ids.push(n.id), a.classNames.push(n.classList.value);
}
d.push(i.value), function(n) {
if (U(e.pattern, d))
return m(w, n.type) ? void function() {
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));
(j.value || B.value || C.value) && h(), b();
}() : void h();
if (U(e.pattern, d)) {
if (m(w, n.type))
return void function() {
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));
(j.value || B.value || C.value) && h(), b();
}();
h();
}
b();
}(t);
}
Expand All @@ -54,15 +57,15 @@ const v = D({ __name: "VEasterEggTrigger", props: { callback: {}, destroy: { typ
}), (t, i) => null;
} }), L = Symbol();
function M(c = {}) {
return (a) => {
a.provide(L, c), a.component("EasterEggTrigger", v), a.component("VEasterEggTrigger", v);
return (o) => {
o.provide(L, c), o.component("EasterEggTrigger", y), o.component("VEasterEggTrigger", y);
};
}
const $ = v;
const $ = y;
export {
$ as EasterEggTrigger,
v as VEasterEggTrigger,
y as VEasterEggTrigger,
M as createVEasterEggTrigger,
v as default,
y as default,
L as globalOptions
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wdns/vue-easter-egg-trigger",
"version": "3.0.1",
"version": "3.0.2",
"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.",
"private": false,
"publishConfig": {
Expand Down
4 changes: 2 additions & 2 deletions src/playground/configs/templates/PlaygroundPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
color="primary"
:disabled="clickClassTriggered"
>
Triggered by Class
Triggered by Class (3 clicks)
</v-btn>

<VEasterEggTrigger
Expand All @@ -53,7 +53,7 @@
class="callback-triggered"
:class="callbackTriggeredClass"
>
Class element clicked
Class element clicked 3 times
</div>
</v-col>

Expand Down
2 changes: 1 addition & 1 deletion src/plugin/VEasterEggTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function checkPattern(e: Event | MouseEvent | KeyboardEvent): void {
}
emitEvent();
return;
}
reset();
Expand Down Expand Up @@ -139,6 +138,7 @@ function checkTarget(): void {
// Reset //
function reset(): void {
// Reset timeout and clear input keys //
timeout = setTimeout(() => {
clearTimeout(timeout);
Expand Down

0 comments on commit 71c3268

Please sign in to comment.