diff --git a/.prettierrc b/.prettierrc index e23b0be753..eda2e6131b 100644 --- a/.prettierrc +++ b/.prettierrc @@ -3,6 +3,8 @@ "semi": false, "singleQuote": false, "trailingComma": "es5", + "arrowParens": "avoid", + "jsxBracketSameLine": false, "plugins": ["prettier-plugin-svelte"], - "svelteSortOrder" : "scripts-markup-styles" + "svelteSortOrder" : "options-scripts-markup-styles" } \ No newline at end of file diff --git a/package.json b/package.json index f98624812f..171f9510f3 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "prettier-plugin-svelte": "^2.2.0", "rimraf": "^3.0.2", "rollup-plugin-replace": "^2.2.0", - "svelte": "^3.30.0" + "svelte": "^3.37.0" }, "scripts": { "bootstrap": "lerna link && lerna bootstrap", diff --git a/packages/auth/src/db/index.js b/packages/auth/src/db/index.js index cca0a3ddba..f94fe4afea 100644 --- a/packages/auth/src/db/index.js +++ b/packages/auth/src/db/index.js @@ -1,9 +1,9 @@ let Pouch -module.exports.setDB = (pouch) => { +module.exports.setDB = pouch => { Pouch = pouch } -module.exports.getDB = (dbName) => { +module.exports.getDB = dbName => { return new Pouch(dbName) } diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index de743a7764..105e038907 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -48,7 +48,7 @@ exports.getGroupParams = (id = "", otherProps = {}) => { * Generates a new global user ID. * @returns {string} The new user ID which the user doc can be stored under. */ -exports.generateGlobalUserID = (id) => { +exports.generateGlobalUserID = id => { return `${DocumentTypes.USER}${SEPARATOR}${id || newid()}` } @@ -70,7 +70,7 @@ exports.getGlobalUserParams = (globalId, otherProps = {}) => { * Generates a template ID. * @param ownerId The owner/user of the template, this could be global or a group level. */ -exports.generateTemplateID = (ownerId) => { +exports.generateTemplateID = ownerId => { return `${DocumentTypes.TEMPLATE}${SEPARATOR}${ownerId}${newid()}` } @@ -132,7 +132,7 @@ const determineScopedConfig = async function (db, { type, user, group }) { } ) ) - const configs = response.rows.map((row) => { + const configs = response.rows.map(row => { const config = row.doc // Config is specific to a user and a group diff --git a/packages/auth/src/hashing.js b/packages/auth/src/hashing.js index fe9b034c63..7f3af2855f 100644 --- a/packages/auth/src/hashing.js +++ b/packages/auth/src/hashing.js @@ -4,7 +4,7 @@ const { v4 } = require("uuid") const SALT_ROUNDS = env.SALT_ROUNDS || 10 -exports.hash = async (data) => { +exports.hash = async data => { const salt = await bcrypt.genSalt(SALT_ROUNDS) return bcrypt.hash(data, salt) } diff --git a/packages/auth/src/utils.js b/packages/auth/src/utils.js index beb1c33cf1..10507410b1 100644 --- a/packages/auth/src/utils.js +++ b/packages/auth/src/utils.js @@ -22,7 +22,7 @@ function confirmAppId(possibleAppId) { * @param {object} ctx The main request body to look through. * @returns {string|undefined} If an appId was found it will be returned. */ -exports.getAppId = (ctx) => { +exports.getAppId = ctx => { const options = [ctx.headers["x-budibase-app-id"], ctx.params.appId] if (ctx.subdomains) { options.push(ctx.subdomains[1]) @@ -41,7 +41,7 @@ exports.getAppId = (ctx) => { } let appPath = ctx.request.headers.referrer || - ctx.path.split("/").filter((subPath) => subPath.startsWith(APP_PREFIX)) + ctx.path.split("/").filter(subPath => subPath.startsWith(APP_PREFIX)) if (!appId && appPath.length !== 0) { appId = confirmAppId(appPath[0]) } @@ -101,11 +101,11 @@ exports.clearCookie = (ctx, name) => { * @param {object} ctx The koa context object to be tested. * @return {boolean} returns true if the call is from the client lib (a built app rather than the builder). */ -exports.isClient = (ctx) => { +exports.isClient = ctx => { return ctx.headers["x-budibase-type"] === "client" } -exports.getGlobalUserByEmail = async (email) => { +exports.getGlobalUserByEmail = async email => { const db = getDB(StaticDatabases.GLOBAL.name) try { let users = ( @@ -114,7 +114,7 @@ exports.getGlobalUserByEmail = async (email) => { include_docs: true, }) ).rows - users = users.map((user) => user.doc) + users = users.map(user => user.doc) return users.length <= 1 ? users[0] : users } catch (err) { if (err != null && err.name === "not_found") { diff --git a/packages/bbui/src/ActionButton/ActionButton.svelte b/packages/bbui/src/ActionButton/ActionButton.svelte index a4bfd29c83..4bb592aa26 100644 --- a/packages/bbui/src/ActionButton/ActionButton.svelte +++ b/packages/bbui/src/ActionButton/ActionButton.svelte @@ -42,12 +42,14 @@ class="spectrum-ActionButton spectrum-ActionButton--size{size}" {disabled} on:longPress - on:click|preventDefault> + on:click|preventDefault +> {#if longPressable} {/if} @@ -56,7 +58,8 @@ class="spectrum-Icon spectrum-Icon--size{size}" focusable="false" aria-hidden="true" - aria-label={icon}> + aria-label={icon} + > {/if} diff --git a/packages/bbui/src/ActionGroup/ActionGroup.svelte b/packages/bbui/src/ActionGroup/ActionGroup.svelte index 514b473521..43d8cd8de5 100644 --- a/packages/bbui/src/ActionGroup/ActionGroup.svelte +++ b/packages/bbui/src/ActionGroup/ActionGroup.svelte @@ -8,7 +8,7 @@ // Attaches a spectrum-ActionGroup-item class to buttons inside the div function group(element) { const buttons = Array.from(element.getElementsByTagName("button")) - buttons.forEach((button) => { + buttons.forEach(button => { button.classList.add("spectrum-ActionGroup-item") }) } diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js index 776fc7f83e..a25cc1bbd5 100644 --- a/packages/bbui/src/Actions/position_dropdown.js +++ b/packages/bbui/src/Actions/position_dropdown.js @@ -47,7 +47,7 @@ export default function positionDropdown(element, { anchor, align }) { element.style[positionSide] = `${dimensions[positionSide]}px` element.style.left = `${calcLeftPosition(dimensions).toFixed(0)}px` - const resizeObserver = new ResizeObserver((entries) => { + const resizeObserver = new ResizeObserver(entries => { entries.forEach(() => { dimensions = getDimensions() element.style[positionSide] = `${dimensions[positionSide]}px` diff --git a/packages/bbui/src/Button/Button.svelte b/packages/bbui/src/Button/Button.svelte index 6e2b63adbd..da4d405f02 100644 --- a/packages/bbui/src/Button/Button.svelte +++ b/packages/bbui/src/Button/Button.svelte @@ -23,13 +23,15 @@ class:active class="spectrum-Button spectrum-Button--size{size.toUpperCase()}" {disabled} - on:click|preventDefault> + on:click|preventDefault +> {#if icon} {/if} diff --git a/packages/bbui/src/ButtonGroup/ButtonGroup.svelte b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte index 51055363a2..b845a770e1 100644 --- a/packages/bbui/src/ButtonGroup/ButtonGroup.svelte +++ b/packages/bbui/src/ButtonGroup/ButtonGroup.svelte @@ -1,15 +1,19 @@ -
- -
\ No newline at end of file +
+ +
diff --git a/packages/bbui/src/Form/Combobox.svelte b/packages/bbui/src/Form/Combobox.svelte index 6b1e67a299..e08e609732 100644 --- a/packages/bbui/src/Form/Combobox.svelte +++ b/packages/bbui/src/Form/Combobox.svelte @@ -35,5 +35,6 @@ {placeholder} {getOptionLabel} {getOptionValue} - on:change={onChange} /> + on:change={onChange} + /> diff --git a/packages/bbui/src/Form/Core/Checkbox.svelte b/packages/bbui/src/Form/Core/Checkbox.svelte index bc9b9a9fc7..7d564d2a9d 100644 --- a/packages/bbui/src/Form/Core/Checkbox.svelte +++ b/packages/bbui/src/Form/Core/Checkbox.svelte @@ -17,27 +17,31 @@ diff --git a/packages/bbui/src/Form/Core/Combobox.svelte b/packages/bbui/src/Form/Core/Combobox.svelte index 4329467bb0..1bce8ba3c4 100644 --- a/packages/bbui/src/Form/Core/Combobox.svelte +++ b/packages/bbui/src/Form/Core/Combobox.svelte @@ -49,7 +49,8 @@
+ class:is-focused={open || focus} + > (focus = true)} @@ -57,18 +58,21 @@ on:change={onChange} {value} {placeholder} - class="spectrum-Textfield-input spectrum-InputGroup-input" /> + class="spectrum-Textfield-input spectrum-InputGroup-input" + />
@@ -76,7 +80,8 @@
(open = false)} />
+ class="spectrum-Popover spectrum-Popover--bottom is-open" + >
    {#if options && Array.isArray(options)} {#each options as option} @@ -86,13 +91,16 @@ role="option" aria-selected="true" tabindex="0" - on:click={() => selectOption(getOptionValue(option))}> - {getOptionLabel(option)} + on:click={() => selectOption(getOptionValue(option))} + > + {getOptionLabel(option)} diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index a3a2fefb38..f76e42a55a 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -64,7 +64,8 @@ on:close={onClose} options={flatpickrOptions} on:change={handleChange} - element={`#${flatpickrId}`}> + element={`#${flatpickrId}`} +>
    + aria-haspopup="true" + >
    + class:is-invalid={!!error} + > {#if !!error} {/if} @@ -94,7 +98,8 @@ class="spectrum-Textfield-input spectrum-InputGroup-input" {placeholder} {id} - {value} /> + {value} + />
    diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index e6addd4e42..9dd2cbbc73 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -119,13 +119,15 @@ @@ -140,19 +142,22 @@ on:dragleave={handleDragLeave} on:dragenter={handleDragOver} on:drop={handleDrop} - class:is-dragged={fileDragged}> + class:is-dragged={fileDragged} + >
    + on:change={handleFile} + /> + viewBox="0 0 199 97.7" + > + d="M110.53,85.66,100.26,95.89a1.09,1.09,0,0,1-1.52,0L88.47,85.66" + /> + d="M126.5,22.5h-19a2,2,0,0,1-2-2V1.5h-31a2,2,0,0,0-2,2v68a2,2,0,0,0,2,2h19" + /> + d="M47.93,50.49a5,5,0,1,0-4.83-5A4.93,4.93,0,0,0,47.93,50.49Z" + /> + d="M36.6,65.93,42.05,60A2.06,2.06,0,0,1,45,60l12.68,13.2" + /> + d="M3.14,73.23,22.42,53.76a1.65,1.65,0,0,1,2.38,0l19.05,19.7" + /> + d="M139.5,36.5H196A1.49,1.49,0,0,1,197.5,38V72A1.49,1.49,0,0,1,196,73.5H141A1.49,1.49,0,0,1,139.5,72V32A1.49,1.49,0,0,1,141,30.5H154a2.43,2.43,0,0,1,1.67.66l6,5.66" + /> + ry="2" + />

    + class="spectrum-Heading spectrum-Heading--sizeL spectrum-Heading--light spectrum-IllustratedMessage-heading" + > Drag and drop your file

    {#if !disabled}

    - + class="spectrum-Body spectrum-Body--sizeS spectrum-IllustratedMessage-description" + > +
    from your computer

    diff --git a/packages/bbui/src/Form/Core/Multiselect.svelte b/packages/bbui/src/Form/Core/Multiselect.svelte index 97420fabad..d659a63582 100644 --- a/packages/bbui/src/Form/Core/Multiselect.svelte +++ b/packages/bbui/src/Form/Core/Multiselect.svelte @@ -78,4 +78,5 @@ {isOptionSelected} {getOptionLabel} {getOptionValue} - onSelectOption={toggleOption} /> + onSelectOption={toggleOption} +/> diff --git a/packages/bbui/src/Form/Core/Picker.svelte b/packages/bbui/src/Form/Core/Picker.svelte index 2f5606dcf1..05fb196064 100644 --- a/packages/bbui/src/Form/Core/Picker.svelte +++ b/packages/bbui/src/Form/Core/Picker.svelte @@ -37,7 +37,8 @@ class:is-invalid={!!error} class:is-open={open} aria-haspopup="listbox" - on:mousedown={onClick}> + on:mousedown={onClick} +> {fieldText} @@ -46,14 +47,16 @@ class="spectrum-Icon spectrum-Icon--sizeM spectrum-Picker-validationIcon" focusable="false" aria-hidden="true" - aria-label="Folder"> + aria-label="Folder" + > {/if} @@ -61,7 +64,8 @@
    (open = false)} transition:fly={{ y: -20, duration: 200 }} - class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open"> + class="spectrum-Popover spectrum-Popover--bottom spectrum-Picker-popover is-open" + >
      {#if placeholderOption}
    • onSelectOption(null)}> + on:click={() => onSelectOption(null)} + > {placeholderOption}
    • @@ -88,13 +94,16 @@ role="option" aria-selected="true" tabindex="0" - on:click={() => onSelectOption(getOptionValue(option, idx))}> - {getOptionLabel(option, idx)} + on:click={() => onSelectOption(getOptionValue(option, idx))} + > + {getOptionLabel(option, idx)} diff --git a/packages/bbui/src/Form/Core/RadioGroup.svelte b/packages/bbui/src/Form/Core/RadioGroup.svelte index 385e456a8e..4ead9ed311 100644 --- a/packages/bbui/src/Form/Core/RadioGroup.svelte +++ b/packages/bbui/src/Form/Core/RadioGroup.svelte @@ -21,14 +21,16 @@
      + class:is-invalid={!!error} + > + {disabled} + />
      diff --git a/packages/bbui/src/Form/Core/Search.svelte b/packages/bbui/src/Form/Core/Search.svelte index 6855799e86..dbc8582ac3 100644 --- a/packages/bbui/src/Form/Core/Search.svelte +++ b/packages/bbui/src/Form/Core/Search.svelte @@ -34,11 +34,13 @@
      + class:is-disabled={disabled} + > + autocomplete="off" + />
      diff --git a/packages/bbui/src/Form/Core/Select.svelte b/packages/bbui/src/Form/Core/Select.svelte index 58e1ccca5a..abc8610064 100644 --- a/packages/bbui/src/Form/Core/Select.svelte +++ b/packages/bbui/src/Form/Core/Select.svelte @@ -51,7 +51,8 @@ {options} {getOptionLabel} {getOptionValue} - isPlaceholder={value == null || value === ''} + isPlaceholder={value == null || value === ""} placeholderOption={placeholder} isOptionSelected={option => option === value} - onSelectOption={selectOption} /> + onSelectOption={selectOption} +/> diff --git a/packages/bbui/src/Form/Core/Switch.svelte b/packages/bbui/src/Form/Core/Switch.svelte index 520b8ebff1..a2f7e5ce01 100644 --- a/packages/bbui/src/Form/Core/Switch.svelte +++ b/packages/bbui/src/Form/Core/Switch.svelte @@ -21,7 +21,8 @@ on:change={onChange} {id} type="checkbox" - class="spectrum-Switch-input" /> + class="spectrum-Switch-input" + />
    diff --git a/packages/bbui/src/Form/Core/TextArea.svelte b/packages/bbui/src/Form/Core/TextArea.svelte index 3903c37b28..03a233f1e1 100644 --- a/packages/bbui/src/Form/Core/TextArea.svelte +++ b/packages/bbui/src/Form/Core/TextArea.svelte @@ -25,23 +25,28 @@ class="spectrum-Textfield spectrum-Textfield--multiline" class:is-invalid={!!error} class:is-disabled={disabled} - class:is-focused={focus}> + class:is-focused={focus} +> {#if error} {/if} + on:blur={onChange} + > + {value || ""} +
    - \ No newline at end of file + + + diff --git a/packages/bbui/src/Popover/Popover.svelte b/packages/bbui/src/Popover/Popover.svelte index bea421fd07..e07dc28ccf 100644 --- a/packages/bbui/src/Popover/Popover.svelte +++ b/packages/bbui/src/Popover/Popover.svelte @@ -37,7 +37,8 @@ use:clickOutside={hide} on:keydown={handleEscape} class="spectrum-Popover is-open" - role="presentation"> + role="presentation" + >
    diff --git a/packages/bbui/src/ProgressCircle/ProgressCircle.svelte b/packages/bbui/src/ProgressCircle/ProgressCircle.svelte index ba1dc10965..c3c0fb39d6 100644 --- a/packages/bbui/src/ProgressCircle/ProgressCircle.svelte +++ b/packages/bbui/src/ProgressCircle/ProgressCircle.svelte @@ -1,29 +1,33 @@ -
    -
    -
    -
    -
    -
    -
    +
    +
    +
    +
    +
    +
    -
    -
    -
    -
    +
    +
    +
    +
    - +
    diff --git a/packages/bbui/src/SideNavigation/Item.svelte b/packages/bbui/src/SideNavigation/Item.svelte index 17b83d1605..75440796b5 100644 --- a/packages/bbui/src/SideNavigation/Item.svelte +++ b/packages/bbui/src/SideNavigation/Item.svelte @@ -1,30 +1,44 @@ -
  • - {#if heading} - +
  • + {#if heading} + + {/if} + + {#if icon} + {/if} - - {#if icon} - - {/if} - - - {#if multilevel && $$slots.subnav} -
      - -
    - {/if} -
  • \ No newline at end of file + + + {#if multilevel && $$slots.subnav} +
      + +
    + {/if} + diff --git a/packages/bbui/src/SideNavigation/Navigation.svelte b/packages/bbui/src/SideNavigation/Navigation.svelte index 1400f0a508..d4d090ec1f 100644 --- a/packages/bbui/src/SideNavigation/Navigation.svelte +++ b/packages/bbui/src/SideNavigation/Navigation.svelte @@ -1,12 +1,12 @@ \ No newline at end of file + diff --git a/packages/bbui/src/Stores/notifications.js b/packages/bbui/src/Stores/notifications.js index 0f397f4dba..ce0c9921f0 100644 --- a/packages/bbui/src/Stores/notifications.js +++ b/packages/bbui/src/Stores/notifications.js @@ -7,7 +7,7 @@ export const createNotificationStore = () => { const _notifications = writable([], () => { return () => { // clear all the timers - timeoutIds.forEach((timeoutId) => { + timeoutIds.forEach(timeoutId => { clearTimeout(timeoutId) }) _notifications.set([]) @@ -25,11 +25,11 @@ export const createNotificationStore = () => { return } let _id = id() - _notifications.update((state) => { + _notifications.update(state => { return [...state, { id: _id, type, message, icon }] }) const timeoutId = setTimeout(() => { - _notifications.update((state) => { + _notifications.update(state => { return state.filter(({ id }) => id !== _id) }) }, NOTIFICATION_TIMEOUT) @@ -41,10 +41,10 @@ export const createNotificationStore = () => { return { subscribe, send, - info: (msg) => send(msg, "info", "Info"), - error: (msg) => send(msg, "error", "Alert"), - warning: (msg) => send(msg, "warning", "Alert"), - success: (msg) => send(msg, "success", "CheckmarkCircle"), + info: msg => send(msg, "info", "Info"), + error: msg => send(msg, "error", "Alert"), + warning: msg => send(msg, "warning", "Alert"), + success: msg => send(msg, "success", "CheckmarkCircle"), blockNotifications, } } diff --git a/packages/bbui/src/Table/BooleanRenderer.svelte b/packages/bbui/src/Table/BooleanRenderer.svelte index a71e28cb91..4e1aa3b4e1 100644 --- a/packages/bbui/src/Table/BooleanRenderer.svelte +++ b/packages/bbui/src/Table/BooleanRenderer.svelte @@ -5,24 +5,28 @@