@atpassport/client 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,7 @@ pnpm add @atpassport/client
21
21
  ## Usage
22
22
 
23
23
  ```typescript
24
- import { AtPassport } from '@atpassport/client';
24
+ import { AtPassport } from '@atpassport/client/core';
25
25
 
26
26
  // 1. Initialize the client
27
27
  const passport = new AtPassport({
@@ -59,7 +59,7 @@ console.log('Custom Parameters:', result.customParams['redirect_uri']); // Outpu
59
59
  To make it easy for developers to build consistent "Login with @passport" buttons and dialogs, the client library exports standard texts and an SVG icon via the `AtPassportUI` constant.
60
60
 
61
61
  ```typescript
62
- import { AtPassportUI } from '@atpassport/client';
62
+ import { AtPassportUI } from '@atpassport/client/ui';
63
63
 
64
64
  // English translations
65
65
  console.log(AtPassportUI.en.title); // "Login with @passport"
@@ -72,7 +72,7 @@ console.log(AtPassportUI.ja.title); // "@passportでログイン"
72
72
  const svgString = AtPassportUI.iconSvg;
73
73
 
74
74
  // React Component
75
- import { AtPassportIcon } from '@atpassport/client';
75
+ import { AtPassportIcon } from '@atpassport/client/ui';
76
76
 
77
77
  // Use it in your React component
78
78
  // <AtPassportIcon size={24} />
