@ggraphic/editor 0.1.0-alpha.2 → 0.1.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -373
- package/NOTICE +2 -1
- package/README.md +1 -1
- package/dist/CanvasEditorProvider.js +1 -1
- package/dist/ai/applyOperation.js +1 -1
- package/dist/ai/describeCanvasElements.js +1 -1
- package/dist/ai/illustrationCapability.js +1 -1
- package/dist/blocks/liftedBlock.js +1 -1
- package/dist/brand/bindPick.js +1 -1
- package/dist/brand/brandRegistry.js +1 -1
- package/dist/collab/documentVersion.js +1 -1
- package/dist/collab/pageElementStateKeys.js +1 -1
- package/dist/collab/pagesDoc.js +1 -1
- package/dist/collab/useAwarenessState.js +1 -1
- package/dist/collab/useEmitHostStateChanges.js +1 -1
- package/dist/collab/useSelectionAwareness.js +1 -1
- package/dist/collab/useYjsCanvasBinding.js +1 -1
- package/dist/collab/useYjsPageStateSync.d.ts +1 -15
- package/dist/collab/useYjsPageStateSync.js +76 -6
- package/dist/collab/wrapCallbacksWithPageSync.js +1 -1
- package/dist/collab/ydocKeys.js +1 -1
- package/dist/collab/yjsBinding.js +1 -1
- package/dist/common/Lightbox.js +1 -1
- package/dist/components/AddPageButton.js +1 -1
- package/dist/components/CanvasAnnouncer.js +1 -1
- package/dist/components/CanvasContextMenu/CanvasActionSheet.js +1 -1
- package/dist/components/CanvasContextMenu/CanvasContextMenu.js +1 -1
- package/dist/components/CanvasContextMenu/canvasMenuModel.js +1 -1
- package/dist/components/CanvasEditor/CanvasEditorShell.js +3 -3
- package/dist/components/CanvasEditor/PageWrapper.js +1 -1
- package/dist/components/CanvasEditor/blockInsertContext.js +1 -1
- package/dist/components/CanvasEditor/editorShell.d.ts +8 -2
- package/dist/components/CanvasEditor/hooks/useCanvasContextMenu.js +1 -1
- package/dist/components/CanvasEditor/hooks/useLoadedConfigs.js +1 -1
- package/dist/components/CanvasEditor/hooks/useMobileSheetFit.js +1 -1
- package/dist/components/CanvasEditor/hooks/usePageRefs.js +1 -1
- package/dist/components/CanvasEditor/hooks/usePageUndoRedoShortcuts.js +1 -1
- package/dist/components/CanvasEditor/hooks/usePrintImpressumGate.js +1 -1
- package/dist/components/CanvasEditor/hooks/useScrollToAddedPage.js +1 -1
- package/dist/components/CanvasEditor/hooks/useToolbarHandlers.js +1 -1
- package/dist/components/CanvasEditor/hooks/useWorkAreaDeselect.js +1 -1
- package/dist/components/CanvasEditor/layersTab.js +1 -1
- package/dist/components/CanvasEditor/types.d.ts +2 -0
- package/dist/components/CanvasEditorSkeleton.js +2 -2
- package/dist/components/CanvasMetaBar.js +1 -1
- package/dist/components/CanvasRenderLayer.js +1 -1
- package/dist/components/CanvasTextOverlay.js +1 -1
- package/dist/components/ConfigCanvas.js +1 -1
- package/dist/components/CropGhostOverlay.js +1 -1
- package/dist/components/CustomColorSwatch.js +1 -1
- package/dist/components/GenericCanvas.d.ts +11 -0
- package/dist/components/GenericCanvas.js +65 -18
- package/dist/components/GenericCanvasElement.js +5 -3
- package/dist/components/MultiSelectionTransformer.js +1 -1
- package/dist/components/PagePreview.js +1 -1
- package/dist/components/PageThumbnailStrip.js +1 -1
- package/dist/components/PageToolbar.js +1 -1
- package/dist/components/PrintGuides.js +1 -1
- package/dist/components/RemoteSelectionOverlay.js +1 -1
- package/dist/components/RichTextField.js +1 -1
- package/dist/components/SelectionPill.js +1 -1
- package/dist/components/SlideNotesPanel.js +1 -1
- package/dist/components/SlotBudgetStatus.js +1 -1
- package/dist/components/StandaloneCanvas.js +1 -1
- package/dist/components/TextFormatControls.js +1 -1
- package/dist/components/Toolbar.js +1 -1
- package/dist/components/ToolbarStateBridge.js +1 -1
- package/dist/components/TopBar/AutoSaveIndicator.js +1 -1
- package/dist/components/TopBar/CropModeControls.js +1 -1
- package/dist/components/TopBar/DownloadSection.js +1 -1
- package/dist/components/TopBar/MobileSelectionControls.js +1 -1
- package/dist/components/TopBar/ShareDropdown.js +1 -1
- package/dist/components/TopBar/barTiles.js +1 -1
- package/dist/components/TopBar/modules/FloatingAiSuggestionBanner.js +1 -1
- package/dist/components/TopBar/modules/FloatingBackgroundControls.js +1 -1
- package/dist/components/TopBar/modules/FloatingFontRoleControl.js +1 -1
- package/dist/components/TopBar/modules/FloatingFontSizeControl.js +1 -1
- package/dist/components/TopBar/modules/FloatingHistoryControls.js +1 -1
- package/dist/components/TopBar/modules/FloatingImageLookControl.js +1 -1
- package/dist/components/TopBar/modules/FloatingLayerControls.js +1 -1
- package/dist/components/TopBar/modules/FloatingOpacityControl.js +1 -1
- package/dist/components/TopBar/modules/FloatingPositionControl.js +1 -1
- package/dist/components/TopBar/modules/FloatingTextAlignControl.js +1 -1
- package/dist/components/TransformHud.js +1 -1
- package/dist/components/WholeTextFormatControls.js +1 -1
- package/dist/components/accentMark.js +1 -1
- package/dist/components/canvasItemLock.js +1 -1
- package/dist/components/kindRenderers.js +1 -1
- package/dist/components/markColor.js +1 -1
- package/dist/composer/cardFollowsText.js +1 -1
- package/dist/composer/marks.js +1 -1
- package/dist/composer/steckbriefLayout.js +1 -1
- package/dist/composer/textFit.js +1 -1
- package/dist/configs/buildCanvasText.js +1 -1
- package/dist/configs/buildSharepicText.js +1 -1
- package/dist/configs/configLoader.js +1 -1
- package/dist/configs/factory/actionFactories.d.ts +9 -5
- package/dist/configs/factory/actionFactories.js +50 -28
- package/dist/configs/factory/baseTypes.js +1 -1
- package/dist/configs/factory/carryInstanceState.js +1 -1
- package/dist/configs/factory/createTextElement.js +1 -1
- package/dist/configs/featureInjector.js +1 -1
- package/dist/configs/pageInheritance.d.ts +10 -1
- package/dist/configs/pageInheritance.js +38 -10
- package/dist/configs/placeholders.js +1 -1
- package/dist/configs/shareSection.js +1 -1
- package/dist/configs/types.d.ts +9 -1
- package/dist/configs/unifiedTabs.js +1 -1
- package/dist/embed/EmbeddedEditor.d.ts +2 -2
- package/dist/embed/EmbeddedEditor.js +2 -2
- package/dist/embed/GgraphicEditor.js +1 -1
- package/dist/embed/blankPage.d.ts +6 -0
- package/dist/embed/blankPage.js +7 -0
- package/dist/embed/index.d.ts +1 -0
- package/dist/embed/index.js +2 -1
- package/dist/entries/ai.js +1 -1
- package/dist/entries/brand.js +1 -1
- package/dist/entries/canvas.js +1 -1
- package/dist/entries/collab.js +1 -1
- package/dist/entries/config.d.ts +1 -1
- package/dist/entries/elements.js +1 -1
- package/dist/entries/embed.d.ts +1 -1
- package/dist/entries/embed.js +2 -2
- package/dist/entries/export.js +1 -1
- package/dist/entries/host.d.ts +2 -1
- package/dist/entries/host.js +2 -1
- package/dist/entries/hostReact.js +1 -1
- package/dist/entries/i18n.js +1 -1
- package/dist/entries/illustrations/gophers.js +1 -1
- package/dist/entries/illustrations/humaaans.js +1 -1
- package/dist/entries/illustrations/illlustrations.js +1 -1
- package/dist/entries/illustrations/kawaii.js +1 -1
- package/dist/entries/illustrations/opendoodles.js +1 -1
- package/dist/entries/illustrations/openpeeps.js +1 -1
- package/dist/entries/illustrations/transhumans.js +1 -1
- package/dist/entries/kinds.js +1 -1
- package/dist/entries/page.js +1 -1
- package/dist/entries/shell.d.ts +1 -0
- package/dist/entries/shell.js +1 -1
- package/dist/entries/sidebar.js +1 -1
- package/dist/entries/store.js +1 -1
- package/dist/entries/templates.d.ts +1 -1
- package/dist/entries/templates.js +2 -2
- package/dist/entries/text.js +1 -1
- package/dist/export/pptx/buildPptxModel.js +1 -1
- package/dist/export/pptx/exportPptxDeck.js +1 -1
- package/dist/export/pptx/pptxFonts.js +1 -1
- package/dist/export/pptx/pptxUnits.js +1 -1
- package/dist/export/pptx/types.js +1 -1
- package/dist/export/pptx/writePptx.js +1 -1
- package/dist/export/pptx/writeText.js +1 -1
- package/dist/export/printExport.js +1 -1
- package/dist/export/printPdf.js +1 -1
- package/dist/export/slidesPdf.js +1 -1
- package/dist/formats/index.d.ts +6 -3
- package/dist/formats/index.js +5 -4
- package/dist/groups/pageGroups.js +1 -1
- package/dist/hooks/editorBox.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/stageFit.js +1 -1
- package/dist/hooks/useAiImageGeneration.js +1 -1
- package/dist/hooks/useAnnounce.js +1 -1
- package/dist/hooks/useBoxSnap.js +1 -1
- package/dist/hooks/useCanvasAutoSave.js +1 -1
- package/dist/hooks/useCanvasElementHandlers.js +1 -1
- package/dist/hooks/useCanvasHistorySetup.d.ts +2 -0
- package/dist/hooks/useCanvasHistorySetup.js +3 -2
- package/dist/hooks/useCanvasInteractions.js +1 -1
- package/dist/hooks/useCanvasKeyboardHandlers.js +1 -1
- package/dist/hooks/useCanvasStoreReset.js +1 -1
- package/dist/hooks/useCanvasUndoRedo.d.ts +2 -0
- package/dist/hooks/useCanvasUndoRedo.js +5 -1
- package/dist/hooks/useContextPress.js +1 -1
- package/dist/hooks/useCropSession.js +1 -1
- package/dist/hooks/useDebounce.js +1 -1
- package/dist/hooks/useDeckAutoSave.js +1 -1
- package/dist/hooks/useDeepSelect.js +1 -1
- package/dist/hooks/useElementSnapping.js +1 -1
- package/dist/hooks/useEmojiCatalog.js +1 -1
- package/dist/hooks/useFloatingModuleState.js +1 -1
- package/dist/hooks/useFontGeneration.js +1 -1
- package/dist/hooks/useFontLoader.js +1 -1
- package/dist/hooks/useGeometryReporter.js +1 -1
- package/dist/hooks/useHoverOutline.js +1 -1
- package/dist/hooks/useIconCatalog.js +1 -1
- package/dist/hooks/useIconSearch.js +1 -1
- package/dist/hooks/useIconSetsFor.js +1 -1
- package/dist/hooks/useImageCoverFit.js +1 -1
- package/dist/hooks/useIsCanvasMobile.js +1 -1
- package/dist/hooks/useMarqueeSelection.js +1 -1
- package/dist/hooks/useMobileSheet.js +1 -1
- package/dist/hooks/useMultiPageExport.js +1 -1
- package/dist/hooks/usePageManager.d.ts +2 -1
- package/dist/hooks/usePageManager.js +7 -5
- package/dist/hooks/usePageThumbnails.js +1 -1
- package/dist/hooks/usePaginatedIcons.js +1 -1
- package/dist/hooks/useRovingToolbar.js +1 -1
- package/dist/hooks/useSelectionAnnouncement.js +1 -1
- package/dist/hooks/useSnapScheduler.js +1 -1
- package/dist/hooks/useTrackUnsplashDownload.js +1 -1
- package/dist/hooks/useZoomGestures.js +1 -1
- package/dist/hostServices.js +1 -1
- package/dist/i18n/catalogue.js +1 -1
- package/dist/i18n/de.js +1 -1
- package/dist/i18n/messages.js +1 -1
- package/dist/layouts/CanvasEditorLayout.js +2 -2
- package/dist/layouts/index.js +1 -1
- package/dist/page/actions.js +1 -1
- package/dist/page/config.js +1 -1
- package/dist/page/fitting.js +1 -1
- package/dist/page/hug.js +1 -1
- package/dist/page/instantiate.js +1 -1
- package/dist/page/logoSize.js +1 -1
- package/dist/page/templatePack.js +1 -1
- package/dist/primitives/AssetPrimitive.js +8 -6
- package/dist/primitives/CanvasBackground.js +1 -1
- package/dist/primitives/CanvasIcons.js +1 -1
- package/dist/primitives/CanvasImage.js +1 -1
- package/dist/primitives/CanvasRichText.js +1 -1
- package/dist/primitives/CanvasStage.js +1 -1
- package/dist/primitives/CanvasText.js +1 -1
- package/dist/primitives/ChartPrimitive.js +1 -1
- package/dist/primitives/FramePrimitive.js +1 -1
- package/dist/primitives/IconPrimitive.js +1 -1
- package/dist/primitives/IllustrationPrimitive.js +1 -1
- package/dist/primitives/PillBadge.js +2 -2
- package/dist/primitives/ShapePrimitive.js +1 -1
- package/dist/primitives/SnapGuidelines.js +1 -1
- package/dist/primitives/UserImagePrimitive.js +13 -7
- package/dist/primitives/index.js +1 -1
- package/dist/sidebar/SidebarPanel.js +1 -1
- package/dist/sidebar/SidebarTabBar.js +1 -1
- package/dist/sidebar/SubsectionTabBar.js +1 -1
- package/dist/sidebar/UserUploadsProvider.js +1 -1
- package/dist/sidebar/components/AltTextField.js +1 -1
- package/dist/sidebar/components/SidebarHint.js +1 -1
- package/dist/sidebar/components/SidebarSlider.js +1 -1
- package/dist/sidebar/components/TextFieldPrimitives.js +1 -1
- package/dist/sidebar/coreSidebarParts.js +1 -1
- package/dist/sidebar/sections/AssetGallery.js +1 -1
- package/dist/sidebar/sections/ChartSettingsSection.js +1 -1
- package/dist/sidebar/sections/ChartsSection.js +1 -1
- package/dist/sidebar/sections/CombinedTextSection.js +1 -1
- package/dist/sidebar/sections/DiagrammeSection.js +1 -1
- package/dist/sidebar/sections/FormenSection.js +1 -1
- package/dist/sidebar/sections/FrameSettingsSection.js +1 -1
- package/dist/sidebar/sections/FramesSection.js +1 -1
- package/dist/sidebar/sections/GenericShareSection.js +1 -1
- package/dist/sidebar/sections/IconsSection.js +1 -1
- package/dist/sidebar/sections/IllustrationSettings.js +1 -1
- package/dist/sidebar/sections/IllustrationThumb.js +1 -1
- package/dist/sidebar/sections/ImageAdjustSection.js +1 -1
- package/dist/sidebar/sections/LayersSection.js +1 -1
- package/dist/sidebar/sections/RahmenSection.js +1 -1
- package/dist/sidebar/sections/ShapesSection.js +1 -1
- package/dist/sidebar/sections/StudioGallery.js +1 -1
- package/dist/sidebar/sections/UploadsSection.js +1 -1
- package/dist/sidebar/sections/assets/AssetsSection.js +1 -1
- package/dist/sidebar/sections/assets/BackgroundCatalog.js +1 -1
- package/dist/sidebar/sections/assets/CategoryCard.js +1 -1
- package/dist/sidebar/sections/assets/ElementGrid.js +1 -1
- package/dist/sidebar/sections/assets/ElementThumb.js +1 -1
- package/dist/sidebar/sections/assets/ElementTile.js +1 -1
- package/dist/sidebar/sections/assets/ElementsPanel.js +1 -1
- package/dist/sidebar/sections/assets/EmojiTonePicker.js +1 -1
- package/dist/sidebar/sections/assets/FotosCatalog.js +1 -1
- package/dist/sidebar/sections/assets/IconifyCatalog.js +1 -1
- package/dist/sidebar/sections/assets/RecentCarousel.js +1 -1
- package/dist/sidebar/sections/assets/StickerCatalog.js +1 -1
- package/dist/sidebar/sections/assets/constants.js +1 -1
- package/dist/sidebar/sections/assets/elementSearch.js +1 -1
- package/dist/sidebar/sections/assets/elementTypes.js +1 -1
- package/dist/sidebar/sections/assets/index.js +1 -1
- package/dist/sidebar/sections/assets/useRecentElements.js +1 -1
- package/dist/sidebar/sections/assets/useStockPhotos.js +1 -1
- package/dist/sidebar/sections/effects/EffectCard.js +1 -1
- package/dist/sidebar/sections/effects/GradientSettings.js +1 -1
- package/dist/sidebar/sections/effects/OutlineSettings.js +1 -1
- package/dist/sidebar/sections/effects/ShadowSettings.js +1 -1
- package/dist/sidebar/sections/effects/effectsFor.js +1 -1
- package/dist/sidebar/sections/index.js +1 -1
- package/dist/sidebar/sections/lazyWithPreload.js +1 -1
- package/dist/sidebar/sections/registerBundledIconSets.js +1 -1
- package/dist/sidebar/sections/tools/AiCreateTool.js +1 -1
- package/dist/sidebar/sections/tools/AiEditTool.js +1 -1
- package/dist/sidebar/sections/tools/AltTextTool.js +1 -1
- package/dist/sidebar/sections/tools/ImageInputPicker.js +1 -1
- package/dist/sidebar/sections/tools/QRCodeTool.js +1 -1
- package/dist/sidebar/sections/tools/RemoveBackgroundTool.js +1 -1
- package/dist/sidebar/sections/tools/ToolPanel.js +1 -1
- package/dist/sidebar/sections/tools/ToolTiles.js +1 -1
- package/dist/sidebar/sections/tools/ToolsSection.js +1 -1
- package/dist/sidebar/sections/tools/UnsplashLimitNotice.js +1 -1
- package/dist/sidebar/sections/tools/UnsplashTool.js +1 -1
- package/dist/sidebar/sections/tools/index.js +1 -1
- package/dist/sidebar/sections/tools/toolTiles.css +1 -1
- package/dist/sidebar/sections/tools/useToolImagePlacement.js +1 -1
- package/dist/sidebar/sections/usePreloadSections.js +1 -1
- package/dist/sidebar/sections/whenIdle.js +1 -1
- package/dist/sidebar/sidebarStyles.js +1 -1
- package/dist/sidebar/useImagePlacement.js +1 -1
- package/dist/stores/AutoSaveStoreProvider.js +1 -1
- package/dist/stores/CanvasStoreProvider.js +1 -1
- package/dist/stores/createAutoSaveStore.js +1 -1
- package/dist/stores/createCanvasEditorStore.d.ts +11 -0
- package/dist/stores/createCanvasEditorStore.js +47 -1
- package/dist/stores/useAutoSaveStore.js +1 -1
- package/dist/styles/compiled.css +2 -2
- package/dist/styles/editor.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles/tailwind.css +1 -1
- package/dist/styles/tokens.css +1 -1
- package/dist/templates/fontWidths.generated.js +1 -1
- package/dist/templates/registry.js +1 -1
- package/dist/templates/templateGeometry.js +1 -1
- package/dist/templates/testKinds.js +1 -1
- package/dist/testing/documentBrandPacks.js +1 -1
- package/dist/testing/fixtureTemplates.js +1 -1
- package/dist/testing/stampKind.js +1 -1
- package/dist/types/editorTypes.js +1 -1
- package/dist/ui/alert-dialog.js +1 -1
- package/dist/ui/button.js +1 -1
- package/dist/ui/dialog.js +1 -1
- package/dist/ui/editorScope.js +1 -1
- package/dist/ui/icon-button.js +1 -1
- package/dist/ui/label.js +1 -1
- package/dist/ui/masonry-grid.js +1 -1
- package/dist/ui/popover.js +1 -1
- package/dist/ui/select.js +1 -1
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/switch.js +1 -1
- package/dist/utils/alignment.js +1 -1
- package/dist/utils/axisLock.js +1 -1
- package/dist/utils/backgroundPhotoCrop.js +1 -1
- package/dist/utils/canvasAssets.js +1 -1
- package/dist/utils/canvasClipboard.js +1 -1
- package/dist/utils/canvasCommandRegistry.js +1 -1
- package/dist/utils/canvasCommands.js +1 -1
- package/dist/utils/canvasFontFamilies.js +1 -1
- package/dist/utils/canvasIcons.js +1 -1
- package/dist/utils/canvasLayerManager.d.ts +4 -0
- package/dist/utils/canvasLayerManager.js +12 -7
- package/dist/utils/captureStage.js +1 -1
- package/dist/utils/chartTypes.js +1 -1
- package/dist/utils/chartUtils.js +1 -1
- package/dist/utils/circleBadgeUtils.js +1 -1
- package/dist/utils/cn.js +1 -1
- package/dist/utils/collectAltTextPages.js +1 -1
- package/dist/utils/colorLuminance.js +1 -1
- package/dist/utils/coverFit.js +1 -1
- package/dist/utils/cropAspect.js +1 -1
- package/dist/utils/cropGhost.js +1 -1
- package/dist/utils/cropSession.js +1 -1
- package/dist/utils/cropTarget.js +1 -1
- package/dist/utils/deepSelect.js +1 -1
- package/dist/utils/downloadError.js +1 -1
- package/dist/utils/duplicateElement.js +1 -1
- package/dist/utils/editorFocus.js +1 -1
- package/dist/utils/elementKinds.js +1 -1
- package/dist/utils/emoji/emojiCatalog.js +1 -1
- package/dist/utils/ensureFontsReady.d.ts +8 -2
- package/dist/utils/ensureFontsReady.js +20 -10
- package/dist/utils/expandImage.js +1 -1
- package/dist/utils/externalIcons.js +1 -1
- package/dist/utils/filterCache.js +1 -1
- package/dist/utils/filterUtils.js +1 -1
- package/dist/utils/fontAliases.js +1 -1
- package/dist/utils/fontGeneration.js +1 -1
- package/dist/utils/fontMarkSupport.js +1 -1
- package/dist/utils/fontSpecs.js +1 -1
- package/dist/utils/gradientFill.js +1 -1
- package/dist/utils/gradientHitArea.js +1 -1
- package/dist/utils/grain.js +1 -1
- package/dist/utils/grainSpec.js +1 -1
- package/dist/utils/groupSnap.js +1 -1
- package/dist/utils/handDrawn.js +1 -1
- package/dist/utils/historyStamp.js +1 -1
- package/dist/utils/hostStorageKeys.js +1 -1
- package/dist/utils/iconInstances.js +1 -1
- package/dist/utils/illustrations/gophers.js +1 -1
- package/dist/utils/illustrations/humaaans.js +1 -1
- package/dist/utils/illustrations/illlustrations.js +1 -1
- package/dist/utils/illustrations/kawaii.js +1 -1
- package/dist/utils/illustrations/opendoodles.js +1 -1
- package/dist/utils/illustrations/openpeeps.js +1 -1
- package/dist/utils/illustrations/prefetchAnalytics.js +1 -1
- package/dist/utils/illustrations/registry.js +1 -1
- package/dist/utils/illustrations/svgCache.js +1 -1
- package/dist/utils/illustrations/transhumans.js +1 -1
- package/dist/utils/illustrations/types.js +1 -1
- package/dist/utils/imageElementComparison.js +1 -1
- package/dist/utils/imageFilters.js +1 -1
- package/dist/utils/imageLook.js +1 -1
- package/dist/utils/keyboardCrop.js +1 -1
- package/dist/utils/keyboardOwnership.js +1 -1
- package/dist/utils/layerLabels.js +1 -1
- package/dist/utils/layerLock.js +1 -1
- package/dist/utils/layerSelection.js +1 -1
- package/dist/utils/mediaDrop.js +1 -1
- package/dist/utils/mediaPlacement.js +1 -1
- package/dist/utils/motifSizes.js +1 -1
- package/dist/utils/multiSelect.js +1 -1
- package/dist/utils/notch.js +1 -1
- package/dist/utils/orientElement.js +1 -1
- package/dist/utils/orientation.js +1 -1
- package/dist/utils/pageCounter.js +1 -1
- package/dist/utils/pendingImages.d.ts +17 -4
- package/dist/utils/pendingImages.js +18 -14
- package/dist/utils/photoCredit.js +1 -1
- package/dist/utils/photoPlaceholder.js +1 -1
- package/dist/utils/pillBadgeUtils.js +1 -1
- package/dist/utils/plainTextLayout.js +1 -1
- package/dist/utils/rebaseHistoryState.d.ts +71 -0
- package/dist/utils/rebaseHistoryState.js +208 -0
- package/dist/utils/removeElement.js +1 -1
- package/dist/utils/renderedBoxes.js +1 -1
- package/dist/utils/resolveElementValue.js +1 -1
- package/dist/utils/scrollBehavior.js +1 -1
- package/dist/utils/searchTranslations.js +1 -1
- package/dist/utils/selectionCapabilities.js +1 -1
- package/dist/utils/shade.js +1 -1
- package/dist/utils/shapeTransform.js +1 -1
- package/dist/utils/smartCrop.js +1 -1
- package/dist/utils/snapping.js +1 -1
- package/dist/utils/stateTypeAssertions.js +1 -1
- package/dist/utils/straighten.js +1 -1
- package/dist/utils/surfaceGlow.js +1 -1
- package/dist/utils/templateElementInstance.js +1 -1
- package/dist/utils/templateRotation.js +1 -1
- package/dist/utils/textAlign.js +1 -1
- package/dist/utils/textEditorOpeners.js +1 -1
- package/dist/utils/textRouting.js +1 -1
- package/dist/utils/transformHudLabel.js +1 -1
- package/dist/utils/unsplashLinks.js +1 -1
- package/dist/utils/userImageCrop.js +1 -1
- package/dist/utils/viewport.js +1 -1
- package/dist/utils/zipPageImages.js +1 -1
- package/package.json +4 -4
- package/skills/ggraphic-embed/SKILL.md +13 -13
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { type BrandPack } from '@ggraphic/core';
|
|
8
8
|
import { type ChartInstance, type ChartType } from '../../utils/chartUtils.js';
|
|
9
9
|
import type { IconState, BaseCanvasState } from './baseTypes.js';
|
|
10
|
-
import type { AdditionalText } from '../types.js';
|
|
10
|
+
import type { AdditionalText, CanvasActionHistory } from '../types.js';
|
|
11
11
|
import type { AssetInstance } from '../../utils/canvasAssets.js';
|
|
12
12
|
import type { CircleBadgeInstance } from '../../utils/circleBadgeUtils.js';
|
|
13
13
|
import type { ExternalIconPayload } from '../../utils/externalIcons.js';
|
|
@@ -66,7 +66,7 @@ brand?: BrandPack): {
|
|
|
66
66
|
};
|
|
67
67
|
export declare function createAdditionalTextActions<TState extends {
|
|
68
68
|
additionalTexts: AdditionalText[];
|
|
69
|
-
}>(getState: () => TState, setState: StateSetter<TState>, saveToHistory: HistorySaver<TState>, debouncedSaveToHistory: HistorySaver<TState>, canvasWidth: number, canvasHeight: number, fontColor?: string,
|
|
69
|
+
}>(getState: () => TState, setState: StateSetter<TState>, saveToHistory: HistorySaver<TState>, debouncedSaveToHistory: HistorySaver<TState>, canvasWidth: number, canvasHeight: number, fontColor?: string,
|
|
70
70
|
/** The pack of the page's document; the active brand by default. */
|
|
71
71
|
brand?: BrandPack): {
|
|
72
72
|
addHeader: () => void;
|
|
@@ -121,7 +121,9 @@ brand?: BrandPack): {
|
|
|
121
121
|
};
|
|
122
122
|
export declare function createUserImageActions<TState extends {
|
|
123
123
|
userImageInstances: UserImageInstance[];
|
|
124
|
-
}>(getState: () => TState, setState: StateSetter<TState>, saveToHistory: HistorySaver<TState>, debouncedSaveToHistory: HistorySaver<TState>, canvasWidth: number, canvasHeight: number
|
|
124
|
+
}>(getState: () => TState, setState: StateSetter<TState>, saveToHistory: HistorySaver<TState>, debouncedSaveToHistory: HistorySaver<TState>, canvasWidth: number, canvasHeight: number,
|
|
125
|
+
/** `createActions`' history argument; without it the URL swap is an undo step of its own. */
|
|
126
|
+
history?: CanvasActionHistory): {
|
|
125
127
|
addUserImage: (file: File, objectUrl: string) => void;
|
|
126
128
|
addUserImageFromUrl: (url: string, fileName: string, options?: UserImagePlacement) => void;
|
|
127
129
|
/**
|
|
@@ -137,14 +139,16 @@ export declare function createUserImageActions<TState extends {
|
|
|
137
139
|
removeUserImage: (id: string) => void;
|
|
138
140
|
};
|
|
139
141
|
export declare function createElementActions<TState extends BaseCanvasState>(getState: () => TState, setState: StateSetter<TState>, saveToHistory: HistorySaver<TState>, debouncedSaveToHistory: HistorySaver<TState>, canvasWidth: number, canvasHeight: number, fontColor?: string, chartColors?: readonly string[],
|
|
140
|
-
/** Startgröße neuer Elemente (`insertScaleFor`); 1 = Sharepic-Werte. */
|
|
142
|
+
/** Startgröße neuer Elemente außer Text (`insertScaleFor`); 1 = Sharepic-Werte. Text wächst selbst mit der Seitenbreite. */
|
|
141
143
|
insertScale?: number,
|
|
142
144
|
/**
|
|
143
145
|
* The pack of the page's document (`FullCanvasConfig.brand`): what new elements take their
|
|
144
146
|
* colours and fonts from. Last, and a `BrandPack`, so it cannot be bound to `chartColors`
|
|
145
147
|
* (a string list) or `insertScale` (a number). The active brand by default.
|
|
146
148
|
*/
|
|
147
|
-
brand?: BrandPack
|
|
149
|
+
brand?: BrandPack,
|
|
150
|
+
/** `createActions`' history argument (`createUserImageActions`). */
|
|
151
|
+
history?: CanvasActionHistory): {
|
|
148
152
|
addUserImage: (file: File, objectUrl: string) => void;
|
|
149
153
|
addUserImageFromUrl: (url: string, fileName: string, options?: UserImagePlacement) => void;
|
|
150
154
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { messages } from '../../i18n/catalogue.js';
|
|
3
3
|
import { activeBrand } from '../../brand/brandRegistry.js';
|
|
4
4
|
import { createAssetInstance, createStickerInstance } from '../../utils/canvasAssets.js';
|
|
@@ -237,39 +237,45 @@ brand = activeBrand()) {
|
|
|
237
237
|
// ============================================================================
|
|
238
238
|
// ADDITIONAL TEXT ACTIONS
|
|
239
239
|
// ============================================================================
|
|
240
|
+
/** The page width the text presets are set for; 80 % of it is a preset's width. */
|
|
241
|
+
const TEXT_PRESET_PAGE_WIDTH = 1080;
|
|
242
|
+
const TEXT_PRESET_WIDTH = TEXT_PRESET_PAGE_WIDTH * 0.8;
|
|
240
243
|
// Read per call, not at import: the brand packs are registered after the modules load.
|
|
241
244
|
// Every text is born bound to the brand font its family stands for, so a brand change takes it along.
|
|
242
245
|
function additionalTextDefaults(brand) {
|
|
243
246
|
const { fonts } = brand;
|
|
244
247
|
return {
|
|
245
248
|
header: {
|
|
246
|
-
fontSize:
|
|
249
|
+
fontSize: 120,
|
|
247
250
|
fontFamily: `${fonts.headline}, Arial, sans-serif`,
|
|
248
251
|
bind: { fontFamily: { ref: 'font.headline', value: fonts.headline } },
|
|
249
252
|
fontStyle: 'normal',
|
|
250
|
-
width:
|
|
253
|
+
width: TEXT_PRESET_WIDTH,
|
|
251
254
|
},
|
|
252
255
|
subheader: {
|
|
253
|
-
fontSize:
|
|
256
|
+
fontSize: 72,
|
|
254
257
|
fontFamily: `${fonts.headline}, Arial, sans-serif`,
|
|
255
258
|
bind: { fontFamily: { ref: 'font.headline', value: fonts.headline } },
|
|
256
259
|
fontStyle: 'normal',
|
|
257
|
-
width:
|
|
260
|
+
width: TEXT_PRESET_WIDTH,
|
|
258
261
|
},
|
|
259
262
|
body: {
|
|
260
|
-
fontSize:
|
|
263
|
+
fontSize: 56,
|
|
261
264
|
fontFamily: `${fonts.body}, Arial, sans-serif`,
|
|
262
265
|
bind: { fontFamily: { ref: 'font.body', value: fonts.body } },
|
|
263
|
-
width:
|
|
266
|
+
width: TEXT_PRESET_WIDTH,
|
|
264
267
|
},
|
|
265
268
|
};
|
|
266
269
|
}
|
|
267
270
|
/**
|
|
268
|
-
* Voreinstellung einer Textart, mit
|
|
269
|
-
* der
|
|
271
|
+
* Voreinstellung einer Textart, mit der Seitenbreite skaliert — auf jedem
|
|
272
|
+
* Format, nicht nur auf Folien (ein Text, der kleiner startet als die
|
|
273
|
+
* Überschriften der Vorlagen, wirkt wie nicht eingefügt); zentriert über der
|
|
274
|
+
* Seitenmitte. Bei 1080 px genau die Werte oben.
|
|
270
275
|
*/
|
|
271
|
-
function textPreset(type, canvasWidth,
|
|
276
|
+
function textPreset(type, canvasWidth, brand) {
|
|
272
277
|
const preset = additionalTextDefaults(brand)[type];
|
|
278
|
+
const s = canvasWidth / TEXT_PRESET_PAGE_WIDTH;
|
|
273
279
|
const width = preset.width * s;
|
|
274
280
|
return {
|
|
275
281
|
...preset,
|
|
@@ -278,7 +284,7 @@ function textPreset(type, canvasWidth, s, brand) {
|
|
|
278
284
|
x: canvasWidth / 2 - width / 2,
|
|
279
285
|
};
|
|
280
286
|
}
|
|
281
|
-
export function createAdditionalTextActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, fontColor = '#ffffff',
|
|
287
|
+
export function createAdditionalTextActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, fontColor = '#ffffff',
|
|
282
288
|
/** The pack of the page's document; the active brand by default. */
|
|
283
289
|
brand = activeBrand()) {
|
|
284
290
|
return {
|
|
@@ -288,7 +294,7 @@ brand = activeBrand()) {
|
|
|
288
294
|
text: messages().sidebar.text.defaultHeader,
|
|
289
295
|
type: 'header',
|
|
290
296
|
y: canvasHeight / 3,
|
|
291
|
-
...textPreset('header', canvasWidth,
|
|
297
|
+
...textPreset('header', canvasWidth, brand),
|
|
292
298
|
fill: fontColor,
|
|
293
299
|
};
|
|
294
300
|
setState((prev) => ({
|
|
@@ -303,7 +309,7 @@ brand = activeBrand()) {
|
|
|
303
309
|
text: messages().sidebar.text.defaultSubheader,
|
|
304
310
|
type: 'subheader',
|
|
305
311
|
y: canvasHeight * 0.4,
|
|
306
|
-
...textPreset('subheader', canvasWidth,
|
|
312
|
+
...textPreset('subheader', canvasWidth, brand),
|
|
307
313
|
fill: fontColor,
|
|
308
314
|
};
|
|
309
315
|
setState((prev) => ({
|
|
@@ -318,7 +324,7 @@ brand = activeBrand()) {
|
|
|
318
324
|
text: messages().sidebar.text.defaultBody,
|
|
319
325
|
type: 'body',
|
|
320
326
|
y: canvasHeight / 2,
|
|
321
|
-
...textPreset('body', canvasWidth,
|
|
327
|
+
...textPreset('body', canvasWidth, brand),
|
|
322
328
|
fill: fontColor,
|
|
323
329
|
};
|
|
324
330
|
setState((prev) => ({
|
|
@@ -337,7 +343,7 @@ brand = activeBrand()) {
|
|
|
337
343
|
text: content,
|
|
338
344
|
type: 'body',
|
|
339
345
|
y: canvasHeight / 2,
|
|
340
|
-
...textPreset('body', canvasWidth,
|
|
346
|
+
...textPreset('body', canvasWidth, brand),
|
|
341
347
|
fill: fontColor,
|
|
342
348
|
};
|
|
343
349
|
setState((prev) => ({
|
|
@@ -521,7 +527,9 @@ brand = activeBrand()) {
|
|
|
521
527
|
// ============================================================================
|
|
522
528
|
// USER IMAGE ACTIONS
|
|
523
529
|
// ============================================================================
|
|
524
|
-
export function createUserImageActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight
|
|
530
|
+
export function createUserImageActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight,
|
|
531
|
+
/** `createActions`' history argument; without it the URL swap is an undo step of its own. */
|
|
532
|
+
history) {
|
|
525
533
|
// `getState` is the render-time state (GenericCanvas), so `saveToHistory(getState())`
|
|
526
534
|
// after a setState snapshots the canvas WITHOUT the change: history records
|
|
527
535
|
// what `change` produces instead.
|
|
@@ -530,6 +538,9 @@ export function createUserImageActions(getState, setState, saveToHistory, deboun
|
|
|
530
538
|
saveToHistory(change(getState()));
|
|
531
539
|
};
|
|
532
540
|
const appendImage = (instance) => (s) => ({ ...s, userImageInstances: [...s.userImageInstances, instance] });
|
|
541
|
+
// The blob preview of each placed file, until its durable URL arrives: an undo during the upload
|
|
542
|
+
// takes the image off the canvas, but the redo entries still hold the preview.
|
|
543
|
+
const previews = new Map();
|
|
533
544
|
return {
|
|
534
545
|
addUserImage: (file, objectUrl) => {
|
|
535
546
|
void createUserImageInstance(file, objectUrl, canvasWidth, canvasHeight).then((instance) => {
|
|
@@ -551,25 +562,34 @@ export function createUserImageActions(getState, setState, saveToHistory, deboun
|
|
|
551
562
|
const objectUrl = URL.createObjectURL(file);
|
|
552
563
|
return createUserImageInstance(file, objectUrl, canvasWidth, canvasHeight).then((instance) => {
|
|
553
564
|
commit(appendImage(instance));
|
|
565
|
+
previews.set(instance.id, objectUrl);
|
|
554
566
|
return instance.id;
|
|
555
567
|
});
|
|
556
568
|
},
|
|
557
569
|
updateUserImage: (id, partial) => {
|
|
570
|
+
const images = getState().userImageInstances;
|
|
571
|
+
const prevSrc = images.find((u) => u.id === id)?.src;
|
|
572
|
+
// Off the canvas, the preview can only be swapped where it is: in the history.
|
|
573
|
+
const preview = prevSrc?.startsWith('blob:') ? prevSrc : history && previews.get(id);
|
|
574
|
+
const nextSrc = partial.src;
|
|
575
|
+
const blob = nextSrc && preview !== nextSrc ? preview : undefined;
|
|
576
|
+
if (blob)
|
|
577
|
+
previews.delete(id);
|
|
558
578
|
// Free the optimistic blob once it's swapped for a durable URL.
|
|
559
|
-
if (
|
|
560
|
-
|
|
561
|
-
const prevInstance = images.find((u) => u.id === id);
|
|
562
|
-
if (prevInstance?.src.startsWith('blob:') &&
|
|
563
|
-
prevInstance.src !== partial.src &&
|
|
564
|
-
isLastHolder(images, (u) => u.src, prevInstance.src)) {
|
|
565
|
-
URL.revokeObjectURL(prevInstance.src);
|
|
566
|
-
}
|
|
579
|
+
if (blob && isLastHolder(images, (u) => u.src, blob)) {
|
|
580
|
+
URL.revokeObjectURL(blob);
|
|
567
581
|
}
|
|
568
582
|
const change = (s) => ({
|
|
569
583
|
...s,
|
|
570
584
|
userImageInstances: s.userImageInstances.map((u) => u.id === id ? { ...u, ...partial } : u),
|
|
571
585
|
});
|
|
572
586
|
setState(change);
|
|
587
|
+
// An upload's durable URL replaces its preview everywhere, the history included: a step of
|
|
588
|
+
// its own would let undo bring back the revoked blob, and save it (#161).
|
|
589
|
+
if (blob && nextSrc && history && Object.keys(partial).length === 1) {
|
|
590
|
+
history.replaceInHistory(blob, nextSrc);
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
573
593
|
debouncedSaveToHistory(change(getState()));
|
|
574
594
|
},
|
|
575
595
|
/** The template background photo's "Bearbeiten" look; merges like `updateUserImage`. */
|
|
@@ -601,14 +621,16 @@ export function createUserImageActions(getState, setState, saveToHistory, deboun
|
|
|
601
621
|
// COMBINED BASE ACTIONS
|
|
602
622
|
// ============================================================================
|
|
603
623
|
export function createElementActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, fontColor, chartColors,
|
|
604
|
-
/** Startgröße neuer Elemente (`insertScaleFor`); 1 = Sharepic-Werte. */
|
|
624
|
+
/** Startgröße neuer Elemente außer Text (`insertScaleFor`); 1 = Sharepic-Werte. Text wächst selbst mit der Seitenbreite. */
|
|
605
625
|
insertScale = 1,
|
|
606
626
|
/**
|
|
607
627
|
* The pack of the page's document (`FullCanvasConfig.brand`): what new elements take their
|
|
608
628
|
* colours and fonts from. Last, and a `BrandPack`, so it cannot be bound to `chartColors`
|
|
609
629
|
* (a string list) or `insertScale` (a number). The active brand by default.
|
|
610
630
|
*/
|
|
611
|
-
brand = activeBrand()
|
|
631
|
+
brand = activeBrand(),
|
|
632
|
+
/** `createActions`' history argument (`createUserImageActions`). */
|
|
633
|
+
history) {
|
|
612
634
|
return {
|
|
613
635
|
...createAssetActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, insertScale),
|
|
614
636
|
...createIconActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight,
|
|
@@ -618,11 +640,11 @@ brand = activeBrand()) {
|
|
|
618
640
|
{ defaultColor: fontColor, defaultScale: insertScale }),
|
|
619
641
|
...createShapeActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, undefined, insertScale, brand),
|
|
620
642
|
...createIllustrationActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, brand),
|
|
621
|
-
...createAdditionalTextActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, fontColor,
|
|
643
|
+
...createAdditionalTextActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, fontColor, brand),
|
|
622
644
|
...createPillBadgeActions(getState, setState, saveToHistory, debouncedSaveToHistory, brand),
|
|
623
645
|
...createCircleBadgeActions(getState, setState, saveToHistory, debouncedSaveToHistory, brand),
|
|
624
646
|
...createChartActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, chartColors, insertScale, brand),
|
|
625
647
|
...createFrameActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, brand),
|
|
626
|
-
...createUserImageActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight),
|
|
648
|
+
...createUserImageActions(getState, setState, saveToHistory, debouncedSaveToHistory, canvasWidth, canvasHeight, history),
|
|
627
649
|
};
|
|
628
650
|
}
|
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
* it to another template. One module so every path (add, setPageConfig)
|
|
4
4
|
* shares the same contract.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* What a new page takes from the active one: its brand (scheme and brand
|
|
8
|
+
* bindings) and its background (photo, colour, composer planes). A host's
|
|
9
|
+
* blank page wants the brand without the background (#166).
|
|
10
|
+
*/
|
|
11
|
+
export interface PageInheritance {
|
|
12
|
+
brand: boolean;
|
|
13
|
+
background: boolean;
|
|
14
|
+
}
|
|
6
15
|
export declare function extractInheritablePageState(state: Record<string, unknown>,
|
|
7
16
|
/** The template the new page uses; decides what happens to composer planes. */
|
|
8
|
-
targetConfigId?: string): Record<string, unknown>;
|
|
17
|
+
targetConfigId?: string, parts?: PageInheritance): Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/**
|
|
3
3
|
* Which parts of a page's state carry over when adding a page or converting
|
|
4
4
|
* it to another template. One module so every path (add, setPageConfig)
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { COMPOSER_PLANE_IDS } from '../utils/shapes.js';
|
|
8
8
|
/** Templates that draw the composer's background planes as free shapes. */
|
|
9
9
|
const PLANE_TEMPLATES = ['freeform', 'freeform-at'];
|
|
10
|
-
/**
|
|
11
|
-
const
|
|
10
|
+
/** Background keys copied verbatim when present on the source page. */
|
|
11
|
+
const BACKGROUND_KEYS = [
|
|
12
12
|
'backgroundColor',
|
|
13
13
|
'imageOffset',
|
|
14
14
|
'imageScale',
|
|
@@ -16,9 +16,18 @@ const INHERITABLE_KEYS = [
|
|
|
16
16
|
'backgroundImageRotation',
|
|
17
17
|
'backgroundImageOpacity',
|
|
18
18
|
'imageAttribution',
|
|
19
|
+
'backgroundMode',
|
|
20
|
+
];
|
|
21
|
+
/** Every page field the background part carries, for filtering its bindings. */
|
|
22
|
+
const BACKGROUND_FIELDS = new Set([
|
|
23
|
+
...BACKGROUND_KEYS,
|
|
24
|
+
'currentImageSrc',
|
|
25
|
+
'imageSrc',
|
|
26
|
+
]);
|
|
27
|
+
/** Brand keys copied verbatim when present on the source page. */
|
|
28
|
+
const BRAND_KEYS = [
|
|
19
29
|
'colorScheme',
|
|
20
30
|
'colorSchemeId',
|
|
21
|
-
'backgroundMode',
|
|
22
31
|
// Brand bindings (F0): an added or converted page stays bound to its brand.
|
|
23
32
|
'bind',
|
|
24
33
|
'brandScheme',
|
|
@@ -26,10 +35,33 @@ const INHERITABLE_KEYS = [
|
|
|
26
35
|
// `templateRef` and `groups` (F0) are deliberately not inheritable: they
|
|
27
36
|
// describe one page's origin and its element groups, not a style to carry on.
|
|
28
37
|
];
|
|
38
|
+
const copyPresent = (state, keys, into) => {
|
|
39
|
+
for (const key of keys) {
|
|
40
|
+
if (state[key] !== undefined && state[key] !== null && state[key] !== '') {
|
|
41
|
+
into[key] = state[key];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
29
45
|
export function extractInheritablePageState(state,
|
|
30
46
|
/** The template the new page uses; decides what happens to composer planes. */
|
|
31
|
-
targetConfigId) {
|
|
47
|
+
targetConfigId, parts = { brand: true, background: true }) {
|
|
32
48
|
const inherited = {};
|
|
49
|
+
if (parts.brand)
|
|
50
|
+
copyPresent(state, BRAND_KEYS, inherited);
|
|
51
|
+
if (!parts.background) {
|
|
52
|
+
// The page takes none of the background fields, so it takes none of their
|
|
53
|
+
// bindings either: a binding of a value the page does not have would wait,
|
|
54
|
+
// under the inherited brand stamp, until the next brand change dropped it.
|
|
55
|
+
const bind = inherited.bind;
|
|
56
|
+
if (bind && typeof bind === 'object' && !Array.isArray(bind)) {
|
|
57
|
+
const kept = Object.fromEntries(Object.entries(bind).filter(([field]) => !BACKGROUND_FIELDS.has(field)));
|
|
58
|
+
if (Object.keys(kept).length > 0)
|
|
59
|
+
inherited.bind = kept;
|
|
60
|
+
else
|
|
61
|
+
delete inherited.bind;
|
|
62
|
+
}
|
|
63
|
+
return inherited;
|
|
64
|
+
}
|
|
33
65
|
// Image background source — templates read it under either key, so mirror
|
|
34
66
|
// whichever one is set into both.
|
|
35
67
|
const imageSrc = state.currentImageSrc || state.imageSrc;
|
|
@@ -37,11 +69,7 @@ targetConfigId) {
|
|
|
37
69
|
inherited.currentImageSrc = imageSrc;
|
|
38
70
|
inherited.imageSrc = imageSrc;
|
|
39
71
|
}
|
|
40
|
-
|
|
41
|
-
if (state[key] !== undefined && state[key] !== null && state[key] !== '') {
|
|
42
|
-
inherited[key] = state[key];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
72
|
+
copyPresent(state, BACKGROUND_KEYS, inherited);
|
|
45
73
|
// Cross-template rule: a source with an image background but no explicit
|
|
46
74
|
// mode (zitat, …) lands in mode-aware templates (freeform) as
|
|
47
75
|
// an image page, not the 'color' default.
|
package/dist/configs/types.d.ts
CHANGED
|
@@ -305,6 +305,14 @@ export interface BackgroundControls {
|
|
|
305
305
|
onScaleChange?: (scale: number) => void;
|
|
306
306
|
}
|
|
307
307
|
/** A design as the host's gallery describes it (`FullCanvasConfig.shareMetadata`). */
|
|
308
|
+
/** History operations an action may need besides saving (`createActions`' last argument). */
|
|
309
|
+
export interface CanvasActionHistory {
|
|
310
|
+
/**
|
|
311
|
+
* Replaces the string value `from` with `to` in every history entry, without a step of its own:
|
|
312
|
+
* an upload's `blob:` preview once its durable URL is known.
|
|
313
|
+
*/
|
|
314
|
+
replaceInHistory: (from: string, to: string) => void;
|
|
315
|
+
}
|
|
308
316
|
export interface ShareDescription {
|
|
309
317
|
content: Record<string, unknown>;
|
|
310
318
|
styling: Record<string, unknown>;
|
|
@@ -339,7 +347,7 @@ export interface FullCanvasConfig<TState = Record<string, unknown>, TActions = R
|
|
|
339
347
|
shareMetadata?: (state: TState) => ShareDescription;
|
|
340
348
|
/** Create action handlers. Both history savers snapshot the committed
|
|
341
349
|
* state after the action's update; their argument is ignored. */
|
|
342
|
-
createActions: (getState: () => TState, setState: (partial: Partial<TState> | ((prev: TState) => TState)) => void, saveToHistory: (state?: TState) => void, debouncedSaveToHistory: (state?: TState) => void, callbacks: Record<string, ((val: unknown) => void) | undefined
|
|
350
|
+
createActions: (getState: () => TState, setState: (partial: Partial<TState> | ((prev: TState) => TState)) => void, saveToHistory: (state?: TState) => void, debouncedSaveToHistory: (state?: TState) => void, callbacks: Record<string, ((val: unknown) => void) | undefined>, history?: CanvasActionHistory) => TActions;
|
|
343
351
|
/** The background's colour and photo controls for the context bar. */
|
|
344
352
|
background?: (state: TState, actions: TActions) => BackgroundControls;
|
|
345
353
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
import { BLANK_PAGE_ID } from './blankPage.js';
|
|
1
2
|
import { type GgraphicEditorProps } from './types.js';
|
|
2
|
-
|
|
3
|
-
export declare const BLANK_PAGE_ID = "ggraphic-blank";
|
|
3
|
+
export { BLANK_PAGE_ID };
|
|
4
4
|
export default function EmbeddedEditor({ brand, templates, document, onChange, services, locale, queryClient, title, exportApiRef, }: GgraphicEditorProps): import("react").JSX.Element;
|
|
@@ -9,8 +9,8 @@ import { registerMessages } from '../i18n/messages.js';
|
|
|
9
9
|
import { createPageConfig } from '../page/config.js';
|
|
10
10
|
import { slotBudgetFor } from '../page/slotBudgets.js';
|
|
11
11
|
import { defineTemplate, getTemplate, registerTemplates, } from '../templates/registry.js';
|
|
12
|
-
|
|
13
|
-
export
|
|
12
|
+
import { BLANK_PAGE_ID } from './blankPage.js';
|
|
13
|
+
export { BLANK_PAGE_ID };
|
|
14
14
|
const BLANK_PAGE = defineTemplate({
|
|
15
15
|
id: BLANK_PAGE_ID,
|
|
16
16
|
load: (formatId) => Promise.resolve(createPageConfig({ id: BLANK_PAGE_ID, formatId, seedFor: () => ({}) })),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// SPDX-License-Identifier:
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
3
3
|
/**
|
|
4
4
|
* The editor in one component. Importing it touches no browser global, so a server-rendered
|
|
5
5
|
* page can import it; the editor itself loads and renders only in the browser.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page config of an empty page. `GgraphicEditor` registers it next to the pack's templates; a
|
|
3
|
+
* host starts a blank design with `pages: [{ configId: BLANK_PAGE_ID, state: {} }]`. Its own module,
|
|
4
|
+
* free of imports, so the React-free host entry can carry it to a server component.
|
|
5
|
+
*/
|
|
6
|
+
export declare const BLANK_PAGE_ID = "ggraphic-blank";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The page config of an empty page. `GgraphicEditor` registers it next to the pack's templates; a
|
|
4
|
+
* host starts a blank design with `pages: [{ configId: BLANK_PAGE_ID, state: {} }]`. Its own module,
|
|
5
|
+
* free of imports, so the React-free host entry can carry it to a server component.
|
|
6
|
+
*/
|
|
7
|
+
export const BLANK_PAGE_ID = 'ggraphic-blank';
|
package/dist/embed/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** The embedding surface: one component, its props and the document it stores. */
|
|
2
|
+
export { BLANK_PAGE_ID } from './blankPage.js';
|
|
2
3
|
export { GgraphicEditor } from './GgraphicEditor.js';
|
|
3
4
|
export { loadTemplatePack } from './loadTemplatePack.js';
|
|
4
5
|
export { type GgraphicDocument, type GgraphicEditorProps } from './types.js';
|
package/dist/embed/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** The embedding surface: one component, its props and the document it stores. */
|
|
3
|
+
export { BLANK_PAGE_ID } from './blankPage.js';
|
|
3
4
|
export { GgraphicEditor } from './GgraphicEditor.js';
|
|
4
5
|
export { loadTemplatePack } from './loadTemplatePack.js';
|
|
5
6
|
export { templatePackFromJson } from '../page/templatePack.js';
|
package/dist/entries/ai.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** Canvas AI: applying operations, describing the canvas to a model, the illustration capability and the capability types. */
|
|
3
3
|
export { applyOperation, CANVAS_AI_GEOMETRY_FIELDS, } from '../ai/applyOperation.js';
|
|
4
4
|
export { aiLabelFormat, describeCanvasElements } from '../ai/describeCanvasElements.js';
|
package/dist/entries/brand.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** Brand packs: registering them, the active brand, the brand of the open document and the glow a registered ground is drawn with. */
|
|
3
3
|
export { activeBrand, registerBrandPacks, registeredBrands } from '../brand/brandRegistry.js';
|
|
4
4
|
export { useDocumentBrand, DocumentBrandContext } from '../brand/documentBrand.js';
|
package/dist/entries/canvas.js
CHANGED
package/dist/entries/collab.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** Collaboration over Yjs: canvas and pages bindings, selection awareness and the page-doc helpers. */
|
|
3
3
|
export { useYjsCanvasBinding } from '../collab/useYjsCanvasBinding.js';
|
|
4
4
|
export { useYjsPages } from '../collab/useYjsPages.js';
|
package/dist/entries/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Canvas configs for hosts with their own page logic: `FullCanvasConfig` and its element configs, the loader, the factories, feature injection, placeholders and the share section. */
|
|
2
|
-
export { type AdditionalText, type AnyCanvasConfig, type BackgroundElementConfig, type CanvasElementConfig, type FullCanvasConfig, type HeterogeneousPage, type ImageElementConfig, type LayoutResult, type RectElementConfig, type ShareDescription, type TextElementConfig, } from '../configs/types.js';
|
|
2
|
+
export { type AdditionalText, type AnyCanvasConfig, type BackgroundElementConfig, type CanvasActionHistory, type CanvasElementConfig, type FullCanvasConfig, type HeterogeneousPage, type ImageElementConfig, type LayoutResult, type RectElementConfig, type ShareDescription, type TextElementConfig, } from '../configs/types.js';
|
|
3
3
|
export { loadCanvasConfig, preloadCanvasTemplate } from '../configs/configLoader.js';
|
|
4
4
|
export { createAssetActions, createChartActions, createCircleBadgeActions, createElementActions, createFrameActions, createIconActions, createIllustrationActions, createPillBadgeActions, createShapeActions, createUserImageActions, } from '../configs/factory/actionFactories.js';
|
|
5
5
|
export { type BaseCanvasActions, type BaseCanvasState, type CanvasDimensions, type CanvasFeatures, type ColorBackgroundState, type IconState, type ImageBackgroundState, } from '../configs/factory/baseTypes.js';
|
package/dist/entries/elements.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** The element model the editor adds to core: instance factories and types for shapes, charts, badges, frames, user images, icons, illustrations and assets; duplicating; lifted blocks. */
|
|
3
3
|
export { BLOCK_COLLECTIONS, blockElementIds, boundsOf, placeBlock, translateBlock, } from '../blocks/liftedBlock.js';
|
|
4
4
|
export { ASSET_TARGET_SIZE, assetMatchesLocale, createAssetInstance, emojiCodeAssetId, getAssetById, registerAssetCatalog, resolveAssetInstanceSrc, } from '../utils/canvasAssets.js';
|
package/dist/entries/embed.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** The editor in one component: `<GgraphicEditor>`, its props and the document it stores. The package root is an alias of this entry. */
|
|
2
|
-
export { type CanvasEditorExportApi, GgraphicEditor, type GgraphicDocument, type GgraphicEditorProps, loadTemplatePack, templatePackFromJson, type TemplatePack, } from '../embed/index.js';
|
|
2
|
+
export { BLANK_PAGE_ID, type CanvasEditorExportApi, GgraphicEditor, type GgraphicDocument, type GgraphicEditorProps, loadTemplatePack, templatePackFromJson, type TemplatePack, } from '../embed/index.js';
|
package/dist/entries/embed.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
'use client';
|
|
3
3
|
// A client boundary: a React Server Component that imports this entry (or the package root, its
|
|
4
4
|
// alias) gets a client reference instead of evaluating the editor, whose modules call
|
|
5
5
|
// `createContext` at load time, which the server build of React does not have.
|
|
6
6
|
/** The editor in one component: `<GgraphicEditor>`, its props and the document it stores. The package root is an alias of this entry. */
|
|
7
|
-
export { GgraphicEditor, loadTemplatePack, templatePackFromJson, } from '../embed/index.js';
|
|
7
|
+
export { BLANK_PAGE_ID, GgraphicEditor, loadTemplatePack, templatePackFromJson, } from '../embed/index.js';
|
package/dist/entries/export.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** Export: PPTX (fonts, model, writer), print and slide PDFs, and zipped page images. */
|
|
3
3
|
export { pptxFamily, registerPptxFonts } from '../export/pptx/pptxFonts.js';
|
|
4
4
|
export { writePptx, PPTX_MIME_TYPE } from '../export/pptx/writePptx.js';
|
package/dist/entries/host.d.ts
CHANGED
|
@@ -19,8 +19,9 @@ export { type HostElementKinds } from '../utils/canvasItem.js';
|
|
|
19
19
|
export { type HostCanvasActions } from '../hooks/useCanvasElementHandlers.js';
|
|
20
20
|
export { type CanvasAiHostTypes } from '../ai/types.js';
|
|
21
21
|
export { assetMatchesLocale, type AssetAudience, type CanvasAssetCatalog, emojiCodeAssetId, getAssetById, type IllustrationSources, registerAssetCatalog, type UniversalAsset, } from '../utils/canvasAssets.js';
|
|
22
|
-
export { type CanvasFormat, CANVAS_FORMAT_GROUP_ORDER, type CanvasFormatGroupDef, canvasFormats, getCanvasFormat, getCanvasFormatOrDefault, registerCanvasFormatGroups, registerCanvasFormats, } from '../formats/index.js';
|
|
22
|
+
export { type CanvasFormat, CANVAS_FORMAT_GROUP_ORDER, type CanvasFormatGroupDef, canvasFormats, formatDescription, formatLabel, getCanvasFormat, getCanvasFormatOrDefault, registerCanvasFormatGroups, registerCanvasFormats, } from '../formats/index.js';
|
|
23
23
|
export { defineTemplate, registerTemplates, type TemplateDefinition, type TemplateId, type TemplatePickerInfo, } from '../templates/registry.js';
|
|
24
|
+
export { BLANK_PAGE_ID } from '../embed/blankPage.js';
|
|
24
25
|
export { registerBrandPacks } from '../brand/brandRegistry.js';
|
|
25
26
|
export { registerHostMessages, registerMessages } from '../i18n/catalogue.js';
|
|
26
27
|
export { type HostMessages } from '../i18n/messages.js';
|
package/dist/entries/host.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { registerElementKind } from '../utils/elementKinds.js';
|
|
2
2
|
export { assetMatchesLocale, emojiCodeAssetId, getAssetById, registerAssetCatalog, } from '../utils/canvasAssets.js';
|
|
3
|
-
export { CANVAS_FORMAT_GROUP_ORDER, canvasFormats, getCanvasFormat, getCanvasFormatOrDefault, registerCanvasFormatGroups, registerCanvasFormats, } from '../formats/index.js';
|
|
3
|
+
export { CANVAS_FORMAT_GROUP_ORDER, canvasFormats, formatDescription, formatLabel, getCanvasFormat, getCanvasFormatOrDefault, registerCanvasFormatGroups, registerCanvasFormats, } from '../formats/index.js';
|
|
4
4
|
export { defineTemplate, registerTemplates, } from '../templates/registry.js';
|
|
5
|
+
export { BLANK_PAGE_ID } from '../embed/blankPage.js';
|
|
5
6
|
export { registerBrandPacks } from '../brand/brandRegistry.js';
|
|
6
7
|
export { registerHostMessages, registerMessages } from '../i18n/catalogue.js';
|
|
7
8
|
export { registerToast, } from '../utils/editorToast.js';
|
package/dist/entries/i18n.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/** UI texts: the catalogue, registering a locale or host texts, and the hook. */
|
|
3
3
|
export { messages, registerHostMessages, registerMessages, useMessages, messageLocale, } from '../i18n/messages.js';
|