fastled 1.1.67__py3-none-any.whl → 1.1.68__py3-none-any.whl

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.
fastled/__init__.py CHANGED
@@ -7,9 +7,13 @@ from typing import Generator
7
7
 
8
8
  from .compile_server import CompileServer
9
9
  from .live_client import LiveClient
10
+ from .site.build import build
10
11
  from .types import BuildMode, CompileResult, CompileServerError
11
12
 
12
- __version__ = "1.1.67"
13
+ # IMPORTANT! There's a bug in github which will REJECT any version update
14
+ # that has any other change in the repo. Please bump the version as the
15
+ # ONLY change in a commit, or else the pypi update and the release will fail.
16
+ __version__ = "1.1.68"
13
17
 
14
18
 
15
19
  class Api:
@@ -117,6 +121,11 @@ class Test:
117
121
 
118
122
  return test_examples(examples=examples, host=host)
119
123
 
124
+ @staticmethod
125
+ def build_site(outputdir: Path, fast: bool | None = None, check: bool = True):
126
+ """Builds the FastLED compiler site."""
127
+ build(outputdir=outputdir, fast=fast, check=check)
128
+
120
129
 
121
130
  __all__ = [
122
131
  "Api",
fastled/site/build.py ADDED
@@ -0,0 +1,409 @@
1
+ import argparse
2
+ import subprocess
3
+ from pathlib import Path
4
+ from shutil import copytree, rmtree, which
5
+
6
+ CSS_CONTENT = """
7
+ /* CSS Reset & Variables */
8
+ *, *::before, *::after {
9
+ box-sizing: border-box;
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ :root {
15
+ --color-background: #121212;
16
+ --color-surface: #252525;
17
+ --color-surface-transparent: rgba(30, 30, 30, 0.95);
18
+ --color-text: #E0E0E0;
19
+ --spacing-sm: 5px;
20
+ --spacing-md: 10px;
21
+ --spacing-lg: 15px;
22
+ --transition-speed: 0.3s;
23
+ --font-family: 'Roboto Condensed', sans-serif;
24
+ --nav-width: 250px;
25
+ --border-radius: 5px;
26
+ }
27
+
28
+ /* Base Styles */
29
+ body {
30
+ background-color: var(--color-background);
31
+ color: var(--color-text);
32
+ margin: 0;
33
+ padding: 0;
34
+ font-family: var(--font-family);
35
+ min-height: 100vh;
36
+ display: grid;
37
+ grid-template-rows: 1fr;
38
+ }
39
+
40
+ /* Splash Screen */
41
+ .splash-screen {
42
+ position: fixed;
43
+ inset: 0;
44
+ background-color: var(--color-background);
45
+ display: flex;
46
+ justify-content: center;
47
+ align-items: center;
48
+ z-index: 2000;
49
+ transition: opacity var(--transition-speed) ease-out;
50
+ }
51
+
52
+ .splash-text {
53
+ font-size: 14vw;
54
+ color: var(--color-text);
55
+ font-weight: 300;
56
+ font-family: var(--font-family);
57
+ opacity: 0;
58
+ transition: opacity var(--transition-speed) ease-in;
59
+ }
60
+
61
+ /* Layout */
62
+ .content-wrapper {
63
+ position: relative;
64
+ width: 100%;
65
+ height: 100vh;
66
+ overflow-x: hidden;
67
+ }
68
+
69
+ /* Navigation */
70
+ .nav-trigger {
71
+ position: fixed;
72
+ left: var(--spacing-md);
73
+ top: var(--spacing-md);
74
+ padding: var(--spacing-sm) var(--spacing-lg);
75
+ z-index: 1001;
76
+ background-color: var(--color-surface);
77
+ border-radius: var(--border-radius);
78
+ display: flex;
79
+ align-items: center;
80
+ justify-content: center;
81
+ cursor: pointer;
82
+ color: var(--color-text);
83
+ font-size: 16px;
84
+ transition: background-color var(--transition-speed) ease;
85
+ }
86
+
87
+ .nav-trigger:hover {
88
+ background-color: var(--color-surface-transparent);
89
+ }
90
+
91
+ .nav-pane {
92
+ position: fixed;
93
+ left: var(--spacing-md);
94
+ top: 60px;
95
+ width: var(--nav-width);
96
+ height: auto;
97
+ background-color: var(--color-surface-transparent);
98
+ border-radius: var(--border-radius);
99
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
100
+ transform: translateY(-20px);
101
+ opacity: 0;
102
+ pointer-events: none;
103
+ transition: transform var(--transition-speed) ease,
104
+ opacity var(--transition-speed) ease;
105
+ }
106
+
107
+ .nav-pane.visible {
108
+ transform: translateY(0);
109
+ opacity: 1;
110
+ pointer-events: auto;
111
+ }
112
+
113
+ /* Main Content */
114
+ .main-content {
115
+ width: 100%;
116
+ height: 100%;
117
+ padding: 0;
118
+ overflow: hidden;
119
+ }
120
+
121
+ #example-frame {
122
+ width: 100%;
123
+ height: 100%;
124
+ border: none;
125
+ background-color: var(--color-background);
126
+ overflow: auto;
127
+ }
128
+
129
+ /* Example Links */
130
+ .example-link {
131
+ margin: var(--spacing-sm) var(--spacing-md);
132
+ padding: var(--spacing-lg) var(--spacing-md);
133
+ border-radius: var(--border-radius);
134
+ display: block;
135
+ text-decoration: none;
136
+ color: var(--color-text);
137
+ background-color: var(--color-surface);
138
+ transition: background-color var(--transition-speed) ease-in-out,
139
+ box-shadow var(--transition-speed) ease-in-out;
140
+ position: relative;
141
+ padding-right: 35px;
142
+ }
143
+
144
+ .example-link:hover {
145
+ background-color: var(--color-surface-transparent);
146
+ box-shadow: var(--shadow-hover, 0 0 10px rgba(255, 255, 255, 0.1));
147
+ }
148
+
149
+ .example-link:last-child {
150
+ margin-bottom: var(--spacing-md);
151
+ }
152
+
153
+ /* Accessibility */
154
+ @media (prefers-reduced-motion: reduce) {
155
+ *, *::before, *::after {
156
+ animation-duration: 0.01ms !important;
157
+ animation-iteration-count: 1 !important;
158
+ transition-duration: 0.01ms !important;
159
+ scroll-behavior: auto !important;
160
+ }
161
+ }
162
+ """
163
+
164
+ INDEX_TEMPLATE = """<!DOCTYPE html>
165
+ <html lang="en">
166
+ <head>
167
+ <meta charset="UTF-8">
168
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
169
+ <title>FastLED Examples</title>
170
+ <link href="https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300&display=swap" rel="stylesheet">
171
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
172
+ <link rel="stylesheet" href="index.css">
173
+ </head>
174
+ <body>
175
+ <div class="splash-screen">
176
+ <div class="splash-text">FastLED</div>
177
+ </div>
178
+ <div class="content-wrapper">
179
+ <div class="nav-trigger">Examples</div>
180
+ <nav class="nav-pane">
181
+ {example_links}
182
+ </nav>
183
+ <main class="main-content">
184
+ <iframe id="example-frame" title="Example Content"></iframe>
185
+ </main>
186
+ </div>
187
+ <script>
188
+ document.addEventListener('DOMContentLoaded', function() {{
189
+ const splashScreen = document.querySelector('.splash-screen');
190
+ const splashText = document.querySelector('.splash-text');
191
+
192
+ // Wait for font to load
193
+ document.fonts.ready.then(() => {{
194
+ // Fade in the text
195
+ splashText.style.opacity = '1';
196
+
197
+ // Wait for page load plus fade-in time before starting fade-out sequence
198
+ window.addEventListener('load', () => {{
199
+ setTimeout(() => {{
200
+ splashScreen.style.opacity = '0';
201
+ setTimeout(() => {{
202
+ splashScreen.style.display = 'none';
203
+ }}, 500); // Remove from DOM after fade completes
204
+ }}, 1500); // Wait for load + 1.5s (giving time for fade-in)
205
+ }});
206
+ }});
207
+ const links = document.querySelectorAll('.example-link');
208
+ const iframe = document.getElementById('example-frame');
209
+ const navPane = document.querySelector('.nav-pane');
210
+ const navTrigger = document.querySelector('.nav-trigger');
211
+
212
+ // First add checkmarks to all links
213
+ links.forEach(link => {{
214
+ // Add the checkmark span to each link
215
+ const checkmark = document.createElement('i');
216
+ checkmark.className = 'fas fa-check';
217
+ checkmark.style.display = 'none';
218
+ checkmark.style.position = 'absolute';
219
+ checkmark.style.right = '10px';
220
+ checkmark.style.top = '50%';
221
+ checkmark.style.transform = 'translateY(-50%)';
222
+ checkmark.style.color = '#E0E0E0';
223
+ link.appendChild(checkmark);
224
+ }});
225
+
226
+ // Now load first example and show its checkmark
227
+ if (links.length > 0) {{
228
+ // Try to find SdCard example first
229
+ let startLink = Array.from(links).find(link => link.textContent === 'SdCard') || links[0];
230
+ iframe.src = startLink.getAttribute('href');
231
+ startLink.classList.add('active');
232
+ startLink.querySelector('.fa-check').style.display = 'inline-block';
233
+ }}
234
+
235
+ // Add click handlers
236
+ links.forEach(link => {{
237
+ link.addEventListener('click', function(e) {{
238
+ e.preventDefault();
239
+ // Hide all checkmarks
240
+ links.forEach(l => {{
241
+ l.querySelector('.fa-check').style.display = 'none';
242
+ l.classList.remove('active');
243
+ }});
244
+ // Show this checkmark
245
+ this.querySelector('.fa-check').style.display = 'inline-block';
246
+ this.classList.add('active');
247
+ iframe.src = this.getAttribute('href');
248
+ hideNav(); // Hide nav after selection
249
+ }});
250
+ }});
251
+
252
+ function showNav() {{
253
+ navPane.classList.add('visible');
254
+ navPane.style.opacity = '1';
255
+ }}
256
+
257
+ function hideNav() {{
258
+ navPane.style.opacity = '0'; // Start fade out
259
+ setTimeout(() => {{
260
+ navPane.classList.remove('visible');
261
+ }}, 300);
262
+ }}
263
+
264
+ // Click handlers for nav
265
+ navTrigger.addEventListener('click', (e) => {{
266
+ e.stopPropagation();
267
+ if (navPane.classList.contains('visible')) {{
268
+ hideNav();
269
+ }} else {{
270
+ showNav();
271
+ }}
272
+ }});
273
+
274
+ // Close menu when clicking anywhere in the document
275
+ document.addEventListener('click', (e) => {{
276
+ if (navPane.classList.contains('visible') &&
277
+ !navPane.contains(e.target) &&
278
+ !navTrigger.contains(e.target)) {{
279
+ hideNav();
280
+ }}
281
+ }});
282
+
283
+ // Close when clicking iframe
284
+ iframe.addEventListener('load', () => {{
285
+ iframe.contentDocument?.addEventListener('click', () => {{
286
+ if (navPane.classList.contains('visible')) {{
287
+ hideNav();
288
+ }}
289
+ }});
290
+ }});
291
+
292
+ // Initial state
293
+ hideNav();
294
+ }});
295
+ </script>
296
+ </body>
297
+ </html>
298
+ """
299
+
300
+
301
+ EXAMPLES = ["wasm", "Chromancer", "SdCard", "NoiseRing", "LuminescentGrand", "Water"]
302
+
303
+
304
+ def _exec(cmd: str) -> None:
305
+ subprocess.run(cmd, shell=True, check=True)
306
+
307
+
308
+ def build_example(example: str, outputdir: Path) -> None:
309
+ if not which("fastled"):
310
+ raise FileNotFoundError("fastled executable not found")
311
+ src_dir = outputdir / example / "src"
312
+ _exec(f"fastled --init={example} {src_dir}")
313
+ assert src_dir.exists()
314
+ _exec(f"fastled {src_dir / example} --just-compile")
315
+ fastled_dir = src_dir / example / "fastled_js"
316
+ assert fastled_dir.exists(), f"fastled dir {fastled_dir} not found"
317
+ # now copy it to the example dir
318
+ example_dir = outputdir / example
319
+ copytree(fastled_dir, example_dir, dirs_exist_ok=True)
320
+ # now remove the src dir
321
+ rmtree(src_dir, ignore_errors=True)
322
+ print(f"Built {example} example in {example_dir}")
323
+ assert (example_dir / "fastled.wasm").exists()
324
+
325
+
326
+ def generate_css(outputdir: Path) -> None:
327
+ css_file = outputdir / "index.css"
328
+ # with open(css_file, "w") as f:
329
+ # f.write(CSS_CONTENT, encoding="utf-8")
330
+ css_file.write_text(CSS_CONTENT, encoding="utf-8")
331
+
332
+
333
+ def build_index_html(outputdir: Path) -> None:
334
+ outputdir = outputdir
335
+ assert (
336
+ outputdir.exists()
337
+ ), f"Output directory {outputdir} not found, you should run build_example first"
338
+ index_html = outputdir / "index.html"
339
+
340
+ examples = [f for f in outputdir.iterdir() if f.is_dir()]
341
+ examples = sorted(examples)
342
+
343
+ example_links = "\n".join(
344
+ f' <a class="example-link" href="{example.name}/index.html">{example.name}</a>'
345
+ for example in examples
346
+ )
347
+
348
+ with open(index_html, "w") as f:
349
+ f.write(INDEX_TEMPLATE.format(example_links=example_links))
350
+
351
+
352
+ def parse_args() -> argparse.Namespace:
353
+ parser = argparse.ArgumentParser(description="Build FastLED example site")
354
+ parser.add_argument(
355
+ "--outputdir", type=Path, help="Output directory", required=True
356
+ )
357
+ parser.add_argument(
358
+ "--fast",
359
+ action="store_true",
360
+ help="Skip regenerating existing examples, only rebuild index.html and CSS",
361
+ )
362
+ return parser.parse_args()
363
+
364
+
365
+ def build(outputdir: Path, fast: bool | None = None, check=False) -> list[Exception]:
366
+ outputdir = outputdir
367
+ fast = fast or False
368
+ errors: list[Exception] = []
369
+
370
+ for example in EXAMPLES:
371
+ example_dir = outputdir / example
372
+ if not fast or not example_dir.exists():
373
+ try:
374
+ build_example(example=example, outputdir=outputdir)
375
+ except Exception as e:
376
+ if check:
377
+ raise
378
+ errors.append(e)
379
+
380
+ try:
381
+ generate_css(outputdir=outputdir)
382
+ except Exception as e:
383
+ if check:
384
+ raise
385
+ errors.append(e)
386
+
387
+ try:
388
+ build_index_html(outputdir=outputdir)
389
+ except Exception as e:
390
+ if check:
391
+ raise
392
+ errors.append(e)
393
+
394
+ return errors
395
+
396
+
397
+ def main() -> int:
398
+ args = parse_args()
399
+ outputdir = args.outputdir
400
+ fast = args.fast
401
+ build(outputdir=outputdir, fast=fast)
402
+ return 0
403
+
404
+
405
+ if __name__ == "__main__":
406
+ import sys
407
+
408
+ sys.argv.append("--fast")
409
+ main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.67
3
+ Version: 1.1.68
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -258,6 +258,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
258
258
 
259
259
 
260
260
  # Revisions
261
+ * 1.1.68 - Add a site builder to fastled.Test which generates a website with a bunch of demos. This is used to build the demo site automatically.
261
262
  * 1.1.67 - Pinned all the minimum versions of dependencies so we don't bind to an out of date py dep: https://github.com/zackees/fastled-wasm/issues/3
262
263
  * 1.1.61 - Excluded non compiling examples from the Test object as part of the api - no sense in having them if they won't compile.
263
264
  * 1.1.60 - Platform executables (macos-arm/macos-x86/windows/linux-x86) now auto building with each release. Add tests.
@@ -1,4 +1,4 @@
1
- fastled/__init__.py,sha256=RpRC0t-T1ZK7KWpdcfe3M8qCAvv2nhth8DgacnW-M-s,3462
1
+ fastled/__init__.py,sha256=vsaQk8Pikams22WtrElrDxkdj_AUr7d42GwSUoAMehs,3925
2
2
  fastled/app.py,sha256=AHLQczFKLV1ZyGCh45wTvJqQpQyJ_Ukh3MmG3Om4NHQ,1844
3
3
  fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
4
4
  fastled/client_server.py,sha256=8L62zNtkGtErDtWrr4XVNsv7ji2zoS5rlqfCnwI3VKU,13177
@@ -21,10 +21,11 @@ fastled/types.py,sha256=PpSEtzFCkWtSIEMC0QXGl966R97vLoryVl3yFW0YhTs,1475
21
21
  fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
22
22
  fastled/web_compile.py,sha256=05PeLJ77QQC6PUKjDhsntBmyBola6QQIfF2k-zjYNE4,10261
23
23
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
24
+ fastled/site/build.py,sha256=UDWaked5QFPibbKZSoDrQgiP1Laoh8f0Fbj8Qfey0I4,12503
24
25
  fastled/test/examples.py,sha256=EDXb6KastKOOWzew99zrpmcNcXTcAtYi8eud6F1pnWA,980
25
- fastled-1.1.67.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
26
- fastled-1.1.67.dist-info/METADATA,sha256=K-Ik5jkSdI3wJJbAfIAY9lwwteCBakYtA_58sZL84mE,18695
27
- fastled-1.1.67.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
28
- fastled-1.1.67.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
29
- fastled-1.1.67.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
30
- fastled-1.1.67.dist-info/RECORD,,
26
+ fastled-1.1.68.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
27
+ fastled-1.1.68.dist-info/METADATA,sha256=0Du_uru8tJWDYxSJAtTBriZj_uNtDPxFD1iVr-m62kE,18843
28
+ fastled-1.1.68.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
29
+ fastled-1.1.68.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
30
+ fastled-1.1.68.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
31
+ fastled-1.1.68.dist-info/RECORD,,