-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: bearni95 <[email protected]>
- Loading branch information
Showing
98 changed files
with
7,157 additions
and
127 deletions.
There are no files selected for viewing
This file contains 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,42 @@ | ||
name: UI Lib Build and Checks | ||
|
||
on: workflow_call | ||
|
||
jobs: | ||
build: | ||
runs-on: [taiko-runner] | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Install pnpm dependencies | ||
uses: ./.github/actions/install-pnpm-dependencies | ||
|
||
- name: Svelte build | ||
working-directory: ./packages/ui-lib | ||
run: pnpm build | ||
|
||
- name: Storybook build | ||
working-directory: ./packages/ui-lib | ||
run: pnpm build-storybook | ||
|
||
- name: Svelte check | ||
working-directory: ./packages/ui-lib | ||
run: pnpm check | ||
|
||
- name: Check formatting | ||
working-directory: ./packages/ui-lib | ||
run: pnpm lint | ||
|
||
- name: Unit tests | ||
env: | ||
SKIP_ENV_VALIDATION: "true" | ||
working-directory: ./packages/ui-lib | ||
run: pnpm test:unit |
This file contains 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,13 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
|
||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock |
This file contains 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,32 @@ | ||
/** @type { import("eslint").Linter.Config } */ | ||
module.exports = { | ||
root: true, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:svelte/recommended', | ||
'prettier', | ||
'plugin:storybook/recommended' | ||
], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
parserOptions: { | ||
sourceType: 'module', | ||
ecmaVersion: 2020, | ||
extraFileExtensions: ['.svelte'] | ||
}, | ||
env: { | ||
browser: true, | ||
es2017: true, | ||
node: true | ||
}, | ||
overrides: [ | ||
{ | ||
files: ['*.svelte'], | ||
parser: 'svelte-eslint-parser', | ||
parserOptions: { | ||
parser: '@typescript-eslint/parser' | ||
} | ||
} | ||
] | ||
}; |
This file contains 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,13 @@ | ||
.DS_Store | ||
node_modules | ||
/build | ||
/dist | ||
/.svelte-kit | ||
/package | ||
.env | ||
.env.* | ||
!.env.example | ||
vite.config.js.timestamp-* | ||
vite.config.ts.timestamp-* | ||
/storybook-static | ||
*storybook.log |
This file contains 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 @@ | ||
engine-strict=true |
This file contains 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,5 @@ | ||
# Ignore files for PNPM, NPM and YARN | ||
pnpm-lock.yaml | ||
package-lock.json | ||
yarn.lock | ||
storybook-static |
This file contains 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,8 @@ | ||
{ | ||
"useTabs": true, | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"printWidth": 100, | ||
"plugins": ["prettier-plugin-svelte"], | ||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] | ||
} |
This file contains 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,29 @@ | ||
import type { StorybookConfig } from '@storybook/sveltekit'; | ||
|
||
export const framework = { | ||
name: '@storybook/sveltekit', | ||
options: {} | ||
}; | ||
|
||
export const docs = { autodocs: false }; | ||
export const addons = [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@chromatic-com/storybook', | ||
'@storybook/addon-interactions', | ||
'@storybook/addon-themes' | ||
]; | ||
|
||
const config: StorybookConfig = { | ||
//framework: '@taiko/ui-lib', | ||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], | ||
staticDirs: ['../static'], | ||
framework: { | ||
name: '@storybook/sveltekit', | ||
options: {} | ||
}, | ||
addons, | ||
docs | ||
}; | ||
|
||
export default config; |
This file contains 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,31 @@ | ||
import type { Preview } from '@storybook/svelte'; | ||
import { withThemeByDataAttribute } from '@storybook/addon-themes'; | ||
import '../src/lib/styles/app.css'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/i | ||
} | ||
} | ||
}, | ||
|
||
tags: ['autodocs'] | ||
}; | ||
|
||
/* snipped for brevity */ | ||
|
||
export const decorators = [ | ||
withThemeByDataAttribute({ | ||
themes: { | ||
light: 'light', | ||
dark: 'dark' | ||
}, | ||
defaultTheme: 'light', | ||
attributeName: 'data-theme' | ||
}) | ||
]; | ||
|
||
export default preview; |
This file contains 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,71 @@ | ||
# Taiko UI Library | ||
|
||
## Components | ||
|
||
- [x] Footer | ||
- [ ] Icons | ||
- [ ] Button | ||
- [ ] ResponsiveController | ||
|
||
## Exported values | ||
|
||
- [x] UI Kit colors | ||
- [x] Dark Theme colors | ||
- [x] Light Theme colors | ||
- [ ] Typography | ||
|
||
## Contributing | ||
|
||
### Development | ||
|
||
The library includes [Storybook](https://storybook.js.org/) for development. To start the Storybook server, run: | ||
|
||
```bash | ||
$ pnpm storybook | ||
``` | ||
|
||
### Build | ||
|
||
The library builds and packs as a [Svelte library] with the following command: | ||
|
||
```bash | ||
$ pnpm build | ||
``` | ||
|
||
### Adding components | ||
|
||
In order to add new components into the library to be used outside: | ||
|
||
1. Create a new component under `src/lib/components/` directory. | ||
2. Export the component on `src/lib/index.ts`: | ||
|
||
```typescript | ||
import { NewComponent } from './components/NewComponent'; | ||
|
||
export { | ||
Footer, | ||
... | ||
NewComponent | ||
}; | ||
|
||
``` | ||
|
||
3. Now you can import it and use it in another project: | ||
|
||
```typescript | ||
import { NewComponent } from '@taiko/ui-lib'; | ||
|
||
... | ||
|
||
<NewComponent /> | ||
``` | ||
|
||
### Exported values | ||
|
||
Besides from the components, the library exports the configurations for TailwindCSS in `src/theme/`: | ||
|
||
- `colors.js`: [Taiko's UI Kit](https://www.figma.com/design/3zuVeAbGDICzyhVvSI15nG/Taiko---UI-Kit-%26-Components?node-id=26-122&t=R6fMNiuhGixl6nxX-0) core colors | ||
- `dark-mode.js`: TailwindCSS/DaisyUI dark mode configuration | ||
- `light-mode.js`: TailwindCSS/DaisyUI light mode configuration | ||
|
||
All exported values from the `src/theme` directory are prefixed with `tko-` to avoid conflicts with other libraries and local definitions. |
This file contains 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,82 @@ | ||
{ | ||
"name": "@taiko/ui-lib", | ||
"version": "0.0.1", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build && npm run package", | ||
"preview": "vite preview", | ||
"package": "svelte-kit sync && svelte-package && publint", | ||
"prepublishOnly": "npm run package", | ||
"test": "npm run test:integration && npm run test:unit", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"lint": "prettier --check ./src && eslint ./src --fix", | ||
"format": "prettier --write .", | ||
"test:integration": "playwright test", | ||
"test:unit": "vitest", | ||
"storybook": "storybook dev -p 6006", | ||
"build-storybook": "storybook build" | ||
}, | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"svelte": "./dist/index.js", | ||
"main": "./dist/index.js" | ||
}, | ||
"./tailwind": "./tailwind.config.js" | ||
}, | ||
"files": [ | ||
"tailwind.config.js", | ||
"dist", | ||
"!dist/**/*.test.*", | ||
"!dist/**/*.spec.*" | ||
], | ||
"peerDependencies": { | ||
"svelte": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@chromatic-com/storybook": "^1.3.4", | ||
"@playwright/test": "^1.28.1", | ||
"@storybook/addon-essentials": "^8.0.10", | ||
"@storybook/addon-interactions": "^8.0.10", | ||
"@storybook/addon-links": "^8.0.10", | ||
"@storybook/addon-themes": "^8.1.1", | ||
"@storybook/blocks": "^8.0.10", | ||
"@storybook/svelte": "^8.0.10", | ||
"@storybook/sveltekit": "^8.0.10", | ||
"@storybook/test": "^8.0.10", | ||
"@sveltejs/adapter-auto": "^3.0.0", | ||
"@sveltejs/kit": "^2.0.0", | ||
"@sveltejs/package": "^2.0.0", | ||
"@sveltejs/vite-plugin-svelte": "^3.0.0", | ||
"@types/eslint": "^8.56.0", | ||
"@typescript-eslint/eslint-plugin": "^7.0.0", | ||
"@typescript-eslint/parser": "^7.0.0", | ||
"autoprefixer": "^10.4.19", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"eslint-plugin-svelte": "^2.35.1", | ||
"prettier": "^3.1.1", | ||
"prettier-plugin-svelte": "^3.1.2", | ||
"publint": "^0.1.9", | ||
"storybook": "^8.0.10", | ||
"svelte": "^4.2.7", | ||
"svelte-check": "^3.6.0", | ||
"tailwindcss": "^3.4.3", | ||
"tslib": "^2.4.1", | ||
"typescript": "^5.0.0", | ||
"vite": "^5.0.11", | ||
"vitest": "^1.2.0" | ||
}, | ||
"svelte": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"daisyui": "^4.11.1", | ||
"tailwindcss-image-rendering": "^1.0.2" | ||
} | ||
} |
This file contains 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 @@ | ||
import type { PlaywrightTestConfig } from '@playwright/test'; | ||
|
||
const config: PlaywrightTestConfig = { | ||
webServer: { | ||
command: 'npm run build && npm run preview', | ||
port: 4173 | ||
}, | ||
testDir: 'tests', | ||
testMatch: /(.+\.)?(test|spec)\.[jt]s/ | ||
}; | ||
|
||
export default config; |
This file contains 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,6 @@ | ||
export default { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {} | ||
} | ||
}; |
This file contains 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,13 @@ | ||
// See https://kit.svelte.dev/docs/types#app | ||
// for information about these interfaces | ||
declare global { | ||
namespace App { | ||
// interface Error {} | ||
// interface Locals {} | ||
// interface PageData {} | ||
// interface PageState {} | ||
// interface Platform {} | ||
} | ||
} | ||
|
||
export {}; |
This file contains 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 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%sveltekit.assets%/favicon.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
%sveltekit.head% | ||
</head> | ||
<body data-sveltekit-preload-data="hover"> | ||
<div>%sveltekit.body%</div> | ||
</body> | ||
</html> |
This file contains 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,7 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
|
||
describe('sum test', () => { | ||
it('adds 1 + 2 to equal 3', () => { | ||
expect(1 + 2).toBe(3); | ||
}); | ||
}); |
Oops, something went wrong.