dls-graphics
Advanced tools
Comparing version 0.1.4 to 1.0.0-alpha.1
@@ -17,3 +17,2 @@ import fs from 'fs' | ||
const ENTRY_MODULE = resolve(DIST_DIR, 'index.js') | ||
const ENTRY_SEPARATE_MODULE = resolve(SEPARATE_DIR, 'index.js') | ||
const EXPORT_TPL = resolve(__dirname, './export.ejs') | ||
@@ -30,4 +29,3 @@ | ||
const exportsSingle = [] | ||
const exportsSeparate = [] | ||
const exportStatements = [] | ||
const renderExport = compile(await readFile(EXPORT_TPL, 'utf8')) | ||
@@ -49,11 +47,9 @@ const files = await readdir(SRC_DIR) | ||
const variable = camelCase(basename(file, extname(file))) | ||
exportsSingle.push( | ||
renderExport({ context: { variable, data: stringify(dataSingle) } }) | ||
) | ||
exportsSeparate.push( | ||
exportStatements.push( | ||
renderExport({ | ||
context: { | ||
variable, | ||
all: stringify(dataSingle), | ||
data: stringify(dataSeparate), | ||
css: css ? css.replace(/'/g, "\\'") : null | ||
css: stringify(css || '') | ||
} | ||
@@ -65,4 +61,3 @@ }) | ||
await writeFile(ENTRY_MODULE, exportsSingle.join('\n'), 'utf8') | ||
await writeFile(ENTRY_SEPARATE_MODULE, exportsSeparate.join('\n'), 'utf8') | ||
await writeFile(ENTRY_MODULE, exportStatements.join('\n'), 'utf8') | ||
@@ -80,3 +75,5 @@ console.log('Build complete.') | ||
await writeFile(outputSvgFile, svg, 'utf8') | ||
await writeFile(outputCssFile, css || '', 'utf8') | ||
if (extractCss) { | ||
await writeFile(outputCssFile, css || '', 'utf8') | ||
} | ||
@@ -83,0 +80,0 @@ return result |
> ⚠️ - Breaking Changes | ||
## 1.0.0-alpha.1 | ||
- ⚠️ Removed `dist/separate/index.js`. | ||
- All exports are merged in the main entry. For an asset named `foo`, we always export `foo`, `fooContent` and `fooCss` at the same time. | ||
- Provided a CJS entry at `dist/index.cjs.js`. | ||
## 0.1.4 | ||
- Fix `module` entry. | ||
## 0.1.3 | ||
@@ -4,0 +14,0 @@ |
@@ -1,2 +0,20 @@ | ||
export const forbidden = { | ||
export var serverError = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-9-10H91V90H-9z"/><g stroke="#A8B0BF" stroke-width="2.8" transform="translate(41 38)"><circle cx="20" cy="20" r="20"/><g stroke-linecap="round" stroke-linejoin="round"><path d="M14 14l11.314 11.314M25.314 14L14 25.314"/></g></g><g transform="translate(2 2)"><rect width="66" height="20" stroke="#A8B0BF" stroke-width="2.8" rx="10"/><rect width="26" height="6" x="31" y="7" fill="#E2E6F0" rx="3"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g><g transform="translate(2 28)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M33.394 20h-23.33C4.506 20 0 15.523 0 10S4.506 0 10.064 0h47.215A9.819 9.819 0 0166 5.278"/><rect width="11" height="6" x="31" y="7" fill="#E2E6F0" rx="3"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g><g transform="translate(2 54)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M37.479 20H10C4.477 20 0 15.523 0 10S4.477 0 10 0h21.333"/><rect width="4" height="6" x="31" y="7" fill="#E2E6F0" rx="2"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g></g>', | ||
attrs: { | ||
width: '83', | ||
height: '80', | ||
viewBox: '0 0 83 80' | ||
} | ||
} | ||
export var serverErrorContent = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-9-10H91V90H-9z"/><g stroke="#A8B0BF" stroke-width="2.8" transform="translate(41 38)"><circle cx="20" cy="20" r="20"/><g stroke-linecap="round" stroke-linejoin="round"><path d="M14 14l11.314 11.314M25.314 14L14 25.314"/></g></g><g transform="translate(2 2)"><rect width="66" height="20" stroke="#A8B0BF" stroke-width="2.8" rx="10"/><rect width="26" height="6" x="31" y="7" fill="#E2E6F0" rx="3"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g><g transform="translate(2 28)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M33.394 20h-23.33C4.506 20 0 15.523 0 10S4.506 0 10.064 0h47.215A9.819 9.819 0 0166 5.278"/><rect width="11" height="6" x="31" y="7" fill="#E2E6F0" rx="3"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g><g transform="translate(2 54)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M37.479 20H10C4.477 20 0 15.523 0 10S4.477 0 10 0h21.333"/><rect width="4" height="6" x="31" y="7" fill="#E2E6F0" rx="2"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g></g>', | ||
attrs: { | ||
width: '83', | ||
height: '80', | ||
viewBox: '0 0 83 80' | ||
} | ||
} | ||
export var serverErrorCss = '' | ||
export var forbidden = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-10-10H90V90H-10z"/><g transform="translate(2 2)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M43.796 75H7.385C3.306 75 0 71.776 0 67.8V34.2C0 30.224 3.306 27 7.385 27h49.23C60.694 27 64 30.224 64 34.2v4.684"/><rect width="16" height="16" x="56" y="46" stroke="#A8B0BF" stroke-width="2.8" rx="8"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M52 74c0-6.627 5.373-12 12-12s12 5.373 12 12"/><path stroke="#A8B0BF" stroke-width="2.8" d="M32 0c9.941 0 18 8.059 18 18v9h0-36v-9c0-9.941 8.059-18 18-18z"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.8" d="M21 27v-9c0-6.075 4.925-11 11-11s11 4.925 11 11v1.478h0"/><circle cx="32" cy="46" r="6" fill="#E2E6F0"/><path fill="#E2E6F0" d="M29 46h6v13a3 3 0 01-6 0V46z"/></g></g>', | ||
@@ -9,5 +27,13 @@ attrs: { | ||
} | ||
export const forbiddenCss = '' | ||
export var forbiddenContent = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-10-10H90V90H-10z"/><g transform="translate(2 2)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M43.796 75H7.385C3.306 75 0 71.776 0 67.8V34.2C0 30.224 3.306 27 7.385 27h49.23C60.694 27 64 30.224 64 34.2v4.684"/><rect width="16" height="16" x="56" y="46" stroke="#A8B0BF" stroke-width="2.8" rx="8"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M52 74c0-6.627 5.373-12 12-12s12 5.373 12 12"/><path stroke="#A8B0BF" stroke-width="2.8" d="M32 0c9.941 0 18 8.059 18 18v9h0-36v-9c0-9.941 8.059-18 18-18z"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.8" d="M21 27v-9c0-6.075 4.925-11 11-11s11 4.925 11 11v1.478h0"/><circle cx="32" cy="46" r="6" fill="#E2E6F0"/><path fill="#E2E6F0" d="M29 46h6v13a3 3 0 01-6 0V46z"/></g></g>', | ||
attrs: { | ||
width: '80', | ||
height: '79', | ||
viewBox: '0 0 80 79' | ||
} | ||
} | ||
export var forbiddenCss = '' | ||
export const notFound = { | ||
export var notFound = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-6-9H94V91H-6z"/><g transform="translate(-1 2)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.8" d="M69.647 10.521C63.134 4.02 54.143 0 44.214 0c-19.882 0-36 16.118-36 36s16.118 36 36 36 36-16.118 36-36c0-5.626-1.29-10.952-3.592-15.695"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M48.922 71.567c1.262-2.103.694-6.718-3.059-8.355-3.752-1.638-6.758 2.067-9.432 2.387-2.675.32-5.006-2.695-7.293 1.461M59.307 5.379a5 5 0 11-9.272-3.746"/><path fill="#E2E6F0" fill-rule="nonzero" d="M29.298 10.22a1.75 1.75 0 111.697 3.06c-6.69 3.71-11.563 10.091-13.328 17.561a1.75 1.75 0 01-3.406-.804c1.992-8.435 7.49-15.632 15.037-19.817z"/><circle cx="14.964" cy="36.75" r="1.75" fill="#E2E6F0"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.8" d="M8.214 37.879c-4.532 3.626-6.344 6.669-5.535 9.687 1.434 5.351 12.219 7.419 26.656 5.9m9.08-1.349c3.06-.579 6.215-1.297 9.422-2.157 22.94-6.146 39.913-17.184 37.912-24.652-.774-2.886-3.895-5.008-9.125-5.008"/></g></g>', | ||
@@ -20,15 +46,13 @@ attrs: { | ||
} | ||
export const notFoundCss = '' | ||
export const serverError = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-9-10H91V90H-9z"/><g stroke="#A8B0BF" stroke-width="2.8" transform="translate(41 38)"><circle cx="20" cy="20" r="20"/><g stroke-linecap="round" stroke-linejoin="round"><path d="M14 14l11.314 11.314M25.314 14L14 25.314"/></g></g><g transform="translate(2 2)"><rect width="66" height="20" stroke="#A8B0BF" stroke-width="2.8" rx="10"/><rect width="26" height="6" x="31" y="7" fill="#E2E6F0" rx="3"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g><g transform="translate(2 28)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M33.394 20h-23.33C4.506 20 0 15.523 0 10S4.506 0 10.064 0h47.215A9.819 9.819 0 0166 5.278"/><rect width="11" height="6" x="31" y="7" fill="#E2E6F0" rx="3"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g><g transform="translate(2 54)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M37.479 20H10C4.477 20 0 15.523 0 10S4.477 0 10 0h21.333"/><rect width="4" height="6" x="31" y="7" fill="#E2E6F0" rx="2"/><rect width="4" height="4" x="9" y="8" fill="#A8B0BF" rx="2"/></g></g>', | ||
export var notFoundContent = { | ||
contents: '<g fill="none" fill-rule="evenodd"><path d="M-6-9H94V91H-6z"/><g transform="translate(-1 2)"><path stroke="#A8B0BF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.8" d="M69.647 10.521C63.134 4.02 54.143 0 44.214 0c-19.882 0-36 16.118-36 36s16.118 36 36 36 36-16.118 36-36c0-5.626-1.29-10.952-3.592-15.695"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-width="2.8" d="M48.922 71.567c1.262-2.103.694-6.718-3.059-8.355-3.752-1.638-6.758 2.067-9.432 2.387-2.675.32-5.006-2.695-7.293 1.461M59.307 5.379a5 5 0 11-9.272-3.746"/><path fill="#E2E6F0" fill-rule="nonzero" d="M29.298 10.22a1.75 1.75 0 111.697 3.06c-6.69 3.71-11.563 10.091-13.328 17.561a1.75 1.75 0 01-3.406-.804c1.992-8.435 7.49-15.632 15.037-19.817z"/><circle cx="14.964" cy="36.75" r="1.75" fill="#E2E6F0"/><path stroke="#A8B0BF" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.8" d="M8.214 37.879c-4.532 3.626-6.344 6.669-5.535 9.687 1.434 5.351 12.219 7.419 26.656 5.9m9.08-1.349c3.06-.579 6.215-1.297 9.422-2.157 22.94-6.146 39.913-17.184 37.912-24.652-.774-2.886-3.895-5.008-9.125-5.008"/></g></g>', | ||
attrs: { | ||
width: '83', | ||
height: '80', | ||
viewBox: '0 0 83 80' | ||
width: '87', | ||
height: '76', | ||
viewBox: '0 0 87 76' | ||
} | ||
} | ||
export const serverErrorCss = '' | ||
export var notFoundCss = '' | ||
export const loading = { | ||
export var loading = { | ||
contents: '<g style="transform-origin:50% 50%;animation:spin-359eb 2s linear infinite"><circle cx="50%" cy="50%" r="29" fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="6" style="transform-origin:50% 50%;transform:rotate(-90deg);stroke-dasharray:182.21;stroke-dashoffset:163.99;animation:scale-359eb 2s infinite"/></g><style>@keyframes spin-359eb{0%{transform:rotate(0deg)}to{transform:rotate(450deg)}}@keyframes scale-359eb{0%{animation-timing-function:cubic-bezier(.33,0,.2,1);stroke-dashoffset:163.99}60%{animation-timing-function:cubic-bezier(.33,0,.33,1);stroke-dashoffset:27.33;transform:rotate(-90deg)}to{stroke-dashoffset:163.99;transform:rotate(180deg)}}@keyframes simple-spin-359eb{0%{transform:rotate(-90deg)}to{transform:rotate(270deg)}}.dls-loading,_:-ms-lang(x){animation:simple-spin-359eb 1s linear infinite}.dls-loading circle,_:-ms-lang(x){stroke-dashoffset:136.66}</style>', | ||
@@ -42,2 +66,11 @@ attrs: { | ||
} | ||
export const loadingCss = '' | ||
export var loadingContent = { | ||
contents: '<g style="transform-origin:50% 50%;animation:spin-359eb 2s linear infinite"><circle cx="50%" cy="50%" r="29" fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="6" style="transform-origin:50% 50%;transform:rotate(-90deg);stroke-dasharray:182.21;stroke-dashoffset:163.99;animation:scale-359eb 2s infinite"/></g>', | ||
attrs: { | ||
width: '40', | ||
height: '40', | ||
class: 'dls-loading', | ||
viewBox: '0 0 64 64' | ||
} | ||
} | ||
export var loadingCss = '@keyframes spin-359eb{0%{transform:rotate(0deg)}to{transform:rotate(450deg)}}@keyframes scale-359eb{0%{animation-timing-function:cubic-bezier(.33,0,.2,1);stroke-dashoffset:163.99}60%{animation-timing-function:cubic-bezier(.33,0,.33,1);stroke-dashoffset:27.33;transform:rotate(-90deg)}to{stroke-dashoffset:163.99;transform:rotate(180deg)}}@keyframes simple-spin-359eb{0%{transform:rotate(-90deg)}to{transform:rotate(270deg)}}.dls-loading,_:-ms-lang(x){animation:simple-spin-359eb 1s linear infinite}.dls-loading circle,_:-ms-lang(x){stroke-dashoffset:136.66}' |
{ | ||
"name": "dls-graphics", | ||
"version": "0.1.4", | ||
"version": "1.0.0-alpha.1", | ||
"description": "Graphics materials for Baidu Light DLS.", | ||
"scripts": { | ||
"prepare": "npm run build", | ||
"build": "node -r esm build/index.js" | ||
"build": "node -r esm build/index.js && rollup -c" | ||
}, | ||
@@ -14,3 +14,3 @@ "keywords": [ | ||
], | ||
"main": "dist/index.js", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.js", | ||
@@ -30,2 +30,3 @@ "author": "Justineo (justice360@gmail.com)", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.34.0", | ||
"stringify-object": "^3.3.0", | ||
@@ -32,0 +33,0 @@ "svgo": "^1.3.2", |
Sorry, the diff of this file is not supported yet
47013
429
10
28