+ `
+ }
+}
From 3143a78fc6832a4c49cfcef989e88627037abf83 Mon Sep 17 00:00:00 2001
From: Andrew Gunsch
Date: Wed, 21 Aug 2024 09:17:03 -0700
Subject: [PATCH 2/4] Add slot for account button. (#34)
Adds a slot for account button in play-pen-header, that can be specified via play-pen.
---
src/elements/play-pen-header.ts | 3 ++-
src/elements/play-pen/play-pen.ts | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/elements/play-pen-header.ts b/src/elements/play-pen-header.ts
index e12c7ba..9fe3b15 100644
--- a/src/elements/play-pen-header.ts
+++ b/src/elements/play-pen-header.ts
@@ -184,7 +184,8 @@ export class PlayPenHeader extends LitElement {
label="Share"
@click=${() =>
this.dispatchEvent(Bubble('share', undefined))}
- >
+ >
) => this._assets.onVirtualFileChange(ev.detail)}
@share=${this.#onShare}
+ >
Date: Thu, 22 Aug 2024 11:42:23 -0700
Subject: [PATCH 3/4] Implements project saving and loading in Play (#35)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## 💸 TL;DR
Implements Project-level saving and loading in Play.
## Details
This includes:
* Adding the Save/Load buttons in the Project menu
* Dialogs for both Save and Load flows
* Logic that proxies the actual storage to something behind the
`ProjectStorageClient` interface, which can be swapped out later
* Storing the current project in `sessionStorage`, so that it persists
across reload but not across tabs
* Making sure "New" projects clear the current stored project
* Making sure we can load/save projects several times
* Using the Pen title as the project name (both when saving and loading)
---
src/elements/play-dialog/play-dialog.ts | 3 +
src/elements/play-new-pen-button.ts | 7 +-
src/elements/play-pen-header.ts | 74 ++++++-
src/elements/play-pen/play-pen.ts | 21 +-
src/elements/play-project-button.ts | 82 +++-----
src/elements/play-project-load-dialog.test.ts | 7 +
src/elements/play-project-load-dialog.ts | 181 ++++++++++++++++++
src/elements/play-project-save-dialog.test.ts | 7 +
src/elements/play-project-save-dialog.ts | 140 ++++++++++++++
src/storage/local-project-storage-client.ts | 118 ++++++++++++
src/storage/project-manager.ts | 75 ++++++++
src/storage/project-storage-client.ts | 35 ++++
12 files changed, 683 insertions(+), 67 deletions(-)
create mode 100644 src/elements/play-project-load-dialog.test.ts
create mode 100644 src/elements/play-project-load-dialog.ts
create mode 100644 src/elements/play-project-save-dialog.test.ts
create mode 100644 src/elements/play-project-save-dialog.ts
create mode 100644 src/storage/local-project-storage-client.ts
create mode 100644 src/storage/project-manager.ts
create mode 100644 src/storage/project-storage-client.ts
diff --git a/src/elements/play-dialog/play-dialog.ts b/src/elements/play-dialog/play-dialog.ts
index ccc13c0..6933a99 100644
--- a/src/elements/play-dialog/play-dialog.ts
+++ b/src/elements/play-dialog/play-dialog.ts
@@ -99,6 +99,9 @@ export class PlayDialog extends LitElement implements PlayDialogLike {
close(): void {
this._dialog.close()
+ this.dispatchEvent(
+ new CustomEvent('closed', {bubbles: true, composed: true})
+ )
}
protected override render(): TemplateResult {
diff --git a/src/elements/play-new-pen-button.ts b/src/elements/play-new-pen-button.ts
index d36cd1b..f639426 100644
--- a/src/elements/play-new-pen-button.ts
+++ b/src/elements/play-new-pen-button.ts
@@ -150,10 +150,12 @@ export class PlayNewPenButton extends LitElement {