@mframework/ui 0.1.0-beta.2 → 0.1.0-beta.4
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/dist/module.d.mts +3 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -6
- package/dist/runtime/assets/config/tailwind.conifg.js +37 -6
- package/dist/runtime/components/Gallery.d.vue.ts +0 -0
- package/{src → dist}/runtime/components/Gallery.vue +23 -33
- package/dist/runtime/components/Gallery.vue.d.ts +0 -0
- package/dist/runtime/composables/useMToast.d.ts +0 -5
- package/dist/runtime/composables/useMToast.js +9 -9
- package/dist/runtime/design/tokens.d.ts +0 -22
- package/dist/runtime/design/tokens.js +20 -20
- package/dist/runtime/plugins/builder.d.ts +0 -3
- package/dist/runtime/plugins/builder.js +328 -303
- package/dist/runtime/plugins/fontawesome.d.ts +0 -3
- package/dist/runtime/plugins/fontawesome.js +7 -7
- package/dist/runtime/plugins/formkit.d.ts +0 -3
- package/dist/runtime/plugins/formkit.js +5 -5
- package/dist/runtime/plugins/lightgallery.d.ts +0 -6
- package/dist/runtime/plugins/lightgallery.js +20 -14
- package/dist/runtime/plugins/motion.d.ts +0 -2
- package/dist/runtime/plugins/motion.js +3 -3
- package/dist/runtime/plugins/theme-switcher.d.ts +0 -2
- package/dist/runtime/plugins/theme-switcher.js +22 -25
- package/dist/runtime/plugins/theme.d.ts +0 -2
- package/dist/runtime/plugins/theme.js +46 -32
- package/dist/runtime/plugins/vuetify.d.ts +0 -3
- package/dist/runtime/plugins/vuetify.js +30 -30
- package/dist/runtime/search/client.d.ts +0 -2
- package/dist/runtime/search/client.js +12 -19
- package/dist/runtime/search/plugin.d.ts +0 -2
- package/dist/runtime/search/plugin.js +5 -5
- package/dist/runtime/styles/index.css +93 -0
- package/dist/runtime/styles/tailwind.css +1 -1
- package/package.json +3 -4
- package/dist/adapters/adapter-directus/src/types/ui.d.ts +0 -21
- package/dist/adapters/adapter-directus/src/types/ui.js +0 -1
- package/dist/module.d.ts +0 -6
- package/dist/module.js +0 -68
- package/dist/modules/ui/src/module.d.ts +0 -8
- package/dist/modules/ui/src/module.js +0 -75
- package/dist/modules/ui/src/runtime/composables/useMToast.d.ts +0 -5
- package/dist/modules/ui/src/runtime/composables/useMToast.js +0 -11
- package/dist/modules/ui/src/runtime/design/tokens.d.ts +0 -22
- package/dist/modules/ui/src/runtime/design/tokens.js +0 -22
- package/dist/modules/ui/src/runtime/plugins/builder.d.ts +0 -3
- package/dist/modules/ui/src/runtime/plugins/builder.js +0 -311
- package/dist/modules/ui/src/runtime/plugins/fontawesome.d.ts +0 -3
- package/dist/modules/ui/src/runtime/plugins/fontawesome.js +0 -9
- package/dist/modules/ui/src/runtime/plugins/formkit.d.ts +0 -3
- package/dist/modules/ui/src/runtime/plugins/formkit.js +0 -8
- package/dist/modules/ui/src/runtime/plugins/motion.d.ts +0 -2
- package/dist/modules/ui/src/runtime/plugins/motion.js +0 -5
- package/dist/modules/ui/src/runtime/plugins/theme-switcher.d.ts +0 -2
- package/dist/modules/ui/src/runtime/plugins/theme-switcher.js +0 -27
- package/dist/modules/ui/src/runtime/plugins/theme.d.ts +0 -2
- package/dist/modules/ui/src/runtime/plugins/theme.js +0 -44
- package/dist/modules/ui/src/runtime/plugins/vuetify.d.ts +0 -3
- package/dist/modules/ui/src/runtime/plugins/vuetify.js +0 -33
- package/dist/modules/ui/src/runtime/search/client.d.ts +0 -2
- package/dist/modules/ui/src/runtime/search/client.js +0 -21
- package/dist/modules/ui/src/runtime/search/plugin.d.ts +0 -2
- package/dist/modules/ui/src/runtime/search/plugin.js +0 -7
- package/dist/modules/ui/src/utils/color.d.ts +0 -2
- package/dist/modules/ui/src/utils/color.js +0 -11
- package/dist/modules/ui/src/utils/fonts.d.ts +0 -5
- package/dist/modules/ui/src/utils/fonts.js +0 -18
- package/dist/modules/ui/src/utils/formkit.d.ts +0 -12
- package/dist/modules/ui/src/utils/formkit.js +0 -59
- package/dist/modules/ui/src/utils/icons.d.ts +0 -4
- package/dist/modules/ui/src/utils/icons.js +0 -36
- package/dist/runtime/plugins/icon-switcher.d.ts +0 -2
- package/dist/runtime/plugins/icon-switcher.js +0 -24
- package/dist/types/ui/api/global-search.d.ts +0 -8
- package/dist/types/ui/api/global-search.js +0 -1
- package/dist/types/ui/blocks/block-button-group.d.ts +0 -6
- package/dist/types/ui/blocks/block-button-group.js +0 -1
- package/dist/types/ui/blocks/block-button.d.ts +0 -13
- package/dist/types/ui/blocks/block-button.js +0 -1
- package/dist/types/ui/blocks/block-column.d.ts +0 -18
- package/dist/types/ui/blocks/block-column.js +0 -1
- package/dist/types/ui/blocks/block-cta.d.ts +0 -11
- package/dist/types/ui/blocks/block-cta.js +0 -1
- package/dist/types/ui/blocks/block-divider.d.ts +0 -4
- package/dist/types/ui/blocks/block-divider.js +0 -1
- package/dist/types/ui/blocks/block-faq.d.ts +0 -11
- package/dist/types/ui/blocks/block-faq.js +0 -1
- package/dist/types/ui/blocks/block-form.d.ts +0 -7
- package/dist/types/ui/blocks/block-form.js +0 -1
- package/dist/types/ui/blocks/block-gallery.d.ts +0 -13
- package/dist/types/ui/blocks/block-gallery.js +0 -1
- package/dist/types/ui/blocks/block-hero.d.ts +0 -11
- package/dist/types/ui/blocks/block-hero.js +0 -1
- package/dist/types/ui/blocks/block-html.d.ts +0 -4
- package/dist/types/ui/blocks/block-html.js +0 -1
- package/dist/types/ui/blocks/block-logocloud.d.ts +0 -13
- package/dist/types/ui/blocks/block-logocloud.js +0 -1
- package/dist/types/ui/blocks/block-quote.d.ts +0 -10
- package/dist/types/ui/blocks/block-quote.js +0 -1
- package/dist/types/ui/blocks/block-richtext.d.ts +0 -7
- package/dist/types/ui/blocks/block-richtext.js +0 -1
- package/dist/types/ui/blocks/block-steps.d.ts +0 -21
- package/dist/types/ui/blocks/block-steps.js +0 -1
- package/dist/types/ui/blocks/block-team.d.ts +0 -6
- package/dist/types/ui/blocks/block-team.js +0 -1
- package/dist/types/ui/blocks/block-testimonial.d.ts +0 -13
- package/dist/types/ui/blocks/block-testimonial.js +0 -1
- package/dist/types/ui/blocks/block-video.d.ts +0 -9
- package/dist/types/ui/blocks/block-video.js +0 -1
- package/dist/types/ui/blocks/block.d.ts +0 -17
- package/dist/types/ui/blocks/block.js +0 -1
- package/dist/types/ui/blocks/index.d.ts +0 -18
- package/dist/types/ui/blocks/index.js +0 -1
- package/dist/types/ui/component.d.ts +0 -6
- package/dist/types/ui/component.js +0 -1
- package/dist/types/ui/content/category.d.ts +0 -10
- package/dist/types/ui/content/category.js +0 -1
- package/dist/types/ui/content/form.d.ts +0 -21
- package/dist/types/ui/content/form.js +0 -1
- package/dist/types/ui/content/index.d.ts +0 -6
- package/dist/types/ui/content/index.js +0 -1
- package/dist/types/ui/content/page.d.ts +0 -38
- package/dist/types/ui/content/page.js +0 -1
- package/dist/types/ui/content/post.d.ts +0 -38
- package/dist/types/ui/content/post.js +0 -1
- package/dist/types/ui/content/team.d.ts +0 -17
- package/dist/types/ui/content/team.js +0 -1
- package/dist/types/ui/content/testimonial.d.ts +0 -18
- package/dist/types/ui/content/testimonial.js +0 -1
- package/dist/types/ui/form.d.ts +0 -12
- package/dist/types/ui/form.js +0 -1
- package/dist/types/ui/help/index.d.ts +0 -51
- package/dist/types/ui/help/index.js +0 -1
- package/dist/types/ui/meta/analytics.d.ts +0 -21
- package/dist/types/ui/meta/analytics.js +0 -1
- package/dist/types/ui/meta/config.d.ts +0 -22
- package/dist/types/ui/meta/config.js +0 -1
- package/dist/types/ui/meta/globals.d.ts +0 -33
- package/dist/types/ui/meta/globals.js +0 -1
- package/dist/types/ui/meta/index.d.ts +0 -6
- package/dist/types/ui/meta/index.js +0 -1
- package/dist/types/ui/meta/navigation.d.ts +0 -31
- package/dist/types/ui/meta/navigation.js +0 -1
- package/dist/types/ui/meta/redirect.d.ts +0 -12
- package/dist/types/ui/meta/redirect.js +0 -1
- package/dist/types/ui/meta/seo.d.ts +0 -19
- package/dist/types/ui/meta/seo.js +0 -1
- package/dist/types/ui/os/contact.d.ts +0 -22
- package/dist/types/ui/os/contact.js +0 -1
- package/dist/types/ui/os/conversation.d.ts +0 -23
- package/dist/types/ui/os/conversation.js +0 -1
- package/dist/types/ui/os/index.d.ts +0 -16
- package/dist/types/ui/os/index.js +0 -1
- package/dist/types/ui/os/organization.d.ts +0 -51
- package/dist/types/ui/os/organization.js +0 -1
- package/dist/types/ui/os/os-activity.d.ts +0 -26
- package/dist/types/ui/os/os-activity.js +0 -1
- package/dist/types/ui/os/os-deal.d.ts +0 -42
- package/dist/types/ui/os/os-deal.js +0 -1
- package/dist/types/ui/os/os-expense.d.ts +0 -21
- package/dist/types/ui/os/os-expense.js +0 -1
- package/dist/types/ui/os/os-invoice.d.ts +0 -46
- package/dist/types/ui/os/os-invoice.js +0 -1
- package/dist/types/ui/os/os-item.d.ts +0 -17
- package/dist/types/ui/os/os-item.js +0 -1
- package/dist/types/ui/os/os-payment.d.ts +0 -27
- package/dist/types/ui/os/os-payment.js +0 -1
- package/dist/types/ui/os/os-project.d.ts +0 -45
- package/dist/types/ui/os/os-project.js +0 -1
- package/dist/types/ui/os/os-proposal.d.ts +0 -61
- package/dist/types/ui/os/os-proposal.js +0 -1
- package/dist/types/ui/os/os-settings.d.ts +0 -17
- package/dist/types/ui/os/os-settings.js +0 -1
- package/dist/types/ui/os/os-subscription.d.ts +0 -12
- package/dist/types/ui/os/os-subscription.js +0 -1
- package/dist/types/ui/os/os-task.d.ts +0 -32
- package/dist/types/ui/os/os-task.js +0 -1
- package/dist/types/ui/os/os-tax-rate.d.ts +0 -12
- package/dist/types/ui/os/os-tax-rate.js +0 -1
- package/dist/types/ui/pageComponentMap.d.ts +0 -2
- package/dist/types/ui/pageComponentMap.js +0 -7
- package/dist/types/ui/pagination.d.ts +0 -6
- package/dist/types/ui/pagination.js +0 -1
- package/dist/types/ui/schema.d.ts +0 -78
- package/dist/types/ui/schema.js +0 -1
- package/dist/types/ui/state.d.ts +0 -5
- package/dist/types/ui/state.js +0 -1
- package/dist/types/ui/system/file.d.ts +0 -47
- package/dist/types/ui/system/file.js +0 -1
- package/dist/types/ui/system/folder.d.ts +0 -8
- package/dist/types/ui/system/folder.js +0 -1
- package/dist/types/ui/system/index.d.ts +0 -4
- package/dist/types/ui/system/index.js +0 -1
- package/dist/types/ui/system/role.d.ts +0 -20
- package/dist/types/ui/system/role.js +0 -1
- package/dist/types/ui/system/user.d.ts +0 -57
- package/dist/types/ui/system/user.js +0 -1
- package/dist/types/ui.d.ts +0 -21
- package/dist/types/ui.js +0 -1
- package/dist/utils/color.d.ts +0 -2
- package/dist/utils/color.js +0 -11
- package/dist/utils/fonts.d.ts +0 -5
- package/dist/utils/fonts.js +0 -18
- package/dist/utils/formkit.d.ts +0 -12
- package/dist/utils/formkit.js +0 -59
- package/dist/utils/icons.d.ts +0 -4
- package/dist/utils/icons.js +0 -36
- package/src/module.ts +0 -105
- package/src/runtime/assets/config/tailwind.conifg.js +0 -42
- package/src/runtime/components/MButton.vue +0 -17
- package/src/runtime/composables/useMToast.ts +0 -14
- package/src/runtime/design/tokens.ts +0 -22
- package/src/runtime/plugins/builder.ts +0 -326
- package/src/runtime/plugins/fontawesome.ts +0 -11
- package/src/runtime/plugins/formkit.ts +0 -9
- package/src/runtime/plugins/lightgallery.js +0 -21
- package/src/runtime/plugins/motion.ts +0 -6
- package/src/runtime/plugins/theme-switcher.ts +0 -32
- package/src/runtime/plugins/theme.ts +0 -57
- package/src/runtime/plugins/vuetify.ts +0 -36
- package/src/runtime/search/client.ts +0 -25
- package/src/runtime/search/components/MSearch.vue +0 -19
- package/src/runtime/search/plugin.ts +0 -9
- package/src/runtime/styles/index.scss +0 -101
- package/src/runtime/styles/tailwind.css +0 -9
- package/src/runtime/styles/vuetify.scss +0 -5
- package/src/types/runtime-config.d.ts +0 -12
- package/src/utils/color.js +0 -11
- package/src/utils/color.ts +0 -14
- package/src/utils/fonts.js +0 -18
- package/src/utils/fonts.ts +0 -24
- package/src/utils/formkit.js +0 -59
- package/src/utils/formkit.ts +0 -75
- package/src/utils/icons.js +0 -36
- package/src/utils/icons.ts +0 -62
|
@@ -1,311 +1,336 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
defineNuxtPlugin
|
|
3
|
+
} from "nuxt/app";
|
|
4
|
+
import "grapesjs/dist/css/grapes.min.css";
|
|
5
|
+
import grapesjs from "grapesjs";
|
|
4
6
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
components: [{
|
|
61
|
-
tagName: 'span',
|
|
62
|
-
content: '<b>Some static content</b>',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
tagName: 'div',
|
|
66
|
-
// use `content` for static strings, `components` string will be parsed
|
|
67
|
-
// and transformed in Components
|
|
68
|
-
components: '<span>HTML at some point</span>',
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: 'text',
|
|
75
|
-
label: 'Text',
|
|
76
|
-
content: '<div data-gjs-type="text">Insert your text here</div>',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: 'image',
|
|
80
|
-
label: 'Image',
|
|
81
|
-
// Select the component once it's dropped
|
|
82
|
-
select: true,
|
|
83
|
-
// You can pass components as a JSON instead of a simple HTML string,
|
|
84
|
-
// in this case we also use a defined component type `image`
|
|
85
|
-
content: {
|
|
86
|
-
type: 'image'
|
|
87
|
-
},
|
|
88
|
-
// This triggers `active` event on dropped components and the `image`
|
|
89
|
-
// reacts by opening the AssetManager
|
|
90
|
-
activate: true,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
},
|
|
94
|
-
panels: {
|
|
95
|
-
defaults: [{
|
|
96
|
-
id: 'layers',
|
|
97
|
-
el: '.panel__right',
|
|
98
|
-
// Make the panel resizable
|
|
99
|
-
resizable: {
|
|
100
|
-
maxDim: 350,
|
|
101
|
-
minDim: 200,
|
|
102
|
-
tc: false, // Top handler
|
|
103
|
-
cl: true, // Left handler
|
|
104
|
-
cr: false, // Right handler
|
|
105
|
-
bc: false, // Bottom handler
|
|
106
|
-
// Being a flex child we need to change `flex-basis` property
|
|
107
|
-
// instead of the `width` (default)
|
|
108
|
-
keyWidth: 'flex-basis',
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
id: 'panel-switcher',
|
|
113
|
-
el: '.panel__switcher',
|
|
114
|
-
buttons: [{
|
|
115
|
-
id: 'show-layers',
|
|
116
|
-
active: true,
|
|
117
|
-
label: 'Layers',
|
|
118
|
-
command: 'show-layers',
|
|
119
|
-
// Once activated disable the possibility to turn it off
|
|
120
|
-
togglable: false,
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 'show-style',
|
|
124
|
-
active: true,
|
|
125
|
-
label: 'Styles',
|
|
126
|
-
command: 'show-styles',
|
|
127
|
-
togglable: false,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: 'show-traits',
|
|
131
|
-
active: true,
|
|
132
|
-
label: 'Traits',
|
|
133
|
-
command: 'show-traits',
|
|
134
|
-
togglable: false,
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: 'panel-devices',
|
|
140
|
-
el: '.panel__devices',
|
|
141
|
-
buttons: [{
|
|
142
|
-
id: 'device-desktop',
|
|
143
|
-
label: 'D',
|
|
144
|
-
command: 'set-device-desktop',
|
|
145
|
-
active: true,
|
|
146
|
-
togglable: false,
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
id: 'device-mobile',
|
|
150
|
-
label: 'M',
|
|
151
|
-
command: 'set-device-mobile',
|
|
152
|
-
togglable: false,
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
},
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
// The Selector Manager allows to assign classes and
|
|
159
|
-
// different states (eg. :hover) on components.
|
|
160
|
-
// Generally, it's used in conjunction with Style Manager
|
|
161
|
-
// but it's not mandatory
|
|
162
|
-
selectorManager: {
|
|
163
|
-
appendTo: '.styles-container',
|
|
164
|
-
},
|
|
165
|
-
styleManager: {
|
|
166
|
-
appendTo: '.styles-container',
|
|
167
|
-
sectors: [{
|
|
168
|
-
name: 'Dimension',
|
|
169
|
-
open: false,
|
|
170
|
-
// Use built-in properties
|
|
171
|
-
buildProps: ['width', 'min-height', 'padding'],
|
|
172
|
-
// Use `properties` to define/override single property
|
|
173
|
-
properties: [{
|
|
174
|
-
// Type of the input,
|
|
175
|
-
// options: integer | radio | select | color | slider | file | composite | stack
|
|
176
|
-
type: 'integer',
|
|
177
|
-
name: 'The width', // Label for the property
|
|
178
|
-
property: 'width', // CSS property (if buildProps contains it will be extended)
|
|
179
|
-
units: ['px', '%'], // Units, available only for 'integer' types
|
|
180
|
-
defaults: 'auto', // Default value
|
|
181
|
-
min: 0, // Min value, available only for 'integer' types
|
|
182
|
-
},],
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
name: 'Extra',
|
|
186
|
-
open: false,
|
|
187
|
-
buildProps: ['background-color', 'box-shadow', 'custom-prop'],
|
|
188
|
-
properties: [{
|
|
189
|
-
id: 'custom-prop',
|
|
190
|
-
name: 'Custom Label',
|
|
191
|
-
property: 'font-size',
|
|
192
|
-
type: 'select',
|
|
193
|
-
defaults: '32px',
|
|
194
|
-
// List of options, available only for 'select' and 'radio' types
|
|
195
|
-
options: [{
|
|
196
|
-
id: 'tiny',
|
|
197
|
-
value: '12px',
|
|
198
|
-
name: 'Tiny'
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
id: 'medium',
|
|
202
|
-
value: '18px',
|
|
203
|
-
name: 'Medium'
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
id: 'big',
|
|
207
|
-
value: '32px',
|
|
208
|
-
name: 'Big'
|
|
209
|
-
},
|
|
210
|
-
],
|
|
211
|
-
},],
|
|
212
|
-
},
|
|
213
|
-
],
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
// Define commands
|
|
217
|
-
editor.Commands.add('show-layers', {
|
|
218
|
-
getRowEl(editor) {
|
|
219
|
-
return editor.getContainer().closest('.editor-row');
|
|
220
|
-
},
|
|
221
|
-
getLayersEl(row) {
|
|
222
|
-
return row.querySelector('.layers-container');
|
|
223
|
-
},
|
|
224
|
-
run(editor, sender) {
|
|
225
|
-
const lmEl = this.getLayersEl(this.getRowEl(editor));
|
|
226
|
-
lmEl.style.display = '';
|
|
227
|
-
},
|
|
228
|
-
stop(editor, sender) {
|
|
229
|
-
const lmEl = this.getLayersEl(this.getRowEl(editor));
|
|
230
|
-
lmEl.style.display = 'none';
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
|
-
editor.Commands.add('show-styles', {
|
|
234
|
-
getRowEl(editor) {
|
|
235
|
-
return editor.getContainer().closest('.editor-row');
|
|
7
|
+
if (process.server) return;
|
|
8
|
+
const mount = () => {
|
|
9
|
+
const el = document.querySelector("#gjs");
|
|
10
|
+
if (!el) return null;
|
|
11
|
+
const editor = grapesjs.init({
|
|
12
|
+
container: `${el}`,
|
|
13
|
+
fromElement: true,
|
|
14
|
+
height: "100%",
|
|
15
|
+
width: "auto",
|
|
16
|
+
storageManager: {
|
|
17
|
+
type: "local",
|
|
18
|
+
autosave: true,
|
|
19
|
+
autoload: true,
|
|
20
|
+
stepsBeforeSave: 1,
|
|
21
|
+
options: {
|
|
22
|
+
local: {
|
|
23
|
+
key: "gjsProject"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
// Avoid any default panel
|
|
28
|
+
layerManager: {
|
|
29
|
+
appendTo: ".layers-container"
|
|
30
|
+
},
|
|
31
|
+
mediaCondition: "min-width",
|
|
32
|
+
// default is `max-width`
|
|
33
|
+
deviceManager: {
|
|
34
|
+
devices: [
|
|
35
|
+
{
|
|
36
|
+
name: "Desktop",
|
|
37
|
+
width: "",
|
|
38
|
+
// default size
|
|
39
|
+
widthMedia: "1024px"
|
|
40
|
+
// this value will be used in CSS @media
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "Mobile",
|
|
44
|
+
width: "320px",
|
|
45
|
+
// this value will be used on canvas width
|
|
46
|
+
widthMedia: "480px"
|
|
47
|
+
// this value will be used in CSS @media
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
blockManager: {
|
|
52
|
+
appendTo: "#blocks",
|
|
53
|
+
blocks: [
|
|
54
|
+
{
|
|
55
|
+
id: "section",
|
|
56
|
+
// id is mandatory
|
|
57
|
+
label: "<b>Section</b>",
|
|
58
|
+
// You can use HTML/SVG inside labels
|
|
59
|
+
category: "Basic",
|
|
60
|
+
attributes: {
|
|
61
|
+
class: "gjs-block-section"
|
|
236
62
|
},
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
},
|
|
248
|
-
});
|
|
249
|
-
editor.Commands.add('show-traits', {
|
|
250
|
-
getTraitsEl(editor) {
|
|
251
|
-
const row = editor.getContainer().closest('.editor-row');
|
|
252
|
-
return row.querySelector('.traits-container');
|
|
253
|
-
},
|
|
254
|
-
run(editor, sender) {
|
|
255
|
-
this.getTraitsEl(editor).style.display = '';
|
|
256
|
-
},
|
|
257
|
-
stop(editor, sender) {
|
|
258
|
-
this.getTraitsEl(editor).style.display = 'none';
|
|
259
|
-
},
|
|
260
|
-
});
|
|
261
|
-
editor.Panels.addPanel({
|
|
262
|
-
id: 'panel-top',
|
|
263
|
-
el: '.panel__top',
|
|
264
|
-
});
|
|
265
|
-
editor.Panels.addPanel({
|
|
266
|
-
id: 'basic-actions',
|
|
267
|
-
el: '.panel__basic-actions',
|
|
268
|
-
buttons: [{
|
|
269
|
-
id: 'visibility',
|
|
270
|
-
active: true, // active by default
|
|
271
|
-
className: 'btn-toggle-borders',
|
|
272
|
-
label: '<u>B</u>',
|
|
273
|
-
command: 'sw-visibility', // Built-in command
|
|
63
|
+
content: {
|
|
64
|
+
tagName: "div",
|
|
65
|
+
draggable: false,
|
|
66
|
+
attributes: {
|
|
67
|
+
"some-attribute": "some-value"
|
|
68
|
+
},
|
|
69
|
+
components: [
|
|
70
|
+
{
|
|
71
|
+
tagName: "span",
|
|
72
|
+
content: "<b>Some static content</b>"
|
|
274
73
|
},
|
|
275
74
|
{
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
75
|
+
tagName: "div",
|
|
76
|
+
// use `content` for static strings, `components` string will be parsed
|
|
77
|
+
// and transformed in Components
|
|
78
|
+
components: "<span>HTML at some point</span>"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "text",
|
|
85
|
+
label: "Text",
|
|
86
|
+
content: '<div data-gjs-type="text">Insert your text here</div>'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "image",
|
|
90
|
+
label: "Image",
|
|
91
|
+
// Select the component once it's dropped
|
|
92
|
+
select: true,
|
|
93
|
+
// You can pass components as a JSON instead of a simple HTML string,
|
|
94
|
+
// in this case we also use a defined component type `image`
|
|
95
|
+
content: {
|
|
96
|
+
type: "image"
|
|
97
|
+
},
|
|
98
|
+
// This triggers `active` event on dropped components and the `image`
|
|
99
|
+
// reacts by opening the AssetManager
|
|
100
|
+
activate: true
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
panels: {
|
|
105
|
+
defaults: [
|
|
106
|
+
{
|
|
107
|
+
id: "layers",
|
|
108
|
+
el: ".panel__right",
|
|
109
|
+
// Make the panel resizable
|
|
110
|
+
resizable: {
|
|
111
|
+
maxDim: 350,
|
|
112
|
+
minDim: 200,
|
|
113
|
+
tc: false,
|
|
114
|
+
// Top handler
|
|
115
|
+
cl: true,
|
|
116
|
+
// Left handler
|
|
117
|
+
cr: false,
|
|
118
|
+
// Right handler
|
|
119
|
+
bc: false,
|
|
120
|
+
// Bottom handler
|
|
121
|
+
// Being a flex child we need to change `flex-basis` property
|
|
122
|
+
// instead of the `width` (default)
|
|
123
|
+
keyWidth: "flex-basis"
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "panel-switcher",
|
|
128
|
+
el: ".panel__switcher",
|
|
129
|
+
buttons: [
|
|
130
|
+
{
|
|
131
|
+
id: "show-layers",
|
|
132
|
+
active: true,
|
|
133
|
+
label: "Layers",
|
|
134
|
+
command: "show-layers",
|
|
135
|
+
// Once activated disable the possibility to turn it off
|
|
136
|
+
togglable: false
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "show-style",
|
|
140
|
+
active: true,
|
|
141
|
+
label: "Styles",
|
|
142
|
+
command: "show-styles",
|
|
143
|
+
togglable: false
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "show-traits",
|
|
147
|
+
active: true,
|
|
148
|
+
label: "Traits",
|
|
149
|
+
command: "show-traits",
|
|
150
|
+
togglable: false
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "panel-devices",
|
|
156
|
+
el: ".panel__devices",
|
|
157
|
+
buttons: [
|
|
158
|
+
{
|
|
159
|
+
id: "device-desktop",
|
|
160
|
+
label: "D",
|
|
161
|
+
command: "set-device-desktop",
|
|
162
|
+
active: true,
|
|
163
|
+
togglable: false
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "device-mobile",
|
|
167
|
+
label: "M",
|
|
168
|
+
command: "set-device-mobile",
|
|
169
|
+
togglable: false
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
// The Selector Manager allows to assign classes and
|
|
176
|
+
// different states (eg. :hover) on components.
|
|
177
|
+
// Generally, it's used in conjunction with Style Manager
|
|
178
|
+
// but it's not mandatory
|
|
179
|
+
selectorManager: {
|
|
180
|
+
appendTo: ".styles-container"
|
|
181
|
+
},
|
|
182
|
+
styleManager: {
|
|
183
|
+
appendTo: ".styles-container",
|
|
184
|
+
sectors: [
|
|
185
|
+
{
|
|
186
|
+
name: "Dimension",
|
|
187
|
+
open: false,
|
|
188
|
+
// Use built-in properties
|
|
189
|
+
buildProps: ["width", "min-height", "padding"],
|
|
190
|
+
// Use `properties` to define/override single property
|
|
191
|
+
properties: [{
|
|
192
|
+
// Type of the input,
|
|
193
|
+
// options: integer | radio | select | color | slider | file | composite | stack
|
|
194
|
+
type: "integer",
|
|
195
|
+
name: "The width",
|
|
196
|
+
// Label for the property
|
|
197
|
+
property: "width",
|
|
198
|
+
// CSS property (if buildProps contains it will be extended)
|
|
199
|
+
units: ["px", "%"],
|
|
200
|
+
// Units, available only for 'integer' types
|
|
201
|
+
defaults: "auto",
|
|
202
|
+
// Default value
|
|
203
|
+
min: 0
|
|
204
|
+
// Min value, available only for 'integer' types
|
|
205
|
+
}]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "Extra",
|
|
209
|
+
open: false,
|
|
210
|
+
buildProps: ["background-color", "box-shadow", "custom-prop"],
|
|
211
|
+
properties: [{
|
|
212
|
+
id: "custom-prop",
|
|
213
|
+
name: "Custom Label",
|
|
214
|
+
property: "font-size",
|
|
215
|
+
type: "select",
|
|
216
|
+
defaults: "32px",
|
|
217
|
+
// List of options, available only for 'select' and 'radio' types
|
|
218
|
+
options: [
|
|
219
|
+
{
|
|
220
|
+
id: "tiny",
|
|
221
|
+
value: "12px",
|
|
222
|
+
name: "Tiny"
|
|
281
223
|
},
|
|
282
224
|
{
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
context: 'show-json',
|
|
287
|
-
command(editor) {
|
|
288
|
-
editor.Modal.setTitle('Components JSON')
|
|
289
|
-
.setContent(`<textarea style="width:100%; height: 250px;">
|
|
290
|
-
${JSON.stringify(editor.getComponents())}
|
|
291
|
-
</textarea>`)
|
|
292
|
-
.open();
|
|
293
|
-
},
|
|
225
|
+
id: "medium",
|
|
226
|
+
value: "18px",
|
|
227
|
+
name: "Medium"
|
|
294
228
|
},
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
229
|
+
{
|
|
230
|
+
id: "big",
|
|
231
|
+
value: "32px",
|
|
232
|
+
name: "Big"
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}]
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
editor.Commands.add("show-layers", {
|
|
241
|
+
getRowEl(editor2) {
|
|
242
|
+
return editor2.getContainer().closest(".editor-row");
|
|
243
|
+
},
|
|
244
|
+
getLayersEl(row) {
|
|
245
|
+
return row.querySelector(".layers-container");
|
|
246
|
+
},
|
|
247
|
+
run(editor2, sender) {
|
|
248
|
+
const lmEl = this.getLayersEl(this.getRowEl(editor2));
|
|
249
|
+
lmEl.style.display = "";
|
|
250
|
+
},
|
|
251
|
+
stop(editor2, sender) {
|
|
252
|
+
const lmEl = this.getLayersEl(this.getRowEl(editor2));
|
|
253
|
+
lmEl.style.display = "none";
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
editor.Commands.add("show-styles", {
|
|
257
|
+
getRowEl(editor2) {
|
|
258
|
+
return editor2.getContainer().closest(".editor-row");
|
|
259
|
+
},
|
|
260
|
+
getStyleEl(row) {
|
|
261
|
+
return row.querySelector(".styles-container");
|
|
262
|
+
},
|
|
263
|
+
run(editor2, sender) {
|
|
264
|
+
const smEl = this.getStyleEl(this.getRowEl(editor2));
|
|
265
|
+
smEl.style.display = "";
|
|
266
|
+
},
|
|
267
|
+
stop(editor2, sender) {
|
|
268
|
+
const smEl = this.getStyleEl(this.getRowEl(editor2));
|
|
269
|
+
smEl.style.display = "none";
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
editor.Commands.add("show-traits", {
|
|
273
|
+
getTraitsEl(editor2) {
|
|
274
|
+
const row = editor2.getContainer().closest(".editor-row");
|
|
275
|
+
return row.querySelector(".traits-container");
|
|
276
|
+
},
|
|
277
|
+
run(editor2, sender) {
|
|
278
|
+
this.getTraitsEl(editor2).style.display = "";
|
|
279
|
+
},
|
|
280
|
+
stop(editor2, sender) {
|
|
281
|
+
this.getTraitsEl(editor2).style.display = "none";
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
editor.Panels.addPanel({
|
|
285
|
+
id: "panel-top",
|
|
286
|
+
el: ".panel__top"
|
|
287
|
+
});
|
|
288
|
+
editor.Panels.addPanel({
|
|
289
|
+
id: "basic-actions",
|
|
290
|
+
el: ".panel__basic-actions",
|
|
291
|
+
buttons: [
|
|
292
|
+
{
|
|
293
|
+
id: "visibility",
|
|
294
|
+
active: true,
|
|
295
|
+
// active by default
|
|
296
|
+
className: "btn-toggle-borders",
|
|
297
|
+
label: "<u>B</u>",
|
|
298
|
+
command: "sw-visibility"
|
|
299
|
+
// Built-in command
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
id: "export",
|
|
303
|
+
className: "btn-open-export",
|
|
304
|
+
label: "Exp",
|
|
305
|
+
command: "export-template",
|
|
306
|
+
context: "export-template"
|
|
307
|
+
// For grouping context of buttons from the same panel
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
id: "show-json",
|
|
311
|
+
className: "btn-show-json",
|
|
312
|
+
label: "JSON",
|
|
313
|
+
context: "show-json",
|
|
314
|
+
command(editor2) {
|
|
315
|
+
editor2.Modal.setTitle("Components JSON").setContent(
|
|
316
|
+
`<textarea style="width:100%; height: 250px;">
|
|
317
|
+
${JSON.stringify(editor2.getComponents())}
|
|
318
|
+
</textarea>`
|
|
319
|
+
).open();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
]
|
|
323
|
+
});
|
|
324
|
+
editor.Commands.add("set-device-desktop", {
|
|
325
|
+
run: (editor2) => editor2.setDevice("Desktop")
|
|
326
|
+
});
|
|
327
|
+
editor.Commands.add("set-device-mobile", {
|
|
328
|
+
run: (editor2) => editor2.setDevice("Mobile")
|
|
329
|
+
});
|
|
330
|
+
editor.on("change:device", () => console.log("Current device: ", editor.getDevice()));
|
|
331
|
+
editor.setDevice("Mobile");
|
|
332
|
+
nuxtApp.provide("grapesStudio", editor);
|
|
333
|
+
return editor;
|
|
334
|
+
};
|
|
335
|
+
window.addEventListener("DOMContentLoaded", mount);
|
|
311
336
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineNuxtPlugin } from
|
|
2
|
-
import { library } from
|
|
3
|
-
import { FontAwesomeIcon } from
|
|
4
|
-
import { fas } from
|
|
5
|
-
import
|
|
1
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
2
|
+
import { library } from "@fortawesome/fontawesome-svg-core";
|
|
3
|
+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
4
|
+
import { fas } from "@fortawesome/free-solid-svg-icons";
|
|
5
|
+
import "@fortawesome/fontawesome-free/css/all.min.css";
|
|
6
6
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
library.add(fas);
|
|
8
|
+
nuxtApp.vueApp.component("Fa", FontAwesomeIcon);
|
|
9
9
|
});
|