package/dist/core.mjs CHANGED
@@ -1 +1 @@
1
- import{a}from"./chunk-HQWY5EUQ.mjs";export{a as AtPassport};
1
+ var d=class{baseUrl;callbackUrl;lang;constructor(t){this.baseUrl=(t.baseUrl||"https://atpassport.net").replace(/\/$/,""),this.callbackUrl=t.callbackUrl,this.lang=t.lang}generateAuthUrl(t){let a=crypto.randomUUID(),e=this.lang?`${this.lang}/authentication`:"authentication",s=new URL(`${this.baseUrl}/${e}`),r=new URL(this.callbackUrl);if(t)for(let[i,n]of Object.entries(t))r.searchParams.set(i,n);return s.searchParams.set("callback",r.toString()),s.searchParams.set("atpstate",a),{url:s.toString(),atpstate:a}}parseCallback(t,a){let e=new URL(t),s=e.searchParams.get("handle"),r=e.searchParams.get("did"),i=e.searchParams.get("pdsurl"),n=e.searchParams.get("atpstate");if(a&&n!==a)throw new Error("Invalid atpstate: CSRF validation failed.");let l={};return e.searchParams.forEach((c,o)=>{["handle","did","pdsurl","atpstate"].includes(o)||(l[o]=c)}),{handle:s,did:r,pdsUrl:i,atpstate:n,customParams:l}}async pick(){return new Promise(t=>{let s=window.screenX+(window.outerWidth-400)/2,r=window.screenY+(window.outerHeight-500)/2,i=this.lang?`${this.lang}/picker`:"picker",n=`${this.baseUrl}/${i}`,l=window.open(n,"atpassport:picker",`width=400,height=500,left=${s},top=${r}`),c=h=>{h.origin===new URL(this.baseUrl).origin&&h.data?.type==="atpassport:pick"&&(window.removeEventListener("message",c),t(h.data.handle))};window.addEventListener("message",c);let o=setInterval(()=>{l?.closed&&clearInterval(o)},1e3)})}decorate(t){t.addEventListener("focus",async()=>{if(t.value)return;let a=await this.pick();a&&(t.value=a,t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))})}};export{d as AtPassport};
package/dist/index.d.mts CHANGED
@@ -1,4 +1,2 @@
1
- export { AtPassport, AtPassportOptions } from './core.mjs';
2
- export { AtPassportIcon, AtPassportIconProps, AtPassportUI } from './ui.mjs';
3
- import 'react/jsx-runtime';
4
- import 'react';
1
+
2
+ export { }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- export { AtPassport, AtPassportOptions } from './core.js';
2
- export { AtPassportIcon, AtPassportIconProps, AtPassportUI } from './ui.js';
3
- import 'react/jsx-runtime';
4
- import 'react';
1
+
2
+ export { }
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var g=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var P=(r,t)=>{for(var s in t)g(r,s,{get:t[s],enumerable:!0})},U=(r,t,s,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of f(t))!b.call(r,e)&&e!==s&&g(r,e,{get:()=>t[e],enumerable:!(a=m(t,e))||a.enumerable});return r};var k=r=>U(g({},"__esModule",{value:!0}),r);var E={};P(E,{AtPassport:()=>d,AtPassportIcon:()=>$,AtPassportUI:()=>I});module.exports=k(E);var d=class{baseUrl;callbackUrl;lang;constructor(t){this.baseUrl=(t.baseUrl||"https://atpassport.net").replace(/\/$/,""),this.callbackUrl=t.callbackUrl,this.lang=t.lang}generateAuthUrl(t){let s=crypto.randomUUID(),a=this.lang?`${this.lang}/authentication`:"authentication",e=new URL(`${this.baseUrl}/${a}`),n=new URL(this.callbackUrl);if(t)for(let[i,o]of Object.entries(t))n.searchParams.set(i,o);return e.searchParams.set("callback",n.toString()),e.searchParams.set("atpstate",s),{url:e.toString(),atpstate:s}}parseCallback(t,s){let a=new URL(t),e=a.searchParams.get("handle"),n=a.searchParams.get("did"),i=a.searchParams.get("pdsurl"),o=a.searchParams.get("atpstate");if(s&&o!==s)throw new Error("Invalid atpstate: CSRF validation failed.");let c={};return a.searchParams.forEach((p,C)=>{["handle","did","pdsurl","atpstate"].includes(C)||(c[C]=p)}),{handle:e,did:n,pdsUrl:i,atpstate:o,customParams:c}}async pick(){return new Promise(t=>{let e=window.screenX+(window.outerWidth-400)/2,n=window.screenY+(window.outerHeight-500)/2,i=this.lang?`${this.lang}/picker`:"picker",o=`${this.baseUrl}/${i}`,c=window.open(o,"atpassport:picker",`width=400,height=500,left=${e},top=${n}`),p=h=>{h.origin===new URL(this.baseUrl).origin&&h.data?.type==="atpassport:pick"&&(window.removeEventListener("message",p),t(h.data.handle))};window.addEventListener("message",p);let C=setInterval(()=>{c?.closed&&clearInterval(C)},1e3)})}decorate(t){t.addEventListener("focus",async()=>{if(t.value)return;let s=await this.pick();s&&(t.value=s,t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))})}};var l=require("react/jsx-runtime"),w="M0 0 C1 0.5 2 1 3 1.5 C9.5 4.7 15.9 8.1 22.1 11.8 C25.2 13.2 27.3 13.3 30.7 12.9 C33.3 11.9 33.3 11.9 35.8 10.5 C44.4 5.8 54.9 5.7 64.5 7.5 C67.3 8.4 69.5 9.8 71.8 11.7 C73.2 15.3 72.9 17.3 71.7 20.9 C64.5 26.2 56.2 29.7 48.1 33.6 C46.6 34.3 45.2 35 43.7 35.7 C40 37.5 36.3 39.2 32.7 41 C29.9 42.3 27 43.7 24.2 45 C20.5 46.8 16.8 48.6 13.2 50.3 C9.2 52.2 5.3 54.1 1.3 56 C0.3 56.5 -0.8 57 -1.8 57.6 C-3.9 58.5 -5.9 59.5 -7.9 60.5 C-8.8 60.9 -9.7 61.4 -10.6 61.8 C-11.4 62.2 -12.2 62.6 -13 63 C-18.7 65.3 -24.9 66.1 -30.8 64.1 C-36.8 61.3 -41 57.8 -45.3 52.9 C-46 52.2 -46.6 51.6 -47.3 50.9 C-52.6 45 -52.6 45 -53.3 40.9 C-52 40.1 -50.7 39.3 -49.4 38.5 C-48.7 38 -48 37.6 -47.3 37.1 C-43.7 34.9 -41.5 34.6 -37.3 34.9 C-34.4 36.3 -31.8 38 -29.1 39.7 C-25.5 41.3 -24.1 41.1 -20.3 39.9 C-16.9 38.4 -13.7 36.7 -10.4 34.9 C-9.1 34.2 -9.1 34.2 -7.8 33.4 C-5.6 32.3 -3.5 31.1 -1.3 29.9 C-3.6 26.9 -5.9 24.2 -8.8 21.8 C-13 18.3 -17 14.6 -21 10.8 C-24 8.1 -27.1 5.5 -30.3 2.9 C-30.3 0.6 -30.3 0.6 -29.3 -2.1 C-18.8 -7.6 -10.1 -5.2 0 0 Z",v="M0 0 C1 -0 2.1 -0 3.2 -0 C4.3 -0 5.5 -0 6.7 -0 C7.9 -0 9.1 -0 10.3 -0 C13.6 -0 17 -0 20.3 -0 C23.8 -0 27.2 -0 30.7 -0 C36.5 -0 42.4 -0 48.2 -0 C54.9 0 61.7 0 68.4 -0 C74.2 -0 80 -0 85.8 -0 C89.2 -0 92.7 -0 96.1 -0 C100 -0 103.8 -0 107.7 -0 C109.4 -0 109.4 -0 111.2 -0 C112.8 -0 112.8 -0 114.4 0 C115.3 0 116.2 0 117.1 0 C119.2 0.1 119.2 0.1 120.2 1.1 C120.3 3.1 120.3 5.1 120.3 7.1 C120.3 8.8 120.3 8.8 120.3 10.4 C120.2 13.1 120.2 13.1 119.2 14.1 C117.6 14.2 116 14.3 114.4 14.3 C113.3 14.3 112.3 14.3 111.2 14.3 C110 14.3 108.9 14.3 107.7 14.3 C106.5 14.3 105.3 14.3 104 14.3 C100.7 14.3 97.4 14.3 94.1 14.3 C90.6 14.3 87.1 14.3 83.7 14.3 C77.8 14.3 72 14.3 66.2 14.3 C59.4 14.3 52.7 14.3 45.9 14.3 C40.2 14.3 34.4 14.3 28.6 14.3 C25.1 14.3 21.7 14.3 18.2 14.3 C14.4 14.3 10.5 14.3 6.7 14.3 C4.9 14.3 4.9 14.3 3.2 14.3 C1.6 14.3 1.6 14.3 0 14.3 C-0.9 14.3 -1.8 14.3 -2.8 14.3 C-4.8 14.1 -4.8 14.1 -5.8 13.1 C-5.9 11.1 -6 9.1 -5.9 7.1 C-5.9 6 -6 4.9 -6 3.8 C-5.7 -0.7 -4.1 0 0 0 Z",u=(r=128)=>`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="${r}" height="${r}" viewBox="0 0 128 128"><path d="${w}" fill="currentColor" transform="translate(54.3,21.1)"/><path d="${v}" fill="currentColor" transform="translate(6.8,97.9)"/></svg>`,$=({size:r=24,...t})=>(0,l.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:r,height:r,viewBox:"0 0 128 128",fill:"currentColor",...t,children:[(0,l.jsx)("path",{d:w,transform:"translate(54.3,21.1)"}),(0,l.jsx)("path",{d:v,transform:"translate(6.8,97.9)"})]}),I={ja:{title:"@passport\u3067\u30ED\u30B0\u30A4\u30F3",description:"@passport\u306F\u3001\u5404atproto\u30A2\u30D7\u30EA\u3067\u30CF\u30F3\u30C9\u30EB\u3092\u90FD\u5EA6\u5165\u529B\u3059\u308B\u624B\u9593\u304C\u7701\u3051\u308B\u5171\u901A\u30CF\u30F3\u30C9\u30EB\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC\u3067\u3059\u3002"},en:{title:"Login with @passport",description:"@passport is a universal handle manager that saves you from typing your handle repeatedly across atproto apps."},iconSvg:u(128),getIconSvg:u};0&&(module.exports={AtPassport,AtPassportIcon,AtPassportUI});
1
+ "use strict";var t=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var d=(o,e,x,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of b(e))!c.call(o,p)&&p!==x&&t(o,p,{get:()=>e[p],enumerable:!(r=a(e,p))||r.enumerable});return o};var f=o=>d(t({},"__esModule",{value:!0}),o);var g={};module.exports=f(g);
package/dist/index.mjs CHANGED
@@ -1 +0,0 @@
1
- import{a as o}from"./chunk-HQWY5EUQ.mjs";import{a as r,b as e}from"./chunk-LGB4WCG6.mjs";export{o as AtPassport,r as AtPassportIcon,e as AtPassportUI};
package/dist/ui.js CHANGED
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(C,t)=>{for(var s in t)n(C,s,{get:t[s],enumerable:!0})},v=(C,t,s,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of g(t))!c.call(C,r)&&r!==s&&n(C,r,{get:()=>t[r],enumerable:!(a=l(t,r))||a.enumerable});return C};var w=C=>v(n({},"__esModule",{value:!0}),C);var f={};h(f,{AtPassportIcon:()=>d,AtPassportUI:()=>m});module.exports=w(f);var o=require("react/jsx-runtime"),p="M0 0 C1 0.5 2 1 3 1.5 C9.5 4.7 15.9 8.1 22.1 11.8 C25.2 13.2 27.3 13.3 30.7 12.9 C33.3 11.9 33.3 11.9 35.8 10.5 C44.4 5.8 54.9 5.7 64.5 7.5 C67.3 8.4 69.5 9.8 71.8 11.7 C73.2 15.3 72.9 17.3 71.7 20.9 C64.5 26.2 56.2 29.7 48.1 33.6 C46.6 34.3 45.2 35 43.7 35.7 C40 37.5 36.3 39.2 32.7 41 C29.9 42.3 27 43.7 24.2 45 C20.5 46.8 16.8 48.6 13.2 50.3 C9.2 52.2 5.3 54.1 1.3 56 C0.3 56.5 -0.8 57 -1.8 57.6 C-3.9 58.5 -5.9 59.5 -7.9 60.5 C-8.8 60.9 -9.7 61.4 -10.6 61.8 C-11.4 62.2 -12.2 62.6 -13 63 C-18.7 65.3 -24.9 66.1 -30.8 64.1 C-36.8 61.3 -41 57.8 -45.3 52.9 C-46 52.2 -46.6 51.6 -47.3 50.9 C-52.6 45 -52.6 45 -53.3 40.9 C-52 40.1 -50.7 39.3 -49.4 38.5 C-48.7 38 -48 37.6 -47.3 37.1 C-43.7 34.9 -41.5 34.6 -37.3 34.9 C-34.4 36.3 -31.8 38 -29.1 39.7 C-25.5 41.3 -24.1 41.1 -20.3 39.9 C-16.9 38.4 -13.7 36.7 -10.4 34.9 C-9.1 34.2 -9.1 34.2 -7.8 33.4 C-5.6 32.3 -3.5 31.1 -1.3 29.9 C-3.6 26.9 -5.9 24.2 -8.8 21.8 C-13 18.3 -17 14.6 -21 10.8 C-24 8.1 -27.1 5.5 -30.3 2.9 C-30.3 0.6 -30.3 0.6 -29.3 -2.1 C-18.8 -7.6 -10.1 -5.2 0 0 Z",i="M0 0 C1 -0 2.1 -0 3.2 -0 C4.3 -0 5.5 -0 6.7 -0 C7.9 -0 9.1 -0 10.3 -0 C13.6 -0 17 -0 20.3 -0 C23.8 -0 27.2 -0 30.7 -0 C36.5 -0 42.4 -0 48.2 -0 C54.9 0 61.7 0 68.4 -0 C74.2 -0 80 -0 85.8 -0 C89.2 -0 92.7 -0 96.1 -0 C100 -0 103.8 -0 107.7 -0 C109.4 -0 109.4 -0 111.2 -0 C112.8 -0 112.8 -0 114.4 0 C115.3 0 116.2 0 117.1 0 C119.2 0.1 119.2 0.1 120.2 1.1 C120.3 3.1 120.3 5.1 120.3 7.1 C120.3 8.8 120.3 8.8 120.3 10.4 C120.2 13.1 120.2 13.1 119.2 14.1 C117.6 14.2 116 14.3 114.4 14.3 C113.3 14.3 112.3 14.3 111.2 14.3 C110 14.3 108.9 14.3 107.7 14.3 C106.5 14.3 105.3 14.3 104 14.3 C100.7 14.3 97.4 14.3 94.1 14.3 C90.6 14.3 87.1 14.3 83.7 14.3 C77.8 14.3 72 14.3 66.2 14.3 C59.4 14.3 52.7 14.3 45.9 14.3 C40.2 14.3 34.4 14.3 28.6 14.3 C25.1 14.3 21.7 14.3 18.2 14.3 C14.4 14.3 10.5 14.3 6.7 14.3 C4.9 14.3 4.9 14.3 3.2 14.3 C1.6 14.3 1.6 14.3 0 14.3 C-0.9 14.3 -1.8 14.3 -2.8 14.3 C-4.8 14.1 -4.8 14.1 -5.8 13.1 C-5.9 11.1 -6 9.1 -5.9 7.1 C-5.9 6 -6 4.9 -6 3.8 C-5.7 -0.7 -4.1 0 0 0 Z",e=(C=128)=>`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="${C}" height="${C}" viewBox="0 0 128 128"><path d="${p}" fill="currentColor" transform="translate(54.3,21.1)"/><path d="${i}" fill="currentColor" transform="translate(6.8,97.9)"/></svg>`,d=({size:C=24,...t})=>(0,o.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:C,height:C,viewBox:"0 0 128 128",fill:"currentColor",...t,children:[(0,o.jsx)("path",{d:p,transform:"translate(54.3,21.1)"}),(0,o.jsx)("path",{d:i,transform:"translate(6.8,97.9)"})]}),m={ja:{title:"@passport\u3067\u30ED\u30B0\u30A4\u30F3",description:"@passport\u306F\u3001\u5404atproto\u30A2\u30D7\u30EA\u3067\u30CF\u30F3\u30C9\u30EB\u3092\u90FD\u5EA6\u5165\u529B\u3059\u308B\u624B\u9593\u304C\u7701\u3051\u308B\u5171\u901A\u30CF\u30F3\u30C9\u30EB\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC\u3067\u3059\u3002"},en:{title:"Login with @passport",description:"@passport is a universal handle manager that saves you from typing your handle repeatedly across atproto apps."},iconSvg:e(128),getIconSvg:e};0&&(module.exports={AtPassportIcon,AtPassportUI});
1
+ "use strict";var n=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var h=(C,t)=>{for(var s in t)n(C,s,{get:t[s],enumerable:!0})},v=(C,t,s,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of g(t))!c.call(C,r)&&r!==s&&n(C,r,{get:()=>t[r],enumerable:!(e=l(t,r))||e.enumerable});return C};var w=C=>v(n({},"__esModule",{value:!0}),C);var f={};h(f,{AtPassportIcon:()=>d,AtPassportUI:()=>m});module.exports=w(f);var o=require("react/jsx-runtime"),p="M0 0 C1 0.5 2 1 3 1.5 C9.5 4.7 15.9 8.1 22.1 11.8 C25.2 13.2 27.3 13.3 30.7 12.9 C33.3 11.9 33.3 11.9 35.8 10.5 C44.4 5.8 54.9 5.7 64.5 7.5 C67.3 8.4 69.5 9.8 71.8 11.7 C73.2 15.3 72.9 17.3 71.7 20.9 C64.5 26.2 56.2 29.7 48.1 33.6 C46.6 34.3 45.2 35 43.7 35.7 C40 37.5 36.3 39.2 32.7 41 C29.9 42.3 27 43.7 24.2 45 C20.5 46.8 16.8 48.6 13.2 50.3 C9.2 52.2 5.3 54.1 1.3 56 C0.3 56.5 -0.8 57 -1.8 57.6 C-3.9 58.5 -5.9 59.5 -7.9 60.5 C-8.8 60.9 -9.7 61.4 -10.6 61.8 C-11.4 62.2 -12.2 62.6 -13 63 C-18.7 65.3 -24.9 66.1 -30.8 64.1 C-36.8 61.3 -41 57.8 -45.3 52.9 C-46 52.2 -46.6 51.6 -47.3 50.9 C-52.6 45 -52.6 45 -53.3 40.9 C-52 40.1 -50.7 39.3 -49.4 38.5 C-48.7 38 -48 37.6 -47.3 37.1 C-43.7 34.9 -41.5 34.6 -37.3 34.9 C-34.4 36.3 -31.8 38 -29.1 39.7 C-25.5 41.3 -24.1 41.1 -20.3 39.9 C-16.9 38.4 -13.7 36.7 -10.4 34.9 C-9.1 34.2 -9.1 34.2 -7.8 33.4 C-5.6 32.3 -3.5 31.1 -1.3 29.9 C-3.6 26.9 -5.9 24.2 -8.8 21.8 C-13 18.3 -17 14.6 -21 10.8 C-24 8.1 -27.1 5.5 -30.3 2.9 C-30.3 0.6 -30.3 0.6 -29.3 -2.1 C-18.8 -7.6 -10.1 -5.2 0 0 Z",i="M0 0 C1 -0 2.1 -0 3.2 -0 C4.3 -0 5.5 -0 6.7 -0 C7.9 -0 9.1 -0 10.3 -0 C13.6 -0 17 -0 20.3 -0 C23.8 -0 27.2 -0 30.7 -0 C36.5 -0 42.4 -0 48.2 -0 C54.9 0 61.7 0 68.4 -0 C74.2 -0 80 -0 85.8 -0 C89.2 -0 92.7 -0 96.1 -0 C100 -0 103.8 -0 107.7 -0 C109.4 -0 109.4 -0 111.2 -0 C112.8 -0 112.8 -0 114.4 0 C115.3 0 116.2 0 117.1 0 C119.2 0.1 119.2 0.1 120.2 1.1 C120.3 3.1 120.3 5.1 120.3 7.1 C120.3 8.8 120.3 8.8 120.3 10.4 C120.2 13.1 120.2 13.1 119.2 14.1 C117.6 14.2 116 14.3 114.4 14.3 C113.3 14.3 112.3 14.3 111.2 14.3 C110 14.3 108.9 14.3 107.7 14.3 C106.5 14.3 105.3 14.3 104 14.3 C100.7 14.3 97.4 14.3 94.1 14.3 C90.6 14.3 87.1 14.3 83.7 14.3 C77.8 14.3 72 14.3 66.2 14.3 C59.4 14.3 52.7 14.3 45.9 14.3 C40.2 14.3 34.4 14.3 28.6 14.3 C25.1 14.3 21.7 14.3 18.2 14.3 C14.4 14.3 10.5 14.3 6.7 14.3 C4.9 14.3 4.9 14.3 3.2 14.3 C1.6 14.3 1.6 14.3 0 14.3 C-0.9 14.3 -1.8 14.3 -2.8 14.3 C-4.8 14.1 -4.8 14.1 -5.8 13.1 C-5.9 11.1 -6 9.1 -5.9 7.1 C-5.9 6 -6 4.9 -6 3.8 C-5.7 -0.7 -4.1 0 0 0 Z",a=(C=128)=>`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="${C}" height="${C}" viewBox="0 0 128 128"><path d="${p}" fill="currentColor" transform="translate(54.3,21.1)"/><path d="${i}" fill="currentColor" transform="translate(6.8,97.9)"/></svg>`,d=({size:C=24,...t})=>(0,o.jsxs)("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:C,height:C,viewBox:"0 0 128 128",fill:"currentColor",...t,children:[(0,o.jsx)("path",{d:p,transform:"translate(54.3,21.1)"}),(0,o.jsx)("path",{d:i,transform:"translate(6.8,97.9)"})]}),m={ja:{title:"@passport\u3067\u30ED\u30B0\u30A4\u30F3",description:"@passport\u306F\u3001\u5404\u30A2\u30D7\u30EA\u3067\u306E\u30CF\u30F3\u30C9\u30EB\u5165\u529B\u3092\u4E0D\u8981\u306B\u3059\u308B\u30CF\u30F3\u30C9\u30EB\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC\u3067\u3059\u3002"},en:{title:"Login with @passport",description:"@passport is a handle manager that eliminates the need for handle entry in each app."},iconSvg:a(128),getIconSvg:a};0&&(module.exports={AtPassportIcon,AtPassportUI});
package/dist/ui.mjs CHANGED
@@ -1 +1 @@
1
- import{a,b}from"./chunk-LGB4WCG6.mjs";export{a as AtPassportIcon,b as AtPassportUI};
1
+ import{jsx as r,jsxs as e}from"react/jsx-runtime";var o="M0 0 C1 0.5 2 1 3 1.5 C9.5 4.7 15.9 8.1 22.1 11.8 C25.2 13.2 27.3 13.3 30.7 12.9 C33.3 11.9 33.3 11.9 35.8 10.5 C44.4 5.8 54.9 5.7 64.5 7.5 C67.3 8.4 69.5 9.8 71.8 11.7 C73.2 15.3 72.9 17.3 71.7 20.9 C64.5 26.2 56.2 29.7 48.1 33.6 C46.6 34.3 45.2 35 43.7 35.7 C40 37.5 36.3 39.2 32.7 41 C29.9 42.3 27 43.7 24.2 45 C20.5 46.8 16.8 48.6 13.2 50.3 C9.2 52.2 5.3 54.1 1.3 56 C0.3 56.5 -0.8 57 -1.8 57.6 C-3.9 58.5 -5.9 59.5 -7.9 60.5 C-8.8 60.9 -9.7 61.4 -10.6 61.8 C-11.4 62.2 -12.2 62.6 -13 63 C-18.7 65.3 -24.9 66.1 -30.8 64.1 C-36.8 61.3 -41 57.8 -45.3 52.9 C-46 52.2 -46.6 51.6 -47.3 50.9 C-52.6 45 -52.6 45 -53.3 40.9 C-52 40.1 -50.7 39.3 -49.4 38.5 C-48.7 38 -48 37.6 -47.3 37.1 C-43.7 34.9 -41.5 34.6 -37.3 34.9 C-34.4 36.3 -31.8 38 -29.1 39.7 C-25.5 41.3 -24.1 41.1 -20.3 39.9 C-16.9 38.4 -13.7 36.7 -10.4 34.9 C-9.1 34.2 -9.1 34.2 -7.8 33.4 C-5.6 32.3 -3.5 31.1 -1.3 29.9 C-3.6 26.9 -5.9 24.2 -8.8 21.8 C-13 18.3 -17 14.6 -21 10.8 C-24 8.1 -27.1 5.5 -30.3 2.9 C-30.3 0.6 -30.3 0.6 -29.3 -2.1 C-18.8 -7.6 -10.1 -5.2 0 0 Z",s="M0 0 C1 -0 2.1 -0 3.2 -0 C4.3 -0 5.5 -0 6.7 -0 C7.9 -0 9.1 -0 10.3 -0 C13.6 -0 17 -0 20.3 -0 C23.8 -0 27.2 -0 30.7 -0 C36.5 -0 42.4 -0 48.2 -0 C54.9 0 61.7 0 68.4 -0 C74.2 -0 80 -0 85.8 -0 C89.2 -0 92.7 -0 96.1 -0 C100 -0 103.8 -0 107.7 -0 C109.4 -0 109.4 -0 111.2 -0 C112.8 -0 112.8 -0 114.4 0 C115.3 0 116.2 0 117.1 0 C119.2 0.1 119.2 0.1 120.2 1.1 C120.3 3.1 120.3 5.1 120.3 7.1 C120.3 8.8 120.3 8.8 120.3 10.4 C120.2 13.1 120.2 13.1 119.2 14.1 C117.6 14.2 116 14.3 114.4 14.3 C113.3 14.3 112.3 14.3 111.2 14.3 C110 14.3 108.9 14.3 107.7 14.3 C106.5 14.3 105.3 14.3 104 14.3 C100.7 14.3 97.4 14.3 94.1 14.3 C90.6 14.3 87.1 14.3 83.7 14.3 C77.8 14.3 72 14.3 66.2 14.3 C59.4 14.3 52.7 14.3 45.9 14.3 C40.2 14.3 34.4 14.3 28.6 14.3 C25.1 14.3 21.7 14.3 18.2 14.3 C14.4 14.3 10.5 14.3 6.7 14.3 C4.9 14.3 4.9 14.3 3.2 14.3 C1.6 14.3 1.6 14.3 0 14.3 C-0.9 14.3 -1.8 14.3 -2.8 14.3 C-4.8 14.1 -4.8 14.1 -5.8 13.1 C-5.9 11.1 -6 9.1 -5.9 7.1 C-5.9 6 -6 4.9 -6 3.8 C-5.7 -0.7 -4.1 0 0 0 Z",t=(C=128)=>`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="${C}" height="${C}" viewBox="0 0 128 128"><path d="${o}" fill="currentColor" transform="translate(54.3,21.1)"/><path d="${s}" fill="currentColor" transform="translate(6.8,97.9)"/></svg>`,a=({size:C=24,...n})=>e("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:C,height:C,viewBox:"0 0 128 128",fill:"currentColor",...n,children:[r("path",{d:o,transform:"translate(54.3,21.1)"}),r("path",{d:s,transform:"translate(6.8,97.9)"})]}),p={ja:{title:"@passport\u3067\u30ED\u30B0\u30A4\u30F3",description:"@passport\u306F\u3001\u5404\u30A2\u30D7\u30EA\u3067\u306E\u30CF\u30F3\u30C9\u30EB\u5165\u529B\u3092\u4E0D\u8981\u306B\u3059\u308B\u30CF\u30F3\u30C9\u30EB\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC\u3067\u3059\u3002"},en:{title:"Login with @passport",description:"@passport is a handle manager that eliminates the need for handle entry in each app."},iconSvg:t(128),getIconSvg:t};export{a as AtPassportIcon,p as AtPassportUI};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atpassport/client",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "AtPassport client library for integrating secure handle input assist into applications.",
5
5
  "keywords": [
6
6
  "atproto",
@@ -1 +0,0 @@
1
- var d=class{baseUrl;callbackUrl;lang;constructor(t){this.baseUrl=(t.baseUrl||"https://atpassport.net").replace(/\/$/,""),this.callbackUrl=t.callbackUrl,this.lang=t.lang}generateAuthUrl(t){let a=crypto.randomUUID(),e=this.lang?`${this.lang}/authentication`:"authentication",s=new URL(`${this.baseUrl}/${e}`),r=new URL(this.callbackUrl);if(t)for(let[i,n]of Object.entries(t))r.searchParams.set(i,n);return s.searchParams.set("callback",r.toString()),s.searchParams.set("atpstate",a),{url:s.toString(),atpstate:a}}parseCallback(t,a){let e=new URL(t),s=e.searchParams.get("handle"),r=e.searchParams.get("did"),i=e.searchParams.get("pdsurl"),n=e.searchParams.get("atpstate");if(a&&n!==a)throw new Error("Invalid atpstate: CSRF validation failed.");let l={};return e.searchParams.forEach((c,o)=>{["handle","did","pdsurl","atpstate"].includes(o)||(l[o]=c)}),{handle:s,did:r,pdsUrl:i,atpstate:n,customParams:l}}async pick(){return new Promise(t=>{let s=window.screenX+(window.outerWidth-400)/2,r=window.screenY+(window.outerHeight-500)/2,i=this.lang?`${this.lang}/picker`:"picker",n=`${this.baseUrl}/${i}`,l=window.open(n,"atpassport:picker",`width=400,height=500,left=${s},top=${r}`),c=h=>{h.origin===new URL(this.baseUrl).origin&&h.data?.type==="atpassport:pick"&&(window.removeEventListener("message",c),t(h.data.handle))};window.addEventListener("message",c);let o=setInterval(()=>{l?.closed&&clearInterval(o)},1e3)})}decorate(t){t.addEventListener("focus",async()=>{if(t.value)return;let a=await this.pick();a&&(t.value=a,t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))})}};export{d as a};
@@ -1 +0,0 @@
1
- import{jsx as r,jsxs as a}from"react/jsx-runtime";var o="M0 0 C1 0.5 2 1 3 1.5 C9.5 4.7 15.9 8.1 22.1 11.8 C25.2 13.2 27.3 13.3 30.7 12.9 C33.3 11.9 33.3 11.9 35.8 10.5 C44.4 5.8 54.9 5.7 64.5 7.5 C67.3 8.4 69.5 9.8 71.8 11.7 C73.2 15.3 72.9 17.3 71.7 20.9 C64.5 26.2 56.2 29.7 48.1 33.6 C46.6 34.3 45.2 35 43.7 35.7 C40 37.5 36.3 39.2 32.7 41 C29.9 42.3 27 43.7 24.2 45 C20.5 46.8 16.8 48.6 13.2 50.3 C9.2 52.2 5.3 54.1 1.3 56 C0.3 56.5 -0.8 57 -1.8 57.6 C-3.9 58.5 -5.9 59.5 -7.9 60.5 C-8.8 60.9 -9.7 61.4 -10.6 61.8 C-11.4 62.2 -12.2 62.6 -13 63 C-18.7 65.3 -24.9 66.1 -30.8 64.1 C-36.8 61.3 -41 57.8 -45.3 52.9 C-46 52.2 -46.6 51.6 -47.3 50.9 C-52.6 45 -52.6 45 -53.3 40.9 C-52 40.1 -50.7 39.3 -49.4 38.5 C-48.7 38 -48 37.6 -47.3 37.1 C-43.7 34.9 -41.5 34.6 -37.3 34.9 C-34.4 36.3 -31.8 38 -29.1 39.7 C-25.5 41.3 -24.1 41.1 -20.3 39.9 C-16.9 38.4 -13.7 36.7 -10.4 34.9 C-9.1 34.2 -9.1 34.2 -7.8 33.4 C-5.6 32.3 -3.5 31.1 -1.3 29.9 C-3.6 26.9 -5.9 24.2 -8.8 21.8 C-13 18.3 -17 14.6 -21 10.8 C-24 8.1 -27.1 5.5 -30.3 2.9 C-30.3 0.6 -30.3 0.6 -29.3 -2.1 C-18.8 -7.6 -10.1 -5.2 0 0 Z",s="M0 0 C1 -0 2.1 -0 3.2 -0 C4.3 -0 5.5 -0 6.7 -0 C7.9 -0 9.1 -0 10.3 -0 C13.6 -0 17 -0 20.3 -0 C23.8 -0 27.2 -0 30.7 -0 C36.5 -0 42.4 -0 48.2 -0 C54.9 0 61.7 0 68.4 -0 C74.2 -0 80 -0 85.8 -0 C89.2 -0 92.7 -0 96.1 -0 C100 -0 103.8 -0 107.7 -0 C109.4 -0 109.4 -0 111.2 -0 C112.8 -0 112.8 -0 114.4 0 C115.3 0 116.2 0 117.1 0 C119.2 0.1 119.2 0.1 120.2 1.1 C120.3 3.1 120.3 5.1 120.3 7.1 C120.3 8.8 120.3 8.8 120.3 10.4 C120.2 13.1 120.2 13.1 119.2 14.1 C117.6 14.2 116 14.3 114.4 14.3 C113.3 14.3 112.3 14.3 111.2 14.3 C110 14.3 108.9 14.3 107.7 14.3 C106.5 14.3 105.3 14.3 104 14.3 C100.7 14.3 97.4 14.3 94.1 14.3 C90.6 14.3 87.1 14.3 83.7 14.3 C77.8 14.3 72 14.3 66.2 14.3 C59.4 14.3 52.7 14.3 45.9 14.3 C40.2 14.3 34.4 14.3 28.6 14.3 C25.1 14.3 21.7 14.3 18.2 14.3 C14.4 14.3 10.5 14.3 6.7 14.3 C4.9 14.3 4.9 14.3 3.2 14.3 C1.6 14.3 1.6 14.3 0 14.3 C-0.9 14.3 -1.8 14.3 -2.8 14.3 C-4.8 14.1 -4.8 14.1 -5.8 13.1 C-5.9 11.1 -6 9.1 -5.9 7.1 C-5.9 6 -6 4.9 -6 3.8 C-5.7 -0.7 -4.1 0 0 0 Z",t=(C=128)=>`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="${C}" height="${C}" viewBox="0 0 128 128"><path d="${o}" fill="currentColor" transform="translate(54.3,21.1)"/><path d="${s}" fill="currentColor" transform="translate(6.8,97.9)"/></svg>`,e=({size:C=24,...n})=>a("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:C,height:C,viewBox:"0 0 128 128",fill:"currentColor",...n,children:[r("path",{d:o,transform:"translate(54.3,21.1)"}),r("path",{d:s,transform:"translate(6.8,97.9)"})]}),p={ja:{title:"@passport\u3067\u30ED\u30B0\u30A4\u30F3",description:"@passport\u306F\u3001\u5404atproto\u30A2\u30D7\u30EA\u3067\u30CF\u30F3\u30C9\u30EB\u3092\u90FD\u5EA6\u5165\u529B\u3059\u308B\u624B\u9593\u304C\u7701\u3051\u308B\u5171\u901A\u30CF\u30F3\u30C9\u30EB\u30DE\u30CD\u30FC\u30B8\u30E3\u30FC\u3067\u3059\u3002"},en:{title:"Login with @passport",description:"@passport is a universal handle manager that saves you from typing your handle repeatedly across atproto apps."},iconSvg:t(128),getIconSvg:t};export{e as a,p as b};