code-playpad 0.5.1 → 0.5.2

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/README.md CHANGED
@@ -9,7 +9,7 @@ entirely in the reader's browser. No backend, no iframe, no sign-up.
9
9
  **[Live demo →](https://code-playpad.swengr.com)**
10
10
 
11
11
  ```html
12
- <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.5.1/dist/standalone.js"></script>
12
+ <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.5.2/dist/standalone.js"></script>
13
13
 
14
14
  <code-playpad height="auto">
15
15
  print("hello from a static page")
@@ -29,7 +29,7 @@ entirely in the reader's browser. No backend, no iframe, no sign-up.
29
29
  | --- | --- | --- |
30
30
  | `python` (default) | Python 3.14 via Pyodide — full standard library, `input()`, real tracebacks, `numpy` on demand | ~6 MB (13.5 MB unpacked), once, cached |
31
31
  | `javascript` | The browser's own engine, in a Worker | nothing |
32
- | `typescript` | Same engine, types stripped before running | ~70 KB, once, cached |
32
+ | `typescript` | Same engine, types stripped before running | nothing from another service: a ~47 KB (gzipped) transform chunk of this package, loaded the first time a widget needs it |
33
33
  | `java` | A documented subset of Java 25, compiled and interpreted in a Worker by an engine built for this package — see [Java](#java) | nothing: the engine is a ~105 KB (gzipped) chunk of this package, loaded with the first Java widget, and its library a ~75 KB chunk loaded the first time a program uses it |
34
34
 
35
35
  ```html
@@ -170,10 +170,10 @@ actually sent.
170
170
  | --- | --- | --- | --- |
171
171
  | Python | **166.3 KB** | Pyodide, about **6.0 MB** (a 3.3 MB wasm file and a 2.4 MB standard library) | 165.8 KB |
172
172
  | JavaScript | **180.4 KB** | nothing | 179.9 KB |
173
- | TypeScript | **180.4 KB** | Sucrase, 72 KB (≈ 252 KB in total) | 179.9 KB |
173
+ | TypeScript | **227.3 KB** (0.5.2: with the 46.9 KB transform) | nothing (before 0.5.2: Sucrase from esm.sh, 72 KB) | 179.9 KB |
174
174
  | Java | **267.8 KB** | nothing | 216.4 KB |
175
175
  | Java, with collections | **342.4 KB** | nothing | 233.2 KB |
176
- | All four | 399.9 KB | Pyodide and Sucrase | 273.9 KB |
176
+ | All four | 446.8 KB (0.5.2: with the transform) | Pyodide | 273.9 KB |
177
177
 
178
178
  - **Every row includes a 144.5 KB shared base:** the editor (CodeMirror) and
179
179
  the widget, the same as in 0.3.0.
@@ -192,8 +192,12 @@ actually sent.
192
192
  - **Languages load lazily.** A Java page never fetches the Python or
193
193
  JavaScript runtimes, and Python and JavaScript pages never fetch Java. As a
194
194
  result, Python-only and JavaScript-only pages are the same size as in 0.3.0.
195
- - **Java needs no CDN:** it is self-contained, while Python's first run
196
- downloads about 6 MB of Pyodide (cached after that).
195
+ - **Java and TypeScript need no other service:** both are self-contained.
196
+ Since 0.5.2 the TypeScript transform (Sucrase) is a 46.9 KB chunk of this
197
+ package, loaded the first time a widget needs it (TypeScript, JSX, or
198
+ JavaScript modules across several files); the TypeScript rows are the
199
+ measured JavaScript page plus that chunk. Python's first run downloads about
200
+ 6 MB of Pyodide (cached after that).
197
201
  - **With npm and a bundler,** you already ship CodeMirror yourself.
198
202
  code-playpad's own code then costs about 9 KB, plus the runtime chunk for
199
203
  each language used. Java's chunk is 104 KB, and 74 KB more for its library
@@ -204,7 +208,7 @@ actually sent.
204
208
  ### From a CDN — nothing to install
205
209
 
206
210
  ```html
207
- <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.5.1/dist/standalone.js"></script>
211
+ <script type="module" src="https://cdn.jsdelivr.net/npm/code-playpad@0.5.2/dist/standalone.js"></script>
208
212
  ```
209
213
 
210
214
  This is the `standalone` build: CodeMirror is bundled in, so a static blog post
@@ -806,8 +810,11 @@ configurePython({ indexURL: '/pyodide/' }); // before the first run
806
810
  pyodideAssetUrls(); // the files worth <link rel=preload>-ing
807
811
  ```
808
812
 
809
- `configureTypeScript({ sucraseURL })` does the same for the TypeScript
810
- transform. Give those files a long `Cache-Control`: one page's download then
813
+ The TypeScript transform needs no configuration: it ships in the package (since
814
+ 0.5.2) and loads from wherever the package is served. `configureTypeScript({
815
+ sucraseURL })` loads it from a URL of your own instead (an absolute URL of a
816
+ self-contained ES module exporting `transform`), set before the first
817
+ JavaScript or TypeScript widget starts its runtime. Give those files a long `Cache-Control`: one page's download then
811
818
  warms every other page on the site.
812
819
 
813
820
  ## Worth knowing
@@ -832,9 +839,29 @@ warms every other page on the site.
832
839
 
833
840
  ## Version history
834
841
 
835
- Markup and API written against 0.1.3 still work on 0.5.1, with one exception, in
842
+ Markup and API written against 0.1.3 still work on 0.5.2, with one exception, in
836
843
  0.5.1: an `entry` that names none of a widget's files is now an error.
837
844
 
845
+ ### 0.5.2
846
+
847
+ - **TypeScript no longer depends on esm.sh.** Before, the first TypeScript
848
+ run (and JSX, and JavaScript modules across several files) imported Sucrase,
849
+ the transform that strips types, from `esm.sh`. If esm.sh was blocked or
850
+ failed, TypeScript could not run (`Failed to fetch dynamically imported
851
+ module`). Sucrase 3.35.1 now ships in the package as its own chunk (46.9 KB
852
+ gzipped, about a third smaller than what esm.sh sent). It loads from wherever
853
+ code-playpad is served: the same CDN, or your app's bundle. It is still
854
+ loaded only when a widget first needs it, so JavaScript-only, Python and
855
+ Java pages never download it.
856
+ - **A failed transform load can be retried, and says what it is.** Before, one
857
+ failed load kept every later run failing until the page was reloaded, and
858
+ the error looked like one in the learner's code. Now the message is *Could
859
+ not load the TypeScript transform (Sucrase)*, with a hint that it is not an
860
+ error in the code, and the next Run tries again.
861
+ - **Types are still erased, not checked.** This changes where the transform
862
+ comes from, not what it does.
863
+ - `configureTypeScript({ sucraseURL })` still works, and is now optional.
864
+
838
865
  ### 0.5.1
839
866
 
840
867
  - **A wrong `entry` is an error, in every language.** Before, a widget whose
@@ -253,6 +253,98 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
253
253
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
254
254
  THE SOFTWARE.
255
255
 
256
+ ==============================================================================
257
+ @jridgewell/gen-mapping 0.3.13 — MIT
258
+
259
+ Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
260
+
261
+ Permission is hereby granted, free of charge, to any person obtaining a copy
262
+ of this software and associated documentation files (the "Software"), to deal
263
+ in the Software without restriction, including without limitation the rights
264
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
265
+ copies of the Software, and to permit persons to whom the Software is
266
+ furnished to do so, subject to the following conditions:
267
+
268
+ The above copyright notice and this permission notice shall be included in
269
+ all copies or substantial portions of the Software.
270
+
271
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
272
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
273
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
274
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
275
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
276
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
277
+ SOFTWARE.
278
+
279
+ ==============================================================================
280
+ @jridgewell/resolve-uri 3.1.2 — MIT
281
+
282
+ Copyright 2019 Justin Ridgewell <jridgewell@google.com>
283
+
284
+ Permission is hereby granted, free of charge, to any person obtaining a copy
285
+ of this software and associated documentation files (the "Software"), to deal
286
+ in the Software without restriction, including without limitation the rights
287
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
288
+ copies of the Software, and to permit persons to whom the Software is
289
+ furnished to do so, subject to the following conditions:
290
+
291
+ The above copyright notice and this permission notice shall be included in
292
+ all copies or substantial portions of the Software.
293
+
294
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
295
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
296
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
297
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
298
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
299
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
300
+ SOFTWARE.
301
+
302
+ ==============================================================================
303
+ @jridgewell/sourcemap-codec 1.6.0 — MIT
304
+
305
+ Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
306
+
307
+ Permission is hereby granted, free of charge, to any person obtaining a copy
308
+ of this software and associated documentation files (the "Software"), to deal
309
+ in the Software without restriction, including without limitation the rights
310
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
311
+ copies of the Software, and to permit persons to whom the Software is
312
+ furnished to do so, subject to the following conditions:
313
+
314
+ The above copyright notice and this permission notice shall be included in
315
+ all copies or substantial portions of the Software.
316
+
317
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
318
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
319
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
320
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
321
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
322
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
323
+ SOFTWARE.
324
+
325
+ ==============================================================================
326
+ @jridgewell/trace-mapping 0.3.31 — MIT
327
+
328
+ Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
329
+
330
+ Permission is hereby granted, free of charge, to any person obtaining a copy
331
+ of this software and associated documentation files (the "Software"), to deal
332
+ in the Software without restriction, including without limitation the rights
333
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
334
+ copies of the Software, and to permit persons to whom the Software is
335
+ furnished to do so, subject to the following conditions:
336
+
337
+ The above copyright notice and this permission notice shall be included in
338
+ all copies or substantial portions of the Software.
339
+
340
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
341
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
342
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
343
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
344
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
345
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
346
+ SOFTWARE.
347
+
256
348
  ==============================================================================
257
349
  @lezer/common 1.5.2 — MIT
258
350
 
@@ -476,6 +568,31 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
476
568
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
477
569
  THE SOFTWARE.
478
570
 
571
+ ==============================================================================
572
+ lines-and-columns 1.2.4 — MIT
573
+
574
+ The MIT License (MIT)
575
+
576
+ Copyright (c) 2015 Brian Donovan
577
+
578
+ Permission is hereby granted, free of charge, to any person obtaining a copy
579
+ of this software and associated documentation files (the "Software"), to deal
580
+ in the Software without restriction, including without limitation the rights
581
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
582
+ copies of the Software, and to permit persons to whom the Software is
583
+ furnished to do so, subject to the following conditions:
584
+
585
+ The above copyright notice and this permission notice shall be included in
586
+ all copies or substantial portions of the Software.
587
+
588
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
589
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
590
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
591
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
592
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
593
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
594
+ THE SOFTWARE.
595
+
479
596
  ==============================================================================
480
597
  style-mod 4.1.3 — MIT
481
598
 
@@ -499,6 +616,236 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
499
616
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
500
617
  THE SOFTWARE.
501
618
 
619
+ ==============================================================================
620
+ sucrase 3.35.1 — MIT
621
+
622
+ The MIT License (MIT)
623
+
624
+ Copyright (c) 2012-2018 various contributors (see AUTHORS)
625
+
626
+ Permission is hereby granted, free of charge, to any person obtaining a copy
627
+ of this software and associated documentation files (the "Software"), to deal
628
+ in the Software without restriction, including without limitation the rights
629
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
630
+ copies of the Software, and to permit persons to whom the Software is
631
+ furnished to do so, subject to the following conditions:
632
+
633
+ The above copyright notice and this permission notice shall be included in all
634
+ copies or substantial portions of the Software.
635
+
636
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
637
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
638
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
639
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
640
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
641
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
642
+ SOFTWARE.
643
+
644
+ ==============================================================================
645
+ ts-interface-checker 0.1.13 — Apache-2.0
646
+
647
+ Apache License
648
+ Version 2.0, January 2004
649
+ http://www.apache.org/licenses/
650
+
651
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
652
+
653
+ 1. Definitions.
654
+
655
+ "License" shall mean the terms and conditions for use, reproduction,
656
+ and distribution as defined by Sections 1 through 9 of this document.
657
+
658
+ "Licensor" shall mean the copyright owner or entity authorized by
659
+ the copyright owner that is granting the License.
660
+
661
+ "Legal Entity" shall mean the union of the acting entity and all
662
+ other entities that control, are controlled by, or are under common
663
+ control with that entity. For the purposes of this definition,
664
+ "control" means (i) the power, direct or indirect, to cause the
665
+ direction or management of such entity, whether by contract or
666
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
667
+ outstanding shares, or (iii) beneficial ownership of such entity.
668
+
669
+ "You" (or "Your") shall mean an individual or Legal Entity
670
+ exercising permissions granted by this License.
671
+
672
+ "Source" form shall mean the preferred form for making modifications,
673
+ including but not limited to software source code, documentation
674
+ source, and configuration files.
675
+
676
+ "Object" form shall mean any form resulting from mechanical
677
+ transformation or translation of a Source form, including but
678
+ not limited to compiled object code, generated documentation,
679
+ and conversions to other media types.
680
+
681
+ "Work" shall mean the work of authorship, whether in Source or
682
+ Object form, made available under the License, as indicated by a
683
+ copyright notice that is included in or attached to the work
684
+ (an example is provided in the Appendix below).
685
+
686
+ "Derivative Works" shall mean any work, whether in Source or Object
687
+ form, that is based on (or derived from) the Work and for which the
688
+ editorial revisions, annotations, elaborations, or other modifications
689
+ represent, as a whole, an original work of authorship. For the purposes
690
+ of this License, Derivative Works shall not include works that remain
691
+ separable from, or merely link (or bind by name) to the interfaces of,
692
+ the Work and Derivative Works thereof.
693
+
694
+ "Contribution" shall mean any work of authorship, including
695
+ the original version of the Work and any modifications or additions
696
+ to that Work or Derivative Works thereof, that is intentionally
697
+ submitted to Licensor for inclusion in the Work by the copyright owner
698
+ or by an individual or Legal Entity authorized to submit on behalf of
699
+ the copyright owner. For the purposes of this definition, "submitted"
700
+ means any form of electronic, verbal, or written communication sent
701
+ to the Licensor or its representatives, including but not limited to
702
+ communication on electronic mailing lists, source code control systems,
703
+ and issue tracking systems that are managed by, or on behalf of, the
704
+ Licensor for the purpose of discussing and improving the Work, but
705
+ excluding communication that is conspicuously marked or otherwise
706
+ designated in writing by the copyright owner as "Not a Contribution."
707
+
708
+ "Contributor" shall mean Licensor and any individual or Legal Entity
709
+ on behalf of whom a Contribution has been received by Licensor and
710
+ subsequently incorporated within the Work.
711
+
712
+ 2. Grant of Copyright License. Subject to the terms and conditions of
713
+ this License, each Contributor hereby grants to You a perpetual,
714
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
715
+ copyright license to reproduce, prepare Derivative Works of,
716
+ publicly display, publicly perform, sublicense, and distribute the
717
+ Work and such Derivative Works in Source or Object form.
718
+
719
+ 3. Grant of Patent License. Subject to the terms and conditions of
720
+ this License, each Contributor hereby grants to You a perpetual,
721
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
722
+ (except as stated in this section) patent license to make, have made,
723
+ use, offer to sell, sell, import, and otherwise transfer the Work,
724
+ where such license applies only to those patent claims licensable
725
+ by such Contributor that are necessarily infringed by their
726
+ Contribution(s) alone or by combination of their Contribution(s)
727
+ with the Work to which such Contribution(s) was submitted. If You
728
+ institute patent litigation against any entity (including a
729
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
730
+ or a Contribution incorporated within the Work constitutes direct
731
+ or contributory patent infringement, then any patent licenses
732
+ granted to You under this License for that Work shall terminate
733
+ as of the date such litigation is filed.
734
+
735
+ 4. Redistribution. You may reproduce and distribute copies of the
736
+ Work or Derivative Works thereof in any medium, with or without
737
+ modifications, and in Source or Object form, provided that You
738
+ meet the following conditions:
739
+
740
+ (a) You must give any other recipients of the Work or
741
+ Derivative Works a copy of this License; and
742
+
743
+ (b) You must cause any modified files to carry prominent notices
744
+ stating that You changed the files; and
745
+
746
+ (c) You must retain, in the Source form of any Derivative Works
747
+ that You distribute, all copyright, patent, trademark, and
748
+ attribution notices from the Source form of the Work,
749
+ excluding those notices that do not pertain to any part of
750
+ the Derivative Works; and
751
+
752
+ (d) If the Work includes a "NOTICE" text file as part of its
753
+ distribution, then any Derivative Works that You distribute must
754
+ include a readable copy of the attribution notices contained
755
+ within such NOTICE file, excluding those notices that do not
756
+ pertain to any part of the Derivative Works, in at least one
757
+ of the following places: within a NOTICE text file distributed
758
+ as part of the Derivative Works; within the Source form or
759
+ documentation, if provided along with the Derivative Works; or,
760
+ within a display generated by the Derivative Works, if and
761
+ wherever such third-party notices normally appear. The contents
762
+ of the NOTICE file are for informational purposes only and
763
+ do not modify the License. You may add Your own attribution
764
+ notices within Derivative Works that You distribute, alongside
765
+ or as an addendum to the NOTICE text from the Work, provided
766
+ that such additional attribution notices cannot be construed
767
+ as modifying the License.
768
+
769
+ You may add Your own copyright statement to Your modifications and
770
+ may provide additional or different license terms and conditions
771
+ for use, reproduction, or distribution of Your modifications, or
772
+ for any such Derivative Works as a whole, provided Your use,
773
+ reproduction, and distribution of the Work otherwise complies with
774
+ the conditions stated in this License.
775
+
776
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
777
+ any Contribution intentionally submitted for inclusion in the Work
778
+ by You to the Licensor shall be under the terms and conditions of
779
+ this License, without any additional terms or conditions.
780
+ Notwithstanding the above, nothing herein shall supersede or modify
781
+ the terms of any separate license agreement you may have executed
782
+ with Licensor regarding such Contributions.
783
+
784
+ 6. Trademarks. This License does not grant permission to use the trade
785
+ names, trademarks, service marks, or product names of the Licensor,
786
+ except as required for reasonable and customary use in describing the
787
+ origin of the Work and reproducing the content of the NOTICE file.
788
+
789
+ 7. Disclaimer of Warranty. Unless required by applicable law or
790
+ agreed to in writing, Licensor provides the Work (and each
791
+ Contributor provides its Contributions) on an "AS IS" BASIS,
792
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
793
+ implied, including, without limitation, any warranties or conditions
794
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
795
+ PARTICULAR PURPOSE. You are solely responsible for determining the
796
+ appropriateness of using or redistributing the Work and assume any
797
+ risks associated with Your exercise of permissions under this License.
798
+
799
+ 8. Limitation of Liability. In no event and under no legal theory,
800
+ whether in tort (including negligence), contract, or otherwise,
801
+ unless required by applicable law (such as deliberate and grossly
802
+ negligent acts) or agreed to in writing, shall any Contributor be
803
+ liable to You for damages, including any direct, indirect, special,
804
+ incidental, or consequential damages of any character arising as a
805
+ result of this License or out of the use or inability to use the
806
+ Work (including but not limited to damages for loss of goodwill,
807
+ work stoppage, computer failure or malfunction, or any and all
808
+ other commercial damages or losses), even if such Contributor
809
+ has been advised of the possibility of such damages.
810
+
811
+ 9. Accepting Warranty or Additional Liability. While redistributing
812
+ the Work or Derivative Works thereof, You may choose to offer,
813
+ and charge a fee for, acceptance of support, warranty, indemnity,
814
+ or other liability obligations and/or rights consistent with this
815
+ License. However, in accepting such obligations, You may act only
816
+ on Your own behalf and on Your sole responsibility, not on behalf
817
+ of any other Contributor, and only if You agree to indemnify,
818
+ defend, and hold each Contributor harmless for any liability
819
+ incurred by, or claims asserted against, such Contributor by reason
820
+ of your accepting any such warranty or additional liability.
821
+
822
+ END OF TERMS AND CONDITIONS
823
+
824
+ APPENDIX: How to apply the Apache License to your work.
825
+
826
+ To apply the Apache License to your work, attach the following
827
+ boilerplate notice, with the fields enclosed by brackets "{}"
828
+ replaced with your own identifying information. (Don't include
829
+ the brackets!) The text should be enclosed in the appropriate
830
+ comment syntax for the file format. We also recommend that a
831
+ file or class name and description of purpose be included on the
832
+ same "printed page" as the copyright notice for easier
833
+ identification within third-party archives.
834
+
835
+ Copyright {yyyy} {name of copyright owner}
836
+
837
+ Licensed under the Apache License, Version 2.0 (the "License");
838
+ you may not use this file except in compliance with the License.
839
+ You may obtain a copy of the License at
840
+
841
+ http://www.apache.org/licenses/LICENSE-2.0
842
+
843
+ Unless required by applicable law or agreed to in writing, software
844
+ distributed under the License is distributed on an "AS IS" BASIS,
845
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
846
+ See the License for the specific language governing permissions and
847
+ limitations under the License.
848
+
502
849
  ==============================================================================
503
850
  w3c-keyname 2.2.8 — MIT
504
851
 
package/dist/cdn.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! code-playpad 0.5.1: CDN entry, loads dist/standalone.js of this exact version */
2
- export * from "https://cdn.jsdelivr.net/npm/code-playpad@0.5.1/dist/standalone.js";
1
+ /*! code-playpad 0.5.2: CDN entry, loads dist/standalone.js of this exact version */
2
+ export * from "https://cdn.jsdelivr.net/npm/code-playpad@0.5.2/dist/standalone.js";
@@ -0,0 +1,6 @@
1
+ /*!
2
+ * code-playpad — MIT © 2026 Seung Hun Lee
3
+ * Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
4
+ * Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
5
+ */
6
+ var e=`314.0.5`,t=`https://cdn.jsdelivr.net/pyodide/v${e}/full/`,n=null;function r(e){t=e.indexURL.endsWith(`/`)?e.indexURL:e.indexURL+`/`}function i(e){n=e.sucraseURL}function a(){return t}function o(){return n}function s(){return[{url:t+`pyodide.js`,as:`script`},{url:t+`pyodide.asm.wasm`,as:`fetch`},{url:t+`python_stdlib.zip`,as:`fetch`}]}export{o as a,a as i,r as n,s as o,i as r,e as t};
@@ -1,4 +1,4 @@
1
- async function e(e){try{return await t(e)}catch(t){return console.warn(`[code-playpad] CodeMirror unavailable, using plain textarea:`,t),n(e)}}async function t(e){let[t,n,r,i,a,o]=await Promise.all([import(`@codemirror/view`),import(`@codemirror/state`),import(`@codemirror/commands`),import(`@codemirror/language`),import(`@codemirror/autocomplete`),import(`@codemirror/theme-one-dark`)]),{EditorView:s,keymap:c,lineNumbers:l,highlightActiveLine:u,highlightActiveLineGutter:d,highlightSpecialChars:f,drawSelection:p,rectangularSelection:m,crosshairCursor:h}=t,{EditorState:g,Compartment:_}=n,{defaultKeymap:v,history:y,historyKeymap:b,indentWithTab:x}=r,{syntaxHighlighting:S,defaultHighlightStyle:C,indentOnInput:w,bracketMatching:T,foldGutter:E,foldKeymap:D}=i,{autocompletion:O,closeBrackets:k,closeBracketsKeymap:A,completionKeymap:j}=a,M=new _,N=new _,P=new _,F=[s.theme({"&":{color:`#1f2328`,backgroundColor:`#ffffff`},".cm-gutters":{backgroundColor:`#f6f8fa`,color:`#8b949e`,border:`none`},".cm-activeLine":{backgroundColor:`#f6f8fa88`},".cm-activeLineGutter":{backgroundColor:`#eaeef2`},".cm-cursor":{borderLeftColor:`#1f2328`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`#cfe3ff`}}),S(C,{fallback:!0})],I=e=>e?o.oneDark:F,L=c.of([{key:`Mod-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)},{key:`Shift-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)}]),R=e.dark,z=e.readOnly,B=e.language??[],V=t=>g.create({doc:t,extensions:[l(),d(),f(),y(),E(),p(),g.allowMultipleSelections.of(!0),w(),T(),k(),O(),m(),h(),u(),L,c.of([...A,...v,...b,...D,...j,x]),s.lineWrapping,P.of(B),M.of(I(R)),N.of(g.readOnly.of(z)),s.updateListener.of(t=>{t.docChanged&&e.onChange?.(t.state.doc.toString())})]}),H=new s({parent:e.parent,state:V(e.doc)}),U=new Map,W=e.name??``;return{fallback:!1,getCode:()=>H.state.doc.toString(),setCode(e){H.dispatch({changes:{from:0,to:H.state.doc.length,insert:e}})},openFile(e,t){if(e===W)return;U.set(W,H.state);let n=U.get(e);H.setState(n??V(t)),W=e,n&&H.dispatch({effects:[M.reconfigure(I(R)),N.reconfigure(g.readOnly.of(z)),P.reconfigure(B)]})},fileCode(e,t){if(e===W)return H.state.doc.toString();let n=U.get(e);return n?n.doc.toString():t},forgetFiles(e){for(let t of[...U.keys()])e.includes(t)||U.delete(t)},setTheme(e){R=e,H.dispatch({effects:M.reconfigure(I(R))})},setReadOnly(e){z=e,H.dispatch({effects:N.reconfigure(g.readOnly.of(z))})},setLanguage(e){B=e,H.dispatch({effects:P.reconfigure(B)})},focus:()=>H.focus(),destroy:()=>H.destroy()}}function n(e){let t=document.createElement(`textarea`);t.className=`cp-fallback-editor`,t.spellcheck=!1,t.value=e.doc,t.readOnly=e.readOnly,t.addEventListener(`input`,()=>e.onChange?.(t.value)),t.addEventListener(`keydown`,t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),e.onRun?.())}),e.parent.appendChild(t);let n=new Map,r=e.name??``;return{fallback:!0,getCode:()=>t.value,setCode:e=>{t.value=e},openFile(e,i){e!==r&&(n.set(r,t.value),t.value=n.get(e)??i,r=e)},fileCode(e,i){return e===r?t.value:n.get(e)??i},forgetFiles(e){for(let t of[...n.keys()])e.includes(t)||n.delete(t)},setTheme:()=>{},setReadOnly:e=>{t.readOnly=e},setLanguage:()=>{},focus:()=>t.focus(),destroy:()=>t.remove()}}var r=new Map,i=new Map;function a(e,t){r.set(e,t)}function o(){return[...r.keys()]}function s(e){let t=i.get(e);if(t)return t;let n=r.get(e);if(!n)return Promise.reject(Error(`Unknown runtime "${e}". Registered: ${o().join(`, `)||`none`}`));let a=n().catch(t=>{throw i.delete(e),t});return i.set(e,a),a}a(`python`,()=>import(`./pyodide-FRnMyCht.js`).then(e=>e.pythonRuntime)),a(`javascript`,()=>import(`./javascript-BiwxX4vc.js`).then(e=>e.javascriptRuntime)),a(`typescript`,()=>import(`./javascript-BiwxX4vc.js`).then(e=>e.typescriptRuntime)),a(`java`,()=>import(`./java-Dd7T9rVc.js`).then(e=>e.javaRuntime));var c=class extends Error{constructor(e=`Execution stopped`){super(e),this.name=`RunStopped`}},l=class extends Error{constructor(e=`Web Workers are unavailable in this page`){super(e),this.name=`WorkerUnavailable`}},u=new WeakSet,d=String.raw`
1
+ async function e(e){try{return await t(e)}catch(t){return console.warn(`[code-playpad] CodeMirror unavailable, using plain textarea:`,t),n(e)}}async function t(e){let[t,n,r,i,a,o]=await Promise.all([import(`@codemirror/view`),import(`@codemirror/state`),import(`@codemirror/commands`),import(`@codemirror/language`),import(`@codemirror/autocomplete`),import(`@codemirror/theme-one-dark`)]),{EditorView:s,keymap:c,lineNumbers:l,highlightActiveLine:u,highlightActiveLineGutter:d,highlightSpecialChars:f,drawSelection:p,rectangularSelection:m,crosshairCursor:h}=t,{EditorState:g,Compartment:_}=n,{defaultKeymap:v,history:y,historyKeymap:b,indentWithTab:x}=r,{syntaxHighlighting:S,defaultHighlightStyle:C,indentOnInput:w,bracketMatching:T,foldGutter:E,foldKeymap:D}=i,{autocompletion:O,closeBrackets:k,closeBracketsKeymap:A,completionKeymap:j}=a,M=new _,N=new _,P=new _,F=[s.theme({"&":{color:`#1f2328`,backgroundColor:`#ffffff`},".cm-gutters":{backgroundColor:`#f6f8fa`,color:`#8b949e`,border:`none`},".cm-activeLine":{backgroundColor:`#f6f8fa88`},".cm-activeLineGutter":{backgroundColor:`#eaeef2`},".cm-cursor":{borderLeftColor:`#1f2328`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:`#cfe3ff`}}),S(C,{fallback:!0})],I=e=>e?o.oneDark:F,L=c.of([{key:`Mod-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)},{key:`Shift-Enter`,preventDefault:!0,run:()=>(e.onRun?.(),!0)}]),R=e.dark,z=e.readOnly,B=e.language??[],V=t=>g.create({doc:t,extensions:[l(),d(),f(),y(),E(),p(),g.allowMultipleSelections.of(!0),w(),T(),k(),O(),m(),h(),u(),L,c.of([...A,...v,...b,...D,...j,x]),s.lineWrapping,P.of(B),M.of(I(R)),N.of(g.readOnly.of(z)),s.updateListener.of(t=>{t.docChanged&&e.onChange?.(t.state.doc.toString())})]}),H=new s({parent:e.parent,state:V(e.doc)}),U=new Map,W=e.name??``;return{fallback:!1,getCode:()=>H.state.doc.toString(),setCode(e){H.dispatch({changes:{from:0,to:H.state.doc.length,insert:e}})},openFile(e,t){if(e===W)return;U.set(W,H.state);let n=U.get(e);H.setState(n??V(t)),W=e,n&&H.dispatch({effects:[M.reconfigure(I(R)),N.reconfigure(g.readOnly.of(z)),P.reconfigure(B)]})},fileCode(e,t){if(e===W)return H.state.doc.toString();let n=U.get(e);return n?n.doc.toString():t},forgetFiles(e){for(let t of[...U.keys()])e.includes(t)||U.delete(t)},setTheme(e){R=e,H.dispatch({effects:M.reconfigure(I(R))})},setReadOnly(e){z=e,H.dispatch({effects:N.reconfigure(g.readOnly.of(z))})},setLanguage(e){B=e,H.dispatch({effects:P.reconfigure(B)})},focus:()=>H.focus(),destroy:()=>H.destroy()}}function n(e){let t=document.createElement(`textarea`);t.className=`cp-fallback-editor`,t.spellcheck=!1,t.value=e.doc,t.readOnly=e.readOnly,t.addEventListener(`input`,()=>e.onChange?.(t.value)),t.addEventListener(`keydown`,t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),e.onRun?.())}),e.parent.appendChild(t);let n=new Map,r=e.name??``;return{fallback:!0,getCode:()=>t.value,setCode:e=>{t.value=e},openFile(e,i){e!==r&&(n.set(r,t.value),t.value=n.get(e)??i,r=e)},fileCode(e,i){return e===r?t.value:n.get(e)??i},forgetFiles(e){for(let t of[...n.keys()])e.includes(t)||n.delete(t)},setTheme:()=>{},setReadOnly:e=>{t.readOnly=e},setLanguage:()=>{},focus:()=>t.focus(),destroy:()=>t.remove()}}var r=new Map,i=new Map;function a(e,t){r.set(e,t)}function o(){return[...r.keys()]}function s(e){let t=i.get(e);if(t)return t;let n=r.get(e);if(!n)return Promise.reject(Error(`Unknown runtime "${e}". Registered: ${o().join(`, `)||`none`}`));let a=n().catch(t=>{throw i.delete(e),t});return i.set(e,a),a}a(`python`,()=>import(`./pyodide-DSeVedct.js`).then(e=>e.pythonRuntime)),a(`javascript`,()=>import(`./javascript-DeH32mx7.js`).then(e=>e.javascriptRuntime)),a(`typescript`,()=>import(`./javascript-DeH32mx7.js`).then(e=>e.typescriptRuntime)),a(`java`,()=>import(`./java-ZNMW01Qb.js`).then(e=>e.javaRuntime));var c=class extends Error{constructor(e=`Execution stopped`){super(e),this.name=`RunStopped`}},l=class extends Error{constructor(e=`Web Workers are unavailable in this page`){super(e),this.name=`WorkerUnavailable`}},u=new WeakSet,d=String.raw`
2
2
  :host {
3
3
  --cp-bg: #ffffff;
4
4
  --cp-fg: #1f2328;
package/dist/element.js CHANGED
@@ -1 +1 @@
1
- import{n as e,t}from"./element-CthH7rm5.js";export{t as CodePlayPadElement,e as defineCodePlayPad};
1
+ import{n as e,t}from"./element-Bb_ST7mq.js";export{t as CodePlayPadElement,e as defineCodePlayPad};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t,d as n,f as r,h as i,i as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./element-CthH7rm5.js";import{n as m,o as h,r as g,t as _}from"./config-DZqcFPEP.js";export{f as CodePlayPadElement,_ as PYODIDE_VERSION,p as RunStopped,n as WorkerUnavailable,u as allProgress,a as clearSnippet,m as configurePython,g as configureTypeScript,i as createEditor,s as defineCodePlayPad,e as getProgress,r as getRuntime,l as listRuntimes,c as loadSnippet,h as pyodideAssetUrls,o as registerRuntime,d as saveSnippet,t as setProgress};
1
+ import{a as e,c as t,d as n,f as r,h as i,i as a,m as o,n as s,o as c,p as l,r as u,s as d,t as f,u as p}from"./element-Bb_ST7mq.js";import{n as m,o as h,r as g,t as _}from"./config-D9w0xYhX.js";export{f as CodePlayPadElement,_ as PYODIDE_VERSION,p as RunStopped,n as WorkerUnavailable,u as allProgress,a as clearSnippet,m as configurePython,g as configureTypeScript,i as createEditor,s as defineCodePlayPad,e as getProgress,r as getRuntime,l as listRuntimes,c as loadSnippet,h as pyodideAssetUrls,o as registerRuntime,d as saveSnippet,t as setProgress};