@studiocms/wysiwyg 0.1.0-experimental.5 → 0.1.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/LICENSE +1 -1
- package/README.md +7 -28
- package/dist/common/gjs-blocks.d.ts +4 -0
- package/dist/common/gjs-blocks.js +27 -0
- package/dist/common/gjs-componentRegistry.d.ts +31 -0
- package/dist/common/gjs-componentRegistry.js +59 -0
- package/dist/common/gjs-editor-settings.d.ts +23 -0
- package/dist/common/gjs-editor-settings.js +357 -0
- package/dist/common/gjs-editor-utils.d.ts +165 -0
- package/dist/common/gjs-editor-utils.js +217 -0
- package/dist/common/grapesBlocks/blocks/basics.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/basics.js +279 -0
- package/dist/common/grapesBlocks/blocks/extras.d.ts +4 -0
- package/dist/common/grapesBlocks/blocks/extras.js +63 -0
- package/dist/common/grapesBlocks/blocks/forms.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/forms/blocks.js → common/grapesBlocks/blocks/forms.js} +15 -14
- package/dist/common/grapesBlocks/blocks/index.d.ts +5 -0
- package/dist/common/grapesBlocks/blocks/index.js +23 -0
- package/dist/common/grapesBlocks/blocks/tabs.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/tabs/blocks.js → common/grapesBlocks/blocks/tabs.js} +9 -8
- package/dist/common/grapesBlocks/commands/clear.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/clear.js +21 -0
- package/dist/common/grapesBlocks/commands/customCodeCommands.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/code/commands.js → common/grapesBlocks/commands/customCodeCommands.js} +11 -9
- package/dist/common/grapesBlocks/commands/deviceCommands.js +23 -0
- package/dist/common/grapesBlocks/commands/index.d.ts +5 -0
- package/dist/common/grapesBlocks/commands/index.js +40 -0
- package/dist/common/grapesBlocks/commands/openImport.d.ts +4 -0
- package/dist/common/grapesBlocks/commands/openImport.js +71 -0
- package/dist/common/grapesBlocks/components/countdown.d.ts +12 -0
- package/dist/common/grapesBlocks/components/countdown.js +147 -0
- package/dist/common/grapesBlocks/components/customCode.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/code/components.js → common/grapesBlocks/components/customCode.js} +16 -15
- package/dist/common/grapesBlocks/components/forms.d.ts +3 -0
- package/dist/{wysiwyg/editorPlugins/forms/components.js → common/grapesBlocks/components/forms.js} +30 -36
- package/dist/common/grapesBlocks/components/index.d.ts +5 -0
- package/dist/common/grapesBlocks/components/index.js +23 -0
- package/dist/common/grapesBlocks/components/tabLoader.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins/tabs/components/index.js → common/grapesBlocks/components/tabLoader.js} +7 -7
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.js +2 -2
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.d.ts +1 -1
- package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.js +8 -8
- package/dist/common/grapesBlocks/components/tooltip.d.ts +4 -0
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks/components}/tooltip.js +15 -87
- package/dist/common/grapesBlocks/components/typed.d.ts +9 -0
- package/dist/{wysiwyg/editorPlugins/typed/components.js → common/grapesBlocks/components/typed.js} +7 -7
- package/dist/common/grapesBlocks/consts.d.ts +25 -0
- package/dist/common/grapesBlocks/consts.js +245 -0
- package/dist/common/grapesBlocks/i18n/index.d.ts +3 -0
- package/dist/common/grapesBlocks/i18n/index.js +19 -0
- package/dist/common/grapesBlocks/panels/index.d.ts +4 -0
- package/dist/common/grapesBlocks/panels/index.js +171 -0
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.d.ts +9 -0
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.js +16 -2
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.d.ts +3 -3
- package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.js +18 -12
- package/dist/common/grapesBlocks/selectors/index.d.ts +4 -0
- package/dist/common/grapesBlocks/selectors/index.js +9 -0
- package/dist/common/grapesBlocks/selectors/tooltip.d.ts +4 -0
- package/dist/common/grapesBlocks/selectors/tooltip.js +15 -0
- package/dist/common/grapesBlocks/traits/formTraits.d.ts +3 -0
- package/dist/{wysiwyg/editorPlugins/forms/traits.js → common/grapesBlocks/traits/formTraits.js} +12 -8
- package/dist/common/grapesBlocks/traits/index.d.ts +4 -0
- package/dist/common/grapesBlocks/traits/index.js +15 -0
- package/dist/common/grapesBlocks/traits/typedTraits.d.ts +3 -0
- package/dist/common/grapesBlocks/traits/typedTraits.js +24 -0
- package/dist/{wysiwyg/editorPlugins/tuiImageEditor.d.ts → common/grapesBlocks/tuiImageEditor/index.d.ts} +2 -2
- package/dist/{wysiwyg/editorPlugins/tuiImageEditor.js → common/grapesBlocks/tuiImageEditor/index.js} +6 -7
- package/dist/common/grapesBlocks/types.d.ts +446 -0
- package/dist/components/Editor.astro +153 -0
- package/dist/components/render.d.ts +15 -0
- package/dist/components/render.js +11 -0
- package/dist/consts.d.ts +31 -0
- package/dist/consts.js +15 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +71 -0
- package/dist/lib/db.d.ts +83 -0
- package/dist/lib/db.js +50 -0
- package/dist/lib/prerender.d.ts +10 -0
- package/dist/lib/prerender.js +22 -0
- package/dist/{wysiwyg → lib}/shared.d.ts +3 -6
- package/dist/lib/shared.js +6 -0
- package/dist/{utils.d.ts → lib/utils.d.ts} +1 -1
- package/dist/lib/utils.js +10 -0
- package/dist/routes/grapes.css.d.ts +7 -0
- package/dist/routes/grapes.css.js +13 -0
- package/dist/routes/partial.astro +44 -0
- package/dist/routes/store.d.ts +1 -0
- package/dist/routes/store.js +121 -0
- package/dist/schema.d.ts +60 -0
- package/dist/schema.js +24 -0
- package/dist/styles/editor.css +150 -0
- package/dist/styles/grapes.css +71 -0
- package/dist/types.d.ts +66 -0
- package/dist/types.js +9 -0
- package/package.json +30 -28
- package/dist/common/prepareRender.d.ts +0 -11
- package/dist/common/prepareRender.js +0 -24
- package/dist/studio/components/Render.astro +0 -11
- package/dist/studio/components/StudioSDKEditor.astro +0 -334
- package/dist/studio/index.d.ts +0 -38
- package/dist/studio/index.js +0 -58
- package/dist/studio/routes/partial.astro +0 -27
- package/dist/studio/shared.d.ts +0 -17
- package/dist/studio/shared.js +0 -7
- package/dist/studio/utils.d.ts +0 -105
- package/dist/studio/utils.js +0 -244
- package/dist/studio/virtual.d.ts +0 -114
- package/dist/utils.js +0 -15
- package/dist/wysiwyg/components/Editor.astro +0 -765
- package/dist/wysiwyg/components/Render.astro +0 -11
- package/dist/wysiwyg/editorPlugins/blocks/blocks.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/blocks/blocks.js +0 -239
- package/dist/wysiwyg/editorPlugins/blocks/index.d.ts +0 -80
- package/dist/wysiwyg/editorPlugins/blocks/index.js +0 -26
- package/dist/wysiwyg/editorPlugins/code/blocks.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/code/blocks.js +0 -20
- package/dist/wysiwyg/editorPlugins/code/commands.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/code/components.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/code/index.d.ts +0 -47
- package/dist/wysiwyg/editorPlugins/code/index.js +0 -28
- package/dist/wysiwyg/editorPlugins/code/utils.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/code/utils.js +0 -8
- package/dist/wysiwyg/editorPlugins/countdown.d.ts +0 -86
- package/dist/wysiwyg/editorPlugins/countdown.js +0 -163
- package/dist/wysiwyg/editorPlugins/forms/blocks.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/forms/components.d.ts +0 -11
- package/dist/wysiwyg/editorPlugins/forms/index.d.ts +0 -21
- package/dist/wysiwyg/editorPlugins/forms/index.js +0 -18
- package/dist/wysiwyg/editorPlugins/forms/traits.d.ts +0 -2
- package/dist/wysiwyg/editorPlugins/index.d.ts +0 -9
- package/dist/wysiwyg/editorPlugins/index.js +0 -20
- package/dist/wysiwyg/editorPlugins/rte/styles.css +0 -63
- package/dist/wysiwyg/editorPlugins/tabs/blocks.d.ts +0 -3
- package/dist/wysiwyg/editorPlugins/tabs/components/index.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/tabs/index.d.ts +0 -5
- package/dist/wysiwyg/editorPlugins/tabs/index.js +0 -15
- package/dist/wysiwyg/editorPlugins/tabs/options.d.ts +0 -5
- package/dist/wysiwyg/editorPlugins/tabs/options.js +0 -80
- package/dist/wysiwyg/editorPlugins/tabs/types.d.ts +0 -81
- package/dist/wysiwyg/editorPlugins/tooltip.d.ts +0 -68
- package/dist/wysiwyg/editorPlugins/typed/blocks.d.ts +0 -4
- package/dist/wysiwyg/editorPlugins/typed/blocks.js +0 -15
- package/dist/wysiwyg/editorPlugins/typed/components.d.ts +0 -9
- package/dist/wysiwyg/editorPlugins/typed/index.d.ts +0 -35
- package/dist/wysiwyg/editorPlugins/typed/index.js +0 -18
- package/dist/wysiwyg/editorPlugins/typed/traits.js +0 -18
- package/dist/wysiwyg/editorPlugins/typed/utils.d.ts +0 -2
- package/dist/wysiwyg/editorPlugins/typed/utils.js +0 -6
- package/dist/wysiwyg/index.d.ts +0 -20
- package/dist/wysiwyg/index.js +0 -47
- package/dist/wysiwyg/routes/partial.astro +0 -27
- package/dist/wysiwyg/shared.js +0 -7
- package/dist/wysiwyg/styles/main.css +0 -52
- package/dist/wysiwyg/virtual.d.ts +0 -3
- /package/dist/{wysiwyg/editorPlugins/typed/traits.d.ts → common/grapesBlocks/commands/deviceCommands.d.ts} +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.js +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.js +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.js +0 -0
- /package/dist/{wysiwyg/editorPlugins/tabs → common/grapesBlocks}/types.js +0 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 StudioCMS -
|
|
3
|
+
Copyright (c) 2025 StudioCMS - withstudiocms (https://github.com/withstudiocms)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,40 +1,19 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @studiocms/wysiwyg
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://codecov.io/github/withstudiocms/studiocms)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Add a WYSIWYG editor to your StudioCMS dashboard.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Overview
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { defineStudioCMSConfig } from 'studiocms/config';
|
|
15
|
-
import wysiwygPlugin from '@studiocms/wysiwyg';
|
|
16
|
-
|
|
17
|
-
export default defineStudioCMSConfig({
|
|
18
|
-
// other options here
|
|
19
|
-
plugins: [wysiwygPlugin()]
|
|
20
|
-
});
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## GrapesJS StudioSDK
|
|
24
|
-
|
|
25
|
-
Get started with the [GrapesJS StudioSDK](https://grapesjs.com)
|
|
26
|
-
|
|
27
|
-
### Usage
|
|
28
|
-
|
|
29
|
-
Add this plugin in your StudioCMS config. (`studiocms.config.mjs`)
|
|
9
|
+
Add this plugin to your StudioCMS config (`studiocms.config.mjs` or `.mts`):
|
|
30
10
|
|
|
31
11
|
```ts
|
|
32
|
-
import
|
|
33
|
-
import wysiwygStudioPlugin from '@studiocms/wysiwyg/studio';
|
|
12
|
+
import wysiwyg from '@studiocms/wysiwyg';
|
|
34
13
|
|
|
35
14
|
export default defineStudioCMSConfig({
|
|
36
15
|
// other options here
|
|
37
|
-
plugins: [
|
|
16
|
+
plugins: [wysiwyg()]
|
|
38
17
|
});
|
|
39
18
|
```
|
|
40
19
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { deepmerge } from "deepmerge-ts";
|
|
2
|
+
import loadBlocks from "./grapesBlocks/blocks/index.js";
|
|
3
|
+
import loadCommands from "./grapesBlocks/commands/index.js";
|
|
4
|
+
import loadComponents from "./grapesBlocks/components/index.js";
|
|
5
|
+
import { defaultGrapesBlocksOptions } from "./grapesBlocks/consts.js";
|
|
6
|
+
import loadI18n from "./grapesBlocks/i18n/index.js";
|
|
7
|
+
import loadPanels from "./grapesBlocks/panels/index.js";
|
|
8
|
+
import loadRichTextEditor from "./grapesBlocks/rte/index.js";
|
|
9
|
+
import loadSelectors from "./grapesBlocks/selectors/index.js";
|
|
10
|
+
import loadTraits from "./grapesBlocks/traits/index.js";
|
|
11
|
+
import loadTuiImageEditor from "./grapesBlocks/tuiImageEditor/index.js";
|
|
12
|
+
const grapesBlocks = (editor, opts = {}) => {
|
|
13
|
+
const options = deepmerge(defaultGrapesBlocksOptions, opts);
|
|
14
|
+
loadComponents(editor, options);
|
|
15
|
+
loadBlocks(editor, options);
|
|
16
|
+
loadCommands(editor, options);
|
|
17
|
+
loadPanels(editor, options);
|
|
18
|
+
loadSelectors(editor, options);
|
|
19
|
+
loadTraits(editor);
|
|
20
|
+
loadI18n(editor);
|
|
21
|
+
loadRichTextEditor(editor, options.rteOpts);
|
|
22
|
+
loadTuiImageEditor(editor);
|
|
23
|
+
};
|
|
24
|
+
var gjs_blocks_default = grapesBlocks;
|
|
25
|
+
export {
|
|
26
|
+
gjs_blocks_default as default
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentRegistryEntry } from '@withstudiocms/component-registry/types';
|
|
2
|
+
import type { Plugin } from 'grapesjs';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a collection of registered components for use within the Astro environment.
|
|
5
|
+
*
|
|
6
|
+
* @property componentRegistry - An array of `ComponentRegistryEntry` objects, each describing a registered component.
|
|
7
|
+
*/
|
|
8
|
+
interface AstroComponents {
|
|
9
|
+
componentRegistry: ComponentRegistryEntry[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Registers custom Astro components in the GrapesJS editor using a provided component registry.
|
|
13
|
+
*
|
|
14
|
+
* This plugin iterates over the given `componentRegistry` array and for each entry:
|
|
15
|
+
* - Adds a new component type to the GrapesJS `DomComponents` manager, mapping the component's props to GrapesJS traits.
|
|
16
|
+
* - Registers a new block in the GrapesJS `BlockManager` for easy drag-and-drop usage in the editor.
|
|
17
|
+
*
|
|
18
|
+
* @param editor - The GrapesJS editor instance to extend.
|
|
19
|
+
* @param opts - Optional configuration object.
|
|
20
|
+
* @param opts.componentRegistry - An array of component registry entries, each describing an Astro component to register.
|
|
21
|
+
*
|
|
22
|
+
* Each component registry entry should have:
|
|
23
|
+
* - `name`: The tag name of the component.
|
|
24
|
+
* - `props`: An array of prop definitions, each with `name`, `type`, and `defaultValue`.
|
|
25
|
+
*
|
|
26
|
+
* @remarks
|
|
27
|
+
* - The function expects helper functions such as `traitTypeFilter`, `renderComponentPreview`, `firstUpperCase`, and the `AstroSVG` asset to be available in scope.
|
|
28
|
+
* - The registered components and blocks will appear under the "Astro Components" category in the GrapesJS block manager.
|
|
29
|
+
*/
|
|
30
|
+
export declare const astroComponents: Plugin<AstroComponents>;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PARTIAL_PATH } from "../consts.js";
|
|
2
|
+
import { buildBlockProps, partialRequestBuilder, traitMapFn } from "./gjs-editor-utils.js";
|
|
3
|
+
const astroComponents = (editor, { componentRegistry }) => {
|
|
4
|
+
const componentKeys = componentRegistry.map(({ name }) => name);
|
|
5
|
+
for (const component of componentRegistry) {
|
|
6
|
+
const { name, props } = component;
|
|
7
|
+
let timedInterval;
|
|
8
|
+
let abortController;
|
|
9
|
+
editor.DomComponents.addType(name, {
|
|
10
|
+
isComponent: (el) => componentKeys.includes(el.tagName?.toLowerCase()),
|
|
11
|
+
model: {
|
|
12
|
+
defaults: {
|
|
13
|
+
tagName: name,
|
|
14
|
+
traits: props.map(traitMapFn)
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
view: {
|
|
18
|
+
tagName: () => "div",
|
|
19
|
+
init() {
|
|
20
|
+
this.listenTo(this.model.components(), "add remove reset", this.onChange);
|
|
21
|
+
this.listenTo(this.model, "change", this.onChange);
|
|
22
|
+
this.onChange();
|
|
23
|
+
},
|
|
24
|
+
onChange() {
|
|
25
|
+
timedInterval && clearTimeout(timedInterval);
|
|
26
|
+
abortController?.abort();
|
|
27
|
+
timedInterval = setTimeout(() => {
|
|
28
|
+
abortController = new AbortController();
|
|
29
|
+
fetch(PARTIAL_PATH, {
|
|
30
|
+
...partialRequestBuilder(this.model),
|
|
31
|
+
signal: abortController.signal
|
|
32
|
+
}).then((getCompResponse) => {
|
|
33
|
+
if (!getCompResponse.ok) {
|
|
34
|
+
console.log("[Error]: Could not fetch component HTML, please try again.");
|
|
35
|
+
const html = `<div class="error">Error: ${getCompResponse.statusText}</div>`;
|
|
36
|
+
this.el.innerHTML = html;
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
return getCompResponse.text();
|
|
40
|
+
}).then((html) => {
|
|
41
|
+
if (html !== void 0) {
|
|
42
|
+
this.el.innerHTML = html;
|
|
43
|
+
}
|
|
44
|
+
}).catch((error) => {
|
|
45
|
+
if (error.name !== "AbortError") {
|
|
46
|
+
console.log("[Error]: Network or parsing error:", error);
|
|
47
|
+
this.el.innerHTML = `<div class="error">Network Error</div>`;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}, 100);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
editor.BlockManager.add(name, buildBlockProps(name));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
export {
|
|
58
|
+
astroComponents
|
|
59
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EditorConfig } from 'grapesjs';
|
|
2
|
+
/**
|
|
3
|
+
* The base configuration object for the WYSIWYG editor.
|
|
4
|
+
*
|
|
5
|
+
* This partial configuration of `EditorConfig` defines the default settings for the editor container,
|
|
6
|
+
* dimensions, storage management, panels, canvas styles, and the style manager sectors.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* - The `container` property specifies the DOM selector for the editor.
|
|
10
|
+
* - The `height` and `width` properties define the editor's dimensions.
|
|
11
|
+
* - `storageManager` is set to use inline storage.
|
|
12
|
+
* - `panels` are initialized as empty.
|
|
13
|
+
* - The `canvas` property includes an array of stylesheets to be loaded.
|
|
14
|
+
* - The `styleManager` property organizes style controls into sectors such as General, Dimension, Typography, Decorations, Extra, and Flex.
|
|
15
|
+
* Each sector contains properties or buildProps for customizing the appearance and layout of elements within the editor.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import { baseConfig } from './editor-settings';
|
|
20
|
+
* // Use baseConfig to initialize the editor
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const baseConfig: Partial<EditorConfig>;
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { GRAPES_CSS_PATH } from "../consts.js";
|
|
2
|
+
const baseConfig = {
|
|
3
|
+
container: "#gjs",
|
|
4
|
+
height: "100%",
|
|
5
|
+
width: "auto",
|
|
6
|
+
fromElement: false,
|
|
7
|
+
storageManager: {
|
|
8
|
+
type: "db",
|
|
9
|
+
stepsBeforeSave: 10
|
|
10
|
+
},
|
|
11
|
+
panels: { defaults: [] },
|
|
12
|
+
canvas: {
|
|
13
|
+
styles: [GRAPES_CSS_PATH]
|
|
14
|
+
},
|
|
15
|
+
styleManager: {
|
|
16
|
+
sectors: [
|
|
17
|
+
{
|
|
18
|
+
name: "General",
|
|
19
|
+
properties: [
|
|
20
|
+
{
|
|
21
|
+
extend: "float",
|
|
22
|
+
type: "radio",
|
|
23
|
+
default: "none",
|
|
24
|
+
options: [
|
|
25
|
+
{
|
|
26
|
+
value: "none",
|
|
27
|
+
className: "fa fa-times",
|
|
28
|
+
id: ""
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: "left",
|
|
32
|
+
className: "fa fa-align-left",
|
|
33
|
+
id: ""
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: "right",
|
|
37
|
+
className: "fa fa-align-right",
|
|
38
|
+
id: ""
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"display",
|
|
43
|
+
{ extend: "position", type: "select" },
|
|
44
|
+
"top",
|
|
45
|
+
"right",
|
|
46
|
+
"left",
|
|
47
|
+
"bottom"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Dimension",
|
|
52
|
+
open: false,
|
|
53
|
+
properties: [
|
|
54
|
+
"width",
|
|
55
|
+
{
|
|
56
|
+
id: "flex-width",
|
|
57
|
+
type: "integer",
|
|
58
|
+
name: "Width",
|
|
59
|
+
units: ["px", "%"],
|
|
60
|
+
property: "flex-basis",
|
|
61
|
+
toRequire: true
|
|
62
|
+
},
|
|
63
|
+
"height",
|
|
64
|
+
"max-width",
|
|
65
|
+
"min-height",
|
|
66
|
+
"margin",
|
|
67
|
+
"padding"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: "Typography",
|
|
72
|
+
open: false,
|
|
73
|
+
properties: [
|
|
74
|
+
"font-family",
|
|
75
|
+
"font-size",
|
|
76
|
+
"font-weight",
|
|
77
|
+
"letter-spacing",
|
|
78
|
+
"color",
|
|
79
|
+
"line-height",
|
|
80
|
+
{
|
|
81
|
+
extend: "text-align",
|
|
82
|
+
options: [
|
|
83
|
+
{
|
|
84
|
+
id: "left",
|
|
85
|
+
label: "Left",
|
|
86
|
+
className: "fa fa-align-left"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "center",
|
|
90
|
+
label: "Center",
|
|
91
|
+
className: "fa fa-align-center"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "right",
|
|
95
|
+
label: "Right",
|
|
96
|
+
className: "fa fa-align-right"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "justify",
|
|
100
|
+
label: "Justify",
|
|
101
|
+
className: "fa fa-align-justify"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
property: "text-decoration",
|
|
107
|
+
type: "radio",
|
|
108
|
+
default: "none",
|
|
109
|
+
options: [
|
|
110
|
+
{
|
|
111
|
+
id: "none",
|
|
112
|
+
label: "None",
|
|
113
|
+
className: "fa fa-times"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
id: "underline",
|
|
117
|
+
label: "underline",
|
|
118
|
+
className: "fa fa-underline"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: "line-through",
|
|
122
|
+
label: "Line-through",
|
|
123
|
+
className: "fa fa-strikethrough"
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
"text-shadow"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
name: "Decorations",
|
|
132
|
+
open: false,
|
|
133
|
+
properties: [
|
|
134
|
+
"opacity",
|
|
135
|
+
"border-radius",
|
|
136
|
+
"border",
|
|
137
|
+
"box-shadow",
|
|
138
|
+
"background"
|
|
139
|
+
// { id: 'background-bg', property: 'background', type: 'bg' }
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "Extra",
|
|
144
|
+
open: false,
|
|
145
|
+
buildProps: ["transition", "perspective", "transform"]
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "Flex",
|
|
149
|
+
open: false,
|
|
150
|
+
properties: [
|
|
151
|
+
{
|
|
152
|
+
name: "Flex Container",
|
|
153
|
+
property: "display",
|
|
154
|
+
type: "select",
|
|
155
|
+
defaults: "block",
|
|
156
|
+
list: [
|
|
157
|
+
{ value: "block", name: "Disable", id: "" },
|
|
158
|
+
{ value: "flex", name: "Enable", id: "" }
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "Flex Parent",
|
|
163
|
+
property: "label-parent-flex",
|
|
164
|
+
type: "integer"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "Direction",
|
|
168
|
+
property: "flex-direction",
|
|
169
|
+
type: "radio",
|
|
170
|
+
defaults: "row",
|
|
171
|
+
list: [
|
|
172
|
+
{
|
|
173
|
+
value: "row",
|
|
174
|
+
name: "Row",
|
|
175
|
+
className: "icons-flex icon-dir-row",
|
|
176
|
+
title: "Row",
|
|
177
|
+
id: ""
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
value: "row-reverse",
|
|
181
|
+
name: "Row reverse",
|
|
182
|
+
className: "icons-flex icon-dir-row-rev",
|
|
183
|
+
title: "Row reverse",
|
|
184
|
+
id: ""
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
value: "column",
|
|
188
|
+
name: "Column",
|
|
189
|
+
title: "Column",
|
|
190
|
+
className: "icons-flex icon-dir-col",
|
|
191
|
+
id: ""
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
value: "column-reverse",
|
|
195
|
+
name: "Column reverse",
|
|
196
|
+
title: "Column reverse",
|
|
197
|
+
className: "icons-flex icon-dir-col-rev",
|
|
198
|
+
id: ""
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: "Justify",
|
|
204
|
+
property: "justify-content",
|
|
205
|
+
type: "radio",
|
|
206
|
+
defaults: "flex-start",
|
|
207
|
+
list: [
|
|
208
|
+
{
|
|
209
|
+
value: "flex-start",
|
|
210
|
+
className: "icons-flex icon-just-start",
|
|
211
|
+
title: "Start",
|
|
212
|
+
id: ""
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
value: "flex-end",
|
|
216
|
+
title: "End",
|
|
217
|
+
className: "icons-flex icon-just-end",
|
|
218
|
+
id: ""
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
value: "space-between",
|
|
222
|
+
title: "Space between",
|
|
223
|
+
className: "icons-flex icon-just-sp-bet",
|
|
224
|
+
id: ""
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
value: "space-around",
|
|
228
|
+
title: "Space around",
|
|
229
|
+
className: "icons-flex icon-just-sp-ar",
|
|
230
|
+
id: ""
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
value: "center",
|
|
234
|
+
title: "Center",
|
|
235
|
+
className: "icons-flex icon-just-sp-cent",
|
|
236
|
+
id: ""
|
|
237
|
+
}
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
name: "Align",
|
|
242
|
+
property: "align-items",
|
|
243
|
+
type: "radio",
|
|
244
|
+
defaults: "center",
|
|
245
|
+
list: [
|
|
246
|
+
{
|
|
247
|
+
value: "flex-start",
|
|
248
|
+
title: "Start",
|
|
249
|
+
className: "icons-flex icon-al-start",
|
|
250
|
+
id: ""
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
value: "flex-end",
|
|
254
|
+
title: "End",
|
|
255
|
+
className: "icons-flex icon-al-end",
|
|
256
|
+
id: ""
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
value: "stretch",
|
|
260
|
+
title: "Stretch",
|
|
261
|
+
className: "icons-flex icon-al-str",
|
|
262
|
+
id: ""
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
value: "center",
|
|
266
|
+
title: "Center",
|
|
267
|
+
className: "icons-flex icon-al-center",
|
|
268
|
+
id: ""
|
|
269
|
+
}
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: "Flex Children",
|
|
274
|
+
property: "label-parent-flex",
|
|
275
|
+
type: "integer"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: "Order",
|
|
279
|
+
property: "order",
|
|
280
|
+
type: "integer",
|
|
281
|
+
defaults: "0",
|
|
282
|
+
min: 0
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
name: "Flex",
|
|
286
|
+
property: "flex",
|
|
287
|
+
type: "composite",
|
|
288
|
+
properties: [
|
|
289
|
+
{
|
|
290
|
+
name: "Grow",
|
|
291
|
+
property: "flex-grow",
|
|
292
|
+
type: "integer",
|
|
293
|
+
defaults: "0",
|
|
294
|
+
min: 0
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: "Shrink",
|
|
298
|
+
property: "flex-shrink",
|
|
299
|
+
type: "integer",
|
|
300
|
+
defaults: "0",
|
|
301
|
+
min: 0
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "Basis",
|
|
305
|
+
property: "flex-basis",
|
|
306
|
+
type: "integer",
|
|
307
|
+
units: ["px", "%", ""],
|
|
308
|
+
unit: "",
|
|
309
|
+
defaults: "auto"
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: "Align",
|
|
315
|
+
property: "align-self",
|
|
316
|
+
type: "radio",
|
|
317
|
+
defaults: "auto",
|
|
318
|
+
list: [
|
|
319
|
+
{
|
|
320
|
+
value: "auto",
|
|
321
|
+
name: "Auto",
|
|
322
|
+
id: ""
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
value: "flex-start",
|
|
326
|
+
title: "Start",
|
|
327
|
+
className: "icons-flex icon-al-start",
|
|
328
|
+
id: ""
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
value: "flex-end",
|
|
332
|
+
title: "End",
|
|
333
|
+
className: "icons-flex icon-al-end",
|
|
334
|
+
id: ""
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
value: "stretch",
|
|
338
|
+
title: "Stretch",
|
|
339
|
+
className: "icons-flex icon-al-str",
|
|
340
|
+
id: ""
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
value: "center",
|
|
344
|
+
title: "Center",
|
|
345
|
+
className: "icons-flex icon-al-center",
|
|
346
|
+
id: ""
|
|
347
|
+
}
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
export {
|
|
356
|
+
baseConfig
|
|
357
|
+
};
|