@ghchinoy/litflow 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,90 @@
1
+ import { LitElement, html, css } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import { m3Tokens } from './theme';
4
+
5
+ @customElement('lit-sidebar')
6
+ export class LitSidebar extends LitElement {
7
+ static styles = [
8
+ m3Tokens,
9
+ css`
10
+ :host {
11
+ display: block;
12
+ width: 200px;
13
+ background: var(--md-sys-color-surface);
14
+ border-right: 1px solid var(--md-sys-color-outline-variant);
15
+ padding: 16px;
16
+ box-sizing: border-box;
17
+ height: 100%;
18
+ }
19
+
20
+ .sidebar-title {
21
+ font-family: var(--md-sys-typescale-body-medium-font);
22
+ font-size: var(--md-sys-typescale-label-medium-size);
23
+ color: var(--md-sys-color-on-surface-variant);
24
+ text-transform: uppercase;
25
+ font-weight: bold;
26
+ margin-bottom: 16px;
27
+ }
28
+
29
+ .node-palette {
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: 12px;
33
+ }
34
+
35
+ .palette-item {
36
+ padding: 12px;
37
+ background: var(--md-sys-color-surface-container-low);
38
+ border: 1px solid var(--md-sys-color-outline-variant);
39
+ border-radius: var(--md-sys-shape-corner-small);
40
+ cursor: grab;
41
+ font-family: var(--md-sys-typescale-body-medium-font);
42
+ font-size: var(--md-sys-typescale-body-medium-size);
43
+ color: var(--md-sys-color-on-surface);
44
+ user-select: none;
45
+ transition: background-color 0.2s ease;
46
+ }
47
+
48
+ .palette-item:hover {
49
+ background: var(--md-sys-color-surface-container-high);
50
+ }
51
+
52
+ .palette-item:active {
53
+ cursor: grabbing;
54
+ }
55
+ `
56
+ ];
57
+
58
+ @property({ type: Array })
59
+ nodeTypes = [
60
+ { type: 'default', label: 'Default Node' },
61
+ { type: 'input', label: 'Input Node' },
62
+ { type: 'output', label: 'Output Node' },
63
+ ];
64
+
65
+ private _onDragStart(e: DragEvent, nodeType: string) {
66
+ if (e.dataTransfer) {
67
+ e.dataTransfer.setData('application/litflow', nodeType);
68
+ e.dataTransfer.effectAllowed = 'move';
69
+ }
70
+ }
71
+
72
+ render() {
73
+ return html`
74
+ <div class="sidebar-title">Node Palette</div>
75
+ <div class="node-palette">
76
+ ${this.nodeTypes.map(
77
+ (node) => html`
78
+ <div
79
+ class="palette-item"
80
+ draggable="true"
81
+ @dragstart="${(e: DragEvent) => this._onDragStart(e, node.type)}"
82
+ >
83
+ ${node.label}
84
+ </div>
85
+ `
86
+ )}
87
+ </div>
88
+ `;
89
+ }
90
+ }
package/src/theme.ts CHANGED
@@ -17,6 +17,10 @@ export const m3Tokens = css`
17
17
  --md-sys-color-on-surface: #1b1b1f;
18
18
  --md-sys-color-surface-variant: #e1e2ec;
19
19
  --md-sys-color-on-surface-variant: #44474f;
20
+
21
+ --md-sys-color-surface-container-low: #f7f2fa;
22
+ --md-sys-color-surface-container: #f3edf7;
23
+ --md-sys-color-surface-container-high: #ece6f0;
20
24
 
21
25
  --md-sys-color-outline: #74777f;
22
26
  --md-sys-color-outline-variant: #c4c6d0;