Skip to content

Commit 3742e65

Browse files
author
Guillaume Chau
committed
feat(ui): prompt type 'color'
1 parent 017e7b9 commit 3742e65

File tree

5 files changed

+96
-5
lines changed

5 files changed

+96
-5
lines changed

packages/@vue/cli-plugin-pwa/ui.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ module.exports = api => {
6868
},
6969
{
7070
name: 'themeColor',
71-
type: 'input',
71+
type: 'color',
7272
message: 'Theme color',
7373
description: 'Color used to theme the browser',
7474
default: '#4DBA87',
7575
value: data.pwa && data.pwa.themeColor
7676
},
7777
{
7878
name: 'backgroundColor',
79-
type: 'input',
79+
type: 'color',
8080
message: 'Splash background color',
8181
description: 'Background color used for the app splash screen',
8282
default: '#000000',
@@ -85,7 +85,7 @@ module.exports = api => {
8585
},
8686
{
8787
name: 'msTileColor',
88-
type: 'input',
88+
type: 'color',
8989
message: 'Windows app tile color',
9090
description: 'Color used for the app tile on Windows',
9191
default: '#000000',

packages/@vue/cli-ui/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"subscriptions-transport-ws": "^0.9.5",
5454
"vue": "^2.5.16",
5555
"vue-apollo": "^3.0.0-beta.5",
56+
"vue-color": "^2.4.6",
5657
"vue-i18n": "^7.6.0",
5758
"vue-instantsearch": "^1.5.1",
5859
"vue-meta": "^1.5.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<template>
2+
<VueDisable
3+
:disabled="!prompt.enabled"
4+
class="prompt prompt-color"
5+
>
6+
<div class="prompt-content">
7+
<ListItemInfo
8+
:name="$t(prompt.message)"
9+
:description="$t(prompt.description)"
10+
:link="prompt.link"
11+
/>
12+
13+
<VueDropdown
14+
class="prompt-input"
15+
>
16+
<VueInput
17+
slot="trigger"
18+
:value="value(prompt.value)"
19+
@input="value => answer(value)"
20+
>
21+
<div slot="right" class="color-preview">
22+
<div class="color-swatch" :style="{
23+
backgroundColor: value(prompt.value)
24+
}" />
25+
</div>
26+
</VueInput>
27+
28+
<ColorPicker
29+
class="color-picker"
30+
:value="value(prompt.value)"
31+
@input="value => answer(value.hex)"
32+
/>
33+
</VueDropdown>
34+
</div>
35+
36+
<PromptError :error="prompt.error"/>
37+
</VueDisable>
38+
</template>
39+
40+
<script>
41+
import Prompt from './Prompt'
42+
import { Sketch } from 'vue-color'
43+
44+
export default {
45+
extends: Prompt,
46+
47+
components: {
48+
ColorPicker: Sketch
49+
}
50+
}
51+
</script>
52+
53+
<style lang="stylus" scoped>
54+
@import "~@/style/imports"
55+
56+
.color-preview
57+
padding-left $padding-item
58+
59+
.color-swatch
60+
width 18px
61+
height @width
62+
border-radius 50%
63+
64+
.color-picker
65+
width 300px
66+
height 370px
67+
background none
68+
box-shadow none
69+
padding ($padding-item - 4px) $padding-item
70+
71+
>>> .vc-sketch-presets
72+
border-top-color rgba(black, .1)
73+
</style>

packages/@vue/cli-ui/src/graphql-api/schema/prompt.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enum PromptType {
5050
checkbox
5151
password
5252
editor
53+
color
5354
}
5455
`
5556

yarn.lock

+18-2
Original file line numberDiff line numberDiff line change
@@ -7362,7 +7362,7 @@ lodash.templatesettings@^4.0.0:
73627362
dependencies:
73637363
lodash._reinterpolate "~3.0.0"
73647364

7365-
lodash.throttle@^4.1.1:
7365+
lodash.throttle@^4.0.0, lodash.throttle@^4.1.1:
73667366
version "4.1.1"
73677367
resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4"
73687368

@@ -7520,6 +7520,10 @@ map-visit@^1.0.0:
75207520
dependencies:
75217521
object-visit "^1.0.0"
75227522

7523+
material-colors@^1.0.0:
7524+
version "1.2.5"
7525+
resolved "https://registry.yarnpkg.com/material-colors/-/material-colors-1.2.5.tgz#5292593e6754cb1bcc2b98030e4e0d6a3afc9ea1"
7526+
75237527
material-design-icons@^3.0.1:
75247528
version "3.0.1"
75257529
resolved "https://registry.yarnpkg.com/material-design-icons/-/material-design-icons-3.0.1.tgz#9a71c48747218ebca51e51a66da682038cdcb7bf"
@@ -10708,6 +10712,10 @@ timers-browserify@^2.0.4:
1070810712
dependencies:
1070910713
setimmediate "^1.0.4"
1071010714

10715+
tinycolor2@^1.1.2:
10716+
version "1.4.1"
10717+
resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.1.tgz#f4fad333447bc0b07d4dc8e9209d8f39a8ac77e8"
10718+
1071110719
1071210720
version "0.0.31"
1071310721
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.31.tgz#8f38ab9438e17315e5dbd8b3657e8bfb277ae4a7"
@@ -11311,6 +11319,14 @@ vue-cli@^2.9.2:
1131111319
user-home "^2.0.0"
1131211320
validate-npm-package-name "^3.0.0"
1131311321

11322+
vue-color@^2.4.6:
11323+
version "2.4.6"
11324+
resolved "https://registry.yarnpkg.com/vue-color/-/vue-color-2.4.6.tgz#9dcd5850f7eec5ee3ac0b20bec7bbffb5f475f64"
11325+
dependencies:
11326+
lodash.throttle "^4.0.0"
11327+
material-colors "^1.0.0"
11328+
tinycolor2 "^1.1.2"
11329+
1131411330
vue-eslint-parser@^2.0.3:
1131511331
version "2.0.3"
1131611332
resolved "https://registry.yarnpkg.com/vue-eslint-parser/-/vue-eslint-parser-2.0.3.tgz#c268c96c6d94cfe3d938a5f7593959b0ca3360d1"
@@ -11403,7 +11419,7 @@ vue-style-loader@^4.1.0:
1140311419
hash-sum "^1.0.2"
1140411420
loader-utils "^1.0.2"
1140511421

11406-
vue-template-compiler@^2.5.16:
11422+
vue-template-compiler@^2.5.13, vue-template-compiler@^2.5.16:
1140711423
version "2.5.16"
1140811424
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.5.16.tgz#93b48570e56c720cdf3f051cc15287c26fbd04cb"
1140911425
dependencies:

0 commit comments

Comments
 (0)