@ggraphic/editor 0.0.0 → 0.1.0-alpha.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.
Files changed (97) hide show
  1. package/dist/brand/brandRegistry.d.ts +11 -3
  2. package/dist/brand/brandRegistry.js +18 -3
  3. package/dist/brand/documentBrand.d.ts +16 -0
  4. package/dist/brand/documentBrand.js +6 -0
  5. package/dist/components/CanvasEditor/CanvasEditorShell.js +39 -33
  6. package/dist/components/CanvasTextOverlay.js +4 -2
  7. package/dist/components/CustomColorSwatch.js +3 -2
  8. package/dist/components/GenericCanvas.js +9 -2
  9. package/dist/components/RichTextField.js +5 -1
  10. package/dist/components/TextFormatButtons.js +6 -22
  11. package/dist/components/TopBar/ContextControls.js +4 -2
  12. package/dist/components/TopBar/modules/FloatingColorPicker.js +3 -1
  13. package/dist/components/TopBar/modules/FloatingFontRoleControl.js +2 -2
  14. package/dist/components/kindRenderers.d.ts +1 -1
  15. package/dist/components/markerMark.d.ts +6 -1
  16. package/dist/components/markerMark.js +7 -11
  17. package/dist/configs/factory/actionFactories.d.ts +38 -9
  18. package/dist/configs/factory/actionFactories.js +53 -36
  19. package/dist/configs/types.d.ts +13 -2
  20. package/dist/export/pptx/buildPptxModel.d.ts +3 -0
  21. package/dist/export/pptx/buildPptxModel.js +5 -5
  22. package/dist/export/pptx/exportPptxDeck.d.ts +4 -1
  23. package/dist/export/pptx/exportPptxDeck.js +5 -2
  24. package/dist/export/pptx/textModel.d.ts +6 -2
  25. package/dist/export/pptx/textModel.js +14 -11
  26. package/dist/hooks/useFloatingModuleHandlers.js +2 -2
  27. package/dist/hooks/useMultiPageExport.js +1 -1
  28. package/dist/i18n/de.d.ts +2 -0
  29. package/dist/i18n/de.js +2 -0
  30. package/dist/i18n/en.js +1 -0
  31. package/dist/primitives/CanvasRichText.js +7 -4
  32. package/dist/primitives/CanvasStage.js +3 -2
  33. package/dist/primitives/UserImagePrimitive.js +3 -1
  34. package/dist/sidebar/sections/ChartSettingsSection.d.ts +1 -1
  35. package/dist/sidebar/sections/ChartSettingsSection.js +5 -2
  36. package/dist/sidebar/sections/CombinedTextSection.js +3 -2
  37. package/dist/sidebar/sections/DiagrammeSection.js +10 -11
  38. package/dist/sidebar/sections/FormenSection.d.ts +3 -1
  39. package/dist/sidebar/sections/FormenSection.js +25 -13
  40. package/dist/sidebar/sections/IllustrationSettings.js +4 -3
  41. package/dist/sidebar/sections/ImageAdjustSection.js +6 -5
  42. package/dist/sidebar/sections/assets/ElementThumb.js +3 -1
  43. package/dist/sidebar/sections/assets/useElementCatalog.d.ts +2 -1
  44. package/dist/sidebar/sections/assets/useElementCatalog.js +30 -15
  45. package/dist/sidebar/sections/effects/GradientSettings.js +4 -2
  46. package/dist/sidebar/sections/effects/OutlineSettings.js +4 -3
  47. package/dist/sidebar/sections/effects/ShadowSettings.js +4 -3
  48. package/dist/sidebar/sections/tools/BlobCreatorTool.js +11 -6
  49. package/dist/sidebar/sections/tools/GradientTextTool.js +14 -12
  50. package/dist/sidebar/sections/tools/TextPathCreatorTool.js +15 -13
  51. package/dist/sidebar/sections/tools/ToolsSection.js +5 -3
  52. package/dist/testing/documentBrandConfig.d.ts +14 -0
  53. package/dist/testing/documentBrandConfig.js +60 -0
  54. package/dist/testing/documentBrandPacks.d.ts +10 -0
  55. package/dist/testing/documentBrandPacks.js +45 -0
  56. package/dist/ui/button.d.ts +2 -2
  57. package/dist/utils/canvasAssets.d.ts +7 -1
  58. package/dist/utils/circleBadgeUtils.d.ts +3 -1
  59. package/dist/utils/circleBadgeUtils.js +5 -5
  60. package/dist/utils/colorNames.d.ts +7 -2
  61. package/dist/utils/colorNames.js +14 -5
  62. package/dist/utils/fontMarkSupport.d.ts +1 -0
  63. package/dist/utils/fontMarkSupport.js +7 -1
  64. package/dist/utils/frameUtils.d.ts +3 -2
  65. package/dist/utils/frameUtils.js +3 -2
  66. package/dist/utils/illustrations/registry.d.ts +4 -1
  67. package/dist/utils/illustrations/registry.js +5 -3
  68. package/dist/utils/illustrations/svgCache.js +13 -6
  69. package/dist/utils/illustrations/types.d.ts +1 -1
  70. package/dist/utils/imageFilters.d.ts +4 -2
  71. package/dist/utils/imageFilters.js +3 -2
  72. package/dist/utils/imageLook.d.ts +4 -2
  73. package/dist/utils/imageLook.js +4 -2
  74. package/dist/utils/markerBoxes.d.ts +16 -1
  75. package/dist/utils/markerBoxes.js +2 -15
  76. package/dist/utils/markerColors.d.ts +12 -5
  77. package/dist/utils/markerColors.js +8 -15
  78. package/dist/utils/photoPlaceholder.d.ts +4 -1
  79. package/dist/utils/photoPlaceholder.js +5 -3
  80. package/dist/utils/pillBadgeUtils.d.ts +3 -2
  81. package/dist/utils/pillBadgeUtils.js +5 -5
  82. package/dist/utils/shapes.d.ts +4 -2
  83. package/dist/utils/shapes.js +4 -2
  84. package/dist/utils/textUtils.js +6 -2
  85. package/dist/utils/zipPageImages.d.ts +2 -1
  86. package/dist/utils/zipPageImages.js +3 -2
  87. package/package.json +3 -3
  88. package/dist/components/MobileSelectionPill.d.ts +0 -40
  89. package/dist/components/MobileSelectionPill.js +0 -85
  90. package/dist/components/TopBar/modules/FloatingGradientControl.d.ts +0 -9
  91. package/dist/components/TopBar/modules/FloatingGradientControl.js +0 -35
  92. package/dist/components/TopBar/modules/FloatingOutlineControl.d.ts +0 -11
  93. package/dist/components/TopBar/modules/FloatingOutlineControl.js +0 -31
  94. package/dist/components/TopBar/modules/FloatingShadowControl.d.ts +0 -12
  95. package/dist/components/TopBar/modules/FloatingShadowControl.js +0 -40
  96. package/dist/utils/balkenUtils.d.ts +0 -22
  97. package/dist/utils/balkenUtils.js +0 -8
@@ -6,13 +6,21 @@
6
6
  * `CanvasEditorServices`, because the defaults are read in commands, factories
7
7
  * and offscreen roots that have no React context. Without a host the editor
