excalidraw/src/css/styles.scss

602 lines
11 KiB
SCSS
Raw Normal View History

@import "./variables.module";
@import "./theme";
:root {
--zIndex-canvas: 1;
--zIndex-wysiwyg: 2;
--zIndex-layerUI: 3;
}
.excalidraw {
position: relative;
overflow: hidden;
color: var(--text-primary-color);
2020-01-04 19:14:12 +01:00
display: flex;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
2020-01-04 19:14:12 +01:00
&:focus {
outline: none;
}
// serves 2 purposes:
// 1. prevent selecting text outside the component when double-clicking or
// dragging inside it (e.g. on canvas)
// 2. prevent selecting UI, both from the inside, and from outside the
// component (e.g. if you select text in a sidebar)
user-select: none;
a {
font-weight: 500;
text-decoration: none;
color: var(--link-color);
&:hover {
text-decoration: underline;
}
}
canvas {
touch-action: none;
// following props improve blurriness at certain devicePixelRatios.
// AFAIK it doesn't affect export (in fact, export seems sharp either way).
2020-01-04 19:14:12 +01:00
image-rendering: pixelated; // chromium
// NOTE: must be declared *after* the above
image-rendering: -moz-crisp-edges; // FF
z-index: var(--zIndex-canvas);
// Remove the main canvas from document flow to avoid resizeObserver
// feedback loop (see https://github.com/excalidraw/excalidraw/pull/3379)
}
&__canvas {
position: absolute;
2020-01-04 19:14:12 +01:00
}
&.theme--dark {
// The percentage is inspired by
// https://material.io/design/color/dark-theme.html#properties, which
// recommends surface color of #121212, 93% yields #111111 for #FFF
canvas {
filter: var(--theme-filter);
}
}
.FixedSideContainer {
padding-top: var(--sat, 0);
padding-right: var(--sar, 0);
padding-bottom: var(--sab, 0);
padding-left: var(--sal, 0);
}
.panelRow {
display: flex;
justify-content: space-between;
}
.panelColumn {
display: flex;
flex-direction: column;
2020-01-04 19:14:12 +01:00
h3,
legend,
.control-label {
margin-top: 0.333rem;
margin-bottom: 0.333rem;
2020-01-20 19:59:00 -03:00
font-size: 0.75rem;
color: var(--text-primary-color);
font-weight: bold;
display: block;
}
.control-label input {
display: block;
width: 100%;
}
h3:first-child,
legend:first-child,
.control-label:first-child {
margin-top: 0;
}
legend {
padding: 0;
}
.iconSelectList {
flex-wrap: wrap;
position: relative;
}
.buttonList {
flex-wrap: wrap;
label {
margin-right: 0.25rem;
font-size: 0.75rem;
display: inline-block;
}
input[type="radio"],
input[type="button"] {
opacity: 0;
position: absolute;
pointer-events: none;
}
2020-11-23 18:16:23 +00:00
.iconRow {
margin-top: 8px;
}
.ToolIcon {
margin: 0;
margin-inline-end: 8px;
2020-11-23 18:16:23 +00:00
&:focus {
outline: transparent;
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
&:hover {
background-color: var(--button-gray-2);
}
&:active {
background-color: var(--button-gray-3);
}
&:disabled {
cursor: not-allowed;
}
}
.ToolIcon__icon {
width: 28px;
height: 28px;
}
}
fieldset {
margin: 0;
margin-top: 0.333rem;
padding: 0;
border: none;
}
2020-01-04 19:14:12 +01:00
}
.divider {
width: 1px;
background-color: $oc-gray-2;
margin: 1px;
}
2020-01-04 19:14:12 +01:00
.buttonList label:focus-within,
input:focus {
outline: transparent;
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
button,
.buttonList label {
user-select: none;
background-color: var(--button-gray-1);
border: 0;
border-radius: 4px;
margin: 0.125rem 0;
padding: 0.25rem;
white-space: nowrap;
2020-01-04 19:14:12 +01:00
cursor: pointer;
&:focus {
outline: transparent;
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
&:hover {
background-color: var(--button-gray-2);
}
&:active {
background-color: var(--button-gray-3);
}
&:disabled {
cursor: not-allowed;
}
}
2020-01-04 19:14:12 +01:00
.active,
.buttonList label.active {
background-color: var(--button-gray-2);
2020-01-04 19:14:12 +01:00
&:hover {
background-color: var(--button-gray-2);
}
2020-01-04 19:14:12 +01:00
&:active {
background-color: var(--button-gray-3);
}
2020-01-04 19:14:12 +01:00
}
2020-11-01 20:08:48 +01:00
.buttonList.buttonListIcon {
label {
display: inline-flex;
justify-content: center;
align-items: center;
svg {
width: 36px;
height: 14px;
padding: 2px;
2020-11-01 20:08:48 +01:00
opacity: 0.6;
}
&.active svg {
opacity: 1;
}
}
}
.App-top-bar {
z-index: var(--zIndex-layerUI);
display: flex;
flex-direction: column;
align-items: center;
}
.App-bottom-bar {
position: absolute;
top: 0;
bottom: 0;
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);
z-index: 4;
display: flex;
align-items: flex-end;
pointer-events: none;
> .Island {
width: 100%;
max-width: 100%;
min-width: 100%;
box-sizing: border-box;
max-height: 100%;
display: flex;
flex-direction: column;
pointer-events: initial;
.panelColumn {
padding: 8px 8px 0 8px;
}
}
}
.App-toolbar {
width: 100%;
box-sizing: border-box;
}
.App-toolbar-content {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px;
}
.App-mobile-menu {
width: 100%;
overflow-x: visible;
overflow-y: auto;
box-sizing: border-box;
margin-bottom: var(--bar-padding);
}
.App-menu {
display: grid;
color: var(--icon-fill-color);
}
.App-menu_top {
2021-12-05 17:47:19 +01:00
grid-template-columns: auto max-content auto;
grid-gap: 4px;
align-items: flex-start;
cursor: default;
pointer-events: none !important;
}
.layer-ui__wrapper:not(.disable-pointerEvents) .App-menu_top > * {
pointer-events: all;
}
.App-menu_top > *:first-child {
justify-self: flex-start;
}
.App-menu_top > *:last-child {
justify-self: flex-end;
}
.App-menu_bottom {
position: absolute;
bottom: 0;
grid-template-columns: min-content auto min-content;
grid-gap: 15px;
align-items: flex-start;
cursor: default;
pointer-events: none !important;
z-index: 100;
:root[dir="ltr"] & {
left: 0.25rem;
}
:root[dir="rtl"] & {
right: 0.25rem;
}
&--transition-left {
section {
width: 185px;
}
}
section {
display: flex;
}
}
.App-menu_bottom > *:first-child {
justify-self: flex-start;
}
.App-menu_bottom > *:last-child {
justify-self: flex-end;
}
.App-menu_left {
grid-template-rows: 1fr auto 1fr;
height: 100%;
}
.App-menu_right {
grid-template-rows: 1fr;
height: 100%;
}
.App-menu__left {
overflow-y: auto;
}
.dropdown-select {
height: 1.5rem;
padding: 0;
padding-inline-start: 0.5rem;
padding-inline-end: 1.5rem;
color: var(--icon-fill-color);
background-color: var(--button-gray-1);
border-radius: var(--space-factor);
border: 1px solid var(--button-gray-2);
font-size: 0.8rem;
outline: none;
appearance: none;
background-image: var(--dropdown-icon);
background-repeat: no-repeat;
background-position: right 0.7rem top 50%, 0 0;
:root[dir="rtl"] & {
background-position: left 0.7rem top 50%, 0 0;
}
background-size: 0.65em auto, 100%;
&:focus {
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
&:hover {
background-color: var(--button-gray-2);
}
&:active {
background-color: var(--button-gray-2);
}
2020-04-07 16:12:10 +05:30
}
.zIndexButton {
margin: 0;
margin-inline-end: 8px;
padding: 5px;
display: inline-flex;
align-items: center;
justify-content: center;
svg {
width: 18px;
height: 18px;
}
}
.scroll-back-to-content {
color: var(--popup-text-color);
position: absolute;
left: 50%;
bottom: 30px;
transform: translateX(-50%);
padding: 10px 20px;
}
.help-icon {
display: flex;
cursor: pointer;
fill: $oc-gray-6;
padding: 0;
margin: 0;
background: none;
color: var(--icon-fill-color);
svg {
width: 1.5rem;
height: 1.5rem;
}
&:hover {
background: none;
}
}
.reset-zoom-button {
padding: 0.2em;
background: transparent;
color: var(--text-primary-color);
font-family: var(--ui-font);
}
.undo-redo-buttons {
display: grid;
grid-auto-flow: column;
gap: 0.4em;
margin-top: auto;
margin-bottom: auto;
margin-inline-start: 0.6em;
}
@include isMobile {
aside {
display: none;
}
.scroll-back-to-content {
bottom: calc(80px + var(--sab, 0));
z-index: -1;
}
}
.rtl-mirror {
:root[dir="rtl"] & {
transform: scaleX(-1);
}
}
.zen-mode-visibility {
visibility: visible;
opacity: 1;
height: auto;
width: auto;
transition: opacity 0.5s;
&.zen-mode-visibility--hidden {
visibility: hidden;
opacity: 0;
height: 0;
width: 0;
transition: opacity 0.5s;
}
}
.disable-pointerEvents {
pointer-events: none !important;
}
&.excalidraw--view-mode {
.App-menu {
display: flex;
justify-content: space-between;
}
}
feat: Allow publishing libraries from UI (#4115) * feat: Allow publishing libraries from UI * Add status for each library item and show publish only for unpublished libs * Add publish library dialog * Pass the data to publish the library * pass lib blob * Handle old and new libraries when importing * Better error handling * Show publish success when library submitted for review * don't close library when publish success dialog open * Support multiple libs deletion and publish * Set status to published once library submitted for review * Save to LS after library published * unique key for publish and delete * fix layout shift when hover and also highlight selected library items * design improvements * migrate old library to the new one * fix * fix tests * use i18n * Support submit type in toolbutton * Use html5 form validation, add asteriks for required fields, add twitter handle, mark github handle optional * Add twitter handle in form state * revert html5 validation as fetch is giving some issues :/ * clarify types around LibraryItems * Add website optional field * event.preventDefault to make htm5 form validationw work * improve png generation by drawing a bounding box rect and aligining pngs to support multiple libs png * remove ts-ignore * add placeholders for fields * decrease clickable area for checkbox by 0.5em * add checkbox background color * rename `items` to `elements` * improve checkbox hit area * show selected library items in publish dialog * decrease dimensions by 3px to improve jerky experience when opening/closing library menu * Don't close publish dialog when clicked outside * Show selected library actions only when any library item selected and use icons instead of button * rename library to libraryItems in excalidrawLib and added migration * change icon and swap bg/color * use blue brand color for hover/selected states * prompt for confirmation when deleting library items * separate unpublished items from published * factor `LibraryMenu` into own file * i18n and minor fixes for unpublished items * fix not rendering empty cells when library empty * don't render published section if empty and unpublished is not * Add edit name functionality for library items * fix * edit lib name with onchange/blur * bump library version * prefer response error message * add library urls to ENV vars * mark lib item name as required * Use input only for lib item name * better error validation for lib items * fix label styling for lib items * design and i18n fixes * Save publish dialog data to local storage and clear once published * Add a note about MIT License * Add note for guidelines * Add tooltip for publish button * Show spinner in submit button when submission is in progress * assign id for older lib items when installed and set status as published for all lib when installed * update export icon and support export library for selected items * move LibraryMenuItems into its own component as its best to keep one comp per file * fix spec * Refactoring the library actions for reusablility * show only load when items not present * close on click outside in publish dialog * ad dialog description and tweak copy * vertically center input labels * align input styles * move author name input to other usernames * rename param * inline to simplify * fix to not inline `undefined` class names * fix version & include only latest lib schema in library export type * await response callback * refactor types * refactor * i18n * align casing & tweaks * move ls logic to publishLibrary * support removal of item inside publish dialog * fix labels for trash icon when items selected * replace window.confirm for removal libs with confirm dialog * fix input/textarea styling * move library item menu scss to its own file * use blue for load and cyan for publish * reduce margin for submit and make submit => Submit * Make library items header sticky * move publish icon to left so there is no jerkiness when unpublish items selected * update url * fix grid gap between lib items * Mark older items imported from initial data as unpublished * add text to publish button on non-mobile * add items counter * fix test * show personal and excal libs sections and personal goes first * show toast on adding to library via contextMenu * Animate plus icon and not the pending item * fix snap * use i18n when no item in publish dialog * tweak style of new lib item * show empty cells for both sections and set status as published for installed libs * fix * push selected item first in unpublished section * set status as published for imported from webiste but unpublished for json * Add items to the begining of library * add `created` library item attr * fix test * use `defaultValue` instead of `value` * fix dark theme styles * fix toggle button not closing library * close library menu on Escape * tweak publish dialog item remove style * fix remove icon in publish dialog Co-authored-by: dwelle <luzar.david@gmail.com>
2021-11-17 23:53:43 +05:30
input[type="text"],
textarea:not(.excalidraw-wysiwyg) {
color: var(--text-primary-color);
border: 1.5px solid var(--input-border-color);
padding: 0.75rem;
white-space: nowrap;
border-radius: var(--space-factor);
background-color: var(--input-bg-color);
&:not(:focus) {
&:hover {
background-color: var(--input-hover-bg-color);
}
}
&:focus {
outline: none;
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
}
@media print {
.App-bottom-bar,
.FixedSideContainer,
.layer-ui__wrapper {
display: none;
}
}
}
.ErrorSplash.excalidraw {
min-height: 100vh;
padding: 20px 0;
overflow: auto;
display: flex;
align-items: center;
justify-content: center;
user-select: text;
.ErrorSplash-messageContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px;
background-color: $oc-red-1;
border: 3px solid $oc-red-9;
}
.ErrorSplash-paragraph {
margin: 15px 0;
max-width: 600px;
&.align-center {
text-align: center;
}
}
.bigger,
.bigger button {
font-size: 1.1em;
}
.smaller,
.smaller button {
font-size: 0.9em;
}
.ErrorSplash-details {
display: flex;
flex-direction: column;
align-items: flex-start;
textarea {
width: 100%;
margin: 10px 0;
font-family: "Cascadia";
font-size: 0.8em;
}
}
}