├── .nvmrc ├── .yarnrc ├── src ├── styles.css ├── index.ts ├── types.d.ts ├── styles.ts ├── reset.ts ├── YoodaComp.ts └── reset.css ├── .storybook ├── main.js └── server.mjs ├── public └── fonts │ ├── Roboto-Black.ttf │ ├── Roboto-Bold.ttf │ ├── Roboto-Italic.ttf │ ├── Roboto-Light.ttf │ ├── Roboto-Medium.ttf │ ├── Roboto-Thin.ttf │ ├── Roboto-Regular.ttf │ ├── Roboto-BlackItalic.ttf │ ├── Roboto-BoldItalic.ttf │ ├── Roboto-LightItalic.ttf │ ├── Roboto-ThinItalic.ttf │ └── Roboto-MediumItalic.ttf ├── .github ├── dependabot.yml └── workflows │ └── main.yml ├── tailwind.config.js ├── .gitignore ├── postcss.config.js ├── web-test-runner.config.mjs ├── tsconfig.json ├── .editorconfig ├── custom-elements.json ├── web-dev-server.config.mjs ├── demo └── index.html ├── LICENSE ├── test └── yooda-comp.test.ts ├── stories └── index.stories.ts ├── README.md ├── rollup.config.js └── package.json /.nvmrc: -------------------------------------------------------------------------------- 1 | v12.19.1 2 | -------------------------------------------------------------------------------- /.yarnrc: -------------------------------------------------------------------------------- 1 | save-prefix "" 2 | -------------------------------------------------------------------------------- /src/styles.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /.storybook/main.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | stories: ['../stories/**/*.stories.{ts,md,mdx}'], 3 | }; 4 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { setupReset } from '../src/reset'; 2 | export { YoodaComp } from './YoodaComp'; 3 | -------------------------------------------------------------------------------- /public/fonts/Roboto-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Black.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Bold.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Italic.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Light.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Thin.ttf -------------------------------------------------------------------------------- /src/types.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module 'static-params'; 3 | declare module 'style-inject'; 4 | -------------------------------------------------------------------------------- /public/fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-BlackItalic.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-BoldItalic.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-LightItalic.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-ThinItalic.ttf -------------------------------------------------------------------------------- /public/fonts/Roboto-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sync/yooda-comp/master/public/fonts/Roboto-MediumItalic.ttf -------------------------------------------------------------------------------- /src/styles.ts: -------------------------------------------------------------------------------- 1 | import { unsafeCSS } from 'lit-element'; 2 | import styles from './styles.css'; 3 | 4 | export default unsafeCSS(styles); 5 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'npm' 4 | directory: '/' 5 | schedule: 6 | interval: 'daily' 7 | -------------------------------------------------------------------------------- /src/reset.ts: -------------------------------------------------------------------------------- 1 | import styleInject from 'style-inject'; 2 | import fontStyles from './reset.css'; 3 | 4 | export const setupReset = () => { 5 | styleInject(fontStyles, { insertAt: 'top' }); 6 | }; 7 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | purge: ['./src/**.ts'], 3 | darkMode: false, // or 'media' or 'class' 4 | theme: { 5 | extend: {}, 6 | }, 7 | variants: { 8 | extend: {}, 9 | }, 10 | plugins: [], 11 | }; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## editors 2 | /.idea 3 | /.vscode 4 | 5 | ## system files 6 | .DS_Store 7 | 8 | ## npm 9 | /node_modules/ 10 | /npm-debug.log 11 | 12 | ## testing 13 | /coverage/ 14 | 15 | ## temp folders 16 | /.tmp/ 17 | 18 | # build 19 | /_site/ 20 | /dist/ 21 | /out-tsc/ 22 | 23 | storybook-static -------------------------------------------------------------------------------- /.storybook/server.mjs: -------------------------------------------------------------------------------- 1 | import { storybookPlugin } from '@web/dev-server-storybook'; 2 | import baseConfig from '../web-dev-server.config.mjs'; 3 | 4 | export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ 5 | ...baseConfig, 6 | open: '/', 7 | plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins], 8 | }); 9 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = ({ env }) => ({ 2 | plugins: 3 | env !== 'test' 4 | ? [ 5 | require('tailwindcss'), 6 | require('autoprefixer'), 7 | env === 'production' 8 | ? require('postcss-url')([ 9 | { 10 | url: asset => asset.url.replace('../public/', ''), 11 | }, 12 | ]) 13 | : false, 14 | ] 15 | : [], 16 | }); 17 | -------------------------------------------------------------------------------- /web-test-runner.config.mjs: -------------------------------------------------------------------------------- 1 | import { esbuildPlugin } from '@web/dev-server-esbuild'; 2 | import { fromRollup } from '@web/dev-server-rollup'; 3 | import rollupPostcss from 'rollup-plugin-postcss'; 4 | 5 | const postcss = fromRollup(rollupPostcss); 6 | 7 | export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({ 8 | files: 'test/**/*.test.ts', 9 | nodeResolve: true, 10 | mimeTypes: { 11 | '**/*.css': 'js', 12 | }, 13 | 14 | plugins: [ 15 | esbuildPlugin({ ts: true }), 16 | postcss({ include: ['src/**/*.css'], inject: false }), 17 | ], 18 | }); 19 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "moduleResolution": "node", 6 | "lib": ["dom", "dom.iterable", "esnext"], 7 | "allowJs": true, 8 | "checkJs": true, 9 | "strict": true, 10 | "esModuleInterop": true, 11 | "noEmit": true, 12 | "resolveJsonModule": true, 13 | "allowSyntheticDefaultImports": true, 14 | "experimentalDecorators": true, 15 | "downlevelIteration": true, 16 | "skipLibCheck": true, 17 | "forceConsistentCasingInFileNames": true 18 | }, 19 | "include": ["**/*.ts"] 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: [push] 3 | jobs: 4 | build: 5 | name: Build, lint, and test 6 | runs-on: ubuntu-latest 7 | 8 | steps: 9 | - name: Checkout repo 10 | uses: actions/checkout@v2 11 | 12 | - name: Use Node 12 13 | uses: actions/setup-node@v1 14 | with: 15 | node-version: 12 16 | 17 | - name: Install deps and build (with cache) 18 | uses: bahmutov/npm-install@v1 19 | 20 | - name: Lint 21 | run: yarn lint 22 | 23 | - name: Test 24 | run: yarn test 25 | 26 | - name: Build 27 | run: yarn build 28 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | 10 | # Change these settings to your own preference 11 | indent_style = space 12 | indent_size = 2 13 | 14 | # We recommend you to keep these unchanged 15 | end_of_line = lf 16 | charset = utf-8 17 | trim_trailing_whitespace = true 18 | insert_final_newline = true 19 | 20 | [*.md] 21 | trim_trailing_whitespace = false 22 | 23 | [*.json] 24 | indent_size = 2 25 | 26 | [*.{html,js,md}] 27 | block_comment_start = /** 28 | block_comment = * 29 | block_comment_end = */ 30 | -------------------------------------------------------------------------------- /custom-elements.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "tags": [ 4 | { 5 | "name": "yooda-comp", 6 | "description": "A component with a title and an action counter", 7 | "properties": [ 8 | { 9 | "name": "title", 10 | "type": "String", 11 | "description": "The title of your component", 12 | "default": "Hey there" 13 | }, 14 | { 15 | "name": "counter", 16 | "type": "Number", 17 | "description": "An action counter", 18 | "default": 0 19 | } 20 | ], 21 | "events": [], 22 | "slots": [], 23 | "cssProperties": [ 24 | { 25 | "name": "--yooda-comp-text-color", 26 | "description": "Main Text Color", 27 | "type": "Color" 28 | } 29 | ] 30 | } 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /web-dev-server.config.mjs: -------------------------------------------------------------------------------- 1 | import { esbuildPlugin } from '@web/dev-server-esbuild'; 2 | import { hmrPlugin, presets } from '@open-wc/dev-server-hmr'; 3 | import { fromRollup } from '@web/dev-server-rollup'; 4 | import rollupPostcss from 'rollup-plugin-postcss'; 5 | 6 | const postcss = fromRollup(rollupPostcss); 7 | 8 | /** Use Hot Module replacement by adding --hmr to the start command */ 9 | const hmr = process.argv.includes('--hmr'); 10 | 11 | export default /** @type {import('@web/dev-server').DevServerConfig} */ ({ 12 | nodeResolve: true, 13 | open: '/demo/', 14 | watch: !hmr, 15 | mimeTypes: { 16 | '**/*.css': 'js', 17 | }, 18 | 19 | plugins: [ 20 | esbuildPlugin({ ts: true }), 21 | postcss({ include: ['src/**/*.css'], inject: false }), 22 | hmr && 23 | hmrPlugin({ 24 | exclude: ['**/*/node_modules/**/*'], 25 | presets: [presets.litElement], 26 | }), 27 | ], 28 | }); 29 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 10 | 11 | 12 | 13 | 14 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 yooda-comp 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /test/yooda-comp.test.ts: -------------------------------------------------------------------------------- 1 | import { html, fixture, expect } from '@open-wc/testing'; 2 | 3 | import type { YoodaComp } from '../src/YoodaComp'; 4 | import '../src/YoodaComp'; 5 | 6 | describe('YoodaComp', () => { 7 | it('has a default title "Hey there" and counter 5', async () => { 8 | const el = await fixtureSlotted content
`, 60 | }; 61 | SlottedContent.argTypes = { 62 | slot: { table: { disable: true } }, 63 | }; 64 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # \