openpencil/packages/core/package.json
Danila Poyarkov e532f616ba
refactor!: move shared primitives below dom-css and core (#771)
* refactor!: move shared primitives below dom-css and core

dom-css depended on core for color conversion, base64 helpers, text
direction, and web-font assets, so core could not use dom-css and every
caller special-cased HTML and Tailwind output.

Color conversion and management, base64 helpers, and text/layout
direction now live in scene-graph under `color`, `bytes`, and
`text-direction`. dom-css takes web-font resolution as an injected
`fonts` option and owns the font face types, so it depends only on
scene-graph and core can depend on it.

BREAKING CHANGE: `@open-pencil/core/color` and `@open-pencil/core/bytes`
are removed, and the direction helpers are no longer exported from
`@open-pencil/core/text`; import them from `@open-pencil/scene-graph`
subpaths. `exportHTMLBundle` takes a font resolver in `fonts` instead of
`'assets'`.

* fix(tools): import color parsing from scene-graph in visual bisect

* fix(mcp): declare the scene-graph dependency

MCP imports `@open-pencil/scene-graph/bytes` since base64 helpers moved
there, but only reached scene-graph through core, so isolated installs
and package checks depended on transitive resolution.

* refactor!: use js-base64 directly instead of a base64 wrapper

Base64 helpers had moved into scene-graph only to sit below dom-css,
but they are a thin wrapper over js-base64 and unrelated to the graph;
fig already called js-base64 directly.

Callers use js-base64 and check `isValid` where input comes from outside
(clipboard, imported HTML, tool arguments, the plugin API). A new
`open-pencil/no-hand-rolled-base64` lint rule rejects atob, btoa, and
Buffer Base64 conversions, and AGENTS.md records the convention.

BREAKING CHANGE: `@open-pencil/core/bytes` is removed; use `js-base64`.

* fix(dom-css): keep images with invalid Base64 inline in HTML export

`exportHTMLBundle` accepts documents parsed from outside HTML, and
js-base64 drops characters it cannot decode, so extracting an invalid
image data URL wrote different bytes. Such images now stay inline.
2026-09-26 11:39:11 +04:00

215 lines
6 KiB
JSON

{
"name": "@open-pencil/core",
"version": "0.15.1",
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/open-pencil/open-pencil.git",
"directory": "packages/core"
},
"files": [
"dist",
"src",
"assets"
],
"type": "module",
"sideEffects": false,
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"imports": {
"#core/*": "./src/*.ts"
},
"exports": {
"./package.json": "./package.json",
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
},
"./geometry": {
"types": "./dist/geometry/index.d.ts",
"import": "./dist/geometry/index.js",
"default": "./dist/geometry/index.js"
},
"./text": {
"types": "./dist/text/index.d.ts",
"import": "./dist/text/index.js",
"default": "./dist/text/index.js"
},
"./text/web-font/assets": {
"types": "./dist/text/web-font/assets.d.ts",
"import": "./dist/text/web-font/assets.js",
"default": "./dist/text/web-font/assets.js"
},
"./vector": {
"types": "./dist/vector/index.d.ts",
"import": "./dist/vector/index.js",
"default": "./dist/vector/index.js"
},
"./figma-api": {
"types": "./dist/figma-api/index.d.ts",
"import": "./dist/figma-api/index.js",
"default": "./dist/figma-api/index.js"
},
"./icons": {
"types": "./dist/icons/index.d.ts",
"import": "./dist/icons/index.js",
"default": "./dist/icons/index.js"
},
"./canvas": {
"types": "./dist/canvas/index.d.ts",
"import": "./dist/canvas/index.js",
"default": "./dist/canvas/index.js"
},
"./design-jsx": {
"types": "./dist/design-jsx/index.d.ts",
"import": "./dist/design-jsx/index.js",
"default": "./dist/design-jsx/index.js"
},
"./editor": {
"types": "./dist/editor/index.d.ts",
"import": "./dist/editor/index.js",
"default": "./dist/editor/index.js"
},
"./tools": {
"types": "./dist/tools/index.d.ts",
"import": "./dist/tools/index.js",
"default": "./dist/tools/index.js"
},
"./profiler": {
"types": "./dist/profiler/index.d.ts",
"import": "./dist/profiler/index.js",
"default": "./dist/profiler/index.js"
},
"./rpc": {
"types": "./dist/rpc/index.d.ts",
"import": "./dist/rpc/index.js",
"default": "./dist/rpc/index.js"
},
"./library": {
"bun": "./src/library/index.ts",
"types": "./dist/library/index.d.ts",
"import": "./dist/library/index.js",
"default": "./dist/library/index.js"
},
"./lint": {
"types": "./dist/lint/index.d.ts",
"import": "./dist/lint/index.js",
"default": "./dist/lint/index.js"
},
"./io": {
"types": "./dist/io/index.d.ts",
"import": "./dist/io/index.js",
"default": "./dist/io/index.js"
},
"./io/formats/fig": {
"types": "./dist/io/formats/fig/index.d.ts",
"import": "./dist/io/formats/fig/index.js",
"default": "./dist/io/formats/fig/index.js"
},
"./io/formats/jsx": {
"types": "./dist/io/formats/jsx/index.d.ts",
"import": "./dist/io/formats/jsx/index.js",
"default": "./dist/io/formats/jsx/index.js"
},
"./io/formats/raster": {
"types": "./dist/io/formats/raster/index.d.ts",
"import": "./dist/io/formats/raster/index.js",
"default": "./dist/io/formats/raster/index.js"
},
"./io/formats/svg": {
"types": "./dist/io/formats/svg/index.d.ts",
"import": "./dist/io/formats/svg/index.js",
"default": "./dist/io/formats/svg/index.js"
},
"./kiwi": {
"types": "./dist/kiwi/index.d.ts",
"import": "./dist/kiwi/index.js",
"default": "./dist/kiwi/index.js"
},
"./clipboard": {
"types": "./dist/clipboard.d.ts",
"import": "./dist/clipboard.js",
"default": "./dist/clipboard.js"
},
"./constants": {
"types": "./dist/constants.d.ts",
"import": "./dist/constants.js",
"default": "./dist/constants.js"
},
"./random": {
"types": "./dist/random.d.ts",
"import": "./dist/random.js",
"default": "./dist/random.js"
},
"./xpath": {
"types": "./dist/xpath.d.ts",
"import": "./dist/xpath.js",
"default": "./dist/xpath.js"
},
"./canvaskit": {
"types": "./dist/canvaskit.d.ts",
"import": "./dist/canvaskit.js",
"default": "./dist/canvaskit.js"
},
"./layout": {
"types": "./dist/layout.d.ts",
"import": "./dist/layout.js",
"default": "./dist/layout.js"
}
},
"publishConfig": {
"access": "public",
"provenance": true
},
"scripts": {
"build": "bunx tsdown --config tsdown.config.ts",
"prepublishOnly": "bun run build"
},
"dependencies": {
"@chenglou/pretext": "^0.0.7",
"@iconify/utils": "^3.1.4",
"@open-pencil/dom-css": "workspace:*",
"@open-pencil/fig": "workspace:*",
"@open-pencil/kiwi": "workspace:*",
"@open-pencil/pen": "workspace:*",
"@open-pencil/scene-graph": "workspace:*",
"@tauri-apps/api": "^2.11.1",
"@valibot/to-json-schema": "^1.8.0",
"@xmldom/xmldom": "^0.9.11",
"acorn": "^8.18.0",
"canvaskit-wasm": "^0.41.1",
"culori": "^4.0.2",
"dedent": "^1.7.2",
"destr": "^2.0.5",
"diff": "^8.0.4",
"es-toolkit": "^1.51.0",
"fflate": "^0.8.3",
"fontoxpath": "^3.34.0",
"fzstd": "^0.1.1",
"js-base64": "^3.9.3",
"jsep": "^1.4.0",
"jspdf": "^4.2.1",
"nanoevents": "^9.1.0",
"ofetch": "^1.5.1",
"opentype.js": "^2.0.0",
"pptxgenjs": "^4.0.1",
"rbush": "^4.0.1",
"sucrase": "^3.35.1",
"svg-path-properties": "^2.0.2",
"svg2pdf.js": "^2.7.0",
"svgpath": "^2.6.0",
"twirlwind": "^0.3.0",
"unifont": "0.7.4",
"valibot": "^1.4.2",
"yoga-layout": "npm:@open-pencil/yoga-layout@3.3.0-grid.3"
},
"devDependencies": {
"@types/culori": "^4.0.1",
"@types/diff": "^8.0.0",
"@types/opentype.js": "^1.3.10",
"@types/rbush": "^4.0.0",
"typescript": "~5.8.3"
}
}