@ggraphic/editor 0.1.0-alpha.5 → 0.1.0-alpha.7
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/dist/CanvasEditorProvider.d.ts +6 -1
- package/dist/components/CanvasEditor/CanvasEditorShell.js +139 -36
- package/dist/components/CanvasEditor/editorShell.d.ts +6 -0
- package/dist/components/CanvasEditor/types.d.ts +28 -0
- package/dist/components/GenericCanvas.d.ts +19 -2
- package/dist/components/GenericCanvas.js +28 -3
- package/dist/components/GenericCanvasElement.js +15 -1
- package/dist/components/PagePreview.d.ts +8 -1
- package/dist/components/PagePreview.js +4 -1
- package/dist/components/TopBar/ContextControls.js +1 -1
- package/dist/components/TopBar/DownloadSection.d.ts +24 -3
- package/dist/components/TopBar/DownloadSection.js +45 -7
- package/dist/components/TopBar/ShareDropdown.d.ts +4 -2
- package/dist/components/TopBar/ShareDropdown.js +2 -2
- package/dist/components/TopBar/modules/FloatingFontSizeControl.d.ts +3 -1
- package/dist/components/TopBar/modules/FloatingFontSizeControl.js +46 -4
- package/dist/components/kindRenderers.js +10 -1
- package/dist/entries/export.d.ts +14 -1
- package/dist/entries/export.js +14 -1
- package/dist/entries/services.d.ts +1 -1
- package/dist/export/fonts/fontFiles.d.ts +100 -0
- package/dist/export/fonts/fontFiles.js +333 -0
- package/dist/export/fonts/glyphs.d.ts +113 -0
- package/dist/export/fonts/glyphs.js +120 -0
- package/dist/export/fonts/variation.d.ts +23 -0
- package/dist/export/fonts/variation.js +43 -0
- package/dist/export/pdf/pdfContent.d.ts +108 -0
- package/dist/export/pdf/pdfContent.js +566 -0
- package/dist/export/pdf/pdfFontkit.d.ts +54 -0
- package/dist/export/pdf/pdfFontkit.js +159 -0
- package/dist/export/pdf/pdfGeometry.d.ts +54 -0
- package/dist/export/pdf/pdfGeometry.js +228 -0
- package/dist/export/pdf/pdfResources.d.ts +109 -0
- package/dist/export/pdf/pdfResources.js +314 -0
- package/dist/export/pdf/writePdf.d.ts +34 -0
- package/dist/export/pdf/writePdf.js +165 -0
- package/dist/export/pptx/exportPptxDeck.d.ts +10 -2
- package/dist/export/pptx/exportPptxDeck.js +5 -2
- package/dist/export/pptx/svgPicture.d.ts +19 -0
- package/dist/export/pptx/svgPicture.js +64 -0
- package/dist/export/pptx/vectorizeElement.d.ts +9 -0
- package/dist/export/pptx/vectorizeElement.js +118 -0
- package/dist/export/pptx/writePptx.d.ts +13 -0
- package/dist/export/pptx/writePptx.js +17 -0
- package/dist/export/printPdf.d.ts +1 -0
- package/dist/export/printPdf.js +1 -1
- package/dist/export/scene/browserDeps.d.ts +32 -0
- package/dist/export/scene/browserDeps.js +174 -0
- package/dist/export/scene/imageBytes.d.ts +79 -0
- package/dist/export/scene/imageBytes.js +330 -0
- package/dist/export/scene/itemBounds.d.ts +9 -0
- package/dist/export/scene/itemBounds.js +40 -0
- package/dist/export/scene/matrix.d.ts +13 -0
- package/dist/export/scene/matrix.js +32 -0
- package/dist/export/scene/rasterLimit.d.ts +13 -0
- package/dist/export/scene/rasterLimit.js +24 -0
- package/dist/export/scene/rebaseOps.d.ts +8 -0
- package/dist/export/scene/rebaseOps.js +51 -0
- package/dist/export/scene/recordPageScene.d.ts +28 -0
- package/dist/export/scene/recordPageScene.js +224 -0
- package/dist/export/scene/recordingCanvas.d.ts +55 -0
- package/dist/export/scene/recordingCanvas.js +71 -0
- package/dist/export/scene/recordingContext.d.ts +162 -0
- package/dist/export/scene/recordingContext.js +1031 -0
- package/dist/export/scene/replayScene.d.ts +31 -0
- package/dist/export/scene/replayScene.js +213 -0
- package/dist/export/scene/resolveScene.d.ts +48 -0
- package/dist/export/scene/resolveScene.js +236 -0
- package/dist/export/scene/trustedSvgImages.d.ts +3 -0
- package/dist/export/scene/trustedSvgImages.js +21 -0
- package/dist/export/scene/types.d.ts +241 -0
- package/dist/export/scene/types.js +38 -0
- package/dist/export/slidesPdf.d.ts +10 -2
- package/dist/export/slidesPdf.js +8 -4
- package/dist/export/svg/__fixtures__/barChart.svg +1 -0
- package/dist/export/svg/__golden__/fixture-editable.svg +87 -0
- package/dist/export/svg/__golden__/fixture-outlines.svg +88 -0
- package/dist/export/svg/inlineSvg.d.ts +10 -0
- package/dist/export/svg/inlineSvg.js +119 -0
- package/dist/export/svg/scopeCss.d.ts +45 -0
- package/dist/export/svg/scopeCss.js +214 -0
- package/dist/export/svg/svgColor.d.ts +8 -0
- package/dist/export/svg/svgColor.js +46 -0
- package/dist/export/svg/svgImageScene.d.ts +41 -0
- package/dist/export/svg/svgImageScene.js +128 -0
- package/dist/export/svg/svgPathData.d.ts +31 -0
- package/dist/export/svg/svgPathData.js +466 -0
- package/dist/export/svg/svgToScene.d.ts +19 -0
- package/dist/export/svg/svgToScene.js +1183 -0
- package/dist/export/svg/writeSvg.d.ts +33 -0
- package/dist/export/svg/writeSvg.js +594 -0
- package/dist/export/svg/xml.d.ts +23 -0
- package/dist/export/svg/xml.js +49 -0
- package/dist/export/vectorDeps.d.ts +27 -0
- package/dist/export/vectorDeps.js +37 -0
- package/dist/export/vectorExport.d.ts +85 -0
- package/dist/export/vectorExport.js +287 -0
- package/dist/hooks/useLiveFontSize.d.ts +6 -0
- package/dist/hooks/useLiveFontSize.js +26 -0
- package/dist/hostServices.d.ts +15 -0
- package/dist/i18n/de.d.ts +27 -9
- package/dist/i18n/de.js +27 -10
- package/dist/i18n/en.js +25 -0
- package/dist/page/actions.js +8 -2
- package/dist/primitives/AssetPrimitive.js +7 -2
- package/dist/primitives/CanvasIcons.js +6 -0
- package/dist/primitives/CanvasImage.js +86 -12
- package/dist/primitives/CanvasRichText.js +10 -5
- package/dist/primitives/CanvasStage.js +2 -2
- package/dist/primitives/CanvasText.d.ts +8 -1
- package/dist/primitives/CanvasText.js +25 -5
- package/dist/primitives/ChartPrimitive.d.ts +11 -1
- package/dist/primitives/ChartPrimitive.js +73 -19
- package/dist/primitives/IconPrimitive.js +3 -0
- package/dist/primitives/IllustrationPrimitive.js +14 -1
- package/dist/primitives/chartFont.d.ts +30 -0
- package/dist/primitives/chartFont.js +127 -0
- package/dist/sidebar/sections/ImageAdjustSection.js +5 -4
- package/dist/sidebar/sections/assets/ElementsPanel.js +4 -2
- package/dist/sidebar/sections/assets/assetAudience.d.ts +12 -0
- package/dist/sidebar/sections/assets/assetAudience.js +18 -0
- package/dist/sidebar/sections/assets/useElementCatalog.js +3 -2
- package/dist/styles/compiled.css +1 -1
- package/dist/utils/canvasAssets.d.ts +11 -1
- package/dist/utils/canvasAssets.js +8 -0
- package/dist/utils/canvasIcons.js +5 -3
- package/dist/utils/captureStage.d.ts +19 -0
- package/dist/utils/captureStage.js +14 -1
- package/dist/utils/cropGhost.d.ts +3 -2
- package/dist/utils/cropGhost.js +4 -3
- package/dist/utils/externalIcons.d.ts +7 -0
- package/dist/utils/externalIcons.js +70 -3
- package/dist/utils/filteredPan.d.ts +22 -0
- package/dist/utils/filteredPan.js +36 -0
- package/dist/utils/illustrations/svgCache.js +6 -1
- package/dist/utils/imageFilters.d.ts +13 -0
- package/dist/utils/imageFilters.js +11 -0
- package/dist/utils/zipPageImages.d.ts +8 -0
- package/dist/utils/zipPageImages.js +16 -4
- package/package.json +6 -2
- package/skills/ggraphic-embed/SKILL.md +33 -1
|
@@ -38,7 +38,11 @@ export declare const emojiCodeAssetId: (code: string) => string;
|
|
|
38
38
|
* a host never renames an entry.
|
|
39
39
|
*/
|
|
40
40
|
export interface CanvasAssetCatalog {
|
|
41
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Everything an instance may name, in lookup order: by id and by src, the first match wins.
|
|
43
|
+
* SVG assets listed here are treated as host-authored and exported without sanitising, so a host
|
|
44
|
+
* must not list user uploads here; those belong to instance srcs (`isInstanceSrc`).
|
|
45
|
+
*/
|
|
42
46
|
assets: readonly UniversalAsset[];
|
|
43
47
|
/**
|
|
44
48
|
* Is this an image the host stores for one instance (a shop sticker)? Such
|
|
@@ -129,6 +133,12 @@ export declare function getAssetById(id: string, catalog?: CanvasAssetCatalog):
|
|
|
129
133
|
* canvas at an arbitrary URL.
|
|
130
134
|
*/
|
|
131
135
|
export declare function resolveAssetInstanceSrc(instance: Pick<AssetInstance, 'assetId' | 'src'>, catalog?: CanvasAssetCatalog): string | null;
|
|
136
|
+
/**
|
|
137
|
+
* Does the image of this instance come from the host's catalogue, rather than from a file the
|
|
138
|
+
* host stores for the one instance (a shop sticker, which a user made)? Only the first is
|
|
139
|
+
* something the host itself shipped; the second is user content, whatever its `src` looks like.
|
|
140
|
+
*/
|
|
141
|
+
export declare function isCatalogueInstance(instance: Pick<AssetInstance, 'src'>, catalog?: CanvasAssetCatalog): boolean;
|
|
132
142
|
/** Sticker-like instances get a pixel-exact hit area: transparent pixels click through. */
|
|
133
143
|
export declare function isStickerLikeInstance(instance: Pick<AssetInstance, 'assetId' | 'src'>, catalog?: CanvasAssetCatalog): boolean;
|
|
134
144
|
/**
|
|
@@ -104,6 +104,14 @@ export function resolveAssetInstanceSrc(instance, catalog = registered) {
|
|
|
104
104
|
return instance.src;
|
|
105
105
|
return getAssetById(instance.assetId, catalog)?.src ?? null;
|
|
106
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Does the image of this instance come from the host's catalogue, rather than from a file the
|
|
109
|
+
* host stores for the one instance (a shop sticker, which a user made)? Only the first is
|
|
110
|
+
* something the host itself shipped; the second is user content, whatever its `src` looks like.
|
|
111
|
+
*/
|
|
112
|
+
export function isCatalogueInstance(instance, catalog = registered) {
|
|
113
|
+
return !(instance.src && catalog.isInstanceSrc(instance.src));
|
|
114
|
+
}
|
|
107
115
|
/** Sticker-like instances get a pixel-exact hit area: transparent pixels click through. */
|
|
108
116
|
export function isStickerLikeInstance(instance, catalog = registered) {
|
|
109
117
|
if (instance.src && catalog.isInstanceSrc(instance.src))
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* the Konva canvas.
|
|
10
10
|
*/
|
|
11
11
|
import { getIconData, iconToSVG } from '@iconify/utils';
|
|
12
|
-
import { externalIconDataUrl, externalIconDefs, externalIconsVersion, getExternalIcon, isExternalIconId, } from './externalIcons.js';
|
|
12
|
+
import { externalIconDataUrl, externalIconDefs, externalIconsVersion, getExternalIcon, isExternalIconId, isSafeColor, } from './externalIcons.js';
|
|
13
13
|
const ICON_SETS = [
|
|
14
14
|
{ prefix: 'tabler', library: 'Tabler', load: () => import('@iconify-json/tabler') },
|
|
15
15
|
{ prefix: 'flowbite', library: 'Flowbite', load: () => import('@iconify-json/flowbite') },
|
|
@@ -220,8 +220,10 @@ export async function generateIconDataUrl(iconId, size = 64, color = '#ffffff')
|
|
|
220
220
|
const attributes = Object.entries(rendered.attributes)
|
|
221
221
|
.map(([key, value]) => `${key}="${value}"`)
|
|
222
222
|
.join(' ');
|
|
223
|
-
// Iconify sets use currentColor for stroke/fill — bake the color in.
|
|
224
|
-
|
|
223
|
+
// Iconify sets use currentColor for stroke/fill — bake the color in. The color comes from the
|
|
224
|
+
// document, so it must be one: it lands inside markup that exports inline as it is.
|
|
225
|
+
const ink = isSafeColor(color) ? color : '#000000';
|
|
226
|
+
const body = rendered.body.replace(/currentColor/g, ink);
|
|
225
227
|
const svgText = `<svg xmlns="http://www.w3.org/2000/svg" ${attributes}>${body}</svg>`;
|
|
226
228
|
const dataUrl = `data:image/svg+xml;base64,${btoa(svgText)}`;
|
|
227
229
|
dataUrlCache.set(cacheKey, dataUrl);
|
|
@@ -3,6 +3,12 @@ import type { ExportOptions } from '../types/editorTypes.js';
|
|
|
3
3
|
import type Konva from 'konva';
|
|
4
4
|
/** Konva node name of what the editor shows but no export contains. */
|
|
5
5
|
export declare const EXPORT_HIDDEN_NAME = "export-hidden";
|
|
6
|
+
/**
|
|
7
|
+
* Konva node name of the group `CanvasStage` scales the logical layout up to the format with: its
|
|
8
|
+
* children are the page's canvas items. A page whose logical size equals its format has no such
|
|
9
|
+
* group, and the items sit on the layer itself.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PAGE_ROOT_NAME = "page-root";
|
|
6
12
|
/**
|
|
7
13
|
* Runs `capture` with all selection chrome on the stage hidden — Konva
|
|
8
14
|
* Transformers plus the dashed selection Rects primitives render alongside
|
|
@@ -49,6 +55,19 @@ export declare function rasterizeStageElement(stage: Konva.Stage | null, element
|
|
|
49
55
|
height: number;
|
|
50
56
|
};
|
|
51
57
|
} | null;
|
|
58
|
+
/**
|
|
59
|
+
* `rasterizeStageElement` for a node in hand: the SVG export draws an island whose item has no id
|
|
60
|
+
* to look the group up by from the node the recorder kept. `pixelRatio` is per page px.
|
|
61
|
+
*/
|
|
62
|
+
export declare function rasterizeStageNode(stage: Konva.Stage | null, node: Konva.Node, pixelRatio?: number): {
|
|
63
|
+
dataUrl: string;
|
|
64
|
+
box: {
|
|
65
|
+
x: number;
|
|
66
|
+
y: number;
|
|
67
|
+
width: number;
|
|
68
|
+
height: number;
|
|
69
|
+
};
|
|
70
|
+
} | null;
|
|
52
71
|
/**
|
|
53
72
|
* The texts a page shows, one entry per text element, roughly in reading
|
|
54
73
|
* order (top to bottom, then left to right). A rich text block draws one node
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import { CANVAS_ITEM_NAME } from './deepSelect.js';
|
|
3
3
|
/** Konva node name of what the editor shows but no export contains. */
|
|
4
4
|
export const EXPORT_HIDDEN_NAME = 'export-hidden';
|
|
5
|
+
/**
|
|
6
|
+
* Konva node name of the group `CanvasStage` scales the logical layout up to the format with: its
|
|
7
|
+
* children are the page's canvas items. A page whose logical size equals its format has no such
|
|
8
|
+
* group, and the items sit on the layer itself.
|
|
9
|
+
*/
|
|
10
|
+
export const PAGE_ROOT_NAME = 'page-root';
|
|
5
11
|
/**
|
|
6
12
|
* Runs `capture` with all selection chrome on the stage hidden — Konva
|
|
7
13
|
* Transformers plus the dashed selection Rects primitives render alongside
|
|
@@ -80,7 +86,14 @@ export function rasterizeStageElement(stage, elementId, pixelRatio = 2) {
|
|
|
80
86
|
const node = stage
|
|
81
87
|
.find(`.${CANVAS_ITEM_NAME}`)
|
|
82
88
|
.find((candidate) => candidate.getAttr('canvasItemId') === elementId);
|
|
83
|
-
|
|
89
|
+
return node ? rasterizeStageNode(stage, node, pixelRatio) : null;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* `rasterizeStageElement` for a node in hand: the SVG export draws an island whose item has no id
|
|
93
|
+
* to look the group up by from the node the recorder kept. `pixelRatio` is per page px.
|
|
94
|
+
*/
|
|
95
|
+
export function rasterizeStageNode(stage, node, pixelRatio = 2) {
|
|
96
|
+
if (!stage || !node.isVisible())
|
|
84
97
|
return null;
|
|
85
98
|
// Absolut (inkl. Zoom und Verschiebung des Stage) für toDataURL, das in
|
|
86
99
|
// diesen Koordinaten schneidet; relativ zum Stage = Seiten-px für die Box.
|
|
@@ -58,6 +58,7 @@ export declare function paintCropGhosts(stage: Konva.Stage, canvas: HTMLCanvasEl
|
|
|
58
58
|
* Einfärbung), einmal auf eine verkleinerte Kopie gerechnet statt per Cache
|
|
59
59
|
* auf dem ganzen, oft vielfach gezoomten Restbild. Spiegeln bleibt außen vor:
|
|
60
60
|
* das Restbild spiegelt über seine Skalierung. `displayedWidth` ist die Breite
|
|
61
|
-
* des ganzen Fotos auf der Bühne; der Weichzeichner-Radius gilt dort.
|
|
61
|
+
* des ganzen Fotos auf der Bühne; der Weichzeichner-Radius gilt dort. `maxSide`
|
|
62
|
+
* begrenzt die längste Kante der Kopie (der Pan braucht Bildschirmauflösung).
|
|
62
63
|
*/
|
|
63
|
-
export declare function cropGhostSource(image: HTMLImageElement, adjustments: ImageAdjustments | null, displayedWidth: number, color?: string | null): CanvasImageSource;
|
|
64
|
+
export declare function cropGhostSource(image: HTMLImageElement, adjustments: ImageAdjustments | null, displayedWidth: number, color?: string | null, maxSide?: number): CanvasImageSource;
|
package/dist/utils/cropGhost.js
CHANGED
|
@@ -172,9 +172,10 @@ const GHOST_SOURCE_SIDE = 1024;
|
|
|
172
172
|
* Einfärbung), einmal auf eine verkleinerte Kopie gerechnet statt per Cache
|
|
173
173
|
* auf dem ganzen, oft vielfach gezoomten Restbild. Spiegeln bleibt außen vor:
|
|
174
174
|
* das Restbild spiegelt über seine Skalierung. `displayedWidth` ist die Breite
|
|
175
|
-
* des ganzen Fotos auf der Bühne; der Weichzeichner-Radius gilt dort.
|
|
175
|
+
* des ganzen Fotos auf der Bühne; der Weichzeichner-Radius gilt dort. `maxSide`
|
|
176
|
+
* begrenzt die längste Kante der Kopie (der Pan braucht Bildschirmauflösung).
|
|
176
177
|
*/
|
|
177
|
-
export function cropGhostSource(image, adjustments, displayedWidth, color = null) {
|
|
178
|
+
export function cropGhostSource(image, adjustments, displayedWidth, color = null, maxSide = GHOST_SOURCE_SIDE) {
|
|
178
179
|
const look = adjustments ? { ...adjustments, flipX: false, flipY: false } : null;
|
|
179
180
|
const filters = [
|
|
180
181
|
...(color ? [Konva.Filters.RGB] : []),
|
|
@@ -183,7 +184,7 @@ export function cropGhostSource(image, adjustments, displayedWidth, color = null
|
|
|
183
184
|
const natural = { width: image.naturalWidth, height: image.naturalHeight };
|
|
184
185
|
if (filters.length === 0 || !natural.width || !natural.height)
|
|
185
186
|
return image;
|
|
186
|
-
const scale = Math.min(1,
|
|
187
|
+
const scale = Math.min(1, maxSide / Math.max(natural.width, natural.height));
|
|
187
188
|
const width = Math.max(1, Math.round(natural.width * scale));
|
|
188
189
|
const height = Math.max(1, Math.round(natural.height * scale));
|
|
189
190
|
const canvas = document.createElement('canvas');
|
|
@@ -53,6 +53,13 @@ export interface StoredIcon {
|
|
|
53
53
|
* renderer can draw them after a reload or on a collaborator's screen.
|
|
54
54
|
*/
|
|
55
55
|
export declare function registerStoredExternalIcons(selectedIcons: readonly string[] | undefined, iconStates: Record<string, StoredIcon> | undefined): void;
|
|
56
|
+
/**
|
|
57
|
+
* A colour that cannot break out of an attribute or reach for a resource: hex, a name, or one of
|
|
58
|
+
* the CSS colour functions (rgb, hsl, hwb, lab, lch, oklab, oklch, color, color-mix) over plain
|
|
59
|
+
* numbers, percentages and angles. Nothing else is parsed, so `url()`, `var()`, `calc()`,
|
|
60
|
+
* quotes, semicolons and braces never get through. Case is folded first.
|
|
61
|
+
*/
|
|
62
|
+
export declare const isSafeColor: (color: string) => boolean;
|
|
56
63
|
/** The SVG as a data URL of `size` px, `currentColor` replaced by `color`, for the canvas. */
|
|
57
64
|
export declare function externalIconDataUrl(svg: string, size: number, color: string): string;
|
|
58
65
|
/** "Icon: <Set> von <Autor>, <Lizenz>" for the picker; the "von" follows the catalogue. */
|
|
@@ -118,9 +118,76 @@ function toBase64(text) {
|
|
|
118
118
|
binary += String.fromCharCode(byte);
|
|
119
119
|
return btoa(binary);
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
/**
|
|
123
|
-
const
|
|
121
|
+
const HEX_OR_NAME = /^(?:#[0-9a-f]{3,8}|[a-z]{3,30})$/;
|
|
122
|
+
/** `none`, or a number with an optional percent sign or angle unit: one channel of a colour. */
|
|
123
|
+
const CHANNEL = /^(?:none|[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg|grad|rad|turn)?)$/;
|
|
124
|
+
const COLOR_FUNCTION = /^(rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\((.*)\)$/;
|
|
125
|
+
const MIX_HEAD = /^in [a-z]+(?: (?:shorter|longer|increasing|decreasing) hue)?$/;
|
|
126
|
+
const MIX_PERCENT = /^(.*?)(?:\s+(?:\d+\.?\d*|\.\d+)%)?$/;
|
|
127
|
+
const MAX_LENGTH = 200;
|
|
128
|
+
const MAX_DEPTH = 3;
|
|
129
|
+
/** The top-level comma-separated parts of `args`, or null when the parentheses do not balance. */
|
|
130
|
+
function splitTopLevel(args) {
|
|
131
|
+
const parts = [];
|
|
132
|
+
let depth = 0;
|
|
133
|
+
let start = 0;
|
|
134
|
+
for (let i = 0; i < args.length; i++) {
|
|
135
|
+
const c = args[i];
|
|
136
|
+
if (c === '(')
|
|
137
|
+
depth++;
|
|
138
|
+
else if (c === ')' && --depth < 0)
|
|
139
|
+
return null;
|
|
140
|
+
else if (c === ',' && depth === 0) {
|
|
141
|
+
parts.push(args.slice(start, i));
|
|
142
|
+
start = i + 1;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
if (depth !== 0)
|
|
146
|
+
return null;
|
|
147
|
+
parts.push(args.slice(start));
|
|
148
|
+
return parts;
|
|
149
|
+
}
|
|
150
|
+
function safeColor(color, depth) {
|
|
151
|
+
const value = color.trim();
|
|
152
|
+
if (HEX_OR_NAME.test(value))
|
|
153
|
+
return true;
|
|
154
|
+
const fn = COLOR_FUNCTION.exec(value);
|
|
155
|
+
if (!fn || depth > MAX_DEPTH)
|
|
156
|
+
return false;
|
|
157
|
+
const [, name, args] = fn;
|
|
158
|
+
if (name === 'color-mix') {
|
|
159
|
+
const parts = splitTopLevel(args);
|
|
160
|
+
if (!parts || parts.length !== 3 || !MIX_HEAD.test(parts[0].trim()))
|
|
161
|
+
return false;
|
|
162
|
+
return parts.slice(1).every((part) => safeColor(MIX_PERCENT.exec(part.trim())[1], depth + 1));
|
|
163
|
+
}
|
|
164
|
+
// No nested function and no stray parenthesis: a plain list of channels.
|
|
165
|
+
if (/[()]/.test(args))
|
|
166
|
+
return false;
|
|
167
|
+
const tokens = args.split(/[\s,/]+/).filter(Boolean);
|
|
168
|
+
if (name === 'color') {
|
|
169
|
+
// `color(<space> c1 c2 c3 [/ alpha])`: the space is an identifier, e.g. `display-p3`.
|
|
170
|
+
const [space, ...channels] = tokens;
|
|
171
|
+
return (!!space &&
|
|
172
|
+
/^[a-z][a-z0-9-]{1,30}$/.test(space) &&
|
|
173
|
+
channels.length > 0 &&
|
|
174
|
+
channels.every((t) => CHANNEL.test(t)));
|
|
175
|
+
}
|
|
176
|
+
return tokens.length >= 3 && tokens.length <= 4 && tokens.every((token) => CHANNEL.test(token));
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* A colour that cannot break out of an attribute or reach for a resource: hex, a name, or one of
|
|
180
|
+
* the CSS colour functions (rgb, hsl, hwb, lab, lch, oklab, oklch, color, color-mix) over plain
|
|
181
|
+
* numbers, percentages and angles. Nothing else is parsed, so `url()`, `var()`, `calc()`,
|
|
182
|
+
* quotes, semicolons and braces never get through. Case is folded first.
|
|
183
|
+
*/
|
|
184
|
+
export const isSafeColor = (color) => {
|
|
185
|
+
// The caller writes `color` into markup as it is, so surrounding whitespace is not slack to trim.
|
|
186
|
+
if (color !== color.trim())
|
|
187
|
+
return false;
|
|
188
|
+
const value = color.toLowerCase();
|
|
189
|
+
return value.length <= MAX_LENGTH && safeColor(value, 0);
|
|
190
|
+
};
|
|
124
191
|
/** The SVG as a data URL of `size` px, `currentColor` replaced by `color`, for the canvas. */
|
|
125
192
|
export function externalIconDataUrl(svg, size, color) {
|
|
126
193
|
const ink = isSafeColor(color) ? color : '#000000';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type Konva from 'konva';
|
|
2
|
+
interface Rect {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
/** A pan of a filtered photo over its pre-filtered copy; `end` puts the photo and its filters back. */
|
|
9
|
+
export interface FilteredPan {
|
|
10
|
+
/** Sets a crop given in the photo's own pixels on the copy. */
|
|
11
|
+
crop: (crop: Rect) => void;
|
|
12
|
+
end: () => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Pans a filtered photo without filtering it again on every move. A filtered node draws from its
|
|
16
|
+
* cache, and a new crop needs a new cache: one pass of every filter over the bitmap per pointer
|
|
17
|
+
* move (#197). Instead the node shows `source` — the whole photo, filtered once at the resolution
|
|
18
|
+
* it is shown at — with its crop scaled to that copy, and no filters or cache. Null when `source`
|
|
19
|
+
* is the photo itself (nothing to filter).
|
|
20
|
+
*/
|
|
21
|
+
export declare function beginFilteredPan(node: Konva.Image, source: CanvasImageSource, naturalWidth: number): FilteredPan | null;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const scaleRect = (r, s) => ({
|
|
2
|
+
x: r.x * s,
|
|
3
|
+
y: r.y * s,
|
|
4
|
+
width: r.width * s,
|
|
5
|
+
height: r.height * s,
|
|
6
|
+
});
|
|
7
|
+
/**
|
|
8
|
+
* Pans a filtered photo without filtering it again on every move. A filtered node draws from its
|
|
9
|
+
* cache, and a new crop needs a new cache: one pass of every filter over the bitmap per pointer
|
|
10
|
+
* move (#197). Instead the node shows `source` — the whole photo, filtered once at the resolution
|
|
11
|
+
* it is shown at — with its crop scaled to that copy, and no filters or cache. Null when `source`
|
|
12
|
+
* is the photo itself (nothing to filter).
|
|
13
|
+
*/
|
|
14
|
+
export function beginFilteredPan(node, source, naturalWidth) {
|
|
15
|
+
const photo = node.image();
|
|
16
|
+
if (!photo || source === photo || !('width' in source))
|
|
17
|
+
return null;
|
|
18
|
+
const sourceWidth = Number(source.width);
|
|
19
|
+
if (!sourceWidth || !naturalWidth)
|
|
20
|
+
return null;
|
|
21
|
+
const s = sourceWidth / naturalWidth;
|
|
22
|
+
const filters = node.filters();
|
|
23
|
+
node.clearCache();
|
|
24
|
+
node.filters([]);
|
|
25
|
+
node.image(source);
|
|
26
|
+
node.crop(scaleRect(node.crop(), s));
|
|
27
|
+
return {
|
|
28
|
+
crop: (crop) => node.crop(scaleRect(crop, s)),
|
|
29
|
+
end: () => {
|
|
30
|
+
const crop = node.crop();
|
|
31
|
+
node.image(photo);
|
|
32
|
+
node.filters(filters);
|
|
33
|
+
node.crop(scaleRect(crop, 1 / s));
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { recordCacheHit, recordCacheMiss, recordNetworkRequest } from './prefetchAnalytics.js';
|
|
12
12
|
import { registeredAssetCatalog } from '../canvasAssets.js';
|
|
13
|
+
import { isSafeColor } from '../externalIcons.js';
|
|
13
14
|
import { getIllustrationPath } from './registry.js';
|
|
14
15
|
// =============================================================================
|
|
15
16
|
// CACHE STATE
|
|
@@ -56,7 +57,11 @@ function escapeRegExp(text) {
|
|
|
56
57
|
/** Swaps the set's main colour (host `recolor`, else the built-in one) for `color`. */
|
|
57
58
|
function replaceColors(svgText, color, source) {
|
|
58
59
|
const key = registeredAssetCatalog().illustrations?.recolor?.[source] ?? BUILT_IN_RECOLOR[source];
|
|
59
|
-
|
|
60
|
+
// The colour comes from the document and lands inside markup that exports inline as it is; a
|
|
61
|
+
// value that is not a colour leaves the set's own colour.
|
|
62
|
+
return key && isSafeColor(color)
|
|
63
|
+
? svgText.replace(new RegExp(escapeRegExp(key), 'gi'), color)
|
|
64
|
+
: svgText;
|
|
60
65
|
}
|
|
61
66
|
/**
|
|
62
67
|
* Convert SVG text to base64 data URL
|
|
@@ -14,6 +14,19 @@ type KonvaFilter = typeof Konva.Filters.Grayscale;
|
|
|
14
14
|
export declare const TemperatureFilter: KonvaFilter;
|
|
15
15
|
/** The tint colour when an image has a strength but no colour of its own: the brand accent. */
|
|
16
16
|
export declare const defaultTint: () => string;
|
|
17
|
+
/**
|
|
18
|
+
* The tint of an image with a strength but no colour, read from a document's brand:
|
|
19
|
+
* its accent if that is an offered swatch, else the first swatch — so the colour
|
|
20
|
+
* painted is always one the picker shows.
|
|
21
|
+
*/
|
|
22
|
+
export declare const fallbackTintOf: (brand: {
|
|
23
|
+
colors: {
|
|
24
|
+
accent: string;
|
|
25
|
+
};
|
|
26
|
+
effects: {
|
|
27
|
+
tints: readonly string[];
|
|
28
|
+
};
|
|
29
|
+
}) => string;
|
|
17
30
|
/**
|
|
18
31
|
* Duotone ramp of one colour: luma 0 → a dark shade of it, 0.5 → the colour
|
|
19
32
|
* itself, 1 → a pale tone of it. 256 RGB entries, indexed by luma.
|
|
@@ -25,6 +25,17 @@ export const TemperatureFilter = function (imageData) {
|
|
|
25
25
|
};
|
|
26
26
|
/** The tint colour when an image has a strength but no colour of its own: the brand accent. */
|
|
27
27
|
export const defaultTint = () => activeBrand().colors.accent;
|
|
28
|
+
/**
|
|
29
|
+
* The tint of an image with a strength but no colour, read from a document's brand:
|
|
30
|
+
* its accent if that is an offered swatch, else the first swatch — so the colour
|
|
31
|
+
* painted is always one the picker shows.
|
|
32
|
+
*/
|
|
33
|
+
export const fallbackTintOf = (brand) => {
|
|
34
|
+
const { tints } = brand.effects;
|
|
35
|
+
return tints.includes(brand.colors.accent)
|
|
36
|
+
? brand.colors.accent
|
|
37
|
+
: (tints[0] ?? brand.colors.accent);
|
|
38
|
+
};
|
|
28
39
|
const hexRgb = (hex) => {
|
|
29
40
|
const n = Number.parseInt(hex.replace('#', '').slice(0, 6), 16) || 0;
|
|
30
41
|
return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packs files into a ZIP in the browser, in the order given. `level` is fflate's: 0 stores the
|
|
3
|
+
* bytes as they are (right for PNG and JPEG, which are compressed already), 6 deflates (SVG).
|
|
4
|
+
*/
|
|
5
|
+
export declare function zipFiles(files: {
|
|
6
|
+
name: string;
|
|
7
|
+
bytes: Uint8Array;
|
|
8
|
+
}[], level?: 0 | 6): Blob;
|
|
1
9
|
/**
|
|
2
10
|
* Packs rendered pages (data URLs) into a ZIP in the browser, as
|
|
3
11
|
* `seite-1.png`, `seite-2.png`, … (the catalogue's `export.pageFile`) — the
|
|
@@ -8,6 +8,16 @@ const EXTENSION_BY_TYPE = {
|
|
|
8
8
|
'image/jpg': 'jpg',
|
|
9
9
|
'image/webp': 'webp',
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Packs files into a ZIP in the browser, in the order given. `level` is fflate's: 0 stores the
|
|
13
|
+
* bytes as they are (right for PNG and JPEG, which are compressed already), 6 deflates (SVG).
|
|
14
|
+
*/
|
|
15
|
+
export function zipFiles(files, level = 6) {
|
|
16
|
+
const entries = {};
|
|
17
|
+
for (const { name, bytes } of files)
|
|
18
|
+
entries[name] = bytes;
|
|
19
|
+
return new Blob([zipSync(entries, { level })], { type: 'application/zip' });
|
|
20
|
+
}
|
|
11
21
|
/**
|
|
12
22
|
* Packs rendered pages (data URLs) into a ZIP in the browser, as
|
|
13
23
|
* `seite-1.png`, `seite-2.png`, … (the catalogue's `export.pageFile`) — the
|
|
@@ -17,14 +27,16 @@ const EXTENSION_BY_TYPE = {
|
|
|
17
27
|
* reads as data loss.
|
|
18
28
|
*/
|
|
19
29
|
export function zipPageImages(dataUrls) {
|
|
20
|
-
const files = {
|
|
21
|
-
dataUrls.forEach((dataUrl, i) => {
|
|
30
|
+
const files = dataUrls.map((dataUrl, i) => {
|
|
22
31
|
const parsed = parseDataUrl(dataUrl);
|
|
23
32
|
const extension = parsed ? EXTENSION_BY_TYPE[parsed.mediaType] : undefined;
|
|
24
33
|
if (!parsed || !extension)
|
|
25
34
|
throw new Error(messages().errors.pageExport(i + 1));
|
|
26
|
-
|
|
35
|
+
return {
|
|
36
|
+
name: `${messages().export.pageFile}-${i + 1}.${extension}`,
|
|
37
|
+
bytes: Uint8Array.from(atob(parsed.base64), (c) => c.charCodeAt(0)),
|
|
38
|
+
};
|
|
27
39
|
});
|
|
28
40
|
// Stored, not deflated: PNG and JPEG are compressed already.
|
|
29
|
-
return
|
|
41
|
+
return zipFiles(files, 0);
|
|
30
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ggraphic/editor",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.7",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
}
|
|
178
178
|
},
|
|
179
179
|
"dependencies": {
|
|
180
|
-
"@ggraphic/core": "0.1.0-alpha.
|
|
180
|
+
"@ggraphic/core": "0.1.0-alpha.3",
|
|
181
181
|
"@ggraphic/schema": "0.1.0-alpha.2",
|
|
182
182
|
"@hocuspocus/provider": "^4.8.0",
|
|
183
183
|
"@iconify-json/bi": "^1.2.7",
|
|
@@ -189,6 +189,7 @@
|
|
|
189
189
|
"@iconify-json/tabler": "^1.2.43",
|
|
190
190
|
"@iconify/react": "^6.0.3",
|
|
191
191
|
"@iconify/utils": "^3.1.7",
|
|
192
|
+
"@pdf-lib/fontkit": "1.1.1",
|
|
192
193
|
"@tanstack/react-query": "^5.104.1",
|
|
193
194
|
"@tiptap/core": "^3.32.1",
|
|
194
195
|
"@tiptap/extension-bold": "^3.32.1",
|
|
@@ -223,6 +224,8 @@
|
|
|
223
224
|
"zustand": "5.0.16"
|
|
224
225
|
},
|
|
225
226
|
"devDependencies": {
|
|
227
|
+
"@fontsource-variable/bricolage-grotesque": "^5.3.0",
|
|
228
|
+
"@fontsource/instrument-sans": "^5.3.0",
|
|
226
229
|
"@napi-rs/canvas": "^1.0.13",
|
|
227
230
|
"@rolldown/plugin-babel": "^0.2.4",
|
|
228
231
|
"@tailwindcss/node": "4.3.3",
|
|
@@ -238,6 +241,7 @@
|
|
|
238
241
|
"jsdom": "30.1.3",
|
|
239
242
|
"konva": "^10.9.0",
|
|
240
243
|
"lightningcss": "1.33.0",
|
|
244
|
+
"pdfjs-dist": "^6.5.438",
|
|
241
245
|
"pptxgenjs": "4.0.1",
|
|
242
246
|
"react-konva": "^19.3.2",
|
|
243
247
|
"rolldown": "1.2.15",
|
|
@@ -66,7 +66,7 @@ Things to know:
|
|
|
66
66
|
|
|
67
67
|
### Export
|
|
68
68
|
|
|
69
|
-
The editor's own Share menu downloads PNG, PDF and slide decks. To export from your own UI (a "Save PNG" button, a thumbnail on save), pass `exportApiRef`:
|
|
69
|
+
The editor's own Share menu downloads PNG, SVG, PDF and slide decks. To export from your own UI (a "Save PNG" button, a thumbnail on save), pass `exportApiRef`:
|
|
70
70
|
|
|
71
71
|
```tsx
|
|
72
72
|
import { type CanvasEditorExportApi } from '@ggraphic/editor/embed';
|
|
@@ -90,11 +90,17 @@ const [api, setApi] = useState<CanvasEditorExportApi | null>(null);
|
|
|
90
90
|
- `captureActivePage({ pixelRatio, transparent })`: the active page as a PNG data URL, or `null` while its canvas is not mounted.
|
|
91
91
|
- `capturePages({ pixelRatio })`: every page as a PNG data URL, in order.
|
|
92
92
|
- `exportPptx()`: the deck as an editable .pptx `Blob`.
|
|
93
|
+
- `exportSvg({ pages, text, transparent })`: vector SVG, resolving to `{ blob, filename, report }`. `pages` is `'current'` or `'all'`; one page gives the SVG itself, several give a ZIP of SVGs. `text` is `'outlines'` (glyph outlines, looks the same everywhere) or `'editable'` (live `<text>`, which needs the font where the file is opened). `transparent` leaves out the page background. It rejects when a page cannot be rendered.
|
|
94
|
+
- `exportPdf()`: every page as one vector PDF, resolving to `{ blob, filename, report }`: print pages with bleed, trim and crop marks, slides at slide size, other pages at 1 px to the pt. Text is real and selectable, fonts are subset-embedded. It rejects when a page cannot be rendered; when the document cannot be made as vector at all, the PDF is made of page pictures and `report.fallback` says why.
|
|
93
95
|
- `getPages()`: the document's pages as `onChange` reports them.
|
|
94
96
|
- `undo()` / `redo()`.
|
|
95
97
|
|
|
98
|
+
Both vector exports return an `ExportReport` (type from `@ggraphic/editor/export`): what could not stay vector (`rasterIslands`, each with a reason), glyphs a font lacks (`missingGlyphs`), images that could not be read (`missingElements`), fonts whose licence only allows outlines (`outlinedForLicence`), brand colours that left a PDF in RGB (`rgbBrandColors`) and `fallback`. Show it to the person who exported; the editor's own Share menu does.
|
|
99
|
+
|
|
96
100
|
To hide the editor's own Share menu, use the low-level path (`showShare={false}` on `CanvasEditorShell`).
|
|
97
101
|
|
|
102
|
+
To export a page you only preview (a gallery, a server-less render queue), mount `PagePreview` (from `@ggraphic/editor/shell`) and take its optional `onCanvas` callback: it receives the page's canvas handle (`GenericCanvasRef`) once the page has settled, just before the PNG is encoded, and the handle stays valid while the preview is mounted. The handle's `recordScene({ page, transparent })` is the `recordPage` dependency of `exportPagesSvg` / `exportPagesPdf` from `@ggraphic/editor/export`, which come with the browser helpers they are wired with (`fetchImageBytes`, `reencodeImage`, `rasterizeOps`, `pngFromDataUrl`).
|
|
103
|
+
|
|
98
104
|
### A brand of your own: `defineBrand`
|
|
99
105
|
|
|
100
106
|
```ts
|
|
@@ -118,6 +124,8 @@ export const brand = defineBrand({
|
|
|
118
124
|
|
|
119
125
|
The other five colour roles, the grounds and every picker are derived with WCAG contrast checks. It throws when a colour is not a colour. Load the fonts you name yourself (see Fonts).
|
|
120
126
|
|
|
127
|
+
**CMYK for print PDFs.** `BrandPack.print.cmyk` is optional: keys are `#rrggbb` (lower case), values are `[c, m, y, k]` from 0 to 100. In a vector PDF, fills, strokes and text in a listed colour, and gradients whose stops are all listed, are written as DeviceCMYK with exactly those values; every other colour, photos included, stays RGB, and a colour without a print value is never derived. Without the map the PDF is pure RGB, and `report.rgbBrandColors` lists the brand colours that left it that way. `defineBrand` does not take `print`; add it to the pack it returns: `{ ...defineBrand({ … }), print: { cmyk: { '#0f2352': [100, 85, 30, 40] } } }`.
|
|
128
|
+
|
|
121
129
|
### Templates as data: `loadTemplatePack`
|
|
122
130
|
|
|
123
131
|
`loadTemplatePack(files)` returns a promise of the pack and loads the parser (the schema validators and the page config, several hundred kB) in a chunk of its own, next to the editor. `templatePackFromJson(files)` does the same work synchronously, but whatever imports it carries that code: called at module level, it more than doubles a host's entry chunk. Use it where you need the pack before rendering. Neither is a server API: both are exported from the `'use client'` entry, so a server component that imports them gets a client reference, not the function, and the pack they return holds functions that cannot cross to the client.
|
|
@@ -166,6 +174,30 @@ Either way, theme the editor through the `--editor-*` custom properties. Set the
|
|
|
166
174
|
|
|
167
175
|
Every family a brand pack names in `fonts` / `fontFaces` must actually load in the page (`@font-face` with the real files), including each cut you declare. With `defaultBrand`, `import '@ggraphic/brand-default/fonts'` does that. Declare which cuts exist in `fonts.cuts` (`{ bold, italic, boldItalic }` per family): a missing declaration makes the editor fake a cut or hide the bold/italic buttons. Families no pack declares fall back to ggraphic's open aliases.
|
|
168
176
|
|
|
177
|
+
The SVG and PDF exports embed or outline the glyphs themselves, so they need the font files, not only a loaded `@font-face`. They look in this order: the optional host service `exportFonts`, the brand pack's `fontFaces`, then the page's own `@font-face` rules (same-origin, or cross-origin with CORS headers, so `fetch` can read them). A host whose fonts are not reachable that way (signed URLs, files behind an API, cross-origin fonts without CORS) passes `exportFonts` in `services`:
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { type CanvasExportFontService } from '@ggraphic/editor/services';
|
|
181
|
+
|
|
182
|
+
const exportFonts: CanvasExportFontService = {
|
|
183
|
+
// The file for one face: TTF, OTF, WOFF or WOFF2; null when you have none.
|
|
184
|
+
load: async ({ family, weight, style }) => {
|
|
185
|
+
const res = await fetch(fontUrl(family, weight, style));
|
|
186
|
+
return res.ok ? new Uint8Array(await res.arrayBuffer()) : null;
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
<GgraphicEditor brand={brand} templates={templates} services={{ exportFonts }} />;
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
`load` is asked for the face the export resolved, which is not always the one the document names:
|
|
194
|
+
|
|
195
|
+
- `family` is already resolved through ggraphic's open font aliases (a document that says an aliased name is asked for its replacement) and has no CSS quotes.
|
|
196
|
+
- For a bold request (weight 600 and up) of a regular family that the brand pack's `fonts.boldFamilies` maps to a bold-only family, `load` is first asked for that bold family at weight `400`, because its regular cut is the bold. Answer weight-400 requests for such a family with its file; if you return `null`, `load` is asked again for the regular family at the bold weight.
|
|
197
|
+
- An answer of `null`, or a `load` that throws or rejects, means "no file from you": the brand's `fontFaces` and the page's `@font-face` rules are tried next.
|
|
198
|
+
|
|
199
|
+
A face no source has a file for does not break the export: in an SVG its text stays a live `<text>` with the family name; in a PDF it becomes a picture (`rasterIslands`, reason `font-unavailable`), and when that hits the text of more than one element the PDF is made of page pictures (`report.fallback`).
|
|
200
|
+
|
|
169
201
|
## Testing a host
|
|
170
202
|
|
|
171
203
|
- **Jest** (e.g. jest-expo): the dist is ESM-only. Extend the preset's `transformIgnorePatterns` allowlist with `@ggraphic/` instead of writing your own pattern.
|