ko-co 1.5.1 → 1.5.2

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/CHANGELOG.md CHANGED
@@ -2,53 +2,57 @@
2
2
 
3
3
  The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
4
 
5
- ## [1.5.1] (2021-05-16)
5
+ ## 1.5.2 - 2024-05-26
6
+
7
+ The package repository has moved and it's now reflected in the package metadata; this version contains no functionality changes.
8
+
9
+ ## 1.5.1 - 2021-05-16
6
10
 
7
11
  ### Changed
8
12
 
9
13
  - Removed unnecessary files from the package making it more lightweight.
10
14
 
11
- ## [1.5.0] (2021-05-15)
15
+ ## 1.5.0 - 2021-05-15
12
16
 
13
17
  ### Added
14
18
 
15
19
  - Introduced an ESM version of this module that will be used when being imported using `import`.
16
20
 
17
- ### Updated
21
+ ### Changed
18
22
 
19
23
  - This module is now transpiled using Babel.
20
24
  - The UMD version of this module now exposes itself using the name `koco` instead of `KoCo`.
21
25
 
22
- ## [1.4.0] (2019-04-30)
26
+ ## 1.4.0 - 2019-04-30
23
27
 
24
28
  ### Added
25
29
 
26
30
  - Introduced a browser entry point that is ES5 compatible and minified.
27
31
 
28
- ## [1.3.0] (2018-12-06)
32
+ ## 1.3.0 - 2018-12-06
29
33
 
30
34
  ### Added
31
35
 
32
- - Introduced documentation to the Typescript type definitons.
36
+ - Introduced documentation to the Typescript type definitions.
33
37
 
34
- ## [1.2.1] (2018-02-07)
38
+ ## 1.2.1 - 2018-02-07
35
39
 
36
40
  ### Fixed
37
41
 
38
42
  - The `konamicode` event now fires even when the user has their caps lock enabled.
39
43
 
40
- ## [1.2.0] (2018-01-31)
44
+ ## 1.2.0 - 2018-01-31
41
45
 
42
46
  ### Changed
43
47
 
44
48
  - Updated `KoCo.addSupportForTheKonamiCode()` to return a function that will remove support for the Konami Code.
45
49
 
46
- ## [1.1.0] (2018-01-02)
50
+ ## 1.1.0 - 2018-01-02
47
51
 
48
52
  ### Changed
49
53
 
50
54
  - Updated the `konamicode` event so it is now cancelable.
51
55
 
52
- ## [1.0.0] (2017-05-16)
56
+ ## 1.0.0 - 2017-05-16
53
57
 
54
58
  The initial public release.
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 - 2021 Luke Phillips
3
+ Copyright (c) 2017 - 2024 Luke Phillips
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # KoCo
1
+ # `ko-co`
2
2
 
