diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 0d14187b9b..24f8f77397 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -2,6 +2,7 @@ "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", "version": "1.58.13", + "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", "exports": { @@ -9,31 +10,24 @@ "import": "./dist/bbui.es.js" }, "./package.json": "./package.json", - "./dist/style.css": "./dist/style.css" + "./spectrum-icons-rollup.js": "./src/spectrum-icons-rollup.js", + "./spectrum-icons-vite.js": "./src/spectrum-icons-vite.js" }, "scripts": { - "dev:builder": "vite build", - "build": "vite build" + "build": "rollup -c" }, "devDependencies": { "@rollup/plugin-commonjs": "^16.0.0", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^11.0.0", - "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", + "@rollup/plugin-node-resolve": "^11.2.1", "cross-env": "^7.0.2", "nollup": "^0.14.1", "postcss": "^8.2.9", - "rollup": "^2.34.0", - "rollup-plugin-copy": "^3.3.0", - "rollup-plugin-delete": "^1.2.0", - "rollup-plugin-hot": "^0.1.1", - "rollup-plugin-node-builtins": "^2.1.2", + "rollup": "^2.45.2", "rollup-plugin-postcss": "^4.0.0", - "rollup-plugin-svelte-hot": "^0.11.0", - "semantic-release": "^17.0.8", - "svelte": "^3.37.0", - "svench": "^0.0.10-7", - "vite": "^2.1.5" + "rollup-plugin-svelte": "^7.1.0", + "rollup-plugin-terser": "^7.0.2", + "svelte": "^3.37.0" }, "keywords": [ "svelte" @@ -43,34 +37,39 @@ "dist" ], "dependencies": { + "@adobe/spectrum-css-workflow-icons": "^1.2.1", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/button": "^3.0.1", "@spectrum-css/buttongroup": "^3.0.1", - "@spectrum-css/checkbox": "^3.0.1", + "@spectrum-css/checkbox": "^3.0.2", "@spectrum-css/dialog": "^3.0.1", "@spectrum-css/divider": "^1.0.1", + "@spectrum-css/fieldgroup": "^3.0.2", + "@spectrum-css/fieldlabel": "^3.0.1", "@spectrum-css/icon": "^3.0.1", + "@spectrum-css/inputgroup": "^3.0.2", "@spectrum-css/label": "^2.0.9", "@spectrum-css/link": "^3.1.1", "@spectrum-css/menu": "^3.0.1", "@spectrum-css/modal": "^3.0.1", + "@spectrum-css/picker": "^1.0.1", "@spectrum-css/popover": "^3.0.1", "@spectrum-css/progressbar": "^1.0.2", "@spectrum-css/progresscircle": "^1.0.2", + "@spectrum-css/radio": "^3.0.2", + "@spectrum-css/search": "^3.0.2", + "@spectrum-css/switch": "^1.0.2", "@spectrum-css/table": "^3.0.1", "@spectrum-css/tabs": "^3.0.1", + "@spectrum-css/textfield": "^3.0.1", "@spectrum-css/toast": "^3.0.1", "@spectrum-css/treeview": "^3.0.2", "@spectrum-css/typography": "^3.0.1", "@spectrum-css/underlay": "^2.0.9", "@spectrum-css/vars": "^3.0.1", "dayjs": "^1.10.4", - "markdown-it": "^12.0.4", - "quill": "^1.3.7", - "sirv-cli": "^0.4.6", - "svelte-flatpickr": "^2.4.0", - "svelte-portal": "^1.0.0", - "turndown": "^7.0.0" + "svelte-flatpickr": "^3.1.0", + "svelte-portal": "^1.0.0" } } diff --git a/packages/bbui/rollup.config.js b/packages/bbui/rollup.config.js index 92b316cbe1..e285d548d6 100644 --- a/packages/bbui/rollup.config.js +++ b/packages/bbui/rollup.config.js @@ -1,140 +1,25 @@ -import * as path from "path" -import svelte from "rollup-plugin-svelte-hot" +import svelte from "rollup-plugin-svelte" import resolve from "@rollup/plugin-node-resolve" import commonjs from "@rollup/plugin-commonjs" import json from "@rollup/plugin-json" -import copy from "rollup-plugin-copy" -import hmr from "rollup-plugin-hot" -import del from "rollup-plugin-delete" +import { terser } from "rollup-plugin-terser" import postcss from "rollup-plugin-postcss" -import { plugin as Svench } from "svench/rollup" -import builtins from "rollup-plugin-node-builtins" -const WATCH = !!process.env.ROLLUP_WATCH -const SVENCH = !!process.env.SVENCH -const HOT = WATCH -const PRODUCTION = !WATCH - -const svench = Svench({ - // The root dir that Svench will parse and watch. - // - // NOTE Watching the root of the project, to let Svench render *.md for us. - // - // NOTE By default, `node_modules` and `.git` dirs are ignored. This can be - // customized by passing a function to `ignore` option. Default ignore is: - // - // ignore: path => /(?:^|\/)(?:node_modules|\.git)\//.test(path), - // - dir: ".", - - // Make `src` dir a section (that is, it will always be "expanded" in the - // menu). - autoSections: ["src"], - - // Use custom index.html - index: { - source: "public/index.html", +export default { + input: "src/index.js", + output: { + sourcemap: true, + format: "esm", + file: "dist/bbui.es.js", }, - - extensions: [".svench", ".svench.svelte", ".svench.svx", ".md"], - - serve: WATCH && { - host: "0.0.0.0", - port: 4242, - public: "public", - nollup: "0.0.0.0:42421", - }, -}) - -// NOTE configs are in function form to avoid instantiating plugins of the -// config that is not used for nothing (in particular, the HMR plugin launches -// a dev server on startup, this is not desired when just building for prod) -const configs = { - svench: () => ({ - input: ".svench/svench.js", - output: { - format: "es", - dir: "public/svench", - }, - plugins: [ - builtins(), - - // NOTE cleaning old builds is required to avoid serving stale static - // files from a previous build instead of in-memory files from the dev/hmr - // server - del({ - targets: "public/svench/*", - runOnce: true, - }), - - postcss({ - hot: HOT, - extract: path.resolve("public/svench/theme.css"), - sourceMap: true, - }), - - svench, - - svelte({ - dev: !PRODUCTION, - extensions: [".svelte", ".svench", ".svx", ".md"], - // Svench's "combined" preprocessor wraps both Mdsvex preprocessors - // (configured for Svench), and its own preprocessor (for static - // analysis -- eg extract source from views) - preprocess: svench.$.preprocess, - hot: HOT && { - optimistic: true, - noPreserveState: false, - }, - }), - - resolve({ browser: true }), - - commonjs(), - json(), - - HOT && - hmr({ - host: "0.0.0.0", - public: "public", - inMemory: true, - compatModuleHot: !HOT, // for terser - }), - ], - - watch: { - clearScreen: false, - // buildDelay is needed to ensure Svench's code (routes) generator will - // pick file changes before Rollup and prevent a double build (if Rollup - // first sees a change to src/Foo.svench, then to Svench's routes.js) - buildDelay: 100, - }, - }), - - lib: () => ({ - input: "src/index.js", - output: [{ file: "dist/bundle.mjs", format: "es" }], - plugins: [ - svelte({ - dev: !PRODUCTION, - extensions: [".svelte"], - emitCss: true, - }), - postcss(), - copy({ - targets: [ - { - src: ".svench/svench.css", - dest: "public", - rename: "global.css", - }, - ], - }), - resolve(), - commonjs(), - json(), - ], - }), + plugins: [ + resolve(), + commonjs(), + svelte({ + emitCss: true, + }), + postcss(), + terser(), + json(), + ], } - -export default configs[SVENCH ? "svench" : "lib"]() diff --git a/packages/bbui/src/Actions/click_outside.js b/packages/bbui/src/Actions/click_outside.js index 9257af5f5b..49a15d36a3 100644 --- a/packages/bbui/src/Actions/click_outside.js +++ b/packages/bbui/src/Actions/click_outside.js @@ -5,14 +5,14 @@ export default function clickOutside(element, callbackFunction) { } } - document.body.addEventListener("click", onClick, true) + document.body.addEventListener("mousedown", onClick, true) return { update(newCallbackFunction) { callbackFunction = newCallbackFunction }, destroy() { - document.body.removeEventListener("click", onClick, true) + document.body.removeEventListener("mousedown", onClick, true) }, } } diff --git a/packages/bbui/src/Button/Button.svelte b/packages/bbui/src/Button/Button.svelte index b646f00c73..f39a1bc25a 100644 --- a/packages/bbui/src/Button/Button.svelte +++ b/packages/bbui/src/Button/Button.svelte @@ -2,19 +2,13 @@ import "@spectrum-css/button/dist/index-vars.css" export let disabled = false - - /** @type {('S', 'M', 'L', 'XL')} Size of button */ - export let size = "M"; - - // Types - export let cta, primary, secondary, warning, overBackground; - + export let size = "M" + export let cta, primary, secondary, warning, overBackground export let quiet = false - - export let icon = undefined; + export let icon = undefined + export let active = false - diff --git a/packages/bbui/src/DatePicker/DatePicker.svelte b/packages/bbui/src/DatePicker/DatePicker.svelte deleted file mode 100644 index d6f6a00753..0000000000 --- a/packages/bbui/src/DatePicker/DatePicker.svelte +++ /dev/null @@ -1,45 +0,0 @@ - - -
content
variable that you can bind to in order to get Markdown out of the component.
-
-As well as the content you can also pass in an option object that looks like so:
-
-```js
-let options = {
- modules: {
- toolbar: [
- [{ header: [1, 2, 3, false] }],
- ['bold', 'italic', 'underline', 'strike']
- ]
- },
- placeholder: 'Type something...',
- theme: 'snow'
-}
-```
-
-Where
{:else} -By
-