@napplet/sdk 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,501 @@
1
+ // src/index.ts
2
+ import { NUB_DOMAINS } from "@napplet/core";
3
+ import { DOMAIN } from "@napplet/nub-relay";
4
+ import { DOMAIN as DOMAIN2 } from "@napplet/nub-identity";
5
+ import { DOMAIN as DOMAIN3 } from "@napplet/nub-storage";
6
+ import { DOMAIN as DOMAIN4 } from "@napplet/nub-ifc";
7
+ import { DOMAIN as DOMAIN5 } from "@napplet/nub-theme";
8
+ import { DOMAIN as DOMAIN6 } from "@napplet/nub-keys";
9
+ import { DOMAIN as DOMAIN7 } from "@napplet/nub-media";
10
+ import { DOMAIN as DOMAIN8 } from "@napplet/nub-notify";
11
+ import { DOMAIN as DOMAIN9 } from "@napplet/nub-config";
12
+ import { installRelayShim } from "@napplet/nub-relay";
13
+ import { installIdentityShim } from "@napplet/nub-identity";
14
+ import { installStorageShim } from "@napplet/nub-storage";
15
+ import { installIfcShim } from "@napplet/nub-ifc";
16
+ import { installKeysShim } from "@napplet/nub-keys";
17
+ import { installMediaShim } from "@napplet/nub-media";
18
+ import { installNotifyShim } from "@napplet/nub-notify";
19
+ import { installConfigShim } from "@napplet/nub-config";
20
+ import { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from "@napplet/nub-relay";
21
+ import { identityGetPublicKey, identityGetRelays, identityGetProfile, identityGetFollows, identityGetList, identityGetZaps, identityGetMutes, identityGetBlocked, identityGetBadges } from "@napplet/nub-identity";
22
+ import { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from "@napplet/nub-storage";
23
+ import { ifcEmit, ifcOn } from "@napplet/nub-ifc";
24
+ import { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from "@napplet/nub-keys";
25
+ import { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaOnCommand, mediaOnControls } from "@napplet/nub-media";
26
+ import { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from "@napplet/nub-notify";
27
+ function requireNapplet() {
28
+ const w = window;
29
+ if (!w.napplet) {
30
+ throw new Error("window.napplet not installed -- import @napplet/shim first");
31
+ }
32
+ return w.napplet;
33
+ }
34
+ var relay = {
35
+ /**
36
+ * Open a live NIP-01 subscription through the shell's relay pool.
37
+ * @param filters One or more NIP-01 subscription filters
38
+ * @param onEvent Called for each matching event
39
+ * @param onEose Called when the shell signals end of stored events (EOSE)
40
+ * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions
41
+ * @returns A Subscription handle with a `close()` method
42
+ */
43
+ subscribe(filters, onEvent, onEose, options) {
44
+ return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);
45
+ },
46
+ /**
47
+ * Sign and publish a Nostr event through the shell.
48
+ * @param template Unsigned event template
49
+ * @param options Optional: `{ relay: true }` to publish via scoped relay
50
+ * @returns The signed NostrEvent after successful publication
51
+ */
52
+ publish(template, options) {
53
+ return requireNapplet().relay.publish(template, options);
54
+ },
55
+ /**
56
+ * Publish an encrypted Nostr event through the shell.
57
+ * @param template Unsigned event template
58
+ * @param recipient Hex-encoded recipient public key
59
+ * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'
60
+ * @returns The signed encrypted NostrEvent after successful publication
61
+ */
62
+ publishEncrypted(template, recipient, encryption = "nip44") {
63
+ return requireNapplet().relay.publishEncrypted(template, recipient, encryption);
64
+ },
65
+ /**
66
+ * One-shot query: subscribe, collect events until EOSE, then resolve.
67
+ * @param filters NIP-01 subscription filters
68
+ * @returns Promise resolving to array of matching NostrEvent objects
69
+ */
70
+ query(filters) {
71
+ return requireNapplet().relay.query(filters);
72
+ }
73
+ };
74
+ var ipc = {
75
+ /**
76
+ * Broadcast an IPC-PEER event to other napplets via the shell.
77
+ * @param topic The 't' tag value (e.g., 'profile:open')
78
+ * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])
79
+ * @param content Event content (default: empty string)
80
+ */
81
+ emit(topic, extraTags, content) {
82
+ requireNapplet().ipc.emit(topic, extraTags, content);
83
+ },
84
+ /**
85
+ * Subscribe to IPC-PEER events on a specific topic.
86
+ * @param topic The 't' tag value to listen for
87
+ * @param callback Called with `(payload, event)` for each matching event
88
+ * @returns A Subscription handle with a `close()` method
89
+ */
90
+ on(topic, callback) {
91
+ return requireNapplet().ipc.on(topic, callback);
92
+ }
93
+ };
94
+ var storage = {
95
+ /**
96
+ * Retrieve a stored value by key. Returns null if the key does not exist.
97
+ * @param key The storage key
98
+ * @returns The stored string value, or null if not found
99
+ */
100
+ getItem(key) {
101
+ return requireNapplet().storage.getItem(key);
102
+ },
103
+ /**
104
+ * Store a key-value pair.
105
+ * @param key The storage key
106
+ * @param value The string value to store
107
+ */
108
+ setItem(key, value) {
109
+ return requireNapplet().storage.setItem(key, value);
110
+ },
111
+ /**
112
+ * Remove a stored key.
113
+ * @param key The storage key to remove
114
+ */
115
+ removeItem(key) {
116
+ return requireNapplet().storage.removeItem(key);
117
+ },
118
+ /**
119
+ * List all keys stored by this napplet.
120
+ * @returns Array of storage key strings
121
+ */
122
+ keys() {
123
+ return requireNapplet().storage.keys();
124
+ }
125
+ };
126
+ var media = {
127
+ /**
128
+ * Create a new media session with the shell.
129
+ * @param metadata Optional initial metadata
130
+ * @returns The confirmed session result with sessionId
131
+ */
132
+ createSession(metadata) {
133
+ return requireNapplet().media.createSession(metadata);
134
+ },
135
+ /**
136
+ * Update metadata for an existing session.
137
+ * @param sessionId The session to update
138
+ * @param metadata Partial metadata fields to update
139
+ */
140
+ updateSession(sessionId, metadata) {
141
+ requireNapplet().media.updateSession(sessionId, metadata);
142
+ },
143
+ /**
144
+ * Destroy a media session.
145
+ * @param sessionId The session to destroy
146
+ */
147
+ destroySession(sessionId) {
148
+ requireNapplet().media.destroySession(sessionId);
149
+ },
150
+ /**
151
+ * Report current playback state for a session.
152
+ * @param sessionId The session to report state for
153
+ * @param state Current playback state
154
+ */
155
+ reportState(sessionId, state) {
156
+ requireNapplet().media.reportState(sessionId, state);
157
+ },
158
+ /**
159
+ * Declare which media actions the session currently supports.
160
+ * @param sessionId The session to update capabilities for
161
+ * @param actions Currently supported actions
162
+ */
163
+ reportCapabilities(sessionId, actions) {
164
+ requireNapplet().media.reportCapabilities(sessionId, actions);
165
+ },
166
+ /**
167
+ * Listen for media commands from the shell.
168
+ * @param sessionId The session to listen for commands on
169
+ * @param callback Called with (action, value?) when a command is received
170
+ * @returns A Subscription with `close()` to stop listening
171
+ */
172
+ onCommand(sessionId, callback) {
173
+ return requireNapplet().media.onCommand(sessionId, callback);
174
+ },
175
+ /**
176
+ * Listen for the shell's media control list.
177
+ * @param sessionId The session to associate controls with
178
+ * @param callback Called with the shell's supported controls
179
+ * @returns A Subscription with `close()` to stop listening
180
+ */
181
+ onControls(sessionId, callback) {
182
+ return requireNapplet().media.onControls(sessionId, callback);
183
+ }
184
+ };
185
+ var notify = {
186
+ /**
187
+ * Send a notification to the shell.
188
+ * @param notification Notification payload (title required)
189
+ * @returns The shell-assigned notificationId
190
+ */
191
+ send(notification) {
192
+ return requireNapplet().notify.send(notification);
193
+ },
194
+ /**
195
+ * Dismiss a notification by ID.
196
+ * @param notificationId The notification to dismiss
197
+ */
198
+ dismiss(notificationId) {
199
+ requireNapplet().notify.dismiss(notificationId);
200
+ },
201
+ /**
202
+ * Set the badge count for this napplet. Pass 0 to clear.
203
+ * @param count Badge count
204
+ */
205
+ badge(count) {
206
+ requireNapplet().notify.badge(count);
207
+ },
208
+ /**
209
+ * Register a notification channel.
210
+ * @param channel Channel definition
211
+ */
212
+ registerChannel(channel) {
213
+ requireNapplet().notify.registerChannel(channel);
214
+ },
215
+ /**
216
+ * Request permission to send notifications.
217
+ * @param channel Optional channel to request permission for
218
+ * @returns Whether permission was granted
219
+ */
220
+ requestPermission(channel) {
221
+ return requireNapplet().notify.requestPermission(channel);
222
+ },
223
+ /**
224
+ * Listen for action button clicks on notifications.
225
+ * @param callback Called with (notificationId, actionId)
226
+ * @returns A Subscription with `close()` to stop listening
227
+ */
228
+ onAction(callback) {
229
+ return requireNapplet().notify.onAction(callback);
230
+ },
231
+ /**
232
+ * Listen for notification body clicks.
233
+ * @param callback Called with (notificationId)
234
+ * @returns A Subscription with `close()` to stop listening
235
+ */
236
+ onClicked(callback) {
237
+ return requireNapplet().notify.onClicked(callback);
238
+ },
239
+ /**
240
+ * Listen for notification dismissals.
241
+ * @param callback Called with (notificationId, reason?)
242
+ * @returns A Subscription with `close()` to stop listening
243
+ */
244
+ onDismissed(callback) {
245
+ return requireNapplet().notify.onDismissed(callback);
246
+ },
247
+ /**
248
+ * Listen for the shell's notification capability list.
249
+ * @param callback Called with supported controls
250
+ * @returns A Subscription with `close()` to stop listening
251
+ */
252
+ onControls(callback) {
253
+ return requireNapplet().notify.onControls(callback);
254
+ }
255
+ };
256
+ var keys = {
257
+ /**
258
+ * Declare a named action that the shell can bind to a key.
259
+ * @param action The action to register (id, label, optional defaultKey)
260
+ * @returns The assigned binding, if any
261
+ */
262
+ registerAction(action) {
263
+ return requireNapplet().keys.registerAction(action);
264
+ },
265
+ /**
266
+ * Remove a previously registered action.
267
+ * @param actionId The action to unregister
268
+ */
269
+ unregisterAction(actionId) {
270
+ requireNapplet().keys.unregisterAction(actionId);
271
+ },
272
+ /**
273
+ * Register a local handler for when a bound key is pressed.
274
+ * @param actionId The action to listen for
275
+ * @param callback Called when the action is triggered
276
+ * @returns A Subscription with `close()` to stop listening
277
+ */
278
+ onAction(actionId, callback) {
279
+ return requireNapplet().keys.onAction(actionId, callback);
280
+ },
281
+ /**
282
+ * Convenience: register a named action AND wire a local handler in one call.
283
+ * Returns a handle whose `close()` both unregisters the action and removes
284
+ * the onAction listener.
285
+ *
286
+ * @param action The action to register (id, label, optional defaultKey)
287
+ * @param handler Called when the shell triggers this action
288
+ * @returns The assigned binding plus a `close()` teardown function
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * import { keys } from '@napplet/sdk';
293
+ *
294
+ * const handle = await keys.register(
295
+ * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },
296
+ * () => saveDocument(),
297
+ * );
298
+ *
299
+ * // Later, tear down both registration and listener:
300
+ * handle.close();
301
+ * ```
302
+ */
303
+ async register(action, handler) {
304
+ const n = requireNapplet();
305
+ const result = await n.keys.registerAction(action);
306
+ const sub = n.keys.onAction(action.id, handler);
307
+ return {
308
+ ...result,
309
+ close() {
310
+ sub.close();
311
+ n.keys.unregisterAction(action.id);
312
+ }
313
+ };
314
+ }
315
+ };
316
+ var identity = {
317
+ /**
318
+ * Get the user's hex-encoded public key. Always succeeds.
319
+ * @returns Hex-encoded public key string
320
+ */
321
+ getPublicKey() {
322
+ return requireNapplet().identity.getPublicKey();
323
+ },
324
+ /**
325
+ * Get the user's relay list (NIP-65).
326
+ * @returns Record mapping relay URLs to read/write permissions
327
+ */
328
+ getRelays() {
329
+ return requireNapplet().identity.getRelays();
330
+ },
331
+ /**
332
+ * Get the user's profile metadata (kind 0).
333
+ * @returns Profile data, or null if not found
334
+ */
335
+ getProfile() {
336
+ return requireNapplet().identity.getProfile();
337
+ },
338
+ /**
339
+ * Get the user's follow list (kind 3 contact list).
340
+ * @returns Array of hex-encoded public keys
341
+ */
342
+ getFollows() {
343
+ return requireNapplet().identity.getFollows();
344
+ },
345
+ /**
346
+ * Get entries from a user's categorized list.
347
+ * @param listType List category (e.g., "bookmarks", "interests", "pins")
348
+ * @returns Array of list entry values
349
+ */
350
+ getList(listType) {
351
+ return requireNapplet().identity.getList(listType);
352
+ },
353
+ /**
354
+ * Get zap receipts sent to the user.
355
+ * @returns Array of zap receipt objects
356
+ */
357
+ getZaps() {
358
+ return requireNapplet().identity.getZaps();
359
+ },
360
+ /**
361
+ * Get the user's mute list (kind 10000).
362
+ * @returns Array of hex-encoded muted public keys
363
+ */
364
+ getMutes() {
365
+ return requireNapplet().identity.getMutes();
366
+ },
367
+ /**
368
+ * Get the user's block list.
369
+ * @returns Array of hex-encoded blocked public keys
370
+ */
371
+ getBlocked() {
372
+ return requireNapplet().identity.getBlocked();
373
+ },
374
+ /**
375
+ * Get badges awarded to the user (NIP-58).
376
+ * @returns Array of badge objects
377
+ */
378
+ getBadges() {
379
+ return requireNapplet().identity.getBadges();
380
+ }
381
+ };
382
+ var config = {
383
+ /**
384
+ * Snapshot current validated + defaulted config values.
385
+ * @returns A one-shot ConfigValues object.
386
+ */
387
+ get() {
388
+ return requireNapplet().config.get();
389
+ },
390
+ /**
391
+ * Subscribe to live configuration updates.
392
+ * First delivery is an immediate snapshot; subsequent deliveries fire on change.
393
+ * @param callback Invoked with the full ConfigValues on every change.
394
+ * @returns A Subscription with close() to stop listening.
395
+ */
396
+ subscribe(callback) {
397
+ return requireNapplet().config.subscribe(callback);
398
+ },
399
+ /**
400
+ * Request the shell open its settings UI for this napplet.
401
+ * @param options Optional { section } to deep-link by x-napplet-section name.
402
+ */
403
+ openSettings(options) {
404
+ requireNapplet().config.openSettings(options);
405
+ },
406
+ /**
407
+ * Register a napplet configuration schema at runtime (escape hatch;
408
+ * prefer manifest-declared via @napplet/vite-plugin's configSchema option).
409
+ * @param schema JSON Schema (draft-07+) describing the config surface.
410
+ * @param version Optional `$version` migration hint.
411
+ */
412
+ registerSchema(schema, version) {
413
+ return requireNapplet().config.registerSchema(schema, version);
414
+ },
415
+ /**
416
+ * Listen for schema-registration errors pushed by the shell
417
+ * (manifest parse failure, no-schema on subscribe-before-schema, etc.).
418
+ * @param callback Invoked with { code, error } on every push.
419
+ * @returns A plain teardown function that detaches the listener.
420
+ */
421
+ onSchemaError(callback) {
422
+ return requireNapplet().config.onSchemaError(callback);
423
+ },
424
+ /**
425
+ * Current schema snapshot (readonly). Populated from the
426
+ * `<meta name="napplet-config-schema">` manifest tag at shim install,
427
+ * updated on successful registerSchema responses.
428
+ * @returns The registered schema, or null if none.
429
+ */
430
+ get schema() {
431
+ return requireNapplet().config.schema;
432
+ }
433
+ };
434
+ export {
435
+ DOMAIN9 as CONFIG_DOMAIN,
436
+ DOMAIN2 as IDENTITY_DOMAIN,
437
+ DOMAIN4 as IFC_DOMAIN,
438
+ DOMAIN6 as KEYS_DOMAIN,
439
+ DOMAIN7 as MEDIA_DOMAIN,
440
+ DOMAIN8 as NOTIFY_DOMAIN,
441
+ NUB_DOMAINS,
442
+ DOMAIN as RELAY_DOMAIN,
443
+ DOMAIN3 as STORAGE_DOMAIN,
444
+ DOMAIN5 as THEME_DOMAIN,
445
+ config,
446
+ identity,
447
+ identityGetBadges,
448
+ identityGetBlocked,
449
+ identityGetFollows,
450
+ identityGetList,
451
+ identityGetMutes,
452
+ identityGetProfile,
453
+ identityGetPublicKey,
454
+ identityGetRelays,
455
+ identityGetZaps,
456
+ ifcEmit,
457
+ ifcOn,
458
+ installConfigShim,
459
+ installIdentityShim,
460
+ installIfcShim,
461
+ installKeysShim,
462
+ installMediaShim,
463
+ installNotifyShim,
464
+ installRelayShim,
465
+ installStorageShim,
466
+ ipc,
467
+ keys,
468
+ keysOnAction,
469
+ keysRegister,
470
+ keysRegisterAction,
471
+ keysUnregisterAction,
472
+ media,
473
+ mediaCreateSession,
474
+ mediaDestroySession,
475
+ mediaOnCommand,
476
+ mediaOnControls,
477
+ mediaReportCapabilities,
478
+ mediaReportState,
479
+ mediaUpdateSession,
480
+ notify,
481
+ notifyBadge,
482
+ notifyDismiss,
483
+ notifyOnAction,
484
+ notifyOnClicked,
485
+ notifyOnControls,
486
+ notifyOnDismissed,
487
+ notifyRegisterChannel,
488
+ notifyRequestPermission,
489
+ notifySend,
490
+ relay,
491
+ relayPublish,
492
+ relayPublishEncrypted,
493
+ relayQuery,
494
+ relaySubscribe,
495
+ storage,
496
+ storageGetItem,
497
+ storageKeys,
498
+ storageRemoveItem,
499
+ storageSetItem
500
+ };
501
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @napplet/sdk -- Typed named exports wrapping window.napplet.\n *\n * Provides `relay`, `ipc`, `storage`, and `keys` objects that delegate\n * to `window.napplet.*` at call time. Developers using a bundler can import\n * individual namespaces without depending on the shim's side-effect install:\n *\n * ```ts\n * import { relay, ipc } from '@napplet/sdk';\n * ```\n *\n * The shim must still be imported somewhere in the application to install\n * the `window.napplet` global. The SDK only wraps it -- it does not install it.\n *\n * Domain-specific SDK helpers are also available directly from NUB packages:\n * ```ts\n * import { relaySubscribe } from '@napplet/nub-relay';\n * import { storageGetItem } from '@napplet/nub-storage';\n * ```\n *\n * @packageDocumentation\n */\n\nimport type {\n NappletGlobal,\n NostrEvent,\n NostrFilter,\n Subscription,\n EventTemplate,\n} from '@napplet/core';\n\n// ─── Global type augmentation ────────────────────────────────────────────────\n// Provides window.napplet autocompletion for TypeScript consumers who import\n// only the SDK (not the shim). Both shim and SDK reference NappletGlobal from\n// @napplet/core -- no duplication.\n\ndeclare global {\n interface Window {\n napplet: NappletGlobal;\n }\n}\n\n// ─── Runtime guard ──────────────────────────────────────────────────────────\n\n/**\n * Retrieve the `window.napplet` global, throwing a clear error if it is absent.\n *\n * Every SDK method calls this at invocation time -- not at module load time --\n * so the shim can be imported in any order relative to the SDK.\n */\nfunction requireNapplet(): NappletGlobal {\n const w = window as Window & { napplet?: NappletGlobal };\n if (!w.napplet) {\n throw new Error('window.napplet not installed -- import @napplet/shim first');\n }\n return w.napplet;\n}\n\n// ─── Relay namespace ────────────────────────────────────────────────────────\n\n/**\n * NIP-01 relay operations: subscribe to events, publish events, one-shot queries.\n *\n * Each method delegates to `window.napplet.relay.*` at call time, which in turn\n * routes through the shell's relay pool via postMessage.\n *\n * @example\n * ```ts\n * import { relay } from '@napplet/sdk';\n *\n * const sub = relay.subscribe(\n * { kinds: [1], limit: 10 },\n * (event) => console.log(event),\n * () => console.log('EOSE'),\n * );\n * ```\n */\nexport const relay = {\n /**\n * Open a live NIP-01 subscription through the shell's relay pool.\n * @param filters One or more NIP-01 subscription filters\n * @param onEvent Called for each matching event\n * @param onEose Called when the shell signals end of stored events (EOSE)\n * @param options Optional: `{ relay, group }` for NIP-29 scoped relay subscriptions\n * @returns A Subscription handle with a `close()` method\n */\n subscribe(\n filters: NostrFilter | NostrFilter[],\n onEvent: (event: NostrEvent) => void,\n onEose: () => void,\n options?: { relay?: string; group?: string },\n ): Subscription {\n return requireNapplet().relay.subscribe(filters, onEvent, onEose, options);\n },\n\n /**\n * Sign and publish a Nostr event through the shell.\n * @param template Unsigned event template\n * @param options Optional: `{ relay: true }` to publish via scoped relay\n * @returns The signed NostrEvent after successful publication\n */\n publish(\n template: EventTemplate,\n options?: { relay?: boolean },\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publish(template, options);\n },\n\n /**\n * Publish an encrypted Nostr event through the shell.\n * @param template Unsigned event template\n * @param recipient Hex-encoded recipient public key\n * @param encryption Encryption scheme: 'nip44' (default) or 'nip04'\n * @returns The signed encrypted NostrEvent after successful publication\n */\n publishEncrypted(\n template: EventTemplate,\n recipient: string,\n encryption: 'nip44' | 'nip04' = 'nip44',\n ): Promise<NostrEvent> {\n return requireNapplet().relay.publishEncrypted(template, recipient, encryption);\n },\n\n /**\n * One-shot query: subscribe, collect events until EOSE, then resolve.\n * @param filters NIP-01 subscription filters\n * @returns Promise resolving to array of matching NostrEvent objects\n */\n query(filters: NostrFilter | NostrFilter[]): Promise<NostrEvent[]> {\n return requireNapplet().relay.query(filters);\n },\n};\n\n// ─── IPC namespace ──────────────────────────────────────────────────────────\n\n/**\n * Inter-napplet pubsub: broadcast and receive IPC-PEER events through the shell.\n *\n * @example\n * ```ts\n * import { ipc } from '@napplet/sdk';\n *\n * ipc.emit('profile:open', [], JSON.stringify({ pubkey: '...' }));\n *\n * const sub = ipc.on('profile:open', (payload) => {\n * console.log('Profile requested:', payload);\n * });\n * ```\n */\nexport const ipc = {\n /**\n * Broadcast an IPC-PEER event to other napplets via the shell.\n * @param topic The 't' tag value (e.g., 'profile:open')\n * @param extraTags Additional NIP-01 tags beyond the 't' tag (default: [])\n * @param content Event content (default: empty string)\n */\n emit(topic: string, extraTags?: string[][], content?: string): void {\n requireNapplet().ipc.emit(topic, extraTags, content);\n },\n\n /**\n * Subscribe to IPC-PEER events on a specific topic.\n * @param topic The 't' tag value to listen for\n * @param callback Called with `(payload, event)` for each matching event\n * @returns A Subscription handle with a `close()` method\n */\n on(\n topic: string,\n callback: (payload: unknown, event: NostrEvent) => void,\n ): Subscription {\n return requireNapplet().ipc.on(topic, callback);\n },\n};\n\n// ─── Services namespace ─────────────────────────────────────────────────────\n\n// ─── Storage namespace ──────────────────────────────────────────────────────\n\n/**\n * Napplet-scoped storage: async localStorage-like API proxied through the shell.\n * Each napplet's storage is isolated by identity.\n *\n * @example\n * ```ts\n * import { storage } from '@napplet/sdk';\n *\n * await storage.setItem('theme', 'dark');\n * const theme = await storage.getItem('theme'); // 'dark'\n * ```\n */\nexport const storage = {\n /**\n * Retrieve a stored value by key. Returns null if the key does not exist.\n * @param key The storage key\n * @returns The stored string value, or null if not found\n */\n getItem(key: string): Promise<string | null> {\n return requireNapplet().storage.getItem(key);\n },\n\n /**\n * Store a key-value pair.\n * @param key The storage key\n * @param value The string value to store\n */\n setItem(key: string, value: string): Promise<void> {\n return requireNapplet().storage.setItem(key, value);\n },\n\n /**\n * Remove a stored key.\n * @param key The storage key to remove\n */\n removeItem(key: string): Promise<void> {\n return requireNapplet().storage.removeItem(key);\n },\n\n /**\n * List all keys stored by this napplet.\n * @returns Array of storage key strings\n */\n keys(): Promise<string[]> {\n return requireNapplet().storage.keys();\n },\n};\n\n// ─── Media namespace ───────────────────────────────────────────────────────\n\n/**\n * Media session control: create sessions, report state and metadata,\n * declare capabilities, receive commands from the shell.\n *\n * @example\n * ```ts\n * import { media } from '@napplet/sdk';\n *\n * const { sessionId } = await media.createSession({\n * title: 'My Song', artist: 'The Artist',\n * });\n *\n * media.reportState(sessionId, { status: 'playing', position: 42.5 });\n * ```\n */\nexport const media = {\n /**\n * Create a new media session with the shell.\n * @param metadata Optional initial metadata\n * @returns The confirmed session result with sessionId\n */\n createSession(metadata?: {\n title?: string;\n artist?: string;\n album?: string;\n artwork?: { url?: string; hash?: string };\n duration?: number;\n mediaType?: 'audio' | 'video';\n }): Promise<{ sessionId: string }> {\n return requireNapplet().media.createSession(metadata);\n },\n\n /**\n * Update metadata for an existing session.\n * @param sessionId The session to update\n * @param metadata Partial metadata fields to update\n */\n updateSession(sessionId: string, metadata: {\n title?: string;\n artist?: string;\n album?: string;\n artwork?: { url?: string; hash?: string };\n duration?: number;\n mediaType?: 'audio' | 'video';\n }): void {\n requireNapplet().media.updateSession(sessionId, metadata);\n },\n\n /**\n * Destroy a media session.\n * @param sessionId The session to destroy\n */\n destroySession(sessionId: string): void {\n requireNapplet().media.destroySession(sessionId);\n },\n\n /**\n * Report current playback state for a session.\n * @param sessionId The session to report state for\n * @param state Current playback state\n */\n reportState(sessionId: string, state: {\n status: 'playing' | 'paused' | 'stopped' | 'buffering';\n position?: number;\n duration?: number;\n volume?: number;\n }): void {\n requireNapplet().media.reportState(sessionId, state);\n },\n\n /**\n * Declare which media actions the session currently supports.\n * @param sessionId The session to update capabilities for\n * @param actions Currently supported actions\n */\n reportCapabilities(sessionId: string, actions: ('play' | 'pause' | 'stop' | 'next' | 'prev' | 'seek' | 'volume')[]): void {\n requireNapplet().media.reportCapabilities(sessionId, actions);\n },\n\n /**\n * Listen for media commands from the shell.\n * @param sessionId The session to listen for commands on\n * @param callback Called with (action, value?) when a command is received\n * @returns A Subscription with `close()` to stop listening\n */\n onCommand(\n sessionId: string,\n callback: (action: 'play' | 'pause' | 'stop' | 'next' | 'prev' | 'seek' | 'volume', value?: number) => void,\n ): Subscription {\n return requireNapplet().media.onCommand(sessionId, callback);\n },\n\n /**\n * Listen for the shell's media control list.\n * @param sessionId The session to associate controls with\n * @param callback Called with the shell's supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n sessionId: string,\n callback: (controls: ('play' | 'pause' | 'stop' | 'next' | 'prev' | 'seek' | 'volume')[]) => void,\n ): Subscription {\n return requireNapplet().media.onControls(sessionId, callback);\n },\n};\n\n// ─── Notify namespace ──────────────────────────────────────────────────────\n\n/**\n * Shell-rendered notifications: send notifications, set badge counts,\n * register channels, request permission, listen for user interaction.\n *\n * @example\n * ```ts\n * import { notify } from '@napplet/sdk';\n *\n * const { notificationId } = await notify.send({\n * title: 'New message', body: 'Alice: hey!',\n * });\n *\n * notify.badge(3);\n * ```\n */\nexport const notify = {\n /**\n * Send a notification to the shell.\n * @param notification Notification payload (title required)\n * @returns The shell-assigned notificationId\n */\n send(notification: {\n title: string;\n body?: string;\n icon?: string;\n actions?: { id: string; label: string }[];\n channel?: string;\n priority?: 'low' | 'normal' | 'high' | 'urgent';\n }): Promise<{ notificationId: string }> {\n return requireNapplet().notify.send(notification);\n },\n\n /**\n * Dismiss a notification by ID.\n * @param notificationId The notification to dismiss\n */\n dismiss(notificationId: string): void {\n requireNapplet().notify.dismiss(notificationId);\n },\n\n /**\n * Set the badge count for this napplet. Pass 0 to clear.\n * @param count Badge count\n */\n badge(count: number): void {\n requireNapplet().notify.badge(count);\n },\n\n /**\n * Register a notification channel.\n * @param channel Channel definition\n */\n registerChannel(channel: {\n channelId: string;\n label: string;\n description?: string;\n defaultPriority?: 'low' | 'normal' | 'high' | 'urgent';\n }): void {\n requireNapplet().notify.registerChannel(channel);\n },\n\n /**\n * Request permission to send notifications.\n * @param channel Optional channel to request permission for\n * @returns Whether permission was granted\n */\n requestPermission(channel?: string): Promise<{ granted: boolean }> {\n return requireNapplet().notify.requestPermission(channel);\n },\n\n /**\n * Listen for action button clicks on notifications.\n * @param callback Called with (notificationId, actionId)\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(\n callback: (notificationId: string, actionId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onAction(callback);\n },\n\n /**\n * Listen for notification body clicks.\n * @param callback Called with (notificationId)\n * @returns A Subscription with `close()` to stop listening\n */\n onClicked(\n callback: (notificationId: string) => void,\n ): Subscription {\n return requireNapplet().notify.onClicked(callback);\n },\n\n /**\n * Listen for notification dismissals.\n * @param callback Called with (notificationId, reason?)\n * @returns A Subscription with `close()` to stop listening\n */\n onDismissed(\n callback: (notificationId: string, reason?: string) => void,\n ): Subscription {\n return requireNapplet().notify.onDismissed(callback);\n },\n\n /**\n * Listen for the shell's notification capability list.\n * @param callback Called with supported controls\n * @returns A Subscription with `close()` to stop listening\n */\n onControls(\n callback: (controls: ('toasts' | 'badges' | 'actions' | 'channels' | 'system')[]) => void,\n ): Subscription {\n return requireNapplet().notify.onControls(callback);\n },\n};\n\n// ─── Keys namespace ────────────────────────────────────────────────────────\n\n/**\n * Keyboard forwarding and action keybindings: register named actions the shell\n * can bind to keys, listen for shell-triggered actions locally.\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const result = await keys.registerAction({\n * id: 'editor.save',\n * label: 'Save',\n * defaultKey: 'Ctrl+S',\n * });\n *\n * const sub = keys.onAction('editor.save', () => {\n * console.log('Save triggered!');\n * });\n * ```\n */\nexport const keys = {\n /**\n * Declare a named action that the shell can bind to a key.\n * @param action The action to register (id, label, optional defaultKey)\n * @returns The assigned binding, if any\n */\n registerAction(action: {\n id: string;\n label: string;\n defaultKey?: string;\n }): Promise<{ actionId: string; binding?: string }> {\n return requireNapplet().keys.registerAction(action);\n },\n\n /**\n * Remove a previously registered action.\n * @param actionId The action to unregister\n */\n unregisterAction(actionId: string): void {\n requireNapplet().keys.unregisterAction(actionId);\n },\n\n /**\n * Register a local handler for when a bound key is pressed.\n * @param actionId The action to listen for\n * @param callback Called when the action is triggered\n * @returns A Subscription with `close()` to stop listening\n */\n onAction(actionId: string, callback: () => void): Subscription {\n return requireNapplet().keys.onAction(actionId, callback);\n },\n\n /**\n * Convenience: register a named action AND wire a local handler in one call.\n * Returns a handle whose `close()` both unregisters the action and removes\n * the onAction listener.\n *\n * @param action The action to register (id, label, optional defaultKey)\n * @param handler Called when the shell triggers this action\n * @returns The assigned binding plus a `close()` teardown function\n *\n * @example\n * ```ts\n * import { keys } from '@napplet/sdk';\n *\n * const handle = await keys.register(\n * { id: 'editor.save', label: 'Save', defaultKey: 'Ctrl+S' },\n * () => saveDocument(),\n * );\n *\n * // Later, tear down both registration and listener:\n * handle.close();\n * ```\n */\n async register(\n action: { id: string; label: string; defaultKey?: string },\n handler: () => void,\n ): Promise<{ actionId: string; binding?: string; close: () => void }> {\n const n = requireNapplet();\n const result = await n.keys.registerAction(action);\n const sub = n.keys.onAction(action.id, handler);\n return {\n ...result,\n close() {\n sub.close();\n n.keys.unregisterAction(action.id);\n },\n };\n },\n};\n\n// ─── Identity namespace ───────────────────────────────────────────────────\n\n/**\n * Read-only user identity queries: public key, profile, follows, relays,\n * lists, zaps, mutes, blocked, badges.\n *\n * @example\n * ```ts\n * import { identity } from '@napplet/sdk';\n *\n * const pubkey = await identity.getPublicKey();\n * const profile = await identity.getProfile();\n * const follows = await identity.getFollows();\n * ```\n */\nexport const identity = {\n /**\n * Get the user's hex-encoded public key. Always succeeds.\n * @returns Hex-encoded public key string\n */\n getPublicKey(): Promise<string> {\n return requireNapplet().identity.getPublicKey();\n },\n\n /**\n * Get the user's relay list (NIP-65).\n * @returns Record mapping relay URLs to read/write permissions\n */\n getRelays(): Promise<Record<string, { read: boolean; write: boolean }>> {\n return requireNapplet().identity.getRelays();\n },\n\n /**\n * Get the user's profile metadata (kind 0).\n * @returns Profile data, or null if not found\n */\n getProfile(): Promise<{\n name?: string;\n displayName?: string;\n about?: string;\n picture?: string;\n banner?: string;\n nip05?: string;\n lud16?: string;\n website?: string;\n } | null> {\n return requireNapplet().identity.getProfile();\n },\n\n /**\n * Get the user's follow list (kind 3 contact list).\n * @returns Array of hex-encoded public keys\n */\n getFollows(): Promise<string[]> {\n return requireNapplet().identity.getFollows();\n },\n\n /**\n * Get entries from a user's categorized list.\n * @param listType List category (e.g., \"bookmarks\", \"interests\", \"pins\")\n * @returns Array of list entry values\n */\n getList(listType: string): Promise<string[]> {\n return requireNapplet().identity.getList(listType);\n },\n\n /**\n * Get zap receipts sent to the user.\n * @returns Array of zap receipt objects\n */\n getZaps(): Promise<{\n eventId: string;\n sender: string;\n amount: number;\n content?: string;\n }[]> {\n return requireNapplet().identity.getZaps();\n },\n\n /**\n * Get the user's mute list (kind 10000).\n * @returns Array of hex-encoded muted public keys\n */\n getMutes(): Promise<string[]> {\n return requireNapplet().identity.getMutes();\n },\n\n /**\n * Get the user's block list.\n * @returns Array of hex-encoded blocked public keys\n */\n getBlocked(): Promise<string[]> {\n return requireNapplet().identity.getBlocked();\n },\n\n /**\n * Get badges awarded to the user (NIP-58).\n * @returns Array of badge objects\n */\n getBadges(): Promise<{\n id: string;\n name?: string;\n description?: string;\n image?: string;\n thumbs?: string[];\n awardedBy: string;\n }[]> {\n return requireNapplet().identity.getBadges();\n },\n};\n\n// ─── Config namespace ──────────────────────────────────────────────────────\n\n/**\n * Per-napplet declarative configuration (NUB-CONFIG): register a schema,\n * read current values, subscribe to live updates, deep-link into the\n * shell-owned settings UI, and listen for schema errors.\n *\n * @example\n * ```ts\n * import { config } from '@napplet/sdk';\n *\n * await config.registerSchema({\n * type: 'object',\n * properties: { theme: { type: 'string', enum: ['light', 'dark'], default: 'dark' } },\n * });\n *\n * const sub = config.subscribe((values) => { applyTheme(values.theme); });\n *\n * config.openSettings({ section: 'appearance' });\n * ```\n */\nexport const config = {\n /**\n * Snapshot current validated + defaulted config values.\n * @returns A one-shot ConfigValues object.\n */\n get(): Promise<Record<string, unknown>> {\n return requireNapplet().config.get();\n },\n\n /**\n * Subscribe to live configuration updates.\n * First delivery is an immediate snapshot; subsequent deliveries fire on change.\n * @param callback Invoked with the full ConfigValues on every change.\n * @returns A Subscription with close() to stop listening.\n */\n subscribe(\n callback: (values: Record<string, unknown>) => void,\n ): Subscription {\n return requireNapplet().config.subscribe(callback);\n },\n\n /**\n * Request the shell open its settings UI for this napplet.\n * @param options Optional { section } to deep-link by x-napplet-section name.\n */\n openSettings(options?: { section?: string }): void {\n requireNapplet().config.openSettings(options);\n },\n\n /**\n * Register a napplet configuration schema at runtime (escape hatch;\n * prefer manifest-declared via @napplet/vite-plugin's configSchema option).\n * @param schema JSON Schema (draft-07+) describing the config surface.\n * @param version Optional `$version` migration hint.\n */\n registerSchema(\n schema: Record<string, unknown>,\n version?: number,\n ): Promise<void> {\n return requireNapplet().config.registerSchema(schema, version);\n },\n\n /**\n * Listen for schema-registration errors pushed by the shell\n * (manifest parse failure, no-schema on subscribe-before-schema, etc.).\n * @param callback Invoked with { code, error } on every push.\n * @returns A plain teardown function that detaches the listener.\n */\n onSchemaError(\n callback: (err: { code: string; error: string }) => void,\n ): () => void {\n return requireNapplet().config.onSchemaError(callback);\n },\n\n /**\n * Current schema snapshot (readonly). Populated from the\n * `<meta name=\"napplet-config-schema\">` manifest tag at shim install,\n * updated on successful registerSchema responses.\n * @returns The registered schema, or null if none.\n */\n get schema(): Record<string, unknown> | null {\n return requireNapplet().config.schema;\n },\n};\n\n// ─── Type re-exports from @napplet/core ─────────────────────────────────────\n\nexport type { NostrEvent } from '@napplet/core';\nexport type { NostrFilter } from '@napplet/core';\nexport type { Subscription } from '@napplet/core';\nexport type { EventTemplate } from '@napplet/core';\n\n// ─── Core envelope types ───────────────────────────────────────────────────\n\nexport type { NappletMessage, NubDomain, NamespacedCapability, ShellSupports } from '@napplet/core';\nexport { NUB_DOMAINS } from '@napplet/core';\n\n// ─── NUB Message Type Re-exports ───────────────────────────────────────────\n// These types let SDK consumers work with typed envelope messages directly.\n// Import from '@napplet/sdk' instead of individual NUB packages.\n\n// Relay NUB\nexport type {\n RelayMessage,\n RelaySubscribeMessage,\n RelayCloseMessage,\n RelayPublishMessage,\n RelayPublishEncryptedMessage,\n RelayQueryMessage,\n RelayEventMessage,\n RelayEoseMessage,\n RelayClosedMessage,\n RelayPublishResultMessage,\n RelayPublishEncryptedResultMessage,\n RelayQueryResultMessage,\n RelayOutboundMessage,\n RelayInboundMessage,\n RelayNubMessage,\n} from '@napplet/nub-relay';\n\n// Identity NUB\nexport type {\n ProfileData,\n ZapReceipt,\n Badge,\n RelayPermission as IdentityRelayPermission,\n IdentityMessage,\n IdentityGetPublicKeyMessage,\n IdentityGetRelaysMessage,\n IdentityGetProfileMessage,\n IdentityGetFollowsMessage,\n IdentityGetListMessage,\n IdentityGetZapsMessage,\n IdentityGetMutesMessage,\n IdentityGetBlockedMessage,\n IdentityGetBadgesMessage,\n IdentityGetPublicKeyResultMessage,\n IdentityGetRelaysResultMessage,\n IdentityGetProfileResultMessage,\n IdentityGetFollowsResultMessage,\n IdentityGetListResultMessage,\n IdentityGetZapsResultMessage,\n IdentityGetMutesResultMessage,\n IdentityGetBlockedResultMessage,\n IdentityGetBadgesResultMessage,\n IdentityRequestMessage,\n IdentityResultMessage,\n IdentityNubMessage,\n} from '@napplet/nub-identity';\n\n// Storage NUB\nexport type {\n StorageMessage,\n StorageGetMessage,\n StorageSetMessage,\n StorageRemoveMessage,\n StorageKeysMessage,\n StorageGetResultMessage,\n StorageSetResultMessage,\n StorageRemoveResultMessage,\n StorageKeysResultMessage,\n StorageRequestMessage,\n StorageResultMessage,\n StorageNubMessage,\n} from '@napplet/nub-storage';\n\n// IFC NUB\nexport type {\n IfcMessage,\n IfcEmitMessage,\n IfcSubscribeMessage,\n IfcSubscribeResultMessage,\n IfcUnsubscribeMessage,\n IfcEventMessage,\n IfcChannelOpenMessage,\n IfcChannelOpenResultMessage,\n IfcChannelEmitMessage,\n IfcChannelEventMessage,\n IfcChannelBroadcastMessage,\n IfcChannelListMessage,\n IfcChannelListResultMessage,\n IfcChannelCloseMessage,\n IfcChannelClosedMessage,\n IfcTopicMessage,\n IfcChannelMessage,\n IfcOutboundMessage,\n IfcInboundMessage,\n IfcNubMessage,\n} from '@napplet/nub-ifc';\n\n// Theme NUB\nexport type {\n ThemeColors,\n ThemeFont,\n ThemeBackground,\n Theme,\n ThemeMessage,\n ThemeGetMessage,\n ThemeGetResultMessage,\n ThemeChangedMessage,\n ThemeRequestMessage,\n ThemeResultMessage,\n ThemeNubMessage,\n} from '@napplet/nub-theme';\n\n// Keys NUB\nexport type {\n Action,\n RegisterResult,\n KeyBinding,\n KeysMessage,\n KeysForwardMessage,\n KeysRegisterActionMessage,\n KeysRegisterActionResultMessage,\n KeysUnregisterActionMessage,\n KeysBindingsMessage,\n KeysActionMessage,\n KeysRequestMessage,\n KeysResultMessage,\n KeysNubMessage,\n} from '@napplet/nub-keys';\n\n// Media NUB\nexport type {\n MediaMetadata,\n MediaArtwork,\n MediaState,\n MediaAction,\n MediaMessage,\n MediaSessionCreateMessage,\n MediaSessionCreateResultMessage,\n MediaSessionUpdateMessage,\n MediaSessionDestroyMessage,\n MediaStateMessage,\n MediaCapabilitiesMessage,\n MediaCommandMessage,\n MediaControlsMessage,\n MediaRequestMessage,\n MediaResultMessage,\n MediaNubMessage,\n} from '@napplet/nub-media';\n\n// Notify NUB\nexport type {\n NotificationPriority,\n NotificationAction,\n NotificationChannel,\n NotifyControl,\n NotifyMessage,\n NotifySendMessage,\n NotifySendResultMessage,\n NotifyDismissMessage,\n NotifyBadgeMessage,\n NotifyChannelRegisterMessage,\n NotifyPermissionRequestMessage,\n NotifyPermissionResultMessage,\n NotifyActionMessage,\n NotifyClickedMessage,\n NotifyDismissedMessage,\n NotifyControlsMessage,\n NotifyRequestMessage,\n NotifyResultMessage,\n NotifyNubMessage,\n} from '@napplet/nub-notify';\n\n// Config NUB\nexport type {\n NappletConfigSchema,\n ConfigSchema,\n ConfigValues,\n ConfigSchemaErrorCode,\n NappletConfigSchemaExtensions,\n ConfigMessage,\n ConfigRegisterSchemaMessage,\n ConfigGetMessage,\n ConfigSubscribeMessage,\n ConfigUnsubscribeMessage,\n ConfigOpenSettingsMessage,\n ConfigRegisterSchemaResultMessage,\n ConfigValuesMessage,\n ConfigSchemaErrorMessage,\n ConfigRequestMessage,\n ConfigResultMessage,\n ConfigNubMessage,\n} from '@napplet/nub-config';\n\n// ─── NUB Domain Constants ──────────────────────────────────────────────────\n\nexport { DOMAIN as RELAY_DOMAIN } from '@napplet/nub-relay';\nexport { DOMAIN as IDENTITY_DOMAIN } from '@napplet/nub-identity';\nexport { DOMAIN as STORAGE_DOMAIN } from '@napplet/nub-storage';\nexport { DOMAIN as IFC_DOMAIN } from '@napplet/nub-ifc';\nexport { DOMAIN as THEME_DOMAIN } from '@napplet/nub-theme';\nexport { DOMAIN as KEYS_DOMAIN } from '@napplet/nub-keys';\nexport { DOMAIN as MEDIA_DOMAIN } from '@napplet/nub-media';\nexport { DOMAIN as NOTIFY_DOMAIN } from '@napplet/nub-notify';\nexport { DOMAIN as CONFIG_DOMAIN } from '@napplet/nub-config';\n\n// ─── NUB Shim Installer Re-exports ─────────────────────────────────────────\n// Allow consumers to cherry-pick shim installers per domain.\n\nexport { installRelayShim } from '@napplet/nub-relay';\nexport { installIdentityShim } from '@napplet/nub-identity';\nexport { installStorageShim } from '@napplet/nub-storage';\nexport { installIfcShim } from '@napplet/nub-ifc';\nexport { installKeysShim } from '@napplet/nub-keys';\nexport { installMediaShim } from '@napplet/nub-media';\nexport { installNotifyShim } from '@napplet/nub-notify';\nexport { installConfigShim } from '@napplet/nub-config';\n\n// ─── NUB SDK Helper Re-exports ──────────────────────────────────────────────\n// Allow consumers to use domain-specific SDK functions from @napplet/sdk.\n\nexport { relaySubscribe, relayPublish, relayPublishEncrypted, relayQuery } from '@napplet/nub-relay';\nexport { identityGetPublicKey, identityGetRelays, identityGetProfile, identityGetFollows, identityGetList, identityGetZaps, identityGetMutes, identityGetBlocked, identityGetBadges } from '@napplet/nub-identity';\nexport { storageGetItem, storageSetItem, storageRemoveItem, storageKeys } from '@napplet/nub-storage';\nexport { ifcEmit, ifcOn } from '@napplet/nub-ifc';\nexport { keysRegisterAction, keysUnregisterAction, keysOnAction, keysRegister } from '@napplet/nub-keys';\nexport { mediaCreateSession, mediaUpdateSession, mediaDestroySession, mediaReportState, mediaReportCapabilities, mediaOnCommand, mediaOnControls } from '@napplet/nub-media';\nexport { notifySend, notifyDismiss, notifyBadge, notifyRegisterChannel, notifyRequestPermission, notifyOnAction, notifyOnClicked, notifyOnDismissed, notifyOnControls } from '@napplet/nub-notify';\n"],"mappings":";AA8uBA,SAAS,mBAAmB;AAiM5B,SAAmB,cAAoB;AACvC,SAAmB,UAAVA,eAAiC;AAC1C,SAAmB,UAAVA,eAAgC;AACzC,SAAmB,UAAVA,eAA4B;AACrC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA6B;AACtC,SAAmB,UAAVA,eAA8B;AACvC,SAAmB,UAAVA,eAA+B;AACxC,SAAmB,UAAVA,eAA+B;AAKxC,SAAS,wBAAwB;AACjC,SAAS,2BAA2B;AACpC,SAAS,0BAA0B;AACnC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,wBAAwB;AACjC,SAAS,yBAAyB;AAClC,SAAS,yBAAyB;AAKlC,SAAS,gBAAgB,cAAc,uBAAuB,kBAAkB;AAChF,SAAS,sBAAsB,mBAAmB,oBAAoB,oBAAoB,iBAAiB,iBAAiB,kBAAkB,oBAAoB,yBAAyB;AAC3L,SAAS,gBAAgB,gBAAgB,mBAAmB,mBAAmB;AAC/E,SAAS,SAAS,aAAa;AAC/B,SAAS,oBAAoB,sBAAsB,cAAc,oBAAoB;AACrF,SAAS,oBAAoB,oBAAoB,qBAAqB,kBAAkB,yBAAyB,gBAAgB,uBAAuB;AACxJ,SAAS,YAAY,eAAe,aAAa,uBAAuB,yBAAyB,gBAAgB,iBAAiB,mBAAmB,wBAAwB;AA55B7K,SAAS,iBAAgC;AACvC,QAAM,IAAI;AACV,MAAI,CAAC,EAAE,SAAS;AACd,UAAM,IAAI,MAAM,4DAA4D;AAAA,EAC9E;AACA,SAAO,EAAE;AACX;AAqBO,IAAM,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnB,UACE,SACA,SACA,QACA,SAC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,EACnD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,aAAa,SAAsC;AACjD,mBAAe,EAAE,OAAO,aAAa,OAAO;AAAA,EAC9C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,eACE,QACA,SACe;AACf,WAAO,eAAe,EAAE,OAAO,eAAe,QAAQ,OAAO;AAAA,EAC/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,cACE,UACY;AACZ,WAAO,eAAe,EAAE,OAAO,cAAc,QAAQ;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,SAAyC;AAC3C,WAAO,eAAe,EAAE,OAAO;AAAA,EACjC;AACF;","names":["DOMAIN"]}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@napplet/sdk",
3
+ "version": "0.2.0",
4
+ "description": "Typed named exports wrapping window.napplet for bundler-consuming napplet developers",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "sideEffects": false,
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "dependencies": {
23
+ "@napplet/core": "workspace:*",
24
+ "@napplet/nub-relay": "workspace:*",
25
+ "@napplet/nub-identity": "workspace:*",
26
+ "@napplet/nub-storage": "workspace:*",
27
+ "@napplet/nub-ifc": "workspace:*",
28
+ "@napplet/nub-theme": "workspace:*",
29
+ "@napplet/nub-keys": "workspace:*",
30
+ "@napplet/nub-media": "workspace:*",
31
+ "@napplet/nub-notify": "workspace:*",
32
+ "@napplet/nub-config": "workspace:*"
33
+ },
34
+ "devDependencies": {
35
+ "tsup": "^8.5.0",
36
+ "typescript": "^5.9.3"
37
+ },
38
+ "scripts": {
39
+ "build": "tsup",
40
+ "type-check": "tsc --noEmit"
41
+ },
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "git+https://github.com/sandwichfarm/napplet.git",
46
+ "directory": "packages/sdk"
47
+ },
48
+ "keywords": [
49
+ "nostr",
50
+ "napplet",
51
+ "sdk",
52
+ "iframe",
53
+ "nip-01"
54
+ ]
55
+ }