3
3
  [![Available from NPM](https://img.shields.io/npm/v/ko-co.svg?maxAge=900)](https://www.npmjs.com/package/ko-co)
4
- [![Built using Travis](https://img.shields.io/travis/com/lsphillips/KoCo/master.svg?maxAge=900)](https://travis-ci.com/lsphillips/KoCo)
4
+ [![Built using GitHub Action](https://github.com/lsphillips/ko-co/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/lsphillips/ko-co/actions)
5
5
 
6
6
  Adds support for the Konami Code; making your website automatically cool.
7
7
 
package/ko-co.cjs CHANGED
@@ -1 +1 @@
1
- !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).koco={})}(this,(function(e){"use strict";var o=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],t=[].concat(o,["enter"]);function n(e,o){var t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?t=new window.CustomEvent(o,{detail:n,bubbles:r,cancelable:i}):(t=document.createEvent("CustomEvent")).initCustomEvent(o,r,i,n),e.dispatchEvent(t)}e.addSupportForTheKonamiCode=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.requireEnterPress,i=void 0!==r&&r,d=e.allowedTimeBetweenKeys,u=void 0===d?0:d,a=o,l=null,c=0;function f(e){return l&&clearTimeout(l),a[c]!==e.key.toLowerCase()?(l=null,void(c=0)):(++c,a.length===c?(l=null,c=0,void n(e.target,"konamicode",{})):void(u>0&&(l=setTimeout((function(){l=null,c=0}),u))))}return i&&(a=t),document.addEventListener("keydown",f,!0),function(){document.removeEventListener("keydown",f,!0)}},Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o((e="undefined"!=typeof globalThis?globalThis:e||self).koco={})}(this,(function(e){"use strict";var o=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],n=[].concat(o,["enter"]);e.addSupportForTheKonamiCode=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.requireEnterPress,r=void 0!==t&&t,i=e.allowedTimeBetweenKeys,d=void 0===i?0:i,u=o,a=null,l=0;function c(e){return a&&clearTimeout(a),u[l]!==e.key.toLowerCase()?(a=null,void(l=0)):(++l,u.length===l?(a=null,l=0,void function(e,o){var n,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?n=new window.CustomEvent(o,{detail:t,bubbles:r,cancelable:i}):(n=document.createEvent("CustomEvent")).initCustomEvent(o,r,i,t),e.dispatchEvent(n)}(e.target,"konamicode",{})):void(d>0&&(a=setTimeout((function(){a=null,l=0}),d))))}return r&&(u=n),document.addEventListener("keydown",c,!0),function(){document.removeEventListener("keydown",c,!0)}}}));
package/ko-co.d.ts CHANGED
@@ -1,56 +1,56 @@
1
- /**
2
- * Options that define how a Konami Code sequence is detected.
3
- */
4
- export interface KonamiCodeDetectionOptions
5
- {
6
- /**
7
- * Determines whether the enter key is required to conclude a Konami Code sequence.
8
- */
9
- requireEnterPress? : boolean;
10
-
11
- /**
12
- * The maximum amount of time (in milliseconds) to wait between key presses before sequence progress is reset.
13
- */
14
- allowedTimeBetweenKeys? : number;
15
- }
16
-
17
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18
-
19
- /**
20
- * A synchronous function that will remove support for the Konami Code.
21
- */
22
- export interface KonamiCodeSupportRemover
23
- {
24
- () : void
25
- }
26
-
27
- // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28
-
29
- /**
30
- * Adds support for the Konami Code.
31
- *
32
- * Example usage:
33
- *
34
- * ``` js
35
- * koco.addSupportForTheKonamiCode(
36
- * {
37
- * allowedTimeBetweenKeys : 500
38
- * });
39
- * ```
40
- *
41
- * Once support is added, all elements will now fire a `konamicode` event whenever the user enters the Konami Code sequence:
42
- *
43
- * ``` js
44
- * target.addEventListener('konamicode', () =>
45
- * {
46
- * console.log('The Konami Code has been entered. 30 more lives for you!');
47
- * });
48
- * ```
49
- *
50
- * **Note:** The `konamicode` event bubbles and is cancelable.
51
- *
52
- * @param options Options that define how a Konami Code sequence is detected. By default, the enter key is not required to conclude the Konami Code sequence and it will wait indefinitely between key presses.
53
- *
54
- * @returns A synchronous function that can be called to remove support for the Konami Code.
55
- */
56
- export function addSupportForTheKonamiCode(options? : KonamiCodeDetectionOptions) : KonamiCodeSupportRemover;
1
+ /**
2
+ * Options that define how a Konami Code sequence is detected.
3
+ */
4
+ export interface KonamiCodeDetectionOptions
5
+ {
6
+ /**
7
+ * Determines whether the enter key is required to conclude a Konami Code sequence.
8
+ */
9
+ requireEnterPress? : boolean;
10
+
11
+ /**
12
+ * The maximum amount of time (in milliseconds) to wait between key presses before sequence progress is reset.
13
+ */
14
+ allowedTimeBetweenKeys? : number;
15
+ }
16
+
17
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18
+
19
+ /**
20
+ * A synchronous function that will remove support for the Konami Code.
21
+ */
22
+ export interface KonamiCodeSupportRemover
23
+ {
24
+ () : void
25
+ }
26
+
27
+ // - - - - - - - - - - - - - - - - - - - - - - - - - - - -
28
+
29
+ /**
30
+ * Adds support for the Konami Code.
31
+ *
32
+ * Example usage:
33
+ *
34
+ * ``` js
35
+ * koco.addSupportForTheKonamiCode(
36
+ * {
37
+ * allowedTimeBetweenKeys : 500
38
+ * });
39
+ * ```
40
+ *
41
+ * Once support is added, all elements will now fire a `konamicode` event whenever the user enters the Konami Code sequence:
42
+ *
43
+ * ``` js
44
+ * target.addEventListener('konamicode', () =>
45
+ * {
46
+ * console.log('The Konami Code has been entered. 30 more lives for you!');
47
+ * });
48
+ * ```
49
+ *
50
+ * **Note:** The `konamicode` event bubbles and is cancelable.
51
+ *
52
+ * @param options Options that define how a Konami Code sequence is detected. By default, the enter key is not required to conclude the Konami Code sequence and it will wait indefinitely between key presses.
53
+ *
54
+ * @returns A synchronous function that can be called to remove support for the Konami Code.
55
+ */
56
+ export function addSupportForTheKonamiCode(options? : KonamiCodeDetectionOptions) : KonamiCodeSupportRemover;
package/ko-co.js CHANGED
@@ -1 +1 @@
1
- var e=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],n=[].concat(e,["enter"]);function t(e,n){var t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?t=new window.CustomEvent(n,{detail:o,bubbles:r,cancelable:i}):(t=document.createEvent("CustomEvent")).initCustomEvent(n,r,i,o),e.dispatchEvent(t)}function o(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=o.requireEnterPress,i=void 0!==r&&r,u=o.allowedTimeBetweenKeys,a=void 0===u?0:u,d=e,l=null,w=0;function v(e){return l&&clearTimeout(l),d[w]!==e.key.toLowerCase()?(l=null,void(w=0)):(++w,d.length===w?(l=null,w=0,void t(e.target,"konamicode",{})):void(a>0&&(l=setTimeout((function(){l=null,w=0}),a))))}return i&&(d=n),document.addEventListener("keydown",v,!0),function(){document.removeEventListener("keydown",v,!0)}}export{o as addSupportForTheKonamiCode};
1
+ var e=["arrowup","arrowup","arrowdown","arrowdown","arrowleft","arrowright","arrowleft","arrowright","b","a"],n=[].concat(e,["enter"]);function t(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=t.requireEnterPress,r=void 0!==o&&o,i=t.allowedTimeBetweenKeys,u=void 0===i?0:i,a=e,d=null,l=0;function w(e){return d&&clearTimeout(d),a[l]!==e.key.toLowerCase()?(d=null,void(l=0)):(++l,a.length===l?(d=null,l=0,void function(e,n){var t,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=!0,i=!0;"function"==typeof window.CustomEvent?t=new window.CustomEvent(n,{detail:o,bubbles:r,cancelable:i}):(t=document.createEvent("CustomEvent")).initCustomEvent(n,r,i,o),e.dispatchEvent(t)}(e.target,"konamicode",{})):void(u>0&&(d=setTimeout((function(){d=null,l=0}),u))))}return r&&(a=n),document.addEventListener("keydown",w,!0),function(){document.removeEventListener("keydown",w,!0)}}export{t as addSupportForTheKonamiCode};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name" : "ko-co",
3
3
 
