@toon-protocol/views 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.
Files changed (206) hide show
  1. package/dist/a2ui/A2UIRenderer.d.ts +47 -0
  2. package/dist/a2ui/A2UIRenderer.d.ts.map +1 -0
  3. package/dist/a2ui/A2UIRenderer.js +106 -0
  4. package/dist/a2ui/A2UIRenderer.js.map +1 -0
  5. package/dist/a2ui/binding.d.ts +46 -0
  6. package/dist/a2ui/binding.d.ts.map +1 -0
  7. package/dist/a2ui/binding.js +111 -0
  8. package/dist/a2ui/binding.js.map +1 -0
  9. package/dist/a2ui/index.d.ts +17 -0
  10. package/dist/a2ui/index.d.ts.map +1 -0
  11. package/dist/a2ui/index.js +17 -0
  12. package/dist/a2ui/index.js.map +1 -0
  13. package/dist/a2ui/types.d.ts +101 -0
  14. package/dist/a2ui/types.d.ts.map +1 -0
  15. package/dist/a2ui/types.js +64 -0
  16. package/dist/a2ui/types.js.map +1 -0
  17. package/dist/a2ui/validate.d.ts +55 -0
  18. package/dist/a2ui/validate.d.ts.map +1 -0
  19. package/dist/a2ui/validate.js +117 -0
  20. package/dist/a2ui/validate.js.map +1 -0
  21. package/dist/app/index.html +246 -0
  22. package/dist/app-bridge/ext-apps-bridge.d.ts +16 -0
  23. package/dist/app-bridge/ext-apps-bridge.d.ts.map +1 -0
  24. package/dist/app-bridge/ext-apps-bridge.js +66 -0
  25. package/dist/app-bridge/ext-apps-bridge.js.map +1 -0
  26. package/dist/app-bridge/types.d.ts +41 -0
  27. package/dist/app-bridge/types.d.ts.map +1 -0
  28. package/dist/app-bridge/types.js +10 -0
  29. package/dist/app-bridge/types.js.map +1 -0
  30. package/dist/app-entry.d.ts +13 -0
  31. package/dist/app-entry.d.ts.map +1 -0
  32. package/dist/app-entry.js +45 -0
  33. package/dist/app-entry.js.map +1 -0
  34. package/dist/atoms/defi.d.ts +3 -0
  35. package/dist/atoms/defi.d.ts.map +1 -0
  36. package/dist/atoms/defi.js +80 -0
  37. package/dist/atoms/defi.js.map +1 -0
  38. package/dist/atoms/fallback.d.ts +4 -0
  39. package/dist/atoms/fallback.d.ts.map +1 -0
  40. package/dist/atoms/fallback.js +15 -0
  41. package/dist/atoms/fallback.js.map +1 -0
  42. package/dist/atoms/forge.d.ts +3 -0
  43. package/dist/atoms/forge.d.ts.map +1 -0
  44. package/dist/atoms/forge.js +50 -0
  45. package/dist/atoms/forge.js.map +1 -0
  46. package/dist/atoms/interactive.d.ts +3 -0
  47. package/dist/atoms/interactive.d.ts.map +1 -0
  48. package/dist/atoms/interactive.js +99 -0
  49. package/dist/atoms/interactive.js.map +1 -0
  50. package/dist/atoms/layout.d.ts +3 -0
  51. package/dist/atoms/layout.d.ts.map +1 -0
  52. package/dist/atoms/layout.js +22 -0
  53. package/dist/atoms/layout.js.map +1 -0
  54. package/dist/atoms/media.d.ts +3 -0
  55. package/dist/atoms/media.d.ts.map +1 -0
  56. package/dist/atoms/media.js +92 -0
  57. package/dist/atoms/media.js.map +1 -0
  58. package/dist/atoms/onboard.d.ts +3 -0
  59. package/dist/atoms/onboard.d.ts.map +1 -0
  60. package/dist/atoms/onboard.js +26 -0
  61. package/dist/atoms/onboard.js.map +1 -0
  62. package/dist/atoms/registry.d.ts +35 -0
  63. package/dist/atoms/registry.d.ts.map +1 -0
  64. package/dist/atoms/registry.js +77 -0
  65. package/dist/atoms/registry.js.map +1 -0
  66. package/dist/atoms/social.d.ts +3 -0
  67. package/dist/atoms/social.d.ts.map +1 -0
  68. package/dist/atoms/social.js +52 -0
  69. package/dist/atoms/social.js.map +1 -0
  70. package/dist/atoms/types.d.ts +72 -0
  71. package/dist/atoms/types.d.ts.map +1 -0
  72. package/dist/atoms/types.js +11 -0
  73. package/dist/atoms/types.js.map +1 -0
  74. package/dist/catalog.d.ts +27 -0
  75. package/dist/catalog.d.ts.map +1 -0
  76. package/dist/catalog.js +121 -0
  77. package/dist/catalog.js.map +1 -0
  78. package/dist/components/mono-id.d.ts +16 -0
  79. package/dist/components/mono-id.d.ts.map +1 -0
  80. package/dist/components/mono-id.js +18 -0
  81. package/dist/components/mono-id.js.map +1 -0
  82. package/dist/components/ui/avatar.d.ts +12 -0
  83. package/dist/components/ui/avatar.d.ts.map +1 -0
  84. package/dist/components/ui/avatar.js +25 -0
  85. package/dist/components/ui/avatar.js.map +1 -0
  86. package/dist/components/ui/badge.d.ts +10 -0
  87. package/dist/components/ui/badge.d.ts.map +1 -0
  88. package/dist/components/ui/badge.js +26 -0
  89. package/dist/components/ui/badge.js.map +1 -0
  90. package/dist/components/ui/button.d.ts +11 -0
  91. package/dist/components/ui/button.d.ts.map +1 -0
  92. package/dist/components/ui/button.js +37 -0
  93. package/dist/components/ui/button.js.map +1 -0
  94. package/dist/components/ui/input.d.ts +4 -0
  95. package/dist/components/ui/input.d.ts.map +1 -0
  96. package/dist/components/ui/input.js +8 -0
  97. package/dist/components/ui/input.js.map +1 -0
  98. package/dist/components/ui/separator.d.ts +5 -0
  99. package/dist/components/ui/separator.d.ts.map +1 -0
  100. package/dist/components/ui/separator.js +9 -0
  101. package/dist/components/ui/separator.js.map +1 -0
  102. package/dist/components/ui/textarea.d.ts +4 -0
  103. package/dist/components/ui/textarea.d.ts.map +1 -0
  104. package/dist/components/ui/textarea.js +8 -0
  105. package/dist/components/ui/textarea.js.map +1 -0
  106. package/dist/examples.d.ts +39 -0
  107. package/dist/examples.d.ts.map +1 -0
  108. package/dist/examples.js +168 -0
  109. package/dist/examples.js.map +1 -0
  110. package/dist/filters.d.ts +40 -0
  111. package/dist/filters.d.ts.map +1 -0
  112. package/dist/filters.js +84 -0
  113. package/dist/filters.js.map +1 -0
  114. package/dist/index.d.ts +18 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +18 -0
  117. package/dist/index.js.map +1 -0
  118. package/dist/lib/cn.d.ts +4 -0
  119. package/dist/lib/cn.d.ts.map +1 -0
  120. package/dist/lib/cn.js +7 -0
  121. package/dist/lib/cn.js.map +1 -0
  122. package/dist/lib/utils.d.ts +3 -0
  123. package/dist/lib/utils.d.ts.map +1 -0
  124. package/dist/lib/utils.js +6 -0
  125. package/dist/lib/utils.js.map +1 -0
  126. package/dist/main.d.ts +3 -0
  127. package/dist/main.d.ts.map +1 -0
  128. package/dist/main.js +7 -0
  129. package/dist/main.js.map +1 -0
  130. package/dist/mcp-ui/ConsentPrompt.d.ts +41 -0
  131. package/dist/mcp-ui/ConsentPrompt.d.ts.map +1 -0
  132. package/dist/mcp-ui/ConsentPrompt.js +45 -0
  133. package/dist/mcp-ui/ConsentPrompt.js.map +1 -0
  134. package/dist/mcp-ui/SandboxedAppRenderer.d.ts +54 -0
  135. package/dist/mcp-ui/SandboxedAppRenderer.d.ts.map +1 -0
  136. package/dist/mcp-ui/SandboxedAppRenderer.js +74 -0
  137. package/dist/mcp-ui/SandboxedAppRenderer.js.map +1 -0
  138. package/dist/mcp-ui/index.d.ts +18 -0
  139. package/dist/mcp-ui/index.d.ts.map +1 -0
  140. package/dist/mcp-ui/index.js +18 -0
  141. package/dist/mcp-ui/index.js.map +1 -0
  142. package/dist/mcp-ui/sandbox.d.ts +62 -0
  143. package/dist/mcp-ui/sandbox.d.ts.map +1 -0
  144. package/dist/mcp-ui/sandbox.js +78 -0
  145. package/dist/mcp-ui/sandbox.js.map +1 -0
  146. package/dist/parsers/media.d.ts +68 -0
  147. package/dist/parsers/media.d.ts.map +1 -0
  148. package/dist/parsers/media.js +124 -0
  149. package/dist/parsers/media.js.map +1 -0
  150. package/dist/parsers/nip34.d.ts +75 -0
  151. package/dist/parsers/nip34.d.ts.map +1 -0
  152. package/dist/parsers/nip34.js +142 -0
  153. package/dist/parsers/nip34.js.map +1 -0
  154. package/dist/parsers/social.d.ts +89 -0
  155. package/dist/parsers/social.d.ts.map +1 -0
  156. package/dist/parsers/social.js +136 -0
  157. package/dist/parsers/social.js.map +1 -0
  158. package/dist/render/node-shims/node-builtins.d.ts +30 -0
  159. package/dist/render/node-shims/node-builtins.d.ts.map +1 -0
  160. package/dist/render/node-shims/node-builtins.js +38 -0
  161. package/dist/render/node-shims/node-builtins.js.map +1 -0
  162. package/dist/render/resolve.d.ts +72 -0
  163. package/dist/render/resolve.d.ts.map +1 -0
  164. package/dist/render/resolve.js +115 -0
  165. package/dist/render/resolve.js.map +1 -0
  166. package/dist/runtime.d.ts +17 -0
  167. package/dist/runtime.d.ts.map +1 -0
  168. package/dist/runtime.js +218 -0
  169. package/dist/runtime.js.map +1 -0
  170. package/dist/server/apps-server.d.ts +32 -0
  171. package/dist/server/apps-server.d.ts.map +1 -0
  172. package/dist/server/apps-server.js +163 -0
  173. package/dist/server/apps-server.js.map +1 -0
  174. package/dist/server/backend.d.ts +148 -0
  175. package/dist/server/backend.d.ts.map +1 -0
  176. package/dist/server/backend.js +11 -0
  177. package/dist/server/backend.js.map +1 -0
  178. package/dist/server/daemon-backend.d.ts +113 -0
  179. package/dist/server/daemon-backend.d.ts.map +1 -0
  180. package/dist/server/daemon-backend.js +79 -0
  181. package/dist/server/daemon-backend.js.map +1 -0
  182. package/dist/server/daemon-main.d.ts +25 -0
  183. package/dist/server/daemon-main.d.ts.map +1 -0
  184. package/dist/server/daemon-main.js +165 -0
  185. package/dist/server/daemon-main.js.map +1 -0
  186. package/dist/server/fake-backend.d.ts +53 -0
  187. package/dist/server/fake-backend.d.ts.map +1 -0
  188. package/dist/server/fake-backend.js +157 -0
  189. package/dist/server/fake-backend.js.map +1 -0
  190. package/dist/server/fake-main.d.ts +15 -0
  191. package/dist/server/fake-main.d.ts.map +1 -0
  192. package/dist/server/fake-main.js +39 -0
  193. package/dist/server/fake-main.js.map +1 -0
  194. package/dist/spec.d.ts +67 -0
  195. package/dist/spec.d.ts.map +1 -0
  196. package/dist/spec.js +221 -0
  197. package/dist/spec.js.map +1 -0
  198. package/dist/tool-names.d.ts +27 -0
  199. package/dist/tool-names.d.ts.map +1 -0
  200. package/dist/tool-names.js +32 -0
  201. package/dist/tool-names.js.map +1 -0
  202. package/dist/types.d.ts +39 -0
  203. package/dist/types.d.ts.map +1 -0
  204. package/dist/types.js +20 -0
  205. package/dist/types.js.map +1 -0
  206. package/package.json +71 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/atoms/media.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AAmH7D,eAAO,MAAM,UAAU,EAAE,IAAI,EAO5B,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** Media atoms — NIP-68/71 posts + NIP-94 files (read), and the spendy uploader. */
