Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
d83fdfe
Add initial bootstrap files
jbuckner Nov 4, 2025
6cec6ca
Merge branch 'main' into bootstrap
jbuckner Nov 4, 2025
3a3ad03
Update directory / filenames
jbuckner Nov 10, 2025
0038bc6
Add components index.ts file
jbuckner Nov 10, 2025
31aa874
Add exports
jbuckner Nov 10, 2025
7e41632
Update build module destination
jbuckner Nov 10, 2025
4856ad3
Update description and license
jbuckner Nov 10, 2025
4e05ed8
Add snowflakes library
jbuckner Nov 10, 2025
e52ab13
Rename directories to match component name
jbuckner Nov 10, 2025
2bab17b
Re-org src directory
jbuckner Nov 11, 2025
4148d86
Lots of updates for ease of use
jbuckner Nov 13, 2025
7f1a3f7
Fix build script
jbuckner Nov 13, 2025
60ae04f
Add path aliases
jbuckner Nov 13, 2025
8c9f8cd
Update demo title
jbuckner Nov 13, 2025
a58e854
Add Github CI workflow
jbuckner Nov 13, 2025
f5d84b1
Add playwright install step
jbuckner Nov 13, 2025
426fc67
Minor change to test CI
jbuckner Nov 14, 2025
a1ca4e3
Add story demos
jbuckner Nov 14, 2025
ad4b1a1
Add story template
jbuckner Nov 14, 2025
c22f439
Flesh out demo a bit more
jbuckner Nov 14, 2025
39496e3
Linting
jbuckner Nov 18, 2025
294f6a9
Remove path aliases
jbuckner Nov 18, 2025
c01da81
Revert "Remove path aliases"
jbuckner Nov 18, 2025
ae9faf4
Add tsc-alias to update import aliases
jbuckner Nov 18, 2025
fe9fe81
Bump version to 0.0.1-alpha.1
jbuckner Nov 18, 2025
70f7e67
Add post install build step
jbuckner Nov 18, 2025
0073ce4
0.0.1-alpha.2
jbuckner Nov 18, 2025
c0cd5d4
Add repo info
jbuckner Nov 18, 2025
bb8027f
Add files section to package files
jbuckner Nov 18, 2025
86706ae
Add prepare script
jbuckner Nov 18, 2025
eb43aa8
0.0.1-alpha.3
jbuckner Nov 18, 2025
4b50153
Move tslib to dependencies
jbuckner Nov 18, 2025
e6be461
0.0.1-alpha.4
jbuckner Nov 18, 2025
b7ab1b5
Add vitest to recommended extensions
jbuckner Nov 18, 2025
f1f1ffe
Add exclusions to vite config
jbuckner Nov 18, 2025
e20bd18
Linting
jbuckner Nov 19, 2025
254c899
Update exports and packaging
jbuckner Nov 21, 2025
775d3e8
Rename components directory to elements
jbuckner Nov 21, 2025
f19b13e
0.0.1-alpha.5
jbuckner Nov 21, 2025
358722b
Update package name
jbuckner Nov 21, 2025
e92e06c
0.0.1-alpha.6
jbuckner Nov 21, 2025
09cb493
Make package public
jbuckner Nov 21, 2025
de671b3
0.0.1-alpha.7
jbuckner Nov 21, 2025
e8a5594
Update exports
jbuckner Nov 21, 2025
c9ece21
0.0.1-alpha.8
jbuckner Nov 21, 2025
6565f96
Improve story template
jbuckner Nov 21, 2025
c9a99d9
Add syntax highlighting
jbuckner Nov 21, 2025
1ba2e20
Import typescript formatter
jbuckner Nov 22, 2025
ce202ec
Improve button usage preview
jbuckner Nov 22, 2025
b8ed403
Move demo files
jbuckner Nov 22, 2025
f579d83
Add syntax highlighter component
jbuckner Nov 22, 2025
bf6898f
Linting
jbuckner Nov 22, 2025
ff7ca8b
Update demo
jbuckner Nov 22, 2025
168c20b
Update demo
jbuckner Nov 22, 2025
ce7e0f9
Update demo
jbuckner Nov 22, 2025
87c6b71
Add types
jbuckner Nov 22, 2025
e42cde8
Update var name
jbuckner Nov 22, 2025
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: App CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: lts/*

- name: Install dependencies
run: npm install

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run tests
run: npm run test

- uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
node_modules/
*.tgz
*.tsbuildinfo
.DS_Store
.wireit
/temp
.idea
/scripts/check-size-out.md
/playground/p/**/package-lock.json
/playground/p/scratch/*/
!/playground/p/scratch/*.*
/.direnv/
/.envrc
/.actrc
dist
coverage
__screenshots__
4 changes: 4 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"bracketSpacing": true
}
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bierner.lit-html",
"bashmish.es6-string-css",
"runem.lit-plugin",
"ryanluker.vscode-coverage-gutters",
"google.wireit",
"vitest.explorer"
]
}
14 changes: 14 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Watch coverage on open",
"command": "${command:coverage-gutters.watchCoverageAndVisibleEditors}",
"runOptions": {
"runOn": "folderOpen"
}
}
]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 📚 _ia-components_ 🏛️
# 📚 _elements_ 🏛️


## Component Inventory
Expand Down
18 changes: 18 additions & 0 deletions demo/app-root.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { html, LitElement } from 'lit';
import { customElement } from 'lit/decorators.js';

import '@src/elements/ia-button/ia-button-story';
import '@src/labs/ia-snow/ia-snow-story';

@customElement('app-root')
export class AppRoot extends LitElement {
render() {
return html`
<h1>🏛️ Internet Archive Elements ⚛️</h1>

<ia-button-story></ia-button-story>

<ia-snow-story></ia-snow-story>
`;
}
}
3 changes: 3 additions & 0 deletions demo/arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions demo/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
:root {
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;

color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;

font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}

a:hover {
color: #535bf2;
}

body {
margin: 1rem;
min-width: 320px;
min-height: 100vh;
}

@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
}
103 changes: 103 additions & 0 deletions demo/story-template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { css, html, LitElement, type CSSResultGroup } from 'lit';
import { property, state } from 'lit/decorators.js';
import { customElement } from 'lit/decorators/custom-element.js';
import { when } from 'lit/directives/when.js';

import './syntax-highlighter';

import arrow from './arrow.svg';

@customElement('story-template')
export class StoryTemplate extends LitElement {
@property({ type: String }) elementTag = '';

@property({ type: String }) exampleUsage = '';

@property({ type: Boolean }) labs = false;

@state() private visible = false;

render() {
return html`
<h2 @click=${() => (this.visible = !this.visible)}>
<img
class="disclosure-arrow ${this.visible ? 'open' : ''}"
src=${arrow}
/><code> &lt;${this.elementTag}&gt;</code>
</h2>
${when(this.visible, () => this.elementDemoTemplate)}
`;
}

private get elementDemoTemplate() {
return html`
<div id="container">
<h3>Demo</h3>
<div class="slot-container">
<slot name="demo"></slot>
</div>
<h3>Import</h3>
<syntax-highlighter .code=${this.importCode}></syntax-highlighter>
<h3>Usage</h3>
<syntax-highlighter .code=${this.exampleUsage}></syntax-highlighter>
<h3>Settings</h3>
<div class="slot-container">
<slot name="settings"></slot>
</div>
</div>
`;
}

private get importCode() {
return `
import '${this.modulePath}';
import { ${this.elementClassName} } from '${this.modulePath}';
`;
}

private get elementClassName() {
return customElements.get(this.elementTag)?.name;
}

private get modulePath() {
return this.labs
? `@internetarchive/elements/labs/${this.elementTag}/${this.elementTag}`
: `@internetarchive/elements/${this.elementTag}/${this.elementTag}`;
}

static get styles(): CSSResultGroup {
return css`
#container {
border: 1px solid #ccc;
padding: 0 16px 16px 16px;
}

h2 {
cursor: pointer;
margin-top: 8px;
margin-bottom: 8px;
}

h3 {
margin-bottom: 8px;
}

.slot-container {
background: #282c34;
padding: 1em;
}

.disclosure-arrow {
width: 12px;
height: 12px;
transform: rotate(-90deg);
filter: invert(1);
transition: transform 0.2s ease-in-out;
}

.disclosure-arrow.open {
transform: rotate(0deg);

`;
}
}
49 changes: 49 additions & 0 deletions demo/syntax-highlighter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import hljs from 'highlight.js';
import typescript from 'highlight.js/lib/languages/typescript';
import {
type CSSResultGroup,
LitElement,
type PropertyValues,
html,
} from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
import { syntaxStyles } from './syntax-style';

@customElement('syntax-highlighter')
export class SyntaxHighlighter extends LitElement {
@property({ type: String }) code = '';

@state() private highlightedCode = '';

connectedCallback(): void {
super.connectedCallback();
hljs.registerLanguage('typescript', typescript);
}

protected willUpdate(_changedProperties: PropertyValues): void {
if (_changedProperties.has('code')) {
this.highlightCode();
}
}

render() {
return html`
<pre><code class="hljs language-typescript">${unsafeHTML(
this.highlightedCode,
)}</code></pre>
`;
}

private highlightCode() {
const code = this.code.trim();
const highlighted = hljs.highlight(code, {
language: 'typescript',
}).value;
this.highlightedCode = highlighted;
}

static get styles(): CSSResultGroup {
return [syntaxStyles];
}
}
94 changes: 94 additions & 0 deletions demo/syntax-style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { css, type CSSResultGroup } from 'lit';

export const syntaxStyles: CSSResultGroup = css`
pre code.hljs {
display: block;
overflow-x: auto;
padding: 1em;
}
code.hljs {
padding: 3px 5px;
}
/*

Atom One Dark by Daniel Gamage
Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax

base: #282c34
mono-1: #abb2bf
mono-2: #818896
mono-3: #5c6370
hue-1: #56b6c2
hue-2: #61aeee
hue-3: #c678dd
hue-4: #98c379
hue-5: #e06c75
hue-5-2: #be5046
hue-6: #d19a66
hue-6-2: #e6c07b

*/
.hljs {
color: #abb2bf;
background: #282c34;
}
.hljs-comment,
.hljs-quote {
color: #5c6370;
font-style: italic;
}
.hljs-doctag,
.hljs-keyword,
.hljs-formula {
color: #c678dd;
}
.hljs-section,
.hljs-name,
.hljs-selector-tag,
.hljs-deletion,
.hljs-subst {
color: #e06c75;
}
.hljs-literal {
color: #56b6c2;
}
.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute,
.hljs-meta .hljs-string {
color: #98c379;
}
.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-type,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-number {
color: #d19a66;
}
.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-meta,
.hljs-selector-id,
.hljs-title {
color: #61aeee;
}
.hljs-built_in,
.hljs-title.class_,
.hljs-class .hljs-title {
color: #e6c07b;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
.hljs-link {
text-decoration: underline;
}
`;
Loading