8
8
  * renders `brandDefault`.
9
+ *
10
+ * The first pack is only the fallback. A document of another pack names it on
11
+ * its config (`FullCanvasConfig.brand`); the action factories take it as a
12
+ * parameter and the editor's panels read it with `useDocumentBrand`
13
+ * (`brand/documentBrand.ts`). The order of this list never changes with the
14
+ * document that is open: other editors in the same host read it too.
9
15
  */
10
- import { type BrandPack } from '@ggraphic/core';
16
+ import { type BrandPack, type FontCuts } from '@ggraphic/core';
11
17
  export declare function registerBrandPacks(packs: readonly [BrandPack, ...BrandPack[]]): void;
12
18
  /** The pack new elements take their defaults from. */
13
19
  export declare function activeBrand(): BrandPack;
14
20
  export declare function registeredBrands(): readonly BrandPack[];
15
21
  /** Every family a registered pack names or ships a file for: the host provides these. */
16
22
  export declare function declaredFontFamilies(): ReadonlySet<string>;
17
- /** The active brand's headline family as a CSS stack, for canvas and SVG text a tool draws itself. */
18
- export declare function headlineFontStack(): string;
23
+ /** A brand's headline family as a CSS stack, for canvas and SVG text a tool draws itself. */
24
+ export declare function headlineFontStack(brand?: BrandPack): string;
25
+ /** The real cuts a registered pack declares for `family`, or null. */
26
+ export declare function brandCuts(family: string): FontCuts | null;
@@ -7,6 +7,12 @@
7
7
  * `CanvasEditorServices`, because the defaults are read in commands, factories
8
8
  * and offscreen roots that have no React context. Without a host the editor
9
9
  * renders `brandDefault`.
10
+ *
11
+ * The first pack is only the fallback. A document of another pack names it on
12
+ * its config (`FullCanvasConfig.brand`); the action factories take it as a
13
+ * parameter and the editor's panels read it with `useDocumentBrand`
14
+ * (`brand/documentBrand.ts`). The order of this list never changes with the
15
+ * document that is open: other editors in the same host read it too.
10
16
  */
11
17
  import { brandDefault } from '@ggraphic/core';
12
18
  let registered = [brandDefault];
@@ -35,7 +41,16 @@ function packFamilies(pack) {
35
41
  ...pack.fontFaces.map((face) => face.family),
36
42
  ];
37
43
  }
38
- /** The active brand's headline family as a CSS stack, for canvas and SVG text a tool draws itself. */
39
- export function headlineFontStack() {
40
- return `"${activeBrand().fonts.headline}", sans-serif`;
44
+ /** A brand's headline family as a CSS stack, for canvas and SVG text a tool draws itself. */
45
+ export function headlineFontStack(brand = activeBrand()) {
46
+ return `"${brand.fonts.headline}", sans-serif`;
47
+ }
48
+ /** The real cuts a registered pack declares for `family`, or null. */
49
+ export function brandCuts(family) {
50
+ for (const brand of registered) {
51
+ const cuts = brand.fonts.cuts?.[family];
52
+ if (cuts)
53
+ return cuts;
54
+ }
55
+ return null;
41
56
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The brand of the document that is open, for the panels that offer defaults
3
+ * (swatches, effect presets, text tiles) and for the canvas that draws one (the
4
+ * marker of a text without a marker style). The registry is one list for every
5
+ * editor in the host, so an open document of another pack has to say its own:
6
+ * the shell provides the active page's `FullCanvasConfig.brand`, and
7
+ * `GenericCanvas` provides its own page's to its tree, so an embedded or
8
+ * offscreen canvas has it too. Where nothing is provided, or the page names no
9
+ * pack, a reader falls back to the active brand (`activeBrand()`).
10
+ *
11
+ * Code without React context takes the brand as a parameter instead: the
12
+ * action factories get it from the config.
13
+ */
14
+ import { type BrandPack } from '@ggraphic/core';
15
+ export declare const DocumentBrandContext: import("react").Context<BrandPack | null>;
16
+ export declare function useDocumentBrand(): BrandPack;
@@ -0,0 +1,6 @@
1
+ import { createContext, useContext } from 'react';
2
+ import { activeBrand } from './brandRegistry.js';
3
+ export const DocumentBrandContext = createContext(null);
4
+ export function useDocumentBrand() {
5
+ return useContext(DocumentBrandContext) ?? activeBrand();
6
+ }
@@ -27,6 +27,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
27
27
  * - usePageUndoRedoShortcuts — Cmd/Ctrl+Z page-array history
28
28
  * - useToolbarHandlers — bundled toolbar actions for the active page
29
29
  */
30
+ import { DocumentBrandContext } from '@ggraphic/editor/brand/documentBrand';
30
31
  import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
31
32
  import { messages, useMessages } from '@ggraphic/editor/i18n/messages';
32
33
  import { pagePersistedStateKeys } from '@ggraphic/editor/collab/pageElementStateKeys';
@@ -403,14 +404,17 @@ function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialPr
403
404
  if (deck.some((_, i) => !refs[i]?.current)) {
404
405
  throw new Error(messages().errors.exportSlidesPartial);
405
406
  }
407
+ // One brand per deck: its pages share a country.
408
+ const brand = deck[0] ? loadedConfigs.get(deck[0].configId)?.brand : undefined;
406
409
  return exportPptxDeck({
407
410
  pages: deck.map((page) => page.state),
408
411
  format: getCanvasFormatOrDefault(formatId),
409
412
  rasterizeElement: async (slideIndex, elementId) => (await refs[slideIndex]?.current?.rasterizeElement(elementId)) ?? null,
410
413
  ...(documentTitle ? { title: documentTitle } : {}),
414
+ ...(brand ? { brand } : {}),
411
415
  ...(onProgress ? { onProgress } : {}),
412
416
  });
413
- }, [pagesDoc, canvasRefsRef, formatId, documentTitle]);
417
+ }, [pagesDoc, canvasRefsRef, formatId, documentTitle, loadedConfigs]);
414
418
  useImperativeHandle(exportApiRef, () => ({
415
419
  captureActivePage: async ({ pixelRatio = 1, transparent = false } = {}) => {
416
420
  await ensureFontsReady();
@@ -619,7 +623,7 @@ function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialPr
619
623
  });
620
624
  if (dataUrl) {
621
625
  const ext = format === 'jpeg' ? 'jpg' : format;
622
- await fileDelivery.downloadDataUrl(dataUrl, `${filenamePrefix}-page-${currentPageIndex + 1}.${ext}`);
626
+ await fileDelivery.downloadDataUrl(dataUrl, `${filenamePrefix}-${messages().export.pageFile}-${currentPageIndex + 1}.${ext}`);
623
627
  onDownload?.(dataUrl);
624
628
  }
625
629
  }, [currentPageIndex, canvasRefsRef, onDownload, fileDelivery, filenamePrefix]);
@@ -773,14 +777,16 @@ function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialPr
773
777
  if (dataUrls.length === 0)
774
778
  return;
