RealBlocks / client /src /index.css
incognitolm's picture
Redesign block editor with proper Scratch-style colored blocks
df9ac1f
Raw
History Blame Contribute Delete
12.4 kB
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', system-ui, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
::-webkit-scrollbar {
width: 6px;
height: 6px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: rgba(148, 163, 184, 0.3);
border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
background: rgba(148, 163, 184, 0.5);
}
}
@layer components {
.btn {
@apply inline-flex items-center justify-center gap-2 px-4 py-2 rounded-lg font-medium text-sm
transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-surface-900
disabled:opacity-50 disabled:cursor-not-allowed;
}
.btn-primary {
@apply btn bg-primary-600 hover:bg-primary-500 text-white focus:ring-primary-500;
}
.btn-secondary {
@apply btn bg-surface-700 hover:bg-surface-600 text-surface-100 focus:ring-surface-500;
}
.btn-ghost {
@apply btn bg-transparent hover:bg-surface-800 text-surface-300 hover:text-white;
}
.btn-danger {
@apply btn bg-red-600 hover:bg-red-500 text-white focus:ring-red-500;
}
.input {
@apply w-full px-3 py-2 bg-surface-800 border border-surface-700 rounded-lg text-white text-sm
placeholder:text-surface-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent
transition-all duration-200;
}
.card {
@apply bg-surface-800 border border-surface-700 rounded-xl p-6;
}
.panel {
@apply bg-surface-900 border-r border-surface-700;
}
.badge {
@apply inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium;
}
.badge-web { @apply badge bg-blue-500/20 text-blue-300; }
.badge-electron { @apply badge bg-cyan-500/20 text-cyan-300; }
.badge-maui { @apply badge bg-purple-500/20 text-purple-300; }
.badge-nodejs { @apply badge bg-green-500/20 text-green-300; }
}
@layer utilities {
.text-gradient {
@apply bg-clip-text text-transparent bg-gradient-to-r from-primary-400 to-purple-400;
}
.glass {
@apply bg-surface-800/80 backdrop-blur-sm;
}
}
/* Block node styles */
.block-node {
position: relative;
min-width: 160px;
max-width: 260px;
display: flex;
flex-direction: column;
cursor: pointer;
font-family: 'Inter', system-ui, sans-serif;
font-size: 12px;
font-weight: 500;
color: #fff;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
user-select: none;
}
.block-node:hover {
filter: brightness(1.08);
}
.block-selected {
filter: brightness(1.15) drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}
/* Hat block: rounded top with bump, flat-ish bottom */
.block-shape-hat {
border-top-left-radius: 14px;
border-top-right-radius: 14px;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
padding: 4px 0 8px 0;
}
.block-shape-hat::before {
content: '';
position: absolute;
top: -8px;
left: 50%;
transform: translateX(-50%);
width: 24px;
height: 8px;
background: var(--block-color, #6366f1);
border-radius: 6px 6px 0 0;
z-index: 0;
}
/* Stack block: notch on top, bump on bottom */
.block-shape-stack {
border-radius: 4px;
padding: 0;
margin: 4px 0;
}
.block-shape-stack::before {
content: '';
position: absolute;
top: -1px;
left: 50%;
transform: translateX(-50%);
width: 16px;
height: 4px;
background: #0a0f1a;
border-radius: 0 0 4px 4px;
z-index: 2;
}
.block-shape-stack::after {
content: '';
position: absolute;
bottom: -1px;
left: 50%;
transform: translateX(-50%);
width: 16px;
height: 4px;
background: var(--block-color, #6366f1);
border-radius: 0 0 4px 4px;
z-index: 2;
}
/* Boolean block: hexagon/diamond shape */
.block-shape-boolean {
clip-path: polygon(8px 0%, calc(100% - 8px) 0%, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0% 50%);
padding: 4px 18px;
min-width: 100px;
max-width: 200px;
}
/* Reporter block: pill/oval shape */
.block-shape-reporter {
border-radius: 999px;
padding: 3px 4px;
min-width: 80px;
max-width: 200px;
display: inline-flex;
flex-direction: row;
align-items: center;
}
/* C-block: stack shape with inner cavity */
.block-shape-cblock {
border-radius: 4px 4px 4px 4px;
padding: 0;
margin: 4px 0;
}
.block-shape-cblock::before {
content: '';
position: absolute;
top: -1px;
left: 50%;
transform: translateX(-50%);
width: 16px;
height: 4px;
background: #0a0f1a;
border-radius: 0 0 4px 4px;
z-index: 2;
}
.block-shape-cblock::after {
content: '';
position: absolute;
bottom: -1px;
left: 50%;
transform: translateX(-50%);
width: 16px;
height: 4px;
background: var(--block-color, #6366f1);
border-radius: 0 0 4px 4px;
z-index: 2;
}
/* Cap block: flat top, rounded bottom */
.block-shape-cap {
border-top-left-radius: 2px;
border-top-right-radius: 2px;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
padding: 4px 0 2px 0;
}
.block-shape-cap::after {
content: '';
position: absolute;
bottom: -1px;
left: 50%;
transform: translateX(-50%);
width: 16px;
height: 4px;
background: var(--block-color, #6366f1);
border-radius: 0 0 4px 4px;
z-index: 2;
}
/* Block body (main content area) */
.block-body {
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-items: center;
gap: 3px;
padding: 5px 8px;
position: relative;
z-index: 1;
}
.block-shape-hat .block-body {
padding: 6px 10px 4px 10px;
}
.block-shape-cblock > .block-body {
padding: 5px 8px 6px 8px;
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
.block-shape-cap .block-body {
padding: 4px 10px 3px 10px;
}
.block-shape-reporter .block-body {
padding: 3px 6px;
gap: 4px;
}
/* Block label text */
.block-label {
font-weight: 500;
font-size: 11px;
color: rgba(255, 255, 255, 0.95);
white-space: nowrap;
}
/* Block icon */
.block-icon {
font-size: 12px;
margin-right: 2px;
opacity: 0.9;
}
/* Input slot - default style (text input pill) */
.block-input {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px 8px;
min-height: 18px;
min-width: 28px;
background: rgba(255, 255, 255, 0.95);
color: #1e293b;
border-radius: 999px;
font-size: 10px;
font-weight: 600;
text-shadow: none;
border: 1px solid rgba(0, 0, 0, 0.15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
white-space: nowrap;
cursor: text;
}
.block-input.text-input {
min-width: 36px;
}
.block-input.number-input {
min-width: 22px;
border-radius: 50%;
padding: 0 4px;
font-size: 10px;
}
.block-input.select-input {
background: rgba(255, 255, 255, 0.95);
color: #1e293b;
position: relative;
padding-right: 16px;
}
.block-input.select-input::after {
content: '▼';
position: absolute;
right: 4px;
top: 50%;
transform: translateY(-50%);
font-size: 7px;
color: #1e293b;
}
.block-input.boolean-input {
background: rgba(255, 255, 255, 0.95);
color: #1e293b;
border-radius: 4px;
min-width: 32px;
}
.block-input.color-input {
padding: 0;
width: 16px;
height: 16px;
min-width: 16px;
border-radius: 50%;
border: 1px solid rgba(0, 0, 0, 0.2);
}
.block-input.empty {
background: rgba(255, 255, 255, 0.3);
color: rgba(255, 255, 255, 0.6);
border: 1px dashed rgba(255, 255, 255, 0.5);
text-shadow: none;
font-style: italic;
font-weight: 400;
}
.block-input.boolean-slot {
background: transparent;
border: 1px dashed rgba(255, 255, 255, 0.7);
color: rgba(255, 255, 255, 0.7);
border-radius: 4px;
text-shadow: none;
font-style: italic;
font-weight: 400;
}
.block-input.reporter-slot {
background: transparent;
border: 1px dashed rgba(255, 255, 255, 0.7);
color: rgba(255, 255, 255, 0.7);
border-radius: 999px;
text-shadow: none;
font-style: italic;
font-weight: 400;
}
/* C-block inner cavity */
.block-cavity {
min-height: 36px;
margin: 0 8px 8px 8px;
padding: 4px;
background: rgba(0, 0, 0, 0.18);
border-radius: 3px;
position: relative;
z-index: 1;
border: 1px dashed rgba(255, 255, 255, 0.2);
}
.block-cavity-empty {
display: flex;
align-items: center;
justify-content: center;
min-height: 32px;
font-size: 10px;
font-style: italic;
color: rgba(255, 255, 255, 0.5);
text-shadow: none;
font-weight: 400;
}
/* React Flow overrides - hide default node chrome */
.react-flow__node-blockNode {
padding: 0;
border: none;
background: transparent;
width: auto;
font-size: 0;
}
.react-flow__node-blockNode.selected {
box-shadow: none;
}
.react-flow__handle {
width: 0 !important;
height: 0 !important;
min-width: 0 !important;
min-height: 0 !important;
border: none !important;
background: transparent !important;
opacity: 0 !important;
pointer-events: none;
}
/* Snap highlight when dragging a block near another */
.block-snap-highlight {
position: absolute;
left: 50%;
transform: translateX(-50%);
width: calc(100% + 8px);
height: 6px;
background: rgba(255, 255, 255, 0.7);
border-radius: 3px;
box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
pointer-events: none;
z-index: 100;
}
.block-snap-highlight.top {
top: -10px;
}
.block-snap-highlight.bottom {
bottom: -10px;
}
/* Palette tab styles (Scratch-style colored circles) */
.palette-tabs {
display: flex;
flex-direction: column;
width: 56px;
flex-shrink: 0;
background: #0f172a;
border-right: 1px solid rgba(148, 163, 184, 0.15);
overflow-y: auto;
padding: 6px 0;
align-items: center;
}
.palette-tab {
width: 44px;
height: 44px;
margin: 2px 0;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font-size: 18px;
transition: all 0.15s ease;
border: 2px solid transparent;
position: relative;
color: #fff;
}
.palette-tab:hover {
transform: scale(1.08);
}
.palette-tab-active {
border-color: #fff;
box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.4);
}
.palette-tab-label {
display: none;
position: absolute;
left: 56px;
top: 50%;
transform: translateY(-50%);
background: #1e293b;
color: #f1f5f9;
padding: 4px 10px;
border-radius: 6px;
font-size: 11px;
white-space: nowrap;
z-index: 50;
border: 1px solid rgba(148, 163, 184, 0.2);
pointer-events: none;
font-weight: 500;
}
.palette-tab:hover .palette-tab-label {
display: block;
}
.palette-block-list {
width: 220px;
flex-shrink: 0;
background: #1a1f2e;
border-right: 1px solid rgba(148, 163, 184, 0.15);
overflow-y: auto;
padding: 8px 6px;
}
.palette-category-header {
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.05em;
padding: 6px 4px 4px;
margin-bottom: 4px;
}
.palette-block-item {
display: block;
margin: 4px 0;
cursor: grab;
transition: transform 0.1s ease, filter 0.1s ease;
}
.palette-block-item:hover {
transform: translateX(2px);
filter: brightness(1.1);
}
.palette-block-item:active {
cursor: grabbing;
transform: scale(0.97);
}
/* Compact palette block - smaller version of full block */
.palette-block-compact {
position: relative;
background: var(--block-color, #6366f1);
color: #fff;
font-size: 10px;
font-weight: 500;
padding: 4px 8px;
border-radius: 4px;
display: flex;
align-items: center;
gap: 4px;
text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
white-space: nowrap;
overflow: hidden;
}
.palette-block-compact.reporter {
border-radius: 999px;
padding: 3px 8px;
}
.palette-block-compact.boolean {
clip-path: polygon(6px 0%, calc(100% - 6px) 0%, 100% 50%, calc(100% - 6px) 100%, 6px 100%, 0% 50%);
padding: 3px 14px;
text-align: center;
}
.palette-block-compact.hat {
border-radius: 12px 12px 4px 4px;
padding: 4px 8px 3px;
}
.palette-block-compact.cap {
border-radius: 2px 2px 8px 8px;
padding: 4px 8px 3px;
}
.palette-block-compact .palette-input {
background: rgba(255, 255, 255, 0.95);
color: #1e293b;
border-radius: 999px;
padding: 1px 6px;
font-size: 9px;
font-weight: 600;
text-shadow: none;
white-space: nowrap;
max-width: 80px;
overflow: hidden;
text-overflow: ellipsis;
}