@liustack/pptwise 0.22.0 → 0.24.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/README.md +72 -41
- package/README.zh-CN.md +72 -41
- package/dist/{chunk-M35M4QUC.js → chunk-2CA3JRFR.js} +460 -499
- package/dist/chunk-2CA3JRFR.js.map +1 -0
- package/dist/{chunk-WL5KWYKS.js → chunk-G7WQ7KSP.js} +34800 -30625
- package/dist/chunk-G7WQ7KSP.js.map +1 -0
- package/dist/{chunk-VUOLBHD7.js → chunk-RQUKZYSH.js} +1 -1
- package/dist/{chunk-VUOLBHD7.js.map → chunk-RQUKZYSH.js.map} +1 -1
- package/dist/{chunk-3ZUKISTY.js → chunk-VEZGVYJS.js} +2 -2
- package/dist/cli.js +911 -462
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +5320 -1534
- package/dist/index.js +15 -13
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -2
- package/dist/{pixel-audit-H5K6JK3X.js → pixel-audit-M5Q5WCST.js} +4 -4
- package/dist/pixel-audit-M5Q5WCST.js.map +1 -0
- package/dist/{registry-C0GJH7ZT.d.ts → registry-D8bkC8ff.d.ts} +1 -1
- package/dsh/preview-tool.js +20 -17
- package/package.json +2 -1
- package/skills/pptwise/SKILL.md +133 -70
- package/skills/pptwise/SKILL.zh-CN.md +136 -73
- package/skills/pptwise/references/branding.md +34 -8
- package/skills/pptwise/references/branding.zh-CN.md +36 -8
- package/skills/pptwise/references/components.md +63 -33
- package/skills/pptwise/references/components.zh-CN.md +63 -33
- package/skills/pptwise/references/density.md +23 -9
- package/skills/pptwise/references/density.zh-CN.md +23 -9
- package/skills/pptwise/references/images.md +26 -13
- package/skills/pptwise/references/images.zh-CN.md +26 -13
- package/skills/pptwise/references/layouts.md +30 -26
- package/skills/pptwise/references/layouts.zh-CN.md +30 -26
- package/skills/pptwise/references/spec.md +143 -69
- package/skills/pptwise/references/spec.zh-CN.md +143 -69
- package/skills/pptwise/references/validate.md +33 -45
- package/skills/pptwise/references/validate.zh-CN.md +33 -45
- package/skills/pptwise/scripts/run.ps1 +1 -1
- package/skills/pptwise/scripts/run.sh +1 -1
- package/dist/chunk-M35M4QUC.js.map +0 -1
- package/dist/chunk-WL5KWYKS.js.map +0 -1
- package/dist/pixel-audit-H5K6JK3X.js.map +0 -1
- /package/dist/{chunk-3ZUKISTY.js.map → chunk-VEZGVYJS.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/platform/registry.ts"],"sourcesContent":["/**\n * A rasterized page — RGBA, 4 bytes per pixel, row-major, top-to-bottom,\n * straight (non-premultiplied) alpha. Deliberately *not* the DOM `ImageData`\n * type: that interface only exists as an ambient global where a canvas\n * implementation provides it, and this shape must be constructible in Node\n * (from sharp's raw buffer) without depending on any DOM global actually\n * existing at runtime — only the browser implementation happens to be able\n * to hand back a real `ImageData` object, which satisfies this shape\n * structurally without either side needing to import the other's type.\n */\nexport interface RasterizedImage {\n width: number\n height: number\n data: Uint8ClampedArray\n}\n\n/**\n * Scan SVG markup for a remote (`http://`/`https://`) image reference on\n * `href`/`xlink:href`, before any `rasterizeSvg` implementation touches it.\n * Shared by every implementation (`node.ts`'s sharp path, `browser.ts`'s\n * canvas path) rather than each reimplementing its own copy, because the\n * guarantee it enforces is a platform-wide one, not a browser-only one:\n * spec §3.1/§7 promise the default audit chain never starts a network\n * request, and `resolveLocalAssets` already inlines every *local* file to a\n * `data:` URI before render — the only way an `http(s)://` href survives\n * into rendered markup at all is a deck that deliberately keeps a remote URL\n * as its own asset `src`. Left there, a Node rasterizer could silently\n * attempt to fetch it (a real network request `pptwise audit` must never\n * make) and a browser canvas would silently drop it and taint the canvas\n * (the audit-v2 controller ruling this guard implements) — either way the\n * rasterized page would show *not what the text actually sits on*, which is\n * exactly the \"checked nothing, reported clean\" failure mode this whole\n * wave exists to rule out. Returns the offending URL for the caller's error\n * message, or `null` when the markup is clean.\n */\nexport function findRemoteAssetRef(svgMarkup: string): string | null {\n const m = /\\s(?:xlink:href|href)\\s*=\\s*[\"'](https?:\\/\\/[^\"']*)[\"']/i.exec(svgMarkup)\n return m ? m[1]! : null\n}\n\n/** Environment seams. The SDK entry stays browser-safe: Node implementations\n * live in ./node and are installed explicitly (CLI does it automatically). */\nexport interface PptwisePlatform {\n /** DOMParser constructor used to parse rendered SVG markup. */\n domParser?: typeof DOMParser\n /** Re-encode an image data URL to PNG (Office rejects webp and friends). */\n recodeImageToPng?: (dataUrl: string) => Promise<string>\n /**\n * Rasterize SVG markup to a fixed-size pixel buffer (audit-v2 phase B,\n * spec §4.3/§11.7) — the one primitive the optional pixel-contrast audit\n * needs and the *only* one Sharp/canvas-shaped work is allowed to hide\n * behind (`src/
|
|
1
|
+
{"version":3,"sources":["../src/platform/registry.ts"],"sourcesContent":["/**\n * A rasterized page — RGBA, 4 bytes per pixel, row-major, top-to-bottom,\n * straight (non-premultiplied) alpha. Deliberately *not* the DOM `ImageData`\n * type: that interface only exists as an ambient global where a canvas\n * implementation provides it, and this shape must be constructible in Node\n * (from sharp's raw buffer) without depending on any DOM global actually\n * existing at runtime — only the browser implementation happens to be able\n * to hand back a real `ImageData` object, which satisfies this shape\n * structurally without either side needing to import the other's type.\n */\nexport interface RasterizedImage {\n width: number\n height: number\n data: Uint8ClampedArray\n}\n\n/**\n * Scan SVG markup for a remote (`http://`/`https://`) image reference on\n * `href`/`xlink:href`, before any `rasterizeSvg` implementation touches it.\n * Shared by every implementation (`node.ts`'s sharp path, `browser.ts`'s\n * canvas path) rather than each reimplementing its own copy, because the\n * guarantee it enforces is a platform-wide one, not a browser-only one:\n * spec §3.1/§7 promise the default audit chain never starts a network\n * request, and `resolveLocalAssets` already inlines every *local* file to a\n * `data:` URI before render — the only way an `http(s)://` href survives\n * into rendered markup at all is a deck that deliberately keeps a remote URL\n * as its own asset `src`. Left there, a Node rasterizer could silently\n * attempt to fetch it (a real network request `pptwise audit` must never\n * make) and a browser canvas would silently drop it and taint the canvas\n * (the audit-v2 controller ruling this guard implements) — either way the\n * rasterized page would show *not what the text actually sits on*, which is\n * exactly the \"checked nothing, reported clean\" failure mode this whole\n * wave exists to rule out. Returns the offending URL for the caller's error\n * message, or `null` when the markup is clean.\n */\nexport function findRemoteAssetRef(svgMarkup: string): string | null {\n const m = /\\s(?:xlink:href|href)\\s*=\\s*[\"'](https?:\\/\\/[^\"']*)[\"']/i.exec(svgMarkup)\n return m ? m[1]! : null\n}\n\n/** Environment seams. The SDK entry stays browser-safe: Node implementations\n * live in ./node and are installed explicitly (CLI does it automatically). */\nexport interface PptwisePlatform {\n /** DOMParser constructor used to parse rendered SVG markup. */\n domParser?: typeof DOMParser\n /** Re-encode an image data URL to PNG (Office rejects webp and friends). */\n recodeImageToPng?: (dataUrl: string) => Promise<string>\n /**\n * Rasterize SVG markup to a fixed-size pixel buffer (audit-v2 phase B,\n * spec §4.3/§11.7) — the one primitive the optional pixel-contrast audit\n * needs and the *only* one Sharp/canvas-shaped work is allowed to hide\n * behind (`src/audit/pixel-audit.ts` never imports a rasterizer\n * itself). `installNodePlatform()` wires this to Sharp; a real browser\n * gets its own default (`./browser.ts`'s `rasterizeSvgInBrowser`) applied\n * at the call site the same way `domParser`'s `?? globalThis.DOMParser`\n * fallback already works — not through this seam, since nothing calls\n * `installPlatform()` automatically in a browser. Every implementation\n * must reject markup `findRemoteAssetRef` flags rather than touch the\n * network or a tainted canvas.\n */\n rasterizeSvg?: (svgMarkup: string, width: number, height: number) => Promise<RasterizedImage>\n /**\n * Optional fetch used when inlining remote assets. The Node CLI installs a\n * proxy-aware implementation. Absent, callers fall back to global fetch\n * (tests that `vi.stubGlobal(\"fetch\")` without installing a platform).\n */\n fetch?: typeof fetch\n}\n\nlet current: PptwisePlatform = {}\n\nexport function installPlatform(p: PptwisePlatform): void {\n current = { ...current, ...p }\n}\n\nexport function getPlatform(): PptwisePlatform {\n return current\n}\n"],"mappings":";AAmCO,SAAS,mBAAmB,WAAkC;AACnE,QAAM,IAAI,2DAA2D,KAAK,SAAS;AACnF,SAAO,IAAI,EAAE,CAAC,IAAK;AACrB;AA+BA,IAAI,UAA2B,CAAC;AAEzB,SAAS,gBAAgB,GAA0B;AACxD,YAAU,EAAE,GAAG,SAAS,GAAG,EAAE;AAC/B;AAEO,SAAS,cAA+B;AAC7C,SAAO;AACT;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findRemoteAssetRef,
|
|
3
3
|
installPlatform
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RQUKZYSH.js";
|
|
5
5
|
|
|
6
6
|
// src/platform/node.ts
|
|
7
7
|
import { DOMParser as LinkedomDOMParser } from "linkedom";
|
|
@@ -111,4 +111,4 @@ export {
|
|
|
111
111
|
isMissingModuleError,
|
|
112
112
|
installNodePlatform
|
|
113
113
|
};
|
|
114
|
-
//# sourceMappingURL=chunk-
|
|
114
|
+
//# sourceMappingURL=chunk-VEZGVYJS.js.map
|