Base project

This commit is contained in:
2020-05-01 22:30:30 +02:00
parent 0e577bf803
commit fde17f7405
11 changed files with 5117 additions and 0 deletions

5
.eslintignore Normal file
View File

@@ -0,0 +1,5 @@
*.js
src/**/*.js
dist/**

25
.eslintrc.js Normal file
View File

@@ -0,0 +1,25 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/eslint-recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
// disable the rule for all files
'@typescript-eslint/explicit-member-accessibility': 'off',
'no-use-before-define': 'off',
'@typescript-eslint/no-use-before-define': ['off'],
},
overrides: [
{
// enable the rule specifically for TypeScript files
files: ['*.ts', '*.tsx'],
rules: {
'@typescript-eslint/explicit-member-accessibility': ['error'],
},
},
],
};

107
.gitignore vendored Normal file
View File

@@ -0,0 +1,107 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test

6
.prettierrc Normal file
View File

@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true
}

5
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"cSpell.words": [
"gulpif"
]
}

26
gulpfile.js Normal file
View File

@@ -0,0 +1,26 @@
var gulp = require('gulp');
var ts = require('gulp-typescript');
var sourcemaps = require('gulp-sourcemaps');
var gulpif = require('gulp-if');
var tsProject = ts.createProject('tsconfig.json');
var del = require('del');
builder = function (production = true) {
return function () {
return tsProject
.src()
.pipe(gulpif(!production, sourcemaps.init()))
.pipe(tsProject())
.js.pipe(gulpif(!production, sourcemaps.write()))
.pipe(gulp.dest('dist'));
};
};
gulp.task('clean', function () {
return del('dist');
});
gulp.task('build', builder(false));
gulp.task('build:production', builder(true));

4849
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

29
package.json Normal file
View File

@@ -0,0 +1,29 @@
{
"name": "adix-components",
"version": "1.0.0",
"description": "",
"scripts": {
"build": "gulp build",
"clean": "gulp clean"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^13.13.2",
"@typescript-eslint/eslint-plugin": "^2.29.0",
"@typescript-eslint/parser": "^2.29.0",
"del": "^5.1.0",
"eslint": "^6.8.0",
"gulp-if": "^3.0.0",
"gulp-sourcemaps": "^2.6.5",
"typescript": "^3.8.3"
},
"dependencies": {
"bootstrap": "^4.4.1",
"gulp": "^4.0.2",
"gulp-typescript": "^6.0.0-alpha.1",
"lit-element": "^2.3.1",
"lit-html": "^1.2.1"
}
}

View File

@@ -0,0 +1,42 @@
import { html, property, customElement, TemplateResult } from 'lit-element';
import { classMap } from 'lit-html/directives/class-map';
import { ComponentBase } from '../componentBase';
@customElement('adix-button')
export class ADIXButton extends ComponentBase {
@property() public text = '';
@property() public type:
| ''
| 'primary'
| 'secondary'
| 'success'
| 'danger'
| 'warning'
| 'info'
| 'light'
| 'dark' = '';
@property() public disabled = false;
public render(): TemplateResult {
return html`
<button
class=${classMap({
btm: true,
primary: this.type === 'primary',
secondary: this.type === 'secondary',
success: this.type === 'success',
danger: this.type === 'danger',
warning: this.type === 'warning',
info: this.type === 'info',
light: this.type === 'light',
dark: this.type === 'dark',
})}
?disabled=${this.disabled}
>
<slot>${this.text}</slot>
</button>
`;
}
}

View File

@@ -0,0 +1,6 @@
import { LitElement, customElement } from 'lit-element';
@customElement('simple-greeting')
export class ComponentBase extends LitElement {
}

17
tsconfig.json Normal file
View File

@@ -0,0 +1,17 @@
{
"compilerOptions": {
"outDir": "./dist/",
"declaration": true,
"noImplicitAny": true,
"lib": [ "DOM", "ESNext" ],
"module": "ESNext",
"target": "ESNext",
"allowJs": true,
"sourceMap": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["node_modules", "**/*.spec.ts"]
}