3
+ import { useRef, useState } from 'react';
4
+ import { parseMediaPost, parseFileMetadata, parseInlineMedia } from '../parsers/media.js';
5
+ import {} from '../types.js';
6
+ import {} from './types.js';
7
+ function isVideo(variant) {
8
+ return variant.mime?.startsWith('video/') ?? false;
9
+ }
10
+ /** Collect renderable media variants from any supported event. */
11
+ function variantsFor(event) {
12
+ const post = parseMediaPost(event);
13
+ if (post)
14
+ return { variants: post.variants, video: post.mediaType === 'video' };
15
+ const file = parseFileMetadata(event);
16
+ if (file) {
17
+ const v = { url: file.url, fallbacks: [] };
18
+ if (file.mime)
19
+ v.mime = file.mime;
20
+ if (file.dim)
21
+ v.dim = file.dim;
22
+ return { variants: [v], video: file.mime?.startsWith('video/') ?? false };
23
+ }
24
+ return { variants: parseInlineMedia(event), video: false };
25
+ }
26
+ const MediaEmbed = ({ events }) => {
27
+ const event = events[0];
28
+ if (!event)
29
+ return null;
30
+ const { variants } = variantsFor(event);
31
+ if (variants.length === 0)
32
+ return null;
33
+ return (_jsx("div", { className: "flex flex-col gap-2", children: variants.map((v, i) => isVideo(v) ? (
34
+ // eslint-disable-next-line jsx-a11y/media-has-caption
35
+ _jsx("video", { src: v.url, controls: true, className: "max-h-96 w-full rounded-md" }, i)) : (_jsx("img", { src: v.url, alt: v.alt ?? '', className: "max-h-96 w-full rounded-md object-contain" }, i))) }));
36
+ };
37
+ const MediaUploader = ({ props, actions }) => {
38
+ const label = typeof props['label'] === 'string' ? props['label'] : 'Upload media';
39
+ const inputRef = useRef(null);
40
+ const [busy, setBusy] = useState(false);
41
+ const [uploadedOk, setUploadedOk] = useState(false);
42
+ const [uploadError, setUploadError] = useState(false);
43
+ const handleFile = async (file) => {
44
+ setBusy(true);
45
+ setUploadedOk(false);
46
+ setUploadError(false);
47
+ try {
48
+ const buf = await new Promise((resolve, reject) => {
49
+ const reader = new FileReader();
50
+ reader.onload = () => resolve(reader.result);
51
+ reader.onerror = () => reject(reader.error);
52
+ reader.readAsArrayBuffer(file);
53
+ });
54
+ const bytes = new Uint8Array(buf);
55
+ let binary = '';
56
+ const chunk = 8192;
57
+ for (let i = 0; i < bytes.length; i += chunk) {
58
+ binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
59
+ }
60
+ const dataBase64 = btoa(binary);
61
+ const outcome = await actions['upload']?.({ dataBase64, mime: file.type || undefined });
62
+ if (outcome?.ok === false) {
63
+ setUploadError(true);
64
+ }
65
+ else {
66
+ setUploadedOk(true);
67
+ }
68
+ }
69
+ catch {
70
+ setUploadError(true);
71
+ }
72
+ finally {
73
+ setBusy(false);
74
+ if (inputRef.current)
75
+ inputRef.current.value = '';
76
+ }
77
+ };
78
+ return (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("input", { ref: inputRef, type: "file", accept: "image/*,video/*", className: "sr-only", disabled: busy || !actions['upload'], onChange: (e) => {
79
+ const file = e.target.files?.[0];
80
+ if (file)
81
+ void handleFile(file);
82
+ } }), _jsxs("button", { type: "button", disabled: busy || !actions['upload'], className: "rounded-md border border-dashed border-border px-3 py-2 text-sm hover:bg-muted disabled:opacity-50", onClick: () => inputRef.current?.click(), children: [busy ? 'Uploading…' : label, ' ', _jsx("span", { className: "text-xs text-muted-foreground", children: "(pays to publish)" })] }), uploadedOk && (_jsx("p", { className: "text-xs text-muted-foreground", children: "Uploaded successfully." })), uploadError && (_jsx("p", { className: "text-xs text-destructive", children: "Upload failed." }))] }));
83
+ };
84
+ export const mediaAtoms = [
85
+ { id: 'media-embed', kinds: [20, 21, 22, 1063], Component: MediaEmbed },
86
+ {
87
+ id: 'media-uploader',
88
+ writes: [{ name: 'toon_upload_media', spendy: true }],
89
+ Component: MediaUploader,
90
+ },
91
+ ];
92
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/atoms/media.tsx"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAW,MAAM,OAAO,CAAC;AAClD,OAAO,EAAqB,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC7G,OAAO,EAAmB,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAmC,MAAM,YAAY,CAAC;AAE7D,SAAS,OAAO,CAAC,OAAqB;IACpC,OAAO,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC;AACrD,CAAC;AAED,kEAAkE;AAClE,SAAS,WAAW,CAAC,KAAiB;IACpC,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACnC,IAAI,IAAI;QAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;IAChF,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,IAAI,EAAE,CAAC;QACT,MAAM,CAAC,GAAiB,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;QACzD,IAAI,IAAI,CAAC,IAAI;YAAE,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG;YAAE,CAAC,CAA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AG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,aAEvC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,EAAE,GAAG,EACjC,eAAM,SAAS,EAAC,+BAA+B,kCAAyB,IACjE,EACR,UAAU,IAAI,CACb,YAAG,SAAS,EAAC,+BAA+B,uCAA2B,CACxE,EACA,WAAW,IAAI,CACd,YAAG,SAAS,EAAC,0BAA0B,+BAAmB,CAC3D,IACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE;IACvE;QACE,EAAE,EAAE,gBAAgB;QACpB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QACrD,SAAS,EAAE,aAAa;KACzB;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const onboardAtoms: Atom[];
3
+ //# sourceMappingURL=onboard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboard.d.ts","sourceRoot":"","sources":["../../src/atoms/onboard.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AA4C7D,eAAO,MAAM,YAAY,EAAE,IAAI,EAE9B,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Onboarding atom — get-started card for new TOON clients.
4
+ * Walks through identity, payment channel, and first publish.
5
+ */
6
+ import {} from 'react';
7
+ import { Button } from '@/components/ui/button.js';
8
+ import { MonoId } from '@/components/mono-id.js';
9
+ import {} from './types.js';
10
+ const DEFAULT_STEPS = [
11
+ 'Claim your identity — one mnemonic, every chain.',
12
+ 'Open a payment channel to a TOON apex.',
13
+ 'Publish your first event. Reads stay free.',
14
+ ];
15
+ const OnboardCard = ({ props, actions }) => {
16
+ const pubkey = typeof props['pubkey'] === 'string' ? props['pubkey'] : undefined;
17
+ const steps = Array.isArray(props['steps'])
18
+ ? props['steps'].map(String)
19
+ : DEFAULT_STEPS;
20
+ const label = typeof props['label'] === 'string' ? props['label'] : 'Publish profile';
21
+ return (_jsxs("div", { className: "rounded-lg border border-border bg-card p-5", children: [_jsxs("div", { className: "mb-4", children: [_jsx("div", { className: "font-semibold", children: "Get started with TOON" }), pubkey ? (_jsx(MonoId, { value: pubkey, className: "mt-0.5 text-muted-foreground" })) : null] }), _jsx("ol", { className: "mb-4 flex flex-col gap-2", children: steps.map((step, i) => (_jsxs("li", { className: "flex gap-3 text-sm", children: [_jsx("span", { className: "mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground", children: i + 1 }), _jsx("span", { className: "text-muted-foreground", children: step })] }, i))) }), actions['publish'] ? (_jsx("div", { className: "flex justify-end", children: _jsx(Button, { size: "sm", onClick: () => void actions['publish']?.(), children: label }) })) : null] }));
22
+ };
23
+ export const onboardAtoms = [
24
+ { id: 'onboard-card', writes: [{ name: 'toon_publish_unsigned' }], Component: OnboardCard },
25
+ ];
26
+ //# sourceMappingURL=onboard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboard.js","sourceRoot":"","sources":["../../src/atoms/onboard.tsx"],"names":[],"mappings":";AAAA;;;GAGG;AACH,OAAO,EAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAmC,MAAM,YAAY,CAAC;AAE7D,MAAM,aAAa,GAAG;IACpB,kDAAkD;IAClD,wCAAwC;IACxC,4CAA4C;CAC7C,CAAC;AAEF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,KAAK,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,YACzD,KAAK,GACC,GACL,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAW;IAClC,EAAE,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE;CAC5F,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Atom registry — the vocabulary the agent composes with.
3
+ *
4
+ * Keyed two ways: by atom `id` (hand-composition via ViewSpec) and by event
5
+ * `kind` (auto-render for feeds / `kindAuto` binds). Adding a NIP = add a parser
6
+ * + an atom here, and both the MCP-app and rig surfaces light up.
7
+ */
8
+ import { KindRegistry } from '@toon-protocol/client/render';
9
+ import { type Atom } from './types.js';
10
+ import { GENERIC_ATOM_ID } from './fallback.js';
11
+ /** Atom id → Atom. */
12
+ export declare const ATOMS: ReadonlyMap<string, Atom>;
13
+ /** All registered atom ids (the ViewSpec validator allowlist). */
14
+ export declare const ATOM_IDS: ReadonlySet<string>;
15
+ /** The default atom for an event kind, or the generic fallback. */
16
+ export declare function defaultAtomForKind(kind: number): Atom;
17
+ /** The generic fallback atom (used for unknown kinds / invalid nodes). */
18
+ export declare function fallbackAtomFor(): Atom;
19
+ /**
20
+ * Build the branch-1 native-component {@link KindRegistry} from the catalog's
21
+ * atom→kind metadata — the `KindRegistry<Atom>` the render trust gradient
22
+ * (`guardedRenderDispatch`) consults first. A hit is branch 1 (a known kind,
23
+ * full trust → render the atom natively); a miss falls through to the
24
+ * unknown-kind branches (A2UI / mcp-ui / generative).
25
+ *
26
+ * Each atom is registered under every kind it declares in {@link Atom.kinds},
27
+ * first-registered-wins (matching {@link KIND_DEFAULT}) so the same atom resolves
28
+ * for a kind here as via {@link defaultAtomForKind}. The generic fallback atom is
29
+ * deliberately NOT registered: an unknown kind must miss the registry so the
30
+ * gradient can route it, not be silently swallowed as "native".
31
+ */
32
+ export declare function buildKindRegistry(): KindRegistry<Atom>;
33
+ export { GENERIC_ATOM_ID };
34
+ export { type Atom, type AtomRenderProps, type AtomAction, type ActionOutcome } from './types.js';
35
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/atoms/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAQvC,OAAO,EAAgB,eAAe,EAAE,MAAM,eAAe,CAAC;AAa9D,sBAAsB;AACtB,eAAO,MAAM,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAA4C,CAAC;AAEzF,kEAAkE;AAClE,eAAO,MAAM,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAyB,CAAC;AAYnE,mEAAmE;AACnE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAErD;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,IAAI,IAAI,CAEtC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAAC,IAAI,CAAC,CAStD;AAED,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Atom registry — the vocabulary the agent composes with.
3
+ *
4
+ * Keyed two ways: by atom `id` (hand-composition via ViewSpec) and by event
5
+ * `kind` (auto-render for feeds / `kindAuto` binds). Adding a NIP = add a parser
6
+ * + an atom here, and both the MCP-app and rig surfaces light up.
7
+ */
8
+ import { KindRegistry } from '@toon-protocol/client/render';
9
+ import {} from './types.js';
10
+ import { layoutAtoms } from './layout.js';
11
+ import { socialAtoms } from './social.js';
12
+ import { mediaAtoms } from './media.js';
13
+ import { forgeAtoms } from './forge.js';
14
+ import { interactiveAtoms } from './interactive.js';
15
+ import { defiAtoms } from './defi.js';
16
+ import { onboardAtoms } from './onboard.js';
17
+ import { fallbackAtom, GENERIC_ATOM_ID } from './fallback.js';
18
+ const ALL_ATOMS = [
19
+ ...layoutAtoms,
20
+ ...socialAtoms,
21
+ ...mediaAtoms,
22
+ ...forgeAtoms,
23
+ ...interactiveAtoms,
24
+ ...defiAtoms,
25
+ ...onboardAtoms,
26
+ fallbackAtom,
27
+ ];
28
+ /** Atom id → Atom. */
29
+ export const ATOMS = new Map(ALL_ATOMS.map((a) => [a.id, a]));
30
+ /** All registered atom ids (the ViewSpec validator allowlist). */
31
+ export const ATOM_IDS = new Set(ATOMS.keys());
32
+ const KIND_DEFAULT = (() => {
33
+ const map = new Map();
34
+ for (const atom of ALL_ATOMS) {
35
+ for (const kind of atom.kinds ?? []) {
36
+ if (!map.has(kind))
37
+ map.set(kind, atom);
38
+ }
39
+ }
40
+ return map;
41
+ })();
42
+ /** The default atom for an event kind, or the generic fallback. */
43
+ export function defaultAtomForKind(kind) {
44
+ return KIND_DEFAULT.get(kind) ?? fallbackAtom;
45
+ }
46
+ /** The generic fallback atom (used for unknown kinds / invalid nodes). */
47
+ export function fallbackAtomFor() {
48
+ return fallbackAtom;
49
+ }
50
+ /**
51
+ * Build the branch-1 native-component {@link KindRegistry} from the catalog's
52
+ * atom→kind metadata — the `KindRegistry<Atom>` the render trust gradient
53
+ * (`guardedRenderDispatch`) consults first. A hit is branch 1 (a known kind,
54
+ * full trust → render the atom natively); a miss falls through to the
55
+ * unknown-kind branches (A2UI / mcp-ui / generative).
56
+ *
57
+ * Each atom is registered under every kind it declares in {@link Atom.kinds},
58
+ * first-registered-wins (matching {@link KIND_DEFAULT}) so the same atom resolves
59
+ * for a kind here as via {@link defaultAtomForKind}. The generic fallback atom is
60
+ * deliberately NOT registered: an unknown kind must miss the registry so the
61
+ * gradient can route it, not be silently swallowed as "native".
62
+ */
63
+ export function buildKindRegistry() {
64
+ const registry = new KindRegistry();
65
+ for (const atom of ALL_ATOMS) {
66
+ if (atom === fallbackAtom)
67
+ continue;
68
+ for (const kind of atom.kinds ?? []) {
69
+ if (!registry.has(kind))
70
+ registry.register(kind, atom);
71
+ }
72
+ }
73
+ return registry;
74
+ }
75
+ export { GENERIC_ATOM_ID };
76
+ export {} from './types.js';
77
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/atoms/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAa,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAE9D,MAAM,SAAS,GAAW;IACxB,GAAG,WAAW;IACd,GAAG,WAAW;IACd,GAAG,UAAU;IACb,GAAG,UAAU;IACb,GAAG,gBAAgB;IACnB,GAAG,SAAS;IACZ,GAAG,YAAY;IACf,YAAY;CACb,CAAC;AAEF,sBAAsB;AACtB,MAAM,CAAC,MAAM,KAAK,GAA8B,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC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,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAwE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type Atom } from './types.js';
2
+ export declare const socialAtoms: Atom[];
3
+ //# sourceMappingURL=social.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.d.ts","sourceRoot":"","sources":["../../src/atoms/social.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,IAAI,EAAwB,MAAM,YAAY,CAAC;AAyG7D,eAAO,MAAM,WAAW,EAAE,IAAI,EAS7B,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /** Social atoms — NIP-01 profile/note, NIP-25 reactions, NIP-02 follow. */
3
+ import {} from 'react';
4
+ import { Button } from '@/components/ui/button.js';
5
+ import { Badge } from '@/components/ui/badge.js';
6
+ import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar.js';
7
+ import { MonoId } from '@/components/mono-id.js';
8
+ import { parseProfile, parseNote, parseReaction } from '../parsers/social.js';
9
+ import {} from './types.js';
10
+ function displayName(pubkey) {
11
+ return pubkey.slice(0, 2).toUpperCase();
12
+ }
13
+ const ProfileHeader = ({ events }) => {
14
+ const profile = events.map(parseProfile).find((p) => p !== null) ?? null;
15
+ if (!profile)
16
+ return null;
17
+ const name = profile.displayName ?? profile.name ?? profile.pubkey;
18
+ const initials = displayName(profile.pubkey);
19
+ return (_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs(Avatar, { className: "h-11 w-11", children: [_jsx(AvatarImage, { src: profile.picture, alt: name }), _jsx(AvatarFallback, { className: "text-xs font-semibold", children: initials })] }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("div", { className: "truncate font-semibold leading-tight", children: name }), profile.nip05 ? (_jsx("div", { className: "truncate text-xs text-muted-foreground", children: profile.nip05 })) : (_jsx(MonoId, { value: profile.pubkey, className: "text-muted-foreground" })), profile.about ? (_jsx("p", { className: "mt-1 line-clamp-2 text-sm text-muted-foreground", children: profile.about })) : null] })] }));
20
+ };
21
+ const NoteCard = ({ events, actions }) => {
22
+ const notes = events.map(parseNote).filter((n) => n !== null);
23
+ if (notes.length === 0)
24
+ return null;
25
+ return (_jsx("div", { className: "flex flex-col divide-y divide-border", children: notes.map((note) => (_jsxs("article", { className: "flex flex-col gap-1.5 py-3 first:pt-0 last:pb-0", children: [_jsxs("header", { className: "flex items-center gap-2", children: [_jsx(MonoId, { value: note.authorPubkey }), note.isReply ? (_jsx(Badge, { variant: "secondary", className: "text-[10px]", children: "reply" })) : null] }), _jsx("p", { className: "whitespace-pre-wrap break-words text-sm leading-relaxed", children: note.content }), actions['reply'] ? (_jsx(Button, { variant: "ghost", size: "sm", className: "self-start h-6 px-0 text-xs text-muted-foreground hover:text-foreground", onClick: () => void actions['reply']?.({ parentId: note.eventId }), children: "Reply" })) : null] }, note.eventId))) }));
26
+ };
27
+ const ReactionBar = ({ events, actions }) => {
28
+ const counts = new Map();
29
+ for (const evt of events) {
30
+ const reaction = parseReaction(evt);
31
+ if (!reaction)
32
+ continue;
33
+ const key = reaction.content || '+';
34
+ counts.set(key, (counts.get(key) ?? 0) + 1);
35
+ }
36
+ return (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [[...counts.entries()].map(([emoji, n]) => (_jsxs(Badge, { variant: "secondary", children: [emoji, " ", n] }, emoji))), actions['react'] ? (_jsx(Button, { variant: "outline", size: "sm", className: "h-6 rounded-full px-2 text-xs", onClick: () => void actions['react']?.({ content: '+' }), children: "+ React" })) : null] }));
37
+ };
38
+ const FollowButton = ({ props, actions }) => {
39
+ const label = typeof props['label'] === 'string' ? props['label'] : 'Follow';
40
+ return (_jsx(Button, { disabled: !actions['follow'], size: "sm", onClick: () => void actions['follow']?.(), children: label }));
41
+ };
42
+ export const socialAtoms = [
43
+ { id: 'profile-header', kinds: [0], Component: ProfileHeader },
44
+ { id: 'note-card', kinds: [1], Component: NoteCard },
45
+ { id: 'reaction-bar', kinds: [7], Component: ReactionBar },
46
+ {
47
+ id: 'follow-button',
48
+ writes: [{ name: 'toon_publish_unsigned' }],
49
+ Component: FollowButton,
50
+ },
51
+ ];
52
+ //# sourceMappingURL=social.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"social.js","sourceRoot":"","sources":["../../src/atoms/social.tsx"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,OAAO,EAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAmC,MAAM,YAAY,CAAC;AAE7D,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAC1C,CAAC;AAED,MAAM,aAAa,GAAwB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE;IACxD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,IAAI,CAAC;IACzE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,IAAI,GACR,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC;IACxD,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACt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AS,EAAE,YAAY;KACxB;CACF,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Atom contract.
3
+ *
4
+ * Atoms are pure, presentational, single-responsibility React components keyed
5
+ * by a stable `id`. The runtime resolves a node's data binding (free reads) and
6
+ * wires its write actions, then hands the atom already-resolved props. Atoms
7
+ * never call the bridge directly — they invoke the `actions` the runtime built.
8
+ */
9
+ import { type FC, type ReactNode } from 'react';
10
+ import { type NostrEvent } from '../types.js';
11
+ /**
12
+ * Outcome of a wired write action, surfaced from the runtime so atoms can render
13
+ * a receipt with the real published `eventId`. A trimmed projection of the
14
+ * bridge's `ToolOutcome`: `ok` is `false` when the action was declined (spendy
15
+ * confirm) or the tool reported failure; `eventId` / `data` carry the publish
16
+ * response (`structuredContent`) on success.
17
+ */
18
+ export interface ActionOutcome {
19
+ ok: boolean;
20
+ /** Published event id when the tool returned one (e.g. `toon_publish_unsigned`). */
21
+ eventId?: string;
22
+ /** Raw structured payload from the tool result. */
23
+ data?: unknown;
24
+ /** Error text when `ok` is false. */
25
+ error?: string;
26
+ }
27
+ /** A wired write action; runtimeArgs are merged over the ViewSpec's static args.
28
+ * Resolves to an {@link ActionOutcome} (`ok` plus the published `eventId`/`data`),
29
+ * or `void` if the call site doesn't read it. */
30
+ export type AtomAction = (runtimeArgs?: Record<string, unknown>) => ActionOutcome | void | Promise<ActionOutcome | void>;
31
+ /**
32
+ * The current pay-to-write status, as surfaced by the `toon_status` tool. Atoms
33
+ * that show a fee (e.g. the pay-confirm receipt) read it via
34
+ * {@link AtomRenderProps.readStatus} rather than hardcoding it.
35
+ */
36
+ export interface AtomStatus {
37
+ feePerEvent: string;
38
+ settlementChain: string;
39
+ asset?: string;
40
+ }
41
+ export interface AtomRenderProps {
42
+ /** Events resolved from the node's `bind` (empty when there is no binding). */
43
+ events: NostrEvent[];
44
+ /** Static props from the ViewSpec node. */
45
+ props: Record<string, unknown>;
46
+ /** Write actions declared on the node, wired to the bridge by the runtime. */
47
+ actions: Record<string, AtomAction>;
48
+ /** Rendered child nodes. */
49
+ children: ReactNode;
50
+ /** Render one event via its kind's default atom (for feeds/lists/kindAuto). */
51
+ renderEvent: (event: NostrEvent) => ReactNode;
52
+ /**
53
+ * Fetch the live pay-to-write status (`toon_status`) — the fee + settlement
54
+ * chain to show before a paid write. Wired to the bridge by the runtime;
55
+ * `undefined` only in older render paths / tests that don't provide it. Atoms
56
+ * never call the bridge directly, so this is the single read seam for the fee.
57
+ */
58
+ readStatus?: () => Promise<AtomStatus>;
59
+ }
60
+ /** A registered atom. */
61
+ export interface Atom {
62
+ id: string;
63
+ /** Event kinds this atom is the default renderer for (kindAuto / feeds). */
64
+ kinds?: number[];
65
+ /** Write tools this atom can fire (informational; the runtime wires them). */
66
+ writes?: {
67
+ name: string;
68
+ spendy?: boolean;
69
+ }[];
70
+ Component: FC<AtomRenderProps>;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/atoms/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;iDAEiD;AACjD,MAAM,MAAM,UAAU,GAAG,CACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAClC,aAAa,GAAG,IAAI,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACpC,4BAA4B;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,+EAA+E;IAC/E,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,SAAS,CAAC;IAC9C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACxC;AAED,yBAAyB;AACzB,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,8EAA8E;IAC9E,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC9C,SAAS,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC;CAChC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Atom contract.
3
+ *
4
+ * Atoms are pure, presentational, single-responsibility React components keyed
5
+ * by a stable `id`. The runtime resolves a node's data binding (free reads) and
6
+ * wires its write actions, then hands the atom already-resolved props. Atoms
7
+ * never call the bridge directly — they invoke the `actions` the runtime built.
8
+ */
9
+ import {} from 'react';
10
+ import {} from '../types.js';
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/atoms/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,EAAmB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Pure atom catalog — Node-safe metadata (no React).
3
+ *
4
+ * This is the single source of truth for which atom ids exist, what kinds they
5
+ * render, and which writes they expose. The client-side React registry
6
+ * ({@link ./atoms/registry}) is asserted to match this list in tests, and the
7
+ * server-side `toon_atoms` tool + ViewSpec validator allowlist read from here so
8
+ * `@toon-protocol/client-mcp` never imports the React bundle.
9
+ */
10
+ export interface AtomWriteMeta {
11
+ name: string;
12
+ spendy?: boolean;
13
+ }
14
+ export interface AtomMeta {
15
+ id: string;
16
+ description: string;
17
+ /** Event kinds this atom is the default renderer for. */
18
+ kinds?: number[];
19
+ /** Write tools this atom can fire. */
20
+ writes?: AtomWriteMeta[];
21
+ /** Human/agent-readable hint of the props the atom accepts. */
22
+ propsSchema?: Record<string, string>;
23
+ }
24
+ export declare const ATOM_CATALOG: AtomMeta[];
25
+ /** All catalog atom ids (the ViewSpec validator allowlist). */
26
+ export declare const CATALOG_ATOM_IDS: ReadonlySet<string>;
27
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,sCAAsC;IACtC,MAAM,CAAC,EAAE,aAAa,EAAE,CAAC;IACzB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,EAAE,QAAQ,EAsHlC,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAA0C,CAAC"}
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Pure atom catalog — Node-safe metadata (no React).
3
+ *
4
+ * This is the single source of truth for which atom ids exist, what kinds they
5
+ * render, and which writes they expose. The client-side React registry
6
+ * ({@link ./atoms/registry}) is asserted to match this list in tests, and the
7
+ * server-side `toon_atoms` tool + ViewSpec validator allowlist read from here so
8
+ * `@toon-protocol/client-mcp` never imports the React bundle.
9
+ */
10
+ import { OPEN_CHANNEL_TOOL, SWAP_TOOL } from './tool-names.js';
11
+ export const ATOM_CATALOG = [
12
+ // layout
13
+ {
14
+ id: 'stack',
15
+ description: 'Vertical (default) or horizontal stack of child nodes.',
16
+ propsSchema: { direction: "'row' | 'col'", gap: 'number (tailwind gap step)' },
17
+ },
18
+ { id: 'section', description: 'Titled section wrapper.', propsSchema: { title: 'string' } },
19
+ { id: 'card', description: 'Bordered card container.' },
20
+ {
21
+ id: 'tabs',
22
+ description: 'Tabbed container; one child node per tab. Use for multi-section journeys.',
23
+ propsSchema: { labels: 'string[] (tab names, in child order)' },
24
+ },
25
+ // social
26
+ { id: 'profile-header', description: 'NIP-01 kind:0 profile header (avatar, name, nip05, bio).', kinds: [0] },
27
+ { id: 'note-card', description: 'NIP-01 kind:1 text note; optional "reply" action.', kinds: [1] },
28
+ { id: 'reaction-bar', description: 'NIP-25 kind:7 reaction counts; optional "react" action.', kinds: [7] },
29
+ {
30
+ id: 'follow-button',
31
+ description: 'NIP-02 follow/unfollow (publishes kind:3).',
32
+ writes: [{ name: 'toon_publish_unsigned' }],
33
+ propsSchema: { label: 'string' },
34
+ },
35
+ {
36
+ id: 'composer',
37
+ description: 'Text composer that publishes a note (kind:1) via its "post" action.',
38
+ writes: [{ name: 'toon_publish_unsigned' }],
39
+ propsSchema: { placeholder: 'string', label: 'string' },
40
+ },
41
+ {
42
+ id: 'pay-confirm',
43
+ description: 'Pay-to-write moment: compose a note, then a confirm step shows the live ' +
44
+ 'fee + settlement chain (from toon_status) with Confirm/Cancel. Confirm ' +
45
+ 'fires the "confirm" action (toon_publish_unsigned) and renders a receipt ' +
46
+ 'with the published eventId — "the message is the money".',
47
+ writes: [{ name: 'toon_publish_unsigned' }],
48
+ propsSchema: { placeholder: 'string', label: 'string (compose button label)' },
49
+ },
50
+ // media
51
+ {
52
+ id: 'media-embed',
53
+ description: 'Render image/video streamed from Arweave (NIP-68/71/94).',
54
+ kinds: [20, 21, 22, 1063],
55
+ },
56
+ {
57
+ id: 'media-uploader',
58
+ description: 'Upload media to Arweave then publish a media event. Spendy.',
59
+ writes: [{ name: 'toon_upload_media', spendy: true }],
60
+ propsSchema: { label: 'string' },
61
+ },
62
+ // forge
63
+ { id: 'repo-card', description: 'NIP-34 kind:30617 repository card.', kinds: [30617] },
64
+ {
65
+ id: 'issue-card',
66
+ description: 'NIP-34 kind:1621 issue; optional "comment" action.',
67
+ kinds: [1621],
68
+ writes: [{ name: 'toon_publish_unsigned' }],
69
+ },
70
+ { id: 'pr-card', description: 'NIP-34 kind:1617 patch/PR summary (status, commits, base).', kinds: [1617] },
71
+ {
72
+ id: 'comment-thread',
73
+ description: 'NIP-34 kind:1622 comment list; optional "comment" action.',
74
+ kinds: [1622],
75
+ writes: [{ name: 'toon_publish_unsigned' }],
76
+ },
77
+ // defi
78
+ {
79
+ id: 'channel-card',
80
+ description: 'Read-only: shows tracked payment channels (channelId, nonce, cumulative ' +
81
+ 'amount). Optional "open" action pre-opens a channel.',
82
+ kinds: [],
83
+ writes: [{ name: OPEN_CHANNEL_TOOL }],
84
+ propsSchema: { destination: 'string (optional ILP destination for "open")' },
85
+ },
86
+ {
87
+ id: 'swap-form',
88
+ description: 'Interactive: collects swap params and fires a cross-asset swap. Spendy.',
89
+ writes: [{ name: SWAP_TOOL, spendy: true }],
90
+ propsSchema: {
91
+ destination: 'string (mill ILP destination)',
92
+ millPubkey: 'string (mill 64-char hex Nostr pubkey)',
93
+ pair: 'SwapPair ({ from, to, rate, … })',
94
+ chainRecipient: 'string (payout address on pair.to.chain)',
95
+ label: 'string (submit button label)',
96
+ },
97
+ },
98
+ {
99
+ id: 'settlement-receipt',
100
+ description: 'Read-only render of a SwapResponse / SwapClaim[] (target amount, chain ' +
101
+ 'claim, channelId, tx/claim id, nonce). No writes.',
102
+ },
103
+ // onboard
104
+ {
105
+ id: 'onboard-card',
106
+ description: 'Onboarding / get-started card: walks a new user through claiming an ' +
107
+ 'identity and opening a payment channel before they pay-to-write. Optional ' +
108
+ '"publish" action publishes their initial kind:0 profile.',
109
+ writes: [{ name: 'toon_publish_unsigned' }],
110
+ propsSchema: {
111
+ pubkey: 'string (the user’s Nostr pubkey, hex)',
112
+ steps: 'string[] (optional checklist of get-started steps)',
113
+ label: 'string (optional publish-profile button label)',
114
+ },
115
+ },
116
+ // fallback
117
+ { id: 'generic-event', description: 'Fallback: decoded JSON + tags for any kind without a bespoke atom.' },
118
+ ];
119
+ /** All catalog atom ids (the ViewSpec validator allowlist). */
120
+ export const CATALOG_ATOM_IDS = new Set(ATOM_CATALOG.map((a) => a.id));
121
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../src/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAkB/D,MAAM,CAAC,MAAM,YAAY,GAAe;IACtC,SAAS;IACT;QACE,EAAE,EAAE,OAAO;QACX,WAAW,EAAE,wDAAwD;QACrE,WAAW,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,4BAA4B,EAAE;KAC/E;IACD,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,yBAAyB,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE;IAC3F,EAA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K,EAAE,8BAA8B;SACtC;KACF;IACD;QACE,EAAE,EAAE,oBAAoB;QACxB,WAAW,EACT,yEAAyE;YACzE,mDAAmD;KACtD;IAED,UAAU;IACV;QACE,EAAE,EAAE,cAAc;QAClB,WAAW,EACT,sEAAsE;YACtE,4EAA4E;YAC5E,0DAA0D;QAC5D,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC;QAC3C,WAAW,EAAE;YACX,MAAM,EAAE,uCAAuC;YAC/C,KAAK,EAAE,oDAAoD;YAC3D,KAAK,EAAE,gDAAgD;SACxD;KACF;IAED,WAAW;IACX,EAAE,EAAE,EAAE,eAAe,EAAE,WAAW,EAAE,oEAAoE,EAAE;CAC3G,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * MonoId — renders a protocol address (pubkey, event ID, channel ID) as a
3
+ * bold·dim·bold split so the head and tail read as distinct identity markers.
4
+ *
5
+ * npub1abc1234…ef56 → [bold: npub1abc] [dim: …] [bold: ef56]
6
+ */
7
+ import * as React from 'react';
8
+ interface MonoIdProps {
9
+ value: string;
10
+ prefixLen?: number;
11
+ suffixLen?: number;
12
+ className?: string;
13
+ }
14
+ export declare function MonoId({ value, prefixLen, suffixLen, className }: MonoIdProps): React.JSX.Element;
15
+ export {};
16
+ //# sourceMappingURL=mono-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mono-id.d.ts","sourceRoot":"","sources":["../../src/components/mono-id.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,SAAa,EAAE,SAAa,EAAE,SAAS,EAAE,EAAE,WAAW,qBAarF"}