guess-the-year-web-component 1.0.1
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.md +1 -0
- package/README.md +66 -0
- package/custom-elements.json +726 -0
- package/dist/guess-the-year.d.ts +60 -0
- package/dist/guess-the-year.d.ts.map +1 -0
- package/dist/guess-the-year.js +451 -0
- package/dist/guess-the-year.js.map +1 -0
- package/dist/index.html +63 -0
- package/dist/lib/ApiService.d.ts +11 -0
- package/dist/lib/ApiService.d.ts.map +1 -0
- package/dist/lib/ApiService.js +97 -0
- package/dist/lib/ApiService.js.map +1 -0
- package/dist/lib/Icon.d.ts +8 -0
- package/dist/lib/Icon.d.ts.map +1 -0
- package/dist/lib/Icon.js +9 -0
- package/dist/lib/Icon.js.map +1 -0
- package/dist/lib/Incident.d.ts +32 -0
- package/dist/lib/Incident.d.ts.map +1 -0
- package/dist/lib/Incident.js +35 -0
- package/dist/lib/Incident.js.map +1 -0
- package/dist/lib/Util.d.ts +16 -0
- package/dist/lib/Util.d.ts.map +1 -0
- package/dist/lib/Util.js +26 -0
- package/dist/lib/Util.js.map +1 -0
- package/dist/lib/i18n/NL.d.ts +7 -0
- package/dist/lib/i18n/NL.d.ts.map +1 -0
- package/dist/lib/i18n/NL.js +48 -0
- package/dist/lib/i18n/NL.js.map +1 -0
- package/dist/lib/i18n/i18n.d.ts +6 -0
- package/dist/lib/i18n/i18n.d.ts.map +1 -0
- package/dist/lib/i18n/i18n.js +8 -0
- package/dist/lib/i18n/i18n.js.map +1 -0
- package/dist/main.js +150 -0
- package/dist/main.js.LICENSE.txt +17 -0
- package/package.json +67 -0
- package/src/guess-the-year.ts +492 -0
- package/src/index.html +109 -0
- package/src/lib/ApiService.ts +122 -0
- package/src/lib/Icon.ts +15 -0
- package/src/lib/Incident.ts +46 -0
- package/src/lib/Util.ts +39 -0
- package/src/lib/i18n/NL.ts +51 -0
- package/src/lib/i18n/i18n.ts +13 -0
- package/src/scss/main.scss +0 -0
- package/todo.txt +13 -0
- package/tsconfig.json +39 -0
- package/webpack.config.cjs +67 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This software is licensed under [Creative Commons Attribution 4.0](https://creativecommons.org/licenses/by/4.0/).
|
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Guess the year
|
|
2
|
+
|
|
3
|
+
Guess the year is a webcomponent you can use to add a historic game to your website.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
### Load the component
|
|
8
|
+
First load the javascript magic that defines our web component:
|
|
9
|
+
```
|
|
10
|
+
<script defer="defer" src="https://www.unpkg.com/guess-the-year@1.0.0"></script>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Use the new html tag
|
|
14
|
+
After this you can use a HTML element called 'guess-the-year' in your html page in which the incidents of a certain date (or date range) will be displayed. E.g.
|
|
15
|
+
```
|
|
16
|
+
<guess-the-year date="1993-03-03"></guess-the-year>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The guess-the-year element will use all the space it has been granted. To control this you can use css styling on the guess-the-year element itself or wrap it in a container that has controlled dimensions:
|
|
20
|
+
```
|
|
21
|
+
```
|
|
22
|
+
Please refer to index.html of this repo for a complete example.
|
|
23
|
+
|
|
24
|
+
### Control the behaviour
|
|
25
|
+
#### Set attributes statically
|
|
26
|
+
The guess-the-year element accepts parameters to control it's behaviour:
|
|
27
|
+
* `date` : a specific *date* you want to retrieve incidents for. Format: `yyyy-mm-dd` or `mm-dd` (for 'on this date' capabilities)
|
|
28
|
+
* `from` and `to` : a *period* you want to retrieve incidents for. Format: `yyyy-mm-dd`
|
|
29
|
+
* `country` : fetch incidents that where newsworhty in this country(ies). Reference https://swagger.tee-e.com for a list of supported countries.
|
|
30
|
+
* `category` : fetch incidents for this category(ies). Reference https://swagger.tee-e.com for a list of supported categories.
|
|
31
|
+
* `emotion` : fetch incidents that match this emotion(s). Reference https://swagger.tee-e.com for a list of supported emotions.
|
|
32
|
+
* `impact` : fetch incidents had this impact(s). Reference https://swagger.tee-e.com for a list of supported emotions.
|
|
33
|
+
* `no-image-src` : what image should be shown when an incident's image is broken. Use a url or base64 encoded image
|
|
34
|
+
* `report-broken-images` : report broken images back to the server so that they can be repaired
|
|
35
|
+
* `delay` : the time (in seconds) waited before the first tip is displayed and the time between the tips
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Adjust the styling
|
|
39
|
+
The guess-the-year element accepts css parameters to specify (significant parts of) it's styling:
|
|
40
|
+
* `--guess-the-year-title-color` : the text color of the title of the tile
|
|
41
|
+
* `--guess-the-year-title-background-color`: the background color of the title of the tile
|
|
42
|
+
* `--guess-the-year-title-font-size` : the font size of the title text of the tile
|
|
43
|
+
* `--guess-the-year-text-color` : the color of the content text of the tile
|
|
44
|
+
* `--guess-the-year-text-background-color` : the color of the background of the content of the tile
|
|
45
|
+
* `--guess-the-year-text-font-size` : the size of the title text of the tile
|
|
46
|
+
* `--guess-the-year-text-max-height` : the maximum height of the text of the tile
|
|
47
|
+
* `--guess-the-year-background-color` : the color of the background of the tile
|
|
48
|
+
* `--guess-the-year-image-min-height` : the minimum height of the image
|
|
49
|
+
* `--guess-the-year-image-max-height` : the maximum height of the image
|
|
50
|
+
* `--guess-the-year-ruler-color` : the color of the ruler that is displayed between two incidents vertically
|
|
51
|
+
* `--guess-the-year-icon-color` : the color of the incident's category icon
|
|
52
|
+
* `--guess-the-year-attribution-font-size` : the font size of the list of attributions / sources
|
|
53
|
+
* `--guess-the-year-attribution-font-color` : the font color of the list of attributions / sources
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
Fetch all packages: `npm ci`
|
|
57
|
+
Run the application: `npm run develop`
|
|
58
|
+
Navigate to http://localhost:8000
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Publication
|
|
62
|
+
Fetch all packages: `npm ci`
|
|
63
|
+
Version the application: `npm version major|minor|patch`
|
|
64
|
+
Build the application: `npm run build:prod`
|
|
65
|
+
Logon at npmjs.org: `npm login`
|
|
66
|
+
Publish the application: `npm publish`
|