`
7 |
8 | See the demo at [http://projects.natemoo.re/konami-listener](http://projects.natemoo.re/konami-listener)
9 |
10 | ## Getting Started
11 |
12 | ### Script tag
13 |
14 | - Add the javascript module in the head of your index.html file
15 | ```html
16 |
17 | ```
18 | - Use `` anywhere in your templates, JSX, html, etc
19 |
20 | ### Node Modules
21 | - Run `npm install konami-listener --save`
22 | - Add the javascript module in the head of your index.html file
23 | ```html
24 |
25 | ```
26 | - Use `` anywhere in your templates, JSX, html, etc
27 |
28 | ### In a stencil-starter app
29 | - Run `npm install konami-listener --save`
30 | - Add `{ name: 'konami-listener' }` to your [collections](https://github.com/ionic-team/stencil-starter/blob/master/stencil.config.js#L5)
31 | - Use `` anywhere in your templates, JSX, html, etc
32 |
33 | ## API
34 | ### Simple Usage
35 | `` allows you to place any content inside of it. It will then be shown when the code is matched. By default, the container is absolutely positioned over the entire page, so style the internal markup accordingly.
36 | ```html
37 |
38 |
💩
39 |
40 | ```
41 |
42 | ### Events
43 | `` emits the following custom events
44 | | Event Name | Description | Data |
45 | | ----------- | ------------------------------------------------ | -------------------------------- |
46 | | input | Emitted on each keydown as the code progresses | `{ key: string, index: number }` |
47 | | match | Emitted on the final match | none |
48 |
49 | To listen for events, just use `addEventListener`. Since it uses custom HTML events, the data payload is bound to `event.detail`.
50 | ```js
51 | const konami = document.querySelector('konami-listener');
52 | konami.addEventListener('match', () => {
53 | console.log('Konami Code matched!');
54 | })
55 | konami.addEventListener('input', (e) => {
56 | const { key, index } = e.detail;
57 | console.log('Konami Code progress', { key, index });
58 | })
59 | ```
60 |
61 | ## Framework Integration
62 | If you'd like to drop this component into Angular, React, or any other framework, take a look at Stencil's [Framework Integration guide](https://stenciljs.com/docs/framework-integration)
--------------------------------------------------------------------------------
/src/main.css:
--------------------------------------------------------------------------------
1 | @keyframes fade {
2 | 0% {
3 | opacity: 0.5;
4 | }
5 | 100% {
6 | opacity: 0;
7 | }
8 | }
9 |
10 | :root {
11 | --color-red: #f4511e;
12 | --header-size: 200px;
13 | --footer-size: 56px;
14 | }
15 |
16 | html, body {
17 | padding: 0;
18 | margin: 0;
19 | }
20 |
21 | header {
22 | box-sizing: border-box;
23 | width: 100%;
24 | height: var(--header-size);
25 | display: flex;
26 | flex-flow: column nowrap;
27 | align-items: center;
28 | justify-content: center;
29 | text-align: center;
30 | padding: 0 12px;
31 | max-width: 570px;
32 | margin: 0 auto;
33 | }
34 | header h1 {
35 | margin: 0;
36 | font-family: 'Press Start 2P', sans-serif;
37 | line-height: 1.2;
38 | }
39 | header p {
40 | font-family: sans-serif;
41 | color: rgba(0,0,0,0.54);
42 | }
43 | header code {
44 | box-sizing: border-box;
45 | padding: 1px 4px 0 4px;
46 | line-height: 1;
47 | background-color: rgba(0, 0, 0, 0.12);
48 | border-radius: 4px;
49 | white-space: nowrap;
50 | }
51 |
52 |
53 | footer {
54 | box-sizing: border-box;
55 | height: var(--footer-size);
56 | background-color: red;
57 | width: 100%;
58 | display: flex;
59 | align-items: center;
60 | }
61 | footer .inner {
62 | box-sizing: border-box;
63 | width: 100%;
64 | display: flex;
65 | align-items: center;
66 | justify-content: space-between;
67 | max-width: 570px;
68 | margin: 0 auto;
69 | }
70 | footer .inner div {
71 | box-sizing: border-box;
72 | text-align: center;
73 | padding: 0 12px;
74 | }
75 | footer h4 {
76 | margin: 0;
77 | font-family: sans-serif;
78 | font-weight: 400;
79 | color: #FFF;
80 | }
81 | footer a {
82 | font-family: 'Press Start 2P', sans-serif;
83 | font-size: 14px;
84 | color: #FFF;
85 | }
86 |
87 | main, .prize {
88 | height: calc(calc(100vh - var(--header-size)) - var(--footer-size));
89 | width: 100%;
90 | max-width: calc(1000px / 4);
91 |
92 | display: flex;
93 | align-items: center;
94 | justify-content: center;
95 | margin: 0 auto;
96 | }
97 |
98 | main.hidden {
99 | opacity: 0;
100 | }
101 |
102 | .prize {
103 | flex-flow: column nowrap;
104 | align-items: center;
105 | justify-content: center;
106 | height: 100vh;
107 | font-size: 126px;
108 | }
109 | .prize h2 {
110 | font-size: 32px;
111 | font-family: 'Press Start 2P', sans-serif;
112 | color: var(--color-red);
113 | margin: 0;
114 | line-height: 1;
115 |
116 | }
117 |
118 | .inputs {
119 | width: 100%;
120 | flex-flow: row wrap;
121 | display: flex;
122 | align-items: center;
123 | justify-content: space-between;
124 | transform: scale(.7);
125 | }
126 |
127 | .inputs > div {
128 | --size: 100px;
129 | margin: 12px;
130 | width: var(--size);
131 | height: var(--size);
132 | }
133 |
134 | .inputs > div > svg > path.fixed {
135 | fill: rgba(0,0,0,0.32);
136 | /* stroke-width: 4px; */
137 | z-index: 1;
138 | }
139 | .inputs > div > svg > path:not(.fixed) {
140 | transition: 250ms ease-out all;
141 | fill: none;
142 | stroke-width: 2px;
143 | opacity: 0.5;
144 | z-index: -1;
145 | stroke: var(--color-red);
146 |
147 | opacity: 0;
148 | transform-origin: center center;
149 | }
150 |
151 | .inputs > div > svg {
152 | overflow: visible;
153 | }
154 |
155 | .inputs > div.active > svg > path.fixed {
156 | fill: var(--color-red);
157 | stroke: transparent;
158 | }
159 | .inputs > div.active > svg > path:not(.fixed) {
160 | display: block;
161 | opacity: 1;
162 | transform: scale(1.5);
163 | animation: 150ms 100ms fade forwards;
164 | }
165 |
166 | div.up.active > svg > path:not(.fixed) {
167 | transform: translateY(-70px);
168 | }
169 | div.down.active > svg > path:not(.fixed) {
170 | transform: translateY(70px);
171 | }
172 | div.left.active > svg > path:not(.fixed) {
173 | transform: translateX(-70px);
174 | }
175 | div.right.active > svg > path:not(.fixed) {
176 | transform: translateX(70px);
177 | }
178 | div.B.active > svg > path:not(.fixed) {
179 | transform: scale(1.75);
180 | }
181 | div.A.active > svg > path:not(.fixed) {
182 | transform: scale(1.75);
183 | }
184 | @media only screen and (min-width: 555px) {
185 | header {
186 | margin-bottom: calc(var(--header-size) / -4);
187 | }
188 | main {
189 | padding-bottom: calc(var(--header-size) / 4);
190 | }
191 | }
192 |
193 | @media only screen and (min-width: 1180px) {
194 | main {
195 | max-width: 1180px;
196 | }
197 | footer {
198 | justify-content: center;
199 | }
200 | .inputs {
201 | transform: scale(1);
202 | }
203 |
204 | .inputs > div {
205 | margin: 0;
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/www/main.css:
--------------------------------------------------------------------------------
1 | @keyframes fade {
2 | 0% {
3 | opacity: 0.5;
4 | }
5 | 100% {
6 | opacity: 0;
7 | }
8 | }
9 |
10 | :root {
11 | --color-red: #f4511e;
12 | --header-size: 200px;
13 | --footer-size: 56px;
14 | }
15 |
16 | html, body {
17 | padding: 0;
18 | margin: 0;
19 | }
20 |
21 | header {
22 | box-sizing: border-box;
23 | width: 100%;
24 | height: var(--header-size);
25 | display: flex;
26 | flex-flow: column nowrap;
27 | align-items: center;
28 | justify-content: center;
29 | text-align: center;
30 | padding: 0 12px;
31 | max-width: 570px;
32 | margin: 0 auto;
33 | }
34 | header h1 {
35 | margin: 0;
36 | font-family: 'Press Start 2P', sans-serif;
37 | line-height: 1.2;
38 | }
39 | header p {
40 | font-family: sans-serif;
41 | color: rgba(0,0,0,0.54);
42 | }
43 | header code {
44 | box-sizing: border-box;
45 | padding: 1px 4px 0 4px;
46 | line-height: 1;
47 | background-color: rgba(0, 0, 0, 0.12);
48 | border-radius: 4px;
49 | white-space: nowrap;
50 | }
51 |
52 |
53 | footer {
54 | box-sizing: border-box;
55 | height: var(--footer-size);
56 | background-color: red;
57 | width: 100%;
58 | display: flex;
59 | align-items: center;
60 | }
61 | footer .inner {
62 | box-sizing: border-box;
63 | width: 100%;
64 | display: flex;
65 | align-items: center;
66 | justify-content: space-between;
67 | max-width: 570px;
68 | margin: 0 auto;
69 | }
70 | footer .inner div {
71 | box-sizing: border-box;
72 | text-align: center;
73 | padding: 0 12px;
74 | }
75 | footer h4 {
76 | margin: 0;
77 | font-family: sans-serif;
78 | font-weight: 400;
79 | color: #FFF;
80 | }
81 | footer a {
82 | font-family: 'Press Start 2P', sans-serif;
83 | font-size: 14px;
84 | color: #FFF;
85 | }
86 |
87 | main, .prize {
88 | height: calc(calc(100vh - var(--header-size)) - var(--footer-size));
89 | width: 100%;
90 | max-width: calc(1000px / 4);
91 |
92 | display: flex;
93 | align-items: center;
94 | justify-content: center;
95 | margin: 0 auto;
96 | }
97 |
98 | main.hidden {
99 | opacity: 0;
100 | }
101 |
102 | .prize {
103 | flex-flow: column nowrap;
104 | align-items: center;
105 | justify-content: center;
106 | height: 100vh;
107 | font-size: 126px;
108 | }
109 | .prize h2 {
110 | font-size: 32px;
111 | font-family: 'Press Start 2P', sans-serif;
112 | color: var(--color-red);
113 | margin: 0;
114 | line-height: 1;
115 |
116 | }
117 |
118 | .inputs {
119 | width: 100%;
120 | flex-flow: row wrap;
121 | display: flex;
122 | align-items: center;
123 | justify-content: space-between;
124 | transform: scale(.7);
125 | }
126 |
127 | .inputs > div {
128 | --size: 100px;
129 | margin: 12px;
130 | width: var(--size);
131 | height: var(--size);
132 | }
133 |
134 | .inputs > div > svg > path.fixed {
135 | fill: rgba(0,0,0,0.32);
136 | /* stroke-width: 4px; */
137 | z-index: 1;
138 | }
139 | .inputs > div > svg > path:not(.fixed) {
140 | transition: 250ms ease-out all;
141 | fill: none;
142 | stroke-width: 2px;
143 | opacity: 0.5;
144 | z-index: -1;
145 | stroke: var(--color-red);
146 |
147 | opacity: 0;
148 | transform-origin: center center;
149 | }
150 |
151 | .inputs > div > svg {
152 | overflow: visible;
153 | }
154 |
155 | .inputs > div.active > svg > path.fixed {
156 | fill: var(--color-red);
157 | stroke: transparent;
158 | }
159 | .inputs > div.active > svg > path:not(.fixed) {
160 | display: block;
161 | opacity: 1;
162 | transform: scale(1.5);
163 | animation: 150ms 100ms fade forwards;
164 | }
165 |
166 | div.up.active > svg > path:not(.fixed) {
167 | transform: translateY(-70px);
168 | }
169 | div.down.active > svg > path:not(.fixed) {
170 | transform: translateY(70px);
171 | }
172 | div.left.active > svg > path:not(.fixed) {
173 | transform: translateX(-70px);
174 | }
175 | div.right.active > svg > path:not(.fixed) {
176 | transform: translateX(70px);
177 | }
178 | div.B.active > svg > path:not(.fixed) {
179 | transform: scale(1.75);
180 | }
181 | div.A.active > svg > path:not(.fixed) {
182 | transform: scale(1.75);
183 | }
184 | @media only screen and (min-width: 555px) {
185 | header {
186 | margin-bottom: calc(var(--header-size) / -4);
187 | }
188 | main {
189 | padding-bottom: calc(var(--header-size) / 4);
190 | }
191 | }
192 |
193 | @media only screen and (min-width: 1180px) {
194 | main {
195 | max-width: 1180px;
196 | }
197 | footer {
198 | justify-content: center;
199 | }
200 | .inputs {
201 | transform: scale(1);
202 | }
203 |
204 | .inputs > div {
205 | margin: 0;
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/dist/collection/main.css:
--------------------------------------------------------------------------------
1 | @keyframes fade {
2 | 0% {
3 | opacity: 0.5;
4 | }
5 | 100% {
6 | opacity: 0;
7 | }
8 | }
9 |
10 | :root {
11 | --color-red: #f4511e;
12 | --header-size: 200px;
13 | --footer-size: 56px;
14 | }
15 |
16 | html, body {
17 | padding: 0;
18 | margin: 0;
19 | }
20 |
21 | header {
22 | box-sizing: border-box;
23 | width: 100%;
24 | height: var(--header-size);
25 | display: flex;
26 | flex-flow: column nowrap;
27 | align-items: center;
28 | justify-content: center;
29 | text-align: center;
30 | padding: 0 12px;
31 | max-width: 570px;
32 | margin: 0 auto;
33 | }
34 | header h1 {
35 | margin: 0;
36 | font-family: 'Press Start 2P', sans-serif;
37 | line-height: 1.2;
38 | }
39 | header p {
40 | font-family: sans-serif;
41 | color: rgba(0,0,0,0.54);
42 | }
43 | header code {
44 | box-sizing: border-box;
45 | padding: 1px 4px 0 4px;
46 | line-height: 1;
47 | background-color: rgba(0, 0, 0, 0.12);
48 | border-radius: 4px;
49 | white-space: nowrap;
50 | }
51 |
52 |
53 | footer {
54 | box-sizing: border-box;
55 | height: var(--footer-size);
56 | background-color: red;
57 | width: 100%;
58 | display: flex;
59 | align-items: center;
60 | }
61 | footer .inner {
62 | box-sizing: border-box;
63 | width: 100%;
64 | display: flex;
65 | align-items: center;
66 | justify-content: space-between;
67 | max-width: 570px;
68 | margin: 0 auto;
69 | }
70 | footer .inner div {
71 | box-sizing: border-box;
72 | text-align: center;
73 | padding: 0 12px;
74 | }
75 | footer h4 {
76 | margin: 0;
77 | font-family: sans-serif;
78 | font-weight: 400;
79 | color: #FFF;
80 | }
81 | footer a {
82 | font-family: 'Press Start 2P', sans-serif;
83 | font-size: 14px;
84 | color: #FFF;
85 | }
86 |
87 | main, .prize {
88 | height: calc(calc(100vh - var(--header-size)) - var(--footer-size));
89 | width: 100%;
90 | max-width: calc(1000px / 4);
91 |
92 | display: flex;
93 | align-items: center;
94 | justify-content: center;
95 | margin: 0 auto;
96 | }
97 |
98 | main.hidden {
99 | opacity: 0;
100 | }
101 |
102 | .prize {
103 | flex-flow: column nowrap;
104 | align-items: center;
105 | justify-content: center;
106 | height: 100vh;
107 | font-size: 126px;
108 | }
109 | .prize h2 {
110 | font-size: 32px;
111 | font-family: 'Press Start 2P', sans-serif;
112 | color: var(--color-red);
113 | margin: 0;
114 | line-height: 1;
115 |
116 | }
117 |
118 | .inputs {
119 | width: 100%;
120 | flex-flow: row wrap;
121 | display: flex;
122 | align-items: center;
123 | justify-content: space-between;
124 | transform: scale(.7);
125 | }
126 |
127 | .inputs > div {
128 | --size: 100px;
129 | margin: 12px;
130 | width: var(--size);
131 | height: var(--size);
132 | }
133 |
134 | .inputs > div > svg > path.fixed {
135 | fill: rgba(0,0,0,0.32);
136 | /* stroke-width: 4px; */
137 | z-index: 1;
138 | }
139 | .inputs > div > svg > path:not(.fixed) {
140 | transition: 250ms ease-out all;
141 | fill: none;
142 | stroke-width: 2px;
143 | opacity: 0.5;
144 | z-index: -1;
145 | stroke: var(--color-red);
146 |
147 | opacity: 0;
148 | transform-origin: center center;
149 | }
150 |
151 | .inputs > div > svg {
152 | overflow: visible;
153 | }
154 |
155 | .inputs > div.active > svg > path.fixed {
156 | fill: var(--color-red);
157 | stroke: transparent;
158 | }
159 | .inputs > div.active > svg > path:not(.fixed) {
160 | display: block;
161 | opacity: 1;
162 | transform: scale(1.5);
163 | animation: 150ms 100ms fade forwards;
164 | }
165 |
166 | div.up.active > svg > path:not(.fixed) {
167 | transform: translateY(-70px);
168 | }
169 | div.down.active > svg > path:not(.fixed) {
170 | transform: translateY(70px);
171 | }
172 | div.left.active > svg > path:not(.fixed) {
173 | transform: translateX(-70px);
174 | }
175 | div.right.active > svg > path:not(.fixed) {
176 | transform: translateX(70px);
177 | }
178 | div.B.active > svg > path:not(.fixed) {
179 | transform: scale(1.75);
180 | }
181 | div.A.active > svg > path:not(.fixed) {
182 | transform: scale(1.75);
183 | }
184 | @media only screen and (min-width: 555px) {
185 | header {
186 | margin-bottom: calc(var(--header-size) / -4);
187 | }
188 | main {
189 | padding-bottom: calc(var(--header-size) / 4);
190 | }
191 | }
192 |
193 | @media only screen and (min-width: 1180px) {
194 | main {
195 | max-width: 1180px;
196 | }
197 | footer {
198 | justify-content: center;
199 | }
200 | .inputs {
201 | transform: scale(1);
202 | }
203 |
204 | .inputs > div {
205 | margin: 0;
206 | }
207 | }
208 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Thanks for your interest in contributing to the Stencil Component Starter! :tada:
4 |
5 |
6 | ## Contributing Etiquette
7 |
8 | Please see our [Contributor Code of Conduct](https://github.com/ionic-team/stencil/blob/master/CODE_OF_CONDUCT.md) for information on our rules of conduct.
9 |
10 |
11 | ## Creating an Issue
12 |
13 | * If you have a question about using Stencil, please ask in the [Stencil Worldwide Slack](https://join.slack.com/t/stencil-worldwide/shared_invite/enQtMjQ2MzkyMTY0MTk0LTQ4ODgzYjFjNjdkNDY3YWVhMmNlMTljMWQxNTM3Yjg0ZTIyZTM1MmU2YWE5YzNjNzE1MmQ3ZTk2NjQ1YzM5ZDM group.
14 |
15 | * It is required that you clearly describe the steps necessary to reproduce the issue you are running into. Although we would love to help our users as much as possible, diagnosing issues without clear reproduction steps is extremely time-consuming and simply not sustainable.
16 |
17 | * The issue list of this repository is exclusively for bug reports and feature requests. Non-conforming issues will be closed immediately.
18 |
19 | * Issues with no clear steps to reproduce will not be triaged. If an issue is labeled with "needs reply" and receives no further replies from the author of the issue for more than 5 days, it will be closed.
20 |
21 | * If you think you have found a bug, or have a new feature idea, please start by making sure it hasn't already been [reported](https://github.com/ionic-team/stencil/issues?utf8=%E2%9C%93&q=is%3Aissue). You can search through existing issues to see if there is a similar one reported. Include closed issues as it may have been closed with a solution.
22 |
23 | * Next, [create a new issue](https://github.com/ionic-team/stencil-component-starter/issues/new) that thoroughly explains the problem. Please fill out the populated issue form before submitting the issue.
24 |
25 |
26 | ## Creating a Pull Request
27 |
28 | * We appreciate you taking the time to contribute! Before submitting a pull request, we ask that you please [create an issue](#creating-an-issue) that explains the bug or feature request and let us know that you plan on creating a pull request for it. If an issue already exists, please comment on that issue letting us know you would like to submit a pull request for it. This helps us to keep track of the pull request and make sure there isn't duplicated effort.
29 |
30 | * Looking for an issue to fix? Make sure to look through our issues with the [help wanted](https://github.com/ionic-team/stencil-component-starter/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) label!
31 |
32 | ### Setup
33 |
34 | 1. Fork the repo.
35 | 2. Clone your fork.
36 | 3. Make a branch for your change.
37 | 4. Run `npm install` (make sure you have [node](https://nodejs.org/en/) and [npm](http://blog.npmjs.org/post/85484771375/how-to-install-npm) installed first)
38 |
39 |
40 | #### Updates
41 |
42 | 1. Unit test. Unit test. Unit test. Please take a look at how other unit tests are written, and you can't write too many tests.
43 | 2. If there is a `*.spec.ts` file located in the components folder, update it to include a test for your change, if needed. If this file doesn't exist, please notify us.
44 | 3. Run `npm run test` or `npm run test.watch` to make sure all tests are working, regardless if a test was added.
45 |
46 |
47 | ## Commit Message Format
48 |
49 | We have very precise rules over how our git commit messages should be formatted. This leads to readable messages that are easy to follow when looking through the project history. We also use the git commit messages to generate our changelog. (Ok you got us, it's basically Angular's commit message format).
50 |
51 | `type(scope): subject`
52 |
53 | #### Type
54 | Must be one of the following:
55 |
56 | * **feat**: A new feature
57 | * **fix**: A bug fix
58 | * **docs**: Documentation only changes
59 | * **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
60 | * **refactor**: A code change that neither fixes a bug nor adds a feature
61 | * **perf**: A code change that improves performance
62 | * **test**: Adding missing tests
63 | * **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
64 |
65 | #### Scope
66 | The scope can be anything specifying place of the commit change. For example `renderer`, `compiler`, etc.
67 |
68 | #### Subject
69 | The subject contains succinct description of the change:
70 |
71 | * use the imperative, present tense: "change" not "changed" nor "changes"
72 | * do not capitalize first letter
73 | * do not place a period `.` at the end
74 | * entire length of the commit message must not go over 50 characters
75 | * describe what the commit does, not what issue it relates to or fixes
76 | * **be brief, yet descriptive** - we should have a good understanding of what the commit does by reading the subject
77 |
78 |
79 | #### Adding Documentation
80 |
81 | Please see the [stencil-site](https://github.com/ionic-team/stencil-site) repo to update documentation.
82 |
83 |
84 | ## License
85 |
86 | By contributing your code to the ionic-team/stencil GitHub Repository, you agree to license your contribution under the MIT license.
87 |
--------------------------------------------------------------------------------
/dist/esm/es5/polyfills/promise.js:
--------------------------------------------------------------------------------
1 | export function applyPolyfill(window, document) {
2 | /*!
3 | es6-promise - a tiny implementation of Promises/A+.
4 | Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
5 | Licensed under MIT license
6 | See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
7 | v4.2.4+314e4831
8 | */
9 | (window.ES6Promise=function(){function t(){var t=setTimeout;return function(){return t(r,1)}}function r(){for(var t=0;t= 0; x--) {
25 | scriptElm = y[x];
26 | if (scriptElm.src || scriptElm.hasAttribute('data-resources-url')) {
27 | break;
28 | }
29 | }
30 | // get the resource path attribute on this script element
31 | y = scriptElm.getAttribute('data-resources-url');
32 | if (!resourcesUrl && y) {
33 | // the script element has a data-resources-url attribute, always use that
34 | resourcesUrl = y;
35 | }
36 | if (!resourcesUrl && scriptElm.src) {
37 | // we don't have an exact resourcesUrl, so let's
38 | // figure it out relative to this script's src and app's filesystem namespace
39 | y = scriptElm.src.split('/').slice(0, -1);
40 | resourcesUrl = (y.join('/')) + (y.length ? '/' : '') + fsNamespace + '/';
41 | }
42 | // request the core this browser needs
43 | // test for native support of custom elements and fetch
44 | // if either of those are not supported, then use the core w/ polyfills
45 | // also check if the page was build with ssr or not
46 | x = doc.createElement('script');
47 | if (usePolyfills(win, win.location, x, 'import("")')) {
48 | // requires the es5/polyfilled core
49 | x.src = resourcesUrl + appCorePolyfilled;
50 | }
51 | else {
52 | // let's do this!
53 | x.src = resourcesUrl + appCore;
54 | x.setAttribute('type', 'module');
55 | x.setAttribute('crossorigin', true);
56 | }
57 | x.setAttribute('data-resources-url', resourcesUrl);
58 | x.setAttribute('data-namespace', fsNamespace);
59 | doc.head.appendChild(x);
60 | }
61 | function usePolyfills(win, location, scriptElm, dynamicImportTest) {
62 | // fyi, dev mode has verbose if/return statements
63 | // but it minifies to a nice 'lil one-liner ;)
64 | if (location.search.indexOf('core=esm') > 0) {
65 | // force esm build
66 | return false;
67 | }
68 | if ((location.search.indexOf('core=es5') > 0) ||
69 | (location.protocol === 'file:') ||
70 | (!(win.customElements && win.customElements.define)) ||
71 | (!win.fetch) ||
72 | (!(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) ||
73 | (!('noModule' in scriptElm))) {
74 | // es5 build w/ polyfills
75 | return true;
76 | }
77 | // final test to see if this browser support dynamic imports
78 | return doesNotSupportsDynamicImports(dynamicImportTest);
79 | }
80 | function doesNotSupportsDynamicImports(dynamicImportTest) {
81 | try {
82 | new Function(dynamicImportTest);
83 | return false;
84 | }
85 | catch (e) { }
86 | return true;
87 | }
88 | function createComponentOnReadyPrototype(win, namespace, HTMLElementPrototype) {
89 | (win['s-apps'] = win['s-apps'] || []).push(namespace);
90 | if (!HTMLElementPrototype.componentOnReady) {
91 | HTMLElementPrototype.componentOnReady = function componentOnReady() {
92 | /*tslint:disable*/
93 | var elm = this;
94 | function executor(resolve) {
95 | if (elm.nodeName.indexOf('-') > 0) {
96 | // window hasn't loaded yet and there's a
97 | // good chance this is a custom element
98 | var apps = win['s-apps'];
99 | var appsReady = 0;
100 | // loop through all the app namespaces
101 | for (var i = 0; i < apps.length; i++) {
102 | // see if this app has "componentOnReady" setup
103 | if (win[apps[i]].componentOnReady) {
104 | // this app's core has loaded call its "componentOnReady"
105 | if (win[apps[i]].componentOnReady(elm, resolve)) {
106 | // this component does belong to this app and would
107 | // have fired off the resolve fn
108 | // let's stop here, we're good
109 | return;
110 | }
111 | appsReady++;
112 | }
113 | }
114 | if (appsReady < apps.length) {
115 | // not all apps are ready yet
116 | // add it to the queue to be figured out when they are
117 | (win['s-cr'] = win['s-cr'] || []).push([elm, resolve]);
118 | return;
119 | }
120 | }
121 | // not a recognized app component
122 | resolve(null);
123 | }
124 | // callback wasn't provided, let's return a promise
125 | if (win.Promise) {
126 | // use native/polyfilled promise
127 | return new win.Promise(executor);
128 | }
129 | // promise may not have been polyfilled yet
130 | return { then: executor };
131 | };
132 | }
133 | }
134 |
135 |
136 | init(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCoreSsr, appCorePolyfilled, hydratedCssClass, components);
137 |
138 | })(window, document, "KonamiListener","konami-listener",0,"konami-listener.core.js","es5-build-disabled.js","hydrated",[["konami-listener","konami-listener",1,[["el",7],["inputs",5]],1,[["document:keydown","handleKey"]]]],HTMLElement.prototype);
--------------------------------------------------------------------------------
/www/build/konami-listener.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Built with http://stenciljs.com
3 | * 2018-08-19T13:38:16
4 | */
5 | (function(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCoreSsr, appCorePolyfilled, hydratedCssClass, components) {
6 |
7 | function init(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCorePolyfilled, hydratedCssClass, components, HTMLElementPrototype, App, x, y, scriptElm) {
8 | // create global namespace if it doesn't already exist
9 | App = win[namespace] = win[namespace] || {};
10 | App.components = components;
11 | y = components.filter(function (c) { return c[2]; }).map(function (c) { return c[0]; });
12 | if (y.length) {
13 | // auto hide components until they been fully hydrated
14 | // reusing the "x" and "i" variables from the args for funzies
15 | x = doc.createElement('style');
16 | x.innerHTML = y.join() + '{visibility:hidden}.' + hydratedCssClass + '{visibility:inherit}';
17 | x.setAttribute('data-styles', '');
18 | doc.head.insertBefore(x, doc.head.firstChild);
19 | }
20 | createComponentOnReadyPrototype(win, namespace, HTMLElementPrototype);
21 | resourcesUrl = resourcesUrl || App.resourcesUrl;
22 | // figure out the script element for this current script
23 | y = doc.querySelectorAll('script');
24 | for (x = y.length - 1; x >= 0; x--) {
25 | scriptElm = y[x];
26 | if (scriptElm.src || scriptElm.hasAttribute('data-resources-url')) {
27 | break;
28 | }
29 | }
30 | // get the resource path attribute on this script element
31 | y = scriptElm.getAttribute('data-resources-url');
32 | if (!resourcesUrl && y) {
33 | // the script element has a data-resources-url attribute, always use that
34 | resourcesUrl = y;
35 | }
36 | if (!resourcesUrl && scriptElm.src) {
37 | // we don't have an exact resourcesUrl, so let's
38 | // figure it out relative to this script's src and app's filesystem namespace
39 | y = scriptElm.src.split('/').slice(0, -1);
40 | resourcesUrl = (y.join('/')) + (y.length ? '/' : '') + fsNamespace + '/';
41 | }
42 | // request the core this browser needs
43 | // test for native support of custom elements and fetch
44 | // if either of those are not supported, then use the core w/ polyfills
45 | // also check if the page was build with ssr or not
46 | x = doc.createElement('script');
47 | if (usePolyfills(win, win.location, x, 'import("")')) {
48 | // requires the es5/polyfilled core
49 | x.src = resourcesUrl + appCorePolyfilled;
50 | }
51 | else {
52 | // let's do this!
53 | x.src = resourcesUrl + appCore;
54 | x.setAttribute('type', 'module');
55 | x.setAttribute('crossorigin', true);
56 | }
57 | x.setAttribute('data-resources-url', resourcesUrl);
58 | x.setAttribute('data-namespace', fsNamespace);
59 | doc.head.appendChild(x);
60 | }
61 | function usePolyfills(win, location, scriptElm, dynamicImportTest) {
62 | // fyi, dev mode has verbose if/return statements
63 | // but it minifies to a nice 'lil one-liner ;)
64 | if (location.search.indexOf('core=esm') > 0) {
65 | // force esm build
66 | return false;
67 | }
68 | if ((location.search.indexOf('core=es5') > 0) ||
69 | (location.protocol === 'file:') ||
70 | (!(win.customElements && win.customElements.define)) ||
71 | (!win.fetch) ||
72 | (!(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) ||
73 | (!('noModule' in scriptElm))) {
74 | // es5 build w/ polyfills
75 | return true;
76 | }
77 | // final test to see if this browser support dynamic imports
78 | return doesNotSupportsDynamicImports(dynamicImportTest);
79 | }
80 | function doesNotSupportsDynamicImports(dynamicImportTest) {
81 | try {
82 | new Function(dynamicImportTest);
83 | return false;
84 | }
85 | catch (e) { }
86 | return true;
87 | }
88 | function createComponentOnReadyPrototype(win, namespace, HTMLElementPrototype) {
89 | (win['s-apps'] = win['s-apps'] || []).push(namespace);
90 | if (!HTMLElementPrototype.componentOnReady) {
91 | HTMLElementPrototype.componentOnReady = function componentOnReady() {
92 | /*tslint:disable*/
93 | var elm = this;
94 | function executor(resolve) {
95 | if (elm.nodeName.indexOf('-') > 0) {
96 | // window hasn't loaded yet and there's a
97 | // good chance this is a custom element
98 | var apps = win['s-apps'];
99 | var appsReady = 0;
100 | // loop through all the app namespaces
101 | for (var i = 0; i < apps.length; i++) {
102 | // see if this app has "componentOnReady" setup
103 | if (win[apps[i]].componentOnReady) {
104 | // this app's core has loaded call its "componentOnReady"
105 | if (win[apps[i]].componentOnReady(elm, resolve)) {
106 | // this component does belong to this app and would
107 | // have fired off the resolve fn
108 | // let's stop here, we're good
109 | return;
110 | }
111 | appsReady++;
112 | }
113 | }
114 | if (appsReady < apps.length) {
115 | // not all apps are ready yet
116 | // add it to the queue to be figured out when they are
117 | (win['s-cr'] = win['s-cr'] || []).push([elm, resolve]);
118 | return;
119 | }
120 | }
121 | // not a recognized app component
122 | resolve(null);
123 | }
124 | // callback wasn't provided, let's return a promise
125 | if (win.Promise) {
126 | // use native/polyfilled promise
127 | return new win.Promise(executor);
128 | }
129 | // promise may not have been polyfilled yet
130 | return { then: executor };
131 | };
132 | }
133 | }
134 |
135 |
136 | init(win, doc, namespace, fsNamespace, resourcesUrl, appCore, appCoreSsr, appCorePolyfilled, hydratedCssClass, components);
137 |
138 | })(window, document, "KonamiListener","konami-listener",0,"konami-listener.core.js","es5-build-disabled.js","hydrated",[["konami-listener","konami-listener",1,[["el",7],["inputs",5]],1,[["document:keydown","handleKey"]]]],HTMLElement.prototype);
--------------------------------------------------------------------------------
/dist/esm/es5/polyfills/fetch.js:
--------------------------------------------------------------------------------
1 | export function applyPolyfill(window, document) {
2 | /*!
3 | whatwg-fetch, 2.0.3
4 | https://github.com/github/fetch
5 | Copyright (c) 2014-2016 GitHub, Inc. - MIT License
6 | */
7 | (function(e){function l(a){"string"!==typeof a&&(a=String(a));if(/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function q(a){"string"!==typeof a&&(a=String(a));return a}function n(a){var b={next:function(){var b=a.shift();return{done:void 0===b,value:b}}};g.iterable&&(b[Symbol.iterator]=function(){return b});return b}function d(a){this.map={};a instanceof d?a.forEach(function(a,c){this.append(c,a)},this):Array.isArray(a)?
8 | a.forEach(function(a){this.append(a[0],a[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(b){this.append(b,a[b])},this)}function p(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function r(a){return new Promise(function(b,c){a.onload=function(){b(a.result)};a.onerror=function(){c(a.error)}})}function w(a){var b=new FileReader,c=r(b);b.readAsArrayBuffer(a);return c}function x(a){a=new Uint8Array(a);for(var b=Array(a.length),c=0;cthis.status;this.statusText="statusText"in b?b.statusText:"OK";this.headers=new d(b.headers);this.url=b.url||"";this._initBody(a)}if(!e.fetch){var D="Symbol"in e&&"iterator"in Symbol,m;if(m="FileReader"in e&&"Blob"in e)try{new Blob,m=!0}catch(a){m=!1}var g={searchParams:"URLSearchParams"in e,iterable:D,
16 | blob:m,formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(g.arrayBuffer){var E="[object Int8Array];[object Uint8Array];[object Uint8ClampedArray];[object Int16Array];[object Uint16Array];[object Int32Array];[object Uint32Array];[object Float32Array];[object Float64Array]".split(";");var y=function(a){return a&&DataView.prototype.isPrototypeOf(a)};var z=ArrayBuffer.isView||function(a){return a&&-1
2 |
3 |
4 |
5 |
6 | Stencil Component Starter
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
Konami Listener
19 |
A web component to detect the Konami Code on any website! It's as simple as including the script and a <konami-listener> tag.