Skip to content

Commit

Permalink
eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
aadu committed Jul 21, 2021
1 parent 48b7872 commit b961c56
Show file tree
Hide file tree
Showing 6 changed files with 409 additions and 348 deletions.
6 changes: 3 additions & 3 deletions packages/renderer/src/components/Color.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
style="stroke:rgb(255,0,0);stroke-width:2"
/>
</svg>
<svg
<svg
v-if="highlight"
class="overlay"
width="150"
Expand Down Expand Up @@ -122,7 +122,7 @@ export default defineComponent({
if (cm.value) {
return cm.value.visible;
}
})
});
const style = computed(() => {
return {
Expand Down Expand Up @@ -230,7 +230,7 @@ export default defineComponent({
},
},
]
],
},
{
separator:true,
Expand Down
17 changes: 10 additions & 7 deletions packages/renderer/src/components/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
label="Add Palette"
@click="addNewPalette"
/>
<p-btn
<p-btn
icon="pi pi-save"
class="p-ml-2 p-my-2"
label="Save All"
Expand All @@ -78,7 +78,10 @@
label="Reload"
@click="refresh"
/>
<NewPalette ref="newpalette" @new:palette="onAddNewPalette" />
<NewPalette
ref="newpalette"
@new:palette="onAddNewPalette"
/>
</template>
</DataView>
<Card v-if="debug">
Expand Down Expand Up @@ -202,7 +205,7 @@ export default defineComponent({
if (newpalette.value) {
newpalette.value.openDialog();
}
};
}
async function onAddNewPalette(event) {
const filename = event.filename ? `${event.filename}.xpalette` : `Palette${palettes.value.length}.xpalette`;
Expand All @@ -214,7 +217,7 @@ export default defineComponent({
);
await store.dispatch(Palettes.extendColors, colors);
await store.dispatch(Palettes.add, palette);
};
}
function xPalette(id: number) {
return store.getters.xPalette(id);
Expand Down Expand Up @@ -247,14 +250,14 @@ export default defineComponent({
const save = commands['save:palette'];
const promises = palettes.value.map((palette) => save(palette.id));
Promise.all(promises);
};
}
async function clear() {
await store.dispatch(Palettes.clear);
};
}
async function refresh() {
await store.dispatch(Palettes.clear);
await readDirectory(currentWorkspace.value);
};
}
return {refresh, clear, newpalette, onAddNewPalette, savePalettes, palettes, currentWorkspace, addNewPalette, xPalette, commands, sortOptions, onSortChange, sortKey, sortOrder, sortField, searchText, debug};
},
Expand Down
188 changes: 120 additions & 68 deletions packages/renderer/src/components/New.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,80 +6,132 @@
:dismissable-mask="true"
:modal="true"
>
<div class="p-grid p-fluid">
<div class="p-col-8">
<div class="p-grid p-fluid">
<div class="p-col-8">
<div class="p-inputgroup">
<span class="p-inputgroup-addon">
<i class="pi pi-file-o"></i>
</span>
<InputText type="text" v-model="name" placeholder="Palette Name" />
<span class="p-inputgroup-addon">
<i class="pi pi-file-o" />
</span>
<InputText
v-model="name"
type="text"
placeholder="Palette Name"
/>
</div>
</div>
<div class="p-col">
Number of non-default colors
<InputNumber v-model="numColors" mode="decimal" showButtons buttonLayout="horizontal" :min="0" :max="8" :step="1"
decrementButtonClass="p-button-secondary" incrementButtonClass="p-button-secondary" incrementButtonIcon="pi pi-plus" decrementButtonIcon="pi pi-minus" />

</div>
<div class="p-col-12">
<h4>Type</h4>
<SelectButton v-model="mode" :options="options" >
</SelectButton>
<Divider type="dashed"/>
</div>
<div class="p-col-12">
<Fieldset legend="Color Scale" v-if="mode === 'Scale'">
<div class="p-grid p-jc-between">
<div class="p-col-4">
<div class="p-grid p-jc-start">
<ColorPicker v-model="color1" />
</div>
</div>
<div class="p-col-4">
<div class="p-grid p-jc-end">
<ColorPicker v-model="color2" />
</div>
</div>
</div>
<div class="p-col">
Number of non-default colors
<InputNumber
v-model="numColors"
mode="decimal"
show-buttons
button-layout="horizontal"
:min="0"
:max="8"
:step="1"
decrement-button-class="p-button-secondary"
increment-button-class="p-button-secondary"
increment-button-icon="pi pi-plus"
decrement-button-icon="pi pi-minus"
/>
</div>
<div class="p-col-12">
<h4>Type</h4>
<SelectButton
v-model="mode"
:options="options"
/>
<Divider type="dashed" />
</div>
<div class="p-col-12">
<Fieldset
v-if="mode === 'Scale'"
legend="Color Scale"
>
<div class="p-grid p-jc-between">
<div class="p-col-4">
<div class="p-grid p-jc-start">
<ColorPicker v-model="color1" />
</div>
</div>
<div class="p-col-4">
<div class="p-grid p-jc-end">
<ColorPicker v-model="color2" />
</div>
</div>
</div>

