@bwalletx/connect 0.2.0 → 0.3.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/shell/index.ts","../src/shell/manifest.ts","../src/shell/wallet.ts","../src/shell/elements.ts"],"sourcesContent":["/**\n * @bwalletx/connect/shell — the bApp shell: manifest, web bar/topbar/drawer, in-wallet bridge.\n *\n * import { defineBappShell, loadManifest, applyManifest, startShellBridge } from '@bwalletx/connect/shell';\n * defineBappShell();\n * const manifest = await loadManifest(); // /.well-known/bapp.json\n * applyManifest(manifest);\n * startShellBridge({ manifest }); // in-wallet: hide bar, follow bapp:navigate\n */\nexport * from './manifest.js';\nexport * from './wallet.js';\nexport * from './elements.js';\n","/**\n * bApp manifest: /.well-known/bapp.json. One file declares the app's five scoped slots, its drawer\n * (Home + sections) and its like-to-fund config. The web bar draws from it; inside bWalletX the\n * wallet's native dock reads the same file. Every path is same-origin: no URLs, no schemes.\n */\n\nexport const SLOT_IDS = ['wallet', 'exchange', 'b', 'feed', 'chat'] as const;\nexport type SlotId = (typeof SLOT_IDS)[number];\n\nexport interface BappSlot {\n /** Same-origin path, e.g. \"/feed\". Required when enabled, except for \"b\" (the agent). */\n path?: string;\n /** Optional rename (\"Market\"); the icon and position never change. */\n label?: string;\n /** false = shown greyed out and not clickable. Slots are never hidden. */\n enabled: boolean;\n}\n\nexport interface BappDrawerItem {\n label: string;\n path: string;\n /** Optional same-origin icon path. */\n icon?: string;\n}\n\nexport interface BappLikeConfig {\n /** Which fields of a feed item hold the id, token (BSV-21 id / $TICKER), payee, title and media. */\n fields: { id: string; token: string; payee?: string; title?: string; media?: string };\n /** Price of one Like in US cents. Default 1 (one PNEE). */\n amountCents: number;\n /** Pay in PNEE (the wallet's USD-cent token) when held, else BSV. Default \"PNEE\". */\n currency: 'PNEE' | 'BSV';\n /** Daily cap in US cents. Default 100 ($1), never more. */\n dailyCapCents: number;\n}\n\nexport interface BappTheme {\n /** Active/accent colour, #RRGGBB. Default #FFD24D. */\n accent?: string;\n}\n\nexport interface BappManifest {\n version: 1;\n name: string;\n /** Same-origin path to a square icon. */\n icon: string;\n /** The app's Home (first drawer item). Default \"/\". */\n home: string;\n theme?: BappTheme;\n slots: Record<SlotId, BappSlot>;\n drawer: BappDrawerItem[];\n like?: BappLikeConfig;\n}\n\nexport type ValidationResult =\n | { ok: true; manifest: BappManifest; errors: [] }\n | { ok: false; errors: string[]; manifest?: undefined };\n\nexport const WELL_KNOWN_PATH = '/.well-known/bapp.json';\nexport const LIKE_DEFAULT_CENTS = 1;\nexport const LIKE_MAX_DAILY_CENTS = 100;\n\n/**\n * A same-origin path: starts with one \"/\", no \"//\" (protocol-relative), no backslashes, no control\n * characters, no scheme. Query and hash are allowed.\n */\nexport function isSameOriginPath(p: unknown): p is string {\n if (typeof p !== 'string' || p.length === 0 || p.length > 512) return false;\n if (p[0] !== '/' || p[1] === '/' || p[1] === '\\\\') return false;\n if (/[\\\\\\u0000-\\u001f\\u007f\\s]/.test(p)) return false;\n // Resolving against a dummy origin must not change origin.\n try {\n return new URL(p, 'https://bapp.invalid').origin === 'https://bapp.invalid';\n } catch {\n return false;\n }\n}\n\nconst isObj = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v);\nconst str = (v: unknown, max = 64): v is string => typeof v === 'string' && v.trim().length > 0 && v.length <= max;\n\n/** Validate and normalise a parsed bapp.json. Never throws. */\nexport function validateManifest(input: unknown): ValidationResult {\n const errors: string[] = [];\n if (!isObj(input)) return { ok: false, errors: ['manifest must be a JSON object'] };\n const m = input;\n const known = new Set(['$schema', 'version', 'name', 'icon', 'home', 'theme', 'slots', 'drawer', 'like']);\n for (const k of Object.keys(m)) if (!known.has(k)) errors.push(`unknown field \"${k}\"`);\n\n if (m.version !== 1) errors.push('version must be 1');\n if (!str(m.name, 40)) errors.push('name must be a non-empty string (max 40)');\n if (!isSameOriginPath(m.icon)) errors.push('icon must be a same-origin path starting with \"/\"');\n const home = m.home === undefined ? '/' : m.home;\n if (!isSameOriginPath(home)) errors.push('home must be a same-origin path starting with \"/\"');\n\n let theme: BappTheme | undefined;\n if (m.theme !== undefined) {\n if (!isObj(m.theme)) errors.push('theme must be an object');\n else {\n for (const k of Object.keys(m.theme)) if (k !== 'accent') errors.push(`unknown field \"theme.${k}\"`);\n if (m.theme.accent !== undefined && !(typeof m.theme.accent === 'string' && /^#[0-9a-fA-F]{6}$/.test(m.theme.accent)))\n errors.push('theme.accent must be #RRGGBB');\n theme = m.theme.accent ? { accent: m.theme.accent as string } : {};\n }\n }\n\n const slots = {} as Record<SlotId, BappSlot>;\n if (!isObj(m.slots)) errors.push('slots must be an object with wallet, exchange, b, feed, chat');\n else {\n for (const k of Object.keys(m.slots)) if (!(SLOT_IDS as readonly string[]).includes(k)) errors.push(`unknown slot \"${k}\"`);\n for (const id of SLOT_IDS) {\n const s = m.slots[id];\n if (!isObj(s)) { errors.push(`slots.${id} is required (use \"enabled\": false for an unused slot)`); continue; }\n for (const k of Object.keys(s)) if (!['path', 'label', 'enabled'].includes(k)) errors.push(`unknown field \"slots.${id}.${k}\"`);\n if (typeof s.enabled !== 'boolean') errors.push(`slots.${id}.enabled must be true or false`);\n if (s.path !== undefined && !isSameOriginPath(s.path)) errors.push(`slots.${id}.path must be a same-origin path starting with \"/\"`);\n if (s.enabled === true && s.path === undefined && id !== 'b') errors.push(`slots.${id}.path is required when enabled`);\n if (s.label !== undefined && !str(s.label, 12)) errors.push(`slots.${id}.label must be a short string (max 12)`);\n slots[id] = { enabled: s.enabled === true, ...(s.path !== undefined ? { path: s.path as string } : {}), ...(s.label !== undefined ? { label: s.label as string } : {}) };\n }\n }\n\n const drawer: BappDrawerItem[] = [];\n if (m.drawer !== undefined) {\n if (!Array.isArray(m.drawer)) errors.push('drawer must be an array');\n else if (m.drawer.length > 24) errors.push('drawer has more than 24 items');\n else m.drawer.forEach((d, i) => {\n if (!isObj(d)) { errors.push(`drawer[${i}] must be an object`); return; }\n for (const k of Object.keys(d)) if (!['label', 'path', 'icon'].includes(k)) errors.push(`unknown field \"drawer[${i}].${k}\"`);\n if (!str(d.label, 40)) errors.push(`drawer[${i}].label must be a non-empty string (max 40)`);\n if (!isSameOriginPath(d.path)) errors.push(`drawer[${i}].path must be a same-origin path starting with \"/\"`);\n if (d.icon !== undefined && !isSameOriginPath(d.icon)) errors.push(`drawer[${i}].icon must be a same-origin path starting with \"/\"`);\n drawer.push({ label: d.label as string, path: d.path as string, ...(d.icon ? { icon: d.icon as string } : {}) });\n });\n }\n\n let like: BappLikeConfig | undefined;\n if (m.like !== undefined) {\n const l = m.like;\n if (!isObj(l)) errors.push('like must be an object');\n else {\n for (const k of Object.keys(l)) if (!['fields', 'amountCents', 'currency', 'dailyCapCents'].includes(k)) errors.push(`unknown field \"like.${k}\"`);\n const f = l.fields;\n if (!isObj(f) || !str(f.id) || !str(f.token)) errors.push('like.fields needs \"id\" and \"token\" field names');\n else for (const k of ['payee', 'title', 'media']) if (f[k] !== undefined && !str(f[k])) errors.push(`like.fields.${k} must be a field name`);\n const amount = l.amountCents ?? LIKE_DEFAULT_CENTS;\n const cap = l.dailyCapCents ?? LIKE_MAX_DAILY_CENTS;\n const currency = l.currency ?? 'PNEE';\n if (!Number.isInteger(amount) || (amount as number) < 1) errors.push('like.amountCents must be a whole number of cents, at least 1');\n if (!Number.isInteger(cap) || (cap as number) < 1 || (cap as number) > LIKE_MAX_DAILY_CENTS) errors.push('like.dailyCapCents must be 1..100 ($1 max)');\n else if (Number.isInteger(amount) && (amount as number) > (cap as number)) errors.push('like.amountCents cannot exceed like.dailyCapCents');\n if (currency !== 'PNEE' && currency !== 'BSV') errors.push('like.currency must be \"PNEE\" or \"BSV\"');\n if (isObj(f)) {\n const fields: BappLikeConfig['fields'] = { id: f.id as string, token: f.token as string };\n for (const k of ['payee', 'title', 'media'] as const) if (typeof f[k] === 'string') fields[k] = f[k] as string;\n like = { fields, amountCents: amount as number, currency: currency as 'PNEE' | 'BSV', dailyCapCents: cap as number };\n }\n }\n }\n\n if (errors.length) return { ok: false, errors };\n return {\n ok: true,\n errors: [],\n manifest: {\n version: 1, name: (m.name as string).trim(), icon: m.icon as string, home: home as string,\n ...(theme ? { theme } : {}), slots, drawer, ...(like ? { like } : {}),\n },\n };\n}\n\n/** Same as validateManifest but throws with every error listed. */\nexport function parseManifest(input: unknown): BappManifest {\n const r = validateManifest(input);\n if (!r.ok) throw new Error(`Invalid bapp.json:\\n- ${r.errors.join('\\n- ')}`);\n return r.manifest;\n}\n\n/** Fetch and validate /.well-known/bapp.json (same origin). */\nexport async function loadManifest(path: string = WELL_KNOWN_PATH, fetchImpl: typeof fetch = fetch): Promise<BappManifest> {\n if (!isSameOriginPath(path)) throw new Error('loadManifest: path must be same-origin');\n const res = await fetchImpl(path, { credentials: 'same-origin', headers: { accept: 'application/json' } });\n if (!res.ok) throw new Error(`loadManifest: ${path} returned ${res.status}`);\n return parseManifest(await res.json());\n}\n\n/** The path a slot points at, or null when disabled / no path. */\nexport function slotPath(m: BappManifest, slot: SlotId): string | null {\n const s = m.slots[slot];\n return s && s.enabled && s.path ? s.path : null;\n}\n\nexport const isSlotId = (v: unknown): v is SlotId => typeof v === 'string' && (SLOT_IDS as readonly string[]).includes(v);\n","/**\n * In-wallet mode. Inside bWalletX the wallet draws the dock natively; the app hides its web bar,\n * follows `bapp:navigate {slot}` from the wallet, and reports `bapp:active {slot}` back.\n * Protocol: docs/SHELL-PROTOCOL.md.\n */\nimport { isSlotId, slotPath, type BappManifest, type SlotId } from './manifest.js';\n\n/** Wallet web origins allowed to drive a framed bApp. Extension origins are passed in by the app. */\nexport const DEFAULT_WALLET_ORIGINS: readonly string[] = ['https://web.bwalletx.com', 'https://bwalletx.com'];\n\nexport type WalletVia = 'ua' | 'frame' | null;\nexport interface WalletDetection {\n inWallet: boolean;\n via: WalletVia;\n /** Bottom inset (px) the wallet reserves, from `bWalletInset/<n>`. */\n inset?: number;\n}\n\nconst UA_RE = /\\b(?:bWallet|YoursWalletMobile)\\//;\nconst INSET_RE = /\\bbWalletInset\\/(\\d{1,4})\\b/;\n\n/** Synchronous detection from the user agent (native app webviews). */\nexport function detectWalletUA(ua: string = typeof navigator !== 'undefined' ? navigator.userAgent : ''): WalletDetection {\n const inset = INSET_RE.exec(ua);\n if (inset || UA_RE.test(ua)) return { inWallet: true, via: 'ua', ...(inset ? { inset: Number(inset[1]) } : {}) };\n return { inWallet: false, via: null };\n}\n\nlet state: WalletDetection = { inWallet: false, via: null };\n/** Current detection (UA, or a completed frame handshake). */\nexport function walletState(): WalletDetection { return state; }\n\nfunction setState(next: WalletDetection, win: Window): void {\n state = next;\n if (next.inWallet) win.document?.documentElement?.setAttribute('data-bwx-in-wallet', next.via ?? '');\n win.dispatchEvent(new CustomEvent('bapp-wallet', { detail: next }));\n}\n\nexport interface ShellBridgeOptions {\n manifest: BappManifest;\n /** Allowed wallet origins for framed mode (exact match). Default DEFAULT_WALLET_ORIGINS. */\n walletOrigins?: readonly string[];\n /** Default: window. */\n win?: Window;\n /** Default: navigator.userAgent. */\n userAgent?: string;\n}\n\ntype Msg = { type?: unknown; v?: unknown; slot?: unknown };\n\n/**\n * Listens for the wallet and keeps it in sync. Navigation is dispatched as a cancelable\n * `bapp-navigate` event on window ({slot, path, source:'wallet'}); if nobody calls\n * preventDefault() the page goes to the slot's path with location.assign.\n */\nexport class ShellBridge {\n readonly manifest: BappManifest;\n private readonly origins: readonly string[];\n private readonly win: Window;\n private target: { win: Window; origin: string } | null = null;\n private active: SlotId | null = null;\n private readonly onMessage = (e: MessageEvent) => this.handle(e);\n private readonly onActive = (e: Event) => { const s = (e as CustomEvent).detail?.slot; if (isSlotId(s)) this.setActive(s); };\n private readonly onMenu = () => this.post({ type: 'bapp:menu' });\n private readonly onClose = () => this.post({ type: 'bapp:close' });\n\n constructor(opts: ShellBridgeOptions) {\n this.manifest = opts.manifest;\n this.origins = opts.walletOrigins ?? DEFAULT_WALLET_ORIGINS;\n this.win = opts.win ?? window;\n const ua = detectWalletUA(opts.userAgent);\n if (ua.inWallet) {\n // Native webview: the wallet injects messages into the page itself.\n this.target = { win: this.win, origin: this.win.location.origin };\n setState(ua, this.win);\n }\n }\n\n start(): this {\n this.win.addEventListener('message', this.onMessage);\n this.win.addEventListener('bapp-active', this.onActive);\n this.win.addEventListener('bapp-menu', this.onMenu);\n this.win.addEventListener('bapp-close', this.onClose);\n return this;\n }\n\n stop(): void {\n this.win.removeEventListener('message', this.onMessage);\n this.win.removeEventListener('bapp-active', this.onActive);\n this.win.removeEventListener('bapp-menu', this.onMenu);\n this.win.removeEventListener('bapp-close', this.onClose);\n }\n\n get inWallet(): boolean { return this.target !== null; }\n\n /** Tell the wallet which slot is showing (lights up the native dock). */\n setActive(slot: SlotId): void {\n this.active = slot;\n this.post({ type: 'bapp:active', v: 1, slot });\n }\n\n /** Is this message from a trusted wallet? */\n trusted(e: MessageEvent): boolean {\n const parent = this.win.parent;\n // Framed: only our direct parent, only an allowlisted origin.\n if (parent && parent !== this.win && e.source === parent) return this.origins.includes(e.origin);\n // Native webview (UA detected): injected into this page, so same window and same origin.\n if (this.target?.win === this.win && (e.source === this.win || e.source === null)) return e.origin === this.win.location.origin;\n return false;\n }\n\n private handle(e: MessageEvent): void {\n const d = e.data as Msg;\n if (!d || typeof d !== 'object' || typeof d.type !== 'string' || !d.type.startsWith('bapp:')) return;\n if (!this.trusted(e)) return;\n if (d.type === 'bapp:hello') {\n if (!this.target) {\n this.target = { win: e.source as Window, origin: e.origin };\n setState({ inWallet: true, via: 'frame' }, this.win);\n }\n this.post({ type: 'bapp:ready', v: 1, manifest: '/.well-known/bapp.json', ...(this.active ? { slot: this.active } : {}) });\n return;\n }\n if (d.type === 'bapp:navigate') {\n if (!isSlotId(d.slot)) return; // never a URL, only a slot id\n const path = slotPath(this.manifest, d.slot);\n if (d.slot !== 'b' && !path) return; // disabled or not in the manifest\n if (d.slot === 'b' && !this.manifest.slots.b.enabled) return;\n const ev = new CustomEvent('bapp-navigate', { cancelable: true, detail: { slot: d.slot, path, source: 'wallet' } });\n this.win.dispatchEvent(ev);\n if (!ev.defaultPrevented && path) this.win.location.assign(path);\n this.setActive(d.slot);\n }\n }\n\n private post(msg: Record<string, unknown>): void {\n if (!this.target) return;\n const { win, origin } = this.target;\n // Native webviews expose ReactNativeWebView; fall back to postMessage to self.\n const rn = (this.win as unknown as { ReactNativeWebView?: { postMessage(s: string): void } }).ReactNativeWebView;\n if (win === this.win && rn) rn.postMessage(JSON.stringify(msg));\n else win.postMessage(msg, origin);\n }\n}\n\n/** Convenience: create and start a bridge. */\nexport function startShellBridge(opts: ShellBridgeOptions): ShellBridge {\n return new ShellBridge(opts).start();\n}\n\n/** Test hook. */\nexport function _resetWalletState(): void { state = { inWallet: false, via: null }; }\n","/**\n * <bwalletx-bar>, <bwalletx-topbar>, <bwalletx-drawer>: the bApp shell drawn on the web.\n * Values match the bWalletX Dock exactly (see docs/BAPP-SHELL in the wallet repo).\n * Framework-free; React wrappers in ./react.ts.\n */\nimport { SLOT_IDS, isSlotId, slotPath, type BappManifest, type SlotId } from './manifest.js';\nimport { detectWalletUA, walletState } from './wallet.js';\n\nexport const TOKENS = {\n barHeight: 88, barBg: '#0A0B0D', hairline: '#1C1C1E', icon: 20, active: '#FFD24D', inactive: '#F2F2F0',\n label: '#98A2B3', bSize: 52, stripHeight: 28, rowHeight: 56, tool: 36, toolRing: '#2A2A2C', toolIcon: '#F5B800',\n} as const;\n\nconst DEFAULT_LABELS: Record<SlotId, string> = { wallet: 'Wallet', exchange: 'Exchange', b: 'b', feed: 'Feed', chat: 'Chat' };\nconst svg = (d: string) => `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">${d}</svg>`;\nexport const ICONS = {\n wallet: svg('<rect x=\"3\" y=\"6\" width=\"18\" height=\"13\" rx=\"2\"/><path d=\"M3 10h18\"/>'),\n exchange: svg('<path d=\"M7 4v16M3 8l4-4 4 4M17 20V4M13 16l4 4 4-4\"/>'),\n feed: svg('<rect x=\"4\" y=\"4\" width=\"16\" height=\"16\" rx=\"2\"/><path d=\"M8 9h8M8 13h8M8 17h5\"/>'),\n chat: svg('<path d=\"M21 12a8 8 0 0 1-12 7l-5 1 1-4a8 8 0 1 1 16-4z\"/>'),\n menu: svg('<path d=\"M4 6h16M4 12h16M4 18h16\"/>'),\n close: svg('<path d=\"M6 6l12 12M18 6L6 18\"/>'),\n};\n\nconst esc = (s: string) => s.replace(/[&<>\"']/g, (c) => `&#${c.charCodeAt(0)};`);\nconst Base: typeof HTMLElement = typeof HTMLElement === 'undefined' ? (class {} as unknown as typeof HTMLElement) : HTMLElement;\n\n/** in-wallet attribute: \"true\" / \"false\" force it; anything else = auto-detect. */\nfunction inWallet(el: HTMLElement): boolean {\n const a = el.getAttribute('in-wallet');\n if (a === 'true' || a === '') return true;\n if (a === 'false') return false;\n return walletState().inWallet || detectWalletUA().inWallet;\n}\n\nfunction emit(el: HTMLElement, type: string, detail: unknown, cancelable = false): boolean {\n return el.dispatchEvent(new CustomEvent(type, { detail, bubbles: true, composed: true, cancelable }));\n}\n\n/** Fire bapp-navigate; unless prevented (or navigate=\"manual\"), go to the path. */\nfunction navigate(el: HTMLElement, detail: { slot?: SlotId; path: string | null }): void {\n const ok = emit(el, 'bapp-navigate', { ...detail, source: 'web' }, true);\n if (ok && detail.path && el.getAttribute('navigate') !== 'manual') location.assign(detail.path);\n}\n\nabstract class ShellElement extends Base {\n protected _manifest: BappManifest | null = null;\n private readonly onWallet = () => this.render();\n get manifest(): BappManifest | null { return this._manifest; }\n set manifest(m: BappManifest | null) { this._manifest = m; this.render(); }\n connectedCallback(): void {\n if (!this.shadowRoot) this.attachShadow({ mode: 'open' });\n window.addEventListener('bapp-wallet', this.onWallet);\n this.render();\n }\n disconnectedCallback(): void { window.removeEventListener('bapp-wallet', this.onWallet); }\n attributeChangedCallback(): void { if (this.shadowRoot) this.render(); }\n protected accent(): string { return this._manifest?.theme?.accent ?? TOKENS.active; }\n abstract render(): void;\n}\n\n// ---------------------------------------------------------------- <bwalletx-bar>\nconst BAR_CSS = `\n:host{display:block;--bwx-accent:${TOKENS.active}}\n:host([hidden]),:host([data-in-wallet]){display:none!important}\nnav{height:${TOKENS.barHeight}px;box-sizing:border-box;background:${TOKENS.barBg};border-top:1px solid ${TOKENS.hairline};\n display:flex;align-items:flex-start;padding:10px 0 env(safe-area-inset-bottom,0);font:10px/1.2 -apple-system,BlinkMacSystemFont,\"SF Pro Text\",system-ui,sans-serif}\nbutton{all:unset;box-sizing:border-box;flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer;\n color:${TOKENS.inactive};-webkit-tap-highlight-color:transparent;touch-action:manipulation}\nbutton:focus-visible{outline:2px solid var(--bwx-accent);outline-offset:2px;border-radius:10px}\nbutton svg{width:${TOKENS.icon}px;height:${TOKENS.icon}px}\n.lbl{font-size:10px;color:${TOKENS.label};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}\nbutton[aria-current=\"page\"]{color:var(--bwx-accent)}\nbutton[aria-current=\"page\"] .lbl{color:var(--bwx-accent);font-weight:700}\nbutton:disabled{opacity:.35;cursor:default;pointer-events:none}\n.b{width:${TOKENS.bSize}px;height:${TOKENS.bSize}px;border-radius:50%;background:#000;border:2px solid var(--bwx-accent);box-sizing:border-box;\n display:grid;place-items:center;font:800 24px/1 Georgia,\"Times New Roman\",serif;color:var(--bwx-accent);margin-top:-4px}\nbutton[data-slot=\"b\"][aria-current=\"page\"] .b{box-shadow:0 0 0 3px #FFD24D33}\n`;\n\nexport class BwalletxBarElement extends ShellElement {\n static observedAttributes = ['active', 'in-wallet', 'hidden'];\n private holdTimer: ReturnType<typeof setTimeout> | null = null;\n private held = false;\n get active(): SlotId | null { const a = this.getAttribute('active'); return isSlotId(a) ? a : null; }\n set active(s: SlotId | null) {\n if (s) this.setAttribute('active', s); else this.removeAttribute('active');\n }\n attributeChangedCallback(name?: string, old?: string | null, val?: string | null): void {\n super.attributeChangedCallback();\n if (name === 'active' && val !== old && isSlotId(val)) emit(this, 'bapp-active', { slot: val });\n }\n render(): void {\n const root = this.shadowRoot;\n if (!root) return;\n if (inWallet(this)) this.setAttribute('data-in-wallet', ''); else this.removeAttribute('data-in-wallet');\n const m = this._manifest;\n const active = this.active;\n const slots = SLOT_IDS.map((id) => {\n const s = m?.slots[id];\n const enabled = !!s?.enabled;\n const label = s?.label ?? DEFAULT_LABELS[id];\n const cur = active === id ? ' aria-current=\"page\"' : '';\n const dis = enabled ? '' : ' disabled aria-disabled=\"true\"';\n if (id === 'b') return `<button type=\"button\" data-slot=\"b\" aria-label=\"b agent${m ? ` in ${esc(m.name)}` : ''}\"${cur}${dis}><span class=\"b\">b</span></button>`;\n return `<button type=\"button\" data-slot=\"${id}\" aria-label=\"${esc(label)}\"${cur}${dis}>${ICONS[id]}<span class=\"lbl\">${esc(label)}</span></button>`;\n }).join('');\n root.innerHTML = `<style>${BAR_CSS}</style><nav part=\"bar\" aria-label=\"${m ? esc(m.name) : 'App'} navigation\" style=\"--bwx-accent:${this.accent()}\">${slots}</nav>`;\n root.querySelectorAll<HTMLButtonElement>('button[data-slot]').forEach((b) => {\n const id = b.dataset.slot as SlotId;\n if (id === 'b') this.wireB(b);\n else b.addEventListener('click', () => this.go(id));\n });\n }\n private go(id: SlotId): void {\n const m = this._manifest;\n if (!m || !m.slots[id]?.enabled) return;\n this.active = id;\n navigate(this, { slot: id, path: slotPath(m, id) });\n }\n /** (b): tap = bapp-b-press, hold (>=450ms) = bapp-b-hold {phase:'start'|'end'}. Hold-to-talk is a later phase. */\n private wireB(b: HTMLButtonElement): void {\n const clear = () => { if (this.holdTimer) clearTimeout(this.holdTimer); this.holdTimer = null; };\n b.addEventListener('pointerdown', () => {\n this.held = false; clear();\n this.holdTimer = setTimeout(() => { this.held = true; emit(this, 'bapp-b-hold', { phase: 'start' }); }, 450);\n });\n const up = () => { clear(); if (this.held) emit(this, 'bapp-b-hold', { phase: 'end' }); };\n b.addEventListener('pointerup', up);\n b.addEventListener('pointercancel', up);\n b.addEventListener('pointerleave', up);\n b.addEventListener('click', () => {\n if (this.held) { this.held = false; return; }\n if (!this._manifest?.slots.b.enabled) return;\n emit(this, 'bapp-b-press', { path: slotPath(this._manifest, 'b') });\n const p = slotPath(this._manifest, 'b');\n if (p) this.go('b');\n });\n }\n}\n\n// ---------------------------------------------------------------- <bwalletx-topbar>\nconst TOP_CSS = `\n:host{display:block;--bwx-accent:${TOKENS.active};font-family:-apple-system,BlinkMacSystemFont,\"SF Pro Text\",system-ui,sans-serif}\n:host([hidden]){display:none!important}\n.strip{height:${TOKENS.stripHeight}px;display:flex;align-items:center;justify-content:space-between;padding:0 16px;font-size:11px;color:#9a9a9a;background:${TOKENS.barBg}}\n::slotted([slot^=\"strip\"]){color:inherit}\n.row{height:${TOKENS.rowHeight}px;box-sizing:border-box;display:flex;align-items:center;gap:8px;padding:0 12px;background:${TOKENS.barBg};border-bottom:1px solid ${TOKENS.hairline}}\n.btn,::slotted([slot=\"tools\"]){all:unset;box-sizing:border-box;width:${TOKENS.tool}px;height:${TOKENS.tool}px;flex:none;border-radius:50%;border:1px solid ${TOKENS.toolRing};\n display:grid;place-items:center;color:${TOKENS.toolIcon};cursor:pointer;-webkit-tap-highlight-color:transparent}\n.btn:focus-visible{outline:2px solid var(--bwx-accent);outline-offset:2px}\n.btn svg{width:18px;height:18px}\n.app{border-color:${TOKENS.toolIcon};background:#1a1405;font-weight:800;font-size:13px;line-height:1;overflow:hidden}\n.app img{width:100%;height:100%;object-fit:cover}\n.title{flex:1;min-width:0;color:#F2F2F0;font-weight:700;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.title small{display:block;color:#777;font-weight:500;font-size:11px}\n.tools{display:flex;gap:8px}\n`;\n\nexport class BwalletxTopbarElement extends ShellElement {\n static observedAttributes = ['title', 'subtitle', 'in-wallet', 'drawer', 'menu', 'strip', 'hidden'];\n render(): void {\n const root = this.shadowRoot;\n if (!root) return;\n const m = this._manifest;\n const wallet = inWallet(this);\n const menu = wallet || this.getAttribute('menu') === 'true';\n const name = this.getAttribute('title') ?? m?.name ?? '';\n const sub = this.getAttribute('subtitle');\n const initials = name.replace(/[^A-Za-z0-9]/g, '').slice(0, 2) || 'b';\n const icon = m?.icon ? `<img src=\"${esc(m.icon)}\" alt=\"\">` : esc(initials);\n const strip = this.getAttribute('strip') !== 'off';\n root.innerHTML = `<style>${TOP_CSS}</style><header part=\"topbar\" style=\"--bwx-accent:${this.accent()}\">\n${strip ? `<div class=\"strip\" part=\"strip\"><slot name=\"strip-left\"></slot><slot name=\"strip-right\"></slot></div>` : ''}\n<div class=\"row\" part=\"row\">\n${menu ? `<button type=\"button\" class=\"btn\" data-act=\"menu\" aria-label=\"bWalletX menu\">${ICONS.menu}</button>` : ''}\n<button type=\"button\" class=\"btn app\" data-act=\"drawer\" aria-label=\"${esc(name || 'App')} home and sections\" aria-haspopup=\"true\">${icon}</button>\n<div class=\"title\" part=\"title\">${esc(name)}${sub ? `<small>${esc(sub)}</small>` : ''}</div>\n<div class=\"tools\"><slot name=\"tools\"></slot>${wallet ? `<button type=\"button\" class=\"btn\" data-act=\"close\" aria-label=\"Close ${esc(name || 'app')}\">${ICONS.close}</button>` : ''}</div>\n</div></header>`;\n root.querySelector('[data-act=\"menu\"]')?.addEventListener('click', () => emit(this, 'bapp-menu', {}));\n root.querySelector('[data-act=\"close\"]')?.addEventListener('click', () => emit(this, 'bapp-close', {}));\n root.querySelector('[data-act=\"drawer\"]')?.addEventListener('click', () => {\n if (!emit(this, 'bapp-drawer-toggle', {}, true)) return;\n const id = this.getAttribute('drawer');\n const d = (id ? document.getElementById(id) : document.querySelector('bwalletx-drawer')) as BwalletxDrawerElement | null;\n d?.toggle();\n });\n }\n}\n\n// ---------------------------------------------------------------- <bwalletx-drawer>\nconst DRAWER_CSS = `\n:host{position:fixed;inset:var(--bwx-drawer-top,84px) 0 var(--bwx-drawer-bottom,88px) 0;z-index:50;display:none;font-family:-apple-system,BlinkMacSystemFont,\"SF Pro Text\",system-ui,sans-serif}\n:host([open]){display:block}\n.scrim{position:absolute;inset:0;background:#0009}\nnav{position:absolute;top:0;left:0;bottom:0;width:min(78%,320px);box-sizing:border-box;background:#0d0e10;border-right:1px solid ${TOKENS.hairline};padding:14px;overflow:auto}\nh4{margin:10px 0 6px;font-size:11px;color:#777;letter-spacing:.08em;text-transform:uppercase;font-weight:600}\na{display:flex;align-items:center;gap:10px;padding:11px 10px;border-radius:10px;color:#F2F2F0;text-decoration:none;font-size:15px}\na img{width:20px;height:20px}\na[aria-current=\"page\"]{background:#1a1405;color:var(--bwx-accent)}\na:focus-visible{outline:2px solid var(--bwx-accent)}\nhr{border:0;border-top:1px solid ${TOKENS.hairline};margin:10px 0}\n.back{color:${TOKENS.toolIcon}}\n`;\n\nexport class BwalletxDrawerElement extends ShellElement {\n static observedAttributes = ['open', 'current', 'in-wallet'];\n get open(): boolean { return this.hasAttribute('open'); }\n set open(v: boolean) { this.toggleAttribute('open', v); }\n toggle(force?: boolean): void { this.open = force ?? !this.open; }\n render(): void {\n const root = this.shadowRoot;\n if (!root) return;\n const m = this._manifest;\n const cur = this.getAttribute('current') ?? (typeof location !== 'undefined' ? location.pathname : '/');\n const items = m ? [{ label: 'Home', path: m.home }, ...m.drawer] : [];\n const links = items.map((it, i) => `<a href=\"${esc(it.path)}\" data-i=\"${i}\"${it.path === cur ? ' aria-current=\"page\"' : ''}>${'icon' in it && it.icon ? `<img src=\"${esc(it.icon)}\" alt=\"\">` : ''}${esc(it.label)}</a>`).join('');\n const back = inWallet(this) ? `<hr><a href=\"#\" class=\"back\" data-act=\"close\">← Back to bWalletX</a>` : '';\n root.innerHTML = `<style>${DRAWER_CSS}</style><div class=\"scrim\" part=\"scrim\"></div><nav part=\"drawer\" aria-label=\"${m ? esc(m.name) : 'App'} sections\" style=\"--bwx-accent:${this.accent()}\"><h4>${m ? esc(m.name) : ''}</h4>${links}${back}</nav>`;\n root.querySelector('.scrim')!.addEventListener('click', () => this.toggle(false));\n root.querySelectorAll<HTMLAnchorElement>('a[data-i]').forEach((a) => a.addEventListener('click', (e) => {\n e.preventDefault();\n const it = items[Number(a.dataset.i)]!;\n this.toggle(false);\n navigate(this, { path: it.path });\n }));\n root.querySelector('[data-act=\"close\"]')?.addEventListener('click', (e) => { e.preventDefault(); this.toggle(false); emit(this, 'bapp-close', {}); });\n }\n}\n\n/** Register the three elements (idempotent). */\nexport function defineBappShell(): void {\n if (typeof customElements === 'undefined') return;\n if (!customElements.get('bwalletx-bar')) customElements.define('bwalletx-bar', BwalletxBarElement);\n if (!customElements.get('bwalletx-topbar')) customElements.define('bwalletx-topbar', BwalletxTopbarElement);\n if (!customElements.get('bwalletx-drawer')) customElements.define('bwalletx-drawer', BwalletxDrawerElement);\n}\n\n/** Give every shell element on the page the same manifest. */\nexport function applyManifest(m: BappManifest, root: ParentNode = document): void {\n root.querySelectorAll<HTMLElement & { manifest: BappManifest | null }>('bwalletx-bar,bwalletx-topbar,bwalletx-drawer').forEach((el) => { el.manifest = m; });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,IAAM,WAAW,CAAC,UAAU,YAAY,KAAK,QAAQ,MAAM;AAoD3D,IAAM,kBAAkB;AACxB,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAM7B,SAAS,iBAAiB,GAAyB;AACxD,MAAI,OAAO,MAAM,YAAY,EAAE,WAAW,KAAK,EAAE,SAAS,IAAK,QAAO;AACtE,MAAI,EAAE,CAAC,MAAM,OAAO,EAAE,CAAC,MAAM,OAAO,EAAE,CAAC,MAAM,K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IAAI,IAAI,KAAK,kCAAkC,KAAK,OAAO,CAAC,SAAS,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE,QAAQ,KAAK,GAAG,IAAI;AAC5O,SAAK,cAAc,QAAQ,EAAG,iBAAiB,SAAS,MAAM,KAAK,OAAO,KAAK,CAAC;AAChF,SAAK,iBAAoC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,iBAAiB,SAAS,CAAC,MAAM;AACtG,QAAE,eAAe;AACjB,YAAM,KAAK,MAAM,OAAO,EAAE,QAAQ,CAAC,CAAC;AACpC,WAAK,OAAO,KAAK;AACjB,eAAS,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;AAAA,IAClC,CAAC,CAAC;AACF,SAAK,cAAc,oBAAoB,GAAG,iBAAiB,SAAS,CAAC,MAAM;AAAE,QAAE,eAAe;AAAG,WAAK,OAAO,KAAK;AAAG,WAAK,MAAM,cAAc,CAAC,CAAC;AAAA,IAAG,CAAC;AAAA,EACtJ;AACF;AAGO,SAAS,kBAAwB;AACtC,MAAI,OAAO,mBAAmB,YAAa;AAC3C,MAAI,CAAC,eAAe,IAAI,cAAc,EAAG,gBAAe,OAAO,gBAAgB,kBAAkB;AACjG,MAAI,CAAC,eAAe,IAAI,iBAAiB,EAAG,gBAAe,OAAO,mBAAmB,qBAAqB;AAC1G,MAAI,CAAC,eAAe,IAAI,iBAAiB,EAAG,gBAAe,OAAO,mBAAmB,qBAAqB;AAC5G;AAGO,SAAS,cAAc,GAAiB,OAAmB,UAAgB;AAChF,OAAK,iBAAkE,8CAA8C,EAAE,QAAQ,CAAC,OAAO;AAAE,OAAG,WAAW;AAAA,EAAG,CAAC;AAC7J;","names":[]}
@@ -0,0 +1,132 @@
1
+ import { B as BappManifest, S as SlotId } from './manifest-Caj_Raqm.cjs';
2
+ export { a as BappDrawerItem, b as BappLikeConfig, c as BappSlot, d as BappTheme, L as LIKE_DEFAULT_CENTS, e as LIKE_MAX_DAILY_CENTS, f as SLOT_IDS, V as ValidationResult, W as WELL_KNOWN_PATH, i as isSameOriginPath, g as isSlotId, l as loadManifest, p as parseManifest, s as slotPath, v as validateManifest } from './manifest-Caj_Raqm.cjs';
3
+
4
+ /**
5
+ * In-wallet mode. Inside bWalletX the wallet draws the dock natively; the app hides its web bar,
6
+ * follows `bapp:navigate {slot}` from the wallet, and reports `bapp:active {slot}` back.
7
+ * Protocol: docs/SHELL-PROTOCOL.md.
8
+ */
9
+
10
+ /** Wallet web origins allowed to drive a framed bApp. Extension origins are passed in by the app. */
11
+ declare const DEFAULT_WALLET_ORIGINS: readonly string[];
12
+ type WalletVia = 'ua' | 'frame' | null;
13
+ interface WalletDetection {
14
+ inWallet: boolean;
15
+ via: WalletVia;
16
+ /** Bottom inset (px) the wallet reserves, from `bWalletInset/<n>`. */
17
+ inset?: number;
18
+ }
19
+ /** Synchronous detection from the user agent (native app webviews). */
20
+ declare function detectWalletUA(ua?: string): WalletDetection;
21
+ /** Current detection (UA, or a completed frame handshake). */
22
+ declare function walletState(): WalletDetection;
23
+ interface ShellBridgeOptions {
24
+ manifest: BappManifest;
25
+ /** Allowed wallet origins for framed mode (exact match). Default DEFAULT_WALLET_ORIGINS. */
26
+ walletOrigins?: readonly string[];
27
+ /** Default: window. */
28
+ win?: Window;
29
+ /** Default: navigator.userAgent. */
30
+ userAgent?: string;
31
+ }
32
+ /**
33
+ * Listens for the wallet and keeps it in sync. Navigation is dispatched as a cancelable
34
+ * `bapp-navigate` event on window ({slot, path, source:'wallet'}); if nobody calls
35
+ * preventDefault() the page goes to the slot's path with location.assign.
36
+ */
37
+ declare class ShellBridge {
38
+ readonly manifest: BappManifest;
39
+ private readonly origins;
40
+ private readonly win;
41
+ private target;
42
+ private active;
43
+ private readonly onMessage;
44
+ private readonly onActive;
45
+ private readonly onMenu;
46
+ private readonly onClose;
47
+ constructor(opts: ShellBridgeOptions);
48
+ start(): this;
49
+ stop(): void;
50
+ get inWallet(): boolean;
51
+ /** Tell the wallet which slot is showing (lights up the native dock). */
52
+ setActive(slot: SlotId): void;
53
+ /** Is this message from a trusted wallet? */
54
+ trusted(e: MessageEvent): boolean;
55
+ private handle;
56
+ private post;
57
+ }
58
+ /** Convenience: create and start a bridge. */
59
+ declare function startShellBridge(opts: ShellBridgeOptions): ShellBridge;
60
+ /** Test hook. */
61
+ declare function _resetWalletState(): void;
62
+
63
+ /**
64
+ * <bwalletx-bar>, <bwalletx-topbar>, <bwalletx-drawer>: the bApp shell drawn on the web.
65
+ * Values match the bWalletX Dock exactly (see docs/BAPP-SHELL in the wallet repo).
66
+ * Framework-free; React wrappers in ./react.ts.
67
+ */
68
+
69
+ declare const TOKENS: {
70
+ readonly barHeight: 88;
71
+ readonly barBg: "#0A0B0D";
72
+ readonly hairline: "#1C1C1E";
73
+ readonly icon: 20;
74
+ readonly active: "#FFD24D";
75
+ readonly inactive: "#F2F2F0";
76
+ readonly label: "#98A2B3";
77
+ readonly bSize: 52;
78
+ readonly stripHeight: 28;
79
+ readonly rowHeight: 56;
80
+ readonly tool: 36;
81
+ readonly toolRing: "#2A2A2C";
82
+ readonly toolIcon: "#F5B800";
83
+ };
84
+ declare const ICONS: {
85
+ wallet: string;
86
+ exchange: string;
87
+ feed: string;
88
+ chat: string;
89
+ menu: string;
90
+ close: string;
91
+ };
92
+ declare const Base: typeof HTMLElement;
93
+ declare abstract class ShellElement extends Base {
94
+ protected _manifest: BappManifest | null;
95
+ private readonly onWallet;
96
+ get manifest(): BappManifest | null;
97
+ set manifest(m: BappManifest | null);
98
+ connectedCallback(): void;
99
+ disconnectedCallback(): void;
100
+ attributeChangedCallback(): void;
101
+ protected accent(): string;
102
+ abstract render(): void;
103
+ }
104
+ declare class BwalletxBarElement extends ShellElement {
105
+ static observedAttributes: string[];
106
+ private holdTimer;
107
+ private held;
108
+ get active(): SlotId | null;
109
+ set active(s: SlotId | null);
110
+ attributeChangedCallback(name?: string, old?: string | null, val?: string | null): void;
111
+ render(): void;
112
+ private go;
113
+ /** (b): tap = bapp-b-press, hold (>=450ms) = bapp-b-hold {phase:'start'|'end'}. Hold-to-talk is a later phase. */
114
+ private wireB;
115
+ }
116
+ declare class BwalletxTopbarElement extends ShellElement {
117
+ static observedAttributes: string[];
118
+ render(): void;
119
+ }
120
+ declare class BwalletxDrawerElement extends ShellElement {
121
+ static observedAttributes: string[];
122
+ get open(): boolean;
123
+ set open(v: boolean);
124
+ toggle(force?: boolean): void;
125
+ render(): void;
126
+ }
127
+ /** Register the three elements (idempotent). */
128
+ declare function defineBappShell(): void;
129
+ /** Give every shell element on the page the same manifest. */
130
+ declare function applyManifest(m: BappManifest, root?: ParentNode): void;
131
+
132
+ export { BappManifest, BwalletxBarElement, BwalletxDrawerElement, BwalletxTopbarElement, DEFAULT_WALLET_ORIGINS, ICONS, ShellBridge, type ShellBridgeOptions, SlotId, TOKENS, type WalletDetection, type WalletVia, _resetWalletState, applyManifest, defineBappShell, detectWalletUA, startShellBridge, walletState };
@@ -0,0 +1,132 @@
1
+ import { B as BappManifest, S as SlotId } from './manifest-Caj_Raqm.js';
2
+ export { a as BappDrawerItem, b as BappLikeConfig, c as BappSlot, d as BappTheme, L as LIKE_DEFAULT_CENTS, e as LIKE_MAX_DAILY_CENTS, f as SLOT_IDS, V as ValidationResult, W as WELL_KNOWN_PATH, i as isSameOriginPath, g as isSlotId, l as loadManifest, p as parseManifest, s as slotPath, v as validateManifest } from './manifest-Caj_Raqm.js';
3
+
4
+ /**
5
+ * In-wallet mode. Inside bWalletX the wallet draws the dock natively; the app hides its web bar,
6
+ * follows `bapp:navigate {slot}` from the wallet, and reports `bapp:active {slot}` back.
7
+ * Protocol: docs/SHELL-PROTOCOL.md.
8
+ */
9
+
10
+ /** Wallet web origins allowed to drive a framed bApp. Extension origins are passed in by the app. */
11
+ declare const DEFAULT_WALLET_ORIGINS: readonly string[];
12
+ type WalletVia = 'ua' | 'frame' | null;
13
+ interface WalletDetection {
14
+ inWallet: boolean;
15
+ via: WalletVia;
16
+ /** Bottom inset (px) the wallet reserves, from `bWalletInset/<n>`. */
17
+ inset?: number;
18
+ }
19
+ /** Synchronous detection from the user agent (native app webviews). */
20
+ declare function detectWalletUA(ua?: string): WalletDetection;
21
+ /** Current detection (UA, or a completed frame handshake). */
22
+ declare function walletState(): WalletDetection;
23
+ interface ShellBridgeOptions {
24
+ manifest: BappManifest;
25
+ /** Allowed wallet origins for framed mode (exact match). Default DEFAULT_WALLET_ORIGINS. */
26
+ walletOrigins?: readonly string[];
27
+ /** Default: window. */
28
+ win?: Window;
29
+ /** Default: navigator.userAgent. */
30
+ userAgent?: string;
31
+ }
32
+ /**
33
+ * Listens for the wallet and keeps it in sync. Navigation is dispatched as a cancelable
34
+ * `bapp-navigate` event on window ({slot, path, source:'wallet'}); if nobody calls
35
+ * preventDefault() the page goes to the slot's path with location.assign.
36
+ */
37
+ declare class ShellBridge {
38
+ readonly manifest: BappManifest;
39
+ private readonly origins;
40
+ private readonly win;
41
+ private target;
42
+ private active;
43
+ private readonly onMessage;
44
+ private readonly onActive;
45
+ private readonly onMenu;
46
+ private readonly onClose;
47
+ constructor(opts: ShellBridgeOptions);
48
+ start(): this;
49
+ stop(): void;
50
+ get inWallet(): boolean;
51
+ /** Tell the wallet which slot is showing (lights up the native dock). */
52
+ setActive(slot: SlotId): void;
53
+ /** Is this message from a trusted wallet? */
54
+ trusted(e: MessageEvent): boolean;
55
+ private handle;
56
+ private post;
57
+ }
58
+ /** Convenience: create and start a bridge. */
59
+ declare function startShellBridge(opts: ShellBridgeOptions): ShellBridge;
60
+ /** Test hook. */
61
+ declare function _resetWalletState(): void;
62
+
63
+ /**
64
+ * <bwalletx-bar>, <bwalletx-topbar>, <bwalletx-drawer>: the bApp shell drawn on the web.
65
+ * Values match the bWalletX Dock exactly (see docs/BAPP-SHELL in the wallet repo).
66
+ * Framework-free; React wrappers in ./react.ts.
67
+ */
68
+
69
+ declare const TOKENS: {
70
+ readonly barHeight: 88;
71
+ readonly barBg: "#0A0B0D";
72
+ readonly hairline: "#1C1C1E";
73
+ readonly icon: 20;
74
+ readonly active: "#FFD24D";
75
+ readonly inactive: "#F2F2F0";
76
+ readonly label: "#98A2B3";
77
+ readonly bSize: 52;
78
+ readonly stripHeight: 28;
79
+ readonly rowHeight: 56;
80
+ readonly tool: 36;
81
+ readonly toolRing: "#2A2A2C";
82
+ readonly toolIcon: "#F5B800";
83
+ };
84
+ declare const ICONS: {
85
+ wallet: string;
86
+ exchange: string;
87
+ feed: string;
88
+ chat: string;
89
+ menu: string;
90
+ close: string;
91
+ };
92
+ declare const Base: typeof HTMLElement;
93
+ declare abstract class ShellElement extends Base {
94
+ protected _manifest: BappManifest | null;
95
+ private readonly onWallet;
96
+ get manifest(): BappManifest | null;
97
+ set manifest(m: BappManifest | null);
98
+ connectedCallback(): void;
99
+ disconnectedCallback(): void;
100
+ attributeChangedCallback(): void;
101
+ protected accent(): string;
102
+ abstract render(): void;
103
+ }
104
+ declare class BwalletxBarElement extends ShellElement {
105
+ static observedAttributes: string[];
106
+ private holdTimer;
107
+ private held;
108
+ get active(): SlotId | null;
109
+ set active(s: SlotId | null);
110
+ attributeChangedCallback(name?: string, old?: string | null, val?: string | null): void;
111
+ render(): void;
112
+ private go;
113
+ /** (b): tap = bapp-b-press, hold (>=450ms) = bapp-b-hold {phase:'start'|'end'}. Hold-to-talk is a later phase. */
114
+ private wireB;
115
+ }
116
+ declare class BwalletxTopbarElement extends ShellElement {
117
+ static observedAttributes: string[];
118
+ render(): void;
119
+ }
120
+ declare class BwalletxDrawerElement extends ShellElement {
121
+ static observedAttributes: string[];
122
+ get open(): boolean;
123
+ set open(v: boolean);
124
+ toggle(force?: boolean): void;
125
+ render(): void;
126
+ }
127
+ /** Register the three elements (idempotent). */
128
+ declare function defineBappShell(): void;
129
+ /** Give every shell element on the page the same manifest. */
130
+ declare function applyManifest(m: BappManifest, root?: ParentNode): void;
131
+
132
+ export { BappManifest, BwalletxBarElement, BwalletxDrawerElement, BwalletxTopbarElement, DEFAULT_WALLET_ORIGINS, ICONS, ShellBridge, type ShellBridgeOptions, SlotId, TOKENS, type WalletDetection, type WalletVia, _resetWalletState, applyManifest, defineBappShell, detectWalletUA, startShellBridge, walletState };
package/dist/shell.js ADDED
@@ -0,0 +1,51 @@
1
+ import {
2
+ BwalletxBarElement,
3
+ BwalletxDrawerElement,
4
+ BwalletxTopbarElement,
5
+ DEFAULT_WALLET_ORIGINS,
6
+ ICONS,
7
+ LIKE_DEFAULT_CENTS,
8
+ LIKE_MAX_DAILY_CENTS,
9
+ SLOT_IDS,
10
+ ShellBridge,
11
+ TOKENS,
12
+ WELL_KNOWN_PATH,
13
+ _resetWalletState,
14
+ applyManifest,
15
+ defineBappShell,
16
+ detectWalletUA,
17
+ isSameOriginPath,
18
+ isSlotId,
19
+ loadManifest,
20
+ parseManifest,
21
+ slotPath,
22
+ startShellBridge,
23
+ validateManifest,
24
+ walletState
25
+ } from "./chunk-OMEKHKMM.js";
26
+ export {
27
+ BwalletxBarElement,
28
+ BwalletxDrawerElement,
29
+ BwalletxTopbarElement,
30
+ DEFAULT_WALLET_ORIGINS,
31
+ ICONS,
32
+ LIKE_DEFAULT_CENTS,
33
+ LIKE_MAX_DAILY_CENTS,
34
+ SLOT_IDS,
35
+ ShellBridge,
36
+ TOKENS,
37
+ WELL_KNOWN_PATH,
38
+ _resetWalletState,
39
+ applyManifest,
40
+ defineBappShell,
41
+ detectWalletUA,
42
+ isSameOriginPath,
43
+ isSlotId,
44
+ loadManifest,
45
+ parseManifest,
46
+ slotPath,
47
+ startShellBridge,
48
+ validateManifest,
49
+ walletState
50
+ };
51
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bwalletx/connect",
3
- "version": "0.2.0",
4
- "description": "Sign in with bWalletX: the standard button (web component + React), wallet discovery, phone pairing and server-side challenge verification",
3
+ "version": "0.3.0",
4
+ "description": "Sign in with bWalletX (button, discovery, pairing, server verification) and the bApp shell (5-slot bar, top bar, drawer, bapp.json manifest)",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,7 +15,8 @@
15
15
  "sideEffects": [
16
16
  "./dist/element.js",
17
17
  "./dist/element.cjs",
18
- "./dist/bwalletx-connect.global.js"
18
+ "./dist/bwalletx-connect.global.js",
19
+ "./dist/bwalletx-shell.global.js"
19
20
  ],
20
21
  "main": "./dist/index.cjs",
21
22
  "module": "./dist/index.js",
@@ -61,6 +62,28 @@
61
62
  "default": "./dist/react.cjs"
62
63
  }
