Compare commits

..

8 Commits

Author SHA1 Message Date
kbariotis
31747b08a7 refine routes 2021-02-14 17:49:37 +02:00
kbariotis
c71ba5c02a add room 2021-02-14 17:43:09 +02:00
kbariotis
e86ae51c92 test handle filesystem 2021-02-14 17:34:41 +02:00
kbariotis
d87ced1711 separate routes 2021-02-14 17:25:27 +02:00
kbariotis
803785201e fix regexp 2021-02-14 17:23:10 +02:00
kbariotis
e844ef8c34 fix headers 2021-02-14 17:19:12 +02:00
kbariotis
9e2df2ac82 merge routes with headers 2021-02-14 17:18:07 +02:00
kbariotis
feae342283 resolve #2910 2021-02-14 17:15:40 +02:00
22 changed files with 238 additions and 292 deletions

View File

@@ -2,7 +2,7 @@
.excalidraw {
.CollabButton.is-collaborating {
background-color: var(--button-special-active-bg-color);
background-color: var(--button-special-active-background-color);
.ToolIcon__icon svg,
.ToolIcon__label {

View File

@@ -2,9 +2,9 @@
.excalidraw {
.color-picker {
background: var(--popup-bg-color);
border: 0 solid transparentize($oc-white, 0.75);
box-shadow: transparentize($oc-black, 0.75) 0 1px 4px;
background: var(--popup-background-color);
border: 0px solid transparentize($oc-white, 0.75);
box-shadow: transparentize($oc-black, 0.75) 0px 1px 4px;
border-radius: 4px;
position: absolute;
@@ -24,11 +24,11 @@
}
.color-picker-triangle {
width: 0;
height: 0;
width: 0px;
height: 0px;
border-style: solid;
border-width: 0 9px 10px;
border-color: transparent transparent var(--popup-bg-color);
border-width: 0px 9px 10px;
border-color: transparent transparent var(--popup-background-color);
position: absolute;
top: -10px;
@@ -84,12 +84,12 @@
.color-picker-transparent {
border-radius: 4px;
box-shadow: transparentize($oc-black, 0.9) 0 0 0 1px inset;
box-shadow: transparentize($oc-black, 0.9) 0px 0px 0px 1px inset;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
}
.color-picker-transparent,
@@ -104,11 +104,11 @@
width: 1.875rem;
:root[dir="ltr"] & {
border-radius: 4px 0 0 4px;
border-radius: 4px 0px 0px 4px;
}
:root[dir="rtl"] & {
border-radius: 0 4px 4px 0;
border-radius: 0px 4px 4px 0px;
}
color: var(--input-label-color);
@@ -144,7 +144,7 @@
}
.color-input-container:focus-within .color-picker-hash::after {
background: var(--input-bg-color);
background: var(--input-background-color);
:root[dir="ltr"] & {
right: -2px;
@@ -163,19 +163,19 @@
width: 12ch; /* length of `transparent` + 1 */
margin: 0;
font-size: 1rem;
background-color: var(--input-bg-color);
color: var(--text-primary-color);
border: 0;
background-color: var(--input-background-color);
color: var(--text-color-primary);
border: 0px;
outline: none;
height: 1.75em;
box-shadow: var(--input-border-color) 0 0 0 1px inset;
box-shadow: var(--input-border-color) 0px 0px 0px 1px inset;
:root[dir="ltr"] & {
border-radius: 0 4px 4px 0;
border-radius: 0px 4px 4px 0px;
}
:root[dir="rtl"] & {
border-radius: 4px 0 0 4px;
border-radius: 4px 0px 0px 4px;
}
float: left;
@@ -228,7 +228,7 @@
}
.color-picker-type-elementBackground .color-picker-keybinding {
color: $oc-white;
color: #fff;
}
.color-picker-swatch[aria-label="transparent"] .color-picker-keybinding {
@@ -241,10 +241,10 @@
&.Appearance_dark {
.color-picker-type-elementBackground .color-picker-keybinding {
color: $oc-black;
color: #000;
}
.color-picker-swatch[aria-label="transparent"] .color-picker-keybinding {
color: $oc-black;
color: #000;
}
}
}

View File

@@ -4,13 +4,13 @@
.context-menu {
position: relative;
border-radius: 4px;
box-shadow: 0 3px 10px transparentize($oc-black, 0.8);
box-shadow: 0px 3px 10px transparentize($oc-black, 0.8);
padding: 0;
list-style: none;
user-select: none;
margin: -0.25rem 0 0 0.125rem;
padding: 0.5rem 0;
background-color: var(--popup-secondary-bg-color);
background-color: var(--popup-secondary-background-color);
border: 1px solid var(--button-gray-3);
cursor: default;
}
@@ -61,12 +61,12 @@
}
.context-menu-option:hover {
color: var(--popup-bg-color);
color: var(--popup-background-color);
background-color: var(--select-highlight-color);
&.dangerous {
.context-menu-option__label {
color: var(--popup-bg-color);
color: var(--popup-background-color);
}
background-color: $oc-red-6;
}

View File

@@ -45,7 +45,7 @@
position: sticky;
top: 0;
padding: calc(var(--space-factor) * 2);
background: var(--island-bg-color);
background: var(--bg-color-island);
font-size: 1.25em;
box-sizing: border-box;

View File

@@ -26,7 +26,7 @@ $wide-viewport-width: 1000px;
> span {
padding: 0.2rem 0.4rem;
background-color: var(--overlay-bg-color);
background-color: var(--overlay-background-color);
border-radius: 4px;
}
}

View File

@@ -8,9 +8,9 @@
}
.picker {
background: var(--popup-bg-color);
border: 0 solid transparentize($oc-white, 0.75);
box-shadow: transparentize($oc-black, 0.75) 0 1px 4px;
background: var(--popup-background-color);
border: 0px solid transparentize($oc-white, 0.75);
box-shadow: transparentize($oc-black, 0.75) 0px 1px 4px;
border-radius: 4px;
position: absolute;
}
@@ -56,8 +56,8 @@
}
.picker-triangle {
width: 0;
height: 0;
width: 0px;
height: 0px;
position: relative;
top: -10px;
:root[dir="ltr"] & {
@@ -73,7 +73,7 @@
content: "";
position: absolute;
border-style: solid;
border-width: 0 9px 10px;
border-width: 0px 9px 10px;
border-color: transparent transparent transparentize($oc-black, 0.9);
top: -1px;
}
@@ -82,8 +82,8 @@
content: "";
position: absolute;
border-style: solid;
border-width: 0 9px 10px;
border-color: transparent transparent var(--popup-bg-color);
border-width: 0px 9px 10px;
border-color: transparent transparent var(--popup-background-color);
}
}
@@ -121,7 +121,7 @@
}
.picker-type-elementBackground .picker-keybinding {
color: $oc-white;
color: #fff;
}
.picker-swatch[aria-label="transparent"] .picker-keybinding {
@@ -134,10 +134,10 @@
&.Appearance_dark {
.picker-type-elementBackground .picker-keybinding {
color: $oc-black;
color: #000;
}
.picker-swatch[aria-label="transparent"] .picker-keybinding {
color: $oc-black;
color: #000;
}
}
}

