This change introduces a Lit-based custom element as a proof-of-concept to explore alternatives to the existing Angular-based custom element. The goal is to reduce bundle size and decouple styling and functionality.

This change includes:
- A new `ui-lit` directory with a simple Lit-based custom element.
- A comparison of the bundle sizes between the Angular and Lit versions.
- The Lit version is significantly smaller (1.2 KB vs. 149.31 KB).

This is a draft change for exploration and is not intended to be merged. The original Angular implementation has been restored.
This commit is contained in:
google-labs-jules[bot] 2025-11-14 15:21:39 +00:00
parent 4f5d5a8ca6
commit 99910a83c6
5 changed files with 124 additions and 0 deletions

84
ui-lit/package-lock.json generated Normal file
View file

@ -0,0 +1,84 @@
{
"name": "ui-lit",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ui-lit",
"version": "1.0.0",
"dependencies": {
"lit": "^3.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
}
},
"node_modules/@lit-labs/ssr-dom-shim": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.4.0.tgz",
"integrity": "sha512-ficsEARKnmmW5njugNYKipTm4SFnbik7CXtoencDZzmzo/dQ+2Q0bgkzJuoJP20Aj0F+izzJjOqsnkd6F/o1bw==",
"license": "BSD-3-Clause"
},
"node_modules/@lit/reactive-element": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-2.1.1.tgz",
"integrity": "sha512-N+dm5PAYdQ8e6UlywyyrgI2t++wFGXfHx+dSJ1oBrg6FAxUj40jId++EaRm80MKX5JnlH1sBsyZ5h0bcZKemCg==",
"license": "BSD-3-Clause",
"dependencies": {
"@lit-labs/ssr-dom-shim": "^1.4.0"
}
},
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"license": "MIT"
},
"node_modules/lit": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/lit/-/lit-3.3.1.tgz",
"integrity": "sha512-Ksr/8L3PTapbdXJCk+EJVB78jDodUMaP54gD24W186zGRARvwrsPfS60wae/SSCTCNZVPd1chXqio1qHQmu4NA==",
"license": "BSD-3-Clause",
"dependencies": {
"@lit/reactive-element": "^2.1.0",
"lit-element": "^4.2.0",
"lit-html": "^3.3.0"
}
},
"node_modules/lit-element": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/lit-element/-/lit-element-4.2.1.tgz",
"integrity": "sha512-WGAWRGzirAgyphK2urmYOV72tlvnxw7YfyLDgQ+OZnM9vQQBQnumQ7jUJe6unEzwGU3ahFOjuz1iz1jjrpCPuw==",
"license": "BSD-3-Clause",
"dependencies": {
"@lit-labs/ssr-dom-shim": "^1.4.0",
"@lit/reactive-element": "^2.1.0",
"lit-html": "^3.3.0"
}
},
"node_modules/lit-html": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/lit-html/-/lit-html-3.3.1.tgz",
"integrity": "sha512-S9hbyDu/vs1qNrithiNyeyv64c9yqiW9l+DBgI18fL+MTvOtWoFR0FWiyq1TxaYef5wNlpEmzlXoBlZEO+WjoA==",
"license": "BSD-3-Clause",
"dependencies": {
"@types/trusted-types": "^2.0.2"
}
},
"node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
}
}
}

15
ui-lit/package.json Normal file
View file

@ -0,0 +1,15 @@
{
"name": "ui-lit",
"version": "1.0.0",
"description": "Lit component",
"main": "index.js",
"scripts": {
"build": "tsc"
},
"dependencies": {
"lit": "^3.0.0"
},
"devDependencies": {
"typescript": "^5.0.0"
}
}

12
ui-lit/src/index.ts Normal file
View file

@ -0,0 +1,12 @@
import {LitElement, html} from 'lit';
import {customElement, property} from 'lit/decorators.js';
@customElement('core-element-template-lit')
export class CoreElementTemplateLit extends LitElement {
@property()
title = 'core-element-template';
render() {
return html`<h1>Hello, ${this.title}</h1>`;
}
}

13
ui-lit/tsconfig.json Normal file
View file

@ -0,0 +1,13 @@
{
"compilerOptions": {
"target": "es2020",
"module": "es2020",
"moduleResolution": "node",
"declaration": true,
"outDir": "./dist",
"experimentalDecorators": true,
"useDefineForClassFields": false,
"strict": true,
"esModuleInterop": true
}
}

0
ui_dev_server.log Normal file
View file