@agora-sdk/social-react-js 0.6.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 +202 -0
- package/dist/esm/components/CommunityWeather.d.ts +24 -0
- package/dist/esm/components/CommunityWeather.js +59 -0
- package/dist/esm/components/CommunityWeather.js.map +1 -0
- package/dist/esm/components/Constellation.d.ts +26 -0
- package/dist/esm/components/Constellation.js +90 -0
- package/dist/esm/components/Constellation.js.map +1 -0
- package/dist/esm/components/Neighborhood.d.ts +24 -0
- package/dist/esm/components/Neighborhood.js +69 -0
- package/dist/esm/components/Neighborhood.js.map +1 -0
- package/dist/esm/components/SocialTransparency.d.ts +21 -0
- package/dist/esm/components/SocialTransparency.js +32 -0
- package/dist/esm/components/SocialTransparency.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/palette.d.ts +49 -0
- package/dist/esm/palette.js +52 -0
- package/dist/esm/palette.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2025 Replyke
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** Props for {@link CommunityWeather}. */
|
|
3
|
+
export interface CommunityWeatherProps {
|
|
4
|
+
/** Optional class for the root element (for host-app layout/spacing). */
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render the Community Weather as an ambient climate chip.
|
|
9
|
+
*
|
|
10
|
+
* Self-contained: reads {@link useSocialWeather} internally and gates on the feature config. Shows a
|
|
11
|
+
* band-tinted glowing orb plus a soft trend arrow when history is available. The warmth `value` is
|
|
12
|
+
* never displayed.
|
|
13
|
+
*
|
|
14
|
+
* @param props - {@link CommunityWeatherProps}.
|
|
15
|
+
* @returns The weather chip, or `null` when the lens is disabled or still loading.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <SocialProvider projectId={id} accessToken={token}>
|
|
20
|
+
* <CommunityWeather />
|
|
21
|
+
* </SocialProvider>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function CommunityWeather({ className }: CommunityWeatherProps): React.ReactElement | null;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSocialWeather } from "@agora-sdk/social-core";
|
|
3
|
+
import { bandColors } from "../palette.js";
|
|
4
|
+
/** Human-readable, non-alarming captions per band. `stormy` stays gentle by design (SOCIAL.md §5). */
|
|
5
|
+
const BAND_CAPTION = {
|
|
6
|
+
quiet: "Still forming",
|
|
7
|
+
stormy: "Could use more warmth",
|
|
8
|
+
overcast: "Settling in",
|
|
9
|
+
fine: "Warm",
|
|
10
|
+
sunny: "Glowing",
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Render the Community Weather as an ambient climate chip.
|
|
14
|
+
*
|
|
15
|
+
* Self-contained: reads {@link useSocialWeather} internally and gates on the feature config. Shows a
|
|
16
|
+
* band-tinted glowing orb plus a soft trend arrow when history is available. The warmth `value` is
|
|
17
|
+
* never displayed.
|
|
18
|
+
*
|
|
19
|
+
* @param props - {@link CommunityWeatherProps}.
|
|
20
|
+
* @returns The weather chip, or `null` when the lens is disabled or still loading.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* <SocialProvider projectId={id} accessToken={token}>
|
|
25
|
+
* <CommunityWeather />
|
|
26
|
+
* </SocialProvider>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function CommunityWeather({ className }) {
|
|
30
|
+
const { weather } = useSocialWeather();
|
|
31
|
+
if (!weather)
|
|
32
|
+
return null;
|
|
33
|
+
const colors = bandColors(weather.band);
|
|
34
|
+
const caption = BAND_CAPTION[weather.band] ?? "Still forming";
|
|
35
|
+
const forming = weather.band === "quiet" || weather.value === null;
|
|
36
|
+
// Trend → a subtle directional cue, never alarming text. Tiny magnitudes are treated as steady.
|
|
37
|
+
const trendArrow = weather.trend === null || Math.abs(weather.trend) < 0.005
|
|
38
|
+
? null
|
|
39
|
+
: weather.trend > 0
|
|
40
|
+
? "↗"
|
|
41
|
+
: "↘";
|
|
42
|
+
return (_jsxs("div", { className: className, role: "img", "aria-label": `Community weather: ${caption.toLowerCase()}`, style: {
|
|
43
|
+
display: "inline-flex",
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
gap: 10,
|
|
46
|
+
padding: "8px 14px",
|
|
47
|
+
borderRadius: 999,
|
|
48
|
+
background: "rgba(15, 15, 24, 0.04)",
|
|
49
|
+
}, children: [_jsx("span", { "aria-hidden": true, style: {
|
|
50
|
+
width: 22,
|
|
51
|
+
height: 22,
|
|
52
|
+
borderRadius: "50%",
|
|
53
|
+
background: `radial-gradient(circle at 35% 30%, ${colors.core}, ${colors.glow})`,
|
|
54
|
+
boxShadow: `0 0 ${forming ? 10 : 18}px ${colors.glow}`,
|
|
55
|
+
filter: forming ? "blur(0.5px)" : undefined,
|
|
56
|
+
opacity: forming ? 0.8 : 1,
|
|
57
|
+
} }), _jsx("span", { style: { fontSize: 13, color: colors.core, fontWeight: 600 }, children: caption }), trendArrow && (_jsx("span", { "aria-hidden": true, title: weather.trend > 0 ? "warming" : "cooling", style: { fontSize: 13, color: colors.core, opacity: 0.7 }, children: trendArrow }))] }));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=CommunityW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AE,aAAa;YACtB,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,EAAE;YACP,OAAO,EAAE,UAAU;YACnB,YAAY,EAAE,GAAG;YACjB,UAAU,EAAE,wBAAwB;SACrC,aAED,oCAEE,KAAK,EAAE;oBACL,KAAK,EAAE,EAAE;oBACT,MAAM,EAAE,EAAE;oBACV,YAAY,EAAE,KAAK;oBACnB,UAAU,EAAE,sCAAsC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,GAAG;oBAChF,SAAS,EAAE,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,MAAM,CAAC,IAAI,EAAE;oBACtD,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;oBAC3C,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;iBAC3B,GACD,EACF,eAAM,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,YAAG,OAAO,GAAQ,EACnF,UAAU,IAAI,CACb,oCAEE,KAAK,EAAE,OAAO,CAAC,KAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACjD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,YAExD,UAAU,GACN,CACR,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** Props for {@link Constellation}. */
|
|
3
|
+
export interface ConstellationProps {
|
|
4
|
+
/** Canvas width in px. Defaults to 360. */
|
|
5
|
+
width?: number;
|
|
6
|
+
/** Canvas height in px. Defaults to 240. */
|
|
7
|
+
height?: number;
|
|
8
|
+
/** Optional class for the root SVG. */
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Render the Constellation as a randomized field of warm blobs.
|
|
13
|
+
*
|
|
14
|
+
* Self-contained: reads {@link useSocialConstellation} and gates on the feature config. Returns `null`
|
|
15
|
+
* when disabled, a nebula when the snapshot is still forming (`asOf === null`), and otherwise a
|
|
16
|
+
* re-randomized SVG blob field. Blobs are sized by bucket and tinted by warmth only.
|
|
17
|
+
*
|
|
18
|
+
* @param props - {@link ConstellationProps}.
|
|
19
|
+
* @returns The blob canvas, a nebula, or `null`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <Constellation width={420} height={280} />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function Constellation({ width, height, className, }: ConstellationProps): React.ReactElement | null;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// <Constellation /> — the anonymous community "shape" as a field of warm, glowing blobs.
|
|
3
|
+
//
|
|
4
|
+
// Renders the Constellation snapshot (cluster blobs) on an SVG canvas. The privacy rules from
|
|
5
|
+
// SOCIAL.md §6 are enforced structurally here:
|
|
6
|
+
// • No stable layout — positions are re-randomized on every mount / whenever the blob data changes,
|
|
7
|
+
// so no cluster has a "home" a viewer could track across loads. We seed random (x, y) and resolve
|
|
8
|
+
// overlaps with a synchronous d3-force pass (collision + center gravity).
|
|
9
|
+
// • Size by BUCKET, never an exact count — radius comes from a fixed bucket→px map; no count is read
|
|
10
|
+
// or shown.
|
|
11
|
+
// • Warmth-only tint — blobs use the same calm climate palette as Weather; friction never renders.
|
|
12
|
+
// • `asOf === null` is the valid "still forming" state — a wispy nebula, not an error or empty list.
|
|
13
|
+
import { useEffect, useId, useMemo, useState } from "react";
|
|
14
|
+
import { forceCenter, forceCollide, forceSimulation, } from "d3-force";
|
|
15
|
+
import { useSocialConstellation } from "@agora-sdk/social-core";
|
|
16
|
+
import { bandColors } from "../palette.js";
|
|
17
|
+
/**
|
|
18
|
+
* Fixed bucket → blob radius (px). Deliberately coarse: the bucket IS the privacy protection, so the
|
|
19
|
+
* visual never encodes more precision than the bucket itself (SOCIAL.md §6).
|
|
20
|
+
*/
|
|
21
|
+
const BUCKET_RADIUS = {
|
|
22
|
+
"5–9": 20,
|
|
23
|
+
"10–19": 28,
|
|
24
|
+
"20–49": 38,
|
|
25
|
+
"50–99": 50,
|
|
26
|
+
"100+": 65,
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Lay out blobs with fresh random positions resolved by a synchronous force pass. Re-randomization is
|
|
30
|
+
* a privacy requirement, so this runs from scratch each time the blob set changes — never memoized to
|
|
31
|
+
* a stable layout. Uses `Math.random()` only for visual placement (no security relevance).
|
|
32
|
+
*/
|
|
33
|
+
function computePositions(blobs, width, height) {
|
|
34
|
+
const nodes = blobs.map((b) => ({
|
|
35
|
+
r: BUCKET_RADIUS[b.size] ?? 28,
|
|
36
|
+
warmth: b.warmth,
|
|
37
|
+
// Random seed placement near the center; the simulation spreads them without overlap.
|
|
38
|
+
x: width / 2 + (Math.random() - 0.5) * width * 0.6,
|
|
39
|
+
y: height / 2 + (Math.random() - 0.5) * height * 0.6,
|
|
40
|
+
}));
|
|
41
|
+
// Build a simulation, immediately stop its internal timer, and tick it synchronously so we get a
|
|
42
|
+
// settled, non-overlapping layout in one render with no animation loop or async state.
|
|
43
|
+
const simulation = forceSimulation(nodes)
|
|
44
|
+
.force("collide", forceCollide((d) => d.r + 8))
|
|
45
|
+
.force("center", forceCenter(width / 2, height / 2))
|
|
46
|
+
.stop();
|
|
47
|
+
simulation.tick(300);
|
|
48
|
+
return nodes;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Render the Constellation as a randomized field of warm blobs.
|
|
52
|
+
*
|
|
53
|
+
* Self-contained: reads {@link useSocialConstellation} and gates on the feature config. Returns `null`
|
|
54
|
+
* when disabled, a nebula when the snapshot is still forming (`asOf === null`), and otherwise a
|
|
55
|
+
* re-randomized SVG blob field. Blobs are sized by bucket and tinted by warmth only.
|
|
56
|
+
*
|
|
57
|
+
* @param props - {@link ConstellationProps}.
|
|
58
|
+
* @returns The blob canvas, a nebula, or `null`.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* <Constellation width={420} height={280} />
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export function Constellation({ width = 360, height = 240, className, }) {
|
|
66
|
+
const { constellation } = useSocialConstellation();
|
|
67
|
+
const gradPrefix = useId();
|
|
68
|
+
const blobs = constellation?.blobs ?? null;
|
|
69
|
+
// Positions live in state, seeded once per blob-set and re-seeded whenever the blobs change (or the
|
|
70
|
+
// canvas resizes). NOT recomputed on every render — only when the data/size actually changes — but
|
|
71
|
+
// also never a *stable* layout across mounts, since each fresh mount re-runs computePositions.
|
|
72
|
+
const [nodes, setNodes] = useState(() => blobs ? computePositions(blobs, width, height) : []);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
if (blobs)
|
|
75
|
+
setNodes(computePositions(blobs, width, height));
|
|
76
|
+
}, [blobs, width, height]);
|
|
77
|
+
// One gradient per band actually present, plus a shared blur — referenced by the circles below.
|
|
78
|
+
const bandsPresent = useMemo(() => Array.from(new Set((blobs ?? []).map((b) => b.warmth))), [blobs]);
|
|
79
|
+
if (!constellation)
|
|
80
|
+
return null;
|
|
81
|
+
// Still-forming: a gentle nebula, never an error or empty state.
|
|
82
|
+
if (constellation.asOf === null) {
|
|
83
|
+
return (_jsxs("svg", { className: className, width: width, height: height, role: "img", "aria-label": "Community constellation: still forming", children: [_jsxs("defs", { children: [_jsxs("radialGradient", { id: `${gradPrefix}-nebula`, cx: "50%", cy: "50%", r: "60%", children: [_jsx("stop", { offset: "0%", stopColor: "rgba(138,148,166,0.30)" }), _jsx("stop", { offset: "100%", stopColor: "rgba(138,148,166,0)" })] }), _jsx("filter", { id: `${gradPrefix}-nblur`, children: _jsx("feGaussianBlur", { stdDeviation: "10" }) })] }), _jsx("rect", { x: 0, y: 0, width: width, height: height, fill: `url(#${gradPrefix}-nebula)`, filter: `url(#${gradPrefix}-nblur)` })] }));
|
|
84
|
+
}
|
|
85
|
+
return (_jsxs("svg", { className: className, width: width, height: height, role: "img", "aria-label": "Community constellation", children: [_jsxs("defs", { children: [bandsPresent.map((band) => {
|
|
86
|
+
const colors = bandColors(band);
|
|
87
|
+
return (_jsxs("radialGradient", { id: `${gradPrefix}-${band}`, cx: "50%", cy: "50%", r: "50%", children: [_jsx("stop", { offset: "0%", stopColor: colors.core, stopOpacity: 0.9 }), _jsx("stop", { offset: "100%", stopColor: colors.core, stopOpacity: 0 })] }, band));
|
|
88
|
+
}), _jsx("filter", { id: `${gradPrefix}-glow`, children: _jsx("feGaussianBlur", { stdDeviation: "4" }) })] }), nodes.map((n, i) => (_jsx("circle", { cx: n.x, cy: n.y, r: n.r, fill: `url(#${gradPrefix}-${n.warmth})`, filter: `url(#${gradPrefix}-glow)` }, i)))] }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=Constellation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constellation.js","sourceRoot":"","sources":["../../../src/components/Constellation.tsx"],"names":[],"mappings":";AAAA,yFAAyF;AACzF,EAAE;AACF,8FAA8F;AAC9F,+CAA+C;AAC/C,sGAAsG;AACtG,sGAAsG;AACtG,8EAA8E;AAC9E,uGAAuG;AACvG,gBAAgB;AAChB,qGAAqG;AACrG,uGAAuG;AAEvG,OAAc,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,eAAe,GAEhB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,M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EE,EAAE,EAAE,CAAC,CAAC,CAAC,EACP,EAAE,EAAE,CAAC,CAAC,CAAC,EACP,CAAC,EAAE,CAAC,CAAC,CAAC,EACN,IAAI,EAAE,QAAQ,UAAU,IAAI,CAAC,CAAC,MAAM,GAAG,EACvC,MAAM,EAAE,QAAQ,UAAU,QAAQ,IAL7B,CAAC,CAMN,CACH,CAAC,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** Props for {@link Neighborhood}. */
|
|
3
|
+
export interface NeighborhoodProps {
|
|
4
|
+
/** Render the "include interactions" toggle (wires to the hook's setter). Defaults to `false`. */
|
|
5
|
+
showInteractionsToggle?: boolean;
|
|
6
|
+
/** Optional class for the root element. */
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Render the caller's Neighborhood — their named ties, lit by dyadic brightness.
|
|
11
|
+
*
|
|
12
|
+
* Self-contained: reads {@link useSocialNeighborhood} and gates on the feature config. Ties render in
|
|
13
|
+
* the server's brightest-first order; brightness becomes glow/scale, never a number. Optionally shows
|
|
14
|
+
* the interactions toggle.
|
|
15
|
+
*
|
|
16
|
+
* @param props - {@link NeighborhoodProps}.
|
|
17
|
+
* @returns The tie list, or `null` when the lens is disabled or still loading.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <Neighborhood showInteractionsToggle />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function Neighborhood({ showInteractionsToggle, className, }: NeighborhoodProps): React.ReactElement | null;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSocialNeighborhood } from "@agora-sdk/social-core";
|
|
3
|
+
import { brightnessTreatment } from "../palette.js";
|
|
4
|
+
/** Subtle glyphs for the tie-kind chips. Hints, not labels. */
|
|
5
|
+
const TIE_KIND_GLYPH = {
|
|
6
|
+
follow: "→",
|
|
7
|
+
connection: "↔",
|
|
8
|
+
interaction: "·",
|
|
9
|
+
};
|
|
10
|
+
/** Best available display label for a tie, falling back gracefully when fields are null. */
|
|
11
|
+
function displayName(tie) {
|
|
12
|
+
return tie.name ?? tie.username ?? "Someone";
|
|
13
|
+
}
|
|
14
|
+
/** First glyph for the avatar fallback. */
|
|
15
|
+
function initial(tie) {
|
|
16
|
+
const label = displayName(tie);
|
|
17
|
+
return label.charAt(0).toUpperCase();
|
|
18
|
+
}
|
|
19
|
+
/** One tie card — avatar (or initial) + name + tie-kind chips, lit by brightness glow. */
|
|
20
|
+
function TieCard({ tie }) {
|
|
21
|
+
const t = brightnessTreatment(tie.brightness);
|
|
22
|
+
// Sprout ties get a warm amber halo (hopeful/new); brighter ties get a golden glow. Never grey.
|
|
23
|
+
const glowColor = t.isSprout ? "rgba(224, 169, 85, " : "rgba(244, 198, 74, ";
|
|
24
|
+
const shadow = `0 0 ${t.glowRadius}px ${glowColor}${t.glowOpacity})`;
|
|
25
|
+
return (_jsxs("li", { style: {
|
|
26
|
+
display: "flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
gap: 12,
|
|
29
|
+
padding: "8px 4px",
|
|
30
|
+
listStyle: "none",
|
|
31
|
+
}, children: [_jsx("div", { "aria-hidden": true, style: {
|
|
32
|
+
width: 40,
|
|
33
|
+
height: 40,
|
|
34
|
+
borderRadius: "50%",
|
|
35
|
+
transform: `scale(${t.scale})`,
|
|
36
|
+
boxShadow: shadow,
|
|
37
|
+
background: tie.avatar
|
|
38
|
+
? `center / cover no-repeat url(${tie.avatar})`
|
|
39
|
+
: "linear-gradient(135deg, #e0a955, #f4c64a)",
|
|
40
|
+
display: "flex",
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
color: "#1b1b24",
|
|
44
|
+
fontWeight: 700,
|
|
45
|
+
fontSize: 16,
|
|
46
|
+
}, children: tie.avatar ? "" : initial(tie) }), _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 2 }, children: [_jsx("span", { style: { fontSize: 14, fontWeight: 600 }, children: displayName(tie) }), _jsx("span", { style: { display: "flex", gap: 6, fontSize: 11, color: "#9ca3af" }, children: tie.tieKinds.map((kind) => (_jsxs("span", { title: kind, "aria-label": kind, children: [TIE_KIND_GLYPH[kind], " ", kind] }, kind))) })] })] }));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Render the caller's Neighborhood — their named ties, lit by dyadic brightness.
|
|
50
|
+
*
|
|
51
|
+
* Self-contained: reads {@link useSocialNeighborhood} and gates on the feature config. Ties render in
|
|
52
|
+
* the server's brightest-first order; brightness becomes glow/scale, never a number. Optionally shows
|
|
53
|
+
* the interactions toggle.
|
|
54
|
+
*
|
|
55
|
+
* @param props - {@link NeighborhoodProps}.
|
|
56
|
+
* @returns The tie list, or `null` when the lens is disabled or still loading.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Neighborhood showInteractionsToggle />
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function Neighborhood({ showInteractionsToggle = false, className, }) {
|
|
64
|
+
const { neighborhood, includeInteractions, setIncludeInteractions } = useSocialNeighborhood();
|
|
65
|
+
if (!neighborhood)
|
|
66
|
+
return null;
|
|
67
|
+
return (_jsxs("div", { className: className, children: [showInteractionsToggle && (_jsxs("label", { style: { display: "flex", alignItems: "center", gap: 8, fontSize: 13, marginBottom: 8 }, children: [_jsx("input", { type: "checkbox", checked: includeInteractions, onChange: (e) => setIncludeInteractions(e.target.checked) }), "Include people I\u2019ve interacted with"] })), _jsx("ul", { style: { margin: 0, padding: 0 }, children: neighborhood.ties.map((tie) => (_jsx(TieCard, { tie: tie }, tie.userId))) })] }));
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=Neighborhood.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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OAAO,IAAI,CAAC;IAE/B,OAAO,CACL,eAAK,SAAS,EAAE,SAAS,aACtB,sBAAsB,IAAI,CACzB,iBAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,aAC5F,gBACE,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GACzD,gDAEI,CACT,EACD,aAAI,KAAK,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,YACjC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAC9B,KAAC,OAAO,IAAkB,GAAG,EAAE,GAAG,IAApB,GAAG,CAAC,MAAM,CAAc,CACvC,CAAC,GACC,IACD,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/** Props for {@link SocialTransparency}. */
|
|
3
|
+
export interface SocialTransparencyProps {
|
|
4
|
+
/** Optional class for the root element. */
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render the social-graph transparency panel.
|
|
9
|
+
*
|
|
10
|
+
* Self-contained: reads {@link useSocialTransparency} from the provider. Lists the enabled lenses and
|
|
11
|
+
* the tuning that shapes them, in member-safe terms.
|
|
12
|
+
*
|
|
13
|
+
* @param props - {@link SocialTransparencyProps}.
|
|
14
|
+
* @returns The disclosure panel, or `null` until the config has resolved.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <SocialTransparency />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function SocialTransparency({ className, }: SocialTransparencyProps): React.ReactElement | null;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSocialTransparency } from "@agora-sdk/social-core";
|
|
3
|
+
/** One labeled row in the disclosure panel. */
|
|
4
|
+
function Row({ label, value }) {
|
|
5
|
+
return (_jsxs("div", { style: { display: "flex", justifyContent: "space-between", gap: 16, fontSize: 13, padding: "4px 0" }, children: [_jsx("span", { style: { color: "#9ca3af" }, children: label }), _jsx("span", { style: { fontWeight: 600 }, children: value })] }));
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render the social-graph transparency panel.
|
|
9
|
+
*
|
|
10
|
+
* Self-contained: reads {@link useSocialTransparency} from the provider. Lists the enabled lenses and
|
|
11
|
+
* the tuning that shapes them, in member-safe terms.
|
|
12
|
+
*
|
|
13
|
+
* @param props - {@link SocialTransparencyProps}.
|
|
14
|
+
* @returns The disclosure panel, or `null` until the config has resolved.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <SocialTransparency />
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export function SocialTransparency({ className, }) {
|
|
22
|
+
const { config } = useSocialTransparency();
|
|
23
|
+
if (!config)
|
|
24
|
+
return null;
|
|
25
|
+
const lenses = [
|
|
26
|
+
config.weatherEnabled && "Weather",
|
|
27
|
+
config.constellationEnabled && "Constellation",
|
|
28
|
+
config.neighborhoodEnabled && "Neighborhood",
|
|
29
|
+
].filter(Boolean);
|
|
30
|
+
return (_jsxs("section", { className: className, "aria-label": "How the social graph works", children: [_jsx("h3", { style: { fontSize: 14, margin: "0 0 8px" }, children: "How your community graph works" }), _jsx(Row, { label: "Active lenses", value: lenses.length ? lenses.join(", ") : "None" }), _jsx(Row, { label: "Warmth memory", value: `~${config.warmthHalfLifeDays}-day half-life` }), _jsx(Row, { label: "Friction memory", value: `~${config.frictionHalfLifeDays}-day half-life` }), _jsx(Row, { label: "Smallest visible cluster", value: `${config.constellationKFloor}+ members` }), _jsx(Row, { label: "Neighborhood includes interactions", value: config.neighborhoodIncludeInteractions ? "By default" : "Only if you opt in" }), _jsx("p", { style: { fontSize: 12, color: "#9ca3af", marginTop: 10, lineHeight: 1.5 }, children: "Warmth fades gently over time, so the graph reflects how things are now \u2014 not a permanent score. Clusters smaller than the floor are never shown. Your Neighborhood is yours alone." })] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=SocialTransparency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialTransparency.js","sourceRoot":"","sources":["../../../src/components/SocialTransparency.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAQ/D,+CAA+C;AAC/C,SAAS,GAAG,CAAC,EAAE,KAAK,EAAE,KAAK,EAAoC;IAC7D,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,aACvG,eAAM,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,YAAG,KAAK,GAAQ,EACjD,eAAM,KAAK,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,YAAG,KAAK,GAAQ,IAC5C,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,SAAS,GACe;IACxB,MAAM,EAAE,MAAM,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IAEzB,MAAM,MAAM,GAAG;QACb,MAAM,CAAC,cAAc,IAAI,SAAS;QAClC,MAAM,CAAC,oBAAoB,IAAI,eAAe;QAC9C,MAAM,CAAC,mBAAmB,IAAI,cAAc;KAC7C,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;IAE9B,OAAO,CACL,mBAAS,SAAS,EAAE,SAAS,gBAAa,4BAA4B,aACpE,aAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,+CAAqC,EACnF,KAAC,GAAG,IAAC,KAAK,EAAC,eAAe,EAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAI,EAChF,KAAC,GAAG,IAAC,KAAK,EAAC,eAAe,EAAC,KAAK,EAAE,IAAI,MAAM,CAAC,kBAAkB,gBAAgB,GAAI,EACnF,KAAC,GAAG,IAAC,KAAK,EAAC,iBAAiB,EAAC,KAAK,EAAE,IAAI,MAAM,CAAC,oBAAoB,gBAAgB,GAAI,EACvF,KAAC,GAAG,IAAC,KAAK,EAAC,0BAA0B,EAAC,KAAK,EAAE,GAAG,MAAM,CAAC,mBAAmB,WAAW,GAAI,EACzF,KAAC,GAAG,IACF,KAAK,EAAC,oCAAoC,EAC1C,KAAK,EAAE,MAAM,CAAC,+BAA+B,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,oBAAoB,GACnF,EACF,YAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,yMAGxE,IACI,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "@agora-sdk/social-core";
|
|
2
|
+
export { CommunityWeather } from "./components/CommunityWeather.js";
|
|
3
|
+
export type { CommunityWeatherProps } from "./components/CommunityWeather.js";
|
|
4
|
+
export { Constellation } from "./components/Constellation.js";
|
|
5
|
+
export type { ConstellationProps } from "./components/Constellation.js";
|
|
6
|
+
export { Neighborhood } from "./components/Neighborhood.js";
|
|
7
|
+
export type { NeighborhoodProps } from "./components/Neighborhood.js";
|
|
8
|
+
export { SocialTransparency } from "./components/SocialTransparency.js";
|
|
9
|
+
export type { SocialTransparencyProps } from "./components/SocialTransparency.js";
|
|
10
|
+
export { bandPalette, bandColors, brightnessTreatment } from "./palette.js";
|
|
11
|
+
export type { BandColors, BrightnessTreatment } from "./palette.js";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @agora-sdk/social-react-js — web (browser) bindings for the Agora social graph.
|
|
2
|
+
//
|
|
3
|
+
// Re-exports the platform-agnostic core (provider + hooks + transport + types) and adds the web visual
|
|
4
|
+
// components for the three lenses plus the transparency disclosure. Use this package (not core
|
|
5
|
+
// directly) in browser apps so the components ship. The shared climate palette is exported too, so host
|
|
6
|
+
// apps can match the SDK's warmth vocabulary in their own chrome.
|
|
7
|
+
export * from "@agora-sdk/social-core";
|
|
8
|
+
// ── components ────────────────────────────────────────────────────────────────
|
|
9
|
+
export { CommunityWeather } from "./components/CommunityWeather.js";
|
|
10
|
+
export { Constellation } from "./components/Constellation.js";
|
|
11
|
+
export { Neighborhood } from "./components/Neighborhood.js";
|
|
12
|
+
export { SocialTransparency } from "./components/SocialTransparency.js";
|
|
13
|
+
// ── shared visual vocabulary (palette + brightness mapping) ───────────────────
|
|
14
|
+
export { bandPalette, bandColors, brightnessTreatment } from "./palette.js";
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,EAAE;AACF,uGAAuG;AACvG,+FAA+F;AAC/F,wGAAwG;AACxG,kEAAkE;AAElE,cAAc,wBAAwB,CAAC;AAEvC,iFAAiF;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAGxE,iFAAiF;AACjF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { WeatherBand } from "@agora-sdk/social-core";
|
|
2
|
+
/** A band's rendering colors: a `core` fill/ink and a softer `glow` for shadows/auras. */
|
|
3
|
+
export interface BandColors {
|
|
4
|
+
/** The primary fill or text color for this band. */
|
|
5
|
+
core: string;
|
|
6
|
+
/** A translucent glow/aura color (for box-shadow, radial-gradient edges). */
|
|
7
|
+
glow: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps each {@link WeatherBand} to its calm climate colors. Kept deliberately in the amber/slate/grey
|
|
11
|
+
* register — **no red anywhere** — so low warmth never reads as an alarm (SOCIAL.md §5).
|
|
12
|
+
*
|
|
13
|
+
* - `quiet` — soft grey-blue, "still forming" (the no-data sentinel)
|
|
14
|
+
* - `stormy` — muted slate-blue (low warmth, NOT danger)
|
|
15
|
+
* - `overcast` — cool grey (below average)
|
|
16
|
+
* - `fine` — warm amber-gold (above average)
|
|
17
|
+
* - `sunny` — bright golden-yellow (high warmth)
|
|
18
|
+
*/
|
|
19
|
+
export declare const bandPalette: Record<WeatherBand, BandColors>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the climate colors for a band, defaulting to `quiet` for any unexpected value (fail-soft to
|
|
22
|
+
* the neutral "forming" look rather than throwing on malformed server data).
|
|
23
|
+
*
|
|
24
|
+
* @param band - The weather/warmth band to color.
|
|
25
|
+
* @returns The {@link BandColors} for that band.
|
|
26
|
+
*/
|
|
27
|
+
export declare function bandColors(band: WeatherBand): BandColors;
|
|
28
|
+
/** The four brightness bands from SOCIAL.md §5, as visual treatment (never exposed as a number). */
|
|
29
|
+
export interface BrightnessTreatment {
|
|
30
|
+
/** Glow radius in px for a box-shadow / drop-shadow (higher = warmer, closer). */
|
|
31
|
+
glowRadius: number;
|
|
32
|
+
/** Glow opacity in `[0, 1]`. */
|
|
33
|
+
glowOpacity: number;
|
|
34
|
+
/** Node scale multiplier (brighter ties read slightly larger). */
|
|
35
|
+
scale: number;
|
|
36
|
+
/**
|
|
37
|
+
* True for ties at the floor band (`[0.15, 0.24]`): render the warm, hopeful "sprout" treatment, not
|
|
38
|
+
* a grey absence. New ≠ lonely ≠ deficient (SOCIAL.md §6).
|
|
39
|
+
*/
|
|
40
|
+
isSprout: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Map a dyadic `brightness` in `[0.15, 1.0]` to a visual treatment — glow, scale, and the sprout flag.
|
|
44
|
+
* The brightness number itself is **never** returned for display; it is a rendering input only.
|
|
45
|
+
*
|
|
46
|
+
* @param brightness - Dyadic brightness in `[0.15, 1.0]` (values outside are clamped).
|
|
47
|
+
* @returns The {@link BrightnessTreatment} for that tie.
|
|
48
|
+
*/
|
|
49
|
+
export declare function brightnessTreatment(brightness: number): BrightnessTreatment;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Climate palette + brightness mapping — the privacy-critical visual vocabulary, in one place.
|
|
2
|
+
//
|
|
3
|
+
// Every social surface that renders warmth (Weather band, Constellation blob tint) maps through
|
|
4
|
+
// `bandPalette` so the rules from SOCIAL.md §5/§6 hold uniformly: a sky/climate register, and
|
|
5
|
+
// **never red** for low-warmth bands (red reads as danger; low warmth means "could use more
|
|
6
|
+
// connection", not "something is wrong"). Brightness (Neighborhood) maps to visual WEIGHT only —
|
|
7
|
+
// never a number — via `brightnessTreatment`, with the floor band rendered as a hopeful sprout glow
|
|
8
|
+
// rather than a grey absence.
|
|
9
|
+
/**
|
|
10
|
+
* Maps each {@link WeatherBand} to its calm climate colors. Kept deliberately in the amber/slate/grey
|
|
11
|
+
* register — **no red anywhere** — so low warmth never reads as an alarm (SOCIAL.md §5).
|
|
12
|
+
*
|
|
13
|
+
* - `quiet` — soft grey-blue, "still forming" (the no-data sentinel)
|
|
14
|
+
* - `stormy` — muted slate-blue (low warmth, NOT danger)
|
|
15
|
+
* - `overcast` — cool grey (below average)
|
|
16
|
+
* - `fine` — warm amber-gold (above average)
|
|
17
|
+
* - `sunny` — bright golden-yellow (high warmth)
|
|
18
|
+
*/
|
|
19
|
+
export const bandPalette = {
|
|
20
|
+
quiet: { core: "#8a94a6", glow: "rgba(138, 148, 166, 0.35)" },
|
|
21
|
+
stormy: { core: "#5b6b86", glow: "rgba(91, 107, 134, 0.40)" },
|
|
22
|
+
overcast: { core: "#8d96a3", glow: "rgba(141, 150, 163, 0.40)" },
|
|
23
|
+
fine: { core: "#e0a955", glow: "rgba(224, 169, 85, 0.55)" },
|
|
24
|
+
sunny: { core: "#f4c64a", glow: "rgba(244, 198, 74, 0.70)" },
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the climate colors for a band, defaulting to `quiet` for any unexpected value (fail-soft to
|
|
28
|
+
* the neutral "forming" look rather than throwing on malformed server data).
|
|
29
|
+
*
|
|
30
|
+
* @param band - The weather/warmth band to color.
|
|
31
|
+
* @returns The {@link BandColors} for that band.
|
|
32
|
+
*/
|
|
33
|
+
export function bandColors(band) {
|
|
34
|
+
return bandPalette[band] ?? bandPalette.quiet;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Map a dyadic `brightness` in `[0.15, 1.0]` to a visual treatment — glow, scale, and the sprout flag.
|
|
38
|
+
* The brightness number itself is **never** returned for display; it is a rendering input only.
|
|
39
|
+
*
|
|
40
|
+
* @param brightness - Dyadic brightness in `[0.15, 1.0]` (values outside are clamped).
|
|
41
|
+
* @returns The {@link BrightnessTreatment} for that tie.
|
|
42
|
+
*/
|
|
43
|
+
export function brightnessTreatment(brightness) {
|
|
44
|
+
const b = Math.min(1, Math.max(0.15, brightness));
|
|
45
|
+
// Linear glow within the meaningful range; the floor band is special-cased as the sprout state.
|
|
46
|
+
const glowRadius = 6 + Math.round(b * 22); // ~9px at floor → 28px at full glow
|
|
47
|
+
const glowOpacity = 0.25 + b * 0.55; // ~0.33 at floor → 0.8 at full glow
|
|
48
|
+
const scale = 0.94 + b * 0.12; // subtle: brighter ties read slightly larger
|
|
49
|
+
const isSprout = b <= 0.24;
|
|
50
|
+
return { glowRadius, glowOpacity, scale, isSprout };
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","sourceRoot":"","sources":["../../src/palette.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,EAAE;AACF,gGAAgG;AAChG,8FAA8F;AAC9F,4FAA4F;AAC5F,iGAAiG;AACjG,oGAAoG;AACpG,8BAA8B;AAY9B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoC;IAC1D,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,2BAA2B,EAAE;IAC7D,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAC7D,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,2BAA2B,EAAE;IAChE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,0BAA0B,EAAE;IAC3D,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,0BAA0B,EAAE;CAC7D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAiB;IAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC;AAChD,CAAC;AAiBD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC;IAClD,gGAAgG;IAChG,MAAM,UAAU,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,oCAAoC;IAC/E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,oCAAoC;IACzE,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,6CAA6C;IAC5E,MAAM,QAAQ,GAAG,CAAC,IAAI,IAAI,CAAC;IAC3B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACtD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agora-sdk/social-react-js",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Agora SDK Plus, maintained by Jenova Marie",
|
|
7
|
+
"description": "Web (browser) components for the Agora social graph: CommunityWeather, Constellation (d3-force), Neighborhood, SocialTransparency. Re-exports @agora-sdk/social-core.",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"agora",
|
|
10
|
+
"social-graph",
|
|
11
|
+
"community",
|
|
12
|
+
"constellation",
|
|
13
|
+
"react",
|
|
14
|
+
"web",
|
|
15
|
+
"typescript"
|
|
16
|
+
],
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/jenova-marie/agora-sdk-plus/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://github.com/jenova-marie/agora-sdk-plus",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/jenova-marie/agora-sdk-plus.git",
|
|
24
|
+
"directory": "packages/social/react-js"
|
|
25
|
+
},
|
|
26
|
+
"main": "dist/esm/index.js",
|
|
27
|
+
"module": "dist/esm/index.js",
|
|
28
|
+
"types": "dist/esm/index.d.ts",
|
|
29
|
+
"type": "module",
|
|
30
|
+
"comment:esm-only": "ESM-only to match the secure-chat web binding: web/React consumers always bundle (Vite/webpack/Metro), and @agora-sdk/core is bundler-only, so a CJS build would never load at runtime.",
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"d3-force": "^3.0.0",
|
|
39
|
+
"@agora-sdk/social-core": "0.6.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@agora-sdk/core": "^1.2.2",
|
|
43
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
44
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/d3-force": "^3.0.10"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
51
|
+
"build": "rimraf dist && pnpm run build:esm",
|
|
52
|
+
"prepublish": "pnpm run build"
|
|
53
|
+
}
|
|
54
|
+
}
|