63
64
  },
65
+ "./shell": {
66
+ "import": {
67
+ "types": "./dist/shell.d.ts",
68
+ "default": "./dist/shell.js"
69
+ },
70
+ "require": {
71
+ "types": "./dist/shell.d.cts",
72
+ "default": "./dist/shell.cjs"
73
+ }
74
+ },
75
+ "./shell/react": {
76
+ "import": {
77
+ "types": "./dist/shell-react.d.ts",
78
+ "default": "./dist/shell-react.js"
79
+ },
80
+ "require": {
81
+ "types": "./dist/shell-react.d.cts",
82
+ "default": "./dist/shell-react.cjs"
83
+ }
84
+ },
85
+ "./shell/browser": "./dist/bwalletx-shell.global.js",
86
+ "./schema/bapp.schema.json": "./schema/bapp.schema.json",
64
87
  "./browser": "./dist/bwalletx-connect.global.js",
65
88
  "./package.json": "./package.json",
66
89
  "./assets/*": "./assets/*"
@@ -70,6 +93,7 @@
70
93
  "files": [
71
94
  "dist",
72
95
  "assets",
96
+ "schema",
73
97
  "README.md",
74
98
  "BRAND.md",
75
99
  "TRADEMARKS.md",
@@ -83,7 +107,9 @@
83
107
  "sign-in",
84
108
  "authentication",
85
109
  "web-component",
86
- "sign-in-button"
110
+ "sign-in-button",
111
+ "bapp",
112
+ "app-shell"
87
113
  ],
