From d994177f3b995fd5a246f4c461c3f7bb2e8c1fef Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 10 Nov 2020 10:51:23 +0000 Subject: [PATCH 01/48] Update yarn lock and dev script to use yarn rather than npm --- package.json | 2 +- packages/builder/yarn.lock | 198 +------------------------------------ 2 files changed, 5 insertions(+), 195 deletions(-) diff --git a/package.json b/package.json index 5ff26bfa91..b5cd1e26cc 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "nuke": "rimraf ~/.budibase && npm run restore", "clean": "lerna clean", "kill-port": "kill-port 4001", - "dev": "npm run kill-port && node ./scripts/symlinkDev.js && lerna run --parallel dev:builder --concurrency 1", + "dev": "yarn run kill-port && node ./scripts/symlinkDev.js && lerna run --parallel dev:builder --concurrency 1", "test": "lerna run test", "lint": "eslint packages", "lint:fix": "eslint --fix packages", diff --git a/packages/builder/yarn.lock b/packages/builder/yarn.lock index 9c0458c7d9..9c57c9b773 100644 --- a/packages/builder/yarn.lock +++ b/packages/builder/yarn.lock @@ -719,15 +719,6 @@ svelte-flatpickr "^2.4.0" svelte-portal "^1.0.0" -"@budibase/client@^0.3.5": - version "0.3.5" - resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.3.5.tgz#3889cc13302b830186c0fe04b4f13870cda59362" - integrity sha512-3uKUGaATJ5vA2fkPQq7CCkh45MyCZsp57Ejqwz/4TUQVaxerGRp46A9R0s2t+w3HKbb5FrlG9eyJ5aarvR2Utg== - dependencies: - deep-equal "^2.0.1" - mustache "^4.0.1" - regexparam "^1.3.0" - "@budibase/colorpicker@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@budibase/colorpicker/-/colorpicker-1.0.1.tgz#940c180e7ebba0cb0756c4c8ef13f5dfab58e810" @@ -1416,11 +1407,6 @@ array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" -array-filter@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" - integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= - array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -1475,13 +1461,6 @@ atob@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" -available-typed-arrays@^1.0.0, available-typed-arrays@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz#6b098ca9d8039079ee3f77f7b783c4480ba513f5" - integrity sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ== - dependencies: - array-filter "^1.0.0" - aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1753,14 +1732,6 @@ cachedir@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/cachedir/-/cachedir-2.3.0.tgz#0c75892a052198f0b21c7c1804d8331edfcae0e8" -call-bind@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.0.tgz#24127054bb3f9bdcb4b1fb82418186072f77b8ce" - integrity sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w== - dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.0" - callsites@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" @@ -2456,26 +2427,6 @@ deep-equal@^1.0.1: object-keys "^1.1.1" regexp.prototype.flags "^1.2.0" -deep-equal@^2.0.1: - version "2.0.4" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.0.4.tgz#6b0b407a074666033169df3acaf128e1c6f3eab6" - integrity sha512-BUfaXrVoCfgkOQY/b09QdO9L3XNoF2XH0A3aY9IQwQL/ZjLOe8FQgCNVl1wiolhsFo8kFdO9zdPViCPbmaJA5w== - dependencies: - es-abstract "^1.18.0-next.1" - es-get-iterator "^1.1.0" - is-arguments "^1.0.4" - is-date-object "^1.0.2" - is-regex "^1.1.1" - isarray "^2.0.5" - object-is "^1.1.3" - object-keys "^1.1.1" - object.assign "^4.1.1" - regexp.prototype.flags "^1.3.0" - side-channel "^1.0.3" - which-boxed-primitive "^1.0.1" - which-collection "^1.0.1" - which-typed-array "^1.1.2" - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2645,23 +2596,6 @@ es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5: string.prototype.trimleft "^2.1.1" string.prototype.trimright "^2.1.1" -es-abstract@^1.17.4: - version "1.17.7" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.7.tgz#a4de61b2f66989fc7421676c1cb9787573ace54c" - integrity sha512-VBl/gnfcJ7OercKA9MVaegWsBHFjV492syMudcnQZvt/Dw8ezpcOHYZXa/J96O8vx+g4x65YKhxOwDUh63aS5g== - dependencies: - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.2" - is-regex "^1.1.1" - object-inspect "^1.8.0" - object-keys "^1.1.1" - object.assign "^4.1.1" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" - es-abstract@^1.18.0-next.0, es-abstract@^1.18.0-next.1: version "1.18.0-next.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0-next.1.tgz#6e3a0a4bda717e5023ab3b8e90bec36108d22c68" @@ -2680,20 +2614,6 @@ es-abstract@^1.18.0-next.0, es-abstract@^1.18.0-next.1: string.prototype.trimend "^1.0.1" string.prototype.trimstart "^1.0.1" -es-get-iterator@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.1.tgz#b93ddd867af16d5118e00881396533c1c6647ad9" - integrity sha512-qorBw8Y7B15DVLaJWy6WdEV/ZkieBcu6QCq/xzWzGOKJqgG1j754vXRfZ3NY7HSShneqU43mPB4OkQBTkvHhFw== - dependencies: - call-bind "^1.0.0" - get-intrinsic "^1.0.1" - has-symbols "^1.0.1" - is-arguments "^1.0.4" - is-map "^2.0.1" - is-set "^2.0.1" - is-string "^1.0.5" - isarray "^2.0.5" - es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -3011,7 +2931,7 @@ for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" -foreach@^2.0.5, foreach@~2.0.1: +foreach@~2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= @@ -3097,15 +3017,6 @@ get-caller-file@^2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" -get-intrinsic@^1.0.0, get-intrinsic@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.0.1.tgz#94a9768fcbdd0595a1c9273aacf4c89d075631be" - integrity sha512-ZnWP+AmS1VUaLgTRy47+zKtjTxz+0xMpx3I52i+aalBK1QP19ggLF3Db89KJX7kjfOfP2eoa01qc++GwPgufPg== - dependencies: - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - get-port@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.2.0.tgz#dd7ce7de187c06c8bf353796ac71e099f0980ebc" @@ -3403,22 +3314,12 @@ is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" -is-bigint@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.0.tgz#73da8c33208d00f130e9b5e15d23eac9215601c4" - integrity sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g== - is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" dependencies: binary-extensions "^2.0.0" -is-boolean-object@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.1.tgz#10edc0900dd127697a92f6f9807c7617d68ac48e" - integrity sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ== - is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -3450,7 +3351,7 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" -is-date-object@^1.0.1, is-date-object@^1.0.2: +is-date-object@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" integrity sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g== @@ -3516,11 +3417,6 @@ is-installed-globally@^0.3.2: global-dirs "^2.0.1" is-path-inside "^3.0.1" -is-map@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.1.tgz#520dafc4307bb8ebc33b813de5ce7c9400d644a1" - integrity sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw== - is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" @@ -3530,11 +3426,6 @@ is-negative-zero@^2.0.0: resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461" integrity sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE= -is-number-object@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197" - integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== - is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -3598,11 +3489,6 @@ is-regex@^1.0.5: dependencies: has "^1.0.3" -is-set@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.1.tgz#d1604afdab1724986d30091575f54945da7e5f43" - integrity sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA== - is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -3611,41 +3497,16 @@ is-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" -is-string@^1.0.4, is-string@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" - integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== - is-symbol@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" dependencies: has-symbols "^1.0.1" -is-typed-array@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.3.tgz#a4ff5a5e672e1a55f99c7f54e59597af5c1df04d" - integrity sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ== - dependencies: - available-typed-arrays "^1.0.0" - es-abstract "^1.17.4" - foreach "^2.0.5" - has-symbols "^1.0.1" - is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" -is-weakmap@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" - integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== - -is-weakset@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.1.tgz#e9a0af88dbd751589f5e50d80f4c98b780884f83" - integrity sha512-pi4vhbhVHGLxohUw7PhGsueT4vRGFoXhP7+RGN0jKIv9+8PWYCQTqtADngrxOm2g46hoH0+g8uZZBzMrvVGDmw== - is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -3666,11 +3527,6 @@ isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - isbuffer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/isbuffer/-/isbuffer-0.0.0.tgz#38c146d9df528b8bf9b0701c3d43cf12df3fc39b" @@ -4796,7 +4652,7 @@ object-inspect@^1.8.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== -object-is@^1.0.1, object-is@^1.1.3: +object-is@^1.0.1: version "1.1.3" resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.3.tgz#2e3b9e65560137455ee3bd62aec4d90a2ea1cc81" integrity sha512-teyqLvFWzLkq5B9ki8FVWA902UER2qkxmdA4nLf+wjOLAWgxzCWZNCxpDq9MvE8MmhWNr+I8w3BN49Vx36Y6Xg== @@ -5351,7 +5207,7 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.0: +regexp.prototype.flags@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75" integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ== @@ -5359,11 +5215,6 @@ regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.0: define-properties "^1.1.3" es-abstract "^1.17.0-next.1" -regexparam@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/regexparam/-/regexparam-1.3.0.tgz#2fe42c93e32a40eff6235d635e0ffa344b92965f" - integrity sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g== - regexpu-core@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.0.tgz#fcbf458c50431b0bb7b45d6967b8192d91f3d938" @@ -5777,14 +5628,6 @@ shortid@^2.2.15: dependencies: nanoid "^2.1.0" -side-channel@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.3.tgz#cdc46b057550bbab63706210838df5d4c19519c3" - integrity sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g== - dependencies: - es-abstract "^1.18.0-next.0" - object-inspect "^1.8.0" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" @@ -6506,43 +6349,10 @@ whatwg-url@^8.0.0: tr46 "^2.0.2" webidl-conversions "^5.0.0" -which-boxed-primitive@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz#cbe8f838ebe91ba2471bb69e9edbda67ab5a5ec1" - integrity sha512-7BT4TwISdDGBgaemWU0N0OU7FeAEJ9Oo2P1PHRm/FCWoEi2VLWC9b6xvxAA3C/NMpxg3HXVgi0sMmGbNUbNepQ== - dependencies: - is-bigint "^1.0.0" - is-boolean-object "^1.0.0" - is-number-object "^1.0.3" - is-string "^1.0.4" - is-symbol "^1.0.2" - -which-collection@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" - integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== - dependencies: - is-map "^2.0.1" - is-set "^2.0.1" - is-weakmap "^2.0.1" - is-weakset "^2.0.1" - which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which-typed-array@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.2.tgz#e5f98e56bda93e3dac196b01d47c1156679c00b2" - integrity sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ== - dependencies: - available-typed-arrays "^1.0.2" - es-abstract "^1.17.5" - foreach "^2.0.5" - function-bind "^1.1.1" - has-symbols "^1.0.1" - is-typed-array "^1.1.3" - which@^1.2.9, which@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" From 499ad2e35d1807601552a5f44cddc3500f178fc7 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 11 Nov 2020 12:25:50 +0000 Subject: [PATCH 02/48] Add initial work on component SDK --- packages/client/src/api/authenticate.js | 28 ----- packages/client/src/api/index.js | 119 ------------------- packages/component-sdk/.gitignore | 9 ++ packages/component-sdk/package.json | 10 ++ packages/component-sdk/src/api/api.js | 54 +++++++++ packages/component-sdk/src/api/auth.js | 21 ++++ packages/component-sdk/src/api/index.js | 2 + packages/component-sdk/src/api/routes.js | 0 packages/component-sdk/src/api/rows.js | 80 +++++++++++++ packages/component-sdk/src/api/screens.js | 0 packages/component-sdk/src/api/tables.js | 0 packages/component-sdk/src/index.js | 2 + packages/component-sdk/src/store/auth.js | 41 +++++++ packages/component-sdk/src/store/config.js | 51 ++++++++ packages/component-sdk/src/store/index.js | 5 + packages/component-sdk/src/utils/getAppId.js | 47 ++++++++ packages/component-sdk/src/utils/index.js | 1 + 17 files changed, 323 insertions(+), 147 deletions(-) delete mode 100644 packages/client/src/api/authenticate.js delete mode 100644 packages/client/src/api/index.js create mode 100644 packages/component-sdk/.gitignore create mode 100644 packages/component-sdk/package.json create mode 100644 packages/component-sdk/src/api/api.js create mode 100644 packages/component-sdk/src/api/auth.js create mode 100644 packages/component-sdk/src/api/index.js create mode 100644 packages/component-sdk/src/api/routes.js create mode 100644 packages/component-sdk/src/api/rows.js create mode 100644 packages/component-sdk/src/api/screens.js create mode 100644 packages/component-sdk/src/api/tables.js create mode 100644 packages/component-sdk/src/index.js create mode 100644 packages/component-sdk/src/store/auth.js create mode 100644 packages/component-sdk/src/store/config.js create mode 100644 packages/component-sdk/src/store/index.js create mode 100644 packages/component-sdk/src/utils/getAppId.js create mode 100644 packages/component-sdk/src/utils/index.js diff --git a/packages/client/src/api/authenticate.js b/packages/client/src/api/authenticate.js deleted file mode 100644 index 0b961a6fe6..0000000000 --- a/packages/client/src/api/authenticate.js +++ /dev/null @@ -1,28 +0,0 @@ -import appStore from "../state/store" - -export const USER_STATE_PATH = "_bbuser" - -export const authenticate = api => async ({ username, password }) => { - if (!username) { - api.error("Authenticate: username not set") - return - } - - if (!password) { - api.error("Authenticate: password not set") - return - } - - const user = await api.post({ - url: "/api/authenticate", - body: { username, password }, - }) - - // set user even if error - so it is defined at least - appStore.update(s => { - s[USER_STATE_PATH] = user - return s - }) - - localStorage.setItem("budibase:user", JSON.stringify(user)) -} diff --git a/packages/client/src/api/index.js b/packages/client/src/api/index.js deleted file mode 100644 index 0b79081187..0000000000 --- a/packages/client/src/api/index.js +++ /dev/null @@ -1,119 +0,0 @@ -import { authenticate } from "./authenticate" -import { getAppId } from "../render/getAppId" - -export async function baseApiCall(method, url, body) { - return await fetch(url, { - method: method, - headers: { - "Content-Type": "application/json", - "x-budibase-app-id": getAppId(window.document.cookie), - }, - body: body && JSON.stringify(body), - credentials: "same-origin", - }) -} - -const apiCall = method => async ({ url, body }) => { - const response = await baseApiCall(method, url, body) - - switch (response.status) { - case 200: - return response.json() - case 404: - return error(`${url} Not found`) - case 400: - return error(`${url} Bad Request`) - case 403: - return error(`${url} Forbidden`) - default: - if (response.status >= 200 && response.status < 400) { - return response.json() - } - - return error(`${url} - ${response.statusText}`) - } -} - -const post = apiCall("POST") -const get = apiCall("GET") -const patch = apiCall("PATCH") -const del = apiCall("DELETE") - -const ERROR_MEMBER = "##error" -const error = message => { - // appStore.update(s => s["##error_message"], message) - return { [ERROR_MEMBER]: message } -} - -const isSuccess = obj => !obj || !obj[ERROR_MEMBER] - -const apiOpts = { - isSuccess, - error, - post, - get, - patch, - delete: del, -} - -const saveRow = async (params, state) => - await post({ - url: `/api/${params.tableId}/rows`, - body: makeRowRequestBody(params, state), - }) - -const updateRow = async (params, state) => { - const row = makeRowRequestBody(params, state) - row._id = params._id - await patch({ - url: `/api/${params.tableId}/rows/${params._id}`, - body: row, - }) -} - -const deleteRow = async params => - await del({ - url: `/api/${params.tableId}/rows/${params.rowId}/${params.revId}`, - }) - -const makeRowRequestBody = (parameters, state) => { - // start with the row thats currently in context - const body = { ...(state.data || {}) } - - // dont send the table - if (body._table) delete body._table - - // then override with supplied parameters - if (parameters.fields) { - for (let fieldName of Object.keys(parameters.fields)) { - const field = parameters.fields[fieldName] - - // ensure fields sent are of the correct type - if (field.type === "boolean") { - if (field.value === "true") body[fieldName] = true - if (field.value === "false") body[fieldName] = false - } else if (field.type === "number") { - const val = parseFloat(field.value) - if (!isNaN(val)) { - body[fieldName] = val - } - } else if (field.type === "datetime") { - const date = new Date(field.value) - if (!isNaN(date.getTime())) { - body[fieldName] = date.toISOString() - } - } else { - body[fieldName] = field.value - } - } - } - - return body -} - -export default { - authenticate: authenticate(apiOpts), - saveRow, - updateRow, - deleteRow, -} diff --git a/packages/component-sdk/.gitignore b/packages/component-sdk/.gitignore new file mode 100644 index 0000000000..2e8ed59c47 --- /dev/null +++ b/packages/component-sdk/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/node_modules/ +node_modules_win +package-lock.json +release/ +dist/ +routify +cypress/videos +cypress/screenshots diff --git a/packages/component-sdk/package.json b/packages/component-sdk/package.json new file mode 100644 index 0000000000..e22cae171a --- /dev/null +++ b/packages/component-sdk/package.json @@ -0,0 +1,10 @@ +{ + "name": "component-sdk", + "version": "1.0.0", + "description": "SDK for developing Budibase components", + "main": "src/index.js", + "repository": "https://github.com/Budibase/budibase", + "author": "Andrew Kingston", + "license": "AGPLv3", + "private": false +} diff --git a/packages/component-sdk/src/api/api.js b/packages/component-sdk/src/api/api.js new file mode 100644 index 0000000000..10dede1c68 --- /dev/null +++ b/packages/component-sdk/src/api/api.js @@ -0,0 +1,54 @@ +import { get } from "svelte/store" +import { getAppId } from "../utils" +import { configStore } from "../store" + +const makeURL = path => { + const { proto, domain, port } = get(configStore).config + let url = `/${path}`.replace("//", "/") + return domain ? `${proto}://${domain}:${port}${url}` : url +} + +const handleError = error => { + store.actions.handleError(error) + return { error } +} + +const apiCall = method => async ({ url, body }) => { + try { + const fullURL = makeURL(url) + const response = await fetch(fullURL, { + method: method, + headers: { + "Content-Type": "application/json", + "x-budibase-app-id": getAppId(window.document.cookie), + }, + body: body && JSON.stringify(body), + credentials: "same-origin", + }) + switch (response.status) { + case 200: + return response.json() + case 404: + return handleError(`${url}: Not Found`) + case 400: + return handleError(`${url}: Bad Request`) + case 403: + return handleError(`${url}: Forbidden`) + default: + if (response.status >= 200 && response.status < 400) { + return response.json() + } + return handleError(`${url} - ${response.statusText}`) + } + } catch (error) { + return handleError(error) + } +} + +export default { + post: apiCall("POST"), + get: apiCall("GET"), + patch: apiCall("PATCH"), + del: apiCall("DELETE"), + error: handleError, +} diff --git a/packages/component-sdk/src/api/auth.js b/packages/component-sdk/src/api/auth.js new file mode 100644 index 0000000000..ba1cf51a75 --- /dev/null +++ b/packages/component-sdk/src/api/auth.js @@ -0,0 +1,21 @@ +import api from "./api" + +/** + * Performs a log in request. + * + * @param username + * @param password + * @returns {Promise<{error: *}|any|{error: *}>} + */ +export const logIn = async ({ username, password }) => { + if (!username) { + return api.error("Please enter your username") + } + if (!password) { + return api.error("Please enter your password") + } + return await api.post({ + url: "/api/authenticate", + body: { username, password }, + }) +} diff --git a/packages/component-sdk/src/api/index.js b/packages/component-sdk/src/api/index.js new file mode 100644 index 0000000000..56ef9b06ad --- /dev/null +++ b/packages/component-sdk/src/api/index.js @@ -0,0 +1,2 @@ +export * from "./rows" +export * from "./auth" diff --git a/packages/component-sdk/src/api/routes.js b/packages/component-sdk/src/api/routes.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/component-sdk/src/api/rows.js b/packages/component-sdk/src/api/rows.js new file mode 100644 index 0000000000..239e33e23d --- /dev/null +++ b/packages/component-sdk/src/api/rows.js @@ -0,0 +1,80 @@ +import api from "./api" + +/** + * Creates a row in a table. + * + * @param params + * @param state + * @returns {Promise} + */ +export const saveRow = async (params, state) => { + return await api.post({ + url: `/api/${params.tableId}/rows`, + body: makeRowRequestBody(params, state), + }) +} + +/** + * Updates a row in a table. + * + * @param params + * @param state + * @returns {Promise} + */ +export const updateRow = async (params, state) => { + const row = makeRowRequestBody(params, state) + row._id = params._id + return await api.patch({ + url: `/api/${params.tableId}/rows/${params._id}`, + body: row, + }) +} + +/** + * Deletes a row from a table. + * + * @param tableId + * @param rowId + * @param revId + * @returns {Promise} + */ +export const deleteRow = async ({ tableId, rowId, revId }) => { + return await api.del({ + url: `/api/${tableId}/rows/${rowId}/${revId}`, + }) +} + +const makeRowRequestBody = (parameters, state) => { + // start with the row thats currently in context + const body = { ...(state.data || {}) } + + // dont send the table + if (body._table) delete body._table + + // then override with supplied parameters + if (parameters.fields) { + for (let fieldName of Object.keys(parameters.fields)) { + const field = parameters.fields[fieldName] + + // ensure fields sent are of the correct type + if (field.type === "boolean") { + if (field.value === "true") body[fieldName] = true + if (field.value === "false") body[fieldName] = false + } else if (field.type === "number") { + const val = parseFloat(field.value) + if (!isNaN(val)) { + body[fieldName] = val + } + } else if (field.type === "datetime") { + const date = new Date(field.value) + if (!isNaN(date.getTime())) { + body[fieldName] = date.toISOString() + } + } else { + body[fieldName] = field.value + } + } + } + + return body +} diff --git a/packages/component-sdk/src/api/screens.js b/packages/component-sdk/src/api/screens.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/component-sdk/src/api/tables.js b/packages/component-sdk/src/api/tables.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/component-sdk/src/index.js b/packages/component-sdk/src/index.js new file mode 100644 index 0000000000..87b875af48 --- /dev/null +++ b/packages/component-sdk/src/index.js @@ -0,0 +1,2 @@ +export * from "./api" +export * from "./store" diff --git a/packages/component-sdk/src/store/auth.js b/packages/component-sdk/src/store/auth.js new file mode 100644 index 0000000000..d492f65ef8 --- /dev/null +++ b/packages/component-sdk/src/store/auth.js @@ -0,0 +1,41 @@ +import { localStorageStore } from "../../../builder/src/builderStore/store/localStorage" +import * as api from "../api" + +const initialState = { + user: null, +} + +export const createAuthStore = () => { + const store = localStorageStore("bb-app-auth", initialState) + + /** + * Logs a user in. + * + * @param username + * @param password + * @returns {Promise} + */ + const logIn = async ({ username, password }) => { + const user = await api.logIn({ username, password }) + if (!user.error) { + store.update(state => { + state.user = user + return state + }) + } + } + + /** + * Logs a user out. + */ + const logOut = () => { + store.update(() => initialState) + } + + store.actions = { + logIn, + logOut, + } + + return store +} diff --git a/packages/component-sdk/src/store/config.js b/packages/component-sdk/src/store/config.js new file mode 100644 index 0000000000..5de7e73238 --- /dev/null +++ b/packages/component-sdk/src/store/config.js @@ -0,0 +1,51 @@ +import { writable, get } from "svelte/store" + +const initialState = { + proto: "http", + domain: null, + port: 80, + onError: null, +} + +export const createConfigStore = () => { + const store = writable(initialState) + + /** + * Sets the SDK configuration. + * + * @param config + */ + const initialise = config => { + store.update(state => { + return { + ...state, + ...config, + } + }) + } + + /** + * Rests the SDK configuration + */ + const reset = () => { + store.update(() => initialState) + } + + /** + * Store handler for errors which triggers the user defined error handler. + * + * @param error + */ + const handleError = error => { + const handler = get(store).onError + handler && handler(error) + } + + store.actions = { + initialise, + reset, + handleError, + } + + return store +} diff --git a/packages/component-sdk/src/store/index.js b/packages/component-sdk/src/store/index.js new file mode 100644 index 0000000000..10cab9dfdc --- /dev/null +++ b/packages/component-sdk/src/store/index.js @@ -0,0 +1,5 @@ +import { createConfigStore } from "./config" +import { createAuthStore } from "./auth" + +export const configStore = createConfigStore() +export const authStore = createAuthStore() diff --git a/packages/component-sdk/src/utils/getAppId.js b/packages/component-sdk/src/utils/getAppId.js new file mode 100644 index 0000000000..62d960afe0 --- /dev/null +++ b/packages/component-sdk/src/utils/getAppId.js @@ -0,0 +1,47 @@ +const COOKIE_SEPARATOR = ";" +const APP_PREFIX = "app_" +const KEY_VALUE_SPLIT = "=" + +function confirmAppId(possibleAppId) { + return possibleAppId && possibleAppId.startsWith(APP_PREFIX) + ? possibleAppId + : undefined +} + +function tryGetFromCookie({ cookies }) { + if (!cookies) { + return undefined + } + const cookie = cookies + .split(COOKIE_SEPARATOR) + .find(cookie => cookie.trim().startsWith("budibase:currentapp")) + let appId + if (cookie && cookie.split(KEY_VALUE_SPLIT).length === 2) { + appId = cookie.split("=")[1] + } + return confirmAppId(appId) +} + +function tryGetFromPath() { + const appId = location.pathname.split("/")[1] + return confirmAppId(appId) +} + +function tryGetFromSubdomain() { + const parts = window.location.host.split(".") + const appId = parts[1] ? parts[0] : undefined + return confirmAppId(appId) +} + +export const getAppId = cookies => { + const functions = [tryGetFromSubdomain, tryGetFromPath, tryGetFromCookie] + // try getting the app Id in order + let appId + for (let func of functions) { + appId = func({ cookies }) + if (appId) { + break + } + } + return appId +} diff --git a/packages/component-sdk/src/utils/index.js b/packages/component-sdk/src/utils/index.js new file mode 100644 index 0000000000..1eb0ca2cfe --- /dev/null +++ b/packages/component-sdk/src/utils/index.js @@ -0,0 +1 @@ +export { getAppId } from "./getAppId" From 921cae0cbced94e3946cdc9e55f3b300178a6a75 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 11 Nov 2020 14:26:33 +0000 Subject: [PATCH 03/48] Tidy up standard components --- packages/client/src/render/getAppId.js | 46 ---------- .../standard-components/src/Heading.svelte | 1 - packages/standard-components/src/Image.svelte | 2 +- .../src/Templates/saveRowButton.js | 23 ----- packages/standard-components/src/api.js | 33 ------- .../src/attachments/AttachmentList.svelte | 2 +- .../src/attachments/Dropzone.svelte | 8 +- .../standard-components/src/buildStyle.js | 9 -- .../src/{Chart => charts}/ApexChart.svelte | 0 .../{Chart => charts}/ApexOptionsBuilder.js | 0 .../src/{Chart => charts}/AreaChart.svelte | 0 .../src/{Chart => charts}/BarChart.svelte | 0 .../{Chart => charts}/CandleStickChart.svelte | 0 .../src/{Chart => charts}/DonutChart.svelte | 0 .../src/{Chart => charts}/LineChart.svelte | 0 .../src/{Chart => charts}/PieChart.svelte | 0 .../src/{Chart => charts}/index.js | 0 packages/standard-components/src/cssVars.js | 31 ------- .../standard-components/src/emptyProps.js | 1 - packages/standard-components/src/fetchData.js | 87 ------------------- .../AttachmentCell/Button.svelte | 0 .../AttachmentCell/Modal.svelte | 0 .../src/{DataGrid => grid}/Component.svelte | 0 .../CreateRow/Button.svelte | 0 .../{DataGrid => grid}/CreateRow/Modal.svelte | 0 .../DateTime/Wrapper.svelte | 0 .../Relationship/RelationshipDisplay.svelte | 0 .../Relationship/tableCache.js | 0 .../{DataGrid => grid}/Select/Wrapper.svelte | 0 .../ViewDetails/Cell.svelte | 0 .../src/{DataGrid => grid}/customRenderer.js | 0 .../src/{DataGrid => grid}/valueSetters.js | 0 packages/standard-components/src/helpers.js | 50 ++++++++++- .../src/icons/ArrowDown.svelte | 10 --- .../src/icons/ArrowUp.svelte | 10 --- packages/standard-components/src/index.js | 5 +- .../src/{Test => tests}/TestApp.svelte | 0 .../src/{Test => tests}/createApp.js | 0 .../src/{Test => tests}/props.js | 0 .../src/{Test => tests}/rootComponent.js | 0 .../src/{Test => tests}/testComponents.js | 0 .../src/{Test => tests}/testMain.js | 0 42 files changed, 56 insertions(+), 262 deletions(-) delete mode 100644 packages/client/src/render/getAppId.js delete mode 100644 packages/standard-components/src/Templates/saveRowButton.js delete mode 100644 packages/standard-components/src/api.js delete mode 100644 packages/standard-components/src/buildStyle.js rename packages/standard-components/src/{Chart => charts}/ApexChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/ApexOptionsBuilder.js (100%) rename packages/standard-components/src/{Chart => charts}/AreaChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/BarChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/CandleStickChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/DonutChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/LineChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/PieChart.svelte (100%) rename packages/standard-components/src/{Chart => charts}/index.js (100%) delete mode 100644 packages/standard-components/src/cssVars.js delete mode 100644 packages/standard-components/src/emptyProps.js delete mode 100644 packages/standard-components/src/fetchData.js rename packages/standard-components/src/{DataGrid => grid}/AttachmentCell/Button.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/AttachmentCell/Modal.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/Component.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/CreateRow/Button.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/CreateRow/Modal.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/DateTime/Wrapper.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/Relationship/RelationshipDisplay.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/Relationship/tableCache.js (100%) rename packages/standard-components/src/{DataGrid => grid}/Select/Wrapper.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/ViewDetails/Cell.svelte (100%) rename packages/standard-components/src/{DataGrid => grid}/customRenderer.js (100%) rename packages/standard-components/src/{DataGrid => grid}/valueSetters.js (100%) delete mode 100644 packages/standard-components/src/icons/ArrowDown.svelte delete mode 100644 packages/standard-components/src/icons/ArrowUp.svelte rename packages/standard-components/src/{Test => tests}/TestApp.svelte (100%) rename packages/standard-components/src/{Test => tests}/createApp.js (100%) rename packages/standard-components/src/{Test => tests}/props.js (100%) rename packages/standard-components/src/{Test => tests}/rootComponent.js (100%) rename packages/standard-components/src/{Test => tests}/testComponents.js (100%) rename packages/standard-components/src/{Test => tests}/testMain.js (100%) diff --git a/packages/client/src/render/getAppId.js b/packages/client/src/render/getAppId.js deleted file mode 100644 index c827db8603..0000000000 --- a/packages/client/src/render/getAppId.js +++ /dev/null @@ -1,46 +0,0 @@ -const COOKIE_SEPARATOR = ";" -const APP_PREFIX = "app_" -const KEY_VALUE_SPLIT = "=" - -function confirmAppId(possibleAppId) { - return possibleAppId && possibleAppId.startsWith(APP_PREFIX) - ? possibleAppId - : undefined -} - -function tryGetFromCookie({ cookies }) { - const cookie = cookies - .split(COOKIE_SEPARATOR) - .find(cookie => cookie.trim().startsWith("budibase:currentapp")) - let appId - if (cookie && cookie.split(KEY_VALUE_SPLIT).length === 2) { - appId = cookie.split("=")[1] - } - return confirmAppId(appId) -} - -function tryGetFromPath() { - const appId = location.pathname.split("/")[1] - return confirmAppId(appId) -} - -function tryGetFromSubdomain() { - const parts = window.location.host.split(".") - const appId = parts[1] ? parts[0] : undefined - return confirmAppId(appId) -} - -export const getAppId = cookies => { - const functions = [tryGetFromSubdomain, tryGetFromPath, tryGetFromCookie] - // try getting the app Id in order - let appId - for (let func of functions) { - appId = func({ cookies }) - if (appId) { - break - } - } - return appId -} - -export const getAppIdFromPath = getAppId diff --git a/packages/standard-components/src/Heading.svelte b/packages/standard-components/src/Heading.svelte index 5c912a2edd..4242c467eb 100644 --- a/packages/standard-components/src/Heading.svelte +++ b/packages/standard-components/src/Heading.svelte @@ -1,5 +1,4 @@ diff --git a/packages/standard-components/src/buildStyle.js b/packages/standard-components/src/buildStyle.js deleted file mode 100644 index 53c77e062e..0000000000 --- a/packages/standard-components/src/buildStyle.js +++ /dev/null @@ -1,9 +0,0 @@ -export const buildStyle = styles => { - let str = "" - for (let s in styles) { - if (styles[s]) { - str += `${s}: ${styles[s]}; ` - } - } - return str -} diff --git a/packages/standard-components/src/Chart/ApexChart.svelte b/packages/standard-components/src/charts/ApexChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/ApexChart.svelte rename to packages/standard-components/src/charts/ApexChart.svelte diff --git a/packages/standard-components/src/Chart/ApexOptionsBuilder.js b/packages/standard-components/src/charts/ApexOptionsBuilder.js similarity index 100% rename from packages/standard-components/src/Chart/ApexOptionsBuilder.js rename to packages/standard-components/src/charts/ApexOptionsBuilder.js diff --git a/packages/standard-components/src/Chart/AreaChart.svelte b/packages/standard-components/src/charts/AreaChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/AreaChart.svelte rename to packages/standard-components/src/charts/AreaChart.svelte diff --git a/packages/standard-components/src/Chart/BarChart.svelte b/packages/standard-components/src/charts/BarChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/BarChart.svelte rename to packages/standard-components/src/charts/BarChart.svelte diff --git a/packages/standard-components/src/Chart/CandleStickChart.svelte b/packages/standard-components/src/charts/CandleStickChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/CandleStickChart.svelte rename to packages/standard-components/src/charts/CandleStickChart.svelte diff --git a/packages/standard-components/src/Chart/DonutChart.svelte b/packages/standard-components/src/charts/DonutChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/DonutChart.svelte rename to packages/standard-components/src/charts/DonutChart.svelte diff --git a/packages/standard-components/src/Chart/LineChart.svelte b/packages/standard-components/src/charts/LineChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/LineChart.svelte rename to packages/standard-components/src/charts/LineChart.svelte diff --git a/packages/standard-components/src/Chart/PieChart.svelte b/packages/standard-components/src/charts/PieChart.svelte similarity index 100% rename from packages/standard-components/src/Chart/PieChart.svelte rename to packages/standard-components/src/charts/PieChart.svelte diff --git a/packages/standard-components/src/Chart/index.js b/packages/standard-components/src/charts/index.js similarity index 100% rename from packages/standard-components/src/Chart/index.js rename to packages/standard-components/src/charts/index.js diff --git a/packages/standard-components/src/cssVars.js b/packages/standard-components/src/cssVars.js deleted file mode 100644 index 7d1371436e..0000000000 --- a/packages/standard-components/src/cssVars.js +++ /dev/null @@ -1,31 +0,0 @@ -// https://github.com/kaisermann/svelte-css-vars - -export const cssVars = (node, props) => { - Object.entries(props).forEach(([key, value]) => { - node.style.setProperty(`--${key}`, value) - }) - - return { - update(new_props) { - Object.entries(new_props).forEach(([key, value]) => { - node.style.setProperty(`--${key}`, value) - delete props[key] - }) - - Object.keys(props).forEach(name => node.style.removeProperty(`--${name}`)) - props = new_props - }, - } -} - -export const createClasses = classes => { - let all = "" - for (let cls in classes) { - if (classes[cls]) { - all = all + " " + cls - } - } - return all -} - -export default cssVars diff --git a/packages/standard-components/src/emptyProps.js b/packages/standard-components/src/emptyProps.js deleted file mode 100644 index 6938c06462..0000000000 --- a/packages/standard-components/src/emptyProps.js +++ /dev/null @@ -1 +0,0 @@ -export const emptyProps = () => ({ _component: "" }) diff --git a/packages/standard-components/src/fetchData.js b/packages/standard-components/src/fetchData.js deleted file mode 100644 index ef1950c5f7..0000000000 --- a/packages/standard-components/src/fetchData.js +++ /dev/null @@ -1,87 +0,0 @@ -import api from "./api" - -export default async function fetchData(datasource, store) { - const { type, name } = datasource - - if (name) { - let rows = [] - if (type === "table") { - rows = await fetchTableData() - } else if (type === "view") { - rows = await fetchViewData() - } else if (type === "link") { - rows = await fetchLinkedRowsData() - } - - // Fetch table schema so we can check for linked rows - if (rows && rows.length && datasource.tableId) { - const schema = await fetchSchema(datasource.tableId) - const keys = Object.keys(schema) - rows.forEach(row => { - for (let key of keys) { - const type = schema[key].type - if (type === "link") { - row[`${key}_count`] = Array.isArray(row[key]) ? row[key].length : 0 - } else if (type === "attachment") { - let url = null - if (Array.isArray(row[key]) && row[key][0] != null) { - url = row[key][0].url - } - row[`${key}_first`] = url - } - } - }) - } - - return rows - } else { - return [] - } - - async function fetchTableData() { - if (!name.startsWith("all_")) { - throw new Error("Incorrect table convention - must begin with all_") - } - const tablesResponse = await api.get(`/api/views/${name}`) - return await tablesResponse.json() - } - - async function fetchViewData() { - const { field, groupBy, calculation } = datasource - const params = new URLSearchParams() - - if (calculation) { - params.set("field", field) - params.set("calculation", calculation) - } - - if (groupBy) { - params.set("group", groupBy) - } - - if (groupBy) params.set("group", groupBy) - - let QUERY_VIEW_URL = field - ? `/api/views/${name}?${params}` - : `/api/views/${name}` - - const response = await api.get(QUERY_VIEW_URL) - return await response.json() - } - - async function fetchLinkedRowsData() { - if (!store || !store.data || !store.data._id) { - return [] - } - const QUERY_URL = `/api/${store.data.tableId}/${store.data._id}/enrich` - const response = await api.get(QUERY_URL) - const row = await response.json() - return row[datasource.fieldName] - } -} - -export async function fetchSchema(id) { - const FETCH_TABLE_URL = `/api/tables/${id}` - const response = await api.get(FETCH_TABLE_URL) - return (await response.json()).schema -} diff --git a/packages/standard-components/src/DataGrid/AttachmentCell/Button.svelte b/packages/standard-components/src/grid/AttachmentCell/Button.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/AttachmentCell/Button.svelte rename to packages/standard-components/src/grid/AttachmentCell/Button.svelte diff --git a/packages/standard-components/src/DataGrid/AttachmentCell/Modal.svelte b/packages/standard-components/src/grid/AttachmentCell/Modal.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/AttachmentCell/Modal.svelte rename to packages/standard-components/src/grid/AttachmentCell/Modal.svelte diff --git a/packages/standard-components/src/DataGrid/Component.svelte b/packages/standard-components/src/grid/Component.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/Component.svelte rename to packages/standard-components/src/grid/Component.svelte diff --git a/packages/standard-components/src/DataGrid/CreateRow/Button.svelte b/packages/standard-components/src/grid/CreateRow/Button.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/CreateRow/Button.svelte rename to packages/standard-components/src/grid/CreateRow/Button.svelte diff --git a/packages/standard-components/src/DataGrid/CreateRow/Modal.svelte b/packages/standard-components/src/grid/CreateRow/Modal.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/CreateRow/Modal.svelte rename to packages/standard-components/src/grid/CreateRow/Modal.svelte diff --git a/packages/standard-components/src/DataGrid/DateTime/Wrapper.svelte b/packages/standard-components/src/grid/DateTime/Wrapper.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/DateTime/Wrapper.svelte rename to packages/standard-components/src/grid/DateTime/Wrapper.svelte diff --git a/packages/standard-components/src/DataGrid/Relationship/RelationshipDisplay.svelte b/packages/standard-components/src/grid/Relationship/RelationshipDisplay.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/Relationship/RelationshipDisplay.svelte rename to packages/standard-components/src/grid/Relationship/RelationshipDisplay.svelte diff --git a/packages/standard-components/src/DataGrid/Relationship/tableCache.js b/packages/standard-components/src/grid/Relationship/tableCache.js similarity index 100% rename from packages/standard-components/src/DataGrid/Relationship/tableCache.js rename to packages/standard-components/src/grid/Relationship/tableCache.js diff --git a/packages/standard-components/src/DataGrid/Select/Wrapper.svelte b/packages/standard-components/src/grid/Select/Wrapper.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/Select/Wrapper.svelte rename to packages/standard-components/src/grid/Select/Wrapper.svelte diff --git a/packages/standard-components/src/DataGrid/ViewDetails/Cell.svelte b/packages/standard-components/src/grid/ViewDetails/Cell.svelte similarity index 100% rename from packages/standard-components/src/DataGrid/ViewDetails/Cell.svelte rename to packages/standard-components/src/grid/ViewDetails/Cell.svelte diff --git a/packages/standard-components/src/DataGrid/customRenderer.js b/packages/standard-components/src/grid/customRenderer.js similarity index 100% rename from packages/standard-components/src/DataGrid/customRenderer.js rename to packages/standard-components/src/grid/customRenderer.js diff --git a/packages/standard-components/src/DataGrid/valueSetters.js b/packages/standard-components/src/grid/valueSetters.js similarity index 100% rename from packages/standard-components/src/DataGrid/valueSetters.js rename to packages/standard-components/src/grid/valueSetters.js diff --git a/packages/standard-components/src/helpers.js b/packages/standard-components/src/helpers.js index 2989f4d39c..fe160bb836 100644 --- a/packages/standard-components/src/helpers.js +++ b/packages/standard-components/src/helpers.js @@ -1 +1,49 @@ -export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1) +/** + * Capitalises a string. + * + * @param string + * @returns {string} + */ +export const capitalise = string => { + return string.substring(0, 1).toUpperCase() + string.substring(1) +} + +/** + * Builds a style string from a style object. + * + * @param styles + * @returns {string} + */ +export const buildStyle = styles => { + let str = "" + Object.entries(styles).forEach(([style, value]) => { + if (style && value) { + str += `${style}: ${value}; ` + } + }) + return str +} + +/** + * Svelte action to set CSS variables on a DOM node. + * + * @param node + * @param props + */ +export const cssVars = (node, props) => { + Object.entries(props).forEach(([key, value]) => { + node.style.setProperty(`--${key}`, value) + }) + + return { + update(new_props) { + Object.entries(new_props).forEach(([key, value]) => { + node.style.setProperty(`--${key}`, value) + delete props[key] + }) + + Object.keys(props).forEach(name => node.style.removeProperty(`--${name}`)) + props = new_props + }, + } +} diff --git a/packages/standard-components/src/icons/ArrowDown.svelte b/packages/standard-components/src/icons/ArrowDown.svelte deleted file mode 100644 index ef7e542ea1..0000000000 --- a/packages/standard-components/src/icons/ArrowDown.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/packages/standard-components/src/icons/ArrowUp.svelte b/packages/standard-components/src/icons/ArrowUp.svelte deleted file mode 100644 index 897c3612d2..0000000000 --- a/packages/standard-components/src/icons/ArrowUp.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/packages/standard-components/src/index.js b/packages/standard-components/src/index.js index 60473bec70..30748aa2bf 100644 --- a/packages/standard-components/src/index.js +++ b/packages/standard-components/src/index.js @@ -7,11 +7,10 @@ export { default as input } from "./Input.svelte" export { default as textfield } from "./Textfield.svelte" export { default as button } from "./Button.svelte" export { default as login } from "./Login.svelte" -export { default as saveRowButton } from "./Templates/saveRowButton" export { default as link } from "./Link.svelte" export { default as image } from "./Image.svelte" export { default as Navigation } from "./Navigation.svelte" -export { default as datagrid } from "./DataGrid/Component.svelte" +export { default as datagrid } from "./grid/Component.svelte" export { default as dataform } from "./DataForm.svelte" export { default as dataformwide } from "./DataFormWide.svelte" export { default as datalist } from "./DataList.svelte" @@ -25,4 +24,4 @@ export { default as rowdetail } from "./RowDetail.svelte" export { default as newrow } from "./NewRow.svelte" export { default as datepicker } from "./DatePicker.svelte" export { default as icon } from "./Icon.svelte" -export * from "./Chart" +export * from "./charts" diff --git a/packages/standard-components/src/Test/TestApp.svelte b/packages/standard-components/src/tests/TestApp.svelte similarity index 100% rename from packages/standard-components/src/Test/TestApp.svelte rename to packages/standard-components/src/tests/TestApp.svelte diff --git a/packages/standard-components/src/Test/createApp.js b/packages/standard-components/src/tests/createApp.js similarity index 100% rename from packages/standard-components/src/Test/createApp.js rename to packages/standard-components/src/tests/createApp.js diff --git a/packages/standard-components/src/Test/props.js b/packages/standard-components/src/tests/props.js similarity index 100% rename from packages/standard-components/src/Test/props.js rename to packages/standard-components/src/tests/props.js diff --git a/packages/standard-components/src/Test/rootComponent.js b/packages/standard-components/src/tests/rootComponent.js similarity index 100% rename from packages/standard-components/src/Test/rootComponent.js rename to packages/standard-components/src/tests/rootComponent.js diff --git a/packages/standard-components/src/Test/testComponents.js b/packages/standard-components/src/tests/testComponents.js similarity index 100% rename from packages/standard-components/src/Test/testComponents.js rename to packages/standard-components/src/tests/testComponents.js diff --git a/packages/standard-components/src/Test/testMain.js b/packages/standard-components/src/tests/testMain.js similarity index 100% rename from packages/standard-components/src/Test/testMain.js rename to packages/standard-components/src/tests/testMain.js From 299dcbab3d063516799863a7c17573e2297bba2c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Nov 2020 09:07:09 +0000 Subject: [PATCH 04/48] Add majority of API interactions to SDK --- .../userInterface/FlatButton.svelte | 3 +- packages/client/src/render/screenRouter.js | 2 +- packages/component-sdk/src/api/api.js | 60 +++++++++++++++---- packages/component-sdk/src/api/auth.js | 4 -- packages/component-sdk/src/api/datasources.js | 58 ++++++++++++++++++ .../component-sdk/src/api/relationships.js | 12 ++++ packages/component-sdk/src/api/rows.js | 16 +---- packages/component-sdk/src/api/tables.js | 16 +++++ packages/component-sdk/src/api/views.js | 22 +++++++ packages/component-sdk/src/store/auth.js | 4 -- packages/component-sdk/src/store/config.js | 4 -- packages/standard-components/src/Card.svelte | 2 +- .../src/CardHorizontal.svelte | 2 +- .../standard-components/src/Container.svelte | 2 - packages/standard-components/src/Link.svelte | 2 - packages/standard-components/src/Login.svelte | 2 - packages/standard-components/src/Nav.svelte | 2 +- 17 files changed, 166 insertions(+), 47 deletions(-) create mode 100644 packages/component-sdk/src/api/datasources.js create mode 100644 packages/component-sdk/src/api/relationships.js create mode 100644 packages/component-sdk/src/api/views.js diff --git a/packages/builder/src/components/userInterface/FlatButton.svelte b/packages/builder/src/components/userInterface/FlatButton.svelte index 4bac03d4a6..931b90a5a2 100644 --- a/packages/builder/src/components/userInterface/FlatButton.svelte +++ b/packages/builder/src/components/userInterface/FlatButton.svelte @@ -1,9 +1,8 @@ - -
- {#each data as data} -
-
    - {#each Object.keys(data) as key} -
  • - {key}: - {data[key]} -
  • - {/each} -
-
- {/each} -
- - diff --git a/packages/standard-components/src/DataSearch.svelte b/packages/standard-components/src/DataSearch.svelte deleted file mode 100644 index 1521dae418..0000000000 --- a/packages/standard-components/src/DataSearch.svelte +++ /dev/null @@ -1,15 +0,0 @@ - - -
- - -
diff --git a/packages/standard-components/src/IconOld.svelte b/packages/standard-components/src/IconOld.svelte deleted file mode 100644 index f220d3c8f9..0000000000 --- a/packages/standard-components/src/IconOld.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/packages/standard-components/src/LinkedRowSelector.svelte b/packages/standard-components/src/LinkedRowSelector.svelte index cd9c6fc264..a0e74dca97 100644 --- a/packages/standard-components/src/LinkedRowSelector.svelte +++ b/packages/standard-components/src/LinkedRowSelector.svelte @@ -1,6 +1,6 @@ diff --git a/packages/standard-components/src/Nav.svelte b/packages/standard-components/src/Nav.svelte deleted file mode 100644 index 7619a440b4..0000000000 --- a/packages/standard-components/src/Nav.svelte +++ /dev/null @@ -1,116 +0,0 @@ - - -
- {#if !hideNavBar} - - {/if} - {#each _children as navItem, index} -
- {/each} -
- - diff --git a/packages/standard-components/src/Navigation.svelte b/packages/standard-components/src/Navigation.svelte index dda860414d..97d4ca0b8c 100644 --- a/packages/standard-components/src/Navigation.svelte +++ b/packages/standard-components/src/Navigation.svelte @@ -1,4 +1,6 @@ diff --git a/packages/standard-components/src/NewRow.svelte b/packages/standard-components/src/NewRow.svelte index e7446f9bdc..dd43a3ee47 100644 --- a/packages/standard-components/src/NewRow.svelte +++ b/packages/standard-components/src/NewRow.svelte @@ -1,5 +1,6 @@ - - - - - {#each columns as col} - - {/each} - - - - {#if data} - {#each data as row} - - {#each columns as col, index} - - {/each} - - {/each} - {/if} - -
{col.title}
{cellValue(index, row)}
- - diff --git a/packages/standard-components/src/TableBody.svelte b/packages/standard-components/src/TableBody.svelte deleted file mode 100644 index ca92ac255c..0000000000 --- a/packages/standard-components/src/TableBody.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/packages/standard-components/src/TableHead.svelte b/packages/standard-components/src/TableHead.svelte deleted file mode 100644 index ae739aa306..0000000000 --- a/packages/standard-components/src/TableHead.svelte +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/packages/standard-components/src/attachments/Dropzone.svelte b/packages/standard-components/src/attachments/Dropzone.svelte index 62bb57b0f8..f30860accf 100644 --- a/packages/standard-components/src/attachments/Dropzone.svelte +++ b/packages/standard-components/src/attachments/Dropzone.svelte @@ -1,5 +1,6 @@ diff --git a/packages/standard-components/src/charts/BarChart.svelte b/packages/standard-components/src/charts/BarChart.svelte index 9fdc649dfa..09d2e04908 100644 --- a/packages/standard-components/src/charts/BarChart.svelte +++ b/packages/standard-components/src/charts/BarChart.svelte @@ -1,16 +1,9 @@ diff --git a/packages/standard-components/src/grid/Relationship/tableCache.js b/packages/standard-components/src/grid/Relationship/tableCache.js deleted file mode 100644 index 850bdd212a..0000000000 --- a/packages/standard-components/src/grid/Relationship/tableCache.js +++ /dev/null @@ -1,20 +0,0 @@ -import api from "../../api" - -let cache = {} - -async function fetchTable(id) { - const FETCH_TABLE_URL = `/api/tables/${id}` - const response = await api.get(FETCH_TABLE_URL) - return await response.json() -} - -export async function getTable(tableId) { - if (!tableId) { - return null - } - if (!cache[tableId]) { - cache[tableId] = fetchTable(tableId) - cache[tableId] = await cache[tableId] - } - return await cache[tableId] -} diff --git a/packages/standard-components/src/index.js b/packages/standard-components/src/index.js index 30748aa2bf..0bd46f12d9 100644 --- a/packages/standard-components/src/index.js +++ b/packages/standard-components/src/index.js @@ -13,9 +13,7 @@ export { default as Navigation } from "./Navigation.svelte" export { default as datagrid } from "./grid/Component.svelte" export { default as dataform } from "./DataForm.svelte" export { default as dataformwide } from "./DataFormWide.svelte" -export { default as datalist } from "./DataList.svelte" export { default as list } from "./List.svelte" -export { default as datasearch } from "./DataSearch.svelte" export { default as embed } from "./Embed.svelte" export { default as stackedlist } from "./StackedList.svelte" export { default as card } from "./Card.svelte" From 66ef0b9d3d57f116e3c897b56a9238d502f6fcd3 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 12 Nov 2020 12:27:53 +0000 Subject: [PATCH 07/48] Fix log out not working --- packages/standard-components/src/Navigation.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/standard-components/src/Navigation.svelte b/packages/standard-components/src/Navigation.svelte index 97d4ca0b8c..20a9864f5e 100644 --- a/packages/standard-components/src/Navigation.svelte +++ b/packages/standard-components/src/Navigation.svelte @@ -20,7 +20,7 @@ } const logOut = () => { - authStore.logOut() + authStore.actions.logOut() location.reload() } From 3a981ac2567a00cb4f7a92f63ce2f05ee0d6651c Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 13 Nov 2020 15:42:32 +0000 Subject: [PATCH 08/48] Add initial new routing and svelte client app generation --- packages/client/babel.config.js | 13 - packages/client/package.json | 43 +- packages/client/rollup.config.js | 20 + .../client/src/components/ClientApp.svelte | 25 + .../client/src/components/Component.svelte | 31 + packages/client/src/components/Router.svelte | 30 + packages/client/src/components/Screen.svelte | 20 + packages/client/src/index.js | 62 +- packages/client/src/{ => old}/createApp.js | 15 +- packages/client/src/old/index.js.old | 59 ++ packages/client/src/render/screenRouter.js | 4 +- packages/client/src/state/eventHandlers.js | 2 +- packages/client/src/store/components.js | 42 + packages/client/src/store/index.js | 3 + packages/client/src/utils.js | 27 + packages/client/tests/binding.spec.js | 209 ----- packages/client/tests/initialiseApp.spec.js | 172 ---- packages/client/tests/screenRouting.spec.js | 174 ---- packages/client/tests/testAppDef.js | 241 ----- .../tests/testComponents/container.svelte | 16 - packages/component-sdk/package.json | 24 +- packages/component-sdk/rollup.config.js | 33 + packages/component-sdk/src/api/api.js | 2 +- packages/component-sdk/src/api/rows.js | 2 +- packages/component-sdk/src/context/index.js | 1 + packages/component-sdk/src/index.js | 3 + packages/component-sdk/src/store/auth.js | 2 +- packages/component-sdk/src/store/index.js | 4 + packages/component-sdk/src/store/routes.js | 21 + packages/component-sdk/src/store/screens.js | 25 + packages/component-sdk/src/utils/getAppId.js | 2 +- packages/component-sdk/yarn.lock | 879 ++++++++++++++++++ packages/standard-components/package.json | 1 + packages/standard-components/rollup.config.js | 15 +- .../standard-components/src/Container.svelte | 66 +- packages/standard-components/src/Image.svelte | 6 +- packages/standard-components/src/Link.svelte | 18 +- .../src/LinkedRowSelector.svelte | 2 +- packages/standard-components/src/List.svelte | 2 +- packages/standard-components/src/Login.svelte | 2 +- .../standard-components/src/Navigation.svelte | 23 +- .../standard-components/src/NewRow.svelte | 2 +- .../standard-components/src/RowDetail.svelte | 2 +- .../src/attachments/Dropzone.svelte | 2 +- .../src/charts/BarChart.svelte | 5 +- .../src/charts/CandleStickChart.svelte | 5 +- .../src/charts/LineChart.svelte | 5 +- .../src/charts/PieChart.svelte | 5 +- .../src/grid/Component.svelte | 2 +- .../Relationship/RelationshipDisplay.svelte | 2 +- packages/standard-components/src/helpers.js | 16 - .../src/tests/createApp.js | 2 +- 52 files changed, 1359 insertions(+), 1030 deletions(-) delete mode 100644 packages/client/babel.config.js create mode 100644 packages/client/src/components/ClientApp.svelte create mode 100644 packages/client/src/components/Component.svelte create mode 100644 packages/client/src/components/Router.svelte create mode 100644 packages/client/src/components/Screen.svelte rename packages/client/src/{ => old}/createApp.js (84%) create mode 100644 packages/client/src/old/index.js.old create mode 100644 packages/client/src/store/components.js create mode 100644 packages/client/src/store/index.js create mode 100644 packages/client/src/utils.js delete mode 100644 packages/client/tests/binding.spec.js delete mode 100644 packages/client/tests/initialiseApp.spec.js delete mode 100644 packages/client/tests/screenRouting.spec.js delete mode 100644 packages/client/tests/testAppDef.js delete mode 100644 packages/client/tests/testComponents/container.svelte create mode 100644 packages/component-sdk/rollup.config.js create mode 100644 packages/component-sdk/src/context/index.js create mode 100644 packages/component-sdk/src/store/routes.js create mode 100644 packages/component-sdk/src/store/screens.js create mode 100644 packages/component-sdk/yarn.lock diff --git a/packages/client/babel.config.js b/packages/client/babel.config.js deleted file mode 100644 index 493f1edf38..0000000000 --- a/packages/client/babel.config.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = { - presets: ["@babel/preset-env"], - sourceMaps: "inline", - retainLines: true, - plugins: [ - [ - "@babel/plugin-transform-runtime", - { - regenerator: true, - }, - ], - ], -} diff --git a/packages/client/package.json b/packages/client/package.json index 7456bd74b2..d7fea8dd64 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -6,56 +6,25 @@ "module": "dist/budibase-client.esm.mjs", "scripts": { "build": "rollup -c", - "test": "jest", "dev:builder": "rollup -cw" }, - "jest": { - "globals": { - "GLOBALS": { - "client": "web" - } - }, - "testURL": "http://test.com", - "moduleNameMapper": { - "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/internals/mocks/fileMock.js", - "\\.(css|less|sass|scss)$": "identity-obj-proxy" - }, - "moduleFileExtensions": [ - "js", - "svelte" - ], - "moduleDirectories": [ - "node_modules" - ], - "transform": { - "^.+js$": "babel-jest", - "^.+.svelte$": "svelte-jester" - }, - "transformIgnorePatterns": [ - "/node_modules/(?!svelte).+\\.js$" - ] - }, "dependencies": { "deep-equal": "^2.0.1", "mustache": "^4.0.1", - "regexparam": "^1.3.0" + "regexparam": "^1.3.0", + "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@babel/core": "^7.5.5", - "@babel/plugin-transform-runtime": "^7.5.5", - "@babel/preset-env": "^7.5.5", - "@babel/runtime": "^7.5.5", - "babel-jest": "^24.8.0", "fs-extra": "^8.1.0", - "jest": "^24.8.0", "jsdom": "^16.0.1", - "rollup": "^1.12.0", + "rollup": "^2.11.2", + "rollup-plugin-alias": "^2.2.0", "rollup-plugin-commonjs": "^10.0.0", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-terser": "^4.0.4", - "svelte": "3.23.x", + "rollup-plugin-svelte": "^6.1.1", + "svelte": "3.29.0", "svelte-jester": "^1.0.6" }, "gitHead": "e4e053cb6ff9a0ddc7115b44ccaa24b8ec41fb9a" diff --git a/packages/client/rollup.config.js b/packages/client/rollup.config.js index adc3bb6337..c4b2e51a8f 100644 --- a/packages/client/rollup.config.js +++ b/packages/client/rollup.config.js @@ -2,6 +2,12 @@ import resolve from "rollup-plugin-node-resolve" import commonjs from "rollup-plugin-commonjs" import builtins from "rollup-plugin-node-builtins" import nodeglobals from "rollup-plugin-node-globals" +import svelte from "rollup-plugin-svelte" +import alias from "rollup-plugin-alias" +import path from "path" + +const production = !process.env.ROLLUP_WATCH +const projectRootDir = path.resolve(__dirname) export default { input: "src/index.js", @@ -19,6 +25,20 @@ export default { }, ], plugins: [ + alias({ + entries: [ + { + find: "@budibase/component-sdk", + replacement: path.resolve( + projectRootDir, + "../component-sdk/dist/budibase-component-sdk" + ), + }, + ], + }), + svelte({ + dev: !production, + }), resolve({ preferBuiltins: true, browser: true, diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte new file mode 100644 index 0000000000..dbf19e0865 --- /dev/null +++ b/packages/client/src/components/ClientApp.svelte @@ -0,0 +1,25 @@ + + +{#if loaded} + +{/if} diff --git a/packages/client/src/components/Component.svelte b/packages/client/src/components/Component.svelte new file mode 100644 index 0000000000..5b0565eb94 --- /dev/null +++ b/packages/client/src/components/Component.svelte @@ -0,0 +1,31 @@ + + +{#if componentConstructor} +
+ + {#if children && children.length} + {#each children as child} + + {/each} + {/if} + +
+{/if} diff --git a/packages/client/src/components/Router.svelte b/packages/client/src/components/Router.svelte new file mode 100644 index 0000000000..b08dc4d5a4 --- /dev/null +++ b/packages/client/src/components/Router.svelte @@ -0,0 +1,30 @@ + + +{#if routes} + +{/if} diff --git a/packages/client/src/components/Screen.svelte b/packages/client/src/components/Screen.svelte new file mode 100644 index 0000000000..35c4fbfc14 --- /dev/null +++ b/packages/client/src/components/Screen.svelte @@ -0,0 +1,20 @@ + + +{#if screenDefinition} + +{/if} diff --git a/packages/client/src/index.js b/packages/client/src/index.js index 0e803a0f76..68f5d2d701 100644 --- a/packages/client/src/index.js +++ b/packages/client/src/index.js @@ -1,59 +1,11 @@ -import { createApp } from "./createApp" -import { builtins, builtinLibName } from "./render/builtinComponents" -import { getAppId } from "../../component-sdk/src/utils" +import ClientApp from "./components/ClientApp.svelte" -/** - * create a web application from static budibase definition files. - * @param {object} opts - configuration options for budibase client libary - */ -export const loadBudibase = async opts => { - const _window = (opts && opts.window) || window - // const _localStorage = (opts && opts.localStorage) || localStorage - const appId = getAppId(window.document.cookie) - const frontendDefinition = _window["##BUDIBASE_FRONTEND_DEFINITION##"] - - const user = {} - - const componentLibraryModules = (opts && opts.componentLibraries) || {} - - const libraries = frontendDefinition.libraries || [] - - for (let library of libraries) { - // fetch the JavaScript for the component libraries from the server - componentLibraryModules[library] = await import( - `/componentlibrary?library=${encodeURI(library)}&appId=${appId}` - ) - } - - componentLibraryModules[builtinLibName] = builtins(_window) - - const { - initialisePage, - screenStore, - pageStore, - routeTo, - rootNode, - } = createApp({ - componentLibraries: componentLibraryModules, - frontendDefinition, - user, - window: _window, +// Initialise client app +const loadBudibase = () => { + new ClientApp({ + target: window.document.body, }) - - const route = _window.location - ? _window.location.pathname.replace(`${appId}/`, "").replace(appId, "") - : "" - - initialisePage(frontendDefinition.page, _window.document.body, route) - - return { - screenStore, - pageStore, - routeTo, - rootNode, - } } -if (window) { - window.loadBudibase = loadBudibase -} +// Attach to window so the HTML template can call this when it loads +window.loadBudibase = loadBudibase diff --git a/packages/client/src/createApp.js b/packages/client/src/old/createApp.js similarity index 84% rename from packages/client/src/createApp.js rename to packages/client/src/old/createApp.js index 649cff1f4f..51ff3011c5 100644 --- a/packages/client/src/createApp.js +++ b/packages/client/src/old/createApp.js @@ -1,8 +1,8 @@ -import { attachChildren } from "./render/attachChildren" -import { createTreeNode } from "./render/prepareRenderComponent" -import { screenRouter } from "./render/screenRouter" -import { createStateManager } from "./state/stateManager" -import { getAppId } from "../../component-sdk/src/utils" +import { attachChildren } from "../render/attachChildren" +import { createTreeNode } from "../render/prepareRenderComponent" +import { screenRouter } from "../render/screenRouter" +import { createStateManager } from "../state/stateManager" +import { getAppId } from "@budibase/component-sdk" export const createApp = ({ componentLibraries, @@ -37,10 +37,7 @@ export const createApp = ({ onScreenSelected, window, }) - const fallbackPath = window.location.pathname.replace( - getAppId(window.document.cookie), - "" - ) + const fallbackPath = window.location.pathname.replace(getAppId(), "") routeTo(currentUrl || fallbackPath) } diff --git a/packages/client/src/old/index.js.old b/packages/client/src/old/index.js.old new file mode 100644 index 0000000000..5c46c1f6b9 --- /dev/null +++ b/packages/client/src/old/index.js.old @@ -0,0 +1,59 @@ +import { createApp } from "./createApp" +import { builtins, builtinLibName } from "./render/builtinComponents" +import { getAppId } from "@budibase/component-sdk" + +/** + * create a web application from static budibase definition files. + * @param {object} opts - configuration options for budibase client libary + */ +export const loadBudibase = async opts => { + const _window = (opts && opts.window) || window + // const _localStorage = (opts && opts.localStorage) || localStorage + const appId = getAppId(window.document.cookie) + const frontendDefinition = _window["##BUDIBASE_FRONTEND_DEFINITION##"] + + const user = {} + + const componentLibraryModules = (opts && opts.componentLibraries) || {} + + const libraries = frontendDefinition.libraries || [] + + for (let library of libraries) { + // fetch the JavaScript for the component libraries from the server + componentLibraryModules[library] = await import( + `/componentlibrary?library=${encodeURI(library)}&appId=${appId}` + ) + } + + componentLibraryModules[builtinLibName] = builtins(_window) + + const { + initialisePage, + screenStore, + pageStore, + routeTo, + rootNode, + } = createApp({ + componentLibraries: componentLibraryModules, + frontendDefinition, + user, + window: _window, + }) + + const route = _window.location + ? _window.location.pathname.replace(`${appId}/`, "").replace(appId, "") + : "" + + initialisePage(frontendDefinition.page, _window.document.body, route) + + return { + screenStore, + pageStore, + routeTo, + rootNode, + } +} + +if (window) { + window.loadBudibase = loadBudibase +} diff --git a/packages/client/src/render/screenRouter.js b/packages/client/src/render/screenRouter.js index 4d5579040f..0ae02841bf 100644 --- a/packages/client/src/render/screenRouter.js +++ b/packages/client/src/render/screenRouter.js @@ -1,6 +1,6 @@ import regexparam from "regexparam" import appStore from "../state/store" -import { getAppId } from "../../../component-sdk/src/utils" +import { getAppId } from "@budibase/component-sdk" export const screenRouter = ({ screens, onScreenSelected, window }) => { function sanitize(url) { @@ -27,7 +27,7 @@ export const screenRouter = ({ screens, onScreenSelected, window }) => { const makeRootedPath = url => { if (isRunningLocally()) { - const appId = getAppId(window.document.cookie) + const appId = getAppId() if (url) { url = sanitize(url) if (!url.startsWith("/")) { diff --git a/packages/client/src/state/eventHandlers.js b/packages/client/src/state/eventHandlers.js index a8f73a8a09..39aecd388c 100644 --- a/packages/client/src/state/eventHandlers.js +++ b/packages/client/src/state/eventHandlers.js @@ -1,5 +1,5 @@ import renderTemplateString from "./renderTemplateString" -import { updateRow, saveRow, deleteRow } from "../../../component-sdk" +import { updateRow, saveRow, deleteRow } from "@budibase/component-sdk" export const EVENT_TYPE_MEMBER_NAME = "##eventHandlerType" diff --git a/packages/client/src/store/components.js b/packages/client/src/store/components.js new file mode 100644 index 0000000000..eed1c87325 --- /dev/null +++ b/packages/client/src/store/components.js @@ -0,0 +1,42 @@ +import { writable, get } from "svelte/store" +import { getAppId } from "@budibase/component-sdk" +import Router from "../components/Router.svelte" + +const initialState = {} + +export const createComponentStore = () => { + const store = writable(initialState) + + /** + * Loads the component library from the server + */ + const loadComponentLibrary = async () => { + const appId = getAppId() + const library = await import( + `/componentlibrary?library=@budibase/standard-components&appId=${appId}` + ) + store.set(library) + } + + /** + * Fetches a Svelte component from the standard-components library. + */ + const getComponent = componentName => { + if (!componentName) { + return null + } + const split = componentName.split("/") + const strippedName = split[split.length - 1] + + // Edge case for screen slot + if (strippedName === "screenslot") { + return Router + } + return get(store)[strippedName] + } + + // Attach actions to the store + store.actions = { getComponent, loadComponentLibrary } + + return store +} diff --git a/packages/client/src/store/index.js b/packages/client/src/store/index.js new file mode 100644 index 0000000000..ea0a3b5709 --- /dev/null +++ b/packages/client/src/store/index.js @@ -0,0 +1,3 @@ +import { createComponentStore } from "./components" + +export const componentStore = createComponentStore() diff --git a/packages/client/src/utils.js b/packages/client/src/utils.js new file mode 100644 index 0000000000..6df8fd6d40 --- /dev/null +++ b/packages/client/src/utils.js @@ -0,0 +1,27 @@ +/** + * Builds a style string from a style object. + */ +export const buildStyle = styles => { + let str = "" + Object.entries(styles).forEach(([style, value]) => { + if (style && value) { + str += `${style}: ${value}; ` + } + }) + return str +} + +/** + * Extracts all valid props from a component definition that should be passed to + * its actual component instance. + * Valid props do not begin with an underscore. + */ +export const getValidProps = component => { + let props = {} + Object.entries(component) + .filter(([name]) => !name.startsWith("_")) + .forEach(([key, value]) => { + props[key] = value + }) + return props +} diff --git a/packages/client/tests/binding.spec.js b/packages/client/tests/binding.spec.js deleted file mode 100644 index 58cd2d6556..0000000000 --- a/packages/client/tests/binding.spec.js +++ /dev/null @@ -1,209 +0,0 @@ -import { load, makePage, makeScreen } from "./testAppDef" - -describe("binding", () => { - - - it("should bind to data in context", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/list", - data: dataArray, - _children: [ - { - _component: "testlib/h1", - text: "{{data.name}}", - } - ], - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children[0].children.length).toBe(2) - expect(screenRoot.children[0].children[0].innerText).toBe(dataArray[0].name) - expect(screenRoot.children[0].children[1].innerText).toBe(dataArray[1].name) - }) - - it("should bind to input in root", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/div", - _children: [ - { - _component: "testlib/h1", - text: "{{inputid.value}}", - }, - { - _id: "inputid", - _component: "testlib/input", - value: "hello" - } - ], - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children[0].children.length).toBe(2) - expect(screenRoot.children[0].children[0].innerText).toBe("hello") - - // change value of input - const input = dom.window.document.getElementsByClassName("input-inputid")[0] - - changeInputValue(dom, input, "new value") - expect(screenRoot.children[0].children[0].innerText).toBe("new value") - - }) - - it("should bind to input in context", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/list", - data: dataArray, - _children: [ - { - _component: "testlib/h1", - text: "{{inputid.value}}", - }, - { - _id: "inputid", - _component: "testlib/input", - value: "hello" - } - ], - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - expect(screenRoot.children[0].children.length).toBe(4) - - const firstHeader = screenRoot.children[0].children[0] - const firstInput = screenRoot.children[0].children[1] - const secondHeader = screenRoot.children[0].children[2] - const secondInput = screenRoot.children[0].children[3] - - expect(firstHeader.innerText).toBe("hello") - expect(secondHeader.innerText).toBe("hello") - - changeInputValue(dom, firstInput, "first input value") - expect(firstHeader.innerText).toBe("first input value") - - changeInputValue(dom, secondInput, "second input value") - expect(secondHeader.innerText).toBe("second input value") - - }) - - it("should bind contextual component, to input in root context", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/div", - _children: [ - { - _id: "inputid", - _component: "testlib/input", - value: "hello" - }, - { - _component: "testlib/list", - data: dataArray, - _children: [ - { - _component: "testlib/h1", - text: "{{parent.inputid.value}}", - }, - ], - } - ] - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - expect(screenRoot.children[0].children.length).toBe(2) - - const input = screenRoot.children[0].children[0] - - const firstHeader = screenRoot.children[0].children[1].children[0] - const secondHeader = screenRoot.children[0].children[1].children[0] - - expect(firstHeader.innerText).toBe("hello") - expect(secondHeader.innerText).toBe("hello") - - changeInputValue(dom, input, "new input value") - expect(firstHeader.innerText).toBe("new input value") - expect(secondHeader.innerText).toBe("new input value") - - }) - - const changeInputValue = (dom, input, newValue) => { - var event = new dom.window.Event("change") - input.value = newValue - input.dispatchEvent(event) - } - - const dataArray = [ - { - name: "katherine", - age: 30, - }, - { - name: "steve", - age: 41, - }, - ] -}) diff --git a/packages/client/tests/initialiseApp.spec.js b/packages/client/tests/initialiseApp.spec.js deleted file mode 100644 index 4601bc94c4..0000000000 --- a/packages/client/tests/initialiseApp.spec.js +++ /dev/null @@ -1,172 +0,0 @@ -import { load, makePage, makeScreen } from "./testAppDef" - -describe("initialiseApp", () => { - it("should populate simple div with initial props", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - className: "my-test-class", - }) - ) - - expect(dom.window.document.body.children.length).toBe(1) - const child = dom.window.document.body.children[0] - expect(child.className.includes("my-test-class")).toBeTruthy() - }) - - it("should populate child component with props", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "testlib/h1", - text: "header one", - }, - { - _component: "testlib/h1", - text: "header two", - }, - ], - }) - ) - - const rootDiv = dom.window.document.body.children[0] - - expect(rootDiv.children.length).toBe(2) - expect(rootDiv.children[0].tagName).toBe("H1") - expect(rootDiv.children[0].innerText).toBe("header one") - expect(rootDiv.children[1].tagName).toBe("H1") - expect(rootDiv.children[1].innerText).toBe("header two") - }) - - it("should append children when told to do so", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "testlib/h1", - text: "header one", - }, - { - _component: "testlib/h1", - text: "header two", - }, - ], - append: true, - }) - ) - - const rootDiv = dom.window.document.body.children[0] - - expect(rootDiv.children.length).toBe(3) - expect(rootDiv.children[0].tagName).toBe("DIV") - expect(rootDiv.children[0].className).toBe("default-child") - expect(rootDiv.children[1].tagName).toBe("H1") - expect(rootDiv.children[1].innerText).toBe("header one") - expect(rootDiv.children[2].tagName).toBe("H1") - expect(rootDiv.children[2].innerText).toBe("header two") - }) - - it("should populate page with correct screen", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/div", - className: "screen-class", - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - - expect(rootDiv.children.length).toBe(1) - expect(rootDiv.children[0].children.length).toBe(1) - expect( - rootDiv.children[0].children[0].className.includes("screen-class") - ).toBeTruthy() - }) - - it("should populate screen with children", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/div", - className: "screen-class", - _children: [ - { - _component: "testlib/h1", - text: "header one", - }, - { - _component: "testlib/h1", - text: "header two", - }, - ], - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children.length).toBe(1) - expect(screenRoot.children[0].children.length).toBe(2) - expect(screenRoot.children[0].children[0].innerText).toBe("header one") - expect(screenRoot.children[0].children[1].innerText).toBe("header two") - }) - - it("should repeat elements that pass an array of contexts", async () => { - const { dom } = await load( - makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - [ - makeScreen("/", { - _component: "testlib/list", - data: [1,2,3,4], - _children: [ - { - _component: "testlib/h1", - text: "header", - } - ], - }), - ] - ) - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children[0].children.length).toBe(4) - expect(screenRoot.children[0].children[0].innerText).toBe("header") - }) -}) diff --git a/packages/client/tests/screenRouting.spec.js b/packages/client/tests/screenRouting.spec.js deleted file mode 100644 index 32419c00e0..0000000000 --- a/packages/client/tests/screenRouting.spec.js +++ /dev/null @@ -1,174 +0,0 @@ -import { load, makePage, makeScreen, walkComponentTree } from "./testAppDef" -import { isScreenSlot } from "../src/render/builtinComponents" -jest.mock("../src/render/getAppId", () => ({ - getAppId: () => "TEST_APP_ID" -})) - -describe("screenRouting", () => { - it("should load correct screen, for initial URL", async () => { - const { page, screens } = pageWith3Screens() - const { dom } = await load(page, screens, "/screen2") - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children.length).toBe(1) - expect(screenRoot.children[0].children.length).toBe(1) - expect(screenRoot.children[0].children[0].innerText).toBe("screen 2") - }) - - it("should load correct screen, for initial URL, when appRootPath is something", async () => { - const { page, screens } = pageWith3Screens() - const { dom } = await load(page, screens, "/TEST_APP_ID/screen2", "127.0.0.1") - - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children.length).toBe(1) - expect(screenRoot.children[0].children.length).toBe(1) - expect(screenRoot.children[0].children[0].innerText).toBe("screen 2") - }) - - it("should be able to route to the correct screen", async () => { - const { page, screens } = pageWith3Screens() - const { dom, app } = await load(page, screens, "/screen2") - - app.routeTo()("/screen3") - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children.length).toBe(1) - expect(screenRoot.children[0].children.length).toBe(1) - expect(screenRoot.children[0].children[0].innerText).toBe("screen 3") - }) - - it("should be able to route to the correct screen, when appRootPath is something", async () => { - const { page, screens } = pageWith3Screens() - const { dom, app } = await load( - page, - screens, - "/TEST_APP_ID/screen2", - "127.0.0.1" - ) - - app.routeTo()("/screen3") - const rootDiv = dom.window.document.body.children[0] - expect(rootDiv.children.length).toBe(1) - - const screenRoot = rootDiv.children[0] - - expect(screenRoot.children.length).toBe(1) - expect(screenRoot.children[0].children.length).toBe(1) - expect(screenRoot.children[0].children[0].innerText).toBe("screen 3") - }) - - it("should destroy and unsubscribe all components on a screen whe screen is changed", async () => { - const { page, screens } = pageWith3Screens() - const { app } = await load(page, screens, "/screen2") - - const nodes = createTrackerNodes(app) - - app.routeTo()("/screen3") - - expect(nodes.length > 0).toBe(true) - expect( - nodes.some(n => n.isDestroyed === false && isUnderScreenSlot(n.node)) - ).toBe(false) - expect( - nodes.some(n => n.isUnsubscribed === false && isUnderScreenSlot(n.node)) - ).toBe(false) - }) - - it("should not destroy and unsubscribe page and screenslot components when screen is changed", async () => { - const { page, screens } = pageWith3Screens() - const { app } = await load(page, screens, "/screen2") - - const nodes = createTrackerNodes(app) - - app.routeTo()("/screen3") - - expect(nodes.length > 0).toBe(true) - expect( - nodes.some(n => n.isDestroyed === true && !isUnderScreenSlot(n.node)) - ).toBe(false) - }) -}) - -const createTrackerNodes = app => { - const nodes = [] - walkComponentTree(app.rootNode(), n => { - if (!n.component) return - const tracker = { node: n, isDestroyed: false, isUnsubscribed: false } - const _destroy = n.component.$destroy - n.component.$destroy = () => { - _destroy() - tracker.isDestroyed = true - } - const _unsubscribe = n.unsubscribe - if (!_unsubscribe) { - tracker.isUnsubscribed = undefined - } else { - n.unsubscribe = () => { - _unsubscribe() - tracker.isUnsubscribed = true - } - } - nodes.push(tracker) - }) - return nodes -} - -const isUnderScreenSlot = node => - node.parentNode && - (isScreenSlot(node.parentNode.props._component) || - isUnderScreenSlot(node.parentNode)) - -const pageWith3Screens = () => ({ - page: makePage({ - _component: "testlib/div", - _children: [ - { - _component: "##builtin/screenslot", - text: "header one", - }, - ], - }), - screens: [ - makeScreen("/", { - _component: "testlib/div", - className: "screen-class", - _children: [ - { - _component: "testlib/h1", - text: "screen 1", - }, - ], - }), - makeScreen("/screen2", { - _component: "testlib/div", - className: "screen-class", - _children: [ - { - _component: "testlib/h1", - text: "screen 2", - }, - ], - }), - makeScreen("/screen3", { - _component: "testlib/div", - className: "screen-class", - _children: [ - { - _component: "testlib/h1", - text: "screen 3", - }, - ], - }), - ], -}) diff --git a/packages/client/tests/testAppDef.js b/packages/client/tests/testAppDef.js deleted file mode 100644 index c9a5bb1cc0..0000000000 --- a/packages/client/tests/testAppDef.js +++ /dev/null @@ -1,241 +0,0 @@ -import jsdom, { JSDOM } from "jsdom" -import { loadBudibase } from "../src/index" - -export const APP_ID = "TEST_APP_ID" - -export const load = async (page, screens, url, host = "test.com") => { - screens = screens || [] - url = url || "/" - - const fullUrl = `http://${host}${url}` - const cookieJar = new jsdom.CookieJar() - const cookie = `${btoa("{}")}.${btoa(`{"appId":"${APP_ID}"}`)}.signature` - cookieJar.setCookie( - `budibase:${APP_ID}:local=${cookie};domain=${host};path=/`, - fullUrl, - { - looseMode: false, - }, - () => {} - ) - - const dom = new JSDOM("", { - url: fullUrl, - cookieJar, - }) - - autoAssignIds(page.props) - for (let s of screens) { - autoAssignIds(s.props) - } - setAppDef(dom.window, page, screens) - addWindowGlobals(dom.window, page, screens, { - hierarchy: {}, - actions: [], - triggers: [], - }) - setComponentCodeMeta(page, screens) - const app = await loadBudibase({ - componentLibraries: allLibs(dom.window), - window: dom.window, - localStorage: createLocalStorage(), - }) - return { dom, app } -} - -const addWindowGlobals = (window, page, screens) => { - window["##BUDIBASE_FRONTEND_DEFINITION##"] = { - page, - screens, - } -} - -export const makePage = props => ({ props }) -export const makeScreen = (route, props) => ({ props, route }) - -export const timeout = ms => new Promise(resolve => setTimeout(resolve, ms)) - -export const walkComponentTree = (node, action) => { - action(node) - - // works for nodes or props - const children = node.children || node._children - - if (children) { - for (let child of children) { - walkComponentTree(child, action) - } - } -} - -// this happens for real by the builder... -// ..this only assigns _ids when missing -const autoAssignIds = (props, count = 0) => { - if (!props._id) { - props._id = `auto_id_${count}` - } - if (props._children) { - for (let child of props._children) { - count += 1 - autoAssignIds(child, count) - } - } -} - -// any component with an id that include "based_on_store" is -// assumed to have code that depends on store value -const setComponentCodeMeta = (page, screens) => { - const setComponentCodeMeta_single = props => { - walkComponentTree(props, c => { - if (c._id.indexOf("based_on_store") >= 0) { - c._codeMeta = { dependsOnStore: true } - } - }) - } - setComponentCodeMeta_single(page.props) - for (let s of screens || []) { - setComponentCodeMeta_single(s.props) - } -} - -const setAppDef = (window, page, screens) => { - window["##BUDIBASE_FRONTEND_DEFINITION##"] = { - componentLibraries: [], - page, - screens, - } -} - -const allLibs = window => ({ - testlib: maketestlib(window), -}) - -const createLocalStorage = () => { - const data = {} - return { - getItem: key => data[key], - setItem: (key, value) => (data[key] = value), - } -} - -const maketestlib = window => ({ - div: function(opts) { - const node = window.document.createElement("DIV") - const defaultChild = window.document.createElement("DIV") - defaultChild.className = "default-child" - node.appendChild(defaultChild) - - let currentProps = { ...opts.props } - let childNodes = [] - - const set = props => { - currentProps = Object.assign(currentProps, props) - node.className = currentProps.className || "" - if (currentProps._children && currentProps._children.length > 0) { - if (currentProps.append) { - for (let c of childNodes) { - node.removeChild(c) - } - const components = currentProps._bb.attachChildren(node, { - hydrate: false, - }) - childNodes = components.map(c => c.component._element) - } else { - currentProps._bb.attachChildren(node) - } - } - } - - this.$destroy = () => opts.target.removeChild(node) - - this.$set = set - this._element = node - set(opts.props) - opts.target.appendChild(node) - }, - - h1: function(opts) { - const node = window.document.createElement("H1") - - let currentProps = { ...opts.props } - - const set = props => { - currentProps = Object.assign(currentProps, props) - if (currentProps.text) { - node.innerText = currentProps.text - } - } - - this.$destroy = () => opts.target.removeChild(node) - - this.$set = set - this._element = node - set(opts.props) - opts.target.appendChild(node) - }, - - button: function(opts) { - const node = window.document.createElement("BUTTON") - - let currentProps = { ...opts.props } - - const set = props => { - currentProps = Object.assign(currentProps, props) - if (currentProps.onClick) { - node.addEventListener("click", () => { - currentProps._bb.call("onClick") - }) - } - } - - this.$destroy = () => opts.target.removeChild(node) - - this.$set = set - this._element = node - set(opts.props) - opts.target.appendChild(node) - }, - - list: function(opts) { - const node = window.document.createElement("DIV") - - let currentProps = { ...opts.props } - - const set = props => { - currentProps = Object.assign(currentProps, props) - if (currentProps._children && currentProps._children.length > 0) { - currentProps._bb.attachChildren(node, { - context: currentProps.data || {}, - }) - } - } - - this.$destroy = () => opts.target.removeChild(node) - - this.$set = set - this._element = node - set(opts.props) - opts.target.appendChild(node) - }, - - input: function(opts) { - const node = window.document.createElement("INPUT") - let currentProps = { ...opts.props } - - const set = props => { - currentProps = Object.assign(currentProps, props) - opts.props._bb.setBinding("value", props.value) - } - - node.addEventListener("change", e => { - opts.props._bb.setBinding("value", e.target.value) - }) - - this.$destroy = () => opts.target.removeChild(node) - - this.$set = set - this._element = node - set(opts.props) - opts.target.appendChild(node) - }, -}) diff --git a/packages/client/tests/testComponents/container.svelte b/packages/client/tests/testComponents/container.svelte deleted file mode 100644 index a7f48b19e8..0000000000 --- a/packages/client/tests/testComponents/container.svelte +++ /dev/null @@ -1,16 +0,0 @@ - - -
diff --git a/packages/component-sdk/package.json b/packages/component-sdk/package.json index e22cae171a..2087d6e52d 100644 --- a/packages/component-sdk/package.json +++ b/packages/component-sdk/package.json @@ -1,10 +1,26 @@ { - "name": "component-sdk", + "name": "@budibase/component-sdk", "version": "1.0.0", "description": "SDK for developing Budibase components", - "main": "src/index.js", "repository": "https://github.com/Budibase/budibase", - "author": "Andrew Kingston", + "author": "Budibase", "license": "AGPLv3", - "private": false + "private": false, + "main": "dist/budibase-client.js", + "module": "dist/budibase-client.esm.mjs", + "scripts": { + "build": "rollup -c", + "dev:builder": "rollup -cw" + }, + "devDependencies": { + "rollup": "^2.11.2", + "rollup-plugin-commonjs": "^10.0.0", + "rollup-plugin-node-builtins": "^2.1.2", + "rollup-plugin-node-globals": "^1.4.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-svelte": "^6.1.1" + }, + "dependencies": { + "svelte-spa-router": "^3.0.5" + } } diff --git a/packages/component-sdk/rollup.config.js b/packages/component-sdk/rollup.config.js new file mode 100644 index 0000000000..9fa7f66113 --- /dev/null +++ b/packages/component-sdk/rollup.config.js @@ -0,0 +1,33 @@ +import resolve from "rollup-plugin-node-resolve" +import commonjs from "rollup-plugin-commonjs" +import builtins from "rollup-plugin-node-builtins" +import nodeglobals from "rollup-plugin-node-globals" +import svelte from "rollup-plugin-svelte" + +const production = !process.env.ROLLUP_WATCH + +export default { + input: "src/index.js", + output: [ + { + file: "dist/budibase-component-sdk.js", + format: "esm", + sourcemap: true, + }, + ], + plugins: [ + svelte({ + dev: !production, + }), + resolve({ + preferBuiltins: true, + browser: true, + }), + commonjs(), + builtins(), + nodeglobals(), + ], + watch: { + clearScreen: false, + }, +} diff --git a/packages/component-sdk/src/api/api.js b/packages/component-sdk/src/api/api.js index 6cc643872a..12733185a1 100644 --- a/packages/component-sdk/src/api/api.js +++ b/packages/component-sdk/src/api/api.js @@ -36,7 +36,7 @@ const makeApiCall = async ({ method, url, body, json = true }) => { headers: { Accept: "application/json", "Content-Type": "application/json", - "x-budibase-app-id": getAppId(window.document.cookie), + "x-budibase-app-id": getAppId(), }, body: requestBody, credentials: "same-origin", diff --git a/packages/component-sdk/src/api/rows.js b/packages/component-sdk/src/api/rows.js index 60d83bbee0..5875300546 100644 --- a/packages/component-sdk/src/api/rows.js +++ b/packages/component-sdk/src/api/rows.js @@ -8,7 +8,7 @@ export const fetchRow = async ({ tableId, rowId }) => { const row = await api.get({ url: `/api/${tableId}/rows/${rowId}`, }) - return await enrichRows([row], tableId) + return (await enrichRows([row], tableId))[0] } /** diff --git a/packages/component-sdk/src/context/index.js b/packages/component-sdk/src/context/index.js new file mode 100644 index 0000000000..ba5c1047ce --- /dev/null +++ b/packages/component-sdk/src/context/index.js @@ -0,0 +1 @@ +export const RouterContext = "bb-router" diff --git a/packages/component-sdk/src/index.js b/packages/component-sdk/src/index.js index 87b875af48..64af7c9cb5 100644 --- a/packages/component-sdk/src/index.js +++ b/packages/component-sdk/src/index.js @@ -1,2 +1,5 @@ export * from "./api" export * from "./store" +export * as ContextTypes from "./context" +export { getAppId } from "./utils" +export { link } from "svelte-spa-router" diff --git a/packages/component-sdk/src/store/auth.js b/packages/component-sdk/src/store/auth.js index 4d69530efa..287dab767d 100644 --- a/packages/component-sdk/src/store/auth.js +++ b/packages/component-sdk/src/store/auth.js @@ -25,7 +25,7 @@ export const createAuthStore = () => { store.set(initialState) // Expire any cookies - const appId = getAppId(window.document.cookie) + const appId = getAppId() if (appId) { for (let environment of ["local", "cloud"]) { window.document.cookie = `budibase:${appId}:${environment}=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;` diff --git a/packages/component-sdk/src/store/index.js b/packages/component-sdk/src/store/index.js index 10cab9dfdc..91baa595b3 100644 --- a/packages/component-sdk/src/store/index.js +++ b/packages/component-sdk/src/store/index.js @@ -1,5 +1,9 @@ import { createConfigStore } from "./config" import { createAuthStore } from "./auth" +import { createRouteStore } from "./routes" +import { createScreenStore } from "./screens" export const configStore = createConfigStore() export const authStore = createAuthStore() +export const routeStore = createRouteStore() +export const screenStore = createScreenStore() diff --git a/packages/component-sdk/src/store/routes.js b/packages/component-sdk/src/store/routes.js new file mode 100644 index 0000000000..50eb072938 --- /dev/null +++ b/packages/component-sdk/src/store/routes.js @@ -0,0 +1,21 @@ +import { writable } from "svelte/store" +import { push } from "svelte-spa-router" + +const initialState = [] + +export const createRouteStore = () => { + const store = writable(initialState) + + const fetchRoutes = () => { + const frontendDefinition = window["##BUDIBASE_FRONTEND_DEFINITION##"] + const routes = frontendDefinition.screens.map(screen => ({ + path: screen.route, + screenId: screen._id, + })) + store.set(routes) + } + const navigate = push + store.actions = { fetchRoutes, navigate } + + return store +} diff --git a/packages/component-sdk/src/store/screens.js b/packages/component-sdk/src/store/screens.js new file mode 100644 index 0000000000..c29535d34e --- /dev/null +++ b/packages/component-sdk/src/store/screens.js @@ -0,0 +1,25 @@ +import { writable, derived, get } from "svelte/store" + +const initialState = [] + +export const createScreenStore = () => { + const store = writable(initialState) + const routeLookupMap = derived(store, $screens => { + let map = {} + $screens.forEach(screen => { + map[screen.route] = screen + }) + return map + }) + + const fetchScreens = () => { + const frontendDefinition = window["##BUDIBASE_FRONTEND_DEFINITION##"] + store.set(frontendDefinition.screens) + } + const getScreenByRoute = path => { + return get(routeLookupMap)[path] + } + store.actions = { fetchScreens, getScreenByRoute } + + return store +} diff --git a/packages/component-sdk/src/utils/getAppId.js b/packages/component-sdk/src/utils/getAppId.js index 62d960afe0..355dd55d6b 100644 --- a/packages/component-sdk/src/utils/getAppId.js +++ b/packages/component-sdk/src/utils/getAppId.js @@ -33,7 +33,7 @@ function tryGetFromSubdomain() { return confirmAppId(appId) } -export const getAppId = cookies => { +export const getAppId = (cookies = window.document.cookie) => { const functions = [tryGetFromSubdomain, tryGetFromPath, tryGetFromCookie] // try getting the app Id in order let appId diff --git a/packages/component-sdk/yarn.lock b/packages/component-sdk/yarn.lock new file mode 100644 index 0000000000..5266d3e283 --- /dev/null +++ b/packages/component-sdk/yarn.lock @@ -0,0 +1,879 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/estree@*": + version "0.0.45" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.45.tgz#e9387572998e5ecdac221950dab3e8c3b16af884" + integrity sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g== + +"@types/node@*": + version "14.14.7" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.7.tgz#8ea1e8f8eae2430cf440564b98c6dfce1ec5945d" + integrity sha512-Zw1vhUSQZYw+7u5dAwNbIA9TuTotpzY/OF7sJM9FqPOF3SPjKnxrjoTktXDZgUjybf4cWVBP7O8wvKdSaGHweg== + +"@types/resolve@0.0.8": + version "0.0.8" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" + integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== + dependencies: + "@types/node" "*" + +abstract-leveldown@~0.12.0, abstract-leveldown@~0.12.1: + version "0.12.4" + resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-0.12.4.tgz#29e18e632e60e4e221d5810247852a63d7b2e410" + integrity sha1-KeGOYy5g5OIh1YECR4UqY9ey5BA= + dependencies: + xtend "~3.0.0" + +acorn@^5.7.3: + version "5.7.4" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.4.tgz#3e8d8a9947d0599a1796d10225d7432f4a4acf5e" + integrity sha512-1D++VG7BhrtvQpNbBzovKNc1FLGGEE/oGe7b9xJm/RFHMBeUaUGpluV9RLjZa47YFdPcDAenEYuq9pQPcMdLJg== + +asn1.js@^5.2.0: + version "5.4.1" + resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" + integrity sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA== + dependencies: + bn.js "^4.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + safer-buffer "^2.1.0" + +bl@~0.8.1: + version "0.8.2" + resolved "https://registry.yarnpkg.com/bl/-/bl-0.8.2.tgz#c9b6bca08d1bc2ea00fc8afb4f1a5fd1e1c66e4e" + integrity sha1-yba8oI0bwuoA/Ir7Txpf0eHGbk4= + dependencies: + readable-stream "~1.0.26" + +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.4.0: + version "4.11.9" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.9.tgz#26d556829458f9d1e81fc48952493d0ba3507828" + integrity sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw== + +bn.js@^5.0.0, bn.js@^5.1.1: + version "5.1.3" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.3.tgz#beca005408f642ebebea80b042b4d18d2ac0ee6b" + integrity sha512-GkTiFpjFtUzU9CbMeJ5iazkCzGL3jrhzerzZIuqLABjbwRaFt33I9tUdSNryIptM+RxDet6OKm2WnLXzW51KsQ== + +brorand@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" + integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= + +browserify-aes@^1.0.0, browserify-aes@^1.0.4: + version "1.2.0" + resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" + integrity sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA== + dependencies: + buffer-xor "^1.0.3" + cipher-base "^1.0.0" + create-hash "^1.1.0" + evp_bytestokey "^1.0.3" + inherits "^2.0.1" + safe-buffer "^5.0.1" + +browserify-cipher@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/browserify-cipher/-/browserify-cipher-1.0.1.tgz#8d6474c1b870bfdabcd3bcfcc1934a10e94f15f0" + integrity sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w== + dependencies: + browserify-aes "^1.0.4" + browserify-des "^1.0.0" + evp_bytestokey "^1.0.0" + +browserify-des@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/browserify-des/-/browserify-des-1.0.2.tgz#3af4f1f59839403572f1c66204375f7a7f703e9c" + integrity sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A== + dependencies: + cipher-base "^1.0.1" + des.js "^1.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +browserify-fs@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/browserify-fs/-/browserify-fs-1.0.0.tgz#f075aa8a729d4d1716d066620e386fcc1311a96f" + integrity sha1-8HWqinKdTRcW0GZiDjhvzBMRqW8= + dependencies: + level-filesystem "^1.0.1" + level-js "^2.1.3" + levelup "^0.18.2" + +browserify-rsa@^4.0.0, browserify-rsa@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/browserify-rsa/-/browserify-rsa-4.1.0.tgz#b2fd06b5b75ae297f7ce2dc651f918f5be158c8d" + integrity sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog== + dependencies: + bn.js "^5.0.0" + randombytes "^2.0.1" + +browserify-sign@^4.0.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.1.tgz#eaf4add46dd54be3bb3b36c0cf15abbeba7956c3" + integrity sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg== + dependencies: + bn.js "^5.1.1" + browserify-rsa "^4.0.1" + create-hash "^1.2.0" + create-hmac "^1.1.7" + elliptic "^6.5.3" + inherits "^2.0.4" + parse-asn1 "^5.1.5" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +buffer-es6@^4.9.2, buffer-es6@^4.9.3: + version "4.9.3" + resolved "https://registry.yarnpkg.com/buffer-es6/-/buffer-es6-4.9.3.tgz#f26347b82df76fd37e18bcb5288c4970cfd5c404" + integrity sha1-8mNHuC33b9N+GLy1KIxJcM/VxAQ= + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +buffer-xor@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" + integrity sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk= + +builtin-modules@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" + integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== + +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.4.tgz#8760e4ecc272f4c363532f926d874aae2c1397de" + integrity sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +clone@~0.1.9: + version "0.1.19" + resolved "https://registry.yarnpkg.com/clone/-/clone-0.1.19.tgz#613fb68639b26a494ac53253e15b1a6bd88ada85" + integrity sha1-YT+2hjmyaklKxTJT4Vsaa9iK2oU= + +concat-stream@^1.4.4: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" + integrity sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw== + dependencies: + buffer-from "^1.0.0" + inherits "^2.0.3" + readable-stream "^2.2.2" + typedarray "^0.0.6" + +core-util-is@~1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= + +create-ecdh@^4.0.0: + version "4.0.4" + resolved "https://registry.yarnpkg.com/create-ecdh/-/create-ecdh-4.0.4.tgz#d6e7f4bffa66736085a0762fd3a632684dabcc4e" + integrity sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A== + dependencies: + bn.js "^4.1.0" + elliptic "^6.5.3" + +create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" + integrity sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg== + dependencies: + cipher-base "^1.0.1" + inherits "^2.0.1" + md5.js "^1.3.4" + ripemd160 "^2.0.1" + sha.js "^2.4.0" + +create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.7.tgz#69170c78b3ab957147b2b8b04572e47ead2243ff" + integrity sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg== + dependencies: + cipher-base "^1.0.3" + create-hash "^1.1.0" + inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +crypto-browserify@^3.11.0: + version "3.12.0" + resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" + integrity sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg== + dependencies: + browserify-cipher "^1.0.0" + browserify-sign "^4.0.0" + create-ecdh "^4.0.0" + create-hash "^1.1.0" + create-hmac "^1.1.0" + diffie-hellman "^5.0.0" + inherits "^2.0.1" + pbkdf2 "^3.0.3" + public-encrypt "^4.0.0" + randombytes "^2.0.0" + randomfill "^1.0.3" + +deferred-leveldown@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-0.2.0.tgz#2cef1f111e1c57870d8bbb8af2650e587cd2f5b4" + integrity sha1-LO8fER4cV4cNi7uK8mUOWHzS9bQ= + dependencies: + abstract-leveldown "~0.12.1" + +des.js@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843" + integrity sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA== + dependencies: + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + +diffie-hellman@^5.0.0: + version "5.0.3" + resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875" + integrity sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg== + dependencies: + bn.js "^4.1.0" + miller-rabin "^4.0.0" + randombytes "^2.0.0" + +elliptic@^6.5.3: + version "6.5.3" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6" + integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw== + dependencies: + bn.js "^4.4.0" + brorand "^1.0.1" + hash.js "^1.0.0" + hmac-drbg "^1.0.0" + inherits "^2.0.1" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.0" + +errno@^0.1.1, errno@~0.1.1: + version "0.1.7" + resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.7.tgz#4684d71779ad39af177e3f007996f7c67c852618" + integrity sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg== + dependencies: + prr "~1.0.1" + +estree-walker@^0.5.2: + version "0.5.2" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.5.2.tgz#d3850be7529c9580d815600b53126515e146dd39" + integrity sha512-XpCnW/AE10ws/kDAs37cngSkvgIR8aN3G0MS85m7dUpuK2EREo9VJ00uvw6Dg/hXEpfsE1I1TvJOJr+Z+TL+ig== + +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== + +evp_bytestokey@^1.0.0, evp_bytestokey@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" + integrity sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA== + dependencies: + md5.js "^1.3.4" + safe-buffer "^5.1.1" + +foreach@~2.0.1: + version "2.0.5" + resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" + integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= + +fsevents@~2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== + +function-bind@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" + integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== + +fwd-stream@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/fwd-stream/-/fwd-stream-1.0.4.tgz#ed281cabed46feecf921ee32dc4c50b372ac7cfa" + integrity sha1-7Sgcq+1G/uz5Ie4y3ExQs3KsfPo= + dependencies: + readable-stream "~1.0.26-4" + +has@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" + integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + dependencies: + function-bind "^1.1.1" + +hash-base@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-3.1.0.tgz#55c381d9e06e1d2997a883b4a3fddfe7f0d3af33" + integrity sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA== + dependencies: + inherits "^2.0.4" + readable-stream "^3.6.0" + safe-buffer "^5.2.0" + +hash.js@^1.0.0, hash.js@^1.0.3: + version "1.1.7" + resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42" + integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA== + dependencies: + inherits "^2.0.3" + minimalistic-assert "^1.0.1" + +hmac-drbg@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" + integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE= + dependencies: + hash.js "^1.0.3" + minimalistic-assert "^1.0.0" + minimalistic-crypto-utils "^1.0.1" + +idb-wrapper@^1.5.0: + version "1.7.2" + resolved "https://registry.yarnpkg.com/idb-wrapper/-/idb-wrapper-1.7.2.tgz#8251afd5e77fe95568b1c16152eb44b396767ea2" + integrity sha512-zfNREywMuf0NzDo9mVsL0yegjsirJxHpKHvWcyRozIqQy89g0a3U+oBPOCN4cc0oCiOuYgZHimzaW/R46G1Mpg== + +indexof@~0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/indexof/-/indexof-0.0.1.tgz#82dc336d232b9062179d05ab3293a66059fd435d" + integrity sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10= + +inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1, inherits@~2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +is-core-module@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.1.0.tgz#a4cc031d9b1aca63eecbd18a650e13cb4eeab946" + integrity sha512-YcV7BgVMRFRua2FqQzKtTDMz8iCuLEyGKjr70q8Zm1yy2qKcurbFEd79PAdHV77oL3NrAaOVQIbMmiHQCHB7ZA== + dependencies: + has "^1.0.3" + +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= + +is-object@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/is-object/-/is-object-0.1.2.tgz#00efbc08816c33cfc4ac8251d132e10dc65098d7" + integrity sha1-AO+8CIFsM8/ErIJR0TLhDcZQmNc= + +is-reference@^1.1.2: + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== + dependencies: + "@types/estree" "*" + +is@~0.2.6: + version "0.2.7" + resolved "https://registry.yarnpkg.com/is/-/is-0.2.7.tgz#3b34a2c48f359972f35042849193ae7264b63562" + integrity sha1-OzSixI81mXLzUEKEkZOucmS2NWI= + +isarray@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" + integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8= + +isarray@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= + +isbuffer@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/isbuffer/-/isbuffer-0.0.0.tgz#38c146d9df528b8bf9b0701c3d43cf12df3fc39b" + integrity sha1-OMFG2d9Si4v5sHAcPUPPEt8/w5s= + +level-blobs@^0.1.7: + version "0.1.7" + resolved "https://registry.yarnpkg.com/level-blobs/-/level-blobs-0.1.7.tgz#9ab9b97bb99f1edbf9f78a3433e21ed56386bdaf" + integrity sha1-mrm5e7mfHtv594o0M+Ie1WOGva8= + dependencies: + level-peek "1.0.6" + once "^1.3.0" + readable-stream "^1.0.26-4" + +level-filesystem@^1.0.1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/level-filesystem/-/level-filesystem-1.2.0.tgz#a00aca9919c4a4dfafdca6a8108d225aadff63b3" + integrity sha1-oArKmRnEpN+v3KaoEI0iWq3/Y7M= + dependencies: + concat-stream "^1.4.4" + errno "^0.1.1" + fwd-stream "^1.0.4" + level-blobs "^0.1.7" + level-peek "^1.0.6" + level-sublevel "^5.2.0" + octal "^1.0.0" + once "^1.3.0" + xtend "^2.2.0" + +level-fix-range@2.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/level-fix-range/-/level-fix-range-2.0.0.tgz#c417d62159442151a19d9a2367868f1724c2d548" + integrity sha1-xBfWIVlEIVGhnZojZ4aPFyTC1Ug= + dependencies: + clone "~0.1.9" + +level-fix-range@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/level-fix-range/-/level-fix-range-1.0.2.tgz#bf15b915ae36d8470c821e883ddf79cd16420828" + integrity sha1-vxW5Fa422EcMgh6IPd95zRZCCCg= + +"level-hooks@>=4.4.0 <5": + version "4.5.0" + resolved "https://registry.yarnpkg.com/level-hooks/-/level-hooks-4.5.0.tgz#1b9ae61922930f3305d1a61fc4d83c8102c0dd93" + integrity sha1-G5rmGSKTDzMF0aYfxNg8gQLA3ZM= + dependencies: + string-range "~1.2" + +level-js@^2.1.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/level-js/-/level-js-2.2.4.tgz#bc055f4180635d4489b561c9486fa370e8c11697" + integrity sha1-vAVfQYBjXUSJtWHJSG+jcOjBFpc= + dependencies: + abstract-leveldown "~0.12.0" + idb-wrapper "^1.5.0" + isbuffer "~0.0.0" + ltgt "^2.1.2" + typedarray-to-buffer "~1.0.0" + xtend "~2.1.2" + +level-peek@1.0.6, level-peek@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/level-peek/-/level-peek-1.0.6.tgz#bec51c72a82ee464d336434c7c876c3fcbcce77f" + integrity sha1-vsUccqgu5GTTNkNMfIdsP8vM538= + dependencies: + level-fix-range "~1.0.2" + +level-sublevel@^5.2.0: + version "5.2.3" + resolved "https://registry.yarnpkg.com/level-sublevel/-/level-sublevel-5.2.3.tgz#744c12c72d2e72be78dde3b9b5cd84d62191413a" + integrity sha1-dEwSxy0ucr543eO5tc2E1iGRQTo= + dependencies: + level-fix-range "2.0" + level-hooks ">=4.4.0 <5" + string-range "~1.2.1" + xtend "~2.0.4" + +levelup@^0.18.2: + version "0.18.6" + resolved "https://registry.yarnpkg.com/levelup/-/levelup-0.18.6.tgz#e6a01cb089616c8ecc0291c2a9bd3f0c44e3e5eb" + integrity sha1-5qAcsIlhbI7MApHCqb0/DETj5es= + dependencies: + bl "~0.8.1" + deferred-leveldown "~0.2.0" + errno "~0.1.1" + prr "~0.0.0" + readable-stream "~1.0.26" + semver "~2.3.1" + xtend "~3.0.0" + +ltgt@^2.1.2: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" + integrity sha1-81ypHEk/e3PaDgdJUwTxezH4fuU= + +magic-string@^0.22.5: + version "0.22.5" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" + integrity sha512-oreip9rJZkzvA8Qzk9HFs8fZGF/u7H/gtrE8EN6RjKJ9kh2HlC+yQ2QezifqTZfGyiuAV0dRv5a+y/8gBb1m9w== + dependencies: + vlq "^0.2.2" + +magic-string@^0.25.2: + version "0.25.7" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.25.7.tgz#3f497d6fd34c669c6798dcb821f2ef31f5445051" + integrity sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA== + dependencies: + sourcemap-codec "^1.4.4" + +md5.js@^1.3.4: + version "1.3.5" + resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" + integrity sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + safe-buffer "^5.1.2" + +miller-rabin@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" + integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== + dependencies: + bn.js "^4.0.0" + brorand "^1.0.1" + +minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" + integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A== + +minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" + integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= + +object-keys@~0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.2.0.tgz#cddec02998b091be42bf1035ae32e49f1cb6ea67" + integrity sha1-zd7AKZiwkb5CvxA1rjLknxy26mc= + dependencies: + foreach "~2.0.1" + indexof "~0.0.1" + is "~0.2.6" + +object-keys@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-0.4.0.tgz#28a6aae7428dd2c3a92f3d95f21335dd204e0336" + integrity sha1-KKaq50KN0sOpLz2V8hM13SBOAzY= + +octal@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/octal/-/octal-1.0.0.tgz#63e7162a68efbeb9e213588d58e989d1e5c4530b" + integrity sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws= + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +parse-asn1@^5.0.0, parse-asn1@^5.1.5: + version "5.1.6" + resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.6.tgz#385080a3ec13cb62a62d39409cb3e88844cdaed4" + integrity sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw== + dependencies: + asn1.js "^5.2.0" + browserify-aes "^1.0.0" + evp_bytestokey "^1.0.0" + pbkdf2 "^3.0.3" + safe-buffer "^5.1.1" + +path-parse@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" + integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== + +pbkdf2@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.1.tgz#cb8724b0fada984596856d1a6ebafd3584654b94" + integrity sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg== + dependencies: + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" + +process-es6@^0.11.2, process-es6@^0.11.6: + version "0.11.6" + resolved "https://registry.yarnpkg.com/process-es6/-/process-es6-0.11.6.tgz#c6bb389f9a951f82bd4eb169600105bd2ff9c778" + integrity sha1-xrs4n5qVH4K9TrFpYAEFvS/5x3g= + +process-nextick-args@~2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== + +prr@~0.0.0: + version "0.0.0" + resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" + integrity sha1-GoS4WQgyVQFBGFPQCB7j+obikmo= + +prr@~1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" + integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= + +public-encrypt@^4.0.0: + version "4.0.3" + resolved "https://registry.yarnpkg.com/public-encrypt/-/public-encrypt-4.0.3.tgz#4fcc9d77a07e48ba7527e7cbe0de33d0701331e0" + integrity sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q== + dependencies: + bn.js "^4.1.0" + browserify-rsa "^4.0.0" + create-hash "^1.1.0" + parse-asn1 "^5.0.0" + randombytes "^2.0.1" + safe-buffer "^5.1.2" + +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: + version "2.1.0" + resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" + integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== + dependencies: + safe-buffer "^5.1.0" + +randomfill@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/randomfill/-/randomfill-1.0.4.tgz#c92196fc86ab42be983f1bf31778224931d61458" + integrity sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw== + dependencies: + randombytes "^2.0.5" + safe-buffer "^5.1.0" + +readable-stream@^1.0.26-4: + version "1.1.14" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.1.14.tgz#7cf4c54ef648e3813084c636dd2079e166c081d9" + integrity sha1-fPTFTvZI44EwhMY23SB54WbAgdk= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +readable-stream@^2.2.2: + version "2.3.7" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@~1.0.26, readable-stream@~1.0.26-4: + version "1.0.34" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c" + integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw= + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.1" + isarray "0.0.1" + string_decoder "~0.10.x" + +regexparam@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/regexparam/-/regexparam-1.3.0.tgz#2fe42c93e32a40eff6235d635e0ffa344b92965f" + integrity sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g== + +require-relative@^0.8.7: + version "0.8.7" + resolved "https://registry.yarnpkg.com/require-relative/-/require-relative-0.8.7.tgz#7999539fc9e047a37928fa196f8e1563dabd36de" + integrity sha1-eZlTn8ngR6N5KPoZb44VY9q9Nt4= + +resolve@^1.11.0, resolve@^1.11.1: + version "1.19.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.19.0.tgz#1af5bf630409734a067cae29318aac7fa29a267c" + integrity sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg== + dependencies: + is-core-module "^2.1.0" + path-parse "^1.0.6" + +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" + integrity sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA== + dependencies: + hash-base "^3.0.0" + inherits "^2.0.1" + +rollup-plugin-commonjs@^10.0.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb" + integrity sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q== + dependencies: + estree-walker "^0.6.1" + is-reference "^1.1.2" + magic-string "^0.25.2" + resolve "^1.11.0" + rollup-pluginutils "^2.8.1" + +rollup-plugin-node-builtins@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-builtins/-/rollup-plugin-node-builtins-2.1.2.tgz#24a1fed4a43257b6b64371d8abc6ce1ab14597e9" + integrity sha1-JKH+1KQyV7a2Q3HYq8bOGrFFl+k= + dependencies: + browserify-fs "^1.0.0" + buffer-es6 "^4.9.2" + crypto-browserify "^3.11.0" + process-es6 "^0.11.2" + +rollup-plugin-node-globals@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-globals/-/rollup-plugin-node-globals-1.4.0.tgz#5e1f24a9bb97c0ef51249f625e16c7e61b7c020b" + integrity sha512-xRkB+W/m1KLIzPUmG0ofvR+CPNcvuCuNdjVBVS7ALKSxr3EDhnzNceGkGi1m8MToSli13AzKFYH4ie9w3I5L3g== + dependencies: + acorn "^5.7.3" + buffer-es6 "^4.9.3" + estree-walker "^0.5.2" + magic-string "^0.22.5" + process-es6 "^0.11.6" + rollup-pluginutils "^2.3.1" + +rollup-plugin-node-resolve@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" + integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw== + dependencies: + "@types/resolve" "0.0.8" + builtin-modules "^3.1.0" + is-module "^1.0.0" + resolve "^1.11.1" + rollup-pluginutils "^2.8.1" + +rollup-plugin-svelte@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-svelte/-/rollup-plugin-svelte-6.1.1.tgz#66362cf0500fb7a848283ebcf19d289a60ef0871" + integrity sha512-ijnm0pH1ScrY4uxwaNXBpNVejVzpL2769hIEbAlnqNUWZrffLspu5/k9/l/Wsj3NrEHLQ6wCKGagVJonyfN7ow== + dependencies: + require-relative "^0.8.7" + rollup-pluginutils "^2.8.2" + sourcemap-codec "^1.4.8" + +rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== + dependencies: + estree-walker "^0.6.1" + +rollup@^2.11.2: + version "2.33.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.33.1.tgz#802795164164ee63cd47769d8879c33ec8ae0c40" + integrity sha512-uY4O/IoL9oNW8MMcbA5hcOaz6tZTMIh7qJHx/tzIJm+n1wLoY38BLn6fuy7DhR57oNFLMbDQtDeJoFURt5933w== + optionalDependencies: + fsevents "~2.1.2" + +safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: + version "5.2.1" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" + integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== + +safe-buffer@~5.1.0, safe-buffer@~5.1.1: + version "5.1.2" + resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== + +safer-buffer@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +semver@~2.3.1: + version "2.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" + integrity sha1-uYSPJdbPNjMwc+ye+IVtQvEjPlI= + +sha.js@^2.4.0, sha.js@^2.4.8: + version "2.4.11" + resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.11.tgz#37a5cf0b81ecbc6943de109ba2960d1b26584ae7" + integrity sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ== + dependencies: + inherits "^2.0.1" + safe-buffer "^5.0.1" + +sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8: + version "1.4.8" + resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" + integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== + +string-range@~1.2, string-range@~1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/string-range/-/string-range-1.2.2.tgz#a893ed347e72299bc83befbbf2a692a8d239d5dd" + integrity sha1-qJPtNH5yKZvIO++78qaSqNI51d0= + +string_decoder@^1.1.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" + integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== + dependencies: + safe-buffer "~5.2.0" + +string_decoder@~0.10.x: + version "0.10.31" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" + integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ= + +string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== + dependencies: + safe-buffer "~5.1.0" + +svelte-spa-router@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/svelte-spa-router/-/svelte-spa-router-3.0.5.tgz#097506578ac2371c9556b9789bd397d408968d92" + integrity sha512-MewNP2IoKcnFBZ5Ni1Ntrow+Enx2rS2lY9hGOWE0ZIHGf/8AhUhpoHQ7a5iv0cAIEUxYVJ480X9GIEURsjfDGA== + dependencies: + regexparam "1.3.0" + +typedarray-to-buffer@~1.0.0: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-1.0.4.tgz#9bb8ba0e841fb3f4cf1fe7c245e9f3fa8a5fe99c" + integrity sha1-m7i6DoQfs/TPH+fCRenz+opf6Zw= + +typedarray@^0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" + integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= + +util-deprecate@^1.0.1, util-deprecate@~1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= + +vlq@^0.2.2: + version "0.2.3" + resolved "https://registry.yarnpkg.com/vlq/-/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" + integrity sha512-DRibZL6DsNhIgYQ+wNdWDL2SL3bKPlVrRiBqV5yuMm++op8W4kGFtaQfCs4KEJn0wBZcHVHJ3eoywX8983k1ow== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +xtend@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.2.0.tgz#eef6b1f198c1c8deafad8b1765a04dad4a01c5a9" + integrity sha1-7vax8ZjByN6vrYsXZaBNrUoBxak= + +xtend@~2.0.4: + version "2.0.6" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.0.6.tgz#5ea657a6dba447069c2e59c58a1138cb0c5e6cee" + integrity sha1-XqZXptukRwacLlnFihE4ywxebO4= + dependencies: + is-object "~0.1.2" + object-keys "~0.2.0" + +xtend@~2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-2.1.2.tgz#6efecc2a4dad8e6962c4901b337ce7ba87b5d28b" + integrity sha1-bv7MKk2tjmlixJAbM3znuoe10os= + dependencies: + object-keys "~0.4.0" + +xtend@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/xtend/-/xtend-3.0.0.tgz#5cce7407baf642cba7becda568111c493f59665a" + integrity sha1-XM50B7r2Qsunvs2laBEcST9ZZlo= diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index cf175b4652..64d41ae5f8 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -14,6 +14,7 @@ }, "devDependencies": { "@budibase/client": "^0.3.6", + "@rollup/plugin-alias": "^3.1.1", "@rollup/plugin-commonjs": "^11.1.0", "lodash": "^4.17.15", "rollup": "^2.11.2", diff --git a/packages/standard-components/rollup.config.js b/packages/standard-components/rollup.config.js index 202adde702..ae191bfc16 100644 --- a/packages/standard-components/rollup.config.js +++ b/packages/standard-components/rollup.config.js @@ -2,10 +2,13 @@ import svelte from "rollup-plugin-svelte" import resolve from "rollup-plugin-node-resolve" import commonjs from "@rollup/plugin-commonjs" import postcss from "rollup-plugin-postcss" +import alias from "@rollup/plugin-alias" import { terser } from "rollup-plugin-terser" +import path from "path" const production = !process.env.ROLLUP_WATCH const lodash_fp_exports = ["isEmpty"] +const projectRootDir = path.resolve(__dirname) export default { input: "src/index.js", @@ -18,7 +21,17 @@ export default { }, ], plugins: [ - // Only run terser in production environments + alias({ + entries: [ + { + find: "@budibase/component-sdk", + replacement: path.resolve( + projectRootDir, + "../component-sdk/dist/budibase-component-sdk" + ), + }, + ], + }), production && terser(), postcss({ plugins: [], diff --git a/packages/standard-components/src/Container.svelte b/packages/standard-components/src/Container.svelte index 9c2a259737..c850e44a5c 100644 --- a/packages/standard-components/src/Container.svelte +++ b/packages/standard-components/src/Container.svelte @@ -1,48 +1,58 @@ {#if type === 'div'} -
+
+ +
{:else if type === 'header'} -
+
+ +
{:else if type === 'main'} -
+
+ +
{:else if type === 'footer'} -