board-game-engine-react 0.0.9 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "board-game-engine-react",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "React library for using board-game-engine",
5
5
  "main": "dist/board-game-engine-react.js",
6
6
  "scripts": {
package/rollup.config.js CHANGED
@@ -1,22 +1,21 @@
1
1
  import babel from '@rollup/plugin-babel'
2
2
  import { terser } from 'rollup-plugin-terser'
3
3
  import scss from 'rollup-plugin-scss'
4
- import resolve from 'rollup-plugin-node-resolve'
4
+ import resolve from '@rollup/plugin-node-resolve'
5
+ import commonjs from '@rollup/plugin-commonjs'
5
6
 
6
7
  const config = [
7
8
  {
8
9
  input: 'src/index.js',
9
10
  external: ['react'],
10
11
  output: {
11
- format: 'umd',
12
+ format: 'esm',
12
13
  file: 'dist/board-game-engine-react.js',
13
- name: 'BoardGameEngineReact'
14
14
  },
15
15
  plugins: [
16
- resolve({
17
- }),
18
- babel({
19
- }),
16
+ resolve(),
17
+ commonjs({ include: /node_modules/ }),
18
+ babel(),
20
19
  scss()
21
20
  ]
22
21
  },
@@ -24,17 +23,17 @@ const config = [
24
23
  input: 'src/index.js',
25
24
  external: ['react'],
26
25
  output: {
27
- format: 'umd',
26
+ format: 'esm',
28
27
  file: 'dist/board-game-engine-react.min.js',
29
- name: 'BoardGameEngineReact'
30
28
  },
31
29
  plugins: [
32
- resolve({
33
- }),
34
- babel({
35
- }),
30
+ resolve(),
31
+ commonjs({ include: /node_modules/ }),
32
+ babel(),
36
33
  scss({ outputStyle: 'compressed' }),
34
+
37
35
  terser()
36
+
38
37
  ]
39
38
  }
40
39
  ]
package/src/styles.scss CHANGED
@@ -2,3 +2,169 @@ html, body, #storybook-root, .story, {
2
2
  height: 100%;
3
3
  }
4
4
 
5
+ .button {
6
+ border: 3px solid var(--dark-amethyst);
7
+ display: inline-block;
8
+ padding: .5em;
9
+ font-size: 1.5em;
10
+ font-family: inherit;
11
+ text-decoration: none;
12
+ cursor: pointer;
13
+ border-radius: .3em;
14
+ box-shadow: 0 4px 6px rgba(0,0,0,0.15);
15
+ margin: .5em;
16
+ }
17
+
18
+ .button--style-b {
19
+ background-color: var(--dark-amethyst);
20
+ color: white;
21
+ }
22
+
23
+ .button--style-c {
24
+ background-color: var(--lipstick-red);
25
+ color: white;
26
+ }
27
+
28
+ .button--x-small {
29
+ font-size: .9em;
30
+ padding: .3em .5em;
31
+ border-radius: .2em;
32
+ }
33
+
34
+ .game {
35
+ color: black;
36
+ }
37
+
38
+ .shared-board, .personal-board {
39
+ padding: 1em 0;
40
+ border-bottom: 1px solid white;
41
+ }
42
+
43
+ .grid {
44
+ border: 1px solid black;
45
+ box-sizing: border-box;
46
+ background-color: #333;
47
+ max-width: 500px;
48
+ }
49
+
50
+ .grid__cell {
51
+ border: 1px solid black;
52
+ background-color: #fff;
53
+ aspect-ratio: 1;
54
+ display: flex;
55
+ align-items: center;
56
+ justify-content: center;
57
+ color: #666;
58
+ position: relative;
59
+ overflow: auto;
60
+ }
61
+
62
+ .grid__cell .space {
63
+ height: 100%;
64
+ width: 100%;
65
+ }
66
+
67
+ .space {
68
+ box-sizing: border-box;
69
+ min-width: 10px;
70
+ min-height: 10px;
71
+ }
72
+
73
+ .space:not(:has(.entity)):not(.grid__cell > :only-child) {
74
+ border: 1px solid grey;
75
+ }
76
+
77
+ .space--clickable {
78
+ background-color: rgba(144, 238, 144, .4);
79
+ }
80
+
81
+ .space--targeted {
82
+ background-color: grey;
83
+ }
84
+
85
+ .space__entity-grid {
86
+ box-sizing: border-box;
87
+ align-items: center;
88
+ justify-content: center;
89
+ }
90
+
91
+ .space__entity-grid__cell {
92
+ box-sizing: border-box;
93
+ overflow: auto;
94
+ }
95
+
96
+ .entity {
97
+ padding: .2em;
98
+ min-height: 20px;
99
+ min-width: 20px;
100
+ box-sizing: border-box;
101
+ border: 1px solid black;
102
+ overflow: hidden;
103
+ font-size: .5em;
104
+ font-family: "Nunito", sans-serif;
105
+ font-weight: bold;
106
+ display: inline-block;
107
+ }
108
+
109
+ .entity.player-0 {
110
+ background-color: pink;
111
+ }
112
+
113
+ .entity--clickable {
114
+ background-color: rgba(144, 238, 144, .4);
115
+ }
116
+
117
+ .entity.player-0.entity--clickable {
118
+ background-color: #f0e0d8;
119
+ }
120
+
121
+ .entity.player-1 {
122
+ background-color: lightblue;
123
+ }
124
+
125
+ .entity.player-1.entity--clickable {
126
+ background-color: paleturquoise;
127
+ }
128
+
129
+ .debug-panel .pane {
130
+ max-width: 420px !important;
131
+ }
132
+
133
+ .game-status {
134
+ position: absolute;
135
+ top: 50%;
136
+ left: 0;
137
+ transform: translateY(-50%);
138
+ width: 100%;
139
+ border-top: 1em;
140
+ border-bottom: 1em;
141
+ padding: 1em;
142
+ background-color: var(--dark-orange);
143
+ color: black;
144
+ box-sizing: border-box;
145
+ font-size: 3em;
146
+ }
147
+
148
+ .debug-panel .visibility-toggle {
149
+ top: 70px !important;
150
+ }
151
+
152
+ .debug-panel .visibility-toggle svg {
153
+ display: none;
154
+ }
155
+
156
+ .debug-panel .visibility-toggle .icon::after {
157
+ position: relative;
158
+ left: 3px;
159
+ content: "⚙️";
160
+ font-size: 20px;
161
+ display: block;
162
+ width: 20px;
163
+ height: 20px;
164
+ }
165
+
166
+ .debug-panel .menu {
167
+ position: relative;
168
+ top: 70px !important;
169
+ }
170
+
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useReducer, useState } from 'react'
2
2
  import * as BoardGameEngine from 'board-game-engine'
3
+ console.log('BoardGameEngine', BoardGameEngine)
3
4
  const Client = BoardGameEngine.Client
4
5
 
5
6