{"_id":"@bun-win32/dcomp","_rev":"5-433c1bb2c23b12213766b3b6a59d2890","name":"@bun-win32/dcomp","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"@bun-win32/dcomp","version":"1.0.0","keywords":["bun","ffi","win32","windows","dcomp","directcomposition","compositor","animation","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/dcomp@1.0.0","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"b4c7522c7384e70c9402f3d796675d60dc511ff6","tarball":"https://registry.npmjs.org/@bun-win32/dcomp/-/dcomp-1.0.0.tgz","fileCount":6,"integrity":"sha512-Fmcr4RBsB8nJbEBf+30S3M9WXRxE3xmCSVpWZ73dZ8s7C5dtSPB+Z66tOtcoFiWkgRdV/ol/EOdUH236g8zfWw==","signatures":[{"sig":"MEYCIQCiJn+KbSZgmLY+K6xLWoL1qyGEOGZnqZLuIPoi6sQ5ZAIhAOcuNrfc6VRTZfAm+y7ARelteowscIkc1maOuizwdL8l","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15393},"main":"./index.ts","type":"module","module":"index.ts","shasum":"b4c7522c7384e70c9402f3d796675d60dc511ff6","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:compositor-clock-scope":"bun ./example/compositor-clock-scope.ts","example:composition-device-diagnostic":"bun ./example/composition-device-diagnostic.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-Fmcr4RBsB8nJbEBf+30S3M9WXRxE3xmCSVpWZ73dZ8s7C5dtSPB+Z66tOtcoFiWkgRdV/ol/EOdUH236g8zfWw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dcomp"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DComp bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dcomp_1.0.0_1779150538031_0.5367417105925687","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@bun-win32/dcomp","version":"1.0.1","keywords":["bun","ffi","win32","windows","dcomp","directcomposition","compositor","animation","bindings","typescript","dll"],"author":"Stev Peifer <stev@bell.net>","license":"MIT","_id":"@bun-win32/dcomp@1.0.1","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"4f1ed44f1e35d2654c874d34619fbe22cde68c6b","tarball":"https://registry.npmjs.org/@bun-win32/dcomp/-/dcomp-1.0.1.tgz","fileCount":6,"integrity":"sha512-TifsHjzXvprEffyU9ho3Tf19p43A9qaDvajc4bbkVyiJjl+8pDgNPsNX+cU5Wjhuv32nan/gwoeYbLGMoDIOVQ==","signatures":[{"sig":"MEYCIQDBCjOOnhF8cI+pRjnCwRGSrr29/NgPVDYnGI1X2RSz0QIhANB51/7hPH4XwDNfoy7/MNXkVcezU0yYiBsWU/PgoN+n","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15407},"main":"./index.ts","type":"module","module":"index.ts","shasum":"4f1ed44f1e35d2654c874d34619fbe22cde68c6b","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:compositor-clock-scope":"bun ./example/compositor-clock-scope.ts","example:composition-device-diagnostic":"bun ./example/composition-device-diagnostic.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-TifsHjzXvprEffyU9ho3Tf19p43A9qaDvajc4bbkVyiJjl+8pDgNPsNX+cU5Wjhuv32nan/gwoeYbLGMoDIOVQ==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dcomp"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DComp bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.2"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dcomp_1.0.1_1780581902624_0.2710904324638139","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bun-win32/dcomp","version":"1.0.2","keywords":["bun","ffi","win32","windows","dcomp","directcomposition","compositor","animation","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/dcomp@1.0.2","maintainers":[{"name":"obscuritysrl","email":"stev@bell.net"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"4015e9fbb5a1c85df0005af0fc05fe02931bcec6","tarball":"https://registry.npmjs.org/@bun-win32/dcomp/-/dcomp-1.0.2.tgz","fileCount":6,"integrity":"sha512-kwEiK3L+GzxENZckoweRpsjquc0bLO/xCCWGkbIbGZKJvDgaZWONdetBkGvWon7IWHLPLM002kAh3EB4rddPCw==","signatures":[{"sig":"MEYCIQCE9NJMkqU9ZcjMsbVz9e70rEnMjIM9opTrwQ6heM01IAIhANJqZcoLTc3XWmb0aqnmNajZWieBqBVhHA6v9IsYLH7A","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15412},"main":"./index.ts","type":"module","module":"index.ts","shasum":"4015e9fbb5a1c85df0005af0fc05fe02931bcec6","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:compositor-clock-scope":"bun ./example/compositor-clock-scope.ts","example:composition-device-diagnostic":"bun ./example/composition-device-diagnostic.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev@bell.net"},"_integrity":"sha512-kwEiK3L+GzxENZckoweRpsjquc0bLO/xCCWGkbIbGZKJvDgaZWONdetBkGvWon7IWHLPLM002kAh3EB4rddPCw==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dcomp"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DComp bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@bun-win32/core":"1.1.4"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dcomp_1.0.2_1781130814979_0.02462651645196967","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bun-win32/dcomp","version":"2.0.0","keywords":["bun","ffi","win32","windows","dcomp","directcomposition","compositor","animation","bindings","typescript","dll"],"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","_id":"@bun-win32/dcomp@2.0.0","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dist":{"shasum":"ed09cdb00ce1910f652f4e71fae48e8e059f64e4","tarball":"https://registry.npmjs.org/@bun-win32/dcomp/-/dcomp-2.0.0.tgz","fileCount":6,"integrity":"sha512-sVhMKIwvBUn/kOC23PAf/ZWPQOYXDLGzYViOpLt8lGcmUZS1tzHhJUF8gULQAFciHyTad6zBB3nEAp4yTR42ig==","signatures":[{"sig":"MEUCIQCjHpU+WgIGsgyR1O9oPinDjnRkny3+lBbBxCjYA2tyzgIgNtR+tREJ+004hJZB78infrgvJ62JMfo3iHxWUzJGFxs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16767},"main":"./index.ts","type":"module","module":"index.ts","shasum":"ed09cdb00ce1910f652f4e71fae48e8e059f64e4","engines":{"bun":">=1.1.0"},"exports":{".":"./index.ts"},"private":false,"scripts":{"example:compositor-clock-scope":"bun ./example/compositor-clock-scope.ts","example:composition-device-diagnostic":"bun ./example/composition-device-diagnostic.ts"},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"_integrity":"sha512-sVhMKIwvBUn/kOC23PAf/ZWPQOYXDLGzYViOpLt8lGcmUZS1tzHhJUF8gULQAFciHyTad6zBB3nEAp4yTR42ig==","repository":{"url":"git://github.com/ObscuritySRL/bun-win32.git","type":"git","directory":"packages/dcomp"},"_npmVersion":"10.8.3","description":"Zero-dependency, zero-overhead Win32 DComp bindings for Bun (FFI) on Windows.","directories":{},"sideEffects":false,"_nodeVersion":"26.3.0","dependencies":{"@bun-win32/core":"2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/dcomp_2.0.0_1782435293335_0.7866403801488144","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"author":"Stev Peifer <stev.p@outlook.com>","bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"dependencies":{"@bun-win32/core":"2.0.1"},"description":"Zero-dependency, zero-overhead Win32 DComp bindings for Bun (FFI) on Windows.","devDependencies":{"@types/bun":"latest"},"exports":{".":"./index.ts"},"license":"MIT","module":"index.ts","name":"@bun-win32/dcomp","peerDependencies":{"typescript":"^5"},"private":false,"homepage":"https://github.com/ObscuritySRL/bun-win32#readme","repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/dcomp"},"type":"module","version":"2.0.1","main":"./index.ts","keywords":["bun","ffi","win32","windows","dcomp","directcomposition","compositor","animation","bindings","typescript","dll"],"sideEffects":false,"engines":{"bun":">=1.1.0"},"scripts":{"example:compositor-clock-scope":"bun ./example/compositor-clock-scope.ts","example:composition-device-diagnostic":"bun ./example/composition-device-diagnostic.ts"},"_id":"@bun-win32/dcomp@2.0.1","_integrity":"sha512-jErZdhW2Zp0JF2h9wlv2GUmDv4fhJ1xImvQVAMRRcoecPQCuO4//P3JPooIUNlk/lV5ZxyeH22GHSWa8Y3QIpQ==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"00156849bac6359ca7de35dfc52cc41cacbe9d1f","dist":{"integrity":"sha512-jErZdhW2Zp0JF2h9wlv2GUmDv4fhJ1xImvQVAMRRcoecPQCuO4//P3JPooIUNlk/lV5ZxyeH22GHSWa8Y3QIpQ==","shasum":"00156849bac6359ca7de35dfc52cc41cacbe9d1f","tarball":"https://registry.npmjs.org/@bun-win32/dcomp/-/dcomp-2.0.1.tgz","fileCount":6,"unpackedSize":16767,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFmTbXULEbdrQR2JJHw52a0bcUXbfwB7YERgOrKer8W1AiAkOALA56ZO/QgbU825awmUzKjfr7PTwDhdPekV011PXQ=="}]},"_npmUser":{"name":"obscuritysrl","email":"stev.p@outlook.com"},"directories":{},"maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dcomp_2.0.1_1782437752269_0.49305164078440056"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T00:28:57.901Z","modified":"2026-06-26T01:35:52.538Z","1.0.0":"2026-05-19T00:28:58.186Z","1.0.1":"2026-06-04T14:05:02.784Z","1.0.2":"2026-06-10T22:33:35.121Z","2.0.0":"2026-06-26T00:54:53.498Z","2.0.1":"2026-06-26T01:35:52.408Z"},"bugs":{"url":"https://github.com/ObscuritySRL/bun-win32/issues"},"author":"Stev Peifer <stev.p@outlook.com>","license":"MIT","homepage":"https://github.com/ObscuritySRL/bun-win32#readme","keywords":["bun","ffi","win32","windows","dcomp","directcomposition","compositor","animation","bindings","typescript","dll"],"repository":{"type":"git","url":"git://github.com/ObscuritySRL/bun-win32.git","directory":"packages/dcomp"},"description":"Zero-dependency, zero-overhead Win32 DComp bindings for Bun (FFI) on Windows.","maintainers":[{"name":"obscuritysrl","email":"stev.p@outlook.com"}],"readme":"# @bun-win32/Dcomp\n\nZero-dependency, zero-overhead Win32 Dcomp bindings for [Bun](https://bun.sh) on Windows.\n\n## Overview\n\n`@bun-win32/Dcomp` exposes the `dcomp.dll` exports using [Bun](https://bun.sh)'s FFI. It provides a single class, `Dcomp`, which lazily binds native symbols on first use. You can optionally preload a subset or all symbols up-front via `Preload()`.\n\nIt covers the documented Microsoft **DirectComposition** flat surface (`dcomp.h`): device creation (`DCompositionCreateDevice`/`2`/`3`), composition surface handles, the Windows-11 compositor-clock frame/statistics APIs (`DCompositionGetFrameId`, `DCompositionGetStatistics`, `DCompositionWaitForCompositorClock`, `DCompositionBoostCompositorClock`), mouse-input redirection, and the COM in-proc-server entry points. The rest of DirectComposition — the `IDCompositionDevice`/`IDCompositionVisual` object graph — rides the COM vtable on top of the device created here.\n\nThe bindings are strongly typed for a smooth DX in TypeScript.\n\n## Features\n\n- [Bun](https://bun.sh)-first ergonomics on Windows 10/11.\n- Direct FFI to `dcomp.dll` (DirectComposition device, surfaces, compositor clock).\n- In-source docs in `structs/Dcomp.ts` with links to Microsoft Docs.\n- Lazy binding on first call; optional eager preload (`Dcomp.Preload()`).\n- No wrapper overhead; calls map 1:1 to native APIs.\n- Strongly-typed Win32 aliases (see `types/Dcomp.ts`).\n\n## Requirements\n\n- [Bun](https://bun.sh) runtime\n- Windows 10 or later (compositor-clock APIs require Windows 11 build 22000+)\n\n## Installation\n\n```sh\nbun add @bun-win32/dcomp\n```\n\n## Quick Start\n\n```ts\nimport Dcomp, { COMPOSITION_FRAME_ID_TYPE } from '@bun-win32/dcomp';\n\n// Create a device-only DirectComposition device (NULL renderer is allowed).\n// IID_IDCompositionDevice = {C37EA93A-E7AA-450D-B16F-9746CB0407F3} (dcomp.h)\nconst iid = Buffer.from([0x3a, 0xe9, 0x7e, 0xc3, 0xaa, 0xe7, 0x0d, 0x45, 0xb1, 0x6f, 0x97, 0x46, 0xcb, 0x04, 0x07, 0xf3]);\nconst deviceOut = Buffer.alloc(8);\nif (Dcomp.DCompositionCreateDevice2(null, iid.ptr!, deviceOut.ptr!) === 0) {\n  const device = deviceOut.readBigUInt64LE(0); // IDCompositionDevice* — drive via the COM vtable\n\n  // Read the latest completed compositor frame id.\n  const frameId = Buffer.alloc(8);\n  Dcomp.DCompositionGetFrameId(COMPOSITION_FRAME_ID_TYPE.COMPOSITION_FRAME_ID_COMPLETED, frameId.ptr!);\n  console.log('latest composited frame', frameId.readBigUInt64LE(0));\n}\n```\n\n> [!NOTE]\n> AI agents: see `AI.md` for the package binding contract and source-navigation guidance. It explains how to use the package without scanning the entire implementation.\n\n## Examples\n\nRun the included examples:\n\n```sh\nbun run example/compositor-clock-scope.ts\nbun run example/composition-device-diagnostic.ts\n```\n\n- **`compositor-clock-scope.ts`** — a live ANSI oscilloscope of the Windows desktop compositor's heartbeat: paces on `DCompositionWaitForCompositorClock`, reads the frame period from `DCompositionGetStatistics`, and plots a scrolling waveform with the measured effective refresh rate.\n- **`composition-device-diagnostic.ts`** — creates a real DirectComposition device, proves it via its IUnknown vtable refcount, mints a composition surface handle, and reads the full compositor-clock frame-id/statistics surface into an aligned report.\n\n## Notes\n\n- Either rely on lazy binding or call `Dcomp.Preload()`.\n- Windows only. Bun runtime required.\n- **SAL types & naming:** nullability is in the **type** — `Optional<T>` (formally optional, SAL `_*opt_`) and `Nullable<T>` (plain `[in]`/`[out]` the docs say can be NULL), the null sentinel derived from `T` (`null` for pointers `LP*`/`P*`, `0n` for handles/by-value addresses); direction is in the **parameter name** — `_out` (`_Out_`), `_in_out` (`_Inout_`), `_In_` bare. See `AI.md` and the repo `AGENTS.md`.\n","readmeFilename":"README.md"}