All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
0.21.2 - 2025-10-02
- Only fire change event on non-programmatic changes
- Make
tabchangeevent bubble.
0.21.1 - 2025-09-26
- Fixed missing
codemirror-extension-mixin.jsfile.
0.21.0 - 2025-09-23
- POTENTIALLY BREAKING Upgraded CodeMirror to v6
- Added
extensionsproperty to<playground-ide>,<playground-file-editor>, and<playground-code-editor>for applying programmatic CodeMirror extensions. - Added an
extensionsslot to<playground-ide>,<playground-file-editor>, and<playground-code-editor>for applying declarative CodeMirror extensions. - Exported
codemirrorExtensionMixinfor creating declarative CodeMirror extensions.
- Safari cursor issues
- Cursor selection and visiblity was broken in Safari
- Fixed by updating to Codemirror 6
0.20.0 - 2025-03-31
- Implement
cdnBaseUrlproperty to allow changing the underlying npm CDN base url. See README for more information.
- Make playground-elements more resilient to 404's from the CDN by not throwing errors when they occur. Instead, log a warning and continue to load the rest of the project.
0.19.1 - 2024-08-19
- Fix broken import of typescript.js module
0.19.0 - 2024-08-19
- Upgraded to TypeScript 5.2 and Lit 3.0
- BREAKING Use modules in workers. See caniuse.com's support table for browser support information.
- Updated
comlink,fuse.js, andtslibdependencies.
0.18.1 - 2023-08-10
- Fix tab-to-spaces conversion in the code editor which was resulting in one less space being produced on tab than desired.
0.18.0 - 2023-05-25
- BREAKING Update bundled version of TypeScript from
4.8.4to5.0.4. See TypeScript 5 breaking changes.
0.17.1 - 2023-04-25
- Fetch all
@typespackages listed in the project'spackage.jsonfile and include them for TypeScript compilation. This allows type-checking packages that do not ship their own types but do have a DefinitelyTyped package available. Note: This does not automatically download the@typespackage for a package. It must be manually listed inpackage.json.
0.17.0 - 2022-11-11
- Replaced
vscode-languageserverdependency with smallervscode-languageserver-protocol. - TypeScript version upgraded from
4.4.4to4.8.4. PlaygroundConnectedElementprojectis now permitted to beundefinedaccording to TypeScript.- Upgrade
codemirrorfrom5.63.0to5.65.9. - BREAKING Switched TypeScript
moduleResolutionfromesnexttonodenext. - BREAKING Bumped TypeScript
targetfromes2017toes2021. - BREAKING The local
package.jsonis now passed to TypeScript for compilation, and the default value of thetypefield is modified tomodule.
0.16.3 - 2022-08-02
- Added styntax highlighting for
jsxandtsxmodules.
0.16.2 - 2022-06-16
- Added support for compiling
jsxandtsxmodules.
0.16.1 - 2022-05-17
- Upgraded MWC dependencies.
0.16.0 - 2022-05-11
- BREAKING Added
browserto the set of export conditions used during module resolution.
0.15.5 - 2022-05-06
- Added
lineWrappingproperty (line-wrappingattribute) to<playground-code-editor>,<playground-file-editor>and<playground-ide>which when enabled wraps long lines, otherwise the editor will scroll. Off by default.
- Fix typo in README. Add missing forward slash in escaped script tag.
0.15.4 - 2022-04-05
- Add the ability to select a file by setting
selected: truein a project config, or by setting theselectedattribute on slotted children.
0.15.3 - 2022-03-29
-
Fixed the hiding of comments that surround a fold/hide code block from creating invisible readonly regions.
-
Refactored fold/hide marker logic so it doesn't add document history when clearing the prior fold/hide markers.
-
Fix typo and incorrectly documented event name in README.
changedevent should instead bechange.
0.15.2 - 2022-03-24
-
Make hidden code blocks readonly to prevent accidental erasure.
-
Added
Ctrl+/orCmd+/hotkey for toggling line comments. -
Added keyboard shortcut documentation to the playground-code-editor README.
0.15.1 - 2022-03-16
- playground-preview now exposes the internal iframe via the
iframeproperty.
0.15.0 - 2022-03-07
- Added
noCompletionsproperty documentation to README.
- Normalize content-type response header to lowercase when matching filetypes.
0.15.0-pre.5 - 2022-02-23
- More mobile friendly completion items via media query
-
Pressing ESC to close completions menu doesn't de-focus the code-editor
-
Word wrapping on long completion item details doesn't extend to multiple lines
-
Elevation on completion items list matches other elevations on project
0.15.0-pre.4 - 2022-02-17
- Added
Ctrl-Spacehotkey for triggering interactive code completions.
0.15.0-pre.3 - 2022-02-16
- Fixed syntax highlighting and code folding regressions introduced when using
documentKey.
0.15.0-pre.2 - 2022-02-15
-
Added
documentKeyproperty to<playground-code-editor>which is used to keep track of individual CodeMirror document instances internally. Default behavior without setting adocumentKeyis unchanged.Use
documentKeyfor fine control over the CodeMirror document instance. For example, to model changing a file.
-
Fixed undo history applying across files (#154).
Previously all files shared the same document instance resulting in files sharing undo/redo history. Now each file has its own isolated internal document instance.
-
Fixed only a single closing script tag unescaping in html files using playground-ide (#251).
0.15.0-pre.1 - 2022-02-04
-
Added interactive code completions for TypeScript files (#243).
Completions can be disabled by setting the
no-completionsattribute on<playground-ide>,<playground-file-editor>, or<playground-code-editor> components.
0.14.8 - 2022-01-25
- Added
html-fileattribute (htmlFileproperty) toplayground-previewandplayground-idewhich allows configuring the project HTML file which should be displayed in the preview. Defaults toindex.html(which was previously the only possible value)
- Remove nbsp characters from README.
0.14.7 - 2021-12-07
- Fixed missing
aria-labelattributes on the reload button, file context menu button, and new file button
0.14.6 - 2021-10-18
- Fixed bug where files could not be deleted or renamed using MWC v0.25.2 or above.
0.14.5 - 2021-10-07
- Upgraded
es-module-lexerdependency to bring in fix for guybedford/es-module-lexer#92.
0.14.4 - 2021-10-06
- Fixed positioning of overlay that displays over previews when service workers are not available so that it is constrained to the preview, rather than the nearest containing positioned ancestor.
0.14.3 - 2021-10-06
-
Added an overlay that will display over the preview when we detect that service workers are not available. One reason this can happen is using Playground in Firefox private browsing mode, which does not support service workers (https://bugzilla.mozilla.org/show_bug.cgi?id=1320796).
-
Added
cursorPosition,cursorIndex, andtokenUnderCursorgetters to<playground-code-editor>.
- Upgraded dependencies, including CodeMirror.
-
Fixed a bottleneck that prevented previews from loading until semantic TypeScript errors were computed. This should significantly improve the latency between updating a file and the new preview loading.
-
Fixed bug where parent window history entries were added every time the preview reloaded.
-
Improvements to service worker version updates:
-
The service worker will require less frequent updates going forward. Previously it needed updating for every playground-elements release. Now it only needs updating if the bytes of the service worker have changed between releases.
-
The default service worker scope has changed from
<sandboxBaseUrl>/playground-projectto<sandboxBaseUrl>/__playground_swfs_<serviceWorkerHash>. This should make service worker updates more reliable because old and new versions of service workers will no longer be in contention to control the same URLs. -
Misc other small service worker robustness improvements, and additional logging to help debug future issues.
-
0.14.2 - 2021-09-30
- Updated bundled version of TypeScript to 4.4.3.
- Internal refactoring of language service.
0.14.1 - 2021-09-21
- GitHub org changed from PolymerLabs to google.
0.14.0 - 2021-09-20
- Upgrade to Lit 2.0.
- TypeScript files are now compiled incrementally for improved performance
- Fixed bug where the
valueproperty of a<playground-code-editor>did not take effect if set before element upgrade.
- It is now possible to set the
valueof a<playground-code-editor>using thevalueHTML attribute.
0.13.0 - 2021-09-14
-
Node package exports are now supported when resolving dependency modules.
The
module,import, anddevelopmentconditions are enabled.Note this change should not theoretically be BREAKING, but this release is versioned with a major increment because there a risk of breakage in practice due to misconfigured
package.jsonfiles, differences betweenprodanddevmodes, etc.
- Added
modifiedproperty to<playground-project>and<playground-ide>which indicates whether the user has modified, added, or removed any project files. Resets whenever a new project is loaded.
0.12.1 - 2021-08-26
- If a file is marked
hidden, and the user creates a new file by that name, the file will become visible and editable.
0.12.0 - 2021-08-17
-
Fixes duplicate module errors by canonicalizing all import specifiers. Import specifiers are now canonicalized by version number and default module. This applies both to local project files, and throughout the entire external dependency tree.
-
Import maps now apply to modules in external dependencies, not just to local project files.
-
The TypeScript compiler can now deal with multiple versions of the same dependency. Previously, if the import graph included two versions of the same package, only one arbitrary version of the types would be compiled. This caused various errors and missing type issues.
-
If the project contains a
package.jsonfile, then itsdependenciesfield will be used to determine the version of dependencies (just like how NPM works locally). -
Dependencies are now served from the special "/node_modules/..." path, instead of directly from
https://unpkg.com/...?moduleURLs. Behind-the-scenes, dependencies are still fetched from unpkg, but they are now themselves transformed to ensure correct specifier canonicalization. -
BREAKING Due to large changes to the way dependencies are handled, there is some risk of breakage due to subtle behavior changes that existing configurations may be relying on. Therefore, this release is versioned with a major increment.
0.11.1 - 2021-08-09
- Added MIME-type detection for the following project file extensions:
gif,ico,jpeg,jpg,mid,midi,mp3,png,svg,weba,webm,webp.
0.11.0 - 2021-07-28
-
Playgrounds now ensure that the service worker they are connected to have a matching version. Fixes issues relating to playgrounds being broken for some time after an upgrade.
-
The
--playground-tab-bar-font-sizeCSS custom property now behaves as documented, and defaults to14px. -
The
--playground-floating-controls-colorCSS custom property now behaves as documented. -
Fix missing
.jsextension from import inbuild.jsthat may have broken Webpack and other builds. -
The hover effect and touch area for tabs in the tab bar are no longer offset by the height of the active tab indicator.
-
Fix bug that caused failures to load
d.tsfiles and "Could not resolve module specifier" console errors when using import maps.
-
BREAKING
playground-base-urlis now resolved relative to theimport.meta.urlof the module containing the definition of<playground-project>, instead of relative todocument.location.hrefas before. This means that.can now be used to refer to the local playground installation directory. -
The service worker now sets the
Origin-Agent-Cluster: ?1heading on all responses, to encourage browsers to allocate a separate process or thread for Playground preview iframe under certain conditions. See the Process isolation section of the README for more details. -
It is now possible to change the
font-familyof the tab-bar using a::part(tab-bar)selector.
0.10.1 - 2021-07-14
- Bumped MWC dependency versions.
0.10.0 - 2021-07-01
-
Adds
--playground-code-paddingand--playground-code-line-paddingfor configuring code editor padding. -
Bare module specifiers are now transformed in dynamic
import()statements.
-
BREAKING The
src/directory is no longer published to NPM. -
BREAKING
.jsfiles are no longer compiled by TypeScript, so they cannot contain types, decorators, or other TypeScript-specific syntax. -
Previews will now begin loading immediately, instead of waiting for compilation to completely finish, and each
.jsfile is served as it compiles.
- Query parameters are now ignored when serving files from the virtual file system.
0.9.4 - 2021-05-18
- Fixed timeouts when using the default
unpkg.comservice worker origin, caused bycomlinkversions being out-of-sync between local components and remote service worker.
- Added
readonlyproperty to<playground-file-editor>.
0.9.3 - 2021-05-05
- Error tooltips now follow
--playground-code-font-family. - Optimized the UX for fast compile and display by switching to a leading edge debouncer and eliminating the minimum display time for the loading bar.
0.9.2 - 2021-04-26
- Playground now executes code on the unpkg.com origin by default, meaning user
code execution is now sandboxed by default. The sandbox URL can still be
changed with the
sandboxBaseUrlproperty orsandbox-base-urlattribute, though it is highly advisable to always use a separate and unprivileged origin.
0.9.1 - 2021-04-19
- Tab key now inserts 2 spaces instead of a tab character.
- Fixed missing vertical scrollbars.
- Fixed transparent region between horizontal and vertical scrollbars.
0.9.0 - 2021-04-13
-
Focusing the editor using the Tab key no longer activates edit mode immediately. This prevents the Tab key from being trapped, which was an accessibility problem for keyboard users.
Instead, when the editor is focused, users can now press Enter to begin editing, and Escape to stop editing. A prompt is displayed with these instructions when focused. Focusing the editor with a mouse click continues to activate edit mode immediately, as before.
-
The editor now uses the CodeMirror
contenteditableinput style, which has much better screen reader support. -
Line numbers are now annotated with
aria-hiddenso that they are not voiced by screen readers. -
Increased default
line-heightfromnormalto1.4em. -
Added a default
padding-leftof1em. -
Increased width of cursor from
1pxto2px. -
Increased default tab
font-sizefrom0.75remto0.8em; -
Increased default
--playground-bar-heightfrom35pxto `40px. -
--playground-cursor-colornow defaults to the value of--playground-code-default-color. -
--playground-code-gutter-backgroundnow defaults to the value of--playground-code-background. -
--playground-code-gutter-margin-rightdefault changed from1px solid #dddtonone. -
--playground-code-linenumber-colordefault changed from#999to#767676.
-
Added
playground-styles.cssandplayground-styles.jswhich can be imported to apply Playground styles to server-side rendered code. -
Added
dialogCSS shadow part tocode-editor,file-editor, andidefor styling modal dialogs that appear over the editor (currently just used for the keyboard help that shows when the editor is focused using the keyboard). -
Added CSS custom properties:
--playground-code-line-height:line-heightof code in the editor.--playground-tab-bar-font-size:font-sizeof tabs in the file picker tab bar.--playground-tab-bar-active-color: Textcolorof active file-picker tab.--playground-tab-bar-indicator-color:colorof the active tab indicator line (usetransparentto hide).--playground-tab-bar-active-background:backgroundof the active file-picker tab.
-
Added
aria-labelattribute to reload, new file, and file context menu buttons. -
Added
titleattribute to preview<iframe>element. -
Added
aria-labelto the preview loading indicator, and setaria-hidden=truewhen the preview is not loading.
0.8.0 - 2021-04-02
- TypeScript type errors are now displayed inline. Previously, only syntax
errors were displayed. Type errors may take slightly longer to appear than
syntax errors, because they require fetching
.d.tsfiles and running a more expensive compiler pass.
- [BREAKING] Removed
--playground-error-borderproperty, and updated inline error style from a dashed border to a red squiggle.
0.7.0 - 2021-03-30
- [BREAKING] Replaced
filesgetter/setter on<playground-project>and<playground-ide>withconfiggetter/setter. This property has the same type as the JSON config, and can be used to save/restore the state of all files and other configuration.
- TypeScript errors of the form
Property '...' does not exist on typeandCannot find name '...'are now suppressed (temporarily untild.tsfiles are fetched).
0.6.6 - 2021-03-29
- Fixed missing
@types/codemirrordependency.
0.6.5 - 2021-03-29
- Fixed missing
lib/codemirror.jsfile in NPM package.
0.6.4 - 2021-03-29
-
TypeScript errors are now displayed in the editor with red underlines. A tooltip displaying the error is shown on hover.
- Note that only basic/syntactic errors are currently shown, because typings of dependencies are not currently available to compilation.
-
Added CSS property
--playground-error-border, theborder-bottomof code spans with an error (2px red dashedby default). -
Added CSS shadow part
diagnostic-tooltipfor styling the tooltip that appears when hovering over an error.
0.6.3 - 2021-03-24
-
Added optional
hiddenproperty/attribute which prevents a file from being displayed in the tab bar. -
Added support for JSON files with syntax highlighting.
-
Added
extendsproperty to JSON config file, an optional URL of another JSON config file to extend from. Useful for setting side-wide defaults.
-
Fixed bug where editor did not immediately switch to newly created files.
-
Fixed bug where
labelwas ignored in tab bar.
0.6.2 - 2021-03-02
- Added
contentandcontentTypeas optional properties of the JSON manifest.
- License headers shortened to concise SPDX style.
- Fixed infinite loop that could occur when switching between two files that both contain code folding/hiding regions.
0.6.1 - 2021-03-01
- Added
playground-hideandplayground-foldregion comments that hide and fold regions of a file, while still compiling and serving them, to help users focus on the relevant code. See https://github.com/google/playground-elements#hiding--folding for details.
0.6.0 - 2021-02-19
- [BREAKING] Leading whitespace that is common to all lines of slotted
<script>files will now be trimmed, along with empty leading/trailing lines. To disable this behavior, add thepreserve-whitespaceattribute.
- Added
--playground-floating-controls-colorto control the highlight color of buttons and text inputs in floating add/remove/rename file controls. Defaults tovar(--playground-highlight-color, #6200ee).
-
Playground can now be imported from Skypack.
-
Fix bugs where
--playground-tab-bar-backgroundand--playground-tab-bar-foreground-colordid not apply correctly.
0.5.0 - 2021-01-30
-
[BREAKING] When both
projectSrcandfilesare set, it is now the most recently set property that wins. Previously,filesalways won. -
<playground-preview>now auto-reloads after 300ms, previously 500ms.
<playground-project>now emits acompileStartandcompileDoneevent.
- [BREAKING]
<playground-project>no longer emits acontentChangedevent.
0.4.3 - 2021-01-21
-
Do not add
?moduleparameter to import map URLs for bare module specifiers, only to fallback unpkg.com URLs. -
Prevent
z-indexissues with CodeMirror scrollbars and other elements by using a separate stacking context.
<playground-preview>now has a default label (calledlocation) of"Result".
0.4.2 - 2021-01-21
-
Import maps are now supported. This allows customizing the URL that a bare module specifier resolves to, e.g. to a specific version, or to a different CDN.
Note that import maps currently only apply to the immediate imports of project source files, not to external transitive dependencies.
Also note
scopesare not yet supported, onlyimports.See https://github.com/WICG/import-maps and https://wicg.github.io/import-maps/ for more information on import maps.
Previously, all bare modules resolved to unpkg.com URLs at the latest version. This continues to be the fallback behavior if no import map is provided, or no entry in it matches.
To specify an import map in a JSON project manifest, add an
importMapproperty:{ "files": { "index.html": {}, "my-element.ts": {} }, "importMap": { "imports": { "lit-html": "https://unpkg.com/lit-html@next-major", "lit-html/": "https://unpkg.com/lit-html@next-major/" } } }To specify an import map inline, add a
<script type="sample/importmap">slotted child:<playground-ide> <script type="sample/importmap"> { "imports": { "lit-html": "https://unpkg.com/lit-html@next-major", "lit-html/": "https://unpkg.com/lit-html@next-major/" } } </script> ... </playground-ide>
- Bare module imports in
.jsfiles are now resolved in the same way as.tsfiles.
0.4.1 - 2021-01-15
- Fixed
<playground-file-editor>not always displaying initial file. - Fixed
editable-file-systemattribute name (waseditableFileSystem). - Fixed
<playground-ide>not stretching<playground-file-editor>vertically.
0.4.0 - 2021-01-15
-
Added
editableFileSystemproperty (editable-file-systemattribute) to<playground-ide>. Whentrue, the user will be able to create, delete, and rename files in the virtual filesystem.- To create a new file: click the "+" icon button in the tab bar.
- To rename a file: click the three-dots menu button on its tab, and select "Rename".
- To delete a file: click the three-dots menu button on its tab, and select "Delete".
-
Added
<playground-file-system-controls>element which displays popup menus/dialogs for creating, deleting, and renaming files.
-
[BREAKING] The tab bar has been factored into a new standalone element called
<playground-tab-bar>. The<playground-file-editor>element no longer integrates the tab bar, and thenoFilePickerproperty has been removed. -
[BREAKING] The following CSS custom properties have been renamed:
--playground-file-picker-background->--playground-tab-bar-background--playground-file-picker-foreground->--playground-tab-bar-foreground
-
[BREAKING] The following CSS shadow parts have been renamed:
file-picker->tab-bar
0.3.7 - 2021-01-08
-
Added
filesproperty to<playground-ide>and<playground-project>. Use this property to directly get and set the array of project files (e.g. to save/restore the project state).Note that directly setting
filesalways takes precedence over settingprojectSrc, and both take precedence over slotted children.
- It is no longer necessary to load the Material Icons font. The reload button icon is now inlined SVG.
- Fix caret placement issues with some dynamic layouts.
0.3.6 - 2020-12-08
- Fix shifted/hidden code in Safari when line numbers are enabled.
0.3.5 - 2020-12-03
- Fix
mwc-tabrace condition bug (dependency version bump).
0.3.4 - 2020-12-03
- The playground service worker now serves its own 404s when a file is not found, instead of forwarding the request to the server.
- Fix race condition where preview could load too early and 404.
- Fix race condition where preview could sometimes never load.
- Fix preview 404 that could occur after leaving page idle for some time.
0.3.3 - 2020-12-01
- Fix Safari scrolling bug by limiting preview max-height.
0.3.2 - 2020-11-30
- Fix installation error relating to missing
node_modules/puppeteerdirectory.
- Bumped and un-pinned
@material/mwcdependencies.
- Removed some unnecessary files from NPM package.
0.3.1 - 2020-11-11
- Remove debugging log statement.
- Remove unecessary file from NPM package.
0.3.0 - 2020-11-11
- [BREAKING]
service-worker.jshas been renamed toplayground-service-worker.js,typescript-worker.jshas been renamed toplayground-typescript-worker.js, and an additional file calledplayground-service-worker-proxy.htmlis now also required. This change may affect bundling configurations.
-
Service Workers and scripts are now able and advised to run on a second origin, in order to isolate arbitrary script execution from sensitive actions or data on the host origin.
The
sandboxBaseUrlproperty (orsandbox-base-urlattribute) has been added<playground-ide>and<playground-project>to control this origin.If the default same origin is used, a warning will be logged to the console.
0.2.0 - 2020-10-28
-
[BREAKING] Replaced
themeproperty with new custom property based theming system (see below). -
[BREAKING] Renamed CSS custom properties:
playground-code-color->playground-code-default-colorplayground-file-editor-background-color->playground-code-backgroundplayground-file-picker-background-color->playground-file-picker-backgroundplayground-preview-toolbar-background-color->playground-preview-toolbar-background
-
Added CSS Custom Properties for configuring the CodeMirror theme.
Includes broad properties like
--playground-code-backgroundand--playground-selection-color, as well as token-specific properties like--playground-code-keyword-colorand--playground-code-string-color.See the
themes/directory for more examples of what can be customized. -
Added
themes/directory which includes CSS files and JS modules for each of the standard CodeMirror themes, adapted to use CSS Custom Properties.Use the configurator at https://google.github.io/playground-elements/ to try out the available themes.
To load a theme, load its stylesheet into your document or shadow root scope, and set the corresponding
playground-theme-NAMEclass on any playground element or ancestor.In HTML:
<head> <link rel="stylesheet" href="/node_modules/playground-elements/themes/mbo.css" /> </head> <body class="playground-theme-mbo"> <playground-ide></playground-ide> </body>
In a LitElement:
import mbo from 'playground-elements/themes/mbo.css.js'; class MyElement extends LitElement { static styles = [mbo, css`...`]; render() { return ` <playground-ide class="playground-theme-mbo"> </playground-ide> `; } }
- Fix inconsistent line-number guttter sizing.
0.1.1 - 2020-10-26
-
Added
--playground-preview-sizeCSS custom property to control the initial size of the RHS preview bar in<playground-ide>. The LHS editor will take up all additional space. Defaults to30%. -
Added
resizableproperty/attribute which allows users to click and drag in the space between the LHS editor and RHS preview of<playground-ide>to change their relative sizes.
- Invalid module import paths.
- Reload button icon now respects
--playground-preview-toolbar-foreground-color.
- TypeScript decorator runtime is now imported from
tslibinstead of inlined.
0.1.0 - 2020-10-24
-
[BREAKING] NPM package and GitHub repo renamed from
code-sample-editortoplayground-elements. -
[BREAKING] Renamed all elements:
<code-sample> -> <playground-ide><code-sample-project>-><playground-project><code-sample-editor>-><playground-file-editor><codemirror-editor>-><playground-code-editor>
-
[BREAKING] Renamed all element JS modules:
./lib/code-sample.js->./playground-ide.js./lib/code-sample-project.js->./playground-project.js./lib/code-sample-editor.js->./playground-file-editor.js./lib/codemirror-editor.js->./playground-code-editor.js
0.1.0-pre.4 - 2020-10-22
-
[BREAKING] Major refactor of elements to allow them to be more easily used independently. The new elements are:
-
<code-sample>: A single editor with file-selection bar and preview in side-by-side layout. If a different layout is required, the editor and preview elements can instead be used directly, along with a project element. New equivalent of what used to be<code-sample-editor>. -
<code-sample-project>: New purely abstract element that coordinates between the service worker, editor elements, and preview elements. -
<code-sample-editor>: An editor with file-selection bar, tied to a project element. New equivalent to the left-hand-side side of what used to be<code-sample-editor>. -
<code-sample-preview>: A rendered HTML preview window, tied to a project element. New equivalent to the right-hand-side of what used to be<code-sample-editor-preview>. -
<codemirror-editor>: A pure CodeMirror editor, mostly unchanged from previous version.
Example usage without
<code-sample>:<code-sample-project id="myProject" project-src="/demo/typescript/project.json" ></code-sample-project> <code-sample-editor project="myProject"></code-sample-editor> <code-sample-preview project="myProject"></code-sample-preview>
The
projectproperty can either be an ID in the host scope (as shown above) or a direct reference to a<code-sample-project>element (which would allow the elements to live in different scopes). -
-
Downgraded from CodeMirror v6 to v5 in order to gain support for nested highlighting of HTML and CSS inside JS/TS. See lezer-parser/javascript#3. Will upgrade back to 6 once support is ready.
-
The caret is now only displayed when an editor is on focus (previously it was always displayed).
-
The
<code-sample>side-by-side layout is now consistently 70%/30% (widths can be changed using theeditorandpreviewCSS shadow parts).
-
Add syntax highlighting of TypeScript files.
-
Add syntax highlighting of nested HTML and CSS inside JS/TS.
-
Add
filenameproperty/attribute to<code-sample-editor>which allows getting and setting the currently selected file. -
Add
noFilePickerproperty (no-file-pickerattribute) to<code-sample-editor>which disables the top file selection tab-bar. -
Add
lineNumbersproperty (line-numbersattribute) to<code-sample>,<code-sample-editor>, and<codemirror-editor>which enables the left-hand-side gutter with line numbers. Off by default. -
Add a
<slot>to<code-sample-editor>which will be displayed until the file is loaded. This facilitates pre-rendering syntax-highlighted code before both the element has upgraded, and before the project file has been fetched. -
Add a
<slot>to<code-sample-preview>which will be displayed until the preview iframe has loaded for the first time. This facilitates pre-rendering preview HTML both before both the element has upgraded, and before the live preview first renders. -
Add
labelproperty and attribute to project files. When set, the file picker will display this label instead of the filename. -
An animated progress bar now displays when a preview is loading.
-
Added CSS Shadow Parts:
<code-sample-editor>:file-picker<code-sample-preview>:preview-toolbar,preview-location,preview-reload-button,preview-loading-indicator<code-sample>:editor,preview,file-picker,preview-toolbar,preview-location,preview-reload-button,preview-loading-indicator
-
Added CSS Custom Properties:
--playground-code-font-family--playground-code-font-size--playground-editor-background-color--playground-file-picker-background-color--playground-file-picker-foreground-color--playground-preview-toolbar-background-color--playground-preview-toolbar-foreground-color--playground-border--playground-highlight-color--playground-bar-height
-
Added
themeproperty to<code-sample>,<code-sample-editor>, and<codemirror-editor>, which sets the theme (currently onlydefault,monokai,ambiance,ayu-mirageare available, but a way to load other themes will follow). -
Previews will now automatically reload on changes (0.5 second debounce).
-
Added
readonlyproperty/attribute to<codemirror-editor>which disables the ability to edit.
- Fix absent CSS syntax highlighting.
- Fix various styling/layout glitches.
- Fix service worker and TypeScript worker URLs, which reached up too many parent directories.
0.1.0-pre.3 - 2020-10-05
- Fix missing CodeMirror styles on Firefox and Safari.
- Fix Safari crashes in
<mwc-tab>code.
- Fix extra/missing files.
- Initial release.