@fkn/lib 0.9.64 → 0.9.65
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 +1 -2
- package/account-Bm7uIcQo.d.ts +39 -0
- package/account-Uh0-1Cbp.js +22 -0
- package/{account-generation-BiZxPztj.cjs → account-generation-ACCBzaI-.cjs} +1 -1
- package/{account-generation-DvRuJDa2.js → account-generation-BKHNe-jL.js} +2 -3
- package/account-m2iCmNui.cjs +1 -0
- package/{account-storage-D8CBG1cv.js → account-storage-BmCVutNL.js} +4 -5
- package/{account-storage-Co9IvkPr.d.ts → account-storage-UmSfF63A.d.ts} +1 -66
- package/{account-storage-DpHBgeX5.cjs → account-storage-dYWDpqsr.cjs} +1 -1
- package/account.cjs +1 -1
- package/account.d.ts +3 -40
- package/account.js +1 -23
- package/{api-xh6lzApn.d.ts → api-0Yp9uZcV.d.ts} +3 -7
- package/{api-BvJu2X1L.js → api-DRglK7ft.js} +19 -21
- package/{api-CrUO33y-.cjs → api-DrvhPN56.cjs} +1 -1
- package/api.cjs +1 -1
- package/api.d.ts +2 -2
- package/api.js +1 -2
- package/attach-policy.d.ts +0 -4
- package/attach-policy.js +2 -3
- package/{broker-frame-B31OXcnH.js → broker-frame-vjSpBa8d.js} +1 -2
- package/broker-frame.d.ts +1 -3
- package/broker-frame.js +1 -2
- package/{busy-DsMWrSzc.js → busy-C1JPjoZ_.js} +1 -2
- package/cloud/dgram.cjs +1 -1
- package/cloud/dgram.d.ts +1 -1
- package/cloud/dgram.js +1 -2
- package/cloud/dns.cjs +1 -1
- package/cloud/dns.d.ts +2 -2
- package/cloud/dns.js +1 -2
- package/cloud/fetch.cjs +1 -1
- package/cloud/fetch.d.ts +1 -1
- package/cloud/fetch.js +1 -2
- package/cloud/fs/promises.cjs +1 -1
- package/cloud/fs/promises.d.ts +3 -5
- package/cloud/fs/promises.js +2 -3
- package/cloud/fs.cjs +1 -1
- package/cloud/fs.d.ts +4 -4
- package/cloud/fs.js +4 -34
- package/cloud/http.cjs +1 -1
- package/cloud/http.d.ts +1 -1
- package/cloud/http.js +1 -2
- package/cloud/net.cjs +1 -1
- package/cloud/net.d.ts +1 -1
- package/cloud/net.js +3 -3
- package/{cloud-CI7FFRMC.d.ts → cloud-BoH54gaM.d.ts} +7 -11
- package/{cloud-FW59_g8F.js → cloud-C7StNncS.js} +15 -16
- package/cloud-TN0eDUy3.cjs +1 -0
- package/cloud.cjs +1 -1
- package/cloud.d.ts +7 -7
- package/cloud.js +7 -7
- package/connect-button-2FmOM8ai.d.ts +2 -0
- package/{connect-button-DtsN3X1J.js → connect-button-C1wKkIhh.js} +1 -2
- package/{contract-BGMJVvTg.d.ts → contract-0rua6Wsh.d.ts} +11 -6
- package/contract.d.ts +3 -3
- package/contract.js +1 -2
- package/desktop-DOubT4ES.d.ts +57 -0
- package/desktop-vXKU4wEK.cjs +1 -0
- package/desktop-xTT7ciGX.js +50 -0
- package/desktop.cjs +1 -1
- package/desktop.d.ts +2 -58
- package/desktop.js +1 -51
- package/dgram-BBbLokVF.js +397 -0
- package/dgram-BYk-QDHW.d.ts +118 -0
- package/dgram-D9ljiUFh.cjs +1 -0
- package/dgram.cjs +1 -1
- package/dgram.d.ts +2 -119
- package/dgram.js +1 -410
- package/dns-2v96zoEh.cjs +1 -0
- package/dns-DyB4K2oE.d.ts +9 -0
- package/dns-o8DLFjP1.js +5 -0
- package/dns.cjs +1 -1
- package/dns.d.ts +3 -10
- package/dns.js +1 -6
- package/extension-BXBjpypy.cjs +1 -0
- package/{extension-Chmpunqf.js → extension-D5UMnEmQ.js} +9 -11
- package/{extension-C1bcizcn.d.ts → extension-D98KM8W7.d.ts} +1 -27
- package/extension.cjs +1 -1
- package/extension.d.ts +2 -2
- package/extension.js +2 -2
- package/fs/promises.cjs +1 -1
- package/fs/promises.d.ts +2 -4
- package/fs/promises.js +2 -3
- package/fs--MLHvMW-.cjs +1 -0
- package/fs-BX_ghRy0.cjs +1 -0
- package/fs-BnWXGRik.js +33 -0
- package/{fs-DCJAYoYy.d.ts → fs-ChOYC6VD.d.ts} +3 -4
- package/{fs-Djuaj5pQ.js → fs-Cw7CcUhx.js} +17 -41
- package/fs.cjs +1 -1
- package/fs.d.ts +4 -4
- package/fs.js +2 -2
- package/{hosts-t7CKGTRz.js → hosts-HUfgMimI.js} +1 -2
- package/http-BE3UBktN.cjs +9 -0
- package/http-CDhG4bUc.d.ts +187 -0
- package/http-DIDjdm08.js +523 -0
- package/http.cjs +1 -9
- package/http.d.ts +2 -188
- package/http.js +1 -542
- package/index-CUWTpQKP.d.ts +87 -0
- package/{index-BQgZVQl7.d.ts → index-CcVwh9yz.d.ts} +0 -2
- package/{index-C5DdoMGo.d.ts → index-Cu5EcdK0.d.ts} +0 -59
- package/{index-57lTXnoe.d.ts → index-D6GPJ4Ow.d.ts} +29 -26
- package/index.cjs +1 -1
- package/index.d.ts +17 -25
- package/index.js +22 -27
- package/lib-Bs-g5jyp.cjs +53 -0
- package/{lib-BrsqpUkv.js → lib-CtJaID_y.js} +7 -31
- package/{messages-AdPfdoLV.d.ts → messages-B9dOXntM.d.ts} +0 -2
- package/messages.d.ts +1 -1
- package/messages.js +1 -2
- package/net-COkJw8lV.js +286 -0
- package/net-Dk2kqtgE.cjs +1 -0
- package/{net-BpyIeQ8r.d.ts → net-mVAYXs8e.d.ts} +5 -7
- package/net.cjs +1 -1
- package/net.d.ts +1 -1
- package/net.js +3 -323
- package/{node-fs-DY2fO5zd.js → node-fs-B4pY08Kc.js} +3 -10
- package/node-fs-DN0ejGTL.cjs +1 -0
- package/opfs/promises.cjs +1 -1
- package/opfs/promises.d.ts +2 -4
- package/opfs/promises.js +2 -3
- package/{opfs-D0goLAQW.js → opfs-CzCfVam3.js} +2 -3
- package/opfs-D3pYzYRc.js +35 -0
- package/opfs-DuXvTgIl.cjs +1 -0
- package/opfs.cjs +1 -1
- package/opfs.d.ts +3 -88
- package/opfs.js +1 -36
- package/package.json +1 -1
- package/packages-BEadIy_h.d.ts +155 -0
- package/packages-Cws_rcgf.js +346 -0
- package/packages-DT8vPB5_.cjs +1 -0
- package/packages.cjs +1 -1
- package/packages.d.ts +3 -156
- package/packages.js +1 -347
- package/{proxy-C4sYkxB5.js → proxy-BBAQxJmP.js} +5 -6
- package/{proxy-Dz60YyYy.d.ts → proxy-BP40IXYD.d.ts} +2 -4
- package/{proxy-jdE5tCwz.cjs → proxy-DVgGp6A8.cjs} +1 -1
- package/react.cjs +1 -1
- package/react.d.ts +16 -4
- package/react.js +96 -7
- package/{relay-choice-BGwXRC5d.js → relay-choice-Bb3oP2gw.js} +1 -2
- package/{relay-choice-5yUPI-tJ.d.ts → relay-choice-DOUttUnL.d.ts} +2 -4
- package/{rolldown-runtime-Dy4uBu1J.js → rolldown-runtime-CGnMp29N.js} +1 -2
- package/rooms-C6mbannC.d.ts +227 -0
- package/rooms-DHFS9cwA.cjs +1 -0
- package/rooms-DP5stTEr.js +300 -0
- package/rooms.cjs +1 -1
- package/rooms.d.ts +3 -228
- package/rooms.js +1 -301
- package/storage-BCjYihUO.cjs +1 -0
- package/storage-BhfImh_2.js +136 -0
- package/storage-DpCLksAa.d.ts +68 -0
- package/storage.cjs +1 -1
- package/storage.d.ts +3 -69
- package/storage.js +1 -137
- package/{utils-Cyq8uJiy.js → utils-DtWP-E9x.js} +1 -2
- package/{wire-Fk5pJaoy.d.ts → wire-DhmLnYEU.d.ts} +0 -2
- package/wire.d.ts +1 -1
- package/wire.js +1 -2
- package/cloud-DcgY8Xfp.cjs +0 -1
- package/connect-button-Cp0NS95-.d.ts +0 -4
- package/extension-I2Ziv2pk.cjs +0 -1
- package/fs-DeyJwJ3w.cjs +0 -1
- package/lib-C_X3WR4G.cjs +0 -53
- package/node-fs-vsWuoMGa.cjs +0 -1
package/packages.d.ts
CHANGED
|
@@ -1,156 +1,3 @@
|
|
|
1
|
-
import { E as InstalledPackage, F as PackageResult, I as PackagesErrorCode, J as Radii, P as PackageQuery, R as PickOptions, Rt as SurfaceRect, T as InstallOptions, m as ConnectOptions, z as Placement } from "./contract-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export { AppConnectOptions, Connect, ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, InstallOptions, InstalledPackage, MountOptions, MountedPackage, PackageConnection, PackageQuery, PackageResult, PackageView, PackagesError, PackagesErrorCode, PickOptions, Placement, Radii, RawPackageConnection, ShowOptions, SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
|
5
|
-
}
|
|
6
|
-
export type PackagesError = Error & {
|
|
7
|
-
code: PackagesErrorCode;
|
|
8
|
-
};
|
|
9
|
-
/** Search npm for FKN packages, e.g. `search({ type: 'plugin', id: 'stub' })`. */
|
|
10
|
-
export declare const search: (query: PackageQuery) => Promise<PackageResult[]>;
|
|
11
|
-
/** FKN-rendered picker over the same search; resolves the user's selection, already installed. [] on cancel. */
|
|
12
|
-
export declare const pick: (query: PackageQuery, options?: PickOptions) => Promise<PackageResult[]>;
|
|
13
|
-
/** Install a package for this app behind an FKN-rendered confirm, or with `{ noConfirm: true }` for a notice instead of a prompt. Resolves null when the user declines. */
|
|
14
|
-
export declare const install: (uri: string, options?: InstallOptions) => Promise<InstalledPackage | null>;
|
|
15
|
-
/** The packages installed by this app. */
|
|
16
|
-
export declare const list: () => Promise<InstalledPackage[]>;
|
|
17
|
-
/** Uninstall a package from this app; its frames and connections are torn down. */
|
|
18
|
-
export declare const uninstall: (uri: string) => Promise<void>;
|
|
19
|
-
export type ShowOptions = {
|
|
20
|
-
/**
|
|
21
|
-
* A placeholder the package frame is aligned to for as long as the view lives. The frame tracks its
|
|
22
|
-
* rect every animation frame, is clipped by its scrolling ancestors, and follows its border-radius,
|
|
23
|
-
* so it reads as inline content even though it renders in FKN's overlay.
|
|
24
|
-
*/
|
|
25
|
-
element?: HTMLElement;
|
|
26
|
-
/** an explicit viewport rect, for a caller that tracks placement itself */
|
|
27
|
-
rect?: SurfaceRect;
|
|
28
|
-
};
|
|
29
|
-
export type PackageView = {
|
|
30
|
-
/** release this view; equivalent to `packages.hide(uri, { element })` */
|
|
31
|
-
hide: () => void;
|
|
32
|
-
/** force a re-measure, e.g. right after a layout change the tracker cannot observe */
|
|
33
|
-
refresh: () => void;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Show an installed, connected package's frame over this page, aligned to `element` (or an explicit
|
|
37
|
-
* `rect`). The package renders its own UI there; the app keeps the space in its own layout. Take it
|
|
38
|
-
* back down with `hide()` on the returned view, or with `packages.hide(uri)`. Throws a PackagesError
|
|
39
|
-
* with code 'not-installed' when the package has not been connected by this app.
|
|
40
|
-
*/
|
|
41
|
-
export declare const show: (uri: string, options: ShowOptions) => Promise<PackageView>;
|
|
42
|
-
/**
|
|
43
|
-
* Hide a package's frame again, the counterpart to `show()`. Pass the same `element` to release only
|
|
44
|
-
* the view bound to it; with no element every view of this package is released. The connection is
|
|
45
|
-
* untouched, so the package can be shown again.
|
|
46
|
-
*/
|
|
47
|
-
export declare const hide: (uri: string, options?: ShowOptions) => Promise<void>;
|
|
48
|
-
export type PackageConnection<T = unknown> = {
|
|
49
|
-
/** the package's exposed payload */
|
|
50
|
-
remote: Remote<T>;
|
|
51
|
-
/** settles when the package side of the connection dies (uninstall, reload, crash) - reconnect by calling connect() again */
|
|
52
|
-
closed: Promise<void>;
|
|
53
|
-
/** the raw channel under `remote`, for direct messaging (osra envelopes ride it too - filter by your own message shape) */
|
|
54
|
-
port: MessagePort;
|
|
55
|
-
};
|
|
56
|
-
export type AppConnectOptions = ConnectOptions & {
|
|
57
|
-
/** exposed to the package as ITS `remote` */
|
|
58
|
-
payload?: unknown;
|
|
59
|
-
signal?: AbortSignal;
|
|
60
|
-
/** skip the osra handshake and hand back the untouched port - e.g. to transfer it into a worker and attach() there */
|
|
61
|
-
raw?: boolean;
|
|
62
|
-
};
|
|
63
|
-
export type RawPackageConnection = Omit<PackageConnection<never>, 'remote'>;
|
|
64
|
-
export type Connect = {
|
|
65
|
-
<T = unknown>(uri: string, options?: AppConnectOptions & {
|
|
66
|
-
raw?: false;
|
|
67
|
-
}): Promise<PackageConnection<T>>;
|
|
68
|
-
(uri: string, options: AppConnectOptions & {
|
|
69
|
-
raw: true;
|
|
70
|
-
}): Promise<RawPackageConnection>;
|
|
71
|
-
};
|
|
72
|
-
/** Connect to an installed package. Throws a PackagesError with code 'not-installed' when it is not. */
|
|
73
|
-
export declare const connect: Connect;
|
|
74
|
-
export type MountOptions = AppConnectOptions & {
|
|
75
|
-
/**
|
|
76
|
-
* the iframe the package is loaded into. YOU create it and YOU own it: its attributes, its styles and
|
|
77
|
-
* its place in your layout are yours, and `mount` only navigates it.
|
|
78
|
-
*
|
|
79
|
-
* Set `allow` yourself for anything the package needs delegated, e.g. `allow="fullscreen; autoplay"`.
|
|
80
|
-
* Permissions policy is not inherited, so a capability this frame is not granted cannot be recovered
|
|
81
|
-
* by the package or by anything it nests inside itself.
|
|
82
|
-
*/
|
|
83
|
-
iframe: HTMLIFrameElement;
|
|
84
|
-
};
|
|
85
|
-
export type MountedPackage<T = unknown> = PackageConnection<T> & {
|
|
86
|
-
/** the iframe you passed in, unchanged apart from its `src` */
|
|
87
|
-
frame: HTMLIFrameElement;
|
|
88
|
-
/** blank the frame and settle `closed`; the element stays in your layout because it is yours */
|
|
89
|
-
unmount: () => void;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Load a package into an iframe of YOUR OWN and connect to it, instead of positioning a frame the broker
|
|
93
|
-
* owns and clipping the overlay to it the way `show()` does.
|
|
94
|
-
*
|
|
95
|
-
* You pass the iframe, the same way `cloud.attachFrame` takes one. It lays out, scrolls, stacks and
|
|
96
|
-
* fullscreens with the rest of your page, there is no geometry to translate, and every attribute on it
|
|
97
|
-
* stays exactly as you set it: `mount` reads `sandbox` and `allow` to check the package can boot, then
|
|
98
|
-
* writes nothing but `src`. The package still gets its own origin and its own broker connection.
|
|
99
|
-
*
|
|
100
|
-
* Grant capabilities through the iframe's own `allow`, before calling this. Permissions policy is read
|
|
101
|
-
* at navigation and is not inherited, so it cannot be added afterwards on the frame handed back.
|
|
102
|
-
*
|
|
103
|
-
* Needs a package built against this version of the lib: an older one only accepts a port from fkn.app.
|
|
104
|
-
* The package reads `brokered: false`.
|
|
105
|
-
*/
|
|
106
|
-
export declare const mount: <T = unknown>(uri: string, options: MountOptions) => Promise<MountedPackage<T>>;
|
|
107
|
-
/** Run this end of an already-brokered connection port, e.g. after transferring it into a worker. */
|
|
108
|
-
export declare const attach: <T = unknown>(port: MessagePort, payload?: unknown, options?: {
|
|
109
|
-
signal?: AbortSignal;
|
|
110
|
-
}) => Promise<Remote<T>>;
|
|
111
|
-
export type IncomingConnectionInfo = {
|
|
112
|
-
/**
|
|
113
|
-
* The connecting app's identity: its package uri when it runs on a sandbox origin, else its page
|
|
114
|
-
* origin. Proof of nothing unless `brokered` is true: under `packages.mount`, or in any page that
|
|
115
|
-
* frames this package's url itself, the embedder writes whatever it likes here.
|
|
116
|
-
*/
|
|
117
|
-
from: string;
|
|
118
|
-
/**
|
|
119
|
-
* True only when fkn.app's broker made this connection (`packages.connect`), so `from` is the app the
|
|
120
|
-
* broker identified by its browser-set origin. False under `packages.mount` and for any other embedder.
|
|
121
|
-
* Worked out here from the origin of the message that carried the port, never read from the message.
|
|
122
|
-
* Key what a connection is allowed (a grant you stored, an app named to the person) to `from` only
|
|
123
|
-
* when this is true. A package built on a lib older than this field gets none, so test `=== true`.
|
|
124
|
-
*/
|
|
125
|
-
brokered: boolean;
|
|
126
|
-
/** the contract tag the app passed to connect(), e.g. 'stub-source@1' */
|
|
127
|
-
protocol: string | null;
|
|
128
|
-
/** this package's normalized uri per the connecting app's install record, e.g. 'npm:@banou/stub-source-example' */
|
|
129
|
-
uri: string;
|
|
130
|
-
/** this package's npm name */
|
|
131
|
-
name: string;
|
|
132
|
-
/** the exact version this frame runs - the pin is encoded into the sandbox origin, immutable per version */
|
|
133
|
-
version: string;
|
|
134
|
-
};
|
|
135
|
-
export type IncomingConnection<T = unknown> = IncomingConnectionInfo & PackageConnection<T>;
|
|
136
|
-
/** produces the payload exposed to a connecting app - called once per incoming connection */
|
|
137
|
-
export type ConnectPayload = (info: IncomingConnectionInfo) => unknown;
|
|
138
|
-
/**
|
|
139
|
-
* Serve connections from apps that installed this package. The first argument is called once per
|
|
140
|
-
* incoming connection with the connection info and returns the payload exposed to that app (its
|
|
141
|
-
* `remote`). The latest registration receives new connections; existing connections are unaffected.
|
|
142
|
-
*/
|
|
143
|
-
export declare const onConnect: <T = unknown>(createPayload: ConnectPayload, handler?: (connection: IncomingConnection<T>) => void) => {
|
|
144
|
-
unsubscribe: () => void;
|
|
145
|
-
};
|
|
146
|
-
/** True while a host app is showing this package's frame. Packages start hidden. */
|
|
147
|
-
export declare const isVisible: () => boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Observe whether a host app is showing this package's frame, so it can render its UI only while on
|
|
150
|
-
* screen. The handler is called immediately with the current state, and on every change after.
|
|
151
|
-
*/
|
|
152
|
-
export declare const onVisibilityChange: (handler: (visible: boolean) => void) => {
|
|
153
|
-
unsubscribe: () => void;
|
|
154
|
-
};
|
|
155
|
-
//#endregion
|
|
156
|
-
export { type ConnectOptions, type InstallOptions, type InstalledPackage, type PackageQuery, type PackageResult, type PackagesErrorCode, type PickOptions, type Placement, type Radii, type SurfaceRect, packages_d_exports as t };
|
|
1
|
+
import { E as InstalledPackage, F as PackageResult, I as PackagesErrorCode, J as Radii, P as PackageQuery, R as PickOptions, Rt as SurfaceRect, T as InstallOptions, m as ConnectOptions, z as Placement } from "./contract-0rua6Wsh.js";
|
|
2
|
+
import { C as pick, E as uninstall, T as show, _ as isVisible, a as IncomingConnectionInfo, b as onConnect, c as PackageConnection, d as RawPackageConnection, f as ShowOptions, g as install, h as hide, i as IncomingConnection, l as PackageView, m as connect, n as Connect, o as MountOptions, p as attach, r as ConnectPayload, s as MountedPackage, t as AppConnectOptions, u as PackagesError, v as list, w as search, x as onVisibilityChange, y as mount } from "./packages-BEadIy_h.js";
|
|
3
|
+
export { AppConnectOptions, Connect, type ConnectOptions, ConnectPayload, IncomingConnection, IncomingConnectionInfo, type InstallOptions, type InstalledPackage, MountOptions, MountedPackage, PackageConnection, type PackageQuery, type PackageResult, PackageView, PackagesError, type PackagesErrorCode, type PickOptions, type Placement, type Radii, RawPackageConnection, ShowOptions, type SurfaceRect, attach, connect, hide, install, isVisible, list, mount, onConnect, onVisibilityChange, pick, search, show, uninstall };
|
package/packages.js
CHANGED
|
@@ -1,347 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { c as t, l as n, o as r, u as i } from "./api-BvJu2X1L.js";
|
|
3
|
-
import { i as a, t as o } from "./busy-DsMWrSzc.js";
|
|
4
|
-
import { expose as s } from "osra";
|
|
5
|
-
//#region src/packages.ts
|
|
6
|
-
var c = /* @__PURE__ */ e({
|
|
7
|
-
attach: () => I,
|
|
8
|
-
connect: () => A,
|
|
9
|
-
hide: () => k,
|
|
10
|
-
install: () => v,
|
|
11
|
-
isVisible: () => X,
|
|
12
|
-
list: () => y,
|
|
13
|
-
mount: () => F,
|
|
14
|
-
onConnect: () => Y,
|
|
15
|
-
onVisibilityChange: () => Z,
|
|
16
|
-
pick: () => _,
|
|
17
|
-
search: () => g,
|
|
18
|
-
show: () => O,
|
|
19
|
-
uninstall: () => b
|
|
20
|
-
}), l = "fkn-packages-connection", u = "https://fkn.app", d = 3e4, f = (e, t) => Object.assign(Error(t), { code: e }), p = async () => {
|
|
21
|
-
if (!n) throw f("unavailable", "packages: no FKN transport in this realm - use relayWorker to bridge workers");
|
|
22
|
-
return r;
|
|
23
|
-
}, m = (e, t, n) => s(e ?? {}, {
|
|
24
|
-
transport: t,
|
|
25
|
-
key: l,
|
|
26
|
-
unregisterSignal: n
|
|
27
|
-
}), h = async (e, t, n = {}) => {
|
|
28
|
-
let { signal: r, closed: i } = n;
|
|
29
|
-
if (r?.aborted) throw f("unavailable", "packages.connect: aborted before connecting");
|
|
30
|
-
let a = new AbortController();
|
|
31
|
-
r && r.addEventListener("abort", () => a.abort(r.reason), { once: !0 });
|
|
32
|
-
let o = new AbortController(), s = new Promise((e, n) => {
|
|
33
|
-
let a = setTimeout(() => n(f("timeout", "packages.connect: the package did not complete the connection")), d);
|
|
34
|
-
o.signal.addEventListener("abort", () => clearTimeout(a), { once: !0 }), t.addEventListener("message", (e) => {
|
|
35
|
-
if (e.data?.type === "fkn-packages-nack") {
|
|
36
|
-
let t = e.data.message;
|
|
37
|
-
n(f("unavailable", typeof t == "string" && t ? t : "packages.connect: the package refused the connection"));
|
|
38
|
-
}
|
|
39
|
-
}, { signal: o.signal }), t.start(), r && r.addEventListener("abort", () => n(f("unavailable", "packages.connect: aborted before connecting")), {
|
|
40
|
-
once: !0,
|
|
41
|
-
signal: o.signal
|
|
42
|
-
}), i?.then(() => n(f("unavailable", "packages.connect: the package closed before connecting")));
|
|
43
|
-
});
|
|
44
|
-
try {
|
|
45
|
-
return await Promise.race([m(e, t, a.signal), s]);
|
|
46
|
-
} catch (e) {
|
|
47
|
-
a.abort(e);
|
|
48
|
-
try {
|
|
49
|
-
t.close();
|
|
50
|
-
} catch {}
|
|
51
|
-
throw e;
|
|
52
|
-
} finally {
|
|
53
|
-
o.abort();
|
|
54
|
-
}
|
|
55
|
-
}, g = async (e) => {
|
|
56
|
-
let t = await (await p()).packages.search(e);
|
|
57
|
-
if ("error" in t) throw f(t.error, t.message);
|
|
58
|
-
return t.results;
|
|
59
|
-
}, _ = async (e, t) => {
|
|
60
|
-
let n = await (await p()).packages.pick(e, t);
|
|
61
|
-
if ("error" in n) throw f(n.error, n.message);
|
|
62
|
-
return "declined" in n ? [] : n.results;
|
|
63
|
-
}, v = async (e, t) => {
|
|
64
|
-
let n = await (await p()).packages.install(e, t);
|
|
65
|
-
if ("error" in n) throw f(n.error, n.message);
|
|
66
|
-
return "declined" in n ? null : n.installed;
|
|
67
|
-
}, y = async () => (await (await p()).packages.list()).results, b = async (e) => {
|
|
68
|
-
let t = await (await p()).packages.uninstall(e);
|
|
69
|
-
if ("error" in t) throw f(t.error, t.message);
|
|
70
|
-
}, x = ({ x: e, y: t, width: n, height: r }) => ({
|
|
71
|
-
x: Math.round(e),
|
|
72
|
-
y: Math.round(t),
|
|
73
|
-
width: Math.round(n),
|
|
74
|
-
height: Math.round(r)
|
|
75
|
-
}), S = (e, t) => {
|
|
76
|
-
let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y);
|
|
77
|
-
return {
|
|
78
|
-
x: n,
|
|
79
|
-
y: r,
|
|
80
|
-
width: Math.max(0, Math.min(e.x + e.width, t.x + t.width) - n),
|
|
81
|
-
height: Math.max(0, Math.min(e.y + e.height, t.y + t.height) - r)
|
|
82
|
-
};
|
|
83
|
-
}, C = (e, t) => {
|
|
84
|
-
let n = t;
|
|
85
|
-
for (let t = e.parentElement; t; t = t.parentElement) {
|
|
86
|
-
let e = getComputedStyle(t);
|
|
87
|
-
if ((e.overflowX !== "visible" || e.overflowY !== "visible") && (n = S(n, x(t.getBoundingClientRect())), n.width === 0 || n.height === 0)) break;
|
|
88
|
-
}
|
|
89
|
-
return n;
|
|
90
|
-
}, w = (e) => {
|
|
91
|
-
let t = getComputedStyle(e), n = [
|
|
92
|
-
t.borderTopLeftRadius,
|
|
93
|
-
t.borderTopRightRadius,
|
|
94
|
-
t.borderBottomRightRadius,
|
|
95
|
-
t.borderBottomLeftRadius
|
|
96
|
-
];
|
|
97
|
-
if (n.some((e) => e.includes("%") || e.includes(" "))) return;
|
|
98
|
-
let r = n.map((e) => {
|
|
99
|
-
let t = Number.parseFloat(e);
|
|
100
|
-
return Number.isFinite(t) && t > 0 ? t : 0;
|
|
101
|
-
});
|
|
102
|
-
return r.some((e) => e > 0) ? r : void 0;
|
|
103
|
-
}, T = (e, t) => {
|
|
104
|
-
if (!e) return !1;
|
|
105
|
-
let n = (e, t) => e === t || !!e && !!t && e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
|
|
106
|
-
return n(e.rect, t.rect) && n(e.clip, t.clip) && ((e, t) => e === t || !!e && !!t && e.every((e, n) => e === t[n]))(e.radius, t.radius);
|
|
107
|
-
}, E = /* @__PURE__ */ new Map();
|
|
108
|
-
a("package view", () => E.size > 0);
|
|
109
|
-
var D = async (e, t) => {
|
|
110
|
-
let n = E.get(e);
|
|
111
|
-
if (n) {
|
|
112
|
-
for (let e of n) t && e.element !== t || (e.stop(), n.delete(e));
|
|
113
|
-
if (n.size > 0) return;
|
|
114
|
-
E.delete(e);
|
|
115
|
-
}
|
|
116
|
-
let r = await (await p()).packages.hide(e);
|
|
117
|
-
if ("error" in r) throw f(r.error, r.message);
|
|
118
|
-
}, O = async (e, t) => {
|
|
119
|
-
let { element: n, rect: r } = t;
|
|
120
|
-
if (!n && !r) throw f("invalid", "packages.show: pass an element or a rect");
|
|
121
|
-
let i = (await p()).packages, a = () => {
|
|
122
|
-
if (!n) return { rect: x(r) };
|
|
123
|
-
let e = x(n.getBoundingClientRect());
|
|
124
|
-
return {
|
|
125
|
-
rect: e,
|
|
126
|
-
clip: C(n, e),
|
|
127
|
-
radius: w(n)
|
|
128
|
-
};
|
|
129
|
-
}, o = !0, s, c = 0, l = async (t) => {
|
|
130
|
-
s = t;
|
|
131
|
-
let n = await i.show(e, t);
|
|
132
|
-
if ("error" in n) throw o = !1, f(n.error, n.message);
|
|
133
|
-
};
|
|
134
|
-
await l(a());
|
|
135
|
-
let u = () => {
|
|
136
|
-
if (!o) return;
|
|
137
|
-
let e = a();
|
|
138
|
-
T(s, e) || l(e).catch(() => {}), c = requestAnimationFrame(u);
|
|
139
|
-
};
|
|
140
|
-
n && (c = requestAnimationFrame(u));
|
|
141
|
-
let d = {
|
|
142
|
-
element: n,
|
|
143
|
-
stop: () => {
|
|
144
|
-
o = !1, cancelAnimationFrame(c);
|
|
145
|
-
}
|
|
146
|
-
}, m = E.get(e) ?? /* @__PURE__ */ new Set();
|
|
147
|
-
return m.add(d), E.set(e, m), {
|
|
148
|
-
hide: () => {
|
|
149
|
-
D(e, n).catch(() => {});
|
|
150
|
-
},
|
|
151
|
-
refresh: () => {
|
|
152
|
-
if (!o) return;
|
|
153
|
-
let e = a();
|
|
154
|
-
T(s, e) || l(e).catch(() => {});
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
}, k = async (e, t = {}) => D(e, t.element), A = (async (e, n = {}) => {
|
|
158
|
-
let r = await (await p()).packages.connect(e, {
|
|
159
|
-
protocol: n.protocol,
|
|
160
|
-
...n.path === void 0 ? {} : { path: n.path }
|
|
161
|
-
});
|
|
162
|
-
if ("error" in r) throw f(r.error, r.message);
|
|
163
|
-
let a = o("package connection"), s = t()?.epoch ?? 0, c = i((e, t) => {
|
|
164
|
-
t !== s && (a(), c());
|
|
165
|
-
});
|
|
166
|
-
Promise.resolve(r.closed).then(() => {
|
|
167
|
-
a(), c();
|
|
168
|
-
}, () => {
|
|
169
|
-
a(), c();
|
|
170
|
-
});
|
|
171
|
-
let { port: l, closed: u } = r;
|
|
172
|
-
if (n.raw) return {
|
|
173
|
-
closed: u,
|
|
174
|
-
port: l
|
|
175
|
-
};
|
|
176
|
-
let d = await h(n.payload, l, {
|
|
177
|
-
signal: n.signal,
|
|
178
|
-
closed: u
|
|
179
|
-
});
|
|
180
|
-
return n.signal && n.signal.addEventListener("abort", () => {
|
|
181
|
-
try {
|
|
182
|
-
l.postMessage({ type: "fkn-packages-disconnect" });
|
|
183
|
-
} catch {}
|
|
184
|
-
}, { once: !0 }), {
|
|
185
|
-
remote: d,
|
|
186
|
-
closed: u,
|
|
187
|
-
port: l
|
|
188
|
-
};
|
|
189
|
-
}), j = ["allow-scripts", "allow-same-origin"], M = (e) => {
|
|
190
|
-
let t = e.getAttribute("sandbox");
|
|
191
|
-
if (t !== null) {
|
|
192
|
-
let e = new Set(t.toLowerCase().split(/\s+/).filter(Boolean)), n = j.filter((t) => !e.has(t));
|
|
193
|
-
if (n.length) throw f("invalid", `packages.mount: the iframe's sandbox attribute must include ${n.join(" and ")}, or the package cannot start`);
|
|
194
|
-
}
|
|
195
|
-
if (globalThis.crossOriginIsolated && !new Set((e.getAttribute("allow") ?? "").toLowerCase().split(";").map((e) => e.trim().split(/\s+/)[0]).filter(Boolean)).has("cross-origin-isolated")) throw f("invalid", "packages.mount: this page is cross-origin isolated, so the iframe's allow attribute must include 'cross-origin-isolated' to hand that down to the package");
|
|
196
|
-
}, N = 3e4, P = (e, t) => new Promise((n, r) => {
|
|
197
|
-
let i = (e) => {
|
|
198
|
-
clearTimeout(o), window.removeEventListener("message", a), e ? r(e) : n();
|
|
199
|
-
}, a = (n) => {
|
|
200
|
-
if (n.source !== e.contentWindow || n.origin !== t) return;
|
|
201
|
-
let r = n.data;
|
|
202
|
-
if (r?.type === "fkn-packages-ready") return i();
|
|
203
|
-
r?.type === "fkn-packages-failed" && i(f("unavailable", typeof r.message == "string" && r.message ? r.message : "packages.mount: the package failed to boot"));
|
|
204
|
-
}, o = setTimeout(() => i(f("timeout", "packages.mount: the package did not register a connection handler")), N);
|
|
205
|
-
window.addEventListener("message", a);
|
|
206
|
-
}), F = async (e, t) => {
|
|
207
|
-
let { iframe: n } = t;
|
|
208
|
-
if (!(n instanceof HTMLIFrameElement)) throw f("invalid", "packages.mount: pass the iframe to load the package into");
|
|
209
|
-
if (!n.isConnected) throw f("invalid", "packages.mount: the iframe must be in the document before mounting into it");
|
|
210
|
-
M(n);
|
|
211
|
-
let r = await (await p()).packages.frame(e);
|
|
212
|
-
if ("error" in r) throw f(r.error, r.message);
|
|
213
|
-
n.src = r.url;
|
|
214
|
-
let i = { done: !1 }, a = () => {}, s = new Promise((e) => {
|
|
215
|
-
a = e;
|
|
216
|
-
}), c = o("mounted package"), l = () => {
|
|
217
|
-
if (!i.done) {
|
|
218
|
-
i.done = !0, c();
|
|
219
|
-
try {
|
|
220
|
-
n.contentWindow?.postMessage({ type: "fkn-packages-close" }, r.origin);
|
|
221
|
-
} catch {}
|
|
222
|
-
n.src = "about:blank", a();
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
try {
|
|
226
|
-
await P(n, r.origin);
|
|
227
|
-
} catch (e) {
|
|
228
|
-
throw l(), e;
|
|
229
|
-
}
|
|
230
|
-
let u = new MessageChannel(), d = n.contentWindow;
|
|
231
|
-
if (!d) throw l(), f("unavailable", "packages.mount: the frame was detached before it could connect");
|
|
232
|
-
d.postMessage({
|
|
233
|
-
type: "fkn-packages-port",
|
|
234
|
-
from: r.from,
|
|
235
|
-
protocol: t.protocol,
|
|
236
|
-
uri: r.uri,
|
|
237
|
-
name: r.name,
|
|
238
|
-
version: r.version
|
|
239
|
-
}, r.origin, [u.port2]);
|
|
240
|
-
try {
|
|
241
|
-
d.postMessage({
|
|
242
|
-
type: "fkn-packages-visibility",
|
|
243
|
-
visible: !0
|
|
244
|
-
}, r.origin);
|
|
245
|
-
} catch {}
|
|
246
|
-
if (t.raw) return {
|
|
247
|
-
closed: s,
|
|
248
|
-
port: u.port1,
|
|
249
|
-
frame: n,
|
|
250
|
-
unmount: l
|
|
251
|
-
};
|
|
252
|
-
try {
|
|
253
|
-
return {
|
|
254
|
-
remote: await h(t.payload, u.port1, {
|
|
255
|
-
signal: t.signal,
|
|
256
|
-
closed: s
|
|
257
|
-
}),
|
|
258
|
-
closed: s,
|
|
259
|
-
port: u.port1,
|
|
260
|
-
frame: n,
|
|
261
|
-
unmount: l
|
|
262
|
-
};
|
|
263
|
-
} catch (e) {
|
|
264
|
-
throw l(), e;
|
|
265
|
-
}
|
|
266
|
-
}, I = (e, t, n) => h(t, e, { signal: n?.signal }), L = null, R = !1, z = /* @__PURE__ */ new Set(), B = [], V = /* @__PURE__ */ new Map(), H = !1, U = !1, W = (e) => {
|
|
267
|
-
let t = V.get(e);
|
|
268
|
-
t && (V.delete(e), t());
|
|
269
|
-
}, G = (e, t) => {
|
|
270
|
-
try {
|
|
271
|
-
e.postMessage({
|
|
272
|
-
type: "fkn-packages-nack",
|
|
273
|
-
message: t
|
|
274
|
-
});
|
|
275
|
-
} catch {}
|
|
276
|
-
try {
|
|
277
|
-
e.close();
|
|
278
|
-
} catch {}
|
|
279
|
-
}, K = async (e, t) => {
|
|
280
|
-
let { port: n, ...r } = e;
|
|
281
|
-
e.port.addEventListener("message", (t) => {
|
|
282
|
-
t.data?.type === "fkn-packages-disconnect" && W(e.port);
|
|
283
|
-
});
|
|
284
|
-
let i;
|
|
285
|
-
try {
|
|
286
|
-
i = await t.createPayload(r);
|
|
287
|
-
} catch (t) {
|
|
288
|
-
throw G(e.port, t instanceof Error ? t.message : "the package failed to produce a connection"), t;
|
|
289
|
-
}
|
|
290
|
-
let a = new Promise((t) => V.set(e.port, t)), o = await m(i, e.port);
|
|
291
|
-
t.handler?.({
|
|
292
|
-
...r,
|
|
293
|
-
remote: o,
|
|
294
|
-
closed: a,
|
|
295
|
-
port: e.port
|
|
296
|
-
});
|
|
297
|
-
}, q = () => {
|
|
298
|
-
H || typeof window > "u" || window.parent === window || (H = !0, window.addEventListener("message", (e) => {
|
|
299
|
-
if (e.source !== window.parent) return;
|
|
300
|
-
let t = e.data;
|
|
301
|
-
if (t?.type === "fkn-packages-port") {
|
|
302
|
-
let n = e.ports[0];
|
|
303
|
-
if (!n) return;
|
|
304
|
-
let r = {
|
|
305
|
-
port: n,
|
|
306
|
-
from: typeof t.from == "string" ? t.from : "",
|
|
307
|
-
brokered: e.origin === u,
|
|
308
|
-
protocol: typeof t.protocol == "string" ? t.protocol : null,
|
|
309
|
-
uri: typeof t.uri == "string" ? t.uri : "",
|
|
310
|
-
name: typeof t.name == "string" ? t.name : "",
|
|
311
|
-
version: typeof t.version == "string" ? t.version : ""
|
|
312
|
-
};
|
|
313
|
-
L ? K(r, L).catch((e) => console.warn("packages.onConnect:", e)) : B.push(r);
|
|
314
|
-
}
|
|
315
|
-
if (t?.type === "fkn-packages-close") for (let e of [...V.keys()]) W(e);
|
|
316
|
-
if (t?.type === "fkn-packages-visibility") {
|
|
317
|
-
R = t.visible === !0;
|
|
318
|
-
for (let e of z) try {
|
|
319
|
-
e(R);
|
|
320
|
-
} catch {}
|
|
321
|
-
}
|
|
322
|
-
}));
|
|
323
|
-
}, J = () => {
|
|
324
|
-
U || typeof window > "u" || window.parent === window || (U = !0, window.parent.postMessage({ type: "fkn-packages-ready" }, "*"));
|
|
325
|
-
}, Y = (e, t) => {
|
|
326
|
-
if (typeof window > "u") return { unsubscribe: () => {} };
|
|
327
|
-
q();
|
|
328
|
-
let n = {
|
|
329
|
-
createPayload: e,
|
|
330
|
-
handler: t
|
|
331
|
-
};
|
|
332
|
-
for (L = n, J(); B.length && L === n;) K(B.shift(), n).catch((e) => console.warn("packages.onConnect:", e));
|
|
333
|
-
return { unsubscribe: () => {
|
|
334
|
-
L === n && (L = null);
|
|
335
|
-
} };
|
|
336
|
-
}, X = () => R, Z = (e) => {
|
|
337
|
-
if (typeof window > "u") return { unsubscribe: () => {} };
|
|
338
|
-
q(), z.add(e);
|
|
339
|
-
try {
|
|
340
|
-
e(R);
|
|
341
|
-
} catch {}
|
|
342
|
-
return { unsubscribe: () => {
|
|
343
|
-
z.delete(e);
|
|
344
|
-
} };
|
|
345
|
-
};
|
|
346
|
-
//#endregion
|
|
347
|
-
export { I as attach, A as connect, k as hide, v as install, X as isVisible, y as list, F as mount, Y as onConnect, Z as onVisibilityChange, _ as pick, g as search, O as show, c as t, b as uninstall };
|
|
1
|
+
export { t as attach, n as connect, r as hide, i as install, a as isVisible, o as list, s as mount, c as onConnect, l as onVisibilityChange, d as pick, f as search, p as show, m as uninstall } from "./packages-Cws_rcgf.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as e } from "./broker-frame-
|
|
2
|
-
import { o as t, s as n } from "./api-
|
|
3
|
-
import { t as r } from "./busy-
|
|
4
|
-
import { t as i } from "./relay-choice-
|
|
5
|
-
|
|
1
|
+
import { r as e } from "./broker-frame-vjSpBa8d.js";
|
|
2
|
+
import { o as t, s as n } from "./api-DRglK7ft.js";
|
|
3
|
+
import { t as r } from "./busy-C1JPjoZ_.js";
|
|
4
|
+
import { t as i } from "./relay-choice-Bb3oP2gw.js";
|
|
5
|
+
// src/proxy.ts
|
|
6
6
|
var a = typeof FinalizationRegistry > "u" ? void 0 : new FinalizationRegistry((e) => e()), o = (e) => {
|
|
7
7
|
let t = e.body;
|
|
8
8
|
if (!t) return e;
|
|
@@ -58,5 +58,4 @@ var a = typeof FinalizationRegistry > "u" ? void 0 : new FinalizationRegistry((e
|
|
|
58
58
|
body: i
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
//#endregion
|
|
62
61
|
export { u as t };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { X as Resolvers } from "./contract-
|
|
2
|
-
import "./api-
|
|
3
|
-
//#region src/proxy.d.ts
|
|
1
|
+
import { X as Resolvers } from "./contract-0rua6Wsh.js";
|
|
2
|
+
import "./api-0Yp9uZcV.js";
|
|
4
3
|
type ProxyFetch = Resolvers['cloud']['fetch'];
|
|
5
4
|
type FetchParameters = Parameters<ProxyFetch>;
|
|
6
5
|
declare const cloudFetch: (input: FetchParameters[0], init?: FetchParameters[1]) => Promise<Response>;
|
|
7
|
-
//#endregion
|
|
8
6
|
export { cloudFetch as t };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./broker-frame-CF4-yXtj.cjs"),t=require("./api-
|
|
1
|
+
const e=require("./broker-frame-CF4-yXtj.cjs"),t=require("./api-DrvhPN56.cjs"),n=require("./busy-BXbVH595.cjs"),r=require("./relay-choice-JC_JJY_M.cjs");var i=typeof FinalizationRegistry>`u`?void 0:new FinalizationRegistry(e=>e()),a=e=>{let t=e.body;if(!t)return e;let r=n.t(`streamed response`),a=t.getReader(),o=new ReadableStream({pull:async e=>{try{let{done:t,value:n}=await a.read();if(t){r(),e.close();return}e.enqueue(n)}catch(t){r(),e.error(t)}},cancel:async e=>{r(),await a.cancel(e).catch(()=>{})}}),s=new Response(o,{status:e.status,statusText:e.statusText,headers:e.headers});return i?.register(s,r),s},o=async e=>{if(e!=null)return typeof e==`string`||e instanceof ArrayBuffer||ArrayBuffer.isView(e)?e:new Request(`https://body.invalid/`,{method:`POST`,body:e,duplex:`half`}).arrayBuffer()},s=async e=>{if(e.method===`GET`||e.method===`HEAD`)return;let t=await e.clone().arrayBuffer();return t.byteLength?t:void 0},c=(e,n)=>(n?.relay===void 0?t.o:t.s(`a relay choice`)).then(t=>(n?.relay!==void 0&&r.t(t,`cloud.fetch`),t.cloud.fetch(e,n))).then(a),l=async(t,n)=>{if(e.r(t),typeof t==`object`&&t&&!(t instanceof URL)&&typeof t.url==`string`){let e=t,r={};e.headers.forEach((e,t)=>{r[t]=e});let i=await o(n?.body===void 0?await s(e):n.body);return c(e.url,{...n,method:n?.method??e.method,headers:n?.headers??r,body:i})}let r=t instanceof URL?t.href:t,i=await o(n?.body);return c(r,n?.body===void 0?n:{...n,body:i})};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return l}});
|
package/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./connect-button-BpXDs7tw.cjs");let t=require("react");var n=({className:n,style:r}={})=>(0,t.createElement)(`iframe`,{src:e.t(),title:`Sign in to FKN`,className:n,style:{border:`none`,width:150,height:40,background:`transparent`,colorScheme:`normal`,...r}});exports.ConnectButton=
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./connect-button-BpXDs7tw.cjs");let t=require("react");var n=6,r=8,i=(e,t,n)=>r=>`var(--fkn-powered-by-${e}, ${r?`light-dark(${t}, ${n})`:n})`,a=i(`card`,`#ffffff`,`#1d1e23`),o=i(`border`,`#e5e6ea`,`#2a2c33`),s=i(`ink`,`#191b1f`,`#ecedf0`),c=i(`link`,`#3a629e`,`#8db0de`),l=i(`shadow`,`rgba(16, 18, 22, .05)`,`rgba(0, 0, 0, .4)`),u=[[`M198.4,0.1L365,288.6H162.3l-31.8,55l331.4-0.2L263.6,0L198.4,0.1z`,i(`mark-app`,`#8f5a0e`,`#f9aa40`)],[`M198.3,0L0,343.6l32.6,56.5l165.1-285.9l100.7,174.4h66.5L198.3,0z`,i(`mark-plat`,`#3a629e`,`#4572b5`)],[`M197.7,114.2l32.6,56.5l-99.8,172.9h331.4l-32.6,56.5H32.6L197.7,114.2z`,i(`mark-acct`,`#2a7c58`,`#51bb8d`)]],d=`http://www.w3.org/2000/svg`,f=0,p=({label:e=`Powered by FKN`,linkLabel:t=`How it works`,href:i=`https://docs.fkn.dev/`}={})=>{let p=`fkn-powered-by-${++f}`,m=document.createElement(`span`),h=document.createElement(`button`);h.type=`button`,h.title=e,h.setAttribute(`aria-label`,e),h.setAttribute(`aria-expanded`,`false`),h.setAttribute(`aria-controls`,p),h.style.cssText=`padding:4px;margin:-4px;border:none;border-radius:4px;background:none;font:inherit;color:inherit;cursor:pointer`;let g=CSS.supports(`color`,`light-dark(red, red)`),_=document.createElementNS(d,`svg`);_.setAttribute(`viewBox`,`0 0 461.9 400.1`),_.setAttribute(`aria-hidden`,`true`),_.style.cssText=`height:${CSS.supports(`height`,`1cap`)?`1cap`:`.7em`};width:auto`;for(let[e,t]of u){let n=document.createElementNS(d,`path`);n.setAttribute(`d`,e),n.style.fill=t(g),_.append(n)}h.append(_);let v=document.createElement(`div`);v.id=p,v.popover=`manual`,v.setAttribute(`role`,`group`),v.setAttribute(`aria-labelledby`,`${p}-title`),v.tabIndex=-1,v.style.cssText=`inset:auto;margin:0;padding:${n}px 0 0;border:none;background:transparent;overflow:visible;width:max-content;max-width:min(280px, calc(100vw - 16px));outline:none;cursor:default;user-select:text`;let y=document.createElement(`div`);y.style.cssText=`display:flex;flex-direction:column;gap:8px;box-sizing:border-box;overflow-y:auto;overflow-wrap:anywhere;padding:12px 14px;font-size:13px;font-weight:400;font-style:normal;line-height:1.4;letter-spacing:normal;text-transform:none;text-shadow:none;text-align:start;white-space:normal;color:${s(g)};background:${a(g)};border:1px solid ${o(g)};border-radius:10px;box-shadow:0 1px 2px ${l(g)}`;let b=document.createElement(`div`);b.id=`${p}-title`,b.textContent=e,b.style.fontWeight=`600`;let x=document.createElement(`a`);x.href=i,x.target=`_blank`,x.rel=`noreferrer`,x.textContent=t,x.style.cssText=`align-self:flex-start;color:${c(g)};font-weight:600;text-decoration:underline;text-underline-offset:2px;border-radius:4px`,y.append(b,x),v.append(y),m.append(h,v);let S=new Set,C,w,T=()=>{let e=h.getBoundingClientRect(),{width:t}=v.getBoundingClientRect(),i=document.documentElement.clientWidth;v.style.left=`${Math.min(Math.max(r,e.left+e.width/2-t/2),i-t-r)}px`,v.style.top=`${e.bottom}px`,y.style.maxHeight=`${Math.max(0,innerHeight-e.bottom-n-r)}px`},E=()=>{m.isConnected||S.clear();let e=S.size>0;if(e===(w!==void 0))return;if(h.setAttribute(`aria-expanded`,String(e)),!e){w.abort(),w=void 0,v.matches(`:popover-open`)&&v.hidePopover();return}v.showPopover(),T(),w=new AbortController;let{signal:t}=w;document.addEventListener(`keydown`,A,{signal:t}),document.addEventListener(`pointerdown`,e=>{e.composedPath().includes(m)||k()},{capture:!0,signal:t}),window.addEventListener(`blur`,()=>k(),{signal:t}),window.addEventListener(`scroll`,T,{capture:!0,passive:!0,signal:t}),window.addEventListener(`resize`,T,{signal:t})},D=()=>{clearTimeout(C),C=void 0},O=!1,k=(e=!1)=>{D(),S.clear(),E(),e&&(O=!0,h.focus(),O=!1)},A=e=>{if(e.key!==`Escape`)return;let t=m.contains(document.activeElement);t&&(e.preventDefault(),e.stopPropagation()),k(t)},j=e=>e.pointerType===`mouse`||e.pointerType===`pen`;return m.addEventListener(`pointerenter`,e=>{j(e)&&(D(),S.add(`hover`),E())}),m.addEventListener(`pointerleave`,e=>{j(e)&&S.has(`hover`)&&(D(),C=setTimeout(()=>{C=void 0,S.delete(`hover`),E()},300))}),h.addEventListener(`click`,()=>{if(S.has(`pinned`))return k();S.add(`pinned`),E()}),h.addEventListener(`focusin`,()=>{!O&&h.matches(`:focus-visible`)&&(S.add(`focus`),E())}),m.addEventListener(`focusout`,()=>setTimeout(()=>{m.contains(document.activeElement)||(S.delete(`focus`),S.delete(`pinned`),E())},0)),{element:m,destroy:()=>{k(),m.remove()}}},m=({className:n,style:r}={})=>(0,t.createElement)(`iframe`,{src:e.t(),title:`Sign in to FKN`,className:n,style:{border:`none`,width:150,height:40,background:`transparent`,colorScheme:`normal`,...r}}),h=({className:e,style:n,label:r,linkLabel:i,href:a})=>{let o=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let e=p({label:r,linkLabel:i,href:a});return o.current.append(e.element),e.destroy},[r,i,a]),(0,t.createElement)(`span`,{ref:o,className:e,style:n})};exports.ConnectButton=m,exports.PoweredByFkn=h,exports.connectButtonUrl=e.t;
|
package/react.d.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { t as connectButtonUrl } from "./connect-button-
|
|
1
|
+
import { t as connectButtonUrl } from "./connect-button-2FmOM8ai.js";
|
|
2
2
|
import { CSSProperties, ReactElement } from "react";
|
|
3
|
-
|
|
3
|
+
type PoweredByOptions = {
|
|
4
|
+
/** The mark's accessible name and tooltip, and the popup's heading. Defaults to "Powered by FKN". */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** The words of the popup's one link. Defaults to "How it works", as on fkn.app's "through FKN" popup. */
|
|
7
|
+
linkLabel?: string;
|
|
8
|
+
/** Where that link leads, in a new tab. Defaults to FKN's documentation, https://docs.fkn.dev/. */
|
|
9
|
+
href?: string;
|
|
10
|
+
};
|
|
4
11
|
export type ConnectButtonProps = {
|
|
5
12
|
className?: string;
|
|
6
13
|
style?: CSSProperties;
|
|
7
14
|
};
|
|
8
15
|
export declare const ConnectButton: ({ className, style }?: ConnectButtonProps) => ReactElement;
|
|
9
|
-
|
|
10
|
-
|
|
16
|
+
export type PoweredByFknProps = PoweredByOptions & {
|
|
17
|
+
className?: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
};
|
|
20
|
+
/** FKN's mark and its popup, in a span that takes `className` and `style` (its font size sizes the mark). */
|
|
21
|
+
export declare const PoweredByFkn: ({ className, style, label, linkLabel, href }: PoweredByFknProps) => ReactElement;
|
|
22
|
+
export { type PoweredByOptions, connectButtonUrl };
|