chart-preview 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/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/.github/workflows/release.yml +38 -0
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +8 -0
- package/README.md +541 -0
- package/dev/index.html +299 -0
- package/dev/main.ts +525 -0
- package/dev/tsconfig.json +16 -0
- package/dist/index.d.ts +496 -0
- package/dist/index.js +2158 -0
- package/dist/index.mjs +2125 -0
- package/package.json +57 -0
- package/src/ChartPreview.ts +1346 -0
- package/src/ChartPreviewPlayer.ts +1163 -0
- package/src/SharedAudioContext.ts +83 -0
- package/src/SngLoader.ts +330 -0
- package/src/index.ts +37 -0
- package/tsconfig.json +26 -0
- package/vite.config.ts +18 -0
package/dev/index.html
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>Chart Preview - Development</title>
|
|
7
|
+
<style>
|
|
8
|
+
* {
|
|
9
|
+
margin: 0;
|
|
10
|
+
padding: 0;
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
body {
|
|
15
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
16
|
+
sans-serif;
|
|
17
|
+
background: #1a1a2e;
|
|
18
|
+
color: #eee;
|
|
19
|
+
min-height: 100vh;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
align-items: center;
|
|
23
|
+
padding: 20px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
h1 {
|
|
27
|
+
margin-bottom: 20px;
|
|
28
|
+
color: #fff;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.demo-container {
|
|
32
|
+
max-width: 800px;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.file-inputs {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 15px;
|
|
40
|
+
margin-bottom: 20px;
|
|
41
|
+
padding: 20px;
|
|
42
|
+
background: #16213e;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.chart-picker {
|
|
47
|
+
display: flex;
|
|
48
|
+
gap: 10px;
|
|
49
|
+
align-items: center;
|
|
50
|
+
flex-wrap: wrap;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.chart-picker button {
|
|
54
|
+
flex-shrink: 0;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.chart-info {
|
|
58
|
+
display: none;
|
|
59
|
+
padding: 12px;
|
|
60
|
+
background: #0f3460;
|
|
61
|
+
border-radius: 6px;
|
|
62
|
+
margin-top: 10px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.chart-info.visible {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.chart-info h3 {
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
margin-bottom: 8px;
|
|
72
|
+
color: #3498db;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.chart-info p {
|
|
76
|
+
font-size: 13px;
|
|
77
|
+
color: #aaa;
|
|
78
|
+
margin-bottom: 4px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.chart-info .song-name {
|
|
82
|
+
font-size: 18px;
|
|
83
|
+
font-weight: 600;
|
|
84
|
+
color: #fff;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.chart-info .artist {
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
color: #ccc;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.last-chart-hint {
|
|
93
|
+
display: none;
|
|
94
|
+
font-size: 12px;
|
|
95
|
+
color: #888;
|
|
96
|
+
margin-top: 5px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.last-chart-hint.visible {
|
|
100
|
+
display: block;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.file-input-group {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-direction: column;
|
|
106
|
+
gap: 5px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
label {
|
|
110
|
+
font-weight: 600;
|
|
111
|
+
font-size: 14px;
|
|
112
|
+
color: #aaa;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
input[type="file"] {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.options {
|
|
120
|
+
display: none;
|
|
121
|
+
gap: 15px;
|
|
122
|
+
flex-wrap: wrap;
|
|
123
|
+
padding-top: 15px;
|
|
124
|
+
border-top: 1px solid #1a4b8c;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.options.visible {
|
|
128
|
+
display: flex;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
select {
|
|
132
|
+
padding: 8px 12px;
|
|
133
|
+
background: #0f3460;
|
|
134
|
+
border: 1px solid #1a4b8c;
|
|
135
|
+
border-radius: 4px;
|
|
136
|
+
color: #eee;
|
|
137
|
+
font-size: 14px;
|
|
138
|
+
min-width: 150px;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
select:disabled {
|
|
142
|
+
opacity: 0.5;
|
|
143
|
+
cursor: not-allowed;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.preview-wrapper {
|
|
147
|
+
background: #000;
|
|
148
|
+
border-radius: 8px;
|
|
149
|
+
overflow: hidden;
|
|
150
|
+
margin-bottom: 20px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* Web Component player container */
|
|
154
|
+
chart-preview-player {
|
|
155
|
+
display: block;
|
|
156
|
+
width: 100%;
|
|
157
|
+
height: 400px;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
button {
|
|
161
|
+
padding: 10px 20px;
|
|
162
|
+
background: #3498db;
|
|
163
|
+
color: white;
|
|
164
|
+
border: none;
|
|
165
|
+
border-radius: 4px;
|
|
166
|
+
cursor: pointer;
|
|
167
|
+
font-size: 14px;
|
|
168
|
+
font-weight: 600;
|
|
169
|
+
transition: background 0.2s;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
button:hover:not(:disabled) {
|
|
173
|
+
background: #2980b9;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
button:disabled {
|
|
177
|
+
background: #555;
|
|
178
|
+
cursor: not-allowed;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
button.secondary {
|
|
182
|
+
background: #0f3460;
|
|
183
|
+
border: 1px solid #1a4b8c;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
button.secondary:hover:not(:disabled) {
|
|
187
|
+
background: #1a4b8c;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.status {
|
|
191
|
+
padding: 10px;
|
|
192
|
+
margin-top: 15px;
|
|
193
|
+
background: #16213e;
|
|
194
|
+
border-radius: 4px;
|
|
195
|
+
font-size: 13px;
|
|
196
|
+
color: #aaa;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.status.error {
|
|
200
|
+
background: #3d1515;
|
|
201
|
+
color: #e74c3c;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.status.success {
|
|
205
|
+
background: #153d15;
|
|
206
|
+
color: #2ecc71;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.player-events {
|
|
210
|
+
margin-top: 15px;
|
|
211
|
+
padding: 10px;
|
|
212
|
+
background: #16213e;
|
|
213
|
+
border-radius: 4px;
|
|
214
|
+
font-size: 12px;
|
|
215
|
+
font-family: monospace;
|
|
216
|
+
color: #888;
|
|
217
|
+
max-height: 100px;
|
|
218
|
+
overflow-y: auto;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.player-events .event {
|
|
222
|
+
padding: 2px 0;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.player-events .event.state {
|
|
226
|
+
color: #3498db;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.player-events .event.progress {
|
|
230
|
+
color: #666;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.player-events .event.end {
|
|
234
|
+
color: #2ecc71;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.player-events .event.error {
|
|
238
|
+
color: #e74c3c;
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
241
|
+
</head>
|
|
242
|
+
<body>
|
|
243
|
+
<div class="demo-container">
|
|
244
|
+
<div class="file-inputs">
|
|
245
|
+
<div class="file-input-group">
|
|
246
|
+
<label>Select Chart</label>
|
|
247
|
+
<div class="chart-picker">
|
|
248
|
+
<button id="choose-folder-btn">Choose Chart Folder</button>
|
|
249
|
+
<button id="choose-sng-btn" class="secondary">
|
|
250
|
+
Choose .sng File
|
|
251
|
+
</button>
|
|
252
|
+
<input type="file" id="folder-input" webkitdirectory />
|
|
253
|
+
<input type="file" id="sng-input" accept=".sng" />
|
|
254
|
+
</div>
|
|
255
|
+
<div class="last-chart-hint" id="last-chart-hint">
|
|
256
|
+
Last used: <span id="last-chart-name"></span>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
|
|
260
|
+
<div class="chart-info" id="chart-info">
|
|
261
|
+
<p class="song-name" id="song-name">Song Name</p>
|
|
262
|
+
<p class="artist" id="song-artist">Artist</p>
|
|
263
|
+
<p id="song-charter"></p>
|
|
264
|
+
<p id="song-length"></p>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div class="options" id="track-options">
|
|
268
|
+
<div class="file-input-group">
|
|
269
|
+
<label>Instrument</label>
|
|
270
|
+
<select id="instrument" disabled>
|
|
271
|
+
<option value="">Select chart first...</option>
|
|
272
|
+
</select>
|
|
273
|
+
</div>
|
|
274
|
+
<div class="file-input-group">
|
|
275
|
+
<label>Difficulty</label>
|
|
276
|
+
<select id="difficulty" disabled>
|
|
277
|
+
<option value="">Select instrument first...</option>
|
|
278
|
+
</select>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
<button id="load-btn" disabled>Load Preview</button>
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
<div class="preview-wrapper">
|
|
285
|
+
<chart-preview-player id="player" volume="50"></chart-preview-player>
|
|
286
|
+
</div>
|
|
287
|
+
|
|
288
|
+
<div class="status" id="status">
|
|
289
|
+
Choose a chart folder or .sng file to begin.
|
|
290
|
+
</div>
|
|
291
|
+
|
|
292
|
+
<div class="player-events" id="player-events">
|
|
293
|
+
<div class="event">Player events will appear here...</div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
<script type="module" src="./main.ts"></script>
|
|
298
|
+
</body>
|
|
299
|
+
</html>
|