API ReferenceAPI リファレンス

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-sharedDocs →ドキュメント →
Name名前Kind種別SignatureシグネチャDescription説明
UsketchPlugintypeinterfacePlugin interface every plugin implements.
PluginContexttypeinterfaceRegistries + services exposed in setup().
ShapeDatatypetypeCanonical shape record.
withRotationfunction(fn) => fnHit-test helper that applies shape rotation.
DEFAULT_STYLEconstShapeStyleDefault style tokens for new shapes.

@edv4h/usketch-core

createApp factory and AppInstance implementation. Wires plugins together.

pnpm add @edv4h/usketch-coreDocs →ドキュメント →
Name名前Kind種別SignatureシグネチャDescription説明
createAppfunction(opts) => AppInstanceEntry point — constructs an app from store + plugins.
AppInstancetypeinterfaceRuntime handle to the app (dispose, plugins, ctx).
createPluginRegistryfunction() => PluginRegistryRegistry for plugin lifecycle management.

@edv4h/usketch-shape-utils

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

pnpm add @edv4h/usketch-shape-utilsDocs →ドキュメント →
Name名前Kind種別SignatureシグネチャDescription説明
getBoundsfunction(data) => BoundingBoxAxis-aligned bounding box.
aabbHitTestfunction(data, point) => booleanAABB hit test.
createResizefunction(min) => ResizerFactory returning an 8-handle resize function.
pointInPolygonfunction(p, poly) => booleanRay-casting point-in-polygon check.

@edv4h/usketch-store

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

pnpm add @edv4h/usketch-storeDocs →ドキュメント →
Name名前Kind種別SignatureシグネチャDescription説明
createBoardStorefunction() => BoardStoreConstruct a Zustand + Yjs backed board store.
createAddShapeCommandfunction(shape) => CommandCommand factory that adds a shape to the store.

@edv4h/usketch-session-protocol

Type-only wire contract for live interactive sessions (server-authoritative). Transported over the sync package's MSG_SESSION channel; each session type owns its own opaque payloads.

pnpm add @edv4h/usketch-session-protocolDocs →ドキュメント →
Name名前Kind種別SignatureシグネチャDescription説明
SessionViewtypeinterface<TPublic>Public session as seen by clients (id, type, host, participants, public state).
ParticipanttypeinterfaceA participant keyed by userId, with role + live connection state.
SessionConfigtype{ type; [k]: unknown }Create payload — a `type` discriminator plus the type's own fields.
ClientToServer / ServerToClienttypeunionWire messages (create/join/action/leave/close/end/sync ↔ state/private/ended/error).
ServerSessionTypetypeinterfaceServer extension contract (init/reduce/privateFor/close) a session type implements.

@edv4h/usketch-session-voting

The `voting` session type — the first one built on the session framework. Server + client halves under subpath exports (`/server`, `/client`) so the server bundle stays React-free.

pnpm add @edv4h/usketch-session-votingDocs →ドキュメント →
Name名前Kind種別SignatureシグネチャDescription説明
votingServerTypeconstServerSessionTypeFrom `/server` — dedup, secret ballot, multi/re-vote, close. Register into SessionManager.
votingClientTypeconstClientSessionTypeFrom `/client` — poll card + create form. Pass to createSessionPlugin({ types }).
VotingPublicState / VotingConfigtypeinterfaceVoting's public state (question/options/tally/status) and create config.