View File

@@ -1,7 +1,7 @@
.excalidraw {
.Island {
--padding: 0;
background-color: var(--island-bg-color);
background-color: var(--bg-color-island);
backdrop-filter: saturate(100%) blur(10px);
box-shadow: var(--shadow-island);
border-radius: 4px;

View File

@@ -73,7 +73,7 @@
&__footer {
position: absolute;
z-index: 100;
bottom: 0;
bottom: 0px;
:root[dir="ltr"] & {
right: 0;
@@ -94,7 +94,7 @@
}
:root[dir="ltr"] &.transition-right {
transform: translate(999px, 0);
transform: translate(999px, 0px);
}
:root[dir="rtl"] &.transition-left {

View File

@@ -44,10 +44,10 @@
overflow-y: auto;
// for modals, reset blurry bg
background: var(--island-bg-color);
background: var(--bg-color-island);
backdrop-filter: none;
border: 1px solid var(--dialog-border-color);
border: 1px solid var(--dialog-border);
box-shadow: 0 2px 10px transparentize($oc-black, 0.75);
border-radius: 6px;

View File

@@ -1,53 +1,51 @@
@import "../css/variables.module";
.excalidraw {
.Stats {
position: absolute;
top: 64px;
right: 12px;
font-size: 12px;
z-index: 999;
.Stats {
position: absolute;
top: 64px;
right: 12px;
font-size: 12px;
z-index: 999;
h3 {
margin: 0 24px 8px 0;
white-space: nowrap;
}
h3 {
margin: 0 24px 8px 0;
white-space: nowrap;
}
.close {
float: right;
height: 16px;
width: 16px;
cursor: pointer;
svg {
width: 100%;
height: 100%;
}
}
table {
.close {
float: right;
height: 16px;
width: 16px;
cursor: pointer;
svg {
width: 100%;
th {
border-bottom: 1px solid var(--input-border-color);
padding: 4px;
}
tr {
td:nth-child(2) {
min-width: 24px;
text-align: right;
}
}
height: 100%;
}
}
:root[dir="rtl"] & {
left: 12px;
right: initial;
h3 {
margin: 0 0 8px 24px;
}
.close {
float: left;
table {
width: 100%;
th {
border-bottom: 1px solid var(--input-border-color);
padding: 4px;
}
tr {
td:nth-child(2) {
min-width: 24px;
text-align: right;
}
}
}
:root[dir="rtl"] & {
left: 12px;
right: initial;
h3 {
margin: 0 0 8px 24px;
}
.close {
float: left;
}
}
}

View File

@@ -2,18 +2,18 @@
.excalidraw {
.TextInput {
color: var(--text-primary-color);
color: var(--text-color-primary);
display: inline-block;
border: 1.5px solid var(--button-gray-1);
line-height: 1;
padding: 0.75rem;
white-space: nowrap;
border-radius: var(--space-factor);
background-color: var(--input-bg-color);
background-color: var(--input-background-color);
&:not(:focus) {
&:hover {
background-color: var(--input-hover-bg-color);
background-color: var(--input-hover-background-color);
}
}

View File

@@ -8,7 +8,7 @@
}
.excalidraw {
color: var(--text-primary-color);
color: var(--text-color-primary);
display: flex;
top: 0;
bottom: 0;
@@ -50,10 +50,10 @@
}
.FixedSideContainer {
padding-top: var(--sat, 0);
padding-right: var(--sar, 0);
padding-bottom: var(--sab, 0);
padding-left: var(--sal, 0);
padding-top: var(--sat, 0px);
padding-right: var(--sar, 0px);
padding-bottom: var(--sab, 0px);
padding-left: var(--sal, 0px);
}
.panelRow {
@@ -71,7 +71,7 @@
margin-top: 0.333rem;
margin-bottom: 0.333rem;
font-size: 0.75rem;
color: var(--text-primary-color);
color: var(--text-color-primary);
font-weight: bold;
display: block;
}
@@ -237,10 +237,10 @@
left: 0;
right: 0;
--bar-padding: calc(4 * var(--space-factor));
padding-top: #{"max(var(--bar-padding), var(--sat,0))"};
padding-right: var(--sar, 0);
padding-bottom: var(--sab, 0);
padding-left: var(--sal, 0);
padding-top: #{"max(var(--bar-padding), var(--sat, 0px))"};
padding-right: var(--sar, 0px);
padding-bottom: var(--sab, 0px);
padding-left: var(--sal, 0px);
z-index: 4;
display: flex;
align-items: flex-end;
@@ -257,7 +257,7 @@
pointer-events: initial;
.panelColumn {
padding: 8px 8px 0 8px;
padding: 8px 8px 0px 8px;
}
}
}
@@ -460,7 +460,7 @@
display: none;
}
.scroll-back-to-content {
bottom: calc(80px + var(--sab, 0));
bottom: calc(80px + var(--sab, 0px));
z-index: -1;
}
}

View File

@@ -1,43 +1,43 @@
@import "open-color/open-color.scss";
:root {
--appearance-filter: none;
--button-destructive-bg-color: #{$oc-red-1};
--button-destructive-color: #{$oc-red-9};
--bg-color-island: rgba(255, 255, 255, 0.9);
--popup-background-color: #{$oc-white};
--space-factor: 0.25rem;
--button-gray-1: #{$oc-gray-2};
--button-gray-2: #{$oc-gray-4};
--button-gray-3: #{$oc-gray-5};
--button-special-active-bg-color: #{$oc-green-0};
--dialog-border-color: #{$oc-gray-6};
--dropdown-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>');
--focus-highlight-color: #{$oc-blue-2};
--input-border-color: #{$oc-gray-3};
--input-background-color: #{$oc-white};
--input-hover-background-color: #{$oc-gray-1};
--input-label-color: #{$oc-gray-7};
--icon-fill-color: #{$oc-black};
--icon-green-fill-color: #{$oc-green-9};
--input-bg-color: #{$oc-white};
--input-border-color: #{$oc-gray-3};
--input-hover-bg-color: #{$oc-gray-1};
--input-label-color: #{$oc-gray-7};
--island-bg-color: rgba(255, 255, 255, 0.9);
--keybinding-color: #{$oc-gray-5};
--link-color: #{$oc-blue-7};
--overlay-bg-color: #{transparentize($oc-white, 0.12)};
--popup-bg-color: #{$oc-white};
--popup-secondary-bg-color: #{$oc-gray-1};
--popup-text-color: #{$oc-black};
--popup-text-inverted-color: #{$oc-white};
--sat: env(safe-area-inset-top);
--sab: env(safe-area-inset-bottom);
--sal: env(safe-area-inset-left);
--sar: env(safe-area-inset-right);
--sat: env(safe-area-inset-top);
--select-highlight-color: #{$oc-blue-5};
--text-color-primary: #{$oc-gray-8};
--shadow-island: 0 1px 5px #{transparentize($oc-black, 0.85)};
--space-factor: 0.25rem;
--text-primary-color: #{$oc-gray-8};
--overlay-background-color: #{transparentize($oc-white, 0.12)};
--dropdown-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>');
--focus-highlight-color: #{$oc-blue-2};
--select-highlight-color: #{$oc-blue-5};
--appearance-filter: none;
--button-special-active-background-color: #{$oc-green-0};
--button-destructive-color: #{$oc-red-9};
--button-destructive-background-color: #{$oc-red-1};
--popup-secondary-background-color: #{$oc-gray-1};
--popup-text-color: #{$oc-black};
--popup-text-inverted-color: #{$oc-white};
--dialog-border: #{$oc-gray-6};
--link-color: #{$oc-blue-7};
}
.excalidraw {
&.Appearance_dark {
background: $oc-black;
background: #000;
&.Appearance_dark-background-none {
background: none;
@@ -45,31 +45,31 @@
}
&.Appearance_dark {
--appearance-filter: invert(93%) hue-rotate(180deg);
--button-destructive-bg-color: #5a0000;
--button-destructive-color: #{$oc-red-3};
--text-color-primary: #{$oc-gray-4};
--bg-color-island: #1e1e1e;
--popup-background-color: #2c2c2c;
--button-gray-1: #363636;
--button-gray-2: #272727;
--button-gray-3: #222;
--button-special-active-bg-color: #204624;
--dialog-border-color: #{$oc-gray-9};
--dropdown-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path fill="%23ced4da" d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>');
--focus-highlight-color: #{$oc-blue-6};
--input-border-color: #2e2e2e;
--input-background-color: #121212;
--input-hover-background-color: #181818;
--input-label-color: #{$oc-gray-2};
--icon-fill-color: #{$oc-gray-4};
--icon-green-fill-color: #{$oc-green-4};
--input-bg-color: #121212;
--input-border-color: #2e2e2e;
--input-hover-bg-color: #181818;
--input-label-color: #{$oc-gray-2};
--island-bg-color: #1e1e1e;
--keybinding-color: #{$oc-gray-6};
--overlay-bg-color: #{transparentize($oc-gray-8, 0.88)};
--popup-bg-color: #2c2c2c;
--popup-secondary-bg-color: #222;
--shadow-island: 0 1px 5px #{transparentize($oc-black, 0.7)};
--overlay-background-color: rgba(30, 30, 30, 0.88);
--dropdown-icon: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="292.4" height="292.4" viewBox="0 0 292 292"><path fill="%23ced4da" d="M287 197L159 69c-4-3-8-5-13-5s-9 2-13 5L5 197c-3 4-5 8-5 13s2 9 5 13c4 4 8 5 13 5h256c5 0 9-1 13-5s5-8 5-13-1-9-5-13z"/></svg>');
--focus-highlight-color: #{$oc-blue-6};
--select-highlight-color: #{$oc-blue-4};
--appearance-filter: invert(93%) hue-rotate(180deg);
--button-special-active-background-color: #204624;
--button-destructive-color: #{$oc-red-3};
--button-destructive-background-color: #5a0000;
--popup-secondary-background-color: #222;
--popup-text-color: #{$oc-gray-4};
--popup-text-inverted-color: #2c2c2c;
--select-highlight-color: #{$oc-blue-4};
--shadow-island: 0 1px 5px #{transparentize($oc-black, 0.7)};
--text-primary-color: #{$oc-gray-4};
--dialog-border: #{$oc-gray-9};
}
}

View File

@@ -141,7 +141,7 @@ export const restoreElements = (
}, [] as ExcalidrawElement[]);
};
export const restoreAppState = (
const restoreAppState = (
appState: ImportedDataState["appState"],
localAppState: Partial<AppState> | null,
): AppState => {

View File

@@ -7,7 +7,7 @@
}
.RoomDialog-link {
color: var(--text-primary-color);
color: var(--text-color-primary);
min-width: 0;
flex: 1 1 auto;
margin-inline-start: 1em;
@@ -45,7 +45,7 @@
}
.RoomDialog-username {
background-color: var(--input-bg-color);
background-color: var(--input-background-color);
border-color: var(--input-border-color);
appearance: none;
min-width: 0;
@@ -67,7 +67,7 @@
}
.Modal .RoomDialog-stopSession {
background-color: var(--button-destructive-bg-color);
background-color: var(--button-destructive-background-color);
.ToolIcon__label,
.ToolIcon__icon svg {

View File

@@ -12,18 +12,6 @@ The change should be grouped under one of the below section and must contain PR
Please add the latest change on the top under the correct section.
-->
## [Unreleased]
## Excalidraw API
### Features
- Export [`restore`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L182), [`restoreAppState`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L144) and [`restoreElements`](https://github.com/excalidraw/excalidraw/blob/master/src/data/restore.ts#L128) to host
### Fixes
- Show user state only when [userState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L35) is passed on remote pointers during collaboration [#3050](https://github.com/excalidraw/excalidraw/pull/3050)
## 0.3.1
## Excalidraw API

View File

@@ -252,6 +252,51 @@ export default function IndexPage() {
| [`zenModeEnabled`](#zenModeEnabled) | boolean | | This implies if the zen mode is enabled |
| [`gridModeEnabled`](#gridModeEnabled) | boolean | | This implies if the grid mode is enabled |
### `Extra API's`
#### `getSceneVersion`
**How to use**
<pre>
import { getSceneVersion } from "@excalidraw/excalidraw";
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>)
</pre>
This function returns the current scene version.
#### `getSyncableElements`
**_Signature_**
<pre>
getSyncableElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>):<a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>
</pre>
**How to use**
```js
import { getSyncableElements } from "@excalidraw/excalidraw";
```
This function returns all the deleted elements of the scene.
### `getElementMap`
**_Signature_**
<pre>
getElementsMap(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>): {[id: string]: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>}
</pre>
**How to use**
```js
import { getElementsMap } from "@excalidraw/excalidraw";
```
This function returns an object where each element is mapped to its id.
#### `width`
This props defines the `width` of the Excalidraw component. Defaults to `window.innerWidth` if not passed.
@@ -406,98 +451,3 @@ This prop indicates whether the app is in `zen mode`. When supplied, the value t
#### `gridModeEnabled`
This prop indicates whether the shows the grid. When supplied, the value takes precedence over `intialData.appState.gridModeEnabled`, the grid will be fully controlled by the host app, and users won't be able to toggle it from within the app.
### Extra API's
#### `getSceneVersion`
**How to use**
<pre>
import { getSceneVersion } from "@excalidraw/excalidraw";
getSceneVersion(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>)
</pre>
This function returns the current scene version.
#### `getSyncableElements`
**_Signature_**
<pre>
getSyncableElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>):<a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>
</pre>
**How to use**
```js
import { getSyncableElements } from "@excalidraw/excalidraw";
```
This function returns all the deleted elements of the scene.
#### `getElementMap`
**_Signature_**
<pre>
getElementsMap(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>): {[id: string]: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement</a>}
</pre>
**How to use**
```js
import { getElementsMap } from "@excalidraw/excalidraw";
```
This function returns an object where each element is mapped to its id.
**_The below api's will be available in [next version](https://github.com/excalidraw/excalidraw/blob/master/src/packages/excalidraw/CHANGELOG.md#unreleased)_**
#### `restoreAppState`
**_Signature_**
<pre>
restoreAppState(appState: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L17">ImportedDataState["appState"]</a>, localAppState: Partial<<a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37">AppState</a>> | null): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37">AppState</a>
</pre>
**_How to use_**
```js
import { restoreAppState } from "@excalidraw/excalidraw";
```
This function will make sure all the keys have appropriate values in [appState](https://github.com/excalidraw/excalidraw/blob/master/src/types.ts#L37) and if any key is missing, it will be set to default value. If you pass `localAppState`, `localAppState` value will be preferred over the `appState` passed in params.
#### `restoreElements`
**_Signature_**
<pre>
restoreElements(elements: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L16">ImportedDataState["elements"]</a>): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/element/types.ts#L78">ExcalidrawElement[]</a>
</pre>
**_How to use_**
```js
import { restoreElements } from "@excalidraw/excalidraw";
```
This function will make sure all properties of element is correctly set and if any attribute is missing, it will be set to default value.
#### `restore`
**_Signature_**
<pre>
restoreElements(data: <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L12">ImportedDataState</a>): <a href="https://github.com/excalidraw/excalidraw/blob/master/src/data/types.ts#L4">DataState</a>
</pre>
**_How to use_**
```js
import { restore } from "@excalidraw/excalidraw";
```
This function makes sure elements and state is set to appropriate values and set to default value if not present. It is combination of [restoreElements](#restoreElements) and [restoreAppState](#restoreAppState)

View File

@@ -106,4 +106,3 @@ export {
getElementMap,
} from "../../element";
export { defaultLang, languages } from "../../i18n";
export { restore, restoreAppState, restoreElements } from "../../data/restore";

View File

@@ -1,6 +1,6 @@
{
"name": "aakansha-excalidraw",
"version": "0.4.3",
"name": "@excalidraw/excalidraw",
"version": "0.3.1",
"main": "dist/excalidraw.min.js",
"files": [
"dist/*"

View File

@@ -14,7 +14,6 @@ module.exports = {
libraryTarget: "umd",
filename: "[name].js",
chunkFilename: "excalidraw-assets/[name].js",
publicPath: "https://unpkg.com/aakansha-excalidraw@0.4.3/dist/",
},
resolve: {
extensions: [".js", ".ts", ".tsx", ".css", ".scss"],

View File

@@ -483,20 +483,25 @@ export const renderScene = (
context.stroke();
const username = sceneState.remotePointerUsernames[clientId];
let idleState = "";
if (userState === UserIdleState.AWAY) {
idleState = hasEmojiSupport ? "⚫️" : ` (${UserIdleState.AWAY})`;
} else if (userState === UserIdleState.IDLE) {
idleState = hasEmojiSupport ? "💤" : ` (${UserIdleState.IDLE})`;
} else if (userState === UserIdleState.ACTIVE) {
idleState = hasEmojiSupport ? "🟢" : "";
let usernameAndIdleState;
if (hasEmojiSupport) {
usernameAndIdleState = `${username ? `${username} ` : ""}${
userState === UserIdleState.AWAY
? "⚫️"
: userState === UserIdleState.IDLE
? "💤"
: "🟢"
}`;
} else {
usernameAndIdleState = `${username ? `${username}` : ""}${
userState === UserIdleState.AWAY
? ` (${UserIdleState.AWAY})`
: userState === UserIdleState.IDLE
? ` (${UserIdleState.IDLE})`
: ""
}`;
}
const usernameAndIdleState = `${
username ? `${username} ` : ""
}${idleState}`;
if (!isOutOfBounds && usernameAndIdleState) {
const offsetX = x + width;
const offsetY = y + height;

View File

@@ -1,25 +1,32 @@
{
"headers": [
"routes": [
{
"source": "/(.*)",
"headers": [
{
"key": "Access-Control-Allow-Origin",
"value": "*"
},
{
"key": "X-Content-Type-Options",
"value": "nosniff"
},
{
"key": "Feature-Policy",
"value": "*"
},
{
"key": "Referrer-Policy",
"value": "origin"
}
]
"src": "/",
"dest": "/",
"headers": {
"Access-Control-Allow-Origin": "*",
"X-Content-Type-Options": "nosniff",
"Feature-Policy": "*",
"Referrer-Policy": "origin"
}
},
{
"src": "/#json=.*",
"dest": "/",
"headers": {
"Access-Control-Allow-Origin": "*",
"X-Content-Type-Options": "nosniff",
"Feature-Policy": "*",
"Referrer-Policy": "origin"
}
},
{
"handle": "filesystem"
},
{
"src": "/(.+)",
"dest": "/",
"status": 301
}
]
}