@tienne/gestalt 0.99.0 → 0.101.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.
- package/CLAUDE.md +6 -1
- package/dist/package.json +5 -3
- package/dist/plugin/research-sources/amplitude/SOURCE.md +28 -0
- package/dist/plugin/research-sources/app-store-reviews/SOURCE.md +25 -0
- package/dist/plugin/research-sources/app-store-search/SOURCE.md +25 -0
- package/dist/plugin/research-sources/tech-blog-search/SOURCE.md +27 -0
- package/dist/plugin/research-sources/uibowl/SOURCE.md +26 -0
- package/dist/plugin/research-sources/web-search/SOURCE.md +24 -0
- package/dist/plugin/skills/_shared/agent-delegation.md +30 -7
- package/dist/plugin/skills/_shared/agent-model.md +3 -1
- package/dist/plugin/skills/_shared/proactive-routing.md +5 -0
- package/dist/plugin/skills/brief/SKILL.md +5 -7
- package/dist/plugin/skills/explain/SKILL.md +4 -5
- package/dist/plugin/skills/jira-create/SKILL.md +3 -4
- package/dist/plugin/skills/market-scan/SKILL.md +61 -0
- package/dist/plugin/skills/pr/SKILL.md +4 -6
- package/dist/plugin/skills/presentation/SKILL.md +18 -16
- package/dist/plugin/skills/research/SKILL.md +438 -0
- package/dist/plugin/skills/research/references/design.md +938 -0
- package/dist/plugin/skills/research/references/output-template.md +366 -0
- package/dist/plugin/skills/research/scripts/pii-vision.swift +327 -0
- package/dist/plugin/skills/research/scripts/slide-extract.mjs +223 -0
- package/dist/plugin/skills/reverse-plan/SKILL.md +52 -0
- package/dist/plugin/skills/review/SKILL.md +20 -25
- package/dist/plugin/skills/review-reply/SKILL.md +4 -5
- package/dist/plugin/skills/screen-ref/SKILL.md +63 -0
- package/dist/plugin/skills/slack-send/SKILL.md +3 -4
- package/dist/plugin/skills/ux-research/SKILL.md +51 -0
- package/dist/src/core/config.d.ts +3 -0
- package/dist/src/core/config.d.ts.map +1 -1
- package/dist/src/core/config.js +4 -0
- package/dist/src/core/config.js.map +1 -1
- package/dist/src/mcp/schemas.d.ts +93 -0
- package/dist/src/mcp/schemas.d.ts.map +1 -1
- package/dist/src/mcp/schemas.js +110 -0
- package/dist/src/mcp/schemas.js.map +1 -1
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +11 -1
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools/research-passthrough.d.ts +21 -0
- package/dist/src/mcp/tools/research-passthrough.d.ts.map +1 -0
- package/dist/src/mcp/tools/research-passthrough.js +566 -0
- package/dist/src/mcp/tools/research-passthrough.js.map +1 -0
- package/dist/src/research/canvas-view.d.ts +5 -0
- package/dist/src/research/canvas-view.d.ts.map +1 -0
- package/dist/src/research/canvas-view.js +274 -0
- package/dist/src/research/canvas-view.js.map +1 -0
- package/dist/src/research/evidence.d.ts +145 -0
- package/dist/src/research/evidence.d.ts.map +1 -0
- package/dist/src/research/evidence.js +50 -0
- package/dist/src/research/evidence.js.map +1 -0
- package/dist/src/research/figma-plan.d.ts +80 -0
- package/dist/src/research/figma-plan.d.ts.map +1 -0
- package/dist/src/research/figma-plan.js +527 -0
- package/dist/src/research/figma-plan.js.map +1 -0
- package/dist/src/research/figma-script.d.ts +19 -0
- package/dist/src/research/figma-script.d.ts.map +1 -0
- package/dist/src/research/figma-script.js +363 -0
- package/dist/src/research/figma-script.js.map +1 -0
- package/dist/src/research/index.d.ts +8 -0
- package/dist/src/research/index.d.ts.map +1 -0
- package/dist/src/research/index.js +8 -0
- package/dist/src/research/index.js.map +1 -0
- package/dist/src/research/pii-core.d.ts +16 -0
- package/dist/src/research/pii-core.d.ts.map +1 -0
- package/dist/src/research/pii-core.js +345 -0
- package/dist/src/research/pii-core.js.map +1 -0
- package/dist/src/research/pii-dom.d.ts +13 -0
- package/dist/src/research/pii-dom.d.ts.map +1 -0
- package/dist/src/research/pii-dom.js +208 -0
- package/dist/src/research/pii-dom.js.map +1 -0
- package/dist/src/research/pii-image.d.ts +71 -0
- package/dist/src/research/pii-image.d.ts.map +1 -0
- package/dist/src/research/pii-image.js +163 -0
- package/dist/src/research/pii-image.js.map +1 -0
- package/dist/src/research/pii.d.ts +21 -0
- package/dist/src/research/pii.d.ts.map +1 -0
- package/dist/src/research/pii.js +47 -0
- package/dist/src/research/pii.js.map +1 -0
- package/dist/src/research/product-profile.d.ts +108 -0
- package/dist/src/research/product-profile.d.ts.map +1 -0
- package/dist/src/research/product-profile.js +104 -0
- package/dist/src/research/product-profile.js.map +1 -0
- package/dist/src/research/render-html.d.ts +203 -0
- package/dist/src/research/render-html.d.ts.map +1 -0
- package/dist/src/research/render-html.js +901 -0
- package/dist/src/research/render-html.js.map +1 -0
- package/dist/src/research/schema-base.d.ts +5 -0
- package/dist/src/research/schema-base.d.ts.map +1 -0
- package/dist/src/research/schema-base.js +10 -0
- package/dist/src/research/schema-base.js.map +1 -0
- package/dist/src/research/schema.d.ts +5142 -0
- package/dist/src/research/schema.d.ts.map +1 -0
- package/dist/src/research/schema.js +991 -0
- package/dist/src/research/schema.js.map +1 -0
- package/dist/src/research/source-create.d.ts +79 -0
- package/dist/src/research/source-create.d.ts.map +1 -0
- package/dist/src/research/source-create.js +226 -0
- package/dist/src/research/source-create.js.map +1 -0
- package/dist/src/research/source-registry.d.ts +29 -0
- package/dist/src/research/source-registry.d.ts.map +1 -0
- package/dist/src/research/source-registry.js +74 -0
- package/dist/src/research/source-registry.js.map +1 -0
- package/dist/src/research/source-schema.d.ts +158 -0
- package/dist/src/research/source-schema.d.ts.map +1 -0
- package/dist/src/research/source-schema.js +215 -0
- package/dist/src/research/source-schema.js.map +1 -0
- package/dist/src/research/source-status.d.ts +40 -0
- package/dist/src/research/source-status.d.ts.map +1 -0
- package/dist/src/research/source-status.js +109 -0
- package/dist/src/research/source-status.js.map +1 -0
- package/dist/src/research/store.d.ts +24 -0
- package/dist/src/research/store.d.ts.map +1 -0
- package/dist/src/research/store.js +60 -0
- package/dist/src/research/store.js.map +1 -0
- package/dist/src/research/target-view.d.ts +33 -0
- package/dist/src/research/target-view.d.ts.map +1 -0
- package/dist/src/research/target-view.js +133 -0
- package/dist/src/research/target-view.js.map +1 -0
- package/dist/src/research/target.d.ts +883 -0
- package/dist/src/research/target.d.ts.map +1 -0
- package/dist/src/research/target.js +323 -0
- package/dist/src/research/target.js.map +1 -0
- package/dist/src/research/video-transfer.d.ts +28 -0
- package/dist/src/research/video-transfer.d.ts.map +1 -0
- package/dist/src/research/video-transfer.js +100 -0
- package/dist/src/research/video-transfer.js.map +1 -0
- package/package.json +5 -3
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/mcp.json +1 -1
- package/plugin/research-sources/amplitude/SOURCE.md +28 -0
- package/plugin/research-sources/app-store-reviews/SOURCE.md +25 -0
- package/plugin/research-sources/app-store-search/SOURCE.md +25 -0
- package/plugin/research-sources/tech-blog-search/SOURCE.md +27 -0
- package/plugin/research-sources/uibowl/SOURCE.md +26 -0
- package/plugin/research-sources/web-search/SOURCE.md +24 -0
- package/plugin/skills/_shared/agent-delegation.md +30 -7
- package/plugin/skills/_shared/agent-model.md +3 -1
- package/plugin/skills/_shared/proactive-routing.md +5 -0
- package/plugin/skills/brief/SKILL.md +5 -7
- package/plugin/skills/explain/SKILL.md +4 -5
- package/plugin/skills/jira-create/SKILL.md +3 -4
- package/plugin/skills/market-scan/SKILL.md +61 -0
- package/plugin/skills/pr/SKILL.md +4 -6
- package/plugin/skills/presentation/SKILL.md +18 -16
- package/plugin/skills/research/SKILL.md +438 -0
- package/plugin/skills/research/references/design.md +938 -0
- package/plugin/skills/research/references/output-template.md +366 -0
- package/plugin/skills/research/scripts/pii-vision.swift +327 -0
- package/plugin/skills/research/scripts/slide-extract.mjs +223 -0
- package/plugin/skills/reverse-plan/SKILL.md +52 -0
- package/plugin/skills/review/SKILL.md +20 -25
- package/plugin/skills/review-reply/SKILL.md +4 -5
- package/plugin/skills/screen-ref/SKILL.md +63 -0
- package/plugin/skills/slack-send/SKILL.md +3 -4
- package/plugin/skills/ux-research/SKILL.md +51 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/** 이미지가 없는 자리의 캡션 끝에 붙는 표시. 이미지를 올린 뒤 fit 스크립트가 이 줄을 지운다 */
|
|
2
|
+
const NO_IMAGE_MARK = '(이미지 없음)';
|
|
3
|
+
/**
|
|
4
|
+
* Plugin API 스크립트의 본문. `async () => {...}` 꼴이라 실행기가 그대로 호출한다.
|
|
5
|
+
* 백틱과 템플릿 치환(달러+중괄호)은 쓰지 않는다. 계획, 이미지, 이미지 없음 표시는 아래 세 자리에 JSON으로 들어간다.
|
|
6
|
+
*/
|
|
7
|
+
const SCRIPT_TEMPLATE = String.raw `async () => {
|
|
8
|
+
const PLAN = __PLAN__;
|
|
9
|
+
const IMAGES = __IMAGES__;
|
|
10
|
+
if (typeof figma === 'undefined' || typeof figma.createPage !== 'function') {
|
|
11
|
+
return { ok: false, code: 'NO_FIGMA', message: '편집 권한이 있는 Figma 파일에서 실행해야 한다. 보기 전용 파일에는 figma 전역이 없다' };
|
|
12
|
+
}
|
|
13
|
+
let family = null;
|
|
14
|
+
for (const f of ['Pretendard', 'Inter']) {
|
|
15
|
+
try {
|
|
16
|
+
await figma.loadFontAsync({ family: f, style: 'Regular' });
|
|
17
|
+
await figma.loadFontAsync({ family: f, style: 'Bold' });
|
|
18
|
+
family = f;
|
|
19
|
+
break;
|
|
20
|
+
} catch (err) {}
|
|
21
|
+
}
|
|
22
|
+
if (!family) return { ok: false, code: 'NO_FONT', message: 'Pretendard와 Inter를 모두 불러오지 못했다' };
|
|
23
|
+
|
|
24
|
+
const W = PLAN.width;
|
|
25
|
+
const PAD = 64;
|
|
26
|
+
const INNER = W - PAD * 2;
|
|
27
|
+
const rgb = (h) => ({ r: parseInt(h.slice(1, 3), 16) / 255, g: parseInt(h.slice(3, 5), 16) / 255, b: parseInt(h.slice(5, 7), 16) / 255 });
|
|
28
|
+
const solid = (h) => [{ type: 'SOLID', color: rgb(h) }];
|
|
29
|
+
const STYLES = {
|
|
30
|
+
title: { size: 32, bold: true, color: '#111111' },
|
|
31
|
+
h2: { size: 24, bold: true, color: '#111111' },
|
|
32
|
+
h3: { size: 18, bold: true, color: '#111111' },
|
|
33
|
+
body: { size: 14, bold: false, color: '#222222' },
|
|
34
|
+
cell: { size: 16, bold: false, color: '#222222' },
|
|
35
|
+
caption: { size: 12, bold: false, color: '#666666' },
|
|
36
|
+
notice: { size: 14, bold: true, color: '#8a4b00' },
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const TINTS = { green: '#e8f5ec', blue: '#e8eff9', orange: '#fff4e5' };
|
|
40
|
+
const NOTE_COLORS = { wow: '#1a7f37', pain: '#c0362c', insight: '#1f5fbf', design: '#6b46c1' };
|
|
41
|
+
const NOTE_W = 560;
|
|
42
|
+
const CARD_W = 320;
|
|
43
|
+
|
|
44
|
+
const stats = { tables: 0, imageNodes: [], missingImages: [], imageSlots: [] };
|
|
45
|
+
|
|
46
|
+
function addText(parent, str, styleName, name) {
|
|
47
|
+
const s = STYLES[styleName] || STYLES.body;
|
|
48
|
+
const t = figma.createText();
|
|
49
|
+
t.fontName = { family: family, style: s.bold ? 'Bold' : 'Regular' };
|
|
50
|
+
t.fontSize = s.size;
|
|
51
|
+
t.fills = solid(s.color);
|
|
52
|
+
t.characters = str;
|
|
53
|
+
if (name) t.name = name;
|
|
54
|
+
parent.appendChild(t);
|
|
55
|
+
t.layoutSizingHorizontal = 'FILL';
|
|
56
|
+
t.textAutoResize = 'HEIGHT';
|
|
57
|
+
return t;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function vframe(name, width, gap, pad) {
|
|
61
|
+
const f = figma.createFrame();
|
|
62
|
+
f.name = name;
|
|
63
|
+
f.layoutMode = 'VERTICAL';
|
|
64
|
+
f.resize(width, 100);
|
|
65
|
+
f.primaryAxisSizingMode = 'AUTO';
|
|
66
|
+
f.counterAxisSizingMode = 'FIXED';
|
|
67
|
+
f.itemSpacing = gap;
|
|
68
|
+
f.paddingLeft = pad;
|
|
69
|
+
f.paddingRight = pad;
|
|
70
|
+
f.paddingTop = pad;
|
|
71
|
+
f.paddingBottom = pad;
|
|
72
|
+
f.fills = [];
|
|
73
|
+
return f;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function addTable(parent, node, width, tinted) {
|
|
77
|
+
stats.tables += 1;
|
|
78
|
+
const cols = node.head.length;
|
|
79
|
+
const weights = [];
|
|
80
|
+
for (let c = 0; c < cols; c++) {
|
|
81
|
+
let max = String(node.head[c]).length;
|
|
82
|
+
for (const row of node.rows) max = Math.max(max, String(row[c] === undefined ? '' : row[c]).length);
|
|
83
|
+
weights.push(Math.min(Math.max(max, 12), 60));
|
|
84
|
+
}
|
|
85
|
+
const total = weights.reduce((a, b) => a + b, 0);
|
|
86
|
+
const widths = weights.map((w) => Math.floor((width * w) / total));
|
|
87
|
+
const table = figma.createFrame();
|
|
88
|
+
table.name = 'table';
|
|
89
|
+
table.layoutMode = 'VERTICAL';
|
|
90
|
+
table.resize(width, 100);
|
|
91
|
+
table.primaryAxisSizingMode = 'AUTO';
|
|
92
|
+
table.counterAxisSizingMode = 'FIXED';
|
|
93
|
+
table.itemSpacing = 0;
|
|
94
|
+
table.fills = [];
|
|
95
|
+
if (tinted) {
|
|
96
|
+
table.cornerRadius = 8;
|
|
97
|
+
table.clipsContent = true;
|
|
98
|
+
}
|
|
99
|
+
parent.appendChild(table);
|
|
100
|
+
table.layoutSizingHorizontal = 'FILL';
|
|
101
|
+
const addRow = (cells, header) => {
|
|
102
|
+
const row = figma.createFrame();
|
|
103
|
+
row.name = header ? 'table-head' : 'table-row';
|
|
104
|
+
row.layoutMode = 'HORIZONTAL';
|
|
105
|
+
row.resize(width, 40);
|
|
106
|
+
row.primaryAxisSizingMode = 'FIXED';
|
|
107
|
+
row.counterAxisSizingMode = 'AUTO';
|
|
108
|
+
row.itemSpacing = 0;
|
|
109
|
+
row.fills = header ? solid('#eef0f2') : tinted ? solid('#ffffff') : [];
|
|
110
|
+
table.appendChild(row);
|
|
111
|
+
for (let c = 0; c < cols; c++) {
|
|
112
|
+
const cell = figma.createFrame();
|
|
113
|
+
cell.name = 'cell';
|
|
114
|
+
cell.layoutMode = 'VERTICAL';
|
|
115
|
+
cell.resize(widths[c], 40);
|
|
116
|
+
cell.primaryAxisSizingMode = 'AUTO';
|
|
117
|
+
cell.counterAxisSizingMode = 'FIXED';
|
|
118
|
+
cell.paddingLeft = 10;
|
|
119
|
+
cell.paddingRight = 10;
|
|
120
|
+
cell.paddingTop = 8;
|
|
121
|
+
cell.paddingBottom = 8;
|
|
122
|
+
cell.fills = [];
|
|
123
|
+
cell.strokes = solid('#dde1e4');
|
|
124
|
+
cell.strokeWeight = 1;
|
|
125
|
+
row.appendChild(cell);
|
|
126
|
+
cell.layoutSizingVertical = 'FILL';
|
|
127
|
+
addText(cell, String(cells[c] === undefined ? '' : cells[c]), header ? 'h3' : 'cell');
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
addRow(node.head, true);
|
|
131
|
+
for (const r of node.rows) addRow(r, false);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function decode(b64) {
|
|
135
|
+
if (typeof figma.base64Decode === 'function') return figma.base64Decode(b64);
|
|
136
|
+
const bin = atob(b64);
|
|
137
|
+
const out = new Uint8Array(bin.length);
|
|
138
|
+
for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);
|
|
139
|
+
return out;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async function addImages(parent, node, cardW, wrapW, fill) {
|
|
143
|
+
const wrap = figma.createFrame();
|
|
144
|
+
wrap.name = 'captures';
|
|
145
|
+
wrap.layoutMode = 'HORIZONTAL';
|
|
146
|
+
wrap.layoutWrap = 'WRAP';
|
|
147
|
+
wrap.resize(wrapW, 100);
|
|
148
|
+
wrap.primaryAxisSizingMode = 'FIXED';
|
|
149
|
+
wrap.counterAxisSizingMode = 'AUTO';
|
|
150
|
+
wrap.itemSpacing = 24;
|
|
151
|
+
wrap.counterAxisSpacing = 24;
|
|
152
|
+
wrap.fills = [];
|
|
153
|
+
parent.appendChild(wrap);
|
|
154
|
+
if (fill) wrap.layoutSizingHorizontal = 'FILL';
|
|
155
|
+
for (const item of node.items) {
|
|
156
|
+
const card = vframe('capture:' + item.imageId, cardW, 8, 0);
|
|
157
|
+
wrap.appendChild(card);
|
|
158
|
+
const rect = figma.createRectangle();
|
|
159
|
+
rect.name = 'img:' + item.imageId;
|
|
160
|
+
const data = IMAGES && IMAGES[item.imageId];
|
|
161
|
+
let height = cardW;
|
|
162
|
+
let hash = null;
|
|
163
|
+
if (data) {
|
|
164
|
+
try {
|
|
165
|
+
const image = figma.createImage(decode(data.base64));
|
|
166
|
+
const size = await image.getSizeAsync();
|
|
167
|
+
height = Math.max(40, Math.round((cardW * size.height) / size.width));
|
|
168
|
+
hash = image.hash;
|
|
169
|
+
} catch (err) {}
|
|
170
|
+
}
|
|
171
|
+
rect.resize(cardW, height);
|
|
172
|
+
if (hash) {
|
|
173
|
+
rect.fills = [{ type: 'IMAGE', scaleMode: 'FIT', imageHash: hash }];
|
|
174
|
+
stats.imageNodes.push({ id: item.imageId, nodeId: rect.id });
|
|
175
|
+
} else {
|
|
176
|
+
rect.fills = solid('#e4e6e8');
|
|
177
|
+
stats.missingImages.push(item.imageId);
|
|
178
|
+
stats.imageSlots.push({ id: item.imageId, nodeId: rect.id });
|
|
179
|
+
}
|
|
180
|
+
card.appendChild(rect);
|
|
181
|
+
addText(card, hash ? item.caption : item.caption + __NO_IMAGE_TAIL__, 'caption');
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async function addNode(parent, node, width, tinted) {
|
|
186
|
+
if (node.type === 'text') {
|
|
187
|
+
addText(parent, node.text, node.style);
|
|
188
|
+
} else if (node.type === 'table') {
|
|
189
|
+
addTable(parent, node, width, tinted);
|
|
190
|
+
} else if (node.type === 'images') {
|
|
191
|
+
await addImages(parent, node, 240, INNER - 64, true);
|
|
192
|
+
} else if (node.type === 'section') {
|
|
193
|
+
const tint = TINTS[node.tint];
|
|
194
|
+
const sec = vframe('section', width, 16, 32);
|
|
195
|
+
sec.name = node.title;
|
|
196
|
+
sec.fills = solid(tint || '#ffffff');
|
|
197
|
+
sec.cornerRadius = 12;
|
|
198
|
+
parent.appendChild(sec);
|
|
199
|
+
sec.layoutSizingHorizontal = 'FILL';
|
|
200
|
+
addText(sec, node.title, 'h2');
|
|
201
|
+
for (const child of node.children) await addNode(sec, child, width - 64, !!tint);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function hframe(name, gap) {
|
|
206
|
+
const f = figma.createFrame();
|
|
207
|
+
f.name = name;
|
|
208
|
+
f.layoutMode = 'HORIZONTAL';
|
|
209
|
+
f.primaryAxisSizingMode = 'AUTO';
|
|
210
|
+
f.counterAxisSizingMode = 'AUTO';
|
|
211
|
+
f.itemSpacing = gap;
|
|
212
|
+
f.fills = [];
|
|
213
|
+
return f;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function addNotes(parent, notes) {
|
|
217
|
+
const card = vframe('notes', NOTE_W, 12, 24);
|
|
218
|
+
card.fills = solid('#ffffff');
|
|
219
|
+
card.cornerRadius = 12;
|
|
220
|
+
parent.appendChild(card);
|
|
221
|
+
for (const n of notes) {
|
|
222
|
+
const line = hframe('note', 12);
|
|
223
|
+
card.appendChild(line);
|
|
224
|
+
line.layoutSizingHorizontal = 'FILL';
|
|
225
|
+
const label = addText(line, n.label, 'h3', 'label');
|
|
226
|
+
label.fills = solid(NOTE_COLORS[n.kind] || '#222222');
|
|
227
|
+
label.layoutSizingHorizontal = 'HUG';
|
|
228
|
+
addText(line, n.text, 'cell');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
async function addGroup(parent, group) {
|
|
233
|
+
const g = vframe(group.title, INNER, 16, 0);
|
|
234
|
+
parent.appendChild(g);
|
|
235
|
+
g.layoutSizingHorizontal = 'FILL';
|
|
236
|
+
addText(g, group.title, 'h2');
|
|
237
|
+
if (group.description) addText(g, group.description, 'caption');
|
|
238
|
+
const row = hframe('row', 24);
|
|
239
|
+
g.appendChild(row);
|
|
240
|
+
await addImages(row, { items: group.images }, CARD_W, INNER - NOTE_W - 24);
|
|
241
|
+
if (group.notes.length > 0) addNotes(row, group.notes);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
async function addBoard(root) {
|
|
245
|
+
const byTitle = new Map(PLAN.nodes.filter((n) => n.type === 'section').map((n) => [n.title, n]));
|
|
246
|
+
const leading = PLAN.nodes.filter((n) => n.type !== 'section');
|
|
247
|
+
const columnIds = [];
|
|
248
|
+
for (const col of PLAN.board.columns) {
|
|
249
|
+
const frame = vframe(col.title, W, 32, PAD);
|
|
250
|
+
frame.fills = solid('#f3f4f6');
|
|
251
|
+
frame.cornerRadius = 32;
|
|
252
|
+
root.appendChild(frame);
|
|
253
|
+
addText(frame, col.title, 'h2', 'column-title');
|
|
254
|
+
if (col.kind === 'conclusion') for (const n of leading) await addNode(frame, n, INNER, false);
|
|
255
|
+
if (col.kind === 'captures') for (const g of PLAN.board.groups) await addGroup(frame, g);
|
|
256
|
+
for (const t of col.sections) await addNode(frame, byTitle.get(t), INNER, false);
|
|
257
|
+
columnIds.push(frame.id);
|
|
258
|
+
}
|
|
259
|
+
return columnIds;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const page = figma.createPage();
|
|
263
|
+
page.name = PLAN.pageName;
|
|
264
|
+
if (typeof figma.setCurrentPageAsync === 'function') await figma.setCurrentPageAsync(page);
|
|
265
|
+
else figma.currentPage = page;
|
|
266
|
+
|
|
267
|
+
let root;
|
|
268
|
+
let columnIds = [];
|
|
269
|
+
if (PLAN.layout === 'board' && PLAN.board) {
|
|
270
|
+
root = hframe(PLAN.pageName, 160);
|
|
271
|
+
root.paddingLeft = 120;
|
|
272
|
+
root.paddingRight = 120;
|
|
273
|
+
root.paddingTop = 120;
|
|
274
|
+
root.paddingBottom = 120;
|
|
275
|
+
root.fills = solid('#e3e5e8');
|
|
276
|
+
page.appendChild(root);
|
|
277
|
+
columnIds = await addBoard(root);
|
|
278
|
+
} else {
|
|
279
|
+
root = vframe(PLAN.pageName, W, 32, PAD);
|
|
280
|
+
root.fills = solid('#f6f7f8');
|
|
281
|
+
page.appendChild(root);
|
|
282
|
+
for (const node of PLAN.nodes) await addNode(root, node, INNER, false);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return {
|
|
286
|
+
ok: true,
|
|
287
|
+
pageId: page.id,
|
|
288
|
+
rootId: root.id,
|
|
289
|
+
columnIds: columnIds,
|
|
290
|
+
tableCount: stats.tables,
|
|
291
|
+
imageNodes: stats.imageNodes,
|
|
292
|
+
missingImages: stats.missingImages,
|
|
293
|
+
imageSlots: stats.imageSlots,
|
|
294
|
+
};
|
|
295
|
+
}`;
|
|
296
|
+
function embed(value) {
|
|
297
|
+
return JSON.stringify(value)
|
|
298
|
+
.replace(new RegExp(String.fromCharCode(0x2028), 'g'), '\\u2028')
|
|
299
|
+
.replace(new RegExp(String.fromCharCode(0x2029), 'g'), '\\u2029');
|
|
300
|
+
}
|
|
301
|
+
const FN_HEAD = 'async () => {\n';
|
|
302
|
+
const FN_TAIL = '\n}';
|
|
303
|
+
function shape(fn, runner) {
|
|
304
|
+
if (runner !== 'body' || !fn.startsWith(FN_HEAD) || !fn.endsWith(FN_TAIL))
|
|
305
|
+
return fn;
|
|
306
|
+
return fn.slice(FN_HEAD.length, -FN_TAIL.length) + '\n';
|
|
307
|
+
}
|
|
308
|
+
/** 계획을 Figma 새 페이지로 그리는 Plugin API 스크립트. images가 없으면 이미지 자리는 회색 칸으로 남는다 */
|
|
309
|
+
export function buildFigmaScript(plan, images, runner) {
|
|
310
|
+
const script = SCRIPT_TEMPLATE.replace('__PLAN__', () => embed(plan))
|
|
311
|
+
.replace('__IMAGES__', () => (images ? embed(images) : 'null'))
|
|
312
|
+
.replace('__NO_IMAGE_TAIL__', () => embed('\n' + NO_IMAGE_MARK));
|
|
313
|
+
return shape(script, runner);
|
|
314
|
+
}
|
|
315
|
+
/** 쓴 뒤 파일에서 이미지 fill이 남았는지 보는 스크립트. 탭을 닫기 전에 업로드가 끝났는지 확인하는 자리다 */
|
|
316
|
+
export function buildFigmaVerifyScript(pageId, expectedImageIds, runner) {
|
|
317
|
+
return shape('async () => {\n' +
|
|
318
|
+
' const page = await figma.getNodeByIdAsync(' +
|
|
319
|
+
embed(pageId) +
|
|
320
|
+
');\n' +
|
|
321
|
+
" if (!page) return { ok: false, code: 'NO_PAGE', message: '페이지를 찾지 못했다' };\n" +
|
|
322
|
+
' const expected = ' +
|
|
323
|
+
embed(expectedImageIds) +
|
|
324
|
+
';\n' +
|
|
325
|
+
' const found = new Set();\n' +
|
|
326
|
+
" for (const n of page.findAll((x) => typeof x.name === 'string' && x.name.indexOf('img:') === 0)) {\n" +
|
|
327
|
+
' const fill = Array.isArray(n.fills) ? n.fills[0] : null;\n' +
|
|
328
|
+
" if (fill && fill.type === 'IMAGE' && fill.imageHash) found.add(n.name.slice(4));\n" +
|
|
329
|
+
' }\n' +
|
|
330
|
+
' const missing = expected.filter((id) => !found.has(id));\n' +
|
|
331
|
+
' return { ok: missing.length === 0, expected: expected.length, found: found.size, missing: missing };\n' +
|
|
332
|
+
'}', runner);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* upload_assets로 이미지를 올린 뒤 도는 스크립트. 회색 칸으로 그려 둔 사각형의 높이를 올린 이미지 비율에 맞추고
|
|
336
|
+
* 캡션 끝의 이미지 없음 표시를 지운다. 이미지가 안 올라간 자리는 noImage로 알려준다
|
|
337
|
+
*/
|
|
338
|
+
export function buildFigmaFitScript(pageId, runner) {
|
|
339
|
+
return shape([
|
|
340
|
+
'async () => {',
|
|
341
|
+
' const page = await figma.getNodeByIdAsync(' + embed(pageId) + ');',
|
|
342
|
+
" if (!page) return { ok: false, code: 'NO_PAGE', message: '페이지를 찾지 못했다' };",
|
|
343
|
+
' const tail = ' + embed('\n' + NO_IMAGE_MARK) + ';',
|
|
344
|
+
' const fitted = [];',
|
|
345
|
+
' const noImage = [];',
|
|
346
|
+
" for (const rect of page.findAll((x) => typeof x.name === 'string' && x.name.indexOf('img:') === 0)) {",
|
|
347
|
+
' const id = rect.name.slice(4);',
|
|
348
|
+
' const fill = Array.isArray(rect.fills) ? rect.fills[0] : null;',
|
|
349
|
+
" if (!fill || fill.type !== 'IMAGE' || !fill.imageHash) { noImage.push(id); continue; }",
|
|
350
|
+
' const size = await figma.getImageByHash(fill.imageHash).getSizeAsync();',
|
|
351
|
+
' rect.resize(rect.width, Math.max(40, Math.round((rect.width * size.height) / size.width)));',
|
|
352
|
+
' fitted.push(id);',
|
|
353
|
+
' for (const t of rect.parent ? rect.parent.children : []) {',
|
|
354
|
+
" if (typeof t.characters !== 'string' || !t.characters.endsWith(tail)) continue;",
|
|
355
|
+
" for (const seg of t.getStyledTextSegments(['fontName'])) await figma.loadFontAsync(seg.fontName);",
|
|
356
|
+
' t.characters = t.characters.slice(0, -tail.length);',
|
|
357
|
+
' }',
|
|
358
|
+
' }',
|
|
359
|
+
' return { ok: noImage.length === 0, fitted: fitted, noImage: noImage };',
|
|
360
|
+
'}',
|
|
361
|
+
].join('\n'), runner);
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=figma-script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"figma-script.js","sourceRoot":"","sources":["../../../src/research/figma-script.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './evidence.js';
|
|
2
|
+
export * from './schema.js';
|
|
3
|
+
export * from './source-schema.js';
|
|
4
|
+
export * from './source-registry.js';
|
|
5
|
+
export * from './source-status.js';
|
|
6
|
+
export * from './source-create.js';
|
|
7
|
+
export * from './video-transfer.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/research/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './evidence.js';
|
|
2
|
+
export * from './schema.js';
|
|
3
|
+
export * from './source-schema.js';
|
|
4
|
+
export * from './source-registry.js';
|
|
5
|
+
export * from './source-status.js';
|
|
6
|
+
export * from './source-create.js';
|
|
7
|
+
export * from './video-transfer.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/research/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 개인정보 탐지와 가짜 값 치환 코어.
|
|
3
|
+
*
|
|
4
|
+
* Node(이미지 경로의 OCR 결과 글자)와 브라우저(DOM 글자)가 같은 구현을 쓰도록 소스 문자열로
|
|
5
|
+
* 둔다. `Function.toString()`으로 뽑지 않는 건 번들러가 함수 안에 헬퍼를 끼워 넣어 브라우저에서
|
|
6
|
+
* 깨지기 때문이다. 이 문자열은 `node:vm`과 `page.evaluate` 양쪽에서 그대로 평가된다.
|
|
7
|
+
*
|
|
8
|
+
* 규칙
|
|
9
|
+
* - 실제 값과 가명의 대응표를 만들지 않는다. 가명은 `seed + 종류 + 정규화한 값`의 해시로
|
|
10
|
+
* 정해서, 같은 값이면 같은 가명이 나오지만 가명에서 실제 값을 되돌릴 수 없다.
|
|
11
|
+
* - 이 소스 안에서 백틱과 `${`를 쓰지 않는다. String.raw가 깨진다.
|
|
12
|
+
* - 못 잡는 것: 라벨 없는 이름, 성씨 목록 밖의 이름, 사진 속 글자가 아닌 정보. `pii: none`은
|
|
13
|
+
* "탐지기가 돌았고 0건"이라는 뜻이지 개인정보가 없다는 보증이 아니다.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PII_CORE_SOURCE: string;
|
|
16
|
+
//# sourceMappingURL=pii-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pii-core.d.ts","sourceRoot":"","sources":["../../../src/research/pii-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,QAyUvB,CAAC"}
|