@airnauts/comments-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/activation/storage.d.ts +4 -0
- package/dist/activation/storage.d.ts.map +1 -0
- package/dist/anchor/capture.d.ts +14 -0
- package/dist/anchor/capture.d.ts.map +1 -0
- package/dist/anchor/extract.d.ts +3 -0
- package/dist/anchor/extract.d.ts.map +1 -0
- package/dist/anchor/index.d.ts +4 -0
- package/dist/anchor/index.d.ts.map +1 -0
- package/dist/anchor/rematch.d.ts +46 -0
- package/dist/anchor/rematch.d.ts.map +1 -0
- package/dist/anchor/runtime.d.ts +33 -0
- package/dist/anchor/runtime.d.ts.map +1 -0
- package/dist/anchor/selectors.d.ts +5 -0
- package/dist/anchor/selectors.d.ts.map +1 -0
- package/dist/api/client.d.ts +24 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/errors.d.ts +8 -0
- package/dist/api/errors.d.ts.map +1 -0
- package/dist/app/app.d.ts +9 -0
- package/dist/app/app.d.ts.map +1 -0
- package/dist/app/mount.d.ts +6 -0
- package/dist/app/mount.d.ts.map +1 -0
- package/dist/app/providers.d.ts +7 -0
- package/dist/app/providers.d.ts.map +1 -0
- package/dist/app/widget-css.generated.d.ts +2 -0
- package/dist/app/widget-css.generated.d.ts.map +1 -0
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/error-boundary.d.ts +16 -0
- package/dist/error-boundary.d.ts.map +1 -0
- package/dist/gate.d.ts +15 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/identity/IdentityModal.d.ts +8 -0
- package/dist/identity/IdentityModal.d.ts.map +1 -0
- package/dist/identity/storage.d.ts +7 -0
- package/dist/identity/storage.d.ts.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38617 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cn.d.ts +3 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/marker/MarkerLayer.d.ts +14 -0
- package/dist/marker/MarkerLayer.d.ts.map +1 -0
- package/dist/marker/useFocusPin.d.ts +15 -0
- package/dist/marker/useFocusPin.d.ts.map +1 -0
- package/dist/panel/PanelDrawer.d.ts +5 -0
- package/dist/panel/PanelDrawer.d.ts.map +1 -0
- package/dist/panel/PanelProvider.d.ts +11 -0
- package/dist/panel/PanelProvider.d.ts.map +1 -0
- package/dist/panel/PanelRow.d.ts +7 -0
- package/dist/panel/PanelRow.d.ts.map +1 -0
- package/dist/panel/controller.d.ts +14 -0
- package/dist/panel/controller.d.ts.map +1 -0
- package/dist/panel/navigate.d.ts +13 -0
- package/dist/panel/navigate.d.ts.map +1 -0
- package/dist/panel/state.d.ts +42 -0
- package/dist/panel/state.d.ts.map +1 -0
- package/dist/positioning/coords.d.ts +28 -0
- package/dist/positioning/coords.d.ts.map +1 -0
- package/dist/positioning/layer.d.ts +12 -0
- package/dist/positioning/layer.d.ts.map +1 -0
- package/dist/positioning/lifecycle.d.ts +9 -0
- package/dist/positioning/lifecycle.d.ts.map +1 -0
- package/dist/react.d.ts +9 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +24 -0
- package/dist/react.js.map +1 -0
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/threads/ThreadsProvider.d.ts +15 -0
- package/dist/threads/ThreadsProvider.d.ts.map +1 -0
- package/dist/threads/controller.d.ts +38 -0
- package/dist/threads/controller.d.ts.map +1 -0
- package/dist/threads/relativeTime.d.ts +3 -0
- package/dist/threads/relativeTime.d.ts.map +1 -0
- package/dist/threads/state.d.ts +98 -0
- package/dist/threads/state.d.ts.map +1 -0
- package/dist/threads/useThreads.d.ts +19 -0
- package/dist/threads/useThreads.d.ts.map +1 -0
- package/dist/ui/Attachment.d.ts +9 -0
- package/dist/ui/Attachment.d.ts.map +1 -0
- package/dist/ui/CommentList.d.ts +9 -0
- package/dist/ui/CommentList.d.ts.map +1 -0
- package/dist/ui/Composer.d.ts +20 -0
- package/dist/ui/Composer.d.ts.map +1 -0
- package/dist/ui/DetachedThread.d.ts +10 -0
- package/dist/ui/DetachedThread.d.ts.map +1 -0
- package/dist/ui/Launcher.d.ts +10 -0
- package/dist/ui/Launcher.d.ts.map +1 -0
- package/dist/ui/Pin.d.ts +17 -0
- package/dist/ui/Pin.d.ts.map +1 -0
- package/dist/ui/ThreadCard.d.ts +11 -0
- package/dist/ui/ThreadCard.d.ts.map +1 -0
- package/dist/ui/ThreadPopover.d.ts +14 -0
- package/dist/ui/ThreadPopover.d.ts.map +1 -0
- package/dist/ui/avatar.d.ts +4 -0
- package/dist/ui/avatar.d.ts.map +1 -0
- package/dist/ui/toast.d.ts +8 -0
- package/dist/ui/toast.d.ts.map +1 -0
- package/package.json +94 -0
package/dist/lib/cn.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAG5C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Provenance } from '@airnauts/comments-core';
|
|
2
|
+
import type { ApiClient } from '../api/client';
|
|
3
|
+
import type { Identity } from '../identity/storage';
|
|
4
|
+
export type MarkerLayerProps = {
|
|
5
|
+
client: ApiClient;
|
|
6
|
+
pageKey: string;
|
|
7
|
+
pageUrl: string;
|
|
8
|
+
identity: Identity | null;
|
|
9
|
+
onNeedIdentity: (resume: (identity: Identity) => void) => void;
|
|
10
|
+
provenance?: Provenance;
|
|
11
|
+
resolvePageKey?: (url: string) => string;
|
|
12
|
+
};
|
|
13
|
+
export declare function MarkerLayer({ client, pageKey, identity, onNeedIdentity, provenance, resolvePageKey, }: MarkerLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=MarkerLayer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarkerLayer.d.ts","sourceRoot":"","sources":["../../src/marker/MarkerLayer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAKvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAI9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAmBnD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,SAAS,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,cAAc,EAAE,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAA;IAC9D,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;CACzC,CAAA;AAED,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAO,EAGP,QAAQ,EACR,cAAc,EACd,UAAU,EACV,cAAc,GACf,EAAE,gBAAgB,2CA6NlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Action } from '../threads/state';
|
|
2
|
+
export type UseFocusPinArgs = {
|
|
3
|
+
pendingFocusId: string | null;
|
|
4
|
+
/** The currently-focused thread; its pin pulses until cleared. */
|
|
5
|
+
focusedId: string | null;
|
|
6
|
+
/** Whether the pending target currently has placement geometry in the store. */
|
|
7
|
+
placed: boolean;
|
|
8
|
+
getElement: (id: string) => Element | null;
|
|
9
|
+
dispatch: (a: Action) => void;
|
|
10
|
+
toast: (message: string) => void;
|
|
11
|
+
/** How long to wait for a placement before declaring the anchor lost. */
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function useFocusPin({ pendingFocusId, focusedId, placed, getElement, dispatch, toast, timeoutMs, }: UseFocusPinArgs): void;
|
|
15
|
+
//# sourceMappingURL=useFocusPin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFocusPin.d.ts","sourceRoot":"","sources":["../../src/marker/useFocusPin.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,kEAAkE;IAClE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,gFAAgF;IAChF,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAA;IAC1C,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAKD,wBAAgB,WAAW,CAAC,EAC1B,cAAc,EACd,SAAS,EACT,MAAM,EACN,UAAU,EACV,QAAQ,EACR,KAAK,EACL,SAAgB,GACjB,EAAE,eAAe,QA4BjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelDrawer.d.ts","sourceRoot":"","sources":["../../src/panel/PanelDrawer.tsx"],"names":[],"mappings":"AAiBA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAA;CACxC,CAAA;AAED,wBAAgB,WAAW,CAAC,EAAE,cAAc,EAAE,EAAE,gBAAgB,2CAwI/D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ApiClient } from '../api/client';
|
|
3
|
+
import { type PanelController } from './controller';
|
|
4
|
+
import { type PanelState } from './state';
|
|
5
|
+
export declare function PanelProvider({ client, children, }: {
|
|
6
|
+
client: Pick<ApiClient, 'listThreads'>;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function usePanelState(): PanelState;
|
|
10
|
+
export declare function usePanelController(): PanelController;
|
|
11
|
+
//# sourceMappingURL=PanelProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelProvider.d.ts","sourceRoot":"","sources":["../../src/panel/PanelProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1E,OAAO,EAAgB,KAAK,UAAU,EAAW,MAAM,SAAS,CAAA;AAMhE,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;IACtC,QAAQ,EAAE,SAAS,CAAA;CACpB,2CAYA;AAQD,wBAAgB,aAAa,eAE5B;AAED,wBAAgB,kBAAkB,oBAEjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ThreadListItem } from '@airnauts/comments-core';
|
|
2
|
+
export type PanelRowProps = {
|
|
3
|
+
item: ThreadListItem;
|
|
4
|
+
onSelect: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function PanelRow({ item, onSelect }: PanelRowProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=PanelRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PanelRow.d.ts","sourceRoot":"","sources":["../../src/panel/PanelRow.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAI7D,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,EAAE,MAAM,IAAI,CAAA;CAAE,CAAA;AAE1E,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,aAAa,2CAsCzD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ApiClient } from '../api/client';
|
|
2
|
+
import type { Action, PanelFilter, PanelState } from './state';
|
|
3
|
+
export type PanelController = {
|
|
4
|
+
openPanel(): Promise<void>;
|
|
5
|
+
closePanel(): void;
|
|
6
|
+
setFilter(filter: PanelFilter): Promise<void>;
|
|
7
|
+
loadMore(): Promise<void>;
|
|
8
|
+
refresh(): Promise<void>;
|
|
9
|
+
};
|
|
10
|
+
export declare function createPanelController(dispatch: (a: Action) => void, deps: {
|
|
11
|
+
client: Pick<ApiClient, 'listThreads'>;
|
|
12
|
+
getState: () => PanelState;
|
|
13
|
+
}): PanelController;
|
|
14
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/panel/controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE9D,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,UAAU,IAAI,IAAI,CAAA;IAClB,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB,CAAA;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAC7B,IAAI,EAAE;IAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IAAC,QAAQ,EAAE,MAAM,UAAU,CAAA;CAAE,GAC3E,eAAe,CAoDjB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const FOCUS_STORAGE_KEY = "cmnt:focus";
|
|
2
|
+
/** Read the cross-page focus target and clear it so it fires exactly once on the destination page. */
|
|
3
|
+
export declare function takeFocusHandoff(storage?: Storage): string | null;
|
|
4
|
+
export type NavigateDeps = {
|
|
5
|
+
storage?: Storage;
|
|
6
|
+
assign?: (url: string) => void;
|
|
7
|
+
};
|
|
8
|
+
/** Stash the focus target, then navigate to the thread's page (full reload or SPA route). */
|
|
9
|
+
export declare function goToThread(row: {
|
|
10
|
+
id: string;
|
|
11
|
+
pageUrl: string;
|
|
12
|
+
}, deps?: NavigateDeps): void;
|
|
13
|
+
//# sourceMappingURL=navigate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigate.d.ts","sourceRoot":"","sources":["../../src/panel/navigate.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,eAAe,CAAA;AAE7C,sGAAsG;AACtG,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,OAAwB,GAAG,MAAM,GAAG,IAAI,CAQjF;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,CAAA;AAEhF,6FAA6F;AAC7F,wBAAgB,UAAU,CAAC,GAAG,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,GAAE,YAAiB,GAAG,IAAI,CAa9F"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ThreadListItem } from '@airnauts/comments-core';
|
|
2
|
+
export type PanelFilter = 'open' | 'resolved' | 'all';
|
|
3
|
+
export type PanelState = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
filter: PanelFilter;
|
|
6
|
+
list: ThreadListItem[];
|
|
7
|
+
nextCursor: string | null;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
loadingMore: boolean;
|
|
10
|
+
error: boolean;
|
|
11
|
+
needsReview: ThreadListItem[];
|
|
12
|
+
};
|
|
13
|
+
export declare const initialState: PanelState;
|
|
14
|
+
export type Action = {
|
|
15
|
+
type: 'OPEN';
|
|
16
|
+
} | {
|
|
17
|
+
type: 'CLOSE';
|
|
18
|
+
} | {
|
|
19
|
+
type: 'SET_FILTER';
|
|
20
|
+
filter: PanelFilter;
|
|
21
|
+
} | {
|
|
22
|
+
type: 'LOAD_START';
|
|
23
|
+
} | {
|
|
24
|
+
type: 'LOAD_SUCCESS';
|
|
25
|
+
list: ThreadListItem[];
|
|
26
|
+
nextCursor: string | null;
|
|
27
|
+
needsReview: ThreadListItem[];
|
|
28
|
+
} | {
|
|
29
|
+
type: 'LOAD_ERROR';
|
|
30
|
+
} | {
|
|
31
|
+
type: 'LOAD_MORE_START';
|
|
32
|
+
} | {
|
|
33
|
+
type: 'LOAD_MORE_SUCCESS';
|
|
34
|
+
list: ThreadListItem[];
|
|
35
|
+
nextCursor: string | null;
|
|
36
|
+
} | {
|
|
37
|
+
type: 'LOAD_MORE_ERROR';
|
|
38
|
+
};
|
|
39
|
+
export declare function reducer(state: PanelState, action: Action): PanelState;
|
|
40
|
+
/** Main list with Needs-review ids removed, so an open orphan isn't shown twice. */
|
|
41
|
+
export declare function mainListExcludingReview(state: PanelState): ThreadListItem[];
|
|
42
|
+
//# sourceMappingURL=state.d.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AO,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAmCrE;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,EAAE,CAI3E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type XY = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export type Box = {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
/** Pin position in viewport coords: element rect corner + fractional offset within the element. */
|
|
12
|
+
export declare function pinXY(rect: {
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}, offset: {
|
|
18
|
+
fx: number;
|
|
19
|
+
fy: number;
|
|
20
|
+
}): XY;
|
|
21
|
+
/** Reshape client rects (already viewport-relative) into overlay boxes. */
|
|
22
|
+
export declare function mapRects(rects: ReadonlyArray<{
|
|
23
|
+
left: number;
|
|
24
|
+
top: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
}>): Box[];
|
|
28
|
+
//# sourceMappingURL=coords.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coords.d.ts","sourceRoot":"","sources":["../../src/positioning/coords.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,EAAE,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACzC,MAAM,MAAM,GAAG,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAOzE,mGAAmG;AACnG,wBAAgB,KAAK,CACnB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAClE,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACjC,EAAE,CAKJ;AAED,2EAA2E;AAC3E,wBAAgB,QAAQ,CACtB,KAAK,EAAE,aAAa,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GACjF,GAAG,EAAE,CAEP"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ApiClient } from '../api/client';
|
|
2
|
+
import type { Identity } from '../identity/storage';
|
|
3
|
+
import type { PlacedThread } from '../threads/state';
|
|
4
|
+
export type { PlacedThread } from '../threads/state';
|
|
5
|
+
export type PinLayerProps = {
|
|
6
|
+
placements: PlacedThread[];
|
|
7
|
+
client: Pick<ApiClient, 'getThread' | 'addComment' | 'setThreadStatus' | 'upload'>;
|
|
8
|
+
identity: Identity | null;
|
|
9
|
+
onNeedIdentity: (resume: (who: Identity) => void) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function PinLayer({ placements, client, identity, onNeedIdentity }: PinLayerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../src/positioning/layer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAIpD,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEpD,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,EAAE,YAAY,EAAE,CAAA;IAC1B,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,YAAY,GAAG,iBAAiB,GAAG,QAAQ,CAAC,CAAA;IAClF,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,cAAc,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAA;CAC1D,CAAA;AAED,wBAAgB,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,aAAa,2CA6BvF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ObserveOptions = {
|
|
2
|
+
targets: Element[];
|
|
3
|
+
onReposition: () => void;
|
|
4
|
+
onRouteChange: () => void;
|
|
5
|
+
onMutation?: () => void;
|
|
6
|
+
};
|
|
7
|
+
/** Wire all reposition + route signals; returns a stop() that detaches everything. */
|
|
8
|
+
export declare function observeReposition(opts: ObserveOptions): () => void;
|
|
9
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/positioning/lifecycle.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACxB,CAAA;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,IAAI,CAiFlE"}
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type InitOptions } from './index';
|
|
2
|
+
export declare const packageName = "@airnauts/comments-client/react";
|
|
3
|
+
export type CommentsLayerProps = Omit<InitOptions, 'key'> & {
|
|
4
|
+
/** The secret key (React reserves the `key` prop name, so it is `commentsKey` here). */
|
|
5
|
+
commentsKey: string;
|
|
6
|
+
};
|
|
7
|
+
/** Thin wrapper for React hosts: calls comments.init() in an effect and tears down on unmount. */
|
|
8
|
+
export declare function CommentsLayer({ commentsKey, ...rest }: CommentsLayerProps): null;
|
|
9
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AACA,OAAO,EAAiC,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAEzE,eAAO,MAAM,WAAW,oCAAoC,CAAA;AAE5D,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG;IAC1D,wFAAwF;IACxF,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAiBhF"}
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/react.ts
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { comments } from "./index.js";
|
|
4
|
+
var packageName = "@airnauts/comments-client/react";
|
|
5
|
+
function CommentsLayer({ commentsKey, ...rest }) {
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
let handle = null;
|
|
8
|
+
let cancelled = false;
|
|
9
|
+
comments.init({ key: commentsKey, ...rest }).then((h) => {
|
|
10
|
+
if (cancelled) h.destroy();
|
|
11
|
+
else handle = h;
|
|
12
|
+
});
|
|
13
|
+
return () => {
|
|
14
|
+
cancelled = true;
|
|
15
|
+
handle?.destroy();
|
|
16
|
+
};
|
|
17
|
+
}, [commentsKey, rest.endpoint, rest.keyParam]);
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
CommentsLayer,
|
|
22
|
+
packageName
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=react.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react.ts"],"sourcesContent":["import { useEffect } from 'react'\nimport { type CommentsHandle, comments, type InitOptions } from './index'\n\nexport const packageName = '@airnauts/comments-client/react'\n\nexport type CommentsLayerProps = Omit<InitOptions, 'key'> & {\n /** The secret key (React reserves the `key` prop name, so it is `commentsKey` here). */\n commentsKey: string\n}\n\n/** Thin wrapper for React hosts: calls comments.init() in an effect and tears down on unmount. */\nexport function CommentsLayer({ commentsKey, ...rest }: CommentsLayerProps): null {\n // Re-init only on connection-identity change (key/endpoint/keyParam), not on every\n // prop-object change — intentionally narrower than exhaustive deps.\n // biome-ignore lint/correctness/useExhaustiveDependencies: connection-scoped deps by design\n useEffect(() => {\n let handle: CommentsHandle | null = null\n let cancelled = false\n comments.init({ key: commentsKey, ...rest }).then((h) => {\n if (cancelled) h.destroy()\n else handle = h\n })\n return () => {\n cancelled = true\n handle?.destroy()\n }\n }, [commentsKey, rest.endpoint, rest.keyParam])\n return null\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAA8B,gBAAkC;AAEzD,IAAM,cAAc;AAQpB,SAAS,cAAc,EAAE,aAAa,GAAG,KAAK,GAA6B;AAIhF,YAAU,MAAM;AACd,QAAI,SAAgC;AACpC,QAAI,YAAY;AAChB,aAAS,KAAK,EAAE,KAAK,aAAa,GAAG,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM;AACvD,UAAI,UAAW,GAAE,QAAQ;AAAA,UACpB,UAAS;AAAA,IAChB,CAAC;AACD,WAAO,MAAM;AACX,kBAAY;AACZ,cAAQ,QAAQ;AAAA,IAClB;AAAA,EACF,GAAG,CAAC,aAAa,KAAK,UAAU,KAAK,QAAQ,CAAC;AAC9C,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-setup.d.ts","sourceRoot":"","sources":["../src/test-setup.ts"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ApiClient } from '../api/client';
|
|
3
|
+
import { type Controller } from './controller';
|
|
4
|
+
import { type Action, type ThreadsState } from './state';
|
|
5
|
+
export type ThreadsContextValue = {
|
|
6
|
+
state: ThreadsState;
|
|
7
|
+
dispatch: (a: Action) => void;
|
|
8
|
+
controller: Controller;
|
|
9
|
+
};
|
|
10
|
+
export declare const ThreadsContext: import("react").Context<ThreadsContextValue | null>;
|
|
11
|
+
export declare function ThreadsProvider({ client, children, }: {
|
|
12
|
+
client: Pick<ApiClient, 'getThread' | 'setThreadStatus'>;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=ThreadsProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThreadsProvider.d.ts","sourceRoot":"","sources":["../../src/threads/ThreadsProvider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAA;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,KAAK,MAAM,EAAyB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAE/E,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,YAAY,CAAA;IACnB,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,cAAc,qDAAkD,CAAA;AAE7E,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,iBAAiB,CAAC,CAAA;IACxD,QAAQ,EAAE,SAAS,CAAA;CACpB,2CAqBA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ThreadStatus } from '@airnauts/comments-core';
|
|
2
|
+
import type { ApiClient } from '../api/client';
|
|
3
|
+
import type { Action } from './state';
|
|
4
|
+
export type Controller = {
|
|
5
|
+
openThread(id: string): void;
|
|
6
|
+
close(): void;
|
|
7
|
+
setShowResolved(value: boolean): void;
|
|
8
|
+
/** Optimistically set a thread's status (store + runtime cache) and persist; rolls back on failure. */
|
|
9
|
+
setStatus(id: string, status: ThreadStatus): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Optimistically patch a thread's status in the store AND the runtime cache WITHOUT persisting.
|
|
12
|
+
* The reply flow uses this to reopen a resolved thread instantly, then persists the reopen only
|
|
13
|
+
* after the reply itself has been saved — so the two network calls can't race. Keeping the runtime
|
|
14
|
+
* cache in sync is what stops a reposition/mutation re-emit from clobbering the optimistic flip.
|
|
15
|
+
*/
|
|
16
|
+
patchStatus(id: string, status: ThreadStatus): void;
|
|
17
|
+
/**
|
|
18
|
+
* MarkerLayer registers the live anchor-runtime here so status changes also patch its cached
|
|
19
|
+
* item list. Without this, the runtime re-emits stale 'open' placements on the next reposition/
|
|
20
|
+
* mutation, clobbering the optimistic update (the pin would revert until a full reload).
|
|
21
|
+
*/
|
|
22
|
+
registerRuntime(patch: ((id: string, status: ThreadStatus) => void) | null): void;
|
|
23
|
+
/** Focus a pin: open + lazy-fetch like openThread, but also arm the focus effect (scroll + pulse). */
|
|
24
|
+
requestFocus(id: string): void;
|
|
25
|
+
/** The panel registers here to refetch its list when a status change persists (drawer-open reconciliation). */
|
|
26
|
+
registerStatusListener(fn: ((id: string, status: ThreadStatus) => void) | null): void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The imperative surface over the store. M8 calls `openThread(id)` to focus a pin
|
|
30
|
+
* after cross-page navigation; M7 uses it for pin clicks. Opening triggers the lazy
|
|
31
|
+
* `getThread` fetch (fire-and-forget; the reducer tracks loading/error).
|
|
32
|
+
*/
|
|
33
|
+
export declare function createController(dispatch: (a: Action) => void, deps: {
|
|
34
|
+
client: Pick<ApiClient, 'getThread' | 'setThreadStatus'>;
|
|
35
|
+
isCached: (id: string) => boolean;
|
|
36
|
+
isLoading: (id: string) => boolean;
|
|
37
|
+
}): Controller;
|
|
38
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../src/threads/controller.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,KAAK,IAAI,IAAI,CAAA;IACb,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAAA;IACrC,uGAAuG;IACvG,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7D;;;;;OAKG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IACnD;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;IACjF,sGAAsG;IACtG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,+GAA+G;IAC/G,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC,GAAG,IAAI,GAAG,IAAI,CAAA;CACtF,CAAA;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,EAC7B,IAAI,EAAE;IACJ,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,iBAAiB,CAAC,CAAA;IACxD,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;IACjC,SAAS,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAA;CACnC,GACA,UAAU,CAyDZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relativeTime.d.ts","sourceRoot":"","sources":["../../src/threads/relativeTime.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,CAe1E"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { Anchor, Comment, Thread, ThreadListItem, ThreadStatus } from '@airnauts/comments-core';
|
|
2
|
+
import type { Box, XY } from '../positioning/coords';
|
|
3
|
+
/** A matched thread plus its on-screen geometry — what the runtime emits to the store. */
|
|
4
|
+
export type PlacedThread = {
|
|
5
|
+
item: ThreadListItem;
|
|
6
|
+
pin: XY;
|
|
7
|
+
highlight: Box[];
|
|
8
|
+
};
|
|
9
|
+
/** A just-placed thread that has no id yet (lives only here until createThread succeeds). */
|
|
10
|
+
export type Draft = {
|
|
11
|
+
anchor: Anchor;
|
|
12
|
+
point: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
};
|
|
16
|
+
pin: XY;
|
|
17
|
+
};
|
|
18
|
+
export type ThreadsState = {
|
|
19
|
+
itemsById: Record<string, ThreadListItem>;
|
|
20
|
+
placementsById: Record<string, {
|
|
21
|
+
pin: XY;
|
|
22
|
+
highlight: Box[];
|
|
23
|
+
}>;
|
|
24
|
+
order: string[];
|
|
25
|
+
openId: string | null;
|
|
26
|
+
detailById: Record<string, Thread>;
|
|
27
|
+
loadingDetail: Record<string, boolean>;
|
|
28
|
+
detailError: Record<string, boolean>;
|
|
29
|
+
draft: Draft | null;
|
|
30
|
+
showResolved: boolean;
|
|
31
|
+
/** Set when an open thread orphaned out of an ingest; the view toasts + clears it. */
|
|
32
|
+
lostOpenId: string | null;
|
|
33
|
+
/** A thread the panel asked us to focus; the focus effect waits for its placement. */
|
|
34
|
+
pendingFocusId: string | null;
|
|
35
|
+
/** A just-focused thread; its pin pulses briefly. */
|
|
36
|
+
focusedId: string | null;
|
|
37
|
+
};
|
|
38
|
+
export declare const initialState: ThreadsState;
|
|
39
|
+
export type Action = {
|
|
40
|
+
type: 'INGEST_PLACEMENTS';
|
|
41
|
+
placements: PlacedThread[];
|
|
42
|
+
} | {
|
|
43
|
+
type: 'OPEN';
|
|
44
|
+
id: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'CLOSE';
|
|
47
|
+
} | {
|
|
48
|
+
type: 'SET_DRAFT';
|
|
49
|
+
draft: Draft;
|
|
50
|
+
} | {
|
|
51
|
+
type: 'CLEAR_DRAFT';
|
|
52
|
+
} | {
|
|
53
|
+
type: 'CLEAR_LOST_OPEN';
|
|
54
|
+
} | {
|
|
55
|
+
type: 'SET_SHOW_RESOLVED';
|
|
56
|
+
value: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'DETAIL_LOADING';
|
|
59
|
+
id: string;
|
|
60
|
+
} | {
|
|
61
|
+
type: 'DETAIL_LOADED';
|
|
62
|
+
id: string;
|
|
63
|
+
thread: Thread;
|
|
64
|
+
} | {
|
|
65
|
+
type: 'DETAIL_ERROR';
|
|
66
|
+
id: string;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'ADD_OPTIMISTIC_COMMENT';
|
|
69
|
+
id: string;
|
|
70
|
+
comment: Comment;
|
|
71
|
+
} | {
|
|
72
|
+
type: 'REPLACE_OPTIMISTIC_COMMENT';
|
|
73
|
+
id: string;
|
|
74
|
+
tempId: string;
|
|
75
|
+
comment: Comment;
|
|
76
|
+
} | {
|
|
77
|
+
type: 'REMOVE_OPTIMISTIC_COMMENT';
|
|
78
|
+
id: string;
|
|
79
|
+
tempId: string;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'SET_STATUS';
|
|
82
|
+
id: string;
|
|
83
|
+
status: ThreadStatus;
|
|
84
|
+
} | {
|
|
85
|
+
type: 'REQUEST_FOCUS';
|
|
86
|
+
id: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: 'FOCUS_PLACED';
|
|
89
|
+
id: string;
|
|
90
|
+
} | {
|
|
91
|
+
type: 'CLEAR_FOCUS';
|
|
92
|
+
} | {
|
|
93
|
+
type: 'CLEAR_PENDING_FOCUS';
|
|
94
|
+
};
|
|
95
|
+
export declare function reducer(state: ThreadsState, action: Action): ThreadsState;
|
|
96
|
+
/** Placements to render: resolved hidden unless showResolved. Reconstructed from store maps. */
|
|
97
|
+
export declare function visiblePlacements(state: ThreadsState): PlacedThread[];
|
|
98
|
+
//# sourceMappingURL=state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/threads/state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AACpG,OAAO,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAA;AAEpD,0FAA0F;AAC1F,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,GAAG,EAAE,EAAE,CAAC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AAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAoHzE;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE,CAYrE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Thread } from '@airnauts/comments-core';
|
|
2
|
+
import { type PlacedThread } from './state';
|
|
3
|
+
export declare function useThreadsState(): import("./state").ThreadsState;
|
|
4
|
+
export declare function useController(): import("./controller").Controller;
|
|
5
|
+
/** Low-level dispatch for components that apply optimistic updates (e.g. reply/resolve). Prefer the controller for open/close/showResolved. */
|
|
6
|
+
export declare function useDispatch(): (a: import("./state").Action) => void;
|
|
7
|
+
export declare function useVisiblePlacements(): PlacedThread[];
|
|
8
|
+
export declare function useShowResolved(): boolean;
|
|
9
|
+
export declare function useOpenThread(): {
|
|
10
|
+
openId: string | null;
|
|
11
|
+
detail: Thread | null;
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function useFocus(): {
|
|
16
|
+
pendingFocusId: string | null;
|
|
17
|
+
focusedId: string | null;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=useThreads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThreads.d.ts","sourceRoot":"","sources":["../../src/threads/useThreads.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAErD,OAAO,EAAE,KAAK,YAAY,EAAqB,MAAM,SAAS,CAAA;AAS9D,wBAAgB,eAAe,mCAE9B;AAED,wBAAgB,aAAa,sCAE5B;AAED,+IAA+I;AAC/I,wBAAgB,WAAW,0CAE1B;AAED,wBAAgB,oBAAoB,IAAI,YAAY,EAAE,CAErD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAEzC;AAED,wBAAgB,aAAa,IAAI;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;CACf,CASA;AAED,wBAAgB,QAAQ,IAAI;IAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAGtF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PendingStatus = 'uploading' | 'ready' | 'error';
|
|
2
|
+
export declare function PendingAttachment({ name, status, previewUrl, onRemove, onRetry, }: {
|
|
3
|
+
name: string;
|
|
4
|
+
status: PendingStatus;
|
|
5
|
+
previewUrl?: string;
|
|
6
|
+
onRemove: () => void;
|
|
7
|
+
onRetry: () => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=Attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Attachment.d.ts","sourceRoot":"","sources":["../../src/ui/Attachment.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAA;AAE3D,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,GACR,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,aAAa,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,2CAoDA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Comment } from '@airnauts/comments-core';
|
|
2
|
+
export type CommentListProps = {
|
|
3
|
+
comments: Comment[];
|
|
4
|
+
loading: boolean;
|
|
5
|
+
error: boolean;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function CommentList({ comments, loading, error, onRetry }: CommentListProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=CommentList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentList.d.ts","sourceRoot":"","sources":["../../src/ui/CommentList.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAItD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAKD,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,gBAAgB,2CAoGlF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Attachment } from '@airnauts/comments-core';
|
|
2
|
+
import type { Identity } from '../identity/storage';
|
|
3
|
+
export type ComposerSubmit = {
|
|
4
|
+
text: string;
|
|
5
|
+
attachmentIds: string[];
|
|
6
|
+
who: Identity;
|
|
7
|
+
};
|
|
8
|
+
export type ComposerProps = {
|
|
9
|
+
mode: 'newThread' | 'reply';
|
|
10
|
+
identity: Identity | null;
|
|
11
|
+
onNeedIdentity: (resume: (who: Identity) => void) => void;
|
|
12
|
+
onSubmit: (payload: ComposerSubmit) => Promise<void>;
|
|
13
|
+
upload: (file: File) => Promise<Attachment>;
|
|
14
|
+
/** When set, renders a Cancel button left of Send (used by the new-comment draft). */
|
|
15
|
+
onCancel?: () => void;
|
|
16
|
+
/** Focus the text input on mount. */
|
|
17
|
+
autoFocus?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function Composer({ mode, identity, onNeedIdentity, onSubmit, upload, onCancel, autoFocus, }: ComposerProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=Composer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Composer.d.ts","sourceRoot":"","sources":["../../src/ui/Composer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAInD,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,GAAG,EAAE,QAAQ,CAAA;CAAE,CAAA;AAErF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,WAAW,GAAG,OAAO,CAAA;IAC3B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,cAAc,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAA;IACzD,QAAQ,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,UAAU,CAAC,CAAA;IAC3C,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,qCAAqC;IACrC,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAID,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,GACV,EAAE,aAAa,2CAkJf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiClient } from '../api/client';
|
|
2
|
+
import type { Identity } from '../identity/storage';
|
|
3
|
+
export type DetachedThreadProps = {
|
|
4
|
+
client: Pick<ApiClient, 'getThread' | 'addComment' | 'setThreadStatus' | 'upload'>;
|
|
5
|
+
identity: Identity | null;
|
|
6
|
+
onNeedIdentity: (resume: (who: Identity) => void) => void;
|
|
7
|
+
};
|
|
8
|
+
/** Renders an open thread that has no pin (orphan) as a fixed-position card, so it stays readable. */
|
|
9
|
+
export declare function DetachedThread({ client, identity, onNeedIdentity }: DetachedThreadProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
//# sourceMappingURL=DetachedThread.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetachedThread.d.ts","sourceRoot":"","sources":["../../src/ui/DetachedThread.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAInD,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,YAAY,GAAG,iBAAiB,GAAG,QAAQ,CAAC,CAAA;IAClF,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACzB,cAAc,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,IAAI,KAAK,IAAI,CAAA;CAC1D,CAAA;AAED,sGAAsG;AACtG,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,mBAAmB,kDAuBvF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type LauncherProps = {
|
|
2
|
+
placing: boolean;
|
|
3
|
+
onTogglePlace: () => void;
|
|
4
|
+
showResolved: boolean;
|
|
5
|
+
onShowResolved: (value: boolean) => void;
|
|
6
|
+
openCount: number;
|
|
7
|
+
onTogglePanel: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare function Launcher({ placing, onTogglePlace, showResolved, onShowResolved, openCount, onTogglePanel, }: LauncherProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Launcher.d.ts","sourceRoot":"","sources":["../../src/ui/Launcher.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,MAAM,IAAI,CAAA;IACzB,YAAY,EAAE,OAAO,CAAA;IACrB,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,IAAI,CAAA;CAC1B,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,aAAa,EACb,YAAY,EACZ,cAAc,EACd,SAAS,EACT,aAAa,GACd,EAAE,aAAa,2CAmDf"}
|
package/dist/ui/Pin.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ThreadListItem } from '@airnauts/comments-core';
|
|
2
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import type { XY } from '../positioning/coords';
|
|
4
|
+
export type PinProps = {
|
|
5
|
+
item: ThreadListItem;
|
|
6
|
+
pin: XY;
|
|
7
|
+
onOpen?: () => void;
|
|
8
|
+
focused?: boolean;
|
|
9
|
+
} & ComponentPropsWithoutRef<'button'>;
|
|
10
|
+
/** The teardrop pin: solid-blue avatar, white ring, dark count pill. Resolved → grey + check. */
|
|
11
|
+
export declare const Pin: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
item: ThreadListItem;
|
|
13
|
+
pin: XY;
|
|
14
|
+
onOpen?: () => void;
|
|
15
|
+
focused?: boolean;
|
|
16
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
//# sourceMappingURL=Pin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pin.d.ts","sourceRoot":"","sources":["../../src/ui/Pin.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,KAAK,wBAAwB,EAAc,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAA;AAG/C,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,cAAc,CAAA;IACpB,GAAG,EAAE,EAAE,CAAA;IACP,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAA;AAEtC,iGAAiG;AACjG,eAAO,MAAM,GAAG;UAPR,cAAc;SACf,EAAE;aACE,MAAM,IAAI;cACT,OAAO;kLAyEjB,CAAA"}
|