@1agh/maude 0.40.0 → 0.42.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/apps/studio/ai-banner.tsx +2 -2
- package/apps/studio/annotations-layer.tsx +53 -2
- package/apps/studio/api.ts +504 -44
- package/apps/studio/artboard-marquee.tsx +1 -1
- package/apps/studio/bin/_canvas-rects-playwright.mjs +55 -0
- package/apps/studio/bin/_canvas-rects-static.mjs +166 -0
- package/apps/studio/bin/_fetch-asset.mjs +556 -0
- package/apps/studio/bin/_html-playwright.mjs +26 -4
- package/apps/studio/bin/_pdf-playwright.mjs +13 -2
- package/apps/studio/bin/_png-playwright.mjs +15 -2
- package/apps/studio/bin/_pptx-playwright.mjs +17 -4
- package/apps/studio/bin/_screenshot-playwright.mjs +17 -2
- package/apps/studio/bin/_svg-playwright.mjs +26 -4
- package/apps/studio/bin/annotate.mjs +576 -34
- package/apps/studio/bin/canvas-rects.sh +152 -0
- package/apps/studio/bin/fetch-asset.sh +34 -0
- package/apps/studio/bin/read-annotations.mjs +138 -7
- package/apps/studio/bin/screenshot.sh +53 -4
- package/apps/studio/bin/smoke.sh +42 -6
- package/apps/studio/build.ts +21 -0
- package/apps/studio/canvas-comment-mount.tsx +138 -4
- package/apps/studio/canvas-edit.ts +744 -11
- package/apps/studio/canvas-lib.tsx +219 -2
- package/apps/studio/canvas-shell.tsx +487 -20
- package/apps/studio/client/app.jsx +1476 -76
- package/apps/studio/client/comments-overlay.css +130 -126
- package/apps/studio/client/export-center.jsx +426 -0
- package/apps/studio/client/github.js +8 -0
- package/apps/studio/client/styles/3-shell-maude.css +65 -0
- package/apps/studio/client/styles/4-components.css +150 -0
- package/apps/studio/comments-overlay.tsx +148 -41
- package/apps/studio/config.schema.json +2 -2
- package/apps/studio/context-menu.tsx +15 -5
- package/apps/studio/contextual-toolbar.tsx +262 -4
- package/apps/studio/cursors-overlay.tsx +4 -4
- package/apps/studio/dist/client.bundle.js +20 -20
- package/apps/studio/dist/comment-mount.js +59 -1
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/dom-selection.ts +127 -1
- package/apps/studio/drag-state.ts +24 -0
- package/apps/studio/equal-spacing-detector.ts +205 -0
- package/apps/studio/export-dialog.tsx +19 -26
- package/apps/studio/exporters/_runtime.ts +104 -0
- package/apps/studio/exporters/html.ts +12 -20
- package/apps/studio/exporters/index.ts +14 -2
- package/apps/studio/exporters/jobs.ts +334 -0
- package/apps/studio/exporters/pdf.ts +16 -20
- package/apps/studio/exporters/png.ts +12 -20
- package/apps/studio/exporters/pptx.ts +22 -23
- package/apps/studio/exporters/scope.ts +1 -0
- package/apps/studio/exporters/svg.ts +14 -22
- package/apps/studio/exporters/video.ts +15 -17
- package/apps/studio/git/service.ts +3 -1
- package/apps/studio/history.ts +47 -1
- package/apps/studio/http.ts +368 -50
- package/apps/studio/input-router.tsx +12 -0
- package/apps/studio/marquee-overlay.tsx +1 -1
- package/apps/studio/measure-overlay.tsx +241 -0
- package/apps/studio/participants-chrome.tsx +3 -3
- package/apps/studio/server.ts +3 -1
- package/apps/studio/sizing-mode.ts +117 -0
- package/apps/studio/spacing-handles.ts +166 -0
- package/apps/studio/test/annotate-write.test.ts +890 -0
- package/apps/studio/test/camera-reveal.test.tsx +173 -0
- package/apps/studio/test/canvas-edit.test.ts +50 -0
- package/apps/studio/test/canvas-origin-gate.test.ts +24 -0
- package/apps/studio/test/canvas-rects.test.ts +198 -0
- package/apps/studio/test/comments-overlay.test.ts +117 -0
- package/apps/studio/test/dns-rebinding-guard.test.ts +27 -0
- package/apps/studio/test/dom-selection.test.ts +130 -0
- package/apps/studio/test/edit-css-occurrence.test.ts +81 -0
- package/apps/studio/test/edit-scope-api.test.ts +115 -0
- package/apps/studio/test/element-resize.test.ts +136 -0
- package/apps/studio/test/element-structural-api.test.ts +360 -0
- package/apps/studio/test/element-structural-edit.test.ts +233 -0
- package/apps/studio/test/equal-spacing-detector.test.ts +165 -1
- package/apps/studio/test/export-center.test.tsx +287 -0
- package/apps/studio/test/export-shim-multi-capture.test.ts +83 -0
- package/apps/studio/test/exporters/history.test.ts +32 -3
- package/apps/studio/test/exporters/jobs.test.ts +263 -0
- package/apps/studio/test/history-rollback.test.ts +26 -0
- package/apps/studio/test/knob-props-authored.test.ts +87 -0
- package/apps/studio/test/read-annotations.test.ts +154 -0
- package/apps/studio/test/sizing-mode.test.ts +102 -0
- package/apps/studio/test/spacing-handles.test.ts +138 -0
- package/apps/studio/test/specimen-select.test.ts +88 -0
- package/apps/studio/test/tool-palette-insert-anchor.test.ts +84 -0
- package/apps/studio/test/undo-sequence-byte-compare.test.ts +211 -0
- package/apps/studio/tool-palette.tsx +122 -2
- package/apps/studio/undo-hud.tsx +2 -2
- package/apps/studio/use-element-resize.tsx +732 -0
- package/apps/studio/use-keyboard-discipline.tsx +205 -15
- package/apps/studio/use-selection-set.tsx +14 -0
- package/apps/studio/use-spacing-handles.tsx +388 -0
- package/apps/studio/whats-new.json +45 -0
- package/apps/studio/ws.ts +6 -0
- package/cli/commands/design.mjs +6 -1
- package/cli/commands/design.test.mjs +49 -1
- package/cli/lib/fetch-asset.test.mjs +213 -0
- package/cli/lib/gitignore-block.mjs +1 -0
- package/package.json +8 -8
- package/plugins/design/dependencies.json +10 -2
|
@@ -48,10 +48,6 @@ try {
|
|
|
48
48
|
world.style.zoom = '1';
|
|
49
49
|
world.style.transform = 'none';
|
|
50
50
|
}
|
|
51
|
-
for (const el of document.querySelectorAll('[data-dc-screen]')) {
|
|
52
|
-
el.style.left = '0px';
|
|
53
|
-
el.style.top = '0px';
|
|
54
|
-
}
|
|
55
51
|
});
|
|
56
52
|
// dom-to-pptx ships a UMD bundle; addScriptTag exposes `window.domToPptx`.
|
|
57
53
|
await page.addScriptTag({ path: bundlePath });
|
|
@@ -74,6 +70,17 @@ try {
|
|
|
74
70
|
}
|
|
75
71
|
await handle.waitFor({ state: 'visible', timeout: timeoutMs });
|
|
76
72
|
|
|
73
|
+
// Pin this artboard to (0,0) for its capture, restoring afterwards so a
|
|
74
|
+
// future multi-slide implementation doesn't inherit a stacked-at-origin bug
|
|
75
|
+
// (the scatter bug fixed in the png/pdf/svg/html shims).
|
|
76
|
+
const savedPos = await handle.evaluate((el) => {
|
|
77
|
+
const ab = el.closest('[data-dc-screen]') ?? el;
|
|
78
|
+
const prev = { left: ab.style.left, top: ab.style.top };
|
|
79
|
+
ab.style.left = '0px';
|
|
80
|
+
ab.style.top = '0px';
|
|
81
|
+
return prev;
|
|
82
|
+
});
|
|
83
|
+
|
|
77
84
|
// Run dom-to-pptx inside the page. It returns a Blob; we serialise to a
|
|
78
85
|
// byte array for transport across the playwright boundary.
|
|
79
86
|
const bytesArray = await handle.evaluate(async (el) => {
|
|
@@ -88,6 +95,12 @@ try {
|
|
|
88
95
|
return Array.from(new Uint8Array(ab));
|
|
89
96
|
});
|
|
90
97
|
|
|
98
|
+
await handle.evaluate((el, prev) => {
|
|
99
|
+
const ab = el.closest('[data-dc-screen]') ?? el;
|
|
100
|
+
ab.style.left = prev.left;
|
|
101
|
+
ab.style.top = prev.top;
|
|
102
|
+
}, savedPos);
|
|
103
|
+
|
|
91
104
|
writeFileSync(out, new Uint8Array(bytesArray));
|
|
92
105
|
console.log(out);
|
|
93
106
|
console.error(
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
//
|
|
6
6
|
// Invocation (called by screenshot.sh — not directly by users):
|
|
7
7
|
// npm exec --package=playwright -- node _screenshot-playwright.mjs \
|
|
8
|
-
// --url <url> [--selector <css>] --out <path> [--timeout 8]
|
|
8
|
+
// --url <url> [--selector <css>] --out <path> [--timeout 8] [--theme <name>]
|
|
9
9
|
//
|
|
10
10
|
// First invocation may install chromium (~150 MB). Subsequent runs reuse cache.
|
|
11
11
|
|
|
@@ -20,7 +20,7 @@ const args = Object.fromEntries(
|
|
|
20
20
|
}, [])
|
|
21
21
|
);
|
|
22
22
|
|
|
23
|
-
const { url, selector, out, timeout = '8' } = args;
|
|
23
|
+
const { url, selector, out, timeout = '8', theme } = args;
|
|
24
24
|
if (!url || !out) {
|
|
25
25
|
console.error(
|
|
26
26
|
'usage: _screenshot-playwright.mjs --url <url> [--selector <css>] --out <path> [--timeout 8]'
|
|
@@ -37,6 +37,21 @@ try {
|
|
|
37
37
|
const page = await ctx.newPage();
|
|
38
38
|
await page.goto(url, { waitUntil: 'networkidle', timeout: timeoutMs });
|
|
39
39
|
|
|
40
|
+
if (theme) {
|
|
41
|
+
// Dual-theme reality check (/design:new step 9): force every DS artboard
|
|
42
|
+
// theme wrapper to `theme` before capture, deterministically, instead of
|
|
43
|
+
// relying on whatever the canvas is pinned to. No-op if the canvas has no
|
|
44
|
+
// `[data-theme]` elements (e.g. a single-theme DS).
|
|
45
|
+
const n = await page.evaluate((t) => {
|
|
46
|
+
const els = document.querySelectorAll('[data-theme]');
|
|
47
|
+
els.forEach((el) => {
|
|
48
|
+
el.setAttribute('data-theme', t);
|
|
49
|
+
});
|
|
50
|
+
return els.length;
|
|
51
|
+
}, theme);
|
|
52
|
+
console.error(`→ theme override: forced data-theme="${theme}" on ${n} element(s)`);
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
if (selector) {
|
|
41
56
|
const loc = page.locator(selector).first();
|
|
42
57
|
await loc.waitFor({ state: 'visible', timeout: timeoutMs });
|
|
@@ -70,10 +70,6 @@ try {
|
|
|
70
70
|
world.style.zoom = '1';
|
|
71
71
|
world.style.transform = 'none';
|
|
72
72
|
}
|
|
73
|
-
for (const el of document.querySelectorAll('[data-dc-screen]')) {
|
|
74
|
-
el.style.left = '0px';
|
|
75
|
-
el.style.top = '0px';
|
|
76
|
-
}
|
|
77
73
|
});
|
|
78
74
|
// Inject dom-to-svg into the page. Bundle attaches its exports under
|
|
79
75
|
// `window.domToSvg`.
|
|
@@ -81,6 +77,27 @@ try {
|
|
|
81
77
|
|
|
82
78
|
const written = [];
|
|
83
79
|
|
|
80
|
+
// Pin one artboard to (0,0) for its capture, returning a restore function.
|
|
81
|
+
// Per-target rather than a one-shot reset of every `[data-dc-screen]` — a
|
|
82
|
+
// multi-target loop must not leave an already-captured artboard sitting at
|
|
83
|
+
// the origin, overlapping the next target's geometry (the scatter bug).
|
|
84
|
+
const pinArtboard = async (handle) => {
|
|
85
|
+
const saved = await handle.evaluate((el) => {
|
|
86
|
+
const ab = el.closest('[data-dc-screen]') ?? el;
|
|
87
|
+
const prev = { left: ab.style.left, top: ab.style.top };
|
|
88
|
+
ab.style.left = '0px';
|
|
89
|
+
ab.style.top = '0px';
|
|
90
|
+
return prev;
|
|
91
|
+
});
|
|
92
|
+
return async () => {
|
|
93
|
+
await handle.evaluate((el, prev) => {
|
|
94
|
+
const ab = el.closest('[data-dc-screen]') ?? el;
|
|
95
|
+
ab.style.left = prev.left;
|
|
96
|
+
ab.style.top = prev.top;
|
|
97
|
+
}, saved);
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
84
101
|
// Single in-page serializer used by BOTH branches (single + multi) so they
|
|
85
102
|
// can't drift again (the `formatXML` 500 bug came from a divergent copy).
|
|
86
103
|
// Note: dom-to-svg exports only elementToSVG / inlineResources /
|
|
@@ -228,11 +245,14 @@ try {
|
|
|
228
245
|
for (let i = 0; i < screens.length; i += 1) {
|
|
229
246
|
const handle = screens[i];
|
|
230
247
|
const id = (await handle.getAttribute('data-dc-screen')) ?? `artboard-${i + 1}`;
|
|
248
|
+
const restore = await pinArtboard(handle);
|
|
231
249
|
// Each multi handle is already a `[data-dc-screen]` artboard — no widen.
|
|
232
250
|
const svg = await serializeOne(handle, false);
|
|
251
|
+
await restore();
|
|
233
252
|
const target = join(outDir, `${id}.svg`);
|
|
234
253
|
writeFileSync(target, svg, 'utf8');
|
|
235
254
|
written.push(target);
|
|
255
|
+
console.log(`MAUDE_PROGRESS {"current":${i + 1},"total":${screens.length}}`);
|
|
236
256
|
}
|
|
237
257
|
} else {
|
|
238
258
|
if (!out) {
|
|
@@ -242,7 +262,9 @@ try {
|
|
|
242
262
|
mkdirSync(dirname(out), { recursive: true });
|
|
243
263
|
const handle = page.locator(selector ?? '[data-dc-screen]:first-of-type').first();
|
|
244
264
|
await handle.waitFor({ state: 'visible', timeout: timeoutMs });
|
|
265
|
+
const restore = await pinArtboard(handle);
|
|
245
266
|
const svg = await serializeOne(handle, widen);
|
|
267
|
+
await restore();
|
|
246
268
|
writeFileSync(out, svg, 'utf8');
|
|
247
269
|
written.push(out);
|
|
248
270
|
}
|