@democraft/preview 0.1.0-beta.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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +441 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Democraft contributors
|
|
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
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RecordedDemoManifest, RenderTimeline } from '@democraft/schema';
|
|
2
|
+
|
|
3
|
+
type PreviewInput = {
|
|
4
|
+
manifest: RecordedDemoManifest;
|
|
5
|
+
timeline: RenderTimeline;
|
|
6
|
+
videoSrc?: string;
|
|
7
|
+
screenshotSrcByStepId?: Record<string, string>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
declare function renderPreviewHtml(input: PreviewInput): string;
|
|
11
|
+
|
|
12
|
+
export { type PreviewInput, renderPreviewHtml };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
// src/escape.ts
|
|
2
|
+
function escapeHtml(value) {
|
|
3
|
+
return value.replace(/[&<>"']/g, (char) => {
|
|
4
|
+
const replacements = {
|
|
5
|
+
"&": "&",
|
|
6
|
+
"<": "<",
|
|
7
|
+
">": ">",
|
|
8
|
+
'"': """,
|
|
9
|
+
"'": "'"
|
|
10
|
+
};
|
|
11
|
+
return replacements[char] ?? char;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function safeJson(value) {
|
|
15
|
+
return JSON.stringify(value).replace(/</g, "\\u003c");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/template.ts
|
|
19
|
+
function renderPreviewHtml(input) {
|
|
20
|
+
const videoSrc = input.videoSrc ?? "";
|
|
21
|
+
const recording = input.manifest.recording ?? { width: 1440, height: 900 };
|
|
22
|
+
const screenshotSrcByStepId = input.screenshotSrcByStepId ?? {};
|
|
23
|
+
return `<!doctype html>
|
|
24
|
+
<html lang="en">
|
|
25
|
+
<head>
|
|
26
|
+
<meta charset="utf-8" />
|
|
27
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
28
|
+
<title>${escapeHtml(input.timeline.demoId)} preview</title>
|
|
29
|
+
<style>
|
|
30
|
+
:root {
|
|
31
|
+
color-scheme: dark;
|
|
32
|
+
--bg: #10131a;
|
|
33
|
+
--panel: #181d26;
|
|
34
|
+
--line: #2c3545;
|
|
35
|
+
--text: #edf2ff;
|
|
36
|
+
--muted: #99a6bd;
|
|
37
|
+
--accent: #79e3c7;
|
|
38
|
+
--warm: #f5c96f;
|
|
39
|
+
--danger: #ff7b8c;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
* {
|
|
43
|
+
box-sizing: border-box;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
body {
|
|
47
|
+
margin: 0;
|
|
48
|
+
min-height: 100vh;
|
|
49
|
+
background:
|
|
50
|
+
radial-gradient(circle at 20% 0%, rgb(121 227 199 / 14%), transparent 34rem),
|
|
51
|
+
linear-gradient(135deg, #0d1017, #151925 56%, #11131a);
|
|
52
|
+
color: var(--text);
|
|
53
|
+
font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.app {
|
|
57
|
+
display: grid;
|
|
58
|
+
grid-template-columns: minmax(0, 1fr) 380px;
|
|
59
|
+
gap: 20px;
|
|
60
|
+
padding: 22px;
|
|
61
|
+
min-height: 100vh;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.stage-shell,
|
|
65
|
+
.panel {
|
|
66
|
+
border: 1px solid var(--line);
|
|
67
|
+
background: rgb(24 29 38 / 88%);
|
|
68
|
+
box-shadow: 0 24px 90px rgb(0 0 0 / 32%);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.stage-shell {
|
|
72
|
+
border-radius: 8px;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
align-self: start;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.top {
|
|
78
|
+
display: flex;
|
|
79
|
+
justify-content: space-between;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 14px;
|
|
82
|
+
padding: 14px 16px;
|
|
83
|
+
border-bottom: 1px solid var(--line);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
h1 {
|
|
87
|
+
margin: 0;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
letter-spacing: 0.08em;
|
|
90
|
+
text-transform: uppercase;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.meta {
|
|
94
|
+
color: var(--muted);
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.stage {
|
|
99
|
+
position: relative;
|
|
100
|
+
background: #07090d;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.media {
|
|
104
|
+
display: block;
|
|
105
|
+
width: 100%;
|
|
106
|
+
aspect-ratio: ${recording.width} / ${recording.height};
|
|
107
|
+
object-fit: contain;
|
|
108
|
+
background: #05070a;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.reference-video {
|
|
112
|
+
display: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.layer {
|
|
116
|
+
position: absolute;
|
|
117
|
+
inset: 0;
|
|
118
|
+
pointer-events: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.target-box {
|
|
122
|
+
position: absolute;
|
|
123
|
+
border: 2px solid var(--warm);
|
|
124
|
+
box-shadow: 0 0 0 1px rgb(0 0 0 / 50%), 0 0 28px rgb(245 201 111 / 42%);
|
|
125
|
+
border-radius: 6px;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.cursor {
|
|
129
|
+
position: absolute;
|
|
130
|
+
width: 18px;
|
|
131
|
+
height: 18px;
|
|
132
|
+
border-radius: 999px;
|
|
133
|
+
translate: -50% -50%;
|
|
134
|
+
background: var(--accent);
|
|
135
|
+
box-shadow: 0 0 0 7px rgb(121 227 199 / 18%), 0 0 30px rgb(121 227 199 / 65%);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.caption,
|
|
139
|
+
.callout {
|
|
140
|
+
position: absolute;
|
|
141
|
+
border: 1px solid rgb(255 255 255 / 16%);
|
|
142
|
+
background: rgb(11 14 20 / 82%);
|
|
143
|
+
backdrop-filter: blur(12px);
|
|
144
|
+
border-radius: 8px;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.caption {
|
|
148
|
+
left: 50%;
|
|
149
|
+
bottom: 28px;
|
|
150
|
+
translate: -50% 0;
|
|
151
|
+
max-width: min(720px, 80%);
|
|
152
|
+
padding: 14px 18px;
|
|
153
|
+
font-size: 18px;
|
|
154
|
+
text-align: center;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.callout {
|
|
158
|
+
padding: 14px 16px;
|
|
159
|
+
max-width: 320px;
|
|
160
|
+
box-shadow: 0 18px 50px rgb(0 0 0 / 30%);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.callout strong {
|
|
164
|
+
display: block;
|
|
165
|
+
margin-bottom: 6px;
|
|
166
|
+
color: var(--accent);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.callout p {
|
|
170
|
+
margin: 0;
|
|
171
|
+
color: var(--muted);
|
|
172
|
+
line-height: 1.45;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.panel {
|
|
176
|
+
border-radius: 8px;
|
|
177
|
+
padding: 16px;
|
|
178
|
+
max-height: calc(100vh - 44px);
|
|
179
|
+
overflow: auto;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.readout {
|
|
183
|
+
display: grid;
|
|
184
|
+
grid-template-columns: repeat(3, 1fr);
|
|
185
|
+
gap: 8px;
|
|
186
|
+
margin: 14px 0 18px;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.metric {
|
|
190
|
+
padding: 10px;
|
|
191
|
+
border: 1px solid var(--line);
|
|
192
|
+
border-radius: 6px;
|
|
193
|
+
background: #111620;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.metric b {
|
|
197
|
+
display: block;
|
|
198
|
+
margin-top: 4px;
|
|
199
|
+
font-size: 18px;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.scene {
|
|
203
|
+
border-top: 1px solid var(--line);
|
|
204
|
+
padding: 12px 0;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.scene h2 {
|
|
208
|
+
margin: 0 0 8px;
|
|
209
|
+
font-size: 13px;
|
|
210
|
+
color: var(--accent);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.step {
|
|
214
|
+
display: grid;
|
|
215
|
+
grid-template-columns: 70px 1fr;
|
|
216
|
+
gap: 10px;
|
|
217
|
+
padding: 5px 0;
|
|
218
|
+
color: var(--muted);
|
|
219
|
+
font-size: 12px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.active-step {
|
|
223
|
+
color: var(--text);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.active-step .range {
|
|
227
|
+
color: var(--warm);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.controls {
|
|
231
|
+
display: grid;
|
|
232
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
233
|
+
gap: 12px;
|
|
234
|
+
align-items: center;
|
|
235
|
+
padding: 12px 16px;
|
|
236
|
+
border-top: 1px solid var(--line);
|
|
237
|
+
background: #0c1018;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
button {
|
|
241
|
+
border: 1px solid var(--line);
|
|
242
|
+
border-radius: 6px;
|
|
243
|
+
background: #141a24;
|
|
244
|
+
color: var(--text);
|
|
245
|
+
font: inherit;
|
|
246
|
+
padding: 8px 12px;
|
|
247
|
+
cursor: pointer;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
input[type="range"] {
|
|
251
|
+
width: 100%;
|
|
252
|
+
accent-color: var(--accent);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@media (max-width: 980px) {
|
|
256
|
+
.app {
|
|
257
|
+
grid-template-columns: 1fr;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.panel {
|
|
261
|
+
max-height: none;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
</style>
|
|
265
|
+
</head>
|
|
266
|
+
<body>
|
|
267
|
+
<main class="app">
|
|
268
|
+
<section class="stage-shell">
|
|
269
|
+
<div class="top">
|
|
270
|
+
<h1>${escapeHtml(input.timeline.demoId)}</h1>
|
|
271
|
+
<div class="meta"><span id="frame">0</span> / ${input.timeline.durationInFrames} frames</div>
|
|
272
|
+
</div>
|
|
273
|
+
<div class="stage" id="stage">
|
|
274
|
+
<img class="media" id="shot" alt="" />
|
|
275
|
+
<video class="reference-video" id="video" src="${escapeHtml(videoSrc)}" muted playsinline preload="metadata"></video>
|
|
276
|
+
<div class="layer" id="layer"></div>
|
|
277
|
+
</div>
|
|
278
|
+
<div class="controls">
|
|
279
|
+
<button id="play" type="button">Play</button>
|
|
280
|
+
<input id="scrub" type="range" min="0" max="${input.timeline.durationInFrames}" value="0" />
|
|
281
|
+
<div class="meta"><span id="time">0.00</span>s / ${(input.timeline.durationInFrames / input.timeline.fps).toFixed(2)}s</div>
|
|
282
|
+
</div>
|
|
283
|
+
</section>
|
|
284
|
+
<aside class="panel">
|
|
285
|
+
<h1>Resolved Preview</h1>
|
|
286
|
+
<div class="readout">
|
|
287
|
+
<div class="metric"><span>FPS</span><b>${input.timeline.fps}</b></div>
|
|
288
|
+
<div class="metric"><span>Scenes</span><b>${input.timeline.scenes.length}</b></div>
|
|
289
|
+
<div class="metric"><span>Tracks</span><b>${input.timeline.camera.length + input.timeline.cursor.length + input.timeline.overlays.length}</b></div>
|
|
290
|
+
</div>
|
|
291
|
+
<div id="steps"></div>
|
|
292
|
+
</aside>
|
|
293
|
+
</main>
|
|
294
|
+
<script>
|
|
295
|
+
const timeline = ${safeJson(input.timeline)};
|
|
296
|
+
const recording = ${safeJson(recording)};
|
|
297
|
+
const screenshotSrcByStepId = ${safeJson(screenshotSrcByStepId)};
|
|
298
|
+
const shot = document.getElementById("shot");
|
|
299
|
+
const layer = document.getElementById("layer");
|
|
300
|
+
const frameLabel = document.getElementById("frame");
|
|
301
|
+
const stepsRoot = document.getElementById("steps");
|
|
302
|
+
const playButton = document.getElementById("play");
|
|
303
|
+
const scrub = document.getElementById("scrub");
|
|
304
|
+
const timeLabel = document.getElementById("time");
|
|
305
|
+
let frame = 0;
|
|
306
|
+
let playing = false;
|
|
307
|
+
let playStartedAt = 0;
|
|
308
|
+
let playStartedFrame = 0;
|
|
309
|
+
const allSteps = timeline.scenes.flatMap((scene) => scene.steps);
|
|
310
|
+
|
|
311
|
+
function active(track, frame) {
|
|
312
|
+
return frame >= track.fromFrame && frame < track.fromFrame + track.durationInFrames;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function scaleBox(box) {
|
|
316
|
+
const rect = shot.getBoundingClientRect();
|
|
317
|
+
const sx = rect.width / recording.width;
|
|
318
|
+
const sy = rect.height / recording.height;
|
|
319
|
+
return {
|
|
320
|
+
x: box.x * sx,
|
|
321
|
+
y: box.y * sy,
|
|
322
|
+
width: box.width * sx,
|
|
323
|
+
height: box.height * sy
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function div(className, styles = {}, html = "") {
|
|
328
|
+
const element = document.createElement("div");
|
|
329
|
+
element.className = className;
|
|
330
|
+
Object.assign(element.style, styles);
|
|
331
|
+
element.innerHTML = html;
|
|
332
|
+
return element;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function render(frame) {
|
|
336
|
+
const visibleStep = [...allSteps].reverse().find((step) => frame >= step.fromFrame);
|
|
337
|
+
const screenshotSrc = visibleStep ? screenshotSrcByStepId[visibleStep.stepId] : undefined;
|
|
338
|
+
if (screenshotSrc && shot.src !== screenshotSrc) shot.src = screenshotSrc;
|
|
339
|
+
frameLabel.textContent = String(frame);
|
|
340
|
+
timeLabel.textContent = (frame / timeline.fps).toFixed(2);
|
|
341
|
+
scrub.value = String(frame);
|
|
342
|
+
layer.replaceChildren();
|
|
343
|
+
|
|
344
|
+
for (const camera of timeline.camera.filter((track) => active(track, frame))) {
|
|
345
|
+
if (!camera.boundingBox) continue;
|
|
346
|
+
const box = scaleBox(camera.boundingBox);
|
|
347
|
+
layer.append(div("target-box", {
|
|
348
|
+
left: box.x + "px",
|
|
349
|
+
top: box.y + "px",
|
|
350
|
+
width: box.width + "px",
|
|
351
|
+
height: box.height + "px"
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
for (const cursor of timeline.cursor.filter((track) => active(track, frame))) {
|
|
356
|
+
if (!cursor.point) continue;
|
|
357
|
+
const point = scaleBox({ x: cursor.point.x, y: cursor.point.y, width: 0, height: 0 });
|
|
358
|
+
layer.append(div("cursor", { left: point.x + "px", top: point.y + "px" }));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
for (const overlay of timeline.overlays.filter((track) => active(track, frame))) {
|
|
362
|
+
if (overlay.kind === "caption") {
|
|
363
|
+
layer.append(div("caption", {}, escapeHtmlJs(overlay.text)));
|
|
364
|
+
} else if (overlay.kind === "callout") {
|
|
365
|
+
const box = overlay.boundingBox ? scaleBox(overlay.boundingBox) : { x: 40, y: 40, width: 0, height: 0 };
|
|
366
|
+
layer.append(div("callout", {
|
|
367
|
+
left: Math.min(box.x + box.width + 18, shot.clientWidth - 340) + "px",
|
|
368
|
+
top: Math.max(18, box.y) + "px"
|
|
369
|
+
}, "<strong>" + escapeHtmlJs(overlay.title) + "</strong>" + (overlay.description ? "<p>" + escapeHtmlJs(overlay.description) + "</p>" : "")));
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
document.querySelectorAll(".step").forEach((node) => {
|
|
374
|
+
const from = Number(node.dataset.from);
|
|
375
|
+
const to = Number(node.dataset.to);
|
|
376
|
+
node.classList.toggle("active-step", frame >= from && frame < to);
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
function renderSteps() {
|
|
381
|
+
stepsRoot.replaceChildren(...timeline.scenes.map((scene) => {
|
|
382
|
+
const section = div("scene");
|
|
383
|
+
section.append(div("", {}, "<h2>" + scene.id + " \xB7 " + scene.fromFrame + "-" + (scene.fromFrame + scene.durationInFrames) + "</h2>"));
|
|
384
|
+
for (const step of scene.steps) {
|
|
385
|
+
const node = div("step", {}, "<span class='range'>" + step.fromFrame + "+" + step.durationInFrames + "</span><span>" + step.kind + "</span>");
|
|
386
|
+
node.dataset.from = String(step.fromFrame);
|
|
387
|
+
node.dataset.to = String(step.fromFrame + step.durationInFrames);
|
|
388
|
+
section.append(node);
|
|
389
|
+
}
|
|
390
|
+
return section;
|
|
391
|
+
}));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
function setFrame(nextFrame) {
|
|
395
|
+
frame = Math.max(0, Math.min(timeline.durationInFrames, Math.round(nextFrame)));
|
|
396
|
+
render(frame);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function tick(now) {
|
|
400
|
+
if (!playing) return;
|
|
401
|
+
setFrame(playStartedFrame + ((now - playStartedAt) / 1000) * timeline.fps);
|
|
402
|
+
if (frame >= timeline.durationInFrames) {
|
|
403
|
+
playing = false;
|
|
404
|
+
playButton.textContent = "Play";
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
requestAnimationFrame(tick);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function escapeHtmlJs(value) {
|
|
411
|
+
return String(value).replace(/[&<>"']/g, (char) => ({
|
|
412
|
+
"&": "&",
|
|
413
|
+
"<": "<",
|
|
414
|
+
">": ">",
|
|
415
|
+
'"': """,
|
|
416
|
+
"'": "'"
|
|
417
|
+
})[char]);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
renderSteps();
|
|
421
|
+
render(0);
|
|
422
|
+
playButton.addEventListener("click", () => {
|
|
423
|
+
playing = !playing;
|
|
424
|
+
playButton.textContent = playing ? "Pause" : "Play";
|
|
425
|
+
playStartedFrame = frame >= timeline.durationInFrames ? 0 : frame;
|
|
426
|
+
playStartedAt = performance.now();
|
|
427
|
+
if (playing) requestAnimationFrame(tick);
|
|
428
|
+
});
|
|
429
|
+
scrub.addEventListener("input", () => {
|
|
430
|
+
playing = false;
|
|
431
|
+
playButton.textContent = "Play";
|
|
432
|
+
setFrame(Number(scrub.value));
|
|
433
|
+
});
|
|
434
|
+
window.addEventListener("resize", () => render(frame));
|
|
435
|
+
</script>
|
|
436
|
+
</body>
|
|
437
|
+
</html>`;
|
|
438
|
+
}
|
|
439
|
+
export {
|
|
440
|
+
renderPreviewHtml
|
|
441
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@democraft/preview",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Standalone HTML preview generator for Democraft artifacts.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/felipersas/democraft.git",
|
|
9
|
+
"directory": "packages/preview"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/felipersas/democraft#readme",
|
|
12
|
+
"bugs": "https://github.com/felipersas/democraft/issues",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public",
|
|
24
|
+
"registry": "https://registry.npmjs.org/"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@democraft/schema": "0.1.0-beta.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"test": "vitest run"
|
|
39
|
+
}
|
|
40
|
+
}
|