feat(styles): one stylesheet source for react and svelte (#3350)
* feat(styles): create stylesheets for react and svelte based on one source * refactor(styling): cleanup * refactor(postcss): share a config * refactor(postcss): replace env hack with env file
This commit is contained in:
33
packages/system/src/styles/base.css
Normal file
33
packages/system/src/styles/base.css
Normal file
@@ -0,0 +1,33 @@
|
||||
.xy-flow {
|
||||
--node-border-default: 1px solid #bbb;
|
||||
--node-border-selected-default: 1px solid #555;
|
||||
|
||||
--handle-background-color-default: #333;
|
||||
|
||||
--selection-background-color-default: rgba(150, 150, 180, 0.1);
|
||||
--selection-border-default: 1px dotted rgba(155, 155, 155, 0.8);
|
||||
}
|
||||
|
||||
.xy-flow__handle {
|
||||
background-color: var(--handle-background-color, var(--handle-background-color-default));
|
||||
}
|
||||
|
||||
.xy-flow__node-input,
|
||||
.xy-flow__node-default,
|
||||
.xy-flow__node-output,
|
||||
.xy-flow__node-group {
|
||||
border: var(--node-border, var(--node-border-default));
|
||||
|
||||
&.selected,
|
||||
&:focus,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
border: var(--node-border-selected, var(--node-border-selected-default));
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__nodesselection-rect,
|
||||
.xy-flow__selection {
|
||||
background: var(--selection-background-color, var(--selection-background-color-default));
|
||||
border: var(--selection-border, var(--selection-border-default));
|
||||
}
|
||||
298
packages/system/src/styles/init.css
Normal file
298
packages/system/src/styles/init.css
Normal file
@@ -0,0 +1,298 @@
|
||||
/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */
|
||||
|
||||
.xy-flow {
|
||||
--edge-stroke-default: #b1b1b7;
|
||||
--edge-stroke-width-default: 1;
|
||||
--edge-stroke-selected-default: #555;
|
||||
|
||||
--connectionline-stroke-default: #b1b1b7;
|
||||
--connectionline-stroke-width-default: 1;
|
||||
|
||||
--attribution-background-color-default: rgba(255, 255, 255, 0.5);
|
||||
|
||||
--minimap-background-color-default: #fff;
|
||||
|
||||
--background-pattern-dot-color-default: #91919a;
|
||||
--background-pattern-line-color-default: #eee;
|
||||
--background-pattern-cross-color-default: #e2e2e2;
|
||||
}
|
||||
|
||||
.xy-flow__container {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.xy-flow__pane {
|
||||
z-index: 1;
|
||||
cursor: grab;
|
||||
|
||||
&.selection {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
&.dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__viewport {
|
||||
transform-origin: 0 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.xy-flow__renderer {
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.xy-flow__selection {
|
||||
z-index: 6;
|
||||
}
|
||||
|
||||
.xy-flow__nodesselection-rect:focus,
|
||||
.xy-flow__nodesselection-rect:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.xy-flow .xy-flow__edges {
|
||||
pointer-events: none;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.xy-flow__edge-path {
|
||||
stroke: var(--edge-stroke, var(--edge-stroke-default));
|
||||
stroke-width: var(--edge-stroke-width, var(--edge-stroke-width-default));
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.xy-flow__connection-path {
|
||||
stroke: var(--connectionline-stroke, var(--connectionline-stroke-default));
|
||||
stroke-width: var(--connectionline-stroke-width, var(--connectionline-stroke-width-default));
|
||||
fill: none;
|
||||
}
|
||||
|
||||
.xy-flow__edge {
|
||||
pointer-events: visibleStroke;
|
||||
cursor: pointer;
|
||||
|
||||
&.animated path {
|
||||
stroke-dasharray: 5;
|
||||
animation: dashdraw 0.5s linear infinite;
|
||||
}
|
||||
|
||||
&.animated path.xy-flow__edge-interaction {
|
||||
stroke-dasharray: none;
|
||||
animation: none;
|
||||
}
|
||||
|
||||
&.inactive {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.selected,
|
||||
&:focus,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.selected .xy-flow__edge-path,
|
||||
&:focus .xy-flow__edge-path,
|
||||
&:focus-visible .xy-flow__edge-path {
|
||||
stroke: var(--edge-stroke-selected, var(--edge-stroke-selected-default));
|
||||
}
|
||||
|
||||
&-textwrapper {
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
&-textbg {
|
||||
fill: white;
|
||||
}
|
||||
|
||||
.xy-flow__edge-text {
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__connection {
|
||||
pointer-events: none;
|
||||
|
||||
.animated {
|
||||
stroke-dasharray: 5;
|
||||
animation: dashdraw 0.5s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__connectionline {
|
||||
z-index: 1001;
|
||||
}
|
||||
|
||||
.xy-flow__nodes {
|
||||
pointer-events: none;
|
||||
transform-origin: 0 0;
|
||||
}
|
||||
|
||||
.xy-flow__node {
|
||||
position: absolute;
|
||||
user-select: none;
|
||||
pointer-events: all;
|
||||
transform-origin: 0 0;
|
||||
box-sizing: border-box;
|
||||
cursor: grab;
|
||||
|
||||
&.dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* only used in Svelte Flow, should we remove it here? */
|
||||
&.draggable {
|
||||
cursor: grab;
|
||||
pointer-events: all;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__nodesselection {
|
||||
z-index: 3;
|
||||
transform-origin: left top;
|
||||
pointer-events: none;
|
||||
|
||||
&-rect {
|
||||
position: absolute;
|
||||
pointer-events: all;
|
||||
cursor: grab;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__handle {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
min-width: 5px;
|
||||
min-height: 5px;
|
||||
|
||||
&.connectionindicator {
|
||||
pointer-events: all;
|
||||
cursor: crosshair;
|
||||
}
|
||||
|
||||
&-bottom {
|
||||
top: auto;
|
||||
left: 50%;
|
||||
bottom: -4px;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
&-top {
|
||||
left: 50%;
|
||||
top: -4px;
|
||||
transform: translate(-50%, 0);
|
||||
}
|
||||
|
||||
&-left {
|
||||
top: 50%;
|
||||
left: -4px;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
|
||||
&-right {
|
||||
right: -4px;
|
||||
top: 50%;
|
||||
transform: translate(0, -50%);
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__edgeupdater {
|
||||
cursor: move;
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.xy-flow__panel {
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
margin: 15px;
|
||||
|
||||
&.top {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
&.bottom {
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
&.left {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&.right {
|
||||
right: 0;
|
||||
}
|
||||
|
||||
&.center {
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__attribution {
|
||||
font-size: 10px;
|
||||
background: var(--attribution-background-color, var(--attribution-background-color-default));
|
||||
padding: 2px 3px;
|
||||
margin: 0;
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes dashdraw {
|
||||
from {
|
||||
stroke-dashoffset: 10;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__edgelabel-renderer {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
user-select: none;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.xy-flow__minimap {
|
||||
stroke: var(--minimap-background-color, var(--minimap-background-color-default));
|
||||
}
|
||||
|
||||
.xy-flow__background {
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
background-color: var(--background-color-props, 'transparent');
|
||||
}
|
||||
|
||||
.xy-flow__background-pattern {
|
||||
&.dot {
|
||||
fill: var(
|
||||
--background-pattern-color-props,
|
||||
var(--background-pattern-color, var(--background-pattern-dot-color-default))
|
||||
);
|
||||
}
|
||||
|
||||
&.line {
|
||||
stroke: var(
|
||||
--background-pattern-color-props,
|
||||
var(--background-pattern-color, var(--background-pattern-line-color-default))
|
||||
);
|
||||
}
|
||||
|
||||
&.cross {
|
||||
stroke: var(
|
||||
--background-pattern-color-props,
|
||||
var(--background-pattern-color, var(--background-pattern-cross-color-default))
|
||||
);
|
||||
}
|
||||
}
|
||||
105
packages/system/src/styles/node-resizer.css
Normal file
105
packages/system/src/styles/node-resizer.css
Normal file
@@ -0,0 +1,105 @@
|
||||
.xy-flow__resize-control {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.left,
|
||||
.xy-flow__resize-control.right {
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.top,
|
||||
.xy-flow__resize-control.bottom {
|
||||
cursor: ns-resize;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.top.left,
|
||||
.xy-flow__resize-control.bottom.right {
|
||||
cursor: nwse-resize;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.bottom.left,
|
||||
.xy-flow__resize-control.top.right {
|
||||
cursor: nesw-resize;
|
||||
}
|
||||
|
||||
/* handle styles */
|
||||
.xy-flow__resize-control.handle {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
border: 1px solid #fff;
|
||||
border-radius: 1px;
|
||||
background-color: #3367d9;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.handle.left {
|
||||
left: 0;
|
||||
top: 50%;
|
||||
}
|
||||
.xy-flow__resize-control.handle.right {
|
||||
left: 100%;
|
||||
top: 50%;
|
||||
}
|
||||
.xy-flow__resize-control.handle.top {
|
||||
left: 50%;
|
||||
top: 0;
|
||||
}
|
||||
.xy-flow__resize-control.handle.bottom {
|
||||
left: 50%;
|
||||
top: 100%;
|
||||
}
|
||||
.xy-flow__resize-control.handle.top.left {
|
||||
left: 0;
|
||||
}
|
||||
.xy-flow__resize-control.handle.bottom.left {
|
||||
left: 0;
|
||||
}
|
||||
.xy-flow__resize-control.handle.top.right {
|
||||
left: 100%;
|
||||
}
|
||||
.xy-flow__resize-control.handle.bottom.right {
|
||||
left: 100%;
|
||||
}
|
||||
|
||||
/* line styles */
|
||||
.xy-flow__resize-control.line {
|
||||
border-color: #3367d9;
|
||||
border-width: 0;
|
||||
border-style: solid;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.line.left,
|
||||
.xy-flow__resize-control.line.right {
|
||||
width: 1px;
|
||||
transform: translate(-50%, 0);
|
||||
top: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.line.left {
|
||||
left: 0;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.line.right {
|
||||
left: 100%;
|
||||
border-right-width: 1px;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.line.top,
|
||||
.xy-flow__resize-control.line.bottom {
|
||||
height: 1px;
|
||||
transform: translate(0, -50%);
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.line.top {
|
||||
top: 0;
|
||||
border-top-width: 1px;
|
||||
}
|
||||
|
||||
.xy-flow__resize-control.line.bottom {
|
||||
border-bottom-width: 1px;
|
||||
top: 100%;
|
||||
}
|
||||
138
packages/system/src/styles/style.css
Normal file
138
packages/system/src/styles/style.css
Normal file
@@ -0,0 +1,138 @@
|
||||
.xy-flow {
|
||||
--node-color-default: inherit;
|
||||
--node-border-default: 1px solid #1a192b;
|
||||
--node-background-color-default: #fff;
|
||||
--node-group-background-color-default: rgba(240, 240, 240, 0.25);
|
||||
--node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);
|
||||
--node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;
|
||||
|
||||
--handle-background-color-default: #1a192b;
|
||||
--handle-border-color-default: #fff;
|
||||
|
||||
--selection-background-color-default: rgba(0, 89, 220, 0.08);
|
||||
--selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);
|
||||
|
||||
--controls-button-background-color-default: #fefefe;
|
||||
--controls-button-background-color-hover-default: #f4f4f4;
|
||||
--controls-button-color-default: inherit;
|
||||
--controls-button-color-hover-default: inherit;
|
||||
--controls-button-border-color-default: #eee;
|
||||
--controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.xy-flow__edge {
|
||||
&.updating {
|
||||
.xy-flow__edge-path {
|
||||
stroke: #777;
|
||||
}
|
||||
}
|
||||
|
||||
&-text {
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__node.selectable {
|
||||
&:focus,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__node-input,
|
||||
.xy-flow__node-default,
|
||||
.xy-flow__node-output,
|
||||
.xy-flow__node-group {
|
||||
padding: 10px;
|
||||
border-radius: 3px;
|
||||
width: 150px;
|
||||
font-size: 12px;
|
||||
color: var(--node-color, var(--node-color-default));
|
||||
text-align: center;
|
||||
border: var(--node-border, var(--node-border-default));
|
||||
background-color: var(--node-background-color, var(--node-background-color-default));
|
||||
|
||||
&.selectable {
|
||||
&:hover {
|
||||
box-shadow: var(--node-boxshadow-hover, var(--node-boxshadow-hover-default));
|
||||
}
|
||||
|
||||
&.selected,
|
||||
&:focus,
|
||||
&:focus-visible {
|
||||
box-shadow: var(--node-boxshadow-selected, var(--node-boxshadow-selected-default));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__node-group {
|
||||
background-color: var(--node-group-background-color, var(--node-group-background-color-default));
|
||||
}
|
||||
|
||||
.xy-flow__nodesselection-rect,
|
||||
.xy-flow__selection {
|
||||
background: var(--selection-background-color, var(--selection-background-color-default));
|
||||
border: var(--selection-border, var(--selection-border-default));
|
||||
|
||||
&:focus,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.xy-flow__handle {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
background-color: var(--handle-background-color, var(--handle-background-color-default));
|
||||
border: 1px solid var(--handle-border-color, var(--handle-border-color-default));
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
.xy-flow__controls {
|
||||
box-shadow: var(--controls-box-shadow, var(--controls-box-shadow-default));
|
||||
|
||||
&-button {
|
||||
border: none;
|
||||
background: var(--controls-button-background-color, var(--controls-button-background-color-default));
|
||||
border-bottom: 1px solid
|
||||
var(
|
||||
--controls-button-border-color-props,
|
||||
var(--controls-button-border-color, var(--controls-button-border-color-default))
|
||||
);
|
||||
color: var(--controls-button-color-props, var(--controls-button-color, var(--controls-button-color-default)));
|
||||
box-sizing: content-box;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
padding: 5px;
|
||||
|
||||
&:hover {
|
||||
background: var(
|
||||
--controls-button-background-color-hover-props,
|
||||
var(--controls-button-background-color-hover, var(--controls-button-background-color-hover-default))
|
||||
);
|
||||
color: var(
|
||||
--controls-button-color-hover-props,
|
||||
var(--controls-button-hover-color, var(--controls-button-hover-color-default))
|
||||
);
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 100%;
|
||||
max-width: 12px;
|
||||
max-height: 12px;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
pointer-events: none;
|
||||
|
||||
svg {
|
||||
fill-opacity: 0.4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user