</Fieldset>
<Fieldset legend="Brewer" v-if="mode === 'Brewer'">
<Dropdown v-model="brewerValue" :options="brewerOptions" optionLabel="name" placeholder="Select Scale" style="width: 300px;">
<template #value="slotProps">
<div v-if="slotProps.value">
<div class="p-d-flex">
<div class="p-mr-2">{{slotProps.value.name}}</div>
<div class="select-color-box" :style="style(color)" v-for="(color, i) in getBrewerColors(slotProps.value.name)" :key="i" />
</Fieldset>
<Fieldset
v-if="mode === 'Brewer'"
legend="Brewer"
>
<Dropdown
v-model="brewerValue"
:options="brewerOptions"
option-label="name"
placeholder="Select Scale"
style="width: 300px;"
>
<template #value="slotProps">
<div v-if="slotProps.value">
<div class="p-d-flex">
<div class="p-mr-2">
{{ slotProps.value.name }}
</div>
<div
v-for="(color, i) in getBrewerColors(slotProps.value.name)"
:key="i"
class="select-color-box"
:style="style(color)"
/>
</div>
<span v-else>
{{slotProps.placeholder}}
</span>
</div>
<span v-else>
{{ slotProps.placeholder }}
</span>
</template>
<template #option="slotProps">
<div class="p-d-flex">
<div class="p-mr-2" style="width: 80px;">{{slotProps.option.name}}</div>
<div class="select-color-box" :style="style(color)" v-for="(color, i) in getBrewerColors(slotProps.option.name)" :key="i" />
</div>
<div
class="p-mr-2"
style="width: 80px;"
>
{{ slotProps.option.name }}
</div>
<div
v-for="(color, i) in getBrewerColors(slotProps.option.name)"
:key="i"
class="select-color-box"
:style="style(color)"
/>
</div>
</template>
</Dropdown>
</Fieldset>

</div>
<div class="p-col-12">
<div class="p-grid p-jc-between">
<div class="p-col" v-for="(color, i) in colors" :key="i">
<div class="color-box" :style="style(color)">
<span class="color-box-color-name">{{ color }}</span>
</Dropdown>
</Fieldset>
</div>
<div class="p-col-12">
<div class="p-grid p-jc-between">
<div
v-for="(color, i) in colors"
:key="i"
class="p-col"
>
<div
class="color-box"
:style="style(color)"
>
<span class="color-box-color-name">{{ color }}</span>
</div>
</div>
</div>
</div>
<div class="p-col-2 p-offset-10">
<p-btn
label="Submit"
@click="submit"
/>
</div>
</div>
</div>
<div class="p-col-2 p-offset-10">
<p-btn label="Submit" @click="submit">
</p-btn>
</div>
</div>
</Dialog>
</template>

Expand Down Expand Up @@ -120,7 +172,7 @@ export default defineComponent({
});
function style(color) {
return {'background': color}
return {'background': color};
}
function openDialog() {
Expand All @@ -136,19 +188,19 @@ export default defineComponent({
'#FFFF00',
'#00FFFF',
'#FF00FF',
]
];
const brewerOptions = ref(
Object.keys(brewer).map(name => {
return {name}
})
return {name};
}),
);
const brewerValue = ref();
function getBrewerColors(name: string) {
const index = Math.max(3, unref(numColors));
const colors = brewer[name][index];
return colors
return colors;
}
const colors = computed(() => {
let scaleColors = [];
Expand Down Expand Up @@ -180,7 +232,7 @@ export default defineComponent({
emit('new:palette', {
filename: unref(name),
colors: unref(colors),
})
});
dialog.value = false;
name.value = '';
}
Expand Down
8 changes: 5 additions & 3 deletions packages/renderer/src/components/Palette.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<template>
<Card class="p-mb-2 p-py-0 p-mx-2 palette" :class="{'active-palette': highlight}"
<Card
class="p-mb-2 p-py-0 p-mx-2 palette"
:class="{'active-palette': highlight}"
>
<template #title>
<div class="p-d-flex p-ai-center">
Expand Down Expand Up @@ -105,7 +107,7 @@ export default defineComponent({
});
const filenames = computed(() => {
return store.getters.filenames;
})
});
const name = computed(() => palette.value.filename.split('.')[0]);
const title = computed({
get() {
Expand All @@ -115,7 +117,7 @@ export default defineComponent({
let newName = `${name}.xpalette`;
while (filenames.value.includes(newName)) {
newName = `_${newName}`;
};
}
store.dispatch(Palettes.updateName, {name: newName, id: paletteId});
},
});
Expand Down
8 changes: 6 additions & 2 deletions packages/renderer/src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@
<Fieldset legend="Save">
Right-click on a color to access that Palette's context menu
</Fieldset>
<p style="font-size: 12px; margin-bottom: -8px;">&copy;2021, Aaron Duke</p>
<p style="font-size: 12px;">dukuru@gmail.com</p>
<p style="font-size: 12px; margin-bottom: -8px;">
&copy;2021, Aaron Duke
</p>
<p style="font-size: 12px;">
dukuru@gmail.com
</p>
</Dialog>
</template>

Expand Down
Loading

0 comments on commit b961c56

Please sign in to comment.