@oddsmith/ui 0.0.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/.eleventy.cjs +14 -0
- package/LICENSE +28 -0
- package/README.md +118 -0
- package/custom-elements.json +1539 -0
- package/docs/_README/index.html +4 -0
- package/docs/api/index.html +2100 -0
- package/docs/components.bundle.js +1669 -0
- package/docs/components.bundle.js.map +1 -0
- package/docs/docs.css +162 -0
- package/docs/examples/index.html +56 -0
- package/docs/index.html +53 -0
- package/docs/install/index.html +45 -0
- package/docs/prism-okaidia.css +123 -0
- package/docs-src/.nojekyll +0 -0
- package/docs-src/_README.md +7 -0
- package/docs-src/_data/api.11tydata.js +8 -0
- package/docs-src/_includes/example.11ty.js +35 -0
- package/docs-src/_includes/footer.11ty.js +6 -0
- package/docs-src/_includes/header.11ty.js +7 -0
- package/docs-src/_includes/nav.11ty.js +11 -0
- package/docs-src/_includes/page.11ty.js +32 -0
- package/docs-src/_includes/relative-path.cjs +9 -0
- package/docs-src/api.11ty.js +85 -0
- package/docs-src/bundle.ts +9 -0
- package/docs-src/docs.css +162 -0
- package/docs-src/examples/index.md +15 -0
- package/docs-src/index.md +39 -0
- package/docs-src/install.md +28 -0
- package/docs-src/package.json +3 -0
- package/index.html +19 -0
- package/karma.conf.cjs +24 -0
- package/main.css +210 -0
- package/main.ts +124 -0
- package/package.json +86 -0
- package/previews/casino.ts +12 -0
- package/previews/catalog.ts +94 -0
- package/previews/leaderboard-v1.ts +12 -0
- package/previews/leaderboard-v2.ts +17 -0
- package/previews/sample-data.ts +101 -0
- package/previews/sf-leaderboard.ts +100 -0
- package/previews/sf-live-feed.ts +15 -0
- package/previews/streaks.ts +40 -0
- package/previews/types.ts +18 -0
- package/src/components/README.md +16 -0
- package/src/components/casino-leaderboard/casino-leaderboard.html +80 -0
- package/src/components/casino-leaderboard/casino-leaderboard.scss +585 -0
- package/src/components/casino-leaderboard/casino-leaderboard.ts +136 -0
- package/src/components/casino-leaderboard/data.ts +111 -0
- package/src/components/casino-leaderboard/index.ts +5 -0
- package/src/components/casino-leaderboard/todo.txt +2 -0
- package/src/components/casino-leaderboard/types.ts +19 -0
- package/src/components/leaderboard/components/leaderboard.ts +373 -0
- package/src/components/leaderboard/components/player-card.ts +342 -0
- package/src/components/leaderboard/components/ui.ts +452 -0
- package/src/components/leaderboard/data.ts +152 -0
- package/src/components/leaderboard/index.ts +2 -0
- package/src/components/leaderboard/main.ts +42 -0
- package/src/components/leaderboard/styles.ts +67 -0
- package/src/components/leaderboard/types.ts +28 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard-player.ts +451 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard-ui.ts +512 -0
- package/src/components/leaderboard-v2/components/sf-leaderboard.ts +205 -0
- package/src/components/leaderboard-v2/constants.ts +16 -0
- package/src/components/leaderboard-v2/demo/sample-data.ts +152 -0
- package/src/components/leaderboard-v2/events.ts +13 -0
- package/src/components/leaderboard-v2/icons.ts +22 -0
- package/src/components/leaderboard-v2/index.ts +23 -0
- package/src/components/leaderboard-v2/sf-leaderboard.html +1 -0
- package/src/components/leaderboard-v2/sf-leaderboard.scss +382 -0
- package/src/components/leaderboard-v2/tokens.ts +35 -0
- package/src/components/leaderboard-v2/types.ts +30 -0
- package/src/components/sf-leaderboard/index.ts +77 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.host.ts +3 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.html +3 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.scss +18 -0
- package/src/components/sf-leaderboard/sections/footer-section/footer-section.ts +22 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.host.ts +14 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.html +27 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.scss +189 -0
- package/src/components/sf-leaderboard/sections/header-section/header-section.ts +70 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.host.ts +22 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.html +38 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.scss +99 -0
- package/src/components/sf-leaderboard/sections/ranking-section/ranking-section.ts +121 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.host.ts +8 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.html +6 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.scss +44 -0
- package/src/components/sf-leaderboard/sections/stats-section/stats-section.ts +41 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.host.ts +17 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.html +19 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.scss +37 -0
- package/src/components/sf-leaderboard/sections/table-section/table-section.ts +108 -0
- package/src/components/sf-leaderboard/services/index.ts +22 -0
- package/src/components/sf-leaderboard/services/sf-leaderboard-data.service.ts +54 -0
- package/src/components/sf-leaderboard/services/sf-leaderboard.state.ts +160 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.host.ts +7 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.html +10 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.scss +180 -0
- package/src/components/sf-leaderboard/shared/components/activity-feed/activity-feed.ts +88 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.host.ts +12 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.html +22 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.scss +122 -0
- package/src/components/sf-leaderboard/shared/components/filters/filters.ts +75 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.host.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.html +5 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.scss +81 -0
- package/src/components/sf-leaderboard/shared/components/player-avatar/player-avatar.ts +34 -0
- package/src/components/sf-leaderboard/shared/components/podium/map-players.ts +24 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.host.ts +10 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.html +53 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.scss +580 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.ts +49 -0
- package/src/components/sf-leaderboard/shared/components/podium/podium.types.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.host.ts +11 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.html +9 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.scss +98 -0
- package/src/components/sf-leaderboard/shared/components/rank-badge/rank-badge.ts +63 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.host.ts +9 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.html +15 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.scss +210 -0
- package/src/components/sf-leaderboard/shared/components/stat-card/stat-card.ts +36 -0
- package/src/components/sf-leaderboard/shared/components/table/table.host.ts +5 -0
- package/src/components/sf-leaderboard/shared/components/table/table.html +11 -0
- package/src/components/sf-leaderboard/shared/components/table/table.scss +212 -0
- package/src/components/sf-leaderboard/shared/components/table/table.ts +111 -0
- package/src/components/sf-leaderboard/shared/constants/defaults.ts +7 -0
- package/src/components/sf-leaderboard/shared/constants/filters.ts +16 -0
- package/src/components/sf-leaderboard/shared/constants/index.ts +5 -0
- package/src/components/sf-leaderboard/shared/constants/player-stats.ts +3 -0
- package/src/components/sf-leaderboard/shared/constants/stats-overview.ts +38 -0
- package/src/components/sf-leaderboard/shared/constants/tags.ts +16 -0
- package/src/components/sf-leaderboard/shared/styles/_section.scss +35 -0
- package/src/components/sf-leaderboard/shared/types/data.ts +29 -0
- package/src/components/sf-leaderboard/shared/types/events.ts +30 -0
- package/src/components/sf-leaderboard/shared/types/player-stats.ts +3 -0
- package/src/components/sf-leaderboard/shared/types/sections.ts +100 -0
- package/src/components/sf-leaderboard/shared/utils/utils.ts +17 -0
- package/src/components/sf-leaderboard/theme/THEMING.md +54 -0
- package/src/components/sf-leaderboard/theme/context.ts +16 -0
- package/src/components/sf-leaderboard/theme/default-theme.ts +4 -0
- package/src/components/sf-leaderboard/theme/hex-to-rgb.ts +25 -0
- package/src/components/sf-leaderboard/theme/index.ts +18 -0
- package/src/components/sf-leaderboard/theme/inject-theme.ts +39 -0
- package/src/components/sf-leaderboard/theme/load-theme.ts +26 -0
- package/src/components/sf-leaderboard/theme/merge-theme.ts +59 -0
- package/src/components/sf-leaderboard/theme/scss/_colors.scss +101 -0
- package/src/components/sf-leaderboard/theme/scss/shared.scss +123 -0
- package/src/components/sf-leaderboard/theme/styles.ts +6 -0
- package/src/components/sf-leaderboard/theme/theme-to-css-vars.ts +99 -0
- package/src/components/sf-leaderboard/theme/themes/fallback.json +62 -0
- package/src/components/sf-leaderboard/theme/themes/red.json +62 -0
- package/src/components/sf-leaderboard/theme/types.ts +71 -0
- package/src/components/sf-live-feed/components/avatar/avatar.host.ts +5 -0
- package/src/components/sf-live-feed/components/avatar/avatar.html +3 -0
- package/src/components/sf-live-feed/components/avatar/avatar.scss +24 -0
- package/src/components/sf-live-feed/components/avatar/avatar.ts +27 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.host.ts +8 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.html +10 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.scss +177 -0
- package/src/components/sf-live-feed/components/sf-live-feed/sf-live-feed.ts +65 -0
- package/src/components/sf-live-feed/constants.ts +4 -0
- package/src/components/sf-live-feed/demo/sample-data.ts +34 -0
- package/src/components/sf-live-feed/index.ts +19 -0
- package/src/components/sf-live-feed/styles/theme.scss +19 -0
- package/src/components/sf-live-feed/styles/theme.ts +5 -0
- package/src/components/sf-live-feed/types.ts +19 -0
- package/src/components/sf-live-feed/utils.ts +17 -0
- package/src/components/streaks/constants.ts +17 -0
- package/src/components/streaks/demo/sample-steps.ts +10 -0
- package/src/components/streaks/events.ts +8 -0
- package/src/components/streaks/index.ts +16 -0
- package/src/components/streaks/sf-streaks.html +26 -0
- package/src/components/streaks/sf-streaks.scss +351 -0
- package/src/components/streaks/sf-streaks.ts +235 -0
- package/src/components/streaks/types.ts +7 -0
- package/src/lib/lit/component.ts +10 -0
- package/src/lib/lit/safe-custom-element.ts +12 -0
- package/src/lib/lit/scss.ts +6 -0
- package/src/vite-env.d.ts +18 -0
- package/styles/global.css +125 -0
- package/todo.txt +54 -0
- package/tsconfig.json +31 -0
- package/vite.config.ts +56 -0
- package/vite.docs.config.ts +33 -0
- package/vite.lit-html-plugin.ts +43 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* okaidia theme for JavaScript, CSS and HTML
|
|
3
|
+
* Loosely based on Monokai textmate theme by http://www.monokai.nl/
|
|
4
|
+
* @author ocodia
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
code[class*="language-"],
|
|
8
|
+
pre[class*="language-"] {
|
|
9
|
+
color: #f8f8f2;
|
|
10
|
+
background: none;
|
|
11
|
+
text-shadow: 0 1px rgba(0, 0, 0, 0.3);
|
|
12
|
+
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
|
|
13
|
+
font-size: 1em;
|
|
14
|
+
text-align: left;
|
|
15
|
+
white-space: pre;
|
|
16
|
+
word-spacing: normal;
|
|
17
|
+
word-break: normal;
|
|
18
|
+
word-wrap: normal;
|
|
19
|
+
line-height: 1.5;
|
|
20
|
+
|
|
21
|
+
-moz-tab-size: 4;
|
|
22
|
+
-o-tab-size: 4;
|
|
23
|
+
tab-size: 4;
|
|
24
|
+
|
|
25
|
+
-webkit-hyphens: none;
|
|
26
|
+
-moz-hyphens: none;
|
|
27
|
+
-ms-hyphens: none;
|
|
28
|
+
hyphens: none;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Code blocks */
|
|
32
|
+
pre[class*="language-"] {
|
|
33
|
+
padding: 1em;
|
|
34
|
+
margin: .5em 0;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
border-radius: 0.3em;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:not(pre) > code[class*="language-"],
|
|
40
|
+
pre[class*="language-"] {
|
|
41
|
+
background: #272822;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Inline code */
|
|
45
|
+
:not(pre) > code[class*="language-"] {
|
|
46
|
+
padding: .1em;
|
|
47
|
+
border-radius: .3em;
|
|
48
|
+
white-space: normal;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.token.comment,
|
|
52
|
+
.token.prolog,
|
|
53
|
+
.token.doctype,
|
|
54
|
+
.token.cdata {
|
|
55
|
+
color: #8292a2;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.token.punctuation {
|
|
59
|
+
color: #f8f8f2;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.token.namespace {
|
|
63
|
+
opacity: .7;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.token.property,
|
|
67
|
+
.token.tag,
|
|
68
|
+
.token.constant,
|
|
69
|
+
.token.symbol,
|
|
70
|
+
.token.deleted {
|
|
71
|
+
color: #f92672;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.token.boolean,
|
|
75
|
+
.token.number {
|
|
76
|
+
color: #ae81ff;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.token.selector,
|
|
80
|
+
.token.attr-name,
|
|
81
|
+
.token.string,
|
|
82
|
+
.token.char,
|
|
83
|
+
.token.builtin,
|
|
84
|
+
.token.inserted {
|
|
85
|
+
color: #a6e22e;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.token.operator,
|
|
89
|
+
.token.entity,
|
|
90
|
+
.token.url,
|
|
91
|
+
.language-css .token.string,
|
|
92
|
+
.style .token.string,
|
|
93
|
+
.token.variable {
|
|
94
|
+
color: #f8f8f2;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.token.atrule,
|
|
98
|
+
.token.attr-value,
|
|
99
|
+
.token.function,
|
|
100
|
+
.token.class-name {
|
|
101
|
+
color: #e6db74;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.token.keyword {
|
|
105
|
+
color: #66d9ef;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.token.regex,
|
|
109
|
+
.token.important {
|
|
110
|
+
color: #fd971f;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.token.important,
|
|
114
|
+
.token.bold {
|
|
115
|
+
font-weight: bold;
|
|
116
|
+
}
|
|
117
|
+
.token.italic {
|
|
118
|
+
font-style: italic;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.token.entity {
|
|
122
|
+
cursor: help;
|
|
123
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
This directory containts the sources for the static site contained in the /docs/ directory. The site is based on the [eleventy](11ty.dev) static site generator.
|
|
2
|
+
|
|
3
|
+
The site is intended to be used with GitHub pages. To enable the site go to the GitHub settings and change the GitHub Pages "Source" setting to "master branch /docs folder".
|
|
4
|
+
|
|
5
|
+
To view the site locally, run `npm run docs:serve`.
|
|
6
|
+
|
|
7
|
+
To edit the site, add to or edit the files in this directory then run `npm run docs` to build the site. The built files must be checked in and pushed to GitHub to appear on GitHub pages.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const page = require('./page.11ty.js');
|
|
2
|
+
const relative = require('./relative-path.cjs');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This template extends the page template and adds an examples list.
|
|
6
|
+
*/
|
|
7
|
+
module.exports = function(data) {
|
|
8
|
+
|
|
9
|
+
return page({
|
|
10
|
+
...data,
|
|
11
|
+
content: renderExample(data),
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const renderExample = ({name, content, collections, page}) => {
|
|
16
|
+
return `
|
|
17
|
+
<h1>Example: ${name}</h1>
|
|
18
|
+
<section class="examples">
|
|
19
|
+
<nav class="collection">
|
|
20
|
+
<ul>
|
|
21
|
+
${collections.example === undefined
|
|
22
|
+
? ''
|
|
23
|
+
: collections.example.map((post) => `
|
|
24
|
+
<li class=${post.url === page.url ? 'selected' : ''}>
|
|
25
|
+
<a href="${relative(page.url, post.url)}">${post.data.description.replace('<', '<')}</a>
|
|
26
|
+
</li>
|
|
27
|
+
`).join('')}
|
|
28
|
+
</ul>
|
|
29
|
+
</nav>
|
|
30
|
+
<div>
|
|
31
|
+
${content}
|
|
32
|
+
</div>
|
|
33
|
+
</section>
|
|
34
|
+
`;
|
|
35
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const relative = require('./relative-path.cjs');
|
|
2
|
+
|
|
3
|
+
module.exports = function({page}) {
|
|
4
|
+
return `
|
|
5
|
+
<nav>
|
|
6
|
+
<a href="${relative(page.url, '/')}">Home</a>
|
|
7
|
+
<a href="${relative(page.url, '/examples/')}">Examples</a>
|
|
8
|
+
<a href="${relative(page.url, '/api/')}">API</a>
|
|
9
|
+
<a href="${relative(page.url, '/install/')}">Install</a>
|
|
10
|
+
</nav>`;
|
|
11
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const header = require('./header.11ty.js');
|
|
2
|
+
const footer = require('./footer.11ty.js');
|
|
3
|
+
const nav = require('./nav.11ty.js');
|
|
4
|
+
const relative = require('./relative-path.cjs');
|
|
5
|
+
|
|
6
|
+
module.exports = function(data) {
|
|
7
|
+
const {title, page, content} = data;
|
|
8
|
+
return `
|
|
9
|
+
<!doctype html>
|
|
10
|
+
|
|
11
|
+
<html lang="en">
|
|
12
|
+
<head>
|
|
13
|
+
<meta charset="utf-8">
|
|
14
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
15
|
+
<title>${title}</title>
|
|
16
|
+
<link rel="stylesheet" href="${relative(page.url, '/docs.css')}">
|
|
17
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600|Roboto+Mono">
|
|
18
|
+
<link href="${relative(page.url, '/prism-okaidia.css')}" rel="stylesheet" />
|
|
19
|
+
<script type="module" src="${relative(page.url, '/components.bundle.js')}"></script>
|
|
20
|
+
</head>
|
|
21
|
+
<body>
|
|
22
|
+
${header()}
|
|
23
|
+
${nav(data)}
|
|
24
|
+
<div id="main-wrapper">
|
|
25
|
+
<main>
|
|
26
|
+
${content}
|
|
27
|
+
</main>
|
|
28
|
+
</div>
|
|
29
|
+
${footer()}
|
|
30
|
+
</body>
|
|
31
|
+
</html>`;
|
|
32
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This page generates its content from the custom-element.json file as read by
|
|
3
|
+
* the _data/api.11tydata.js script.
|
|
4
|
+
*/
|
|
5
|
+
module.exports = class Docs {
|
|
6
|
+
data() {
|
|
7
|
+
return {
|
|
8
|
+
layout: 'page.11ty.js',
|
|
9
|
+
title: '<sf-leaderboard> ⌲ Docs',
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
render(data) {
|
|
14
|
+
const customElements = data.api['11tydata'].customElements;
|
|
15
|
+
const tags = customElements.tags;
|
|
16
|
+
return `
|
|
17
|
+
<h1>API</h1>
|
|
18
|
+
${tags.map((tag) => `
|
|
19
|
+
<h2><${tag.name}></h2>
|
|
20
|
+
<div>
|
|
21
|
+
${tag.description}
|
|
22
|
+
</div>
|
|
23
|
+
${renderTable(
|
|
24
|
+
'Attributes',
|
|
25
|
+
['name', 'description', 'type', 'default'],
|
|
26
|
+
tag.attributes)}
|
|
27
|
+
${renderTable(
|
|
28
|
+
'Properties',
|
|
29
|
+
['name', 'attribute', 'description', 'type', 'default'],
|
|
30
|
+
tag.properties)}
|
|
31
|
+
${/*
|
|
32
|
+
* Methods are not output by web-component-analyzer yet (a bug), so
|
|
33
|
+
* this is a placeholder so that at least _something_ will be output
|
|
34
|
+
* when that is fixed, and element maintainers will hopefully have a
|
|
35
|
+
* signal to update this file to add the neccessary columns.
|
|
36
|
+
*/
|
|
37
|
+
renderTable(
|
|
38
|
+
'Methods',
|
|
39
|
+
['name', 'description'],
|
|
40
|
+
tag.methods)}
|
|
41
|
+
${renderTable(
|
|
42
|
+
'Events',
|
|
43
|
+
['name', 'description'],
|
|
44
|
+
tag.events)}
|
|
45
|
+
${renderTable(
|
|
46
|
+
'Slots',
|
|
47
|
+
['name', 'description'],
|
|
48
|
+
tag.slots)}
|
|
49
|
+
${renderTable(
|
|
50
|
+
'CSS Shadow Parts',
|
|
51
|
+
['name', 'description'],
|
|
52
|
+
tag.cssParts)}
|
|
53
|
+
${renderTable(
|
|
54
|
+
'CSS Custom Properties',
|
|
55
|
+
['name', 'description'],
|
|
56
|
+
tag.cssProperties)}
|
|
57
|
+
`).join('')}
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Renders a table of data, plucking the given properties from each item in
|
|
64
|
+
* `data`.
|
|
65
|
+
*/
|
|
66
|
+
const renderTable = (name, properties, data) => {
|
|
67
|
+
if (data === undefined) {
|
|
68
|
+
return ''
|
|
69
|
+
}
|
|
70
|
+
return `
|
|
71
|
+
<h3>${name}</h3>
|
|
72
|
+
<table>
|
|
73
|
+
<tr>
|
|
74
|
+
${properties.map((p) => `<th>${capitalize(p)}</th>`).join('')}
|
|
75
|
+
</tr>
|
|
76
|
+
${data.map((i) => `
|
|
77
|
+
<tr>
|
|
78
|
+
${properties.map((p) => `<td>${i[p]}</td>`).join('')}
|
|
79
|
+
</tr>
|
|
80
|
+
`).join('')}
|
|
81
|
+
</table>
|
|
82
|
+
`
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const capitalize = (s) => s[0].toUpperCase() + s.substring(1);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registers components for the static docs site.
|
|
3
|
+
* Bundled to docs/components.bundle.js by vite.docs.config.ts.
|
|
4
|
+
*/
|
|
5
|
+
import { DEFAULT_SF_LEADERBOARD_THEME } from '../src/theme/default-theme.js';
|
|
6
|
+
import { injectTheme } from '../src/theme/inject-theme.js';
|
|
7
|
+
import '../src/components/sf-leaderboard/sf-leaderboard.js';
|
|
8
|
+
|
|
9
|
+
injectTheme(DEFAULT_SF_LEADERBOARD_THEME);
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
body {
|
|
6
|
+
margin: 0;
|
|
7
|
+
color: #333;
|
|
8
|
+
font-family: 'Open Sans', arial, sans-serif;
|
|
9
|
+
min-width: min-content;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
font-size: 18px;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
align-items: stretch;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#main-wrapper {
|
|
18
|
+
flex-grow: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
main {
|
|
22
|
+
max-width: 1024px;
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
a:visited {
|
|
27
|
+
color: inherit;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
header {
|
|
31
|
+
width: 100%;
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
height: 360px;
|
|
37
|
+
margin: 0;
|
|
38
|
+
background: linear-gradient(0deg, rgba(9,9,121,1) 0%, rgba(0,212,255,1) 100%);
|
|
39
|
+
color: white;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
footer {
|
|
43
|
+
width: 100%;
|
|
44
|
+
min-height: 120px;
|
|
45
|
+
background: gray;
|
|
46
|
+
color: white;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
padding: 12px;
|
|
51
|
+
margin-top: 64px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
h1 {
|
|
55
|
+
font-size: 2.5em;
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
h2 {
|
|
60
|
+
font-size: 1.6em;
|
|
61
|
+
font-weight: 300;
|
|
62
|
+
margin: 64px 0 12px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
h3 {
|
|
66
|
+
font-weight: 300;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
header h1 {
|
|
70
|
+
width: auto;
|
|
71
|
+
font-size: 2.8em;
|
|
72
|
+
margin: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
header h2 {
|
|
76
|
+
width: auto;
|
|
77
|
+
margin: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
nav {
|
|
81
|
+
display: grid;
|
|
82
|
+
width: 100%;
|
|
83
|
+
max-width: 100%;
|
|
84
|
+
grid-template-columns: repeat(auto-fit, 240px);
|
|
85
|
+
justify-content: center;
|
|
86
|
+
border-bottom: 1px solid #efefef;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
nav > a {
|
|
90
|
+
color: #444;
|
|
91
|
+
display: block;
|
|
92
|
+
flex: 1;
|
|
93
|
+
font-size: 18px;
|
|
94
|
+
padding: 20px 0;
|
|
95
|
+
text-align: center;
|
|
96
|
+
text-decoration: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
nav > a:hover {
|
|
100
|
+
text-decoration: underline;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
nav.collection {
|
|
104
|
+
border: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
nav.collection > ul {
|
|
108
|
+
padding: 0;
|
|
109
|
+
list-style: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
nav.collection > ul > li {
|
|
113
|
+
padding: 4px 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
nav.collection > ul > li.selected {
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
nav.collection a {
|
|
121
|
+
text-decoration: none;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
nav.collection a:hover {
|
|
125
|
+
text-decoration: underline;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
section.columns {
|
|
129
|
+
display: grid;
|
|
130
|
+
grid-template-columns: repeat(auto-fit, minmax(400px, 488px));
|
|
131
|
+
grid-gap: 48px;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
section.columns > div {
|
|
136
|
+
flex: 1;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
section.examples {
|
|
140
|
+
display: grid;
|
|
141
|
+
grid-template-columns: 240px minmax(400px, 784px);
|
|
142
|
+
grid-gap: 48px;
|
|
143
|
+
justify-content: center;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
section.examples h2:first-of-type {
|
|
147
|
+
margin-top: 0;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
table {
|
|
151
|
+
width: 100%;
|
|
152
|
+
border-collapse: collapse;
|
|
153
|
+
}
|
|
154
|
+
th {
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
td, th {
|
|
159
|
+
border: solid 1px #aaa;
|
|
160
|
+
padding: 4px;
|
|
161
|
+
text-align: left;
|
|
162
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: example.11ty.js
|
|
3
|
+
title: <sf-leaderboard> ⌲ Examples ⌲ Basic
|
|
4
|
+
tags: example
|
|
5
|
+
name: Basic
|
|
6
|
+
description: Default leaderboard
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<sf-leaderboard></sf-leaderboard>
|
|
10
|
+
|
|
11
|
+
<h3>HTML</h3>
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<sf-leaderboard></sf-leaderboard>
|
|
15
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page.11ty.js
|
|
3
|
+
title: <sf-leaderboard> ⌲ Home
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# <sf-leaderboard>
|
|
7
|
+
|
|
8
|
+
`<sf-leaderboard>` is a themeable leaderboard web component built with Lit. Use it in any app that supports custom elements.
|
|
9
|
+
|
|
10
|
+
## As easy as HTML
|
|
11
|
+
|
|
12
|
+
<section class="columns">
|
|
13
|
+
<div>
|
|
14
|
+
|
|
15
|
+
`<sf-leaderboard>` is a custom element. Drop it anywhere you use HTML.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<sf-leaderboard></sf-leaderboard>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
|
|
24
|
+
<sf-leaderboard></sf-leaderboard>
|
|
25
|
+
|
|
26
|
+
</div>
|
|
27
|
+
</section>
|
|
28
|
+
|
|
29
|
+
## With npm
|
|
30
|
+
|
|
31
|
+
Install the package and import the component entry so it registers itself:
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
import '@oddsmith/core/sf-leaderboard';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```html
|
|
38
|
+
<sf-leaderboard></sf-leaderboard>
|
|
39
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page.11ty.js
|
|
3
|
+
title: <sf-leaderboard> ⌲ Install
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Install
|
|
7
|
+
|
|
8
|
+
Components are published as ES modules from the `@oddsmith/core` package.
|
|
9
|
+
|
|
10
|
+
## Local installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm i @oddsmith/core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import '@oddsmith/core/sf-leaderboard';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## From `dist/` after building this repo
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
import '../dist/sf-leaderboard/index.js';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<sf-leaderboard></sf-leaderboard>
|
|
28
|
+
```
|
package/index.html
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>Oddsmith Core — dev</title>
|
|
6
|
+
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
7
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
8
|
+
<link
|
|
9
|
+
href="https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700;900&display=swap"
|
|
10
|
+
rel="stylesheet"
|
|
11
|
+
/>
|
|
12
|
+
<link rel="stylesheet" href="/main.css" />
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<!-- Shell mounts here; only main.ts runs before any component code loads -->
|
|
16
|
+
<div id="app"></div>
|
|
17
|
+
<script type="module" src="/main.ts"></script>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
package/karma.conf.cjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const {createDefaultConfig} = require('@open-wc/testing-karma');
|
|
2
|
+
const merge = require('deepmerge');
|
|
3
|
+
|
|
4
|
+
module.exports = (config) => {
|
|
5
|
+
config.set(
|
|
6
|
+
merge(createDefaultConfig(config), {
|
|
7
|
+
frameworks: ['mocha', 'chai'],
|
|
8
|
+
client: {
|
|
9
|
+
mocha: {ui: 'tdd'},
|
|
10
|
+
},
|
|
11
|
+
files: [
|
|
12
|
+
{
|
|
13
|
+
pattern: config.grep ? config.grep : 'test/**/*_test.js',
|
|
14
|
+
type: 'module',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
// See the karma-esm docs for all options
|
|
18
|
+
esm: {
|
|
19
|
+
nodeResolve: true,
|
|
20
|
+
},
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
return config;
|
|
24
|
+
};
|