@zoneflow/renderer-dom 0.0.2 → 0.0.3

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.
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # @zoneflow/renderer-dom
2
+
3
+ `@zoneflow/renderer-dom`은 Zoneflow의 저수준 DOM 렌더러 엔진 패키지입니다.
4
+
5
+ 이 패키지는 주로 다음을 포함합니다.
6
+
7
+ - 그래프 레이아웃 파이프라인
8
+ - DOM draw engine
9
+ - renderer frame / mount registry
10
+ - renderer용 타입 정의
11
+
12
+ 대부분의 앱에서는 이 패키지를 직접 사용할 필요가 없습니다.
13
+ 일반적인 React 앱은 `@zoneflow/react`를 사용하면 충분합니다.
14
+
15
+ ## 설치
16
+
17
+ ```bash
18
+ pnpm add @zoneflow/renderer-dom
19
+ ```
20
+
21
+ ## 언제 직접 쓰나
22
+
23
+ - React 없이 renderer DOM 레이어를 직접 붙일 때
24
+ - low-level draw engine이나 pipeline을 교체/실험할 때
25
+ - renderer frame을 직접 소비하는 커스텀 환경을 만들 때
26
+
27
+ 일반적인 앱 통합은 `@zoneflow/react`를 우선 사용하는 편이 맞습니다.
28
+
29
+ 레포지토리: [github.com/groobee/zoneflow](https://github.com/groobee/zoneflow)
@@ -36,6 +36,55 @@ function resolvePathDisplayName(params) {
36
36
  return trimmed;
37
37
  return params.rule === null ? "Empty" : "Untitled";
38
38
  }
39
+ function resolvePathTargetDisplay(params) {
40
+ const targetZoneId = params.pathVisual.targetZoneId;
41
+ if (!targetZoneId) {
42
+ return {
43
+ label: "—",
44
+ status: "unconfigured",
45
+ };
46
+ }
47
+ const targetZone = params.model.zonesById[targetZoneId];
48
+ if (!targetZone) {
49
+ return {
50
+ label: "—",
51
+ status: "missing",
52
+ };
53
+ }
54
+ return {
55
+ label: targetZone.name,
56
+ status: "resolved",
57
+ };
58
+ }
59
+ function createPathStatusBadge(params) {
60
+ const { owner, status } = params;
61
+ const badge = document.createElement("div");
62
+ const isMissing = status === "missing";
63
+ badge.title = isMissing ? "Broken path target" : "Path target not set";
64
+ badge.setAttribute("aria-label", isMissing ? "Broken path target" : "Path target not set");
65
+ badge.textContent = isMissing ? "⚠" : "?";
66
+ applyStyles(badge, {
67
+ position: "absolute",
68
+ right: "10px",
69
+ top: "10px",
70
+ width: "22px",
71
+ height: "22px",
72
+ display: "flex",
73
+ alignItems: "center",
74
+ justifyContent: "center",
75
+ borderRadius: "999px",
76
+ border: "1px solid rgba(217, 119, 6, 0.24)",
77
+ background: "linear-gradient(180deg, rgba(255,251,235,0.98) 0%, rgba(254,243,199,0.98) 100%)",
78
+ color: "#b45309",
79
+ boxShadow: "0 6px 14px rgba(180, 83, 9, 0.16)",
80
+ fontSize: "12px",
81
+ lineHeight: "1",
82
+ fontWeight: "700",
83
+ pointerEvents: "none",
84
+ zIndex: 2,
85
+ });
86
+ owner.appendChild(badge);
87
+ }
39
88
  function getOpacity(emphasis) {
40
89
  switch (emphasis) {
41
90
  case "strong":
@@ -190,10 +239,11 @@ function renderPathFallback(host, slot, context) {
190
239
  fontFamily: "'IBM Plex Sans', 'Pretendard', sans-serif",
191
240
  };
192
241
  if (slot === "label") {
193
- host.textContent = resolvePathDisplayName({
242
+ const title = resolvePathDisplayName({
194
243
  name: context.path.name,
195
244
  rule: context.path.rule,
196
245
  });
246
+ host.textContent = title;
197
247
  applyStyles(host, {
198
248
  ...base,
199
249
  fontSize: "12px",
@@ -213,11 +263,20 @@ function renderPathFallback(host, slot, context) {
213
263
  return;
214
264
  }
215
265
  if (slot === "target") {
216
- host.textContent = context.pathVisual.targetZoneId ?? "unresolved";
266
+ const targetDisplay = resolvePathTargetDisplay({
267
+ model: context.model,
268
+ pathVisual: context.pathVisual,
269
+ });
270
+ host.textContent = targetDisplay.label;
217
271
  applyStyles(host, {
218
272
  ...base,
219
- color: context.theme.zoneSubtext,
273
+ color: targetDisplay.status === "missing"
274
+ ? "#b45309"
275
+ : targetDisplay.status === "unconfigured"
276
+ ? "#b45309"
277
+ : context.theme.zoneSubtext,
220
278
  fontSize: "11px",
279
+ fontWeight: targetDisplay.status === "resolved" ? 500 : 700,
221
280
  });
222
281
  return;
223
282
  }
@@ -664,6 +723,16 @@ export const domDrawEngine = {
664
723
  topBandOpacity: 0.72,
665
724
  });
666
725
  pathEl.appendChild(pathChromeEl);
726
+ const targetDisplay = resolvePathTargetDisplay({
727
+ model: input.model,
728
+ pathVisual,
729
+ });
730
+ if (targetDisplay.status !== "resolved") {
731
+ createPathStatusBadge({
732
+ owner: pathEl,
733
+ status: targetDisplay.status,
734
+ });
735
+ }
667
736
  for (const slot of Object.keys(componentLayout?.slots ?? {})) {
668
737
  createPathSlotHost({
669
738
  pathVisual,
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@zoneflow/renderer-dom",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
+ "description": "Low-level DOM renderer engines for Zoneflow.",
4
5
  "type": "module",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
8
+ "homepage": "https://github.com/groobee/zoneflow",
7
9
  "repository": {
8
10
  "type": "git",
9
11
  "url": "https://github.com/groobee/zoneflow.git",
@@ -16,7 +18,7 @@
16
18
  "dist"
17
19
  ],
18
20
  "dependencies": {
19
- "@zoneflow/core": "0.0.2"
21
+ "@zoneflow/core": "0.0.3"
20
22
  },
21
23
  "scripts": {
22
24
  "build": "tsc -p tsconfig.json",