@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
package/dist/utils/imageLook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { BW_LOOK, duotoneLook, withoutDuotone } from './imageFilters.js';
|
|
3
3
|
/** The four looks of the top-bar control; each is derived from stored fields, none is stored. */
|
|
4
4
|
export const IMAGE_LOOK_IDS = ['none', 'bw', 'duotone', 'darken'];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { framedPhotoRect, panOfFramedPhoto, clampPan, panWindowPhoto, windowInPhoto, zoomWindow, } from './coverFit.js';
|
|
3
3
|
import { isWidgetOwnedKey } from './keyboardOwnership.js';
|
|
4
4
|
import { minStraightenZoom, panOfStraightPhoto, panStraightPhoto, straightFramedPhoto, windowPhotoOfStraight, zoomStraightPhoto, } from './straighten.js';
|
package/dist/utils/layerLock.js
CHANGED
package/dist/utils/mediaDrop.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { hostElementKind } from './elementKinds.js';
|
|
3
3
|
/** Drag type of an upload or photo tile; the payload is `MediaDragPayload` as JSON. */
|
|
4
4
|
export const MEDIA_DRAG_TYPE = 'application/x-ggraphic-media';
|
package/dist/utils/motifSizes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import Konva from 'konva';
|
|
3
3
|
import { CANVAS_ITEM_ID_ATTR, CANVAS_ITEM_NAME } from './deepSelect.js';
|
|
4
4
|
/** Name des gemeinsamen Transformers, der bei Mehrfachauswahl alle Elemente umfasst. */
|
package/dist/utils/notch.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { findKindItem, hostElementKind, isCoreElementKind, kindAction, } from './elementKinds.js';
|
|
3
3
|
import { isLayerLocked } from './layerLock.js';
|
|
4
4
|
import { isTemplateElementRotatable, templatePositionUpdates, templateRotationOf, withTemplateRotation, } from './templateRotation.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/**
|
|
3
3
|
* A text with `counter: 'page'` shows the number of the page it sits on instead of its own
|
|
4
4
|
* text (the "ghost numeral" of a carousel). The stored text is only what is drawn where no page
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ids of the image elements on one canvas whose source is still loading
|
|
2
|
+
* Ids of the image elements on one canvas whose source is still loading
|
|
3
|
+
* (`pending`) or failed to load (`failed`).
|
|
3
4
|
*
|
|
4
5
|
* An image element draws nothing until its bitmap arrives, so a capture taken
|
|
5
6
|
* meanwhile is a complete-looking picture minus the photo. The offscreen chat
|
|
6
|
-
* preview asks `GenericCanvasRef.imagesSettled()` before capturing
|
|
7
|
-
*
|
|
7
|
+
* preview asks `GenericCanvasRef.imagesSettled()` before capturing, and
|
|
8
|
+
* `imageLoadState()` afterwards to tell a complete capture from one that is
|
|
9
|
+
* missing an image; nothing else in the canvas needs to know.
|
|
8
10
|
*/
|
|
9
|
-
export
|
|
11
|
+
export interface ImageLoads {
|
|
12
|
+
pending: Set<string>;
|
|
13
|
+
failed: Set<string>;
|
|
14
|
+
}
|
|
15
|
+
export declare const PendingImagesContext: import("react").Context<ImageLoads | null>;
|
|
16
|
+
/**
|
|
17
|
+
* How often each element's load was retried (`GenericCanvasRef.retryFailedImages`).
|
|
18
|
+
* A loader starts a fresh load when its number moves on: `use-image` loads
|
|
19
|
+
* again only for a new url, so a re-render alone leaves a failed image failed.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ImageRetryContext: import("react").Context<ReadonlyMap<string, number>>;
|
|
22
|
+
export declare function useImageRetry(id: string): number;
|
|
10
23
|
export declare function useTrackPendingImage(id: string, url: string, status: 'loading' | 'loaded' | 'failed'): void;
|
|
@@ -1,25 +1,29 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { createContext, useContext, useEffect } from 'react';
|
|
3
|
+
export const PendingImagesContext = createContext(null);
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* meanwhile is a complete-looking picture minus the photo. The offscreen chat
|
|
8
|
-
* preview asks `GenericCanvasRef.imagesSettled()` before capturing; nothing
|
|
9
|
-
* else in the canvas needs to know.
|
|
5
|
+
* How often each element's load was retried (`GenericCanvasRef.retryFailedImages`).
|
|
6
|
+
* A loader starts a fresh load when its number moves on: `use-image` loads
|
|
7
|
+
* again only for a new url, so a re-render alone leaves a failed image failed.
|
|
10
8
|
*/
|
|
11
|
-
export const
|
|
9
|
+
export const ImageRetryContext = createContext(new Map());
|
|
10
|
+
export function useImageRetry(id) {
|
|
11
|
+
return useContext(ImageRetryContext).get(id) ?? 0;
|
|
12
|
+
}
|
|
12
13
|
export function useTrackPendingImage(id, url, status) {
|
|
13
|
-
const
|
|
14
|
+
const loads = useContext(PendingImagesContext);
|
|
14
15
|
// `use-image` reports 'loading' forever for an empty url — an element with
|
|
15
16
|
// no source has nothing to wait for.
|
|
16
|
-
const
|
|
17
|
+
const state = url === '' || status === 'loaded' ? null : status;
|
|
17
18
|
useEffect(() => {
|
|
18
|
-
if (!
|
|
19
|
+
if (!loads || !state)
|
|
19
20
|
return undefined;
|
|
20
|
-
pending.add(id);
|
|
21
|
+
(state === 'loading' ? loads.pending : loads.failed).add(id);
|
|
21
22
|
return () => {
|
|
22
|
-
pending
|
|
23
|
+
// Both sets: a retry moves a failed id to `pending` before the element
|
|
24
|
+
// re-renders, and an element removed meanwhile must not stay pending.
|
|
25
|
+
loads.pending.delete(id);
|
|
26
|
+
loads.failed.delete(id);
|
|
23
27
|
};
|
|
24
|
-
}, [
|
|
28
|
+
}, [loads, id, state]);
|
|
25
29
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
import { mixColors, resolveScheme, SCHEME_IDS, } from '@ggraphic/core';
|
|
3
3
|
import { activeBrand } from '../brand/brandRegistry.js';
|
|
4
4
|
/** Share of the ink mixed into the ground for the placeholder fill. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
/**
|
|
3
3
|
* The line breaking of Konva's `Text` (wrap `word`, fixed width, no ellipsis), with the glyph
|
|
4
4
|
* measure injected. It is a port of `Text._setTextData`, so the render gate can count the lines
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes another client's edit into the history snapshots, as if it had always
|
|
3
|
+
* been there (#160). Undo restores whole snapshots; a snapshot taken before
|
|
4
|
+
* the edit would otherwise write the old value back over it, and one taken
|
|
5
|
+
* after would count the edit as this client's own step.
|
|
6
|
+
*
|
|
7
|
+
* Only what the remote edit changed (`prev` → `next`) is touched, and as
|
|
8
|
+
* finely as the state allows: element collections (arrays of objects with an
|
|
9
|
+
* `id`) per element and property, id lists (`layerOrder`, `lockedLayerIds`)
|
|
10
|
+
* per id with their order, records per key, everything else as a whole value.
|
|
11
|
+
* So an own step on another element of the same collection — or on another
|
|
12
|
+
* property of the same element — stays undoable.
|
|
13
|
+
*
|
|
14
|
+
* Where the two meet, this client's own step decides: an element (or id) the
|
|
15
|
+
* snapshot lacks although `prev` has it came with a later own step, so the
|
|
16
|
+
* remote edit does not bring it back — undo of an add removes the element even
|
|
17
|
+
* after someone else touched it. A remote removal still applies.
|
|
18
|
+
*
|
|
19
|
+
* The change is planned once per remote edit (`planHistoryRebase`) and applied
|
|
20
|
+
* per snapshot (`applyHistoryRebase`), which returns the snapshot itself when
|
|
21
|
+
* the change does not reach it.
|
|
22
|
+
*/
|
|
23
|
+
type WithId = {
|
|
24
|
+
id: string;
|
|
25
|
+
};
|
|
26
|
+
type Rec = Record<string, unknown>;
|
|
27
|
+
/** A key changed from `prev` to `next`; `present: false` means deleted. */
|
|
28
|
+
interface FieldChange {
|
|
29
|
+
key: string;
|
|
30
|
+
present: boolean;
|
|
31
|
+
value: unknown;
|
|
32
|
+
}
|
|
33
|
+
interface CollectionPlan {
|
|
34
|
+
key: string;
|
|
35
|
+
kind: 'collection';
|
|
36
|
+
removed: Set<string>;
|
|
37
|
+
changed: Map<string, FieldChange[]>;
|
|
38
|
+
added: {
|
|
39
|
+
item: WithId;
|
|
40
|
+
index: number;
|
|
41
|
+
}[];
|
|
42
|
+
}
|
|
43
|
+
interface IdsPlan {
|
|
44
|
+
key: string;
|
|
45
|
+
kind: 'ids';
|
|
46
|
+
removed: Set<string>;
|
|
47
|
+
moved: Set<string>;
|
|
48
|
+
/** Inserted and moved ids in `next` order, each with the ids after it in `next`. */
|
|
49
|
+
placed: {
|
|
50
|
+
id: string;
|
|
51
|
+
following: string[];
|
|
52
|
+
}[];
|
|
53
|
+
}
|
|
54
|
+
type KeyPlan = {
|
|
55
|
+
key: string;
|
|
56
|
+
kind: 'delete';
|
|
57
|
+
} | {
|
|
58
|
+
key: string;
|
|
59
|
+
kind: 'value';
|
|
60
|
+
next: unknown;
|
|
61
|
+
} | {
|
|
62
|
+
key: string;
|
|
63
|
+
kind: 'record';
|
|
64
|
+
changes: FieldChange[];
|
|
65
|
+
} | CollectionPlan | IdsPlan;
|
|
66
|
+
export type HistoryRebase = KeyPlan[];
|
|
67
|
+
/** The remote edit from `prev` to `next`, ready to apply to any number of snapshots. */
|
|
68
|
+
export declare function planHistoryRebase(prev: Rec, next: Rec): HistoryRebase;
|
|
69
|
+
/** `entry` with the planned change applied; `entry` itself when the change does not reach it. */
|
|
70
|
+
export declare function applyHistoryRebase(entry: Rec, plan: HistoryRebase): Rec;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* Writes another client's edit into the history snapshots, as if it had always
|
|
4
|
+
* been there (#160). Undo restores whole snapshots; a snapshot taken before
|
|
5
|
+
* the edit would otherwise write the old value back over it, and one taken
|
|
6
|
+
* after would count the edit as this client's own step.
|
|
7
|
+
*
|
|
8
|
+
* Only what the remote edit changed (`prev` → `next`) is touched, and as
|
|
9
|
+
* finely as the state allows: element collections (arrays of objects with an
|
|
10
|
+
* `id`) per element and property, id lists (`layerOrder`, `lockedLayerIds`)
|
|
11
|
+
* per id with their order, records per key, everything else as a whole value.
|
|
12
|
+
* So an own step on another element of the same collection — or on another
|
|
13
|
+
* property of the same element — stays undoable.
|
|
14
|
+
*
|
|
15
|
+
* Where the two meet, this client's own step decides: an element (or id) the
|
|
16
|
+
* snapshot lacks although `prev` has it came with a later own step, so the
|
|
17
|
+
* remote edit does not bring it back — undo of an add removes the element even
|
|
18
|
+
* after someone else touched it. A remote removal still applies.
|
|
19
|
+
*
|
|
20
|
+
* The change is planned once per remote edit (`planHistoryRebase`) and applied
|
|
21
|
+
* per snapshot (`applyHistoryRebase`), which returns the snapshot itself when
|
|
22
|
+
* the change does not reach it.
|
|
23
|
+
*/
|
|
24
|
+
const jsonEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
25
|
+
const hasId = (value) => typeof value === 'object' && value !== null && typeof value.id === 'string';
|
|
26
|
+
const isPlainRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
27
|
+
const isCollection = (value) => Array.isArray(value) && value.every(hasId);
|
|
28
|
+
/** Distinct strings whose order may matter (`layerOrder`, `lockedLayerIds`). */
|
|
29
|
+
const isIdList = (value) => Array.isArray(value) &&
|
|
30
|
+
value.every((id) => typeof id === 'string') &&
|
|
31
|
+
new Set(value).size === value.length;
|
|
32
|
+
function fieldChanges(prev, next) {
|
|
33
|
+
const changes = [];
|
|
34
|
+
for (const key of new Set([...Object.keys(prev), ...Object.keys(next)])) {
|
|
35
|
+
if (jsonEqual(prev[key], next[key]))
|
|
36
|
+
continue;
|
|
37
|
+
changes.push({ key, present: Object.hasOwn(next, key), value: next[key] });
|
|
38
|
+
}
|
|
39
|
+
return changes;
|
|
40
|
+
}
|
|
41
|
+
function applyFields(entry, changes) {
|
|
42
|
+
let result = null;
|
|
43
|
+
for (const { key, present, value } of changes) {
|
|
44
|
+
if (present ? jsonEqual(entry[key], value) : !Object.hasOwn(entry, key))
|
|
45
|
+
continue;
|
|
46
|
+
result ??= { ...entry };
|
|
47
|
+
if (present)
|
|
48
|
+
result[key] = value;
|
|
49
|
+
else
|
|
50
|
+
delete result[key];
|
|
51
|
+
}
|
|
52
|
+
return result ?? entry;
|
|
53
|
+
}
|
|
54
|
+
function planCollection(key, prev, next) {
|
|
55
|
+
const before = new Map(prev.map((item) => [item.id, item]));
|
|
56
|
+
const after = new Set(next.map((item) => item.id));
|
|
57
|
+
const changed = new Map();
|
|
58
|
+
const added = [];
|
|
59
|
+
next.forEach((item, index) => {
|
|
60
|
+
const old = before.get(item.id);
|
|
61
|
+
if (!old)
|
|
62
|
+
added.push({ item, index });
|
|
63
|
+
else if (!jsonEqual(old, item))
|
|
64
|
+
changed.set(item.id, fieldChanges(old, item));
|
|
65
|
+
});
|
|
66
|
+
const removed = new Set(prev.filter((item) => !after.has(item.id)).map((item) => item.id));
|
|
67
|
+
return { key, kind: 'collection', removed, changed, added };
|
|
68
|
+
}
|
|
69
|
+
/** Positions (into `seq`) of one longest increasing subsequence. */
|
|
70
|
+
function longestIncreasing(seq) {
|
|
71
|
+
const tails = [];
|
|
72
|
+
const parent = [];
|
|
73
|
+
seq.forEach((value, i) => {
|
|
74
|
+
let lo = 0;
|
|
75
|
+
let hi = tails.length;
|
|
76
|
+
while (lo < hi) {
|
|
77
|
+
const mid = (lo + hi) >> 1;
|
|
78
|
+
if (seq[tails[mid]] < value)
|
|
79
|
+
lo = mid + 1;
|
|
80
|
+
else
|
|
81
|
+
hi = mid;
|
|
82
|
+
}
|
|
83
|
+
parent[i] = lo > 0 ? tails[lo - 1] : -1;
|
|
84
|
+
tails[lo] = i;
|
|
85
|
+
});
|
|
86
|
+
const kept = new Set();
|
|
87
|
+
for (let i = tails.length > 0 ? tails[tails.length - 1] : -1; i >= 0; i = parent[i])
|
|
88
|
+
kept.add(i);
|
|
89
|
+
return kept;
|
|
90
|
+
}
|
|
91
|
+
function planIds(key, prev, next) {
|
|
92
|
+
const inNext = new Map(next.map((id, i) => [id, i]));
|
|
93
|
+
const inPrev = new Set(prev);
|
|
94
|
+
const removed = new Set(prev.filter((id) => !inNext.has(id)));
|
|
95
|
+
// Of the ids both sides keep, those off one longest common order are the ones the remote moved.
|
|
96
|
+
const common = prev.filter((id) => inNext.has(id));
|
|
97
|
+
const stay = longestIncreasing(common.map((id) => inNext.get(id)));
|
|
98
|
+
const moved = new Set(common.filter((_, i) => !stay.has(i)));
|
|
99
|
+
const placed = next.flatMap((id, i) => !inPrev.has(id) || moved.has(id) ? [{ id, following: next.slice(i + 1) }] : []);
|
|
100
|
+
return { key, kind: 'ids', removed, moved, placed };
|
|
101
|
+
}
|
|
102
|
+
/** The remote edit from `prev` to `next`, ready to apply to any number of snapshots. */
|
|
103
|
+
export function planHistoryRebase(prev, next) {
|
|
104
|
+
const plan = [];
|
|
105
|
+
for (const key of new Set([...Object.keys(prev), ...Object.keys(next)])) {
|
|
106
|
+
const before = prev[key];
|
|
107
|
+
const after = next[key];
|
|
108
|
+
if (jsonEqual(before, after))
|
|
109
|
+
continue;
|
|
110
|
+
if (!Object.hasOwn(next, key))
|
|
111
|
+
plan.push({ key, kind: 'delete' });
|
|
112
|
+
else if (isCollection(after) && (before === undefined || isCollection(before)))
|
|
113
|
+
plan.push(planCollection(key, before ?? [], after));
|
|
114
|
+
else if (isIdList(after) && (before === undefined || isIdList(before)))
|
|
115
|
+
plan.push(planIds(key, before ?? [], after));
|
|
116
|
+
else if (isPlainRecord(before) && isPlainRecord(after))
|
|
117
|
+
plan.push({ key, kind: 'record', changes: fieldChanges(before, after) });
|
|
118
|
+
else
|
|
119
|
+
plan.push({ key, kind: 'value', next: after });
|
|
120
|
+
}
|
|
121
|
+
return plan;
|
|
122
|
+
}
|
|
123
|
+
function applyCollection(entry, plan) {
|
|
124
|
+
let changed = false;
|
|
125
|
+
const result = [];
|
|
126
|
+
const at = new Map();
|
|
127
|
+
for (const item of entry) {
|
|
128
|
+
if (plan.removed.has(item.id)) {
|
|
129
|
+
changed = true;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
const fields = plan.changed.get(item.id);
|
|
133
|
+
const patched = fields ? applyFields(item, fields) : item;
|
|
134
|
+
if (patched !== item)
|
|
135
|
+
changed = true;
|
|
136
|
+
at.set(item.id, result.length);
|
|
137
|
+
result.push(patched);
|
|
138
|
+
}
|
|
139
|
+
// Changes to an element this snapshot lacks are skipped above: a later own step added it.
|
|
140
|
+
for (const { item, index } of plan.added) {
|
|
141
|
+
const own = at.get(item.id);
|
|
142
|
+
if (own === undefined) {
|
|
143
|
+
result.splice(Math.min(index, result.length), 0, item);
|
|
144
|
+
changed = true;
|
|
145
|
+
}
|
|
146
|
+
else if (!jsonEqual(result[own], item)) {
|
|
147
|
+
result[own] = item;
|
|
148
|
+
changed = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return changed ? result : entry;
|
|
152
|
+
}
|
|
153
|
+
function applyIds(entry, plan) {
|
|
154
|
+
const had = new Set(entry);
|
|
155
|
+
const result = entry.filter((id) => !plan.removed.has(id) && !plan.moved.has(id));
|
|
156
|
+
for (const { id, following } of plan.placed) {
|
|
157
|
+
// A moved id this snapshot lacks came with a later own step.
|
|
158
|
+
if (plan.moved.has(id) ? !had.has(id) : result.includes(id))
|
|
159
|
+
continue;
|
|
160
|
+
const anchor = following.find((other) => result.includes(other));
|
|
161
|
+
result.splice(anchor === undefined ? result.length : result.indexOf(anchor), 0, id);
|
|
162
|
+
}
|
|
163
|
+
return result.length === entry.length && result.every((id, i) => id === entry[i])
|
|
164
|
+
? entry
|
|
165
|
+
: result;
|
|
166
|
+
}
|
|
167
|
+
function applyKey(value, plan) {
|
|
168
|
+
switch (plan.kind) {
|
|
169
|
+
case 'value':
|
|
170
|
+
return jsonEqual(value, plan.next) ? value : plan.next;
|
|
171
|
+
case 'record':
|
|
172
|
+
return applyFields(isPlainRecord(value) ? value : {}, plan.changes);
|
|
173
|
+
case 'collection':
|
|
174
|
+
return isCollection(value) ? applyCollection(value, plan) : value;
|
|
175
|
+
case 'ids':
|
|
176
|
+
return isIdList(value) ? applyIds(value, plan) : value;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
/** `entry` with the planned change applied; `entry` itself when the change does not reach it. */
|
|
180
|
+
export function applyHistoryRebase(entry, plan) {
|
|
181
|
+
let result = null;
|
|
182
|
+
for (const keyPlan of plan) {
|
|
183
|
+
const { key } = keyPlan;
|
|
184
|
+
if (keyPlan.kind === 'delete') {
|
|
185
|
+
if (!Object.hasOwn(entry, key))
|
|
186
|
+
continue;
|
|
187
|
+
result ??= { ...entry };
|
|
188
|
+
delete result[key];
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
const current = entry[key];
|
|
192
|
+
let next;
|
|
193
|
+
if (current === undefined && (keyPlan.kind === 'collection' || keyPlan.kind === 'ids')) {
|
|
194
|
+
// A list the snapshot lacks: only what the remote edit itself added goes in.
|
|
195
|
+
next = applyKey([], keyPlan);
|
|
196
|
+
if (next.length === 0)
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
next = applyKey(current, keyPlan);
|
|
201
|
+
}
|
|
202
|
+
if (next === current)
|
|
203
|
+
continue;
|
|
204
|
+
result ??= { ...entry };
|
|
205
|
+
result[key] = next;
|
|
206
|
+
}
|
|
207
|
+
return result ?? entry;
|
|
208
|
+
}
|
package/dist/utils/shade.js
CHANGED
package/dist/utils/smartCrop.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
2
|
// „Automatisch": smartcrop schlägt den interessantesten Ausschnitt vor; hier wird er zu Pan/Zoom.
|
|
3
3
|
// Ausschnitt und Zoom: immer der kleinste erlaubte Zoom, ungedreht, auf Deckung.
|
|
4
4
|
import { photoRectAround } from './coverFit.js';
|
package/dist/utils/snapping.js
CHANGED