@mborecki/memory-game 0.1.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.
Files changed (53) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  2. package/dist/cjs/index-D_ddvJ2f.js +3228 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +13 -0
  5. package/dist/cjs/mb-memory-game.cjs.entry.js +213 -0
  6. package/dist/cjs/memory-game.cjs.js +25 -0
  7. package/dist/collection/collection-manifest.json +12 -0
  8. package/dist/collection/components/sliding-puzzle/memory-game.css +72 -0
  9. package/dist/collection/components/sliding-puzzle/memory-game.js +357 -0
  10. package/dist/collection/components/sliding-puzzle/tile.js +16 -0
  11. package/dist/collection/components/sliding-puzzle/types.js +1 -0
  12. package/dist/collection/index.js +1 -0
  13. package/dist/collection/utils/get-set.js +23 -0
  14. package/dist/collection/utils/get-set.test.js +31 -0
  15. package/dist/components/index.d.ts +35 -0
  16. package/dist/components/index.js +1 -0
  17. package/dist/components/mb-memory-game.d.ts +11 -0
  18. package/dist/components/mb-memory-game.js +1 -0
  19. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  20. package/dist/esm/index-D2pBOsDL.js +3221 -0
  21. package/dist/esm/index.js +1 -0
  22. package/dist/esm/loader.js +11 -0
  23. package/dist/esm/mb-memory-game.entry.js +211 -0
  24. package/dist/esm/memory-game.js +21 -0
  25. package/dist/index.cjs.js +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/memory-game/index.esm.js +0 -0
  28. package/dist/memory-game/memory-game.esm.js +1 -0
  29. package/dist/memory-game/p-35b15a0c.entry.js +1 -0
  30. package/dist/memory-game/p-D2pBOsDL.js +2 -0
  31. package/dist/memory-game/p-DQuL1Twl.js +1 -0
  32. package/dist/types/components/sliding-puzzle/memory-game.d.ts +28 -0
  33. package/dist/types/components/sliding-puzzle/tile.d.ts +10 -0
  34. package/dist/types/components/sliding-puzzle/types.d.ts +24 -0
  35. package/dist/types/components.d.ts +84 -0
  36. package/dist/types/index.d.ts +10 -0
  37. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/apps/memory-game/vitest.config.d.ts +2 -0
  38. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/grid/src/grid.d.ts +19 -0
  39. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/grid/src/grid.test.d.ts +1 -0
  40. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/grid/vitest.config.d.ts +2 -0
  41. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/vec2/src/vec2.d.ts +29 -0
  42. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/vec2/src/vec2.test.d.ts +1 -0
  43. package/dist/types/roboczy/mb-puzzle/apps/memory-game/.stencil/shared/vec2/vitest.config.d.ts +2 -0
  44. package/dist/types/stencil-public-runtime.d.ts +1839 -0
  45. package/dist/types/utils/get-set.d.ts +1 -0
  46. package/dist/types/utils/get-set.test.d.ts +1 -0
  47. package/dist/vitest.config.js +4 -0
  48. package/loader/cdn.js +1 -0
  49. package/loader/index.cjs.js +1 -0
  50. package/loader/index.d.ts +24 -0
  51. package/loader/index.es2017.js +1 -0
  52. package/loader/index.js +2 -0
  53. package/package.json +53 -0
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-D_ddvJ2f.js');
4
+ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
+
6
+ const defineCustomElements = async (win, options) => {
7
+ if (typeof window === 'undefined') return undefined;
8
+ await appGlobals.globalScripts();
9
+ return index.bootstrapLazy([["mb-memory-game.cjs",[[513,"mb-memory-game",{"tileGroups":[16],"reverseTile":[16],"init":[4],"cols":[2],"tiles":[32],"selected":[32],"matchedTiles":[32],"uncoverSelected":[32],"initGame":[64]},null,{"board":[{"watchBoard":0}],"matchedTiles":[{"watchMatchedTiles":0}]}]]]], options);
10
+ };
11
+
12
+ exports.setNonce = index.setNonce;
13
+ exports.defineCustomElements = defineCustomElements;
@@ -0,0 +1,213 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-D_ddvJ2f.js');
4
+
5
+ function getSet(items, count) {
6
+ console.log('getSet', items, count);
7
+ if (items.length <= 0)
8
+ throw new Error("getSet() - no items");
9
+ if (items.length === count) {
10
+ return [...items];
11
+ }
12
+ let result = [];
13
+ while (count - result.length > items.length) {
14
+ result = [
15
+ ...result,
16
+ ...items
17
+ ];
18
+ }
19
+ const rest = new Set();
20
+ while (rest.size < count - result.length) {
21
+ rest.add(items[Math.floor(Math.random() * items.length)]);
22
+ }
23
+ return [
24
+ ...result,
25
+ ...rest
26
+ ];
27
+ }
28
+
29
+ function Tile({ tile, selected, matched, uncovered, reversTile }) {
30
+ return index.h("div", { class: {
31
+ 'tile-container': true,
32
+ selected,
33
+ matched
34
+ } }, index.h(TileRender, { tile: uncovered ? tile.data : reversTile }));
35
+ }
36
+ function TileRender({ tile }) {
37
+ if (tile.type === 'text') {
38
+ return index.h("button", { class: "tile tile-text" }, tile.text);
39
+ }
40
+ if (tile.type === 'image') {
41
+ return index.h("button", { class: "tile tile-image" }, index.h("img", { src: tile.imageSrc }));
42
+ }
43
+ }
44
+
45
+ const memoryGameCss = () => `:host{box-sizing:border-box;display:grid;place-content:center;width:100%;height:100%;container-type:size}[part=container]{width:min(100cqw, 100cqh / var(--aspect, 1));height:min(100cqw * var(--aspect, 1), 100cqh);container-type:size;background:pink}[part=list]{width:100cqw;height:100cqh;display:grid;grid-template-columns:repeat(var(--cols, 4), 1fr);grid-template-columns:repeat(var(--rows, 4), 1fr)}[part=tile-slot]{display:block;aspect-ratio:1;padding:5%}.tile-container{min-width:0;transition:scale 0.3s;width:100%;height:100%}.tile-container:hover{scale:1.05}.tile-container.selected{scale:1.1}.tile-container.matched{scale:0}.tile{border-radius:var(--tile-border-radius, 5px);border:var(--tile-border-width, 2px) solid var(--tile-border-color, black);padding:0;margin:0}.tile-text{width:100%;height:100%;aspect-ratio:1;background:#d9d9d9;display:grid;place-content:center}.tile-image{width:100%;height:100%}.tile-image img{display:block;width:100%;height:100%;object-fit:cover}`;
46
+
47
+ const MbMemoryGame = class {
48
+ constructor(hostRef) {
49
+ index.registerInstance(this, hostRef);
50
+ this.completed = index.createEvent(this, "completed");
51
+ this.matched = index.createEvent(this, "matched");
52
+ }
53
+ tileGroups = [];
54
+ reverseTile = { type: 'text', text: '?' };
55
+ init = true;
56
+ watchBoard() {
57
+ if (this.init) {
58
+ this.initGame();
59
+ }
60
+ }
61
+ tiles = [];
62
+ selected = [];
63
+ matchedTiles = [];
64
+ watchMatchedTiles() {
65
+ if (this.matchedTiles.length === this.tiles.length) {
66
+ this.completed.emit();
67
+ }
68
+ }
69
+ cols;
70
+ blockUI = false;
71
+ uncoverSelected = false;
72
+ completed;
73
+ matched;
74
+ componentWillLoad() {
75
+ console.log('componentDidLoad', this.init);
76
+ if (this.init && this.tileGroups) {
77
+ this.initGame();
78
+ }
79
+ }
80
+ slots = new Map();
81
+ get gridCols() {
82
+ if (this.cols) {
83
+ return this.cols;
84
+ }
85
+ return Math.floor(Math.sqrt(this.tiles.length));
86
+ }
87
+ get gridRows() {
88
+ return Math.ceil(this.tiles.length / this.gridCols);
89
+ }
90
+ get gridAspectRatio() {
91
+ return this.gridCols / this.gridRows;
92
+ }
93
+ async initGame(tileGroups = this.tileGroups, reverseTile = this.reverseTile) {
94
+ console.log('initGame', tileGroups);
95
+ this.reverseTile = reverseTile;
96
+ this.buildTiles(tileGroups);
97
+ }
98
+ buildTiles(tileGroups) {
99
+ let result = [];
100
+ let index = 0;
101
+ tileGroups.forEach(tg => {
102
+ const tiles = getSet(tg.tiles, tg.count);
103
+ result = [
104
+ ...result,
105
+ ...tiles.map(t => {
106
+ return {
107
+ id: index++,
108
+ data: { ...t },
109
+ groupId: tg.id,
110
+ uncovered: false,
111
+ matched: false
112
+ };
113
+ })
114
+ ];
115
+ });
116
+ this.tiles = result.sort(() => Math.random() - .5);
117
+ }
118
+ async onTileClick(id) {
119
+ if (this.blockUI)
120
+ return;
121
+ if (this.selected.includes(id)) {
122
+ this.selected = this.selected.filter(i => i !== id);
123
+ return;
124
+ }
125
+ this.selected = [...this.selected, id];
126
+ if (this.selected.length === 2) {
127
+ const t1 = this.tiles.find(t => t.id === this.selected[0]);
128
+ const t2 = this.tiles.find(t => t.id === this.selected[1]);
129
+ if (!t1 || !t2)
130
+ return;
131
+ this.blockUI = true;
132
+ this.uncoverSelected = true;
133
+ if (t1.groupId === t2.groupId) {
134
+ await Promise.all([
135
+ this.markAsMatched(t1.id),
136
+ this.markAsMatched(t2.id)
137
+ ]);
138
+ this.matched.emit({ t1: t1.data, t2: t2.data, groupId: t1.groupId });
139
+ this.matchedTiles = [
140
+ ...this.matchedTiles, t1.id, t2.id
141
+ ];
142
+ }
143
+ else {
144
+ await Promise.all([
145
+ this.animateWrongMatch(t1.id),
146
+ this.animateWrongMatch(t2.id)
147
+ ]);
148
+ }
149
+ this.uncoverSelected = false;
150
+ this.blockUI = false;
151
+ this.selected = [];
152
+ }
153
+ }
154
+ markAsMatched(id) {
155
+ return new Promise(resolve => {
156
+ const slot = this.slots.get(id);
157
+ if (!slot)
158
+ return;
159
+ const tile = slot.children[0];
160
+ const anim = tile.animate([], { duration: 1000 });
161
+ anim.addEventListener('finish', () => {
162
+ resolve();
163
+ });
164
+ anim.addEventListener('cancel', () => {
165
+ resolve();
166
+ });
167
+ });
168
+ }
169
+ animateWrongMatch(id) {
170
+ return new Promise(resolve => {
171
+ const slot = this.slots.get(id);
172
+ if (!slot)
173
+ return;
174
+ const tile = slot.children[0];
175
+ const anim = tile.animate([
176
+ { rotate: "0deg" },
177
+ { rotate: "0deg" },
178
+ { rotate: "30deg" },
179
+ { rotate: "0deg" },
180
+ { rotate: "-30deg" },
181
+ { rotate: "0deg" },
182
+ { rotate: "0deg" },
183
+ ], { duration: 1500 });
184
+ anim.addEventListener('finish', () => {
185
+ resolve();
186
+ });
187
+ anim.addEventListener('cancel', () => {
188
+ resolve();
189
+ });
190
+ });
191
+ }
192
+ render() {
193
+ return index.h("div", { key: 'bb7b898014606de493fd580e50ef685f529ac2bb', part: "container", style: {
194
+ '--aspect': `${this.gridAspectRatio}`
195
+ } }, index.h("div", { key: '0c677fb539e7af023c21411e70adf64050c97077', part: "list", style: {
196
+ '--cols': `${this.gridCols}`,
197
+ '--rows': `${this.gridRows}`
198
+ } }, this.tiles.map(t => {
199
+ return index.h("div", { part: "tile-slot", onClick: () => this.onTileClick(t.id), ref: el => this.slots.set(t.id, el) }, index.h(Tile, { tile: t, selected: this.selected.includes(t.id), matched: this.matchedTiles.includes(t.id), reversTile: this.reverseTile, uncovered: this.uncoverSelected && this.selected.includes(t.id) }));
200
+ })));
201
+ }
202
+ static get watchers() { return {
203
+ "board": [{
204
+ "watchBoard": 0
205
+ }],
206
+ "matchedTiles": [{
207
+ "watchMatchedTiles": 0
208
+ }]
209
+ }; }
210
+ };
211
+ MbMemoryGame.style = memoryGameCss();
212
+
213
+ exports.mb_memory_game = MbMemoryGame;
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-D_ddvJ2f.js');
4
+ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
5
+
6
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
7
+ /*
8
+ Stencil Client Patch Browser v4.41.0 | MIT Licensed | https://stenciljs.com
9
+ */
10
+
11
+ var patchBrowser = () => {
12
+ const importMeta = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('memory-game.cjs.js', document.baseURI).href));
13
+ const opts = {};
14
+ if (importMeta !== "") {
15
+ opts.resourcesUrl = new URL(".", importMeta).href;
16
+ }
17
+ return index.promiseResolve(opts);
18
+ };
19
+
20
+ patchBrowser().then(async (options) => {
21
+ await appGlobals.globalScripts();
22
+ return index.bootstrapLazy([["mb-memory-game.cjs",[[513,"mb-memory-game",{"tileGroups":[16],"reverseTile":[16],"init":[4],"cols":[2],"tiles":[32],"selected":[32],"matchedTiles":[32],"uncoverSelected":[32],"initGame":[64]},null,{"board":[{"watchBoard":0}],"matchedTiles":[{"watchMatchedTiles":0}]}]]]], options);
23
+ });
24
+
25
+ exports.setNonce = index.setNonce;
@@ -0,0 +1,12 @@
1
+ {
2
+ "entries": [
3
+ "components/sliding-puzzle/memory-game.js"
4
+ ],
5
+ "compiler": {
6
+ "name": "@stencil/core",
7
+ "version": "4.41.0",
8
+ "typescriptVersion": "5.8.3"
9
+ },
10
+ "collections": [],
11
+ "bundles": []
12
+ }
@@ -0,0 +1,72 @@
1
+ :host {
2
+ box-sizing: border-box;
3
+ display: grid;
4
+ place-content: center;
5
+ width: 100%;
6
+ height: 100%;
7
+ container-type: size;
8
+ }
9
+
10
+ [part=container] {
11
+ width: min(100cqw, 100cqh / var(--aspect, 1));
12
+ height: min(100cqw * var(--aspect, 1), 100cqh);
13
+ container-type: size;
14
+ background: pink;
15
+ }
16
+
17
+ [part=list] {
18
+ width: 100cqw;
19
+ height: 100cqh;
20
+ display: grid;
21
+ grid-template-columns: repeat(var(--cols, 4), 1fr);
22
+ grid-template-columns: repeat(var(--rows, 4), 1fr);
23
+ }
24
+
25
+ [part=tile-slot] {
26
+ display: block;
27
+ aspect-ratio: 1;
28
+ padding: 5%;
29
+ }
30
+
31
+ .tile-container {
32
+ min-width: 0;
33
+ transition: scale 0.3s;
34
+ width: 100%;
35
+ height: 100%;
36
+ }
37
+ .tile-container:hover {
38
+ scale: 1.05;
39
+ }
40
+ .tile-container.selected {
41
+ scale: 1.1;
42
+ }
43
+ .tile-container.matched {
44
+ scale: 0;
45
+ }
46
+
47
+ .tile {
48
+ border-radius: var(--tile-border-radius, 5px);
49
+ border: var(--tile-border-width, 2px) solid var(--tile-border-color, black);
50
+ padding: 0;
51
+ margin: 0;
52
+ }
53
+
54
+ .tile-text {
55
+ width: 100%;
56
+ height: 100%;
57
+ aspect-ratio: 1;
58
+ background: #d9d9d9;
59
+ display: grid;
60
+ place-content: center;
61
+ }
62
+
63
+ .tile-image {
64
+ width: 100%;
65
+ height: 100%;
66
+ }
67
+ .tile-image img {
68
+ display: block;
69
+ width: 100%;
70
+ height: 100%;
71
+ object-fit: cover;
72
+ }
@@ -0,0 +1,357 @@
1
+ import { h } from "@stencil/core";
2
+ import { getSet } from "../../utils/get-set";
3
+ import { Tile } from "./tile";
4
+ export class MbMemoryGame {
5
+ tileGroups = [];
6
+ reverseTile = { type: 'text', text: '?' };
7
+ init = true;
8
+ watchBoard() {
9
+ if (this.init) {
10
+ this.initGame();
11
+ }
12
+ }
13
+ tiles = [];
14
+ selected = [];
15
+ matchedTiles = [];
16
+ watchMatchedTiles() {
17
+ if (this.matchedTiles.length === this.tiles.length) {
18
+ this.completed.emit();
19
+ }
20
+ }
21
+ cols;
22
+ blockUI = false;
23
+ uncoverSelected = false;
24
+ completed;
25
+ matched;
26
+ componentWillLoad() {
27
+ console.log('componentDidLoad', this.init);
28
+ if (this.init && this.tileGroups) {
29
+ this.initGame();
30
+ }
31
+ }
32
+ slots = new Map();
33
+ get gridCols() {
34
+ if (this.cols) {
35
+ return this.cols;
36
+ }
37
+ return Math.floor(Math.sqrt(this.tiles.length));
38
+ }
39
+ get gridRows() {
40
+ return Math.ceil(this.tiles.length / this.gridCols);
41
+ }
42
+ get gridAspectRatio() {
43
+ return this.gridCols / this.gridRows;
44
+ }
45
+ async initGame(tileGroups = this.tileGroups, reverseTile = this.reverseTile) {
46
+ console.log('initGame', tileGroups);
47
+ this.reverseTile = reverseTile;
48
+ this.buildTiles(tileGroups);
49
+ }
50
+ buildTiles(tileGroups) {
51
+ let result = [];
52
+ let index = 0;
53
+ tileGroups.forEach(tg => {
54
+ const tiles = getSet(tg.tiles, tg.count);
55
+ result = [
56
+ ...result,
57
+ ...tiles.map(t => {
58
+ return {
59
+ id: index++,
60
+ data: { ...t },
61
+ groupId: tg.id,
62
+ uncovered: false,
63
+ matched: false
64
+ };
65
+ })
66
+ ];
67
+ });
68
+ this.tiles = result.sort(() => Math.random() - .5);
69
+ }
70
+ async onTileClick(id) {
71
+ if (this.blockUI)
72
+ return;
73
+ if (this.selected.includes(id)) {
74
+ this.selected = this.selected.filter(i => i !== id);
75
+ return;
76
+ }
77
+ this.selected = [...this.selected, id];
78
+ if (this.selected.length === 2) {
79
+ const t1 = this.tiles.find(t => t.id === this.selected[0]);
80
+ const t2 = this.tiles.find(t => t.id === this.selected[1]);
81
+ if (!t1 || !t2)
82
+ return;
83
+ this.blockUI = true;
84
+ this.uncoverSelected = true;
85
+ if (t1.groupId === t2.groupId) {
86
+ await Promise.all([
87
+ this.markAsMatched(t1.id),
88
+ this.markAsMatched(t2.id)
89
+ ]);
90
+ this.matched.emit({ t1: t1.data, t2: t2.data, groupId: t1.groupId });
91
+ this.matchedTiles = [
92
+ ...this.matchedTiles, t1.id, t2.id
93
+ ];
94
+ }
95
+ else {
96
+ await Promise.all([
97
+ this.animateWrongMatch(t1.id),
98
+ this.animateWrongMatch(t2.id)
99
+ ]);
100
+ }
101
+ this.uncoverSelected = false;
102
+ this.blockUI = false;
103
+ this.selected = [];
104
+ }
105
+ }
106
+ markAsMatched(id) {
107
+ return new Promise(resolve => {
108
+ const slot = this.slots.get(id);
109
+ if (!slot)
110
+ return;
111
+ const tile = slot.children[0];
112
+ const anim = tile.animate([], { duration: 1000 });
113
+ anim.addEventListener('finish', () => {
114
+ resolve();
115
+ });
116
+ anim.addEventListener('cancel', () => {
117
+ resolve();
118
+ });
119
+ });
120
+ }
121
+ animateWrongMatch(id) {
122
+ return new Promise(resolve => {
123
+ const slot = this.slots.get(id);
124
+ if (!slot)
125
+ return;
126
+ const tile = slot.children[0];
127
+ const anim = tile.animate([
128
+ { rotate: "0deg" },
129
+ { rotate: "0deg" },
130
+ { rotate: "30deg" },
131
+ { rotate: "0deg" },
132
+ { rotate: "-30deg" },
133
+ { rotate: "0deg" },
134
+ { rotate: "0deg" },
135
+ ], { duration: 1500 });
136
+ anim.addEventListener('finish', () => {
137
+ resolve();
138
+ });
139
+ anim.addEventListener('cancel', () => {
140
+ resolve();
141
+ });
142
+ });
143
+ }
144
+ render() {
145
+ return h("div", { key: 'bb7b898014606de493fd580e50ef685f529ac2bb', part: "container", style: {
146
+ '--aspect': `${this.gridAspectRatio}`
147
+ } }, h("div", { key: '0c677fb539e7af023c21411e70adf64050c97077', part: "list", style: {
148
+ '--cols': `${this.gridCols}`,
149
+ '--rows': `${this.gridRows}`
150
+ } }, this.tiles.map(t => {
151
+ return h("div", { part: "tile-slot", onClick: () => this.onTileClick(t.id), ref: el => this.slots.set(t.id, el) }, h(Tile, { tile: t, selected: this.selected.includes(t.id), matched: this.matchedTiles.includes(t.id), reversTile: this.reverseTile, uncovered: this.uncoverSelected && this.selected.includes(t.id) }));
152
+ })));
153
+ }
154
+ static get is() { return "mb-memory-game"; }
155
+ static get encapsulation() { return "shadow"; }
156
+ static get originalStyleUrls() {
157
+ return {
158
+ "$": ["memory-game.scss"]
159
+ };
160
+ }
161
+ static get styleUrls() {
162
+ return {
163
+ "$": ["memory-game.css"]
164
+ };
165
+ }
166
+ static get properties() {
167
+ return {
168
+ "tileGroups": {
169
+ "type": "unknown",
170
+ "mutable": false,
171
+ "complexType": {
172
+ "original": "TileGroup[]",
173
+ "resolved": "TileGroup[]",
174
+ "references": {
175
+ "TileGroup": {
176
+ "location": "import",
177
+ "path": "./types",
178
+ "id": "src/components/sliding-puzzle/types.ts::TileGroup",
179
+ "referenceLocation": "TileGroup"
180
+ }
181
+ }
182
+ },
183
+ "required": false,
184
+ "optional": false,
185
+ "docs": {
186
+ "tags": [],
187
+ "text": ""
188
+ },
189
+ "getter": false,
190
+ "setter": false,
191
+ "defaultValue": "[]"
192
+ },
193
+ "reverseTile": {
194
+ "type": "unknown",
195
+ "mutable": false,
196
+ "complexType": {
197
+ "original": "TileDefinition",
198
+ "resolved": "TileDefinition",
199
+ "references": {
200
+ "TileDefinition": {
201
+ "location": "import",
202
+ "path": "./types",
203
+ "id": "src/components/sliding-puzzle/types.ts::TileDefinition",
204
+ "referenceLocation": "TileDefinition"
205
+ }
206
+ }
207
+ },
208
+ "required": false,
209
+ "optional": false,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": ""
213
+ },
214
+ "getter": false,
215
+ "setter": false,
216
+ "defaultValue": "{ type: 'text', text: '?' }"
217
+ },
218
+ "init": {
219
+ "type": "boolean",
220
+ "mutable": false,
221
+ "complexType": {
222
+ "original": "boolean",
223
+ "resolved": "boolean",
224
+ "references": {}
225
+ },
226
+ "required": false,
227
+ "optional": false,
228
+ "docs": {
229
+ "tags": [],
230
+ "text": ""
231
+ },
232
+ "getter": false,
233
+ "setter": false,
234
+ "reflect": false,
235
+ "attribute": "init",
236
+ "defaultValue": "true"
237
+ },
238
+ "cols": {
239
+ "type": "number",
240
+ "mutable": false,
241
+ "complexType": {
242
+ "original": "number",
243
+ "resolved": "number",
244
+ "references": {}
245
+ },
246
+ "required": false,
247
+ "optional": true,
248
+ "docs": {
249
+ "tags": [],
250
+ "text": ""
251
+ },
252
+ "getter": false,
253
+ "setter": false,
254
+ "reflect": false,
255
+ "attribute": "cols"
256
+ }
257
+ };
258
+ }
259
+ static get states() {
260
+ return {
261
+ "tiles": {},
262
+ "selected": {},
263
+ "matchedTiles": {},
264
+ "uncoverSelected": {}
265
+ };
266
+ }
267
+ static get events() {
268
+ return [{
269
+ "method": "completed",
270
+ "name": "completed",
271
+ "bubbles": true,
272
+ "cancelable": true,
273
+ "composed": true,
274
+ "docs": {
275
+ "tags": [],
276
+ "text": ""
277
+ },
278
+ "complexType": {
279
+ "original": "void",
280
+ "resolved": "void",
281
+ "references": {}
282
+ }
283
+ }, {
284
+ "method": "matched",
285
+ "name": "matched",
286
+ "bubbles": true,
287
+ "cancelable": true,
288
+ "composed": true,
289
+ "docs": {
290
+ "tags": [],
291
+ "text": ""
292
+ },
293
+ "complexType": {
294
+ "original": "MatchedEvent",
295
+ "resolved": "MatchedEvent",
296
+ "references": {
297
+ "MatchedEvent": {
298
+ "location": "import",
299
+ "path": "./types",
300
+ "id": "src/components/sliding-puzzle/types.ts::MatchedEvent",
301
+ "referenceLocation": "MatchedEvent"
302
+ }
303
+ }
304
+ }
305
+ }];
306
+ }
307
+ static get methods() {
308
+ return {
309
+ "initGame": {
310
+ "complexType": {
311
+ "signature": "(tileGroups?: TileGroup[], reverseTile?: TileDefinition) => Promise<void>",
312
+ "parameters": [{
313
+ "name": "tileGroups",
314
+ "type": "TileGroup[]",
315
+ "docs": ""
316
+ }, {
317
+ "name": "reverseTile",
318
+ "type": "TileDefinition",
319
+ "docs": ""
320
+ }],
321
+ "references": {
322
+ "Promise": {
323
+ "location": "global",
324
+ "id": "global::Promise"
325
+ },
326
+ "TileGroup": {
327
+ "location": "import",
328
+ "path": "./types",
329
+ "id": "src/components/sliding-puzzle/types.ts::TileGroup",
330
+ "referenceLocation": "TileGroup"
331
+ },
332
+ "TileDefinition": {
333
+ "location": "import",
334
+ "path": "./types",
335
+ "id": "src/components/sliding-puzzle/types.ts::TileDefinition",
336
+ "referenceLocation": "TileDefinition"
337
+ }
338
+ },
339
+ "return": "Promise<void>"
340
+ },
341
+ "docs": {
342
+ "text": "",
343
+ "tags": []
344
+ }
345
+ }
346
+ };
347
+ }
348
+ static get watchers() {
349
+ return [{
350
+ "propName": "board",
351
+ "methodName": "watchBoard"
352
+ }, {
353
+ "propName": "matchedTiles",
354
+ "methodName": "watchMatchedTiles"
355
+ }];
356
+ }
357
+ }