improve notepad features and add drawing canvas
All checks were successful
Deploy Sokko G / deploy (push) Successful in 7s

This commit is contained in:
Shinuwa 2026-07-29 13:51:42 +02:00
parent e73d754082
commit de1b8a5638
20 changed files with 1732 additions and 141 deletions

View file

@ -222,6 +222,11 @@
-webkit-mask-image: url("/static/icons/refresh.svg");
}
.ui-icon-back {
mask-image: url("/static/icons/back.svg");
-webkit-mask-image: url("/static/icons/back.svg");
}
.ui-icon-trash {
mask-image: url("/static/icons/trashcan.svg");
-webkit-mask-image: url("/static/icons/trashcan.svg");

View file

@ -102,6 +102,7 @@
}
.image-viewer-marker {
z-index: 3;
display: inline-grid;
width: 30px;
min-width: 30px;
@ -155,7 +156,7 @@
grid-auto-rows: max-content;
overflow-y: auto;
overscroll-behavior: contain;
padding-right: 4px;
padding: 4px 4px 4px 0;
}
.drawer[aria-hidden="true"] {

View file

@ -774,17 +774,423 @@
background: currentColor;
}
.notepad {
display: block;
width: calc(100% - 32px);
min-height: 240px;
margin: var(--space-4);
.notepad-module {
display: grid;
gap: var(--space-3);
padding: var(--space-4);
resize: vertical;
line-height: 1.6;
}
.notepad-toolbar,
.notepad-toolbar-group,
.notepad-format-controls {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px;
}
.notepad-toolbar {
justify-content: flex-start;
padding: 8px;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: rgba(5, 7, 17, 0.46);
}
.notepad-format-controls {
min-width: 0;
}
.notepad-toolbar-group {
padding-right: 8px;
border-right: 1px solid rgba(150, 165, 205, 0.12);
}
.notepad-toolbar-group:last-child {
padding-right: 0;
border-right: 0;
}
.notepad-toolbar-button,
.drawing-control-button,
.notepad-swatch,
.notepad-color-toggle,
.drawing-width-toggle,
.drawing-width-button {
display: inline-grid;
place-items: center;
width: 34px;
min-width: 34px;
min-height: 34px;
padding: 0;
border-color: rgba(150, 165, 205, 0.18);
border-radius: var(--radius-sm);
background: rgba(16, 20, 38, 0.74);
color: var(--color-text-secondary);
font-size: var(--font-size-sm);
font-weight: 900;
box-shadow: none;
}
.notepad-toolbar-button .ui-icon,
.drawing-control-button .ui-icon {
width: 17px;
height: 17px;
}
.notepad-toolbar-button:hover,
.drawing-control-button:hover,
.notepad-swatch:hover,
.notepad-color-toggle:hover,
.drawing-width-toggle:hover,
.drawing-width-button:hover,
.notepad-toolbar-button.active,
.drawing-control-button.active,
.notepad-swatch.active,
.drawing-width-button.active {
border-color: rgba(246, 196, 83, 0.48);
background: rgba(246, 196, 83, 0.1);
color: var(--color-accent-gold);
}
.notepad-color-dropdown {
position: relative;
}
.notepad-color-toggle::before,
.notepad-swatch::before {
content: "";
width: 18px;
height: 18px;
border: 1px solid rgba(245, 247, 255, 0.22);
border-radius: 50%;
background: var(--swatch-color);
box-shadow: inset 0 0 0 2px rgba(5, 7, 17, 0.36);
}
.notepad-color-toggle.is-rainbow::before {
width: 20px;
height: 20px;
border-color: rgba(245, 247, 255, 0.28);
background: conic-gradient(
from 20deg,
#f6c453,
#22d3ee,
#8b5cf6,
#d946ef,
#f5f7ff,
#f6c453
);
box-shadow:
inset 0 0 0 3px rgba(5, 7, 17, 0.34),
0 0 10px rgba(139, 92, 246, 0.16);
}
.notepad-color-menu {
position: absolute;
top: calc(100% + 8px);
left: 50%;
z-index: 50;
display: grid;
grid-template-columns: repeat(3, 34px);
gap: 6px;
padding: 8px;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: rgba(10, 13, 28, 0.99);
box-shadow: var(--shadow-lg);
opacity: 0;
pointer-events: none;
transform: translate(-50%, -4px);
transition:
opacity 140ms ease,
transform 140ms ease;
}
.notepad-color-menu.is-sectioned {
grid-template-columns: 1fr;
width: 168px;
}
.notepad-color-section {
display: grid;
gap: 6px;
}
.notepad-color-section + .notepad-color-section {
margin-top: 4px;
padding-top: 8px;
border-top: 1px solid rgba(150, 165, 205, 0.12);
}
.notepad-color-section-label {
color: var(--color-text-muted);
font-size: var(--font-size-xs);
font-weight: 800;
}
.notepad-color-section-swatches {
display: grid;
grid-template-columns: repeat(4, 34px);
gap: 6px;
}
.notepad-color-dropdown:hover .notepad-color-menu,
.notepad-color-dropdown:focus-within .notepad-color-menu,
.notepad-color-dropdown.is-open .notepad-color-menu {
opacity: 1;
pointer-events: auto;
transform: translate(-50%, 0);
}
.notepad-color-menu::after {
content: "";
position: absolute;
right: 0;
bottom: 100%;
left: 0;
height: 10px;
}
.notepad-color-menu::before {
content: "";
position: absolute;
bottom: 100%;
left: calc(50% - 7px);
border-right: 7px solid transparent;
border-bottom: 7px solid rgba(10, 13, 28, 0.99);
border-left: 7px solid transparent;
}
.drawing-width-toggle span,
.drawing-width-button span {
width: 20px;
height: var(--line-width);
border-radius: var(--radius-pill);
background: currentColor;
}
.drawing-width-dropdown {
position: relative;
}
.drawing-width-menu {
position: absolute;
right: auto;
bottom: calc(100% + 8px);
left: 50%;
z-index: 50;
display: grid;
grid-template-columns: repeat(2, 34px);
gap: 6px;
padding: 8px;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: rgba(10, 13, 28, 0.99);
box-shadow: var(--shadow-lg);
opacity: 0;
pointer-events: none;
transform: translate(-50%, 4px);
transition:
opacity 140ms ease,
transform 140ms ease;
}
.drawing-width-dropdown:hover .drawing-width-menu,
.drawing-width-dropdown:focus-within .drawing-width-menu,
.drawing-width-dropdown.is-open .drawing-width-menu {
opacity: 1;
pointer-events: auto;
transform: translate(-50%, 0);
}
.drawing-width-menu::after {
content: "";
position: absolute;
top: 100%;
right: 0;
left: 0;
width: 100%;
height: 10px;
}
.drawing-width-menu::before {
content: "";
position: absolute;
top: 100%;
left: calc(50% - 7px);
border-top: 7px solid rgba(10, 13, 28, 0.99);
border-right: 7px solid transparent;
border-left: 7px solid transparent;
}
.notepad-surface {
position: relative;
min-height: 260px;
overflow: auto;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: rgba(5, 7, 17, 0.56);
}
.notepad-surface:focus-within {
border-color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16);
}
.notepad-surface.is-drawing {
cursor: crosshair;
}
.notepad-editor {
position: relative;
z-index: 1;
min-height: 260px;
padding: var(--space-4);
color: var(--color-text-primary);
line-height: 1.6;
outline: none;
white-space: pre-wrap;
}
.notepad-editor[contenteditable="false"] {
pointer-events: none;
}
.notepad-editor.is-empty::before {
content: attr(data-placeholder);
position: absolute;
color: var(--color-text-muted);
pointer-events: none;
}
.notepad-editor h3,
.notepad-editor h4,
.notepad-editor p,
.notepad-editor ul,
.notepad-editor ol {
margin: 0 0 0.75em;
}
.notepad-editor h3 {
font-size: 1.08rem;
}
.notepad-editor h4 {
font-size: 0.98rem;
}
.notepad-editor ul,
.notepad-editor ol {
padding-left: 1.35rem;
}
.drawing-overlay {
position: absolute;
top: 0;
left: 0;
z-index: 2;
pointer-events: none;
touch-action: none;
}
.drawing-overlay.is-active {
cursor: crosshair;
pointer-events: auto;
}
.drawing-overlay.is-erase {
cursor: crosshair;
}
.drawing-controls-panel {
position: absolute;
right: 50%;
bottom: 10px;
z-index: 6;
display: flex;
flex-direction: row;
align-items: center;
gap: 6px;
width: max-content;
max-width: calc(100% - 20px);
padding: 8px;
border: 1px solid var(--color-border);
border-radius: var(--radius-md);
background: rgba(10, 13, 28, 0.94);
box-shadow: var(--shadow-md);
transform: translateX(50%);
}
.drawing-controls-panel:not(.is-open) {
width: auto;
padding: 6px;
}
.drawing-controls-panel .drawing-storage-switch {
display: inline-grid;
grid-template-columns: 16px 30px;
grid-template-rows: 1fr;
width: fit-content;
min-width: 64px;
min-height: 34px;
gap: 7px;
justify-items: initial;
padding: 0 7px 0 10px;
}
.drawing-controls-panel .drawing-storage-switch .ui-icon {
justify-self: initial;
}
.drawing-controls-panel .drawing-storage-switch i {
width: 30px;
height: 16px;
}
.drawing-controls-panel .notepad-color-menu {
top: auto;
bottom: calc(100% + 8px);
right: auto;
left: 50%;
transform: translate(-50%, 4px);
}
.drawing-controls-panel .notepad-color-dropdown:hover .notepad-color-menu,
.drawing-controls-panel .notepad-color-dropdown:focus-within .notepad-color-menu,
.drawing-controls-panel .notepad-color-dropdown.is-open .notepad-color-menu {
transform: translate(-50%, 0);
}
.drawing-controls-panel .notepad-color-menu::after {
top: 100%;
right: 0;
bottom: auto;
left: 0;
width: 100%;
height: 10px;
}
.drawing-controls-panel .notepad-color-menu::before {
top: 100%;
right: auto;
left: calc(50% - 7px);
bottom: auto;
border-top: 7px solid rgba(10, 13, 28, 0.99);
border-right: 7px solid transparent;
border-bottom: 0;
border-left: 7px solid transparent;
}
.notepad-footer {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: var(--space-2);
color: var(--color-text-muted);
font-size: var(--font-size-xs);
}
.inline-form,
.field {
display: grid;
@ -2864,6 +3270,7 @@ textarea:focus {
.annotation-marker {
position: absolute;
z-index: 3;
display: inline-grid;
left: clamp(0px, calc(var(--marker-x, 50%) - 15px), calc(100% - 30px));
top: clamp(0px, calc(var(--marker-y, 50%) - 15px), calc(100% - 30px));
@ -2909,6 +3316,7 @@ textarea:focus {
grid-template-columns: 28px minmax(0, 1fr) auto;
gap: var(--space-2);
align-items: center;
padding-block: 3px;
}
.annotation-marker-list li > span {