@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,9 +1,10 @@
1
- import { commandNameCustomCode, keyCustomCode, typeCustomCode } from "./utils.js";
2
- var components_default = (editor, opts = {}) => {
3
- const { Components } = editor;
4
- const { toolbarBtnCustomCode } = opts;
1
+ import { commandNameCustomCode, keyCustomCode, typeCustomCode } from "../consts.js";
2
+ import { AddComponent } from "./index.js";
3
+ var customCode_default = (editor, opts) => {
4
+ const addComponent = AddComponent(editor);
5
5
  let timedInterval;
6
- Components.addType("script", {
6
+ const { propsCustomCode, toolbarBtnCustomCode, placeholderScript } = opts;
7
+ addComponent("script", {
7
8
  view: {
8
9
  onRender() {
9
10
  const { model, el } = this;
@@ -12,7 +13,7 @@ var components_default = (editor, opts = {}) => {
12
13
  }
13
14
  }
14
15
  });
15
- Components.addType(typeCustomCode, {
16
+ addComponent(typeCustomCode, {
16
17
  model: {
17
18
  defaults: {
18
19
  name: "Custom Code",
@@ -20,9 +21,9 @@ var components_default = (editor, opts = {}) => {
20
21
  components: {
21
22
  tagName: "span",
22
23
  components: { type: "textnode", content: "Insert here your custom code" }
23
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
24
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
24
25
  },
25
- ...opts.propsCustomCode
26
+ ...propsCustomCode
26
27
  },
27
28
  /**
28
29
  * Initilize the component
@@ -38,8 +39,8 @@ var components_default = (editor, opts = {}) => {
38
39
  id,
39
40
  command: commandNameCustomCode,
40
41
  label: `<svg viewBox="0 0 24 24">
41
- <path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path>
42
- </svg>`,
42
+ <path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path>
43
+ </svg>`,
43
44
  ...toolbarBtnCustomCode
44
45
  });
45
46
  }
@@ -54,7 +55,7 @@ var components_default = (editor, opts = {}) => {
54
55
  view: {
55
56
  events: {
56
57
  dblclick: "onActive"
57
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
58
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
58
59
  },
59
60
  init() {
60
61
  this.listenTo(this.model.components(), "add remove reset", this.onComponentsChange);
@@ -64,13 +65,13 @@ var components_default = (editor, opts = {}) => {
64
65
  * Things to do once inner components of custom code are changed
65
66
  */
66
67
  onComponentsChange() {
67
- timedInterval && clearInterval(timedInterval);
68
+ timedInterval && clearTimeout(timedInterval);
68
69
  timedInterval = setTimeout(() => {
69
70
  const { model, el } = this;
70
71
  const content = model.get(keyCustomCode) || "";
71
72
  let droppable = true;
72
- if (content.indexOf("<script") >= 0 && opts.placeholderScript) {
73
- el.innerHTML = opts.placeholderScript;
73
+ if (content.indexOf("<script") >= 0 && placeholderScript) {
74
+ el.innerHTML = placeholderScript;
74
75
  droppable = false;
75
76
  }
76
77
  model.set({ droppable });
@@ -84,5 +85,5 @@ var components_default = (editor, opts = {}) => {
84
85
  });
85
86
  };
86
87
  export {
87
- components_default as default
88
+ customCode_default as default
88
89
  };
@@ -0,0 +1,3 @@
1
+ import type { Editor } from 'grapesjs';
2
+ declare const _default: (editor: Editor) => void;
3
+ export default _default;
@@ -1,14 +1,17 @@
1
- const typeForm = "form";
2
- const typeInput = "input";
3
- const typeTextarea = "textarea";
4
- const typeSelect = "select";
5
- const typeCheckbox = "checkbox";
6
- const typeRadio = "radio";
7
- const typeButton = "button";
8
- const typeLabel = "label";
9
- const typeOption = "option";
10
- function components_default(editor) {
11
- const { Components } = editor;
1
+ import {
2
+ typeButton,
3
+ typeCheckbox,
4
+ typeForm,
5
+ typeInput,
6
+ typeLabel,
7
+ typeOption,
8
+ typeRadio,
9
+ typeSelect,
10
+ typeTextarea
11
+ } from "../consts.js";
12
+ import { AddComponent } from "./index.js";
13
+ var forms_default = (editor) => {
14
+ const addComponent = AddComponent(editor);
12
15
  const idTrait = {
13
16
  name: "id"
14
17
  };
@@ -40,7 +43,7 @@ function components_default(editor) {
40
43
  ev.preventDefault();
41
44
  }
42
45
  };
43
- Components.addType(typeForm, {
46
+ addComponent(typeForm, {
44
47
  isComponent: (el) => el.tagName === "FORM",
45
48
  model: {
46
49
  defaults: {
@@ -76,11 +79,11 @@ function components_default(editor) {
76
79
  // The submit of the form might redirect the user from the editor so
77
80
  // we should always prevent the default here.
78
81
  submit: (e) => e.preventDefault()
79
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
82
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
80
83
  }
81
84
  }
82
85
  });
83
- Components.addType(typeInput, {
86
+ addComponent(typeInput, {
84
87
  isComponent: (el) => el.tagName === "INPUT",
85
88
  model: {
86
89
  defaults: {
@@ -124,7 +127,7 @@ function components_default(editor) {
124
127
  }
125
128
  }
126
129
  });
127
- Components.addType(typeTextarea, {
130
+ addComponent(typeTextarea, {
128
131
  extend: typeInput,
129
132
  isComponent: (el) => el.tagName === "TEXTAREA",
130
133
  model: {
@@ -135,7 +138,7 @@ function components_default(editor) {
135
138
  }
136
139
  }
137
140
  });
138
- Components.addType(typeOption, {
141
+ addComponent(typeOption, {
139
142
  isComponent: (el) => el.tagName === "OPTION",
140
143
  model: {
141
144
  defaults: {
@@ -147,7 +150,7 @@ function components_default(editor) {
147
150
  }
148
151
  }
149
152
  });
150
- Components.addType(typeSelect, {
153
+ addComponent(typeSelect, {
151
154
  isComponent: (el) => el.tagName === "SELECT",
152
155
  model: {
153
156
  defaults: {
@@ -168,11 +171,11 @@ function components_default(editor) {
168
171
  view: {
169
172
  events: {
170
173
  mousedown: checkIfInPreview
171
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
174
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
172
175
  }
173
176
  }
174
177
  });
175
- Components.addType(typeCheckbox, {
178
+ addComponent(typeCheckbox, {
176
179
  extend: typeInput,
177
180
  isComponent: (el) => el.tagName === "INPUT" && el.type === "checkbox",
178
181
  model: {
@@ -185,7 +188,7 @@ function components_default(editor) {
185
188
  view: {
186
189
  events: {
187
190
  click: checkIfInPreview
188
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
191
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
189
192
  },
190
193
  init() {
191
194
  this.listenTo(this.model, "change:attributes:checked", this.handleChecked);
@@ -195,7 +198,7 @@ function components_default(editor) {
195
198
  }
196
199
  }
197
200
  });
198
- Components.addType(typeRadio, {
201
+ addComponent(typeRadio, {
199
202
  extend: typeCheckbox,
200
203
  isComponent: (el) => el.tagName === "INPUT" && el.type === "radio",
201
204
  model: {
@@ -204,7 +207,7 @@ function components_default(editor) {
204
207
  }
205
208
  }
206
209
  });
207
- Components.addType(typeButton, {
210
+ addComponent(typeButton, {
208
211
  extend: typeInput,
209
212
  isComponent: (el) => el.tagName === "BUTTON",
210
213
  model: {
@@ -253,32 +256,23 @@ function components_default(editor) {
253
256
  view: {
254
257
  events: {
255
258
  click: checkIfInPreview
256
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
259
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
257
260
  }
258
261
  }
259
262
  });
260
- Components.addType(typeLabel, {
263
+ addComponent(typeLabel, {
261
264
  extend: "text",
262
265
  isComponent: (el) => el.tagName === "LABEL",
263
266
  model: {
264
267
  defaults: {
265
268
  tagName: "label",
266
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
269
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
267
270
  components: "Label",
268
271
  traits: [forTrait]
269
272
  }
270
273
  }
271
274
  });
272
- }
275
+ };
273
276
  export {
274
- components_default as default,
275
- typeButton,
276
- typeCheckbox,
277
- typeForm,
278
- typeInput,
279
- typeLabel,
280
- typeOption,
281
- typeRadio,
282
- typeSelect,
283
- typeTextarea
277
+ forms_default as default
284
278
  };
@@ -0,0 +1,5 @@
1
+ import type { AddComponentTypeOptions, Editor } from 'grapesjs';
2
+ import type { RequiredGrapesBlocksOptions } from '../types.js';
3
+ export declare const AddComponent: (editor: Editor) => (id: string, def: AddComponentTypeOptions) => void;
4
+ export declare const loadComponents: (editor: Editor, opts: RequiredGrapesBlocksOptions) => void;
5
+ export default loadComponents;
@@ -0,0 +1,23 @@
1
+ import countdownComponent from "./countdown.js";
2
+ import customCode from "./customCode.js";
3
+ import formsComponents from "./forms.js";
4
+ import tabLoader from "./tabLoader.js";
5
+ import tooltipComponent from "./tooltip.js";
6
+ import typedComponent from "./typed.js";
7
+ const AddComponent = (editor) => (id, def) => {
8
+ editor.Components.addType(id, def);
9
+ };
10
+ const loadComponents = (editor, opts) => {
11
+ tooltipComponent(editor, opts.tooltip);
12
+ typedComponent(editor, opts.typed);
13
+ countdownComponent(editor, opts.countdown);
14
+ customCode(editor, opts.customCode);
15
+ formsComponents(editor);
16
+ tabLoader(editor, opts.tabOptions);
17
+ };
18
+ var components_default = loadComponents;
19
+ export {
20
+ AddComponent,
21
+ components_default as default,
22
+ loadComponents
23
+ };
@@ -0,0 +1,4 @@
1
+ import type { Editor } from 'grapesjs';
2
+ import type { RequiredTabsOptions } from '../types.js';
3
+ declare const _default: (editor: Editor, config: RequiredTabsOptions) => void;
4
+ export default _default;
@@ -1,8 +1,8 @@
1
- import Tab from "./Tab.js";
2
- import TabContainer from "./TabContainer.js";
3
- import TabContent from "./TabContent.js";
4
- import TabContents from "./TabContents.js";
5
- import Tabs from "./Tabs.js";
1
+ import Tab from "./tabs/Tab.js";
2
+ import TabContainer from "./tabs/TabContainer.js";
3
+ import TabContent from "./tabs/TabContent.js";
4
+ import TabContents from "./tabs/TabContents.js";
5
+ import Tabs from "./tabs/Tabs.js";
6
6
  const components = [
7
7
  TabContainer,
8
8
  // Load container first
@@ -14,7 +14,7 @@ const components = [
14
14
  Tabs
15
15
  // Finally the main tabs component
16
16
  ];
17
- var components_default = (editor, config) => {
17
+ var tabLoader_default = (editor, config) => {
18
18
  const opts = {
19
19
  ...config,
20
20
  defaultModel: editor.DomComponents.getType("default").model,
@@ -25,5 +25,5 @@ var components_default = (editor, config) => {
25
25
  }
26
26
  };
27
27
  export {
28
- components_default as default
28
+ tabLoader_default as default
29
29
  };
@@ -1,5 +1,5 @@
1
1
  import type { Component, Editor } from 'grapesjs';
2
- import type { TabConfig } from '../types.js';
2
+ import type { TabConfig } from '../../types.js';
3
3
  export interface TabComponent extends Component {
4
4
  tabContent?: Component;
5
5
  __initTab(index: number): void;
@@ -1,4 +1,4 @@
1
- import { resolveTemplate } from "../options.js";
1
+ import { resolveTemplate } from "../../consts.js";
2
2
  var Tab_default = (editor, config) => {
3
3
  const { Components } = editor;
4
4
  const prevSelectorTab = "data-prev";
@@ -77,7 +77,7 @@ var Tab_default = (editor, config) => {
77
77
  )[0];
78
78
  return content;
79
79
  },
80
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
80
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
81
81
  clone(opt = {}, ...args) {
82
82
  const fromParent = opt._inner;
83
83
  if (fromParent) {
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'grapesjs';
2
- import type { TabContainerConfig } from '../types.js';
2
+ import type { TabContainerConfig } from '../../types.js';
3
3
  export declare const role = "tablist";
4
4
  declare const _default: (editor: Editor, config: TabContainerConfig) => void;
5
5
  export default _default;
@@ -1,5 +1,5 @@
1
1
  import type { Editor } from 'grapesjs';
2
- import type { TabContentConfig } from '../types.js';
2
+ import type { TabContentConfig } from '../../types.js';
3
3
  export declare const role = "tabpanel";
4
4
  declare const _default: (editor: Editor, config: TabContentConfig) => void;
5
5
  export default _default;
@@ -1,4 +1,4 @@
1
1
  import type { Editor } from 'grapesjs';
2
- import type { TabContentsConfig } from '../types.js';
2
+ import type { TabContentsConfig } from '../../types.js';
3
3
  declare const _default: (editor: Editor, config: TabContentsConfig) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
1
  import type { Editor } from 'grapesjs';
2
- import type { TabsOptions } from '../types.js';
2
+ import type { TabsOptions } from '../../types.js';
3
3
  declare const _default: (editor: Editor, config: TabsOptions) => void;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { resolveTemplate } from "../options.js";
1
+ import { resolveTemplate } from "../../consts.js";
2
2
  var Tabs_default = (editor, config) => {
3
3
  const { Components } = editor;
4
4
  const script = function(props) {
@@ -11,9 +11,9 @@ var Tabs_default = (editor, config) => {
11
11
  const roleTab = "[role=tab]";
12
12
  const roleTabContent = "[role=tabpanel]";
13
13
  const { body, location } = document;
14
- const matches = body.matches || // biome-ignore lint/suspicious/noExplicitAny: <explanation>
15
- body.webkitMatchesSelector || // biome-ignore lint/suspicious/noExplicitAny: <explanation>
16
- body.mozMatchesSelector || // biome-ignore lint/suspicious/noExplicitAny: <explanation>
14
+ const matches = body.matches || // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
15
+ body.webkitMatchesSelector || // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
16
+ body.mozMatchesSelector || // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
17
17
  body.msMatchesSelector;
18
18
  const each = (items, clb) => {
19
19
  Array.from(items).forEach(clb);
@@ -28,7 +28,7 @@ var Tabs_default = (editor, config) => {
28
28
  const getAllTabs = () => el.querySelectorAll(roleTab);
29
29
  const upTabIdx = (item, val) => {
30
30
  if (!_isEditor) {
31
- item.tabIndex = Number.parseInt(val);
31
+ item.tabIndex = Number.parseInt(val, 10);
32
32
  }
33
33
  };
34
34
  const activeTab = (tabEl) => {
@@ -114,7 +114,7 @@ var Tabs_default = (editor, config) => {
114
114
  styles: styleText,
115
115
  ...config.tabsProps
116
116
  },
117
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
117
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
118
118
  isTabsComponent(comp) {
119
119
  return comp.findTabs !== void 0;
120
120
  },
@@ -130,8 +130,8 @@ var Tabs_default = (editor, config) => {
130
130
  tab.__initTab?.(tabCount);
131
131
  });
132
132
  },
133
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
134
- __onTab(tab, index, v, opts = {}) {
133
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
134
+ __onTab(tab, index, _v, opts = {}) {
135
135
  if (!opts.avoidStore && !opts.temporary) {
136
136
  tab.__initTab(index);
137
137
  }
@@ -0,0 +1,4 @@
1
+ import type { Editor } from 'grapesjs';
2
+ import type { RequiredTooltipOptions } from '../types';
3
+ export declare const tooltipComponent: (editor: Editor, opts: RequiredTooltipOptions) => void;
4
+ export default tooltipComponent;
@@ -1,96 +1,23 @@
1
- const plugin = (editor, opts = {}) => {
2
- const options = {
3
- // The ID used to create tooltip block and component
4
- id: "tooltip",
5
- // Label of the tooltip. Used for the block and component name
6
- labelTooltip: "Tooltip",
7
- // Object to extend the default tooltip block, eg. { label: 'Tooltip', category: 'Extra', ... }.
8
- // Pass a falsy value to avoid adding the block
9
- blockTooltip: {},
10
- // Object to extend the default tooltip properties, eg. `{ name: 'Tooltip', droppable: false, ... }`
11
- propsTooltip: {},
12
- // A function which allows to extend default traits by receiving the original array and returning a new one
13
- extendTraits: (traits) => traits,
14
- // Tooltip attribute prefix
15
- attrTooltip: "data-tooltip",
16
- // Tooltip class prefix
17
- classTooltip: "tooltip-component",
18
- // Custom CSS styles, this will replace the default one
19
- style: "",
20
- // Additional CSS styles
21
- styleAdditional: "",
22
- // Make all tooltip relative classes private
23
- privateClasses: true,
24
- // Indicate if the tooltip can be styled. You can also pass an array
25
- // of which properties can be styled. Eg. `['color', 'background-color']`
26
- stylableTooltip: [
27
- "background-color",
28
- "padding",
29
- "padding-top",
30
- "padding-right",
31
- "padding-bottom",
32
- "padding-left",
33
- "font-family",
34
- "font-size",
35
- "font-weight",
36
- "letter-spacing",
37
- "color",
38
- "line-height",
39
- "text-align",
40
- "border-radius",
41
- "border-top-left-radius",
42
- "border-top-right-radius",
43
- "border-bottom-left-radius",
44
- "border-bottom-right-radius",
45
- "border",
46
- "border-width",
47
- "border-style",
48
- "border-color"
49
- ],
50
- // If true, force the tooltip to be shown
51
- showTooltipOnStyle: true,
52
- ...opts
53
- };
1
+ const tooltipComponent = (editor, opts) => {
54
2
  const {
55
- propsTooltip,
3
+ id: tooltipId,
4
+ labelTooltip,
56
5
  classTooltip,
6
+ attrTooltip,
57
7
  style,
58
8
  styleAdditional,
59
- privateClasses,
60
- stylableTooltip,
9
+ extendTraits,
61
10
  showTooltipOnStyle,
62
- blockTooltip,
63
- extendTraits
64
- } = options;
65
- const id = options.id;
66
- const labelTooltip = options.labelTooltip;
67
- const attrTooltip = options.attrTooltip;
68
- if (blockTooltip) {
69
- editor.BlockManager.add(id, {
70
- media: `<svg viewBox="0 0 24 24">
71
- <path d="M4 2h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2h-4l-4 4-4-4H4c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2m0 2v12h4.83L12 19.17 15.17 16H20V4H4z"></path>
72
- </svg>`,
73
- label: labelTooltip,
74
- category: "Extra",
75
- select: true,
76
- content: { type: id },
77
- ...blockTooltip
78
- });
79
- }
11
+ propsTooltip,
12
+ stylableTooltip
13
+ } = opts;
80
14
  const classTooltipBody = `${classTooltip}__body`;
81
15
  const classTooltipEmpty = `${classTooltip}--empty`;
82
16
  const attrTooltipVis = `${attrTooltip}-visible`;
83
17
  const attrTooltipPos = `${attrTooltip}-pos`;
84
18
  const attrTooltipLen = `${attrTooltip}-length`;
85
19
  const traitIdStyleTooltip = "style-tooltip";
86
- if (privateClasses) {
87
- editor.SelectorManager.getAll().add([
88
- { private: 1, name: classTooltip },
89
- { private: 1, name: classTooltipBody },
90
- { private: 1, name: classTooltipEmpty }
91
- ]);
92
- }
93
- editor.Components.addType(id, {
20
+ editor.Components.addType(tooltipId, {
94
21
  isComponent: (el) => el.hasAttribute?.(attrTooltip),
95
22
  model: {
96
23
  defaults: {
@@ -204,7 +131,7 @@ const plugin = (editor, opts = {}) => {
204
131
  overflow: visible;
205
132
  }
206
133
  `) + styleAdditional,
207
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
134
+ // biome-ignore lint/style/noNonNullAssertion: This is the type that was already used in the original code
208
135
  traits: extendTraits([
209
136
  {
210
137
  name: attrTooltip,
@@ -288,7 +215,7 @@ const plugin = (editor, opts = {}) => {
288
215
  editor2.StyleManager.select(ruleTooltip);
289
216
  if (showTooltipOnStyle) {
290
217
  const selected = editor2.getSelected();
291
- if (selected?.is(id)) {
218
+ if (selected?.is(tooltipId)) {
292
219
  selected.addAttributes({ [attrTooltipVis]: "true" });
293
220
  editor2.once("style:target", () => {
294
221
  selected.addAttributes({ [attrTooltipVis]: "false" });
@@ -298,7 +225,7 @@ const plugin = (editor, opts = {}) => {
298
225
  }
299
226
  }
300
227
  ]),
301
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
228
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
302
229
  ...propsTooltip
303
230
  },
304
231
  init() {
@@ -312,7 +239,8 @@ const plugin = (editor, opts = {}) => {
312
239
  }
313
240
  });
314
241
  };
315
- var tooltip_default = plugin;
242
+ var tooltip_default = tooltipComponent;
316
243
  export {
317
- tooltip_default as default
244
+ tooltip_default as default,
245
+ tooltipComponent
318
246
  };
@@ -0,0 +1,9 @@
1
+ import type { Editor } from 'grapesjs';
2
+ import type { RequiredTypedOptions } from '../types.js';
3
+ declare global {
4
+ interface Window {
5
+ Typed: any;
6
+ }
7
+ }
8
+ declare const _default: (editor: Editor, opts: RequiredTypedOptions) => void;
9
+ export default _default;
@@ -1,10 +1,10 @@
1
- import { cmpId, traitStringId } from "./utils.js";
1
+ import { typedId, typedTraitStringId } from "../consts.js";
2
2
  const getTraitType = (value) => {
3
3
  if (typeof value === "number") return "number";
4
4
  if (typeof value === "boolean") return "checkbox";
5
5
  return "text";
6
6
  };
7
- var components_default = (editor, opts) => {
7
+ var typed_default = (editor, opts) => {
8
8
  const domc = editor.DomComponents;
9
9
  const { keys } = Object;
10
10
  const typedProps = {
@@ -30,7 +30,7 @@ var components_default = (editor, opts) => {
30
30
  const typedPropsKeys = keys(typedProps);
31
31
  const traits = typedPropsKeys.filter((item) => ["strings"].indexOf(item) < 0).map((name) => ({
32
32
  changeProp: true,
33
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
33
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
34
34
  type: getTraitType(typedProps[name]),
35
35
  min: 0,
36
36
  name
@@ -38,9 +38,9 @@ var components_default = (editor, opts) => {
38
38
  traits.unshift({
39
39
  changeProp: true,
40
40
  name: "strings",
41
- type: traitStringId
41
+ type: typedTraitStringId
42
42
  });
43
- domc.addType(cmpId, {
43
+ domc.addType(typedId, {
44
44
  model: {
45
45
  defaults: opts.props({
46
46
  ...typedProps,
@@ -99,11 +99,11 @@ var components_default = (editor, opts) => {
99
99
  init();
100
100
  }
101
101
  }
102
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
102
+ // biome-ignore lint/suspicious/noExplicitAny: This is the type that was already used in the original code
103
103
  })
104
104
  }
105
105
  });
106
106
  };
107
107
  export {
108
- components_default as default
108
+ typed_default as default
109
109
  };
@@ -0,0 +1,25 @@
1
+ import type { RequiredGrapesBlocksOptions, TabsOptions, TabTemplate, TabTemplateProps } from './types.js';
2
+ export declare const cmdImport = "gjs-open-import-webpage";
3
+ export declare const cmdDeviceDesktop = "set-device-desktop";
4
+ export declare const cmdDeviceTablet = "set-device-tablet";
5
+ export declare const cmdDeviceMobile = "set-device-mobile";
6
+ export declare const exportTemplate = "export-template";
7
+ export declare const cmdClear = "canvas-clear";
8
+ export declare const cmdSave = "store-data";
9
+ export declare const typedId = "typed";
10
+ export declare const typedTraitStringId = "typed-strings";
11
+ export declare const keyCustomCode = "custom-code-plugin__code";
12
+ export declare const typeCustomCode = "custom-code";
13
+ export declare const commandNameCustomCode = "custom-code:open-modal";
14
+ export declare const typeForm = "form";
15
+ export declare const typeInput = "input";
16
+ export declare const typeTextarea = "textarea";
17
+ export declare const typeSelect = "select";
18
+ export declare const typeCheckbox = "checkbox";
19
+ export declare const typeRadio = "radio";
20
+ export declare const typeButton = "button";
21
+ export declare const typeLabel = "label";
22
+ export declare const typeOption = "option";
23
+ export declare const resolveTemplate: (template: TabTemplate | undefined, props: TabTemplateProps) => string | undefined;
24
+ export declare const mergeStyles: (userStyle?: (config: TabsOptions) => string) => (config: TabsOptions) => string;
25
+ export declare const defaultGrapesBlocksOptions: RequiredGrapesBlocksOptions;