@johnmorrisdotca/fuda-cards 0.10.1 → 0.12.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 +16 -0
- package/README.md +106 -33
- 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 +36 -67
- 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 +154 -11
- package/dist/collection.js +140 -34
- 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 +246 -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 +138 -134
- package/docs/collection-displays.md +4 -4
- package/docs/collection-input.md +5 -5
- package/docs/framework-integration.md +1 -1
- package/docs/guides/architecture.md +8 -8
- package/docs/guides/bundlers.md +60 -0
- package/docs/guides/card-element.md +26 -2
- package/docs/guides/collections.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 +4 -2
- package/docs/guides/html-and-cdn.md +86 -0
- package/docs/guides/ja/architecture.md +4 -4
- package/docs/guides/ja/bundlers.md +60 -0
- package/docs/guides/ja/card-element.md +26 -2
- package/docs/guides/ja/collections.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 +4 -2
- package/docs/guides/ja/html-and-cdn.md +86 -0
- package/docs/guides/ja/live-3d.md +37 -24
- package/docs/guides/ja/materials-and-stacks.md +4 -4
- package/docs/guides/ja/troubleshooting.md +2 -2
- package/docs/guides/ja/typescript-and-node.md +45 -0
- package/docs/guides/ja/upgrading.md +7 -2
- package/docs/guides/ja/wear.md +1 -1
- package/docs/guides/live-3d.md +37 -24
- package/docs/guides/materials-and-stacks.md +4 -4
- package/docs/guides/troubleshooting.md +2 -2
- package/docs/guides/typescript-and-node.md +45 -0
- package/docs/guides/upgrading.md +7 -2
- package/docs/guides/wear.md +1 -1
- package/docs/live-3d.md +1 -18
- package/docs/materials.md +15 -11
- package/docs/wear.md +4 -12
- package/package.json +57 -10
package/dist/materials.js
CHANGED
|
@@ -1,48 +1,266 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* 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.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { mmPerPoint } from "@johnmorrisdotca/fuda-cards";
|
|
7
|
+
*
|
|
8
|
+
* console.log(Math.round(13 * mmPerPoint * 1000) / 1000); // 0.33
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
2
11
|
export const mmPerPoint = 0.0254;
|
|
12
|
+
/**
|
|
13
|
+
* The thickness of a card that names no material or thickness: a playing card's black-core stock, 13 pt, 0.325 mm
|
|
14
|
+
* (Qin Printing, Black Core Paper 310 gsm, 0.325 mm).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* import { DEFAULT_CARD_THICKNESS_MM, stackHeightMm } from "@johnmorrisdotca/fuda-cards";
|
|
19
|
+
*
|
|
20
|
+
* console.log(stackHeightMm(52, DEFAULT_CARD_THICKNESS_MM)); // 16.9
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export const DEFAULT_CARD_THICKNESS_MM = 0.325;
|
|
3
24
|
const pt = (points) => Math.round(points * mmPerPoint * 1000) / 1000;
|
|
4
|
-
const qin = {
|
|
25
|
+
const qin = {
|
|
26
|
+
label: "Qin Printing, Custom Playing Card Printing",
|
|
27
|
+
url: "https://www.qinprinting.com/poker-card-printing/",
|
|
28
|
+
};
|
|
5
29
|
const holder = (points, slug) => ({
|
|
6
30
|
label: `Ultra PRO, ${points}PT ONE-TOUCH Magnetic Holder`,
|
|
7
31
|
url: `https://ultrapro.com/products/${slug}`,
|
|
8
|
-
says: `holds standard cards (2-1/2" x 3-1/2") up to ${points}pt in thickness
|
|
32
|
+
says: `holds standard cards (2-1/2" x 3-1/2") up to ${points}pt in thickness`,
|
|
9
33
|
});
|
|
10
34
|
const thick = (points, slug) => ({
|
|
11
35
|
id: `card-${points}pt`,
|
|
12
36
|
name: `Thick trading card, ${points} pt`,
|
|
13
|
-
group:
|
|
37
|
+
group: "thick-card",
|
|
14
38
|
thicknessMm: pt(points),
|
|
15
|
-
edge:
|
|
16
|
-
source: holder(points, slug)
|
|
39
|
+
edge: "#e8dfca",
|
|
40
|
+
source: holder(points, slug),
|
|
17
41
|
});
|
|
42
|
+
/**
|
|
43
|
+
* Every material the package knows, each with a thickness and the page it was read from. `docs/materials.md` lists them with their sources.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { cardMaterials } from "@johnmorrisdotca/fuda-cards";
|
|
48
|
+
*
|
|
49
|
+
* for (const material of cardMaterials.slice(0, 3)) console.log(material.id, material.thicknessMm);
|
|
50
|
+
* // paper-250 0.28
|
|
51
|
+
* // paper-310-black-core 0.325
|
|
52
|
+
* // paper-350 0.405
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
18
55
|
export const cardMaterials = [
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
56
|
+
{
|
|
57
|
+
id: "paper-250",
|
|
58
|
+
name: "Card stock, 250 gsm (11 pt)",
|
|
59
|
+
group: "paper",
|
|
60
|
+
thicknessMm: 0.28,
|
|
61
|
+
edge: "#efe9da",
|
|
62
|
+
source: { ...qin, says: "Premium Cardstock, 250gsm, 0.28mm, 11pt" },
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "paper-310-black-core",
|
|
66
|
+
name: "Playing-card stock, black core, 310 gsm (13 pt)",
|
|
67
|
+
group: "paper",
|
|
68
|
+
thicknessMm: 0.325,
|
|
69
|
+
edge: "#2a2a2e",
|
|
70
|
+
source: { ...qin, says: "Black Core Paper, 310gsm, 0.325mm, 13pt" },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "paper-350",
|
|
74
|
+
name: "Heavy card stock, 350 gsm (16 pt)",
|
|
75
|
+
group: "paper",
|
|
76
|
+
thicknessMm: 0.405,
|
|
77
|
+
edge: "#e9e1cd",
|
|
78
|
+
source: { ...qin, says: "Premium Cardstock, 350gsm, 0.405mm, 16pt" },
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "plastic-id1",
|
|
82
|
+
name: "Plastic bank-size card (ID-1, PVC)",
|
|
83
|
+
group: "plastic",
|
|
84
|
+
thicknessMm: 0.76,
|
|
85
|
+
edge: "#f2f2ef",
|
|
86
|
+
source: {
|
|
87
|
+
label: "ISO/IEC 7810 ID-1, as summarised on Wikipedia",
|
|
88
|
+
url: "https://en.wikipedia.org/wiki/ISO/IEC_7810",
|
|
89
|
+
says: '"All card sizes have a thickness of 760±80 μm." Payment cards are generally PVC (Wikipedia, Payment card).',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: "plastic-pvc-0.31",
|
|
94
|
+
name: "Matte PVC playing-card stock",
|
|
95
|
+
group: "plastic",
|
|
96
|
+
thicknessMm: 0.31,
|
|
97
|
+
edge: "#f2f2ef",
|
|
98
|
+
source: {
|
|
99
|
+
label: "Kuo Kau Paper Products, Custom Plastic Poker Cards",
|
|
100
|
+
url: "https://www.kkplayingcard.com/en/product-713063/Custom-Plastic-Playing-Cards-with-P107-Poker-Size-Plastic-Box-Chocolate-Brand-Promotional-Tool-CPA027P107-A-CPA031P107-A.html",
|
|
101
|
+
says: "The maker lists 0.31 mm white PVC with a matte finish.",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
thick(35, "35pt-uv-one-touch-magnetic-holders-5ct"),
|
|
105
|
+
thick(55, "55pt-uv-one-touch-magnetic-holder"),
|
|
106
|
+
thick(75, "75pt-uv-one-touch-magnetic-holder"),
|
|
107
|
+
thick(100, "100pt-uv-one-touch-magnetic-holder"),
|
|
108
|
+
thick(130, "130pt-uv-one-touch-magnetic-holder"),
|
|
109
|
+
thick(180, "180pt-uv-one-touch-magnetic-holder"),
|
|
110
|
+
{
|
|
111
|
+
id: "booklet-175pt",
|
|
112
|
+
name: "Booklet card, 175 pt",
|
|
113
|
+
group: "thick-card",
|
|
114
|
+
thicknessMm: pt(175),
|
|
115
|
+
edge: "#e8dfca",
|
|
116
|
+
source: {
|
|
117
|
+
label: "Ultra PRO, 175PT Vertical Booklet Card ONE-TOUCH Magnetic Holder",
|
|
118
|
+
url: "https://ultrapro.com/products/175pt-vertical-booklet-card-uv-one-touch-magnetic-holder",
|
|
119
|
+
says: '"Sized to fit Vertical Booklets up to 175pt thickness"',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "aluminium-0.8",
|
|
124
|
+
name: "Anodised aluminium card, 0.8 mm",
|
|
125
|
+
group: "metal",
|
|
126
|
+
thicknessMm: 0.8,
|
|
127
|
+
edge: "#c9ced4",
|
|
128
|
+
source: {
|
|
129
|
+
label: "Foison Metal, Blank Metal Business Cards",
|
|
130
|
+
url: "https://www.foismetal.com/product/blank-metal-business-cards-wholesale/",
|
|
131
|
+
says: "The maker lists anodised aluminium among the options for its 85 × 54 × 0.8 mm blanks.",
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "steel-0.5",
|
|
136
|
+
name: "Stainless steel card, 0.5 mm",
|
|
137
|
+
group: "metal",
|
|
138
|
+
thicknessMm: 0.5,
|
|
139
|
+
edge: "#aab0b6",
|
|
140
|
+
source: {
|
|
141
|
+
label: "My Metal Business Card, Metal Business Card Thickness Guide",
|
|
142
|
+
url: "https://mymetalbusinesscard.com/blog/metal-business-card-thickness-guide/",
|
|
143
|
+
says: '"our standard metal business card thickness is 0.5mm"; "A 0.5mm stainless steel business card"',
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: "brass-0.5",
|
|
148
|
+
name: "Brass card, 0.5 mm",
|
|
149
|
+
group: "metal",
|
|
150
|
+
thicknessMm: 0.5,
|
|
151
|
+
edge: "#b59a52",
|
|
152
|
+
source: {
|
|
153
|
+
label: "Pure Metal Cards, Standard Brass Cards",
|
|
154
|
+
url: "https://www.puremetalcards.com/order-cards/brass-gold-cards/standard-brass-gold-cards/",
|
|
155
|
+
says: "The maker lists brass as the metal and offers a 0.5 mm thickness.",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "copper-0.5",
|
|
160
|
+
name: "Copper card, 0.5 mm",
|
|
161
|
+
group: "metal",
|
|
162
|
+
thicknessMm: 0.5,
|
|
163
|
+
edge: "#bd7757",
|
|
164
|
+
source: {
|
|
165
|
+
label: "Pure Metal Cards, Copper Brushed Cards",
|
|
166
|
+
url: "https://www.puremetalcards.com/order-cards/copper-cards/copper-brushed-cards/",
|
|
167
|
+
says: "The maker offers brushed copper cards in 0.5 mm.",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: "titanium-0.8",
|
|
172
|
+
name: "Titanium card, 0.8 mm",
|
|
173
|
+
group: "metal",
|
|
174
|
+
thicknessMm: 0.8,
|
|
175
|
+
edge: "#9b9fa6",
|
|
176
|
+
source: {
|
|
177
|
+
label: "Pure Metal Cards, Brushed Titanium Cards",
|
|
178
|
+
url: "https://www.puremetalcards.com/order-cards/titanium-cards/brushed-titanium-cards/",
|
|
179
|
+
says: "The maker specifies 0.8 mm for brushed titanium cards.",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
32
182
|
];
|
|
33
|
-
const
|
|
34
|
-
|
|
183
|
+
const playingCards = {
|
|
184
|
+
label: "Bicycle Cards, Basics of Poker",
|
|
185
|
+
url: "https://bicyclecards.com/how-to-play/basics-of-poker",
|
|
186
|
+
};
|
|
187
|
+
const wikiPokemon = {
|
|
188
|
+
label: "Wikipedia, Pokémon Trading Card Game",
|
|
189
|
+
url: "https://en.wikipedia.org/wiki/Pok%C3%A9mon_Trading_Card_Game",
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* The usual sizes of a stack of cards, each with where the number comes from.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```ts
|
|
196
|
+
* import { stackPresets } from "@johnmorrisdotca/fuda-cards";
|
|
197
|
+
*
|
|
198
|
+
* console.log(stackPresets.map((preset) => preset.count)); // [ 52, 54, 60, 10 ]
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
35
201
|
export const stackPresets = [
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
202
|
+
{
|
|
203
|
+
id: "deck-52",
|
|
204
|
+
name: "Playing cards, 52",
|
|
205
|
+
count: 52,
|
|
206
|
+
source: { ...playingCards, says: "The standard poker pack has 52 cards." },
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: "deck-54",
|
|
210
|
+
name: "Playing cards with two jokers, 54",
|
|
211
|
+
count: 54,
|
|
212
|
+
source: {
|
|
213
|
+
...playingCards,
|
|
214
|
+
says: "A 52-card pack with two added jokers has 54 cards.",
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
id: "pokemon-deck",
|
|
219
|
+
name: "Pokémon TCG deck, 60",
|
|
220
|
+
count: 60,
|
|
221
|
+
source: { ...wikiPokemon, says: 'players "play with 60-card decks"' },
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: "pokemon-booster",
|
|
225
|
+
name: "Booster pack, about 10",
|
|
226
|
+
count: 10,
|
|
227
|
+
source: {
|
|
228
|
+
label: "The Pokémon Company, Sun & Moon—Forbidden Light release",
|
|
229
|
+
url: "https://press.pokemon.com/en/releases/LATEST-EXPANSION-OF-THE-POKEMON-TRADING-CARD-GAME-SUN-MOONFORBIDDEN-LI",
|
|
230
|
+
says: "A booster from this expansion has 10 expansion cards plus a Basic Energy card. The preset counts the expansion cards.",
|
|
231
|
+
},
|
|
232
|
+
},
|
|
40
233
|
];
|
|
41
|
-
/**
|
|
234
|
+
/**
|
|
235
|
+
* The material with this id.
|
|
236
|
+
*
|
|
237
|
+
* @param id - A material's id, such as `paper-310-black-core` (the `material` attribute's value).
|
|
238
|
+
* @returns The material, or `undefined` when there is none with that id (and for `null` and `undefined`).
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* import { cardMaterial } from "@johnmorrisdotca/fuda-cards";
|
|
242
|
+
*
|
|
243
|
+
* console.log(cardMaterial("aluminium-0.8")?.thicknessMm); // 0.8
|
|
244
|
+
* console.log(cardMaterial("nothing")); // undefined
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
42
247
|
export function cardMaterial(id) {
|
|
43
|
-
return cardMaterials.find(material => material.id === id);
|
|
248
|
+
return cardMaterials.find((material) => material.id === id);
|
|
44
249
|
}
|
|
45
|
-
/**
|
|
250
|
+
/**
|
|
251
|
+
* The height of a stack of cards, in millimetres: the count times the thickness of one, to a thousandth of a millimetre.
|
|
252
|
+
*
|
|
253
|
+
* @param count - How many cards; a count under one is one card.
|
|
254
|
+
* @param thicknessMm - The thickness of one card in millimetres.
|
|
255
|
+
* @returns The height of the stack in millimetres.
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* import { cardMaterial, stackHeightMm } from "@johnmorrisdotca/fuda-cards";
|
|
259
|
+
*
|
|
260
|
+
* const stock = cardMaterial("paper-310-black-core");
|
|
261
|
+
* console.log(stackHeightMm(52, stock?.thicknessMm ?? 0.325)); // 16.9
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
46
264
|
export function stackHeightMm(count, thicknessMm) {
|
|
47
265
|
return Math.round(Math.max(1, Math.floor(count)) * thicknessMm * 1000) / 1000;
|
|
48
266
|
}
|
package/dist/motion.d.ts
ADDED
package/dist/motion.js
ADDED