polotno 3.0.0-beta.38 → 3.0.0-beta.40
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/blueprint/blueprint-guard.d.ts +2 -0
- package/blueprint/blueprint-guard.js +1 -0
- package/blueprint/canvas/context-menu/context-menu.d.ts +16 -0
- package/blueprint/canvas/context-menu/context-menu.js +1 -0
- package/blueprint/canvas/page-controls.d.ts +11 -0
- package/blueprint/canvas/page-controls.js +1 -0
- package/blueprint/canvas/tooltip.d.ts +16 -0
- package/blueprint/canvas/tooltip.js +1 -0
- package/blueprint/pages-timeline/audio-track.d.ts +12 -0
- package/blueprint/pages-timeline/audio-track.js +1 -0
- package/blueprint/pages-timeline/audios.d.ts +8 -0
- package/blueprint/pages-timeline/audios.js +1 -0
- package/blueprint/pages-timeline/current-time.d.ts +13 -0
- package/blueprint/pages-timeline/current-time.js +1 -0
- package/blueprint/pages-timeline/element-track.d.ts +13 -0
- package/blueprint/pages-timeline/element-track.js +1 -0
- package/blueprint/pages-timeline/elements.d.ts +10 -0
- package/blueprint/pages-timeline/elements.js +1 -0
- package/blueprint/pages-timeline/index.d.ts +1 -0
- package/blueprint/pages-timeline/index.js +1 -0
- package/blueprint/pages-timeline/page-preview.d.ts +12 -0
- package/blueprint/pages-timeline/page-preview.js +23 -0
- package/blueprint/pages-timeline/pages-timeline.d.ts +8 -0
- package/blueprint/pages-timeline/pages-timeline.js +38 -0
- package/blueprint/pages-timeline/pages.d.ts +7 -0
- package/blueprint/pages-timeline/pages.js +1 -0
- package/blueprint/pages-timeline/play-button.d.ts +10 -0
- package/blueprint/pages-timeline/play-button.js +24 -0
- package/blueprint/pages-timeline/spinner.d.ts +1 -0
- package/blueprint/pages-timeline/spinner.js +14 -0
- package/blueprint/pages-timeline/time-ruler.d.ts +8 -0
- package/blueprint/pages-timeline/time-ruler.js +13 -0
- package/blueprint/pages-timeline/track-styles.d.ts +7 -0
- package/blueprint/pages-timeline/track-styles.js +79 -0
- package/blueprint/pages-timeline/waveform.d.ts +14 -0
- package/blueprint/pages-timeline/waveform.js +1 -0
- package/blueprint/side-panel/ai-images-panel.d.ts +6 -0
- package/blueprint/side-panel/ai-images-panel.js +1 -0
- package/blueprint/side-panel/animations-panel.d.ts +11 -0
- package/blueprint/side-panel/animations-panel.js +8 -0
- package/blueprint/side-panel/background-panel.d.ts +8 -0
- package/blueprint/side-panel/background-panel.js +8 -0
- package/blueprint/side-panel/draw-panel.d.ts +6 -0
- package/blueprint/side-panel/draw-panel.js +19 -0
- package/blueprint/side-panel/effect-card.d.ts +11 -0
- package/blueprint/side-panel/effect-card.js +42 -0
- package/blueprint/side-panel/effects-panel.d.ts +11 -0
- package/blueprint/side-panel/effects-panel.js +1 -0
- package/blueprint/side-panel/elements-panel.d.ts +12 -0
- package/blueprint/side-panel/elements-panel.js +85 -0
- package/blueprint/side-panel/image-clip-panel.d.ts +6 -0
- package/blueprint/side-panel/image-clip-panel.js +3 -0
- package/blueprint/side-panel/images-grid.d.ts +22 -0
- package/blueprint/side-panel/images-grid.js +50 -0
- package/blueprint/side-panel/index.d.ts +2 -0
- package/blueprint/side-panel/index.js +2 -0
- package/blueprint/side-panel/layers-panel.d.ts +6 -0
- package/blueprint/side-panel/layers-panel.js +1 -0
- package/blueprint/side-panel/pages-panel.d.ts +6 -0
- package/blueprint/side-panel/pages-panel.js +1 -0
- package/blueprint/side-panel/photos-panel.d.ts +4 -0
- package/blueprint/side-panel/photos-panel.js +1 -0
- package/blueprint/side-panel/select-gif.d.ts +13 -0
- package/blueprint/side-panel/select-gif.js +1 -0
- package/blueprint/side-panel/select-image.d.ts +13 -0
- package/blueprint/side-panel/select-image.js +1 -0
- package/blueprint/side-panel/select-svg.d.ts +13 -0
- package/blueprint/side-panel/select-svg.js +1 -0
- package/blueprint/side-panel/select-video.d.ts +358 -0
- package/blueprint/side-panel/select-video.js +1 -0
- package/blueprint/side-panel/side-panel.d.ts +39 -0
- package/blueprint/side-panel/side-panel.js +94 -0
- package/blueprint/side-panel/size-panel.d.ts +12 -0
- package/blueprint/side-panel/size-panel.js +1 -0
- package/blueprint/side-panel/tab-button.d.ts +9 -0
- package/blueprint/side-panel/tab-button.js +23 -0
- package/blueprint/side-panel/templates-panel.d.ts +6 -0
- package/blueprint/side-panel/templates-panel.js +1 -0
- package/blueprint/side-panel/text-panel.d.ts +9 -0
- package/blueprint/side-panel/text-panel.js +24 -0
- package/blueprint/side-panel/upload-panel.d.ts +5 -0
- package/blueprint/side-panel/upload-panel.js +1 -0
- package/blueprint/side-panel/videos-grid.d.ts +8 -0
- package/blueprint/side-panel/videos-grid.js +56 -0
- package/blueprint/side-panel/videos-panel.d.ts +6 -0
- package/blueprint/side-panel/videos-panel.js +1 -0
- package/blueprint/toolbar/admin-button.d.ts +6 -0
- package/blueprint/toolbar/admin-button.js +1 -0
- package/blueprint/toolbar/animations-picker.d.ts +21 -0
- package/blueprint/toolbar/animations-picker.js +1 -0
- package/blueprint/toolbar/color-picker.d.ts +20 -0
- package/blueprint/toolbar/color-picker.js +19 -0
- package/blueprint/toolbar/copy-style.d.ts +7 -0
- package/blueprint/toolbar/copy-style.js +1 -0
- package/blueprint/toolbar/download-button.d.ts +7 -0
- package/blueprint/toolbar/download-button.js +1 -0
- package/blueprint/toolbar/duplicate-button.d.ts +6 -0
- package/blueprint/toolbar/duplicate-button.js +1 -0
- package/blueprint/toolbar/element-container.d.ts +9 -0
- package/blueprint/toolbar/element-container.js +3 -0
- package/blueprint/toolbar/figure-toolbar.d.ts +24 -0
- package/blueprint/toolbar/figure-toolbar.js +1 -0
- package/blueprint/toolbar/filters-picker.d.ts +27 -0
- package/blueprint/toolbar/filters-picker.js +1 -0
- package/blueprint/toolbar/flip-button.d.ts +7 -0
- package/blueprint/toolbar/flip-button.js +1 -0
- package/blueprint/toolbar/gif-toolbar.d.ts +9 -0
- package/blueprint/toolbar/gif-toolbar.js +1 -0
- package/blueprint/toolbar/group-button.d.ts +6 -0
- package/blueprint/toolbar/group-button.js +1 -0
- package/blueprint/toolbar/group-toolbar.d.ts +9 -0
- package/blueprint/toolbar/group-toolbar.js +1 -0
- package/blueprint/toolbar/history-buttons.d.ts +6 -0
- package/blueprint/toolbar/history-buttons.js +1 -0
- package/blueprint/toolbar/html-toolbar.d.ts +33 -0
- package/blueprint/toolbar/html-toolbar.js +25 -0
- package/blueprint/toolbar/image-remove-background-button.d.ts +11 -0
- package/blueprint/toolbar/image-remove-background-button.js +1 -0
- package/blueprint/toolbar/image-toolbar.d.ts +33 -0
- package/blueprint/toolbar/image-toolbar.js +1 -0
- package/blueprint/toolbar/line-toolbar.d.ts +29 -0
- package/blueprint/toolbar/line-toolbar.js +1 -0
- package/blueprint/toolbar/lock-button.d.ts +6 -0
- package/blueprint/toolbar/lock-button.js +1 -0
- package/blueprint/toolbar/many-toolbar.d.ts +9 -0
- package/blueprint/toolbar/many-toolbar.js +1 -0
- package/blueprint/toolbar/opacity-picker.d.ts +6 -0
- package/blueprint/toolbar/opacity-picker.js +1 -0
- package/blueprint/toolbar/page-toolbar.d.ts +14 -0
- package/blueprint/toolbar/page-toolbar.js +1 -0
- package/blueprint/toolbar/position-picker.d.ts +6 -0
- package/blueprint/toolbar/position-picker.js +1 -0
- package/blueprint/toolbar/remove-button.d.ts +6 -0
- package/blueprint/toolbar/remove-button.js +1 -0
- package/blueprint/toolbar/sketch.d.ts +44 -0
- package/blueprint/toolbar/sketch.js +1 -0
- package/blueprint/toolbar/svg-toolbar.d.ts +10 -0
- package/blueprint/toolbar/svg-toolbar.js +1 -0
- package/blueprint/toolbar/table-toolbar.d.ts +48 -0
- package/blueprint/toolbar/table-toolbar.js +1 -0
- package/blueprint/toolbar/text-ai-write.d.ts +6 -0
- package/blueprint/toolbar/text-ai-write.js +1 -0
- package/blueprint/toolbar/text-toolbar.d.ts +54 -0
- package/blueprint/toolbar/text-toolbar.js +7 -0
- package/blueprint/toolbar/toolbar.d.ts +17 -0
- package/blueprint/toolbar/toolbar.js +24 -0
- package/blueprint/toolbar/use-copy-style.d.ts +9 -0
- package/blueprint/toolbar/use-copy-style.js +1 -0
- package/blueprint/toolbar/use-duplicate-element.d.ts +7 -0
- package/blueprint/toolbar/use-duplicate-element.js +1 -0
- package/blueprint/toolbar/use-lock.d.ts +8 -0
- package/blueprint/toolbar/use-lock.js +1 -0
- package/blueprint/toolbar/use-remove-element.d.ts +7 -0
- package/blueprint/toolbar/use-remove-element.js +1 -0
- package/blueprint/toolbar/video-toolbar.d.ts +17 -0
- package/blueprint/toolbar/video-toolbar.js +1 -0
- package/blueprint/toolbar/zoom-buttons.d.ts +13 -0
- package/blueprint/toolbar/zoom-buttons.js +15 -0
- package/canvas/context-menu/context-menu.d.ts +2 -2
- package/canvas/context-menu/context-menu.js +1 -1
- package/canvas/element.js +1 -1
- package/canvas/html-element.d.ts +2 -16
- package/canvas/html-element.js +1 -30
- package/canvas/page-controls.d.ts +1 -2
- package/canvas/page-controls.js +1 -1
- package/canvas/page.d.ts +3 -3
- package/canvas/page.js +1 -1
- package/canvas/quill-font-formats.d.ts +1 -0
- package/canvas/quill-font-formats.js +1 -0
- package/canvas/render-tag-element.d.ts +12 -0
- package/canvas/render-tag-element.js +1 -0
- package/canvas/rich-editor.d.ts +38 -0
- package/canvas/rich-editor.js +33 -0
- package/canvas/text-element/fit-font-size.d.ts +8 -0
- package/canvas/text-element/fit-font-size.js +1 -0
- package/canvas/text-element.d.ts +1 -0
- package/canvas/text-element.js +1 -1
- package/canvas/tooltip.d.ts +1 -2
- package/canvas/tooltip.js +1 -1
- package/canvas/workspace-canvas.d.ts +3 -3
- package/canvas/workspace-canvas.js +1 -1
- package/canvas/workspace-style.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/fonts.css +75 -0
- package/hooks/use-debounced-value.d.ts +1 -0
- package/hooks/use-debounced-value.js +1 -0
- package/hooks/use-event.d.ts +1 -0
- package/hooks/use-event.js +6 -0
- package/hooks/use-toolbar-condensed.d.ts +4 -0
- package/hooks/use-toolbar-condensed.js +1 -0
- package/icons/animation-icons.d.ts +7 -0
- package/icons/animation-icons.js +1 -0
- package/icons/registry.d.ts +123 -0
- package/icons/registry.js +1 -0
- package/lib/utils.d.ts +3 -0
- package/lib/utils.js +1 -0
- package/model/audio-model.d.ts +2 -0
- package/model/audio-model.js +1 -1
- package/model/figure-model.d.ts +1 -1
- package/model/gif-model.d.ts +1 -1
- package/model/group-model.d.ts +23 -13
- package/model/group-model.js +1 -1
- package/model/image-model.d.ts +1 -1
- package/model/line-model.d.ts +1 -1
- package/model/node-model.js +1 -1
- package/model/page-model.d.ts +1848 -1
- package/model/schema.d.ts +1 -0
- package/model/shape-model.d.ts +2 -2
- package/model/shape-model.js +1 -1
- package/model/store.d.ts +17337 -712
- package/model/store.js +1 -1
- package/model/svg-model.d.ts +1 -1
- package/model/table-model.d.ts +10 -10
- package/model/table-model.js +1 -1
- package/model/text-model.d.ts +1 -1
- package/model/video-model.d.ts +1 -1
- package/package.json +111 -39
- package/pages-timeline/audio-track.d.ts +2 -2
- package/pages-timeline/audio-track.js +1 -1
- package/pages-timeline/audios.d.ts +1 -1
- package/pages-timeline/audios.js +1 -1
- package/pages-timeline/current-time.d.ts +1 -1
- package/pages-timeline/current-time.js +1 -1
- package/pages-timeline/element-track.d.ts +1 -3
- package/pages-timeline/element-track.js +1 -1
- package/pages-timeline/elements.d.ts +1 -1
- package/pages-timeline/elements.js +1 -1
- package/pages-timeline/index.d.ts +1 -1
- package/pages-timeline/index.js +1 -1
- package/pages-timeline/page-preview.d.ts +5 -4
- package/pages-timeline/page-preview.js +1 -23
- package/pages-timeline/pages-timeline.d.ts +1 -1
- package/pages-timeline/pages-timeline.js +1 -38
- package/pages-timeline/pages.d.ts +1 -1
- package/pages-timeline/play-button.d.ts +1 -1
- package/pages-timeline/play-button.js +1 -24
- package/pages-timeline/spinner.d.ts +3 -1
- package/pages-timeline/spinner.js +1 -14
- package/pages-timeline/time-ruler.d.ts +1 -1
- package/pages-timeline/time-ruler.js +1 -13
- package/pages-timeline/track-styles.d.ts +12 -7
- package/pages-timeline/track-styles.js +1 -79
- package/polotno-app.js +8 -4
- package/polotno.bundle.js +342 -570
- package/primitives/button-group.d.ts +8 -0
- package/primitives/button-group.js +1 -0
- package/primitives/button.d.ts +13 -0
- package/primitives/button.js +1 -0
- package/primitives/dialog.d.ts +17 -0
- package/primitives/dialog.js +1 -0
- package/primitives/dropdown-menu.d.ts +25 -0
- package/primitives/dropdown-menu.js +1 -0
- package/primitives/field-group.d.ts +11 -0
- package/primitives/field-group.js +1 -0
- package/primitives/field-row.d.ts +5 -0
- package/primitives/field-row.js +1 -0
- package/primitives/index.d.ts +27 -0
- package/primitives/index.js +1 -0
- package/primitives/input-group.d.ts +8 -0
- package/primitives/input-group.js +1 -0
- package/primitives/input.d.ts +3 -0
- package/primitives/input.js +1 -0
- package/primitives/navbar.d.ts +17 -0
- package/primitives/navbar.js +1 -0
- package/primitives/numeric-input.d.ts +28 -0
- package/primitives/numeric-input.js +1 -0
- package/primitives/overflow-list.d.ts +9 -0
- package/primitives/overflow-list.js +1 -0
- package/primitives/panel-header.d.ts +6 -0
- package/primitives/panel-header.js +1 -0
- package/primitives/popover.d.ts +6 -0
- package/primitives/popover.js +1 -0
- package/primitives/portal-scope.d.ts +13 -0
- package/primitives/portal-scope.js +1 -0
- package/primitives/search-input.d.ts +9 -0
- package/primitives/search-input.js +1 -0
- package/primitives/select.d.ts +15 -0
- package/primitives/select.js +1 -0
- package/primitives/separator.d.ts +4 -0
- package/primitives/separator.js +1 -0
- package/primitives/slider-field.d.ts +18 -0
- package/primitives/slider-field.js +1 -0
- package/primitives/slider.d.ts +4 -0
- package/primitives/slider.js +1 -0
- package/primitives/spinner.d.ts +6 -0
- package/primitives/spinner.js +1 -0
- package/primitives/switch.d.ts +4 -0
- package/primitives/switch.js +1 -0
- package/primitives/tabs.d.ts +10 -0
- package/primitives/tabs.js +1 -0
- package/primitives/textarea.d.ts +3 -0
- package/primitives/textarea.js +1 -0
- package/primitives/toggle-group.d.ts +15 -0
- package/primitives/toggle-group.js +1 -0
- package/primitives/toggle.d.ts +12 -0
- package/primitives/toggle.js +1 -0
- package/primitives/tooltip-icon-button.d.ts +11 -0
- package/primitives/tooltip-icon-button.js +1 -0
- package/primitives/tooltip.d.ts +7 -0
- package/primitives/tooltip.js +1 -0
- package/side-panel/ai-images-panel.d.ts +1 -1
- package/side-panel/ai-images-panel.js +1 -1
- package/side-panel/animations-panel.d.ts +3 -6
- package/side-panel/animations-panel.js +1 -8
- package/side-panel/background-panel.d.ts +4 -1
- package/side-panel/background-panel.js +1 -8
- package/side-panel/draw-panel.d.ts +4 -1
- package/side-panel/draw-panel.js +1 -19
- package/side-panel/effect-card.js +1 -42
- package/side-panel/effects-panel.d.ts +3 -6
- package/side-panel/effects-panel.js +1 -1
- package/side-panel/elements-panel.d.ts +8 -5
- package/side-panel/elements-panel.js +1 -85
- package/side-panel/image-clip-panel.d.ts +1 -1
- package/side-panel/image-clip-panel.js +1 -3
- package/side-panel/images-grid.d.ts +1 -1
- package/side-panel/images-grid.js +1 -50
- package/side-panel/index.d.ts +35 -2
- package/side-panel/index.js +1 -2
- package/side-panel/layers-panel.d.ts +1 -1
- package/side-panel/layers-panel.js +1 -1
- package/side-panel/pages-panel.d.ts +1 -1
- package/side-panel/photos-panel.d.ts +4 -1
- package/side-panel/photos-panel.js +1 -1
- package/side-panel/select-gif.d.ts +3 -4
- package/side-panel/select-gif.js +1 -1
- package/side-panel/select-image.d.ts +1 -2
- package/side-panel/select-image.js +1 -1
- package/side-panel/select-svg.d.ts +1 -2
- package/side-panel/select-video.d.ts +3 -4
- package/side-panel/side-panel.d.ts +5 -17
- package/side-panel/side-panel.js +1 -94
- package/side-panel/size-panel.d.ts +8 -4
- package/side-panel/size-panel.js +1 -1
- package/side-panel/tab-button.d.ts +3 -2
- package/side-panel/tab-button.js +3 -23
- package/side-panel/templates-panel.d.ts +4 -1
- package/side-panel/templates-panel.js +1 -1
- package/side-panel/text-panel.d.ts +4 -1
- package/side-panel/text-panel.js +1 -24
- package/side-panel/unsplash-credit.d.ts +1 -0
- package/side-panel/unsplash-credit.js +1 -0
- package/side-panel/upload-panel.d.ts +7 -2
- package/side-panel/upload-panel.js +1 -1
- package/side-panel/videos-grid.d.ts +5 -5
- package/side-panel/videos-grid.js +1 -56
- package/side-panel/videos-panel.d.ts +1 -1
- package/side-panel/videos-panel.js +1 -1
- package/themes/blueprint.css +108 -0
- package/toolbar/admin-button.d.ts +1 -1
- package/toolbar/admin-button.js +1 -1
- package/toolbar/animations-picker.d.ts +2 -7
- package/toolbar/animations-picker.js +1 -1
- package/toolbar/color-picker.d.ts +5 -4
- package/toolbar/color-picker.js +1 -19
- package/toolbar/copy-style.d.ts +1 -1
- package/toolbar/copy-style.js +1 -1
- package/toolbar/download-button.d.ts +1 -1
- package/toolbar/download-button.js +1 -1
- package/toolbar/duplicate-button.d.ts +1 -1
- package/toolbar/duplicate-button.js +1 -1
- package/toolbar/element-container.d.ts +6 -3
- package/toolbar/element-container.js +1 -3
- package/toolbar/figure-toolbar.d.ts +3 -3
- package/toolbar/figure-toolbar.js +1 -1
- package/toolbar/filters-picker.d.ts +5 -10
- package/toolbar/filters-picker.js +1 -1
- package/toolbar/flip-button.d.ts +3 -3
- package/toolbar/flip-button.js +1 -1
- package/toolbar/gif-toolbar.d.ts +1 -1
- package/toolbar/group-button.d.ts +1 -1
- package/toolbar/group-button.js +1 -1
- package/toolbar/group-toolbar.d.ts +9 -0
- package/toolbar/group-toolbar.js +1 -0
- package/toolbar/history-buttons.d.ts +1 -1
- package/toolbar/history-buttons.js +1 -1
- package/toolbar/html-toolbar.d.ts +2 -3
- package/toolbar/html-toolbar.js +25 -1
- package/toolbar/image-remove-background-button.js +1 -1
- package/toolbar/image-toolbar.d.ts +5 -6
- package/toolbar/image-toolbar.js +1 -1
- package/toolbar/index.d.ts +34 -0
- package/toolbar/index.js +1 -0
- package/toolbar/line-toolbar.d.ts +2 -2
- package/toolbar/line-toolbar.js +1 -1
- package/toolbar/lock-button.d.ts +1 -1
- package/toolbar/lock-button.js +1 -1
- package/toolbar/many-toolbar.d.ts +1 -1
- package/toolbar/opacity-picker.d.ts +1 -1
- package/toolbar/opacity-picker.js +1 -1
- package/toolbar/page-toolbar.d.ts +2 -6
- package/toolbar/page-toolbar.js +1 -1
- package/toolbar/position-picker.d.ts +1 -1
- package/toolbar/position-picker.js +1 -1
- package/toolbar/remove-button.d.ts +1 -1
- package/toolbar/remove-button.js +1 -1
- package/toolbar/sketch.d.ts +11 -43
- package/toolbar/sketch.js +1 -1
- package/toolbar/svg-toolbar.d.ts +1 -1
- package/toolbar/svg-toolbar.js +1 -1
- package/toolbar/table-toolbar.d.ts +2 -2
- package/toolbar/table-toolbar.js +1 -1
- package/toolbar/text-ai-write.d.ts +1 -1
- package/toolbar/text-ai-write.js +1 -1
- package/toolbar/text-toolbar.d.ts +24 -18
- package/toolbar/text-toolbar.js +1 -7
- package/toolbar/toolbar-shared.d.ts +15 -0
- package/toolbar/toolbar-shared.js +1 -0
- package/toolbar/toolbar.d.ts +9 -7
- package/toolbar/toolbar.js +1 -24
- package/toolbar/use-copy-style.d.ts +3 -3
- package/toolbar/use-duplicate-element.d.ts +1 -1
- package/toolbar/use-lock.d.ts +1 -1
- package/toolbar/use-remove-element.d.ts +1 -1
- package/toolbar/video-toolbar.d.ts +2 -3
- package/toolbar/video-toolbar.js +1 -1
- package/toolbar/zoom-buttons.d.ts +1 -3
- package/toolbar/zoom-buttons.js +1 -15
- package/ui-types.d.ts +22 -0
- package/ui-types.js +1 -0
- package/ui.css +2 -0
- package/utils/background-shape.js +1 -1
- package/utils/flags.d.ts +3 -1
- package/utils/flags.js +1 -1
- package/utils/html-to-svg/svg-builder.js +1 -1
- package/utils/html2canvas.d.ts +4 -1
- package/utils/html2canvas.js +1 -1
- package/utils/l10n.d.ts +3 -0
- package/utils/l10n.js +1 -1
- package/utils/measure-text.js +1 -1
- package/utils/pack-rows.d.ts +8 -0
- package/utils/pack-rows.js +1 -0
- package/utils/reset-style.d.ts +2 -2
- package/utils/reset-style.js +1 -1
- package/utils/rich-text-html.d.ts +28 -0
- package/utils/rich-text-html.js +1 -0
- package/utils/screen.js +1 -1
- package/utils/styled.d.ts +2 -1
- package/utils/styled.js +1 -4
- package/utils/text-format-state.d.ts +59 -0
- package/utils/text-format-state.js +1 -0
- package/utils/text-format.d.ts +46 -0
- package/utils/text-format.js +1 -0
- package/utils/text-html.d.ts +10 -0
- package/utils/text-html.js +1 -1
- package/utils/text.d.ts +6 -1
- package/utils/text.js +1 -1
- package/utils/to-html.js +1 -1
- package/utils/to-pptx.js +1 -1
- package/utils/to-svg.js +1 -1
- package/utils/validate-key.js +1 -1
- package/allPaths.629bdd83.js +0 -2
- package/allPathsLoader.76d3ece1.js +0 -2
- package/paths.52076178.js +0 -2
- package/paths.fb1df685.js +0 -2
- package/splitPathsBySizeLoader.c77762b8.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const MESSAGE="polotno/blueprint/* requires @blueprintjs/core @blueprintjs/icons @blueprintjs/select — install them to use the legacy Blueprint chrome.";function blueprintResolvable(){try{const req=eval('typeof require !== "undefined" ? require : undefined');return!req||"function"!=typeof req.resolve||(req.resolve("@blueprintjs/core"),!0)}catch(_a){return!1}}if(!blueprintResolvable()){throw new Error(MESSAGE)}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoreType } from '../../../model/store.js';
|
|
2
|
+
import { ShapeType } from '../../../model/shape-model.js';
|
|
3
|
+
type ContextMenuProps = {
|
|
4
|
+
store: StoreType;
|
|
5
|
+
element: ShapeType;
|
|
6
|
+
offset: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
};
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
setIsOpen: (b: boolean) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const ContextMenu: (({ store, isOpen, offset, setIsOpen }: ContextMenuProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o,jsxs as e,Fragment as t}from"react/jsx-runtime";import{observer as l}from"mobx-react-lite";import{ContextMenuPopover as n,Menu as s,MenuDivider as i,MenuItem as r}from"@blueprintjs/core";import{t as a}from"../../../utils/l10n.js";import{useDuplicateElement as d}from"../../toolbar/use-duplicate-element.js";import{ChevronDown as m,ChevronUp as c,DoubleChevronDown as u,DoubleChevronUp as b,Duplicate as v,Layers as p,Lock as C,Trash as x,Unlock as E}from"@blueprintjs/icons";import{useRemoveElement as h}from"../../toolbar/use-remove-element.js";import{useCopyStyle as w}from"../../toolbar/use-copy-style.js";import{useLock as f}from"../../toolbar/use-lock.js";export const ContextMenu=l(({store:l,isOpen:k,offset:R,setIsOpen:y})=>{var j;const{disabled:g,duplicate:M}=d({store:l}),{disabled:D,remove:P}=h({store:l}),{setElementToCopy:B}=w(l),{disabled:O,lock:F,locked:T}=f({store:l}),U=o(T?C:E,{});return 0===l.selectedElements.length?null:o(n,{isOpen:k,onClose:()=>{y(!1)},content:e(s,{children:[o(r,{shouldDismissPopover:!1,icon:U,text:a(T?"contextMenu.unlock":"contextMenu.lock"),onClick:F,disabled:O}),o(r,{icon:o(v,{}),text:a("contextMenu.duplicate"),onClick:M,disabled:g}),o(r,{icon:o(x,{}),text:a("contextMenu.remove"),onClick:P,disabled:D}),o(i,{}),e(r,{icon:o(p,{}),text:a("toolbar.layering"),children:[o(r,{shouldDismissPopover:!1,icon:o(b,{}),text:a("toolbar.toForward"),disabled:!l.selectedElements.some(o=>{var e;return null===(e=o.parent)||void 0===e?void 0:e.canMoveElementsTop([o.id])}),onClick:()=>l.selectedElements.forEach(o=>o.moveTop())}),o(r,{shouldDismissPopover:!1,icon:o(c,{}),text:a("toolbar.up"),disabled:!l.selectedElements.some(o=>{var e;return null===(e=o.parent)||void 0===e?void 0:e.canMoveElementsUp([o.id])}),onClick:()=>l.selectedElements.forEach(o=>o.moveUp())}),o(r,{shouldDismissPopover:!1,icon:o(m,{}),text:a("toolbar.down"),disabled:!l.selectedElements.some(o=>{var e;return null===(e=o.parent)||void 0===e?void 0:e.canMoveElementsDown([o.id])}),onClick:()=>l.selectedElements.forEach(o=>o.moveDown())}),o(r,{shouldDismissPopover:!1,icon:o(u,{}),text:a("toolbar.toBottom"),disabled:!l.selectedElements.some(o=>{var e;return null===(e=o.parent)||void 0===e?void 0:e.canMoveElementsBottom([o.id])}),onClick:()=>l.selectedElements.forEach(o=>o.moveBottom())})]}),"table"===(null===(j=l.selectedElements[0])||void 0===j?void 0:j.type)&&(()=>{var n;const s=l.selectedElements[0],d=s.focusedCells[0],m=null!=d,c=null!==(n=s.getFocusedCellRange())&&void 0!==n?n:d?{minRow:d.row,maxRow:d.row,minCol:d.col,maxCol:d.col}:{minRow:0,maxRow:0,minCol:0,maxCol:0},{minRow:u,maxRow:b,minCol:v,maxCol:p}=c,C=b>u,x=p>v;return e(t,{children:[m&&e(t,{children:[o(i,{}),o(r,{text:a("toolbar.insertRowAbove"),onClick:()=>{l.history.transaction(()=>{s.addRow(u)})}}),o(r,{text:a("toolbar.insertRowBelow"),onClick:()=>{l.history.transaction(()=>{s.addRow(b+1)})}}),o(r,{text:a(C?"toolbar.deleteRows":"toolbar.deleteRow"),disabled:s.rows<=b-u+1,onClick:()=>{l.history.transaction(()=>{s.removeRowRange(u,b)})}}),o(i,{}),o(r,{text:a("toolbar.insertColumnLeft"),onClick:()=>{l.history.transaction(()=>{s.addColumn(v)})}}),o(r,{text:a("toolbar.insertColumnRight"),onClick:()=>{l.history.transaction(()=>{s.addColumn(p+1)})}}),o(r,{text:a(x?"toolbar.deleteColumns":"toolbar.deleteColumn"),disabled:s.cols<=p-v+1,onClick:()=>{l.history.transaction(()=>{s.removeColumnRange(v,p)})}})]}),o(i,{}),o(r,{text:a("toolbar.distributeRowsEvenly"),onClick:()=>{l.history.transaction(()=>{s.distributeRowsEvenly()})}}),o(r,{text:a("toolbar.distributeColumnsEvenly"),onClick:()=>{l.history.transaction(()=>{s.distributeColumnsEvenly()})}})]})})()]}),targetOffset:{top:R.y,left:R.x}})});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoreType } from '../../model/store.js';
|
|
2
|
+
import { PageType } from '../../model/page-model.js';
|
|
3
|
+
export declare const PageControls: (({ store, page, xPadding, yPadding, layout, }: {
|
|
4
|
+
store: StoreType;
|
|
5
|
+
page: PageType;
|
|
6
|
+
xPadding: number;
|
|
7
|
+
yPadding: number;
|
|
8
|
+
layout?: "vertical" | "horizontal";
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{observer as i}from"mobx-react-lite";import{Button as a,Tooltip as l}from"@blueprintjs/core";import{ChevronUp as n,ChevronDown as t,ChevronLeft as r,ChevronRight as c,Duplicate as s,Trash as d,Insert as p}from"@blueprintjs/icons";import{ROLES as m}from"../../model/store.js";import{t as g}from"../../utils/l10n.js";export const PageControls=i(({store:i,page:h,xPadding:v,yPadding:b,layout:k="vertical"})=>{const u=i.pages.length>1,x=i.pages.indexOf(h),P="horizontal"===k,w=P?r:n,f=P?c:t,j=g(P?"workspace.moveLeft":"workspace.moveUp"),C=g(P?"workspace.moveRight":"workspace.moveDown");return"selection"!==i.tool||i.role===m.VIEWER?null:o("div",{style:{position:"absolute",top:b-40+"px",right:v+"px"},children:[u&&e(l,{content:j,disabled:0===x,children:e(a,{icon:e(w,{}),minimal:!0,disabled:0===x,onClick:()=>{h.setZIndex(x-1)},"aria-label":j})}),u&&e(l,{content:C,disabled:x===i.pages.length-1,children:e(a,{icon:e(f,{}),"aria-label":C,minimal:!0,disabled:x===i.pages.length-1,onClick:()=>{const e=i.pages.indexOf(h);h.setZIndex(e+1)}})}),e(l,{content:g("workspace.duplicatePage"),children:e(a,{icon:e(s,{}),minimal:!0,"aria-label":g("workspace.duplicatePage"),onClick:()=>{h.clone()}})}),u&&e(l,{content:g("workspace.removePage"),children:e(a,{icon:e(d,{}),"aria-label":g("workspace.removePage"),minimal:!0,onClick:()=>{i.deletePages([h.id])}})}),e(l,{content:g("workspace.addPage"),children:e(a,{icon:e(p,{}),minimal:!0,"aria-label":g("workspace.addPage"),onClick:()=>{var e,o,a;const l=i.addPage({bleed:(null===(e=i.activePage)||void 0===e?void 0:e.bleed)||0,width:(null===(o=i.activePage)||void 0===o?void 0:o.width)||"auto",height:(null===(a=i.activePage)||void 0===a?void 0:a.height)||"auto"}),n=i.pages.indexOf(h);l.setZIndex(n+1)}})})]})});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoreType } from '../../model/store.js';
|
|
2
|
+
import { PageType } from '../../model/page-model.js';
|
|
3
|
+
export declare const Tooltip: (({ store, page, components, stageRef, tooltipSafeArea, }: {
|
|
4
|
+
store: StoreType;
|
|
5
|
+
page: PageType;
|
|
6
|
+
components?: any;
|
|
7
|
+
stageRef?: any;
|
|
8
|
+
tooltipSafeArea?: {
|
|
9
|
+
top?: number;
|
|
10
|
+
bottom?: number;
|
|
11
|
+
left?: number;
|
|
12
|
+
right?: number;
|
|
13
|
+
};
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import{Html as l}from"react-konva-utils";import{Navbar as r,NavbarGroup as i}from"@blueprintjs/core";import{getTotalClientRect as s}from"../../utils/math.js";import{extendToolbar as u}from"../toolbar/element-container.js";import{TextAiWrite as a}from"../toolbar/text-ai-write.js";import{flags as c}from"../../utils/flags.js";import{DuplicateButton as d}from"../toolbar/duplicate-button.js";import{RemoveButton as f}from"../toolbar/remove-button.js";import{PositionPicker as m}from"../toolbar/position-picker.js";import{GroupButton as p}from"../toolbar/group-button.js";function v(t,e){return t.classList.contains(e)?t:t.parentElement?v(t.parentElement,e):null}const h=()=>null;export const Tooltip=o(({store:o,page:g,components:b,stageRef:x,tooltipSafeArea:y})=>{var E,C,k;const j=o.selectedShapes.every(t=>t.page===g),w=n.useRef(null),[I,N]=n.useState(!1),R=o._hasCroppedImages;o.selectedElements.length,n.useEffect(()=>{var t,e,n;const o=()=>{N(!0)},l=()=>{N(!1)};null===(t=null==x?void 0:x.current)||void 0===t||t.on("dragstart",o),null===(e=null==x?void 0:x.current)||void 0===e||e.on("dragend",l);const r=null===(n=null==x?void 0:x.current)||void 0===n?void 0:n.findOne("Transformer");return null==r||r.on("transformstart",o),null==r||r.on("transformend",l),()=>{var t,e;null===(t=null==x?void 0:x.current)||void 0===t||t.off("dragstart",o),null===(e=null==x?void 0:x.current)||void 0===e||e.off("dragend",l),null==r||r.off("transformstart",o),null==r||r.off("transformend",l)}},[]);const[M,T]=n.useState({fit:!0,needCalculate:!1,token:Math.random()});function O(){if(!w.current){return}if(!M.needCalculate){return}const t=v(w.current,"polotno-workspace-container");if(!t){return}const e=t.getBoundingClientRect(),n=w.current.getBoundingClientRect(),o=(n.right,e.left,n.top-e.top),l=(n.left,e.left,n.bottom-e.top),r=(null==y?void 0:y.top)||0,i=(null==y?void 0:y.bottom)||0,s=null==x?void 0:x.current;let u=-1/0,a=1/0;if(s){const t=s.container().getBoundingClientRect(),n=s.scaleY();u=t.top+s.y()+S.y*n-e.top,a=t.top+s.y()+(S.y+S.height)*n-e.top}const c=o>=20+r&&u-l>=48,d=l-e.height<=-20-i&&o-a>=48;T(c?{fit:!0,needCalculate:!1,token:M.token}:d?{fit:!1,needCalculate:!1,token:M.token}:{fit:M.fit,needCalculate:!1,token:M.token})}if(n.useEffect(()=>{0!==o.selectedElements.length&&T({fit:!0,needCalculate:!0,token:Math.random()})},[o.selectedElements,I,o.scale]),n.useLayoutEffect(()=>{const t=setTimeout(()=>{O()},100);return()=>{clearTimeout(t)}},[M.needCalculate,w.current,M.token]),n.useEffect(()=>{if(!x.current){return}const t=v(x.current.content,"polotno-workspace-inner");if(!t){return}const e=()=>{o.selectedElements.length&&T({fit:!0,needCalculate:!0,token:Math.random()})};return null==t||t.addEventListener("scroll",e),()=>{null==t||t.removeEventListener("scroll",e)}},[]),0===o.selectedShapes.length){return null}if(I){return null}if(!j){return null}if(o.activePage!==g){return null}if(R){return null}const S=s(o.selectedShapes),B=(null==b?void 0:b.Position)||m,Y=(null==b?void 0:b.Duplicate)||d,F=(null==b?void 0:b.Remove)||f,L=(null==b?void 0:b.Group)||p,P=(null==b?void 0:b.Lock)||h,X=null===(E=o.selectedElements[0])||void 0===E?void 0:E.type,_=Object.assign(Object.assign({},c.aiTextEnabled?{TextAiWrite:a}:{}),b||{}),A=u({components:_,type:X,usedItems:[]}),J=(null===(k=null===(C=null==x?void 0:x.current)||void 0===C?void 0:C.findOne("Transformer"))||void 0===k?void 0:k.rotation())||0;let V=80;return Math.abs(J)<30&&M.fit&&(V=80),Math.abs(J)>140&&!M.fit&&(V=80),t(l,{parentNodeFunc:({stage:t})=>{var e,n;return(null===(e=null==t?void 0:t.container())||void 0===e?void 0:e.closest(".polotno-workspace-container"))||(null===(n=null==t?void 0:t.container())||void 0===n?void 0:n.parentNode)},transformFunc:t=>{var e;const n=S.x+S.width/2,o=null===(e=null==x?void 0:x.current)||void 0===e?void 0:e.container(),l=(null==o?void 0:o.getBoundingClientRect())||{left:0,top:0,width:0,height:0,right:0,bottom:0,x:0,y:0,toJSON:()=>({})},r=null==o?void 0:o.closest(".polotno-workspace-container"),i=(null==r?void 0:r.getBoundingClientRect())||{left:0,top:0,width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY,right:0,bottom:0,x:0,y:0,toJSON:()=>({})},s=l.left-i.left,u=l.top-i.top,a=w.current?w.current.getBoundingClientRect().height:34,c=((null==y?void 0:y.top)||0)+8,d=u+t.y+S.y*t.scaleY;let f=M.fit;if(f){const t=d-V,e=c+a/2;Math.max(e,t)+a/2>d-48&&(f=!1)}const m=f?S.y*t.scaleY-V:S.y*t.scaleY+S.height*t.scaleY+V;let p=s+t.x+n*t.scaleX,v=p-S.width*t.scaleX/2,h=p+S.width*t.scaleX/2;const g=Math.min(50,S.width/2*t.scaleX),b=h>=g&&v<=i.width-g,E=w.current?w.current.getBoundingClientRect().width:0,C=(null==y?void 0:y.left)||0,k=(null==y?void 0:y.right)||0;if(Number.isFinite(i.width)&&E>0&&b){const t=8+E/2+C,e=i.width-8-E/2-k;e>=t&&(p=Math.max(t,Math.min(p,e)))}h<g&&(p-=E+8),v>i.width-g&&(p+=E+8);let j=u+t.y+m;const I=w.current?w.current.getBoundingClientRect().height:34,N=((null==y?void 0:y.top)||0)+8,R=((null==y?void 0:y.bottom)||0)+8;return Number.isFinite(i.height)&&(j=Math.max(N+I/2,j),j=Math.min(i.height-R-I/2,j)),Object.assign(Object.assign({},t),{x:p,y:j,scaleX:1,scaleY:1})},divProps:{style:{pointerEvents:"none",position:"absolute",visibility:M.needCalculate?"hidden":"visible",zIndex:9}},children:t("div",{ref:t=>{w.current=t,!w.current&&t&&O()},style:{pointerEvents:"none"},children:t(r,{style:{padding:"2px",borderRadius:"5px",height:"34px",transform:"translate(-50%, -50%)",pointerEvents:"auto"},children:e(i,{style:{height:"30px"},children:[A.map(e=>{const n=_[e];return t(n,{elements:o.selectedElements,element:o.selectedElements[0],store:o},e)}),t(L,{store:o}),t(P,{store:o}),t(Y,{store:o}),t(F,{store:o}),t(B,{store:o})]})})})})});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoreType } from '../../model/store.js';
|
|
2
|
+
import { AudioType } from '../../model/audio-model.js';
|
|
3
|
+
export declare const AUDIO_ROW_HEIGHT = 28;
|
|
4
|
+
export declare const AUDIO_TRACK_HEIGHT = 24;
|
|
5
|
+
export declare const AudioTrack: (({ audio, scale, store, index, }: {
|
|
6
|
+
audio: AudioType;
|
|
7
|
+
scale: number;
|
|
8
|
+
store: StoreType;
|
|
9
|
+
index: number;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=this&&this.__rest||function(e,t){var n={};for(var o in e){Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o])}if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(o=Object.getOwnPropertySymbols(e);i<o.length;i++){t.indexOf(o[i])<0&&Object.prototype.propertyIsEnumerable.call(e,o[i])&&(n[o[i]]=e[o[i]])}}return n};import{jsx as t,jsxs as n}from"react/jsx-runtime";import o from"react";import{observer as i}from"mobx-react-lite";import{Button as s,Menu as a,MenuItem as r,MenuDivider as l,Popover as m,Position as d,Slider as p}from"@blueprintjs/core";import{Duplicate as c,More as u,Trash as h,VolumeUp as x,VolumeOff as v}from"@blueprintjs/icons";import{t as f}from"../../utils/l10n.js";import{Spinner as y}from"./spinner.js";import{useWaveformData as M,useWaveformPath as T}from"./waveform.js";import{TrackWrapper as g,TrackContainer as w,TrackMenu as b,TrackHandleLeft as I,TrackHandleRight as j,WaveformSvg as O}from"./track-styles.js";export const AUDIO_ROW_HEIGHT=28;export const AUDIO_TRACK_HEIGHT=24;const E=({position:e,store:t,scale:n})=>{const o=t.pages;for(const i of o){const t=i.startTime,o=i.startTime+i.duration;if(Math.abs(e-t)<10/n){return t}if(Math.abs(e-o)<10/n){return o}}return null};export const AudioTrack=i(({audio:i,scale:A,store:D,index:P})=>{const[C,L]=o.useState(1),N=0===i.volume,k=()=>{N?i.set({volume:C>0?C:1}):(L(i.volume),i.set({volume:0}))},S=(e=i.startTime,t=i.endTime)=>Math.max(0,(t-e)*(i.duration||0)),_=e=>Math.max(0,D.duration-e),H=(e,t=S())=>Math.min(Math.max(0,e),_(t)),R=S(),X=D.duration*A-i.delay*A,z=Math.min(R*A,X),$=i.delay*A,{data:Y,isLoading:B}=M(i.src),F=(i.endTime-i.startTime)*i.duration*A,G=T(Y,20).path,U=(e,t)=>{e.stopPropagation(),e.preventDefault();const n=e.clientX,o=$,s=z,a=i.endTime,r=i.startTime,l=i.delay,m=i.duration||1,d=e=>{e.preventDefault();const d=(e.clientX-n)/A;if("start"===t){if(d>=0){const e=d,t=Math.max(0,a-.1-r)*m,n=Math.min(e,t);if(n<=0){return}let o=r+n/m;const s=(i.endTime-o)*m,p=l+n,c=_(s);let u=Math.min(Math.max(0,p),c);const h=E({position:u,store:D,scale:A});u=Math.min(Math.max(0,null!=h?h:u),c);const x=u-p;o=Math.min(i.endTime-.1,Math.max(0,o+x/m)),i.set({delay:u,startTime:o})}else{const e=-d,t=r*m,n=Math.min(e,t);if(n<=0){return}const o=n/m;let s=Math.max(0,r-o);const a=(i.endTime-s)*m,p=l-n,c=_(a);let u=Math.min(Math.max(0,p),c);const h=E({position:u,store:D,scale:A});u=Math.min(Math.max(0,null!=h?h:u),c);const x=u-p;s=Math.max(0,Math.min(i.endTime-.1,s+x/m)),i.set({delay:u,startTime:s})}}else{const e=o/A+s/A;let t=e+d;const n=E({position:t,store:D,scale:A});t=null!=n?n:t;const r=(t-e)/i.duration,l=Math.min(1,Math.max(i.startTime+.1,a+r));i.set({endTime:l})}},p=()=>{if(window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",p),"start"===t){const e=E({position:i.delay,store:D,scale:A});if(null!=e&&e!==i.delay){const t=S(i.startTime,i.endTime),n=H(e,t),o=n-i.delay,s=Math.max(0,Math.min(i.endTime-.1,i.startTime+o/m));i.set({delay:n,startTime:s})}}};window.addEventListener("mousemove",d),window.addEventListener("mouseup",p)};return t(g,{style:{left:`${$}px`,top:28*P+"px",width:`${z}px`,height:"24px"},className:"polotno-audio-container",children:n(w,{style:{width:"100%",height:"100%",color:"var(--polotno-timeline-audio-color, rgba(0, 161, 255, 0.85))"},onMouseDown:e=>{const t=e.clientX,n=$;e.preventDefault();const o=e=>{e.preventDefault();const o=(e.clientX-t)/A;let s=n/A+o;const a=s+R,r=E({position:s,store:D,scale:A}),l=E({position:a,store:D,scale:A}),m=null!==r?Math.abs(s-r):Number.POSITIVE_INFINITY,d=null!==l?Math.abs(a-l):Number.POSITIVE_INFINITY;let p;p=H(null!==r&&m<d?r:null!==l?l-R:s),i.set({delay:H(p)})},s=()=>{window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",s)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",s)},children:[t("div",{style:{position:"absolute",left:"4px",top:"50%",transform:"translateY(-50%)",zIndex:10,pointerEvents:"auto"},onClick:e=>{e.stopPropagation(),k()},onMouseDown:e=>e.stopPropagation(),children:t(N?v:x,{size:14,style:{opacity:.7,cursor:"pointer"}})}),t("div",{style:{position:"absolute",inset:"0 0 0 0",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:n("div",{style:{display:"flex",alignItems:"center",width:"100%",height:"100%",gap:"8px",paddingLeft:"22px"},children:[G&&t("div",{style:{flex:1,height:"14px",overflow:"hidden",opacity:N?.4:1},children:t(O,{width:F,height:"14",viewBox:`0 0 ${F} 20`,preserveAspectRatio:"none",style:{width:F+"px",height:"14px",transform:`translateX(-${i.startTime*F}px)`},children:t("path",{d:G})})}),B&&t("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center"},children:t(y,{})})]})}),t(I,{onMouseDown:e=>U(e,"start")}),t(j,{onMouseDown:e=>U(e,"end")}),t(b,{className:"polotno-track-menu",onClick:e=>{e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),children:t(m,{content:n(a,{style:{width:"180px"},children:[n("div",{style:{padding:"8px 12px"},children:[n("div",{style:{fontSize:"12px",marginBottom:"6px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t("span",{children:f("pagesTimeline.volume")}),n("span",{children:[Math.round(100*i.volume),"%"]})]}),t(p,{value:i.volume,min:0,max:1,stepSize:.01,labelRenderer:!1,onChange:e=>{const t=Math.max(0,Math.min(1,e));t>0&&L(t),i.set({volume:t})}})]}),t(l,{}),t(r,{icon:t(N?x:v,{}),text:f(N?"pagesTimeline.unmuteAudio":"pagesTimeline.muteAudio"),onClick:k}),t(r,{icon:t(c,{}),text:f("pagesTimeline.duplicateAudio"),onClick:()=>{const t=i.toJSON(),n=(i.endTime-i.startTime)*(i.duration||0),o=i.delay+n,s=D.duration-o;let a=i.delay;s>=n?a=o:s>0&&(a=Math.max(0,D.duration-n));const{id:r}=t,l=e(t,["id"]);D.addAudio(Object.assign(Object.assign({},l),{delay:a}))}}),t(l,{}),t(r,{icon:t(h,{}),text:f("pagesTimeline.removeAudio"),onClick:()=>{D.removeAudio(i.id)}})]}),position:d.TOP,children:t(s,{icon:t(u,{}),style:{minHeight:"20px",borderRadius:"10px",padding:"0px"}})})})]})})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{observer as t}from"mobx-react-lite";import{AudioTrack as e,AUDIO_ROW_HEIGHT as r}from"./audio-track.js";export const Audios=t(({store:t,scale:i,width:a})=>{const s=(o=>{const t=[],e=[];return o.forEach(o=>{const r=o.delay,i=o.delay+(o.endTime-o.startTime)*o.duration;let a=0;for(;a<e.length&&e[a]>r;){a++}t.push({audio:o,row:a}),e[a]=i}),t})(t.audios),n=s.reduce((o,t)=>Math.max(o,t.row),-1)+1,d=Math.max(n,1)*r;return s.length?o("div",{style:{position:"relative",minWidth:a+"px",height:d+"px",marginTop:"12px"},className:"polotno-audios-container",children:s.map(({audio:r,row:a})=>o(e,{audio:r,scale:i,store:t,index:a},r.id))}):null});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StoreType } from '../../model/store.js';
|
|
3
|
+
type Variant = 'timeline' | 'ruler';
|
|
4
|
+
interface CurrentTimeProps {
|
|
5
|
+
store: StoreType;
|
|
6
|
+
scale: number;
|
|
7
|
+
variant?: Variant;
|
|
8
|
+
dragAreaRef?: React.RefObject<HTMLElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare const CurrentTime: (({ store, scale, variant, dragAreaRef }: CurrentTimeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";const r="rgb(0, 161, 255)";export const CurrentTime=o(({store:o,scale:i,variant:a="timeline",dragAreaRef:s})=>{var l;const c=n.useRef(null),u=(null===(l=o.activePage)||void 0===l?void 0:l.startTime)||0,d=o.isPlaying||0!==o.currentTime?o.currentTime:u,v=n.useCallback(e=>Math.max(0,Math.min(e,o.duration)),[o.duration]),p=n.useCallback(e=>{var t,n;const r=(null==s?void 0:s.current)||(null===(t=c.current)||void 0===t?void 0:t.parentElement);if(!r){return}const a=r.getBoundingClientRect(),l=r.scrollLeft||0;let u=e-a.left+l;const d=window.getComputedStyle(r);u-=parseFloat(d.paddingLeft)||0;const p=Math.max(0,u),m=v(p/i);o.setCurrentTime(m),null===(n=o.checkActivePage)||void 0===n||n.call(o)},[v,s,i,o]),m=n.useCallback(e=>{p(e);const t=e=>{e.preventDefault(),p(e.clientX)},n=()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",t),window.addEventListener("mouseup",n)},[p]),w=n.useCallback(e=>{p(e);const t=e=>{const t=e.touches[0];t&&(e.preventDefault(),p(t.clientX))},n=()=>{window.removeEventListener("touchmove",t),window.removeEventListener("touchend",n),window.removeEventListener("touchcancel",n)};window.addEventListener("touchmove",t,{passive:!1}),window.addEventListener("touchend",n),window.addEventListener("touchcancel",n)},[p]),h=n.useCallback(e=>{e.preventDefault(),e.stopPropagation(),m(e.clientX)},[m]),g=n.useCallback(e=>{const t=e.touches[0];t&&(e.preventDefault(),e.stopPropagation(),w(t.clientX))},[w]),f=(e=>"ruler"===e?{wrapper:{top:0,width:12,height:"100%",transform:"translateX(-6px)",display:"flex",flexDirection:"column",alignItems:"center"},line:{flex:1}}:{wrapper:{top:0,width:12,height:"100%",transform:"translateX(-6px)"},line:{height:"100%",margin:"0 auto"},showMarker:!1})(a);return t("div",{ref:c,onMouseDown:h,onTouchStart:g,style:Object.assign(Object.assign({position:"absolute",left:d*i+"px"},f.wrapper),{cursor:"col-resize",touchAction:"none"}),children:[e("svg",{width:"12",height:"8",viewBox:"0 0 12 8",style:{display:"block",filter:"drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3))"},children:e("path",{d:"M0 0 H12 L6 8 Z",fill:r,stroke:r,strokeWidth:"2",strokeLinejoin:"round"})}),e("div",{style:Object.assign({width:"2px",backgroundColor:r},f.line)})]})});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ShapeType } from '../../model/shape-model.js';
|
|
2
|
+
import { StoreType } from '../../model/store.js';
|
|
3
|
+
import { PageType } from '../../model/page-model.js';
|
|
4
|
+
export declare const ELEMENT_ROW_HEIGHT = 26;
|
|
5
|
+
export declare const ElementTrack: (({ element, page, store, scale, row, }: {
|
|
6
|
+
element: ShapeType;
|
|
7
|
+
page: PageType;
|
|
8
|
+
store: StoreType;
|
|
9
|
+
scale: number;
|
|
10
|
+
row: number;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
12
|
+
displayName: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import{Button as i,Menu as s,MenuItem as l,Popover as r,Position as a}from"@blueprintjs/core";import{Duplicate as m,More as d,Trash as p}from"@blueprintjs/icons";import{t as c}from"../../utils/l10n.js";import{TrackWrapper as u,TrackContainer as v,TrackMenu as w,TrackHandleLeft as x,TrackHandleRight as f,TrackLabel as h}from"./track-styles.js";import{duplicateElements as E}from"../../utils/duplicate.js";export const ELEMENT_ROW_HEIGHT=26;const y=100,b=(e,t,n)=>Math.min(n,Math.max(t,e)),g=(e,t)=>{const n=e.animations.find(e=>e.type===t);n?n.enabled||e.setAnimation(t,{enabled:!0}):e.setAnimation(t,{})},L=(e,t,n,o)=>{const i=b(n,0,t-y),s=b(o,i+y,t);g(e,"enter"),g(e,"exit"),e.setAnimation("enter",{delay:i}),e.setAnimation("exit",{delay:Math.max(0,t-s)})};export const ElementTrack=o(({element:o,page:g,store:M,scale:j,row:D})=>{const k=g.duration,P=g.startTime,T=P+k,A=b((e=>{var t;const n=e.animations.find(e=>"enter"===e.type);return null!==(t=null==n?void 0:n.delay)&&void 0!==t?t:0})(o),0,k),X=b(k-(e=>{var t;const n=e.animations.find(e=>"exit"===e.type);return null!==(t=null==n?void 0:n.delay)&&void 0!==t?t:0})(o),A+y,k),C=Math.max(X-A,y)*j,H=(P+A)*j,O=o.name||o.type||c("toolbar.element"),[N,R]=n.useState(null),$=()=>{R(e=>null===e?D:e)},_=()=>{R(null)},G=(e,t)=>{e.preventDefault(),e.stopPropagation(),$();const n=e.clientX,i=A,s=X,l=e=>{e.preventDefault();const l=(e.clientX-n)/j;if("start"===t){const e=b(P+i+l,P,P+s-y);L(o,k,e-P,s)}else{const e=b(P+s+l,P+i+y,T);L(o,k,i,e-P)}},r=()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",r),_()};window.addEventListener("mousemove",l),window.addEventListener("mouseup",r)};return e(u,{style:{left:`${H}px`,top:26*(null!=N?N:D)+"px",width:`${C}px`,height:"22px"},children:t(v,{style:{width:"100%",height:"100%",color:"var(--polotno-timeline-element-color, rgba(255, 153, 0, 0.85))",outline:M.selectedElements.find(e=>e.id===o.id)?"2px solid var(--polotno-timeline-element-selected-color, rgba(0, 120, 255, 0.9))":"none",outlineOffset:"-1px"},onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),$();const t=e.clientX,n=A,i=X-n;let s=!1;const l=e=>{e.preventDefault(),s=!0;const l=(e.clientX-t)/j,r=b(P+n+l,P,T-i)-P;L(o,k,r,r+i)},r=()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",r),_(),s||M.selectElements([o.id])};window.addEventListener("mousemove",l),window.addEventListener("mouseup",r)},children:[e(h,{children:O}),e(x,{onMouseDown:e=>G(e,"start")}),e(f,{onMouseDown:e=>G(e,"end")}),e(w,{className:"polotno-track-menu",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:e(r,{content:t(s,{style:{width:"140px"},children:[e(l,{icon:e(m,{}),text:c("toolbar.duplicateElements"),onClick:()=>{E([o],M)}}),e(l,{icon:e(p,{}),text:c("toolbar.removeElements"),onClick:()=>{M.deleteElements([o.id])}})]}),position:a.TOP,children:e(i,{icon:e(d,{}),style:{minHeight:"20px",borderRadius:"10px",padding:"0px"}})})})]})})});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StoreType } from '../../model/store.js';
|
|
2
|
+
interface ElementTimelineProps {
|
|
3
|
+
store: StoreType;
|
|
4
|
+
scale: number;
|
|
5
|
+
width: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const ElementsTimeline: (({ store, scale, width }: ElementTimelineProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{observer as t}from"mobx-react-lite";import{ROLES as r}from"../../model/store.js";import{ElementTrack as n,ELEMENT_ROW_HEIGHT as o}from"./element-track.js";import{forEveryChild as a}from"../../model/group-model.js";export const ElementsTimeline=t(({store:t,scale:l,width:s})=>{const i=t.pages.slice();if(!i.length){return null}const m=i.flatMap(e=>(e=>{const t=[];for(const r of e.children){"group"===r.type?a(r,e=>{"group"!==e.type&&t.push(e)}):t.push(r)}return t})(e).map(t=>({element:t,page:e}))).filter(({element:e})=>e.selectable||t.role===r.ADMIN);if(!m.length){return null}const p=(e=>{const t=[],r=[];return e.map(({element:e,page:t})=>{const r=((e,t)=>{var r,n;const o=t.duration,a=e.animations.find(e=>"enter"===e.type),l=e.animations.find(e=>"exit"===e.type),s=Math.max(0,Math.min(o,null!==(r=null==a?void 0:a.delay)&&void 0!==r?r:0));return{start:s,end:Math.max(s+50,Math.min(o,o-(null!==(n=null==l?void 0:l.delay)&&void 0!==n?n:0)))}})(e,t);return{element:e,page:t,start:t.startTime+r.start,end:t.startTime+r.end}}).sort((e,t)=>e.start-t.start).forEach(e=>{if(e.end-e.start<50){return}let n=0;for(;n<r.length&&r[n]>e.start;){n++}t.push({element:e.element,page:e.page,row:n,start:e.start,end:e.end}),r[n]=e.end}),t})(m);if(!p.length){return null}const d=p.reduce((e,t)=>Math.max(e,t.row),-1)+1;return e("div",{style:{position:"relative",minWidth:s+"px",height:d*o+"px",marginTop:"12px"},className:"polotno-elements-container",children:p.map(({element:r,row:o,page:a})=>e(n,{element:r,store:t,page:a,scale:l,row:o},`${a.id}-${r.id}`))})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pages-timeline.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './pages-timeline.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PageType } from '../../model/page-model.js';
|
|
3
|
+
export declare const usePagePreview: ({ page, ref, }: {
|
|
4
|
+
page: PageType;
|
|
5
|
+
ref: React.RefObject<HTMLDivElement>;
|
|
6
|
+
}) => string | null;
|
|
7
|
+
export declare const PagePreview: (({ page, scale }: {
|
|
8
|
+
page: PageType;
|
|
9
|
+
scale: number;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import o from"react";import{observer as i}from"mobx-react-lite";import{reaction as n}from"mobx";import{onSnapshot as r}from"mobx-state-tree";import{Button as s,Menu as a,MenuItem as l,Popover as d,Position as c}from"@blueprintjs/core";import{Duplicate as p,Insert as u,More as g,Trash as m}from"@blueprintjs/icons";import h from"../../utils/styled.js";import{flags as x}from"../../utils/flags.js";import{t as f}from"../../utils/l10n.js";import{Spinner as v}from"./spinner.js";import{deepEqual as b}from"../../utils/deep-equal.js";const w=h("div",o.forwardRef)`
|
|
2
|
+
display: flex;
|
|
3
|
+
position: relative;
|
|
4
|
+
border-radius: 15px;
|
|
5
|
+
|
|
6
|
+
&:hover {
|
|
7
|
+
.polotno-page-menu {
|
|
8
|
+
opacity: 1;
|
|
9
|
+
pointer-events: auto;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`,P=h("div")`
|
|
13
|
+
position: absolute;
|
|
14
|
+
z-index: 20;
|
|
15
|
+
top: 5px;
|
|
16
|
+
right: 5px;
|
|
17
|
+
opacity: 0;
|
|
18
|
+
pointer-events: none;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
`;let y=[],k=!1;const E=async()=>{if(k||0===y.length){return}k=!0;const{page:e,setPreview:t}=y.shift();try{t(await e.store.toDataURL({pageId:e.id,pixelRatio:.1,quickMode:!0}))}catch(o){o instanceof Error&&"string"==typeof o.message&&(o.message.includes("Canvas was unmounted.")||o.message.includes("<Workspace /> component is not mounted"))||console.error(o)}finally{k=!1}E()};export const usePagePreview=({page:e,ref:t})=>{const[i,s]=o.useState(null),a=o.useRef(!1);return o.useEffect(()=>{const o=()=>{y.push({page:e,setPreview:e=>s(e)}),E()};let i=null,l=null,d=Date.now();const c=()=>{i&&clearTimeout(i),a.current&&(l||(l=setTimeout(()=>{Date.now()-d>=6e3&&(o(),d=Date.now(),l=null)},6e3)),i=setTimeout(()=>{o(),d=Date.now(),i=null,l&&(clearTimeout(l),l=null)},300))};let p=null;const u=r(e,e=>{b(p,e)||(c(),p=e)}),g=n(()=>e.children.some(e=>e._editModeEnabled),e=>{e||c()}),m=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting?(a.current=!0,c()):(i&&clearTimeout(i),l&&clearTimeout(l),a.current=!1)})},{threshold:.1});return t.current&&m.observe(t.current),()=>{m.disconnect(),i&&clearTimeout(i),l&&clearTimeout(l),u(),g(),y=y.filter(t=>t.page!==e)}},[t,e]),i};export const PagePreview=i(({page:i,scale:n})=>{const r=i.store.activePage===i||i.store._selectedPagesIds.includes(i.id),h=o.useRef(null),b=i.store.pages.indexOf(i),y=60/i.computedHeight*i.computedWidth,k=x.animationsEnabled?i.duration*n:y,E=i.store.pages.length>1;o.useLayoutEffect(()=>{h.current&&(h.current.style.width=k+"px")},[b,k]);const I=usePagePreview({page:i,ref:h}),{handleStartDrag:R}=((e,t)=>({handleStartDrag:o.useCallback((o,i)=>{o.preventDefault();const n=o=>{if(o.preventDefault(),!t.current){return}const n="start"===i?7:-7,{clientX:r}=o,{left:s,width:a}=t.current.getBoundingClientRect(),l=(r-s-n)/a;"end"===i&&e.set({duration:Math.max(1e3,l*e.duration)})},r=()=>{window.removeEventListener("mousemove",n),window.removeEventListener("mouseup",r)};window.addEventListener("mousemove",n),window.addEventListener("mouseup",r)},[t,e])}))(i,h);return t(w,{style:{width:k+"px",marginRight:x.animationsEnabled?"0px":"10px",height:"60px"},ref:h,className:"polotno-page-container"+(r?" sortable-selected":""),children:[e("div",{style:{width:"100%",height:"100%",borderRadius:"15px",backgroundImage:I?`url("${I}")`:"none",backgroundRepeat:"repeat-x",backgroundSize:"auto 100%",backgroundColor:"white",display:"flex",justifyContent:"center",alignItems:"center"},onClick:e=>{const{store:t}=i,o=t._selectedPagesIds.length?t._selectedPagesIds:t.activePage?[t.activePage.id]:[],n=o.includes(i.id),r=e.shiftKey;if(r&&n){const e=o.filter(e=>e!==i.id);t.selectPages(e)}else if(r&&!n){const e=o.concat([i.id]);t.selectPages(e)}else{t.selectPages([i.id])}},children:!I&&e(v,{})}),e("div",{style:{position:"absolute",top:"0",left:"0px",bottom:"0px",right:"0px",borderRadius:"15px",border:r?"2px solid rgb(0, 161, 255, 0.9)":"2px solid lightgrey",zIndex:1,pointerEvents:"none"}}),x.animationsEnabled&&t("div",{style:{position:"absolute",zIndex:1,bottom:"5px",left:"5px",backgroundColor:"rgba(0, 0, 0, 0.5)",color:"white",padding:"2px 7px",textAlign:"center",borderRadius:"4rem"},children:[(i.duration/1e3).toFixed(1),"s"]}),x.animationsEnabled&&e("div",{style:{position:"absolute",zIndex:1,top:"50%",right:"0px",width:"8px",height:"50%",transform:"translateY(-50%) translateX(-3px)",borderRadius:"5px",border:"1px solid rgb(255, 255, 255, 0.6)",backgroundColor:"rgb(0, 0, 0, 0.6)",cursor:"ew-resize"},onMouseDown:e=>R(e,"end")}),r&&e(P,{className:"polotno-page-menu",onClick:e=>{e.stopPropagation()},children:e(d,{content:t(a,{style:{width:"140px"},children:[e(l,{icon:e(p,{}),text:f("pagesTimeline.duplicatePage"),onClick:()=>{const e=i.store,t=(e.selectedPages||[]).filter(Boolean),o=t.length?t:e.activePage?[e.activePage]:[];if(!o.length){return}const n=new Set(o.map(e=>e.id)),r=e.pages.filter(e=>n.has(e.id)),s=r[r.length-1],a=r.map(e=>e.clone()),l=e.pages.indexOf(s);a.forEach((e,t)=>{e.setZIndex(l+1+t)}),e.selectPages(a.map(e=>e.id))}}),e(l,{icon:e(u,{}),text:f("pagesTimeline.addPage"),onClick:()=>{var e,t,o;const n=i.store.addPage({bleed:(null===(e=i.store.activePage)||void 0===e?void 0:e.bleed)||0,width:(null===(t=i.store.activePage)||void 0===t?void 0:t.width)||"auto",height:(null===(o=i.store.activePage)||void 0===o?void 0:o.height)||"auto"}),r=i.store.pages.indexOf(i);n.setZIndex(r+1)}}),E&&e(l,{icon:e(m,{}),text:f("pagesTimeline.removePage"),onClick:()=>{const e=i.store,t=(e.selectedPages||[]).filter(Boolean),o=t.length?t.map(e=>e.id):e.activePage?[e.activePage.id]:[];o.length&&e.deletePages(o)}})]}),position:c.TOP,children:e(s,{icon:e(g,{}),style:{minHeight:"20px",borderRadius:"10px"}})})})]})});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import '../blueprint-guard';
|
|
2
|
+
import { StoreType } from '../../model/store.js';
|
|
3
|
+
export declare const PagesTimeline: (({ store, defaultOpened, }: {
|
|
4
|
+
store: StoreType;
|
|
5
|
+
defaultOpened?: boolean;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import"../blueprint-guard";import n from"react";import{observer as o}from"mobx-react-lite";import{Button as r,Navbar as s}from"@blueprintjs/core";import{Plus as a,Play as l}from"@blueprintjs/icons";import d from"../../utils/styled.js";import{flags as m}from"../../utils/flags.js";import{t as p}from"../../utils/l10n.js";import{Pages as c}from"./pages.js";import{CurrentTime as u}from"./current-time.js";import{Audios as h}from"./audios.js";import{ElementsTimeline as v}from"./elements.js";import{PlayButton as f}from"./play-button.js";import{TimeRuler as g}from"./time-ruler.js";const b=d("div")`
|
|
2
|
+
position: relative;
|
|
3
|
+
height: 0px;
|
|
4
|
+
`,x=d("div")`
|
|
5
|
+
position: absolute;
|
|
6
|
+
bottom: 5px;
|
|
7
|
+
width: auto;
|
|
8
|
+
left: 5px;
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
box-shadow: 0 0 4px lightgrey;
|
|
11
|
+
border-radius: 5px;
|
|
12
|
+
z-index: 1;
|
|
13
|
+
`,w=d("div")`
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 0;
|
|
16
|
+
left: 0px;
|
|
17
|
+
right: 0px;
|
|
18
|
+
height: 14px;
|
|
19
|
+
transform: translateY(-50%);
|
|
20
|
+
cursor: ns-resize;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
|
|
25
|
+
&::before {
|
|
26
|
+
content: '';
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 4px;
|
|
29
|
+
border-radius: 2px;
|
|
30
|
+
background: rgba(0, 0, 0, 0);
|
|
31
|
+
transition: background 0.2s;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:hover::before,
|
|
35
|
+
&.active::before {
|
|
36
|
+
background: var(--polotno-accent-color, #137cbd);
|
|
37
|
+
}
|
|
38
|
+
`;export const PagesTimeline=o(({store:o,defaultOpened:d=!1})=>{const y=n.useRef(null),[j,E]=n.useState(d),[k,L]=n.useState(.02),[C,M]=n.useState(()=>(e=>{if(!m.animationsEnabled){return 65}const t=e.pages.reduce((e,t)=>e+t.children.length,0),i=25*e.audios.length+20*t+140;return Math.min(Math.max(i,140),420)})(o)),[R,S]=n.useState(!1),P=n.useRef(0),z=n.useRef(C),D=n.useRef(!1),W=o.duration*k,Y=n.useCallback(e=>{if(!D.current){return}const t=e.clientY-P.current,i=z.current-t,n=Math.min(420,Math.max(140,i));M(n)},[]),N=n.useCallback(()=>{D.current&&(D.current=!1,S(!1),window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",N))},[Y]);return n.useEffect(()=>()=>{window.removeEventListener("mousemove",Y),window.removeEventListener("mouseup",N)},[Y,N]),t(i,{children:[e(b,{children:e(x,{children:e(s,{style:{height:"35px",padding:"0 5px"},children:e(s.Group,{style:{height:"35px"},children:e(r,{minimal:!0,onClick:()=>{E(!j)},icon:m.animationsEnabled&&!j?e(l,{}):null,children:p("pagesTimeline.pages")})})})})}),t(s,{style:{padding:"5px",height:"auto",zIndex:1,position:"relative",overflow:"visible",display:j?"block":"none"},className:"polotno-pages-timeline",children:[m.animationsEnabled&&e(w,{onMouseDown:e=>{e.preventDefault(),P.current=e.clientY,z.current=C,D.current=!0,S(!0),window.addEventListener("mousemove",Y),window.addEventListener("mouseup",N)},className:R?"active":void 0,title:"Drag to adjust timeline height"}),m.animationsEnabled&&e("div",{style:{display:"flex",justifyContent:"center"},children:e(f,{store:o,scale:k,onScaleChange:L})}),e("div",{dir:"ltr",style:{width:"100%",position:"relative",height:C},children:e("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowX:"auto",padding:"0 24px"},ref:y,children:t("div",{style:{position:"relative",minWidth:m.animationsEnabled?W+"px":void 0},children:[m.animationsEnabled&&e(g,{store:o,scale:k,minWidth:W}),t("div",{style:{position:"relative",display:"flex"},children:[e("div",{style:{position:"relative",minWidth:m.animationsEnabled?W+"px":void 0,height:"60px"},children:e(c,{store:o,scale:k})}),e(r,{icon:e(a,{}),style:{width:"60px",marginLeft:"12px"},onClick:()=>{var e;o.addPage({bleed:(null===(e=o.activePage)||void 0===e?void 0:e.bleed)||0})},minimal:!0})]}),m.animationsEnabled&&t(i,{children:[e(v,{store:o,scale:k,width:W}),e(h,{store:o,scale:k,width:W})]}),m.animationsEnabled&&e(u,{store:o,scale:k,dragAreaRef:y,variant:"timeline"})]})})})]})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{observer as t}from"mobx-react-lite";import{ReactSortable as o}from"react-sortablejs";import{PagePreview as r}from"./page-preview.js";export const Pages=t(({store:t,scale:s})=>{const i=t.pages.map(e=>({id:e.id}));return e(o,{list:i,setList:e=>{e.forEach(({id:e},o)=>{const r=t.pages.find(t=>t.id===e);r&&t.pages.indexOf(r)!==o&&r.setZIndex(o)})},direction:"horizontal",style:{display:"flex",flexDirection:"row"},delay:500,delayOnTouchOnly:!0,className:"polotno-pages-container",children:i.map(({id:o})=>{const i=t.pages.find(e=>e.id===o);return i?e(r,{page:i,scale:s},o):null})})});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StoreType } from '../../model/store.js';
|
|
2
|
+
interface PlayButtonProps {
|
|
3
|
+
store: StoreType;
|
|
4
|
+
scale?: number;
|
|
5
|
+
onScaleChange?: (scale: number) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const PlayButton: (({ store, scale, onScaleChange }: PlayButtonProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
8
|
+
displayName: string;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import{jsxs as t,jsx as i}from"react/jsx-runtime";import{observer as e}from"mobx-react-lite";import{Button as n,ButtonGroup as o}from"@blueprintjs/core";import{Pause as l,Play as a}from"@blueprintjs/icons";import r from"../../utils/styled.js";const s=r("div")`
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: 1fr auto 1fr;
|
|
4
|
+
align-items: center;
|
|
5
|
+
width: 100%;
|
|
6
|
+
gap: 12px;
|
|
7
|
+
`,c=r("div")`
|
|
8
|
+
display: flex;
|
|
9
|
+
justify-content: flex-end;
|
|
10
|
+
`,m=r("div")`
|
|
11
|
+
display: inline-flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
`,d=r("div")`
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: flex-end;
|
|
19
|
+
gap: 6px;
|
|
20
|
+
`,p=r("div")`
|
|
21
|
+
font-size: 13px;
|
|
22
|
+
font-weight: 500;
|
|
23
|
+
font-variant-numeric: tabular-nums;
|
|
24
|
+
`,f=t=>{const i=Math.floor(t/6e4),e=Math.floor(t%6e4/1e3);return`${i.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`};export const PlayButton=e(({store:e,scale:r,onScaleChange:g})=>{var u;const y=(null===(u=e.activePage)||void 0===u?void 0:u.startTime)||0,h=e.isPlaying||0!==e.currentTime?e.currentTime:y;return t(s,{children:[i(c,{children:t(p,{style:{opacity:.85,textAlign:"right"},children:[f(h)," / ",f(e.duration)]})}),i(m,{className:"polotno-play-button-container",children:i(n,{icon:e.isPlaying?i(l,{size:25}):i(a,{size:25}),minimal:!0,onClick:()=>{var t;if(e.isPlaying){const t=e.activePage;e.stop(),t&&e.selectPage(t.id)}else{e.play({startTime:(null===(t=e.activePage)||void 0===t?void 0:t.startTime)||0})}}})}),g&&r&&t(d,{children:[i(p,{style:{opacity:.6,fontSize:"12px"},children:"Zoom timeline"}),t(o,{minimal:!0,children:[i(n,{icon:i("span",{style:{fontWeight:"bold"},children:"−"}),onClick:()=>{g&&r&&g(Math.max(r/1.5,.005))},title:"Zoom out timeline"}),i(n,{icon:i("span",{style:{fontWeight:"bold"},children:"+"}),onClick:()=>{g&&r&&g(Math.min(1.5*r,.2))},title:"Zoom in timeline"})]})]})]})});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Spinner: any;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import r from"../../utils/styled.js";export const Spinner=r("div")`
|
|
2
|
+
border: 4px solid rgba(0, 0, 0, 0.1);
|
|
3
|
+
border-left-color: #09f;
|
|
4
|
+
border-radius: 50%;
|
|
5
|
+
width: 24px;
|
|
6
|
+
height: 24px;
|
|
7
|
+
animation: spin 1s linear infinite;
|
|
8
|
+
|
|
9
|
+
@keyframes spin {
|
|
10
|
+
to {
|
|
11
|
+
transform: rotate(360deg);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import n from"react";import{observer as o}from"mobx-react-lite";import r from"../../utils/styled.js";const i=r("div",n.forwardRef)`
|
|
2
|
+
position: relative;
|
|
3
|
+
height: 24px;
|
|
4
|
+
user-select: none;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
color: inherit;
|
|
7
|
+
`,a=r("div")`
|
|
8
|
+
margin-top: 4px;
|
|
9
|
+
font-size: 11px;
|
|
10
|
+
font-variant-numeric: tabular-nums;
|
|
11
|
+
text-align: center;
|
|
12
|
+
opacity: 0.7;
|
|
13
|
+
`;export const TimeRuler=o(({store:o,scale:r,minWidth:s=0})=>{const l=n.useRef(null),c=Math.max(o.duration,0),u=Math.max(1,Math.ceil(c/1e3)),d=Math.max(c*r,s,120),m=1/(1/(1e3*r)),h=[1,2,5,10,15,30,60,120,300,600],v=h.find(e=>e*m>=70)||h[h.length-1],p=Math.max(1,Math.ceil(20/m)),w=n.useCallback(e=>Math.max(0,Math.min(e,o.duration)),[o.duration]),f=n.useCallback(e=>{var t;if(!l.current){return}const n=l.current.getBoundingClientRect(),i=Math.min(Math.max(e-n.left,0),n.width),a=w(i/r);o.setCurrentTime(a),null===(t=o.checkActivePage)||void 0===t||t.call(o)},[w,r,o]),x=n.useCallback(e=>{f(e);const t=e=>{e.preventDefault(),f(e.clientX)},n=()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",t),window.addEventListener("mouseup",n)},[f]),g=n.useCallback(e=>{f(e);const t=e=>{const t=e.touches[0];t&&(e.preventDefault(),f(t.clientX))},n=()=>{window.removeEventListener("touchmove",t),window.removeEventListener("touchend",n),window.removeEventListener("touchcancel",n)};window.addEventListener("touchmove",t,{passive:!1}),window.addEventListener("touchend",n),window.addEventListener("touchcancel",n)},[f]),M=n.useCallback(e=>{e.preventDefault(),x(e.clientX)},[x]),b=n.useCallback(e=>{const t=e.touches[0];t&&(e.preventDefault(),g(t.clientX))},[g]);return e(i,{ref:l,className:"polotno-time-ruler",onMouseDown:M,onTouchStart:b,style:{minWidth:d+"px",width:d+"px",touchAction:"none"},children:Array.from({length:u+1},(n,o)=>{const i=o%v===0,s=o%p===0&&!i;return i||s?t("div",{style:{position:"absolute",left:1e3*o*r+"px",top:0,transform:"translateX(-50%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",gap:4,pointerEvents:"none"},children:[s&&e("div",{style:{width:4,height:4,borderRadius:"50%",backgroundColor:"currentColor",opacity:.5}}),i&&e(a,{children:o<60?`${o}s`:`${Math.floor(o/60)}m${o%60?o%60+"s":""}`})]},o):null})})});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const TrackLabel: any;
|
|
2
|
+
export declare const WaveformSvg: any;
|
|
3
|
+
export declare const TrackWrapper: any;
|
|
4
|
+
export declare const TrackContainer: any;
|
|
5
|
+
export declare const TrackMenu: any;
|
|
6
|
+
export declare const TrackHandleLeft: any;
|
|
7
|
+
export declare const TrackHandleRight: any;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import o from"../../utils/styled.js";export const TrackLabel=o("div")`
|
|
2
|
+
position: absolute;
|
|
3
|
+
inset: 0 0 0 0;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
padding: 0 12px;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
font-size: 11px;
|
|
9
|
+
font-weight: 500;
|
|
10
|
+
color: rgba(0, 0, 0, 0.75);
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
text-overflow: ellipsis;
|
|
14
|
+
|
|
15
|
+
.bp6-dark & {
|
|
16
|
+
color: rgba(255, 255, 255, 0.92);
|
|
17
|
+
}
|
|
18
|
+
`;export const WaveformSvg=o("svg")`
|
|
19
|
+
& path {
|
|
20
|
+
fill: rgba(0, 0, 0, 0.5);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.bp6-dark & path {
|
|
24
|
+
fill: rgba(255, 255, 255, 0.7);
|
|
25
|
+
}
|
|
26
|
+
`;export const TrackWrapper=o("div")`
|
|
27
|
+
position: absolute;
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
.polotno-track-menu {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
pointer-events: auto;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;export const TrackContainer=o("div")`
|
|
36
|
+
position: absolute;
|
|
37
|
+
border-radius: 10px;
|
|
38
|
+
color: rgba(0, 161, 255, 0.85);
|
|
39
|
+
background: linear-gradient(
|
|
40
|
+
135deg,
|
|
41
|
+
rgba(0, 161, 255, 0.15),
|
|
42
|
+
rgba(0, 161, 255, 0.35)
|
|
43
|
+
);
|
|
44
|
+
border: 1px solid rgba(0, 120, 200, 0.55);
|
|
45
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
46
|
+
cursor: move;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
`;export const TrackMenu=o("div")`
|
|
49
|
+
position: absolute;
|
|
50
|
+
z-index: 20;
|
|
51
|
+
top: 50%;
|
|
52
|
+
right: 12px;
|
|
53
|
+
opacity: 0;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
transform: translateY(-50%);
|
|
56
|
+
`;const e=o("div")`
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 1px;
|
|
59
|
+
width: 12px;
|
|
60
|
+
height: calc(100% - 2px);
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: center;
|
|
64
|
+
cursor: ew-resize;
|
|
65
|
+
pointer-events: auto;
|
|
66
|
+
|
|
67
|
+
&::before {
|
|
68
|
+
content: '';
|
|
69
|
+
width: 8px;
|
|
70
|
+
height: 75%;
|
|
71
|
+
border-radius: 4px;
|
|
72
|
+
border: 1px solid rgba(255, 255, 255, 0.6);
|
|
73
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
74
|
+
}
|
|
75
|
+
`;export const TrackHandleLeft=o(e)`
|
|
76
|
+
left: 0;
|
|
77
|
+
`;export const TrackHandleRight=o(e)`
|
|
78
|
+
right: 0;
|
|
79
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function generateWaveformData(audioUrl: string): Promise<number[]>;
|
|
2
|
+
export declare function createFullWaveformPath(samples: number[], height: number): {
|
|
3
|
+
path: string;
|
|
4
|
+
width: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function useWaveformData(src: string): {
|
|
7
|
+
data: number[] | null;
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
error: Error | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function useWaveformPath(data: number[] | null, height?: number): {
|
|
12
|
+
path: string;
|
|
13
|
+
width: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"react";const e={};let a=null;export async function generateWaveformData(t){if(e[t]){return e[t]}const r="undefined"==typeof window?null:(a=a||new AudioContext,a);if(!r){return[]}const n=await fetch(t),o=await n.arrayBuffer(),l=(await r.decodeAudioData(o)).getChannelData(0),u=Math.max(1,Math.floor(l.length/500)),f=new Array(500).fill(0);for(let e=0;e<500;e++){let t=0;const a=e*u;for(let e=0;e<u&&a+e<l.length;e++){t=Math.max(t,Math.abs(l[a+e]))}f[e]=t}const h=Math.max(...f)||1,i=f.map(t=>Number((t/h).toFixed(4)));return e[t]=i,i}export function createFullWaveformPath(t,e){if(!t.length||e<=0){return{path:"",width:0}}const a=e/2,r=Math.max(1,t.length-1);let n="";for(let o=0;o<t.length;o++){const e=o,r=a-t[o]*a;n+=0===o?`M ${e},${r}`:` L ${e},${r}`}for(let o=t.length-1;o>=0;o--){n+=` L ${o},${a+t[o]*a}`}return n+=" Z",{path:n,width:r}}export function useWaveformData(e){const[a,r]=t.useState(null),[n,o]=t.useState(!1),[l,u]=t.useState(null);return t.useEffect(()=>{e?(o(!0),generateWaveformData(e).then(t=>{r(t),o(!1)}).catch(t=>{console.error("Error generating waveform:",t),u(t),o(!1)})):r(null)},[e]),{data:a,isLoading:n,error:l}}export function useWaveformPath(e,a=20){return t.useMemo(()=>e?createFullWaveformPath(e,a):{path:"",width:0},[e,a])}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import i from"react";import{observer as o}from"mobx-react-lite";import{InputGroup as r,Button as n}from"@blueprintjs/core";import{getKey as a}from"../../utils/validate-key.js";import{getImageSize as s}from"../../utils/image.js";import{ImagesGrid as l}from"./images-grid.js";import{getAPI as m}from"../../utils/api.js";export const AiImagesPanel=o(({store:o})=>{const p=i.useRef(null),[d,c]=i.useState(null),[g,u]=i.useState(!1),f=async()=>{u(!0),c(null);const e=await fetch(`${m()}/get-stable-diffusion?KEY=${a()}&prompt=${p.current.value}`);if(u(!1),!e.ok){return void alert("Something went wrong, please try again later...")}const t=await e.json();c(t.output[0])};return t("div",{style:{height:"100%",display:"flex",flexDirection:"column"},children:[e("div",{style:{padding:"15px 0"},children:"Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input"}),e(r,{placeholder:"Type your image generation prompt here...",onKeyDown:e=>{"Enter"===e.key&&f()},style:{marginBottom:"20px"},inputRef:p}),e(n,{onClick:f,intent:"primary",loading:g,style:{marginBottom:"40px"},children:"Generate"}),d&&e(l,{shadowEnabled:!1,images:d?[d]:[],getPreview:e=>e,isLoading:g,onSelect:async(e,t,i)=>{var r;const n=e;if(i&&"svg"===i.type&&i.contentEditable){return void i.set({maskSrc:n})}if(i&&"image"===i.type&&i.contentEditable){return void i.set({src:n})}const{width:a,height:l}=await s(n),m=((null==t?void 0:t.x)||o.width/2)-a/2,p=((null==t?void 0:t.y)||o.height/2)-l/2;null===(r=o.activePage)||void 0===r||r.addElement({type:"image",src:n,width:a,height:l,x:m,y:p})},rowsNumber:1})]})});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StoreType } from '../../model/store.js';
|
|
2
|
+
export declare const NumberInput: ({ value, onValueChange, ...props }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
value: any;
|
|
5
|
+
onValueChange: any;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const AnimationsPanel: (({ store }: {
|
|
8
|
+
store: StoreType;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|