@live-change/db-admin 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/e2e/codecept.conf.js +60 -0
  3. package/e2e/connectEmailCode.test.js +61 -0
  4. package/e2e/connectEmailLink.test.js +60 -0
  5. package/e2e/delete.test.js +44 -0
  6. package/e2e/disconnectEmail.test.js +42 -0
  7. package/e2e/resetPasswordWithEmailCode.test.js +62 -0
  8. package/e2e/resetPasswordWithEmailLink.test.js +62 -0
  9. package/e2e/setPassword.test.js +70 -0
  10. package/e2e/signInEmailCode.test.js +52 -0
  11. package/e2e/signInEmailLink.test.js +52 -0
  12. package/e2e/signInEmailPassword.test.js +47 -0
  13. package/e2e/signOut.test.js +41 -0
  14. package/e2e/signUpEmailCode.test.js +41 -0
  15. package/e2e/signUpEmailLink.test.js +41 -0
  16. package/e2e/steps.d.ts +12 -0
  17. package/e2e/steps_file.js +85 -0
  18. package/front/assets/images/empty-photo.svg +38 -0
  19. package/front/assets/images/empty-user-photo.svg +33 -0
  20. package/front/assets/images/logo.svg +34 -0
  21. package/front/index.html +11 -0
  22. package/front/public/favicon.ico +0 -0
  23. package/front/public/images/empty-photo.svg +38 -0
  24. package/front/public/images/empty-user-photo.svg +33 -0
  25. package/front/public/images/logo.svg +34 -0
  26. package/front/public/images/logo128.png +0 -0
  27. package/front/src/App.vue +93 -0
  28. package/front/src/CodeEditor.vue +92 -0
  29. package/front/src/Data.vue +74 -0
  30. package/front/src/DataRangeView.vue +58 -0
  31. package/front/src/DataView.vue +51 -0
  32. package/front/src/Database.vue +364 -0
  33. package/front/src/DatabaseAdmin.vue +135 -0
  34. package/front/src/Databases.vue +110 -0
  35. package/front/src/NavBar.vue +105 -0
  36. package/front/src/ObjectEditor.vue +143 -0
  37. package/front/src/Page.vue +39 -0
  38. package/front/src/PathEditor.vue +210 -0
  39. package/front/src/dbSugar.js +75 -0
  40. package/front/src/entry-client.js +24 -0
  41. package/front/src/entry-server.js +59 -0
  42. package/front/src/isClientSide.js +3 -0
  43. package/front/src/main.js +61 -0
  44. package/front/src/path.js +68 -0
  45. package/front/src/router.js +42 -0
  46. package/front/src/routes.js +31 -0
  47. package/front/vite.config.js +107 -0
  48. package/package.json +71 -0
  49. package/server/init.js +16 -0
  50. package/server/services.config.js +4 -0
