sketchmark 2.0.0 → 2.1.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.
Files changed (132) hide show
  1. package/ANIMATABLE_MATRIX.md +177 -0
  2. package/KERNEL_SPEC.md +412 -0
  3. package/PACKS.md +81 -0
  4. package/PRESETS.md +182 -0
  5. package/README.md +274 -188
  6. package/bin/editor-ui.cjs +2285 -0
  7. package/bin/preview-ui.cjs +74 -0
  8. package/bin/sketchmark.cjs +648 -2008
  9. package/dist/src/animatable.d.ts +21 -0
  10. package/dist/src/animatable.js +439 -0
  11. package/dist/src/builders/index.d.ts +1 -11
  12. package/dist/src/builders/index.js +1 -19
  13. package/dist/src/diagnostics.js +1 -64
  14. package/dist/src/edit.d.ts +27 -0
  15. package/dist/src/edit.js +162 -0
  16. package/dist/src/index.d.ts +4 -13
  17. package/dist/src/index.js +4 -13
  18. package/dist/src/keyframes.d.ts +48 -0
  19. package/dist/src/keyframes.js +182 -0
  20. package/dist/src/motion.d.ts +4 -0
  21. package/dist/src/motion.js +262 -0
  22. package/dist/src/normalize.js +120 -151
  23. package/dist/src/presets/characters.d.ts +15 -0
  24. package/dist/src/presets/characters.js +113 -0
  25. package/dist/src/presets/compose.d.ts +5 -0
  26. package/dist/src/presets/compose.js +80 -0
  27. package/dist/src/presets/effects.d.ts +40 -0
  28. package/dist/src/presets/effects.js +79 -0
  29. package/dist/src/presets/helpers.d.ts +33 -0
  30. package/dist/src/presets/helpers.js +165 -0
  31. package/dist/src/presets/index.d.ts +9 -0
  32. package/dist/src/presets/index.js +48 -0
  33. package/dist/src/presets/motions.d.ts +33 -0
  34. package/dist/src/presets/motions.js +75 -0
  35. package/dist/src/presets/scenes.d.ts +35 -0
  36. package/dist/src/presets/scenes.js +134 -0
  37. package/dist/src/presets/shapes.d.ts +71 -0
  38. package/dist/src/presets/shapes.js +96 -0
  39. package/dist/src/presets/transitions.d.ts +29 -0
  40. package/dist/src/presets/transitions.js +113 -0
  41. package/dist/src/presets/types.d.ts +34 -0
  42. package/dist/src/presets/types.js +2 -0
  43. package/dist/src/render/html.js +1 -4
  44. package/dist/src/render/svg.d.ts +2 -2
  45. package/dist/src/render/svg.js +86 -82
  46. package/dist/src/render/three-html.js +67 -113
  47. package/dist/src/scenes.js +1 -0
  48. package/dist/src/schema.js +218 -280
  49. package/dist/src/shapes/builtins.js +11 -47
  50. package/dist/src/shapes/common.js +12 -11
  51. package/dist/src/shapes/registry.d.ts +0 -1
  52. package/dist/src/shapes/registry.js +0 -4
  53. package/dist/src/shapes/types.d.ts +1 -3
  54. package/dist/src/types.d.ts +57 -288
  55. package/dist/src/utils.d.ts +2 -11
  56. package/dist/src/utils.js +13 -70
  57. package/dist/src/validate.js +321 -275
  58. package/dist/tests/run.js +576 -510
  59. package/examples/1730642890464.jpg +0 -0
  60. package/examples/app-screen.svg +1 -0
  61. package/examples/app-screen.visual.json +503 -0
  62. package/examples/dashboard-table.svg +1 -0
  63. package/examples/dashboard-table.visual.json +708 -0
  64. package/examples/dev-docs.svg +1 -0
  65. package/examples/dev-docs.visual.json +248 -0
  66. package/examples/explainer.mp4 +0 -0
  67. package/examples/explainer.visual.json +1713 -0
  68. package/examples/group-origin-effects-lab-check.svg +1 -0
  69. package/examples/group-origin-effects-lab.visual.json +1880 -0
  70. package/examples/image-clip-radius.visual.json +271 -0
  71. package/examples/make-app-screen.cjs +368 -0
  72. package/examples/make-dashboard-table.cjs +277 -0
  73. package/examples/make-dev-docs.cjs +233 -0
  74. package/examples/make-explainer.cjs +438 -0
  75. package/examples/make-group-origin-effects-lab.cjs +370 -0
  76. package/examples/make-image-clip-radius.cjs +169 -0
  77. package/examples/make-modal-dialog.cjs +355 -0
  78. package/examples/make-origin-effects-lab.cjs +311 -0
  79. package/examples/make-preset-character-motion.cjs +32 -0
  80. package/examples/make-presets-demo.cjs +30 -0
  81. package/examples/make-pricing.cjs +286 -0
  82. package/examples/make-product-demo.cjs +468 -0
  83. package/examples/make-product-hero.cjs +223 -0
  84. package/examples/make-release-notes.cjs +333 -0
  85. package/examples/make-settings-panel.cjs +435 -0
  86. package/examples/make-split-preview.cjs +248 -0
  87. package/examples/make-storyboard.cjs +215 -0
  88. package/examples/make-transcript.cjs +234 -0
  89. package/examples/make-typography-test.cjs +397 -0
  90. package/examples/make-ui-demo-explainer.cjs +1094 -0
  91. package/examples/make-ui-flow.cjs +762 -0
  92. package/examples/make-walkthrough.cjs +815 -0
  93. package/examples/modal-dialog.svg +1 -0
  94. package/examples/modal-dialog.visual.json +239 -0
  95. package/examples/origin-effects-lab-check.svg +1 -0
  96. package/examples/origin-effects-lab.visual.json +1412 -0
  97. package/examples/preset-character-motion.visual.json +949 -0
  98. package/examples/presets-demo.visual.json +787 -0
  99. package/examples/pricing.svg +1 -0
  100. package/examples/pricing.visual.json +652 -0
  101. package/examples/product-demo.mp4 +0 -0
  102. package/examples/product-demo.visual.json +866 -0
  103. package/examples/product-hero.svg +1 -0
  104. package/examples/product-hero.visual.json +242 -0
  105. package/examples/release-notes.svg +1 -0
  106. package/examples/release-notes.visual.json +467 -0
  107. package/examples/settings-panel.svg +1 -0
  108. package/examples/settings-panel.visual.json +501 -0
  109. package/examples/split-preview.svg +1 -0
  110. package/examples/split-preview.visual.json +124 -0
  111. package/examples/storyboard.svg +1 -0
  112. package/examples/storyboard.visual.json +312 -0
  113. package/examples/transcript.svg +1 -0
  114. package/examples/transcript.visual.json +407 -0
  115. package/examples/typography-indent-check.svg +1 -0
  116. package/examples/typography-lineheight-0.svg +1 -0
  117. package/examples/typography-lineheight-2.svg +1 -0
  118. package/examples/typography-test-check.svg +1 -0
  119. package/examples/typography-test.svg +1 -0
  120. package/examples/typography-test.visual.json +757 -0
  121. package/examples/ui-demo-explainer-billing.svg +1 -0
  122. package/examples/ui-demo-explainer-check.svg +1 -0
  123. package/examples/ui-demo-explainer-save.svg +1 -0
  124. package/examples/ui-demo-explainer-toggle.svg +1 -0
  125. package/examples/ui-demo-explainer.mp4 +0 -0
  126. package/examples/ui-demo-explainer.visual.json +2597 -0
  127. package/examples/ui-flow.mp4 +0 -0
  128. package/examples/ui-flow.visual.json +1211 -0
  129. package/examples/walkthrough.mp4 +0 -0
  130. package/examples/walkthrough.visual.json +1372 -0
  131. package/package.json +52 -52
  132. package/schema/visual.schema.json +1086 -930
