@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
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- interface FloatingOutlineControlProps {
3
- stroke?: string;
4
- strokeWidth?: number;
5
- onChange: (patch: {
6
- stroke?: string;
7
- strokeWidth?: number;
8
- }) => void;
9
- }
10
- export declare function FloatingOutlineControl({ stroke, strokeWidth, onChange, }: FloatingOutlineControlProps): React.JSX.Element;
11
- export {};
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // SPDX-License-Identifier: MPL-2.0
3
- import { activeBrand } from '@ggraphic/editor/brand/brandRegistry';
4
- import { CustomColorSwatch } from '@ggraphic/editor/components/CustomColorSwatch';
5
- import { useMessages } from '@ggraphic/editor/i18n/messages';
6
- import { Popover, PopoverContent, PopoverTrigger } from '@ggraphic/editor/ui/popover';
7
- import { Slider } from 'radix-ui';
8
- import { useId } from 'react';
9
- import { PiTextAa } from 'react-icons/pi';
10
- import { colorName } from '@ggraphic/editor/utils/colorNames';
11
- const DEFAULT_WIDTH = 2;
12
- const ICON_BTN = 'inline-flex items-center justify-center size-8 shrink-0 rounded-md border-none bg-transparent cursor-pointer text-[var(--editor-text)] transition-colors duration-150 hover:bg-[var(--editor-surface-hover)]';
13
- export function FloatingOutlineControl({ stroke, strokeWidth, onChange, }) {
14
- const { outlines } = activeBrand().effects;
15
- const t = useMessages();
16
- const enabled = !!stroke && (strokeWidth ?? 0) > 0;
17
- const toggle = () => {
18
- if (enabled) {
19
- onChange({ stroke: undefined, strokeWidth: 0 });
20
- }
21
- else {
22
- onChange({ stroke: '#ffffff', strokeWidth: DEFAULT_WIDTH });
23
- }
24
- };
25
- const titleId = useId();
26
- return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { className: ICON_BTN, title: t.topBar.outline, type: "button", "aria-label": t.topBar.editOutline, children: _jsx(PiTextAa, { size: 17, className: enabled ? 'text-[var(--editor-accent)]' : 'text-[var(--editor-text-muted)]' }) }) }), _jsxs(PopoverContent, { className: "z-[10001] w-56 flex flex-col gap-2.5 p-3", align: "center", "aria-labelledby": titleId, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { id: titleId, className: "text-xs font-medium text-[var(--editor-text)]", children: t.topBar.outline }), _jsx("button", { className: "text-[11px] font-medium text-[var(--editor-accent)] hover:underline", onClick: toggle, type: "button", children: enabled ? 'Entfernen' : 'Aktivieren' })] }), enabled && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [outlines.map((c) => (_jsx("button", { className: "size-6 rounded-full border border-black/10 hover:scale-110 transition-transform", style: {
27
- backgroundColor: c,
28
- outline: stroke === c ? '2px solid var(--editor-accent)' : 'none',
29
- outlineOffset: '2px',
30
- }, onClick: () => onChange({ stroke: c }), title: colorName(c), "aria-label": colorName(c), "aria-pressed": stroke === c, type: "button" }, c))), _jsx(CustomColorSwatch, { value: stroke, presets: outlines, onPick: (color) => onChange({ stroke: color }), className: "size-6" })] }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-[11px] w-12 text-[var(--editor-text-muted)]", children: t.topBar.strength }), _jsxs(Slider.Root, { className: "relative flex items-center select-none touch-none grow h-4 max-canvas-mobile:h-11", value: [strokeWidth ?? DEFAULT_WIDTH], onValueChange: (v) => onChange({ strokeWidth: v[0] }), min: 0.5, max: 12, step: 0.5, children: [_jsx(Slider.Track, { className: "relative grow rounded-full h-1 bg-[var(--editor-border-soft)]", children: _jsx(Slider.Range, { className: "absolute rounded-full h-full bg-[var(--editor-accent)]" }) }), _jsx(Slider.Thumb, { className: "block size-3 max-canvas-mobile:size-5 bg-white rounded-full border-2 border-[var(--editor-accent)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] cursor-grab focus:outline-none", "aria-label": t.topBar.outlineWidth })] }), _jsx("span", { className: "text-[11px] w-8 text-right tabular-nums text-[var(--editor-text-muted)]", children: strokeWidth ?? DEFAULT_WIDTH })] })] }))] })] }));
31
- }
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import type { ShadowPatch } from '@ggraphic/editor/hooks/useFloatingModuleHandlers';
3
- interface FloatingShadowControlProps {
4
- shadowColor?: string;
5
- shadowBlur?: number;
6
- shadowOffsetX?: number;
7
- shadowOffsetY?: number;
8
- shadowOpacity?: number;
9
- onChange: (patch: ShadowPatch) => void;
10
- }
11
- export declare function FloatingShadowControl({ shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, onChange, }: FloatingShadowControlProps): React.JSX.Element;
12
- export {};
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // SPDX-License-Identifier: MPL-2.0
3
- import { activeBrand } from '@ggraphic/editor/brand/brandRegistry';
4
- import { CustomColorSwatch } from '@ggraphic/editor/components/CustomColorSwatch';
5
- import { useMessages } from '@ggraphic/editor/i18n/messages';
6
- import { Popover, PopoverContent, PopoverTrigger } from '@ggraphic/editor/ui/popover';
7
- import { Slider } from 'radix-ui';
8
- import { useId } from 'react';
9
- import { PiDropHalfBottom } from 'react-icons/pi';
10
- import { colorName } from '@ggraphic/editor/utils/colorNames';
11
- const SHADOW_DEFAULTS = {
12
- shadowColor: '#000000',
13
- shadowBlur: 8,
14
- shadowOffsetX: 4,
15
- shadowOffsetY: 4,
16
- shadowOpacity: 0.5,
17
- };
18
- const ICON_BTN = 'inline-flex items-center justify-center size-8 shrink-0 rounded-md border-none bg-transparent cursor-pointer text-[var(--editor-text)] transition-colors duration-150 hover:bg-[var(--editor-surface-hover)]';
19
- function LabeledSlider({ label, value, min, max, step, suffix, onValueChange, }) {
20
- return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-[11px] w-14 text-[var(--editor-text-muted)]", children: label }), _jsxs(Slider.Root, { className: "relative flex items-center select-none touch-none grow h-4 max-canvas-mobile:h-11", value: [value], onValueChange: (v) => onValueChange(v[0]), min: min, max: max, step: step, children: [_jsx(Slider.Track, { className: "relative grow rounded-full h-1 bg-[var(--editor-border-soft)]", children: _jsx(Slider.Range, { className: "absolute rounded-full h-full bg-[var(--editor-accent)]" }) }), _jsx(Slider.Thumb, { className: "block size-3 max-canvas-mobile:size-5 bg-white rounded-full border-2 border-[var(--editor-accent)] shadow-[0_1px_3px_rgba(0,0,0,0.2)] cursor-grab focus:outline-none", "aria-label": label })] }), _jsxs("span", { className: "text-[11px] w-9 text-right tabular-nums text-[var(--editor-text-muted)]", children: [Math.round(value), suffix] })] }));
21
- }
22
- export function FloatingShadowControl({ shadowColor, shadowBlur, shadowOffsetX, shadowOffsetY, shadowOpacity, onChange, }) {
23
- const { shadows } = activeBrand().effects;
24
- const t = useMessages();
25
- const enabled = !!shadowColor;
26
- const toggle = () => {
27
- if (enabled) {
28
- onChange({ shadowColor: undefined, shadowBlur: 0, shadowOpacity: 0 });
29
- }
30
- else {
31
- onChange(SHADOW_DEFAULTS);
32
- }
33
- };
34
- const titleId = useId();
35
- return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { className: ICON_BTN, title: t.topBar.shadow, type: "button", "aria-label": t.topBar.editShadow, children: _jsx(PiDropHalfBottom, { size: 17, className: enabled ? 'text-[var(--editor-accent)]' : 'text-[var(--editor-text-muted)]' }) }) }), _jsxs(PopoverContent, { className: "z-[10001] w-64 flex flex-col gap-2.5 p-3", align: "center", "aria-labelledby": titleId, children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { id: titleId, className: "text-xs font-medium text-[var(--editor-text)]", children: t.topBar.shadow }), _jsx("button", { className: "text-[11px] font-medium text-[var(--editor-accent)] hover:underline", onClick: toggle, type: "button", children: enabled ? 'Entfernen' : 'Aktivieren' })] }), enabled && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [shadows.map((c) => (_jsx("button", { className: "size-6 rounded-full border border-black/10 hover:scale-110 transition-transform", style: {
36
- backgroundColor: c,
37
- outline: shadowColor === c ? '2px solid var(--editor-accent)' : 'none',
38
- outlineOffset: '2px',
39
- }, onClick: () => onChange({ shadowColor: c }), title: colorName(c), "aria-label": colorName(c), "aria-pressed": shadowColor === c, type: "button" }, c))), _jsx(CustomColorSwatch, { value: shadowColor, presets: shadows, onPick: (color) => onChange({ shadowColor: color }), className: "size-6" })] }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.softness, value: shadowBlur ?? 0, min: 0, max: 40, step: 1, onValueChange: (v) => onChange({ shadowBlur: v }) }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.offsetX, value: shadowOffsetX ?? 0, min: -40, max: 40, step: 1, onValueChange: (v) => onChange({ shadowOffsetX: v }) }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.offsetY, value: shadowOffsetY ?? 0, min: -40, max: 40, step: 1, onValueChange: (v) => onChange({ shadowOffsetY: v }) }), _jsx(LabeledSlider, { label: t.sidebar.imageAdjust.opacity, value: (shadowOpacity ?? 0) * 100, min: 0, max: 100, step: 1, suffix: "%", onValueChange: (v) => onChange({ shadowOpacity: v / 100 }) })] }))] })] }));
40
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * Balken — the data of a bar group on the canvas: one or three skewed bars
3
- * with a text each. The kind's slot (`balkenInstances`, its actions) is the
4
- * editor's; how a group looks is supplied by the host as a kind renderer
5
- * (`registerKindRenderers`), and its presets live with the host's brand.
6
- */
7
- export type BalkenMode = 'single' | 'triple';
8
- export interface BalkenInstance {
9
- id: string;
10
- mode: BalkenMode;
11
- colorSchemeId: string;
12
- widthScale: number;
13
- offset: {
14
- x: number;
15
- y: number;
16
- };
17
- scale: number;
18
- texts: string[];
19
- rotation: number;
20
- opacity?: number;
21
- barOffsets?: [number, number, number];
22
- }
@@ -1,8 +0,0 @@
1
- // SPDX-License-Identifier: MPL-2.0
2
- /**
3
- * Balken — the data of a bar group on the canvas: one or three skewed bars
4
- * with a text each. The kind's slot (`balkenInstances`, its actions) is the
5
- * editor's; how a group looks is supplied by the host as a kind renderer
6
- * (`registerKindRenderers`), and its presets live with the host's brand.
7
- */
8
- export {};