Skip to content

Commit

Permalink
perf: wip experimental ssr with lightdom css
Browse files Browse the repository at this point in the history
  • Loading branch information
bennypowers committed Nov 21, 2024
1 parent 024bb57 commit bb6b66e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
9 changes: 8 additions & 1 deletion docs/_plugins/lit-ssr/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ class RHDSSSRableRenderer extends LitElementRenderer {
}
yield* super.renderShadow(renderInfo);
}

override* renderLight(renderInfo: RenderInfo): RenderResult {
if (this.tagName === 'rh-table') {
console.log(renderInfo.customElementHostStack);
console.log(this.element);
}
yield* super.renderLight(renderInfo);
}
}

const elementRenderers = [
Expand Down Expand Up @@ -93,4 +101,3 @@ export default async function renderPage({
const end = performance.now();
return { page, rendered, durationMs: end - start };
}

2 changes: 0 additions & 2 deletions elements/rh-table/demo/rh-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@
<small slot="summary">Dates and venues subject to change.</small>
</rh-table>

<link rel="stylesheet" href="../rh-table-lightdom.css">

<script type="module">
import '@rhds/elements/rh-table/rh-table.js';
</script>
6 changes: 3 additions & 3 deletions elements/rh-table/rh-sort-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import { customElement } from 'lit/decorators/custom-element.js';
import { property } from 'lit/decorators/property.js';
import { classMap } from 'lit/directives/class-map.js';

import { ComposedEvent } from '@patternfly/pfe-core';

import { colorContextConsumer, type ColorTheme } from '../../lib/context/color/consumer.js';

import styles from './rh-sort-button.css';

const DIRECTIONS_OPPOSITES = { asc: 'desc', desc: 'asc' } as const;

export class RequestSortEvent extends ComposedEvent {
export class RequestSortEvent extends Event {
constructor(public direction: 'asc' | 'desc') {
super('request-sort', {
bubbles: true,
composed: true,
cancelable: true,
});
}
Expand Down
5 changes: 5 additions & 0 deletions elements/rh-table/rh-table-lightdom.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
@property --_rhds-lightdom {
inherits: false;
syntax: string;
}

rh-table {
--_rhds-lightdom: rh-table;

Expand Down

0 comments on commit bb6b66e

Please sign in to comment.