@ohos-ports/slides-grab 1.5.0-beta.3 → 1.5.0-beta.4
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/native/@img/sharp-libvips-openharmony-arm64/lib/libc++_shared.so +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libcairo.so.2.11804.4 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libexpat.so.1 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libffi.so +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libfontconfig.so.1 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libfreetype.so.6 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libfribidi.so.0.4.0 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libgdk_pixbuf-2.0.so.0.4400.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libgio-2.0.so.0 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libglib-2.0.so.0.8800.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libgobject-2.0.so.0.8800.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libharfbuzz.so.0.61430.0 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libintl.so.8 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpango-1.0.so.0.5600.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpangocairo-1.0.so.0.5600.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpangoft2-1.0.so.0.5600.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpcre2-8.so +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpcre2-8.so.0 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpixman-1.so.0 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libpng16.so.16 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/librsvg-2.so.2.60.0 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips-cpp.so.42 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips-cpp.so.42.20.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips.so.42 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libvips.so.42.20.3 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libxml2.so.16 +0 -0
- package/native/@img/sharp-libvips-openharmony-arm64/lib/libz.so.1 +0 -0
- package/package.json +2 -2
- package/scripts/html2pdf.js +5 -2
- package/scripts/html2png.js +5 -2
- package/scripts/validate-slides.js +4 -1
- package/src/ohos-browser-bridge.cjs +11 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohos-ports/slides-grab",
|
|
3
|
-
"version": "1.5.0-beta.
|
|
3
|
+
"version": "1.5.0-beta.4",
|
|
4
4
|
"description": "Agent-first presentation framework — plan, design, and visually edit HTML slides with Claude Code or Codex, then export to PDF or experimental/unstable PPTX/Figma formats. HarmonyOS adaptation: Playwright connects to system Haitai browser (Chromium M132) via CDP bridge.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "vkehfdl1",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"pptxgenjs": "^3.12.0",
|
|
78
78
|
"react": "^19.2.4",
|
|
79
79
|
"react-dom": "^19.2.4",
|
|
80
|
-
"sharp": "npm:@ohos-ports/sharp@0.34.5-beta.
|
|
80
|
+
"sharp": "npm:@ohos-ports/sharp@0.34.5-beta.5",
|
|
81
81
|
"tldraw": "^4.4.1"
|
|
82
82
|
},
|
|
83
83
|
"optionalDependencies": {
|
package/scripts/html2pdf.js
CHANGED
|
@@ -11,6 +11,7 @@ import sharp from 'sharp';
|
|
|
11
11
|
import { ensureSlidesPassValidation } from './validate-slides.js';
|
|
12
12
|
|
|
13
13
|
const require = createRequire(import.meta.url);
|
|
14
|
+
const { launchBrowserViaCdp, loadPageUrl } = require('../src/ohos-browser-bridge.cjs');
|
|
14
15
|
const {
|
|
15
16
|
getResolutionChoices,
|
|
16
17
|
getResolutionSize,
|
|
@@ -667,7 +668,7 @@ export async function renderSlideToPdf(page, slideFile, slidesDir, options = {})
|
|
|
667
668
|
const slideMode = normalizeSlideMode(options.slideMode ?? DEFAULT_SLIDE_MODE, { optionName: '--slide-mode' });
|
|
668
669
|
const captureResolution = mode === 'capture' ? normalizeResolutionPreset(options.resolution ?? '') : '';
|
|
669
670
|
|
|
670
|
-
await page
|
|
671
|
+
await loadPageUrl(page, slideUrl, { waitUntil: 'load' });
|
|
671
672
|
await waitForSlideRenderReady(page, options);
|
|
672
673
|
|
|
673
674
|
const slideFrame = await detectSlideFrame(page, slideMode);
|
|
@@ -773,7 +774,9 @@ async function main() {
|
|
|
773
774
|
throw new Error(`No slide-*.html files found in: ${slidesDir}`);
|
|
774
775
|
}
|
|
775
776
|
|
|
776
|
-
const browser =
|
|
777
|
+
const browser = process.platform === 'openharmony'
|
|
778
|
+
? await launchBrowserViaCdp()
|
|
779
|
+
: await chromium.launch({ headless: true });
|
|
777
780
|
const page = await browser.newPage(buildPageOptions(options.mode, options.resolution, options.slideMode));
|
|
778
781
|
const diagnostics = createSlideDiagnostics();
|
|
779
782
|
diagnostics.attach(page);
|
package/scripts/html2png.js
CHANGED
|
@@ -9,6 +9,7 @@ import { chromium } from 'playwright';
|
|
|
9
9
|
import { ensureSlidesPassValidation } from './validate-slides.js';
|
|
10
10
|
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
|
+
const { launchBrowserViaCdp, loadPageUrl } = require('../src/ohos-browser-bridge.cjs');
|
|
12
13
|
const {
|
|
13
14
|
getResolutionChoices,
|
|
14
15
|
getResolutionSize,
|
|
@@ -159,7 +160,7 @@ async function discoverSlideFiles(slidesDir) {
|
|
|
159
160
|
|
|
160
161
|
async function renderSlideToPng(page, slidesDir, slideFile, outputPath) {
|
|
161
162
|
const url = pathToFileURL(join(slidesDir, slideFile)).href;
|
|
162
|
-
await page
|
|
163
|
+
await loadPageUrl(page, url, { waitUntil: 'load' });
|
|
163
164
|
await page.evaluate(async () => {
|
|
164
165
|
if (document.fonts?.ready) {
|
|
165
166
|
await document.fonts.ready;
|
|
@@ -217,7 +218,9 @@ async function main() {
|
|
|
217
218
|
`Rendering ${slideFiles.length} slide(s) at ${outputSize.width}x${outputSize.height} (${options.slideMode})\n`,
|
|
218
219
|
);
|
|
219
220
|
|
|
220
|
-
const browser =
|
|
221
|
+
const browser = process.platform === 'openharmony'
|
|
222
|
+
? await launchBrowserViaCdp()
|
|
223
|
+
: await chromium.launch({ headless: true });
|
|
221
224
|
try {
|
|
222
225
|
const context = await browser.newContext({
|
|
223
226
|
viewport: { width: framePx.width, height: framePx.height },
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from '../src/validation/core.js';
|
|
23
23
|
|
|
24
24
|
const require = createRequire(import.meta.url);
|
|
25
|
+
const { launchBrowserViaCdp } = require('../src/ohos-browser-bridge.cjs');
|
|
25
26
|
const { DEFAULT_SLIDE_MODE } = require('../src/slide-mode.cjs');
|
|
26
27
|
|
|
27
28
|
export {
|
|
@@ -170,7 +171,9 @@ export async function validateSlides(slidesDir, { mode = DEFAULT_SLIDE_MODE, sel
|
|
|
170
171
|
throw new Error(`No slide-*.html files found in: ${slidesDir}`);
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
const browser =
|
|
174
|
+
const browser = process.platform === 'openharmony'
|
|
175
|
+
? await launchBrowserViaCdp()
|
|
176
|
+
: await chromium.launch({ headless: true });
|
|
174
177
|
const context = await browser.newContext({ viewport: { width: 1920, height: 1080 } });
|
|
175
178
|
const page = await context.newPage();
|
|
176
179
|
|
|
@@ -115,6 +115,17 @@ function killBrowserProcess(pkg) {
|
|
|
115
115
|
execSync(`killall ${pkg} 2>/dev/null`, { encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'ignore'] });
|
|
116
116
|
} catch {}
|
|
117
117
|
|
|
118
|
+
// 3b. Fallback: kill -9 by PID
|
|
119
|
+
try {
|
|
120
|
+
const out = execSync(`ps -ef 2>/dev/null | grep "${pkg}" | grep -v grep | awk '{print $2}'`, {
|
|
121
|
+
encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'ignore']
|
|
122
|
+
});
|
|
123
|
+
const pids = out.trim().split('\n').filter(Boolean);
|
|
124
|
+
for (const pid of pids) {
|
|
125
|
+
try { execSync(`kill -9 ${pid} 2>/dev/null`, { encoding: 'utf-8', timeout: 3000, stdio: ['pipe', 'pipe', 'ignore'] }); } catch {}
|
|
126
|
+
}
|
|
127
|
+
} catch {}
|
|
128
|
+
|
|
118
129
|
// 4. Wait for process to die (poll up to 5s)
|
|
119
130
|
const deadline = Date.now() + 5000;
|
|
120
131
|
while (Date.now() < deadline) {
|