From 71abc2a38d133d847a1d884818f3854b9db2339c Mon Sep 17 00:00:00 2001 From: Conor_Mack <36074859+Conor-Mack@users.noreply.github.com> Date: Tue, 28 Jan 2020 13:00:05 +0000 Subject: [PATCH] Aliasing config and additional test button component for test app (#66) * Fix for field modal infinite render loop once closed from click away * Added rollupgenerators to md to keep builder happy * Beginning the button component and general setup * Aliasing config and additional test button component for test app --- .../materialdesign-components/components.json | 30 ++- .../dist/generators.js | 207 +---------------- .../materialdesign-components/package.json | 4 + .../rollup.config.js | 51 +++-- .../rollup.generatorsconfig.js | 14 ++ .../rollup.testconfig.js | 212 +++++++++++------- .../src/Button.svelte | 12 + .../src/Test/TestApp.svelte | 47 ++-- .../src/Test/props.js | 20 +- .../src/Test/testComponents.js | 3 +- .../src/generators.js | 0 .../materialdesign-components/src/index.js | 3 +- 12 files changed, 254 insertions(+), 349 deletions(-) create mode 100644 packages/materialdesign-components/rollup.generatorsconfig.js create mode 100644 packages/materialdesign-components/src/Button.svelte create mode 100644 packages/materialdesign-components/src/generators.js diff --git a/packages/materialdesign-components/components.json b/packages/materialdesign-components/components.json index f6cc3eb501..2aface718d 100644 --- a/packages/materialdesign-components/components.json +++ b/packages/materialdesign-components/components.json @@ -1,12 +1,20 @@ { - "_lib": "./dist/index.js", - "h1": { - "name": "H1", - "description": "An HTML H1 tag", - "props" : { - "text": "string", - "className":"string" - }, - "tags": [] - } -} \ No newline at end of file + "_lib": "./dist/index.js", + "h1": { + "name": "H1", + "description": "An HTML H1 tag", + "props": { + "text": "string", + "className": "string" + }, + "tags": [] + }, + "button": { + "name": "Button", + "description": "A button", + "props": { + "raised": "bool" + }, + "tags": [] + } +} diff --git a/packages/materialdesign-components/dist/generators.js b/packages/materialdesign-components/dist/generators.js index 7fd547ea88..67dd2ee24a 100644 --- a/packages/materialdesign-components/dist/generators.js +++ b/packages/materialdesign-components/dist/generators.js @@ -1,207 +1,2 @@ -const headers = () => [ - { - name: "common/H1", - description: "Header 1", - inherits: "@budibase/standard-components/text", - props: { - font: "20pt", - } - }, - { - name: "common/H2", - description: "Header 2", - inherits: "@budibase/standard-components/text", - props: { - font: "15pt", - } - }, - { - name: "common/H3", - description: "Header 3", - inherits: "@budibase/standard-components/text", - props: { - font: "12pt bold", - } - }, - { - name: "common/H4", - description: "Header 4", - inherits: "@budibase/standard-components/text", - props: { - font: "10pt bold", - } - } -]; -const forms = ({records, indexes}) => - [...headers(), - ...records.map(root)]; - -const root = record => ({ - name: `${record.name} Form`, - description: `All fields on record '${record.nodeKey()}' `, - inherits: "@budibase/standard-components/stackpanel", - props: { - direction: "vertical", - children: [ - { - control: { - _component: "common/H1", - value: `Edit ${record.name}`, - } - }, - form(record), - saveCancelButtons(record) - ] - } -}); - -const form = record => ({ - control: { - _component: "@budibase/standard-components/form", - formControls: - record.fields.map(f => ({ - label: f.label, - control: { - _component: "@budibase/standard-components/textbox", - value: { - "##bbstate":`current${record.name}.${f.name}`, - "##bbsource":"store" - } - } - })) - } -}); - -const saveCancelButtons = (record) => ({ - control: { - _component: "@budibase/standard-components/stackpanel", - direction: "horizontal", - children: [ - paddedPanelForButton({ - _component: "common/Primary Button", - contentText: `Save ${record.name}`, - onClick: [ - { - "##eventHandlerType": "Save Record", - parameters: { - statePath: `current${record.name}`, - } - } - ] - }), - paddedPanelForButton({ - _component: "common/Secondary Button", - contentText: `Cancel`, - onClick: [ - { - "##eventHandlerType": "Save Record", - parameters: { - statePath: `current${record.name}`, - } - } - ] - }) - ] - } -}); - -const paddedPanelForButton = (button) => ({ - control: { - _component: "@budibase/standard-components/panel", - padding: "20px", - component: button - } -}); - -const indexTables = ({indexes, helpers}) => - indexes.filter(i => i.parent().type === "root") - .map(i => indexTable(i, helpers)); - -const indexTableProps = (index, helpers) => ({ - data: { - "##bbstate":index.nodeKey(), - "##bbsource":"store" - }, - columns: helpers.indexSchema(index).map(column) -}); - -const indexTable = (index, helpers) => ({ - name: `tables/${index.name} Table`, - inherits: "@budibase/standard-components/table", - props: indexTableProps(index, helpers) -}); - -const column = (col) => ({ - title: col.name, - value: { - "##bbstate": col.name, - "##bbsource":"context" - } -}); - -const nav = ({records, indexes, helpers}) => [ - { - name: "Application Root", - inherits: "@budibase/standard-components/nav", - props: { - items: indexes - .filter(i => i.parent().type === "root") - .map(navItem), - selectedItem: { - "##bbstate": "selectedNav", - "##bbstatefallback": records[0].collectionName, - "##bbsource":"store" - } - }, - }, - ...indexTables({records, indexes, helpers}) -]; - - -const navItem = (index) => ({ - title: index.name, - component : { - _component: `tables/${index.name} Table` - } -}); - -const app = (params) => { - - return [ - ...nav(params), - ...forms(params) - ]; -}; - -const buttons = () => [ - { - name: "common/Primary Button", - description: "a styled button", - inherits: "@budibase/standard-components/button", - props: { - padding: "5px 7px", - border: "1px solid #EEE", - color: "#5F6368", - background: "##f2f2f2", - hoverColor: "black", - hoverBackground: "#cccccc" - } - }, - { - name: "common/Secondary Button", - description: "a styled button", - inherits: "@budibase/standard-components/button", - props: { - padding: "5px 7px", - border: "1px solid #EEE", - color: "#5F6368", - background: "##f2f2f2", - hoverColor: "black", - hoverBackground: "#cccccc" - } - } -]; - -export { app, buttons, forms, headers, indexTables, nav }; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdG9ycy5qcyIsInNvdXJjZXMiOlsiLi4vc3JjL2dlbmVyYXRvcnMvaGVhZGVyc0dlbmVyYXRvci5qcyIsIi4uL3NyYy9nZW5lcmF0b3JzL2Zvcm1zR2VuZXJhdG9yLmpzIiwiLi4vc3JjL2dlbmVyYXRvcnMvaW5kZXhUYWJsZXNHZW5lcmF0b3IuanMiLCIuLi9zcmMvZ2VuZXJhdG9ycy9uYXZHZW5lcmF0b3IuanMiLCIuLi9zcmMvZ2VuZXJhdG9ycy9hcHBHZW5lcmF0b3IuanMiLCIuLi9zcmMvZ2VuZXJhdG9ycy9idXR0b25zR2VuZXJhdG9yLmpzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCBoZWFkZXJzID0gKCkgPT4gW1xyXG4gICAge1xyXG4gICAgICAgIG5hbWU6IFwiY29tbW9uL0gxXCIsXHJcbiAgICAgICAgZGVzY3JpcHRpb246IFwiSGVhZGVyIDFcIixcclxuICAgICAgICBpbmhlcml0czogXCJAYnVkaWJhc2Uvc3RhbmRhcmQtY29tcG9uZW50cy90ZXh0XCIsXHJcbiAgICAgICAgcHJvcHM6IHtcclxuICAgICAgICAgICAgZm9udDogXCIyMHB0XCIsXHJcbiAgICAgICAgfVxyXG4gICAgfSxcclxuICAgIHtcclxuICAgICAgICBuYW1lOiBcImNvbW1vbi9IMlwiLFxyXG4gICAgICAgIGRlc2NyaXB0aW9uOiBcIkhlYWRlciAyXCIsXHJcbiAgICAgICAgaW5oZXJpdHM6IFwiQGJ1ZGliYXNlL3N0YW5kYXJkLWNvbXBvbmVudHMvdGV4dFwiLFxyXG4gICAgICAgIHByb3BzOiB7XHJcbiAgICAgICAgICAgIGZvbnQ6IFwiMTVwdFwiLFxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgbmFtZTogXCJjb21tb24vSDNcIixcclxuICAgICAgICBkZXNjcmlwdGlvbjogXCJIZWFkZXIgM1wiLFxyXG4gICAgICAgIGluaGVyaXRzOiBcIkBidWRpYmFzZS9zdGFuZGFyZC1jb21wb25lbnRzL3RleHRcIixcclxuICAgICAgICBwcm9wczoge1xyXG4gICAgICAgICAgICBmb250OiBcIjEycHQgYm9sZFwiLFxyXG4gICAgICAgIH1cclxuICAgIH0sXHJcbiAgICB7XHJcbiAgICAgICAgbmFtZTogXCJjb21tb24vSDRcIixcclxuICAgICAgICBkZXNjcmlwdGlvbjogXCJIZWFkZXIgNFwiLFxyXG4gICAgICAgIGluaGVyaXRzOiBcIkBidWRpYmFzZS9zdGFuZGFyZC1jb21wb25lbnRzL3RleHRcIixcclxuICAgICAgICBwcm9wczoge1xyXG4gICAgICAgICAgICBmb250OiBcIjEwcHQgYm9sZFwiLFxyXG4gICAgICAgIH1cclxuICAgIH1cclxuXSIsImltcG9ydCB7aGVhZGVyc30gZnJvbSBcIi4vaGVhZGVyc0dlbmVyYXRvclwiO1xyXG5cclxuZXhwb3J0IGNvbnN0IGZvcm1zID0gKHtyZWNvcmRzLCBpbmRleGVzfSkgPT4gXHJcbiAgICBbLi4uaGVhZGVycyh7cmVjb3JkcywgaW5kZXhlc30pLFxyXG4gICAgLi4ucmVjb3Jkcy5tYXAocm9vdCldO1xyXG5cclxuY29uc3Qgcm9vdCA9IHJlY29yZCA9PiAoe1xyXG4gICAgbmFtZTogYCR7cmVjb3JkLm5hbWV9IEZvcm1gLFxyXG4gICAgZGVzY3JpcHRpb246IGBBbGwgZmllbGRzIG9uIHJlY29yZCAnJHtyZWNvcmQubm9kZUtleSgpfScgYCxcclxuICAgIGluaGVyaXRzOiBcIkBidWRpYmFzZS9zdGFuZGFyZC1jb21wb25lbnRzL3N0YWNrcGFuZWxcIixcclxuICAgIHByb3BzOiB7XHJcbiAgICAgICAgZGlyZWN0aW9uOiBcInZlcnRpY2FsXCIsXHJcbiAgICAgICAgY2hpbGRyZW46IFtcclxuICAgICAgICAgICAge1xyXG4gICAgICAgICAgICAgICAgY29udHJvbDoge1xyXG4gICAgICAgICAgICAgICAgICAgIF9jb21wb25lbnQ6IFwiY29tbW9uL0gxXCIsXHJcbiAgICAgICAgICAgICAgICAgICAgdmFsdWU6IGBFZGl0ICR7cmVjb3JkLm5hbWV9YCxcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgZm9ybShyZWNvcmQpLFxyXG4gICAgICAgICAgICBzYXZlQ2FuY2VsQnV0dG9ucyhyZWNvcmQpXHJcbiAgICAgICAgXVxyXG4gICAgfVxyXG59KSBcclxuXHJcbmNvbnN0IGZvcm0gPSByZWNvcmQgPT4gKHtcclxuICAgIGNvbnRyb2w6IHtcclxuICAgICAgICBfY29tcG9uZW50OiBcIkBidWRpYmFzZS9zdGFuZGFyZC1jb21wb25lbnRzL2Zvcm1cIixcclxuICAgICAgICBmb3JtQ29udHJvbHM6IFxyXG4gICAgICAgICAgICByZWNvcmQuZmllbGRzLm1hcChmID0+ICh7XHJcbiAgICAgICAgICAgICAgICBsYWJlbDogZi5sYWJlbCxcclxuICAgICAgICAgICAgICAgIGNvbnRyb2w6IHtcclxuICAgICAgICAgICAgICAgICAgICBfY29tcG9uZW50OiBcIkBidWRpYmFzZS9zdGFuZGFyZC1jb21wb25lbnRzL3RleHRib3hcIixcclxuICAgICAgICAgICAgICAgICAgICB2YWx1ZToge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBcIiMjYmJzdGF0ZVwiOmBjdXJyZW50JHtyZWNvcmQubmFtZX0uJHtmLm5hbWV9YCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCIjI2Jic291cmNlXCI6XCJzdG9yZVwiXHJcbiAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICB9KSlcclxuICAgIH1cclxufSlcclxuXHJcbmNvbnN0IHNhdmVDYW5jZWxCdXR0b25zID0gKHJlY29yZCkgPT4gKHtcclxuICAgIGNvbnRyb2w6IHtcclxuICAgICAgICBfY29tcG9uZW50OiBcIkBidWRpYmFzZS9zdGFuZGFyZC1jb21wb25lbnRzL3N0YWNrcGFuZWxcIixcclxuICAgICAgICBkaXJlY3Rpb246IFwiaG9yaXpvbnRhbFwiLFxyXG4gICAgICAgIGNoaWxkcmVuOiBbXHJcbiAgICAgICAgICAgIHBhZGRlZFBhbmVsRm9yQnV0dG9uKHtcclxuICAgICAgICAgICAgICAgIF9jb21wb25lbnQ6IFwiY29tbW9uL1ByaW1hcnkgQnV0dG9uXCIsXHJcbiAgICAgICAgICAgICAgICBjb250ZW50VGV4dDogYFNhdmUgJHtyZWNvcmQubmFtZX1gLFxyXG4gICAgICAgICAgICAgICAgb25DbGljazogWyAgICAgICAgICAgICAgICBcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiIyNldmVudEhhbmRsZXJUeXBlXCI6IFwiU2F2ZSBSZWNvcmRcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyczoge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGVQYXRoOiBgY3VycmVudCR7cmVjb3JkLm5hbWV9YCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIF1cclxuICAgICAgICAgICAgfSksXHJcbiAgICAgICAgICAgIHBhZGRlZFBhbmVsRm9yQnV0dG9uKHtcclxuICAgICAgICAgICAgICAgIF9jb21wb25lbnQ6IFwiY29tbW9uL1NlY29uZGFyeSBCdXR0b25cIixcclxuICAgICAgICAgICAgICAgIGNvbnRlbnRUZXh0OiBgQ2FuY2VsYCxcclxuICAgICAgICAgICAgICAgIG9uQ2xpY2s6IFtcclxuICAgICAgICAgICAgICAgICAgICB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgIFwiIyNldmVudEhhbmRsZXJUeXBlXCI6IFwiU2F2ZSBSZWNvcmRcIixcclxuICAgICAgICAgICAgICAgICAgICAgICAgcGFyYW1ldGVyczoge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RhdGVQYXRoOiBgY3VycmVudCR7cmVjb3JkLm5hbWV9YCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIF1cclxuICAgICAgICAgICAgfSlcclxuICAgICAgICBdXHJcbiAgICB9XHJcbn0pXHJcblxyXG5jb25zdCBwYWRkZWRQYW5lbEZvckJ1dHRvbiA9IChidXR0b24pID0+ICh7XHJcbiAgICBjb250cm9sOiB7XHJcbiAgICAgICAgX2NvbXBvbmVudDogXCJAYnVkaWJhc2Uvc3RhbmRhcmQtY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CJcclxuICAgIH1cclxufSkiLCJpbXBvcnQge2luZGV4VGFibGVzfSBmcm9tIFwiLi9pbmRleFRhYmxlc0dlbmVyYXRvclwiO1xyXG5cclxuZXhwb3J0IGNvbnN0IG5hdiA9ICh7cmVjb3JkcywgaW5kZXhlcywgaGVscGVyc30pID0+IFtcclxuICAgIHtcclxuICAgICAgICBuYW1lOiBcIkFwcGxpY2F0aW9uIFJvb3RcIixcclxuICAgICAgICBpbmhlcml0czogXCJAYnVkaWJhc2Uvc3RhbmRhcmQtY29tcG9uZW50cy9uYXZcIixcclxuICAgICAgICBwcm9wczoge1xyXG4gICAgICAgICAgICBpdGVtczogaW5kZXhlc1xyXG4gICAgICAgICAgICAgICAgICAgIC5maWx0ZXIoaSA9PiBpLnBhcmVudCgpLnR5cGUgPT09IFwicm9vdFwiKVxyXG4gICAgICAgICAgICAgICAgICAgIC5tYXAobmF2SXRlbSksXHJcbiAgICAgICAgICAgIHNlbGVjdGVkSXRlbToge1xyXG4gICAgICAgICAgICAgICAgXCIjI2Jic3RhdGVcIjogXCJzZWxlY3RlZE5hdlwiLFxyXG4gICAgICAgICAgICAgICAgXCIjI2Jic3RhdGVmYWxsYmFja1wiOiByZWNvcmRzWzBdLmNvbGxlY3Rpb25OYW1lLFxyXG4gICAgICAgICAgICAgICAgXCIjI2Jic291cmNlXCI6XCJzdG9yZVwiXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICB9LFxyXG4gICAgfSxcclxuICAgIC4uLmluZGV4VGFibGVzKHtyZWNvcmRzLCBpbmRleGVzLCBoZWxwZXJzfSlcclxuXVxyXG5cclxuXHJcbmV4cG9ydCBjb25zdCBuYXZJdGVtID0gKGluZGV4KSA9PiAoe1xyXG4gICAgdGl0bGU6IGluZGV4Lm5hbWUsXHJcbiAgICBjb21wb25lbnQgOiB7XHJcbiAgICAgICAgX2NvbXBvbmVudDogYHRhYmxlcy8ke2luZGV4Lm5hbWV9IFRhYmxlYFxyXG4gICAgfVxyXG59KVxyXG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IsT0FBTztRQUNILEdBQUcsR0FBRyxDQUFDLE1BQU0sQ0FBQztRQUNkLEdBQUcsS0FBSyxDQUFDLE1BQU0sQ0FBQztLQUNuQixDQUFDO0NBQ0w7O0FDVFcsTUFBQyxPQUFPLEdBQUcsTUFBTTtJQUN6QjtRQUNJLElBQUksRUFBRSx1QkFBdUI7UUFDN0IsV0FBVyxFQUFFLGlCQUFpQjtRQUM5QixRQUFRLEVBQUUsc0NBQXNDO1FBQ2hELEtBQUssRUFBRTtZQUNILE9BQU8sRUFBRSxTQUFTO1lBQ2xCLE1BQU0sRUFBRSxnQkFBZ0I7WUFDeEIsS0FBSyxFQUFFLFNBQVM7WUFDaEIsVUFBVSxFQUFFLFVBQVU7WUFDdEIsVUFBVSxFQUFFLE9BQU87WUFDbkIsZUFBZSxFQUFFLFNBQVM7U0FDN0I7S0FDSjtJQUNEO1FBQ0ksSUFBSSxFQUFFLHlCQUF5QjtRQUMvQixXQUFXLEVBQUUsaUJBQWlCO1FBQzlCLFFBQVEsRUFBRSxzQ0FBc0M7UUFDaEQsS0FBSyxFQUFFO1lBQ0gsT0FBTyxFQUFFLFNBQVM7WUFDbEIsTUFBTSxFQUFFLGdCQUFnQjtZQUN4QixLQUFLLEVBQUUsU0FBUztZQUNoQixVQUFVLEVBQUUsVUFBVTtZQUN0QixVQUFVLEVBQUUsT0FBTztZQUNuQixlQUFlLEVBQUUsU0FBUztTQUM3QjtLQUNKOzs7OzsifQ== +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdG9ycy5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ== diff --git a/packages/materialdesign-components/package.json b/packages/materialdesign-components/package.json index 16f6582fde..69e08883ce 100644 --- a/packages/materialdesign-components/package.json +++ b/packages/materialdesign-components/package.json @@ -13,18 +13,22 @@ }, "devDependencies": { "@budibase/client": "^0.0.16", + "@material/button": "^4.0.0", "@nx-js/compiler-util": "^2.0.0", "bcryptjs": "^2.4.3", "fs-extra": "^8.1.0", "lodash": "^4.17.15", "npm-run-all": "^4.1.5", "rollup": "^1.11.0", + "rollup-plugin-alias": "^2.2.0", "rollup-plugin-commonjs": "^10.0.2", "rollup-plugin-json": "^4.0.0", "rollup-plugin-livereload": "^1.0.1", "rollup-plugin-node-resolve": "^5.0.0", + "rollup-plugin-postcss": "^2.0.5", "rollup-plugin-svelte": "^5.0.0", "rollup-plugin-terser": "^5.1.1", + "sass": "^1.25.1-test.1", "shortid": "^2.2.15", "sirv-cli": "^0.4.4", "svelte": "^3.12.1" diff --git a/packages/materialdesign-components/rollup.config.js b/packages/materialdesign-components/rollup.config.js index a2dbf1a644..9feb2cc374 100644 --- a/packages/materialdesign-components/rollup.config.js +++ b/packages/materialdesign-components/rollup.config.js @@ -1,20 +1,37 @@ -import svelte from 'rollup-plugin-svelte'; -import resolve from 'rollup-plugin-node-resolve'; +import svelte from "rollup-plugin-svelte"; +import postcss from "rollup-plugin-postcss"; +import resolve from "rollup-plugin-node-resolve"; +import path from "path"; + +const postcssOptions = () => ({ + extensions: [".scss", ".sass"], + extract: false, + minimize: true, + use: [ + [ + "sass", + { + includePaths: ["./node_modules"] + } + ] + ] +}); export default { - input: 'src/index.js', - output: [ - { - file: "dist/index.js", - format: 'esm', - name:"budibaseStandardComponents", - sourcemap: "inline" - } - ], - plugins: [ - svelte({ - hydratable:true - }), - resolve() - ] + input: "src/index.js", + output: [ + { + file: "dist/index.js", + format: "esm", + name: "budibaseStandardComponents", + sourcemap: "inline" + } + ], + plugins: [ + svelte({ + hydratable: true + }), + resolve(), + postcss(postcssOptions()) + ] }; diff --git a/packages/materialdesign-components/rollup.generatorsconfig.js b/packages/materialdesign-components/rollup.generatorsconfig.js new file mode 100644 index 0000000000..bbecc79c64 --- /dev/null +++ b/packages/materialdesign-components/rollup.generatorsconfig.js @@ -0,0 +1,14 @@ +import resolve from "rollup-plugin-node-resolve"; + +export default { + input: "src/generators.js", + output: [ + { + file: "dist/generators.js", + format: "esm", + name: "budibaseStandardComponents", + sourcemap: "inline" + } + ], + plugins: [resolve()] +}; diff --git a/packages/materialdesign-components/rollup.testconfig.js b/packages/materialdesign-components/rollup.testconfig.js index 8a6ab7ff7a..2ef69b8705 100644 --- a/packages/materialdesign-components/rollup.testconfig.js +++ b/packages/materialdesign-components/rollup.testconfig.js @@ -1,93 +1,149 @@ -import svelte from 'rollup-plugin-svelte'; -import resolve from 'rollup-plugin-node-resolve'; -import commonjs from 'rollup-plugin-commonjs'; -import livereload from 'rollup-plugin-livereload'; -import { terser } from 'rollup-plugin-terser'; -import json from 'rollup-plugin-json'; +import svelte from "rollup-plugin-svelte"; +import resolve from "rollup-plugin-node-resolve"; +import commonjs from "rollup-plugin-commonjs"; +import livereload from "rollup-plugin-livereload"; +import { terser } from "rollup-plugin-terser"; +import json from "rollup-plugin-json"; +import alias from "rollup-plugin-alias"; +import path from "path"; + +const aliases = { + resolve: [".js", ".svelte"], + entries: [ + { find: "@BBMD", replacement: path.resolve(__dirname, "dist/index.js") } + ] +}; const production = !process.env.ROLLUP_WATCH; const lodash_fp_exports = [ - "find", "isUndefined", "split", "max", - "last", "union", "reduce", "isObject", - "cloneDeep", "some", "isArray", "map", - "filter", "keys", "isFunction", "isEmpty", - "countBy", "join", "includes", "flatten", - "constant", "first", "intersection", "take", - "has", "mapValues", "isString", "isBoolean", - "isNull", "isNumber", "isObjectLike", "isDate", - "clone", "values", "keyBy", "isNaN", - "isInteger", "toNumber"]; + "find", + "isUndefined", + "split", + "max", + "last", + "union", + "reduce", + "isObject", + "cloneDeep", + "some", + "isArray", + "map", + "filter", + "keys", + "isFunction", + "isEmpty", + "countBy", + "join", + "includes", + "flatten", + "constant", + "first", + "intersection", + "take", + "has", + "mapValues", + "isString", + "isBoolean", + "isNull", + "isNumber", + "isObjectLike", + "isDate", + "clone", + "values", + "keyBy", + "isNaN", + "isInteger", + "toNumber" +]; const lodash_exports = [ - "flow", "head", "find","each", - "tail", "findIndex", "startsWith", - "dropRight", "takeRight", - "trim", "split", "replace", - "merge", "assign"]; + "flow", + "head", + "find", + "each", + "tail", + "findIndex", + "startsWith", + "dropRight", + "takeRight", + "trim", + "split", + "replace", + "merge", + "assign" +]; const coreExternal = [ - "lodash", "lodash/fp", "date-fns", - "lunr", "safe-buffer", "shortid", - "@nx-js/compiler-util", "bcryptjs" + "lodash", + "lodash/fp", + "date-fns", + "lunr", + "safe-buffer", + "shortid", + "@nx-js/compiler-util", + "bcryptjs" ]; export default { - input: 'src/Test/testMain.js', - output: { - sourcemap: true, - format: 'iife', - name: 'app', - file: 'public/bundle.js', - globals: { - "crypto": "crypto" - } - }, - plugins: [ - svelte({ - // enable run-time checks when not in production - dev: !production, - // we'll extract any component CSS out into - // a separate file — better for performance - css: css => { - css.write('public/bundle.css'); - }, - - hydratable:true - }), + input: "src/Test/testMain.js", + output: { + sourcemap: true, + format: "iife", + name: "app", + file: "public/bundle.js", + globals: { + crypto: "crypto" + } + }, + plugins: [ + alias(aliases), + svelte({ + // enable run-time checks when not in production + dev: !production, + // we'll extract any component CSS out into + // a separate file — better for performance + css: css => { + css.write("public/bundle.css"); + }, - // If you have external dependencies installed from - // npm, you'll most likely need these plugins. In - // some cases you'll need additional configuration — - // consult the documentation for details: - // https://github.com/rollup/rollup-plugin-commonjs - resolve({ - browser: true, - dedupe: importee => { - return importee === 'svelte' - || importee.startsWith('svelte/') - || coreExternal.includes(importee); - }, - preferBuiltins: true - }), - commonjs({ - namedExports: { - "lodash/fp": lodash_fp_exports, - "lodash":lodash_exports, - "shortid": ["generate"] - } - }), - json(), + hydratable: true + }), - // Watch the `public` directory and refresh the - // browser on changes when not in production - !production && livereload('public'), + // If you have external dependencies installed from + // npm, you'll most likely need these plugins. In + // some cases you'll need additional configuration — + // consult the documentation for details: + // https://github.com/rollup/rollup-plugin-commonjs + resolve({ + browser: true, + dedupe: importee => { + return ( + importee === "svelte" || + importee.startsWith("svelte/") || + coreExternal.includes(importee) + ); + }, + preferBuiltins: true + }), + commonjs({ + namedExports: { + "lodash/fp": lodash_fp_exports, + lodash: lodash_exports, + shortid: ["generate"] + } + }), + json(), - // If we're building for production (npm run build - // instead of npm run dev), minify - production && terser() - ], - watch: { - clearScreen: false - } + // Watch the `public` directory and refresh the + // browser on changes when not in production + !production && livereload("public"), + + // If we're building for production (npm run build + // instead of npm run dev), minify + production && terser() + ], + watch: { + clearScreen: false + } }; diff --git a/packages/materialdesign-components/src/Button.svelte b/packages/materialdesign-components/src/Button.svelte new file mode 100644 index 0000000000..639e0d3f51 --- /dev/null +++ b/packages/materialdesign-components/src/Button.svelte @@ -0,0 +1,12 @@ + + + diff --git a/packages/materialdesign-components/src/Test/TestApp.svelte b/packages/materialdesign-components/src/Test/TestApp.svelte index 7c7545a894..53298940d5 100644 --- a/packages/materialdesign-components/src/Test/TestApp.svelte +++ b/packages/materialdesign-components/src/Test/TestApp.svelte @@ -1,40 +1,35 @@ -{#await _appPromise} -loading -{:then _bb} - -