Skip to content

Commit

Permalink
Merge pull request #13 from npolar/cleanup
Browse files Browse the repository at this point in the history
ESLint
  • Loading branch information
cnrdh authored Nov 18, 2020
2 parents 4dfa24a + 783eb2a commit 046b3ce
Show file tree
Hide file tree
Showing 114 changed files with 4,225 additions and 419 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"no-implied-eval": "error",
"no-self-compare": "error",
"no-unused-expressions": "error",
"curly": "error"
"curly": "error",
"no-unused-vars": ["error", {"args": "none"}]
}
}
154 changes: 28 additions & 126 deletions asset/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,144 +2,46 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta
name="description"
content="@npolar/mdc – material design components"
/>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/@npolar/mdc/font/material-icons.css" />
<link rel="stylesheet" href="/@npolar/mdc/css/style/typography.css" />
<title>@npolar/mdc demo</title>
<link rel="stylesheet" href="@npolar/mdc/css/style/shared.css" />
<link rel="stylesheet" href="@npolar/mdc/font/material-icons.css" />

<title></title>
<style>
html,
body,
nav-bar {
body {
font-family: "Inter var", sans-serif;
margin: 0;
padding: 0;
--nav-bar-background: var(--mdc-theme-secondary);
--nav-bar-color: var(--mdc-theme-on-secondary);
--nav-open-background: var(--mdc-theme-primary);
--nav-open-color: var(--mdc-theme-on-primary);
--nav-bar-nav-icon-display: "none";
}

nav-bar a.logo {
color: pink;
}

select-mdc,
select-enum,
input-mdc,
input-password,
input-lock,
input-search,
button-mdc,
button-fab,
button-icon {
margin: 4px;
padding: 4px;
min-height: 100vh;
scroll-behavior: smooth;
text-rendering: optimizeSpeed;
--mdc-typography-font-family: "Inter var", sans-serif;
}

main {
/* padding-top: 55px; */
app-bar {
margin: 0;
padding: 0;
}

.danger {
--mdc-theme-primary: var(--mdc-theme-error);
}
.black-on-white {
--mdc-theme-on-secondary: black;
--mdc-theme-secondary: white;
}
._2ndary {
--mdc-theme-primary: var(--mdc-theme-secondary);
*:not(:defined) {
display: none;
}
</style>
</head>
<body hidden>
<nav-bar
id="npolar-mdc"
href="#npolar-mdc"
heading="@npolar/mdc"
links='[{"text":"Invert colors", "href": "#npolar-mdc", "id": "invert"},
{"text":"Primary theme", "href": "#npolar-mdc", "id": "primary"},
{"text":"Secondary theme", "href": "#npolar-mdc", "id": "secondary"},
{"text":"Dark", "href": "#npolar-mdc", "id": "dark"},
{"text":"Light", "href": "#npolar-mdc", "id": "light"}
]'
fixed
dark
></nav-bar>
<main>
<card-mdc>
<div slot="secondary">
<select-enum
name="area"
label="area"
value="Dronning Maud Land"
enum='["", "Svalbard", "Jan Mayen", "Bouvetøya", "Peter I Øy", "Dronning Maud Land"]'
>
</select-enum>
</div>
</card-mdc>

<section>
<!--<div>
<input-mdc
fullwidth
name="fullwidth"
helper="Helper text"
placeholder="fullwidth"
></input-mdc>
</div>-->
<div>
<input-mdc autofocus label="input-mdc[autofocus]"></input-mdc>
<input-search name="search" label="input-search"></input-search>
<input-password
label="input-password"
name="password"
></input-password>
<input-lock label="input-lock"></input-lock>
</div>
</section>
<body>
<demo-app></demo-app>
<script type="module" src="demo-app.js"></script>
<script type="nomodule" src="@npolar/mdc/nomodule.js"></script>

<section>
<div>
<button-mdc>button-mdc</button-mdc>
<button-mdc outlined>outlined</button-mdc>
<button-mdc raised>raised</button-mdc>
<button-mdc id="dark-light" class="_2ndary" raised
>secondary
</button-mdc>
</div>
<div>
<button-mdc icon="cloud" label="cloud"></button-mdc>
<button-mdc icon="cloud" label="outlined" outlined></button-mdc>
<button-mdc icon="cloud" label="raised"></button-mdc>
<button-mdc
icon="error"
class="danger"
label="dangerous"
raised
outlined
></button-mdc>
</div>
<div>
<button-icon-toggle
on
icon="menu"
icon-toggle="close"
></button-icon-toggle>
<button-icon class="danger" icon="warning"></button-icon>
</div>
<div>
<button-fab icon="edit"></button-fab>
<button-fab icon="add" mini></button-fab>
<button-fab icon="cloud" extended label="Upload"></button-fab>
<button-fab icon="share" class="black-on-white"></button-fab>
</div>
</section>
</main>
<script type="module" src="/@npolar/mdc/demo.js"></script>
<noscript>
<header>
<h1 lang="nn">Krev JavaScript…</h1>
<h1 lang="en">Requires JavaScript…</h1>
</header>
<article lang="nn"></article>
<article lang="en"></article>
</noscript>
</body>
</html>
Binary file added asset/npolar/icon/npolar-icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 3 additions & 13 deletions bin/build-styles
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
#!/usr/bin/env bash
before='//Auto-generated: DO NOT EDIT (see `bin/build-styles`)
import { css } from "lit-element";
export default css`'
after='`;'
bin="./node_modules/.bin"
dist="dist/@npolar/mdc"
find ./src -name "*.scss" -not -name "_*" -print0 | while read -d $'\0' sassfile
do
cssfile=`echo ${sassfile} | sed -e 's/.scss/.css/' | sed -e 's/src\//dist\/@npolar\/mdc\/css\//'`
cssjsfile=`echo ${sassfile} | sed -e 's/.scss/-scss.js/'`

echo "Building ${sassfile} -> ${cssjsfile}"
echo "Building ${sassfile} -> ${cssjsfile} [$cssfile]"
./node_modules/material-components-web-components/scripts/sass-render/bin/sass-render.js -t tpl-export-scss -s ${sassfile} -o ${cssjsfile}
mkdir -p `dirname $cssfile`
css=`cat $sassfile \
| $bin/node-sass --omit-source-map-url --output-style=compressed --include-path=./node_modules:./src \
| $bin/postcss --use autoprefixer --no-map`
echo $css > $cssfile;
echo "$before$css$after" > $cssjsfile
cat $cssjsfile | tail -n +2 | sed 's/`;$//' | sed 's/export default css`//' > $cssfile
done
10 changes: 5 additions & 5 deletions bin/copy-assets
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env sh
dist=dist/@npolar/mdc
asset=asset
mkdir -p $dist
rm $dist/* -rf

# Web root
cp ./asset/index.html dist/
cp ./asset/robots.txt dist/
cp ./asset/favicon.ico dist/
cp -f $asset/index.html dist/
cp -f $asset/favicon.ico dist/
cp -f $asset/robots.txt dist/

# Other assets into /@npolar/mdc
cp -r ./asset/* $dist
cp -r $asset/* $dist
15 changes: 15 additions & 0 deletions bin/prepare
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
rm -rf dist/*

mkdir -p node_modules
cd node_modules && rm -rf material-components-web-components
git clone https://github.com/material-components/material-components-web-components
cd -

./bin/build-styles
./bin/copy-assets

# find node_modules/material-components-web-components/packages -name "*.ts" -not -name "_*" -not -name "*test.ts" -print0 | while read -d $'\0' ts
# do
# tsc $ts -t ES2019 -m es2015 --outDir _mwc
# done
89 changes: 61 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,77 @@
{
"name": "@npolar/mdc",
"version": "0.0.1-pre",
"version": "0.10.0",
"license": "MIT",
"type": "module",
"dependencies": {
"@material/base": "4.0.0",
"@material/card": "4.0.0",
"@material/list": "4.0.0",
"@material/mwc-base": "*",
"@material/mwc-button": "*",
"@material/mwc-fab": "*",
"@material/mwc-icon": "*",
"@material/mwc-icon-button": "*",
"@material/mwc-icon-button-toggle": "*",
"@material/mwc-textfield": "*",
"@material/select": "*",
"@material/touch-target": "*",
"lit-element": "=2.2.1",
"weightless": "=0.0.36"
"@material/base": "=6.0.0-canary.35a32aaea.0",
"@material/button": "=6.0.0-canary.35a32aaea.0",
"@material/card": "=6.0.0-canary.35a32aaea.0",
"@material/checkbox": "=6.0.0-canary.35a32aaea.0",
"@material/chips": "=6.0.0-canary.35a32aaea.0",
"@material/data-table": "=6.0.0-canary.35a32aaea.0",
"@material/drawer": "=6.0.0-canary.35a32aaea.0",
"@material/list": "=6.0.0-canary.35a32aaea.0",
"@material/menu": "=6.0.0-canary.35a32aaea.0",
"@material/mwc-base": "0.14.1",
"@material/mwc-button": "0.14.1",
"@material/mwc-dialog": "^0.17.2",
"@material/mwc-drawer": "0.14.1",
"@material/mwc-fab": "0.14.1",
"@material/mwc-formfield": "0.14.1",
"@material/mwc-icon": "0.14.1",
"@material/mwc-icon-button": "0.14.1",
"@material/mwc-icon-button-toggle": "0.14.1",
"@material/mwc-list": "0.14.1",
"@material/mwc-menu": "0.14.1",
"@material/mwc-select": "0.14.1",
"@material/mwc-slider": "0.14.1",
"@material/mwc-snackbar": "0.14.1",
"@material/mwc-switch": "0.14.1",
"@material/mwc-tab-bar": "0.14.1",
"@material/mwc-textarea": "0.14.1",
"@material/mwc-textfield": "0.14.1",
"@material/select": "=6.0.0-canary.35a32aaea.0",
"@material/tab-bar": "=6.0.0-canary.35a32aaea.0",
"@material/top-app-bar": "=6.0.0-canary.35a32aaea.0",
"@material/touch-target": "=6.0.0-canary.35a32aaea.0",
"@npolar/fetch-api": "https://github.com/npolar/fetch-api#v1.0.0",
"@vaadin/router": "1.7.2",
"lit-element": "2.3.1",
"lit-translate": "1.2.1"
},
"browserslist": [
"chrome 69"
"chrome 73"
],
"devDependencies": {
"autoprefixer": "^9",
"eslint": "^7.11.0",
"node-sass": "^4",
"postcss-cli": "^6",
"rollup": "^1.22",
"rollup-plugin-eslint": "^7",
"rollup-plugin-live-server": "^1",
"rollup-plugin-node-resolve": "^5"
"@rollup/plugin-commonjs": "=16.0.0",
"@rollup/plugin-node-resolve": "=10.0.0",
"autoprefixer": "=9.8.6",
"command-line-args": "=5.1.1",
"command-line-usage": "=6.1.0",
"eslint": "=7.11.0",
"node-sass-import": "=2.0.1",
"postcss-cli": "=7.1.2",
"rollup": "=2.33.3",
"rollup-plugin-eslint": "=7.0.0",
"rollup-plugin-filesize": "=9.0.2",
"rollup-plugin-live-server": "=1.0.3",
"rollup-plugin-terser": "=5.3.0",
"sass": "=1.29.0"
},
"scripts": {
"dev": "yarn prebuild && yarn rollup -c -w",
"prepare": "./bin/prepare",
"eslint": "eslint src",
"pretest": "yarn eslint",
"test": "yarn build",
"prebuild": "./bin/copy-assets && ./bin/build-styles",
"build": "yarn rollup -c",
"now": "yarn build && cp now.json dist/ && cd dist && now && cd -"
"build-styles": "./bin/build-styles",
"now": "cp now.json dist/ && cd src && now && cd -",
"predev": "./bin/copy-assets",
"dev": "yarn rollup -c -w",
"prebuild": "./bin/copy-assets",
"build": "yarn rollup -c"
},
"vaadin": {
"disableUsageStatistics": true
}
}
Loading

0 comments on commit 046b3ce

Please sign in to comment.