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.
| 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.
| 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). |
createPluginRegistry | function | () => PluginRegistry | Registry for plugin lifecycle management. |
@edv4h/usketch-shape-utils
Pure helpers for shape bounds, hit testing, resize, and GPU primitives.
| 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.
| Name名前 | Kind種別 | Signatureシグネチャ | Description説明 |
|---|---|---|---|
createBoardStore | function | () => BoardStore | Construct a Zustand + Yjs backed board store. |
createAddShapeCommand | function | (shape) => Command | Command 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.
| Name名前 | Kind種別 | Signatureシグネチャ | Description説明 |
|---|---|---|---|
SessionView | type | interface<TPublic> | Public session as seen by clients (id, type, host, participants, public state). |
Participant | type | interface | A participant keyed by userId, with role + live connection state. |
SessionConfig | type | { type; [k]: unknown } | Create payload — a `type` discriminator plus the type's own fields. |
ClientToServer / ServerToClient | type | union | Wire messages (create/join/action/leave/close/end/sync ↔ state/private/ended/error). |
ServerSessionType | type | interface | Server 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.
| Name名前 | Kind種別 | Signatureシグネチャ | Description説明 |
|---|---|---|---|
votingServerType | const | ServerSessionType | From `/server` — dedup, secret ballot, multi/re-vote, close. Register into SessionManager. |
votingClientType | const | ClientSessionType | From `/client` — poll card + create form. Pass to createSessionPlugin({ types }). |
VotingPublicState / VotingConfig | type | interface | Voting's public state (question/options/tally/status) and create config. |