From efdae588322848f18e17589d858983d7641ff0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Johanson?= Date: Fri, 23 Aug 2024 15:54:59 +0200 Subject: [PATCH] feat: Merge upstream/master into b310-digital/excalidraw#master (#3) --- .dockerignore | 9 +- .env.development | 5 +- .env.production | 2 +- .eslintignore | 2 + .eslintrc.json | 3 +- .github/workflows/autorelease-excalidraw.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/size-limit.yml | 2 +- .github/workflows/test-coverage-pr.yml | 2 +- .github/workflows/test.yml | 10 +- .gitignore | 5 +- README.md | 7 +- .../excalidraw/api/props/excalidraw-api.mdx | 12 +- .../excalidraw/api/props/props.mdx | 8 +- .../excalidraw/api/props/ui-options.mdx | 4 +- .../excalidraw/api/utils/export.mdx | 2 +- .../@excalidraw/excalidraw/integration.mdx | 101 +- dev-docs/docs/codebase/json-schema.mdx | 2 +- dev-docs/package.json | 6 +- dev-docs/src/css/custom.scss | 2 +- dev-docs/yarn.lock | 8 +- docker-compose-prod.yml | 4 +- docker-compose.yml | 9 +- .../excalidraw/components}/App.scss | 21 +- .../excalidraw/components}/App.tsx | 300 +- .../excalidraw/components}/CustomFooter.tsx | 28 +- .../excalidraw/components/MobileFooter.tsx | 27 + .../components}/sidebar/ExampleSidebar.scss | 0 .../components}/sidebar/ExampleSidebar.tsx | 3 +- .../excalidraw}/initialData.tsx | 6 +- examples/excalidraw/package.json | 13 + examples/excalidraw/tsconfig.json | 3 + examples/excalidraw/utils.ts | 146 + examples/excalidraw/with-nextjs/.gitignore | 39 + examples/excalidraw/with-nextjs/README.md | 36 + .../excalidraw/with-nextjs/next.config.js | 12 + examples/excalidraw/with-nextjs/package.json | 26 + .../with-nextjs}/public/images/doremon.png | Bin .../with-nextjs}/public/images/excalibot.png | Bin .../with-nextjs}/public/images/pika.jpeg | Bin .../with-nextjs}/public/images/rocket.jpeg | Bin .../with-nextjs/src/app/favicon.ico | Bin 0 -> 25931 bytes .../excalidraw/with-nextjs/src/app/layout.tsx | 11 + .../excalidraw/with-nextjs/src/app/page.tsx | 26 + .../excalidraw/with-nextjs/src/common.scss | 15 + .../with-nextjs/src/excalidrawWrapper.tsx | 22 + .../src/pages/excalidraw-in-pages.tsx | 22 + examples/excalidraw/with-nextjs/tsconfig.json | 28 + examples/excalidraw/with-nextjs/vercel.json | 3 + examples/excalidraw/with-nextjs/yarn.lock | 252 + .../with-script-in-browser/.gitignore | 2 + .../with-script-in-browser}/index.html | 12 +- .../with-script-in-browser/index.tsx | 28 + .../with-script-in-browser/package.json | 21 + .../public/images/doremon.png | Bin 0 -> 201946 bytes .../public/images/excalibot.png | Bin 0 -> 30330 bytes .../public/images/pika.jpeg | Bin 0 -> 6250 bytes .../public/images/rocket.jpeg | Bin 0 -> 40368 bytes .../with-script-in-browser}/vercel.json | 2 +- .../with-script-in-browser/vite.config.mts | 11 + examples/excalidraw/yarn.lock | 313 + excalidraw-app/App.tsx | 572 +- excalidraw-app/CustomStats.tsx | 65 +- .../LanguageList.tsx | 5 +- .../app-language/language-detector.ts | 25 + excalidraw-app/app-language/language-state.ts | 15 + excalidraw-app/app_constants.ts | 6 +- excalidraw-app/collab/Collab.tsx | 267 +- excalidraw-app/collab/CollabError.scss | 35 + excalidraw-app/collab/CollabError.tsx | 54 + excalidraw-app/collab/Portal.tsx | 47 +- excalidraw-app/collab/RoomDialog.tsx | 31 +- excalidraw-app/collab/reconciliation.ts | 154 - excalidraw-app/components/AppMainMenu.tsx | 36 +- .../components/AppWelcomeScreen.tsx | 10 +- .../components/ExportToExcalidrawPlus.tsx | 12 +- excalidraw-app/components/GitHubCorner.tsx | 2 +- .../components/TopErrorBoundary.tsx | 2 + excalidraw-app/data/FileManager.ts | 6 +- excalidraw-app/data/LocalData.ts | 68 +- excalidraw-app/data/StorageBackend.ts | 13 +- excalidraw-app/data/config.ts | 104 +- excalidraw-app/data/firebase.ts | 66 +- excalidraw-app/data/httpStorage.ts | 116 +- excalidraw-app/data/index.ts | 54 +- excalidraw-app/data/localStorage.ts | 22 +- excalidraw-app/index.html | 110 +- excalidraw-app/index.scss | 14 +- excalidraw-app/package.json | 23 +- .../ShareDialog.scss} | 29 +- excalidraw-app/share/ShareDialog.tsx | 300 + .../__snapshots__/MobileMenu.test.tsx.snap | 24 +- excalidraw-app/tests/collab.test.tsx | 228 +- excalidraw-app/tests/reconciliation.test.ts | 421 - excalidraw-app/useHandleAppTheme.ts | 70 + excalidraw-app/vite.config.mts | 14 + package.json | 36 +- packages/excalidraw/.gitignore | 2 - packages/excalidraw/CHANGELOG.md | 80 +- .../excalidraw/actions/actionAddToLibrary.ts | 9 +- packages/excalidraw/actions/actionAlign.tsx | 41 +- .../excalidraw/actions/actionBoundText.tsx | 62 +- packages/excalidraw/actions/actionCanvas.tsx | 123 +- .../excalidraw/actions/actionClipboard.tsx | 57 +- .../actions/actionDeleteSelected.tsx | 62 +- .../excalidraw/actions/actionDistribute.tsx | 20 +- .../actions/actionDuplicateSelection.tsx | 38 +- .../actions/actionElementLock.test.tsx | 1 + .../excalidraw/actions/actionElementLock.ts | 60 +- packages/excalidraw/actions/actionExport.tsx | 57 +- .../excalidraw/actions/actionFinalize.tsx | 45 +- packages/excalidraw/actions/actionFlip.ts | 69 +- packages/excalidraw/actions/actionFrame.ts | 38 +- packages/excalidraw/actions/actionGroup.tsx | 57 +- packages/excalidraw/actions/actionHistory.tsx | 161 +- .../excalidraw/actions/actionLinearEditor.ts | 45 - .../excalidraw/actions/actionLinearEditor.tsx | 77 + packages/excalidraw/actions/actionLink.tsx | 55 + packages/excalidraw/actions/actionMenu.tsx | 13 +- .../excalidraw/actions/actionNavigate.tsx | 106 +- .../actions/actionProperties.test.tsx | 29 +- .../excalidraw/actions/actionProperties.tsx | 819 +- .../excalidraw/actions/actionSelectAll.ts | 12 +- packages/excalidraw/actions/actionStyles.ts | 39 +- .../actions/actionTextAutoResize.ts | 48 + .../actions/actionToggleGridMode.tsx | 19 +- .../actions/actionToggleObjectsSnapMode.tsx | 11 +- .../excalidraw/actions/actionToggleStats.tsx | 13 +- .../actions/actionToggleViewMode.tsx | 8 +- .../actions/actionToggleZenMode.tsx | 8 +- packages/excalidraw/actions/actionZindex.tsx | 26 +- packages/excalidraw/actions/index.ts | 2 +- packages/excalidraw/actions/manager.tsx | 16 +- packages/excalidraw/actions/register.ts | 2 +- packages/excalidraw/actions/shortcuts.ts | 41 +- packages/excalidraw/actions/types.ts | 52 +- packages/excalidraw/align.ts | 12 +- packages/excalidraw/analytics.ts | 17 +- packages/excalidraw/animated-trail.ts | 149 + .../excalidraw/animation-frame-handler.ts | 79 + packages/excalidraw/appState.ts | 35 +- packages/excalidraw/assets/lock.svg | 20 - packages/excalidraw/binaryheap.ts | 105 + packages/excalidraw/change.ts | 1538 ++ packages/excalidraw/charts.test.ts | 8 +- packages/excalidraw/charts.ts | 12 +- packages/excalidraw/clients.ts | 229 +- packages/excalidraw/clipboard.ts | 17 +- packages/excalidraw/colors.ts | 2 +- packages/excalidraw/components/Actions.scss | 1 + packages/excalidraw/components/Actions.tsx | 128 +- packages/excalidraw/components/App.tsx | 3234 ++- packages/excalidraw/components/Avatar.scss | 2 +- packages/excalidraw/components/Avatar.tsx | 15 +- packages/excalidraw/components/Button.tsx | 1 + .../excalidraw/components/ButtonIcon.scss | 12 + packages/excalidraw/components/ButtonIcon.tsx | 36 + .../components/ButtonIconSelect.tsx | 18 +- .../excalidraw/components/ButtonSeparator.tsx | 10 + packages/excalidraw/components/Card.scss | 2 +- .../excalidraw/components/CheckboxItem.scss | 2 +- .../excalidraw/components/CheckboxItem.tsx | 7 +- .../components/ColorPicker/ColorInput.tsx | 6 +- .../components/ColorPicker/ColorPicker.scss | 4 +- .../components/ColorPicker/ColorPicker.tsx | 206 +- .../components/ColorPicker/Picker.tsx | 8 +- .../ColorPicker/PickerColorList.tsx | 5 +- .../components/ColorPicker/PickerHeading.tsx | 2 +- .../components/ColorPicker/ShadeList.tsx | 2 +- .../components/ColorPicker/TopPicks.tsx | 2 +- .../ColorPicker/colorPickerUtils.ts | 9 +- .../ColorPicker/keyboardNavHandlers.ts | 9 +- .../CommandPalette/CommandPalette.scss | 137 + .../CommandPalette/CommandPalette.tsx | 936 + .../defaultCommandPaletteItems.ts | 11 + .../components/CommandPalette/types.ts | 26 + .../excalidraw/components/ConfirmDialog.scss | 2 +- .../excalidraw/components/ConfirmDialog.tsx | 3 +- .../excalidraw/components/ContextMenu.scss | 2 +- .../excalidraw/components/ContextMenu.tsx | 22 +- .../excalidraw/components/DarkModeToggle.tsx | 6 +- .../components/DefaultSidebar.test.tsx | 2 +- .../excalidraw/components/DefaultSidebar.tsx | 4 +- packages/excalidraw/components/Dialog.scss | 8 +- packages/excalidraw/components/Dialog.tsx | 33 +- .../components/DialogActionButton.tsx | 2 +- .../excalidraw/components/ExportDialog.scss | 2 +- packages/excalidraw/components/EyeDropper.tsx | 4 +- .../excalidraw/components/FilledButton.scss | 85 +- .../excalidraw/components/FilledButton.tsx | 50 +- .../components/FixedSideContainer.scss | 2 +- .../components/FollowMode/FollowMode.tsx | 35 +- .../components/FontPicker/FontPicker.scss | 15 + .../components/FontPicker/FontPicker.tsx | 110 + .../components/FontPicker/FontPickerList.tsx | 268 + .../FontPicker/FontPickerTrigger.tsx | 38 + .../FontPicker/keyboardNavHandlers.ts | 66 + .../excalidraw/components/HelpDialog.scss | 6 +- packages/excalidraw/components/HelpDialog.tsx | 47 +- .../excalidraw/components/HintViewer.scss | 3 +- packages/excalidraw/components/HintViewer.tsx | 54 +- .../excalidraw/components/IconPicker.scss | 2 +- packages/excalidraw/components/IconPicker.tsx | 2 + .../components/ImageExportDialog.scss | 4 +- .../components/ImageExportDialog.tsx | 34 +- .../excalidraw/components/InitializeApp.tsx | 5 +- packages/excalidraw/components/InlineIcon.tsx | 2 +- .../components/JSONExportDialog.tsx | 8 +- .../{LaserTool => }/LaserPointerButton.tsx | 6 +- .../components/LaserTool/LaserPathManager.ts | 310 - .../components/LaserTool/LaserTool.tsx | 27 - packages/excalidraw/components/LayerUI.scss | 9 +- packages/excalidraw/components/LayerUI.tsx | 46 +- .../excalidraw/components/LibraryMenu.scss | 2 +- .../excalidraw/components/LibraryMenu.tsx | 7 +- .../components/LibraryMenuBrowseButton.tsx | 2 +- .../components/LibraryMenuControlButtons.tsx | 2 +- .../components/LibraryMenuHeaderContent.tsx | 5 +- .../components/LibraryMenuItems.scss | 4 +- .../components/LibraryMenuItems.tsx | 2 +- .../components/LibraryMenuSection.tsx | 9 +- .../excalidraw/components/LibraryUnit.scss | 2 +- .../excalidraw/components/LibraryUnit.tsx | 5 +- .../excalidraw/components/LoadingMessage.tsx | 2 +- packages/excalidraw/components/LockButton.tsx | 2 +- .../excalidraw/components/MagicButton.tsx | 2 +- .../excalidraw/components/MagicSettings.tsx | 4 +- packages/excalidraw/components/MobileMenu.tsx | 22 +- packages/excalidraw/components/Modal.scss | 23 +- packages/excalidraw/components/Modal.tsx | 11 +- .../OverwriteConfirm/OverwriteConfirm.scss | 2 +- .../OverwriteConfirm/OverwriteConfirmState.ts | 2 +- .../components/PasteChartDialog.scss | 2 +- .../components/PasteChartDialog.tsx | 8 +- .../excalidraw/components/PenModeButton.tsx | 2 +- .../excalidraw/components/ProjectName.tsx | 27 +- .../components/PropertiesPopover.tsx | 96 + .../excalidraw/components/PublishLibrary.scss | 4 +- .../excalidraw/components/PublishLibrary.tsx | 7 +- .../excalidraw/components/QuickSearch.scss | 48 + .../excalidraw/components/QuickSearch.tsx | 28 + .../excalidraw/components/RadioGroup.scss | 2 +- packages/excalidraw/components/RadioGroup.tsx | 7 +- .../LaserToolOverlay.scss => SVGLayer.scss} | 10 +- packages/excalidraw/components/SVGLayer.tsx | 33 + .../excalidraw/components/ScrollableList.scss | 21 + .../excalidraw/components/ScrollableList.tsx | 24 + .../components/ShareableLinkDialog.scss | 6 +- .../components/ShareableLinkDialog.tsx | 25 +- .../components/Sidebar/Sidebar.scss | 2 +- .../components/Sidebar/Sidebar.test.tsx | 157 +- .../excalidraw/components/Sidebar/Sidebar.tsx | 7 +- .../components/Sidebar/SidebarTab.tsx | 4 +- .../components/Sidebar/SidebarTabTrigger.tsx | 2 +- .../components/Sidebar/SidebarTrigger.scss | 3 +- .../components/Sidebar/SidebarTrigger.tsx | 2 +- .../excalidraw/components/Sidebar/common.ts | 2 +- .../Sidebar/siderbar.test.helpers.tsx | 42 + packages/excalidraw/components/Stats.scss | 54 - packages/excalidraw/components/Stats.tsx | 108 - .../excalidraw/components/Stats/Angle.tsx | 94 + .../components/Stats/CanvasGrid.tsx | 67 + .../components/Stats/Collapsible.tsx | 43 + .../excalidraw/components/Stats/Dimension.tsx | 138 + .../components/Stats/DragInput.scss | 76 + .../excalidraw/components/Stats/DragInput.tsx | 327 + .../excalidraw/components/Stats/FontSize.tsx | 99 + .../components/Stats/MultiAngle.tsx | 135 + .../components/Stats/MultiDimension.tsx | 394 + .../components/Stats/MultiFontSize.tsx | 164 + .../components/Stats/MultiPosition.tsx | 271 + .../excalidraw/components/Stats/Position.tsx | 120 + .../excalidraw/components/Stats/Stats.scss | 72 + .../excalidraw/components/Stats/index.tsx | 393 + .../components/Stats/stats.test.tsx | 733 + packages/excalidraw/components/Stats/utils.ts | 322 + packages/excalidraw/components/Switch.scss | 2 +- .../TTDDialog/MermaidToExcalidraw.tsx | 14 +- .../components/TTDDialog/TTDDialog.scss | 4 +- .../components/TTDDialog/TTDDialog.tsx | 17 +- .../components/TTDDialog/TTDDialogInput.tsx | 3 +- .../components/TTDDialog/TTDDialogPanel.tsx | 2 +- .../components/TTDDialog/TTDDialogPanels.tsx | 2 +- .../components/TTDDialog/TTDDialogTabs.tsx | 3 +- .../components/TTDDialog/TTDDialogTrigger.tsx | 2 +- .../excalidraw/components/TTDDialog/common.ts | 33 +- packages/excalidraw/components/TextField.scss | 2 +- packages/excalidraw/components/TextField.tsx | 19 +- packages/excalidraw/components/TextInput.scss | 2 +- packages/excalidraw/components/Toast.scss | 2 +- packages/excalidraw/components/Toast.tsx | 4 + packages/excalidraw/components/ToolButton.tsx | 17 +- packages/excalidraw/components/ToolIcon.scss | 21 +- packages/excalidraw/components/Toolbar.scss | 2 +- packages/excalidraw/components/Tooltip.scss | 2 +- packages/excalidraw/components/Trans.test.tsx | 2 +- packages/excalidraw/components/Trans.tsx | 3 +- packages/excalidraw/components/UserList.scss | 178 +- packages/excalidraw/components/UserList.tsx | 243 +- .../components/canvases/InteractiveCanvas.tsx | 90 +- .../components/canvases/StaticCanvas.tsx | 35 +- .../components/dropdownMenu/DropdownMenu.scss | 90 +- .../dropdownMenu/DropdownMenu.test.tsx | 26 + .../dropdownMenu/DropdownMenuContent.tsx | 29 +- .../dropdownMenu/DropdownMenuItem.tsx | 92 +- .../dropdownMenu/DropdownMenuItemContent.tsx | 8 +- .../DropdownMenuItemContentRadio.tsx | 51 + .../components/dropdownMenu/common.ts | 6 +- .../excalidraw/components/footer/Footer.tsx | 4 +- .../hoc/withInternalFallback.test.tsx | 1 + .../hyperlink}/Hyperlink.scss | 2 +- .../hyperlink}/Hyperlink.tsx | 228 +- .../components/hyperlink/helpers.ts | 90 + packages/excalidraw/components/icons.tsx | 559 +- .../LiveCollaborationTrigger.scss | 10 +- .../LiveCollaborationTrigger.tsx | 8 +- .../components/main-menu/DefaultItems.tsx | 148 +- .../welcome-screen/WelcomeScreen.Center.tsx | 4 +- .../welcome-screen/WelcomeScreen.Hints.tsx | 6 +- .../welcome-screen/WelcomeScreen.scss | 23 +- packages/excalidraw/constants.ts | 72 +- packages/excalidraw/context/ui-appState.ts | 2 +- packages/excalidraw/css/styles.scss | 30 +- packages/excalidraw/css/theme.scss | 11 +- packages/excalidraw/css/variables.module.scss | 36 +- packages/excalidraw/cursor.ts | 2 +- .../excalidraw/data/EditorLocalStorage.ts | 4 +- .../data/__snapshots__/transform.test.ts.snap | 849 +- packages/excalidraw/data/blob.ts | 47 +- packages/excalidraw/data/filesystem.ts | 4 +- packages/excalidraw/data/index.ts | 66 +- packages/excalidraw/data/json.ts | 11 +- packages/excalidraw/data/library.ts | 515 +- packages/excalidraw/data/magic.ts | 9 +- packages/excalidraw/data/reconcile.ts | 118 + packages/excalidraw/data/resave.ts | 7 +- packages/excalidraw/data/restore.ts | 233 +- packages/excalidraw/data/transform.test.ts | 227 +- packages/excalidraw/data/transform.ts | 65 +- packages/excalidraw/data/types.ts | 6 +- packages/excalidraw/data/url.ts | 6 +- packages/excalidraw/deburr.ts | 93 + packages/excalidraw/distribute.ts | 5 +- .../element/ElementCanvasButtons.tsx | 13 +- packages/excalidraw/element/binding.ts | 2125 +- packages/excalidraw/element/bounds.test.ts | 64 +- packages/excalidraw/element/bounds.ts | 91 +- packages/excalidraw/element/collision.ts | 1157 +- packages/excalidraw/element/containerCache.ts | 33 + packages/excalidraw/element/dragElements.ts | 111 +- packages/excalidraw/element/embeddable.ts | 241 +- .../excalidraw/element/flowchart.test.tsx | 404 + packages/excalidraw/element/flowchart.ts | 698 + packages/excalidraw/element/heading.ts | 146 + packages/excalidraw/element/image.ts | 7 +- packages/excalidraw/element/index.ts | 36 +- .../excalidraw/element/linearElementEditor.ts | 525 +- packages/excalidraw/element/mutateElement.ts | 17 +- .../excalidraw/element/newElement.test.ts | 9 +- packages/excalidraw/element/newElement.ts | 142 +- packages/excalidraw/element/resizeElements.ts | 583 +- packages/excalidraw/element/resizeTest.ts | 116 +- packages/excalidraw/element/routing.test.tsx | 195 + packages/excalidraw/element/routing.ts | 1020 + .../element/showSelectedShapeActions.ts | 4 +- packages/excalidraw/element/sizeHelpers.ts | 55 +- .../excalidraw/element/sortElements.test.ts | 2 +- packages/excalidraw/element/sortElements.ts | 2 +- .../excalidraw/element/textElement.test.ts | 16 +- packages/excalidraw/element/textElement.ts | 428 +- .../excalidraw/element/textWysiwyg.test.tsx | 430 +- packages/excalidraw/element/textWysiwyg.tsx | 276 +- .../excalidraw/element/transformHandles.ts | 80 +- packages/excalidraw/element/typeChecks.ts | 75 +- packages/excalidraw/element/types.ts | 127 +- packages/excalidraw/emitter.ts | 21 +- packages/excalidraw/entry.js | 7 - packages/excalidraw/{env.js => env.cjs} | 0 packages/excalidraw/errors.ts | 4 + packages/excalidraw/example/MobileFooter.tsx | 20 - packages/excalidraw/example/index.tsx | 16 - packages/excalidraw/fonts/ExcalidrawFont.ts | 159 + .../fonts/assets}/Assistant-Bold.woff2 | Bin .../fonts/assets}/Assistant-Medium.woff2 | Bin .../fonts/assets/Assistant-Regular.woff2 | Bin 0 -> 20232 bytes .../fonts/assets}/Assistant-SemiBold.woff2 | Bin .../fonts/assets/CascadiaCode-Regular.woff2 | Bin 0 -> 65732 bytes .../fonts/assets/ComicShanns-Regular.woff2 | Bin 0 -> 16856 bytes .../fonts/assets/Excalifont-Regular.woff2 | Bin 0 -> 52296 bytes .../fonts/assets/LiberationSans-Regular.woff2 | Bin 0 -> 70668 bytes .../fonts/assets/Virgil-Regular.woff2 | Bin 0 -> 56156 bytes packages/excalidraw/fonts/assets/fonts.css | 35 + packages/excalidraw/fonts/index.ts | 359 + packages/excalidraw/fonts/metadata.ts | 128 + packages/excalidraw/fractionalIndex.ts | 411 + packages/excalidraw/frame.test.tsx | 77 +- packages/excalidraw/frame.ts | 339 +- packages/excalidraw/gadirections.ts | 2 +- packages/excalidraw/galines.ts | 2 +- packages/excalidraw/gapoints.ts | 3 +- packages/excalidraw/gatransforms.ts | 2 +- packages/excalidraw/gesture.ts | 2 +- packages/excalidraw/global.d.ts | 5 +- packages/excalidraw/groups.ts | 50 +- packages/excalidraw/history.ts | 429 +- .../hooks/useCreatePortalContainer.ts | 3 +- packages/excalidraw/hooks/useEmitter.ts | 21 + .../excalidraw/hooks/useLibraryItemSvg.ts | 2 +- .../excalidraw/hooks/useStableCallback.ts | 18 + packages/excalidraw/i18n.ts | 6 +- packages/excalidraw/index.tsx | 51 +- packages/excalidraw/jotai.ts | 3 +- packages/excalidraw/keys.ts | 1 + packages/excalidraw/laser-trails.ts | 128 + packages/excalidraw/locales/en.json | 101 +- packages/excalidraw/main.js | 11 - packages/excalidraw/math.test.ts | 46 +- packages/excalidraw/math.ts | 210 +- packages/excalidraw/mermaid.test.ts | 15 + packages/excalidraw/mermaid.ts | 33 + packages/excalidraw/package.json | 71 +- packages/excalidraw/points.ts | 2 +- packages/excalidraw/publicPath.js | 8 - packages/excalidraw/queue.test.ts | 62 + packages/excalidraw/queue.ts | 46 + packages/excalidraw/reactUtils.ts | 61 + packages/excalidraw/renderer/helpers.ts | 75 + .../{renderScene.ts => interactiveScene.ts} | 1923 +- packages/excalidraw/renderer/renderElement.ts | 881 +- packages/excalidraw/renderer/renderSnaps.ts | 7 +- packages/excalidraw/renderer/staticScene.ts | 438 + .../excalidraw/renderer/staticSvgScene.ts | 682 + packages/excalidraw/scene/Fonts.ts | 94 - packages/excalidraw/scene/Renderer.ts | 86 +- packages/excalidraw/scene/Scene.ts | 207 +- packages/excalidraw/scene/Shape.ts | 98 +- packages/excalidraw/scene/ShapeCache.ts | 10 +- packages/excalidraw/scene/comparisons.ts | 10 +- packages/excalidraw/scene/export.ts | 208 +- packages/excalidraw/scene/index.ts | 7 +- packages/excalidraw/scene/normalize.ts | 15 + packages/excalidraw/scene/scroll.ts | 4 +- packages/excalidraw/scene/scrollbars.ts | 8 +- packages/excalidraw/scene/selection.ts | 44 +- packages/excalidraw/scene/types.ts | 49 +- packages/excalidraw/scene/zoom.ts | 7 +- packages/excalidraw/shapes.tsx | 92 + packages/excalidraw/snapping.ts | 129 +- packages/excalidraw/store.ts | 442 + packages/excalidraw/tests/App.test.tsx | 5 +- .../tests/MermaidToExcalidraw.test.tsx | 64 +- .../MermaidToExcalidraw.test.tsx.snap | 11 +- .../__snapshots__/contextmenu.test.tsx.snap | 8183 ++++--- .../__snapshots__/dragCreate.test.tsx.snap | 31 +- .../__snapshots__/excalidraw.test.tsx.snap | 109 +- .../tests/__snapshots__/export.test.tsx.snap | 15 +- .../tests/__snapshots__/history.test.tsx.snap | 19940 ++++++++++++++++ .../linearElementEditor.test.tsx.snap | 47 +- .../tests/__snapshots__/move.test.tsx.snap | 115 +- .../multiPointCreate.test.tsx.snap | 13 +- .../regressionTests.test.tsx.snap | 19160 +++++++-------- .../__snapshots__/selection.test.tsx.snap | 31 +- .../excalidraw/tests/actionStyles.test.tsx | 1 + packages/excalidraw/tests/align.test.tsx | 59 +- packages/excalidraw/tests/appState.test.tsx | 10 +- packages/excalidraw/tests/binding.test.tsx | 180 +- packages/excalidraw/tests/clipboard.test.tsx | 274 +- .../excalidraw/tests/contextmenu.test.tsx | 79 +- .../data/__snapshots__/restore.test.ts.snap | 65 +- .../excalidraw/tests/data/reconcile.test.ts | 372 + .../excalidraw/tests/data/restore.test.ts | 52 +- packages/excalidraw/tests/dragCreate.test.tsx | 13 +- .../excalidraw/tests/elementLocking.test.tsx | 37 +- packages/excalidraw/tests/excalidraw.test.tsx | 18 +- packages/excalidraw/tests/export.test.tsx | 13 +- .../excalidraw/tests/fitToContent.test.tsx | 44 +- .../tests/fixtures/diagramFixture.ts | 2 +- .../tests/fixtures/elementFixture.ts | 19 +- packages/excalidraw/tests/flip.test.tsx | 209 +- .../excalidraw/tests/fractionalIndex.test.ts | 807 + packages/excalidraw/tests/helpers/api.ts | 100 +- packages/excalidraw/tests/helpers/colorize.ts | 2 + packages/excalidraw/tests/helpers/mocks.ts | 32 + .../excalidraw/tests/helpers/polyfills.ts | 4 + packages/excalidraw/tests/helpers/ui.ts | 90 +- packages/excalidraw/tests/history.test.tsx | 5075 +++- packages/excalidraw/tests/library.test.tsx | 27 +- .../tests/linearElementEditor.test.tsx | 466 +- packages/excalidraw/tests/move.test.tsx | 51 +- .../tests/multiPointCreate.test.tsx | 13 +- .../excalidraw/tests/packages/events.test.tsx | 11 +- packages/excalidraw/tests/queries/dom.ts | 2 +- .../excalidraw/tests/queries/toolQueries.ts | 2 +- .../excalidraw/tests/regressionTests.test.tsx | 62 +- packages/excalidraw/tests/resize.test.tsx | 189 +- packages/excalidraw/tests/rotate.test.tsx | 5 +- .../scene/__snapshots__/export.test.ts.snap | 121 +- .../excalidraw/tests/scene/export.test.ts | 97 +- packages/excalidraw/tests/scroll.test.tsx | 7 +- packages/excalidraw/tests/selection.test.tsx | 23 +- packages/excalidraw/tests/shortcuts.test.tsx | 3 +- packages/excalidraw/tests/test-utils.ts | 68 +- packages/excalidraw/tests/tool.test.tsx | 17 +- packages/excalidraw/tests/viewMode.test.tsx | 9 +- packages/excalidraw/tests/zindex.test.tsx | 102 +- packages/excalidraw/tsconfig-types.json | 20 - packages/excalidraw/tsconfig.json | 15 + packages/excalidraw/types.ts | 195 +- packages/excalidraw/utility-types.ts | 11 + packages/excalidraw/utils.ts | 227 +- packages/excalidraw/vite-env.d.ts | 1 + .../excalidraw/webpack.dev-server.config.js | 28 - packages/excalidraw/webpack.dev.config.js | 108 - packages/excalidraw/webpack.preact.config.js | 32 - packages/excalidraw/webpack.prod.config.js | 131 - packages/excalidraw/zindex.ts | 94 +- .../utils/__snapshots__/export.test.ts.snap | 15 +- packages/utils/bbox.ts | 4 +- packages/utils/collision.ts | 66 + packages/utils/export.ts | 25 +- packages/utils/geometry/geometry.test.ts | 249 + packages/utils/geometry/geometry.ts | 1060 + packages/utils/geometry/shape.ts | 321 + packages/utils/global.d.ts | 3 + packages/utils/index.js | 1 - packages/utils/index.ts | 4 + packages/utils/package.json | 46 +- packages/utils/tsconfig.json | 16 + packages/utils/utils.unmocked.test.ts | 6 +- packages/utils/withinBounds.test.ts | 2 +- packages/utils/withinBounds.ts | 6 +- public/Cascadia.ttf | Bin 213476 -> 0 bytes public/FG_Virgil.ttf | Bin 236876 -> 0 bytes public/FG_Virgil.woff2 | Bin 119508 -> 0 bytes public/fonts.css | 38 - public/{og-image-2.png => og-image-3.png} | Bin scripts/autorelease.js | 8 +- scripts/buildExample.mjs | 36 + scripts/buildPackage.js | 133 + scripts/buildUtils.js | 131 + scripts/release.js | 6 +- scripts/woff2/assets/NotoEmoji-Regular.ttf | Bin 0 -> 836652 bytes scripts/woff2/woff2-esbuild-plugins.js | 269 + scripts/woff2/woff2-vite-plugins.js | 132 + setupTests.ts | 95 + tsconfig.json | 2 +- vercel.json | 28 +- vitest.config.mts | 5 +- yarn.lock | 7595 +++--- 549 files changed, 79065 insertions(+), 30661 deletions(-) rename {packages/excalidraw/example => examples/excalidraw/components}/App.scss (83%) rename {packages/excalidraw/example => examples/excalidraw/components}/App.tsx (83%) rename {packages/excalidraw/example => examples/excalidraw/components}/CustomFooter.tsx (78%) create mode 100644 examples/excalidraw/components/MobileFooter.tsx rename {packages/excalidraw/example => examples/excalidraw/components}/sidebar/ExampleSidebar.scss (100%) rename {packages/excalidraw/example => examples/excalidraw/components}/sidebar/ExampleSidebar.tsx (94%) rename {packages/excalidraw/example => examples/excalidraw}/initialData.tsx (99%) create mode 100644 examples/excalidraw/package.json create mode 100644 examples/excalidraw/tsconfig.json create mode 100644 examples/excalidraw/utils.ts create mode 100644 examples/excalidraw/with-nextjs/.gitignore create mode 100644 examples/excalidraw/with-nextjs/README.md create mode 100644 examples/excalidraw/with-nextjs/next.config.js create mode 100644 examples/excalidraw/with-nextjs/package.json rename {packages/excalidraw/example => examples/excalidraw/with-nextjs}/public/images/doremon.png (100%) rename {packages/excalidraw/example => examples/excalidraw/with-nextjs}/public/images/excalibot.png (100%) rename {packages/excalidraw/example => examples/excalidraw/with-nextjs}/public/images/pika.jpeg (100%) rename {packages/excalidraw/example => examples/excalidraw/with-nextjs}/public/images/rocket.jpeg (100%) create mode 100644 examples/excalidraw/with-nextjs/src/app/favicon.ico create mode 100644 examples/excalidraw/with-nextjs/src/app/layout.tsx create mode 100644 examples/excalidraw/with-nextjs/src/app/page.tsx create mode 100644 examples/excalidraw/with-nextjs/src/common.scss create mode 100644 examples/excalidraw/with-nextjs/src/excalidrawWrapper.tsx create mode 100644 examples/excalidraw/with-nextjs/src/pages/excalidraw-in-pages.tsx create mode 100644 examples/excalidraw/with-nextjs/tsconfig.json create mode 100644 examples/excalidraw/with-nextjs/vercel.json create mode 100644 examples/excalidraw/with-nextjs/yarn.lock create mode 100644 examples/excalidraw/with-script-in-browser/.gitignore rename {packages/excalidraw/example/public => examples/excalidraw/with-script-in-browser}/index.html (62%) create mode 100644 examples/excalidraw/with-script-in-browser/index.tsx create mode 100644 examples/excalidraw/with-script-in-browser/package.json create mode 100644 examples/excalidraw/with-script-in-browser/public/images/doremon.png create mode 100644 examples/excalidraw/with-script-in-browser/public/images/excalibot.png create mode 100644 examples/excalidraw/with-script-in-browser/public/images/pika.jpeg create mode 100644 examples/excalidraw/with-script-in-browser/public/images/rocket.jpeg rename {packages/excalidraw => examples/excalidraw/with-script-in-browser}/vercel.json (50%) create mode 100644 examples/excalidraw/with-script-in-browser/vite.config.mts create mode 100644 examples/excalidraw/yarn.lock rename excalidraw-app/{components => app-language}/LanguageList.tsx (79%) create mode 100644 excalidraw-app/app-language/language-detector.ts create mode 100644 excalidraw-app/app-language/language-state.ts create mode 100644 excalidraw-app/collab/CollabError.scss create mode 100644 excalidraw-app/collab/CollabError.tsx delete mode 100644 excalidraw-app/collab/reconciliation.ts rename excalidraw-app/{collab/RoomDialog.scss => share/ShareDialog.scss} (80%) create mode 100644 excalidraw-app/share/ShareDialog.tsx delete mode 100644 excalidraw-app/tests/reconciliation.test.ts create mode 100644 excalidraw-app/useHandleAppTheme.ts delete mode 100644 packages/excalidraw/actions/actionLinearEditor.ts create mode 100644 packages/excalidraw/actions/actionLinearEditor.tsx create mode 100644 packages/excalidraw/actions/actionLink.tsx create mode 100644 packages/excalidraw/actions/actionTextAutoResize.ts create mode 100644 packages/excalidraw/animated-trail.ts create mode 100644 packages/excalidraw/animation-frame-handler.ts delete mode 100644 packages/excalidraw/assets/lock.svg create mode 100644 packages/excalidraw/binaryheap.ts create mode 100644 packages/excalidraw/change.ts create mode 100644 packages/excalidraw/components/ButtonIcon.scss create mode 100644 packages/excalidraw/components/ButtonIcon.tsx create mode 100644 packages/excalidraw/components/ButtonSeparator.tsx create mode 100644 packages/excalidraw/components/CommandPalette/CommandPalette.scss create mode 100644 packages/excalidraw/components/CommandPalette/CommandPalette.tsx create mode 100644 packages/excalidraw/components/CommandPalette/defaultCommandPaletteItems.ts create mode 100644 packages/excalidraw/components/CommandPalette/types.ts create mode 100644 packages/excalidraw/components/FontPicker/FontPicker.scss create mode 100644 packages/excalidraw/components/FontPicker/FontPicker.tsx create mode 100644 packages/excalidraw/components/FontPicker/FontPickerList.tsx create mode 100644 packages/excalidraw/components/FontPicker/FontPickerTrigger.tsx create mode 100644 packages/excalidraw/components/FontPicker/keyboardNavHandlers.ts rename packages/excalidraw/components/{LaserTool => }/LaserPointerButton.tsx (87%) delete mode 100644 packages/excalidraw/components/LaserTool/LaserPathManager.ts delete mode 100644 packages/excalidraw/components/LaserTool/LaserTool.tsx create mode 100644 packages/excalidraw/components/PropertiesPopover.tsx create mode 100644 packages/excalidraw/components/QuickSearch.scss create mode 100644 packages/excalidraw/components/QuickSearch.tsx rename packages/excalidraw/components/{LaserTool/LaserToolOverlay.scss => SVGLayer.scss} (63%) create mode 100644 packages/excalidraw/components/SVGLayer.tsx create mode 100644 packages/excalidraw/components/ScrollableList.scss create mode 100644 packages/excalidraw/components/ScrollableList.tsx create mode 100644 packages/excalidraw/components/Sidebar/siderbar.test.helpers.tsx delete mode 100644 packages/excalidraw/components/Stats.scss delete mode 100644 packages/excalidraw/components/Stats.tsx create mode 100644 packages/excalidraw/components/Stats/Angle.tsx create mode 100644 packages/excalidraw/components/Stats/CanvasGrid.tsx create mode 100644 packages/excalidraw/components/Stats/Collapsible.tsx create mode 100644 packages/excalidraw/components/Stats/Dimension.tsx create mode 100644 packages/excalidraw/components/Stats/DragInput.scss create mode 100644 packages/excalidraw/components/Stats/DragInput.tsx create mode 100644 packages/excalidraw/components/Stats/FontSize.tsx create mode 100644 packages/excalidraw/components/Stats/MultiAngle.tsx create mode 100644 packages/excalidraw/components/Stats/MultiDimension.tsx create mode 100644 packages/excalidraw/components/Stats/MultiFontSize.tsx create mode 100644 packages/excalidraw/components/Stats/MultiPosition.tsx create mode 100644 packages/excalidraw/components/Stats/Position.tsx create mode 100644 packages/excalidraw/components/Stats/Stats.scss create mode 100644 packages/excalidraw/components/Stats/index.tsx create mode 100644 packages/excalidraw/components/Stats/stats.test.tsx create mode 100644 packages/excalidraw/components/Stats/utils.ts create mode 100644 packages/excalidraw/components/dropdownMenu/DropdownMenu.test.tsx create mode 100644 packages/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.tsx rename packages/excalidraw/{element => components/hyperlink}/Hyperlink.scss (96%) rename packages/excalidraw/{element => components/hyperlink}/Hyperlink.tsx (64%) create mode 100644 packages/excalidraw/components/hyperlink/helpers.ts create mode 100644 packages/excalidraw/data/reconcile.ts create mode 100644 packages/excalidraw/deburr.ts create mode 100644 packages/excalidraw/element/containerCache.ts create mode 100644 packages/excalidraw/element/flowchart.test.tsx create mode 100644 packages/excalidraw/element/flowchart.ts create mode 100644 packages/excalidraw/element/heading.ts create mode 100644 packages/excalidraw/element/routing.test.tsx create mode 100644 packages/excalidraw/element/routing.ts delete mode 100644 packages/excalidraw/entry.js rename packages/excalidraw/{env.js => env.cjs} (100%) delete mode 100644 packages/excalidraw/example/MobileFooter.tsx delete mode 100644 packages/excalidraw/example/index.tsx create mode 100644 packages/excalidraw/fonts/ExcalidrawFont.ts rename {public => packages/excalidraw/fonts/assets}/Assistant-Bold.woff2 (100%) rename {public => packages/excalidraw/fonts/assets}/Assistant-Medium.woff2 (100%) create mode 100644 packages/excalidraw/fonts/assets/Assistant-Regular.woff2 rename {public => packages/excalidraw/fonts/assets}/Assistant-SemiBold.woff2 (100%) create mode 100644 packages/excalidraw/fonts/assets/CascadiaCode-Regular.woff2 create mode 100644 packages/excalidraw/fonts/assets/ComicShanns-Regular.woff2 create mode 100644 packages/excalidraw/fonts/assets/Excalifont-Regular.woff2 create mode 100644 packages/excalidraw/fonts/assets/LiberationSans-Regular.woff2 create mode 100644 packages/excalidraw/fonts/assets/Virgil-Regular.woff2 create mode 100644 packages/excalidraw/fonts/assets/fonts.css create mode 100644 packages/excalidraw/fonts/index.ts create mode 100644 packages/excalidraw/fonts/metadata.ts create mode 100644 packages/excalidraw/fractionalIndex.ts create mode 100644 packages/excalidraw/hooks/useEmitter.ts create mode 100644 packages/excalidraw/hooks/useStableCallback.ts create mode 100644 packages/excalidraw/laser-trails.ts delete mode 100644 packages/excalidraw/main.js create mode 100644 packages/excalidraw/mermaid.test.ts create mode 100644 packages/excalidraw/mermaid.ts delete mode 100644 packages/excalidraw/publicPath.js create mode 100644 packages/excalidraw/queue.test.ts create mode 100644 packages/excalidraw/queue.ts create mode 100644 packages/excalidraw/reactUtils.ts create mode 100644 packages/excalidraw/renderer/helpers.ts rename packages/excalidraw/renderer/{renderScene.ts => interactiveScene.ts} (51%) create mode 100644 packages/excalidraw/renderer/staticScene.ts create mode 100644 packages/excalidraw/renderer/staticSvgScene.ts delete mode 100644 packages/excalidraw/scene/Fonts.ts create mode 100644 packages/excalidraw/scene/normalize.ts create mode 100644 packages/excalidraw/store.ts create mode 100644 packages/excalidraw/tests/__snapshots__/history.test.tsx.snap create mode 100644 packages/excalidraw/tests/data/reconcile.test.ts create mode 100644 packages/excalidraw/tests/fractionalIndex.test.ts create mode 100644 packages/excalidraw/tests/helpers/colorize.ts create mode 100644 packages/excalidraw/tests/helpers/mocks.ts delete mode 100644 packages/excalidraw/tsconfig-types.json create mode 100644 packages/excalidraw/tsconfig.json delete mode 100644 packages/excalidraw/webpack.dev-server.config.js delete mode 100644 packages/excalidraw/webpack.dev.config.js delete mode 100644 packages/excalidraw/webpack.preact.config.js delete mode 100644 packages/excalidraw/webpack.prod.config.js create mode 100644 packages/utils/collision.ts create mode 100644 packages/utils/geometry/geometry.test.ts create mode 100644 packages/utils/geometry/geometry.ts create mode 100644 packages/utils/geometry/shape.ts create mode 100644 packages/utils/global.d.ts delete mode 100644 packages/utils/index.js create mode 100644 packages/utils/index.ts create mode 100644 packages/utils/tsconfig.json delete mode 100644 public/Cascadia.ttf delete mode 100644 public/FG_Virgil.ttf delete mode 100644 public/FG_Virgil.woff2 delete mode 100644 public/fonts.css rename public/{og-image-2.png => og-image-3.png} (100%) create mode 100644 scripts/buildExample.mjs create mode 100644 scripts/buildPackage.js create mode 100644 scripts/buildUtils.js create mode 100644 scripts/woff2/assets/NotoEmoji-Regular.ttf create mode 100644 scripts/woff2/woff2-esbuild-plugins.js create mode 100644 scripts/woff2/woff2-vite-plugins.js diff --git a/.dockerignore b/.dockerignore index 98c9151f..6472839a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,5 +8,12 @@ !package.json !public/ !packages/ +!scripts/ !tsconfig.json -!yarn.lock \ No newline at end of file +!yarn.lock + +# keep (sub)sub directories at the end to exclude from explicit included +# e.g. ./packages/excalidraw/{dist,node_modules} +**/build +**/dist +**/node_modules diff --git a/.env.development b/.env.development index bf7a32fd..5f990879 100644 --- a/.env.development +++ b/.env.development @@ -10,9 +10,6 @@ VITE_APP_HTTP_STORAGE_BACKEND_URL=http://localhost:8080/api/v2 # collaboration WebSocket server (https://github.com/excalidraw/excalidraw-room) VITE_APP_WS_SERVER_URL=http://localhost:5001 -# set this only if using the collaboration workflow we use on excalidraw.com -VITE_APP_PORTAL_URL= - VITE_APP_PLUS_LP=https://plus.excalidraw.com VITE_APP_PLUS_APP=https://app.excalidraw.com @@ -28,7 +25,7 @@ VITE_APP_DEV_ENABLE_SW= # whether to disable live reload / HMR. Usuaully what you want to do when # debugging Service Workers. VITE_APP_DEV_DISABLE_LIVE_RELOAD= -VITE_APP_DISABLE_TRACKING=true +VITE_APP_ENABLE_TRACKING=false FAST_REFRESH=false diff --git a/.env.production b/.env.production index a022a78d..7cf326b8 100644 --- a/.env.production +++ b/.env.production @@ -20,5 +20,5 @@ VITE_APP_WS_SERVER_URL=http://localhost:5012 # VITE_APP_FIREBASE_CONFIG='{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}' -VITE_APP_DISABLE_TRACKING=true +VITE_APP_ENABLE_TRACKING=false VITE_APP_DISABLE_SENTRY=true \ No newline at end of file diff --git a/.eslintignore b/.eslintignore index ab3aa6c7..8578fb7d 100644 --- a/.eslintignore +++ b/.eslintignore @@ -6,3 +6,5 @@ firebase/ dist/ public/workbox packages/excalidraw/types +examples/**/public +dev-dist diff --git a/.eslintrc.json b/.eslintrc.json index fbb12f59..86d5c299 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -2,6 +2,7 @@ "extends": ["@excalidraw/eslint-config", "react-app"], "rules": { "import/no-anonymous-default-export": "off", - "no-restricted-globals": "off" + "no-restricted-globals": "off", + "@typescript-eslint/consistent-type-imports": ["error", { "prefer": "type-imports", "disallowTypeAnnotations": false, "fixStyle": "separate-type-imports" }] } } diff --git a/.github/workflows/autorelease-excalidraw.yml b/.github/workflows/autorelease-excalidraw.yml index 4eaeb11f..5ff5690e 100644 --- a/.github/workflows/autorelease-excalidraw.yml +++ b/.github/workflows/autorelease-excalidraw.yml @@ -23,5 +23,5 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Auto release run: | - yarn add @actions/core + yarn add @actions/core -W yarn autorelease diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f922f5e7..82f82636 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ jobs: - name: Install and lint run: | - yarn install:deps + yarn install yarn test:other yarn test:code yarn test:typecheck diff --git a/.github/workflows/size-limit.yml b/.github/workflows/size-limit.yml index 02aade54..5bd3c0d9 100644 --- a/.github/workflows/size-limit.yml +++ b/.github/workflows/size-limit.yml @@ -23,6 +23,6 @@ jobs: - uses: andresz1/size-limit-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} - build_script: build:umd + build_script: build:esm skip_step: install directory: packages/excalidraw diff --git a/.github/workflows/test-coverage-pr.yml b/.github/workflows/test-coverage-pr.yml index 7d77d39f..7ff40ad5 100644 --- a/.github/workflows/test-coverage-pr.yml +++ b/.github/workflows/test-coverage-pr.yml @@ -16,7 +16,7 @@ jobs: with: node-version: "18.x" - name: "Install Deps" - run: yarn install:deps + run: yarn install - name: "Test Coverage" run: yarn test:coverage - name: "Report Coverage" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 124cae26..7d454ecf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,17 +1,19 @@ name: Tests -on: pull_request +on: + push: + branches: master jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Node.js 18.x - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: 18.x - name: Install and test run: | - yarn install:deps + yarn install yarn test:app diff --git a/.gitignore b/.gitignore index fb0393b7..a8ff2a40 100644 --- a/.gitignore +++ b/.gitignore @@ -23,9 +23,8 @@ package-lock.json yarn-debug.log* yarn-error.log* packages/excalidraw/types -packages/excalidraw/example/public/bundle.js -packages/excalidraw/example/public/excalidraw-assets-dev -packages/excalidraw/example/public/excalidraw.development.js coverage dev-dist html +examples/**/bundle.* +meta*.json \ No newline at end of file diff --git a/README.md b/README.md index f2bff40e..b0a4b33e 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,10 @@ Hint: Collab mode requires a secure context (https). Localhost works as well, bu docker-compose -f docker-compose-prod.yml up -d ``` - ## Additional licence The excalidraw [logo](https://thenounproject.com/icon/2357486/) in this repo – created by [Verry](https://thenounproject.com/verry.dsign.creative) – is licenced under [CC BY 3.0 Unported](https://creativecommons.org/licenses/by/3.0/). +
Excalidraw logo: Sketch handrawn like diagrams. @@ -169,4 +169,7 @@ Visit our documentation on [https://docs.excalidraw.com](https://docs.excalidraw ## Who's integrating Excalidraw [Google Cloud](https://googlecloudcheatsheet.withgoogle.com/architecture) • [Meta](https://meta.com/) • [CodeSandbox](https://codesandbox.io/) • [Obsidian Excalidraw](https://github.com/zsviczian/obsidian-excalidraw-plugin) • [Replit](https://replit.com/) • [Slite](https://slite.com/) • [Notion](https://notion.so/) • [HackerRank](https://www.hackerrank.com/) -``` \ No newline at end of file + +``` + +``` diff --git a/dev-docs/docs/@excalidraw/excalidraw/api/props/excalidraw-api.mdx b/dev-docs/docs/@excalidraw/excalidraw/api/props/excalidraw-api.mdx index c27e9614..f68b4bd1 100644 --- a/dev-docs/docs/@excalidraw/excalidraw/api/props/excalidraw-api.mdx +++ b/dev-docs/docs/@excalidraw/excalidraw/api/props/excalidraw-api.mdx @@ -13,7 +13,7 @@ Once the callback is triggered, you will need to store the api in state to acces ```jsx showLineNumbers export default function App() { const [excalidrawAPI, setExcalidrawAPI] = useState(null); - return setExcalidrawAPI(api)}} />; + return setExcalidrawAPI(api)} />; } ``` @@ -22,7 +22,7 @@ You can use this prop when you want to access some [Excalidraw APIs](https://git | API | Signature | Usage | | --- | --- | --- | | [updateScene](#updatescene) | `function` | updates the scene with the sceneData | -| [updateLibrary](#updatelibrary) | `function` | updates the scene with the sceneData | +| [updateLibrary](#updatelibrary) | `function` | updates the library | | [addFiles](#addfiles) | `function` | add files data to the appState | | [resetScene](#resetscene) | `function` | Resets the scene. If `resetLoadingState` is passed as true then it will also force set the loading state to false. | | [getSceneElementsIncludingDeleted](#getsceneelementsincludingdeleted) | `function` | Returns all the elements including the deleted in the scene | @@ -37,7 +37,7 @@ You can use this prop when you want to access some [Excalidraw APIs](https://git | [setActiveTool](#setactivetool) | `function` | This API can be used to set the active tool | | [setCursor](#setcursor) | `function` | This API can be used to set customise the mouse cursor on the canvas | | [resetCursor](#resetcursor) | `function` | This API can be used to reset to default mouse cursor on the canvas | -| [toggleMenu](#togglemenu) | `function` | Toggles specific menus on/off | +| [toggleSidebar](#toggleSidebar) | `function` | Toggles specific sidebar on/off | | [onChange](#onChange) | `function` | Subscribes to change events | | [onPointerDown](#onPointerDown) | `function` | Subscribes to `pointerdown` events | | [onPointerUp](#onPointerUp) | `function` | Subscribes to `pointerup` events | @@ -65,7 +65,7 @@ You can use this function to update the scene with the sceneData. It accepts the | `elements` | [`ImportedDataState["elements"]`](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/types.ts#L38) | The `elements` to be updated in the scene | | `appState` | [`ImportedDataState["appState"]`](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/data/types.ts#L39) | The `appState` to be updated in the scene. | | `collaborators` | MapCollaborator> | The list of collaborators to be updated in the scene. | -| `commitToHistory` | `boolean` | Implies if the `history (undo/redo)` should be recorded. Defaults to `false`. | +| `commitToStore` | `boolean` | Implies if the change should be captured and commited to the `store`. Commited changes are emmitted and listened to by other components, such as `History` for undo / redo purposes. Defaults to `false`. | ```jsx live function App() { @@ -115,7 +115,7 @@ function App() { - setExcalidrawAPI(api)} /> + setExcalidrawAPI(api)} />
); } @@ -188,7 +188,7 @@ function App() { Update Library setExcalidrawAPI(api)} + excalidrawAPI={(api) => setExcalidrawAPI(api)} // initial data retrieved from https://github.com/excalidraw/excalidraw/blob/master/dev-docs/packages/excalidraw/initialData.js initialData={{ libraryItems: initialData.libraryItems, diff --git a/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx b/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx index 40773a1a..a3af7893 100644 --- a/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx +++ b/dev-docs/docs/@excalidraw/excalidraw/api/props/props.mdx @@ -9,9 +9,9 @@ All `props` are _optional_. | [`isCollaborating`](#iscollaborating) | `boolean` | _ | This indicates if the app is in `collaboration` mode | | [`onChange`](#onchange) | `function` | _ | This callback is triggered whenever the component updates due to any change. This callback will receive the excalidraw `elements` and the current `app state`. | | [`onPointerUpdate`](#onpointerupdate) | `function` | _ | Callback triggered when mouse pointer is updated. | -| [`onPointerDown`](#onpointerdown) | `function` | _ | This prop if passed gets triggered on pointer down evenets | +| [`onPointerDown`](#onpointerdown) | `function` | _ | This prop if passed gets triggered on pointer down events | | [`onScrollChange`](#onscrollchange) | `function` | _ | This prop if passed gets triggered when scrolling the canvas. | -| [`onPaste`](#onpaste) | `function` | _ | Callback to be triggered if passed when the something is pasted in to the scene | +| [`onPaste`](#onpaste) | `function` | _ | Callback to be triggered if passed when something is pasted into the scene | | [`onLibraryChange`](#onlibrarychange) | `function` | _ | The callback if supplied is triggered when the library is updated and receives the library items. | | [`onLinkOpen`](#onlinkopen) | `function` | _ | The callback if supplied is triggered when any link is opened. | | [`langCode`](#langcode) | `string` | `en` | Language code string to be used in Excalidraw | @@ -23,10 +23,10 @@ All `props` are _optional_. | [`libraryReturnUrl`](#libraryreturnurl) | `string` | _ | What URL should [libraries.excalidraw.com](https://libraries.excalidraw.com) be installed to | | [`theme`](#theme) | `"light"` | `"dark"` | `"light"` | The theme of the Excalidraw component | | [`name`](#name) | `string` | | Name of the drawing | -| [`UIOptions`](/docs/@excalidraw/excalidraw/api/props/ui-options) | `object` | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/constants.ts#L151) | To customise UI options. Currently we support customising [`canvas actions`](#canvasactions) | +| [`UIOptions`](/docs/@excalidraw/excalidraw/api/props/ui-options) | `object` | [DEFAULT UI OPTIONS](https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/constants.ts#L151) | To customise UI options. Currently we support customising [`canvas actions`](/docs/@excalidraw/excalidraw/api/props/ui-options#canvasactions) | | [`detectScroll`](#detectscroll) | `boolean` | `true` | Indicates whether to update the offsets when nearest ancestor is scrolled. | | [`handleKeyboardGlobally`](#handlekeyboardglobally) | `boolean` | `false` | Indicates whether to bind the keyboard events to document. | -| [`autoFocus`](#autofocus) | `boolean` | `false` | indicates whether to focus the Excalidraw component on page load | +| [`autoFocus`](#autofocus) | `boolean` | `false` | Indicates whether to focus the Excalidraw component on page load | | [`generateIdForFile`](#generateidforfile) | `function` | _ | Allows you to override `id` generation for files added on canvas | | [`validateEmbeddable`](#validateEmbeddable) | string[] | `boolean | RegExp | RegExp[] | ((link: string) => boolean | undefined)` | \_ | use for custom src url validation | | [`renderEmbeddable`](/docs/@excalidraw/excalidraw/api/props/render-props#renderEmbeddable) | `function` | \_ | Render function that can override the built-in `