-
+
+
+
+
- {:then result}
-
- {:catch err}
-
{err}
- {/await}
-
+
+
+
+
+
+
+
+
+
+
Welcome to Budibase
+
+
+
+
+
+
+
+
+
+ {#await promise}
+
+
+
+ {:then result}
+
+ {:catch err}
+
{err}
+ {/await}
+
+
diff --git a/packages/builder/tests/generate_css.spec.js b/packages/builder/tests/generate_css.spec.js
index 5fa4a94db9..b2a7fca64d 100644
--- a/packages/builder/tests/generate_css.spec.js
+++ b/packages/builder/tests/generate_css.spec.js
@@ -1,320 +1,55 @@
import {
generate_css,
- make_margin,
generate_screen_css,
+ generate_array_styles
} from "../src/builderStore/generate_css.js"
-describe("make_margin", () => {
- test("it should generate a valid rule", () => {
- expect(make_margin(["1", "1", "1", "1"])).toEqual("1px 1px 1px 1px")
- })
-
- test("empty values should output 0", () => {
- expect(make_margin(["1", "1", "", ""])).toEqual("1px 1px 0px 0px")
- expect(make_margin(["1", "", "", "1"])).toEqual("1px 0px 0px 1px")
- expect(make_margin(["", "", "", ""])).toEqual("0px 0px 0px 0px")
- })
-})
-
describe("generate_css", () => {
- test("it should generate a valid css rule: grid-area", () => {
- expect(generate_css({ layout: { gridarea: ["", "", "", ""] } })).toEqual({
- layout: "",
- position: "",
- })
+
+ test("Check how partially empty arrays are handled", () => {
+ expect(["", "5", "", ""].map(generate_array_styles)).toEqual(["0px", "5px", "0px", "0px"])
})
- test("it should generate a valid css rule: grid-gap", () => {
- expect(generate_css({ layout: { gap: "10" } })).toEqual({
- layout: "grid-gap: 10px;\ndisplay: grid;",
- position: "",
- })
+ test("Check how array styles are output", () => {
+ expect(generate_css({ margin: ["0", "10", "0", "15"] })).toBe("margin: 0px 10px 0px 15px;")
})
- test("it should generate a valid css rule: column 1", () => {
- expect(generate_css({ position: { column: ["", ""] } })).toEqual({
- layout: "",
- position: "",
- })
+ test("Check handling of an array with empty string values", () => {
+ expect(generate_css({ padding: ["", "", "", ""] })).toBe("")
})
- test("it should generate a valid css rule: column 2", () => {
- expect(generate_css({ position: { column: ["1", ""] } })).toEqual({
- position: "grid-column-start: 1;",
- layout: "",
- })
+ test("Check handling of an empty array", () => {
+ expect(generate_css({ margin: [] })).toBe("")
})
- test("it should generate a valid css rule: column 3", () => {
- expect(generate_css({ position: { column: ["", "1"] } })).toEqual({
- position: "grid-column-end: 1;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: column 4", () => {
- expect(generate_css({ position: { column: ["1", "1"] } })).toEqual({
- position: "grid-column-start: 1;\ngrid-column-end: 1;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: row 1", () => {
- expect(generate_css({ position: { row: ["", ""] } })).toEqual({
- layout: "",
- position: "",
- })
- })
-
- test("it should generate a valid css rule: row 2", () => {
- expect(generate_css({ position: { row: ["1", ""] } })).toEqual({
- position: "grid-row-start: 1;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: row 3", () => {
- expect(generate_css({ position: { row: ["", "1"] } })).toEqual({
- position: "grid-row-end: 1;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: row 4", () => {
- expect(generate_css({ position: { row: ["1", "1"] } })).toEqual({
- position: "grid-row-start: 1;\ngrid-row-end: 1;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: padding 1", () => {
- expect(
- generate_css({ position: { padding: ["1", "1", "1", "1"] } })
- ).toEqual({
- position: "padding: 1px 1px 1px 1px;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: padding 2", () => {
- expect(generate_css({ position: { padding: ["1", "", "", "1"] } })).toEqual(
- {
- position: "padding: 1px 0px 0px 1px;",
- layout: "",
- }
- )
- })
-
- test("it should generate a valid css rule: margin 1", () => {
- expect(
- generate_css({ position: { margin: ["1", "1", "1", "1"] } })
- ).toEqual({
- position: "margin: 1px 1px 1px 1px;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: margin 2", () => {
- expect(generate_css({ position: { margin: ["1", "", "", "1"] } })).toEqual({
- position: "margin: 1px 0px 0px 1px;",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: z-index 1", () => {
- expect(generate_css({ position: { zindex: "" } })).toEqual({
- position: "",
- layout: "",
- })
- })
-
- test("it should generate a valid css rule: z-index 2", () => {
- expect(generate_css({ position: { zindex: "1" } })).toEqual({
- position: "z-index: 1;",
- layout: "",
- })
+ test("Check handling of valid font property", () => {
+ expect(generate_css({ "font-size": "10px" })).toBe("font-size: 10px;")
})
})
+
describe("generate_screen_css", () => {
- test("it should compile the css for a list of components", () => {
- const components = [
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 1,
- },
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 2,
- },
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 3,
- },
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 4,
- },
- ]
-
- const compiled = `.pos-1 {
-margin: 1px 1px 1px 1px;
-}
-.lay-1 {
-
-}
-.pos-2 {
-margin: 1px 1px 1px 1px;
-}
-.lay-2 {
-
-}
-.pos-3 {
-margin: 1px 1px 1px 1px;
-}
-.lay-3 {
-
-}
-.pos-4 {
-margin: 1px 1px 1px 1px;
-}
-.lay-4 {
-
-}`
-
- expect(generate_screen_css(components)).toEqual(compiled)
+ const normalComponent = { _id: "123-456", _component: "@standard-components/header", _children: [], _styles: { normal: { "font-size": "16px" }, hover: {}, active: {}, selected: {} } }
+
+ test("Test generation of normal css styles", () => {
+ expect(generate_screen_css([normalComponent])).toBe(".header-123-456 {\nfont-size: 16px;\n}")
})
- test("it should compile the css for a list of components", () => {
- const components = [
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 1,
- _children: [
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 2,
- _children: [
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 3,
- _children: [
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 4,
- _children: [
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 5,
- _children: [],
- },
- ],
- },
- ],
- },
- ],
- },
- ],
- },
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 6,
- },
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 7,
- },
- {
- _styles: {
- layout: { gridarea: ["", "", "", ""] },
- position: { margin: ["1", "1", "1", "1"] },
- },
- _id: 8,
- },
- ]
+ const hoverComponent = { _id: "123-456", _component: "@standard-components/header", _children: [], _styles: { normal: {}, hover: {"font-size": "16px"}, active: {}, selected: {} } }
- const compiled = `.pos-1 {
-margin: 1px 1px 1px 1px;
-}
-.lay-1 {
-
-}
-.pos-2 {
-margin: 1px 1px 1px 1px;
-}
-.lay-2 {
-
-}
-.pos-3 {
-margin: 1px 1px 1px 1px;
-}
-.lay-3 {
-
-}
-.pos-4 {
-margin: 1px 1px 1px 1px;
-}
-.lay-4 {
-
-}
-.pos-5 {
-margin: 1px 1px 1px 1px;
-}
-.lay-5 {
-
-}
-.pos-6 {
-margin: 1px 1px 1px 1px;
-}
-.lay-6 {
-
-}
-.pos-7 {
-margin: 1px 1px 1px 1px;
-}
-.lay-7 {
-
-}
-.pos-8 {
-margin: 1px 1px 1px 1px;
-}
-.lay-8 {
-
-}`
-
- expect(generate_screen_css(components)).toEqual(compiled)
+ test("Test generation of hover css styles", () => {
+ expect(generate_screen_css([hoverComponent])).toBe(".header-123-456:hover {\nfont-size: 16px;\n}")
})
-})
+
+ const selectedComponent = { _id: "123-456", _component: "@standard-components/header", _children: [], _styles: { normal: {}, hover: {}, active: {}, selected: { "font-size": "16px" } } }
+
+ test("Test generation of selection css styles", () => {
+ expect(generate_screen_css([selectedComponent])).toBe(".header-123-456::selection {\nfont-size: 16px;\n}")
+ })
+
+ const emptyComponent = { _id: "123-456", _component: "@standard-components/header", _children: [], _styles: { normal: {}, hover: {}, active: {}, selected: {} } }
+
+ test.only("Testing handling of empty component styles", () => {
+ expect(generate_screen_css([emptyComponent])).toBe("")
+ })
+})
\ No newline at end of file
diff --git a/packages/cli/src/commands/new/appDirectoryTemplate/pages/main/page.json b/packages/cli/src/commands/new/appDirectoryTemplate/pages/main/page.json
index 4f25934bba..af75ddec68 100644
--- a/packages/cli/src/commands/new/appDirectoryTemplate/pages/main/page.json
+++ b/packages/cli/src/commands/new/appDirectoryTemplate/pages/main/page.json
@@ -9,8 +9,10 @@
"_id": 0,
"type": "div",
"_styles": {
- "layout": {},
- "position": {}
+ "normal": {},
+ "hover": {},
+ "active": {},
+ "selected": {}
},
"_code": ""
},
diff --git a/packages/cli/src/commands/new/appDirectoryTemplate/pages/unauthenticated/page.json b/packages/cli/src/commands/new/appDirectoryTemplate/pages/unauthenticated/page.json
index 298d73e8b6..3452a6df55 100644
--- a/packages/cli/src/commands/new/appDirectoryTemplate/pages/unauthenticated/page.json
+++ b/packages/cli/src/commands/new/appDirectoryTemplate/pages/unauthenticated/page.json
@@ -9,8 +9,10 @@
"_id": 1,
"type": "div",
"_styles": {
- "layout": {},
- "position": {}
+ "normal": {},
+ "hover": {},
+ "active": {},
+ "selected": {}
},
"_code": ""
},
diff --git a/packages/cli/src/commands/new/page.template.json b/packages/cli/src/commands/new/page.template.json
index 89a23a78e5..6f02b78c62 100644
--- a/packages/cli/src/commands/new/page.template.json
+++ b/packages/cli/src/commands/new/page.template.json
@@ -9,8 +9,10 @@
"_id": 0,
"type": "div",
"_styles": {
- "layout": {},
- "position": {}
+ "normal": {},
+ "hover": {},
+ "active": {},
+ "selected": {}
},
"_code": ""
},
diff --git a/packages/client/src/render/attachChildren.js b/packages/client/src/render/attachChildren.js
index ebb5dd34da..22dff2b2a8 100644
--- a/packages/client/src/render/attachChildren.js
+++ b/packages/client/src/render/attachChildren.js
@@ -31,7 +31,7 @@ export const attachChildren = initialiseOpts => (htmlElement, options) => {
}
}
- htmlElement.classList.add(`lay-${treeNode.props._id}`)
+ // htmlElement.classList.add(`lay-${treeNode.props._id}`)
const childNodes = []
for (let childProps of treeNode.props._children) {
diff --git a/packages/client/src/render/prepareRenderComponent.js b/packages/client/src/render/prepareRenderComponent.js
index 916ac82960..a7c3e6ddcf 100644
--- a/packages/client/src/render/prepareRenderComponent.js
+++ b/packages/client/src/render/prepareRenderComponent.js
@@ -35,8 +35,9 @@ export const prepareRenderComponent = ({
thisNode.rootElement =
htmlElement.children[htmlElement.children.length - 1]
+ let [componentName] = props._component.match(/[a-z]*$/)
if (props._id && thisNode.rootElement) {
- thisNode.rootElement.classList.add(`pos-${props._id}`)
+ thisNode.rootElement.classList.add(`${componentName}-${props._id}`)
}
}
}
diff --git a/packages/server/builder/assets/10-1.png b/packages/server/builder/assets/10-1.png
new file mode 100644
index 0000000000..3531495668
Binary files /dev/null and b/packages/server/builder/assets/10-1.png differ
diff --git a/packages/server/builder/assets/banner-image.png b/packages/server/builder/assets/banner-image.png
new file mode 100644
index 0000000000..3531495668
Binary files /dev/null and b/packages/server/builder/assets/banner-image.png differ
diff --git a/packages/server/builder/assets/bb-logo.svg b/packages/server/builder/assets/bb-logo.svg
new file mode 100644
index 0000000000..7d115faefc
--- /dev/null
+++ b/packages/server/builder/assets/bb-logo.svg
@@ -0,0 +1,31 @@
+
+
+
diff --git a/packages/server/builder/assets/space.jpeg b/packages/server/builder/assets/space.jpeg
new file mode 100644
index 0000000000..427aeb13c7
Binary files /dev/null and b/packages/server/builder/assets/space.jpeg differ
diff --git a/packages/server/builder/assets/space.jpg b/packages/server/builder/assets/space.jpg
new file mode 100644
index 0000000000..6fbde46033
Binary files /dev/null and b/packages/server/builder/assets/space.jpg differ
diff --git a/packages/standard-components/components.json b/packages/standard-components/components.json
index 4705f2b45b..f9c800489e 100644
--- a/packages/standard-components/components.json
+++ b/packages/standard-components/components.json
@@ -12,10 +12,10 @@
"props": {
"logoUrl": "string",
"title": "string",
- "backgroundColor": "colour",
- "color": "colour",
+ "backgroundColor": "string",
+ "color": "string",
"borderWidth": "string",
- "borderColor": "colour",
+ "borderColor": "string",
"borderStyle": "string"
}
},
@@ -23,35 +23,10 @@
"name": "Button",
"description": "an html
",
"props": {
- "contentText": {
- "type": "string",
- "default": "Button"
- },
+ "text": "string",
"className": "string",
"disabled": "bool",
- "onClick": "event",
- "background": "colour",
- "color": "colour",
- "border": "string",
- "padding": "string",
- "hoverColor": "string",
- "hoverBackground": "string",
- "hoverBorder": "string",
- "fontFamily": {
- "type": "options",
- "default": "initial",
- "styleBindingProperty": "font-family",
- "options": [
- "initial",
- "Times New Roman",
- "Georgia",
- "Arial",
- "Arial Black",
- "Comic Sans MS",
- "Impact",
- "Lucida Sans Unicode"
- ]
- }
+ "onClick": "event"
},
"tags": [
"layout"
@@ -167,58 +142,7 @@
"children": false,
"props": {
"text": "string",
- "color": "colour",
- "fontFamily": {
- "type": "options",
- "default": "initial",
- "styleBindingProperty": "font-family",
- "options": [
- "initial",
- "Times New Roman",
- "Georgia",
- "Arial",
- "Arial Black",
- "Comic Sans MS",
- "Impact",
- "Lucida Sans Unicode"
- ]
- },
- "fontSize": "string",
- "textAlign": {
- "type": "options",
- "default": "inline",
- "options": [
- "left",
- "center",
- "right"
- ]
- },
- "verticalAlign": {
- "type": "options",
- "default": "inline",
- "options": [
- "top",
- "middle",
- "bottom"
- ]
- },
- "formattingTag": {
- "type": "options",
- "default": "none",
- "options": [
- "none",
- "
- bold",
- " - important",
- " - italic",
- " - emphasized",
- " - marked text",
- " - small",
- " - deleted",
- " - inserted",
- " - subscript",
- " - superscript"
- ]
- }
+ "type": {"type": "string", "default": "none"}
},
"tags": [
"div",
@@ -230,6 +154,7 @@
"description": "A component that allows the user to input text.",
"props": {
"label": "string",
+ "type": "string",
"value": "string",
"onchange": "event"
}
@@ -259,7 +184,7 @@
"props": {
"icon": "string",
"fontSize": "string",
- "color": "colour"
+ "color": "string"
}
},
"datatable": {
@@ -328,8 +253,8 @@
"url": "string",
"openInNewTab": "bool",
"text": "string",
- "color": "colour",
- "hoverColor": "colour",
+ "color": "string",
+ "hoverColor": "string",
"underline": "bool",
"fontSize": "string",
"fontFamily": {
@@ -383,27 +308,8 @@
"summary"
],
"default": "div"
- },
- "backgroundColor": "string",
- "color": "string",
- "borderWidth": "string",
- "borderColor": "string",
- "borderStyle": {
- "type": "options",
- "options": [
- "none",
- "solid",
- "dotted",
- "dashed",
- "double",
- "groove",
- "ridge",
- "inset",
- "outset"
- ],
- "default": "none"
}
- },
+ },
"container": true,
"tags": [
"div",
@@ -416,7 +322,6 @@
"description": "An HTML H1 - H6 tag",
"props": {
"className": "string",
- "color":"colour",
"text": "string",
"type": {
"type": "options",
@@ -429,21 +334,6 @@
"h5",
"h6"
]
- },
- "fontFamily": {
- "type": "options",
- "default": "initial",
- "styleBindingProperty": "font-family",
- "options": [
- "initial",
- "Times New Roman",
- "Georgia",
- "Arial",
- "Arial Black",
- "Comic Sans MS",
- "Impact",
- "Lucida Sans Unicode"
- ]
}
},
"tags": []
diff --git a/packages/standard-components/src/Button.svelte b/packages/standard-components/src/Button.svelte
index 3d50c22df5..eac2150274 100644
--- a/packages/standard-components/src/Button.svelte
+++ b/packages/standard-components/src/Button.svelte
@@ -1,58 +1,15 @@
{#if type === 'div'}
-
+
{:else if type === 'header'}
-
+
{:else if type === 'main'}
-
+
{:else if type === 'footer'}
-
+
{:else if type === 'aside'}
-
+
{:else if type === 'summary'}
-
+
{:else if type === 'details'}
-
+
{:else if type === 'article'}
-
+
{:else if type === 'nav'}
-
+
{:else if type === 'mark'}
-
+
{:else if type === 'figure'}
-
+
{:else if type === 'figcaption'}
-
+
{:else if type === 'paragraph'}
-
+
{/if}
-
-
diff --git a/packages/standard-components/src/Heading.svelte b/packages/standard-components/src/Heading.svelte
index 6a3a210dc3..4760ae05db 100644
--- a/packages/standard-components/src/Heading.svelte
+++ b/packages/standard-components/src/Heading.svelte
@@ -2,28 +2,25 @@
import { buildStyle } from "./buildStyle.js"
export let className = ""
export let type
- export let _bb
export let text = ""
- export let fontFamily = ""
- export let color = ""
+
+ export let _bb
let containerElement
$: containerElement && !text && _bb.attachChildren(containerElement)
- $: style = buildStyle({ "font-family": fontFamily, color })
- // $: console.log("HEADING", color)
{#if type === 'h1'}
- {text}
+ {text}
{:else if type === 'h2'}
- {text}
+ {text}
{:else if type === 'h3'}
- {text}
+ {text}
{:else if type === 'h4'}
- {text}
+ {text}
{:else if type === 'h5'}
- {text}
+ {text}
{:else if type === 'h6'}
- {text}
+ {text}
{/if}
diff --git a/packages/standard-components/src/Link.svelte b/packages/standard-components/src/Link.svelte
index 0ac3d9f628..ef0b71d62e 100644
--- a/packages/standard-components/src/Link.svelte
+++ b/packages/standard-components/src/Link.svelte
@@ -4,11 +4,6 @@
export let url = ""
export let text = ""
export let openInNewTab = false
- export let color
- export let hoverColor
- export let underline = false
- export let fontFamily
- export let fontSize
export let _bb
@@ -16,43 +11,12 @@
$: anchorElement && !text && _bb.attachChildren(anchorElement)
$: target = openInNewTab ? "_blank" : "_self"
- $: cssVariables = {
- hoverColor,
- color,
- textDecoration: underline ? "underline" : "none",
- fontSize,
- fontFamily,
- }
- $: classes = createClasses(cssVariables)
-
- {text}
-
+{text}
diff --git a/packages/standard-components/src/Text.svelte b/packages/standard-components/src/Text.svelte
index b6d3c159e9..96fc09e025 100644
--- a/packages/standard-components/src/Text.svelte
+++ b/packages/standard-components/src/Text.svelte
@@ -4,45 +4,35 @@
export let text = ""
export let className = ""
- export let formattingTag = ""
-
- export let fontFamily = ""
- export let fontSize = "1em"
- export let textAlign = ""
- export let verticalAlign = ""
- export let color = ""
+ export let type = ""
export let _bb
- const isTag = tag => (formattingTag || "").indexOf(tag) > -1
-
- $: style = buildStyle({
- "font-size": fontSize,
- "font-family": fontFamily,
- color,
- })
+ const isTag = tag => type === tag
{#if isTag('none')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else if isTag('')}
- {text}
-{:else}{text}{/if}
+ {text}
+{:else if isTag('bold')}
+ {text}
+{:else if isTag('strong')}
+ {text}
+{:else if isTag('italic')}
+ {text}
+{:else if isTag('emphasis')}
+ {text}
+{:else if isTag('mark')}
+ {text}
+{:else if isTag('small')}
+ {text}
+{:else if isTag('del')}
+ {text}
+{:else if isTag('ins')}
+ {text}
+{:else if isTag('sub')}
+ {text}
+{:else if isTag('sup')}
+ {text}
+{:else}
+ {text}
+{/if}