@@ -0,0 +1,41 @@
1
+ const randomProfile = require('random-profile-generator')
2
+
3
+ const user = randomProfile.profile()
4
+ user.email = user.firstName.toLowerCase() + '@test.com' // test domain - emails not sent
5
+
6
+ const happyPath = false
7
+
8
+ Feature('user')
9
+
10
+ Scenario('sign up with email code', async ({ I }) => {
11
+
12
+ I.amOnPage('/sign-up')
13
+ I.fillField('input#email', user.email)
14
+ I.click('button[type=submit]')
15
+
16
+ I.seeInCurrentUrl('/sent/')
17
+ const url = await I.grabCurrentUrl()
18
+ const authentication = url.split('/').pop()
19
+
20
+ const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
21
+ console.log("AUTHENTICATION DATA", authenticationData)
22
+ I.assert(!!authenticationData, true, 'authentication created')
23
+
24
+ await I.useSecretCode(authentication, happyPath)
25
+
26
+ I.seeInCurrentUrl('/sign-up-finished')
27
+ const clientSession = await I.executeScript(() => api.client.value.session)
28
+ const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
29
+ const authenticatedUserData = await AuthenticatedUser.get(clientSession)
30
+ I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
31
+ const clientUser = await I.executeScript(() => api.client.value.user)
32
+ console.log("CLIENT USER", clientUser)
33
+ console.log("SERVER AUTHENTICATION", authenticatedUserData)
34
+ I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
35
+
36
+ if(!happyPath) {
37
+ I.amOnPage(url)
38
+ I.seeInCurrentUrl('/sign-up-finished')
39
+ }
40
+
41
+ })
@@ -0,0 +1,41 @@
1
+ const randomProfile = require('random-profile-generator')
2
+
3
+ const user = randomProfile.profile()
4
+ user.email = user.firstName.toLowerCase() + '@test.com' // test domain - emails not sent
5
+
6
+ const happyPath = false
7
+
8
+ Feature('user')
9
+
10
+ Scenario('sign up with email link', async ({ I }) => {
11
+
12
+ I.amOnPage('/sign-up')
13
+ I.fillField('input#email', user.email)
14
+ I.click('button[type=submit]')
15
+
16
+ I.seeInCurrentUrl('/sent/')
17
+ const url = await I.grabCurrentUrl()
18
+ const authentication = url.split('/').pop()
19
+
20
+ const authenticationData = await I.grabObject('messageAuthentication', 'Authentication', authentication)
21
+ console.log("AUTHENTICATION DATA", authenticationData)
22
+ I.assert(!!authenticationData, true, 'authentication created')
23
+
24
+ const linkData = await I.useSecretLink(authentication, happyPath)
25
+
26
+ I.seeInCurrentUrl('/sign-up-finished')
27
+ const clientSession = await I.executeScript(() => api.client.value.session)
28
+ const AuthenticatedUser = await I.haveModel('user', 'AuthenticatedUser')
29
+ const authenticatedUserData = await AuthenticatedUser.get(clientSession)
30
+ I.assert(!!authenticatedUserData, true, 'user authenticated server-side')
31
+ const clientUser = await I.executeScript(() => api.client.value.user)
32
+ console.log("CLIENT USER", clientUser)
33
+ console.log("SERVER AUTHENTICATION", authenticatedUserData)
34
+ I.assert(clientUser, authenticatedUserData.user, 'user authenticated')
35
+
36
+ if(!happyPath) {
37
+ I.amOnPage('/link/' + linkData.secretCode)
38
+ I.see('Link used')
39
+ }
40
+
41
+ })
package/e2e/steps.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /// <reference types='codeceptjs' />
2
+ // @ts-ignore
3
+ type steps_file = typeof import('./steps_file.js');
4
+
5
+ declare namespace CodeceptJS {
6
+ interface SupportObject { I: I, current: any }
7
+ interface Methods extends Playwright {}
8
+ interface I extends ReturnType<steps_file> {}
9
+ namespace Translation {
10
+ interface Actions {}
11
+ }
12
+ }
@@ -0,0 +1,85 @@
1
+ // in this file you can append custom step methods to 'I' object
2
+
3
+ module.exports = function() {
4
+ return actor({
5
+
6
+ async useSecretCode(authentication, happyPath) {
7
+ const I = this
8
+ const Code = await I.haveModel('secretCode', 'Code')
9
+ let codeData = await Code.indexObjectGet('byAuthentication', authentication)
10
+ console.log("CODE DATA", codeData)
11
+ I.assert(!!codeData, true, 'code created')
12
+
13
+ if(!happyPath) {
14
+ const wrongCode = codeData.secretCode == '123456' ? '654321' : '123456'
15
+ I.fillField('input#code', wrongCode)
16
+ I.fillField('input#code', wrongCode) /// twice because it can fail once with this type of field
17
+ I.click('button[type=submit]')
18
+ I.seeElement('#code-help.p-error')
19
+ }
20
+
21
+ if(!happyPath) {
22
+ await I.wait(0.2)
23
+ await Code.update(codeData.id, { expire: new Date() }) // expire now
24
+ I.fillField('input#code', codeData.secretCode)
25
+ I.fillField('input#code', codeData.secretCode) /// twice because it can fail once with this type of field
26
+ I.click('button[type=submit]')
27
+ I.seeElement('#code-help.p-error')
28
+
29
+ I.click('Resend')
30
+ I.seeInCurrentUrl('/sent/')
31
+
32
+ await I.wait(0.2)
33
+ const newCodeData = await Code.indexRangeGet('byAuthentication', authentication)
34
+ newCodeData.sort((a,b) => new Date(b.expire).getTime() - new Date(a.expire).getTime())
35
+ const oldCodeData = codeData
36
+ codeData = newCodeData[0]
37
+ I.assert(!!codeData, true, 'code exists')
38
+ I.assert(oldCodeData.id != codeData.id, true, 'code is different from previous code')
39
+ }
40
+
41
+ I.fillField('input#code', codeData.secretCode)
42
+ I.fillField('input#code', codeData.secretCode) /// twice because it can fail once with this type of field
43
+ I.click('button[type=submit]')
44
+ await I.wait(0.1)
45
+ },
46
+
47
+ async useSecretLink(authentication, happyPath) {
48
+ const I = this
49
+ const Link = await I.haveModel('secretLink', 'Link')
50
+ let linkData = await Link.indexObjectGet('byAuthentication', authentication)
51
+ console.log("LINK DATA", linkData)
52
+ I.assert(!!linkData, true, 'link created')
53
+
54
+ if(!happyPath) {
55
+ I.amOnPage('/link/[badSecret]')
56
+ I.see('Unknown link')
57
+ }
58
+
59
+ if(!happyPath) {
60
+ await I.wait(0.2)
61
+ await Link.update(linkData.id, { expire: new Date() }) // expire now
62
+ I.amOnPage('/link/' + linkData.secretCode)
63
+ I.see('Link expired')
64
+
65
+ I.click('Resend')
66
+ I.seeInCurrentUrl('/sent/')
67
+
68
+ await I.wait(0.2)
69
+ const newLinksData = await Link.indexRangeGet('byAuthentication', authentication)
70
+ newLinksData.sort((a,b) => new Date(b.expire).getTime() - new Date(a.expire).getTime())
71
+ const oldLinkData = linkData
72
+ linkData = newLinksData[0]
73
+ I.assert(!!linkData, true, 'link exists')
74
+ I.assert(oldLinkData.id != linkData.id, true, 'link is different from previous link')
75
+ }
76
+
77
+ console.log("LINK RIGHT", '/link/' + linkData.secretCode)
78
+ I.amOnPage('/link/'+linkData.secretCode)
79
+ await I.wait(0.1)
80
+
81
+ return linkData
82
+ }
83
+
84
+ })
85
+ }
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+
4
+ <svg
5
+ version="1.1"
6
+ id="Layer_1"
7
+ x="0px"
8
+ y="0px"
9
+ width="512px"
10
+ height="512px"
11
+ viewBox="0 0 512 512"
12
+ enable-background="new 0 0 512 512"
13
+ xml:space="preserve"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ xmlns:svg="http://www.w3.org/2000/svg"
16
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ xmlns:cc="http://creativecommons.org/ns#"
18
+ xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
19
+ id="metadata9"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs7" />
23
+ <rect
24
+ style="fill:#dbdbdb;fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
25
+ id="rect821"
26
+ width="512.54236"
27
+ height="512.54236"
28
+ x="0.54237288"
29
+ y="0.54237235" />
30
+ <path
31
+ style="fill:#f6f6f6;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
32
+ d="M 0.54237288,470.23729 125.83051,306.44068 l 60.20339,70.50847 130.71186,-174.10169 195.79661,261.42373 0.54235,48.81353 H 0.54237288 Z"
33
+ id="path816" /><circle
34
+ style="fill:#f6f6f6;fill-opacity:1;stroke:none;stroke-width:4.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
35
+ id="path818"
36
+ cx="118.50848"
37
+ cy="106.57627"
38
+ r="57.762711" /></svg>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+
4
+ <svg
5
+ version="1.1"
6
+ id="Layer_1"
7
+ x="0px"
8
+ y="0px"
9
+ width="512px"
10
+ height="512px"
11
+ viewBox="0 0 512 512"
12
+ enable-background="new 0 0 512 512"
13
+ xml:space="preserve"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ xmlns:svg="http://www.w3.org/2000/svg"
16
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ xmlns:cc="http://creativecommons.org/ns#"
18
+ xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
19
+ id="metadata9"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs7" />
23
+ <rect
24
+ style="fill:#dbdbdb;fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
25
+ id="rect821"
26
+ width="512.54236"
27
+ height="512.54236"
28
+ x="0.54237288"
29
+ y="0.54237235" /><path
30
+ d="m 313.14122,310.64877 c 9.02181,-8.85097 12.15686,-31.23733 20.41627,-39.3056 11.69771,-11.43183 24.39381,-25.50218 27.98588,-43.06851 4.82003,-23.34203 -4.96846,-26.30516 -4.96846,-34.3713 0,-16.90002 -0.15376,-44.65739 -5.43081,-62.68607 -0.30326,-23.7809 -4.20499,-34.123578 -12.38858,-43.031138 -7.72017,-8.33522 -26.68637,-6.366203 -36.59125,-11.85361 C 286.83605,67.825407 274.23818,64.594254 258.15823,64.17461 v -0.09503 c -0.47624,0 -0.93539,0.05659 -1.41162,0.05659 -0.78484,0 -1.53123,-0.05659 -2.35343,-0.05659 l 0.0395,0.151627 c -39.17105,1.472492 -80.84608,26.170627 -95.16524,65.895863 -5.31335,14.71958 -3.28881,46.87521 -3.28881,63.77522 0,8.06721 -9.78742,11.02927 -4.96846,34.37131 3.61129,17.56632 16.28817,31.63668 27.98588,43.06851 8.26048,8.06827 11.39446,30.45462 20.39705,39.30559 1.96902,13.0378 2.1986,9.31012 2.12278,21.23954 -0.0203,4.03307 0.11426,10.28502 -6.32669,16.4398 -12.17822,11.6614 -40.14595,36.95324 -63.08756,46.79832 -30.24,12.98014 -79.41203,33.74237 -90.746691,39.59069 -11.334661,5.84833 -41.2532541,21.69763 -41.2532541,31.79045 0,10.11417 0,47.33542 0,47.33542 h 253.3742451 5.79494 253.37318 c 0,0 0,-37.22125 0,-47.33542 0,-10.09282 -29.89723,-25.94212 -41.25645,-31.79045 -11.35389,-5.84938 -60.48321,-26.61055 -90.72641,-39.59069 -22.32976,-9.57707 -49.43685,-33.81712 -62.09344,-45.84158 -4.2808,-4.05228 -7.3016,-8.29784 -7.3411,-18.62023 -0.0737,-12.00417 0.23278,-7.41692 2.14306,-20.01478"
31
+ id="path2"
32
+ style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:1.06779659;fill:#f6f6f6;fill-opacity:1" />
33
+ </svg>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ width="512"
4
+ height="512"
5
+ viewBox="0 0 135.46667 135.46667"
6
+ version="1.1"
7
+ id="svg977"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:svg="http://www.w3.org/2000/svg"
10
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
11
+ xmlns:cc="http://creativecommons.org/ns#"
12
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
13
+ <defs
14
+ id="defs971" />
15
+ <metadata
16
+ id="metadata974">
17
+ <rdf:RDF>
18
+ <cc:Work
19
+ rdf:about="">
20
+ <dc:format>image/svg+xml</dc:format>
21
+ <dc:type
22
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
23
+ </cc:Work>
24
+ </rdf:RDF>
25
+ </metadata>
26
+ <g
27
+ id="layer1"
28
+ style="fill:#666666">
29
+ <path
30
+ style="fill:#666666;fill-opacity:1;stroke:none;stroke-width:2.70907px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
31
+ d="M 54.181439,13.558436 67.726801,0.01304296 135.45359,67.739804 67.726801,135.46667 29.799793,97.539626 V 65.030766 L 13.545362,81.285197 0,67.739804 40.636077,27.103727 81.272154,67.739804 67.726801,81.285197 51.472371,65.030766 V 92.12155 l 16.25443,16.25433 40.636069,-40.636076 z"
32
+ id="path892" />
33
+ </g>
34
+ </svg>
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <!--head-->
5
+ </head>
6
+ <body>
7
+ <div id="app"><!--app-html--></div>
8
+ <!--app-data-->
9
+ <script type="module" src="/src/entry-client.js"></script>
10
+ </body>
11
+ </html>
Binary file
@@ -0,0 +1,38 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+
4
+ <svg
5
+ version="1.1"
6
+ id="Layer_1"
7
+ x="0px"
8
+ y="0px"
9
+ width="512px"
10
+ height="512px"
11
+ viewBox="0 0 512 512"
12
+ enable-background="new 0 0 512 512"
13
+ xml:space="preserve"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ xmlns:svg="http://www.w3.org/2000/svg"
16
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ xmlns:cc="http://creativecommons.org/ns#"
18
+ xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
19
+ id="metadata9"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs7" />
23
+ <rect
24
+ style="fill:#dbdbdb;fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
25
+ id="rect821"
26
+ width="512.54236"
27
+ height="512.54236"
28
+ x="0.54237288"
29
+ y="0.54237235" />
30
+ <path
31
+ style="fill:#f6f6f6;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
32
+ d="M 0.54237288,470.23729 125.83051,306.44068 l 60.20339,70.50847 130.71186,-174.10169 195.79661,261.42373 0.54235,48.81353 H 0.54237288 Z"
33
+ id="path816" /><circle
34
+ style="fill:#f6f6f6;fill-opacity:1;stroke:none;stroke-width:4.80000019;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
35
+ id="path818"
36
+ cx="118.50848"
37
+ cy="106.57627"
38
+ r="57.762711" /></svg>
@@ -0,0 +1,33 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+
4
+ <svg
5
+ version="1.1"
6
+ id="Layer_1"
7
+ x="0px"
8
+ y="0px"
9
+ width="512px"
10
+ height="512px"
11
+ viewBox="0 0 512 512"
12
+ enable-background="new 0 0 512 512"
13
+ xml:space="preserve"
14
+ xmlns="http://www.w3.org/2000/svg"
15
+ xmlns:svg="http://www.w3.org/2000/svg"
16
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
17
+ xmlns:cc="http://creativecommons.org/ns#"
18
+ xmlns:dc="http://purl.org/dc/elements/1.1/"><metadata
19
+ id="metadata9"><rdf:RDF><cc:Work
20
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
21
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
22
+ id="defs7" />
23
+ <rect
24
+ style="fill:#dbdbdb;fill-opacity:1;stroke:none;stroke-width:1.88976383;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
25
+ id="rect821"
26
+ width="512.54236"
27
+ height="512.54236"
28
+ x="0.54237288"
29
+ y="0.54237235" /><path
30
+ d="m 313.14122,310.64877 c 9.02181,-8.85097 12.15686,-31.23733 20.41627,-39.3056 11.69771,-11.43183 24.39381,-25.50218 27.98588,-43.06851 4.82003,-23.34203 -4.96846,-26.30516 -4.96846,-34.3713 0,-16.90002 -0.15376,-44.65739 -5.43081,-62.68607 -0.30326,-23.7809 -4.20499,-34.123578 -12.38858,-43.031138 -7.72017,-8.33522 -26.68637,-6.366203 -36.59125,-11.85361 C 286.83605,67.825407 274.23818,64.594254 258.15823,64.17461 v -0.09503 c -0.47624,0 -0.93539,0.05659 -1.41162,0.05659 -0.78484,0 -1.53123,-0.05659 -2.35343,-0.05659 l 0.0395,0.151627 c -39.17105,1.472492 -80.84608,26.170627 -95.16524,65.895863 -5.31335,14.71958 -3.28881,46.87521 -3.28881,63.77522 0,8.06721 -9.78742,11.02927 -4.96846,34.37131 3.61129,17.56632 16.28817,31.63668 27.98588,43.06851 8.26048,8.06827 11.39446,30.45462 20.39705,39.30559 1.96902,13.0378 2.1986,9.31012 2.12278,21.23954 -0.0203,4.03307 0.11426,10.28502 -6.32669,16.4398 -12.17822,11.6614 -40.14595,36.95324 -63.08756,46.79832 -30.24,12.98014 -79.41203,33.74237 -90.746691,39.59069 -11.334661,5.84833 -41.2532541,21.69763 -41.2532541,31.79045 0,10.11417 0,47.33542 0,47.33542 h 253.3742451 5.79494 253.37318 c 0,0 0,-37.22125 0,-47.33542 0,-10.09282 -29.89723,-25.94212 -41.25645,-31.79045 -11.35389,-5.84938 -60.48321,-26.61055 -90.72641,-39.59069 -22.32976,-9.57707 -49.43685,-33.81712 -62.09344,-45.84158 -4.2808,-4.05228 -7.3016,-8.29784 -7.3411,-18.62023 -0.0737,-12.00417 0.23278,-7.41692 2.14306,-20.01478"
31
+ id="path2"
32
+ style="clip-rule:evenodd;fill-rule:evenodd;stroke-width:1.06779659;fill:#f6f6f6;fill-opacity:1" />
33
+ </svg>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+ <svg
3
+ width="512"
4
+ height="512"
5
+ viewBox="0 0 135.46667 135.46667"
6
+ version="1.1"
7
+ id="svg977"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ xmlns:svg="http://www.w3.org/2000/svg"
10
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
11
+ xmlns:cc="http://creativecommons.org/ns#"
12
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
13
+ <defs
14
+ id="defs971" />
15
+ <metadata
16
+ id="metadata974">
17
+ <rdf:RDF>
18
+ <cc:Work
19
+ rdf:about="">
20
+ <dc:format>image/svg+xml</dc:format>
21
+ <dc:type
22
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
23
+ </cc:Work>
24
+ </rdf:RDF>
25
+ </metadata>
26
+ <g
27
+ id="layer1"
28
+ style="fill:#666666">
29
+ <path
30
+ style="fill:#666666;fill-opacity:1;stroke:none;stroke-width:2.70907px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
31
+ d="M 54.181439,13.558436 67.726801,0.01304296 135.45359,67.739804 67.726801,135.46667 29.799793,97.539626 V 65.030766 L 13.545362,81.285197 0,67.739804 40.636077,27.103727 81.272154,67.739804 67.726801,81.285197 51.472371,65.030766 V 92.12155 l 16.25443,16.25433 40.636069,-40.636076 z"
32
+ id="path892" />
33
+ </g>
34
+ </svg>
Binary file
@@ -0,0 +1,93 @@
1
+ <template>
2
+ <ConfirmPopup v-if="isClientSide"></ConfirmPopup>
3
+ <Toast v-if="isClientSide"></Toast>
4
+ <router-view v-slot="{ route, Component }">
5
+ <template v-if="route?.meta?.raw">
6
+ <component :is="Component" />
7
+ </template>
8
+ <loading-zone v-else suspense @isLoading="l => loading = l">
9
+ <template v-slot:loading>
10
+ <div class="fixed w-full h-full flex align-items-center justify-content-center top-0 left-0">
11
+ <ProgressSpinner animationDuration=".5s"/>
12
+ </div>
13
+ </template>
14
+ <template v-slot:default="{ isLoading }">
15
+ <page :loading="loading" :working="working">
16
+ <working-zone @isWorking="w => working = w">
17
+ <template v-slot:working>
18
+ <div class="fixed w-full h-full flex align-items-center justify-content-center top-0 left-0">
19
+ <ProgressSpinner animationDuration=".5s"/>
20
+ </div>
21
+ </template>
22
+ <template v-slot:default="{ isWorking }">
23
+ <component :is="Component"
24
+ :style="isWorking || isLoading ? 'filter: blur(4px)' : ''"
25
+ class="working-blur" />
26
+ </template>
27
+ </working-zone>
28
+ </page>
29
+ </template>
30
+ </loading-zone>
31
+ </router-view>
32
+ </template>
33
+
34
+ <script setup>
35
+ import ConfirmPopup from 'primevue/confirmpopup'
36
+ import Toast from 'primevue/toast'
37
+
38
+ import 'primevue/resources/primevue.min.css'
39
+ import 'primevue/resources/themes/saga-blue/theme.css'
40
+ import 'primeflex/primeflex.css'
41
+ import 'primeicons/primeicons.css'
42
+
43
+ import ProgressSpinner from 'primevue/progressspinner'
44
+
45
+ import { useMeta } from 'vue-meta'
46
+ import Page from "./Page.vue"
47
+
48
+ const { meta } = useMeta({
49
+ title: 'Title',
50
+ meta: [
51
+ { charset: 'utf-8' },
52
+ { name: 'viewport',
53
+ content: "user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1," +
54
+ " width=device-width, viewport-fit=cover" }
55
+ ],
56
+ htmlAttrs: {
57
+ lang: 'en',
58
+ amp: true
59
+ }
60
+ })
61
+
62
+ import { onMounted } from 'vue'
63
+ import isClientSide from "./isClientSide.js"
64
+ onMounted(() => isClientSide.value = true)
65
+
66
+ import { ref } from 'vue'
67
+ const working = ref(false)
68
+ const loading = ref(false)
69
+
70
+ import { watch } from 'vue'
71
+ import { client as useClient } from '@live-change/vue3-ssr'
72
+ const client = useClient()
73
+ watch(client, (newClient, oldClient) => {
74
+ console.log("WATCH CLIENT", oldClient, '=>', newClient)
75
+ })
76
+
77
+ </script>
78
+
79
+ <style>
80
+ body {
81
+ margin: 0;
82
+ height: 100%;
83
+ overflow-x: hidden;
84
+ overflow-y: auto;
85
+ background-color: var(--surface-a);
86
+ font-family: var(--font-family);
87
+ font-weight: 400;
88
+ color: var(--text-color);
89
+ }
90
+ .working-blur {
91
+ transition: filter 0.3s;
92
+ }
93
+ </style>
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <prism-editor v-if="isMounted"
3
+ class="config-editor" :highlight="highlight"
4
+ :style="{ height: (codeLines * 1.35) + 'em' }"
5
+ v-model="code"
6
+ :readonly="readOnly" :line-numbers="codeLines > 1" />
7
+ <small v-if="editResult.error" class="p-error">{{ editResult.error }}</small>
8
+ </template>
9
+
10
+ <script setup>
11
+
12
+ import { stringify } from "javascript-stringify"
13
+
14
+ import 'vue-prism-editor/dist/prismeditor.min.css'
15
+ import 'prismjs/themes/prism-coy.css'
16
+ import * as Prism from 'prismjs/components/prism-core'
17
+ import 'prismjs/components/prism-clike'
18
+ import 'prismjs/components/prism-javascript'
19
+
20
+ import { PrismEditor } from 'vue-prism-editor'
21
+
22
+ import { ref, computed, watch, onMounted } from 'vue'
23
+
24
+ const isMounted = ref(false)
25
+ onMounted(() => isMounted.value = true)
26
+
27
+ const props = defineProps({
28
+ initialCode: {
29
+ type: String
30
+ },
31
+ initialData: {
32
+ },
33
+ readOnly: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ env: {
38
+ type: Object
39
+ },
40
+ dbSugar: {
41
+ type: Object
42
+ }
43
+ })
44
+
45
+ const { readOnly, env, dbSugar } = props
46
+
47
+ const emit = defineEmits(['result'])
48
+
49
+
50
+ const code = ref(props.initialCode !== undefined ? props.initialCode : stringify(props.initialData, null, " "))
51
+
52
+ function highlight(code) {
53
+ return Prism.highlight(code, Prism.languages.js, "js")
54
+ }
55
+
56
+ const codeLines = computed(() => code.value.split('\n').length)
57
+
58
+ const modified = computed(() => code.value != props.initialCode)
59
+
60
+ const editResult = computed(() => {
61
+ if(!modified.value && props.initialData) return { data: props.initialData, code: code.value }
62
+ try {
63
+ const $ = env || {}
64
+ const db = dbSugar || {}
65
+ console.log("COMPILE CODE", code.value)
66
+ const result = eval(`(${code.value})`)
67
+ if(result === false) return { data: false, code: code.value }
68
+ if(result) return { data: result, code: code.value }
69
+ return { error: 'empty' }
70
+ } catch(e) {
71
+ if(e instanceof SyntaxError) {
72
+ if(e.lineNumber) return {
73
+ error: `${e.message} at ${e.lineNumber}:${e.columnNumber - (e.lineNumber ? 0 : -1)}`
74
+ }
75
+ }
76
+ return { error: e.message }
77
+ }
78
+ })
79
+
80
+ function reset() {
81
+ code.value = props.initialCode !== undefined ? props.initialCode : stringify(props.initialData, null, " ")
82
+ }
83
+
84
+ watch(() => editResult.value, () => emit('result', editResult.value))
85
+
86
+ defineExpose({ reset })
87
+
88
+ </script>
89
+
90
+ <style scoped>
91
+
92
+ </style>