ltcai 2.2.0 → 2.2.2

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,167 @@
1
+ /* ============================================================================
2
+ * Lattice AI — Shared UX runtime (v2.2.2)
3
+ *
4
+ * 모든 페이지에서 로드된다. 페이지마다 일부 요소가 없을 수 있으므로 전부
5
+ * 방어적으로(존재 확인 후) 동작한다. 기존 chat.js / graph.js / admin.js 의
6
+ * 함수를 재정의하지 않고, 새 전역 기능만 추가한다.
7
+ *
8
+ * - 다크/라이트 테마 (localStorage + OS 선호 + 토글)
9
+ * - 모바일 키보드 inset (--kb-inset) : 입력창이 키보드에 안 가리게
10
+ * - Escape 로 열린 모달/오버레이 닫기
11
+ * - 브레이크포인트 넘으면 열린 드로어 자동 정리
12
+ * - 그래프/관리자 네비 드로어 토글
13
+ * ========================================================================== */
14
+ (function () {
15
+ "use strict";
16
+
17
+ var root = document.documentElement;
18
+
19
+ /* ---------- 1. 테마 ---------- */
20
+ var THEME_KEY = "lt-theme";
21
+
22
+ function systemPrefersDark() {
23
+ return window.matchMedia &&
24
+ window.matchMedia("(prefers-color-scheme: dark)").matches;
25
+ }
26
+
27
+ function storedTheme() {
28
+ try { return localStorage.getItem(THEME_KEY); } catch (e) { return null; }
29
+ }
30
+
31
+ function applyTheme(mode) {
32
+ if (mode !== "dark" && mode !== "light") {
33
+ mode = systemPrefersDark() ? "dark" : "light";
34
+ }
35
+ root.setAttribute("data-lt-theme", mode);
36
+ return mode;
37
+ }
38
+
39
+ // 초기 적용 (FOUC 최소화를 위해 가능한 한 빨리)
40
+ applyTheme(storedTheme());
41
+
42
+ window.setTheme = function (mode) {
43
+ var applied = applyTheme(mode);
44
+ try { localStorage.setItem(THEME_KEY, applied); } catch (e) {}
45
+ return applied;
46
+ };
47
+
48
+ window.toggleTheme = function () {
49
+ var cur = root.getAttribute("data-lt-theme") === "dark" ? "dark" : "light";
50
+ return window.setTheme(cur === "dark" ? "light" : "dark");
51
+ };
52
+
53
+ // 사용자가 명시 선택을 안 했으면 OS 변화 따라가기
54
+ if (window.matchMedia) {
55
+ try {
56
+ window.matchMedia("(prefers-color-scheme: dark)")
57
+ .addEventListener("change", function (e) {
58
+ if (!storedTheme()) applyTheme(e.matches ? "dark" : "light");
59
+ });
60
+ } catch (e) { /* Safari < 14 */ }
61
+ }
62
+
63
+ /* ---------- 2. 모바일 키보드 inset ---------- */
64
+ var vv = window.visualViewport;
65
+ if (vv) {
66
+ var updateKbInset = function () {
67
+ // 레이아웃 뷰포트와 비주얼 뷰포트의 차이 = 키보드(또는 브라우저 UI) 높이
68
+ var inset = Math.max(0, window.innerHeight - vv.height - vv.offsetTop);
69
+ // 작은 값(브라우저 바 미세 변화)은 무시
70
+ root.style.setProperty("--kb-inset", (inset > 80 ? inset : 0) + "px");
71
+ };
72
+ vv.addEventListener("resize", updateKbInset);
73
+ vv.addEventListener("scroll", updateKbInset);
74
+ // 입력에 포커스되면 화면 안으로 스크롤
75
+ document.addEventListener("focusin", function (e) {
76
+ var t = e.target;
77
+ if (t && (t.tagName === "TEXTAREA" || t.tagName === "INPUT")) {
78
+ setTimeout(function () {
79
+ if (t.scrollIntoView) {
80
+ try { t.scrollIntoView({ block: "center", behavior: "smooth" }); }
81
+ catch (err) { t.scrollIntoView(); }
82
+ }
83
+ }, 250);
84
+ }
85
+ });
86
+ }
87
+
88
+ /* ---------- 3. 드로어 토글 (그래프 / 관리자) ---------- */
89
+ function bodyHas(cls) { return document.body.classList.contains(cls); }
90
+
91
+ window.toggleGraphNav = function () {
92
+ document.body.classList.toggle("graph-nav-open");
93
+ };
94
+ window.closeGraphNav = function () {
95
+ document.body.classList.remove("graph-nav-open");
96
+ };
97
+ window.toggleAdminRail = function () {
98
+ document.body.classList.toggle("admin-rail-open");
99
+ };
100
+ window.closeAdminRail = function () {
101
+ document.body.classList.remove("admin-rail-open");
102
+ };
103
+
104
+ /* ---------- 4. Escape 로 닫기 ---------- */
105
+ var OVERLAY_SELECTORS = [
106
+ ".acct-modal-overlay", ".mcp-modal-overlay", ".mode-modal-overlay",
107
+ ".workspace-modal-overlay", ".advanced-settings-overlay", ".model-overlay",
108
+ ".perm-overlay", ".onboarding-overlay", ".pipeline-overlay",
109
+ ".admin-overlay", ".vpc-overlay", ".status-overlay", ".cu-overlay",
110
+ ".file-create-overlay", ".file-editor-overlay", ".local-browser-overlay"
111
+ ];
112
+
113
+ function isVisible(el) {
114
+ if (!el) return false;
115
+ var s = window.getComputedStyle(el);
116
+ return s.display !== "none" && s.visibility !== "hidden" && el.offsetParent !== null;
117
+ }
118
+
119
+ function closeTopOverlay() {
120
+ // 1) 드로어 먼저
121
+ if (bodyHas("sidebar-open")) { document.body.classList.remove("sidebar-open"); return true; }
122
+ if (bodyHas("graph-nav-open")) { window.closeGraphNav(); return true; }
123
+ if (bodyHas("admin-rail-open")) { window.closeAdminRail(); return true; }
124
+
125
+ // 2) 보이는 오버레이를 위에서부터 닫기
126
+ var overlays = document.querySelectorAll(OVERLAY_SELECTORS.join(","));
127
+ for (var i = overlays.length - 1; i >= 0; i--) {
128
+ var el = overlays[i];
129
+ if (isVisible(el)) {
130
+ // 닫기 버튼이 있으면 클릭, 없으면 직접 숨김
131
+ var btn = el.querySelector(
132
+ "[onclick*='close'],.modal-close,.mcp-modal-close,.admin-close,.mode-close,.acct-close"
133
+ );
134
+ if (btn && btn.click) { btn.click(); }
135
+ else { el.style.display = "none"; }
136
+ return true;
137
+ }
138
+ }
139
+ return false;
140
+ }
141
+
142
+ document.addEventListener("keydown", function (e) {
143
+ if (e.key === "Escape" || e.keyCode === 27) {
144
+ if (closeTopOverlay()) { e.stopPropagation(); }
145
+ }
146
+ });
147
+
148
+ /* ---------- 5. 브레이크포인트 넘으면 드로어 정리 ---------- */
149
+ if (window.matchMedia) {
150
+ var desktop = window.matchMedia("(min-width: 1025px)");
151
+ var onDesktop = function (e) {
152
+ if (e.matches) {
153
+ document.body.classList.remove("sidebar-open", "graph-nav-open", "admin-rail-open");
154
+ }
155
+ };
156
+ try { desktop.addEventListener("change", onDesktop); }
157
+ catch (e2) { /* old Safari */ try { desktop.addListener(onDesktop); } catch (e3) {} }
158
+ }
159
+
160
+ /* ---------- 6. 새 드로어용 오버레이 백드롭 클릭 ---------- */
161
+ document.addEventListener("click", function (e) {
162
+ var t = e.target;
163
+ if (t && t.classList && t.classList.contains("sidebar-overlay")) {
164
+ document.body.classList.remove("graph-nav-open", "admin-rail-open");
165
+ }
166
+ });
167
+ })();
@@ -2,9 +2,12 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content" />
6
6
  <title>Workflow Designer — Lattice AI</title>
