From a5a538bf98197f96f83cc6a11f97fcd18d6ca7ec Mon Sep 17 00:00:00 2001 From: Konnor Rogers Date: Fri, 16 Aug 2024 16:28:53 -0400 Subject: [PATCH] fix unescape behavior on `` (#24) * fix unescape behavior * update to fix bugs and add slots --- CHANGELOG.md | 7 ++++++- .../components/light-preview/light-preview.js | 19 +++++++++++++++---- .../light-preview/light-preview.styles.js | 4 ++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b766ee79..7f83ffc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -## Next +## 4.1.0 - 08/03/2024 + +- Feature(light-preview): Added the `after-actions`, `above-expanded-code`, and `after-expanded-code` slots and parts. [#24] +- Bug Fix(light-preview): now properly listens to changes to `unescapeBehavior` / `unescape-behavior` [#24] + +## 4.0.0 - 08/01/2024 - BREAKING_CHANGE: All components are now scoped under `exports/components//.js` diff --git a/exports/components/light-preview/light-preview.js b/exports/components/light-preview/light-preview.js index 0b4f94f7..92f280c1 100644 --- a/exports/components/light-preview/light-preview.js +++ b/exports/components/light-preview/light-preview.js @@ -40,16 +40,24 @@ const sourceCodeFallback = "Show source code"; * @csspart code-wrapper - The div that wraps the
 +  elements containing your highlighted code
  * @csspart pre - The 
 element wrapping the source code
  * @csspart code - The   element wrapping the source code
- * @csspart actions - The buttons at the bottom of the code previewer
  * @csspart source-code-toggle - The button to show the source code
+ * @csspart actions - The buttons at the bottom of the code previewer
+ * @csspart before-expanded-code - A wrapper around the "before-expanded-code" slot
+ * @csspart after-expanded-code - A wrapper around the "after-expanded-code" slot
+ * @csspart after-actions - A wrapper around the "after-actions" slot
  * @csspart source-code-toggle-icon - The caret icon in the source code toggle
  *
  * @slot resize-icon - The icon to display in the resizer button. Override this to provide your own icon.
  * @slot summary - What to display in source code expander
  * @slot source-code-toggle-icon - Slot in your own icon to override the default caret.
- * @slot actions - Slot in buttons / links to allow for additional actions in the bottom bar.
+ * @slot above-actions - Additional actions placed above the source code toggle
+ * @slot below-actions - Additional actions placed above the source code toggle
+ * @slot actions - Slot in buttons / links to allow for additional actions in the bottom bar. These are placed inline.
  * @slot preview-html - If you want to run code that is slightly different from the source code you want to display, slot it into "preview-html"
  * @slot code - Used to display both source code and to power your preview in the iframe. If you slot in "preview-html", then it will only be used to show / highlight your source code.
+ * @slot before-expanded-code - A slot to add actions such as buttons. This will sit above the source-code-toggle, and when code is expanded, will be *above* the expanded code.
+ * @slot after-expanded-code - A slot to add actions such as buttons. This will sit above the source-code-toggle, and when code is expanded, will be *below* the expanded code.
+ * @slot after-actions - A slot add actions below the source-code-toggle button.
  */
 export default class LightPreview extends BaseElement {
   /**
@@ -86,6 +94,7 @@ export default class LightPreview extends BaseElement {
     resizing: { reflect: true, type: Boolean },
     scriptScope: { attribute: "script-scope" },
     previewHtml: { attribute: "preview-html" },
+    unescapeBehavior: { attribute: "unescape-behavior" },
 
     //  properties
     disableHighlight: { type: Boolean, attribute: "disable-highlight" },
@@ -604,6 +613,7 @@ export default class LightPreview extends BaseElement {
           
+
- +
+
-
+