@live-change/content-frontend 0.2.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Michał Łaszczewski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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,32 @@
1
+ <template>
2
+ <view-root>
3
+ <template #navbar>
4
+ <NavBar />
5
+ </template>
6
+ </view-root>
7
+ </template>
8
+
9
+ <script setup>
10
+ import 'primevue/resources/themes/saga-green/theme.css'
11
+ import "@fortawesome/fontawesome-free/css/all.min.css"
12
+
13
+ import ViewRoot from "@live-change/frontend-base/ViewRoot.vue"
14
+ import NavBar from "./NavBar.vue"
15
+
16
+ import { useMeta } from 'vue-meta'
17
+ const { meta } = useMeta({
18
+ title: 'Title',
19
+ htmlAttrs: {
20
+ lang: 'en',
21
+ amp: true
22
+ }
23
+ })
24
+
25
+ import { watch } from 'vue'
26
+ import { client as useClient } from '@live-change/vue3-ssr'
27
+ const client = useClient()
28
+ watch(client, (newClient, oldClient) => {
29
+ console.log("WATCH CLIENT", oldClient, '=>', newClient)
30
+ })
31
+
32
+ </script>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <div class="surface-overlay py-3 px-6 shadow-2 flex align-items-center justify-content-between
3
+ relative md:sticky top-0 z-5"
4
+ style="min-height: 80px" key="navbar">
5
+ <img src="/images/logo.svg" alt="Image" height="40" class="mr-0 lg:mr-6">
6
+ <div class="hidden lg:flex">
7
+ <!-- place for desktop menu -->
8
+ </div>
9
+ <div class="flex flex-grow-1"></div>
10
+ <UserIcon />
11
+
12
+
13
+ <div class="static w-auto w-full surface-overlay left-0 top-100 z-1 shadow-none hidden">
14
+ <ul class="list-none p-0 m-0 flex align-items-center select-none flex-row border-top-none">
15
+ <li>
16
+ <a v-ripple class="flex p-3 px-3 align-items-center text-600 hover:text-900 hover:surface-100
17
+ font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
18
+ <i class="pi pi-inbox text-base text-2xl mr-0"></i>
19
+ </a>
20
+ </li>
21
+ <li>
22
+ <a v-ripple class="flex p-3 px-3 align-items-center text-600 hover:text-900 hover:surface-100 font-medium
23
+ border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
24
+ <i class="pi pi-bell text-base lg:text-2xl mr-2 lg:mr-0" v-badge.danger></i>
25
+ </a>
26
+ </li>
27
+ </ul>
28
+ </div>
29
+
30
+
31
+ <a v-ripple class="cursor-pointer block lg:hidden text-700 p-ripple ml-2 hover:surface-100 p-2"
32
+ v-styleclass="{ selector: '@next', enterClass: 'hidden', leaveToClass: 'hidden', hideOnOutsideClick: true }">
33
+ <i class="pi pi-bars text-4xl"></i>
34
+ </a>
35
+ <div class="align-items-center flex-grow-1 justify-content-between hidden absolute lg:static w-full surface-overlay left-0 top-100 z-1 shadow-2 lg:shadow-none">
36
+ <ul class="list-none p-0 m-0 flex lg:align-items-center select-none flex-column lg:flex-row">
37
+ <li>
38
+ <a v-ripple class="flex px-6 p-3 lg:px-3 lg:py-2 align-items-center text-600 hover:text-900 hover:surface-100 font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
39
+ <i class="pi pi-home mr-2"></i>
40
+ <span>Home</span>
41
+ </a>
42
+ </li>
43
+ <li class="lg:relative">
44
+ <a v-ripple class="flex px-6 p-3 lg:px-3 lg:py-2 align-items-center text-600 hover:text-900 hover:surface-100 font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple"
45
+ v-styleclass="{ selector: '@next', enterClass: 'hidden', enterActiveClass: 'scalein', leaveToClass: 'hidden', leaveActiveClass: 'fadeout', hideOnOutsideClick: true }">
46
+ <i class="pi pi-users mr-2"></i>
47
+ <span>Customers</span>
48
+ <i class="pi pi-angle-down ml-auto lg:ml-3"></i>
49
+ </a>
50
+ <ul class="list-none py-3 px-6 m-0 lg:px-0 lg:py-0 border-round shadow-0 lg:shadow-2 lg:border-1 border-50 lg:absolute surface-overlay hidden origin-top w-full lg:w-15rem cursor-pointer">
51
+ <li>
52
+ <a v-ripple class="flex p-3 align-items-center text-600 hover:text-900 hover:surface-100 transition-colors transition-duration-150 p-ripple">
53
+ <i class="pi pi-user-plus mr-2"></i>
54
+ <span class="font-medium">Add New</span>
55
+ </a>
56
+ </li>
57
+ <li class="relative">
58
+ <a v-ripple class="flex p-3 align-items-center text-600 hover:text-900 hover:surface-100 transition-colors transition-duration-150 p-ripple"
59
+ v-styleclass="{ selector: '@next', enterClass: 'hidden', enterActiveClass: 'scalein', leaveToClass: 'hidden', leaveActiveClass: 'fadeout', hideOnOutsideClick: true }">
60
+ <i class="pi pi-search mr-2"></i>
61
+ <span class="font-medium">Search</span>
62
+ <i class="pi pi-angle-down ml-auto lg:-rotate-90"></i>
63
+ </a>
64
+ <ul class="list-none py-3 pl-3 m-0 lg:px-0 lg:py-0 border-round shadow-0 lg:shadow-2 lg:border-1 border-50 lg:absolute surface-overlay hidden origin-top w-full lg:w-15rem cursor-pointer left-100 top-0">
65
+ <li>
66
+ <a v-ripple class="flex p-3 align-items-center text-600 hover:text-900 hover:surface-100 transition-colors transition-duration-150 p-ripple">
67
+ <i class="pi pi-shopping-cart mr-2"></i>
68
+ <span class="font-medium">Purchases</span>
69
+ </a>
70
+ </li>
71
+ <li class="relative">
72
+ <a v-ripple class="flex p-3 align-items-center text-600 hover:text-900 hover:surface-100 transition-colors transition-duration-150 p-ripple">
73
+ <i class="pi pi-comments mr-2"></i>
74
+ <span class="font-medium">Messages</span>
75
+ </a>
76
+ </li>
77
+ </ul>
78
+ </li>
79
+ </ul>
80
+ </li>
81
+ <li>
82
+ <a v-ripple class="flex px-6 p-3 lg:px-3 lg:py-2 align-items-center text-600 hover:text-900 hover:surface-100 font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
83
+ <i class="pi pi-calendar mr-2"></i>
84
+ <span>Calendar</span>
85
+ </a>
86
+ </li>
87
+ <li>
88
+ <a v-ripple class="flex px-6 p-3 lg:px-3 lg:py-2 align-items-center text-600 hover:text-900 hover:surface-100 font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
89
+ <i class="pi pi-chart-line mr-2"></i>
90
+ <span>Stats</span>
91
+ </a>
92
+ </li>
93
+ </ul>
94
+ <ul class="list-none p-0 m-0 flex lg:align-items-center select-none flex-column lg:flex-row border-top-1 surface-border lg:border-top-none">
95
+ <li>
96
+ <a v-ripple class="flex px-6 p-3 lg:px-3 lg:py-2 align-items-center text-600 hover:text-900 hover:surface-100 font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
97
+ <i class="pi pi-inbox text-base lg:text-2xl mr-2 lg:mr-0"></i>
98
+ <span class="block lg:hidden font-medium">Inbox</span>
99
+ </a>
100
+ </li>
101
+ <li class="border-top-1 surface-border lg:border-top-none">
102
+ <a v-ripple class="flex px-6 p-3 lg:px-3 lg:py-2 align-items-center hover:surface-100 font-medium border-round cursor-pointer transition-colors transition-duration-150 p-ripple">
103
+ <img src="/images/empty-user-photo.svg" class="mr-3 lg:mr-0 border-circle" style="width: 28px; height: 28px"/>
104
+ <div class="block lg:hidden">
105
+ <div class="text-900 font-medium">Josephine Lillard</div>
106
+ <span class="text-600 font-medium text-sm">Marketing Specialist</span>
107
+ </div>
108
+ </a>
109
+ </li>
110
+ </ul>
111
+ </div>
112
+ </div>
113
+ </template>
114
+
115
+ <script setup>
116
+
117
+ import { NotificationsIcon } from "@live-change/user-frontend"
118
+
119
+ import { UserIcon } from "@live-change/user-frontend"
120
+
121
+
122
+
123
+ </script>
124
+
125
+ <style scoped>
126
+
127
+ </style>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <!-- <pre>{{ JSON.stringify(content, null, " ") }}</pre>-->
3
+ <ContentView :content="JSON.stringify(content.content)" :config="contentConfig" />
4
+ </template>
5
+
6
+ <script setup>
7
+ import { ContentView } from "@live-change/wysiwyg-frontend"
8
+ import contentConfig from "./contentConfig.js"
9
+
10
+ const props = defineProps({
11
+ objectType: {
12
+ type: String,
13
+ required: true
14
+ },
15
+ object: {
16
+ type: String,
17
+ required: true
18
+ }
19
+ })
20
+
21
+ import { computed, ref, onMounted } from 'vue'
22
+ import { path, live } from '@live-change/vue3-ssr'
23
+
24
+ const isMounted = ref(false)
25
+ onMounted(() => isMounted.value = true)
26
+
27
+ const p = path()
28
+ const liveContentPath = computed(() =>
29
+ p.content.content({ objectType: props.objectType, object: props.object })
30
+ )
31
+
32
+ const [content] = await Promise.all([
33
+ live(liveContentPath)
34
+ ])
35
+
36
+ </script>
37
+
38
+ <style scoped>
39
+
40
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+
3
+ </template>
4
+
5
+ <script setup>
6
+
7
+ </script>
8
+
9
+ <style scoped>
10
+
11
+ </style>
@@ -0,0 +1,89 @@
1
+ <template>
2
+ <ResolveUrl targetType="content_Page" :path="urlPath" :fetchMore="urlMore">
3
+ <template #default="{ target }">
4
+ <LimitedAccess :requiredRoles="['writer']" objectType="content_Page" :object="target" hidden>
5
+ <div class="absolute top-0 right-0 pr-4 max-h-0 flex align-items-center z-5">
6
+ <Button icon="pi pi-pencil"
7
+ class="p-button p-button-icon-only p-button-rounded p-button-warning mr-2"
8
+ @click="editPage(target)" />
9
+ <Button icon="pi pi-trash"
10
+ class="p-button p-button-icon-only p-button-rounded p-button-danger"
11
+ @click="deletePage(target)" />
12
+ </div>
13
+ </LimitedAccess>
14
+ <Content objectType="content_Page" :object="target" />
15
+ </template>
16
+ <template #notFound="{ path }">
17
+ <div class="surface-section px-4 py-8 md:px-6 lg:px-8">
18
+ <div style="background: radial-gradient(50% 109137.91% at 50% 50%, rgba(233, 30, 99, 0.1) 0%, rgba(254, 244, 247, 0) 100%);" class="text-center">
19
+ <span class="bg-white text-pink-500 font-bold text-2xl inline-block px-3">404</span>
20
+ </div>
21
+ <div class="mt-6 mb-5 font-bold text-6xl text-900 text-center">Page Not Found</div>
22
+ <p class="text-700 text-3xl mt-0 mb-6 text-center">Sorry, we couldn't find the page.</p>
23
+ <div class="text-center">
24
+ <Button class="p-button-text mr-2" label="Go Back" icon="pi pi-arrow-left"></Button>
25
+ <Button label="Go to Dashboard" icon="pi pi-home"></Button>
26
+ </div>
27
+ </div>
28
+ </template>
29
+ </ResolveUrl>
30
+ </template>
31
+
32
+ <script setup>
33
+ import Button from "primevue/button"
34
+ import { ResolveUrl } from "@live-change/url-frontend"
35
+ import {LimitedAccess} from "@live-change/access-control-frontend";
36
+ import Content from "./Content.vue"
37
+
38
+ import { computed, watch, ref, onMounted } from 'vue'
39
+ import { toRefs } from "@vueuse/core"
40
+ import { useHost } from "@live-change/frontend-base"
41
+
42
+ const isMounted = ref(false)
43
+ onMounted(() => isMounted.value = true)
44
+
45
+ import { path, live, useApi } from '@live-change/vue3-ssr'
46
+ const api = useApi()
47
+ const p = path()
48
+
49
+ const urlMore = [
50
+ url => p.content.page({ page: url.target })
51
+ ]
52
+
53
+ const props = defineProps({
54
+ path: {
55
+ type: String,
56
+ required: true
57
+ }
58
+ })
59
+ const { path: urlPath } = toRefs(props)
60
+
61
+ import { useToast } from 'primevue/usetoast'
62
+ const toast = useToast()
63
+ import { useConfirm } from 'primevue/useconfirm'
64
+ const confirm = useConfirm()
65
+
66
+ function editPage(page) {
67
+
68
+ }
69
+ function deletePage(page) {
70
+ confirm.require({
71
+ target: event.currentTarget,
72
+ message: `Do you want to remove page ${urlPath.value} ?`,
73
+ icon: 'pi pi-info-circle',
74
+ acceptClass: 'p-button-danger',
75
+ accept: async () => {
76
+ await api.actions.content.deletePage({ page })
77
+ toast.add({ severity:'info', summary: 'Page deleted', life: 1500 })
78
+ },
79
+ reject: () => {
80
+ toast.add({ severity:'error', summary: 'Rejected', detail: 'You have rejected', life: 3000 })
81
+ }
82
+ })
83
+ }
84
+
85
+ </script>
86
+
87
+ <style scoped>
88
+
89
+ </style>
@@ -0,0 +1,11 @@
1
+ <template>
2
+
3
+ </template>
4
+
5
+ <script>
6
+
7
+ </script>
8
+
9
+ <style scoped>
10
+
11
+ </style>
@@ -0,0 +1,15 @@
1
+ import { config } from "@live-change/wysiwyg-frontend"
2
+
3
+ const { basicMarks, richEditorNodes } = config
4
+
5
+ const contentConfig = {
6
+ marks: {
7
+ ...basicMarks
8
+ },
9
+ nodes: {
10
+ //...messageNodes,
11
+ ...richEditorNodes
12
+ }
13
+ }
14
+
15
+ export default contentConfig
@@ -0,0 +1,46 @@
1
+ import { sitemap } from "@live-change/url-frontend"
2
+
3
+ export function contentEditRoutes(config = {}) {
4
+ const { prefix = '/', route = (r) => r } = config
5
+
6
+ return [
7
+
8
+ route({ name: 'content:editor', path: prefix + 'content-editor/:documentId', meta: { },
9
+ component: () => import("./ContentEditor.vue") }),
10
+ route({ name: 'content:pageEditor', path: prefix + 'page-editor/:pageId', meta: { },
11
+ component: () => import("./PageEditor.vue") }),
12
+
13
+ ]
14
+ }
15
+
16
+ export function catchAllPagesRoute(config = {}) {
17
+ const { prefix = '/', route = (r) => r } = config
18
+
19
+ return [
20
+
21
+ route({
22
+ name: 'content:page', path: prefix + ':path(.*)', meta: { },
23
+ component: () => import("./Page.vue"),
24
+ props: true
25
+ })
26
+
27
+ ]
28
+ }
29
+
30
+
31
+ export function routes(config = {}) {
32
+ const { prefix = '/', route = (r) => r } = config
33
+
34
+ return [
35
+
36
+ ...contentEditRoutes(config),
37
+ ...catchAllPagesRoute({ ...config, prefix: config.pagePrefix ?? '/' })
38
+
39
+ ]
40
+ }
41
+
42
+ export async function pagesSitemap(route, api) {
43
+ await sitemap(route, api, 'page_Page', '/')
44
+ }
45
+
46
+ export default routes
@@ -0,0 +1,6 @@
1
+ import { clientEntry } from '@live-change/frontend-base/client-entry.js'
2
+ import App from './App.vue'
3
+ import { createRouter } from './router'
4
+
5
+
6
+ clientEntry(App, createRouter)
@@ -0,0 +1,6 @@
1
+ import { serverEntry } from '@live-change/frontend-base/server-entry.js'
2
+ import App from './App.vue'
3
+ import { createRouter } from './router'
4
+
5
+ const render = serverEntry(App, createRouter)
6
+ export { render }
@@ -0,0 +1,42 @@
1
+ import {
2
+ createMemoryHistory,
3
+ createRouter as _createRouter,
4
+ createWebHistory
5
+ } from 'vue-router'
6
+
7
+ import { dbAdminRoutes } from "@live-change/db-admin"
8
+ import { userRoutes } from "@live-change/user-frontend";
9
+ import { catchAllPagesRoute, contentEditRoutes, pagesSitemap } from "./components/routes";
10
+
11
+ export function wysiwygRoutes(config = {}) {
12
+ const { prefix = '/', route = (r) => r } = config
13
+ return [
14
+ ...userRoutes({ ...config, prefix: prefix + 'user/' }),
15
+
16
+ route({
17
+ name: 'page:test', path: prefix, meta: { },
18
+ redirect: to => {
19
+ return { name: 'content:page', params: { path: 'test' } }
20
+ }
21
+ }),
22
+
23
+ ...contentEditRoutes({ ...config }),
24
+
25
+ ...dbAdminRoutes({ prefix: '/_db', route: r => ({ ...r, meta: { ...r.meta, raw: true }}) }),
26
+ ...catchAllPagesRoute({ ...config })
27
+ ]
28
+ }
29
+
30
+ export async function sitemap(route, api) {
31
+ await pagesSitemap(route, api)
32
+ }
33
+
34
+
35
+ export function createRouter(app, config) {
36
+ const router = _createRouter({
37
+ history: import.meta.env.SSR ? createMemoryHistory() : createWebHistory(),
38
+ routes: wysiwygRoutes(config)
39
+ })
40
+ return router
41
+ }
42
+
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from 'vite'
2
+
3
+ import baseViteConfig from '@live-change/frontend-base/vite-config.js'
4
+
5
+ export default defineConfig(async ({ command, mode }) => {
6
+ const baseConfig = (await baseViteConfig({ command, mode }))
7
+ return {
8
+ ...baseConfig,
9
+
10
+ resolve: {
11
+ alias: [
12
+ ...baseConfig.resolve.alias,
13
+ /* { find: 'vue', replacement: 'vue/dist/vue.esm-bundler.js' },
14
+ { find: 'vue/server-renderer', replacement: 'vue/server-renderer' },*/
15
+ ]
16
+ }
17
+ }
18
+ })
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+
2
+
3
+ export { }
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@live-change/content-frontend",
3
+ "version": "0.2.0",
4
+ "scripts": {
5
+ "memDev": "lcli memDev --enableSessions --initScript ./init.js --dbAccess",
6
+ "localDevInit": "rm tmp.db; lcli localDev --enableSessions --initScript ./init.js",
7
+ "localDev": "lcli localDev --enableSessions",
8
+ "dev": "lcli dev --enableSessions",
9
+ "ssrDev": "lcli ssrDev --enableSessions",
10
+ "serveAllMem": "cross-env NODE_ENV=production lcli ssrServer --withApi --withServices --updateServices --enableSessions --withDb --dbBackend mem --createDb",
11
+ "serveAll": "cross-env NODE_ENV=production lcli ssrServer --withApi --withServices --updateServices --enableSessions",
12
+ "serve": "cross-env NODE_ENV=production lcli ssrServer --enableSessions",
13
+ "apiServer": "lcli apiServer --enableSessions",
14
+ "devApiServer": "lcli devApiServer --enableSessions",
15
+ "memApiServer": "lcli memApiServer --enableSessions",
16
+ "build": "cd front; yarn build:client && yarn build:server",
17
+ "build:client": "cd front; vite build --ssrManifest --outDir dist/client",
18
+ "build:server": "cd front; vite build --ssr src/entry-server.js --outDir dist/server",
19
+ "generate": "vite build --ssrManifest --outDir dist/static && yarn build:server && node prerender",
20
+ "debug": "node --inspect-brk server"
21
+ },
22
+ "dependencies": {
23
+ "@fortawesome/fontawesome-free": "^6.1.1",
24
+ "@live-change/cli": "0.6.14",
25
+ "@live-change/dao": "0.5.6",
26
+ "@live-change/dao-vue3": "0.5.6",
27
+ "@live-change/dao-websocket": "0.5.6",
28
+ "@live-change/framework": "0.6.14",
29
+ "@live-change/image-service": "0.2.51",
30
+ "@live-change/session-service": "0.2.51",
31
+ "@live-change/vue3-components": "0.2.15",
32
+ "@live-change/vue3-ssr": "0.2.15",
33
+ "@tiptap/extension-highlight": "^2.0.0-beta.33",
34
+ "@tiptap/extension-underline": "2.0.0-beta.23",
35
+ "@tiptap/starter-kit": "^2.0.0-beta.185",
36
+ "@tiptap/vue-3": "2.0.0-beta.91",
37
+ "@vueuse/core": "^9.1.0",
38
+ "codeceptjs-assert": "^0.0.5",
39
+ "compression": "^1.7.4",
40
+ "cross-env": "^7.0.3",
41
+ "get-port-sync": "1.0.1",
42
+ "pica": "^9.0.1",
43
+ "pretty-bytes": "^6.0.0",
44
+ "primeflex": "^3.2.1",
45
+ "primeicons": "^5.0.0",
46
+ "primevue": "^3.15.0",
47
+ "rollup-plugin-node-builtins": "^2.1.2",
48
+ "rollup-plugin-visualizer": "5.6.0",
49
+ "serialize-javascript": "^6.0.0",
50
+ "serve-static": "^1.15.0",
51
+ "v-shared-element": "3.1.0",
52
+ "vue-meta": "^3.0.0-alpha.9",
53
+ "vue-router": "^4.1.3",
54
+ "vue3-scroll-border": "0.1.2"
55
+ },
56
+ "devDependencies": {
57
+ "@live-change/codeceptjs-helper": "0.6.14",
58
+ "@wdio/selenium-standalone-service": "^7.20.8",
59
+ "codeceptjs": "^3.3.4",
60
+ "generate-password": "1.7.0",
61
+ "playwright": "^1.24.2",
62
+ "random-profile-generator": "^2.3.0",
63
+ "txtgen": "^3.0.2",
64
+ "webdriverio": "^7.20.9"
65
+ },
66
+ "author": "",
67
+ "license": "ISC",
68
+ "description": "",
69
+ "gitHead": "b7109dab79e452d391c00405c9a8108efda660d5"
70
+ }
package/server/init.js ADDED
@@ -0,0 +1,94 @@
1
+ const {createUser} = require("@live-change/user-frontend/server/init-functions.js");
2
+ const App = require('@live-change/framework')
3
+ const app = App.app()
4
+
5
+ module.exports = async function(services) {
6
+ const user1 = await createUser(services,
7
+ 'Test User 1', 'test1@test.com', 'Testy123', 'u1', ['writer'])
8
+
9
+ const pageId = 'one'
10
+ const documentId = App.encodeIdentifier(['page_Page', 'one'])
11
+ const snapshotId = App.encodeIdentifier([documentId, (0).toFixed().padStart(10, '0')])
12
+
13
+ const documentContent = {
14
+ "type": "doc",
15
+ "content": [].concat(new Array(2).fill(
16
+ {
17
+ "type": "paragraph",
18
+ "content": [
19
+ {
20
+ "type": "text",
21
+ "text": "test"
22
+ },
23
+ {
24
+ "type": "text",
25
+ "marks": [
26
+ {
27
+ "type": "bold"
28
+ }
29
+ ],
30
+ "text": "est"
31
+ }
32
+ ]
33
+ }
34
+ ))
35
+ }
36
+ const documentTime = new Date()
37
+
38
+ await services.content.models.Page.create({
39
+ id: pageId
40
+ })
41
+
42
+ await services.prosemirror.models.Document.create({
43
+ id: documentId,
44
+ type: 'rich',
45
+ purpose: 'page',
46
+ version: 0,
47
+ content: documentContent,
48
+ created: documentTime,
49
+ lastModified: documentTime
50
+ })
51
+ await services.prosemirror.models.Snapshot.create({
52
+ id: snapshotId,
53
+ document: documentId,
54
+ version: 0,
55
+ content: documentContent,
56
+ timestamp: documentTime,
57
+ })
58
+
59
+ await services.content.models.Content.create({
60
+ id: App.encodeIdentifier(['content_Page', 'one']),
61
+ objectType: 'content_Page',
62
+ object: 'one',
63
+ snapshot: snapshotId
64
+ })
65
+
66
+ await services.accessControl.models.PublicAccess.create({
67
+ id: App.encodeIdentifier(['content_Page', 'one']),
68
+ objectType: 'content_Page',
69
+ object: 'one',
70
+ sessionRoles: ['reader'] .concat(['writer'])
71
+ })
72
+ await services.accessControl.models.Access.create({
73
+ id: App.encodeIdentifier(['user_User', user1.id, 'content_Page', 'one']),
74
+ sessionOrUserType: 'user_User', sessionOrUser: user1.id,
75
+ objectType: 'content_Page', object: 'one',
76
+ roles: ['writer']
77
+ })
78
+
79
+ await services.url.models.Canonical.create({
80
+ id: App.encodeIdentifier(['content_Page', 'one']),
81
+ domain: '',
82
+ path: 'test',
83
+ targetType: 'content_Page',
84
+ target: 'one'
85
+ })
86
+ await services.url.models.Redirect.create({
87
+ id: app.generateUid(),
88
+ domain: 'localhost:8001',
89
+ path: 'test-redirect',
90
+ targetType: 'content_Page',
91
+ target: 'one'
92
+ })
93
+
94
+ }
@@ -0,0 +1,87 @@
1
+ module.exports = {
2
+ "marks": {
3
+ "bold": {},
4
+ "italic": {},
5
+ "underline": {},
6
+ "strike": {}
7
+ },
8
+ "nodes": {
9
+ "paragraph": {
10
+ "content": "inline*",
11
+ "group": "block"
12
+ },
13
+ "horizontalRule": {
14
+ "group": "block"
15
+ },
16
+ "heading": {
17
+ "content": "inline*",
18
+ "group": "block",
19
+ "defining": true,
20
+ "attrs": {
21
+ "level": {
22
+ "default": 1
23
+ }
24
+ }
25
+ },
26
+ "blockquote": {
27
+ "content": "block+",
28
+ "group": "block",
29
+ "defining": true
30
+ },
31
+ "codeBlock": {
32
+ "content": "text*",
33
+ "marks": "",
34
+ "group": "block",
35
+ "code": true,
36
+ "defining": true,
37
+ "attrs": {
38
+ "language": {
39
+ "default": null
40
+ }
41
+ }
42
+ },
43
+ "bulletList": {
44
+ "content": "listItem+",
45
+ "group": "block list"
46
+ },
47
+ "orderedList": {
48
+ "content": "listItem+",
49
+ "group": "block list",
50
+ "attrs": {
51
+ "start": {
52
+ "default": 1
53
+ }
54
+ }
55
+ },
56
+ "listItem": {
57
+ "content": "paragraph block*",
58
+ "defining": true
59
+ },
60
+ "image": {
61
+ "content": "",
62
+ "marks": "",
63
+ "group": "block",
64
+ "inline": false,
65
+ "atom": true,
66
+ "selectable": true,
67
+ "draggable": true,
68
+ "attrs": {
69
+ "image": {
70
+ "default": null
71
+ }
72
+ }
73
+ },
74
+ "doc": {
75
+ "content": "block+"
76
+ },
77
+ "text": {
78
+ "group": "inline"
79
+ },
80
+ "hardBreak": {
81
+ "group": "inline",
82
+ "inline": true,
83
+ "selectable": false
84
+ }
85
+ },
86
+ "topNode": "doc"
87
+ }
@@ -0,0 +1,64 @@
1
+ const contactTypes = ['email']
2
+
3
+ module.exports = {
4
+ services: [
5
+ {
6
+ name: 'session',
7
+ path: '@live-change/session-service',
8
+ createSessionOnUpdate: true
9
+ },
10
+ {
11
+ name: 'user',
12
+ path: '@live-change/user-service'
13
+ },
14
+ {
15
+ name: 'email',
16
+ path: '@live-change/email-service'
17
+ },
18
+ {
19
+ name: 'passwordAuthentication',
20
+ path: '@live-change/password-authentication-service',
21
+ contactTypes,
22
+ signInWithoutPassword: true
23
+ },
24
+ {
25
+ name: 'userIdentification',
26
+ path: '@live-change/user-identification-service'
27
+ },
28
+ {
29
+ name: 'identicon',
30
+ path: '@live-change/identicon-service'
31
+ },
32
+ {
33
+ name: 'accessControl',
34
+ path: '@live-change/access-control-service',
35
+ createSessionOnUpdate: true,
36
+ contactTypes,
37
+ },
38
+ {
39
+ name: 'url',
40
+ path: '@live-change/url-service'
41
+ },
42
+ {
43
+ name: 'prosemirror',
44
+ path: '@live-change/prosemirror-service',
45
+ documentTypes: {
46
+ rich: require('./rich.documentType.js'),
47
+ },
48
+ testLatency: 2000
49
+ },
50
+ {
51
+ name: 'upload',
52
+ path: '@live-change/upload-service'
53
+ },
54
+ {
55
+ name: "image",
56
+ path: '@live-change/image-service'
57
+ },
58
+ {
59
+ name: 'content',
60
+ path: '@live-change/content-service',
61
+ }
62
+
63
+ ]
64
+ }