@mframework/ui 0.1.0-beta.0 → 0.1.0-beta.1
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/adapters/adapter-directus/src/types/ui.d.ts +21 -0
- package/dist/adapters/adapter-directus/src/types/ui.js +1 -0
- package/dist/module.d.mts +9 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.js +68 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +38 -0
- package/dist/modules/ui/src/module.d.ts +8 -0
- package/dist/modules/ui/src/module.js +75 -0
- package/dist/modules/ui/src/runtime/composables/useMToast.d.ts +5 -0
- package/dist/modules/ui/src/runtime/composables/useMToast.js +11 -0
- package/dist/modules/ui/src/runtime/design/tokens.d.ts +22 -0
- package/dist/modules/ui/src/runtime/design/tokens.js +22 -0
- package/dist/modules/ui/src/runtime/plugins/builder.d.ts +3 -0
- package/dist/modules/ui/src/runtime/plugins/builder.js +311 -0
- package/dist/modules/ui/src/runtime/plugins/fontawesome.d.ts +3 -0
- package/dist/modules/ui/src/runtime/plugins/fontawesome.js +9 -0
- package/dist/modules/ui/src/runtime/plugins/formkit.d.ts +3 -0
- package/dist/modules/ui/src/runtime/plugins/formkit.js +8 -0
- package/dist/modules/ui/src/runtime/plugins/motion.d.ts +2 -0
- package/dist/modules/ui/src/runtime/plugins/motion.js +5 -0
- package/dist/modules/ui/src/runtime/plugins/theme-switcher.d.ts +2 -0
- package/dist/modules/ui/src/runtime/plugins/theme-switcher.js +27 -0
- package/dist/modules/ui/src/runtime/plugins/theme.d.ts +2 -0
- package/dist/modules/ui/src/runtime/plugins/theme.js +44 -0
- package/dist/modules/ui/src/runtime/plugins/vuetify.d.ts +3 -0
- package/dist/modules/ui/src/runtime/plugins/vuetify.js +33 -0
- package/dist/modules/ui/src/runtime/search/client.d.ts +2 -0
- package/dist/modules/ui/src/runtime/search/client.js +21 -0
- package/dist/modules/ui/src/runtime/search/plugin.d.ts +2 -0
- package/dist/modules/ui/src/runtime/search/plugin.js +7 -0
- package/dist/modules/ui/src/utils/color.d.ts +2 -0
- package/dist/modules/ui/src/utils/color.js +11 -0
- package/dist/modules/ui/src/utils/fonts.d.ts +5 -0
- package/dist/modules/ui/src/utils/fonts.js +18 -0
- package/dist/modules/ui/src/utils/formkit.d.ts +12 -0
- package/dist/modules/ui/src/utils/formkit.js +59 -0
- package/dist/modules/ui/src/utils/icons.d.ts +4 -0
- package/dist/modules/ui/src/utils/icons.js +36 -0
- package/dist/runtime/assets/config/tailwind.conifg.d.ts +0 -0
- package/dist/runtime/assets/config/tailwind.conifg.js +11 -0
- package/dist/runtime/components/MButton.d.vue.ts +0 -0
- package/dist/runtime/components/MButton.vue +15 -0
- package/dist/runtime/components/MButton.vue.d.ts +0 -0
- package/dist/runtime/composables/useMToast.d.ts +5 -0
- package/dist/runtime/composables/useMToast.js +11 -0
- package/dist/runtime/plugins/builder.d.ts +3 -0
- package/dist/runtime/plugins/builder.js +311 -0
- package/dist/runtime/plugins/fontawesome.d.ts +3 -0
- package/dist/runtime/plugins/fontawesome.js +9 -0
- package/dist/runtime/plugins/formkit.d.ts +3 -0
- package/dist/runtime/plugins/formkit.js +8 -0
- package/dist/runtime/plugins/icon-switcher.d.ts +1 -1
- package/dist/runtime/plugins/icon-switcher.js +15 -9
- package/dist/runtime/plugins/lightgallery.d.ts +6 -0
- package/dist/runtime/plugins/lightgallery.js +15 -0
- package/dist/runtime/plugins/motion.d.ts +2 -0
- package/dist/runtime/plugins/motion.js +5 -0
- package/dist/runtime/plugins/theme-switcher.d.ts +2 -0
- package/dist/runtime/plugins/theme-switcher.js +27 -0
- package/dist/runtime/plugins/theme.d.ts +1 -1
- package/dist/runtime/plugins/theme.js +31 -25
- package/dist/runtime/plugins/vuetify.d.ts +1 -86
- package/dist/runtime/plugins/vuetify.js +28 -55
- package/dist/runtime/search/components/MSearch.d.vue.ts +0 -0
- package/dist/runtime/search/components/MSearch.vue +19 -0
- package/dist/runtime/search/components/MSearch.vue.d.ts +0 -0
- package/dist/runtime/styles/index.css +5 -0
- package/dist/runtime/styles/tailwind.css +1 -0
- package/dist/runtime/styles/vuetify.css +3 -0
- package/dist/types.d.mts +9 -0
- package/dist/utils/color.d.ts +2 -0
- package/dist/utils/color.js +11 -0
- package/dist/utils/fonts.d.ts +5 -0
- package/dist/utils/fonts.js +18 -0
- package/dist/utils/formkit.d.ts +12 -0
- package/dist/utils/formkit.js +59 -0
- package/dist/utils/icons.d.ts +4 -0
- package/dist/utils/icons.js +36 -0
- package/package.json +12 -10
- package/src/module.ts +105 -0
- package/src/runtime/assets/config/tailwind.conifg.js +42 -0
- package/src/runtime/components/Gallery.vue +66 -0
- package/src/runtime/components/MButton.vue +17 -0
- package/src/runtime/composables/useMToast.ts +14 -0
- package/src/runtime/design/tokens.ts +22 -0
- package/src/runtime/plugins/builder.ts +326 -0
- package/src/runtime/plugins/fontawesome.ts +11 -0
- package/src/runtime/plugins/formkit.ts +9 -0
- package/src/runtime/plugins/lightgallery.js +21 -0
- package/src/runtime/plugins/motion.ts +6 -0
- package/src/runtime/plugins/theme-switcher.ts +32 -0
- package/src/runtime/plugins/theme.ts +57 -0
- package/src/runtime/plugins/vuetify.ts +36 -0
- package/src/runtime/search/client.ts +25 -0
- package/src/runtime/search/components/MSearch.vue +19 -0
- package/src/runtime/search/plugin.ts +9 -0
- package/src/runtime/styles/index.scss +101 -0
- package/src/runtime/styles/tailwind.css +9 -0
- package/src/runtime/styles/vuetify.scss +5 -0
- package/src/types/runtime-config.d.ts +12 -0
- package/src/utils/color.js +11 -0
- package/src/utils/color.ts +14 -0
- package/src/utils/fonts.js +18 -0
- package/src/utils/fonts.ts +24 -0
- package/src/utils/formkit.js +59 -0
- package/src/utils/formkit.ts +75 -0
- package/src/utils/icons.js +36 -0
- package/src/utils/icons.ts +62 -0
- package/dist/runtime/plugins/icons.d.ts +0 -4
- package/dist/runtime/plugins/icons.js +0 -13
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface Image {
|
|
2
|
+
url: string;
|
|
3
|
+
alt?: string;
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export interface Product {
|
|
9
|
+
id: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
price?: number;
|
|
12
|
+
images?: Image[];
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
export interface Category {
|
|
16
|
+
id: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
slug?: string;
|
|
19
|
+
image?: string;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as nuxt_schema from 'nuxt/schema';
|
|
2
|
+
|
|
3
|
+
interface MFrameworkUiOptions {
|
|
4
|
+
theme?: 'light' | 'dark';
|
|
5
|
+
}
|
|
6
|
+
declare const _default: nuxt_schema.NuxtModule<MFrameworkUiOptions, MFrameworkUiOptions, false>;
|
|
7
|
+
|
|
8
|
+
export { _default as default };
|
|
9
|
+
export type { MFrameworkUiOptions };
|
package/dist/module.d.ts
ADDED
package/dist/module.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineNuxtModule, addPlugin, createResolver, addComponentsDir, addImportsDir } from 'nuxt/kit';
|
|
2
|
+
export default defineNuxtModule({
|
|
3
|
+
meta: {
|
|
4
|
+
name: '@mframework/ui',
|
|
5
|
+
configKey: 'mframeworkUi'
|
|
6
|
+
},
|
|
7
|
+
defaults: {
|
|
8
|
+
theme: 'light',
|
|
9
|
+
builder: true
|
|
10
|
+
},
|
|
11
|
+
setup(options, nuxt) {
|
|
12
|
+
const resolver = createResolver(import.meta.url);
|
|
13
|
+
//
|
|
14
|
+
// 1. Ensure Vuetify loads FIRST
|
|
15
|
+
//
|
|
16
|
+
addPlugin({
|
|
17
|
+
src: resolver.resolve('./runtime/plugins/vuetify'),
|
|
18
|
+
mode: 'all'
|
|
19
|
+
});
|
|
20
|
+
//
|
|
21
|
+
// 2. Global styles (Tailwind, Vuetify overrides, tokens)
|
|
22
|
+
//
|
|
23
|
+
nuxt.options.css = nuxt.options.css || [];
|
|
24
|
+
nuxt.options.css.push(resolver.resolve('./runtime/styles/index.scss'));
|
|
25
|
+
//
|
|
26
|
+
// 3. Register core UI plugins
|
|
27
|
+
//
|
|
28
|
+
const plugins = [
|
|
29
|
+
'formkit',
|
|
30
|
+
'fontawesome',
|
|
31
|
+
'lightgallery',
|
|
32
|
+
'motion',
|
|
33
|
+
'theme'
|
|
34
|
+
];
|
|
35
|
+
plugins.forEach((name) => {
|
|
36
|
+
addPlugin({
|
|
37
|
+
src: resolver.resolve(`./runtime/plugins/${name}`),
|
|
38
|
+
mode: 'all'
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//
|
|
42
|
+
// 4. Register GrapesJS builder (client‑only)
|
|
43
|
+
//
|
|
44
|
+
if (options.builder) {
|
|
45
|
+
addPlugin({
|
|
46
|
+
src: resolver.resolve('./runtime/plugins/builder'),
|
|
47
|
+
mode: 'client'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//
|
|
51
|
+
// 5. Auto‑import components & composables
|
|
52
|
+
//
|
|
53
|
+
addComponentsDir({
|
|
54
|
+
path: resolver.resolve('./runtime/components'),
|
|
55
|
+
prefix: 'M'
|
|
56
|
+
});
|
|
57
|
+
addImportsDir(resolver.resolve('./runtime/composables'));
|
|
58
|
+
//
|
|
59
|
+
// 6. Expose runtime config
|
|
60
|
+
//
|
|
61
|
+
nuxt.options.runtimeConfig.public.mframeworkUi = {
|
|
62
|
+
...(nuxt.options.runtimeConfig.public.mframeworkUi || {}),
|
|
63
|
+
...options
|
|
64
|
+
};
|
|
65
|
+
nuxt.options.tailwindcss = nuxt.options.tailwindcss || {};
|
|
66
|
+
nuxt.options.tailwindcss.configPath = resolver.resolve('./runtime/assets/config/tailwind.config.js');
|
|
67
|
+
}
|
|
68
|
+
});
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineNuxtModule, createResolver, addPlugin, addComponentsDir, addImportsDir } from 'nuxt/kit';
|
|
2
|
+
|
|
3
|
+
const module$1 = defineNuxtModule({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "@mframework/ui",
|
|
6
|
+
configKey: "mframeworkUi"
|
|
7
|
+
},
|
|
8
|
+
defaults: {
|
|
9
|
+
theme: "light"
|
|
10
|
+
},
|
|
11
|
+
setup(options, nuxt) {
|
|
12
|
+
const resolver = createResolver(import.meta.url);
|
|
13
|
+
addPlugin(resolver.resolve("./runtime/plugins/vuetify"));
|
|
14
|
+
nuxt.options.css = nuxt.options.css || [];
|
|
15
|
+
nuxt.options.css.push(resolver.resolve("./runtime/styles/index.scss"));
|
|
16
|
+
const plugins = [
|
|
17
|
+
"formkit",
|
|
18
|
+
"fontawesome",
|
|
19
|
+
"lightgallery",
|
|
20
|
+
"motion",
|
|
21
|
+
"grapes"
|
|
22
|
+
];
|
|
23
|
+
plugins.forEach((name) => {
|
|
24
|
+
addPlugin(resolver.resolve(`./runtime/plugins/${name}`));
|
|
25
|
+
});
|
|
26
|
+
addComponentsDir({
|
|
27
|
+
path: resolver.resolve("./runtime/components"),
|
|
28
|
+
prefix: "M"
|
|
29
|
+
});
|
|
30
|
+
addImportsDir(resolver.resolve("./runtime/composables"));
|
|
31
|
+
nuxt.options.runtimeConfig.public.mframeworkUi = {
|
|
32
|
+
...nuxt.options.runtimeConfig.public.mframeworkUi || {},
|
|
33
|
+
...options
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { module$1 as default };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { defineNuxtModule, addPlugin, createResolver, addComponentsDir, addImportsDir } from 'nuxt/kit';
|
|
2
|
+
export default defineNuxtModule({
|
|
3
|
+
meta: {
|
|
4
|
+
name: '@mframework/ui',
|
|
5
|
+
configKey: 'mframeworkUi'
|
|
6
|
+
},
|
|
7
|
+
defaults: {
|
|
8
|
+
theme: 'light',
|
|
9
|
+
builder: true
|
|
10
|
+
},
|
|
11
|
+
setup(options, nuxt) {
|
|
12
|
+
const resolver = createResolver(import.meta.url);
|
|
13
|
+
//
|
|
14
|
+
// 1. Ensure Vuetify loads FIRST
|
|
15
|
+
//
|
|
16
|
+
addPlugin({
|
|
17
|
+
src: resolver.resolve('./runtime/plugins/vuetify'),
|
|
18
|
+
mode: 'all'
|
|
19
|
+
});
|
|
20
|
+
//
|
|
21
|
+
// 2. Global styles (Tailwind, Vuetify overrides, tokens)
|
|
22
|
+
//
|
|
23
|
+
nuxt.options.css = nuxt.options.css || [];
|
|
24
|
+
nuxt.options.css.push(resolver.resolve('./runtime/styles/index.scss'));
|
|
25
|
+
//
|
|
26
|
+
// 3. Register core UI plugins
|
|
27
|
+
//
|
|
28
|
+
const plugins = [
|
|
29
|
+
'formkit',
|
|
30
|
+
'fontawesome',
|
|
31
|
+
'lightgallery',
|
|
32
|
+
'motion',
|
|
33
|
+
'theme'
|
|
34
|
+
];
|
|
35
|
+
plugins.forEach((name) => {
|
|
36
|
+
addPlugin({
|
|
37
|
+
src: resolver.resolve(`./runtime/plugins/${name}`),
|
|
38
|
+
mode: 'all'
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
//
|
|
42
|
+
// 4. Register GrapesJS builder (client‑only)
|
|
43
|
+
//
|
|
44
|
+
if (options.builder) {
|
|
45
|
+
addPlugin({
|
|
46
|
+
src: resolver.resolve('./runtime/plugins/builder'),
|
|
47
|
+
mode: 'client'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//
|
|
51
|
+
// 5. Auto‑import components & composables
|
|
52
|
+
//
|
|
53
|
+
addComponentsDir({
|
|
54
|
+
path: resolver.resolve('./runtime/components'),
|
|
55
|
+
prefix: 'M'
|
|
56
|
+
});
|
|
57
|
+
addImportsDir(resolver.resolve('./runtime/composables'));
|
|
58
|
+
//
|
|
59
|
+
// 6. Expose runtime config
|
|
60
|
+
//
|
|
61
|
+
// Normalize builder option
|
|
62
|
+
const normalizedBuilder = typeof options.builder === 'boolean' ? {
|
|
63
|
+
enabled: options.builder
|
|
64
|
+
} :
|
|
65
|
+
options.builder || {
|
|
66
|
+
enabled: true
|
|
67
|
+
};
|
|
68
|
+
nuxt.options.runtimeConfig.public.mframeworkUi = {
|
|
69
|
+
theme: options.theme,
|
|
70
|
+
builder: normalizedBuilder
|
|
71
|
+
};
|
|
72
|
+
nuxt.options.tailwindcss = nuxt.options.tailwindcss || {};
|
|
73
|
+
nuxt.options.tailwindcss.configPath = resolver.resolve('./runtime/assets/config/tailwind.config.js');
|
|
74
|
+
}
|
|
75
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import iziToast from 'izitoast';
|
|
2
|
+
import 'izitoast/dist/css/iziToast.min.css';
|
|
3
|
+
export const useMToast = () => {
|
|
4
|
+
const success = (message, title = 'Success') => {
|
|
5
|
+
iziToast.success({ title, message });
|
|
6
|
+
};
|
|
7
|
+
const error = (message, title = 'Error') => {
|
|
8
|
+
iziToast.error({ title, message });
|
|
9
|
+
};
|
|
10
|
+
return { success, error };
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const tokens: {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: string;
|
|
4
|
+
secondary: string;
|
|
5
|
+
success: string;
|
|
6
|
+
warning: string;
|
|
7
|
+
error: string;
|
|
8
|
+
surface: string;
|
|
9
|
+
background: string;
|
|
10
|
+
};
|
|
11
|
+
radius: {
|
|
12
|
+
sm: string;
|
|
13
|
+
md: string;
|
|
14
|
+
lg: string;
|
|
15
|
+
};
|
|
16
|
+
spacing: {
|
|
17
|
+
xs: string;
|
|
18
|
+
sm: string;
|
|
19
|
+
md: string;
|
|
20
|
+
lg: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const tokens = {
|
|
2
|
+
colors: {
|
|
3
|
+
primary: '#4f46e5',
|
|
4
|
+
secondary: '#64748b',
|
|
5
|
+
success: '#22c55e',
|
|
6
|
+
warning: '#f59e0b',
|
|
7
|
+
error: '#ef4444',
|
|
8
|
+
surface: '#ffffff',
|
|
9
|
+
background: '#f8fafc'
|
|
10
|
+
},
|
|
11
|
+
radius: {
|
|
12
|
+
sm: '4px',
|
|
13
|
+
md: '8px',
|
|
14
|
+
lg: '12px'
|
|
15
|
+
},
|
|
16
|
+
spacing: {
|
|
17
|
+
xs: '4px',
|
|
18
|
+
sm: '8px',
|
|
19
|
+
md: '16px',
|
|
20
|
+
lg: '24px'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
import 'grapesjs/dist/css/grapes.min.css';
|
|
3
|
+
import grapesjs from 'grapesjs';
|
|
4
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
5
|
+
if (process.server)
|
|
6
|
+
return;
|
|
7
|
+
const mount = () => {
|
|
8
|
+
const el = document.querySelector('#gjs');
|
|
9
|
+
if (!el)
|
|
10
|
+
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', // default is `max-width`
|
|
32
|
+
deviceManager: {
|
|
33
|
+
devices: [{
|
|
34
|
+
name: 'Desktop',
|
|
35
|
+
width: '', // default size
|
|
36
|
+
widthMedia: '1024px', // this value will be used in CSS @media
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Mobile',
|
|
40
|
+
width: '320px', // this value will be used on canvas width
|
|
41
|
+
widthMedia: '480px', // this value will be used in CSS @media
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
blockManager: {
|
|
46
|
+
appendTo: '#blocks',
|
|
47
|
+
blocks: [{
|
|
48
|
+
id: 'section', // id is mandatory
|
|
49
|
+
label: '<b>Section</b>', // You can use HTML/SVG inside labels
|
|
50
|
+
category: 'Basic',
|
|
51
|
+
attributes: {
|
|
52
|
+
class: 'gjs-block-section'
|
|
53
|
+
},
|
|
54
|
+
content: {
|
|
55
|
+
tagName: 'div',
|
|
56
|
+
draggable: false,
|
|
57
|
+
attributes: {
|
|
58
|
+
'some-attribute': 'some-value'
|
|
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');
|
|
236
|
+
},
|
|
237
|
+
getStyleEl(row) {
|
|
238
|
+
return row.querySelector('.styles-container');
|
|
239
|
+
},
|
|
240
|
+
run(editor, sender) {
|
|
241
|
+
const smEl = this.getStyleEl(this.getRowEl(editor));
|
|
242
|
+
smEl.style.display = '';
|
|
243
|
+
},
|
|
244
|
+
stop(editor, sender) {
|
|
245
|
+
const smEl = this.getStyleEl(this.getRowEl(editor));
|
|
246
|
+
smEl.style.display = 'none';
|
|
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
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
id: 'export',
|
|
277
|
+
className: 'btn-open-export',
|
|
278
|
+
label: 'Exp',
|
|
279
|
+
command: 'export-template',
|
|
280
|
+
context: 'export-template', // For grouping context of buttons from the same panel
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
id: 'show-json',
|
|
284
|
+
className: 'btn-show-json',
|
|
285
|
+
label: 'JSON',
|
|
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
|
+
},
|
|
294
|
+
},
|
|
295
|
+
],
|
|
296
|
+
});
|
|
297
|
+
editor.Commands.add('set-device-desktop', {
|
|
298
|
+
run: (editor) => editor.setDevice('Desktop'),
|
|
299
|
+
});
|
|
300
|
+
editor.Commands.add('set-device-mobile', {
|
|
301
|
+
run: (editor) => editor.setDevice('Mobile'),
|
|
302
|
+
});
|
|
303
|
+
editor.on('change:device', () => console.log('Current device: ', editor.getDevice()));
|
|
304
|
+
// Set initial device as Mobile
|
|
305
|
+
editor.setDevice('Mobile');
|
|
306
|
+
nuxtApp.provide('grapesStudio', editor);
|
|
307
|
+
return editor;
|
|
308
|
+
};
|
|
309
|
+
// Auto‑mount when page loads
|
|
310
|
+
window.addEventListener('DOMContentLoaded', mount);
|
|
311
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
7
|
+
library.add(fas);
|
|
8
|
+
nuxtApp.vueApp.component('Fa', FontAwesomeIcon);
|
|
9
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from 'nuxt/app';
|
|
2
|
+
import { plugin as formKitPlugin, defaultConfig } from '@formkit/vue';
|
|
3
|
+
import '@formkit/themes/genesis';
|
|
4
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
5
|
+
nuxtApp.vueApp.use(formKitPlugin, defaultConfig({
|
|
6
|
+
// You can inject your own inputs, locales, etc. here
|
|
7
|
+
}));
|
|
8
|
+
});
|