@johnmorrisdotca/dougu-sports 0.0.1 → 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.
- package/CHANGELOG.md +24 -1
- package/LICENSES/Apache-2.0.txt +202 -55
- package/LICENSES/CC-BY-3.0.txt +319 -0
- package/LICENSES/README.md +4 -3
- package/LICENSES/upstream/game-icons.license.txt +45 -0
- package/LICENSES/upstream/noto-emoji-2D-svg.LICENSE +13 -0
- package/LICENSES/upstream/pictogrammers-mdi.LICENSE +20 -0
- package/NOTICE.md +92 -3
- package/README.md +104 -69
- package/dist/emblems/award/badge.d.ts +2 -0
- package/dist/emblems/award/badge.js +5 -0
- package/dist/emblems/award/crown.d.ts +2 -0
- package/dist/emblems/award/crown.js +5 -0
- package/dist/emblems/award/medal.d.ts +2 -2
- package/dist/emblems/award/medal.js +5 -19
- package/dist/emblems/award/shield.d.ts +2 -0
- package/dist/emblems/award/shield.js +5 -0
- package/dist/emblems/award/star.d.ts +2 -0
- package/dist/emblems/award/star.js +5 -0
- package/dist/emblems/ball/ball.afl.d.ts +1 -0
- package/dist/emblems/ball/ball.afl.js +24 -0
- package/dist/emblems/ball/ball.baseball.d.ts +1 -0
- package/dist/emblems/ball/ball.baseball.js +14 -0
- package/dist/emblems/ball/ball.basketball.d.ts +7 -0
- package/dist/emblems/ball/ball.basketball.js +32 -0
- package/dist/emblems/ball/ball.basketball3x3.d.ts +1 -0
- package/dist/emblems/ball/ball.basketball3x3.js +10 -0
- package/dist/emblems/ball/ball.basketball6.d.ts +1 -0
- package/dist/emblems/ball/ball.basketball6.js +10 -0
- package/dist/emblems/ball/ball.core.d.ts +105 -0
- package/dist/emblems/ball/ball.core.js +66 -0
- package/dist/emblems/ball/ball.cricket.d.ts +5 -0
- package/dist/emblems/ball/ball.cricket.js +31 -0
- package/dist/emblems/ball/ball.curlingstone.d.ts +3 -0
- package/dist/emblems/ball/ball.curlingstone.js +46 -0
- package/dist/emblems/ball/ball.discus.d.ts +1 -0
- package/dist/emblems/ball/ball.discus.js +24 -0
- package/dist/emblems/ball/ball.engine.d.ts +114 -0
- package/dist/emblems/ball/ball.engine.js +342 -0
- package/dist/emblems/ball/ball.family.dotted.d.ts +27 -0
- package/dist/emblems/ball/ball.family.dotted.js +20 -0
- package/dist/emblems/ball/ball.family.panelled.d.ts +7 -0
- package/dist/emblems/ball/ball.family.panelled.js +60 -0
- package/dist/emblems/ball/ball.family.prolate.d.ts +16 -0
- package/dist/emblems/ball/ball.family.prolate.js +29 -0
- package/dist/emblems/ball/ball.family.seamed.d.ts +31 -0
- package/dist/emblems/ball/ball.family.seamed.js +26 -0
- package/dist/emblems/ball/ball.fieldhockey.d.ts +1 -0
- package/dist/emblems/ball/ball.fieldhockey.js +15 -0
- package/dist/emblems/ball/ball.football.d.ts +3 -0
- package/dist/emblems/ball/ball.football.js +51 -0
- package/dist/emblems/ball/ball.gaelic.d.ts +2 -0
- package/dist/emblems/ball/ball.gaelic.js +30 -0
- package/dist/emblems/ball/ball.golf.d.ts +1 -0
- package/dist/emblems/ball/ball.golf.js +15 -0
- package/dist/emblems/ball/ball.hammer.d.ts +1 -0
- package/dist/emblems/ball/ball.hammer.js +31 -0
- package/dist/emblems/ball/ball.handball.d.ts +1 -0
- package/dist/emblems/ball/ball.handball.js +25 -0
- package/dist/emblems/ball/ball.index.d.ts +48 -0
- package/dist/emblems/ball/ball.index.js +103 -0
- package/dist/emblems/ball/ball.math.d.ts +38 -0
- package/dist/emblems/ball/ball.math.js +105 -0
- package/dist/emblems/ball/ball.object.d.ts +38 -0
- package/dist/emblems/ball/ball.object.js +20 -0
- package/dist/emblems/ball/ball.padel.d.ts +1 -0
- package/dist/emblems/ball/ball.padel.js +13 -0
- package/dist/emblems/ball/ball.pickleball.d.ts +2 -0
- package/dist/emblems/ball/ball.pickleball.js +26 -0
- package/dist/emblems/ball/ball.polyhedra.d.ts +15 -0
- package/dist/emblems/ball/ball.polyhedra.js +63 -0
- package/dist/emblems/ball/ball.puck.d.ts +3 -0
- package/dist/emblems/ball/ball.puck.js +22 -0
- package/dist/emblems/ball/ball.roundnet.d.ts +1 -0
- package/dist/emblems/ball/ball.roundnet.js +15 -0
- package/dist/emblems/ball/ball.rugby.d.ts +1 -0
- package/dist/emblems/ball/ball.rugby.js +35 -0
- package/dist/emblems/ball/ball.sepaktakraw.d.ts +1 -0
- package/dist/emblems/ball/ball.sepaktakraw.js +48 -0
- package/dist/emblems/ball/ball.shuttlecock.d.ts +6 -0
- package/dist/emblems/ball/ball.shuttlecock.js +93 -0
- package/dist/emblems/ball/ball.sliotar.d.ts +1 -0
- package/dist/emblems/ball/ball.sliotar.js +14 -0
- package/dist/emblems/ball/ball.smooth.d.ts +4 -0
- package/dist/emblems/ball/ball.smooth.js +51 -0
- package/dist/emblems/ball/ball.soccer.d.ts +2 -0
- package/dist/emblems/ball/ball.soccer.js +54 -0
- package/dist/emblems/ball/ball.softball.d.ts +1 -0
- package/dist/emblems/ball/ball.softball.js +14 -0
- package/dist/emblems/ball/ball.squash.d.ts +7 -0
- package/dist/emblems/ball/ball.squash.js +27 -0
- package/dist/emblems/ball/ball.stack.d.ts +48 -0
- package/dist/emblems/ball/ball.stack.js +127 -0
- package/dist/emblems/ball/ball.stitch.d.ts +10 -0
- package/dist/emblems/ball/ball.stitch.js +59 -0
- package/dist/emblems/ball/ball.tennis.d.ts +1 -0
- package/dist/emblems/ball/ball.tennis.js +13 -0
- package/dist/emblems/ball/ball.teqball.d.ts +1 -0
- package/dist/emblems/ball/ball.teqball.js +27 -0
- package/dist/emblems/ball/ball.volleyball.d.ts +3 -0
- package/dist/emblems/ball/ball.volleyball.js +56 -0
- package/dist/emblems/ball/ball.waterpolo.d.ts +1 -0
- package/dist/emblems/ball/ball.waterpolo.js +31 -0
- package/dist/emblems/crest/diamond.d.ts +2 -0
- package/dist/emblems/crest/diamond.js +18 -0
- package/dist/emblems/crest/pennant.d.ts +2 -0
- package/dist/emblems/crest/pennant.js +18 -0
- package/dist/emblems/crest/roundel.d.ts +2 -0
- package/dist/emblems/crest/roundel.js +18 -0
- package/dist/emblems/crest/shield.d.ts +2 -0
- package/dist/emblems/crest/shield.js +17 -0
- package/dist/emblems/emblem.api.d.ts +39 -9
- package/dist/emblems/emblem.api.js +38 -10
- package/dist/emblems/emblem.core.d.ts +42 -6
- package/dist/emblems/emblem.core.js +55 -11
- package/dist/emblems/emblem.ids.d.ts +33 -27
- package/dist/emblems/emblem.ids.js +35 -16
- package/dist/emblems/emblem.lathe.d.ts +59 -0
- package/dist/emblems/emblem.lathe.js +404 -0
- package/dist/emblems/emblem.material.d.ts +9 -0
- package/dist/emblems/emblem.material.data.d.ts +34 -0
- package/dist/emblems/emblem.material.data.js +85 -0
- package/dist/emblems/emblem.material.js +23 -0
- package/dist/emblems/emblem.medal.d.ts +6 -0
- package/dist/emblems/emblem.medal.js +38 -0
- package/dist/emblems/emblem.registry.js +142 -4
- package/dist/emblems/emblem.shapes.d.ts +31 -12
- package/dist/emblems/emblem.shapes.js +99 -33
- package/dist/emblems/gear/gear.badmintonracket.d.ts +1 -0
- package/dist/emblems/gear/gear.badmintonracket.js +15 -0
- package/dist/emblems/gear/gear.baseballglove.d.ts +1 -0
- package/dist/emblems/gear/gear.baseballglove.js +15 -0
- package/dist/emblems/gear/gear.core.d.ts +83 -0
- package/dist/emblems/gear/gear.core.js +120 -0
- package/dist/emblems/gear/gear.cricketbat.d.ts +1 -0
- package/dist/emblems/gear/gear.cricketbat.js +15 -0
- package/dist/emblems/gear/gear.field.d.ts +6 -0
- package/dist/emblems/gear/gear.field.js +81 -0
- package/dist/emblems/gear/gear.fieldhockeystick.d.ts +1 -0
- package/dist/emblems/gear/gear.fieldhockeystick.js +15 -0
- package/dist/emblems/gear/gear.footballhelmet.d.ts +1 -0
- package/dist/emblems/gear/gear.footballhelmet.js +15 -0
- package/dist/emblems/gear/gear.goaliemask.d.ts +1 -0
- package/dist/emblems/gear/gear.goaliemask.js +17 -0
- package/dist/emblems/gear/gear.goalnet.d.ts +1 -0
- package/dist/emblems/gear/gear.goalnet.js +15 -0
- package/dist/emblems/gear/gear.hockeystick.d.ts +1 -0
- package/dist/emblems/gear/gear.hockeystick.js +15 -0
- package/dist/emblems/gear/gear.index.d.ts +22 -0
- package/dist/emblems/gear/gear.index.js +45 -0
- package/dist/emblems/gear/gear.lacrossestick.d.ts +1 -0
- package/dist/emblems/gear/gear.lacrossestick.js +15 -0
- package/dist/emblems/gear/gear.rackets.d.ts +4 -0
- package/dist/emblems/gear/gear.rackets.js +60 -0
- package/dist/emblems/gear/gear.skates.d.ts +3 -0
- package/dist/emblems/gear/gear.skates.js +39 -0
- package/dist/emblems/gear/gear.sticks.d.ts +3 -0
- package/dist/emblems/gear/gear.sticks.js +34 -0
- package/dist/emblems/gear/gear.tabletennispaddle.d.ts +1 -0
- package/dist/emblems/gear/gear.tabletennispaddle.js +15 -0
- package/dist/emblems/gear/gear.tennisracket.d.ts +1 -0
- package/dist/emblems/gear/gear.tennisracket.js +15 -0
- package/dist/emblems/gear/gear.track.d.ts +4 -0
- package/dist/emblems/gear/gear.track.js +45 -0
- package/dist/emblems/gear/gear.water.d.ts +2 -0
- package/dist/emblems/gear/gear.water.js +25 -0
- package/dist/emblems/medal/bronze.d.ts +2 -0
- package/dist/emblems/medal/bronze.js +4 -0
- package/dist/emblems/medal/gold.d.ts +2 -0
- package/dist/emblems/medal/gold.js +4 -0
- package/dist/emblems/medal/place-1.d.ts +2 -0
- package/dist/emblems/medal/place-1.js +4 -0
- package/dist/emblems/medal/place-2.d.ts +2 -0
- package/dist/emblems/medal/place-2.js +4 -0
- package/dist/emblems/medal/place-3.d.ts +2 -0
- package/dist/emblems/medal/place-3.js +4 -0
- package/dist/emblems/medal/silver.d.ts +2 -0
- package/dist/emblems/medal/silver.js +4 -0
- package/dist/emblems/sport/afl.d.ts +2 -0
- package/dist/emblems/sport/afl.js +12 -0
- package/dist/emblems/sport/artisticswimming.d.ts +2 -0
- package/dist/emblems/sport/artisticswimming.js +16 -0
- package/dist/emblems/sport/athletics.d.ts +2 -0
- package/dist/emblems/sport/athletics.js +12 -0
- package/dist/emblems/sport/badminton.d.ts +2 -0
- package/dist/emblems/sport/badminton.js +13 -0
- package/dist/emblems/sport/cfl.d.ts +2 -0
- package/dist/emblems/sport/cfl.js +5 -0
- package/dist/emblems/sport/cricket.d.ts +2 -0
- package/dist/emblems/sport/cricket.js +5 -0
- package/dist/emblems/sport/curling.d.ts +2 -0
- package/dist/emblems/sport/curling.js +14 -0
- package/dist/emblems/sport/diving.d.ts +2 -0
- package/dist/emblems/sport/diving.js +18 -0
- package/dist/emblems/sport/fieldhockey.d.ts +2 -0
- package/dist/emblems/sport/fieldhockey.js +11 -0
- package/dist/emblems/sport/gaelic.d.ts +2 -0
- package/dist/emblems/sport/gaelic.js +11 -0
- package/dist/emblems/sport/handball.d.ts +2 -0
- package/dist/emblems/sport/handball.js +5 -0
- package/dist/emblems/sport/ifaf.d.ts +2 -0
- package/dist/emblems/sport/ifaf.js +5 -0
- package/dist/emblems/sport/lacrosse.d.ts +2 -0
- package/dist/emblems/sport/lacrosse.js +13 -0
- package/dist/emblems/sport/mlb.d.ts +2 -0
- package/dist/emblems/sport/mlb.js +5 -0
- package/dist/emblems/sport/nba.d.ts +2 -0
- package/dist/emblems/sport/nba.js +5 -0
- package/dist/emblems/sport/netball.d.ts +2 -0
- package/dist/emblems/sport/netball.js +14 -0
- package/dist/emblems/sport/nfl.d.ts +2 -0
- package/dist/emblems/sport/nfl.js +5 -0
- package/dist/emblems/sport/nhl.d.ts +2 -0
- package/dist/emblems/sport/nhl.js +5 -0
- package/dist/emblems/sport/padel.d.ts +2 -0
- package/dist/emblems/sport/padel.js +14 -0
- package/dist/emblems/sport/pickleball.d.ts +2 -0
- package/dist/emblems/sport/pickleball.js +13 -0
- package/dist/emblems/sport/racquetball.d.ts +2 -0
- package/dist/emblems/sport/racquetball.js +13 -0
- package/dist/emblems/sport/roundnet.d.ts +2 -0
- package/dist/emblems/sport/roundnet.js +15 -0
- package/dist/emblems/sport/rugby.d.ts +2 -0
- package/dist/emblems/sport/rugby.js +5 -0
- package/dist/emblems/sport/sepaktakraw.d.ts +2 -0
- package/dist/emblems/sport/sepaktakraw.js +11 -0
- package/dist/emblems/sport/skating.d.ts +2 -0
- package/dist/emblems/sport/skating.js +14 -0
- package/dist/emblems/sport/soccer.d.ts +2 -0
- package/dist/emblems/sport/soccer.js +5 -0
- package/dist/emblems/sport/squash.d.ts +2 -0
- package/dist/emblems/sport/squash.js +15 -0
- package/dist/emblems/sport/swimming.d.ts +2 -0
- package/dist/emblems/sport/swimming.js +15 -0
- package/dist/emblems/sport/tabletennis.d.ts +2 -0
- package/dist/emblems/sport/tabletennis.js +12 -0
- package/dist/emblems/sport/tennis.d.ts +2 -0
- package/dist/emblems/sport/tennis.js +5 -0
- package/dist/emblems/sport/teqball.d.ts +2 -0
- package/dist/emblems/sport/teqball.js +15 -0
- package/dist/emblems/sport/volleyball.d.ts +2 -0
- package/dist/emblems/sport/volleyball.js +5 -0
- package/dist/emblems/sport/waterpolo.d.ts +2 -0
- package/dist/emblems/sport/waterpolo.js +15 -0
- package/dist/emblems/trophy/baseball.d.ts +2 -0
- package/dist/emblems/trophy/baseball.js +14 -0
- package/dist/emblems/trophy/basketball.d.ts +2 -0
- package/dist/emblems/trophy/basketball.js +16 -0
- package/dist/emblems/trophy/belt.d.ts +2 -0
- package/dist/emblems/trophy/belt.js +16 -0
- package/dist/emblems/trophy/bowl.d.ts +2 -0
- package/dist/emblems/trophy/bowl.js +7 -0
- package/dist/emblems/trophy/canadian-bowl.d.ts +2 -0
- package/dist/emblems/trophy/canadian-bowl.js +22 -0
- package/dist/emblems/trophy/cricket-urn.d.ts +2 -0
- package/dist/emblems/trophy/cricket-urn.js +22 -0
- package/dist/emblems/trophy/cup.d.ts +2 -0
- package/dist/emblems/trophy/cup.js +5 -0
- package/dist/emblems/trophy/football.d.ts +2 -0
- package/dist/emblems/trophy/football.js +10 -0
- package/dist/emblems/trophy/globe.d.ts +2 -0
- package/dist/emblems/trophy/globe.js +8 -0
- package/dist/emblems/trophy/hockey-cup.d.ts +2 -0
- package/dist/emblems/trophy/hockey-cup.js +21 -0
- package/dist/emblems/trophy/laurel.d.ts +2 -0
- package/dist/emblems/trophy/laurel.js +40 -0
- package/dist/emblems/trophy/lidded-cup.d.ts +2 -0
- package/dist/emblems/trophy/lidded-cup.js +20 -0
- package/dist/emblems/trophy/plaque.d.ts +2 -0
- package/dist/emblems/trophy/plaque.js +16 -0
- package/dist/emblems/trophy/rosette.d.ts +2 -0
- package/dist/emblems/trophy/rosette.js +27 -0
- package/dist/emblems/trophy/rugby-cup.d.ts +2 -0
- package/dist/emblems/trophy/rugby-cup.js +22 -0
- package/dist/emblems/trophy/salver.d.ts +2 -0
- package/dist/emblems/trophy/salver.js +8 -0
- package/dist/emblems/trophy/soccer-ball.d.ts +2 -0
- package/dist/emblems/trophy/soccer-ball.js +8 -0
- package/dist/emblems/trophy/soccer-globe.d.ts +2 -0
- package/dist/emblems/trophy/soccer-globe.js +17 -0
- package/dist/emblems/trophy/tennis-cup.d.ts +2 -0
- package/dist/emblems/trophy/tennis-cup.js +23 -0
- package/dist/emblems/trophy/tennis-plate.d.ts +2 -0
- package/dist/emblems/trophy/tennis-plate.js +15 -0
- package/dist/emblems-entry.d.ts +10 -6
- package/dist/emblems-entry.js +3 -2
- package/dist/index.d.ts +114 -1
- package/dist/index.js +116 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +28 -8
- package/LICENSES/CC-BY-3.0.md +0 -15
- package/dist/emblems/ball/soccer.d.ts +0 -2
- package/dist/emblems/ball/soccer.js +0 -9
- package/dist/emblems/emblem.ball.d.ts +0 -28
- package/dist/emblems/emblem.ball.js +0 -70
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<h1 align="center">Dougu Sports <sub>道具</sub></h1>
|
|
2
2
|
|
|
3
3
|
<p align="center"><strong>Sports emblems as SVG strings, with optional 3D turning.</strong><br>
|
|
4
|
-
Trophies, medals, crests, and the ball and gear of
|
|
4
|
+
Trophies, medals, crests, the icon of every sport, and the ball and gear of the sports, each one a function that returns SVG: in polished metal, in one line, or in flat colour, light and dark, any size, any tint. Turn one about its axis and it is another string. Each emblem is its own module, so a page that wants one trophy takes one trophy. MIT, with no dependencies.</p>
|
|
5
5
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<a href="https://github.com/johnmorrisdotca/dougu-sports/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/johnmorrisdotca/dougu-sports/actions/workflows/ci.yml/badge.svg"></a>
|
|
@@ -16,14 +16,14 @@ Trophies, medals, crests, and the ball and gear of every sport, each one a funct
|
|
|
16
16
|
<p align="center">
|
|
17
17
|
<picture>
|
|
18
18
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/johnmorrisdotca/dougu-sports/main/docs/images/hero-desk-dark.png">
|
|
19
|
-
<img alt="
|
|
19
|
+
<img alt="Ten trophies drawn in metal, each a generic form that stands for a league's cup: a tall banded silver cup, a ring of gold pennants round a baseball, a football on a three-sided stand, a basketball over a net, a wide two-handled bowl on a tall base, a globe held up by spiral figures, a gilt dish, a lidded cup with a pineapple, a terracotta urn and a gilded lidded cup. Below them gold, silver and bronze medals, crests, a rosette, a wreath and a belt, and one cup in the three styles." src="https://raw.githubusercontent.com/johnmorrisdotca/dougu-sports/main/docs/images/hero-desk-light.png" width="760">
|
|
20
20
|
</picture>
|
|
21
21
|
</p>
|
|
22
22
|
|
|
23
23
|
<table align="center">
|
|
24
24
|
<tr>
|
|
25
25
|
<td align="center" valign="top">
|
|
26
|
-
<img alt="A
|
|
26
|
+
<img alt="A two-handled cup, a banded cup, a medal and a soccer ball each turned through five angles: the cups keep their outline and move their light and handles, the medal flips like a coin to show its plain back, and the ball rolls." src="https://raw.githubusercontent.com/johnmorrisdotca/dougu-sports/main/docs/images/turn-desk-light.png" width="470"><br><em>Turned: a ball rolls, a medal flips</em>
|
|
27
27
|
</td>
|
|
28
28
|
<td align="center" valign="top">
|
|
29
29
|
<img alt="The same emblems on a phone, light." src="https://raw.githubusercontent.com/johnmorrisdotca/dougu-sports/main/docs/images/phone-light.png" width="200"><br><em>On a phone</em>
|
|
@@ -31,7 +31,7 @@ Trophies, medals, crests, and the ball and gear of every sport, each one a funct
|
|
|
31
31
|
</tr>
|
|
32
32
|
</table>
|
|
33
33
|
|
|
34
|
-
> **Status:
|
|
34
|
+
> **Status: preview.** 148 emblems: 20 trophies, 5 awards, 6 medals, 4 crests, a pictogram for each of the 33 sports, 47 balls and implements drawn in 3D, and 33 pieces of gear ([docs/layout.md](./docs/layout.md) says where each goes).
|
|
35
35
|
|
|
36
36
|
## In 30 seconds
|
|
37
37
|
|
|
@@ -42,10 +42,10 @@ npm install @johnmorrisdotca/dougu-sports
|
|
|
42
42
|
```js
|
|
43
43
|
import { renderEmblem } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
44
44
|
|
|
45
|
-
const svg = renderEmblem("
|
|
45
|
+
const svg = renderEmblem("trophy:hockey-cup", { size: 48 });
|
|
46
46
|
|
|
47
47
|
console.log(svg.startsWith("<svg")); // true
|
|
48
|
-
console.log(svg.includes("<title>
|
|
48
|
+
console.log(svg.includes("<title>Tall banded silver cup</title>")); // true
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Put the string in a page (`element.innerHTML = svg`), write it to a file, or send it from a server: it is plain SVG, with no script, no font and no network. The outline takes the page's text colour, so an emblem follows light and dark mode as the text does.
|
|
@@ -55,14 +55,15 @@ Put the string in a page (`element.innerHTML = svg`), write it to a file, or sen
|
|
|
55
55
|
- **Sports sites** that mark a champion, a result or a list with a trophy, a medal or a crest, without licensing a logo.
|
|
56
56
|
- **Scoreboards and brackets** that want a generic emblem for a team that has no logo, tinted in the team's colour.
|
|
57
57
|
- **Anyone building a game or a card** who needs a ball or a piece of gear for a sport, in one style that matches the rest.
|
|
58
|
-
- **Pages that care about weight**: one emblem is one module
|
|
58
|
+
- **Pages that care about weight**: one emblem is one module, 2 to 6 kB gzipped with the renderer for its kind (a medal about 3, a turning cup about 5), and the package says `"sideEffects": false`.
|
|
59
59
|
|
|
60
60
|
## Features
|
|
61
61
|
|
|
62
|
-
- **Three styles** for every emblem: `metal` (
|
|
63
|
-
- **Size, tint and theme** as options: a tint recolours the main part (a medal's metal, a ball's patches), a theme sets the
|
|
62
|
+
- **Three styles** for every emblem: `metal` (polished metal: a gradient, a highlight and a soft rim of reflected light, edged in a darker tone of its own metal, with no heavy outline), `line` (one clean outline in the page's text colour, made to read at 14 pixels) and `color` (flat fills); see [Theming](#theming).
|
|
63
|
+
- **Size, tint, accent and theme** as options: a tint recolours the main part (a medal's metal, a crest's colour, a ball's patches), an accent the second colour (a ribbon, a crest's band, the pennants), a theme sets the ink for light, dark or either.
|
|
64
64
|
- **Turning**: `emblemFrame` and `ballFrame` return the emblem at an angle, in plain SVG; see [docs/turning.md](./docs/turning.md).
|
|
65
65
|
- **One module per item**, so a bundler takes only what is imported; see [Use it in your project](#use-it-in-your-project).
|
|
66
|
+
- **Short names and helpers**: `"cup"` is `"trophy:cup"`, `"trophy:cup/line"` is the line style, and `crest`, `medal` and `sportIcon` draw a team's crest, a medal and a sport's icon.
|
|
66
67
|
- **Typed ids**: `EmblemId` is a union of `award:*`, `trophy:*`, `medal:*`, `crest:*`, `ball:*`, `gear:*` and `sport:*` ids.
|
|
67
68
|
- **Generic by design**: no emblem carries a league's, a team's or a federation's name or mark.
|
|
68
69
|
- **Accessible**: every drawing is `role="img"` with a `<title>`; see [Accessibility](#accessibility).
|
|
@@ -73,12 +74,12 @@ Put the string in a page (`element.innerHTML = svg`), write it to a file, or sen
|
|
|
73
74
|
|
|
74
75
|
<table>
|
|
75
76
|
<tr>
|
|
76
|
-
<td align="center" valign="top"><img alt="
|
|
77
|
-
<td align="center" valign="top"><img alt="
|
|
77
|
+
<td align="center" valign="top"><img alt="Ten trophies, medals and crests, and one cup in the three styles." src="https://raw.githubusercontent.com/johnmorrisdotca/dougu-sports/main/docs/images/hero-desk-light.png" width="360"><br><em>Trophies, medals and crests, and one cup in three styles</em></td>
|
|
78
|
+
<td align="center" valign="top"><img alt="Cups, a medal and a ball turned through five angles." src="https://raw.githubusercontent.com/johnmorrisdotca/dougu-sports/main/docs/images/turn-desk-light.png" width="360"><br><em>Turned through five angles</em></td>
|
|
78
79
|
</tr>
|
|
79
80
|
</table>
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
Every emblem, with its id in both styles and a button that copies it, is on the [gallery page](https://johnmorrisdotca.github.io/dougu-sports/gallery.html); the same list as text, with its names, kind, source and the import that takes it alone, is [docs/gallery.md](./docs/gallery.md), made from the built package. [docs/emblems.md](./docs/emblems.md) says how the art is drawn.
|
|
82
83
|
|
|
83
84
|
## Use it in your project
|
|
84
85
|
|
|
@@ -111,20 +112,18 @@ The alias is a name in your `package.json` only: the same package, the same code
|
|
|
111
112
|
| `@johnmorrisdotca/dougu-sports` | The full registry: every emblem by id, the functions, and each emblem as a constant |
|
|
112
113
|
| `@johnmorrisdotca/dougu-sports/emblems` | `renderEmblem`, the ids and the types, with no single drawing imported by name |
|
|
113
114
|
| `@johnmorrisdotca/dougu-sports/turn` | `emblemFrame` and `ballFrame` |
|
|
114
|
-
| `@johnmorrisdotca/dougu-sports
|
|
115
|
-
| `@johnmorrisdotca/dougu-sports/ball/<name>` | One ball, alone (`ball/soccer`) |
|
|
116
|
-
| `@johnmorrisdotca/dougu-sports/gear/<name>` | One piece of gear, alone |
|
|
115
|
+
| `@johnmorrisdotca/dougu-sports/<group>/<name>` | One emblem, alone: `trophy/hockey-cup`, `medal/gold`, `crest/shield`, `sport/nhl`, `award/crown`, `ball/soccer`, `gear/<name>` |
|
|
117
116
|
|
|
118
117
|
### One emblem and nothing else
|
|
119
118
|
|
|
120
119
|
```js
|
|
121
|
-
import {
|
|
120
|
+
import { TROPHY_HOCKEY_CUP } from "@johnmorrisdotca/dougu-sports/trophy/hockey-cup";
|
|
122
121
|
|
|
123
|
-
console.log(
|
|
124
|
-
console.log(
|
|
122
|
+
console.log(TROPHY_HOCKEY_CUP.id); // trophy:hockey-cup
|
|
123
|
+
console.log(TROPHY_HOCKEY_CUP.svg({ size: 24 }).includes('width="24"')); // true
|
|
125
124
|
```
|
|
126
125
|
|
|
127
|
-
A bundler that imports this module takes the
|
|
126
|
+
A bundler that imports this module takes the cup and the renderer for a body of revolution, and no other emblem: the package says `"sideEffects": false` and each constant is marked pure. `test/size.test.ts` bundles one item with esbuild and holds it to a limit for its kind (a ball 6.8 kB, a medal or a crest 3.6 kB, a cup 6.2 kB gzipped, most of that the renderer); `pnpm test:package` does the same from the packed tarball.
|
|
128
127
|
|
|
129
128
|
### In a page
|
|
130
129
|
|
|
@@ -132,7 +131,7 @@ A bundler that imports this module takes the soccer ball and the small renderer
|
|
|
132
131
|
<span id="trophy"></span>
|
|
133
132
|
<script type="module">
|
|
134
133
|
import { renderEmblem } from "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/dougu-sports@0/emblems";
|
|
135
|
-
document.getElementById("trophy").innerHTML = renderEmblem("
|
|
134
|
+
document.getElementById("trophy").innerHTML = renderEmblem("trophy:hockey-cup", { size: 40 });
|
|
136
135
|
</script>
|
|
137
136
|
```
|
|
138
137
|
|
|
@@ -142,7 +141,7 @@ A bundler that imports this module takes the soccer ball and the small renderer
|
|
|
142
141
|
import { renderEmblem } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
143
142
|
import { writeFileSync } from "node:fs";
|
|
144
143
|
|
|
145
|
-
writeFileSync("
|
|
144
|
+
writeFileSync("cup.svg", renderEmblem("trophy:hockey-cup", { size: 256, theme: "light" }));
|
|
146
145
|
```
|
|
147
146
|
|
|
148
147
|
## Examples
|
|
@@ -154,10 +153,14 @@ An id is `<group>:<name>`. `renderEmblem` takes an id, or an id with a style aft
|
|
|
154
153
|
```js
|
|
155
154
|
import { renderEmblem } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
156
155
|
|
|
157
|
-
console.log(renderEmblem("
|
|
158
|
-
console.log(renderEmblem("
|
|
156
|
+
console.log(renderEmblem("medal:gold/line") === renderEmblem("medal:gold", { style: "line" })); // true
|
|
157
|
+
console.log(renderEmblem("medal:gold") === renderEmblem("medal:gold", { style: "metal" })); // true
|
|
158
|
+
console.log(renderEmblem("cup") === renderEmblem("trophy:cup")); // true
|
|
159
|
+
console.log(renderEmblem("gear:hurley").includes("<title>Hurley</title>")); // true
|
|
159
160
|
```
|
|
160
161
|
|
|
162
|
+
A trophy or an award can also be written without its group: `"cup"` is `"trophy:cup"` and `"crown"` is `"award:crown"` (`EMBLEM_ALIASES` lists them).
|
|
163
|
+
|
|
161
164
|
### Tint an emblem in a team's colour
|
|
162
165
|
|
|
163
166
|
```js
|
|
@@ -168,16 +171,40 @@ console.log(svg.includes('fill="#0b6e4f"')); // true
|
|
|
168
171
|
console.log(renderEmblem("ball:soccer", { tint: "not a colour" }) === renderEmblem("ball:soccer")); // true
|
|
169
172
|
```
|
|
170
173
|
|
|
171
|
-
A tint is `#rgb`, `#rrggbb` or `rgb(r, g, b)`; anything else is ignored, so a colour that comes from outside cannot reach the markup.
|
|
174
|
+
A tint is `#rgb`, `#rrggbb` or `rgb(r, g, b)`; anything else is ignored, so a colour that comes from outside cannot reach the markup. The `accent` option is a second colour in the same form: a medal's ribbon, a crest's band, a rosette's tails.
|
|
175
|
+
|
|
176
|
+
### Draw a crest for a team with no logo
|
|
177
|
+
|
|
178
|
+
```js
|
|
179
|
+
import { crest } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
180
|
+
|
|
181
|
+
const svg = crest({ shape: "roundel", colors: ["#c8102e", "#f4f0e4"], initials: "no" });
|
|
182
|
+
console.log(svg.includes(">NO<")); // true
|
|
183
|
+
console.log(svg.includes("#c8102e") && svg.includes("#f4f0e4")); // true
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
A crest takes the team's colour and a second colour, and up to three letters, in the ink that reads on the colour; with no letters it has a star. `medal("gold")` and `sportIcon("nhl")` are the same kind of shortcut.
|
|
187
|
+
|
|
188
|
+
### Draw balls at their true sizes
|
|
189
|
+
|
|
190
|
+
```js
|
|
191
|
+
import { emblemInfo, lineup } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
192
|
+
|
|
193
|
+
console.log(emblemInfo("ball:golf").size.diameterMm); // 42.67
|
|
194
|
+
const svg = lineup(["ball:golf", "ball:tennis", "ball:soccer", "ball:puck"], { height: 80 });
|
|
195
|
+
console.log(svg.includes("<title>Balls at their true relative sizes")); // true
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Each ball carries the official size of the rulebook it is from (`emblemInfo(id).size`, with the rule), and `lineup` draws several side by side at the rules' relative sizes.
|
|
172
199
|
|
|
173
200
|
### Choose the outline for a theme
|
|
174
201
|
|
|
175
202
|
```js
|
|
176
203
|
import { renderEmblem } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
177
204
|
|
|
178
|
-
console.log(renderEmblem("
|
|
179
|
-
console.log(renderEmblem("
|
|
180
|
-
console.log(renderEmblem("
|
|
205
|
+
console.log(renderEmblem("medal:gold", { theme: "dark" }).includes('color="#eef1f3"')); // true
|
|
206
|
+
console.log(renderEmblem("medal:gold", { theme: "light" }).includes('color="#20262d"')); // true
|
|
207
|
+
console.log(renderEmblem("medal:gold").includes(" color=")); // false
|
|
181
208
|
```
|
|
182
209
|
|
|
183
210
|
### Turn an emblem
|
|
@@ -186,7 +213,8 @@ console.log(renderEmblem("award:medal").includes(" color=")); // false
|
|
|
186
213
|
import { ballFrame, emblemFrame } from "@johnmorrisdotca/dougu-sports/turn";
|
|
187
214
|
import { renderEmblem } from "@johnmorrisdotca/dougu-sports/emblems";
|
|
188
215
|
|
|
189
|
-
console.log(emblemFrame("
|
|
216
|
+
console.log(emblemFrame("trophy:hockey-cup", { yaw: 0 }) === renderEmblem("trophy:hockey-cup")); // true
|
|
217
|
+
console.log(emblemFrame("trophy:tennis-cup", { yaw: 90 }) === renderEmblem("trophy:tennis-cup")); // false
|
|
190
218
|
console.log(ballFrame("ball:soccer", { yaw: 90 }) === ballFrame("ball:soccer", { yaw: 450 })); // true
|
|
191
219
|
```
|
|
192
220
|
|
|
@@ -197,8 +225,9 @@ More in [docs/turning.md](./docs/turning.md).
|
|
|
197
225
|
```js
|
|
198
226
|
import { emblemInfo, emblemName } from "@johnmorrisdotca/dougu-sports";
|
|
199
227
|
|
|
200
|
-
console.log(emblemInfo("
|
|
201
|
-
console.log(
|
|
228
|
+
console.log(emblemInfo("medal:gold").kind); // flat
|
|
229
|
+
console.log(emblemInfo("trophy:hockey-cup").kind); // lathe
|
|
230
|
+
console.log(emblemName("medal:gold", "ja")); // 金メダル
|
|
202
231
|
```
|
|
203
232
|
|
|
204
233
|
### List the emblems
|
|
@@ -223,46 +252,49 @@ console.log(parseEmblem("ball:nonesuch")); // undefined
|
|
|
223
252
|
|
|
224
253
|
### In React, Vue and the rest
|
|
225
254
|
|
|
226
|
-
The functions return strings, so a framework puts them where it puts any markup: `dangerouslySetInnerHTML={{ __html: renderEmblem("
|
|
255
|
+
The functions return strings, so a framework puts them where it puts any markup: `dangerouslySetInnerHTML={{ __html: renderEmblem("medal:gold") }}` in React, `v-html` in Vue, `{@html …}` in Svelte. The string holds no script and no external reference.
|
|
227
256
|
|
|
228
257
|
```ts no-check
|
|
229
|
-
const
|
|
258
|
+
const Cup = () => <span dangerouslySetInnerHTML={{ __html: renderEmblem("trophy:hockey-cup", { size: 32 }) }} />;
|
|
230
259
|
```
|
|
231
260
|
|
|
232
261
|
## The emblems
|
|
233
262
|
|
|
234
|
-
An emblem is a small object: `id`, `en` and `ja` names, a `source` (who drew it), a `kind`, the `model` it is drawn from, and two functions, `svg(options)` and `frame(options)`.
|
|
263
|
+
An emblem is a small object: `id`, `en` and `ja` names, a `source` (who drew it), a `kind`, the `model` it is drawn from, and two functions, `svg(options)` and `frame(options)`. A ball or an implement also has a `size`, its official dimensions and the rule they are from.
|
|
235
264
|
|
|
236
265
|
| Kind | What it is | A turn |
|
|
237
266
|
| --- | --- | --- |
|
|
238
|
-
| `
|
|
239
|
-
| `
|
|
240
|
-
| `
|
|
241
|
-
| `icon` | One
|
|
242
|
-
|
|
243
|
-
Only `flat` and `ball` exist so far; the others are named here because the art that is coming needs them.
|
|
267
|
+
| `lathe` | A body of revolution: a cup, a bowl, an urn, a column with a ball or a globe on it, a stand with flat faces | Keeps its outline, and moves its light, its handles, its seams and its grooves |
|
|
268
|
+
| `flat` | A front and a back drawn from shapes: a medal, a crest, a plaque, a rosette | Flips like a coin, thick at the rim as it goes edge on |
|
|
269
|
+
| `ball` | A ball or an implement drawn in true 3D, with its panels, seams and marks on the surface | Rolls |
|
|
270
|
+
| `icon` | One drawing: a Material Symbols icon or a sport's pictogram | Is not turned |
|
|
271
|
+
| `gear` | A piece of equipment, a flat drawing | Is not turned |
|
|
244
272
|
|
|
245
273
|
### The groups
|
|
246
274
|
|
|
247
275
|
| Group | What it holds | Folder |
|
|
248
276
|
| --- | --- | --- |
|
|
249
|
-
| `award` |
|
|
250
|
-
| `trophy` |
|
|
251
|
-
| `medal` | Gold, silver and bronze, and the places | `src/emblems/
|
|
252
|
-
| `crest` |
|
|
253
|
-
| `ball` |
|
|
254
|
-
| `gear` |
|
|
255
|
-
| `sport` |
|
|
277
|
+
| `award` | Five awards from Material Symbols: a medal, a badge, a crown, a star, a shield | `src/emblems/award/` |
|
|
278
|
+
| `trophy` | Twenty trophies: ten that stand for a league's cup in a generic form (a tall banded cup, a ring of pennants round a baseball, a football on a stand, a ball over a net, a wide two-handled bowl, a globe held up by spiral figures, a gilt dish, a lidded cup with a pineapple, an urn, a gilded cup), plain cups, bowls and dishes, a plaque, a belt, a wreath, a rosette | `src/emblems/trophy/` |
|
|
279
|
+
| `medal` | Gold, silver and bronze medals on a ribbon of five stripes, and a badge for each of the first three places | `src/emblems/medal/` |
|
|
280
|
+
| `crest` | Four generic crests, tinted by a team's colours, with its letters | `src/emblems/crest/` |
|
|
281
|
+
| `ball` | 47 balls and implements, in 3D, each with its official size: soccer, basketball, baseball, tennis, rugby, the footballs, golf, the puck, the curling stone and the rest | `src/emblems/ball/` |
|
|
282
|
+
| `gear` | 33 pieces of equipment: sticks, rackets, skates, a glove, a helmet, nets and posts, a javelin, starting blocks | `src/emblems/gear/` |
|
|
283
|
+
| `sport` | One pictogram for each of the thirty-three sports | `src/emblems/sport/` |
|
|
256
284
|
|
|
257
|
-
The thirty-three sports the ball, gear and sport emblems are made for are `SPORT_NAMES`: NFL, CFL, IFAF, NHL, NBA, MLB, soccer, curling, tennis, volleyball, badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet, netball, swimming, water polo, diving, artistic swimming, lacrosse, rugby, Australian football, Gaelic games, cricket, field hockey, handball, athletics and skating.
|
|
285
|
+
The thirty-three sports the ball, gear and sport emblems are made for are `SPORT_NAMES`: NFL, CFL, IFAF, NHL, NBA, MLB, soccer, curling, tennis, volleyball, badminton, pickleball, table tennis, padel, squash, racquetball, sepak takraw, teqball, roundnet, netball, swimming, water polo, diving, artistic swimming, lacrosse, rugby, Australian football, Gaelic games, cricket, field hockey, handball, athletics and skating. How the trophies are drawn, and what each stands for, is in [docs/emblems.md](./docs/emblems.md); the balls and the gear are described in [src/emblems/README.md](./src/emblems/README.md).
|
|
258
286
|
|
|
259
287
|
## API
|
|
260
288
|
|
|
261
289
|
| Function or value | What it does |
|
|
262
290
|
| --- | --- |
|
|
263
|
-
| `renderEmblem(ref, options?)` | An emblem as SVG. `ref` is an id, an id with a style (`"
|
|
291
|
+
| `renderEmblem(ref, options?)` | An emblem as SVG. `ref` is an id, an id with a style (`"medal:gold/line"`), or an emblem |
|
|
264
292
|
| `emblemSvg` | The same as `renderEmblem` |
|
|
265
|
-
| `
|
|
293
|
+
| `crest(options?)` | A crest by shape, colours and letters |
|
|
294
|
+
| `medal(kind, options?)` | A gold, silver or bronze medal on its ribbon |
|
|
295
|
+
| `sportIcon(sport, options?)` | The pictogram of a sport, by the names of `SPORT_NAMES`; an unknown sport is an error |
|
|
296
|
+
| `lineup(ids, options?)` | Several balls side by side, at their true relative sizes (or all as large as the largest) |
|
|
297
|
+
| `emblemFrame(ref, options?)` | An emblem turned by `yaw` and `pitch` degrees (and `roll` for a ball) |
|
|
266
298
|
| `ballFrame(id, options?)` | A ball rolled; an id that is not a ball is an error |
|
|
267
299
|
| `parseEmblem(value)` | The id and style a string names, or `undefined` |
|
|
268
300
|
| `isEmblemId(value)`, `isBallId(value)` | Whether a value is the id of an emblem, or of a ball |
|
|
@@ -270,9 +302,10 @@ The thirty-three sports the ball, gear and sport emblems are made for are `SPORT
|
|
|
270
302
|
| `emblemInfo(id)`, `emblemName(id, language?)`, `emblemModel(id)` | What an emblem is: its names, kind and source, and the data it is drawn from |
|
|
271
303
|
| `EMBLEMS` | Every emblem as markup in the metal style at 64 pixels, by id |
|
|
272
304
|
| `EMBLEM_TABLE` | Every emblem object, by id |
|
|
273
|
-
| `
|
|
274
|
-
| `EMBLEM_IDS`, `EMBLEM_GROUPS`, `EMBLEM_FOLDERS` | Every id, the groups,
|
|
305
|
+
| `TROPHY_HOCKEY_CUP`, `MEDAL_GOLD`, `CREST_SHIELD`, `SPORT_NHL`, `BALL_SOCCER`, `GEAR_HURLEY`... | Each emblem as a constant, named by its id in capitals (`trophy:hockey-cup`); [docs/gallery.md](./docs/gallery.md) lists every constant with its id and the module that takes it alone |
|
|
306
|
+
| `EMBLEM_IDS`, `EMBLEM_GROUPS`, `EMBLEM_FOLDERS`, `EMBLEM_ALIASES` | Every id, the groups, the folder of each group's art, and the short names (`cup` for `trophy:cup`) |
|
|
275
307
|
| `AWARD_IDS`, `TROPHY_IDS`, `MEDAL_IDS`, `CREST_IDS`, `BALL_IDS`, `GEAR_IDS`, `SPORT_IDS` | The ids of each group |
|
|
308
|
+
| `MEDAL_KINDS`, `CREST_SHAPES` | The kinds of medal, and the shapes of crest |
|
|
276
309
|
| `SPORT_NAMES` | The thirty-three sports |
|
|
277
310
|
| `EMBLEM_STYLES`, `EMBLEM_INK`, `EMBLEM_PAGE`, `METALS` | The styles, the ink and page colours the themes use, and the metals |
|
|
278
311
|
| `VERSION` | The package's version |
|
|
@@ -284,38 +317,42 @@ The thirty-three sports the ball, gear and sport emblems are made for are `SPORT
|
|
|
284
317
|
| `style` | `"metal"`, `"line"`, `"color"` | `"metal"` |
|
|
285
318
|
| `size` | A number of pixels, 4096 at most | `64` |
|
|
286
319
|
| `tint` | `#rgb`, `#rrggbb` or `rgb(r, g, b)` | the emblem's own colour |
|
|
320
|
+
| `accent` | `#rgb`, `#rrggbb` or `rgb(r, g, b)` | the emblem's second colour (a ribbon, a band, pennants) |
|
|
321
|
+
| `initials` | Up to three letters (a crest only) | none: the crest has a star |
|
|
287
322
|
| `theme` | `"inherit"`, `"auto"`, `"light"`, `"dark"` | `"inherit"` |
|
|
288
|
-
| `
|
|
323
|
+
| `grain` | `true` or `false` (a ball only) | on for a ball of 48 pixels or more that is not turning |
|
|
324
|
+
| `yaw`, `pitch`, `roll` (turning only; `roll` for a ball) | Degrees from the resting view | `0` |
|
|
289
325
|
|
|
290
|
-
The types are `EmblemId`, `EmblemRef`, `EmblemOptions`, `FrameOptions`, `EmblemStyle`, `EmblemTheme`, `Emblem`, `EmblemInfo`, `EmblemKind`, `EmblemSource`, `EmblemGroup`, `SportName`,
|
|
326
|
+
The types are `EmblemId`, `EmblemRef`, `EmblemOptions`, `FrameOptions`, `EmblemStyle`, `EmblemTheme`, `Emblem`, `EmblemInfo`, `EmblemKind`, `EmblemSource`, `EmblemGroup`, `CrestOptions`, `CrestShape`, `MedalKind`, `LineupOptions`, `PieceSize`, `SportName`, the id types of each group, and the types of the models the emblems are drawn from (`LatheModel`, `FlatModel`, `MaterialModel` and their parts).
|
|
291
327
|
|
|
292
328
|
## Theming
|
|
293
329
|
|
|
294
|
-
|
|
330
|
+
In the `metal` and `color` styles a trophy, a medal or a crest is edged by a darker tone of its own metal, so it needs nothing from the page and looks the same on a light page and on a dark one. In the `line` style (and in a pictogram, which is a drawing in ink) the drawing is `currentColor`, so it takes the colour of the text around it. The `theme` option changes that when the SVG is used where it cannot inherit (an `<img>`, a data address):
|
|
295
331
|
|
|
296
|
-
| `theme` | The
|
|
332
|
+
| `theme` | The ink |
|
|
297
333
|
| --- | --- |
|
|
298
334
|
| `inherit` | The page's text colour (`currentColor`): the default for markup put in a page |
|
|
299
335
|
| `auto` | Dark ink on a light device and pale ink on a dark one, by `prefers-color-scheme` |
|
|
300
336
|
| `light` | `#20262d`, made to read on `#ffffff` |
|
|
301
337
|
| `dark` | `#eef1f3`, made to read on `#14181c` |
|
|
302
338
|
|
|
303
|
-
The metals are `METALS` (gold `#d9a620`, silver `#aeb6c0`, bronze `#b8733a`). The `line` style has no fill, so it takes only the
|
|
339
|
+
The metals are `METALS` (gold `#d9a620`, silver `#aeb6c0`, bronze `#b8733a`); each is shaded with a dark edge, a bright band, the metal, a darker side and a faint light from the rim, which holds on both pages. The `line` style has no fill, so it takes only the ink. For a ball and a piece of gear, `color` is the same shaded drawing as `metal`.
|
|
304
340
|
|
|
305
341
|
## Limits
|
|
306
342
|
|
|
307
|
-
-
|
|
308
|
-
- A
|
|
309
|
-
-
|
|
343
|
+
- A turn is drawn in plain SVG, not in 3D: a cup keeps its silhouette and moves its light, handles and seams; a medal is squeezed; a ball is projected from its own geometry, panel by panel, and has no grain while it turns. Gear and pictograms are not turned.
|
|
344
|
+
- A tint is one colour, the main one, and an accent a second. The pieces of a trophy that are another metal (the gilt of a plate, the green bands of a globe, the black foot of a cup) keep their own colour.
|
|
345
|
+
- The trophies are generic: each is drawn for this package in a simplified form that a reader knows at a glance, and none is traced from a photograph or carries a name, a mark or an engraving.
|
|
346
|
+
- A trophy in the metal style is about 3 to 4.5 kB of markup, a medal or a crest about 1 to 2 kB, a line drawing about 1 to 2.5 kB; a ball in 3D is 5 to 13 kB, and some gear is as large, because it is copied from detailed artwork.
|
|
310
347
|
- The size is a number of pixels up to 4096; the drawing is a vector at any size.
|
|
311
348
|
- No emblem carries a real league's, team's or federation's mark.
|
|
312
349
|
|
|
313
350
|
## Accessibility
|
|
314
351
|
|
|
315
|
-
- Every emblem is `role="img"` with a `<title>` that names it in English ("
|
|
352
|
+
- Every emblem is `role="img"` with a `<title>` that names it in English ("Gold medal", "Soccer ball"). `emblemName(id, "ja")` gives the Japanese name for a caller that writes its own label.
|
|
316
353
|
- Where an emblem is only decoration next to text that says the same, hide it from a screen reader with `aria-hidden="true"` on the element that holds it.
|
|
317
354
|
- Colour is never the only carrier of meaning: the `line` style has no colour at all.
|
|
318
|
-
- The
|
|
355
|
+
- The ink reads at 4.5 to 1 against the page the `light` and `dark` themes name, and a crest's letters read at 4.5 to 1 on the crest's colour, whatever the colour; the tests hold both.
|
|
319
356
|
- Nothing moves by itself: turning happens when the caller asks for a frame, and the demo's sliders are 44 pixels tall.
|
|
320
357
|
|
|
321
358
|
## Browser and runtime support
|
|
@@ -328,14 +365,12 @@ The package's own words are the emblems' names, in English (`en`) and Japanese (
|
|
|
328
365
|
|
|
329
366
|
## Roadmap
|
|
330
367
|
|
|
331
|
-
-
|
|
332
|
-
- Bodies of revolution (`lathe`), so a cup turns with its outline kept.
|
|
333
|
-
- A second colour as an option.
|
|
368
|
+
- Native review of the Japanese names, and more pictograms and gear where a sport has none yet.
|
|
334
369
|
- Deliberately not: logos of real leagues and teams, a canvas or WebGL renderer, and a runtime dependency.
|
|
335
370
|
|
|
336
371
|
## Architecture
|
|
337
372
|
|
|
338
|
-
The code is `src/emblems/`: the core (options, colours, the wrapper), the id lists, the registry, the
|
|
373
|
+
The code is `src/emblems/`: the core (options, colours, gradients, the wrapper), the id lists, the registry, the renderers (the body of revolution, the flat object and icon, the Material icon, and the ball and gear engines) and one module per emblem, or per family of balls and gear, in a folder for its group; [docs/layout.md](./docs/layout.md) has the folders and how to add one. The package has no state and no clock: every function is a pure function of its arguments.
|
|
339
374
|
|
|
340
375
|
## The name
|
|
341
376
|
|
|
@@ -343,11 +378,11 @@ Dougu (道具, *dōgu*, どうぐ) is Japanese for a tool or a piece of equipmen
|
|
|
343
378
|
|
|
344
379
|
## Where it comes from, and where it is used
|
|
345
380
|
|
|
346
|
-
The emblems are drawn for this package or made from the open sources listed in [NOTICE.md](./NOTICE.md), each with its licence in [LICENSES/](./LICENSES/). It is made for [spxn.com](https://spxn.com), the historical record of the NHL, NBA, MLB, NFL and CFL, and for the other packages of the family that draw sport.
|
|
381
|
+
The emblems are drawn for this package or made from the open sources listed in [NOTICE.md](./NOTICE.md), each with its licence in [LICENSES/](./LICENSES/): sixteen icons are Material Symbols (Apache 2.0), fetched at a pinned commit by `scripts/fetch-material-symbols.mjs`; some gear is copied from Noto Emoji, Wikimedia Commons and game-icons.net, with its credit; everything else is drawn here, and the rulebooks the balls' sizes were read from are in [docs/references.md](./docs/references.md). It is made for [spxn.com](https://spxn.com), the historical record of the NHL, NBA, MLB, NFL and CFL, and for the other packages of the family that draw sport.
|
|
347
382
|
|
|
348
383
|
### Used by
|
|
349
384
|
|
|
350
|
-
[Kyogijo Stadiums](https://github.com/johnmorrisdotca/kyogijo-stadiums)
|
|
385
|
+
[Kyogijo Stadiums](https://github.com/johnmorrisdotca/kyogijo-stadiums) drew the same kind of emblems inside itself; they moved here, redrawn, and Kyogijo then imports them.
|
|
351
386
|
|
|
352
387
|
### The family
|
|
353
388
|
|
|
@@ -381,7 +416,7 @@ Dougu Sports is one of twenty-seven packages, each made for the same site, each
|
|
|
381
416
|
- [Houseki](https://github.com/johnmorrisdotca/houseki) (宝石): gem and stone matching puzzles: falling triplets, stone collapse, colour chains and gem swap. [Demo](https://johnmorrisdotca.github.io/houseki/).
|
|
382
417
|
- [Kyogijo Stadiums](https://github.com/johnmorrisdotca/kyogijo-stadiums) (競技場): sports fields, rinks, courts and ballparks drawn to scale as SVG, with each team and the score on them. [Demo](https://johnmorrisdotca.github.io/kyogijo-stadiums/).
|
|
383
418
|
- [Taisen Brackets](https://github.com/johnmorrisdotca/taisen-brackets) (対戦): a sport-agnostic tournament bracket, drawn as SVG, from a list of ties. [Demo](https://johnmorrisdotca.github.io/taisen-brackets/).
|
|
384
|
-
- [Dougu Sports](https://github.com/johnmorrisdotca/dougu-sports) (道具): sports emblems as SVG: trophies, medals, crests, and the ball and gear of every sport, with optional 3D turning. [Demo](https://johnmorrisdotca.github.io/dougu-sports/).
|
|
419
|
+
- [Dougu Sports](https://github.com/johnmorrisdotca/dougu-sports) (道具): sports emblems as SVG: trophies, medals, crests, and the ball and gear of every sport, with optional 3D turning. [Demo](https://johnmorrisdotca.github.io/dougu-sports/).
|
|
385
420
|
|
|
386
421
|
**This package is Dougu Sports.** The demos of all twenty-seven share one header and footer, so each links the rest.
|
|
387
422
|
<!-- family:end -->
|
|
@@ -405,7 +440,7 @@ Bug reports and ideas go in the [issues](https://github.com/johnmorrisdotca/doug
|
|
|
405
440
|
|
|
406
441
|
## Changes
|
|
407
442
|
|
|
408
|
-
See [CHANGELOG.md](./CHANGELOG.md). 0.0
|
|
443
|
+
See [CHANGELOG.md](./CHANGELOG.md). 0.1.0 brings the full set of 148 emblems; 0.0.1 was the first preview.
|
|
409
444
|
|
|
410
445
|
## Credits
|
|
411
446
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Award badge: the Material Symbols icon `workspace_premium` (Google, Apache License 2.0; see NOTICE.md), in metal, line and flat colour.
|
|
2
|
+
import { M_WORKSPACE_PREMIUM } from "../emblem.material.data.js";
|
|
3
|
+
import { defineMaterial } from "../emblem.material.js";
|
|
4
|
+
/** Award badge. */
|
|
5
|
+
export const AWARD_BADGE = /* @__PURE__ */ defineMaterial("award:badge", "Award badge", "表彰バッジ", M_WORKSPACE_PREMIUM, "gold");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Crown: the Material Symbols icon `crown` (Google, Apache License 2.0; see NOTICE.md), in metal, line and flat colour.
|
|
2
|
+
import { M_CROWN } from "../emblem.material.data.js";
|
|
3
|
+
import { defineMaterial } from "../emblem.material.js";
|
|
4
|
+
/** Crown. */
|
|
5
|
+
export const AWARD_CROWN = /* @__PURE__ */ defineMaterial("award:crown", "Crown", "王冠", M_CROWN, "gold");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare const AWARD_MEDAL: import("../emblem.core.ts").Emblem<import("../emblem.
|
|
1
|
+
/** Medal. */
|
|
2
|
+
export declare const AWARD_MEDAL: import("../emblem.core.ts").Emblem<import("../emblem.material.ts").MaterialModel>;
|
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
front: [
|
|
7
|
-
{ part: "ribbon", d: "M17 3H29L39 31H28Z" },
|
|
8
|
-
{ part: "ribbon", d: "M47 3H35L25 31H36Z" },
|
|
9
|
-
{ part: "main", d: circlePath(32, 42, 17) },
|
|
10
|
-
{ part: "detail", d: circlePath(32, 42, 12.5) },
|
|
11
|
-
{ part: "main", d: starPath(32, 42, 8.6, 3.6) },
|
|
12
|
-
],
|
|
13
|
-
back: [
|
|
14
|
-
{ part: "ribbon", d: "M17 3H29L39 31H28Z" },
|
|
15
|
-
{ part: "ribbon", d: "M47 3H35L25 31H36Z" },
|
|
16
|
-
{ part: "main", d: circlePath(32, 42, 17) },
|
|
17
|
-
{ part: "detail", d: circlePath(32, 42, 12.5) },
|
|
18
|
-
],
|
|
19
|
-
});
|
|
1
|
+
// Medal: the Material Symbols icon `military_tech` (Google, Apache License 2.0; see NOTICE.md), in metal, line and flat colour.
|
|
2
|
+
import { M_MILITARY_TECH } from "../emblem.material.data.js";
|
|
3
|
+
import { defineMaterial } from "../emblem.material.js";
|
|
4
|
+
/** Medal. */
|
|
5
|
+
export const AWARD_MEDAL = /* @__PURE__ */ defineMaterial("award:medal", "Medal", "メダル", M_MILITARY_TECH, "gold");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Shield: the Material Symbols icon `shield` (Google, Apache License 2.0; see NOTICE.md), in metal, line and flat colour.
|
|
2
|
+
import { M_SHIELD } from "../emblem.material.data.js";
|
|
3
|
+
import { defineMaterial } from "../emblem.material.js";
|
|
4
|
+
/** Shield. */
|
|
5
|
+
export const AWARD_SHIELD = /* @__PURE__ */ defineMaterial("award:shield", "Shield", "盾", M_SHIELD, "silver");
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Star: the Material Symbols icon `star` (Google, Apache License 2.0; see NOTICE.md), in metal, line and flat colour.
|
|
2
|
+
import { M_STAR } from "../emblem.material.data.js";
|
|
3
|
+
import { defineMaterial } from "../emblem.material.js";
|
|
4
|
+
/** Star. */
|
|
5
|
+
export const AWARD_STAR = /* @__PURE__ */ defineMaterial("award:star", "Star", "星", M_STAR, "gold");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BALL_AFL: import("./ball.core.ts").Piece<import("./ball.engine.ts").BallSpec>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Australian football: a red leather ball, rounder than an American one, with four panels whose seams are sewn with white stitches.
|
|
2
|
+
import { defineBall } from "./ball.engine.js";
|
|
3
|
+
import { footballSeams } from "./ball.family.prolate.js";
|
|
4
|
+
import { stitches } from "./ball.stitch.js";
|
|
5
|
+
import { mix } from "./ball.core.js";
|
|
6
|
+
export const BALL_AFL = /* @__PURE__ */ defineBall({
|
|
7
|
+
id: "ball:afl",
|
|
8
|
+
en: "Australian football",
|
|
9
|
+
ja: "オーストラリアンフットボールのボール",
|
|
10
|
+
size: { extentMm: 280, lengthMm: 280, circumferenceMm: 550.0, longCircumferenceMm: 725.0, rule: "Laws of Australian Football 2026, Law 4 The Football, 4.1 Specifications", note: "The Laws give the two circumferences (720-730 mm and 545-555 mm) and no length: 280 mm is the length of an ellipse of those two girths." },
|
|
11
|
+
spec: {
|
|
12
|
+
axes: [1, 0.7, 0.7],
|
|
13
|
+
view: { yaw: -30, pitch: 20, roll: -25 },
|
|
14
|
+
base: "#b4202b",
|
|
15
|
+
mat: { gloss: 0.55, shade: "#2a0408", grain: { f: 1.0, a: 0.34 } },
|
|
16
|
+
draw: (s, base) => {
|
|
17
|
+
const seams = footballSeams(Math.PI / 4);
|
|
18
|
+
let out = s.strokes(seams, mix(base, -0.5), 1.1, { closed: true });
|
|
19
|
+
for (const seam of seams)
|
|
20
|
+
out += s.strokes(stitches(seam, true, 46, 0.045, { lean: 0.0 }), "#f4efe4", 0.8, { ink: false });
|
|
21
|
+
return out;
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BALL_BASEBALL: import("./ball.core.ts").Piece<import("./ball.engine.ts").BallSpec>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Baseball: a white leather ball with 108 red double stitches in V's along the figure-eight seam.
|
|
2
|
+
import { seamedBall } from "./ball.family.seamed.js";
|
|
3
|
+
export const BALL_BASEBALL = /* @__PURE__ */ seamedBall({
|
|
4
|
+
id: "ball:baseball",
|
|
5
|
+
en: "Baseball",
|
|
6
|
+
ja: "野球のボール",
|
|
7
|
+
size: { extentMm: 73.8, diameterMm: 73.8, circumferenceMm: 231.77, massG: [141.75, 148.83], rule: "Official Baseball Rules, Rule 3.01 The Ball", note: "Diameter worked out from the middle of the circumference range." },
|
|
8
|
+
base: "#f4f0e6",
|
|
9
|
+
b: 0.4,
|
|
10
|
+
view: { yaw: 18, pitch: 28, roll: -10 },
|
|
11
|
+
mat: { gloss: 0.3, shade: "#4a3a2a", grain: { f: 1.4, a: 0.12 } },
|
|
12
|
+
groove: "#8a7a62",
|
|
13
|
+
stitch: { colour: "#c4262e", count: 108, half: 0.075, width: 0.85, lean: 0.032 },
|
|
14
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type BallSpec } from "./ball.engine.ts";
|
|
2
|
+
import type { V3 } from "./ball.math.ts";
|
|
3
|
+
/** One side channel: the wave above the equator for `sign` 1 and below it for -1. */
|
|
4
|
+
export declare const basketballChannel: (sign: 1 | -1, n?: number) => V3[];
|
|
5
|
+
/** The spec of a basketball: its colour, and the colour of its lower half for a two-tone ball. */
|
|
6
|
+
export declare function basketballSpec(base: string, lower?: string): BallSpec;
|
|
7
|
+
export declare const BALL_BASKETBALL: import("./ball.core.ts").Piece<BallSpec>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// The basketball: an orange sphere with the equator, the meridian and the two curved side channels. The channels are the curves latitude = +-(0.304 + 0.585 sin^2 longitude) round the ball,
|
|
2
|
+
// each crossing the meridian square on and swinging away from the equator toward both sides; the constants were fitted to a photograph and a drawing of a generic ball (a least-squares
|
|
3
|
+
// match of 1,766 seam pixels), not copied from either. FIBA allows at most 12 seams of at most 6.35 mm; this ball has the four channels of the usual pattern.
|
|
4
|
+
import { defineBall } from "./ball.engine.js";
|
|
5
|
+
import { greatCircle, lonLat, smallCircle } from "./ball.math.js";
|
|
6
|
+
import { mix } from "./ball.core.js";
|
|
7
|
+
const L0 = 0.304;
|
|
8
|
+
const AMP = 0.585;
|
|
9
|
+
/** One side channel: the wave above the equator for `sign` 1 and below it for -1. */
|
|
10
|
+
export const basketballChannel = (sign, n = 72) => Array.from({ length: n }, (_, i) => {
|
|
11
|
+
const lon = (i / n) * 2 * Math.PI;
|
|
12
|
+
return lonLat(lon, sign * (L0 + AMP * Math.sin(lon) ** 2));
|
|
13
|
+
});
|
|
14
|
+
/** The spec of a basketball: its colour, and the colour of its lower half for a two-tone ball. */
|
|
15
|
+
export function basketballSpec(base, lower) {
|
|
16
|
+
return {
|
|
17
|
+
view: { yaw: 46.8, pitch: -13.5, roll: 183.6 },
|
|
18
|
+
base,
|
|
19
|
+
mat: { gloss: 0.5, shade: "#4a1c06", grain: { f: 1.1, a: 0.32 } },
|
|
20
|
+
draw(s, colour) {
|
|
21
|
+
const ink = mix(colour, -0.88);
|
|
22
|
+
let out = "";
|
|
23
|
+
if (lower !== undefined)
|
|
24
|
+
out += s.panel(smallCircle([0, -1, 0], 1.545, 72), lower, { n: 1, ink: false });
|
|
25
|
+
const curves = [greatCircle([0, 1, 0], 72), greatCircle([1, 0, 0], 72), basketballChannel(1), basketballChannel(-1)];
|
|
26
|
+
out += s.strokes(curves, ink, 2.0, { closed: true });
|
|
27
|
+
return out;
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const SIZE7 = { extentMm: 241.9, diameterMm: 241.9, circumferenceMm: 760.0, massG: [580, 620], rule: "FIBA Basketball Equipment 2026, Rule 2 Basketballs, 2.4 and Table 1 (size 7 = men's competitions)", note: "Diameter worked out from the middle of the circumference range." };
|
|
32
|
+
export const BALL_BASKETBALL = /* @__PURE__ */ defineBall({ id: "ball:basketball", en: "Basketball", ja: "バスケットボール", size: SIZE7, spec: basketballSpec("#e0701f") });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BALL_BASKETBALL_3X3: import("./ball.core.ts").Piece<import("./ball.engine.ts").BallSpec>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The 3x3 basketball: two-tone, orange above and charcoal below, the size of a 6 and the weight of a 7. Our own two-tone scheme; the rules fix the size and the weight.
|
|
2
|
+
import { defineBall } from "./ball.engine.js";
|
|
3
|
+
import { basketballSpec } from "./ball.basketball.js";
|
|
4
|
+
export const BALL_BASKETBALL_3X3 = /* @__PURE__ */ defineBall({
|
|
5
|
+
id: "ball:basketball-3x3",
|
|
6
|
+
en: "Basketball, 3x3",
|
|
7
|
+
ja: "3x3バスケットボール",
|
|
8
|
+
size: { extentMm: 232.4, diameterMm: 232.4, circumferenceMm: 730.0, massG: [580, 620], rule: "FIBA 3x3 Official Equipment & Software Appendix to the 3x3 Official Rules (Dec 2024 update), Table 1 and section 5.7 (as quoted by balls.com)", note: "Not read in the FIBA 3x3 equipment appendix itself (fiba3x3.com refused the request); the figures are those a ball retailer prints from it: the circumference of a size 6 with the weight of a size 7. Diameter worked out from the middle of the circumference range." },
|
|
9
|
+
spec: basketballSpec("#e0701f", "#2b2d33"),
|
|
10
|
+
});
|