88
114
  "engines": {
89
115
  "node": ">=20"
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bwalletx.com/schema/bapp.schema.json",
4
+ "title": "bApp manifest (/.well-known/bapp.json)",
5
+ "description": "Declares a bApp's five scoped slots (Wallet, Exchange, (b), Feed, Chat), its drawer and like-to-fund config. All paths are same-origin. Validate in code with validateManifest() from @bwalletx/connect/shell, which also enforces the rules JSON Schema cannot (URL origin check, amount <= cap).",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": ["version", "name", "icon", "slots"],
9
+ "$defs": {
10
+ "path": {
11
+ "type": "string",
12
+ "description": "Same-origin path: one leading slash, no scheme, no protocol-relative //, no backslash or whitespace.",
13
+ "pattern": "^/(?![/\\\\])[^\\s\\\\]*$",
14
+ "maxLength": 512
15
+ },
16
+ "slot": {
17
+ "type": "object",
18
+ "additionalProperties": false,
19
+ "required": ["enabled"],
20
+ "properties": {
21
+ "path": { "$ref": "#/$defs/path" },
22
+ "label": { "type": "string", "minLength": 1, "maxLength": 12 },
23
+ "enabled": { "type": "boolean", "description": "false = greyed out and not clickable. Slots are never hidden." }
24
+ }
25
+ },
26
+ "pathSlot": {
27
+ "allOf": [
28
+ { "$ref": "#/$defs/slot" },
29
+ { "if": { "properties": { "enabled": { "const": true } } }, "then": { "required": ["path"] } }
30
+ ]
31
+ },
32
+ "fieldName": { "type": "string", "minLength": 1, "maxLength": 64 }
33
+ },
34
+ "properties": {
35
+ "$schema": { "type": "string" },
36
+ "version": { "const": 1 },
37
+ "name": { "type": "string", "minLength": 1, "maxLength": 40 },
38
+ "icon": { "$ref": "#/$defs/path" },
39
+ "home": { "$ref": "#/$defs/path", "default": "/" },
40
+ "theme": {
41
+ "type": "object",
42
+ "additionalProperties": false,
43
+ "properties": { "accent": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$", "default": "#FFD24D" } }
44
+ },
45
+ "slots": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "required": ["wallet", "exchange", "b", "feed", "chat"],
49
+ "properties": {
50
+ "wallet": { "$ref": "#/$defs/pathSlot" },
51
+ "exchange": { "$ref": "#/$defs/pathSlot" },
52
+ "b": { "$ref": "#/$defs/slot" },
53
+ "feed": { "$ref": "#/$defs/pathSlot" },
54
+ "chat": { "$ref": "#/$defs/pathSlot" }
55
+ }
56
+ },
57
+ "drawer": {
58
+ "type": "array",
59
+ "maxItems": 24,
60
+ "items": {
61
+ "type": "object",
62
+ "additionalProperties": false,
63
+ "required": ["label", "path"],
64
+ "properties": {
65
+ "label": { "type": "string", "minLength": 1, "maxLength": 40 },
66
+ "path": { "$ref": "#/$defs/path" },
67
+ "icon": { "$ref": "#/$defs/path" }
68
+ }
69
+ }
70
+ },
71
+ "like": {
72
+ "type": "object",
73
+ "description": "Like-to-fund config (config only in Phase 1). A Like is a small purchase of the item's utility token.",
74
+ "additionalProperties": false,
75
+ "required": ["fields"],
76
+ "properties": {
77
+ "fields": {
78
+ "type": "object",
79
+ "additionalProperties": false,
80
+ "required": ["id", "token"],
81
+ "properties": {
82
+ "id": { "$ref": "#/$defs/fieldName" },
83
+ "token": { "$ref": "#/$defs/fieldName" },
84
+ "payee": { "$ref": "#/$defs/fieldName" },
85
+ "title": { "$ref": "#/$defs/fieldName" },
86
+ "media": { "$ref": "#/$defs/fieldName" }
87
+ }
88
+ },
89
+ "amountCents": { "type": "integer", "minimum": 1, "default": 1 },
90
+ "currency": { "enum": ["PNEE", "BSV"], "default": "PNEE" },
91
+ "dailyCapCents": { "type": "integer", "minimum": 1, "maximum": 100, "default": 100 }
92
+ }
93
+ }
94
+ }
95
+ }