7
- <link rel="stylesheet" href="/static/platform.css" />
7
+ <script src="/static/scripts/ux.js?v=2.2.2"></script>
8
+ <link rel="stylesheet" href="/static/css/tokens.css?v=2.2.2" />
9
+ <link rel="stylesheet" href="/static/platform.css?v=2.2.2" />
10
+ <link rel="stylesheet" href="/static/css/responsive.css?v=2.2.2" />
8
11
  </head>
9
12
  <body>
10
13
  <main>
@@ -1,21 +1,42 @@
1
1
  :root {
2
- color-scheme: light;
3
- --bg: #f6f7f9;
4
- --surface: #ffffff;
5
- --surface-2: #f0f4f8;
6
- --ink: #101828;
7
- --muted: #667085;
8
- --line: #d9e0e8;
9
- --blue: #2563eb;
2
+ /* Map the local palette onto the shared design tokens so this page
3
+ inverts cleanly under :root[data-lt-theme="dark"]. Light defaults
4
+ stay visually close to the original hand-tuned values. */
5
+ --bg: var(--lt-bg, #f6f7f9);
6
+ --surface: var(--lt-surface, #ffffff);
7
+ --surface-2: var(--lt-surface-2, #f0f4f8);
8
+ --ink: var(--lt-ink, #101828);
9
+ --muted: var(--lt-muted, #667085);
10
+ --line: var(--lt-line, #d9e0e8);
11
+ --blue: var(--lt-accent, #2563eb);
10
12
  --green: #12805c;
11
13
  --amber: #b45309;
12
14
  --pink: #be185d;
13
15
  --red: #c2410c;
14
16
  --radius: 8px;
15
- --shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
17
+ --shadow: var(--lt-shadow-md, 0 12px 34px rgba(16, 24, 40, 0.08));
18
+ /* Rail keeps its dark-navy identity in light mode; dark mode remaps it
19
+ to a shared surface token below so it inverts coherently. */
20
+ --rail-bg: #111827;
21
+ --rail-ink: #e5e7eb;
22
+ --rail-ink-soft: #b8c0cc;
23
+ --rail-ink-strong: #fff;
24
+ --rail-hover: rgba(255, 255, 255, 0.08);
25
+ --rail-line: rgba(255, 255, 255, 0.12);
16
26
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
17
27
  }
18
28
 
29
+ /* Dark theme: remap the rail to the shared surface tokens so it inverts
30
+ instead of staying permanently navy. */
31
+ :root[data-lt-theme="dark"] {
32
+ --rail-bg: var(--lt-surface-2);
33
+ --rail-ink: var(--lt-ink);
34
+ --rail-ink-soft: var(--lt-ink-soft);
35
+ --rail-ink-strong: var(--lt-ink);
36
+ --rail-hover: rgba(255, 255, 255, 0.06);
37
+ --rail-line: var(--lt-line);
38
+ }
39
+
19
40
  * { box-sizing: border-box; }
20
41
 
21
42
  html { scroll-behavior: smooth; }
@@ -40,14 +61,16 @@ button {
40
61
  display: grid;
41
62
  grid-template-columns: 248px minmax(0, 1fr);
42
63
  min-height: 100vh;
64
+ min-height: 100dvh;
43
65
  }
44
66
 
45
67
  .workspace-rail {
46
68
  position: sticky;
47
69
  top: 0;
48
70
  height: 100vh;
49
- background: #111827;
50
- color: #e5e7eb;
71
+ height: 100dvh;
72
+ background: var(--rail-bg);
73
+ color: var(--rail-ink);
51
74
  padding: 18px 14px;
52
75
  display: flex;
53
76
  flex-direction: column;
@@ -58,7 +81,7 @@ button {
58
81
  display: flex;
59
82
  align-items: center;
60
83
  gap: 10px;
61
- color: #fff;
84
+ color: var(--rail-ink-strong);
62
85
  text-decoration: none;
63
86
  font-weight: 800;
64
87
  padding: 8px;
@@ -77,7 +100,7 @@ button {
77
100
  }
78
101
 
79
102
  .workspace-rail a {
80
- color: #b8c0cc;
103
+ color: var(--rail-ink-soft);
81
104
  text-decoration: none;
82
105
  }
83
106
 
@@ -94,12 +117,12 @@ button {
94
117
  .workspace-rail nav a.active,
95
118
  .workspace-rail nav a:hover,
96
119
  .rail-links a:hover {
97
- background: rgba(255,255,255,0.08);
98
- color: #fff;
120
+ background: var(--rail-hover);
121
+ color: var(--rail-ink-strong);
99
122
  }
100
123
 
101
124
  .rail-links {
102
- border-top: 1px solid rgba(255,255,255,0.12);
125
+ border-top: 1px solid var(--rail-line);
103
126
  padding-top: 12px;
104
127
  margin-top: auto;
105
128
  }
@@ -422,6 +445,11 @@ textarea {
422
445
  position: absolute;
423
446
  opacity: 0;
424
447
  pointer-events: none;
448
+ /* 절대배치 + width:auto 인 체크박스는 컨테이닝 블록(뷰포트) 폭만큼 늘어나
449
+ * 가로 오버플로우를 만든다. 1px 박스로 가둬 레이아웃에 영향 없게 한다. */
450
+ width: 1px;
451
+ height: 1px;
452
+ margin: 0;
425
453
  }
426
454
 
427
455
  .toggle-row span {
@@ -521,8 +549,8 @@ textarea {
521
549
  gap: 8px;
522
550
  padding: 6px 10px;
523
551
  border-radius: 10px;
524
- background: rgba(255, 255, 255, 0.06);
525
- border: 1px solid rgba(255, 255, 255, 0.12);
552
+ background: var(--rail-hover);
553
+ border: 1px solid var(--rail-line);
526
554
  }
527
555
  .workspace-switcher select {
528
556
  background: transparent;
@@ -600,7 +628,7 @@ textarea {
600
628
  /* Enterprise capability grid */
601
629
  .capability-grid {
602
630
  display: grid; gap: 10px;
603
- grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
631
+ grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
604
632
  margin-top: 12px;
605
633
  }
606
634
  .capability-card {
@@ -684,3 +712,16 @@ textarea {
684
712
  grid-template-columns: 1fr;
685
713
  }
686
714
  }
715
+
716
+ /* v2.2.1 — 태블릿(761~1024) 레일 슬림화로 본문 공간 확보 */
717
+ @media (min-width: 761px) and (max-width: 1024px) {
718
+ .workspace-shell { grid-template-columns: 196px minmax(0, 1fr); }
719
+ .workspace-rail { padding: 14px 10px; }
720
+ }
721
+
722
+ /* v2.2.1 — 터치 영역 44px 보장 */
723
+ @media (hover: none), (max-width: 760px) {
724
+ .icon-action { min-width: 44px; min-height: 44px; }
725
+ .small-action { min-height: 44px; }
726
+ .workspace-rail a { min-height: 44px; display: flex; align-items: center; }
727
+ }
@@ -2,13 +2,16 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content">
6
6
  <title>Lattice AI Workspace OS</title>
7
+ <script src="/static/scripts/ux.js?v=2.2.2"></script>
7
8
  <link rel="manifest" href="/manifest.json">
8
9
  <link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32.png">
9
10
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap">
10
11
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@tabler/icons-webfont@latest/tabler-icons.min.css">
11
- <link rel="stylesheet" href="/static/workspace.css?v=2.2.0">
12
+ <link rel="stylesheet" href="/static/css/tokens.css?v=2.2.2">
13
+ <link rel="stylesheet" href="/static/workspace.css?v=2.2.2">
14
+ <link rel="stylesheet" href="/static/css/responsive.css?v=2.2.2">
12
15
  </head>
13
16
  <body>
14
17
  <div class="workspace-shell">