@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.
Files changed (164) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +7 -28
  3. package/dist/common/gjs-blocks.d.ts +4 -0
  4. package/dist/common/gjs-blocks.js +27 -0
  5. package/dist/common/gjs-componentRegistry.d.ts +31 -0
  6. package/dist/common/gjs-componentRegistry.js +59 -0
  7. package/dist/common/gjs-editor-settings.d.ts +23 -0
  8. package/dist/common/gjs-editor-settings.js +357 -0
  9. package/dist/common/gjs-editor-utils.d.ts +165 -0
  10. package/dist/common/gjs-editor-utils.js +217 -0
  11. package/dist/common/grapesBlocks/blocks/basics.d.ts +4 -0
  12. package/dist/common/grapesBlocks/blocks/basics.js +279 -0
  13. package/dist/common/grapesBlocks/blocks/extras.d.ts +4 -0
  14. package/dist/common/grapesBlocks/blocks/extras.js +63 -0
  15. package/dist/common/grapesBlocks/blocks/forms.d.ts +4 -0
  16. package/dist/{wysiwyg/editorPlugins/forms/blocks.js → common/grapesBlocks/blocks/forms.js} +15 -14
  17. package/dist/common/grapesBlocks/blocks/index.d.ts +5 -0
  18. package/dist/common/grapesBlocks/blocks/index.js +23 -0
  19. package/dist/common/grapesBlocks/blocks/tabs.d.ts +4 -0
  20. package/dist/{wysiwyg/editorPlugins/tabs/blocks.js → common/grapesBlocks/blocks/tabs.js} +9 -8
  21. package/dist/common/grapesBlocks/commands/clear.d.ts +4 -0
  22. package/dist/common/grapesBlocks/commands/clear.js +21 -0
  23. package/dist/common/grapesBlocks/commands/customCodeCommands.d.ts +4 -0
  24. package/dist/{wysiwyg/editorPlugins/code/commands.js → common/grapesBlocks/commands/customCodeCommands.js} +11 -9
  25. package/dist/common/grapesBlocks/commands/deviceCommands.js +23 -0
  26. package/dist/common/grapesBlocks/commands/index.d.ts +5 -0
  27. package/dist/common/grapesBlocks/commands/index.js +40 -0
  28. package/dist/common/grapesBlocks/commands/openImport.d.ts +4 -0
  29. package/dist/common/grapesBlocks/commands/openImport.js +71 -0
  30. package/dist/common/grapesBlocks/components/countdown.d.ts +12 -0
  31. package/dist/common/grapesBlocks/components/countdown.js +147 -0
  32. package/dist/common/grapesBlocks/components/customCode.d.ts +4 -0
  33. package/dist/{wysiwyg/editorPlugins/code/components.js → common/grapesBlocks/components/customCode.js} +16 -15
  34. package/dist/common/grapesBlocks/components/forms.d.ts +3 -0
  35. package/dist/{wysiwyg/editorPlugins/forms/components.js → common/grapesBlocks/components/forms.js} +30 -36
  36. package/dist/common/grapesBlocks/components/index.d.ts +5 -0
  37. package/dist/common/grapesBlocks/components/index.js +23 -0
  38. package/dist/common/grapesBlocks/components/tabLoader.d.ts +4 -0
  39. package/dist/{wysiwyg/editorPlugins/tabs/components/index.js → common/grapesBlocks/components/tabLoader.js} +7 -7
  40. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.d.ts +1 -1
  41. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tab.js +2 -2
  42. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.d.ts +1 -1
  43. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.d.ts +1 -1
  44. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.d.ts +1 -1
  45. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.d.ts +1 -1
  46. package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/Tabs.js +8 -8
  47. package/dist/common/grapesBlocks/components/tooltip.d.ts +4 -0
  48. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks/components}/tooltip.js +15 -87
  49. package/dist/common/grapesBlocks/components/typed.d.ts +9 -0
  50. package/dist/{wysiwyg/editorPlugins/typed/components.js → common/grapesBlocks/components/typed.js} +7 -7
  51. package/dist/common/grapesBlocks/consts.d.ts +25 -0
  52. package/dist/common/grapesBlocks/consts.js +245 -0
  53. package/dist/common/grapesBlocks/i18n/index.d.ts +3 -0
  54. package/dist/common/grapesBlocks/i18n/index.js +19 -0
  55. package/dist/common/grapesBlocks/panels/index.d.ts +4 -0
  56. package/dist/common/grapesBlocks/panels/index.js +171 -0
  57. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.d.ts +9 -0
  58. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/colorPicker.js +16 -2
  59. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.d.ts +3 -3
  60. package/dist/{wysiwyg/editorPlugins → common/grapesBlocks}/rte/index.js +18 -12
  61. package/dist/common/grapesBlocks/selectors/index.d.ts +4 -0
  62. package/dist/common/grapesBlocks/selectors/index.js +9 -0
  63. package/dist/common/grapesBlocks/selectors/tooltip.d.ts +4 -0
  64. package/dist/common/grapesBlocks/selectors/tooltip.js +15 -0
  65. package/dist/common/grapesBlocks/traits/formTraits.d.ts +3 -0
  66. package/dist/{wysiwyg/editorPlugins/forms/traits.js → common/grapesBlocks/traits/formTraits.js} +12 -8
  67. package/dist/common/grapesBlocks/traits/index.d.ts +4 -0
  68. package/dist/common/grapesBlocks/traits/index.js +15 -0
  69. package/dist/common/grapesBlocks/traits/typedTraits.d.ts +3 -0
  70. package/dist/common/grapesBlocks/traits/typedTraits.js +24 -0
  71. package/dist/{wysiwyg/editorPlugins/tuiImageEditor.d.ts → common/grapesBlocks/tuiImageEditor/index.d.ts} +2 -2
  72. package/dist/{wysiwyg/editorPlugins/tuiImageEditor.js → common/grapesBlocks/tuiImageEditor/index.js} +6 -7
  73. package/dist/common/grapesBlocks/types.d.ts +446 -0
  74. package/dist/components/Editor.astro +153 -0
  75. package/dist/components/render.d.ts +15 -0
  76. package/dist/components/render.js +11 -0
  77. package/dist/consts.d.ts +31 -0
  78. package/dist/consts.js +15 -0
  79. package/dist/index.d.ts +39 -0
  80. package/dist/index.js +71 -0
  81. package/dist/lib/db.d.ts +83 -0
  82. package/dist/lib/db.js +50 -0
  83. package/dist/lib/prerender.d.ts +10 -0
  84. package/dist/lib/prerender.js +22 -0
  85. package/dist/{wysiwyg → lib}/shared.d.ts +3 -6
  86. package/dist/lib/shared.js +6 -0
  87. package/dist/{utils.d.ts → lib/utils.d.ts} +1 -1
  88. package/dist/lib/utils.js +10 -0
  89. package/dist/routes/grapes.css.d.ts +7 -0
  90. package/dist/routes/grapes.css.js +13 -0
  91. package/dist/routes/partial.astro +44 -0
  92. package/dist/routes/store.d.ts +1 -0
  93. package/dist/routes/store.js +121 -0
  94. package/dist/schema.d.ts +60 -0
  95. package/dist/schema.js +24 -0
  96. package/dist/styles/editor.css +150 -0
  97. package/dist/styles/grapes.css +71 -0
  98. package/dist/types.d.ts +66 -0
  99. package/dist/types.js +9 -0
  100. package/package.json +30 -28
  101. package/dist/common/prepareRender.d.ts +0 -11
  102. package/dist/common/prepareRender.js +0 -24
  103. package/dist/studio/components/Render.astro +0 -11
  104. package/dist/studio/components/StudioSDKEditor.astro +0 -334
  105. package/dist/studio/index.d.ts +0 -38
  106. package/dist/studio/index.js +0 -58
  107. package/dist/studio/routes/partial.astro +0 -27
  108. package/dist/studio/shared.d.ts +0 -17
  109. package/dist/studio/shared.js +0 -7
  110. package/dist/studio/utils.d.ts +0 -105
  111. package/dist/studio/utils.js +0 -244
  112. package/dist/studio/virtual.d.ts +0 -114
  113. package/dist/utils.js +0 -15
  114. package/dist/wysiwyg/components/Editor.astro +0 -765
  115. package/dist/wysiwyg/components/Render.astro +0 -11
  116. package/dist/wysiwyg/editorPlugins/blocks/blocks.d.ts +0 -3
  117. package/dist/wysiwyg/editorPlugins/blocks/blocks.js +0 -239
  118. package/dist/wysiwyg/editorPlugins/blocks/index.d.ts +0 -80
  119. package/dist/wysiwyg/editorPlugins/blocks/index.js +0 -26
  120. package/dist/wysiwyg/editorPlugins/code/blocks.d.ts +0 -4
  121. package/dist/wysiwyg/editorPlugins/code/blocks.js +0 -20
  122. package/dist/wysiwyg/editorPlugins/code/commands.d.ts +0 -4
  123. package/dist/wysiwyg/editorPlugins/code/components.d.ts +0 -4
  124. package/dist/wysiwyg/editorPlugins/code/index.d.ts +0 -47
  125. package/dist/wysiwyg/editorPlugins/code/index.js +0 -28
  126. package/dist/wysiwyg/editorPlugins/code/utils.d.ts +0 -3
  127. package/dist/wysiwyg/editorPlugins/code/utils.js +0 -8
  128. package/dist/wysiwyg/editorPlugins/countdown.d.ts +0 -86
  129. package/dist/wysiwyg/editorPlugins/countdown.js +0 -163
  130. package/dist/wysiwyg/editorPlugins/forms/blocks.d.ts +0 -3
  131. package/dist/wysiwyg/editorPlugins/forms/components.d.ts +0 -11
  132. package/dist/wysiwyg/editorPlugins/forms/index.d.ts +0 -21
  133. package/dist/wysiwyg/editorPlugins/forms/index.js +0 -18
  134. package/dist/wysiwyg/editorPlugins/forms/traits.d.ts +0 -2
  135. package/dist/wysiwyg/editorPlugins/index.d.ts +0 -9
  136. package/dist/wysiwyg/editorPlugins/index.js +0 -20
  137. package/dist/wysiwyg/editorPlugins/rte/styles.css +0 -63
  138. package/dist/wysiwyg/editorPlugins/tabs/blocks.d.ts +0 -3
  139. package/dist/wysiwyg/editorPlugins/tabs/components/index.d.ts +0 -4
  140. package/dist/wysiwyg/editorPlugins/tabs/index.d.ts +0 -5
  141. package/dist/wysiwyg/editorPlugins/tabs/index.js +0 -15
  142. package/dist/wysiwyg/editorPlugins/tabs/options.d.ts +0 -5
  143. package/dist/wysiwyg/editorPlugins/tabs/options.js +0 -80
  144. package/dist/wysiwyg/editorPlugins/tabs/types.d.ts +0 -81
  145. package/dist/wysiwyg/editorPlugins/tooltip.d.ts +0 -68
  146. package/dist/wysiwyg/editorPlugins/typed/blocks.d.ts +0 -4
  147. package/dist/wysiwyg/editorPlugins/typed/blocks.js +0 -15
  148. package/dist/wysiwyg/editorPlugins/typed/components.d.ts +0 -9
  149. package/dist/wysiwyg/editorPlugins/typed/index.d.ts +0 -35
  150. package/dist/wysiwyg/editorPlugins/typed/index.js +0 -18
  151. package/dist/wysiwyg/editorPlugins/typed/traits.js +0 -18
  152. package/dist/wysiwyg/editorPlugins/typed/utils.d.ts +0 -2
  153. package/dist/wysiwyg/editorPlugins/typed/utils.js +0 -6
  154. package/dist/wysiwyg/index.d.ts +0 -20
  155. package/dist/wysiwyg/index.js +0 -47
  156. package/dist/wysiwyg/routes/partial.astro +0 -27
  157. package/dist/wysiwyg/shared.js +0 -7
  158. package/dist/wysiwyg/styles/main.css +0 -52
  159. package/dist/wysiwyg/virtual.d.ts +0 -3
  160. /package/dist/{wysiwyg/editorPlugins/typed/traits.d.ts → common/grapesBlocks/commands/deviceCommands.d.ts} +0 -0
  161. /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContainer.js +0 -0
  162. /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContent.js +0 -0
  163. /package/dist/{wysiwyg/editorPlugins/tabs/components → common/grapesBlocks/components/tabs}/TabContents.js +0 -0
  164. /package/dist/{wysiwyg/editorPlugins/tabs → common/grapesBlocks}/types.js +0 -0
