* feat: integrate mermaidToExcalidraw
* create mermaid to excal dialog
* allow mermaid syntax and export in preview
* fix
* fix webpack config
* fix markdown error by using named export
* center preview
* set elements as selected when inserted onto canvas
* persist mermaid data to storage
* store canvas data in refs
* load mermaid lazily
* tweak design
* compute width, height correctly for arrows
* fix undefined vertex issue
* add mermaid icon in dropdown
* add a note in dialog
* reset preview when error
* show error in preview when error
* show mermaid error messgae react way
* design tweaks
* add example and docs link
* fix
* tweak design to remove scroll bar
* show a spinner unless mermaid loaded
* regenerate ids when needed via programmatic api, this makes sure for mermaid diagrams ids are regenerated
* tweak
* add option to transform viewport to scene coords in transform api
* make opts optional and use 100% zoom when inserting to canvas
* fix arrow bindings in safari and firefox
* fix elements insert position and viewport centering
* fix: Update start/end points by 0.5 so bindings don't overlap with start/end bound element coordinates.
* defer rendering the preview
* tweak text
* fix tests
* remove only
* make design responsive
* fix: show extra tools dropdown in mobile
* fix mobile css
* width auto
* upgrade mermaid-to-excalidraw
* don't pass appState in deps as its not used
* upgrade mermaid-to-excalidraw to fix firefox issue
* use types from mermaid-to-excalidraw
* upgrade mermaid-to-excalidraw
* use stable version of mermaid-to-excalidraw
* upgrade mermaid-to-excalidraw
* fix width of shapes toolbar for smaller screen size and also fix regression of mobile menu
* use i18n
* better api
* enable test coverage in ui
* Add tests
* use common utils to update and get text editor
* updgrade mermaid-to-excalidraw to support sequence diagrams
* fix test
* don't update arrow container height anytime in when redrawing text bounding box
* increase size limit
* increase size limit of vendor to 900kb
* use openDialog for mermaid
* upgrade mermaid-to-excalidraw
* update frame id post generation
* upgrade mermaid-to-excalidraw to add entity codes support
* update size limit
* upgrade mermaid-to-excalidraw package with frame api changes
* upgrade mermaid-to-excalidraw to remove directive and use config
* don't highlight mermaid tool and remove unused api setSelection
* stop using loading state to update text area
* move some styling to scss
* review fixes
* use modifiedTableIcon props and remove stale snap
* css
* dialog css
* fix snap
* use dialog border
* change mermaidToExcalidrawLib to state
* better styling of errors
* make modal bigger
* fix mobile
* update snaps
* fix icon color
* fix dark mode insert button color
* horizontally center spinner
* render canvas conditionally on loaded state
* rd tweaks
* tweak class names
* remove max height
* typo in example
* upgrade mermaid-to-excalidraw
* simplify error state
* fix height & overflow on vertical breakpoint
* fix lint
* show errors in overlay
* set textarea font family
* reduce opacity
* update snap
* upgrade to mermaid 0.1.2
---------
Co-authored-by: dwelle <luzar.david@gmail.com>
* update frame id post generation
* support frames via programmatic API
* fix types
* add test for frames
* throw error when element doesn't exist
* naming tweaks
* update the api to use children
* consider max of frame dimensions and calculated bounds of elements
* consider bound elements in frame api
* feat: regenerate ids by default when using transform api and also update bindings by 0.5px to avoid possible overlapping
* type
* increase limit as some past PR(s) increased the bundle size
* review fixes
* update changelog
* feat: initial Laser pointer mvp
* feat: add laser-pointer package and integrate it with collab
* chore: fix yarn.lock
* feat: update laser-pointer package, prevent panning from showing
* feat: add laser pointer tool button when collaborating, migrate to official package
* feat: reduce laser tool button size
* update icon
* fix icon & rotate
* fix: lock zoom level
* fix icon
* add `selected` state, simplify and reduce api
* set up pointer callbacks in viewMode if laser tool active
* highlight extra-tools button if one of the nested tools active
* add shortcut to laser pointer
* feat: don't update paths if nothing changed
* ensure we reset flag if no rAF scheduled
* move `lastUpdate` to instance to optimize
* return early
* factor out into constants and add doc
* skip iteration instead of exit
* fix naming
* feat: remove testing variable on window
* destroy on editor unmount
* fix incorrectly resetting `lastUpdate` in `stop()`
---------
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: support creating text containers programatically
* fix
* fix
* fix
* fix
* update api to use label
* fix api and support individual shapes and text element
* update test case in package example
* support creating arrows and line
* support labelled arrows
* add in package example
* fix alignment
* better types
* fix
* keep element as is unless we support prog api
* fix tests
* fix lint
* ignore
* support arrow bindings via start and end in api
* fix lint
* fix coords
* support id as well for elements
* preserve bindings if present and fix testcases
* preserve bindings for labelled arrows
* support ids, clean up code and move the api related stuff to transform.ts
* allow multiple arrows to bind to single element
* fix singular elements
* fix single text element, unique id and tests
* fix lint
* fix
* support binding arrow to text element
* fix creation of regular text
* use same stroke color as parent for text containers and height 0 for linear element by default
* fix types
* fix
* remove more ts ignore
* remove ts ignore
* remove
* Add coverage script
* Add tests
* fix tests
* make type optional when id present
* remove type when id provided in tests
* Add more tests
* tweak
* let host call convertToExcalidrawElements when using programmatic API
* remove convertToExcalidrawElements call from restore
* lint
* update snaps
* Add new type excalidraw-api/clipboard for programmatic api
* cleanup
* rename tweak
* tweak
* make image attributes optional and better ts check
* support image via programmatic API
* fix lint
* more types
* make fileId mandatory for image and export convertToExcalidrawElements
* fix
* small tweaks
* update snaps
* fix
* use Object.assign instead of mutateElement
* lint
* preserve z-index by pushing all elements first and then add bindings
* instantiate instead of closure for storing elements
* use element API to create regular text, diamond, ellipse and rectangle
* fix snaps
* udpdate api
* ts fixes
* make `convertToExcalidrawElements` more typesafe
* update snaps
* refactor the approach so that order of elements doesn't matter
* Revert "update snaps"
This reverts commit 621dfadccfea975a1f77223f506dce9d260f91fd.
* review fixes
* rename ExcalidrawProgrammaticElement -> ExcalidrawELementSkeleton
* Add tests
* give preference to first element when duplicate ids found
* use console.error
---------
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: Sidebar tabs support [wip]
* tab trigger styling tweaks
* add `:hover` & `:active` states
* replace `@dwelle/tunnel-rat` with `tunnel-rat`
* make stuff more explicit
- remove `Sidebar.Header` fallback (host apps need to render manually), and stop tunneling it (render in place)
- make `docked` state explicit
- stop tunneling `Sidebar.TabTriggers` (render in place)
* redesign sidebar / library as per latest spec
* support no label on `Sidebar.Trigger`
* add Sidebar `props.onStateChange`
* style fixes
* make `appState.isSidebarDocked` into a soft user preference
* px -> rem & refactor
* remove `props.renderSidebar`
* update tests
* remove
* refactor
* rename constants
* tab triggers styling fixes
* factor out library-related logic from generic sidebar trigger
* change `props.onClose` to `onToggle`
* rename `props.value` -> `props.tab`
* add displayNames
* allow HTMLAttributes on applicable compos
* fix example App
* more styling tweaks and fixes
* fix not setting `dockable`
* more style fixes
* fix and align sidebar header button styling
* make DefaultSidebar dockable on if host apps supplies `onDock`
* stop `Sidebar.Trigger` hiding label on mobile
this should be only the default sidebar trigger behavior, and for that we don't need to use `device` hook as we handle in CSS
* fix `dockable` prop of defaultSidebar
* remove extra `typescript` dep
* remove `defaultTab` prop
in favor of explicit `tab` value in `<Sidebar.Trigger/>` and `toggleSidebar()`, to reduce API surface area and solve inconsistency of `appState.openSidebar.tab` not reflecting actual UI value if `defaultTab` was supported (without additional syncing logic which feels like the wrong solution).
* remove `onToggle` in favor of `onStateChange`
reducing API surface area
* fix restore
* comment no longer applies
* reuse `Button` component in sidebar buttons
* fix tests
* split Sidebar sub-components into files
* remove `props.dockable` in favor of `props.onDock` only
* split tests
* fix sidebar showing dock button if no `props.docked` supplied & add more tests
* reorder and group sidebar tests
* clarify
* rename classes & dedupe css
* refactor tests
* update changelog
* update changelog
---------
Co-authored-by: barnabasmolnar <barnabas@excalidraw.com>
* fix: introduce baseline to fix the layout shift when switching to text editor
* uncomment
* change offset to 8pixels
* [debug]
* introduce DOM baseline in canvas rendering instead
* introduce baseline in element making it backward compat
* fix
* lint
* fix
* update baseline when resizing text element
* fix safari backward compat
* fix for safari
* lint
* reduce safari LS
* floor line height and height when dom height increases than canvas height
* Revert "floor line height and height when dom height increases than canvas height"
This reverts commit 8de65168238b8fb9a638e0c75f596f371983c2c7.
* cleanup
* use DOM height only for safari to fix LS
* Revert "use DOM height only for safari to fix LS"
This reverts commit d75889238da59b7954ec3a6ac2c29dc0ba420635.
* fix lint and test
* fix
* calculate line height by rounding off instead of DOM
* cleanup
---------
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: add line height attribute to text element
* lint
* update line height when redrawing text bounding box
* fix tests
* retain line height when pasting styles
* fix test
* create a util for calculating ling height using old algo
* update line height when resizing multiple text elements
* make line height backward compatible
* udpate line height for older element when font size updated
* remove logs
* Add specs
* lint
* review fixes
* simplify by changing `lineHeight` from px to unitless
* make param non-optional
* update comment
* fix: jumping text due to font size being calculated incorrectly
* update line height when font family is updated
* lint
* Add spec
* more specs
* rename to getDefaultLineHeight
* fix getting lineHeight for potentially undefined fontFamily
* reduce duplication
* fix fallback
* refactor and comment tweaks
* fix
---------
Co-authored-by: dwelle <luzar.david@gmail.com>
* feat: move to canvas measureText
* calcualte height with better heuristic
* improve heuristic more
* remove vertical offset as its not needed
* lint
* calculate width of individual char and ceil to calculate width and remove adjustment factor
* push the word if equal to max width
* update height when text overflows for vertical alignment top/bottom
* remove the hack of updating height when line mismatch as its not needed
* remove scroll height and calculate the height instead
* remove unused code
* fix
* remove
* use math.ceil for whole width instead of individual chars
* fix tests
* fix
* fix
* redraw text bounding box instead when font loaded to fix alignment as well
* fix
* fix
* fix
* Add a 0.05px extra only for firefox
* Add spec
* stop taking ceil and increase firefox editor width by 0.05px
* Ad 0.05px in safari too
* lint
* lint
* remove baseline from measureFontSizeFromWH
* don't redraw on font load
* lint
* refactor name and signature
* fix: don't repair during reconcilation
* Add opts to restoreElement and enable refreshDimensions and repair via config
* remove
* update changelog
* fix tests
* rename to repairBindings
* feat: add hand/panning tool
* move hand tool right of tool lock separator
* tweak i18n
* rename `panning` -> `hand`
* toggle between last tool and hand on `H` shortcut
* hide properties sidebar when `hand` active
* revert to rendering HandButton manually due to mobile toolbar
* feat: hide copy-as-png shortcut from help dialog if not supported
* fix: support firefox if clipboard.write supported
* show shrotcut in firefox and instead show error message how to enable the flag support
* widen to TypeError because minification
* show copy-as-png on firefox even if it will throw