{"_id":"@dakilloth/storybook-wails-mock","_rev":"2-7f1c2e5ff5fcab6a57bea9c8e1b1bdbc","name":"@dakilloth/storybook-wails-mock","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@dakilloth/storybook-wails-mock","version":"0.1.0","keywords":["wails","wails2","storybook","mock","testing"],"author":{"name":"DaKiLloTh"},"license":"MIT","_id":"@dakilloth/storybook-wails-mock@0.1.0","maintainers":[{"name":"dakilloth","email":"dklthomas1987@gmail.com"}],"homepage":"https://github.com/DaKiLloTh/storybook-wails-mock#readme","bugs":{"url":"https://github.com/DaKiLloTh/storybook-wails-mock/issues"},"dist":{"shasum":"5b13ce6e819b9ff04d4243da17a8f116dd1d09d6","tarball":"https://registry.npmjs.org/@dakilloth/storybook-wails-mock/-/storybook-wails-mock-0.1.0.tgz","fileCount":9,"integrity":"sha512-2ng3e7vtzvA44T7MPlPMVsrCcwlM2RBm8tb3DAGC9Urjr9OEJ80OAC4cmXeTUtLLVQWkKGsXR/8V8HLIGL+buQ==","signatures":[{"sig":"MEQCICtEQlkAxFNJFmoHZSGwwS3TBOYyP5x0dBV2gV7/nFxuAiAR3Z4Cd210rLkrfzoNMe1F0cu13QINqqN+iqKE+04T5Q==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":49756},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"bb431ef571e4fa16c7581af768aac89fcbbd2ee4","scripts":{"lint":"eslint .","test":"vitest run","build":"tsup","check":"tsc --noEmit && eslint . && vitest run && tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"dakilloth","email":"dklthomas1987@gmail.com"},"repository":{"url":"git+https://github.com/DaKiLloTh/storybook-wails-mock.git","type":"git"},"_npmVersion":"11.19.0","description":"Mocks a Wails v2 app's window.go bound methods and window.runtime API so components using them can render in Storybook (or any plain browser/test environment) outside the real Wails runtime.","directories":{},"_nodeVersion":"24.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.0","eslint":"^10.9.1","vitest":"^4.1.11","globals":"^17.11.0","happy-dom":"^20.12.0","@eslint/js":"^10.0.1","typescript":"^5.6.3","typescript-eslint":"^8.68.0"},"_npmOperationalInternal":{"tmp":"tmp/storybook-wails-mock_0.1.0_1788109638600_0.6615784306990851","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@dakilloth/storybook-wails-mock","version":"0.1.1","publishConfig":{"access":"public"},"description":"Mocks a Wails v2 app's window.go bound methods and window.runtime API so components using them can render in Storybook (or any plain browser/test environment) outside the real Wails runtime.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup","test":"vitest run","typecheck":"tsc --noEmit","lint":"eslint .","check":"tsc --noEmit && eslint . && vitest run && tsup"},"keywords":["wails","wails2","storybook","mock","testing"],"author":{"name":"DaKiLloTh"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/DaKiLloTh/storybook-wails-mock.git"},"devDependencies":{"@eslint/js":"^10.0.1","eslint":"^10.9.1","globals":"^17.11.0","happy-dom":"^20.12.0","tsup":"^8.5.0","typescript":"^5.6.3","typescript-eslint":"^8.68.0","vitest":"^4.1.11"},"gitHead":"45a57fe4c4090a389c45729fed0973975cb90ef8","_id":"@dakilloth/storybook-wails-mock@0.1.1","bugs":{"url":"https://github.com/DaKiLloTh/storybook-wails-mock/issues"},"homepage":"https://github.com/DaKiLloTh/storybook-wails-mock#readme","_nodeVersion":"22.23.2","_npmVersion":"12.0.2","dist":{"integrity":"sha512-070lkVGXfSfUpS/dG2C1n0jEKMuGWQHxbDucdkGQQhTNLJWo8rDwtliB2yQXP2OvCnhPTjLx0KscKLYcgUgfUA==","shasum":"431a9ada2c38c96893e370ce7ed101a781dff2fc","tarball":"https://registry.npmjs.org/@dakilloth/storybook-wails-mock/-/storybook-wails-mock-0.1.1.tgz","fileCount":9,"unpackedSize":47925,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@dakilloth%2fstorybook-wails-mock@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEHOqIeS2bsv8gYnXT+Rjp458BgiNrFdCJ0XCwfZ5Fj6AiAcBxkZ+DhhfHwl67bpd9GnHgu+7pb0M3c/U6Pdu8dVQg=="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b567f43a-c4d9-4cf8-9efc-642357e02c85"}},"directories":{},"maintainers":[{"name":"dakilloth","email":"dklthomas1987@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/storybook-wails-mock_0.1.1_1788110294386_0.8441971887317303"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-30T17:07:18.328Z","modified":"2026-08-30T17:18:14.845Z","0.1.0":"2026-08-30T17:07:18.729Z","0.1.1":"2026-08-30T17:18:14.521Z"},"bugs":{"url":"https://github.com/DaKiLloTh/storybook-wails-mock/issues"},"author":{"name":"DaKiLloTh"},"license":"MIT","homepage":"https://github.com/DaKiLloTh/storybook-wails-mock#readme","keywords":["wails","wails2","storybook","mock","testing"],"repository":{"type":"git","url":"git+https://github.com/DaKiLloTh/storybook-wails-mock.git"},"description":"Mocks a Wails v2 app's window.go bound methods and window.runtime API so components using them can render in Storybook (or any plain browser/test environment) outside the real Wails runtime.","maintainers":[{"name":"dakilloth","email":"dklthomas1987@gmail.com"}],"readme":"# storybook-wails-mock\n\nRender [Wails v2](https://wails.io) components outside a real Wails app - in Storybook, in tests, in a plain browser preview.\n\nWails injects `window.go` (your bound Go methods) and `window.runtime` (its JS runtime API) into the webview at startup. Neither exists in a regular browser, so any component that calls into Go throws the moment you try to render it somewhere else.\n\n## Install\n\n```sh\nnpm install --save-dev storybook-wails-mock\n```\n\n## Usage\n\n```ts\n// .storybook/preview.ts\nimport { installWailsMocks } from 'storybook-wails-mock'\n\ninstallWailsMocks({\n  go: {\n    'main.App.GetVersion': () => '1.2.3',\n    'main.App.ListInstalled': () => [{ name: 'wget', version: '1.25.0' }],\n  },\n})\n```\n\nCall it once, early - the top of your Storybook preview file is the usual spot. Keys are the full dotted path from your generated binding: `window['go']['main']['App']['GetVersion']` becomes `'main.App.GetVersion'`.\n\nAnything you haven't mocked resolves to `undefined` and logs a warning instead of throwing, so one missing mock doesn't take down every story that shares a component. Want it to fail loudly instead, e.g. in CI?\n\n```ts\ninstallWailsMocks({\n  go: {\n    /* ... */\n  },\n  onUnmockedGoCall: (path, args) => {\n    throw new Error(`Unmocked Wails call: ${path}(${args.join(', ')})`)\n  },\n})\n```\n\n## The runtime API\n\n`window.runtime.*` - events, log, window state, clipboard, notifications - comes with working defaults, so most apps won't need to touch this at all. Override what you need:\n\n```ts\ninstallWailsMocks({\n  runtime: {\n    BrowserOpenURL: (url) => console.log('would open', url),\n  },\n})\n```\n\n## Lower-level API\n\nPrefer to wire it up yourself instead of calling `installWailsMocks`:\n\n```ts\nimport { createGoMock, createRuntimeMock } from 'storybook-wails-mock'\n\nwindow.go = createGoMock({ go: { 'main.App.GetVersion': () => '1.2.3' } })\nwindow.runtime = createRuntimeMock({ BrowserOpenURL: (url) => {} })\n```\n\n## How it works\n\nEvery Wails app binds different methods, so there's no fixed shape to mock ahead of time. `createGoMock` returns a recursive Proxy - property access always returns another Proxy no matter how deep you go, and calling one resolves against your `go` config, matched by the dotted path built up along the way.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}