asianscore-widget 0.0.0-stage → 1.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/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AsianScore Lab (https://asianscore.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
package/README.md CHANGED
@@ -1,3 +1,59 @@
1
- # Temporary Holding Version
1
+ # AsianScore Live Widget (`asianscore-widget`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Zero-dependency Shadow DOM Web Component (`<asianscore-widget>`) for embedding real-time Football & NBA live scores, Dixon-Coles xG win probabilities, and verifiable SHA-256 prediction ledger metrics from [AsianScore](https://asianscore.com/).
4
+
5
+ - **Live Demo (GitHub Pages):** https://aiyixiu.github.io/asianscore-live-widget/
6
+ - **Open JSON API (No key, CORS enabled):** `https://asianscore.com/api/widget/summary`
7
+ - **Live Scoreboard:** https://asianscore.com/live.html
8
+ - **SHA-256 Verifiable AI Prediction Ledger:** https://asianscore.com/models.html#ledger
9
+ - **Sports Quantitative Tools (Devig, Kelly, Poisson):** https://asianscore.com/tools.html
10
+
11
+ ## Installation
12
+
13
+ ### npm
14
+
15
+ ```bash
16
+ npm install asianscore-widget
17
+ ```
18
+
19
+ Import in your bundler or ES module entry:
20
+
21
+ ```js
22
+ import 'asianscore-widget';
23
+ ```
24
+
25
+ ### jsDelivr CDN
26
+
27
+ ```html
28
+ <script src="https://cdn.jsdelivr.net/npm/asianscore-widget@1.0.0/asianscore-widget.js" defer></script>
29
+ <asianscore-widget theme="light" limit="6"></asianscore-widget>
30
+ ```
31
+
32
+ ### GitHub Pages CDN
33
+
34
+ ```html
35
+ <script src="https://aiyixiu.github.io/asianscore-live-widget/asianscore-widget.js" defer></script>
36
+ <asianscore-widget theme="light" limit="6"></asianscore-widget>
37
+ ```
38
+
39
+ ## Attributes
40
+
41
+ | Attribute | Default | Description |
42
+ | --- | --- | --- |
43
+ | `theme` | `light` | `light` or `dark` |
44
+ | `limit` | `6` | Maximum fixtures displayed (`1`–`20`) |
45
+ | `api` | `https://asianscore.com/api/widget/summary` | JSON summary endpoint |
46
+
47
+ ## Open Platform & Ecosystem
48
+
49
+ - **Official Platform:** https://asianscore.com/
50
+ - **Zenodo Academic Dataset (CERN DOI):** https://doi.org/10.5281/zenodo.24441036
51
+ - **PyPI Python SDK (`asianscore-quant`):** https://pypi.org/project/asianscore-quant/
52
+ - **Hugging Face Dataset:** https://huggingface.co/datasets/asianscore/football-nba-xg-prediction-ledger
53
+ - **Official Go SDK (`pkg.go.dev`):** https://pkg.go.dev/github.com/AIYIXIU/asianscore-go
54
+ - **GitHub Dataset Mirror:** https://github.com/AIYIXIU/asianscore-xg-ledger-dataset
55
+ - **GitHub Python Quant SDK:** https://github.com/AIYIXIU/asianscore-quant-sdk
56
+
57
+ ## License
58
+
59
+ MIT
@@ -0,0 +1,116 @@
1
+ /**
2
+ * <asianscore-widget> — Zero-dependency Shadow DOM live scores & AI probability widget
3
+ * Data source: https://asianscore.com/api/widget/summary (open CORS JSON, no API key required)
4
+ * License: MIT | Homepage: https://asianscore.com/tools.html
5
+ */
6
+ class AsianScoreWidget extends HTMLElement {
7
+ static get observedAttributes() {
8
+ return ['theme', 'limit', 'api'];
9
+ }
10
+
11
+ constructor() {
12
+ super();
13
+ this.attachShadow({ mode: 'open' });
14
+ this._timer = null;
15
+ }
16
+
17
+ connectedCallback() {
18
+ this.renderLoading();
19
+ this.load();
20
+ this._timer = setInterval(() => this.load(), 30000);
21
+ }
22
+
23
+ disconnectedCallback() {
24
+ if (this._timer) clearInterval(this._timer);
25
+ }
26
+
27
+ attributeChangedCallback() {
28
+ if (this.isConnected) this.load();
29
+ }
30
+
31
+ get apiUrl() {
32
+ return this.getAttribute('api') || 'https://asianscore.com/api/widget/summary';
33
+ }
34
+
35
+ get limit() {
36
+ const n = parseInt(this.getAttribute('limit') || '6', 10);
37
+ return Number.isFinite(n) && n > 0 ? Math.min(n, 20) : 6;
38
+ }
39
+
40
+ get isDark() {
41
+ return (this.getAttribute('theme') || 'light') === 'dark';
42
+ }
43
+
44
+ renderLoading() {
45
+ this.shadowRoot.innerHTML = `<style>${this.styles()}</style><div class="card"><div class="head"><span class="brand">AsianScore Live</span><span class="meta">Loading…</span></div></div>`;
46
+ }
47
+
48
+ styles() {
49
+ const dark = this.isDark;
50
+ const bg = dark ? '#141518' : '#ffffff';
51
+ const card = dark ? '#1c1d21' : '#f8f9fa';
52
+ const line = dark ? 'rgba(255,255,255,0.09)' : 'rgba(17,24,39,0.09)';
53
+ const ink = dark ? '#f3f4f6' : '#111827';
54
+ const muted = dark ? '#9ca3af' : '#6b7280';
55
+ return `
56
+ :host { display: block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
57
+ .card { background: ${bg}; color: ${ink}; border: 1px solid ${line}; border-radius: 12px; overflow: hidden; }
58
+ .head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid ${line}; gap: 12px; flex-wrap: wrap; }
59
+ .brand { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; color: ${ink}; text-decoration: none; }
60
+ .meta { font-size: 12px; color: ${muted}; font-variant-numeric: tabular-nums; }
61
+ .list { display: flex; flex-direction: column; }
62
+ .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid ${line}; text-decoration: none; color: inherit; transition: background 140ms ease; }
63
+ .row:last-child { border-bottom: 0; }
64
+ .row:hover { background: ${card}; }
65
+ .left { min-width: 0; flex: 1; }
66
+ .league { font-size: 11px; color: ${muted}; margin-bottom: 2px; }
67
+ .teams { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
68
+ .right { text-align: right; flex-shrink: 0; }
69
+ .prob { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(16,185,129,0.12); color: #059669; font-variant-numeric: tabular-nums; }
70
+ .foot { display: flex; justify-content: space-between; align-items: center; padding: 9px 16px; border-top: 1px solid ${line}; background: ${card}; font-size: 11.5px; color: ${muted}; }
71
+ .foot a { color: ${ink}; text-decoration: none; font-weight: 500; }
72
+ .foot a:hover { text-decoration: underline; }
73
+ `;
74
+ }
75
+
76
+ async load() {
77
+ try {
78
+ const res = await fetch(this.apiUrl);
79
+ if (!res.ok) throw new Error('HTTP ' + res.status);
80
+ const data = await res.json();
81
+ const ledger = data.ledger || {};
82
+ const matches = (data.matches || []).slice(0, this.limit);
83
+ const rows = matches.map((m) => {
84
+ const score = m.state === 'pre' ? (m.kickoff || '').slice(5, 16) : `${m.homeScore} - ${m.awayScore}`;
85
+ const href = m.url || 'https://asianscore.com/live.html';
86
+ return `<a class="row" href="${href}" target="_blank" rel="noopener">
87
+ <div class="left">
88
+ <div class="league">${m.league || ''} · ${score}</div>
89
+ <div class="teams">${m.homeTeam || ''} vs ${m.awayTeam || ''}</div>
90
+ </div>
91
+ <div class="right">
92
+ ${m.topLabel ? `<span class="prob">${m.topLabel} ${m.topProbPct || ''}%</span>` : ''}
93
+ </div>
94
+ </a>`;
95
+ }).join('');
96
+ this.shadowRoot.innerHTML = `<style>${this.styles()}</style>
97
+ <div class="card">
98
+ <div class="head">
99
+ <a class="brand" href="https://asianscore.com/" target="_blank" rel="noopener">AsianScore Live &amp; xG</a>
100
+ <span class="meta">${ledger.settled || 0} settled · Brier ${ledger.avgBrier || '—'} · Hit ${ledger.hitRatePct || '—'}%</span>
101
+ </div>
102
+ <div class="list">${rows || '<div class="row"><span class="meta">No active fixtures</span></div>'}</div>
103
+ <div class="foot">
104
+ <span>Verifiable SHA-256 Ledger (${ledger.totalLocked || 0} locked)</span>
105
+ <a href="https://asianscore.com/ai.html" target="_blank" rel="noopener">Full Ledger →</a>
106
+ </div>
107
+ </div>`;
108
+ } catch (e) {
109
+ this.shadowRoot.innerHTML = `<style>${this.styles()}</style><div class="card"><div class="head"><a class="brand" href="https://asianscore.com/" target="_blank" rel="noopener">AsianScore Live</a><span class="meta">Feed offline</span></div></div>`;
110
+ }
111
+ }
112
+ }
113
+
114
+ if (!customElements.get('asianscore-widget')) {
115
+ customElements.define('asianscore-widget', AsianScoreWidget);
116
+ }
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "asianscore-widget",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Zero-dependency Shadow DOM Web Component (<asianscore-widget>) for real-time Football & NBA live scores, Dixon-Coles xG win probabilities, and verifiable SHA-256 prediction ledger metrics.",
5
+ "main": "asianscore-widget.js",
6
+ "files": [
7
+ "asianscore-widget.js",
8
+ "README.md",
9
+ "LICENSE"
10
+ ],
11
+ "homepage": "https://asianscore.com/",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/AIYIXIU/asianscore-live-widget.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/AIYIXIU/asianscore-live-widget/issues"
18
+ },
19
+ "keywords": [
20
+ "sports",
21
+ "live-scores",
22
+ "xg",
23
+ "football",
24
+ "nba",
25
+ "widget",
26
+ "asianscore"
27
+ ],
28
+ "author": "AsianScore Lab <npm@aimail.men>",
29
+ "license": "MIT"
30
+ }