775
779
  if (route === 'native-host') {
776
- dataUrls.forEach((dataUrl, i) => fileDelivery.shareDataUrlViaNativeHost(dataUrl, `${filenamePrefix}-page-${i + 1}.png`, {
780
+ dataUrls.forEach((dataUrl, i) => fileDelivery.shareDataUrlViaNativeHost(dataUrl, `${filenamePrefix}-${messages().export.pageFile}-${i + 1}.png`, {
777
781
  title: shareTitle,
778
782
  }));
779
783
  return;
780
784
  }
781
785
  const files = await Promise.all(dataUrls.map(async (dataUrl, i) => {
782
786
  const blob = await (await fetch(dataUrl)).blob();
783
- return new File([blob], `${filenamePrefix}-page-${i + 1}.png`, { type: 'image/png' });
787
+ return new File([blob], `${filenamePrefix}-${messages().export.pageFile}-${i + 1}.png`, {
788
+ type: 'image/png',
789
+ });
784
790
  }));
785
791
  if (navigator.canShare?.({ files })) {
786
792
  await navigator.share({ files, title: shareTitle });
@@ -805,7 +811,7 @@ function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialPr
805
811
  await ensureFontsReady();
806
812
  const dataUrl = ref.current.toDataURL({ pixelRatio: 1 });
807
813
  if (dataUrl) {
808
- await fileDelivery.downloadDataUrl(dataUrl, `${filenamePrefix}-slider-page-${currentPageIndex + 1}.png`);
814
+ await fileDelivery.downloadDataUrl(dataUrl, `${filenamePrefix}-slider-${messages().export.pageFile}-${currentPageIndex + 1}.png`);
809
815
  }
810
816
  }
811
817
  },
@@ -878,7 +884,7 @@ function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialPr
878
884
  ...shareProps,
879
885
  ...(specEdit && { specEdit }),
880
886
  background: source.config.background?.(source.state, source.actions) ?? null,
881
- chartColors: source.config.chartColors,
887
+ chartColors: source.config.chartColors ?? source.config.brand?.chart,
882
888
  });
883
889
  return (_jsx(Suspense, { fallback: sidebarLoadingFallback, children: _jsx(SectionComponent, { ...sectionProps }) }));
