@edv4h/usketch-plugin-presence-activity 0.2.0 → 0.3.1
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/dist/activity-overlay.d.ts +5 -13
- package/dist/activity-overlay.d.ts.map +1 -1
- package/dist/activity-overlay.js +16 -10
- package/dist/activity-overlay.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +7 -1
- package/dist/plugin.js.map +1 -1
- package/dist/style.d.ts +73 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.js +34 -0
- package/dist/style.js.map +1 -0
- package/package.json +3 -3
|
@@ -1,35 +1,27 @@
|
|
|
1
|
-
import type { BoardStore,
|
|
1
|
+
import type { BoardStore, ShapeRegistry, Viewport } from "@edv4h/usketch-shared";
|
|
2
2
|
import type { WsProviderHandle } from "@edv4h/usketch-sync";
|
|
3
3
|
import type { AiActivityStore } from "./ai-activity-store.js";
|
|
4
|
+
import type { PresenceParticipant, ResolvedActivityStyle } from "./style.js";
|
|
4
5
|
type Awareness = WsProviderHandle["awareness"];
|
|
5
|
-
interface Participant {
|
|
6
|
-
clientId: number;
|
|
7
|
-
name: string;
|
|
8
|
-
color: string;
|
|
9
|
-
action: "select" | "edit";
|
|
10
|
-
/** Per-shape world bounds this participant is selecting/editing. */
|
|
11
|
-
boxes: BoundingBox[];
|
|
12
|
-
/** Optional in-progress marquee rect (world coords). */
|
|
13
|
-
marquee?: BoundingBox;
|
|
14
|
-
}
|
|
15
6
|
/**
|
|
16
7
|
* Resolve every remote participant's `activity` awareness field into drawable
|
|
17
8
|
* world-space boxes. Self is skipped. Participants with no resolvable activity
|
|
18
9
|
* are dropped. Exported for testing the awareness→geometry mapping.
|
|
19
10
|
*/
|
|
20
|
-
export declare function collectParticipants(awareness: Awareness, store: BoardStore, shapes: ShapeRegistry):
|
|
11
|
+
export declare function collectParticipants(awareness: Awareness, store: BoardStore, shapes: ShapeRegistry): PresenceParticipant[];
|
|
21
12
|
/**
|
|
22
13
|
* Screen-space SVG overlay drawing every remote participant's selection / edit /
|
|
23
14
|
* marquee in their presence color (feature #960). Mirrors the coordinate math of
|
|
24
15
|
* `UnconfirmedOverlay`. Re-renders on awareness change (own subscription) and on
|
|
25
16
|
* viewport change (the fixed layer re-renders and passes a fresh `viewport`).
|
|
26
17
|
*/
|
|
27
|
-
export declare function ActivityOverlay({ store, shapes, viewport, awareness, aiActivityStore, }: {
|
|
18
|
+
export declare function ActivityOverlay({ store, shapes, viewport, awareness, aiActivityStore, style, }: {
|
|
28
19
|
store: BoardStore;
|
|
29
20
|
shapes: ShapeRegistry;
|
|
30
21
|
viewport: Viewport;
|
|
31
22
|
awareness: Awareness;
|
|
32
23
|
aiActivityStore: AiActivityStore;
|
|
24
|
+
style: ResolvedActivityStyle;
|
|
33
25
|
}): import("react").JSX.Element | null;
|
|
34
26
|
export {};
|
|
35
27
|
//# sourceMappingURL=activity-overlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-overlay.d.ts","sourceRoot":"","sources":["../src/activity-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"activity-overlay.d.ts","sourceRoot":"","sources":["../src/activity-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAe,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAE7E,KAAK,SAAS,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;AAyB/C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAClC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,aAAa,GACnB,mBAAmB,EAAE,CAqBvB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAC/B,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,eAAe,EACf,KAAK,GACL,EAAE;IACF,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,eAAe,CAAC;IACjC,KAAK,EAAE,qBAAqB,CAAC;CAC7B,sCA8CA"}
|
package/dist/activity-overlay.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useReducer, useSyncExternalStore } from "react";
|
|
3
3
|
import { fallbackColor, unionBounds, worldRectToScreen } from "./geometry.js";
|
|
4
|
-
/** Identity of the local in-app AI participant (matches the MCP AI presence). */
|
|
5
|
-
const AI_LABEL = "AI 🤖";
|
|
6
|
-
const AI_COLOR = "#7c3aed";
|
|
7
4
|
/** Resolve shape ids to their world bounds (registered def, else raw x/y/w/h). */
|
|
8
5
|
function resolveBoxes(store, shapes, ids) {
|
|
9
6
|
const boxes = [];
|
|
@@ -55,7 +52,7 @@ export function collectParticipants(awareness, store, shapes) {
|
|
|
55
52
|
* `UnconfirmedOverlay`. Re-renders on awareness change (own subscription) and on
|
|
56
53
|
* viewport change (the fixed layer re-renders and passes a fresh `viewport`).
|
|
57
54
|
*/
|
|
58
|
-
export function ActivityOverlay({ store, shapes, viewport, awareness, aiActivityStore, }) {
|
|
55
|
+
export function ActivityOverlay({ store, shapes, viewport, awareness, aiActivityStore, style, }) {
|
|
59
56
|
const [, bump] = useReducer((n) => n + 1, 0);
|
|
60
57
|
useEffect(() => {
|
|
61
58
|
awareness.on("change", bump);
|
|
@@ -69,8 +66,8 @@ export function ActivityOverlay({ store, shapes, viewport, awareness, aiActivity
|
|
|
69
66
|
if (boxes.length > 0) {
|
|
70
67
|
participants.push({
|
|
71
68
|
clientId: -1,
|
|
72
|
-
name:
|
|
73
|
-
color:
|
|
69
|
+
name: style.aiParticipant.label,
|
|
70
|
+
color: style.aiParticipant.color,
|
|
74
71
|
action: "edit",
|
|
75
72
|
boxes,
|
|
76
73
|
});
|
|
@@ -84,15 +81,24 @@ export function ActivityOverlay({ store, shapes, viewport, awareness, aiActivity
|
|
|
84
81
|
width: "100%",
|
|
85
82
|
height: "100%",
|
|
86
83
|
pointerEvents: "none",
|
|
87
|
-
}, children: [_jsx("title", { children: "\u53C2\u52A0\u8005\u306E\u9078\u629E\u30FB\u7DE8\u96C6" }), participants.map((p) =>
|
|
84
|
+
}, children: [_jsx("title", { children: "\u53C2\u52A0\u8005\u306E\u9078\u629E\u30FB\u7DE8\u96C6" }), participants.map((p) => {
|
|
85
|
+
if (style.renderParticipant) {
|
|
86
|
+
// Contract: ReactElement → render it; null → draw nothing for this participant.
|
|
87
|
+
const custom = style.renderParticipant(p, viewport);
|
|
88
|
+
return custom === null ? null : _jsx("g", { children: custom }, p.clientId);
|
|
89
|
+
}
|
|
90
|
+
return _jsx(ParticipantActivity, { p: p, viewport: viewport, style: style }, p.clientId);
|
|
91
|
+
})] }));
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
function ParticipantActivity({ p, viewport }) {
|
|
93
|
+
function ParticipantActivity({ p, viewport, style, }) {
|
|
91
94
|
const editing = p.action === "edit";
|
|
95
|
+
const { outline, marquee: mq, badge } = style;
|
|
96
|
+
const pad = outline.padding;
|
|
92
97
|
const rects = p.boxes.map((b) => worldRectToScreen(b, viewport));
|
|
93
98
|
const union = unionBounds(p.boxes);
|
|
94
99
|
const badgeAt = union ? worldRectToScreen(union, viewport) : null;
|
|
95
100
|
const marquee = p.marquee ? worldRectToScreen(p.marquee, viewport) : null;
|
|
96
|
-
|
|
101
|
+
const label = editing ? `${p.name}${badge.editingSuffix}` : p.name;
|
|
102
|
+
return (_jsxs("g", { children: [rects.map((r, i) => (_jsx("rect", { x: r.x - pad, y: r.y - pad, width: r.width + pad * 2, height: r.height + pad * 2, fill: "none", stroke: p.color, strokeWidth: outline.strokeWidth, rx: outline.radius, opacity: outline.opacity, children: editing && outline.pulse && (_jsx("animate", { attributeName: "opacity", values: "0.35;0.95;0.35", dur: "1.1s", repeatCount: "indefinite" })) }, i))), marquee && (_jsx("rect", { x: marquee.x, y: marquee.y, width: marquee.width, height: marquee.height, fill: p.color, fillOpacity: mq.fillOpacity, stroke: p.color, strokeWidth: mq.strokeWidth, strokeDasharray: mq.dash })), badge.enabled && badgeAt && p.name && (_jsxs("g", { transform: `translate(${badgeAt.x - pad}, ${badgeAt.y - pad - 18})`, children: [_jsx("rect", { width: label.length * 7.5 + 16, height: 16, rx: 4, fill: p.color }), _jsx("text", { x: 7, y: 12, fontSize: badge.fontSize, fontWeight: badge.fontWeight, fill: "#fff", style: { userSelect: "none" }, children: label })] }))] }));
|
|
97
103
|
}
|
|
98
104
|
//# sourceMappingURL=activity-overlay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-overlay.js","sourceRoot":"","sources":["../src/activity-overlay.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"activity-overlay.js","sourceRoot":"","sources":["../src/activity-overlay.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAE,aAAa,EAAE,WAAW,EA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MAAM,EAAC,gBAAgB,EACvB,GAAG,EAAC,MAAM,EACV,WAAW,EAAC,YAAY,GACvB,CACF,IAlBI,CAAC,CAmBA,CACP,CAAC,EAGD,OAAO,IAAI,CACX,eACC,CAAC,EAAE,OAAO,CAAC,CAAC,EACZ,CAAC,EAAE,OAAO,CAAC,CAAC,EACZ,KAAK,EAAE,OAAO,CAAC,KAAK,EACpB,MAAM,EAAE,OAAO,CAAC,MAAM,EACtB,IAAI,EAAE,CAAC,CAAC,KAAK,EACb,WAAW,EAAE,EAAE,CAAC,WAAW,EAC3B,MAAM,EAAE,CAAC,CAAC,KAAK,EACf,WAAW,EAAE,EAAE,CAAC,WAAW,EAC3B,eAAe,EAAE,EAAE,CAAC,IAAI,GACvB,CACF,EAGA,KAAK,CAAC,OAAO,IAAI,OAAO,IAAI,CAAC,CAAC,IAAI,IAAI,CACtC,aAAG,SAAS,EAAE,aAAa,OAAO,CAAC,CAAC,GAAG,GAAG,KAAK,OAAO,CAAC,CAAC,GAAG,GAAG,GAAG,EAAE,GAAG,aACrE,eAAM,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,GAAG,GAAG,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,GAAI,EAC1E,eACC,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,EAAE,EACL,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,YAE5B,KAAK,GACA,IACJ,CACJ,IACE,CACJ,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export type { PresenceActivity, PresenceUser } from "./activity.js";
|
|
|
2
2
|
export { collectParticipants } from "./activity-overlay.js";
|
|
3
3
|
export { type AiActivity, type AiActivityStore, createAiActivityStore, } from "./ai-activity-store.js";
|
|
4
4
|
export { createPresenceActivityPlugin, type PresenceActivityOptions } from "./plugin.js";
|
|
5
|
+
export { DEFAULT_ACTIVITY_STYLE, type PresenceActivityStyle, type PresenceParticipant, type ResolvedActivityStyle, resolveActivityStyle, } from "./style.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACN,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACN,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAE,KAAK,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EACN,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,oBAAoB,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { collectParticipants } from "./activity-overlay.js";
|
|
2
2
|
export { createAiActivityStore, } from "./ai-activity-store.js";
|
|
3
3
|
export { createPresenceActivityPlugin } from "./plugin.js";
|
|
4
|
+
export { DEFAULT_ACTIVITY_STYLE, resolveActivityStyle, } from "./style.js";
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAGN,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAgC,MAAM,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAGN,qBAAqB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,4BAA4B,EAAgC,MAAM,aAAa,CAAC;AACzF,OAAO,EACN,sBAAsB,EAItB,oBAAoB,GACpB,MAAM,YAAY,CAAC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { UsketchPlugin } from "@edv4h/usketch-shared";
|
|
2
2
|
import type { WsProviderHandle } from "@edv4h/usketch-sync";
|
|
3
|
+
import { type PresenceActivityStyle } from "./style.js";
|
|
3
4
|
export interface PresenceActivityOptions {
|
|
4
5
|
wsProvider: WsProviderHandle;
|
|
6
|
+
/**
|
|
7
|
+
* Appearance overrides for the overlay (outline / marquee / badge / local-AI
|
|
8
|
+
* identity), or a full `renderParticipant` override. Merges over the defaults —
|
|
9
|
+
* omit for the stock look. See {@link PresenceActivityStyle}.
|
|
10
|
+
*/
|
|
11
|
+
style?: PresenceActivityStyle;
|
|
5
12
|
}
|
|
6
13
|
/**
|
|
7
14
|
* Renders every OTHER participant's live selection / edit / marquee on the canvas
|
|
@@ -14,6 +21,10 @@ export interface PresenceActivityOptions {
|
|
|
14
21
|
* It also drives the LOCAL in-app AI: the ⌘K agent writes shapes server-side with
|
|
15
22
|
* no awareness presence, so its `ai:response` is mirrored into `aiActivityStore`
|
|
16
23
|
* and drawn as a synthetic "AI" participant on this tab.
|
|
24
|
+
*
|
|
25
|
+
* The host can restyle the indicators via `options.style` (outline / marquee /
|
|
26
|
+
* badge / local-AI identity), or take over rendering entirely with
|
|
27
|
+
* `style.renderParticipant`. See {@link PresenceActivityStyle}.
|
|
17
28
|
*/
|
|
18
29
|
export declare function createPresenceActivityPlugin(options: PresenceActivityOptions): UsketchPlugin;
|
|
19
30
|
//# sourceMappingURL=plugin.d.ts.map
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,KAAK,qBAAqB,EAAwB,MAAM,YAAY,CAAC;AAc9E,MAAM,WAAW,uBAAuB;IACvC,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;;;OAIG;IACH,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC9B;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa,CAmE5F"}
|
package/dist/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ActivityOverlay } from "./activity-overlay.js";
|
|
3
3
|
import { createAiActivityStore } from "./ai-activity-store.js";
|
|
4
|
+
import { resolveActivityStyle } from "./style.js";
|
|
4
5
|
const LAYER_ID = "usketch-presence-activity";
|
|
5
6
|
/** How long the in-app AI highlight lingers after `ai:response` before clearing. */
|
|
6
7
|
const AI_HOLD_MS = 1600;
|
|
@@ -15,9 +16,14 @@ const AI_HOLD_MS = 1600;
|
|
|
15
16
|
* It also drives the LOCAL in-app AI: the ⌘K agent writes shapes server-side with
|
|
16
17
|
* no awareness presence, so its `ai:response` is mirrored into `aiActivityStore`
|
|
17
18
|
* and drawn as a synthetic "AI" participant on this tab.
|
|
19
|
+
*
|
|
20
|
+
* The host can restyle the indicators via `options.style` (outline / marquee /
|
|
21
|
+
* badge / local-AI identity), or take over rendering entirely with
|
|
22
|
+
* `style.renderParticipant`. See {@link PresenceActivityStyle}.
|
|
18
23
|
*/
|
|
19
24
|
export function createPresenceActivityPlugin(options) {
|
|
20
25
|
const { wsProvider } = options;
|
|
26
|
+
const style = resolveActivityStyle(options.style);
|
|
21
27
|
return {
|
|
22
28
|
id: "usketch-plugin-presence-activity",
|
|
23
29
|
name: "参加者アクティビティ",
|
|
@@ -30,7 +36,7 @@ export function createPresenceActivityPlugin(options) {
|
|
|
30
36
|
id: LAYER_ID,
|
|
31
37
|
order: 248,
|
|
32
38
|
fixed: true,
|
|
33
|
-
render: (renderCtx) => (_jsx(ActivityOverlay, { store: ctx.store, shapes: ctx.shapes, viewport: renderCtx.viewport, awareness: wsProvider.awareness, aiActivityStore: aiActivityStore })),
|
|
39
|
+
render: (renderCtx) => (_jsx(ActivityOverlay, { store: ctx.store, shapes: ctx.shapes, viewport: renderCtx.viewport, awareness: wsProvider.awareness, style: style, aiActivityStore: aiActivityStore })),
|
|
34
40
|
});
|
|
35
41
|
// ── In-app AI driver (feature #960) ──
|
|
36
42
|
// The ⌘K AI agent writes shapes server-side and has no awareness presence
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAA8B,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAC7C,oFAAoF;AACpF,MAAM,UAAU,GAAG,IAAI,CAAC;AAoBxB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,4BAA4B,CAAC,OAAgC;IAC5E,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAClD,OAAO;QACN,EAAE,EAAE,kCAAkC;QACtC,IAAI,EAAE,YAAY;QAElB,KAAK,CAAC,GAAkB;YACvB,wEAAwE;YACxE,8CAA8C;YAC9C,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;YAEhD,0EAA0E;YAC1E,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACnB,EAAE,EAAE,QAAQ;gBACZ,KAAK,EAAE,GAAG;gBACV,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CACtB,KAAC,eAAe,IACf,KAAK,EAAE,GAAG,CAAC,KAAK,EAChB,MAAM,EAAE,GAAG,CAAC,MAAM,EAClB,QAAQ,EAAE,SAAS,CAAC,QAAQ,EAC5B,SAAS,EAAE,UAAU,CAAC,SAAS,EAC/B,KAAK,EAAE,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AAG,CAAC,IAAI,CAAC,CAAC;gBAC3B,CAAC;YACF,CAAC,CAAC,CAAC;YAEH,OAAO,GAAG,EAAE;gBACX,WAAW,EAAE,CAAC;gBACd,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBAC1B,WAAW,EAAE,CAAC;gBACd,SAAS,EAAE,CAAC;gBACZ,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;YACjC,CAAC,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/style.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { BoundingBox, Viewport } from "@edv4h/usketch-shared";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
/**
|
|
4
|
+
* A participant's resolved activity, in world coordinates — the input to a custom
|
|
5
|
+
* {@link PresenceActivityStyle.renderParticipant}. `clientId` is the awareness
|
|
6
|
+
* client id, or `-1` for the local in-app AI participant.
|
|
7
|
+
*/
|
|
8
|
+
export interface PresenceParticipant {
|
|
9
|
+
clientId: number;
|
|
10
|
+
name: string;
|
|
11
|
+
color: string;
|
|
12
|
+
action: "select" | "edit";
|
|
13
|
+
/** World-space bounds of each selected/edited shape. */
|
|
14
|
+
boxes: BoundingBox[];
|
|
15
|
+
/** In-progress marquee rect (world coords), if any. */
|
|
16
|
+
marquee?: BoundingBox;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Host-facing appearance options for the presence-activity overlay (#960). Everything
|
|
20
|
+
* is optional and merges over the defaults, so passing `{}` keeps the stock look.
|
|
21
|
+
* Applies to ALL participants (the AI is just a participant) — for total control use
|
|
22
|
+
* {@link renderParticipant}.
|
|
23
|
+
*/
|
|
24
|
+
export interface PresenceActivityStyle {
|
|
25
|
+
/** Outline drawn around each selected / edited shape. */
|
|
26
|
+
outline?: {
|
|
27
|
+
strokeWidth?: number;
|
|
28
|
+
/** Screen-px inflation so the outline sits just outside the shape. */
|
|
29
|
+
padding?: number;
|
|
30
|
+
/** Corner radius (rx). */
|
|
31
|
+
radius?: number;
|
|
32
|
+
opacity?: number;
|
|
33
|
+
/** Pulse the outline while `action === "edit"`. */
|
|
34
|
+
pulse?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** In-progress marquee rectangle. */
|
|
37
|
+
marquee?: {
|
|
38
|
+
fillOpacity?: number;
|
|
39
|
+
strokeWidth?: number;
|
|
40
|
+
dash?: string;
|
|
41
|
+
};
|
|
42
|
+
/** Name badge above the participant's group. */
|
|
43
|
+
badge?: {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
/** Appended to the name while editing (default `" ✏️"`). */
|
|
46
|
+
editingSuffix?: string;
|
|
47
|
+
fontSize?: number;
|
|
48
|
+
fontWeight?: number;
|
|
49
|
+
};
|
|
50
|
+
/** Identity of the LOCAL in-app AI participant (⌘K agent). */
|
|
51
|
+
aiParticipant?: {
|
|
52
|
+
label?: string;
|
|
53
|
+
color?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Full override: return your own SVG (rendered in screen space) for a
|
|
57
|
+
* participant's activity instead of the default outline/marquee/badge. Return
|
|
58
|
+
* `null` to draw nothing for that participant.
|
|
59
|
+
*/
|
|
60
|
+
renderParticipant?: (p: PresenceParticipant, viewport: Viewport) => ReactElement | null;
|
|
61
|
+
}
|
|
62
|
+
export interface ResolvedActivityStyle {
|
|
63
|
+
outline: Required<NonNullable<PresenceActivityStyle["outline"]>>;
|
|
64
|
+
marquee: Required<NonNullable<PresenceActivityStyle["marquee"]>>;
|
|
65
|
+
badge: Required<NonNullable<PresenceActivityStyle["badge"]>>;
|
|
66
|
+
aiParticipant: Required<NonNullable<PresenceActivityStyle["aiParticipant"]>>;
|
|
67
|
+
renderParticipant?: PresenceActivityStyle["renderParticipant"];
|
|
68
|
+
}
|
|
69
|
+
/** The stock appearance — matches the look shipped in #960 PR1–PR3. */
|
|
70
|
+
export declare const DEFAULT_ACTIVITY_STYLE: ResolvedActivityStyle;
|
|
71
|
+
/** Shallow-merge a host style over the defaults (per group; ignores explicit undefined). */
|
|
72
|
+
export declare function resolveActivityStyle(style?: PresenceActivityStyle): ResolvedActivityStyle;
|
|
73
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC1B,wDAAwD;IACxD,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,uDAAuD;IACvD,OAAO,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACrC,yDAAyD;IACzD,OAAO,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,sEAAsE;QACtE,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,0BAA0B;QAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,mDAAmD;QACnD,KAAK,CAAC,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,qCAAqC;IACrC,OAAO,CAAC,EAAE;QACT,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;KACd,CAAC;IACF,gDAAgD;IAChD,KAAK,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,4DAA4D;QAC5D,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,8DAA8D;IAC9D,aAAa,CAAC,EAAE;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,KAAK,YAAY,GAAG,IAAI,CAAC;CACxF;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjE,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjE,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC7D,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAC7E,iBAAiB,CAAC,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CAC/D;AAED,uEAAuE;AACvE,eAAO,MAAM,sBAAsB,EAAE,qBAKpC,CAAC;AAkBF,4FAA4F;AAC5F,wBAAgB,oBAAoB,CAAC,KAAK,CAAC,EAAE,qBAAqB,GAAG,qBAAqB,CAQzF"}
|
package/dist/style.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The stock appearance — matches the look shipped in #960 PR1–PR3. */
|
|
2
|
+
export const DEFAULT_ACTIVITY_STYLE = {
|
|
3
|
+
outline: { strokeWidth: 2, padding: 3, radius: 4, opacity: 0.9, pulse: true },
|
|
4
|
+
marquee: { fillOpacity: 0.08, strokeWidth: 1.5, dash: "6 4" },
|
|
5
|
+
badge: { enabled: true, editingSuffix: " ✏️", fontSize: 11, fontWeight: 600 },
|
|
6
|
+
aiParticipant: { label: "AI 🤖", color: "#7c3aed" },
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Copy `override` over `base`, keeping the base value wherever the override is
|
|
10
|
+
* `undefined` (plain spread would let an explicit `undefined` clobber a default and
|
|
11
|
+
* later turn arithmetic like `x - padding` into `NaN`).
|
|
12
|
+
*/
|
|
13
|
+
function mergeDefined(base, override) {
|
|
14
|
+
const out = { ...base };
|
|
15
|
+
if (override) {
|
|
16
|
+
for (const key of Object.keys(override)) {
|
|
17
|
+
const value = override[key];
|
|
18
|
+
if (value !== undefined)
|
|
19
|
+
out[key] = value;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
/** Shallow-merge a host style over the defaults (per group; ignores explicit undefined). */
|
|
25
|
+
export function resolveActivityStyle(style) {
|
|
26
|
+
return {
|
|
27
|
+
outline: mergeDefined(DEFAULT_ACTIVITY_STYLE.outline, style?.outline),
|
|
28
|
+
marquee: mergeDefined(DEFAULT_ACTIVITY_STYLE.marquee, style?.marquee),
|
|
29
|
+
badge: mergeDefined(DEFAULT_ACTIVITY_STYLE.badge, style?.badge),
|
|
30
|
+
aiParticipant: mergeDefined(DEFAULT_ACTIVITY_STYLE.aiParticipant, style?.aiParticipant),
|
|
31
|
+
renderParticipant: style?.renderParticipant,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../src/style.ts"],"names":[],"mappings":"AAwEA,uEAAuE;AACvE,MAAM,CAAC,MAAM,sBAAsB,GAA0B;IAC5D,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI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
1
1
|
{
|
|
2
2
|
"name": "@edv4h/usketch-plugin-presence-activity",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@edv4h/usketch-shared": "4.
|
|
15
|
+
"@edv4h/usketch-shared": "4.12.0",
|
|
16
16
|
"@edv4h/usketch-sync": "1.3.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/react": "19.2.18",
|
|
23
23
|
"typescript": "7.0.2",
|
|
24
|
-
"vitest": "4.1.
|
|
24
|
+
"vitest": "4.1.11"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|