-
Notifications
You must be signed in to change notification settings - Fork 0
Project Bootstrap #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 63 commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
d83fdfe
Add initial bootstrap files
jbuckner 6cec6ca
Merge branch 'main' into bootstrap
jbuckner 3a3ad03
Update directory / filenames
jbuckner 0038bc6
Add components index.ts file
jbuckner 31aa874
Add exports
jbuckner 7e41632
Update build module destination
jbuckner 4856ad3
Update description and license
jbuckner 4e05ed8
Add snowflakes library
jbuckner e52ab13
Rename directories to match component name
jbuckner 2bab17b
Re-org src directory
jbuckner 4148d86
Lots of updates for ease of use
jbuckner 7f1a3f7
Fix build script
jbuckner 60ae04f
Add path aliases
jbuckner 8c9f8cd
Update demo title
jbuckner a58e854
Add Github CI workflow
jbuckner f5d84b1
Add playwright install step
jbuckner 426fc67
Minor change to test CI
jbuckner a1ca4e3
Add story demos
jbuckner ad4b1a1
Add story template
jbuckner c22f439
Flesh out demo a bit more
jbuckner 39496e3
Linting
jbuckner 294f6a9
Remove path aliases
jbuckner c01da81
Revert "Remove path aliases"
jbuckner ae9faf4
Add tsc-alias to update import aliases
jbuckner fe9fe81
Bump version to 0.0.1-alpha.1
jbuckner 70f7e67
Add post install build step
jbuckner 0073ce4
0.0.1-alpha.2
jbuckner c0cd5d4
Add repo info
jbuckner bb8027f
Add files section to package files
jbuckner 86706ae
Add prepare script
jbuckner eb43aa8
0.0.1-alpha.3
jbuckner 4b50153
Move tslib to dependencies
jbuckner e6be461
0.0.1-alpha.4
jbuckner b7ab1b5
Add vitest to recommended extensions
jbuckner f1f1ffe
Add exclusions to vite config
jbuckner e20bd18
Linting
jbuckner 254c899
Update exports and packaging
jbuckner 775d3e8
Rename components directory to elements
jbuckner f19b13e
0.0.1-alpha.5
jbuckner 358722b
Update package name
jbuckner e92e06c
0.0.1-alpha.6
jbuckner 09cb493
Make package public
jbuckner de671b3
0.0.1-alpha.7
jbuckner e8a5594
Update exports
jbuckner c9ece21
0.0.1-alpha.8
jbuckner 6565f96
Improve story template
jbuckner c9a99d9
Add syntax highlighting
jbuckner 1ba2e20
Import typescript formatter
jbuckner ce202ec
Improve button usage preview
jbuckner b8ed403
Move demo files
jbuckner f579d83
Add syntax highlighter component
jbuckner bf6898f
Linting
jbuckner ff7ca8b
Update demo
jbuckner 168c20b
Update demo
jbuckner ce7e0f9
Update demo
jbuckner 87c6b71
Add types
jbuckner e42cde8
Update var name
jbuckner 79bb6fe
Add rsync to build to copy svg files over
jbuckner fef1d1d
Add example svg
jbuckner 21c0b3f
0.0.1-alpha.9
jbuckner bd81de6
Add svg example
jbuckner 980670e
0.0.1-alpha.10
jbuckner c4eccf1
Move types definition to file
jbuckner 4b2abd5
Add comments to the component classes
jbuckner 00f6081
Add basic readme
jbuckner b7ed986
Add to readme for exporting component
jbuckner 8ebcb95
Update readme with more story info and syntax highlighting
jbuckner 88f543f
Add some comments and types
jbuckner e4faf40
Update template
jbuckner aac44f0
Update story and lint
jbuckner 918de0e
Revert versions
jbuckner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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__ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "singleQuote": true, | ||
| "bracketSpacing": true | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" | ||
| } | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # 📚 _ia-components_ 🏛️ | ||
| # 📚 _elements_ 🏛️ | ||
|
|
||
|
|
||
| ## Component Inventory | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| `; | ||
| } | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> <${this.elementTag}></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); | ||
|
|
||
| `; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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]; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } | ||
| `; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.