From fcc88ee33118a89bff0e09a06e46028921a430a7 Mon Sep 17 00:00:00 2001 From: Elliott Marquez <5981958+e111077@users.noreply.github.com> Date: Thu, 2 Feb 2023 17:11:59 -0800 Subject: [PATCH 1/3] [Lit] add `client:only` functionality to Lit integration --- .../src/components/ClientOnlyComponent.js | 9 ++ .../lit-component/src/pages/index.astro | 8 ++ packages/astro/e2e/lit-component.test.js | 21 +++++ .../src/runtime/server/render/component.ts | 1 + packages/integrations/lit/src/client.ts | 89 +++++++++++++++---- 5 files changed, 109 insertions(+), 19 deletions(-) create mode 100644 packages/astro/e2e/fixtures/lit-component/src/components/ClientOnlyComponent.js diff --git a/packages/astro/e2e/fixtures/lit-component/src/components/ClientOnlyComponent.js b/packages/astro/e2e/fixtures/lit-component/src/components/ClientOnlyComponent.js new file mode 100644 index 000000000000..0fd16b50af01 --- /dev/null +++ b/packages/astro/e2e/fixtures/lit-component/src/components/ClientOnlyComponent.js @@ -0,0 +1,9 @@ +import { LitElement, html } from 'lit'; + +export default class ClientOnlyComponent extends LitElement { + render() { + return html` Shadow dom default content should not be visible`; + } +} + +customElements.define('client-only-component', ClientOnlyComponent); diff --git a/packages/astro/e2e/fixtures/lit-component/src/pages/index.astro b/packages/astro/e2e/fixtures/lit-component/src/pages/index.astro index f15e832dcbbd..43eb17a4ecb9 100644 --- a/packages/astro/e2e/fixtures/lit-component/src/pages/index.astro +++ b/packages/astro/e2e/fixtures/lit-component/src/pages/index.astro @@ -1,6 +1,7 @@ --- import MyCounter from '../components/Counter.js'; import NonDeferredCounter from '../components/NonDeferredCounter.js'; +import ClientOnlyComponent from '../components/ClientOnlyComponent.js'; const someProps = { count: 10, @@ -26,5 +27,12 @@ const someProps = { Hello, client:visible! + + + Framework + client:only + component + Should not be visible +