4
- "version" : "1.5.1",
4
+ "version" : "1.5.2",
5
5
 
6
6
  "type" : "module",
7
7
 
@@ -20,33 +20,34 @@
20
20
  "cool"
21
21
  ],
22
22
 
23
- "homepage" : "https://github.com/lsphillips/KoCo",
23
+ "homepage" : "https://github.com/lsphillips/ko-co",
24
24
 
25
25
  "bugs" :
26
26
  {
27
- "url" : "https://github.com/lsphillips/KoCo/issues"
27
+ "url" : "https://github.com/lsphillips/ko-co/issues"
28
28
  },
29
29
 
30
30
  "devDependencies" :
31
31
  {
32
- "rollup" : "2.48.0",
33
- "rollup-plugin-terser" : "7.0.2",
34
- "@rollup/plugin-node-resolve" : "13.0.0",
35
- "@rollup/plugin-commonjs" : "19.0.0",
36
- "@rollup/plugin-babel" : "5.3.0",
37
- "mocha" : "8.4.0",
38
- "sinon" : "10.0.0",
39
- "eslint" : "7.26.0",
40
- "eslint-plugin-import" : "2.23.1",
41
- "eslint-plugin-promise" : "5.1.0",
42
- "eslint-config-protect-me-from-my-stupidity" : "7.2.1",
43
- "karma" : "6.3.2",
32
+ "rollup" : "4.17.2",
33
+ "@rollup/plugin-terser" : "0.4.4",
34
+ "@rollup/plugin-node-resolve" : "15.2.3",
35
+ "@rollup/plugin-commonjs" : "25.0.7",
36
+ "@rollup/plugin-babel" : "6.0.4",
37
+ "mocha" : "10.4.0",
38
+ "sinon" : "18.0.0",
39
+ "eslint" : "8.57.0",
40
+ "eslint-plugin-import" : "2.29.1",
41
+ "eslint-plugin-promise" : "6.1.1",
42
+ "@stylistic/eslint-plugin-js" : "1.8.1",
43
+ "eslint-config-protect-me-from-my-stupidity" : "10.1.0",
44
+ "karma" : "6.4.3",
44
45
  "karma-mocha" : "2.0.1",
45
- "karma-mocha-reporter" : "2.2.5",
46
- "karma-rollup-preprocessor" : "7.0.7",
47
- "karma-chrome-launcher" : "3.1.0",
48
- "@babel/core" : "7.14.2",
49
- "@babel/preset-env" : "7.14.2",
46
+ "karma-spec-reporter" : "0.0.36",
47
+ "karma-rollup-preprocessor" : "7.0.8",
48
+ "karma-chrome-launcher" : "3.2.0",
49
+ "@babel/core" : "7.24.5",
50
+ "@babel/preset-env" : "7.24.5",
50
51
  "timeout-as-promise" : "1.0.0"
51
52
  },
52
53
 
@@ -72,7 +73,7 @@
72
73
  "repository" :
73
74
  {
74
75
  "type" : "git",
75
- "url" : "https://github.com/lsphillips/KoCo.git"
76
+ "url" : "https://github.com/lsphillips/ko-co.git"
76
77
  },
77
78
 
78
79
  "scripts" :