feat: add @studiometa/playground-preview web component package#53
Merged
titouanmathis merged 5 commits intomainfrom Mar 10, 2026
Merged
feat: add @studiometa/playground-preview web component package#53titouanmathis merged 5 commits intomainfrom
@studiometa/playground-preview web component package#53titouanmathis merged 5 commits intomainfrom
Conversation
Export SizeUnchanged@studiometa/playground
|
Deploying studiometa-playground with
|
| Latest commit: |
cebf293
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7ce9cd25.studiometa-playground.pages.dev |
| Branch Preview URL: | https://feature-playground-preview-w.studiometa-playground.pages.dev |
734ff0a to
52f87e3
Compare
This reverts commit 52f87e3.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53 +/- ##
==========================================
+ Coverage 3.76% 14.85% +11.09%
==========================================
Files 48 53 +5
Lines 717 902 +185
Branches 116 151 +35
==========================================
+ Hits 27 134 +107
- Misses 689 755 +66
- Partials 1 13 +12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- zip.test.ts: roundtrip compression, empty string, multiline, unicode - playground-preview.test.ts: content resolution, rendering, shadow DOM, controls visibility, attribute reactivity, lazy loading, cleanup - vitest.config.ts: add playground-preview project with happy-dom env Co-authored-by: Claude <claude@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a new
@studiometa/playground-previewpackage that provides a<playground-preview>custom element to embed playground previews anywhere — framework-agnostic, zero configuration, zero runtime dependencies.Closes #52
What's included
New package:
packages/playground-preview/A lightweight (~10KB gzipped, zero runtime dependencies —
fflateis bundled in) web component that:html,script,cssattributes<script type="playground/...">children (takes precedence)IntersectionObserver(100px root margin)dark,light, orauto(followsprefers-color-scheme)--pg-bg,--pg-controls-bg, etc.)https://studiometa-playground.pages.devTwo entry points
Usage example
Key design decisions
@studiometa/playground, so consumers don't pull heavy deps (esbuild-wasm, Monaco, webpack-config, etc.) just for an embed widgetfflatebundled into the dist (not an external dependency) so the package is fully self-contained and works with a plain<script type="module">tag — no bundler required<script type="playground/...">children for long content — the browser treats unknown script types as inert (no parsing, no execution), making it the most robust option for arbitrary codeChecklist
package.json,tsconfig.json, build scripts)PlaygroundPreviewcustom element implementationIntersectionObserverlazy loading<script type="playground/...">child content supportpackages/*glob)