From 2ac15c6b89841f4087c932f268c83013b519e86c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 18 Jun 2020 17:55:46 +0100 Subject: [PATCH] lint :sparkles: --- .../builder/src/builderStore/store/backend.js | 45 +-- .../src/components/common/Block.svelte | 3 +- .../common/LinkedRecordSelector.svelte | 6 +- .../modals/CreateEditRecord.svelte | 6 +- .../src/components/nav/HierarchyRow.svelte | 4 +- .../nav/ModelNavigator/BlockNavigator.svelte | 2 +- .../nav/ModelNavigator/EmptyModel.svelte | 24 +- .../nav/ModelNavigator/ModelNavigator.svelte | 16 +- .../nav/ModelSetupNav/ModelFieldEditor.svelte | 72 +++-- .../nav/ModelSetupNav/ModelSetupNav.svelte | 4 +- .../src/components/nav/ModelSetupNav/index.js | 2 +- .../Colorpicker/ButtonGroup.svelte | 26 +- .../Colorpicker/Colorpicker.svelte | 152 +++++----- .../Colorpicker/Colorpreview.svelte | 267 ++++++++++-------- .../Colorpicker/FlatButton.svelte | 8 +- .../userInterface/Colorpicker/Input.svelte | 10 +- .../userInterface/Colorpicker/Palette.svelte | 55 ++-- .../userInterface/Colorpicker/Slider.svelte | 61 ++-- .../userInterface/DesignView.svelte | 38 +-- .../userInterface/PropertyControl.svelte | 2 +- .../builder/src/constants/backend/index.js | 112 ++++---- .../[selectedDatabase]/_layout.svelte | 2 +- .../database/[selectedDatabase]/index.svelte | 4 +- 23 files changed, 479 insertions(+), 442 deletions(-) diff --git a/packages/builder/src/builderStore/store/backend.js b/packages/builder/src/builderStore/store/backend.js index 16fd12ada4..ddd0174c09 100644 --- a/packages/builder/src/builderStore/store/backend.js +++ b/packages/builder/src/builderStore/store/backend.js @@ -1,5 +1,5 @@ import { writable } from "svelte/store" -import { cloneDeep } from "lodash/fp"; +import { cloneDeep } from "lodash/fp" import api from "../api" export const getBackendUiStore = () => { @@ -12,8 +12,8 @@ export const getBackendUiStore = () => { draftModel: {}, tabs: { SETUP_PANEL: "SETUP", - NAVIGATION_PANEL: "NAVIGATE" - } + NAVIGATION_PANEL: "NAVIGATE", + }, } const store = writable(INITIAL_BACKEND_UI_STATE) @@ -28,7 +28,7 @@ export const getBackendUiStore = () => { store.update(state => { state.selectedDatabase = db if (models && models.length > 0) { - store.actions.models.select(models[0]); + store.actions.models.select(models[0]) } state.models = models state.views = views @@ -49,24 +49,25 @@ export const getBackendUiStore = () => { }), }, models: { - select: model => store.update(state => { - state.selectedModel = model; - state.draftModel = cloneDeep(model); - state.selectedField = "" - state.selectedView = `all_${model._id}` - state.tabs.SETUP_PANEL = "SETUP" - return state; - }), + select: model => + store.update(state => { + state.selectedModel = model + state.draftModel = cloneDeep(model) + state.selectedField = "" + state.selectedView = `all_${model._id}` + state.tabs.SETUP_PANEL = "SETUP" + return state + }), save: async ({ instanceId, model }) => { - const updatedModel = cloneDeep(model); + const updatedModel = cloneDeep(model) // TODO: refactor for (let key in updatedModel.schema) { const field = updatedModel.schema[key] - if (field.name && field.name !== key) { - updatedModel.schema[field.name] = field - delete updatedModel.schema[key]; - } + if (field.name && field.name !== key) { + updatedModel.schema[field.name] = field + delete updatedModel.schema[key] + } } const SAVE_MODEL_URL = `/api/${instanceId}/models` @@ -78,8 +79,10 @@ export const getBackendUiStore = () => { if (!model._id) { state.models = [...state.models, savedModel] } else { - const existingIdx = state.models.findIndex(({ _id }) => _id === model._id); - state.models.splice(existingIdx, 1, savedModel); + const existingIdx = state.models.findIndex( + ({ _id }) => _id === model._id + ) + state.models.splice(existingIdx, 1, savedModel) state.models = state.models } @@ -95,7 +98,7 @@ export const getBackendUiStore = () => { state.draftModel.schema = { ...state.draftModel.schema, - [field.name]: field + [field.name]: field, } state.selectedField = field.name @@ -103,7 +106,7 @@ export const getBackendUiStore = () => { state.tabs.NAVIGATION_PANEL = "NAVIGATE" return state - }); + }) }, }, views: { diff --git a/packages/builder/src/components/common/Block.svelte b/packages/builder/src/components/common/Block.svelte index 168834b5a8..0d4cb1b9e2 100644 --- a/packages/builder/src/components/common/Block.svelte +++ b/packages/builder/src/components/common/Block.svelte @@ -30,7 +30,7 @@ i { font-size: 30px; } - + span { font-size: 14px; text-align: center; @@ -53,5 +53,4 @@ .tertiary { background: var(--white); } - diff --git a/packages/builder/src/components/common/LinkedRecordSelector.svelte b/packages/builder/src/components/common/LinkedRecordSelector.svelte index 18adfda61e..b4787773b3 100644 --- a/packages/builder/src/components/common/LinkedRecordSelector.svelte +++ b/packages/builder/src/components/common/LinkedRecordSelector.svelte @@ -1,5 +1,5 @@ @@ -65,4 +65,4 @@ font-size: 14px; word-break: break-word; } - \ No newline at end of file + diff --git a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte index 7c31ea3bf3..f96e2530a6 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/CreateEditRecord.svelte @@ -1,7 +1,7 @@ @@ -20,7 +20,11 @@

Blocks are pre-made fields and help you build your model quicker.

{#each Object.values(FIELDS) as field} - addNewField(field)} /> + addNewField(field)} /> {/each}
@@ -30,7 +34,11 @@

Blocks are pre-made fields and help you build your model quicker.

{#each Object.values(BLOCKS) as field} - addNewField(field)} /> + addNewField(field)} /> {/each}
@@ -78,4 +86,4 @@ grid-auto-columns: 110px; grid-gap: 20px; } - \ No newline at end of file + diff --git a/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte b/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte index b0b0d9ca24..3d9aeb64fd 100644 --- a/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte +++ b/packages/builder/src/components/nav/ModelNavigator/ModelNavigator.svelte @@ -1,6 +1,6 @@ +
+ {#each colorFormats as text} + onclick(text)} /> + {/each} +
+ - -
- {#each colorFormats as text} - onclick(text)} /> - {/each} -
diff --git a/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte b/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte index 936756f403..9813c9ff28 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Colorpicker.svelte @@ -1,123 +1,79 @@ - -
@@ -143,3 +99,47 @@
+ + diff --git a/packages/builder/src/components/userInterface/Colorpicker/Colorpreview.svelte b/packages/builder/src/components/userInterface/Colorpicker/Colorpreview.svelte index fa880b6292..1f637f7483 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Colorpreview.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Colorpreview.svelte @@ -1,143 +1,170 @@
- {#if !errorMsg} -
- {#if open} -
- -
-
open = false} class="overlay">
- {/if} - {:else} -
- × -
+ {#if !errorMsg} +
+ {#if open} +
+ +
+
(open = false)} class="overlay" /> {/if} + {:else} +
+ × +
+ {/if}
- - diff --git a/packages/builder/src/components/userInterface/Colorpicker/FlatButton.svelte b/packages/builder/src/components/userInterface/Colorpicker/FlatButton.svelte index af1ea5e945..48e2e12c30 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/FlatButton.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/FlatButton.svelte @@ -1,8 +1,10 @@ +
{text}
+ - -
{text}
diff --git a/packages/builder/src/components/userInterface/Colorpicker/Input.svelte b/packages/builder/src/components/userInterface/Colorpicker/Input.svelte index 04966c1f30..4316204c84 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Input.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Input.svelte @@ -1,7 +1,11 @@ +
+ +
+ - -
- -
diff --git a/packages/builder/src/components/userInterface/Colorpicker/Palette.svelte b/packages/builder/src/components/userInterface/Colorpicker/Palette.svelte index 01a614124c..6454c84b92 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Palette.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Palette.svelte @@ -1,41 +1,54 @@ +
+
+
+ - -
-
-
diff --git a/packages/builder/src/components/userInterface/Colorpicker/Slider.svelte b/packages/builder/src/components/userInterface/Colorpicker/Slider.svelte index ec8d99248d..761f2c7acb 100644 --- a/packages/builder/src/components/userInterface/Colorpicker/Slider.svelte +++ b/packages/builder/src/components/userInterface/Colorpicker/Slider.svelte @@ -1,36 +1,47 @@ +
handleClick(event.clientX)} + class="color-format-slider" + class:hue={type === 'hue'} + class:alpha={type === 'alpha'}> +
handleClick(e.detail)} + class="slider-thumb" + {style} /> +
+ - -
handleClick(event.clientX)} - class="color-format-slider" - class:hue={type === 'hue'} - class:alpha={type === 'alpha'}> -
handleClick(e.detail)} - class="slider-thumb" - {style} /> -
diff --git a/packages/builder/src/components/userInterface/DesignView.svelte b/packages/builder/src/components/userInterface/DesignView.svelte index 6826bddc5c..97cf9bb40f 100644 --- a/packages/builder/src/components/userInterface/DesignView.svelte +++ b/packages/builder/src/components/userInterface/DesignView.svelte @@ -31,26 +31,26 @@
-
-
- {#if propertyGroupNames.length > 0} - {#each propertyGroupNames as groupName} - - {/each} - {:else} -
- This component does not have any design properties -
- {/if} +
+
+ {#if propertyGroupNames.length > 0} + {#each propertyGroupNames as groupName} + + {/each} + {:else} +
+ This component does not have any design properties +
+ {/if} +
-