Bump dev (incl. eslint fixes) (#302)

* Bump dev (incl. eslint fixes)

* Ordering fixes
This commit is contained in:
Jaco Greeff
2020-04-01 21:24:45 +02:00
committed by GitHub
parent cc4fa53339
commit 175f876101
22 changed files with 246 additions and 225 deletions
+2 -2
View File
@@ -6,8 +6,8 @@ module.exports = Object.assign({}, config, {
'@polkadot/react-(identicon|qr)(.*)$': '<rootDir>/packages/react-$1/src/$2', '@polkadot/react-(identicon|qr)(.*)$': '<rootDir>/packages/react-$1/src/$2',
'@polkadot/reactnative-(identicon)(.*)$': '<rootDir>/packages/reactnative-$1/src/$2', '@polkadot/reactnative-(identicon)(.*)$': '<rootDir>/packages/reactnative-$1/src/$2',
'@polkadot/ui-(assets|keyring|settings|shared)(.*)$': '<rootDir>/packages/ui-$1/src/$2', '@polkadot/ui-(assets|keyring|settings|shared)(.*)$': '<rootDir>/packages/ui-$1/src/$2',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object', '\\.(css|less)$': 'empty/object',
'\\.(css|less)$': 'empty/object' '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': 'empty/object'
}, },
resolver: './jest.resolver.js' resolver: './jest.resolver.js'
}); });
+1 -1
View File
@@ -32,7 +32,7 @@
"devDependencies": { "devDependencies": {
"@babel/core": "^7.9.0", "@babel/core": "^7.9.0",
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@polkadot/dev": "^0.52.1", "@polkadot/dev": "^0.52.3",
"@polkadot/ts": "^0.3.14", "@polkadot/ts": "^0.3.14",
"@types/jest": "^25.1.4", "@types/jest": "^25.1.4",
"babel-plugin-transform-vue-template": "^0.4.2", "babel-plugin-transform-vue-template": "^0.4.2",
+17 -17
View File
@@ -11,26 +11,11 @@ module.exports = {
devtool: 'cheap-eval-source-map', devtool: 'cheap-eval-source-map',
entry: './src/index.tsx', entry: './src/index.tsx',
mode: 'development', mode: 'development',
output: {
chunkFilename: '[name].[chunkhash:8].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
filename: '[name].js',
path: path.join(__dirname, 'build')
},
resolve: {
alias: {
'@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'),
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts', '.tsx']
},
module: { module: {
rules: [ rules: [
{ {
test: /\.(ts|tsx)$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
test: /\.(ts|tsx)$/,
use: [ use: [
{ {
loader: 'babel-loader', loader: 'babel-loader',
@@ -40,14 +25,29 @@ module.exports = {
} }
] ]
}, },
output: {
chunkFilename: '[name].[chunkhash:8].js',
filename: '[name].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
path: path.join(__dirname, 'build')
},
plugins: [ plugins: [
new WebpackPluginServe({ new WebpackPluginServe({
hmr: false, // switch off, Chrome WASM memory leak hmr: false, // switch off, Chrome WASM memory leak
liveReload: false, // explict off, overrides hmr liveReload: false, // explict off, overrides hmr
progress: false, // since we have hmr off, disable
port: 8080, port: 8080,
progress: false, // since we have hmr off, disable
static: __dirname static: __dirname
}) })
], ],
resolve: {
alias: {
'@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'),
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts', '.tsx']
},
watch: true watch: true
}; };
+19 -19
View File
@@ -33,6 +33,25 @@ function generateAccount (ss58Format: Prefix = 42): Account {
} }
const Example = Vue.extend({ const Example = Vue.extend({
components: {
Identicon
},
data: function (): Data {
return {
...generateAccount(),
ss58Format: 42,
ss58Options
};
},
methods: {
onClickNew: function (): void {
const { address, phrase } = generateAccount(this.ss58Format);
this.address = address;
this.phrase = phrase;
}
},
name: 'Example',
template: ` template: `
<div id="example"> <div id="example">
<section> <section>
@@ -62,25 +81,6 @@ const Example = Vue.extend({
</section> </section>
</div> </div>
`, `,
name: 'Example',
components: {
Identicon
},
data: function (): Data {
return {
...generateAccount(),
ss58Format: 42,
ss58Options
};
},
methods: {
onClickNew: function (): void {
const { address, phrase } = generateAccount(this.ss58Format);
this.address = address;
this.phrase = phrase;
}
},
watch: { watch: {
ss58Format: function (): void { ss58Format: function (): void {
this.address = keyring.encodeAddress(this.address, this.ss58Format); this.address = keyring.encodeAddress(this.address, this.ss58Format);
+29 -29
View File
@@ -13,12 +13,40 @@ module.exports = {
devtool: 'cheap-eval-source-map', devtool: 'cheap-eval-source-map',
entry: './src/index.ts', entry: './src/index.ts',
mode: 'development', mode: 'development',
module: {
rules: [
{
exclude: /(node_modules)/,
test: /\.(ts|tsx)$/,
use: [
{
loader: 'babel-loader',
options: require('../../babel.config.js')
}
]
},
{
loader: 'vue-loader',
test: /\.vue$/
}
]
},
output: { output: {
chunkFilename: '[name].[chunkhash:8].js', chunkFilename: '[name].[chunkhash:8].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
filename: '[name].js', filename: '[name].js',
globalObject: '(typeof self !== \'undefined\' ? self : this)',
path: path.join(__dirname, 'build') path: path.join(__dirname, 'build')
}, },
plugins: [
new WebpackPluginServe({
hmr: false, // switch off, Chrome WASM memory leak
liveReload: false, // explict off, overrides hmr
port: 8080,
progress: false, // since we have hmr off, disable
static: __dirname
}),
new VueLoaderPlugin()
],
resolve: { resolve: {
alias: { alias: {
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'), '@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
@@ -28,33 +56,5 @@ module.exports = {
}, },
extensions: ['.js', '.ts', '.tsx'] extensions: ['.js', '.ts', '.tsx']
}, },
module: {
rules: [
{
test: /\.(ts|tsx)$/,
exclude: /(node_modules)/,
use: [
{
loader: 'babel-loader',
options: require('../../babel.config.js')
}
]
},
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
new WebpackPluginServe({
hmr: false, // switch off, Chrome WASM memory leak
liveReload: false, // explict off, overrides hmr
progress: false, // since we have hmr off, disable
port: 8080,
static: __dirname
}),
new VueLoaderPlugin()
],
watch: true watch: true
}; };
+19 -19
View File
@@ -11,36 +11,36 @@ import settings from '@polkadot/ui-settings';
import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto'; import { mnemonicGenerate, cryptoWaitReady } from '@polkadot/util-crypto';
const styles = StyleSheet.create({ const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter
},
body: { body: {
backgroundColor: Colors.white backgroundColor: Colors.white
}, },
buttonContainer: {
alignItems: 'flex-start',
flex: 1,
flexDirection: 'column'
},
mainTitle: {
color: Colors.black,
fontSize: 28,
fontWeight: '600'
},
scrollView: {
backgroundColor: Colors.lighter
},
sectionContainer: { sectionContainer: {
marginTop: 32, marginTop: 32,
paddingHorizontal: 24 paddingHorizontal: 24
}, },
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black
},
mainTitle: {
fontSize: 28,
fontWeight: '600',
color: Colors.black
},
sectionDescription: { sectionDescription: {
marginTop: 8, color: Colors.dark,
fontSize: 18, fontSize: 18,
fontWeight: '400', fontWeight: '400',
color: Colors.dark marginTop: 8
}, },
buttonContainer: { sectionTitle: {
flex: 1, color: Colors.black,
flexDirection: 'column', fontSize: 24,
alignItems: 'flex-start' fontWeight: '600'
} }
}); });
+9 -12
View File
@@ -8,24 +8,16 @@ let workspacesBuildDirs = workspaces.map((workspace) => path.join(workspace, 'bu
workspacesBuildDirs = workspacesBuildDirs.filter((item) => item !== path.join(__dirname, '../reactnative-identicon/build/')); workspacesBuildDirs = workspacesBuildDirs.filter((item) => item !== path.join(__dirname, '../reactnative-identicon/build/'));
module.exports = { module.exports = {
// watch other packages as well as root node_modules
watchFolders: [
path.resolve(__dirname, '../../node_modules'),
...workspacesBuildDirs
],
// remap node packages to react-native packages // remap node packages to react-native packages
resolver: { resolver: {
extraNodeModules: { extraNodeModules: {
crypto: require.resolve('react-native-crypto'), crypto: require.resolve('react-native-crypto'),
stream: require.resolve('stream-http'), os: require.resolve('os-browserify'),
vm: require.resolve('vm-browserify'),
process: require.resolve('process'), process: require.resolve('process'),
os: require.resolve('os-browserify') stream: require.resolve('stream-http'),
vm: require.resolve('vm-browserify')
} }
}, },
transformer: { transformer: {
getTransformOptions: () => ({ getTransformOptions: () => ({
transform: { transform: {
@@ -33,5 +25,10 @@ module.exports = {
inlineRequires: false inlineRequires: false
} }
}) })
} },
// watch other packages as well as root node_modules
watchFolders: [
path.resolve(__dirname, '../../node_modules'),
...workspacesBuildDirs
]
}; };
+13 -13
View File
@@ -13,27 +13,27 @@ module.exports = {
devtool: isProd ? 'source-map' : 'cheap-eval-source-map', devtool: isProd ? 'source-map' : 'cheap-eval-source-map',
entry: './src/Demo.tsx', entry: './src/Demo.tsx',
mode: ENV, mode: ENV,
output: {
path: __dirname,
filename: './demo.js'
},
resolve: {
alias: {
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.jsx', '.ts', '.tsx']
},
module: { module: {
rules: [ rules: [
{ {
test: /\.(js|ts|tsx)$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
test: /\.(js|ts|tsx)$/,
use: [ use: [
'babel-loader' 'babel-loader'
] ]
} }
] ]
}, },
plugins: [] output: {
filename: './demo.js',
path: __dirname
},
plugins: [],
resolve: {
alias: {
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.jsx', '.ts', '.tsx']
}
}; };
+6 -6
View File
@@ -42,15 +42,15 @@ function getDataUrl (value: Uint8Array): string {
class Display extends React.PureComponent<Props, State> { class Display extends React.PureComponent<Props, State> {
public state: State = { public state: State = {
frames: [],
frameIdx: 0, frameIdx: 0,
frames: [],
image: null, image: null,
timerDelay: FRAME_DELAY, timerDelay: FRAME_DELAY,
timerId: null, timerId: null,
valueHash: null valueHash: null
}; };
public static getDerivedStateFromProps ({ value, skipEncoding = false }: Props, prevState: State): Pick<State, never> | null { public static getDerivedStateFromProps ({ skipEncoding = false, value }: Props, prevState: State): Pick<State, never> | null {
const valueHash = xxhashAsHex(value); const valueHash = xxhashAsHex(value);
if (valueHash === prevState.valueHash) { if (valueHash === prevState.valueHash) {
@@ -63,8 +63,8 @@ class Display extends React.PureComponent<Props, State> {
// encode on demand // encode on demand
return { return {
frames,
frameIdx: 0, frameIdx: 0,
frames,
image: getDataUrl(frames[0]), image: getDataUrl(frames[0]),
valueHash valueHash
}; };
@@ -108,7 +108,7 @@ class Display extends React.PureComponent<Props, State> {
} }
private nextFrame = (): void => { private nextFrame = (): void => {
const { frames, frameIdx, timerDelay } = this.state; const { frameIdx, frames, timerDelay } = this.state;
if (!frames || frames.length <= 1) { if (!frames || frames.length <= 1) {
return; return;
@@ -126,8 +126,8 @@ class Display extends React.PureComponent<Props, State> {
this.setState({ this.setState({
frameIdx: nextIdx, frameIdx: nextIdx,
image: getDataUrl(frames[nextIdx]), image: getDataUrl(frames[nextIdx]),
timerId, timerDelay: nextDelay,
timerDelay: nextDelay timerId
}); });
} }
} }
+4 -4
View File
@@ -23,9 +23,9 @@ const RECENT_EXPIRY = 24 * 60 * 60;
// from the API after the chain is received // from the API after the chain is received
export class Keyring extends Base implements KeyringStruct { export class Keyring extends Base implements KeyringStruct {
#stores = { #stores = {
account: (): AddressSubject => this.accounts,
address: (): AddressSubject => this.addresses, address: (): AddressSubject => this.addresses,
contract: (): AddressSubject => this.contracts, contract: (): AddressSubject => this.contracts
account: (): AddressSubject => this.accounts
}; };
public addExternal (address: string | Uint8Array, meta: KeyringPair$Meta = {}): CreateResult { public addExternal (address: string | Uint8Array, meta: KeyringPair$Meta = {}): CreateResult {
@@ -122,8 +122,8 @@ export class Keyring extends Base implements KeyringStruct {
return info && { return info && {
address, address,
publicKey, meta: info.json.meta,
meta: info.json.meta publicKey
}; };
} }
+2 -2
View File
@@ -40,8 +40,8 @@ class KeyringOption implements KeyringOptionInstance {
public createOptionHeader (name: string): KeyringSectionOption { public createOptionHeader (name: string): KeyringSectionOption {
return { return {
name,
key: `header-${name.toLowerCase()}`, key: `header-${name.toLowerCase()}`,
name,
value: null value: null
}; };
} }
@@ -131,9 +131,9 @@ class KeyringOption implements KeyringOptionInstance {
return { return {
account: [], account: [],
address: [], address: [],
contract: [],
all: [], all: [],
allPlus: [], allPlus: [],
contract: [],
recent: [], recent: [],
testing: [] testing: []
}; };
@@ -1,3 +1,7 @@
// Copyright 2018 @polkadot/ui-shared authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import generate from './polkadotIcon'; import generate from './polkadotIcon';
describe('polkadotIcon', (): void => { describe('polkadotIcon', (): void => {
+14 -12
View File
@@ -29,21 +29,23 @@ const C = S / 2;
const Z = S / 64 * 5; const Z = S / 64 * 5;
const ZERO = blake2(new Uint8Array(32)); const ZERO = blake2(new Uint8Array(32));
/* eslint-disable sort-keys */
const SCHEMA: { [index: string]: Scheme } = { const SCHEMA: { [index: string]: Scheme } = {
target: { freq: 1, colors: [0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 1] }, target: { colors: [0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 0, 28, 0, 1], freq: 1 },
cube: { freq: 20, colors: [0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 5] }, cube: { colors: [0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 0, 1, 3, 2, 4, 3, 5], freq: 20 },
quazar: { freq: 16, colors: [1, 2, 3, 1, 2, 4, 5, 5, 4, 1, 2, 3, 1, 2, 4, 5, 5, 4, 0] }, quazar: { colors: [1, 2, 3, 1, 2, 4, 5, 5, 4, 1, 2, 3, 1, 2, 4, 5, 5, 4, 0], freq: 16 },
flower: { freq: 32, colors: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 3] }, flower: { colors: [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 3], freq: 32 },
cyclic: { freq: 32, colors: [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6] }, cyclic: { colors: [0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6], freq: 32 },
vmirror: { freq: 128, colors: [0, 1, 2, 3, 4, 5, 3, 4, 2, 0, 1, 6, 7, 8, 9, 7, 8, 6, 10] }, vmirror: { colors: [0, 1, 2, 3, 4, 5, 3, 4, 2, 0, 1, 6, 7, 8, 9, 7, 8, 6, 10], freq: 128 },
hmirror: { freq: 128, colors: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 8, 6, 7, 5, 3, 4, 2, 11] } hmirror: { colors: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 8, 6, 7, 5, 3, 4, 2, 11], freq: 128 }
}; };
/* eslint-enable sort-keys */
const OUTER_CIRCLE: Circle = { const OUTER_CIRCLE: Circle = {
cx: C, cx: C,
cy: C, cy: C,
r: C, fill: '#eee',
fill: '#eee' r: C
}; };
function getRotation (isSixPoint: boolean): { r: number; ro2: number; r3o4: number; ro4: number; rroot3o2: number; rroot3o4: number } { function getRotation (isSixPoint: boolean): { r: number; ro2: number; r3o4: number; ro4: number; rroot3o2: number; rroot3o4: number } {
@@ -56,11 +58,11 @@ function getRotation (isSixPoint: boolean): { r: number; ro2: number; r3o4: numb
const ro4 = r / 4; const ro4 = r / 4;
const r3o4 = r * 3 / 4; const r3o4 = r * 3 / 4;
return { r, ro2, r3o4, ro4, rroot3o2, rroot3o4 }; return { r, r3o4, ro2, ro4, rroot3o2, rroot3o4 };
} }
function getCircleXY (isSixPoint: boolean): [number, number][] { function getCircleXY (isSixPoint: boolean): [number, number][] {
const { r, ro2, r3o4, ro4, rroot3o2, rroot3o4 } = getRotation(isSixPoint); const { r, r3o4, ro2, ro4, rroot3o2, rroot3o4 } = getRotation(isSixPoint);
return [ return [
[C, C - r], [C, C - r],
@@ -139,7 +141,7 @@ export default function generate (address: string, isSixPoint = false): Circle[]
return [OUTER_CIRCLE].concat( return [OUTER_CIRCLE].concat(
getCircleXY(isSixPoint).map(([cx, cy], index): Circle => ({ getCircleXY(isSixPoint).map(([cx, cy], index): Circle => ({
cx, cy, r: Z, fill: colors[index] cx, cy, fill: colors[index], r: Z
})) }))
); );
} }
+11 -11
View File
@@ -16,6 +16,16 @@ interface Data {
* @description Demo component * @description Demo component
*/ */
const Demo = Vue.extend({ const Demo = Vue.extend({
components: {
Identicon
},
data: function (): Data {
return {
address: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
size: 128
};
},
name: 'Demo',
template: ` template: `
<div id="demo"> <div id="demo">
<Identicon :size="size" :theme="'polkadot'" :value="address" /> <Identicon :size="size" :theme="'polkadot'" :value="address" />
@@ -23,17 +33,7 @@ const Demo = Vue.extend({
<Identicon :size="size" :theme="'beachball'" :value="address" /> <Identicon :size="size" :theme="'beachball'" :value="address" />
<Identicon :size="size" :theme="'empty'" /> <Identicon :size="size" :theme="'empty'" />
</div> </div>
`, `
name: 'Demo',
data: function (): Data {
return {
address: '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY',
size: 128
};
},
components: {
Identicon
}
}); });
new Vue({ new Vue({
+32 -32
View File
@@ -46,6 +46,38 @@ function encodeAccount (value: string | Uint8Array, prefix?: Prefix): Account {
* ``` * ```
*/ */
export const Identicon = Vue.extend({ export const Identicon = Vue.extend({
components: {
Beachball,
Empty,
Jdenticon,
Polkadot
},
created: function (): void {
this.createData();
},
data: function (): Data {
return {
address: '',
iconSize: DEFAULT_SIZE,
publicKey: '0x',
type: 'empty'
};
},
methods: {
createData: function (): void {
this.iconSize = this.size || DEFAULT_SIZE;
this.type = this.theme;
this.recodeAddress();
},
recodeAddress: function (): void {
const { address, publicKey } = encodeAccount(this.value);
this.address = address;
this.publicKey = publicKey;
}
},
props: ['prefix', 'size', 'theme', 'value'],
// FIXME These nested divs are not correct, would like a different way // FIXME These nested divs are not correct, would like a different way
// here so we don't create a div wrapped for the div wrapper of the icon // here so we don't create a div wrapped for the div wrapper of the icon
template: ` template: `
@@ -62,38 +94,6 @@ export const Identicon = Vue.extend({
<Jdenticon :key="address" :publicKey="publicKey" :size="iconSize" /> <Jdenticon :key="address" :publicKey="publicKey" :size="iconSize" />
</div> </div>
`, `,
props: ['prefix', 'size', 'theme', 'value'],
components: {
Beachball,
Empty,
Jdenticon,
Polkadot
},
data: function (): Data {
return {
address: '',
iconSize: DEFAULT_SIZE,
publicKey: '0x',
type: 'empty'
};
},
created: function (): void {
this.createData();
},
methods: {
createData: function (): void {
this.iconSize = this.size || DEFAULT_SIZE;
this.type = this.theme;
this.recodeAddress();
},
recodeAddress: function (): void {
const { address, publicKey } = encodeAccount(this.value);
this.address = address;
this.publicKey = publicKey;
}
},
watch: { watch: {
value: function (): void { value: function (): void {
this.recodeAddress(); this.recodeAddress();
@@ -14,21 +14,21 @@ interface Data {
* @description The Beachball identicon * @description The Beachball identicon
*/ */
export const Beachball = Vue.extend({ export const Beachball = Vue.extend({
// eslint-disable-next-line quotes created: function (): void {
template: `<div v-html="html" />`, this.createHtml();
props: ['address', 'size'], },
data: function (): Data { data: function (): Data {
return { return {
// eslint-disable-next-line quotes // eslint-disable-next-line quotes
html: `<div />` html: `<div />`
}; };
}, },
created: function (): void {
this.createHtml();
},
methods: { methods: {
createHtml: function (): void { createHtml: function (): void {
this.html = generate(this.address, this.size).outerHTML; this.html = generate(this.address, this.size).outerHTML;
} }
} },
props: ['address', 'size'],
// eslint-disable-next-line quotes
template: `<div v-html="html" />`
}); });
+2 -2
View File
@@ -9,10 +9,10 @@ import Vue from 'vue';
* @description An empty identicon * @description An empty identicon
*/ */
export const Empty = Vue.extend({ export const Empty = Vue.extend({
props: ['size'],
template: ` template: `
<svg :height="size" :width="size" viewBox="0 0 64 64"> <svg :height="size" :width="size" viewBox="0 0 64 64">
<circle cx="50%" cy="50%" fill="#eee" r="50%" /> <circle cx="50%" cy="50%" fill="#eee" r="50%" />
</svg> </svg>
`, `
props: ['size']
}); });
@@ -14,21 +14,21 @@ interface Data {
* @description The substrate default via Jdenticon * @description The substrate default via Jdenticon
*/ */
export const Jdenticon = Vue.extend({ export const Jdenticon = Vue.extend({
// eslint-disable-next-line quotes created: function (): void {
template: `<div v-html="svgHtml" />`, this.createSvgHtml();
props: ['publicKey', 'size'], },
data: function (): Data { data: function (): Data {
return { return {
// eslint-disable-next-line quotes // eslint-disable-next-line quotes
svgHtml: `<svg viewBox="0 0 64 64" />` svgHtml: `<svg viewBox="0 0 64 64" />`
}; };
}, },
created: function (): void {
this.createSvgHtml();
},
methods: { methods: {
createSvgHtml: function (): void { createSvgHtml: function (): void {
this.svgHtml = jdenticon.toSvg(this.publicKey.substr(2), this.size); this.svgHtml = jdenticon.toSvg(this.publicKey.substr(2), this.size);
} }
} },
props: ['publicKey', 'size'],
// eslint-disable-next-line quotes
template: `<div v-html="svgHtml" />`
}); });
+7 -7
View File
@@ -14,18 +14,15 @@ interface Data {
* @description The Polkadot default identicon * @description The Polkadot default identicon
*/ */
export const Polkadot = Vue.extend({ export const Polkadot = Vue.extend({
// eslint-disable-next-line quotes created: function (): void {
template: `<div v-html="svgHtml" />`, this.createSvgHtml();
props: ['address', 'size'], },
data: function (): Data { data: function (): Data {
return { return {
// eslint-disable-next-line quotes // eslint-disable-next-line quotes
svgHtml: `<svg viewBox="0 0 64 64" />` svgHtml: `<svg viewBox="0 0 64 64" />`
}; };
}, },
created: function (): void {
this.createSvgHtml();
},
methods: { methods: {
createSvgHtml: function (): void { createSvgHtml: function (): void {
const circles = generateIcon(this.address).map(({ cx, cy, fill, r }): string => const circles = generateIcon(this.address).map(({ cx, cy, fill, r }): string =>
@@ -34,5 +31,8 @@ export const Polkadot = Vue.extend({
this.svgHtml = `<svg height=${this.size} viewBox='0 0 64 64' width=${this.size}>${circles}</svg>`; this.svgHtml = `<svg height=${this.size} viewBox='0 0 64 64' width=${this.size}>${circles}</svg>`;
} }
} },
props: ['address', 'size'],
// eslint-disable-next-line quotes
template: `<div v-html="svgHtml" />`
}); });
+14 -15
View File
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
// Copyright 2017-2020 @polkadot/react-identicon authors & contributors // Copyright 2017-2020 @polkadot/react-identicon authors & contributors
// This software may be modified and distributed under the terms // This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details. // of the Apache-2.0 license. See the LICENSE file for details.
@@ -14,32 +13,32 @@ module.exports = {
devtool: isProd ? 'source-map' : 'cheap-eval-source-map', devtool: isProd ? 'source-map' : 'cheap-eval-source-map',
entry: './src/Demo.ts', entry: './src/Demo.ts',
mode: ENV, mode: ENV,
output: {
path: path.join(__dirname, 'build'),
filename: './demo.js'
},
resolve: {
alias: {
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts']
},
module: { module: {
rules: [ rules: [
{ {
test: /\.(js|ts)$/,
exclude: /(node_modules)/, exclude: /(node_modules)/,
test: /\.(js|ts)$/,
use: [ use: [
'babel-loader' 'babel-loader'
] ]
}, },
{ {
test: /\.vue$/, loader: 'vue-loader',
loader: 'vue-loader' test: /\.vue$/
} }
] ]
}, },
output: {
filename: './demo.js',
path: path.join(__dirname, 'build')
},
plugins: [ plugins: [
new VueLoaderPlugin() new VueLoaderPlugin()
] ],
resolve: {
alias: {
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts']
}
}; };
+3 -3
View File
@@ -1,15 +1,15 @@
module.exports = { module.exports = {
name: 'Polkadot JS UI libraries',
exclude: '**/*+(index|e2e|spec).ts', exclude: '**/*+(index|e2e|spec).ts',
excludeExternals: true, excludeExternals: true,
excludeNotExported: true, excludeNotExported: true,
excludeProtected: true,
excludePrivate: true, excludePrivate: true,
excludeProtected: true,
hideGenerator: true, hideGenerator: true,
includeDeclarations: false, includeDeclarations: false,
out: 'docs',
module: 'commonjs', module: 'commonjs',
moduleResolution: 'node', moduleResolution: 'node',
name: 'Polkadot JS UI libraries',
out: 'docs',
stripInternal: 'true', stripInternal: 'true',
theme: 'markdown' theme: 'markdown'
}; };
+24 -5
View File
@@ -2971,9 +2971,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@polkadot/dev@npm:^0.52.1": "@polkadot/dev@npm:^0.52.3":
version: 0.52.1 version: 0.52.3
resolution: "@polkadot/dev@npm:0.52.1" resolution: "@polkadot/dev@npm:0.52.3"
dependencies: dependencies:
"@babel/cli": ^7.8.4 "@babel/cli": ^7.8.4
"@babel/core": ^7.9.0 "@babel/core": ^7.9.0
@@ -3014,6 +3014,7 @@ __metadata:
eslint-plugin-promise: ^4.2.1 eslint-plugin-promise: ^4.2.1
eslint-plugin-react: ^7.19.0 eslint-plugin-react: ^7.19.0
eslint-plugin-react-hooks: ^3.0.0 eslint-plugin-react-hooks: ^3.0.0
eslint-plugin-sort-destructure-keys: ^1.3.3
eslint-plugin-standard: ^4.0.1 eslint-plugin-standard: ^4.0.1
fs-extra: ^9.0.0 fs-extra: ^9.0.0
gh-pages: ^2.2.0 gh-pages: ^2.2.0
@@ -3053,7 +3054,7 @@ __metadata:
polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js polkadot-exec-typedoc: scripts/polkadot-exec-typedoc.js
polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js polkadot-exec-vuepress: scripts/polkadot-exec-vuepress.js
polkadot-exec-webpack: scripts/polkadot-exec-webpack.js polkadot-exec-webpack: scripts/polkadot-exec-webpack.js
checksum: 2/40526b91020c188986c6828e3a2ad373d32e581a5852c36193ae11adb3100482943bfeea3fd5d7d149279176ea69575da2e6255f395305c50e1cd70272b97bd5 checksum: 2/aeb6078c70026ea90323925491fe3f6d09ec69d7336655779e56480950013bff880ee64f2a917d0f9850aeb2fc837c7dfa7e717c67b5c237ddfce4ae76aee5a0
languageName: node languageName: node
linkType: hard linkType: hard
@@ -8966,6 +8967,17 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"eslint-plugin-sort-destructure-keys@npm:^1.3.3":
version: 1.3.3
resolution: "eslint-plugin-sort-destructure-keys@npm:1.3.3"
dependencies:
natural-compare-lite: ^1.4.0
peerDependencies:
eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0
checksum: 2/bcf1e4c8d9ebd692269cfbec29fbd321eec86f13273b313c46d5cff6c9434873941db4dfa117f7b71a60e247c3be5df2cdc324d4216b824ac19e3fad259370fd
languageName: node
linkType: hard
"eslint-plugin-standard@npm:^4.0.1": "eslint-plugin-standard@npm:^4.0.1":
version: 4.0.1 version: 4.0.1
resolution: "eslint-plugin-standard@npm:4.0.1" resolution: "eslint-plugin-standard@npm:4.0.1"
@@ -14859,6 +14871,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"natural-compare-lite@npm:^1.4.0":
version: 1.4.0
resolution: "natural-compare-lite@npm:1.4.0"
checksum: 2/18c1c37b8523b08e9ea51043f3f6a7a50c9354fcc0b3ff4ec3437f017f766325e935cf427fd3b39657491f6174a8701c498235acb642c752537ddca5d378ff1f
languageName: node
linkType: hard
"natural-compare@npm:^1.4.0": "natural-compare@npm:^1.4.0":
version: 1.4.0 version: 1.4.0
resolution: "natural-compare@npm:1.4.0" resolution: "natural-compare@npm:1.4.0"
@@ -18199,7 +18218,7 @@ __metadata:
dependencies: dependencies:
"@babel/core": ^7.9.0 "@babel/core": ^7.9.0
"@babel/runtime": ^7.9.2 "@babel/runtime": ^7.9.2
"@polkadot/dev": ^0.52.1 "@polkadot/dev": ^0.52.3
"@polkadot/ts": ^0.3.14 "@polkadot/ts": ^0.3.14
"@types/jest": ^25.1.4 "@types/jest": ^25.1.4
babel-plugin-transform-vue-template: ^0.4.2 babel-plugin-transform-vue-template: ^0.4.2