Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 33 additions & 12 deletions examples/esm-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>@knighted/jsx &mdash; esm.sh demo</title>
<title>@knighted/jsx &mdash; CDN demo</title>
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin />
<link rel="dns-prefetch" href="https://cdn.jsdelivr.net" />
Comment thread
knightedcodemonkey marked this conversation as resolved.
<link
rel="modulepreload"
href="https://cdn.jsdelivr.net/npm/@knighted/jsx@1.7.6/lite/+esm"
/>
<link
rel="modulepreload"
href="https://cdn.jsdelivr.net/npm/@knighted/jsx@1.7.6/react/+esm"
Comment on lines +11 to +15

Copilot AI Jan 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version is hardcoded to 1.7.6 in multiple modulepreload links. This creates a maintenance burden as these URLs will need manual updates on each release. Consider using a build-time variable replacement or documenting the need to update these references when releasing new versions.

Suggested change
href="https://cdn.jsdelivr.net/npm/@knighted/jsx@1.7.6/lite/+esm"
/>
<link
rel="modulepreload"
href="https://cdn.jsdelivr.net/npm/@knighted/jsx@1.7.6/react/+esm"
href="https://cdn.jsdelivr.net/npm/@knighted/jsx/lite/+esm"
/>
<link
rel="modulepreload"
href="https://cdn.jsdelivr.net/npm/@knighted/jsx/react/+esm"

Copilot uses AI. Check for mistakes.
/>
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/react@19.2.4/+esm" />
<link
rel="modulepreload"
href="https://cdn.jsdelivr.net/npm/react-dom@19.2.4/client/+esm"
/>
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/lit@3/+esm" />
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/shiki@1.1.7/+esm" />
<style>
:root {
font-family:
Expand Down Expand Up @@ -436,7 +453,7 @@
<body>
<main id="app">
<header>
<h1>@knighted/jsx + esm.sh</h1>
<h1>@knighted/jsx + CDN</h1>
<p>
Use @knighted/jsx in any modern runtime—browser, Node, or CDN—without a build
step.
Expand All @@ -446,18 +463,22 @@ <h1>@knighted/jsx + esm.sh</h1>
<div class="loading-spinner" aria-hidden="true"></div>
<div>
<p><strong>Loading demo modules…</strong></p>
<p>esm.sh dependencies stream in on first visit.</p>
<p>CDN dependencies stream in on first visit.</p>
</div>
</section>
</main>

<script type="module">
import { jsx } from 'https://esm.sh/@knighted/jsx@latest/lite'
import { reactJsx } from 'https://esm.sh/@knighted/jsx@latest/react'
import { useEffect, useRef, useState } from 'https://esm.sh/react@19'
import { createRoot } from 'https://esm.sh/react-dom@19/client'
import { LitElement, css, html } from 'https://esm.sh/lit@3'
import { codeToHtml } from 'https://esm.sh/shiki@1.1.7'
import { jsx } from 'https://cdn.jsdelivr.net/npm/@knighted/jsx@1.7.6/lite/+esm'
import { reactJsx } from 'https://cdn.jsdelivr.net/npm/@knighted/jsx@1.7.6/react/+esm'
import {
useEffect,
useRef,
useState,
} from 'https://cdn.jsdelivr.net/npm/react@19.2.4/+esm'
import { createRoot } from 'https://cdn.jsdelivr.net/npm/react-dom@19.2.4/client/+esm'
import { LitElement, css, html } from 'https://cdn.jsdelivr.net/npm/lit@3/+esm'
import { codeToHtml } from 'https://cdn.jsdelivr.net/npm/shiki@1.1.7/+esm'

const app = document.getElementById('app')
const loadingCard = document.getElementById('demo-loading')
Expand Down Expand Up @@ -1058,7 +1079,7 @@ <h3>Share React state with Lit</h3>
<h2>Pick the runtime that matches your target</h2>
<p>
Each subpath ships a pre-minified helper so you can import exactly what you need from
npm or esm.sh.
npm or a CDN.
</p>
</header>
<div class="lite-metric-grid">
Expand Down Expand Up @@ -1108,7 +1129,7 @@ <h2>Try the React runtime</h2>
</p>
</header>
<p>
The panel below mounts React 19 + react-dom directly from esm.sh and keeps state with hooks.
The panel below mounts React 19 + react-dom directly from a CDN and keeps state with hooks.
</p>
<div class="react-mount" id="react-runtime-demo"></div>
<p>
Expand Down Expand Up @@ -1149,7 +1170,7 @@ <h2>Lit renders React via <code>reactJsx</code></h2>
<header>
<h2>Combine Lit + React</h2>
<p>
Stream Lit from esm.sh, register a custom element, and let React drive it with shared state.
Stream Lit from a CDN, register a custom element, and let React drive it with shared state.
</p>
</header>
<p>
Expand Down
Loading
Loading