@gamesberry/karmyc-core
Version:
A flexible and powerful layout management system for React applications
724 lines (610 loc) • 13.6 kB
CSS
:root {
--lighter-bg: #7e748a;
--normal-bg: #3f3a44;
--darker-bg: #2e1f35;
/* Dimensions et polices */
--toolbar-height: 40px;
--font-family: 'Open sans', sans-serif;
--font-monospace: 'Source Code Pro', monospace;
--area-border-width: 2px;
--space-color: var(--primary-700);
/* Z-index */
--z-index-graph-editor-zoom-target: 55;
--z-index-flow-editor-connections: 500;
--z-index-flow-editor-nodes: 1000;
--z-index-flow-editor-drag-select-preview: 1010;
--z-index-flow-editor-pan-target: 2000;
--z-index-flow-editor-zoom-target: 2010;
--z-index-flow-editor-click-capture-target: 2020;
--z-index-area-base: 5;
--z-index-area-separator: 2000;
--z-index-area-cursor-capture: 15;
--z-index-area-active: 20;
--z-index-area-join-preview: 25;
--z-index-area-area-to-open-target: 99;
--z-index-area-area-to-open: 100;
--z-index-timeline-scrubber-interaction-area: 1;
--z-index-timeline-scrubber-canvas: 2;
--z-index-timeline-scrubber-head: 3;
--z-index-toolbar: 100;
--z-index-drag-comp: 200;
--z-index-context-menu-background: 500;
--z-index-context-menu: 501;
/* Opacités pour les couleurs primaires */
--primary-700-07: rgba(144, 75, 255, 0.07);
--primary-700-15: rgba(144, 75, 255, 0.15);
--primary-700-30: rgba(144, 75, 255, 0.3);
}
.screen-switcher-menu {
background: var(--normal-bg);
border: 1px solid var(--darker-bg);
color: white;
padding: 0;
}
.screen-switcher-menu .szh-menu__item {
&:hover {
background: var(--darker-bg);
}
}
.screen-switcher-menu .szh-menu__item svg {
width: 12px;
height: 12px;
margin-right: 8px;
}
.switch-area-type-context-menu {
background: #222;
color: #fff;
display: flex;
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
border-radius: 6px;
min-width: 400px;
padding: 8px;
display: flex;
flex-direction: row;
gap: 8px;
}
.context-menu {
z-index: 9999 ;
}
/* Styles de la barre de défilement */
.dark-scrollbar {
scrollbar-color: var(--normal-bg) var(--darker-bg);
scrollbar-width: thin;
}
.dark-scrollbar::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.dark-scrollbar::-webkit-scrollbar-track {
background: var(--darker-bg);
border-radius: 4px;
}
.dark-scrollbar::-webkit-scrollbar-thumb {
background: var(--normal-bg);
border-radius: 4px;
}
.dark-scrollbar::-webkit-scrollbar-thumb:hover {
background: var(--normal-bg);
}
.area {
position: absolute;
z-index: var(--z-index-area-base);
}
.area.active {
z-index: var(--z-index-area-active);
}
.area__content {
border-radius: 8px;
background: var(--normal-bg);
position: absolute;
z-index: 1;
top: var(--area-border-width);
left: var(--area-border-width);
bottom: var(--area-border-width);
right: var(--area-border-width);
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
}
.area__content>div {
width: 100%;
height: 100%;
}
.area__structured {
border-radius: 8px;
background: var(--normal-bg);
position: absolute;
z-index: 1;
top: var(--area-border-width);
left: var(--area-border-width);
bottom: var(--area-border-width);
right: var(--area-border-width);
overflow: hidden;
display: flex;
flex-direction: column;
}
.area__content_container {
flex: 1;
position: relative;
overflow: hidden;
}
.area__corner {
width: 25px;
height: 25px;
position: absolute;
z-index: 2;
cursor: crosshair;
background: var(--space-color);
border-radius: 0;
opacity: 0;
transition: all 0.2s ease;
box-shadow: 0;
&:hover {
opacity: 0.5;
}
}
.area__corner--nw {
top: 0;
left: 0;
border-bottom-right-radius: 100%;
}
.area__corner--ne {
top: 0;
right: 0;
border-top-left-radius: 100%;
}
.area__corner--sw {
bottom: 0;
left: 0;
border-top-right-radius: 100%;
}
.area__corner--se {
bottom: 0;
right: 0;
border-top-left-radius: 100%;
}
.select-area-button {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
width: 100%;
background: var(--normal-bg);
cursor: grab;
z-index: 1000;
padding: 0 5px;
min-width: 120px;
&:active {
cursor: grabbing;
}
}
.select-area-button__action-icons {
margin-left: 10px;
}
.select-area-button__main {
margin-left: 5px;
display: flex;
align-items: center;
color: white;
flex: 1 1 0;
min-width: 0;
gap: 5px;
}
.select-area-button__icon {
width: 15px;
height: 15px;
}
.select-area-button__name {
color: white;
flex: 1 1 0;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 8px;
}
.select-area-icons {
width: 16px;
height: 16px;
background-color: transparent;
border: none;
color: white;
& svg {
width: 16px;
height: 16px;
}
+.select-area-icons {
margin-left: 10px;
}
&:hover {
cursor: pointer;
}
}
.select-area-button__lock-icon {
width: 20px;
height: 20px;
&.locked {
color: var(--lighter-bg);
& svg {
& rect {
fill: var(--lighter-bg);
}
}
}
& svg {
width: 16px;
height: 16px;
& rect {
fill: white;
}
}
}
.selectArea {
position: absolute;
top: -32px;
left: -32px;
padding: 36px;
z-index: 15;
background: transparent;
}
.selectArea__inner {
border: 1px solid var(--darker-bg);
background: var(--darker-bg);
}
.selectArea__item {
color: white;
border: none;
border-radius: 4px;
padding: 0 24px;
background: var(--darker-bg);
display: block;
width: 128px;
}
.tools-container {
overflow: hidden;
}
.tools-content {
position: relative;
}
.tools-bar-section {
display: flex;
align-items: center;
flex: 1;
gap: 8px;
}
.tools-bar-section button {
background: none;
border: none;
cursor: pointer;
padding: 4px;
color: #999;
transition: color 0.2s ease;
}
.tools-bar-section button:hover {
color: #fff;
}
.tools-bar-section--left {
justify-content: flex-start;
}
.tools-bar-section--center {
justify-content: center;
}
.tools-bar-section--right {
justify-content: flex-end;
}
.area-main-content-wrapper {
flex-grow: 1;
overflow-y: auto;
position: relative;
display: flex;
flex-direction: column;
justify-content: space-between;
background: var(--lighter-bg);
}
.area-container {
position: absolute;
display: flex;
flex-direction: column;
overflow: hidden;
}
.area-container__content {
position: relative;
overflow: hidden;
width: 100%;
height: 100%;
}
.area-preview {
position: fixed;
z-index: 1000000;
cursor: move;
pointer-events: none;
user-select: none;
touch-action: none;
will-change: transform;
transform: translate(-50%, -50%) scale(0.4);
outline: 3px dashed blue;
background: rgba(255, 255, 255, 0.5);
border-radius: 4px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
.area-stack {
position: absolute;
border: 1px solid #404040;
display: flex;
flex-direction: column;
overflow: hidden;
}
.area-stack__content {
flex: 1;
position: relative;
overflow: hidden;
}
.empty-area-message {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
width: 100%;
padding: 16px;
}
.empty-area-message__text {
font-size: 16px;
color: #666;
text-align: center;
}
.tools-bar {
display: flex;
flex-direction: row;
padding: 5px 10px;
line-height: 1em;
}
.tools-bar-top-inner,
.tools-bar-bottom-inner {
background-color: transparent;
position: absolute;
width: 100%;
padding: 0 10px;
z-index: 500;
}
.tools-bar-top-inner {
margin-top: 10px;
}
.tools-bar-bottom-inner {
margin-bottom: 10px;
}
.tools-bar-top-outer {
background-color: var(--normal-bg);
}
.tools-bar-bottom-outer {
background-color: var(--normal-bg);
}
.join-area-preview {
position: absolute;
z-index: var(--z-index-area-join-preview);
}
.join-area-preview__arrow-container {
position: absolute;
top: var(--area-border-width);
left: var(--area-border-width);
right: var(--area-border-width);
bottom: var(--area-border-width);
background: rgba(0, 0, 0, 0.2);
border-radius: 8px;
opacity: 0;
}
.join-area-preview__arrow-container:hover {
opacity: 1;
}
.join-area-preview__arrow-container--n {
cursor: n-resize;
}
.join-area-preview__arrow-container--s {
cursor: s-resize;
}
.join-area-preview__arrow-container--w {
cursor: w-resize;
}
.join-area-preview__arrow-container--e {
cursor: e-resize;
}
.join-area-preview__arrow {
position: absolute;
}
.join-area-preview__arrow--n {
bottom: -25%;
left: 50%;
transform: translateX(-50%) rotate(180deg);
}
.join-area-preview__arrow--s {
top: 0;
left: 50%;
transform: translateX(-50%);
}
.join-area-preview__arrow--w {
right: 0;
top: 50%;
transform: translateY(-50%) rotate(90deg);
}
.join-area-preview__arrow--e {
left: 0;
top: 50%;
transform: translateY(-50%) rotate(-90deg);
}
.join-area-preview__arrow svg {
fill: rgba(0, 0, 0, 0.3);
}
.area-to-open-overlay {
position: fixed;
inset: 0;
z-index: 9999;
pointer-events: auto;
}
.area-to-open-overlay__placement {
position: absolute;
pointer-events: none;
fill: var(--primary-700-15);
stroke: var(--primary-700-30);
}
.area-separator {
position: absolute;
z-index: var(--z-index-area-separator);
background-color: var(--normal-bg);
cursor: ns-resize;
display: flex;
align-items: center;
justify-content: center;
& svg {
color: rgba(0, 0, 0, 0.5);
margin: -2px
}
}
.area-separator--horizontal {
cursor: ew-resize;
}
.area-root {
position: relative;
width: 100vw;
height: 100vh;
overflow: hidden;
}
.cursor-capture {
display: none;
}
.cursor-capture--active {
position: absolute;
display: block;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: var(--z-index-area-cursor-capture);
cursor: not-allowed;
}
.area-to-open-container {
z-index: var(--z-index-area-area-to-open);
transform: scale(0.5);
position: fixed;
opacity: 0.8;
animation: area-to-open-container-animation 0.3s;
cursor: grabbing;
pointer-events: all;
user-select: none;
touch-action: none;
}
.area-to-open-container>* {
pointer-events: all;
}
.area-to-open-target-overlay {
z-index: var(--z-index-area-area-to-open-target);
position: absolute;
background: var(--primary-700-07);
border-radius: 8px;
opacity: 1;
overflow: hidden;
pointer-events: all;
cursor: copy;
transition: background-color 0.2s ease;
user-select: none;
touch-action: none;
}
.area-to-open-target-overlay:hover,
.area-to-open-target-overlay.dragover {
background: var(--primary-700-15);
}
.placement line {
stroke-width: 1px;
stroke: var(--primary-700-30);
}
.placement path {
fill: var(--primary-700-15);
}
@keyframes area-to-open-container-animation {
0% {
transform: scale(0.25);
opacity: .3
}
50% {
transform: scale(0.52);
opacity: .8;
}
100% {
transform: scale(0.5);
}
}
/* Styles pour AreaTabs */
.area-tabs {
display: flex;
gap: 1px;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: thin;
scrollbar-color: var(--normal-bg) var(--darker-bg);
min-height: 32px;
border-bottom: 1px solid var(--normal-bg);
background: var(--darker-bg);
}
.area-tab {
display: flex;
align-items: center;
min-width: 120px;
flex: 0 0 auto;
padding: 0;
background: transparent;
border-radius: 0 6px 0 0;
cursor: pointer;
user-select: none;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: relative;
transition: opacity 0.2s ease-in-out, margin-left 0.2s ease-in-out, margin-right 0.2s ease-in-out;
}
.area-tab .select-area-button:hover {
background: #353535;
}
.area-tab--active {
background: darkgray;
color: #fff;
}
.area-tab--active:hover {
background: #404040;
}
.area-tab.drop-indicator-before::before,
.area-tab.drop-indicator-after::after {
content: "";
position: absolute;
top: 0;
bottom: 0;
background-color: rgba(0, 123, 255, 0.1);
border: 1px dashed #007bff;
z-index: 10;
width: 0;
opacity: 0;
transition: width 0.1s ease-out, opacity 0.1s ease-out;
}
.area-tab.drop-indicator-before::before {
left: -2px;
width: 70px;
opacity: 1;
}
.area-tab.drop-indicator-after::after {
right: -2px;
width: 70px;
opacity: 1;
}
.area-tab:not(.drop-indicator-before):not(.drop-indicator-after)::before,
.area-tab:not(.drop-indicator-before):not(.drop-indicator-after)::after {
opacity: 0;
}
.area-tab.is-dragging-source {
opacity: 0.3;
width: 10px;
overflow: hidden;
}
.area-tab.drop-indicator-before {
margin-left: 50px;
}
.area-tab.drop-indicator-after {
margin-right: 50px;
}