@@ -1,7 +1,8 @@
1
- import { typeOption } from "./components.js";
2
- function traits_default(editor) {
3
- const trm = editor.TraitManager;
4
- trm.addType("select-options", {
1
+ import { typeOption } from "../consts.js";
2
+ import { AddTrait } from "./index.js";
3
+ var formTraits_default = (editor) => {
4
+ const addTrait = AddTrait(editor);
5
+ addTrait("select-options", {
5
6
  events: {
6
7
  keyup: "onChange"
7
8
  },
@@ -12,7 +13,9 @@ function traits_default(editor) {
12
13
  const optComps = [];
13
14
  for (let i = 0; i < options.length; i++) {
14
15
  const optionStr = options[i];
16
+ if (!optionStr.trim()) continue;
15
17
  const option = optionStr.split("::");
18
+ if (option.length === 0) continue;
16
19
  optComps.push({
17
20
  type: typeOption,
18
21
  components: option[1] || option[0],
@@ -27,10 +30,11 @@ function traits_default(editor) {
27
30
  const optionsArr = [];
28
31
  const options = this.target.components();
29
32
  for (let i = 0; i < options.length; i++) {
30
- const option = options.models[i];
33
+ const option = options.at(i);
34
+ if (!option) continue;
31
35
  const optAttr = option.get("attributes");
32
36
  const optValue = optAttr?.value || "";
33
- const optTxtNode = option.components().models[0];
37
+ const optTxtNode = option.components().at(0);
34
38
  const optLabel = optTxtNode?.get("content") || "";
35
39
  optionsArr.push(`${optValue}::${optLabel}`);
36
40
  }
@@ -41,7 +45,7 @@ function traits_default(editor) {
41
45
  return this.$input;
42
46
  }
43
47
  });
44
- }
48
+ };
45
49
  export {
46
- traits_default as default
50
+ formTraits_default as default
47
51
  };
@@ -0,0 +1,4 @@
1
+ import type { CustomTrait, Editor } from 'grapesjs';
2
+ export declare const AddTrait: (editor: Editor) => <T>(id: string, def: CustomTrait<T>) => void;
3
+ export declare function loadTraits(editor: Editor): void;
4
+ export default loadTraits;
@@ -0,0 +1,15 @@
1
+ import formTraits from "./formTraits.js";
2
+ import typedTraits from "./typedTraits.js";
3
+ const AddTrait = (editor) => (id, def) => {
4
+ editor.TraitManager.addType(id, def);
5
+ };
6
+ function loadTraits(editor) {
7
+ typedTraits(editor);
8
+ formTraits(editor);
9
+ }
10
+ var traits_default = loadTraits;
11
+ export {
12
+ AddTrait,
13
+ traits_default as default,
14
+ loadTraits
15
+ };
@@ -0,0 +1,3 @@
1
+ import type { Editor } from 'grapesjs';
2
+ declare const _default: (editor: Editor) => void;
3
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { typedTraitStringId } from "../consts.js";
2
+ import { AddTrait } from "./index.js";
3
+ var typedTraits_default = (editor) => {
4
+ const addTrait = AddTrait(editor);
5
+ addTrait(typedTraitStringId, {
6
+ createInput({ component }) {
7
+ const strings = component.get("strings");
8
+ const stringsArray = Array.isArray(strings) ? strings : [];
9
+ return `<textarea>${stringsArray.join("\n")}</textarea>`;
10
+ },
11
+ onUpdate({ component, elInput }) {
12
+ const strings = component.get("strings");
13
+ const stringsArray = Array.isArray(strings) ? strings : [];
14
+ elInput.value = stringsArray.join("\n");
15
+ },
16
+ onEvent({ component, elInput }) {
17
+ const value = (elInput.value || "").split("\n");
18
+ component.set("strings", value);
19
+ }
20
+ });
21
+ };
22
+ export {
23
+ typedTraits_default as default
24
+ };
@@ -1,4 +1,4 @@
1
- import type { Component, Plugin } from 'grapesjs';
1
+ import type { Component, Editor } from 'grapesjs';
2
2
  type ImageEditor = tuiImageEditor.ImageEditor;
3
3
  type IOptions = tuiImageEditor.IOptions;
4
4
  export type PluginOptions = {
@@ -82,5 +82,5 @@ export type PluginOptions = {
82
82
  */
83
83
  style?: string[];
84
84
  };
85
- declare const plugin: Plugin<PluginOptions>;
85
+ declare const plugin: (editor: Editor) => void;
86
86
  export default plugin;
@@ -1,4 +1,4 @@
1
- const plugin = (editor, options = {}) => {
1
+ const plugin = (editor) => {
2
2
  const opts = {
3
3
  config: {},
4
4
  constructor: "",
@@ -25,8 +25,7 @@ const plugin = (editor, options = {}) => {
25
25
  style: [
26
26
  "https://uicdn.toast.com/tui-color-picker/v2.2.7/tui-color-picker.min.css",
27
27
  "https://uicdn.toast.com/tui-image-editor/v3.15.2/tui-image-editor.min.css"
28
- ],
29
- ...options
28
+ ]
30
29
  };
31
30
  const { script, style, height, width, hideHeader, onApply, upload, addToAssets, commandId } = opts;
32
31
  const hasWindow = typeof window !== "undefined";
@@ -81,12 +80,12 @@ const plugin = (editor, options = {}) => {
81
80
  const errorOpts = { level: "error", ns: commandId };
82
81
  editor.Commands.add(commandId, {
83
82
  imageEditor: null,
84
- run(ed, s, options2 = {}) {
83
+ run(ed, _s, options = {}) {
85
84
  if (!constr) {
86
85
  ed.log("TOAST UI Image editor not found", errorOpts);
87
86
  return ed.stopCommand(commandId);
88
87
  }
89
- const target = options2.target || ed.getSelected();
88
+ const target = options.target || ed.getSelected();
90
89
  if (!target) {
91
90
  ed.log("Target not available", errorOpts);
92
91
  return ed.stopCommand(commandId);
@@ -162,11 +161,11 @@ const plugin = (editor, options = {}) => {
162
161
  am.FileUploader().uploadFile(
163
162
  {
164
163
  dataTransfer: {
165
- // @ts-ignore
164
+ // @ts-expect-error
166
165
  files: [file]
167
166
  }
168
167
  },
169
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
168
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
170
169
  (res) => {
171
170
  const obj = res?.data?.[0];
172
171
  const src = obj && (typeof obj === "string" ? obj : obj.src);
@@ -0,0 +1,446 @@
1
+ import type { BlockProperties, ComponentDefinition, Editor } from 'grapesjs';
2
+ import type { RichTextEditorOptions } from './rte/index.js';
3
+ type TraitsProperty = ComponentDefinition['traits'];
4
+ type BlockList = string[];
5
+ export interface TabsOptions {
6
+ tabsBlock?: ComponentDefinition | null;
7
+ tabsProps?: ComponentDefinition;
8
+ tabContainerProps?: ComponentDefinition;
9
+ tabProps?: ComponentDefinition;
10
+ tabContentProps?: ComponentDefinition;
11
+ tabContentsProps?: ComponentDefinition;
12
+ classTab: string;
13
+ classTabContainer: string;
14
+ classTabActive: string;
15
+ classTabContent: string;
16
+ classTabContents: string;
17
+ selectorTab: string;
18
+ typeTabs: string;
19
+ typeTabContainer: string;
20
+ typeTab: string;
21
+ typeTabContent: string;
22
+ typeTabContents: string;
23
+ templateTab: TabTemplate;
24
+ templateTabContent?: TabTemplate;
25
+ style?: (config: TabsOptions) => string;
26
+ }
27
+ export interface TabTemplateProps {
28
+ index: number;
29
+ }
30
+ export type TabTemplate = string | ((props: TabTemplateProps) => string);
31
+ export interface TabConfig {
32
+ selectorTab: string;
33
+ typeTab: string;
34
+ typeTabContainer: string;
35
+ classTab: string;
36
+ classTabActive: string;
37
+ typeTabs: string;
38
+ templateTab: TabTemplate;
39
+ typeTabContent: string;
40
+ templateTabContent?: TabTemplate;
41
+ tabProps?: ComponentDefinition;
42
+ }
43
+ export interface TabContainerConfig {
44
+ typeTabContainer: string;
45
+ typeTabs: string;
46
+ typeTab: string;
47
+ classTabContainer: string;
48
+ tabContainerProps?: ComponentDefinition;
49
+ }
50
+ export interface TabContentConfig {
51
+ typeTabContent: string;
52
+ classTabContent: string;
53
+ tabContentProps?: ComponentDefinition;
54
+ }
55
+ export interface TabContentsConfig {
56
+ typeTabContents: string;
57
+ classTabContents: string;
58
+ tabContentsProps?: ComponentDefinition;
59
+ }
60
+ export interface TabsConfig {
61
+ typeTabs: string;
62
+ typeTab: string;
63
+ typeTabContent: string;
64
+ typeTabContents: string;
65
+ typeTabContainer: string;
66
+ classTabActive: string;
67
+ selectorTab: string;
68
+ tabsProps?: ComponentDefinition;
69
+ style?: (config: TabsOptions) => string;
70
+ }
71
+ export interface TabComponentProps {
72
+ classactive: string;
73
+ selectortab: string;
74
+ }
75
+ export interface TabAttributes {
76
+ role?: string;
77
+ id?: string;
78
+ 'aria-labelledby'?: string;
79
+ hidden?: boolean;
80
+ [key: string]: any;
81
+ }
82
+ export interface CustomWindow extends Window {
83
+ _isEditor?: boolean;
84
+ }
85
+ export type TooltipOptions = {
86
+ /**
87
+ * The ID used to create tooltip block and component
88
+ * @default 'tooltip'
89
+ */
90
+ id?: string;
91
+ /**
92
+ * The ID used to create tooltip block and component
93
+ * @default 'Tooltip'
94
+ */
95
+ labelTooltip?: string;
96
+ /**
97
+ * Object to extend the default tooltip block. Pass a falsy value to avoid adding the block.
98
+ * @example
99
+ * { label: 'Tooltip', category: 'Extra', ... }
100
+ */
101
+ blockTooltip?: Partial<BlockProperties>;
102
+ /**
103
+ * Object to extend the default tooltip properties.
104
+ * @example
105
+ * { name: 'Tooltip', droppable: false, ... }
106
+ */
107
+ propsTooltip?: ComponentDefinition;
108
+ /**
109
+ * A function which allows to extend default traits by receiving the original array and returning a new one.
110
+ */
111
+ extendTraits?: (traits: TraitsProperty) => TraitsProperty;
112
+ /**
113
+ * Tooltip attribute prefix.
114
+ * @default 'data-tooltip'
115
+ */
116
+ attrTooltip?: string;
117
+ /**
118
+ * Tooltip class prefix.
119
+ * @default 'tooltip-component'
120
+ */
121
+ classTooltip?: string;
122
+ /**
123
+ * Custom CSS styles for the tooltip component, this will replace the default one.
124
+ * @default 'tooltip-component'
125
+ */
126
+ style?: string;
127
+ /**
128
+ * Additional CSS styles for the tooltip component.
129
+ * @default 'tooltip-component'
130
+ */
131
+ styleAdditional?: string;
132
+ /**
133
+ * Make all tooltip relative classes private.
134
+ * @default true
135
+ */
136
+ privateClasses?: boolean;
137
+ /**
138
+ * Indicate if the tooltip can be styled.
139
+ * You can pass an array of which properties can be styled.
140
+ * @example ['color', 'background-color']
141
+ */
142
+ stylableTooltip?: string[] | boolean;
143
+ /**
144
+ * If true, force the tooltip to be shown when the default "Style tooltip" trait button is clicked.
145
+ * @default true
146
+ */
147
+ showTooltipOnStyle?: boolean;
148
+ };
149
+ export interface TypedOptions {
150
+ /**
151
+ * Library to load asynchronously in case `Typed` is not found.
152
+ * @default 'https://cdn.jsdelivr.net/npm/typed.js@2.0.11'
153
+ */
154
+ script?: string;
155
+ /**
156
+ * Object to extend the default block, eg. `{ label: 'Typed', ... }`.
157
+ * Pass a falsy value to avoid adding the block
158
+ * @default {}
159
+ */
160
+ block?: Partial<BlockProperties>;
161
+ /**
162
+ * Customize the component props. The final object should be returned.
163
+ * @default (props) => props
164
+ * @example
165
+ * props: props => {
166
+ * props.traits = props.traits.map(trait => {
167
+ * if (trait.name == 'strings') {
168
+ * trait.label = 'Custom <b>trait<b/> label';
169
+ * }
170
+ * // this trait will be removed
171
+ * if (trait.name == 'fade-out-class') return;
172
+ * return trait;
173
+ * }).filter(Boolean);
174
+ *
175
+ * return props;
176
+ * }
177
+ */
178
+ props?: (p: ComponentDefinition) => ComponentDefinition;
179
+ }
180
+ export type CountdownOptions = {
181
+ /**
182
+ * The ID used to create the block and component
183
+ * @default 'countdown'
184
+ */
185
+ id?: string;
186
+ /**
187
+ * The label used for the block and the component.
188
+ * @default 'Countdown'
189
+ */
190
+ label?: string;
191
+ /**
192
+ * Object to extend the default block. Pass a falsy value to avoid adding the block.
193
+ * @example
194
+ * { label: 'Countdown', category: 'Extra', ... }
195
+ */
196
+ block?: Partial<BlockProperties>;
197
+ /**
198
+ * Object to extend the default component properties.
199
+ * @example
200
+ * { name: 'Countdown', droppable: false, ... }
201
+ */
202
+ props?: ComponentDefinition;
203
+ /**
204
+ * Custom CSS styles for the component. This will replace the default one.
205
+ * @default ''
206
+ */
207
+ style?: string;
208
+ /**
209
+ * Additional CSS styles for the component. These will be appended to the default one.
210
+ * @default ''
211
+ */
212
+ styleAdditional?: string;
213
+ /**
214
+ * Default start time.
215
+ * @default ''
216
+ * @example '2018-01-25 00:00'
217
+ */
218
+ startTime?: string;
219
+ /**
220
+ * Text to show when the countdown is ended.
221
+ * @default 'EXPIRED'
222
+ */
223
+ endText?: string;
224
+ /**
225
+ * Date input type, eg. `date`, `datetime-local`
226
+ * @default 'date'
227
+ */
228
+ dateInputType?: string;
229
+ /**
230
+ * Days label text used in component.
231
+ * @default 'days'
232
+ */
233
+ labelDays?: string;
234
+ /**
235
+ * Hours label text used in component.
236
+ * @default 'hours'
237
+ */
238
+ labelHours?: string;
239
+ /**
240
+ * Minutes label text used in component.
241
+ * @default 'minutes'
242
+ */
243
+ labelMinutes?: string;
244
+ /**
245
+ * Seconds label text used in component.
246
+ * @default 'seconds'
247
+ */
248
+ labelSeconds?: string;
249
+ /**
250
+ * Countdown component class prefix.
251
+ * @default 'countdown'
252
+ */
253
+ classPrefix?: string;
254
+ };
255
+ export type CustomCodeOptions = {
256
+ /**
257
+ * Object to extend the default custom code block. Pass a falsy value to avoid adding the block
258
+ * @example
259
+ * { label: 'Custom Code', category: 'Extra', ... }
260
+ */
261
+ blockCustomCode?: Partial<BlockProperties>;
262
+ /**
263
+ * Object to extend the default custom code properties.
264
+ * @example
265
+ * { name: 'Custom Code', droppable: false, ... }
266
+ */
267
+ propsCustomCode?: ComponentDefinition;
268
+ /**
269
+ * Object to extend the default component's toolbar button for the code. Pass a falsy value to avoid adding the button
270
+ * @example
271
+ * { label: '</>', attributes: { title: 'Open custom code' } }
272
+ */
273
+ toolbarBtnCustomCode?: Record<string, any>;
274
+ /**
275
+ * Content to show when the custom code contains `<script>`
276
+ */
277
+ placeholderScript?: string;
278
+ /**
279
+ * Title for the custom code modal
280
+ * @default 'Insert your code'
281
+ */
282
+ modalTitle?: string;
283
+ /**
284
+ * Additional options for the code viewer.
285
+ * @example
286
+ * { theme: 'hopscotch', readOnly: 0 }
287
+ */
288
+ codeViewOptions?: Record<string, any>;
289
+ /**
290
+ * Label for the default save button
291
+ * @default 'Save'
292
+ */
293
+ buttonLabel?: string;
294
+ /**
295
+ * Object to extend the default custom code command.
296
+ */
297
+ commandCustomCode?: Record<string, any>;
298
+ };
299
+ export interface GrapesBlocksOptions {
300
+ blocks: BlockList;
301
+ /**
302
+ * Add custom block options, based on block id.
303
+ * @default (blockId) => ({})
304
+ * @example (blockId) => blockId === 'quote' ? { attributes: {...} } : {};
305
+ */
306
+ block?: (blockId: string) => {};
307
+ /**
308
+ * Modal import title.
309
+ * @default 'Import'
310
+ */
311
+ modalImportTitle?: string;
312
+ /**
313
+ * Modal import button text.
314
+ * @default 'Import'
315
+ */
316
+ modalImportButton?: string;
317
+ /**
318
+ * Import description inside import modal.
319
+ * @default ''
320
+ */
321
+ modalImportLabel?: string;
322
+ /**
323
+ * Default content to setup on import model open.
324
+ * Could also be a function with a dynamic content return (must be a string).
325
+ * @default ''
326
+ * @example editor => editor.getHtml()
327
+ */
328
+ modalImportContent?: string | ((editor: Editor) => string);
329
+ /**
330
+ * Code viewer (eg. CodeMirror) options.
331
+ * @default {}
332
+ */
333
+ importViewerOptions?: Record<string, any>;
334
+ /**
335
+ * Confirm text before clearing the canvas.
336
+ * @default 'Are you sure you want to clear the canvas?'
337
+ */
338
+ textCleanCanvas?: string;
339
+ /**
340
+ * Show the Style Manager on component change.
341
+ * @default true
342
+ */
343
+ showStylesOnChange?: boolean;
344
+ /**
345
+ * Make use of flexbox for the grid
346
+ * @default false
347
+ */
348
+ flexGrid?: boolean;
349
+ /**
350
+ * Classes prefix
351
+ * @default 'gjs-'
352
+ */
353
+ stylePrefix?: string;
354
+ /**
355
+ * Use basic CSS for blocks
356
+ * @default true
357
+ */
358
+ addBasicStyle?: boolean;
359
+ /**
360
+ * 1 Column label
361
+ * @default '1 Column'
362
+ */
363
+ labelColumn1?: string;
364
+ /**
365
+ * 2 Columns label
366
+ * @default '2 Columns'
367
+ */
368
+ labelColumn2?: string;
369
+ /**
370
+ * 3 Columns label
371
+ * @default '3 Columns'
372
+ */
373
+ labelColumn3?: string;
374
+ /**
375
+ * 3/7 Columns label
376
+ * @default '2 Columns 3/7'
377
+ */
378
+ labelColumn37?: string;
379
+ /**
380
+ * Text label
381
+ * @default 'Text'
382
+ */
383
+ labelText?: string;
384
+ /**
385
+ * Link label
386
+ * @default 'Link'
387
+ */
388
+ labelLink?: string;
389
+ /**
390
+ * Image label
391
+ * @default 'Image'
392
+ */
393
+ labelImage?: string;
394
+ /**
395
+ * Video label
396
+ * @default 'Video'
397
+ */
398
+ labelVideo?: string;
399
+ /**
400
+ * Map label
401
+ * @default 'Map'
402
+ */
403
+ labelMap?: string;
404
+ /**
405
+ * Initial row height
406
+ * @default 75
407
+ */
408
+ rowHeight?: number;
409
+ /**
410
+ * Tooltip options.
411
+ * @default {}
412
+ */
413
+ tooltip?: TooltipOptions;
414
+ /**
415
+ * Options for the Typed.js component.
416
+ * @default {}
417
+ */
418
+ typed?: TypedOptions;
419
+ /**
420
+ * Options for the Rich Text Editor component.
421
+ * @default {}
422
+ */
423
+ rteOpts?: RichTextEditorOptions;
424
+ /**
425
+ * Options for the Countdown component.
426
+ * @default {}
427
+ */
428
+ countdown?: CountdownOptions;
429
+ /**
430
+ * Options for the Custom Code component.
431
+ * @default {}
432
+ */
433
+ customCode?: CustomCodeOptions;
434
+ /**
435
+ * Options for the Tabs component.
436
+ * @default {}
437
+ */
438
+ tabOptions?: TabsOptions;
439
+ }
440
+ export type RequiredTooltipOptions = Required<TooltipOptions>;
441
+ export type RequiredTypedOptions = Required<TypedOptions>;
442
+ export type RequiredCountdownOptions = Required<CountdownOptions>;
443
+ export type RequiredCustomCodeOptions = Required<CustomCodeOptions>;
444
+ export type RequiredTabsOptions = Required<TabsOptions>;
445
+ export type RequiredGrapesBlocksOptions = Required<GrapesBlocksOptions>;
446
+ export {};