@thegraid/hexlib 1.2.0 → 1.2.10
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/dist/choosers.d.ts +11 -2
- package/dist/choosers.d.ts.map +1 -1
- package/dist/choosers.js +13 -3
- package/dist/choosers.js.map +1 -1
- package/dist/game-play.d.ts +22 -17
- package/dist/game-play.d.ts.map +1 -1
- package/dist/game-play.js +36 -38
- package/dist/game-play.js.map +1 -1
- package/dist/game-setup.d.ts +1 -0
- package/dist/game-setup.d.ts.map +1 -1
- package/dist/game-setup.js +6 -4
- package/dist/game-setup.js.map +1 -1
- package/dist/game-state.d.ts +18 -6
- package/dist/game-state.d.ts.map +1 -1
- package/dist/game-state.js +38 -36
- package/dist/game-state.js.map +1 -1
- package/dist/hex-intfs.d.ts +0 -6
- package/dist/hex-intfs.d.ts.map +1 -1
- package/dist/hex-intfs.js +1 -0
- package/dist/hex-intfs.js.map +1 -1
- package/dist/hex.d.ts +12 -5
- package/dist/hex.d.ts.map +1 -1
- package/dist/hex.js +16 -5
- package/dist/hex.js.map +1 -1
- package/dist/image-loader.d.ts.map +1 -1
- package/dist/image-loader.js.map +1 -1
- package/dist/meeple.d.ts +5 -7
- package/dist/meeple.d.ts.map +1 -1
- package/dist/meeple.js +8 -13
- package/dist/meeple.js.map +1 -1
- package/dist/player-panel.d.ts +5 -9
- package/dist/player-panel.d.ts.map +1 -1
- package/dist/player-panel.js +56 -42
- package/dist/player-panel.js.map +1 -1
- package/dist/player.d.ts +2 -1
- package/dist/player.d.ts.map +1 -1
- package/dist/player.js +6 -2
- package/dist/player.js.map +1 -1
- package/dist/scenario-parser.d.ts.map +1 -1
- package/dist/scenario-parser.js +4 -6
- package/dist/scenario-parser.js.map +1 -1
- package/dist/shapes.d.ts +42 -194
- package/dist/shapes.d.ts.map +1 -1
- package/dist/shapes.js +54 -363
- package/dist/shapes.js.map +1 -1
- package/dist/table-params.d.ts +3 -3
- package/dist/table-params.d.ts.map +1 -1
- package/dist/table-params.js +2 -2
- package/dist/table-params.js.map +1 -1
- package/dist/table.d.ts +42 -18
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +89 -67
- package/dist/table.js.map +1 -1
- package/dist/text-log.js +2 -2
- package/dist/text-log.js.map +1 -1
- package/dist/tile.d.ts +17 -20
- package/dist/tile.d.ts.map +1 -1
- package/dist/tile.js +31 -31
- package/dist/tile.js.map +1 -1
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/shapes.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="easeljs" />
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { PaintableShape, TextInRect, type CGF, type TextInRectOptions, type TextStyle } from "@thegraid/easeljs-lib";
|
|
3
|
+
import { Graphics, Shape, Text } from "@thegraid/easeljs-module";
|
|
4
4
|
import type { IHex2 } from "./hex";
|
|
5
5
|
export declare class C1 {
|
|
6
6
|
static GREY: string;
|
|
@@ -8,99 +8,6 @@ export declare class C1 {
|
|
|
8
8
|
static lightgrey2: string;
|
|
9
9
|
static lightgrey_8: string;
|
|
10
10
|
}
|
|
11
|
-
export interface Paintable extends DisplayObject {
|
|
12
|
-
/** paint with new player color; updateCache() */
|
|
13
|
-
paint(colorn: string, force?: boolean): Graphics;
|
|
14
|
-
/** Paintable can compute its own Bounds. setBounds(undefined, 0, 0, 0) */
|
|
15
|
-
setBounds(x: undefined | null | number, y: number, width: number, height: number): void;
|
|
16
|
-
/** compute bounds of this Paintable */
|
|
17
|
-
calcBounds(): XYWH;
|
|
18
|
-
/** ensure Paintable is cached; expect setBounds() already done. */
|
|
19
|
-
setCacheID(): void;
|
|
20
|
-
}
|
|
21
|
-
/** Create/Color Graphics Function (color, g0); extend graphics with additional instructions.
|
|
22
|
-
* g0 is clone of "baseline" Graphics. (may be clear)
|
|
23
|
-
*/
|
|
24
|
-
export type CGF = (color: string, g?: Graphics) => Graphics;
|
|
25
|
-
/**
|
|
26
|
-
* Usage: ??? [obsolete?]
|
|
27
|
-
* - ps = super.makeShape(); // ISA PaintableShape
|
|
28
|
-
* - ps.cgf = (color) => new CGF(color);
|
|
29
|
-
* - ...
|
|
30
|
-
* - ps.paint(red); --> ps.graphics = gf(red) --> new CG(red);
|
|
31
|
-
* -
|
|
32
|
-
* - const cgf: CGF = (color: string, g = new Graphics()) => {
|
|
33
|
-
* - return g.f(this.color).dc(0, 0, rad);
|
|
34
|
-
* - }
|
|
35
|
-
* - }
|
|
36
|
-
*/
|
|
37
|
-
export declare class PaintableShape extends Shape implements Paintable {
|
|
38
|
-
_cgf: CGF;
|
|
39
|
-
colorn: string;
|
|
40
|
-
/** if supplied in contructor, cgf extends a clone [otherwise use new Graphics()] */
|
|
41
|
-
_g0?: Graphics;
|
|
42
|
-
/** initial/baseline Graphics, cgf extends to create cgfGraphics */
|
|
43
|
-
get g0(): Graphics;
|
|
44
|
-
/** previous/current Graphics that were rendered. (optimization... paint(color, true) to override) */
|
|
45
|
-
cgfGraphics: Graphics;
|
|
46
|
-
/**
|
|
47
|
-
*
|
|
48
|
-
* @param _cgf Create Graphics Function
|
|
49
|
-
* @param colorn paint with this color
|
|
50
|
-
* @param g0 Graphics to clone (or create); used as baseline Graphics for each paint()
|
|
51
|
-
*/
|
|
52
|
-
constructor(_cgf: CGF, colorn?: string, g0?: Graphics);
|
|
53
|
-
updateCacheInPaint: boolean;
|
|
54
|
-
get cgf(): CGF;
|
|
55
|
-
/** set new cgf; and clear "previously rendered Graphics" */
|
|
56
|
-
set cgf(cgf: CGF);
|
|
57
|
-
/** render graphics from cgf. */
|
|
58
|
-
paint(colorn?: string, force?: boolean): Graphics;
|
|
59
|
-
/**
|
|
60
|
-
* Paintable shape can & should calculate its Bounds.
|
|
61
|
-
*
|
|
62
|
-
* Subclasses should override to calculate their bounds.
|
|
63
|
-
* @param x
|
|
64
|
-
* * undefined -> calculate bounds,
|
|
65
|
-
* * null -> remove bounds,
|
|
66
|
-
* * number -> set to {x, y, width, height}
|
|
67
|
-
* @param y
|
|
68
|
-
* @param width
|
|
69
|
-
* @param height
|
|
70
|
-
*/
|
|
71
|
-
setBounds(x: number | undefined | null, y: number, width: number, height: number): void;
|
|
72
|
-
/** subclass to override to compute actual bounds of their Shape. */
|
|
73
|
-
calcBounds(): XYWH;
|
|
74
|
-
/** ensure PaintableShape is cached; expect setBounds() already done. */
|
|
75
|
-
setCacheID(): void;
|
|
76
|
-
}
|
|
77
|
-
/** an n-sided Polygon, tilted */
|
|
78
|
-
export declare class PolyShape extends PaintableShape {
|
|
79
|
-
rad: number;
|
|
80
|
-
nsides: number;
|
|
81
|
-
pSize: number;
|
|
82
|
-
tilt: number;
|
|
83
|
-
fillc: string;
|
|
84
|
-
strokec: string;
|
|
85
|
-
/**
|
|
86
|
-
* pscgf() invokes drawPoly(0,0,...);
|
|
87
|
-
*
|
|
88
|
-
* To adjust (x,y): supply g0 = new Graphics().mt(x,y)
|
|
89
|
-
* @param params \{ rad, nsides, pSize, tilt, fillc, strokec }
|
|
90
|
-
* @param g0 Graphics base
|
|
91
|
-
*/
|
|
92
|
-
constructor({ rad, nsides, pSize, tilt, fillc, strokec }: {
|
|
93
|
-
rad?: number;
|
|
94
|
-
nsides?: number;
|
|
95
|
-
pSize: number;
|
|
96
|
-
tilt?: number;
|
|
97
|
-
fillc?: string;
|
|
98
|
-
strokec?: string;
|
|
99
|
-
}, g0?: Graphics);
|
|
100
|
-
/** set fillc and strokec, invoke drawPoly(0, 0, ...) */
|
|
101
|
-
pscgf(fillc: string, g?: Graphics): Graphics;
|
|
102
|
-
setBounds(x: number | undefined | null, y: number, width: number, height: number): void;
|
|
103
|
-
}
|
|
104
11
|
/**
|
|
105
12
|
* A colored PaintableShape that fills a Hex.
|
|
106
13
|
*
|
|
@@ -127,56 +34,6 @@ export declare class HexShape extends PaintableShape {
|
|
|
127
34
|
hscgf(color: string, g0?: Graphics): Graphics;
|
|
128
35
|
setBounds(x: number | undefined | null, y: number, width: number, height: number): void;
|
|
129
36
|
}
|
|
130
|
-
export declare class EllipseShape extends PaintableShape {
|
|
131
|
-
fillc: string;
|
|
132
|
-
radx: number;
|
|
133
|
-
rady: number;
|
|
134
|
-
strokec: string;
|
|
135
|
-
/**
|
|
136
|
-
* ellipse centered on (0,0), axis is NS/EW, rotate after.
|
|
137
|
-
* @param radx radius in x dir
|
|
138
|
-
* @param rady radisu in y dir
|
|
139
|
-
* retain g0, to use as baseline Graphics for each paint()
|
|
140
|
-
*/
|
|
141
|
-
constructor(fillc?: string, radx?: number, rady?: number, strokec?: string, g0?: Graphics);
|
|
142
|
-
cscgf(fillc: string, g?: Graphics): Graphics;
|
|
143
|
-
setBounds(x: number | undefined | null, y: number, width: number, height: number): void;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Circle centered on (0,0)
|
|
147
|
-
* @param rad radius
|
|
148
|
-
* retain g0, to use as baseline Graphics for each paint()
|
|
149
|
-
*/
|
|
150
|
-
export declare class CircleShape extends EllipseShape {
|
|
151
|
-
constructor(fillc?: string, rad?: number, strokec?: string, g0?: Graphics);
|
|
152
|
-
}
|
|
153
|
-
/** a Rectangular Shape, maybe with rounded corners */
|
|
154
|
-
export declare class RectShape extends PaintableShape {
|
|
155
|
-
fillc: string;
|
|
156
|
-
strokec: string;
|
|
157
|
-
_rect: XYWH;
|
|
158
|
-
_cRad: number;
|
|
159
|
-
/**
|
|
160
|
-
* Paint a rectangle (possibly with rounded corners) with fillc and stroke.
|
|
161
|
-
* @param rect \{ x=0, y=0, w=hexRad, h=hexRad, r=0 } origin, extent and corner radius of Rectangle
|
|
162
|
-
* @param fillc [C.white] color to fill the rectangle, '' for no fill
|
|
163
|
-
* @param strokec [C.black] stroke color, '' for no stroke
|
|
164
|
-
* @param g0 [new Graphics()] Graphics to clone and extend during paint()
|
|
165
|
-
*/
|
|
166
|
-
constructor({ x, y, w, h, r }: {
|
|
167
|
-
x?: number;
|
|
168
|
-
y?: number;
|
|
169
|
-
w?: number;
|
|
170
|
-
h?: number;
|
|
171
|
-
r?: number;
|
|
172
|
-
}, fillc?: string, strokec?: string, g0?: Graphics);
|
|
173
|
-
/** update any of {x, y, w, h, r} for future paint() or setBounds(...) */
|
|
174
|
-
setRectRad({ x, y, w, h, r }: Partial<XYWH & {
|
|
175
|
-
r: number;
|
|
176
|
-
}>): void;
|
|
177
|
-
setBounds(x: number | undefined | null, y: number, width: number, height: number): void;
|
|
178
|
-
rscgf(fillc: string, g?: Graphics): Graphics;
|
|
179
|
-
}
|
|
180
37
|
/** from hextowns, with translucent center circle. */
|
|
181
38
|
export declare class TileShape extends HexShape {
|
|
182
39
|
static fillColor: string;
|
|
@@ -190,64 +47,55 @@ export declare class LegalMark extends Shape {
|
|
|
190
47
|
hex2: IHex2;
|
|
191
48
|
setOnHex(hex: IHex2): void;
|
|
192
49
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
rectShape: RectShape;
|
|
200
|
-
/** Text object to be displayed above an RectShape of color */
|
|
201
|
-
label: Text;
|
|
202
|
-
_border: number;
|
|
203
|
-
/** extend RectShape around Text bounds; fraction of line height. */
|
|
204
|
-
get border(): number;
|
|
205
|
-
set border(b: number);
|
|
206
|
-
_corner: number;
|
|
207
|
-
/** corner radius; fraction of line height. */
|
|
208
|
-
get corner(): number;
|
|
209
|
-
set corner(rc: number);
|
|
210
|
-
/** the string inside the Text label. */
|
|
211
|
-
get label_text(): string | undefined;
|
|
212
|
-
set label_text(txt: string | undefined);
|
|
213
|
-
/**
|
|
214
|
-
* Create Container with Text above a RectShape.
|
|
215
|
-
* @param color of background RectShape.
|
|
216
|
-
* @param text label
|
|
217
|
-
* @param border [.3] extend RectShape around Text; fraction of fontSize
|
|
218
|
-
* @param corner [0] corner radius as fraction of fontSize
|
|
219
|
-
* @param cgf [new Graphics()]
|
|
220
|
-
*/
|
|
221
|
-
constructor(color: string, label: Text, border?: number, corner?: number, cgf?: CGF);
|
|
222
|
-
/** TextInRect.paint(color) paints new color for the backing RectShape. */
|
|
223
|
-
paint(color?: string, force?: boolean): Graphics;
|
|
224
|
-
calcBounds(): XYWH;
|
|
225
|
-
setCacheID(): void;
|
|
226
|
-
setBounds(x: number | undefined | null, y: number, width: number, height: number): void;
|
|
227
|
-
}
|
|
228
|
-
/** Construct a CenterText for a TextInRect. */
|
|
50
|
+
export type UtilButtonOptions = TextStyle & TextInRectOptions & {
|
|
51
|
+
rollover?: (mouseIn: boolean) => void;
|
|
52
|
+
active?: boolean;
|
|
53
|
+
visible?: boolean;
|
|
54
|
+
};
|
|
55
|
+
/** A CenterText in a TextInRect. */
|
|
229
56
|
export declare class UtilButton extends TextInRect {
|
|
230
|
-
fontSize: number;
|
|
231
|
-
textColor: string;
|
|
232
57
|
/**
|
|
233
58
|
* Create Container with CenterText above a RectShape.
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
* @param
|
|
239
|
-
* @param
|
|
59
|
+
*
|
|
60
|
+
* on(rollover|rollout, this.rollover(mouseIn))
|
|
61
|
+
*
|
|
62
|
+
* initially visible & mouseEnabled, but deactivated.
|
|
63
|
+
* @param label if string: new CenterText(label, fontSize, textColor)
|
|
64
|
+
* @param options
|
|
65
|
+
* * bgColor [undefined = C.WHITE] of the background
|
|
66
|
+
* * border: [undefined = .3] for background, fraction of fontSize
|
|
67
|
+
* * corner: [undefined = 0] corner radius of background
|
|
68
|
+
* * fontSize: [TP.hexRad/2] if Text not supplied
|
|
69
|
+
* * textColor: [C.BLACK] if Text not supplied
|
|
70
|
+
* * visible: [false] initial visibility
|
|
71
|
+
* * active: [false] supply true|false to activate(active, visible) including stage?.update()
|
|
72
|
+
* @param cgf [tscgf] CGF for the RectShape
|
|
73
|
+
*/
|
|
74
|
+
constructor(label: string | Text, options?: UtilButtonOptions, cgf?: CGF);
|
|
75
|
+
/** When activated, this.rollover(mouseIn) is invoked when mouse enter/exits this button. */
|
|
76
|
+
rollover: (mouseIn: boolean) => void;
|
|
77
|
+
_active: boolean;
|
|
78
|
+
/** indicates if this button is currently activated. */
|
|
79
|
+
get isActive(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Activate (or deactivate) this UtilButton.
|
|
82
|
+
*
|
|
83
|
+
* When activated: visible, mouseEnabled, enable rollover(mouseIn).
|
|
84
|
+
*
|
|
85
|
+
* @param active [true] false to deactivate
|
|
86
|
+
* @param visible [active] true or false to set this.visible
|
|
87
|
+
* @returns this
|
|
240
88
|
*/
|
|
241
|
-
|
|
89
|
+
activate(active?: boolean, visible?: boolean): this;
|
|
242
90
|
/**
|
|
243
91
|
* Repaint the stage with button visible or not.
|
|
244
92
|
*
|
|
245
|
-
* Allow Chrome to finish stage.update before proceeding with
|
|
93
|
+
* Allow Chrome to finish stage.update before proceeding with after().
|
|
246
94
|
*
|
|
247
95
|
* Other code can watch this.blocked; then call updateWait(false) to reset.
|
|
248
|
-
* @param after callback on('drawend') when stage.update is done [none]
|
|
249
|
-
* @param scope thisArg for after [this UtilButton]
|
|
250
|
-
* @param hide [false] true to
|
|
96
|
+
* @param after [() => {}] callback on('drawend') when stage.update is done [none]
|
|
97
|
+
* @param scope [this] thisArg for after [this UtilButton]
|
|
98
|
+
* @param hide [false] true to deactivate this UtilButton
|
|
251
99
|
* @deprecated use easeljs-lib.afterUpdate(cont, after, scope) directly
|
|
252
100
|
*/
|
|
253
101
|
updateWait(after?: () => void, scope?: any, hide?: boolean): void;
|
package/dist/shapes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../src/shapes.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"shapes.d.ts","sourceRoot":"","sources":["../src/shapes.ts"],"names":[],"mappings":";AACA,OAAO,EAAe,cAAc,EAAE,UAAU,EAAE,KAAK,GAAG,EAAE,KAAK,iBAAiB,EAAE,K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