@zoneflow/renderer-dom 0.0.1 → 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GROOBEE
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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,
@@ -2,12 +2,6 @@ export const DEFAULT_PATH_NODE_WIDTH = 120;
2
2
  export const DEFAULT_PATH_NODE_HEIGHT = 32;
3
3
  export const DEFAULT_PATH_NODE_OFFSET_X = 32;
4
4
  export const DEFAULT_PATH_NODE_GAP_Y = 40;
5
- function typedEntries(record) {
6
- return Object.entries(record);
7
- }
8
- function typedValues(record) {
9
- return Object.values(record);
10
- }
11
5
  function rectFromLayout(layout) {
12
6
  return {
13
7
  x: layout.x,
@@ -62,7 +56,9 @@ function resolveLayout(model, layoutModel) {
62
56
  zoneCache.set(zoneId, worldPos);
63
57
  return worldPos;
64
58
  }
65
- for (const [typedZoneId, layout] of typedEntries(layoutModel.zoneLayoutsById)) {
59
+ const zoneLayoutIds = Object.keys(layoutModel.zoneLayoutsById);
60
+ for (const typedZoneId of zoneLayoutIds) {
61
+ const layout = layoutModel.zoneLayoutsById[typedZoneId];
66
62
  const worldPos = resolveZonePosition(typedZoneId);
67
63
  const anchors = layout.anchors;
68
64
  const resolvedAnchors = {
@@ -88,7 +84,9 @@ function resolveLayout(model, layoutModel) {
88
84
  anchors: resolvedAnchors,
89
85
  };
90
86
  }
91
- for (const [pathId, pathLayout] of typedEntries(layoutModel.pathLayoutsById)) {
87
+ const pathLayoutIds = Object.keys(layoutModel.pathLayoutsById);
88
+ for (const pathId of pathLayoutIds) {
89
+ const pathLayout = layoutModel.pathLayoutsById[pathId];
92
90
  resolvedPathLayouts[pathId] = {
93
91
  ...pathLayout,
94
92
  };
@@ -133,7 +131,9 @@ function resolvePathNodeAnchors(rect) {
133
131
  function createZoneVisualNodes(params) {
134
132
  const { model, layoutModel } = params;
135
133
  const result = {};
136
- for (const [typedZoneId, zone] of typedEntries(model.zonesById)) {
134
+ const zoneIds = Object.keys(model.zonesById);
135
+ for (const typedZoneId of zoneIds) {
136
+ const zone = model.zonesById[typedZoneId];
137
137
  const zoneLayout = layoutModel.zoneLayoutsById[typedZoneId];
138
138
  if (!zoneLayout)
139
139
  continue;
@@ -150,7 +150,9 @@ function createZoneVisualNodes(params) {
150
150
  function createPathVisualNodes(params) {
151
151
  const { model, layoutModel, zonesById } = params;
152
152
  const result = {};
153
- for (const zone of typedValues(model.zonesById)) {
153
+ const zoneIds = Object.keys(model.zonesById);
154
+ for (const zoneId of zoneIds) {
155
+ const zone = model.zonesById[zoneId];
154
156
  const sourceZoneVisual = zonesById[zone.id];
155
157
  if (!sourceZoneVisual)
156
158
  continue;
@@ -187,7 +189,9 @@ function createPathVisualNodes(params) {
187
189
  function createEdgeVisuals(params) {
188
190
  const { model, zonesById, pathsById } = params;
189
191
  const result = {};
190
- for (const zone of typedValues(model.zonesById)) {
192
+ const zoneIds = Object.keys(model.zonesById);
193
+ for (const zoneId of zoneIds) {
194
+ const zone = model.zonesById[zoneId];
191
195
  const sourceZoneVisual = zonesById[zone.id];
192
196
  if (!sourceZoneVisual)
193
197
  continue;
package/package.json CHANGED
@@ -1,23 +1,27 @@
1
1
  {
2
2
  "name": "@zoneflow/renderer-dom",
3
- "version": "0.0.1",
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
- "url": "git@github-groobee:groobee/zoneflow.git",
11
+ "url": "https://github.com/groobee/zoneflow.git",
10
12
  "directory": "packages/renderer-dom"
11
13
  },
12
14
  "publishConfig": {
13
15
  "registry": "https://registry.npmjs.org"
14
16
  },
15
- "files": ["dist"],
17
+ "files": [
18
+ "dist"
19
+ ],
16
20
  "dependencies": {
17
- "@zoneflow/core": "workspace:*"
21
+ "@zoneflow/core": "0.0.3"
18
22
  },
19
23
  "scripts": {
20
24
  "build": "tsc -p tsconfig.json",
21
25
  "type-check": "tsc -p tsconfig.json --noEmit"
22
26
  }
23
- }
27
+ }