884
890
  }, [
@@ -1104,35 +1110,35 @@ function CanvasEditorInner({ initialConfigId, formatId, documentTitle, initialPr
1104
1110
  const bottomBarGroup = 'flex items-center rounded-xl border border-[var(--editor-border)] bg-[var(--editor-surface)]/80 shadow-sm backdrop-blur-sm pointer-events-auto';
1105
1111
  const pageStrip = showPageStrip ? (_jsx(PageThumbnailStrip, { pages: pages, currentPageIndex: currentPageIndex, thumbnails: pageThumbnails, loadedConfigs: loadedConfigs, currentTemplateId: currentTemplateId, canAddMore: canAddPages, onSelect: handleThumbnailSelect, onAddPage: handleAddPage, quickAddOpensPicker: pagePicker?.quickAddOpensPicker?.(pages) ?? false, renderPicker: renderAddPicker })) : null;
1106
1112
  const bottomBar = (_jsxs("div", { className: "canvas-bottom-bar pointer-events-none flex items-center gap-2 px-2 pb-2", children: [pageStrip ? (_jsx("div", { className: "min-w-0 flex-1", children: _jsx("div", { className: cn('w-fit max-w-full', bottomBarGroup), children: pageStrip }) })) : (_jsx("div", { className: "min-w-0 flex-1", children: canAddPages && (_jsx("div", { className: cn('w-fit px-1.5 py-1', bottomBarGroup), children: _jsx(AddPageButton, { onAddPage: handleAddPageLikeCurrent, renderPicker: renderAddPicker, disabled: !renderAddPicker && !currentTemplateId, compact: true }) })) })), _jsx("div", { className: cn('shrink-0', bottomBarGroup), children: _jsx(CanvasMetaBar, { pageCount: pageCount, currentPageIndex: currentPageIndex, zoom: zoom, onZoomChange: setZoom }) })] }));
1107
- return (_jsxs(AnnouncerContext.Provider, { value: announcer, children: [_jsx(CanvasAnnouncer, { message: liveMessage }), _jsx(ShellProvider, { pages: pages, currentPageIndex: currentPageIndex, formatId: formatId, canvasRefsRef: canvasRefsRef, configTabIds: configTabIds, children: _jsx(UserUploadsProvider, { children: _jsxs(CanvasTextEditorProvider, { children: [!isPreview && !readOnly && !hasPendingSuggestion && (_jsx("button", { type: "button", onClick: handleSkipToLayers, className: "sr-only focus:not-sr-only focus:fixed focus:left-2 focus:top-2 focus:z-[400] focus:flex focus:min-h-8 focus:items-center focus:rounded-md focus:border focus:border-[var(--editor-border-strong)] focus:bg-[var(--editor-surface)] focus:px-3 focus:text-[length:var(--font-size-small)] focus:font-semibold focus:text-[var(--editor-text)] focus:shadow-md outline-none kbd:focus-visible:outline-2 kbd:focus-visible:outline-solid kbd:focus-visible:outline-offset-2 kbd:focus-visible:outline-[var(--editor-accent)]", children: t.shell.skipToLayers })), _jsxs(CanvasEditorLayout
1108
- // Vorschau vor dem Sync: zeigen, aber nichts anbieten, was schreibt —
1109
- // die Seiten hängen noch an keinem Y.Map, jede Änderung ginge verloren.
1110
- // Ein Viewer ebenso: der Server verwirft seine Schreibzugriffe.
1111
- , {
1113
+ return (_jsx(DocumentBrandContext.Provider, { value: activeConfig?.brand ?? null, children: _jsxs(AnnouncerContext.Provider, { value: announcer, children: [_jsx(CanvasAnnouncer, { message: liveMessage }), _jsx(ShellProvider, { pages: pages, currentPageIndex: currentPageIndex, formatId: formatId, canvasRefsRef: canvasRefsRef, configTabIds: configTabIds, children: _jsx(UserUploadsProvider, { children: _jsxs(CanvasTextEditorProvider, { children: [!isPreview && !readOnly && !hasPendingSuggestion && (_jsx("button", { type: "button", onClick: handleSkipToLayers, className: "sr-only focus:not-sr-only focus:fixed focus:left-2 focus:top-2 focus:z-[400] focus:flex focus:min-h-8 focus:items-center focus:rounded-md focus:border focus:border-[var(--editor-border-strong)] focus:bg-[var(--editor-surface)] focus:px-3 focus:text-[length:var(--font-size-small)] focus:font-semibold focus:text-[var(--editor-text)] focus:shadow-md outline-none kbd:focus-visible:outline-2 kbd:focus-visible:outline-solid kbd:focus-visible:outline-offset-2 kbd:focus-visible:outline-[var(--editor-accent)]", children: t.shell.skipToLayers })), _jsxs(CanvasEditorLayout
1112
1114
  // Vorschau vor dem Sync: zeigen, aber nichts anbieten, was schreibt —
1113
1115
  // die Seiten hängen noch an keinem Y.Map, jede Änderung ginge verloren.
1114
1116
  // Ein Viewer ebenso: der Server verwirft seine Schreibzugriffe.
1115
- sidebar: isPreview || readOnly ? null : hasPendingSuggestion ? (_jsx("div", { inert: true, className: "contents", children: panel })) : (panel), tabBar: isPreview || readOnly ? null : tabBar, actions: null, toolbar: toolbarElement, contextBar: isPreview || readOnly ? null : contextBarElement,
1116
- // Die Desktop-Leiste ist auf dem Handy per CSS ausgeblendet; gar
1117
- // nicht erst mitgeben, sonst hinge der Streifen zweimal im Baum.
1118
- bottomBar: isMobileWeb || isPreview ? null : bottomBar,
1119
- // Auf dem Handy scrollt ein Finger auf dem Sharepic nicht (wie in
1120
- // Canva) — die Seiten wechselt dort dieser Streifen.
1121
- mobilePageStrip: isMobileWeb && !isMobileSheetOpen && !isPreview ? pageStrip : null, mobileZoomControl: isMobileWeb && !isMobileSheetOpen && !isPreview ? (_jsx(CanvasZoomIndicator, { zoom: zoom, onZoomChange: setZoom })) : null, mobileSheetOpen: isMobileSheetOpen, onCanvasBackdropPointerDown: isMobileSheetOpen ? handlePanelClose : undefined, children: [schemaRefusal && (_jsx("p", { role: "alert", className: "mx-auto mt-sm max-w-prose rounded-md border border-[var(--editor-border-strong)] bg-[var(--editor-surface)] px-3 py-2 text-[length:var(--font-size-small)] text-[var(--editor-text)]", children: t.shell.schemaRefusal[schemaRefusal.status] })), _jsxs("div", { inert: isPreview || hasPendingSuggestion, "aria-busy": isPreview && !schemaRefusal, ref: pagesContainerCallbackRef, onPointerDown: handleWorkAreaPointerDown, className: cn('heterogeneous-multipage__pages-container has-bottom-bar flex flex-col items-center gap-md p-sm pb-lg w-full max-canvas-mobile:gap-sm max-canvas-mobile:p-xs', hasPendingSuggestion && 'opacity-60 transition-opacity duration-200'), children: [pages.map((page, index) => {
1122
- const config = loadedConfigs.get(page.configId);
1123
- if (!config)
1124
- return null;
1125
- const isActive = index === currentPageIndex;
1126
- const canDelete = pageCount > 1;
1127
- return (_jsx(PageWrapper
1128
- // A replaced state (convert, undo) mounts the page afresh on the new state.
1129
- , { page: page, index: index, pageCount: pageCount, config: config, formatId: formatId, isActive: isActive, canDelete: canDelete, canvasRef: canvasRefsRef.current[index], pageRef: pageDomRefsRef.current[index], onSelect: handlePageSelect, onDelete: removePage, onMovePage: movePage, onDuplicatePage: duplicatePage, onChangeTemplate: PagePicker ? handleOpenTemplateChange : undefined, onDropVorlage: takesPageDrops && !readOnly ? handleDropVorlage : undefined, onExport: handleExport, onCancel: onCancel, callbacks: getCallbacksForPage(page.id, page.configId), multiPageExport: index === 0 ? multiPageExportProps : undefined, onStateChange: handlePageStateChange, onObservedState: printService && needsImpressum(printFormat)
1130
- ? handleObservedState
1131
- : undefined, onToolbarStateChange: isActive && !isPreview ? handleToolbarStateChange : undefined, onAutoSaveShareToken: onAutoSaveShareToken, autoSave: false, pageBinding: pageBindingAt(index, page.id, isActive), readOnly: readOnly }, `${page.id}:${page.stateEpoch ?? 0}`));
1132
- }), noPageRenderable && _jsx(CanvasPageSkeleton, { aspectRatio: pageAspectRatio }), templateChangePage && PagePicker && (_jsx(PagePicker, { isOpen: true, mode: "replace", anchorRef: pageDomRefsRef.current[templateChangePage.index], onSelectTemplate: handleSelectTemplateChange, onClose: handleCloseTemplateChange, currentTemplateId: templateChangePage.configId, currentState: templateChangePage.state, activeTemplateId: currentTemplateId, pages: pages, formatId: formatId })), isSlideFormat(format) && !isPreview && pages[currentPageIndex] && (_jsx(SlideNotesPanel, { value: typeof pages[currentPageIndex].state.notes === 'string'
1133
- ? pages[currentPageIndex].state.notes
1134
- : '', onChange: (notes) => updatePageState(pages[currentPageIndex].id, { notes }), readOnly: readOnly })), canAddPages && !showPageStrip && (_jsx("div", { className: "w-full max-w-[28rem] pt-sm max-canvas-mobile:pt-xs max-canvas-mobile:px-xs max-canvas-mobile:origin-top max-canvas-mobile:[scale:calc(1/var(--canvas-total-scale,1))] canvas-mobile:hidden", children: _jsx(AddPageButton, { onAddPage: handleAddPageLikeCurrent, renderPicker: renderAddPicker, disabled: !canAddMore || (!renderAddPicker && !currentTemplateId) }) }))] })] }), selectionPill, !isPreview &&
1135
- !readOnly &&
1136
- (isMobileWeb ? (_jsx(CanvasActionSheet, { handleRef: contextMenuRef })) : (_jsx(CanvasContextMenu, { handleRef: contextMenuRef, closeKey: zoom })))] }) }) })] }));
1117
+ , {
1118
+ // Vorschau vor dem Sync: zeigen, aber nichts anbieten, was schreibt —
1119
+ // die Seiten hängen noch an keinem Y.Map, jede Änderung ginge verloren.
1120
+ // Ein Viewer ebenso: der Server verwirft seine Schreibzugriffe.
1121
+ sidebar: isPreview || readOnly ? null : hasPendingSuggestion ? (_jsx("div", { inert: true, className: "contents", children: panel })) : (panel), tabBar: isPreview || readOnly ? null : tabBar, actions: null, toolbar: toolbarElement, contextBar: isPreview || readOnly ? null : contextBarElement,
1122
+ // Die Desktop-Leiste ist auf dem Handy per CSS ausgeblendet; gar
1123
+ // nicht erst mitgeben, sonst hinge der Streifen zweimal im Baum.
1124
+ bottomBar: isMobileWeb || isPreview ? null : bottomBar,
1125
+ // Auf dem Handy scrollt ein Finger auf dem Sharepic nicht (wie in
1126
+ // Canva) — die Seiten wechselt dort dieser Streifen.
1127
+ mobilePageStrip: isMobileWeb && !isMobileSheetOpen && !isPreview ? pageStrip : null, mobileZoomControl: isMobileWeb && !isMobileSheetOpen && !isPreview ? (_jsx(CanvasZoomIndicator, { zoom: zoom, onZoomChange: setZoom })) : null, mobileSheetOpen: isMobileSheetOpen, onCanvasBackdropPointerDown: isMobileSheetOpen ? handlePanelClose : undefined, children: [schemaRefusal && (_jsx("p", { role: "alert", className: "mx-auto mt-sm max-w-prose rounded-md border border-[var(--editor-border-strong)] bg-[var(--editor-surface)] px-3 py-2 text-[length:var(--font-size-small)] text-[var(--editor-text)]", children: t.shell.schemaRefusal[schemaRefusal.status] })), _jsxs("div", { inert: isPreview || hasPendingSuggestion, "aria-busy": isPreview && !schemaRefusal, ref: pagesContainerCallbackRef, onPointerDown: handleWorkAreaPointerDown, className: cn('heterogeneous-multipage__pages-container has-bottom-bar flex flex-col items-center gap-md p-sm pb-lg w-full max-canvas-mobile:gap-sm max-canvas-mobile:p-xs', hasPendingSuggestion && 'opacity-60 transition-opacity duration-200'), children: [pages.map((page, index) => {
1128
+ const config = loadedConfigs.get(page.configId);
1129
+ if (!config)
1130
+ return null;
1131
+ const isActive = index === currentPageIndex;
1132
+ const canDelete = pageCount > 1;
1133
+ return (_jsx(PageWrapper
1134
+ // A replaced state (convert, undo) mounts the page afresh on the new state.
1135
+ , { page: page, index: index, pageCount: pageCount, config: config, formatId: formatId, isActive: isActive, canDelete: canDelete, canvasRef: canvasRefsRef.current[index], pageRef: pageDomRefsRef.current[index], onSelect: handlePageSelect, onDelete: removePage, onMovePage: movePage, onDuplicatePage: duplicatePage, onChangeTemplate: PagePicker ? handleOpenTemplateChange : undefined, onDropVorlage: takesPageDrops && !readOnly ? handleDropVorlage : undefined, onExport: handleExport, onCancel: onCancel, callbacks: getCallbacksForPage(page.id, page.configId), multiPageExport: index === 0 ? multiPageExportProps : undefined, onStateChange: handlePageStateChange, onObservedState: printService && needsImpressum(printFormat)
1136
+ ? handleObservedState
1137
+ : undefined, onToolbarStateChange: isActive && !isPreview ? handleToolbarStateChange : undefined, onAutoSaveShareToken: onAutoSaveShareToken, autoSave: false, pageBinding: pageBindingAt(index, page.id, isActive), readOnly: readOnly }, `${page.id}:${page.stateEpoch ?? 0}`));
1138
+ }), noPageRenderable && _jsx(CanvasPageSkeleton, { aspectRatio: pageAspectRatio }), templateChangePage && PagePicker && (_jsx(PagePicker, { isOpen: true, mode: "replace", anchorRef: pageDomRefsRef.current[templateChangePage.index], onSelectTemplate: handleSelectTemplateChange, onClose: handleCloseTemplateChange, currentTemplateId: templateChangePage.configId, currentState: templateChangePage.state, activeTemplateId: currentTemplateId, pages: pages, formatId: formatId })), isSlideFormat(format) && !isPreview && pages[currentPageIndex] && (_jsx(SlideNotesPanel, { value: typeof pages[currentPageIndex].state.notes === 'string'
1139
+ ? pages[currentPageIndex].state.notes
1140
+ : '', onChange: (notes) => updatePageState(pages[currentPageIndex].id, { notes }), readOnly: readOnly })), canAddPages && !showPageStrip && (_jsx("div", { className: "w-full max-w-[28rem] pt-sm max-canvas-mobile:pt-xs max-canvas-mobile:px-xs max-canvas-mobile:origin-top max-canvas-mobile:[scale:calc(1/var(--canvas-total-scale,1))] canvas-mobile:hidden", children: _jsx(AddPageButton, { onAddPage: handleAddPageLikeCurrent, renderPicker: renderAddPicker, disabled: !canAddMore || (!renderAddPicker && !currentTemplateId) }) }))] })] }), selectionPill, !isPreview &&
1141
+ !readOnly &&
1142
+ (isMobileWeb ? (_jsx(CanvasActionSheet, { handleRef: contextMenuRef })) : (_jsx(CanvasContextMenu, { handleRef: contextMenuRef, closeKey: zoom })))] }) }) })] }) }));
1137
1143
  }
1138
1144
  export default CanvasEditorShell;
@@ -67,6 +67,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
67
67
  import { PLAIN_STYLE, splitListItems, stripInlineMarks } from '@ggraphic/schema';
68
68
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
69
69
  import { createPortal, flushSync } from 'react-dom';
70
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
70
71
  import { messages } from '@ggraphic/editor/i18n/messages';
71
72
  import { captureFocusOrigin, returnFocus, } from '@ggraphic/editor/utils/editorFocus';
72
73
  import { normalizeRotation } from '@ggraphic/editor/utils/orientation';
@@ -342,6 +343,7 @@ export function CanvasTextEditorProvider({ children }) {
342
343
  return _jsx(TextEditorRoot, { children: children });
343
344
  }
344
345
  function TextEditorRoot({ children }) {
346
+ const brand = useDocumentBrand();
345
347
  const [session, setSession] = useState(null);
346
348
  const [editor, setEditor] = useState(null);
347
349
  const [draft, setDraft] = useState('');
@@ -489,8 +491,8 @@ function TextEditorRoot({ children }) {
489
491
  // Wert aber unverändert durch.
490
492
  ...{
491
493
  '--canvas-rte-list-indent': `${listIndent}px`,
492
- '--canvas-rte-marker-fill': (session.marker ?? defaultTextMarker()).fill,
493
- '--canvas-rte-marker-color': (session.marker ?? defaultTextMarker()).color,
494
+ '--canvas-rte-marker-fill': (session.marker ?? defaultTextMarker(brand)).fill,
495
+ '--canvas-rte-marker-color': (session.marker ?? defaultTextMarker(brand)).color,
494
496
  ...(session.accent && {
495
497
  '--canvas-rte-accent-color': session.accent.fill,
496
498
  '--canvas-rte-accent-font': resolveFontFamily(session.accent.fontFamily ?? session.fontFamily),
@@ -18,7 +18,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
18
18
  * samt Listener verloren. Beim Abbauen wird eine offene Wahl noch übernommen.
19
19
  */
20
20
  import { useEffect, useRef } from 'react';
21
- import { activeBrand } from '@ggraphic/editor/brand/brandRegistry';
21
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
22
22
  import { useMessages } from '@ggraphic/editor/i18n/messages';
23
23
  import { cn } from '@ggraphic/editor/utils/cn';
24
24
  const HEX6 = /^#[0-9a-f]{6}$/i;
@@ -26,6 +26,7 @@ const DRAG_COMMIT_MS = 250;
26
26
  const COLOR_WHEEL = 'conic-gradient(from 180deg, #ff4d4d, #ffd84d, #4dd98a, #4db8ff, #8a4dff, #ff4dc4, #ff4d4d)';
27
27
  export function CustomColorSwatch({ value, presets, onPick, onPreview, className, outlineOffset = 2, disabled = false, inputProps, }) {
28
28
  const ownColor = useMessages().common.ownColor;
29
+ const brand = useDocumentBrand();
29
30
  const inputRef = useRef(null);
30
31
  const hex = value && HEX6.test(value) ? value.toUpperCase() : null;
31
32
  const pickRef = useRef(onPick);
@@ -76,5 +77,5 @@ export function CustomColorSwatch({ value, presets, onPick, onPreview, className
76
77
  outline: isCustom ? '2px solid var(--editor-accent)' : 'none',
77
78
  outlineOffset: `${outlineOffset}px`,
78
79
  };
79
- return (_jsx("label", { title: ownColor, style: style, className: cn('relative inline-block shrink-0 cursor-pointer rounded-full border border-black/10 transition-transform hover:scale-110', disabled && 'pointer-events-none opacity-50', className), children: _jsx("input", { ref: inputRef, type: "color", "aria-label": ownColor, disabled: disabled, defaultValue: (hex ?? activeBrand().colors.primary).toLowerCase(), onChange: (e) => onPreview?.(e.target.value.toUpperCase()), className: "absolute inset-0 size-full cursor-pointer opacity-0", ...inputProps }) }));
80
+ return (_jsx("label", { title: ownColor, style: style, className: cn('relative inline-block shrink-0 cursor-pointer rounded-full border border-black/10 transition-transform hover:scale-110', disabled && 'pointer-events-none opacity-50', className), children: _jsx("input", { ref: inputRef, type: "color", "aria-label": ownColor, disabled: disabled, defaultValue: (hex ?? brand.colors.primary).toLowerCase(), onChange: (e) => onPreview?.(e.target.value.toUpperCase()), className: "absolute inset-0 size-full cursor-pointer opacity-0", ...inputProps }) }));
80
81
  }
@@ -9,7 +9,8 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
9
9
  * Refactored to use extracted hooks, utilities, and components for better maintainability.
10
10
  */
11
11
  import Konva from 'konva';
12
- import { useRef, useState, useEffect, useCallback, useMemo, memo, useImperativeHandle, useLayoutEffect, } from 'react';
12
+ import { useRef, useState, useEffect, useCallback, useMemo, memo, useContext, useImperativeHandle, useLayoutEffect, } from 'react';
13
+ import { DocumentBrandContext } from '@ggraphic/editor/brand/documentBrand';
13
14
  import { useEmitHostStateChanges } from '@ggraphic/editor/collab/useEmitHostStateChanges';
14
15
  import { useYjsCanvasBinding } from '@ggraphic/editor/collab/useYjsCanvasBinding';
15
16
  import { stateKeyOfCallback } from '@ggraphic/editor/collab/wrapCallbacksWithPageSync';
@@ -773,7 +774,13 @@ function CanvasYjsBindingMount({ pageYMap, isSynced, }) {
773
774
  return null;
774
775
  }
775
776
  function GenericCanvasWithProvider(props) {
776
- return (_jsxs(CanvasStoreProvider, { initialFormatId: props.formatId, children: [props.pageBinding ? (_jsx(CanvasYjsBindingMount, { pageYMap: props.pageBinding.pageYMap, isSynced: props.pageBinding.isSynced })) : null, _jsx(MemoizedGenericCanvas, { ...props })] }));
777
+ // The page draws its defaults (the marker of a text without a marker style, the backdrop) in
778
+ // the brand of ITS document, wherever it is mounted: in the editor shell, embedded, or in an
779
+ // offscreen root for a preview or an export, where no shell provides one. A config that names
780
+ // none leaves the context as it is.
781
+ const outerBrand = useContext(DocumentBrandContext);
782
+ const brand = props.config.brand ?? outerBrand;
783
+ return (_jsx(DocumentBrandContext.Provider, { value: brand, children: _jsxs(CanvasStoreProvider, { initialFormatId: props.formatId, children: [props.pageBinding ? (_jsx(CanvasYjsBindingMount, { pageYMap: props.pageBinding.pageYMap, isSynced: props.pageBinding.isSynced })) : null, _jsx(MemoizedGenericCanvas, { ...props })] }) }));
777
784
  }
778
785
  GenericCanvasWithProvider.displayName = 'GenericCanvas';
779
786
  export const GenericCanvas = GenericCanvasWithProvider;
@@ -37,6 +37,7 @@ import { Underline } from '@tiptap/extension-underline';
37
37
  import { Placeholder, UndoRedo } from '@tiptap/extensions';
38
38
  import { EditorContent, useEditor } from '@tiptap/react';
39
39
  import { useEffect, useRef } from 'react';
40
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
40
41
  import { Accent } from '@ggraphic/editor/components/accentMark';
41
42
  import { messages } from '@ggraphic/editor/i18n/messages';
42
43
  import { keepsEditing } from '@ggraphic/editor/utils/keyboardOwnership';
@@ -58,7 +59,8 @@ const BASE_EXTENSIONS = [
58
59
  * Schriftschnitt und ist deshalb auf jedem Feld aktiv. Der Akzent steht
59
60
  * immer im Schema; angeboten wird er nur, wo der Text einen Akzentstil trägt.
60
61
  */
61
- const ALWAYS_MARK_EXTENSIONS = [Underline, Accent, Marker];
62
+ const ALWAYS_MARK_EXTENSIONS = [Underline, Accent];
63
+ // Der Marker steht ebenso immer im Schema; er kommt mit dem Paket des Dokuments dazu.
62
64
  /**
63
65
  * Fett und Kursiv müssen IM SCHEMA stehen, auch wo die Schrift sie nicht
64
66
  * tragen kann. Ein Dokument mit einem Mark, den das Schema nicht kennt, lässt
@@ -101,10 +103,12 @@ export function RichTextField({ value, onChange, placeholder, marks = ALL_MARKS_
101
103
  callbacks.current = { onChange, onBlur, onEscape, onSubmit };
102
104
  // `handleKeyDown` steht in der Konfiguration, bevor es den Editor gibt.
103
105
  const editorRef = useRef(null);
106
+ const brand = useDocumentBrand();
104
107
  const editor = useEditor({
105
108
  extensions: [
106
109
  ...BASE_EXTENSIONS,
107
110
  ...ALWAYS_MARK_EXTENSIONS,
111
+ Marker.configure({ brand }),
108
112
  markExtension(Bold, marks.bold),
109
113
  markExtension(Italic, marks.italic),
110
114
  Placeholder.configure({ placeholder: placeholder ?? '' }),
@@ -1,27 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // SPDX-License-Identifier: MPL-2.0
3
- /**
4
- * TextFormatButtons — Fett, Kursiv, Unterstrichen, Akzent, Textmarker, Aufzählung, Nummerierung.
5
- *
6
- * EINE Definition der Knöpfe, ohne dass sie wissen, wen sie bedienen. Sie
7
- * lesen einen `TextFormatState` und rufen `TextFormatCommands`; wer beides
8
- * liefert, ist der Wirt:
9
- *
10
- * - `TextFormatControls` aus dem tiptap-Editor, solange ein Text bearbeitet wird;
11
- * - `WholeTextFormatControls` aus dem gespeicherten Text, solange er nur
12
- * ausgewählt ist und die Knöpfe für den ganzen Text gelten.
13
- *
14
- * Dieses Modul kennt kein tiptap: die Kopfleiste lädt es mit, den Editor
15
- * (~360 KB) lädt sie erst beim Bearbeiten nach.
16
- *
17
- * `variant` wählt nur das Aussehen; welche Knöpfe erscheinen und was sie
18
- * bedeuten, steht genau einmal hier.
19
- */
20
2
  import clsx from 'clsx';
21
3
  import { useEffect, useImperativeHandle, useRef, useState, } from 'react';
22
4
  import { createPortal } from 'react-dom';
23
5
  import { FiBold, FiItalic, FiList, FiUnderline } from 'react-icons/fi';
24
6
  import { MdBorderColor, MdFormatListNumbered, MdHighlight } from 'react-icons/md';
7
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
25
8
  import { useRovingToolbar } from '@ggraphic/editor/hooks/useRovingToolbar';
26
9
  import { useMessages } from '@ggraphic/editor/i18n/messages';
27
10
  import { KEEP_EDITING_ATTR } from '@ggraphic/editor/utils/keyboardOwnership';
@@ -49,16 +32,17 @@ function ToolbarButton({ onClick, isActive, disabled = false, label, variant, ch
49
32
  export function TextFormatButtons({ state, commands, marks, variant = 'floating', orderedListDisabled = false, toolbarRef, onColorFieldBlur, }) {
50
33
  const roving = useRovingToolbar();
51
34
  const m = useMessages().textFormat;
35
+ const brand = useDocumentBrand();
52
36
  const { ref: rovingRef, ...rovingHandlers } = roving;
53
37
  useImperativeHandle(toolbarRef, () => rovingRef.current, [rovingRef]);
54
- return (_jsxs("div", { ref: rovingRef, ...rovingHandlers, [KEEP_EDITING_ATTR]: '', role: "toolbar", "aria-label": m.toolbar, className: GROUP_CLASS[variant], children: [marks.bold && (_jsx(ToolbarButton, { onClick: commands.toggleBold, isActive: state.bold, label: m.bold, variant: variant, children: _jsx(FiBold, {}) })), marks.italic && (_jsx(ToolbarButton, { onClick: commands.toggleItalic, isActive: state.italic, label: m.italic, variant: variant, children: _jsx(FiItalic, {}) })), _jsx(ToolbarButton, { onClick: commands.toggleUnderline, isActive: state.underline, label: m.underline, variant: variant, children: _jsx(FiUnderline, {}) }), _jsx(MarkColorButton, { label: m.accent, icon: _jsx(MdHighlight, {}), variant: variant, isActive: state.accent, color: state.accentColor, presets: brandColors(), hasTemplate: !!marks.accent, onPick: commands.setAccent, onPreview: commands.previewAccent, onRemove: commands.removeAccent, onColorFieldBlur: onColorFieldBlur }), _jsx(MarkColorButton, { label: m.marker, icon: _jsx(MdBorderColor, {}), variant: variant, isActive: state.marker, color: state.markerColor ?? (marks.marker ? null : defaultTextMarker().fill), presets: markerColorPresets(), hasTemplate: !!marks.marker, onPick: commands.setMarker, onPreview: commands.previewMarker, onRemove: commands.removeMarker, onColorFieldBlur: onColorFieldBlur }), _jsx(ToolbarButton, { onClick: commands.toggleBulletList, isActive: state.bulletList, label: m.bulletList, variant: variant, children: _jsx(FiList, {}) }), _jsx(ToolbarButton, { onClick: commands.toggleOrderedList, isActive: state.orderedList, disabled: orderedListDisabled, label: m.orderedList, variant: variant, children: _jsx(MdFormatListNumbered, {}) })] }));
38
+ return (_jsxs("div", { ref: rovingRef, ...rovingHandlers, [KEEP_EDITING_ATTR]: '', role: "toolbar", "aria-label": m.toolbar, className: GROUP_CLASS[variant], children: [marks.bold && (_jsx(ToolbarButton, { onClick: commands.toggleBold, isActive: state.bold, label: m.bold, variant: variant, children: _jsx(FiBold, {}) })), marks.italic && (_jsx(ToolbarButton, { onClick: commands.toggleItalic, isActive: state.italic, label: m.italic, variant: variant, children: _jsx(FiItalic, {}) })), _jsx(ToolbarButton, { onClick: commands.toggleUnderline, isActive: state.underline, label: m.underline, variant: variant, children: _jsx(FiUnderline, {}) }), _jsx(MarkColorButton, { label: m.accent, icon: _jsx(MdHighlight, {}), variant: variant, isActive: state.accent, color: state.accentColor, presets: brandColors(brand), hasTemplate: !!marks.accent, onPick: commands.setAccent, onPreview: commands.previewAccent, onRemove: commands.removeAccent, onColorFieldBlur: onColorFieldBlur }), _jsx(MarkColorButton, { label: m.marker, icon: _jsx(MdBorderColor, {}), variant: variant, isActive: state.marker, color: state.markerColor ?? (marks.marker ? null : defaultTextMarker(brand).fill), presets: markerColorPresets(brand), hasTemplate: !!marks.marker, onPick: commands.setMarker, onPreview: commands.previewMarker, onRemove: commands.removeMarker, onColorFieldBlur: onColorFieldBlur }), _jsx(ToolbarButton, { onClick: commands.toggleBulletList, isActive: state.bulletList, label: m.bulletList, variant: variant, children: _jsx(FiList, {}) }), _jsx(ToolbarButton, { onClick: commands.toggleOrderedList, isActive: state.orderedList, disabled: orderedListDisabled, label: m.orderedList, variant: variant, children: _jsx(MdFormatListNumbered, {}) })] }));
55
39
  }
56
40
  /** The marker boxes first, then the brand colours that are not among them. */
57
- const markerColorPresets = () => {
58
- const markers = markerSwatches();
41
+ const markerColorPresets = (pack) => {
42
+ const markers = markerSwatches(pack);
59
43
  return [
60
44
  ...markers,
61
- ...brandColors().filter((brand) => !markers.some((m) => m.value === brand.value)),
45
+ ...brandColors(pack).filter((color) => !markers.some((m) => m.value === color.value)),
62
46
  ];
63
47
  };
64
48
  const POPOVER_WIDTH = 184;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useCanvasEditorServices } from '@ggraphic/editor/CanvasEditorProvider';
3
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
3
4
  import { useCanvasTextFormatting, useIsCanvasTextEditing, } from '@ggraphic/editor/components/CanvasTextOverlay';
4
5
  import { useMessages } from '@ggraphic/editor/i18n/messages';
5
6
  import { hasEffects } from '@ggraphic/editor/sidebar/sections/effects/effectsFor';
@@ -47,6 +48,7 @@ const SEP = 'w-px h-[22px] bg-[var(--editor-border-soft)] mx-1 shrink-0';
47
48
  * color-picker expansion state. Renders nothing when there is no active module.
48
49
  */
49
50
  export function ContextControls({ selectedElement, activeFloatingModule, canMoveUp, canMoveDown, canDuplicate, isCropping = false, cropAspect = 'free', cropRotation = 0, isExpanding = false, lockState = 'none', canLock = false, canAlign = false, canChangeFontRole = false, backgroundPickerRequest = 0, handlers, background, onRemoveUserImage, onDeletePage, onDeselect, hideObjectActions = false, cropLayout = 'inline', }) {
51
+ const brand = useDocumentBrand();
50
52
  const t = useMessages();
51
53
  const tiles = useBarTiles();
52
54
  const unsplashHome = useUnsplashHome();
@@ -105,7 +107,7 @@ export function ContextControls({ selectedElement, activeFloatingModule, canMove
105
107
  // regardless of which groups are visible).
106
108
  const groups = [];
107
109
  if (colorConfig) {
108
- groups.push(_jsx(FloatingColorPicker, { currentColor: colorConfig.color, onColorSelect: handlers.handleColorSelect, isExpanded: isColorPickerExpanded, onExpandChange: setIsColorPickerExpanded, variant: colorConfig.variant, ...(isText ? { colors: fontColors() } : {}) }, "color"));
110
+ groups.push(_jsx(FloatingColorPicker, { currentColor: colorConfig.color, onColorSelect: handlers.handleColorSelect, isExpanded: isColorPickerExpanded, onExpandChange: setIsColorPickerExpanded, variant: colorConfig.variant, ...(isText ? { colors: fontColors(brand) } : {}) }, "color"));
109
111
  }
110
112
  // On the photo too: the photo covers the plane, so this is the only way to a colour.
111
113
  if ((isPlane || isPhoto) && background?.colors?.length && background.onColorChange) {
@@ -119,7 +121,7 @@ export function ContextControls({ selectedElement, activeFloatingModule, canMove
119
121
  const known = new Set(own.map((c) => c.value.toLowerCase()));
120
122
  const palette = paletteOnly
121
123
  ? own
122
- : [...own, ...brandColors().filter((c) => !known.has(c.value.toLowerCase()))];
124
+ : [...own, ...brandColors(brand).filter((c) => !known.has(c.value.toLowerCase()))];
123
125
  const pickColor = isPhoto && !colorReplacesImage && onImageChange
124
126
  ? (color, ref) => {
125
127
  onImageChange(null, undefined, null);
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
2
3
  import { CustomColorSwatch } from '@ggraphic/editor/components/CustomColorSwatch';
3
4
  import { TILE, useBarTiles } from '@ggraphic/editor/components/TopBar/barTiles';
4
5
  import { useMessages } from '@ggraphic/editor/i18n/messages';
@@ -13,7 +14,8 @@ const colorBtn = `size-8 max-canvas-mobile:size-[26px] rounded-full border borde
13
14
  export function FloatingColorPicker({ currentColor, onColorSelect, isExpanded: externalExpanded, onExpandChange, colors, variant = 'swatch', allowCustom = true, }) {
14
15
  const t = useMessages();
15
16
  const tiles = useBarTiles();
16
- const colorOptions = colors ?? brandColors();
17
+ const brand = useDocumentBrand();
18
+ const colorOptions = colors ?? brandColors(brand);
17
19
  const [internalExpanded, setInternalExpanded] = React.useState(false);
18
20
  const isExpanded = externalExpanded !== undefined ? externalExpanded : internalExpanded;
19
21
  const setIsExpanded = onExpandChange || setInternalExpanded;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // SPDX-License-Identifier: MPL-2.0
3
3
  import { currentFontRole, fontRoleOptions } from '@ggraphic/core';
4
- import { activeBrand } from '@ggraphic/editor/brand/brandRegistry';
4
+ import { useDocumentBrand } from '@ggraphic/editor/brand/documentBrand';
5
5
  import { TileCaption, useBarTiles } from '@ggraphic/editor/components/TopBar/barTiles';
6
6
  import { useMessages } from '@ggraphic/editor/i18n/messages';
7
7
  import { primaryFontFamily } from '@ggraphic/editor/utils/fontMarkSupport';
@@ -18,7 +18,7 @@ const stackOf = (family) => `"${family}", sans-serif`;
18
18
  export function FloatingFontRoleControl({ text, onChange }) {
19
19
  const t = useMessages();
20
20
  const tiles = useBarTiles();
21
- const options = fontRoleOptions(activeBrand());
21
+ const options = fontRoleOptions(useDocumentBrand());
22
22
  const role = currentFontRole(text, options);
23
23
  const family = options.find((o) => o.role === role)?.family ?? primaryFontFamily(text.fontFamily);
24
24
  const select = (_jsxs("select", { "aria-label": t.topBar.fontRole, title: t.topBar.fontRole, value: role ?? CUSTOM, onChange: (e) => {
@@ -89,7 +89,7 @@ export interface RenderCtx {
89
89
  /** The page this item is drawn on, from 1; absent for a canvas that is no page of a deck. */
90
90
  pageNumber?: number;
91
91
  }
92
- export declare function createSelectableWrapper<P extends object>(Component: React.ComponentType<P>, propName?: 'selected' | 'isSelected'): React.MemoExoticComponent<({ elementId, ...rest }: Omit<P, "isSelected" | "selected"> & {
92
+ export declare function createSelectableWrapper<P extends object>(Component: React.ComponentType<P>, propName?: 'selected' | 'isSelected'): React.MemoExoticComponent<({ elementId, ...rest }: Omit<P, "selected" | "isSelected"> & {
93
93
  elementId: string;
94
94
  }) => React.JSX.Element>;
95
95
  /** How one kind is drawn: its item from the layer list, and the layer's context. */
@@ -5,6 +5,7 @@
5
5
  * CSS-Variablen, die das Overlay setzt; mit Farbe (`++{#FFFFFF}…++`) trägt die
6
6
  * Mark Kasten- und Schriftfarbe selbst.
7
7
  */
8
+ import { type BrandPack } from '@ggraphic/core';
8
9
  import { Mark } from '@tiptap/core';
9
10
  declare module '@tiptap/core' {
10
11
  interface Commands<ReturnType> {
@@ -16,4 +17,8 @@ declare module '@tiptap/core' {
16
17
  };
17
18
  }
18
19
  }
19
- export declare const Marker: Mark<any, any>;
20
+ export interface MarkerOptions {
21
+ /** Das Paket des Dokuments, dessen dunkle Schrift auf frei gewählten Kästen steht; null = das aktive. */
22
+ brand: BrandPack | null;
23
+ }
24
+ export declare const Marker: Mark<MarkerOptions, any>;
@@ -1,19 +1,15 @@
1
- // SPDX-License-Identifier: MPL-2.0
2
- /**
3
- * Die tiptap-Mark zu `++Marker++` — wie `accentMark.ts` immer im Schema (eine
4
- * unbekannte Mark lässt ProseMirror werfen und tiptap setzt ein leeres
5
- * Dokument). Ohne eigene Farbe zeigt der Editor den Kasten über die
6
- * CSS-Variablen, die das Overlay setzt; mit Farbe (`++{#FFFFFF}…++`) trägt die
7
- * Mark Kasten- und Schriftfarbe selbst.
8
- */
9
1
  import { Mark } from '@tiptap/core';
10
2
  import { colorAttribute } from '@ggraphic/editor/components/markColor';
11
3
  import { markerInkOn } from '../utils/markerColors.js';
12
4
  export const Marker = Mark.create({
13
5
  name: 'marker',
14
- addAttributes: () => ({
15
- color: colorAttribute('--mark-fill', (color) => `--mark-ink:${markerInkOn(color)}`),
16
- }),
6
+ addOptions: () => ({ brand: null }),
7
+ addAttributes() {
8
+ const brand = this.options.brand ?? undefined;
9
+ return {
10
+ color: colorAttribute('--mark-fill', (color) => `--mark-ink:${markerInkOn(color, brand)}`),
11
+ };
12
+ },
17
13
  parseHTML: () => [{ tag: 'mark[data-marker]' }],
18
14
  renderHTML: ({ HTMLAttributes }) => ['mark', { 'data-marker': '', ...HTMLAttributes }, 0],
19
15
  addCommands() {