@innovastudio/contentbox 1.6.194 → 1.6.196

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/index.d.ts CHANGED
@@ -1,3 +1,21 @@
1
+ /** An entry in the font picker. Only fontFamily is required. */
2
+ interface FontEntry {
3
+ /** What appears in the picker. Defaults to the first name in fontFamily. */
4
+ label?: string;
5
+ /** The font-family applied to the text. */
6
+ fontFamily: string;
7
+ /**
8
+ * Stylesheet that defines the font: your own @font-face file, a Google
9
+ * Fonts URL, or any other. Omit for fonts already installed on the device.
10
+ */
11
+ cssUrl?: string;
12
+ /** Searched and matched on. Defaults to the first name in fontFamily. */
13
+ value?: string;
14
+ fontStyle?: string;
15
+ fontDisplay?: string;
16
+ provider?: '' | 'google' | 'others';
17
+ }
18
+
1
19
  interface ContentBoxOptions {
2
20
  wrapper?: string;
3
21
  siteToken?: string;
@@ -19,10 +37,31 @@ interface ContentBoxOptions {
19
37
  disableStaticSection?: boolean;
20
38
  framework?: string;
21
39
  imageRenameOnEdit?: boolean;
40
+ /** @deprecated 'crop' opens the older crop-only dialog. It will be removed. */
41
+ imageEditor?: string;
42
+ /** LUT library for the image editor's look reel: entries, { category: entries }, or a URL to a JSON file. */
43
+ imageEditorPresets?: string | any[] | Record<string, any[]> | null;
44
+ /** Encoder quality (0-1) used when the image editor saves. Default 0.92. */
45
+ imageEditorQuality?: number;
46
+ /** Show the image editor's "My looks" section (save & re-apply a treatment). Default false. */
47
+ imageEditorMyLooks?: boolean;
48
+ /** Show the image editor's "Load .cube…" button (load a LUT from the user's computer). Default false. */
49
+ imageEditorLoadCube?: boolean;
22
50
  imageResizeOnBlock?: boolean;
23
51
 
24
52
  htmlButton?: boolean;
53
+ sectionHtmlButton?: boolean;
25
54
  undoRedoButtons?: boolean;
55
+ /** Content Size slider on the Box panel. Default: true. */
56
+ contentSizeSlider?: boolean;
57
+ /** Drag handles on the page for resizing the content width. Default: true. */
58
+ contentResizeHandles?: boolean;
59
+ /** Superscript & subscript buttons on the Text panel. Default: false. */
60
+ subscriptSuperscript?: boolean;
61
+ /** Insert Symbol button on the Text panel. Default: false. */
62
+ symbols?: boolean;
63
+ /** Search & Replace button on the Text panel. Default: false. */
64
+ searchReplace?: boolean;
26
65
  toggleDeviceButton?: boolean;
27
66
  deviceButtons?: boolean;
28
67
 
@@ -57,6 +96,23 @@ interface ContentBoxOptions {
57
96
  contentStylePath?: string;
58
97
  pluginPath?: string;
59
98
  fontAssetPath?: string;
99
+ fontPath?: string;
100
+
101
+ /** Replaces the built-in font list of the Text panel's font picker. */
102
+ fonts?: FontEntry[] | null;
103
+ /** Adds fonts to the font list. Use this for fonts your users upload. */
104
+ customFonts?: FontEntry[];
105
+ /**
106
+ * How the font picker shows each font: drawn in the font itself ('font',
107
+ * the default), the thumbnails shipped in fontAssetPath ('image', which
108
+ * needs no internet connection), or plain text ('none').
109
+ */
110
+ fontPreview?: 'font' | 'image' | 'none';
111
+ /**
112
+ * Where 'font' previews are fetched from. Defaults to Google's CSS2
113
+ * endpoint; any Google Fonts compatible service works.
114
+ */
115
+ fontPreviewUrl?: string;
60
116
 
61
117
  disableBootstrapIcons?: boolean;
62
118
 
@@ -124,6 +180,9 @@ interface ContentBoxOptions {
124
180
  slider?: string;
125
181
  navbar?: boolean;
126
182
  screenMode?: string;
183
+ scaleFullview?: boolean;
184
+ fullviewLogicalWidth?: number;
185
+ disableAutoOpenEditPanel?: boolean;
127
186
 
128
187
  onRender?: () => void;
129
188
  onChange?: () => void;
@@ -216,6 +275,13 @@ interface ContentBoxOptions {
216
275
  toolbar?: string;
217
276
  toolbarDisplay?: string;
218
277
  toolbarAddSnippetButton?: boolean;
278
+ /** Paste mode.
279
+ * 'auto' (default): content adopts the destination block,
280
+ * keeping semantic inline marks (bold/italic/underline/strike/link/code/
281
+ * sub-sup) and dropping presentational styling
282
+ * 'text': plain text.
283
+ * 'html': HTML with styles.
284
+ * 'html-without-styles': HTML, inline styles dropped, classes kept. */
219
285
  paste?: string;
220
286
  builderMode?: string;
221
287
 
@@ -330,8 +396,48 @@ interface ContentBoxOptions {
330
396
  clearChatSettings?: boolean;
331
397
  defaultChatSettings?: Record<string, any>;
332
398
  demoMode?: boolean;
333
- demoConversations?: any[];
399
+ demoConversations?: any[];
334
400
  startCodeChat?: boolean;
401
+ /**
402
+ * AI framework-context inclusion for code generation (Code Chat):
403
+ * - 'all' — send every framework (content + box + animation + design) on each code request
404
+ * - 'selection' — send only the frameworks a task needs (drops box/animation/design/content when not required)
405
+ * - 'optimized' — selection + finer drops (also drops the Buttons block from the content docs when no button)
406
+ * @default 'optimized'
407
+ */
408
+ context?: 'all' | 'selection' | 'optimized';
409
+ /**
410
+ * Include the optional Motion Path animation context (`data-fx-path`) — moving
411
+ * an object along a curved path through waypoints. A rare, story-page effect,
412
+ * so it's off by default; when on, it rides along wherever the animation
413
+ * framework is included in an AI code request.
414
+ * @default false
415
+ */
416
+ motionPath?: boolean;
417
+
418
+ //-- Code Chat: vision / attachments
419
+ /** Let files be attached to a chat message. Off by default: the attach
420
+ * button is hidden and drag-and-drop and paste are not accepted. */
421
+ chatAttachments?: boolean;
422
+ /** Legacy attachment handling: extract text from Office/text files and
423
+ * transcode images before sending, instead of passing files through
424
+ * natively. Off by default. */
425
+ convertAttachments?: boolean;
426
+ /** Explicit override of which code models accept image input. When omitted,
427
+ * capability comes from a model entry's own `accepts` list, then family
428
+ * heuristics. */
429
+ visionCapableCodeModels?: string[];
430
+ /** Same as visionCapableCodeModels, for the chat model list. */
431
+ visionCapableChatModels?: string[];
432
+ /** Per-provider image model lists. Only the active provider's list is used,
433
+ * and the provider suffix is matched case-insensitively. An entry is
434
+ * `{ id, label, sizes?, size_param?, output_format?, output_param?,
435
+ * size_auto?, image_input?, edit? }`; a Fal entry adds
436
+ * `edit: { id, image_param, image_max?, ...overrides }` naming the model id
437
+ * used when reference images ride along. */
438
+ imageModels_Fal?: any[];
439
+ imageModels_OpenRouter?: any[];
440
+ imageModels_OpenAI?: any[];
335
441
 
336
442
  //-- Asset Manager
337
443
  listFilesUrl?: string;
@@ -377,6 +483,21 @@ interface ContentBoxOptions {
377
483
  generateMediaUrl_Fal?: string;
378
484
  checkRequestStatusUrl_Fal?: string;
379
485
  getResultUrl_Fal?: string;
486
+ /** OpenRouter image provider (defaultImageGenerationProvider: 'openrouter').
487
+ * Same three-step request/status/result contract as the _Fal endpoints,
488
+ * including reference-image features (restyle / edit existing photos),
489
+ * which all three providers serve. */
490
+ generateMediaUrl_OpenRouter?: string;
491
+ checkRequestStatusUrl_OpenRouter?: string;
492
+ getResultUrl_OpenRouter?: string;
493
+ /** OpenAI image provider (defaultImageGenerationProvider: 'openai').
494
+ * The same three-step request/status/result contract as the _Fal and
495
+ * _OpenRouter endpoints, including reference-image features (an entry with
496
+ * image_input: true routes to /v1/images/edits). Distinct from the older
497
+ * one-shot generateMediaUrl_OpenAI_CreateImage(Edit) below. */
498
+ generateMediaUrl_OpenAI?: string;
499
+ checkRequestStatusUrl_OpenAI?: string;
500
+ getResultUrl_OpenAI?: string;
380
501
  minimizeImageUrl?: string;
381
502
  cleanup?: string;
382
503
  generateMediaUrl_OpenAI_CreateImage?: string;
@@ -427,19 +548,143 @@ interface InlineScriptOptions {
427
548
  retryDelay?: number;
428
549
  }
429
550
 
551
+ /** Options for builder.modal(). Only `html` is required. */
552
+ interface ModalOptions {
553
+ /** Title bar text. Omit for a bare dialog with a floating close button. */
554
+ title?: string;
555
+ /** The content of the dialog: plain markup, no shell needed. */
556
+ html: string;
557
+ /** 320 (px) or any CSS length, e.g. '40rem'. */
558
+ width?: number | string;
559
+ /** Overrides the body padding. Skipped automatically if your own outermost
560
+ * element already sets padding inline. */
561
+ padding?: string;
562
+ /** Default: true. */
563
+ closeButton?: boolean;
564
+ /** Default: true. Applies to the title bar. */
565
+ draggable?: boolean;
566
+ /** Extra class on the shell, so you can style it from your own CSS. */
567
+ className?: string;
568
+ overlayStay?: boolean;
569
+ onOpen?: (modal: ModalHandle) => void;
570
+ onClose?: (modal: ModalHandle) => void;
571
+ }
572
+
573
+ /** What builder.modal() returns. */
574
+ interface ModalHandle {
575
+ /** The dialog element. */
576
+ el: HTMLElement;
577
+ /** The content wrapper - query your own markup from here. */
578
+ body: HTMLElement;
579
+ open(): ModalHandle;
580
+ close(): ModalHandle;
581
+ }
582
+
430
583
  declare class ContentBox {
431
584
  constructor(options: ContentBoxOptions);
432
585
 
433
586
  boxImage(url: string, err?: string): void;
434
587
  selectAsset(url: string): void;
588
+ /**
589
+ * Show a file: images and video open in the editor's lightbox, anything
590
+ * else (pdf, audio, archives) opens in a new tab. Also available inside a
591
+ * page opened by the editor as window.parent.previewAsset(url).
592
+ */
593
+ previewAsset(url: string): void;
435
594
  hideModal(modal?: HTMLElement): void;
595
+
596
+ /**
597
+ * Build a dialog from plain content. The shell, title bar, close button,
598
+ * aria attributes, padding and drag wiring are supplied for you:
599
+ *
600
+ * const wc = builder.modal({ title: 'Word Count', width: 320, html: '<div>…</div>' });
601
+ * wc.open();
602
+ */
603
+ modal(options: ModalOptions): ModalHandle;
604
+
605
+ /**
606
+ * Page Preview. Opens previewURL in a fullscreen frame with a width ruler,
607
+ * so a layout can be checked at any width without leaving the editor.
608
+ * Does nothing when previewURL is unset.
609
+ *
610
+ * Distinct from openPreview(), which opens Live Preview, the small floating
611
+ * window. Both remain available.
612
+ */
613
+ openPagePreview(): void;
614
+
615
+ /* Building a feature from outside: add your own button and back it with a
616
+ real dialog, without reaching into the editor. */
617
+
618
+ /** Insert markup into the editor's own container (#_cbhtml), so .is-modal
619
+ * and friends style it exactly as they style the built-in dialogs. */
620
+ addHtml(html: string): void;
621
+ /** Append a stylesheet to the host page's <head>. */
622
+ addCss(css: string): void;
623
+ /** Insert the modal if needed, show it, and make its .is-draggable bar drag. */
624
+ createModal(
625
+ modal: HTMLElement,
626
+ selector: string,
627
+ overlayStay?: boolean,
628
+ cancelCallback?: () => void,
629
+ animated?: boolean,
630
+ overflowHidden?: boolean
631
+ ): HTMLElement;
632
+ showModal(
633
+ modal: HTMLElement,
634
+ overlayStay?: boolean,
635
+ cancelCallback?: () => void,
636
+ animated?: boolean,
637
+ overflowHidden?: boolean
638
+ ): void;
639
+ /** Make anything matching the selector draggable by that element. */
640
+ draggable(selector: string): void;
641
+ showSidePanel(panel: HTMLElement): void;
642
+ hideSidePanel(panel: HTMLElement): void;
643
+ /** Record an undo point before your code changes content, so your edit is
644
+ * one step of the editor's undo history. */
645
+ saveForUndo(checkLater?: boolean): void;
646
+ /** Insert HTML at the caret, the way the built-in insert tools do. */
647
+ pasteHtmlAtCaret(html: string, selectPastedContent?: boolean): void;
648
+ getScriptPath(): string;
649
+
436
650
  closeAsset(): void;
437
651
  returnUrl(s: string): void;
438
652
  htmlCheck(): void;
439
653
  loadHtml(html: string): void;
440
654
  loadStyles(mainCss: string, sectionCss: string): void;
441
655
  addButton(btn: object): void;
656
+ /** Adds a font to the font picker after the editor has been created. */
657
+ addFont(font: FontEntry): void;
658
+ /** Adds a button to the Text panel of the control panel (not the sidebar — see addButton). */
659
+ addTextButton(
660
+ html: string,
661
+ selector?: string,
662
+ exec?: (e: Event) => void
663
+ ): HTMLElement | null;
664
+ /** Wraps the current text selection in an inline plugin instance. */
665
+ convertSelectionToPlugin(
666
+ pluginName: string,
667
+ config?: {
668
+ create?: (selectedText: string, doc: Document) => HTMLElement;
669
+ attributes?: Record<string, string>;
670
+ className?: string;
671
+ tag?: string;
672
+ openEditor?: boolean;
673
+ }
674
+ ): HTMLElement | null;
675
+ /** Toggles a highlight (marker) background on the current text selection. */
676
+ toggleHighlight(color?: string): void;
677
+ /** Shows or hides the superscript/subscript buttons on the Text panel. */
678
+ setSubscriptSuperscript(show?: boolean): void;
679
+ /** Translates a string through the active language file. */
680
+ out(text: string, alt?: string): string;
681
+ /** Opens the Motion cascade for the selected section. */
682
+ openMotionCascade(): void;
683
+ /** Opens the Motion dock and timeline. */
684
+ openMotionDock(): void;
685
+ /** Legacy animation panel, replaced by openMotionCascade(). */
442
686
  openAnimationPanel(): void;
687
+ /** Legacy timeline editor, replaced by openMotionDock(). */
443
688
  openAnimationTimeline(): void;
444
689
  openAIAssistant(): void;
445
690
  openSettings(e: object): void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
- "name": "@innovastudio/contentbox",
3
2
  "type": "module",
4
- "version": "1.6.194",
3
+ "name": "@innovastudio/contentbox",
4
+ "version": "1.6.196",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "types": "index.d.ts",
@@ -14,7 +14,15 @@
14
14
  "serve": "webpack serve --config webpack.config.js",
15
15
  "start": "concurrently \"node server.js\" \"webpack serve --config webpack.config.js\"",
16
16
  "scss": "sass --watch --no-source-map src/scss/contentbox.scss public/contentbox/contentbox.css",
17
- "test": "echo \"Error: no test specified\" && exit 1"
17
+ "test:fullview": "node tests/fullview-regression.mjs",
18
+ "test:box": "node tests/box-structure.mjs",
19
+ "test:contentsize": "node tests/content-size-handles.mjs",
20
+ "test:spacing": "node tests/spacing-panels.mjs",
21
+ "test:panelsection": "node tests/panel-section-state.mjs",
22
+ "test:devicerow": "node tests/device-row.mjs",
23
+ "test:canvas": "node tests/canvas-size.mjs",
24
+ "test:fonts": "node tests/fonts.mjs",
25
+ "test": "node tests/box-structure.mjs && node tests/content-size-handles.mjs && node tests/spacing-panels.mjs && node tests/panel-section-state.mjs && node tests/device-row.mjs && node tests/canvas-size.mjs && node tests/fonts.mjs"
18
26
  },
19
27
  "keywords": [],
20
28
  "author": "",
@@ -59,7 +67,7 @@
59
67
  "ws": "^8.13.0"
60
68
  },
61
69
  "dependencies": {
62
- "@innovastudio/contentbuilder": "^1.5.211",
70
+ "@innovastudio/contentbuilder": "^1.5.214",
63
71
  "js-beautify": "^1.14.0",
64
72
  "marked": "^17.0.0",
65
73
  "sortablejs": "^1.15.2"