@blockslides/react-prebuilts 0.1.0

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.md ADDED
@@ -0,0 +1,36 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 BlockSlides
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ## Acknowledgments
26
+
27
+ This project includes code and patterns adapted from [Tiptap](https://tiptap.dev),
28
+ an open-source headless editor framework for web artisans.
29
+
30
+ **Tiptap License:**
31
+
32
+ - Copyright (c) 2025, Tiptap GmbH
33
+ - Licensed under MIT License
34
+ - Original source: https://github.com/ueberdosis/tiptap
35
+
36
+ See `_tiptap/LICENSE.md` for the full Tiptap license.
package/dist/index.cjs ADDED
@@ -0,0 +1,381 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/index.ts
32
+ var index_exports = {};
33
+ __export(index_exports, {
34
+ BubbleMenuPreset: () => BubbleMenuPreset,
35
+ ReactSlideEditor: () => SlideEditor,
36
+ useSlideEditor: () => useSlideEditor
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/SlideEditor.tsx
41
+ var import_react5 = require("react");
42
+ var import_react6 = require("@blockslides/react");
43
+
44
+ // src/menus/BubbleMenuPreset.tsx
45
+ var import_react = __toESM(require("react"), 1);
46
+ var import_react_dom = require("react-dom");
47
+ var import_react2 = require("@blockslides/react");
48
+ var import_extension_bubble_menu = require("@blockslides/extension-bubble-menu");
49
+ var import_state = require("@blockslides/pm/state");
50
+ var import_extension_bubble_menu_preset = require("@blockslides/extension-bubble-menu-preset");
51
+ var import_core = require("@blockslides/core");
52
+ var import_jsx_runtime = require("react/jsx-runtime");
53
+ var BubbleMenuPreset = import_react.default.forwardRef(
54
+ ({
55
+ editor,
56
+ updateDelay,
57
+ resizeDelay,
58
+ appendTo,
59
+ shouldShow,
60
+ getReferencedVirtualElement,
61
+ options,
62
+ items,
63
+ className,
64
+ injectStyles,
65
+ textColors,
66
+ highlightColors,
67
+ fonts,
68
+ fontSizes,
69
+ alignments,
70
+ onTextAction,
71
+ onImageReplace,
72
+ ...rest
73
+ }, ref) => {
74
+ const pluginKey = "bubbleMenuPreset";
75
+ const { editor: currentEditor } = (0, import_react2.useCurrentEditor)();
76
+ const menuEl = (0, import_react.useRef)(null);
77
+ (0, import_react.useEffect)(() => {
78
+ const attachToEditor = editor || currentEditor;
79
+ if (!attachToEditor || attachToEditor.isDestroyed) {
80
+ return;
81
+ }
82
+ const { element, cleanup } = (0, import_extension_bubble_menu_preset.buildMenuElement)(attachToEditor, {
83
+ items: items != null ? items : import_extension_bubble_menu_preset.DEFAULT_ITEMS,
84
+ className: className != null ? className : "",
85
+ injectStyles: injectStyles !== false,
86
+ textColors: textColors != null ? textColors : import_extension_bubble_menu_preset.DEFAULT_COLOR_PALETTE,
87
+ highlightColors: highlightColors != null ? highlightColors : import_extension_bubble_menu_preset.DEFAULT_HIGHLIGHT_PALETTE,
88
+ fonts: fonts != null ? fonts : import_extension_bubble_menu_preset.DEFAULT_FONTS,
89
+ fontSizes: fontSizes != null ? fontSizes : import_extension_bubble_menu_preset.DEFAULT_FONT_SIZES,
90
+ alignments: alignments != null ? alignments : import_extension_bubble_menu_preset.DEFAULT_ALIGNMENTS,
91
+ onTextAction,
92
+ onImageReplace
93
+ });
94
+ menuEl.current = element;
95
+ if (typeof ref === "function") {
96
+ ref(element);
97
+ } else if (ref) {
98
+ ;
99
+ ref.current = element;
100
+ }
101
+ const defaultShouldShow = ({
102
+ state,
103
+ editor: editor2
104
+ }) => {
105
+ var _a, _b;
106
+ const sel = state.selection;
107
+ const imageSelection = sel instanceof import_state.NodeSelection && ["image", "imageBlock"].includes((_b = (_a = sel.node) == null ? void 0 : _a.type) == null ? void 0 : _b.name) || editor2.isActive("image") || editor2.isActive("imageBlock");
108
+ if (imageSelection) return true;
109
+ if ((0, import_core.isTextSelection)(sel) && !sel.empty && !imageSelection) return true;
110
+ return false;
111
+ };
112
+ const plugin = (0, import_extension_bubble_menu.BubbleMenuPlugin)({
113
+ editor: attachToEditor,
114
+ element,
115
+ updateDelay,
116
+ resizeDelay,
117
+ appendTo,
118
+ pluginKey,
119
+ shouldShow: shouldShow != null ? shouldShow : defaultShouldShow,
120
+ getReferencedVirtualElement,
121
+ options
122
+ });
123
+ attachToEditor.registerPlugin(plugin);
124
+ return () => {
125
+ attachToEditor.unregisterPlugin(pluginKey);
126
+ cleanup == null ? void 0 : cleanup();
127
+ if (element.parentNode) {
128
+ element.parentNode.removeChild(element);
129
+ }
130
+ };
131
+ }, [
132
+ editor,
133
+ currentEditor,
134
+ updateDelay,
135
+ resizeDelay,
136
+ appendTo,
137
+ shouldShow,
138
+ getReferencedVirtualElement,
139
+ options,
140
+ items,
141
+ className,
142
+ injectStyles,
143
+ textColors,
144
+ highlightColors,
145
+ fonts,
146
+ fontSizes,
147
+ alignments,
148
+ onTextAction,
149
+ onImageReplace,
150
+ ref
151
+ ]);
152
+ return menuEl.current ? (0, import_react_dom.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...rest }), menuEl.current) : null;
153
+ }
154
+ );
155
+ BubbleMenuPreset.displayName = "BubbleMenuPreset";
156
+
157
+ // src/useSlideEditor.ts
158
+ var import_react3 = require("react");
159
+ var import_ai_context = require("@blockslides/ai-context");
160
+ var import_extension_kit = require("@blockslides/extension-kit");
161
+ var import_react4 = require("@blockslides/react");
162
+ var defaultSlide = () => ({
163
+ /**
164
+ * Placeholder slide if no content is provided.
165
+ */
166
+ type: "doc",
167
+ content: [
168
+ {
169
+ type: "slide",
170
+ attrs: {
171
+ size: "16x9",
172
+ className: "",
173
+ id: "slide-1",
174
+ backgroundMode: "none",
175
+ backgroundColor: null,
176
+ backgroundImage: null,
177
+ backgroundOverlayColor: null,
178
+ backgroundOverlayOpacity: null
179
+ },
180
+ content: [
181
+ {
182
+ type: "column",
183
+ attrs: {
184
+ align: "center",
185
+ padding: "lg",
186
+ margin: null,
187
+ gap: "md",
188
+ backgroundColor: "#ffffff",
189
+ backgroundImage: null,
190
+ borderRadius: null,
191
+ border: null,
192
+ fill: true,
193
+ width: null,
194
+ height: null,
195
+ justify: "center"
196
+ },
197
+ content: [
198
+ {
199
+ type: "heading",
200
+ attrs: {
201
+ align: null,
202
+ padding: null,
203
+ margin: null,
204
+ gap: null,
205
+ backgroundColor: null,
206
+ backgroundImage: null,
207
+ borderRadius: null,
208
+ border: null,
209
+ fill: null,
210
+ width: null,
211
+ height: null,
212
+ justify: null,
213
+ id: "1fc4664c-333d-4203-a3f1-3ad27a54c535",
214
+ "data-toc-id": "1fc4664c-333d-4203-a3f1-3ad27a54c535",
215
+ level: 1
216
+ },
217
+ content: [
218
+ {
219
+ type: "text",
220
+ text: "Lorem ipsum dolor sit amet"
221
+ }
222
+ ]
223
+ },
224
+ {
225
+ type: "paragraph",
226
+ attrs: {
227
+ align: null,
228
+ padding: null,
229
+ margin: null,
230
+ gap: null,
231
+ backgroundColor: null,
232
+ backgroundImage: null,
233
+ borderRadius: null,
234
+ border: null,
235
+ fill: null,
236
+ width: null,
237
+ height: null,
238
+ justify: null
239
+ },
240
+ content: [
241
+ {
242
+ type: "text",
243
+ text: "Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. "
244
+ }
245
+ ]
246
+ }
247
+ ]
248
+ }
249
+ ]
250
+ }
251
+ ]
252
+ });
253
+ var defaultAddSlideButton = (presets) => ({
254
+ showPresets: true,
255
+ presets,
256
+ presetBackground: "#0f172a",
257
+ presetForeground: "#e5e7eb"
258
+ });
259
+ var defaultSlideOptions = {
260
+ renderMode: "dynamic",
261
+ hoverOutline: { color: "#3b82f6", width: "1.5px", offset: "4px" },
262
+ hoverOutlineCascade: false
263
+ };
264
+ var useSlideEditor = ({
265
+ content,
266
+ onChange,
267
+ extensions,
268
+ extensionKitOptions,
269
+ presetTemplates,
270
+ deps = [],
271
+ onEditorReady,
272
+ immediatelyRender = false,
273
+ shouldRerenderOnTransaction = false,
274
+ theme = "light",
275
+ editorProps,
276
+ onUpdate,
277
+ ...editorOptions
278
+ } = {}) => {
279
+ var _a;
280
+ const presets = (0, import_react3.useMemo)(
281
+ () => presetTemplates != null ? presetTemplates : import_ai_context.templatesV1.listPresetTemplates(),
282
+ [presetTemplates]
283
+ );
284
+ const mergedExtensionKitOptions = (0, import_react3.useMemo)(() => {
285
+ var _a2, _b;
286
+ const addSlideButton = (extensionKitOptions == null ? void 0 : extensionKitOptions.addSlideButton) === false ? false : {
287
+ ...defaultAddSlideButton(presets),
288
+ ...(_a2 = extensionKitOptions == null ? void 0 : extensionKitOptions.addSlideButton) != null ? _a2 : {}
289
+ };
290
+ const slide = (extensionKitOptions == null ? void 0 : extensionKitOptions.slide) === false ? false : {
291
+ ...defaultSlideOptions,
292
+ ...(_b = extensionKitOptions == null ? void 0 : extensionKitOptions.slide) != null ? _b : {}
293
+ };
294
+ return {
295
+ ...extensionKitOptions,
296
+ addSlideButton,
297
+ slide
298
+ };
299
+ }, [extensionKitOptions, presets]);
300
+ const resolvedExtensions = (0, import_react3.useMemo)(() => {
301
+ const kit = import_extension_kit.ExtensionKit.configure(mergedExtensionKitOptions);
302
+ return extensions ? [kit, ...extensions] : [kit];
303
+ }, [extensions, mergedExtensionKitOptions]);
304
+ const initialContent = content != null ? content : defaultSlide();
305
+ const editor = (0, import_react4.useEditor)(
306
+ {
307
+ content: initialContent,
308
+ extensions: resolvedExtensions,
309
+ immediatelyRender,
310
+ shouldRerenderOnTransaction,
311
+ theme,
312
+ editorProps: {
313
+ attributes: {
314
+ autocomplete: "off",
315
+ autocorrect: "off",
316
+ autocapitalize: "off",
317
+ class: "min-h-full min-w-full",
318
+ ...(_a = editorProps == null ? void 0 : editorProps.attributes) != null ? _a : {}
319
+ },
320
+ ...editorProps
321
+ },
322
+ ...editorOptions,
323
+ onUpdate: (ctx) => {
324
+ const json = ctx.editor.getJSON();
325
+ onChange == null ? void 0 : onChange(json, ctx.editor);
326
+ onUpdate == null ? void 0 : onUpdate(ctx);
327
+ }
328
+ },
329
+ deps
330
+ );
331
+ (0, import_react3.useEffect)(() => {
332
+ if (editor && !editor.isDestroyed) {
333
+ onEditorReady == null ? void 0 : onEditorReady(editor);
334
+ }
335
+ }, [editor, onEditorReady]);
336
+ return { editor, presets };
337
+ };
338
+
339
+ // src/SlideEditor.tsx
340
+ var import_jsx_runtime2 = require("react/jsx-runtime");
341
+ var SlideEditor = (0, import_react5.forwardRef)(
342
+ ({
343
+ bubbleMenuPreset = true,
344
+ editorContentProps,
345
+ viewportScale = 1,
346
+ className,
347
+ style,
348
+ ...hookProps
349
+ }, ref) => {
350
+ const { editor } = useSlideEditor(hookProps);
351
+ const bubbleMenuProps = (0, import_react5.useMemo)(() => {
352
+ if (bubbleMenuPreset === false) return null;
353
+ if (bubbleMenuPreset === true) return {};
354
+ return bubbleMenuPreset;
355
+ }, [bubbleMenuPreset]);
356
+ if (!editor) return null;
357
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { ref, className, style, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
358
+ "div",
359
+ {
360
+ className: "bs-viewport",
361
+ style: { ["--zoom"]: viewportScale },
362
+ children: [
363
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_react6.EditorContent, { editor, ...editorContentProps }),
364
+ bubbleMenuProps && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BubbleMenuPreset, { editor, ...bubbleMenuProps })
365
+ ]
366
+ }
367
+ ) });
368
+ }
369
+ );
370
+ SlideEditor.displayName = "SlideEditor";
371
+
372
+ // src/index.ts
373
+ __reExport(index_exports, require("@blockslides/react"), module.exports);
374
+ // Annotate the CommonJS export names for ESM import in node:
375
+ 0 && (module.exports = {
376
+ BubbleMenuPreset,
377
+ ReactSlideEditor,
378
+ useSlideEditor,
379
+ ...require("@blockslides/react")
380
+ });
381
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/SlideEditor.tsx","../src/menus/BubbleMenuPreset.tsx","../src/useSlideEditor.ts"],"sourcesContent":["export { SlideEditor as ReactSlideEditor } from \"./SlideEditor.js\";\nexport * from \"./useSlideEditor.js\";\nexport * from \"./menus/BubbleMenuPreset.js\";\n\n// Re-export everything from @blockslides/react core\nexport * from \"@blockslides/react\";\n\n// Note: @blockslides/core is already re-exported by @blockslides/react\n","import React, { forwardRef, useMemo } from \"react\";\nimport type { CSSProperties } from \"react\";\n\nimport { EditorContent, type EditorContentProps } from \"@blockslides/react\";\nimport {\n BubbleMenuPreset,\n type BubbleMenuPresetProps,\n} from \"./menus/BubbleMenuPreset.js\";\nimport {\n useSlideEditor,\n type UseSlideEditorProps,\n} from \"./useSlideEditor.js\";\n\nexport type SlideEditorProps = UseSlideEditorProps & {\n /**\n * Toggle or customize the built-in BubbleMenuPreset.\n * - true (default): render with defaults\n * - false: disable entirely\n * - object: pass through to BubbleMenuPreset\n */\n bubbleMenuPreset?: boolean | BubbleMenuPresetProps;\n /**\n * Additional props forwarded to EditorContent.\n */\n editorContentProps?: Omit<EditorContentProps, \"editor\">;\n /**\n * Viewport scale factor applied to the slide viewport.\n * @default 1\n */\n viewportScale?: number;\n className?: string;\n style?: CSSProperties;\n};\n\nexport const SlideEditor = forwardRef<HTMLDivElement, SlideEditorProps>(\n (\n {\n bubbleMenuPreset = true,\n editorContentProps,\n viewportScale = 1,\n className,\n style,\n ...hookProps\n },\n ref\n ) => {\n const { editor } = useSlideEditor(hookProps);\n\n const bubbleMenuProps = useMemo(() => {\n if (bubbleMenuPreset === false) return null;\n if (bubbleMenuPreset === true) return {};\n return bubbleMenuPreset;\n }, [bubbleMenuPreset]);\n\n if (!editor) return null;\n\n return (\n <div ref={ref} className={className} style={style}>\n <div\n className=\"bs-viewport\"\n style={{ [\"--zoom\" as any]: viewportScale }}\n >\n <EditorContent editor={editor} {...editorContentProps} />\n {bubbleMenuProps && (\n <BubbleMenuPreset editor={editor} {...bubbleMenuProps} />\n )}\n </div>\n </div>\n );\n }\n);\n\nSlideEditor.displayName = \"SlideEditor\";\n","import React, { useEffect, useRef } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useCurrentEditor } from '@blockslides/react'\nimport {\n BubbleMenuPlugin,\n type BubbleMenuPluginProps,\n} from '@blockslides/extension-bubble-menu'\nimport { NodeSelection } from '@blockslides/pm/state'\nimport {\n type BubbleMenuPresetOptions,\n buildMenuElement,\n DEFAULT_ITEMS,\n DEFAULT_COLOR_PALETTE,\n DEFAULT_HIGHLIGHT_PALETTE,\n DEFAULT_FONTS,\n DEFAULT_FONT_SIZES,\n DEFAULT_ALIGNMENTS,\n} from '@blockslides/extension-bubble-menu-preset'\nimport { isNodeSelection, isTextSelection, type Editor } from '@blockslides/core'\n\nexport type BubbleMenuPresetProps = Omit<BubbleMenuPresetOptions, 'element' | 'pluginKey'> &\n React.HTMLAttributes<HTMLElement> & {\n editor?: Editor | null\n }\n\nexport const BubbleMenuPreset = React.forwardRef<HTMLElement, BubbleMenuPresetProps>(\n (\n {\n editor,\n updateDelay,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n options,\n items,\n className,\n injectStyles,\n textColors,\n highlightColors,\n fonts,\n fontSizes,\n alignments,\n onTextAction,\n onImageReplace,\n ...rest\n },\n ref,\n ) => {\n const pluginKey = 'bubbleMenuPreset'\n const { editor: currentEditor } = useCurrentEditor()\n const menuEl = useRef<HTMLElement | null>(null)\n\n useEffect(() => {\n const attachToEditor = (editor || currentEditor) as Editor | null\n if (!attachToEditor || (attachToEditor as any).isDestroyed) {\n return\n }\n\n const { element, cleanup } = buildMenuElement(attachToEditor, {\n items: items ?? DEFAULT_ITEMS,\n className: className ?? '',\n injectStyles: injectStyles !== false,\n textColors: textColors ?? DEFAULT_COLOR_PALETTE,\n highlightColors: highlightColors ?? DEFAULT_HIGHLIGHT_PALETTE,\n fonts: fonts ?? DEFAULT_FONTS,\n fontSizes: fontSizes ?? DEFAULT_FONT_SIZES,\n alignments: alignments ?? DEFAULT_ALIGNMENTS,\n onTextAction,\n onImageReplace,\n })\n\n menuEl.current = element\n\n if (typeof ref === 'function') {\n ref(element)\n } else if (ref) {\n ;(ref as React.MutableRefObject<HTMLElement | null>).current = element\n }\n\n const defaultShouldShow: Exclude<BubbleMenuPluginProps['shouldShow'], null> = ({\n state,\n editor,\n }) => {\n const sel = state.selection\n const imageSelection =\n (sel instanceof NodeSelection &&\n ['image', 'imageBlock'].includes((sel as any).node?.type?.name)) ||\n editor.isActive('image') ||\n editor.isActive('imageBlock')\n\n if (imageSelection) return true\n if (isTextSelection(sel) && !sel.empty && !imageSelection) return true\n return false\n }\n\n const plugin = BubbleMenuPlugin({\n editor: attachToEditor,\n element,\n updateDelay,\n resizeDelay,\n appendTo,\n pluginKey,\n shouldShow: shouldShow ?? defaultShouldShow,\n getReferencedVirtualElement,\n options,\n })\n\n attachToEditor.registerPlugin(plugin)\n\n return () => {\n attachToEditor.unregisterPlugin(pluginKey)\n cleanup?.()\n if (element.parentNode) {\n element.parentNode.removeChild(element)\n }\n }\n }, [\n editor,\n currentEditor,\n updateDelay,\n resizeDelay,\n appendTo,\n shouldShow,\n getReferencedVirtualElement,\n options,\n items,\n className,\n injectStyles,\n textColors,\n highlightColors,\n fonts,\n fontSizes,\n alignments,\n onTextAction,\n onImageReplace,\n ref,\n ])\n\n return menuEl.current ? createPortal(<div {...rest} />, menuEl.current) : null\n },\n)\n\nBubbleMenuPreset.displayName = 'BubbleMenuPreset'\n","import { useEffect, useMemo } from \"react\";\nimport type { DependencyList } from \"react\";\nimport { templatesV1 } from \"@blockslides/ai-context\";\nimport type { AnyExtension, Editor, JSONContent } from \"@blockslides/core\";\nimport type { SlideOptions } from \"@blockslides/extension-slide\";\nimport {\n ExtensionKit,\n type ExtensionKitOptions,\n} from \"@blockslides/extension-kit\";\n\nimport {\n useEditor,\n type UseEditorOptions,\n} from \"@blockslides/react\";\n\ntype PresetTemplates = ReturnType<typeof templatesV1.listPresetTemplates>;\n\nexport type UseSlideEditorProps = {\n /**\n * Initial content for the editor. If omitted, a single preset slide is used.\n */\n content?: UseEditorOptions[\"content\"];\n /**\n * Called on every update with the current JSON document.\n */\n onChange?: (doc: JSONContent, editor: Editor) => void;\n /**\n * Additional extensions to append after the ExtensionKit bundle.\n */\n extensions?: AnyExtension[];\n /**\n * Customize or disable pieces of ExtensionKit (e.g., bubbleMenu: false).\n */\n extensionKitOptions?: ExtensionKitOptions;\n /**\n * Optional preset list to power the add-slide button.\n */\n presetTemplates?: PresetTemplates;\n /**\n * Dependencies array forwarded to useEditor for re-instantiation control.\n * Leave empty to avoid recreating the editor on prop changes.\n */\n deps?: DependencyList;\n /**\n * Called once when an editor instance is ready.\n */\n onEditorReady?: (editor: Editor) => void;\n} & Omit<UseEditorOptions, \"extensions\" | \"content\">;\n\nconst defaultSlide = () => ({\n /**\n * Placeholder slide if no content is provided.\n */\n\n type: \"doc\",\n content: [\n {\n type: \"slide\",\n attrs: {\n size: \"16x9\",\n className: \"\",\n id: \"slide-1\",\n backgroundMode: \"none\",\n backgroundColor: null,\n backgroundImage: null,\n backgroundOverlayColor: null,\n backgroundOverlayOpacity: null,\n },\n content: [\n {\n type: \"column\",\n attrs: {\n align: \"center\",\n padding: \"lg\",\n margin: null,\n gap: \"md\",\n backgroundColor: \"#ffffff\",\n backgroundImage: null,\n borderRadius: null,\n border: null,\n fill: true,\n width: null,\n height: null,\n justify: \"center\",\n },\n content: [\n {\n type: \"heading\",\n attrs: {\n align: null,\n padding: null,\n margin: null,\n gap: null,\n backgroundColor: null,\n backgroundImage: null,\n borderRadius: null,\n border: null,\n fill: null,\n width: null,\n height: null,\n justify: null,\n id: \"1fc4664c-333d-4203-a3f1-3ad27a54c535\",\n \"data-toc-id\": \"1fc4664c-333d-4203-a3f1-3ad27a54c535\",\n level: 1,\n },\n content: [\n {\n type: \"text\",\n text: \"Lorem ipsum dolor sit amet\",\n },\n ],\n },\n {\n type: \"paragraph\",\n attrs: {\n align: null,\n padding: null,\n margin: null,\n gap: null,\n backgroundColor: null,\n backgroundImage: null,\n borderRadius: null,\n border: null,\n fill: null,\n width: null,\n height: null,\n justify: null,\n },\n content: [\n {\n type: \"text\",\n text: \"Consectetur adipiscing elit. Sed do eiusmod tempor incididunt. \",\n },\n ],\n },\n ],\n },\n ],\n },\n ],\n});\n\nconst defaultAddSlideButton = (presets: PresetTemplates) => ({\n showPresets: true,\n presets,\n presetBackground: \"#0f172a\",\n presetForeground: \"#e5e7eb\",\n});\n\nconst defaultSlideOptions: Partial<SlideOptions> = {\n renderMode: \"dynamic\",\n hoverOutline: { color: \"#3b82f6\", width: \"1.5px\", offset: \"4px\" },\n hoverOutlineCascade: false,\n};\n\nexport const useSlideEditor = ({\n content,\n onChange,\n extensions,\n extensionKitOptions,\n presetTemplates,\n deps = [],\n onEditorReady,\n immediatelyRender = false,\n shouldRerenderOnTransaction = false,\n theme = \"light\",\n editorProps,\n onUpdate,\n ...editorOptions\n}: UseSlideEditorProps = {}) => {\n\n\n /**\n * Presets for add slide button.\n */\n const presets = useMemo<PresetTemplates>(\n () => presetTemplates ?? templatesV1.listPresetTemplates(),\n [presetTemplates]\n );\n\n const mergedExtensionKitOptions = useMemo<ExtensionKitOptions>(() => {\n const addSlideButton =\n extensionKitOptions?.addSlideButton === false\n ? false\n : {\n ...defaultAddSlideButton(presets),\n ...(extensionKitOptions?.addSlideButton ?? {}),\n };\n\n const slide =\n extensionKitOptions?.slide === false\n ? false\n : {\n ...defaultSlideOptions,\n ...(extensionKitOptions?.slide ?? {}),\n };\n\n return {\n ...extensionKitOptions,\n addSlideButton,\n slide,\n };\n }, [extensionKitOptions, presets]);\n\n const resolvedExtensions = useMemo<AnyExtension[]>(() => {\n const kit = ExtensionKit.configure(mergedExtensionKitOptions);\n return extensions ? [kit, ...extensions] : [kit];\n }, [extensions, mergedExtensionKitOptions]);\n\n /**\n * Initial content for the editor.\n * content, initialContent, defaultValue, value etc are all the same thing\n */\n const initialContent = content ?? defaultSlide();\n\n const editor = useEditor(\n {\n content: initialContent,\n extensions: resolvedExtensions,\n immediatelyRender,\n shouldRerenderOnTransaction,\n theme,\n editorProps: {\n attributes: {\n autocomplete: \"off\",\n autocorrect: \"off\",\n autocapitalize: \"off\",\n class: \"min-h-full min-w-full\",\n ...(editorProps?.attributes ?? {}),\n },\n ...editorProps,\n },\n ...editorOptions,\n onUpdate: (ctx) => {\n const json = ctx.editor.getJSON();\n onChange?.(json, ctx.editor);\n onUpdate?.(ctx);\n },\n },\n deps\n );\n\n useEffect(() => {\n if (editor && !editor.isDestroyed) {\n onEditorReady?.(editor);\n }\n }, [editor, onEditorReady]);\n\n return { editor, presets };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA2C;AAG3C,IAAAA,gBAAuD;;;ACHvD,mBAAyC;AACzC,uBAA6B;AAC7B,IAAAC,gBAAiC;AACjC,mCAGO;AACP,mBAA8B;AAC9B,0CASO;AACP,kBAA8D;AAyHrB;AAlHlC,IAAM,mBAAmB,aAAAC,QAAM;AAAA,EACpC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,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+BAAU,MAAM;AACd,QAAI,UAAU,CAAC,OAAO,aAAa;AACjC,qDAAgB;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,QAAQ,aAAa,CAAC;AAE1B,SAAO,EAAE,QAAQ,QAAQ;AAC3B;;;AF/LQ,IAAAC,sBAAA;AAxBD,IAAM,kBAAc;AAAA,EACzB,CACE;AAAA,IACE,mBAAmB;AAAA,IACnB;AAAA,IACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,EAAE,OAAO,IAAI,eAAe,SAAS;AAE3C,UAAM,sBAAkB,uBAAQ,MAAM;AACpC,UAAI,qBAAqB,MAAO,QAAO;AACvC,UAAI,qBAAqB,KAAM,QAAO,CAAC;AACvC,aAAO;AAAA,IACT,GAAG,CAAC,gBAAgB,CAAC;AAErB,QAAI,CAAC,OAAQ,QAAO;AAEpB,WACE,6CAAC,SAAI,KAAU,WAAsB,OACnC;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,CAAC,QAAe,GAAG,cAAc;AAAA,QAE1C;AAAA,uDAAC,+BAAc,QAAiB,GAAG,oBAAoB;AAAA,UACtD,mBACC,6CAAC,oBAAiB,QAAiB,GAAG,iBAAiB;AAAA;AAAA;AAAA,IAE3D,GACF;AAAA,EAEJ;AACF;AAEA,YAAY,cAAc;;;ADnE1B,0BAAc,+BALd;","names":["import_react","import_react","React","editor","import_react","_a","import_jsx_runtime"]}
@@ -0,0 +1,86 @@
1
+ import * as packages_ai_context_src_templates_v1_presetTemplateBuilder_js from 'packages/ai-context/src/templates/v1/presetTemplateBuilder.js';
2
+ import * as _blockslides_extension_kit from '@blockslides/extension-kit';
3
+ import { ExtensionKitOptions } from '@blockslides/extension-kit';
4
+ import * as _blockslides_core from '@blockslides/core';
5
+ import { Editor, JSONContent, AnyExtension } from '@blockslides/core';
6
+ import * as _blockslides_react from '@blockslides/react';
7
+ import { UseEditorOptions, EditorContentProps } from '@blockslides/react';
8
+ export * from '@blockslides/react';
9
+ import React, { DependencyList, CSSProperties } from 'react';
10
+ import { BubbleMenuPresetOptions } from '@blockslides/extension-bubble-menu-preset';
11
+ import { templatesV1 } from '@blockslides/ai-context';
12
+
13
+ type BubbleMenuPresetProps = Omit<BubbleMenuPresetOptions, 'element' | 'pluginKey'> & React.HTMLAttributes<HTMLElement> & {
14
+ editor?: Editor | null;
15
+ };
16
+ declare const BubbleMenuPreset: React.ForwardRefExoticComponent<Omit<BubbleMenuPresetOptions, "element" | "pluginKey"> & React.HTMLAttributes<HTMLElement> & {
17
+ editor?: Editor | null;
18
+ } & React.RefAttributes<HTMLElement>>;
19
+
20
+ type PresetTemplates = ReturnType<typeof templatesV1.listPresetTemplates>;
21
+ type UseSlideEditorProps = {
22
+ /**
23
+ * Initial content for the editor. If omitted, a single preset slide is used.
24
+ */
25
+ content?: UseEditorOptions["content"];
26
+ /**
27
+ * Called on every update with the current JSON document.
28
+ */
29
+ onChange?: (doc: JSONContent, editor: Editor) => void;
30
+ /**
31
+ * Additional extensions to append after the ExtensionKit bundle.
32
+ */
33
+ extensions?: AnyExtension[];
34
+ /**
35
+ * Customize or disable pieces of ExtensionKit (e.g., bubbleMenu: false).
36
+ */
37
+ extensionKitOptions?: ExtensionKitOptions;
38
+ /**
39
+ * Optional preset list to power the add-slide button.
40
+ */
41
+ presetTemplates?: PresetTemplates;
42
+ /**
43
+ * Dependencies array forwarded to useEditor for re-instantiation control.
44
+ * Leave empty to avoid recreating the editor on prop changes.
45
+ */
46
+ deps?: DependencyList;
47
+ /**
48
+ * Called once when an editor instance is ready.
49
+ */
50
+ onEditorReady?: (editor: Editor) => void;
51
+ } & Omit<UseEditorOptions, "extensions" | "content">;
52
+ declare const useSlideEditor: ({ content, onChange, extensions, extensionKitOptions, presetTemplates, deps, onEditorReady, immediatelyRender, shouldRerenderOnTransaction, theme, editorProps, onUpdate, ...editorOptions }?: UseSlideEditorProps) => {
53
+ editor: Editor;
54
+ presets: templatesV1.PresetTemplate[];
55
+ };
56
+
57
+ declare const SlideEditor: React.ForwardRefExoticComponent<{
58
+ content?: _blockslides_react.UseEditorOptions["content"];
59
+ onChange?: (doc: _blockslides_core.JSONContent, editor: _blockslides_core.Editor) => void;
60
+ extensions?: _blockslides_core.AnyExtension[];
61
+ extensionKitOptions?: _blockslides_extension_kit.ExtensionKitOptions;
62
+ presetTemplates?: packages_ai_context_src_templates_v1_presetTemplateBuilder_js.PresetTemplate[];
63
+ deps?: React.DependencyList;
64
+ onEditorReady?: (editor: _blockslides_core.Editor) => void;
65
+ } & Omit<_blockslides_react.UseEditorOptions, "content" | "extensions"> & {
66
+ /**
67
+ * Toggle or customize the built-in BubbleMenuPreset.
68
+ * - true (default): render with defaults
69
+ * - false: disable entirely
70
+ * - object: pass through to BubbleMenuPreset
71
+ */
72
+ bubbleMenuPreset?: boolean | BubbleMenuPresetProps;
73
+ /**
74
+ * Additional props forwarded to EditorContent.
75
+ */
76
+ editorContentProps?: Omit<EditorContentProps, "editor">;
77
+ /**
78
+ * Viewport scale factor applied to the slide viewport.
79
+ * @default 1
80
+ */
81
+ viewportScale?: number;
82
+ className?: string;
83
+ style?: CSSProperties;
84
+ } & React.RefAttributes<HTMLDivElement>>;
85
+
86
+ export { BubbleMenuPreset, type BubbleMenuPresetProps, SlideEditor as ReactSlideEditor, type UseSlideEditorProps, useSlideEditor };
@@ -0,0 +1,86 @@
1
+ import * as packages_ai_context_src_templates_v1_presetTemplateBuilder_js from 'packages/ai-context/src/templates/v1/presetTemplateBuilder.js';
2
+ import * as _blockslides_extension_kit from '@blockslides/extension-kit';
3
+ import { ExtensionKitOptions } from '@blockslides/extension-kit';
4
+ import * as _blockslides_core from '@blockslides/core';
5
+ import { Editor, JSONContent, AnyExtension } from '@blockslides/core';
6
+ import * as _blockslides_react from '@blockslides/react';
7
+ import { UseEditorOptions, EditorContentProps } from '@blockslides/react';
8
+ export * from '@blockslides/react';
9
+ import React, { DependencyList, CSSProperties } from 'react';
10
+ import { BubbleMenuPresetOptions } from '@blockslides/extension-bubble-menu-preset';
11
+ import { templatesV1 } from '@blockslides/ai-context';
12
+
13
+ type BubbleMenuPresetProps = Omit<BubbleMenuPresetOptions, 'element' | 'pluginKey'> & React.HTMLAttributes<HTMLElement> & {
14
+ editor?: Editor | null;
15
+ };
16
+ declare const BubbleMenuPreset: React.ForwardRefExoticComponent<Omit<BubbleMenuPresetOptions, "element" | "pluginKey"> & React.HTMLAttributes<HTMLElement> & {
17
+ editor?: Editor | null;
18
+ } & React.RefAttributes<HTMLElement>>;
19
+
20
+ type PresetTemplates = ReturnType<typeof templatesV1.listPresetTemplates>;
21
+ type UseSlideEditorProps = {
22
+ /**
23
+ * Initial content for the editor. If omitted, a single preset slide is used.
24
+ */
25
+ content?: UseEditorOptions["content"];
26
+ /**
27
+ * Called on every update with the current JSON document.
28
+ */
29
+ onChange?: (doc: JSONContent, editor: Editor) => void;
30
+ /**
31
+ * Additional extensions to append after the ExtensionKit bundle.
32
+ */
33
+ extensions?: AnyExtension[];
34
+ /**
35
+ * Customize or disable pieces of ExtensionKit (e.g., bubbleMenu: false).
36
+ */
37
+ extensionKitOptions?: ExtensionKitOptions;
38
+ /**
39
+ * Optional preset list to power the add-slide button.
40
+ */
41
+ presetTemplates?: PresetTemplates;
42
+ /**
43
+ * Dependencies array forwarded to useEditor for re-instantiation control.
44
+ * Leave empty to avoid recreating the editor on prop changes.
45
+ */
46
+ deps?: DependencyList;
47
+ /**
48
+ * Called once when an editor instance is ready.
49
+ */
50
+ onEditorReady?: (editor: Editor) => void;
51
+ } & Omit<UseEditorOptions, "extensions" | "content">;
52
+ declare const useSlideEditor: ({ content, onChange, extensions, extensionKitOptions, presetTemplates, deps, onEditorReady, immediatelyRender, shouldRerenderOnTransaction, theme, editorProps, onUpdate, ...editorOptions }?: UseSlideEditorProps) => {
53
+ editor: Editor;
54
+ presets: templatesV1.PresetTemplate[];
55
+ };
56
+
57
+ declare const SlideEditor: React.ForwardRefExoticComponent<{
58
+ content?: _blockslides_react.UseEditorOptions["content"];
59
+ onChange?: (doc: _blockslides_core.JSONContent, editor: _blockslides_core.Editor) => void;
60
+ extensions?: _blockslides_core.AnyExtension[];
61
+ extensionKitOptions?: _blockslides_extension_kit.ExtensionKitOptions;
62
+ presetTemplates?: packages_ai_context_src_templates_v1_presetTemplateBuilder_js.PresetTemplate[];
63
+ deps?: React.DependencyList;
64
+ onEditorReady?: (editor: _blockslides_core.Editor) => void;
65
+ } & Omit<_blockslides_react.UseEditorOptions, "content" | "extensions"> & {
66
+ /**
67
+ * Toggle or customize the built-in BubbleMenuPreset.
68
+ * - true (default): render with defaults
69
+ * - false: disable entirely
70
+ * - object: pass through to BubbleMenuPreset
71
+ */
72
+ bubbleMenuPreset?: boolean | BubbleMenuPresetProps;
73
+ /**
74
+ * Additional props forwarded to EditorContent.
75
+ */
76
+ editorContentProps?: Omit<EditorContentProps, "editor">;
77
+ /**
78
+ * Viewport scale factor applied to the slide viewport.
79
+ * @default 1
80
+ */
81
+ viewportScale?: number;
82
+ className?: string;
83
+ style?: CSSProperties;
84
+ } & React.RefAttributes<HTMLDivElement>>;
85
+
86
+ export { BubbleMenuPreset, type BubbleMenuPresetProps, SlideEditor as ReactSlideEditor, type UseSlideEditorProps, useSlideEditor };