@@ -0,0 +1,397 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ const width = 1000;
5
+ const height = 920;
6
+ const duration = 8;
7
+ const fps = 30;
8
+ const bg = "#ffffff";
9
+ const font = "Inter, system-ui, sans-serif";
10
+ const monoFont = "JetBrains Mono, Fira Code, monospace";
11
+ const altFont = "Roboto, Arial, sans-serif";
12
+
13
+ const colors = {
14
+ headline: "#0f172a",
15
+ subtitle: "#475569",
16
+ body: "#334155",
17
+ muted: "#64748b",
18
+ number: "#2563eb",
19
+ codeBg: "#1e293b",
20
+ codeText: "#e2e8f0",
21
+ pillBg: "#f1f5f9",
22
+ pillBorder: "#cbd5e1",
23
+ pillText: "#475569",
24
+ note: "#94a3b8",
25
+ divider: "#e2e8f0"
26
+ };
27
+
28
+ const curves = {
29
+ ease: { type: "cubicBezier", x1: 0.25, y1: 0.1, x2: 0.25, y2: 1 }
30
+ };
31
+
32
+ const padX = 72;
33
+ const contentW = width - padX * 2;
34
+ let y = 56;
35
+
36
+ const elements = [];
37
+
38
+ function kf(time, value, out) {
39
+ return out ? { time, value, out } : { time, value };
40
+ }
41
+
42
+ function animated(tracks) {
43
+ return { timeline: { tracks } };
44
+ }
45
+
46
+ // === 1. Centered headline ===
47
+ elements.push({
48
+ id: "headline",
49
+ type: "text",
50
+ x: width / 2,
51
+ y: y,
52
+ text: "Typography Stress Test",
53
+ align: "center",
54
+ valign: "top",
55
+ fontSize: 40,
56
+ fontFamily: font,
57
+ weight: 700,
58
+ fill: colors.headline,
59
+ ...animated({
60
+ fontSize: {
61
+ keyframes: [
62
+ kf(0, 40, curves.ease),
63
+ kf(1.6, 46, curves.ease),
64
+ kf(3.3, 36, curves.ease),
65
+ kf(4.8, 44, curves.ease),
66
+ kf(6.5, 40)
67
+ ]
68
+ },
69
+ letterSpacing: {
70
+ keyframes: [
71
+ kf(0, 0, curves.ease),
72
+ kf(1.6, 1.5, curves.ease),
73
+ kf(3.3, 4, curves.ease),
74
+ kf(4.8, 0.8, curves.ease),
75
+ kf(6.5, 0)
76
+ ]
77
+ },
78
+ weight: {
79
+ keyframes: [
80
+ kf(0, 700),
81
+ kf(2.2, 300),
82
+ kf(4.4, 700),
83
+ kf(6.5, 700)
84
+ ]
85
+ }
86
+ })
87
+ });
88
+ y += 56;
89
+
90
+ // === 2. Centered subtitle ===
91
+ elements.push({
92
+ id: "subtitle",
93
+ type: "text",
94
+ x: width / 2,
95
+ y: y,
96
+ text: "Demonstrating multiple alignment modes, text styles, and layout patterns\nin a single cohesive document without visual overlap.",
97
+ align: "center",
98
+ valign: "top",
99
+ fontSize: 16,
100
+ fontFamily: font,
101
+ weight: 400,
102
+ lineHeight: 1.55,
103
+ fill: colors.subtitle,
104
+ maxWidth: contentW,
105
+ ...animated({
106
+ lineHeight: {
107
+ keyframes: [
108
+ kf(0, 1.55, curves.ease),
109
+ kf(2, 1.9, curves.ease),
110
+ kf(4.2, 1.3, curves.ease),
111
+ kf(6.4, 1.55)
112
+ ]
113
+ }
114
+ })
115
+ });
116
+ y += 64;
117
+
118
+ // Divider
119
+ elements.push({
120
+ id: "divider-1",
121
+ type: "path",
122
+ d: `M ${padX} ${y} L ${width - padX} ${y}`,
123
+ stroke: colors.divider,
124
+ strokeWidth: 1,
125
+ fill: "none"
126
+ });
127
+ y += 40;
128
+
129
+ // === 3. Left-aligned paragraph block ===
130
+ elements.push({
131
+ id: "para-heading",
132
+ type: "text",
133
+ x: padX,
134
+ y: y,
135
+ text: "Overview",
136
+ align: "left",
137
+ valign: "top",
138
+ fontSize: 20,
139
+ fontFamily: font,
140
+ weight: 700,
141
+ fill: colors.headline
142
+ });
143
+ y += 32;
144
+
145
+ elements.push({
146
+ id: "para-body",
147
+ type: "text",
148
+ x: padX,
149
+ y: y,
150
+ text: "This document tests the render kernel's ability to handle diverse typographic\nscenarios. Each section exercises a different combination of alignment, weight,\nsize, and line height. The goal is to verify that spacing remains predictable\nand that no elements collide regardless of content length or style variation.",
151
+ align: "left",
152
+ valign: "top",
153
+ fontSize: 14,
154
+ fontFamily: font,
155
+ weight: 400,
156
+ lineHeight: 1.7,
157
+ fill: colors.body,
158
+ maxWidth: contentW,
159
+ ...animated({
160
+ letterSpacing: {
161
+ keyframes: [
162
+ kf(0, 0, curves.ease),
163
+ kf(2.6, 0.6, curves.ease),
164
+ kf(5.1, 0.15, curves.ease),
165
+ kf(7, 0)
166
+ ]
167
+ }
168
+ })
169
+ });
170
+ y += 110;
171
+
172
+ // === 4. Left-aligned numbered list ===
173
+ elements.push({
174
+ id: "list-heading",
175
+ type: "text",
176
+ x: padX,
177
+ y: y,
178
+ text: "Validation Checklist",
179
+ align: "left",
180
+ valign: "top",
181
+ fontSize: 20,
182
+ fontFamily: font,
183
+ weight: 700,
184
+ fill: colors.headline
185
+ });
186
+ y += 32;
187
+
188
+ const listItems = [
189
+ "Confirm that centered text remains horizontally balanced at all font sizes.",
190
+ "Verify left-aligned blocks maintain consistent left edge across line breaks.",
191
+ "Check that right-aligned notes anchor correctly without drifting.",
192
+ "Ensure code blocks preserve whitespace and monospace character width.",
193
+ "Validate that pill components center their labels within fixed bounds."
194
+ ];
195
+
196
+ listItems.forEach((text, i) => {
197
+ const itemY = y + i * 28;
198
+
199
+ // Number
200
+ elements.push({
201
+ id: `list-num-${i}`,
202
+ type: "text",
203
+ x: padX,
204
+ y: itemY,
205
+ text: `${i + 1}.`,
206
+ align: "left",
207
+ valign: "top",
208
+ fontSize: 14,
209
+ fontFamily: font,
210
+ weight: 600,
211
+ fill: colors.number
212
+ });
213
+
214
+ // Item text
215
+ elements.push({
216
+ id: `list-item-${i}`,
217
+ type: "text",
218
+ x: padX + 24,
219
+ y: itemY,
220
+ text: text,
221
+ align: "left",
222
+ valign: "top",
223
+ fontSize: 14,
224
+ fontFamily: font,
225
+ weight: 400,
226
+ fill: colors.body,
227
+ maxWidth: contentW - 24
228
+ });
229
+ });
230
+ y += listItems.length * 28 + 32;
231
+
232
+ // === 5. Multiline code block ===
233
+ const codeLines = `function validateLayout(elements) {
234
+ const bounds = elements.map(el => getBounds(el));
235
+ for (let i = 0; i < bounds.length; i++) {
236
+ for (let j = i + 1; j < bounds.length; j++) {
237
+ if (intersects(bounds[i], bounds[j])) {
238
+ return { valid: false, collision: [i, j] };
239
+ }
240
+ }
241
+ }
242
+ return { valid: true };
243
+ }`;
244
+
245
+ const codeBlockH = 200;
246
+ const codeBlockR = 8;
247
+ const codePad = 20;
248
+
249
+ elements.push({
250
+ id: "code-bg",
251
+ type: "path",
252
+ d: roundedRect(padX, y, contentW, codeBlockH, codeBlockR),
253
+ fill: colors.codeBg,
254
+ stroke: "none"
255
+ });
256
+
257
+ elements.push({
258
+ id: "code-text",
259
+ type: "text",
260
+ x: padX + codePad,
261
+ y: y + codePad,
262
+ text: codeLines,
263
+ align: "left",
264
+ valign: "top",
265
+ fontSize: 12,
266
+ fontFamily: monoFont,
267
+ weight: 400,
268
+ lineHeight: 1.55,
269
+ fill: colors.codeText,
270
+ maxWidth: contentW - codePad * 2,
271
+ ...animated({
272
+ fontFamily: {
273
+ keyframes: [
274
+ kf(0, monoFont),
275
+ kf(2.7, altFont),
276
+ kf(5.2, monoFont)
277
+ ]
278
+ }
279
+ })
280
+ });
281
+ y += codeBlockH + 28;
282
+
283
+ // === 6. Right-aligned note ===
284
+ elements.push({
285
+ id: "note-text",
286
+ type: "text",
287
+ x: width - padX,
288
+ y: y,
289
+ text: "Note: All measurements are in logical pixels.\nActual rendering may vary by display density.",
290
+ align: "right",
291
+ valign: "top",
292
+ fontSize: 12,
293
+ fontFamily: font,
294
+ weight: 400,
295
+ lineHeight: 1.5,
296
+ fill: colors.note,
297
+ maxWidth: 320,
298
+ ...animated({
299
+ fontSize: {
300
+ keyframes: [
301
+ kf(0, 12, curves.ease),
302
+ kf(2.5, 14, curves.ease),
303
+ kf(5.3, 12)
304
+ ]
305
+ },
306
+ letterSpacing: {
307
+ keyframes: [
308
+ kf(0, 0, curves.ease),
309
+ kf(2.5, 1.2, curves.ease),
310
+ kf(5.3, 0.2, curves.ease),
311
+ kf(7.1, 0)
312
+ ]
313
+ }
314
+ })
315
+ });
316
+ y += 52;
317
+
318
+ // === 7. Three small centered pills ===
319
+ const pills = ["Centered", "Balanced", "Verified"];
320
+ const pillH = 28;
321
+ const pillR = 14;
322
+ const pillPadX = 16;
323
+ const pillGap = 12;
324
+
325
+ let totalPillW = 0;
326
+ const pillWidths = pills.map(label => {
327
+ const w = label.length * 8 + pillPadX * 2;
328
+ totalPillW += w;
329
+ return w;
330
+ });
331
+ totalPillW += pillGap * (pills.length - 1);
332
+
333
+ let pillX = (width - totalPillW) / 2;
334
+
335
+ pills.forEach((label, i) => {
336
+ const pw = pillWidths[i];
337
+
338
+ elements.push({
339
+ id: `pill-bg-${i}`,
340
+ type: "path",
341
+ d: roundedRect(pillX, y, pw, pillH, pillR),
342
+ fill: colors.pillBg,
343
+ stroke: colors.pillBorder,
344
+ strokeWidth: 1
345
+ });
346
+
347
+ elements.push({
348
+ id: `pill-text-${i}`,
349
+ type: "text",
350
+ x: pillX + pw / 2,
351
+ y: y + pillH / 2,
352
+ text: label,
353
+ align: "center",
354
+ valign: "middle",
355
+ fontSize: 12,
356
+ fontFamily: font,
357
+ weight: 500,
358
+ fill: colors.pillText,
359
+ ...animated({
360
+ weight: {
361
+ keyframes: [
362
+ kf(0, 500),
363
+ kf(1.8 + i * 0.18, 700),
364
+ kf(4.1 + i * 0.18, 300),
365
+ kf(6.2 + i * 0.18, 500)
366
+ ]
367
+ }
368
+ })
369
+ });
370
+
371
+ pillX += pw + pillGap;
372
+ });
373
+
374
+ function roundedRect(x, y, w, h, r) {
375
+ return [
376
+ `M ${x + r} ${y}`,
377
+ `L ${x + w - r} ${y}`,
378
+ `Q ${x + w} ${y} ${x + w} ${y + r}`,
379
+ `L ${x + w} ${y + h - r}`,
380
+ `Q ${x + w} ${y + h} ${x + w - r} ${y + h}`,
381
+ `L ${x + r} ${y + h}`,
382
+ `Q ${x} ${y + h} ${x} ${y + h - r}`,
383
+ `L ${x} ${y + r}`,
384
+ `Q ${x} ${y} ${x + r} ${y}`,
385
+ "Z"
386
+ ].join(" ");
387
+ }
388
+
389
+ const doc = {
390
+ version: 1,
391
+ canvas: { width, height, background: bg, duration, fps },
392
+ elements
393
+ };
394
+
395
+ const outPath = path.join(__dirname, "typography-test.visual.json");
396
+ fs.writeFileSync(outPath, JSON.stringify(doc, null, 2));
397
+ console.log("Written:", outPath);