@johnmorrisdotca/fuda-cards 0.10.1 → 0.11.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.
- package/LICENSE +21 -0
- package/NOTICE.md +14 -0
- package/README.md +89 -7
- package/dist/binder.d.ts +4 -6
- package/dist/binder.js +32 -23
- package/dist/card-markup.d.ts +2 -0
- package/dist/card-markup.js +59 -0
- package/dist/card-options.d.ts +131 -0
- package/dist/card-options.js +48 -0
- package/dist/card-styles.d.ts +2 -0
- package/dist/card-styles.js +314 -0
- package/dist/choice.d.ts +1 -1
- package/dist/choice.js +27 -23
- package/dist/collection-address.d.ts +8 -0
- package/dist/collection-address.js +52 -0
- package/dist/collection-binder-view.d.ts +9 -0
- package/dist/collection-binder-view.js +123 -0
- package/dist/collection-controls.d.ts +2 -0
- package/dist/collection-controls.js +143 -0
- package/dist/collection-deck.d.ts +11 -0
- package/dist/collection-deck.js +165 -0
- package/dist/collection-dialog.d.ts +2 -0
- package/dist/collection-dialog.js +28 -0
- package/dist/collection-element.d.ts +30 -65
- package/dist/collection-element.js +283 -484
- package/dist/collection-host.d.ts +5 -0
- package/dist/collection-host.js +1 -0
- package/dist/collection-icons.d.ts +3 -0
- package/dist/collection-icons.js +19 -0
- package/dist/collection-motion.d.ts +11 -0
- package/dist/collection-motion.js +72 -0
- package/dist/collection-styles.d.ts +4 -0
- package/dist/collection-styles.js +336 -0
- package/dist/collection-views.d.ts +8 -0
- package/dist/collection-views.js +8 -0
- package/dist/collection.d.ts +140 -11
- package/dist/collection.js +139 -33
- package/dist/element-define.d.ts +2 -0
- package/dist/element-define.js +3 -0
- package/dist/element.d.ts +20 -1
- package/dist/element.js +289 -98
- package/dist/index.d.ts +9 -52
- package/dist/index.js +5 -5
- package/dist/live-3d.d.ts +87 -4
- package/dist/live-3d.js +120 -52
- package/dist/materials.d.ts +117 -6
- package/dist/materials.js +191 -28
- package/dist/motion.d.ts +2 -0
- package/dist/motion.js +4 -0
- package/dist/pile-card.js +138 -91
- package/dist/pile.d.ts +61 -8
- package/dist/pile.js +89 -29
- package/dist/stack.d.ts +42 -6
- package/dist/stack.js +28 -3
- package/dist/version.d.ts +11 -0
- package/dist/version.js +11 -0
- package/dist/wear.d.ts +147 -9
- package/dist/wear.js +273 -89
- package/dist/zoom.d.ts +1 -1
- package/dist/zoom.js +73 -42
- package/docs/API.md +121 -131
- package/docs/guides/bundlers.md +60 -0
- package/docs/guides/card-element.md +2 -2
- package/docs/guides/embed-in-an-iframe.md +39 -0
- package/docs/guides/frameworks.md +93 -66
- package/docs/guides/getting-started.md +3 -1
- package/docs/guides/html-and-cdn.md +69 -0
- package/docs/guides/ja/bundlers.md +60 -0
- package/docs/guides/ja/card-element.md +2 -2
- package/docs/guides/ja/embed-in-an-iframe.md +39 -0
- package/docs/guides/ja/frameworks.md +93 -66
- package/docs/guides/ja/getting-started.md +3 -1
- package/docs/guides/ja/html-and-cdn.md +69 -0
- package/docs/guides/ja/materials-and-stacks.md +3 -3
- package/docs/guides/ja/troubleshooting.md +2 -2
- package/docs/guides/ja/typescript-and-node.md +45 -0
- package/docs/guides/ja/upgrading.md +1 -1
- package/docs/guides/materials-and-stacks.md +3 -3
- package/docs/guides/troubleshooting.md +2 -2
- package/docs/guides/typescript-and-node.md +45 -0
- package/docs/guides/upgrading.md +1 -1
- package/package.json +57 -10
package/docs/API.md
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
# @johnmorrisdotca/fuda-cards API reference
|
|
2
2
|
|
|
3
|
-
Every export of @johnmorrisdotca/fuda-cards 0.
|
|
3
|
+
Every export of @johnmorrisdotca/fuda-cards 0.11.0, one section for each entry point, written by `pnpm docs:api` from the built declarations. Do not edit it by hand: `pnpm docs:check` fails when it is out of date. The guides are in [docs/guides](guides/getting-started.md).
|
|
4
4
|
|
|
5
5
|
## `@johnmorrisdotca/fuda-cards`
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
17 values and 15 types.
|
|
8
8
|
|
|
9
9
|
```js
|
|
10
|
-
import { cardFinishes, cardMaterial, cardMaterials, cardVariants, mmPerPoint, stackHeightMm, stackLayout, stackPresets, wearLayout, wearLevels, wearOutline, wearOverlaySvg, wearPreset, wearPresets } from '@johnmorrisdotca/fuda-cards';
|
|
10
|
+
import { cardAttributes, cardFinishes, cardMaterial, cardMaterials, cardVariants, DEFAULT_CARD_THICKNESS_MM, mmPerPoint, stackHeightMm, stackLayout, stackPresets, VERSION, wearLayout, wearLevels, wearOutline, wearOverlaySvg, wearPreset, wearPresets } from '@johnmorrisdotca/fuda-cards';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### cardAttributes
|
|
14
|
+
|
|
15
|
+
*function*. The attributes of a `<fuda-card>` for these options, ready to set one by one (`element.setAttribute(name, value)`): names are the
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
function cardAttributes(options: CardOptions): Record<string, string>;
|
|
11
19
|
```
|
|
12
20
|
|
|
13
21
|
### cardFinishes
|
|
14
22
|
|
|
15
|
-
*constant
|
|
23
|
+
*constant*. The two finishes, foil and matte.
|
|
16
24
|
|
|
17
25
|
```ts
|
|
18
26
|
const cardFinishes: readonly CardFinish[];
|
|
@@ -20,7 +28,7 @@ const cardFinishes: readonly CardFinish[];
|
|
|
20
28
|
|
|
21
29
|
### cardMaterial
|
|
22
30
|
|
|
23
|
-
*function*. The material with this id
|
|
31
|
+
*function*. The material with this id.
|
|
24
32
|
|
|
25
33
|
```ts
|
|
26
34
|
function cardMaterial(id: string | null | undefined): CardMaterial | undefined;
|
|
@@ -28,7 +36,7 @@ function cardMaterial(id: string | null | undefined): CardMaterial | undefined;
|
|
|
28
36
|
|
|
29
37
|
### cardMaterials
|
|
30
38
|
|
|
31
|
-
*constant
|
|
39
|
+
*constant*. Every material the package knows, each with a thickness and the page it was read from. `docs/materials.md` lists them with their sources.
|
|
32
40
|
|
|
33
41
|
```ts
|
|
34
42
|
const cardMaterials: readonly CardMaterial[];
|
|
@@ -36,15 +44,23 @@ const cardMaterials: readonly CardMaterial[];
|
|
|
36
44
|
|
|
37
45
|
### cardVariants
|
|
38
46
|
|
|
39
|
-
*constant
|
|
47
|
+
*constant*. The three looks, in the order the studio offers them.
|
|
40
48
|
|
|
41
49
|
```ts
|
|
42
50
|
const cardVariants: readonly CardVariant[];
|
|
43
51
|
```
|
|
44
52
|
|
|
53
|
+
### DEFAULT_CARD_THICKNESS_MM
|
|
54
|
+
|
|
55
|
+
*constant*. The thickness of a card that names no material or thickness: a playing card's black-core stock, 13 pt, 0.325 mm
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
const DEFAULT_CARD_THICKNESS_MM = 0.325;
|
|
59
|
+
```
|
|
60
|
+
|
|
45
61
|
### mmPerPoint
|
|
46
62
|
|
|
47
|
-
*constant*. One thousandth of an inch ("pt" in card and paper trade talk) in millimetres.
|
|
63
|
+
*constant*. One thousandth of an inch ("pt" in card and paper trade talk) in millimetres, 0.0254: a 13 pt card is 13 × 0.0254 mm.
|
|
48
64
|
|
|
49
65
|
```ts
|
|
50
66
|
const mmPerPoint = 0.0254;
|
|
@@ -52,7 +68,7 @@ const mmPerPoint = 0.0254;
|
|
|
52
68
|
|
|
53
69
|
### stackHeightMm
|
|
54
70
|
|
|
55
|
-
*function*.
|
|
71
|
+
*function*. The height of a stack of cards, in millimetres: the count times the thickness of one, to a thousandth of a millimetre.
|
|
56
72
|
|
|
57
73
|
```ts
|
|
58
74
|
function stackHeightMm(count: number, thicknessMm: number): number;
|
|
@@ -60,7 +76,7 @@ function stackHeightMm(count: number, thicknessMm: number): number;
|
|
|
60
76
|
|
|
61
77
|
### stackLayout
|
|
62
78
|
|
|
63
|
-
*function*.
|
|
79
|
+
*function*. Where the cards of a stack lie, from neat to messy, the same every time for the same seed: the cards under the top one, bottom first, at most
|
|
64
80
|
|
|
65
81
|
```ts
|
|
66
82
|
function stackLayout(count: number, options?: StackLayoutOptions): StackPlace[];
|
|
@@ -68,15 +84,23 @@ function stackLayout(count: number, options?: StackLayoutOptions): StackPlace[];
|
|
|
68
84
|
|
|
69
85
|
### stackPresets
|
|
70
86
|
|
|
71
|
-
*constant
|
|
87
|
+
*constant*. The usual sizes of a stack of cards, each with where the number comes from.
|
|
72
88
|
|
|
73
89
|
```ts
|
|
74
90
|
const stackPresets: readonly StackPreset[];
|
|
75
91
|
```
|
|
76
92
|
|
|
93
|
+
### VERSION
|
|
94
|
+
|
|
95
|
+
*constant*. The version of this package, the same as `package.json`'s (a test holds the two together).
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
const VERSION = "0.11.0";
|
|
99
|
+
```
|
|
100
|
+
|
|
77
101
|
### wearLayout
|
|
78
102
|
|
|
79
|
-
*function*. Where every mark of a card lies. A pure function of the levels and the seed: no DOM, nothing at random.
|
|
103
|
+
*function*. Where every mark of a card lies. A pure function of the levels and the seed: no DOM, nothing at random, so the same seed lays the same marks every time.
|
|
80
104
|
|
|
81
105
|
```ts
|
|
82
106
|
function wearLayout(levels: WearLevels, seed?: number): WearFeatures;
|
|
@@ -84,7 +108,7 @@ function wearLayout(levels: WearLevels, seed?: number): WearFeatures;
|
|
|
84
108
|
|
|
85
109
|
### wearLevels
|
|
86
110
|
|
|
87
|
-
*function*. The levels a card's wear asks for
|
|
111
|
+
*function*. The levels a card's wear asks for: the grade's or the number's, with any level named on its own laid over them.
|
|
88
112
|
|
|
89
113
|
```ts
|
|
90
114
|
function wearLevels(options: WearOptions): WearLevels | null;
|
|
@@ -95,7 +119,7 @@ function wearLevels(options: WearOptions): WearLevels | null;
|
|
|
95
119
|
*function*. The outline of a face as an SVG path in the 250 by 350 box, corners as worn.
|
|
96
120
|
|
|
97
121
|
```ts
|
|
98
|
-
function wearOutline(features: WearFeatures, face?:
|
|
122
|
+
function wearOutline(features: WearFeatures, face?: "front" | "back"): string;
|
|
99
123
|
```
|
|
100
124
|
|
|
101
125
|
### wearOverlaySvg
|
|
@@ -103,12 +127,12 @@ function wearOutline(features: WearFeatures, face?: 'front' | 'back'): string;
|
|
|
103
127
|
*function*. The SVG laid over one face: whitening, folds, creases, scratches, specks, stain and toning. Markup only, no script.
|
|
104
128
|
|
|
105
129
|
```ts
|
|
106
|
-
function wearOverlaySvg(features: WearFeatures, face?:
|
|
130
|
+
function wearOverlaySvg(features: WearFeatures, face?: "front" | "back"): string;
|
|
107
131
|
```
|
|
108
132
|
|
|
109
133
|
### wearPreset
|
|
110
134
|
|
|
111
|
-
*function
|
|
135
|
+
*function*. The grade with this id.
|
|
112
136
|
|
|
113
137
|
```ts
|
|
114
138
|
function wearPreset(id: string | null | undefined): WearPreset | undefined;
|
|
@@ -116,7 +140,7 @@ function wearPreset(id: string | null | undefined): WearPreset | undefined;
|
|
|
116
140
|
|
|
117
141
|
### wearPresets
|
|
118
142
|
|
|
119
|
-
*constant*.
|
|
143
|
+
*constant*. The seven grades, from perfect to damaged. The names are the plain grading terms; the numbers are this package's reading of them (docs/wear.md).
|
|
120
144
|
|
|
121
145
|
```ts
|
|
122
146
|
const wearPresets: readonly WearPreset[];
|
|
@@ -124,15 +148,15 @@ const wearPresets: readonly WearPreset[];
|
|
|
124
148
|
|
|
125
149
|
### CardFinish
|
|
126
150
|
|
|
127
|
-
*type*. A card's finish and
|
|
151
|
+
*type*. A card's finish: foil catches the light and shows a rainbow in its frame, matte does not.
|
|
128
152
|
|
|
129
153
|
```ts
|
|
130
|
-
type CardFinish =
|
|
154
|
+
type CardFinish = "foil" | "matte";
|
|
131
155
|
```
|
|
132
156
|
|
|
133
157
|
### CardMaterial
|
|
134
158
|
|
|
135
|
-
*interface
|
|
159
|
+
*interface*. A card material: a stock or a metal with a thickness read from a maker or a standard, and the colour its edge is drawn in.
|
|
136
160
|
|
|
137
161
|
```ts
|
|
138
162
|
interface CardMaterial {
|
|
@@ -149,15 +173,15 @@ interface CardMaterial {
|
|
|
149
173
|
|
|
150
174
|
### CardMaterialGroup
|
|
151
175
|
|
|
152
|
-
*type
|
|
176
|
+
*type*. The kind of stock a material is: plain paper card, plastic, a thick trading-card stock or metal.
|
|
153
177
|
|
|
154
178
|
```ts
|
|
155
|
-
type CardMaterialGroup =
|
|
179
|
+
type CardMaterialGroup = "paper" | "plastic" | "thick-card" | "metal";
|
|
156
180
|
```
|
|
157
181
|
|
|
158
182
|
### CardMaterialSource
|
|
159
183
|
|
|
160
|
-
*interface*.
|
|
184
|
+
*interface*. Where a number was read: the maker's or the standard's page, and what it says there.
|
|
161
185
|
|
|
162
186
|
```ts
|
|
163
187
|
interface CardMaterialSource {
|
|
@@ -170,7 +194,7 @@ interface CardMaterialSource {
|
|
|
170
194
|
|
|
171
195
|
### CardOptions
|
|
172
196
|
|
|
173
|
-
*interface
|
|
197
|
+
*interface*. Every setting of `<fuda-card>` as an object. `cardAttributes(options)` turns it into the element's attributes, so the same object
|
|
174
198
|
|
|
175
199
|
```ts
|
|
176
200
|
interface CardOptions {
|
|
@@ -182,7 +206,7 @@ interface CardOptions {
|
|
|
182
206
|
rarity?: string;
|
|
183
207
|
variant?: CardVariant;
|
|
184
208
|
finish?: CardFinish;
|
|
185
|
-
/** Card thickness in millimetres at the 63 mm wide card size; overrides the material's. Default 0.
|
|
209
|
+
/** Card thickness in millimetres at the 63 mm wide card size; overrides the material's. Default 0.325, 0 for a flat card. */
|
|
186
210
|
thickness?: number;
|
|
187
211
|
/** A material's id (see `cardMaterials`): its sourced thickness and edge colour. */
|
|
188
212
|
material?: string;
|
|
@@ -203,38 +227,54 @@ interface CardOptions {
|
|
|
203
227
|
wearEdges?: number;
|
|
204
228
|
wearSurface?: number;
|
|
205
229
|
wearCreases?: number;
|
|
230
|
+
/** The card shows its back. */
|
|
206
231
|
flipped?: boolean;
|
|
207
|
-
motion?:
|
|
232
|
+
motion?: "still" | "pan";
|
|
233
|
+
/** The picture is moving now (needs `motion: "pan"`). */
|
|
208
234
|
playing?: boolean;
|
|
209
235
|
/** `focus`: the card in focus animates its art (needs `motion: 'pan'`); never with reduced motion. */
|
|
210
|
-
autoplay?:
|
|
211
|
-
panDirection?:
|
|
212
|
-
panLoop?:
|
|
213
|
-
cardSpin?:
|
|
214
|
-
cardSpinDirection?:
|
|
236
|
+
autoplay?: "focus";
|
|
237
|
+
panDirection?: "down" | "up";
|
|
238
|
+
panLoop?: "alternate" | "restart";
|
|
239
|
+
cardSpin?: "center" | "corner";
|
|
240
|
+
cardSpinDirection?: "normal" | "reverse";
|
|
215
241
|
cardSpinPaused?: boolean;
|
|
242
|
+
/** The page turns the card with `--fuda-yaw` and `--fuda-tilt` instead of the built-in spin. */
|
|
243
|
+
cardView?: boolean;
|
|
244
|
+
/** `open`: a stack of more than one card fans open. */
|
|
245
|
+
fan?: "open";
|
|
246
|
+
/** How many cards are on the pile beside the stack. */
|
|
247
|
+
takenOff?: number;
|
|
248
|
+
/** How a card taken off lands: `face-up` or turned over (`face-down`). */
|
|
249
|
+
deckLand?: "face-up" | "face-down";
|
|
250
|
+
/** `off` ends every move at once. */
|
|
251
|
+
animate?: "on" | "off";
|
|
252
|
+
/** How long a move takes: `slow`, `normal` or `quick`. */
|
|
253
|
+
speed?: "slow" | "normal" | "quick";
|
|
254
|
+
/** The three buttons under a stack: Fan, Take a card off and Put it back. */
|
|
255
|
+
pileControls?: boolean;
|
|
216
256
|
}
|
|
217
257
|
```
|
|
218
258
|
|
|
219
259
|
### CardVariant
|
|
220
260
|
|
|
221
|
-
*type
|
|
261
|
+
*type*. A card's look: classic gold, silver sport or cosmic violet.
|
|
222
262
|
|
|
223
263
|
```ts
|
|
224
|
-
type CardVariant =
|
|
264
|
+
type CardVariant = "classic" | "sport" | "cosmic";
|
|
225
265
|
```
|
|
226
266
|
|
|
227
267
|
### CornerKind
|
|
228
268
|
|
|
229
|
-
*type
|
|
269
|
+
*type*. How a corner is worn: sharp, softened, rounded, chipped or folded.
|
|
230
270
|
|
|
231
271
|
```ts
|
|
232
|
-
type CornerKind =
|
|
272
|
+
type CornerKind = "sharp" | "soft" | "rounded" | "chipped" | "dog-eared";
|
|
233
273
|
```
|
|
234
274
|
|
|
235
275
|
### StackLayoutOptions
|
|
236
276
|
|
|
237
|
-
*interface
|
|
277
|
+
*interface*. How a stack is laid out: how messy, from which seed and how many cards deep.
|
|
238
278
|
|
|
239
279
|
```ts
|
|
240
280
|
interface StackLayoutOptions {
|
|
@@ -249,7 +289,7 @@ interface StackLayoutOptions {
|
|
|
249
289
|
|
|
250
290
|
### StackPlace
|
|
251
291
|
|
|
252
|
-
*interface*. Where
|
|
292
|
+
*interface*. Where one card of a stack lies, as the stack's layout says: how far it is nudged across and down, in card widths, and how far it is turned.
|
|
253
293
|
|
|
254
294
|
```ts
|
|
255
295
|
interface StackPlace {
|
|
@@ -264,7 +304,7 @@ interface StackPlace {
|
|
|
264
304
|
|
|
265
305
|
### StackPreset
|
|
266
306
|
|
|
267
|
-
*interface*. A count of cards for a stack, with where the number comes from.
|
|
307
|
+
*interface*. A count of cards for a stack, with where the number comes from: a deck of 52, a Pokémon deck of 60, a booster pack of about 10.
|
|
268
308
|
|
|
269
309
|
```ts
|
|
270
310
|
interface StackPreset {
|
|
@@ -277,7 +317,7 @@ interface StackPreset {
|
|
|
277
317
|
|
|
278
318
|
### WearCorner
|
|
279
319
|
|
|
280
|
-
*interface
|
|
320
|
+
*interface*. One corner of a worn card: how it is worn and how far the damage reaches.
|
|
281
321
|
|
|
282
322
|
```ts
|
|
283
323
|
interface WearCorner {
|
|
@@ -291,7 +331,7 @@ interface WearCorner {
|
|
|
291
331
|
|
|
292
332
|
### WearFeatures
|
|
293
333
|
|
|
294
|
-
*interface
|
|
334
|
+
*interface*. Every mark of a worn card: its corners, its centring, and the creases, scratches, specks and stain of each face.
|
|
295
335
|
|
|
296
336
|
```ts
|
|
297
337
|
interface WearFeatures {
|
|
@@ -327,7 +367,7 @@ interface WearLevels {
|
|
|
327
367
|
|
|
328
368
|
### WearOptions
|
|
329
369
|
|
|
330
|
-
*interface
|
|
370
|
+
*interface*. What a card asks of its wear: a grade or a number, a seed, and any level on its own.
|
|
331
371
|
|
|
332
372
|
```ts
|
|
333
373
|
interface WearOptions {
|
|
@@ -345,7 +385,7 @@ interface WearOptions {
|
|
|
345
385
|
|
|
346
386
|
### WearPreset
|
|
347
387
|
|
|
348
|
-
*interface
|
|
388
|
+
*interface*. A grading term with the levels it stands for and what it means in a few words.
|
|
349
389
|
|
|
350
390
|
```ts
|
|
351
391
|
interface WearPreset {
|
|
@@ -367,7 +407,7 @@ import { FudaCard } from '@johnmorrisdotca/fuda-cards/element';
|
|
|
367
407
|
|
|
368
408
|
### FudaCard
|
|
369
409
|
|
|
370
|
-
*class
|
|
410
|
+
*class*. `<fuda-card>`: a collectible card frame around a picture you give it (or a live 3D view), drawn with a true thickness, an edge, a back, foil or matte,
|
|
371
411
|
|
|
372
412
|
```ts
|
|
373
413
|
class FudaCard extends HTMLElement {
|
|
@@ -376,6 +416,8 @@ class FudaCard extends HTMLElement {
|
|
|
376
416
|
private hushed;
|
|
377
417
|
private focusedAtPress?;
|
|
378
418
|
constructor();
|
|
419
|
+
/** The light follows the pointer over the card: a foil card shows its sheen where the pointer is (see `--fuda-sheen-x` and `--fuda-sheen-y`). */
|
|
420
|
+
private watchLight;
|
|
379
421
|
/** With `autoplay="focus"` the card in focus animates its art; leaving it (pointer, keyboard or a tap elsewhere) stops it. */
|
|
380
422
|
private watchFocus;
|
|
381
423
|
/** Put this card in focus (or out of it); the card that had focus is put out, so only one is ever in focus. */
|
|
@@ -385,10 +427,12 @@ class FudaCard extends HTMLElement {
|
|
|
385
427
|
private toggleMotion;
|
|
386
428
|
/** The art stays invisible until the card has a size on screen and every slotted image has loaded, so it never shows outside the frame. */
|
|
387
429
|
private watchArt;
|
|
430
|
+
/** The front is hidden while `--fuda-yaw` has turned the back toward the reader. */
|
|
431
|
+
private watchFacing;
|
|
388
432
|
connectedCallback(): void;
|
|
389
433
|
disconnectedCallback(): void;
|
|
390
434
|
attributeChangedCallback(name: string): void;
|
|
391
|
-
/** Millimetres thick: the `thickness` attribute, else the `material`'s, else 0.
|
|
435
|
+
/** Millimetres thick: the `thickness` attribute, else the `material`'s, else the playing-card stock's 0.325 (`DEFAULT_CARD_THICKNESS_MM`). */
|
|
392
436
|
get cardThicknessMm(): number;
|
|
393
437
|
/** How many cards the stack holds: the `stack` attribute as a whole number from 1 (one card) to 1000. */
|
|
394
438
|
get stackCount(): number;
|
|
@@ -428,6 +472,14 @@ class FudaCard extends HTMLElement {
|
|
|
428
472
|
}
|
|
429
473
|
```
|
|
430
474
|
|
|
475
|
+
## `@johnmorrisdotca/fuda-cards/element/define`
|
|
476
|
+
|
|
477
|
+
0 values and 0 types.
|
|
478
|
+
|
|
479
|
+
```js
|
|
480
|
+
import { /* types only */ } from '@johnmorrisdotca/fuda-cards/element/define';
|
|
481
|
+
```
|
|
482
|
+
|
|
431
483
|
## `@johnmorrisdotca/fuda-cards/live-3d`
|
|
432
484
|
|
|
433
485
|
1 value and 5 types.
|
|
@@ -438,7 +490,7 @@ import { createLiveCards } from '@johnmorrisdotca/fuda-cards/live-3d';
|
|
|
438
490
|
|
|
439
491
|
### createLiveCards
|
|
440
492
|
|
|
441
|
-
*function
|
|
493
|
+
*function*. Make the live cards of a page. Nothing 3D is loaded until a card is first in focus (or a card with no picture of its own comes near the view and needs its still made).
|
|
442
494
|
|
|
443
495
|
```ts
|
|
444
496
|
function createLiveCards<T extends ThreeLike = ThreeLike>(options: LiveCardsOptions<T>): LiveCards<T>;
|
|
@@ -446,7 +498,7 @@ function createLiveCards<T extends ThreeLike = ThreeLike>(options: LiveCardsOpti
|
|
|
446
498
|
|
|
447
499
|
### AddOptions
|
|
448
500
|
|
|
449
|
-
*interface
|
|
501
|
+
*interface*. What a card brings when it is added: the picture it already has.
|
|
450
502
|
|
|
451
503
|
```ts
|
|
452
504
|
interface AddOptions {
|
|
@@ -457,7 +509,7 @@ interface AddOptions {
|
|
|
457
509
|
|
|
458
510
|
### LiveCards
|
|
459
511
|
|
|
460
|
-
*interface
|
|
512
|
+
*interface*. The live cards of a page: add a card, put one in focus, let go. Only the card in focus turns in 3D, on the page's one WebGL context; the others stay pictures.
|
|
461
513
|
|
|
462
514
|
```ts
|
|
463
515
|
interface LiveCards<T extends ThreeLike = ThreeLike> {
|
|
@@ -480,10 +532,10 @@ interface LiveCards<T extends ThreeLike = ThreeLike> {
|
|
|
480
532
|
|
|
481
533
|
### LiveCardsOptions
|
|
482
534
|
|
|
483
|
-
*interface
|
|
535
|
+
*interface*. How the live cards behave: the shared renderer's options (kazoku-ui's), and how long a turn takes, how long the pointer rests before a card goes live and how far ahead a still is made.
|
|
484
536
|
|
|
485
537
|
```ts
|
|
486
|
-
interface LiveCardsOptions<T extends ThreeLike = ThreeLike> extends Omit<SharedRendererOptions<T>,
|
|
538
|
+
interface LiveCardsOptions<T extends ThreeLike = ThreeLike> extends Omit<SharedRendererOptions<T>, "scheduler" | "assets" | "clock" | "document"> {
|
|
487
539
|
/** Seconds for one turn of the card in focus (12). 0 does not turn it. */
|
|
488
540
|
turnSeconds?: number;
|
|
489
541
|
/** How long the pointer has to rest on a card before it goes live, in milliseconds (150), so moving the pointer across a page of cards starts nothing. A press or the keyboard does not wait. */
|
|
@@ -506,7 +558,7 @@ interface LiveItem<T extends ThreeLike = ThreeLike> {
|
|
|
506
558
|
|
|
507
559
|
### LiveScene
|
|
508
560
|
|
|
509
|
-
*interface*. A scene for a card
|
|
561
|
+
*interface*. A scene for a card: kazoku-ui's scene, with `object`, the thing that turns about its upright axis while the card is in focus.
|
|
510
562
|
|
|
511
563
|
```ts
|
|
512
564
|
interface LiveScene extends Scene3D {
|
|
@@ -528,7 +580,7 @@ import { collectionKinds, collectionViewAliases, collectionViews, deckLandings,
|
|
|
528
580
|
|
|
529
581
|
### collectionKinds
|
|
530
582
|
|
|
531
|
-
*constant
|
|
583
|
+
*constant*. The two kinds of item, `card` and `object`.
|
|
532
584
|
|
|
533
585
|
```ts
|
|
534
586
|
const collectionKinds: ReadonlyArray<CollectionKind>;
|
|
@@ -544,7 +596,7 @@ const collectionViewAliases: Readonly<Record<string, CollectionView>>;
|
|
|
544
596
|
|
|
545
597
|
### collectionViews
|
|
546
598
|
|
|
547
|
-
*constant*. The displays, in the order the buttons show them. `jukebox` and `tower` were two more names for the deck's pile of cards (no real counterpart for cards, and the same drawing), so they are no longer offered; see
|
|
599
|
+
*constant*. The ten displays, in the order the buttons show them, each with the label on its button. `jukebox` and `tower` were two more names for the deck's pile of cards (no real counterpart for cards, and the same drawing), so they are no longer offered; see {@link collectionViewAliases}.
|
|
548
600
|
|
|
549
601
|
```ts
|
|
550
602
|
const collectionViews: ReadonlyArray<{
|
|
@@ -555,18 +607,18 @@ const collectionViews: ReadonlyArray<{
|
|
|
555
607
|
|
|
556
608
|
### deckLandings
|
|
557
609
|
|
|
558
|
-
*constant
|
|
610
|
+
*constant*. The two ways a card can land, with the label on each button: `face-up` (still facing up) and `face-down` (turned over sideways on the way).
|
|
559
611
|
|
|
560
612
|
```ts
|
|
561
613
|
const deckLandings: ReadonlyArray<{
|
|
562
|
-
id:
|
|
614
|
+
id: "face-up" | "face-down";
|
|
563
615
|
label: string;
|
|
564
616
|
}>;
|
|
565
617
|
```
|
|
566
618
|
|
|
567
619
|
### fanLayout
|
|
568
620
|
|
|
569
|
-
*function*.
|
|
621
|
+
*function*. Where the cards of a fan lie: each card turns eleven degrees more than the one before, up to 110 degrees from the first to the last, centred on the pile.
|
|
570
622
|
|
|
571
623
|
```ts
|
|
572
624
|
function fanLayout(count: number, seed?: number, step?: number): FanPlace[];
|
|
@@ -574,7 +626,7 @@ function fanLayout(count: number, seed?: number, step?: number): FanPlace[];
|
|
|
574
626
|
|
|
575
627
|
### isCard
|
|
576
628
|
|
|
577
|
-
*constant*.
|
|
629
|
+
*constant*. Whether an item is a card: anything that does not say it is an object. Only a card turns, has a back and lands turned over.
|
|
578
630
|
|
|
579
631
|
```ts
|
|
580
632
|
const isCard: (card: Pick<CollectionCard, "kind">) => boolean;
|
|
@@ -582,7 +634,7 @@ const isCard: (card: Pick<CollectionCard, "kind">) => boolean;
|
|
|
582
634
|
|
|
583
635
|
### movePage
|
|
584
636
|
|
|
585
|
-
*function*.
|
|
637
|
+
*function*. The first card of the page that is `delta` pages away, wrapping round at either end.
|
|
586
638
|
|
|
587
639
|
```ts
|
|
588
640
|
function movePage(index: number, length: number, pageSize: number, delta: number): number;
|
|
@@ -593,20 +645,20 @@ function movePage(index: number, length: number, pageSize: number, delta: number
|
|
|
593
645
|
*function*. The landing a value means: `face-down` (also `upside-down` and `turned-over`) is turned over; anything else is still facing up.
|
|
594
646
|
|
|
595
647
|
```ts
|
|
596
|
-
function normalizeLanding(value: string | null | undefined):
|
|
648
|
+
function normalizeLanding(value: string | null | undefined): "face-up" | "face-down";
|
|
597
649
|
```
|
|
598
650
|
|
|
599
651
|
### parseCollection
|
|
600
652
|
|
|
601
|
-
*function
|
|
653
|
+
*function*. Check a collection and make it the shape the element draws: an array of cards, or an object with a `cards` array. A card without an id is numbered by its place.
|
|
602
654
|
|
|
603
655
|
```ts
|
|
604
|
-
function parseCollection(
|
|
656
|
+
function parseCollection(input: unknown): CollectionCard[];
|
|
605
657
|
```
|
|
606
658
|
|
|
607
659
|
### randomDrawIndex
|
|
608
660
|
|
|
609
|
-
*function*. Choose a
|
|
661
|
+
*function*. Choose a card whose name contains the filter, avoiding the current card when another match exists.
|
|
610
662
|
|
|
611
663
|
```ts
|
|
612
664
|
function randomDrawIndex(cards: CollectionCard[], current: number, filter: string, random?: () => number): number | null;
|
|
@@ -614,7 +666,7 @@ function randomDrawIndex(cards: CollectionCard[], current: number, filter: strin
|
|
|
614
666
|
|
|
615
667
|
### CollectionCard
|
|
616
668
|
|
|
617
|
-
*interface
|
|
669
|
+
*interface*. One item of a collection: an id, a name, the front's picture, optionally the back's, its kind and its metadata.
|
|
618
670
|
|
|
619
671
|
```ts
|
|
620
672
|
interface CollectionCard {
|
|
@@ -632,12 +684,12 @@ interface CollectionCard {
|
|
|
632
684
|
*type*. What an item is. A `card` (the default, so every collection written before this field existed is still cards) is a flat, thin card with a back: it
|
|
633
685
|
|
|
634
686
|
```ts
|
|
635
|
-
type CollectionKind =
|
|
687
|
+
type CollectionKind = "card" | "object";
|
|
636
688
|
```
|
|
637
689
|
|
|
638
690
|
### CollectionMetadata
|
|
639
691
|
|
|
640
|
-
*interface
|
|
692
|
+
*interface*. What a collector writes about a card: its set, year, number, edition, condition, grade, quantity and notes. All optional; `year` and `quantity` are whole numbers.
|
|
641
693
|
|
|
642
694
|
```ts
|
|
643
695
|
interface CollectionMetadata {
|
|
@@ -654,10 +706,10 @@ interface CollectionMetadata {
|
|
|
654
706
|
|
|
655
707
|
### CollectionView
|
|
656
708
|
|
|
657
|
-
*type*.
|
|
709
|
+
*type*. The name of a display of `<fuda-collection>`: the `view` attribute's values. `jukebox` and `tower` are older names that open the deck (see
|
|
658
710
|
|
|
659
711
|
```ts
|
|
660
|
-
type CollectionView =
|
|
712
|
+
type CollectionView = "deck" | "rolodex" | "binder" | "case" | "jukebox" | "random" | "story" | "wall" | "tower" | "spotlight" | "atlas" | "fan";
|
|
661
713
|
```
|
|
662
714
|
|
|
663
715
|
### DeckLanding
|
|
@@ -665,12 +717,12 @@ type CollectionView = 'deck' | 'rolodex' | 'binder' | 'case' | 'jukebox' | 'rand
|
|
|
665
717
|
*type*. How a card taken off a pile lands on the pile at its side: still facing up, or turned over sideways (as a person turns a card, like a
|
|
666
718
|
|
|
667
719
|
```ts
|
|
668
|
-
type DeckLanding =
|
|
720
|
+
type DeckLanding = "face-up" | "face-down" | "upside-down";
|
|
669
721
|
```
|
|
670
722
|
|
|
671
723
|
### FanPlace
|
|
672
724
|
|
|
673
|
-
*interface*. Where
|
|
725
|
+
*interface*. Where one card of a fan lies, first card on the left when open and on top when closed. `angle`, `x` and `y` are the open fan, spread like a hand
|
|
674
726
|
|
|
675
727
|
```ts
|
|
676
728
|
interface FanPlace {
|
|
@@ -693,28 +745,10 @@ import { FudaCollection } from '@johnmorrisdotca/fuda-cards/collection-element';
|
|
|
693
745
|
|
|
694
746
|
### FudaCollection
|
|
695
747
|
|
|
696
|
-
*class
|
|
748
|
+
*class*. `<fuda-collection>`: a whole collection in one of ten displays (a deck, a rolodex, binder pages, a display case, a random draw, a story scroll, a gallery wall,
|
|
697
749
|
|
|
698
750
|
```ts
|
|
699
751
|
class FudaCollection extends HTMLElement {
|
|
700
|
-
private root;
|
|
701
|
-
private data;
|
|
702
|
-
private index;
|
|
703
|
-
private pageSize;
|
|
704
|
-
private selected;
|
|
705
|
-
private back;
|
|
706
|
-
private drawFilter;
|
|
707
|
-
private zoom;
|
|
708
|
-
private tiles?;
|
|
709
|
-
private landing?;
|
|
710
|
-
private fanChoice?;
|
|
711
|
-
private animateChoice?;
|
|
712
|
-
private speedChoice?;
|
|
713
|
-
private binderChoices;
|
|
714
|
-
private turn;
|
|
715
|
-
private flip;
|
|
716
|
-
private addressTimer;
|
|
717
|
-
private fanPlaces;
|
|
718
752
|
private liveSetup;
|
|
719
753
|
private liveOff;
|
|
720
754
|
static get observedAttributes(): string[];
|
|
@@ -730,54 +764,10 @@ class FudaCollection extends HTMLElement {
|
|
|
730
764
|
connectedCallback(): void;
|
|
731
765
|
disconnectedCallback(): void;
|
|
732
766
|
attributeChangedCallback(name: string): void;
|
|
733
|
-
private get currentView();
|
|
734
|
-
/** How a card taken off lands: still facing up, or turned over sideways. The 0.6.0 value `upside-down` is still accepted and means turned over. */
|
|
735
|
-
private get land();
|
|
736
|
-
private get fanOpen();
|
|
737
|
-
private get stacked();
|
|
738
|
-
private get piled();
|
|
739
|
-
/** Only a card turns: a collection of objects (no card in it) never turns, and in a mixed one the objects stay square to the reader while the cards turn. */
|
|
740
|
-
private get hasCards();
|
|
741
|
-
private get turnable();
|
|
742
|
-
private q;
|
|
743
|
-
/** With `address`, the display, the fan, the landing, the animation and its speed are kept in the page's address (`?view=fan&fan=open&land=face-down&animate=off`), and a link to it opens the same. */
|
|
744
|
-
private readAddress;
|
|
745
|
-
private writeAddress;
|
|
746
|
-
private move;
|
|
747
|
-
private binderLay;
|
|
748
767
|
/** The first card of an opening of the binder: the right-hand page's first card, or the left-hand page's when the right-hand page is past the end. */
|
|
749
768
|
private spreadFirst;
|
|
750
|
-
private image;
|
|
751
|
-
private open;
|
|
752
|
-
private renderDialog;
|
|
753
|
-
private canDraw;
|
|
754
|
-
/** The one length every move takes, in a custom property the stylesheet reads: `animate="off"` and reduced motion make it 0, `speed` stretches it. */
|
|
755
|
-
private timeVars;
|
|
756
|
-
private syncChoices;
|
|
757
|
-
private build;
|
|
758
|
-
/** One pile of the deck. `positions` are data indexes from the bottom of the pile to its top; the cards under the top one lie nudged and turned from the seed and the top one lies square. A deck's cards also carry where they lie when the fan is open. */
|
|
759
|
-
private pile;
|
|
760
|
-
/** Where the fan's cards lie for a pile of this many cards. A phone's fan lies closer across and leans on its angle. */
|
|
761
|
-
private fanFor;
|
|
762
|
-
/** Open the fan (or close it) on the pile that is on screen, without drawing it again, so every card glides: the open fan's reach is put in custom properties that move the piles apart and the Fit box. */
|
|
763
|
-
private fanVars;
|
|
764
769
|
/** `fan` changed: when a pile is on screen, move its cards to or from the fan in place (animated) and fit the view to it. Returns false when there is no pile to move. */
|
|
765
770
|
private setFan;
|
|
766
|
-
private renderDeck;
|
|
767
|
-
/** The card that just moved flies between the two piles, turning over sideways on the way if it lands face down. The same element, so the card is never drawn twice. An open fan sends the card from where the fan holds it. */
|
|
768
|
-
private playFlip;
|
|
769
|
-
private renderFan;
|
|
770
|
-
/** Where every card is on screen now, by data index. */
|
|
771
|
-
private snapshot;
|
|
772
|
-
/** Cards that arrive grow and fade in, a little to the side the reader is heading. Only an opening keyframe: they end on the card's own style. */
|
|
773
|
-
private enter;
|
|
774
|
-
/** After a card or page change or a switch of display: glide what stays, let what goes leave, bring in what comes. Nothing runs afterwards: each is one animation that ends by itself. */
|
|
775
|
-
private play;
|
|
776
|
-
private syncBinder;
|
|
777
|
-
private binderCount;
|
|
778
|
-
/** The binder: a ring or zip binder open on two facing sheets of pockets. A page turn swings the leaf about the spine, bending as it goes, and shows the pockets on its back. */
|
|
779
|
-
private renderBinder;
|
|
780
|
-
private render;
|
|
781
771
|
}
|
|
782
772
|
```
|
|
783
773
|
|