API Reference API リファレンス

Public surface of the core packages. For full type signatures, see the package in the docs. コアパッケージの公開 API。完全な型シグネチャはドキュメントの該当ページを参照してください。

@edv4h/usketch-shared

Core types, schemas, and framework-agnostic helpers shared across all packages.

pnpm add @edv4h/usketch-shared Docs → ドキュメント →
Name名前 Kind種別 Signatureシグネチャ Description説明
UsketchPlugin type interface Plugin interface every plugin implements.
PluginContext type interface Registries + services exposed in setup().
ShapeData type type Canonical shape record.
withRotation function (fn) => fn Hit-test helper that applies shape rotation.
DEFAULT_STYLE const ShapeStyle Default style tokens for new shapes.

@edv4h/usketch-core

createApp factory and AppInstance implementation. Wires plugins together.

pnpm add @edv4h/usketch-core Docs → ドキュメント →
Name名前 Kind種別 Signatureシグネチャ Description説明
createApp function (opts) => AppInstance Entry point — constructs an app from store + plugins.
AppInstance type interface Runtime handle to the app (dispose, plugins, ctx).
PluginRegistry class class Registry for plugin lifecycle management.

@edv4h/usketch-shape-utils

Pure helpers for shape bounds, hit testing, resize, and GPU primitives.

pnpm add @edv4h/usketch-shape-utils Docs → ドキュメント →
Name名前 Kind種別 Signatureシグネチャ Description説明
getBounds function (data) => BoundingBox Axis-aligned bounding box.
aabbHitTest function (data, point) => boolean AABB hit test.
createResize function (min) => Resizer Factory returning an 8-handle resize function.
pointInPolygon function (p, poly) => boolean Ray-casting point-in-polygon check.

@edv4h/usketch-store

Zustand + Yjs backed document store. Selectors, transactions, undo/redo.

pnpm add @edv4h/usketch-store Docs → ドキュメント →
Name名前 Kind種別 Signatureシグネチャ Description説明
createStore function () => Store Construct an in-memory store.
useShape hook (id) => ShapeData React hook for subscribing to a shape.