plantasia.space-design 0.22.21 → 0.23.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/FONT-LICENSES.md +135 -0
- package/dist/arrow/arrow-value-param.js +1 -1
- package/dist/arrow/arrow-value-slider.js +1 -1
- package/dist/arrow/index.js +4 -4
- package/dist/button.d.ts +1 -1
- package/dist/chat-rail/chat-rail.d.ts +7 -1
- package/dist/chat-rail/chat-rail.js +1 -1
- package/dist/chat-rail/index.js +1 -1
- package/dist/{chunk-NYNVSZKX.js → chunk-AQXHY6TR.js} +4 -3
- package/dist/chunk-AQXHY6TR.js.map +1 -0
- package/dist/chunk-FPLU5UXN.js +2 -0
- package/dist/chunk-FPLU5UXN.js.map +1 -0
- package/dist/chunk-PUDXPQEF.js +26 -0
- package/dist/chunk-PUDXPQEF.js.map +1 -0
- package/dist/chunk-ROQ3JZ2J.js +103 -0
- package/dist/chunk-ROQ3JZ2J.js.map +1 -0
- package/dist/chunk-T3T7F4AT.js +171 -0
- package/dist/chunk-T3T7F4AT.js.map +1 -0
- package/dist/color-control.js +1 -1
- package/dist/command.d.ts +2 -2
- package/dist/components.generated.d.ts +2 -2
- package/dist/components.generated.js +141 -2
- package/dist/components.generated.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +24 -7
- package/dist/numeric-keyboard/index.js +1 -1
- package/dist/numeric-keyboard/numeric-keyboard-provider.js +1 -1
- package/dist/numeric-keyboard/numeric-keyboard.js +1 -1
- package/dist/playback-bar.js +1 -1
- package/dist/playback-overlay.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme.js +29 -29
- package/dist/theme.js.map +1 -1
- package/dist/timeline/components/index.js +17 -17
- package/dist/timeline/hooks/index.js +7 -7
- package/dist/timeline/index.js +41 -41
- package/dist/timeline/tracks/index.js +6 -6
- package/dist/use-can-hover.d.ts +12 -0
- package/dist/use-can-hover.js +9 -0
- package/dist/use-can-hover.js.map +1 -0
- package/dist/user-card/index.d.ts +3 -0
- package/dist/user-card/index.js +23 -0
- package/dist/user-card/index.js.map +1 -0
- package/dist/user-card/user-card-preview.d.ts +43 -0
- package/dist/user-card/user-card-preview.js +13 -0
- package/dist/user-card/user-card-preview.js.map +1 -0
- package/dist/user-card/user-card.d.ts +67 -0
- package/dist/user-card/user-card.js +16 -0
- package/dist/user-card/user-card.js.map +1 -0
- package/package.json +5 -3
- package/src/react/chat-rail/chat-rail.tsx +12 -2
- package/src/react/components.generated.json +140 -1
- package/src/react/components.generated.ts +143 -2
- package/src/react/index.ts +12 -0
- package/src/react/use-can-hover.ts +35 -0
- package/src/react/user-card/index.ts +10 -0
- package/src/react/user-card/user-card-preview.tsx +137 -0
- package/src/react/user-card/user-card.tsx +257 -0
- package/src/styles/_build.css +9 -2
- package/src/styles/fonts/ChakraPetch-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/ChakraPetch-400-latin.woff2 +0 -0
- package/src/styles/fonts/ChakraPetch-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/ChakraPetch-700-latin.woff2 +0 -0
- package/src/styles/fonts/CormorantGaramond-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/CormorantGaramond-400-latin.woff2 +0 -0
- package/src/styles/fonts/CormorantGaramond-600-latin-ext.woff2 +0 -0
- package/src/styles/fonts/CormorantGaramond-600-latin.woff2 +0 -0
- package/src/styles/fonts/CormorantGaramond-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/CormorantGaramond-700-latin.woff2 +0 -0
- package/src/styles/fonts/DMSerifDisplay-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/DMSerifDisplay-400-latin.woff2 +0 -0
- package/src/styles/fonts/Exo2-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Exo2-400-latin.woff2 +0 -0
- package/src/styles/fonts/Exo2-600-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Exo2-600-latin.woff2 +0 -0
- package/src/styles/fonts/IBMPlexSans-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/IBMPlexSans-400-latin.woff2 +0 -0
- package/src/styles/fonts/IBMPlexSans-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/IBMPlexSans-700-latin.woff2 +0 -0
- package/src/styles/fonts/Inter-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Inter-400-latin.woff2 +0 -0
- package/src/styles/fonts/Inter-600-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Inter-600-latin.woff2 +0 -0
- package/src/styles/fonts/JetBrainsMono-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/JetBrainsMono-400-latin.woff2 +0 -0
- package/src/styles/fonts/JetBrainsMono-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/JetBrainsMono-700-latin.woff2 +0 -0
- package/src/styles/fonts/Lato-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Lato-400-latin.woff2 +0 -0
- package/src/styles/fonts/Lato-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Lato-700-latin.woff2 +0 -0
- package/src/styles/fonts/Merriweather-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Merriweather-400-latin.woff2 +0 -0
- package/src/styles/fonts/Merriweather-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Merriweather-700-latin.woff2 +0 -0
- package/src/styles/fonts/NunitoSans-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/NunitoSans-400-latin.woff2 +0 -0
- package/src/styles/fonts/NunitoSans-600-latin-ext.woff2 +0 -0
- package/src/styles/fonts/NunitoSans-600-latin.woff2 +0 -0
- package/src/styles/fonts/NunitoSans-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/NunitoSans-700-latin.woff2 +0 -0
- package/src/styles/fonts/Orbit-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Orbit-400-latin.woff2 +0 -0
- package/src/styles/fonts/Orbitron-400-latin.woff2 +0 -0
- package/src/styles/fonts/Orbitron-700-latin.woff2 +0 -0
- package/src/styles/fonts/Outfit-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Outfit-400-latin.woff2 +0 -0
- package/src/styles/fonts/Outfit-600-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Outfit-600-latin.woff2 +0 -0
- package/src/styles/fonts/Outfit-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/Outfit-700-latin.woff2 +0 -0
- package/src/styles/fonts/PinyonScript-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/PinyonScript-400-latin.woff2 +0 -0
- package/src/styles/fonts/PlusJakartaSans-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/PlusJakartaSans-400-latin.woff2 +0 -0
- package/src/styles/fonts/PlusJakartaSans-600-latin-ext.woff2 +0 -0
- package/src/styles/fonts/PlusJakartaSans-600-latin.woff2 +0 -0
- package/src/styles/fonts/PlusJakartaSans-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/PlusJakartaSans-700-latin.woff2 +0 -0
- package/src/styles/fonts/SourceSerif4-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/SourceSerif4-400-latin.woff2 +0 -0
- package/src/styles/fonts/SourceSerif4-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/SourceSerif4-700-latin.woff2 +0 -0
- package/src/styles/fonts/SpaceMono-400-latin-ext.woff2 +0 -0
- package/src/styles/fonts/SpaceMono-400-latin.woff2 +0 -0
- package/src/styles/fonts/SpaceMono-700-latin-ext.woff2 +0 -0
- package/src/styles/fonts/SpaceMono-700-latin.woff2 +0 -0
- package/src/styles/fonts/Tangerine-400-latin.woff2 +0 -0
- package/src/styles/fonts/Tangerine-700-latin.woff2 +0 -0
- package/src/styles/fonts.css +612 -9
- package/src/theme/catalog.generated.json +29 -29
- package/src/theme/source/fonts.source.js +31 -18
- package/dist/chunk-NYNVSZKX.js.map +0 -1
package/FONT-LICENSES.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Font licenses
|
|
2
|
+
|
|
3
|
+
The woff2 files in `src/styles/fonts/` are third-party fonts redistributed with this package. Every
|
|
4
|
+
one of them is licensed under the **SIL Open Font License, Version 1.1**, which permits bundling and
|
|
5
|
+
redistribution — including inside a package like this one — provided the copyright notice and the
|
|
6
|
+
license travel with the files. That is what this file is for.
|
|
7
|
+
|
|
8
|
+
The files are the latin and latin-ext subsets as built and distributed by Google Fonts
|
|
9
|
+
(https://fonts.google.com), redistributed unmodified. No font here has been renamed, edited or
|
|
10
|
+
re-generated, so no Reserved Font Name restriction is engaged. None of these fonts is sold, on its
|
|
11
|
+
own or otherwise.
|
|
12
|
+
|
|
13
|
+
Regenerate the files with `npm run fonts:generate`; if you add a family, add its copyright line
|
|
14
|
+
below in the same pass.
|
|
15
|
+
|
|
16
|
+
## Fonts and copyright holders
|
|
17
|
+
|
|
18
|
+
| Family | Copyright | Source |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| Orbit | Copyright 2022 The Orbit Project Authors (https://github.com/JAMO-TYPEFACE/Orbit) | https://fonts.google.com/specimen/Orbit |
|
|
21
|
+
| Inter | Copyright 2020 The Inter Project Authors (https://github.com/rsms/inter) | https://fonts.google.com/specimen/Inter |
|
|
22
|
+
| JetBrains Mono | Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono) | https://fonts.google.com/specimen/JetBrains+Mono |
|
|
23
|
+
| Lato | Copyright (c) 2010-2014 by tyPoland Lukasz Dziedzic (team@latofonts.com) with Reserved Font Name "Lato" | https://fonts.google.com/specimen/Lato |
|
|
24
|
+
| IBM Plex Sans | Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" | https://fonts.google.com/specimen/IBM+Plex+Sans |
|
|
25
|
+
| Chakra Petch | Copyright 2018 The Chakra Petch Project Authors (https://github.com/m4rc1e/Chakra-Petch.git) | https://fonts.google.com/specimen/Chakra+Petch |
|
|
26
|
+
| Exo 2 | Copyright 2013 The Exo 2 Project Authors (https://github.com/googlefonts/Exo-2.0) | https://fonts.google.com/specimen/Exo+2 |
|
|
27
|
+
| Source Serif 4 | Copyright 2014 The Source Serif 4 Project Authors (https://github.com/adobe-fonts/source-serif) | https://fonts.google.com/specimen/Source+Serif+4 |
|
|
28
|
+
| Space Mono | Copyright 2016 The Space Mono Project Authors (https://github.com/googlefonts/spacemono) | https://fonts.google.com/specimen/Space+Mono |
|
|
29
|
+
| Merriweather | Copyright 2020 The Merriweather Project Authors (https://github.com/EbenSorkin/Merriweather4) with Reserved Font Name "Merriweather". | https://fonts.google.com/specimen/Merriweather |
|
|
30
|
+
| Orbitron | Copyright 2018 The Orbitron Project Authors (https://github.com/theleagueof/orbitron), with Reserved Font Name: "Orbitron" | https://fonts.google.com/specimen/Orbitron |
|
|
31
|
+
| Pinyon Script | Copyright 2024 The Pinyon Project Authors (https://github.com/SorkinType/Pinyon) | https://fonts.google.com/specimen/Pinyon+Script |
|
|
32
|
+
| Cormorant Garamond | Copyright 2015 the Cormorant Project Authors (github.com/CatharsisFonts/Cormorant) | https://fonts.google.com/specimen/Cormorant+Garamond |
|
|
33
|
+
| Tangerine | Copyright (c) 2010, Toshi Omagari (tosche@mac.com) | https://fonts.google.com/specimen/Tangerine |
|
|
34
|
+
| Plus Jakarta Sans | Copyright 2020 The Plus Jakarta Sans Project Authors (https://github.com/tokotype/PlusJakartaSans) | https://fonts.google.com/specimen/Plus+Jakarta+Sans |
|
|
35
|
+
| Nunito Sans | Copyright 2016 The Nunito Sans Project Authors (https://github.com/Fonthausen/NunitoSans) | https://fonts.google.com/specimen/Nunito+Sans |
|
|
36
|
+
| Outfit | Copyright 2021 The Outfit Project Authors (https://github.com/Outfitio/Outfit-Fonts) | https://fonts.google.com/specimen/Outfit |
|
|
37
|
+
| DM Serif Display | Copyright 2014-2018 Adobe (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe in the United States and/or other countries. Copyright 2019 Google LLC. | https://fonts.google.com/specimen/DM+Serif+Display |
|
|
38
|
+
|
|
39
|
+
## SIL Open Font License, Version 1.1
|
|
40
|
+
|
|
41
|
+
Full text at https://openfontlicense.org — reproduced here so it ships with the files it covers.
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
45
|
+
This license is copied below, and is also available with a FAQ at:
|
|
46
|
+
http://scripts.sil.org/OFL
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
-----------------------------------------------------------
|
|
50
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
51
|
+
-----------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
PREAMBLE
|
|
54
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
55
|
+
development of collaborative font projects, to support the font creation
|
|
56
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
57
|
+
open framework in which fonts may be shared and improved in partnership
|
|
58
|
+
with others.
|
|
59
|
+
|
|
60
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
61
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
62
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
63
|
+
redistributed and/or sold with any software provided that any reserved
|
|
64
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
65
|
+
however, cannot be released under any other type of license. The
|
|
66
|
+
requirement for fonts to remain under this license does not apply
|
|
67
|
+
to any document created using the fonts or their derivatives.
|
|
68
|
+
|
|
69
|
+
DEFINITIONS
|
|
70
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
71
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
72
|
+
include source files, build scripts and documentation.
|
|
73
|
+
|
|
74
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
75
|
+
copyright statement(s).
|
|
76
|
+
|
|
77
|
+
"Original Version" refers to the collection of Font Software components as
|
|
78
|
+
distributed by the Copyright Holder(s).
|
|
79
|
+
|
|
80
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
81
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
82
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
83
|
+
new environment.
|
|
84
|
+
|
|
85
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
86
|
+
writer or other person who contributed to the Font Software.
|
|
87
|
+
|
|
88
|
+
PERMISSION & CONDITIONS
|
|
89
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
90
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
91
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
92
|
+
Software, subject to the following conditions:
|
|
93
|
+
|
|
94
|
+
1) Neither the Font Software nor any of its individual components,
|
|
95
|
+
in Original or Modified Versions, may be sold by itself.
|
|
96
|
+
|
|
97
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
98
|
+
redistributed and/or sold with any software, provided that each copy
|
|
99
|
+
contains the above copyright notice and this license. These can be
|
|
100
|
+
included either as stand-alone text files, human-readable headers or
|
|
101
|
+
in the appropriate machine-readable metadata fields within text or
|
|
102
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
103
|
+
|
|
104
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
105
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
106
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
107
|
+
presented to the users.
|
|
108
|
+
|
|
109
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
110
|
+
Software shall not be used to promote, endorse or advertise any
|
|
111
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
112
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
113
|
+
permission.
|
|
114
|
+
|
|
115
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
116
|
+
must be distributed entirely under this license, and must not be
|
|
117
|
+
distributed under any other license. The requirement for fonts to
|
|
118
|
+
remain under this license does not apply to any document created
|
|
119
|
+
using the Font Software.
|
|
120
|
+
|
|
121
|
+
TERMINATION
|
|
122
|
+
This license becomes null and void if any of the above conditions are
|
|
123
|
+
not met.
|
|
124
|
+
|
|
125
|
+
DISCLAIMER
|
|
126
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
127
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
128
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
129
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
130
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
131
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
132
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
133
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
134
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
135
|
+
```
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
clampSnap
|
|
6
6
|
} from "../chunk-7SZ7Y64V.js";
|
|
7
7
|
import "../chunk-Q7FZPJAG.js";
|
|
8
|
+
import "../chunk-QHYMH6SU.js";
|
|
8
9
|
import "../chunk-3CI5MFCE.js";
|
|
9
10
|
import "../chunk-TFNW3AJD.js";
|
|
10
11
|
import "../chunk-Y4HIF3E7.js";
|
|
@@ -14,7 +15,6 @@ import "../chunk-IPOE5ATE.js";
|
|
|
14
15
|
import "../chunk-QTGWYJDF.js";
|
|
15
16
|
import "../chunk-W5IFSITY.js";
|
|
16
17
|
import "../chunk-OC6SB4GT.js";
|
|
17
|
-
import "../chunk-QHYMH6SU.js";
|
|
18
18
|
import "../chunk-SQFBTEV3.js";
|
|
19
19
|
import "../chunk-5GN4B4YO.js";
|
|
20
20
|
import "../chunk-HSQIBP76.js";
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
ValueSlider
|
|
5
5
|
} from "../chunk-7SZ7Y64V.js";
|
|
6
6
|
import "../chunk-Q7FZPJAG.js";
|
|
7
|
+
import "../chunk-QHYMH6SU.js";
|
|
7
8
|
import "../chunk-3CI5MFCE.js";
|
|
8
9
|
import "../chunk-TFNW3AJD.js";
|
|
9
10
|
import "../chunk-Y4HIF3E7.js";
|
|
@@ -13,7 +14,6 @@ import "../chunk-IPOE5ATE.js";
|
|
|
13
14
|
import "../chunk-QTGWYJDF.js";
|
|
14
15
|
import "../chunk-W5IFSITY.js";
|
|
15
16
|
import "../chunk-OC6SB4GT.js";
|
|
16
|
-
import "../chunk-QHYMH6SU.js";
|
|
17
17
|
import "../chunk-SQFBTEV3.js";
|
|
18
18
|
import "../chunk-5GN4B4YO.js";
|
|
19
19
|
import "../chunk-HSQIBP76.js";
|
package/dist/arrow/index.js
CHANGED
|
@@ -5,6 +5,10 @@ import {
|
|
|
5
5
|
clampSnap
|
|
6
6
|
} from "../chunk-7SZ7Y64V.js";
|
|
7
7
|
import "../chunk-Q7FZPJAG.js";
|
|
8
|
+
import {
|
|
9
|
+
Switch,
|
|
10
|
+
SwitchGroup
|
|
11
|
+
} from "../chunk-QHYMH6SU.js";
|
|
8
12
|
import "../chunk-3CI5MFCE.js";
|
|
9
13
|
import "../chunk-TFNW3AJD.js";
|
|
10
14
|
import "../chunk-Y4HIF3E7.js";
|
|
@@ -25,10 +29,6 @@ import {
|
|
|
25
29
|
import {
|
|
26
30
|
Param
|
|
27
31
|
} from "../chunk-OC6SB4GT.js";
|
|
28
|
-
import {
|
|
29
|
-
Switch,
|
|
30
|
-
SwitchGroup
|
|
31
|
-
} from "../chunk-QHYMH6SU.js";
|
|
32
32
|
import "../chunk-SQFBTEV3.js";
|
|
33
33
|
import {
|
|
34
34
|
SegmentSlider,
|
package/dist/button.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "default" | "link" | "destructive" | "destructiveFilled" | "success" | "successOutlined" | "outline" | "outlineAccent" | "secondary" | "ghost" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare function Button({ className, variant, size, asChild, children, ...props }: Omit<React.ComponentProps<'button'>, 'size'> & VariantProps<typeof buttonVariants> & {
|
|
@@ -77,6 +77,12 @@ type ChatRailProps = {
|
|
|
77
77
|
/** A quiet line between the feed and the composer (e.g. "3 muted · unmute all"). */
|
|
78
78
|
footer?: React.ReactNode;
|
|
79
79
|
defaultCorner?: ChatRailCorner;
|
|
80
|
+
/**
|
|
81
|
+
* Whether the rail starts open. Uncontrolled, like `defaultCorner` — the rail still owns the
|
|
82
|
+
* open/collapsed gesture from then on. For hosts where talking IS the screen's purpose (a
|
|
83
|
+
* lobby, a waiting room) rather than a thing you might turn to mid-task.
|
|
84
|
+
*/
|
|
85
|
+
defaultOpen?: boolean;
|
|
80
86
|
/** Where the docked corner is remembered. `null` disables persistence. */
|
|
81
87
|
storageKey?: string | null;
|
|
82
88
|
/**
|
|
@@ -90,6 +96,6 @@ type ChatRailProps = {
|
|
|
90
96
|
labels?: ChatRailLabels;
|
|
91
97
|
className?: string;
|
|
92
98
|
};
|
|
93
|
-
declare function ChatRail({ messages, ownId, canWrite, onSend, onRetry, menuFor, footer, defaultCorner, storageKey, bottomClearance, maxVisible, maxLength, labels, className, }: ChatRailProps): React.JSX.Element;
|
|
99
|
+
declare function ChatRail({ messages, ownId, canWrite, onSend, onRetry, menuFor, footer, defaultCorner, defaultOpen, storageKey, bottomClearance, maxVisible, maxLength, labels, className, }: ChatRailProps): React.JSX.Element;
|
|
94
100
|
|
|
95
101
|
export { ChatRail, type ChatRailCorner, type ChatRailLabels, type ChatRailMenuItem, type ChatRailMessage, type ChatRailProps, type ChatRailRole, type ChatRailStatus };
|
package/dist/chat-rail/index.js
CHANGED
|
@@ -212,6 +212,7 @@ function ChatRail({
|
|
|
212
212
|
menuFor,
|
|
213
213
|
footer,
|
|
214
214
|
defaultCorner = "bottom-left",
|
|
215
|
+
defaultOpen = false,
|
|
215
216
|
storageKey = "ps.chat-rail.dock",
|
|
216
217
|
bottomClearance = "0px",
|
|
217
218
|
maxVisible = 60,
|
|
@@ -220,7 +221,7 @@ function ChatRail({
|
|
|
220
221
|
className
|
|
221
222
|
}) {
|
|
222
223
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
223
|
-
const [open, setOpen] = React.useState(
|
|
224
|
+
const [open, setOpen] = React.useState(defaultOpen);
|
|
224
225
|
const [unread, setUnread] = React.useState(0);
|
|
225
226
|
const [corner, setCorner] = React.useState(defaultCorner);
|
|
226
227
|
const [dragOffset, setDragOffset] = React.useState(null);
|
|
@@ -300,7 +301,7 @@ function ChatRail({
|
|
|
300
301
|
window.removeEventListener("pointerdown", onPointerDown2, true);
|
|
301
302
|
};
|
|
302
303
|
}, [open]);
|
|
303
|
-
const wasOpen = React.useRef(
|
|
304
|
+
const wasOpen = React.useRef(defaultOpen);
|
|
304
305
|
React.useEffect(() => {
|
|
305
306
|
if (open && !wasOpen.current) {
|
|
306
307
|
rootRef.current?.querySelector(".ps-chat-rail__input")?.focus();
|
|
@@ -476,4 +477,4 @@ function ChatRail({
|
|
|
476
477
|
export {
|
|
477
478
|
ChatRail
|
|
478
479
|
};
|
|
479
|
-
//# sourceMappingURL=chunk-
|
|
480
|
+
//# sourceMappingURL=chunk-AQXHY6TR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/chat-rail/chat-rail.tsx"],"sourcesContent":["/**\n * ChatRail — a near-invisible chat that lays over a live surface instead of boxing it in.\n *\n * Three states, all of them quiet:\n * - collapsed: one small dock icon with a soft unread badge. Drag it to snap to any of the four\n * corners; the choice is remembered per `storageKey`.\n * - peek: a newly arrived message flashes over the surface as a compact line and clears itself.\n * - expanded: the same lines as a scrollable feed with a compose bar beside the icon.\n *\n * Quiet is a property of the rail's FOOTPRINT, not of its text: each line sits on its own opaque\n * slab, sized to the words on it. The rail stays small and mostly out of the way, and the part of\n * it that carries meaning stays readable over anything — including a scene that moves.\n *\n * The rail owns all of its own behaviour — dock corner, drag-to-snap, open/collapsed, unread and\n * the peek queue — so every consumer gets the same interaction without reimplementing it. It owns\n * nothing domain-specific: the transport arrives as `onSend`, sender identity as a role stamped on\n * each message, and the row menu as `menuFor`. That split is what lets a multiplayer room and a\n * website page mount the identical component.\n *\n * A sender's identity is carried by name COLOUR alone — no avatars, no timestamps, no badges. The\n * colours are `--chat-role-*` tokens, so they follow the theme rather than pinning the rail to a\n * dark surface.\n */\nimport * as React from 'react'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../dropdown-menu'\nimport { Button } from '../button'\nimport { Input } from '../input'\nimport { cn } from '../utils'\n\nexport type ChatRailRole = 'creator' | 'player' | 'spectator'\nexport type ChatRailCorner = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'\nexport type ChatRailStatus = 'pending' | 'delivered' | 'failed'\n\nexport type ChatRailMessage = {\n /** Stable identity — also what the rail diffs on to decide what is newly arrived. */\n id: string\n text: string\n /** Compared against `ownId` to decide whether this is your own line. */\n authorId: string | null\n authorName: string\n /**\n * The sender's standing, stamped by the consumer AT SEND/RECEIVE TIME. It belongs on the message\n * rather than being looked up live, so a member leaving never recolours what they already said.\n */\n role?: ChatRailRole | null\n status?: ChatRailStatus\n /** Arrived as backlog rather than as news: counts toward unread, never flashes a peek. */\n history?: boolean\n}\n\nexport type ChatRailMenuItem = {\n key: string\n label: string\n icon?: React.ReactNode\n tone?: 'default' | 'destructive'\n disabled?: boolean\n onSelect: () => void\n}\n\nexport type ChatRailLabels = {\n /** Name shown on your own lines. Default `you`. */\n self?: string\n placeholder?: string\n placeholderDisabled?: string\n send?: string\n empty?: string\n open?: string\n openUnread?: (count: number) => string\n close?: string\n menu?: string\n retry?: string\n}\n\nexport type ChatRailProps = {\n messages: ChatRailMessage[]\n /** Your own author id — lines matching it render as yours and carry no row menu. */\n ownId?: string | null\n /** False disables the composer (e.g. no display name yet). */\n canWrite?: boolean\n onSend: (text: string) => void\n onRetry?: (id: string) => void\n /** Row menu contents. Omit for a read-only rail — no trigger is rendered. */\n menuFor?: (message: ChatRailMessage) => ChatRailMenuItem[]\n /** A quiet line between the feed and the composer (e.g. \"3 muted · unmute all\"). */\n footer?: React.ReactNode\n defaultCorner?: ChatRailCorner\n /**\n * Whether the rail starts open. Uncontrolled, like `defaultCorner` — the rail still owns the\n * open/collapsed gesture from then on. For hosts where talking IS the screen's purpose (a\n * lobby, a waiting room) rather than a thing you might turn to mid-task.\n */\n defaultOpen?: boolean\n /** Where the docked corner is remembered. `null` disables persistence. */\n storageKey?: string | null\n /**\n * Extra room to leave at the bottom edge on top of the safe-area inset — a transport bar, a\n * bottom nav. Any CSS length. The rail cannot know what its host puts there, so the host says.\n */\n bottomClearance?: string\n /** Newest N lines kept in the DOM. The rail is a ticker, not an archive. */\n maxVisible?: number\n maxLength?: number\n labels?: ChatRailLabels\n className?: string\n}\n\nconst CORNERS: ChatRailCorner[] = ['top-left', 'top-right', 'bottom-left', 'bottom-right']\nconst PEEK_MS = 5_000\nconst PEEK_MAX = 3\nconst DRAG_THRESHOLD_PX = 8\n\nconst DEFAULT_LABELS: Required<Omit<ChatRailLabels, 'openUnread'>> & {\n openUnread: (count: number) => string\n} = {\n self: 'you',\n placeholder: 'message the room…',\n placeholderDisabled: 'pick a display name to chat',\n send: 'send',\n empty: 'no messages yet — say hi',\n open: 'Open chat',\n openUnread: (count) => `Open chat, ${count} unread`,\n close: 'Close chat',\n menu: 'Message options',\n retry: 'not sent — retry',\n}\n\nconst isCorner = (value: unknown): value is ChatRailCorner =>\n CORNERS.includes(value as ChatRailCorner)\n\nfunction readCorner(key: string | null | undefined, fallback: ChatRailCorner): ChatRailCorner {\n if (!key || typeof window === 'undefined') return fallback\n try {\n const stored = window.localStorage.getItem(key)\n return isCorner(stored) ? stored : fallback\n } catch {\n return fallback\n }\n}\n\nfunction writeCorner(key: string | null | undefined, corner: ChatRailCorner) {\n if (!key || typeof window === 'undefined') return\n try {\n window.localStorage.setItem(key, corner)\n } catch {\n /* private mode — the dock just resets next boot */\n }\n}\n\n/**\n * The box a `position: fixed` rail is actually laid out against. Usually the viewport, but any\n * ancestor with a transform/filter/containment establishes a containing block instead — which is\n * exactly what a host that frames the rail inside a panel does. Snapping against the viewport\n * there would make whole corners unreachable.\n */\nfunction containingBlockRect(el: HTMLElement | null) {\n for (let node = el?.parentElement ?? null; node; node = node.parentElement) {\n const s = getComputedStyle(node)\n const contained =\n s.transform !== 'none' ||\n s.filter !== 'none' ||\n s.perspective !== 'none' ||\n /\\b(paint|layout|strict|content)\\b/.test(s.contain) ||\n /\\b(transform|filter|perspective)\\b/.test(s.willChange)\n if (contained) {\n const r = node.getBoundingClientRect()\n return { left: r.left, top: r.top, width: r.width, height: r.height }\n }\n }\n return { left: 0, top: 0, width: window.innerWidth, height: window.innerHeight }\n}\n\n/** The corner a released pointer landed nearest to, within the rail's own containing block. */\nfunction cornerForPoint(x: number, y: number, box: ReturnType<typeof containingBlockRect>) {\n const vertical = y < box.top + box.height / 2 ? 'top' : 'bottom'\n const horizontal = x < box.left + box.width / 2 ? 'left' : 'right'\n return `${vertical}-${horizontal}` as ChatRailCorner\n}\n\n/** One rail line: a role-coloured name, the text, and (optionally) a menu revealed on hover. */\nfunction ChatRailLine({\n message,\n isOwn,\n selfLabel,\n menuFor,\n menuLabel,\n retryLabel,\n onRetry,\n menuContainer,\n armed,\n onArm,\n}: {\n message: ChatRailMessage\n isOwn: boolean\n selfLabel: string\n menuFor?: (message: ChatRailMessage) => ChatRailMenuItem[]\n menuLabel: string\n retryLabel: string\n onRetry?: () => void\n /** Portal target for the row menu — the rail's own root, so the menu stays inside whatever\n * theme the consumer wrapped the rail in. Portalled to <body> it would fall back to the light\n * token set and render white-on-dark. */\n menuContainer?: HTMLElement | null\n /** True once this row has been pointed at or focused. Only then does it pay for a menu. */\n armed?: boolean\n onArm?: () => void\n}) {\n const name = isOwn ? selfLabel : message.authorName\n // `menuFor` is only consulted for the row actually being acted on: a full feed would otherwise\n // rebuild every row's item array on every keystroke, and mount a dropdown root per line.\n const items = armed && menuFor ? menuFor(message) : null\n\n return (\n <div\n className=\"ps-chat-rail__line\"\n data-slot=\"chat-rail-line\"\n data-role={isOwn ? 'self' : (message.role ?? 'spectator')}\n data-status={message.status ?? 'delivered'}\n >\n <span className=\"ps-chat-rail__name\">{name}</span>{' '}\n <span className=\"ps-chat-rail__text\">{message.text}</span>\n {message.status === 'failed' && onRetry ? (\n <>\n {' '}\n <button type=\"button\" className=\"ps-chat-rail__retry\" onClick={onRetry}>\n {retryLabel}\n </button>\n </>\n ) : null}\n {menuFor && !isOwn ? (\n <span\n className=\"ps-chat-rail__linemenu\"\n onPointerEnter={armed ? undefined : onArm}\n onPointerDown={armed ? undefined : onArm}\n onFocusCapture={armed ? undefined : onArm}\n >\n {items && items.length > 0 ? (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={menuLabel}\n className=\"ps-chat-rail__linemenu-trigger\"\n >\n <MoreGlyph />\n </Button>\n </DropdownMenuTrigger>\n {/* The library's own menu surface, unrestyled — a chat row should not invent a\n second kind of dropdown. */}\n <DropdownMenuContent align=\"start\" container={menuContainer ?? undefined}>\n {items.map((item) => (\n <DropdownMenuItem\n key={item.key}\n disabled={item.disabled}\n onSelect={item.disabled ? undefined : item.onSelect}\n variant={item.tone === 'destructive' ? 'destructive' : undefined}\n >\n {item.icon}\n {item.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n ) : (\n // Placeholder trigger: same box, no dropdown machinery, until the row is pointed at.\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={menuLabel}\n className=\"ps-chat-rail__linemenu-trigger\"\n onClick={onArm}\n >\n <MoreGlyph />\n </Button>\n )}\n </span>\n ) : null}\n </div>\n )\n}\n\nfunction MoreGlyph() {\n return (\n <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"currentColor\" aria-hidden>\n <circle cx=\"12\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"19\" cy=\"12\" r=\"1.5\" />\n <circle cx=\"5\" cy=\"12\" r=\"1.5\" />\n </svg>\n )\n}\n\n/**\n * The composer owns its own draft. Kept out of the rail body on purpose: typing would otherwise\n * re-render the whole feed on every keystroke, on a surface that is usually already spending its\n * frame budget on a live scene.\n */\nfunction ChatRailComposer({\n canWrite,\n maxLength,\n labels,\n onSend,\n}: {\n canWrite: boolean\n maxLength: number\n labels: typeof DEFAULT_LABELS\n onSend: (text: string) => void\n}) {\n const [draft, setDraft] = React.useState('')\n const submit = React.useCallback(() => {\n const value = draft.trim()\n if (!value || !canWrite) return\n onSend(value)\n setDraft('')\n }, [draft, canWrite, onSend])\n\n return (\n <div className=\"ps-chat-rail__composer\" data-slot=\"chat-rail-composer\">\n {/* The library's own field and button — a chat composer is not a reason to grow a second\n set of primitives. (No ref here: Input is a plain function component, so the rail focuses\n it by query instead.) */}\n <Input\n type=\"text\"\n className=\"ps-chat-rail__input\"\n value={draft}\n maxLength={maxLength}\n disabled={!canWrite}\n placeholder={canWrite ? labels.placeholder : labels.placeholderDisabled}\n aria-label={labels.placeholder}\n onChange={(event) => setDraft(event.target.value)}\n onKeyDown={(event) => {\n // An IME's confirm-candidate Enter must not send the half-composed buffer.\n if (event.nativeEvent.isComposing) return\n if (event.key === 'Enter' && !event.shiftKey) {\n event.preventDefault()\n submit()\n }\n }}\n />\n <Button\n type=\"button\"\n size=\"sm\"\n className=\"ps-chat-rail__send\"\n onClick={submit}\n disabled={!canWrite || draft.trim().length === 0}\n >\n {labels.send}\n </Button>\n </div>\n )\n}\n\nexport function ChatRail({\n messages,\n ownId = null,\n canWrite = true,\n onSend,\n onRetry,\n menuFor,\n footer,\n defaultCorner = 'bottom-left',\n defaultOpen = false,\n storageKey = 'ps.chat-rail.dock',\n bottomClearance = '0px',\n maxVisible = 60,\n maxLength = 500,\n labels,\n className,\n}: ChatRailProps) {\n const text = { ...DEFAULT_LABELS, ...labels }\n const [open, setOpen] = React.useState(defaultOpen)\n const [unread, setUnread] = React.useState(0)\n const [corner, setCorner] = React.useState<ChatRailCorner>(defaultCorner)\n const [dragOffset, setDragOffset] = React.useState<{ x: number; y: number } | null>(null)\n const [peeks, setPeeks] = React.useState<ChatRailMessage[]>([])\n const [armedRow, setArmedRow] = React.useState<string | null>(null)\n\n const rootRef = React.useRef<HTMLDivElement | null>(null)\n // The rail's root doubles as the portal target for row menus, so they inherit the consumer's\n // theme instead of <body>'s. Held in state because the portal needs it during render.\n const [portalHost, setPortalHost] = React.useState<HTMLDivElement | null>(null)\n const iconRef = React.useRef<HTMLButtonElement | null>(null)\n const listRef = React.useRef<HTMLDivElement | null>(null)\n const dragRef = React.useRef<{ startX: number; startY: number; moved: boolean } | null>(null)\n const suppressClickRef = React.useRef(false)\n const stickToBottom = React.useRef(true)\n const seenRef = React.useRef<Set<string> | null>(null)\n const openRef = React.useRef(open)\n openRef.current = open\n const peekTimers = React.useRef<Set<ReturnType<typeof setTimeout>>>(new Set())\n\n // Stable, so React does not detach/reattach it (and re-run the state setter) on every render —\n // which during a drag would be every pointer event.\n const setRoot = React.useCallback((el: HTMLDivElement | null) => {\n rootRef.current = el\n setPortalHost((prev) => (prev === el ? prev : el))\n }, [])\n\n React.useEffect(() => setCorner(readCorner(storageKey, defaultCorner)), [storageKey, defaultCorner])\n React.useEffect(\n () => () => {\n for (const timer of peekTimers.current) clearTimeout(timer)\n peekTimers.current.clear()\n },\n [],\n )\n\n // What is NEW since the last render decides both the badge and the peek. The very first pass\n // only seeds the seen-set: everything already on screen at mount is context, not news.\n React.useEffect(() => {\n const seen = seenRef.current\n if (seen === null) {\n seenRef.current = new Set(messages.map((m) => m.id))\n return\n }\n const arrivals: ChatRailMessage[] = []\n for (const message of messages) {\n if (seen.has(message.id)) continue\n seen.add(message.id)\n if (message.authorId !== null && message.authorId === ownId) continue\n arrivals.push(message)\n }\n if (arrivals.length === 0 || openRef.current) return\n setUnread((n) => n + arrivals.length)\n const fresh = arrivals.filter((m) => !m.history)\n if (fresh.length === 0) return\n setPeeks((prev) => [...prev, ...fresh].slice(-PEEK_MAX))\n for (const message of fresh) {\n const timer = setTimeout(() => {\n peekTimers.current.delete(timer)\n setPeeks((prev) => prev.filter((entry) => entry.id !== message.id))\n }, PEEK_MS)\n peekTimers.current.add(timer)\n }\n }, [messages, ownId])\n\n // Opening is a gesture, so closing is one too: Escape, or a pointer landing outside the rail.\n // Both scope their \"is this ours?\" test to the rail's own subtree — the rail portals its menus\n // into its own root, so a document-wide overlay query would let any unrelated dialog in the host\n // page silently disable closing. The outside listener only OBSERVES — it never preventDefaults,\n // so the surface underneath still receives the same gesture.\n React.useEffect(() => {\n if (!open) return undefined\n const isOurs = (node: Node | null) => {\n const root = rootRef.current\n return Boolean(root && node && root.contains(node))\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key !== 'Escape') return\n // Escape belongs to our own row menu or a dialog it opened while focus is inside it.\n if (isOurs(document.activeElement)) {\n const el = document.activeElement as Element | null\n if (el?.closest('[role=\"menu\"], [role=\"dialog\"], [role=\"alertdialog\"]')) return\n }\n setOpen(false)\n }\n const onPointerDown = (event: PointerEvent) => {\n if (isOurs(event.target as Node | null)) return\n setOpen(false)\n }\n window.addEventListener('keydown', onKeyDown)\n window.addEventListener('pointerdown', onPointerDown, true)\n return () => {\n window.removeEventListener('keydown', onKeyDown)\n window.removeEventListener('pointerdown', onPointerDown, true)\n }\n }, [open])\n\n // Focus follows the gesture: into the composer on open, back to the icon on close — so the rail\n // is dismissable and reachable without a pointer. Queried rather than ref'd: the library's Input\n // is a plain function component and would silently drop a ref.\n // Seeded from `defaultOpen`, not from `false`: a rail that STARTS open was never opened by a\n // gesture, so there is no gesture for focus to follow. Seeding false made it grab the composer\n // on mount and talk over whatever the host was announcing.\n const wasOpen = React.useRef(defaultOpen)\n React.useEffect(() => {\n if (open && !wasOpen.current) {\n rootRef.current?.querySelector<HTMLInputElement>('.ps-chat-rail__input')?.focus()\n }\n if (!open && wasOpen.current) iconRef.current?.focus()\n wasOpen.current = open\n }, [open])\n\n const visible = messages.length > maxVisible ? messages.slice(-maxVisible) : messages\n\n const handleScroll = React.useCallback(() => {\n const el = listRef.current\n if (!el) return\n stickToBottom.current = el.scrollHeight - el.scrollTop - el.clientHeight < 48\n }, [])\n React.useEffect(() => {\n const el = listRef.current\n if (el && stickToBottom.current) el.scrollTop = el.scrollHeight\n }, [visible.length, open])\n\n const send = React.useCallback(\n (value: string) => {\n stickToBottom.current = true\n onSend(value)\n },\n [onSend],\n )\n\n const toggle = React.useCallback(() => {\n if (suppressClickRef.current) {\n suppressClickRef.current = false\n return\n }\n // Read the current state rather than nesting sibling updates inside setOpen's updater —\n // updaters must be pure, and React may run them more than once.\n const next = !openRef.current\n setOpen(next)\n if (next) {\n setUnread(0)\n setPeeks([])\n }\n }, [])\n\n const onPointerDown = React.useCallback((event: React.PointerEvent<HTMLButtonElement>) => {\n // Cleared at the START of each gesture: a drag's synthetic click lands on whatever sits under\n // the release point, not on the icon, so the flag would otherwise eat the NEXT real tap.\n suppressClickRef.current = false\n dragRef.current = { startX: event.clientX, startY: event.clientY, moved: false }\n // Capture keeps the move/up on the icon once the pointer leaves its 34px box.\n event.currentTarget.setPointerCapture?.(event.pointerId)\n }, [])\n\n const onPointerMove = React.useCallback((event: React.PointerEvent<HTMLButtonElement>) => {\n const drag = dragRef.current\n if (!drag) return\n const dx = event.clientX - drag.startX\n const dy = event.clientY - drag.startY\n if (!drag.moved && Math.hypot(dx, dy) < DRAG_THRESHOLD_PX) return\n drag.moved = true\n setDragOffset({ x: dx, y: dy })\n }, [])\n\n const onPointerUp = React.useCallback(\n (event: React.PointerEvent<HTMLButtonElement>) => {\n const drag = dragRef.current\n dragRef.current = null\n setDragOffset(null)\n if (!drag?.moved) return\n suppressClickRef.current = true\n const next = cornerForPoint(event.clientX, event.clientY, containingBlockRect(rootRef.current))\n setCorner(next)\n writeCorner(storageKey, next)\n },\n [storageKey],\n )\n\n const [vertical, horizontal] = corner.split('-') as ['top' | 'bottom', 'left' | 'right']\n\n return (\n <div\n ref={setRoot}\n data-slot=\"chat-rail\"\n className={cn('ps-chat-rail', className)}\n // NOT `data-corner`: that attribute already belongs to the brand corner-bracket decoration\n // in effects.css, which would style this element as a 9px bracket at opacity 0.\n data-dock={corner}\n data-side={horizontal}\n data-edge={vertical}\n data-open={open || undefined}\n style={\n {\n '--ps-chat-rail-bottom-clearance': bottomClearance,\n '--ps-chat-rail-peek-duration': `${PEEK_MS}ms`,\n } as React.CSSProperties\n }\n >\n {open ? (\n <div\n ref={listRef}\n onScroll={handleScroll}\n className=\"ps-chat-rail__feed\"\n data-slot=\"chat-rail-feed\"\n data-chat-rail-feed\n >\n {visible.length === 0 ? (\n <div className=\"ps-chat-rail__empty\">{text.empty}</div>\n ) : (\n visible.map((message) => {\n const isOwn = message.authorId !== null && message.authorId === ownId\n return (\n <ChatRailLine\n key={message.id}\n message={message}\n isOwn={isOwn}\n selfLabel={text.self}\n menuFor={menuFor}\n menuLabel={text.menu}\n retryLabel={text.retry}\n onRetry={onRetry ? () => onRetry(message.id) : undefined}\n menuContainer={portalHost}\n armed={armedRow === message.id}\n onArm={() => setArmedRow(message.id)}\n />\n )\n })\n )}\n </div>\n ) : peeks.length > 0 ? (\n <div className=\"ps-chat-rail__peek\" role=\"status\" aria-live=\"polite\" data-chat-rail-peek>\n {peeks.map((message) => (\n <ChatRailLine\n key={message.id}\n message={message}\n isOwn={false}\n selfLabel={text.self}\n menuLabel={text.menu}\n retryLabel={text.retry}\n />\n ))}\n </div>\n ) : null}\n\n {open && footer ? <div className=\"ps-chat-rail__footer\">{footer}</div> : null}\n\n <div className=\"ps-chat-rail__bar\" data-slot=\"chat-rail-bar\">\n <button\n ref={iconRef}\n type=\"button\"\n className=\"ps-chat-rail__icon\"\n aria-label={open ? text.close : unread > 0 ? text.openUnread(unread) : text.open}\n aria-expanded={open}\n data-dragging={dragOffset !== null || undefined}\n data-chat-rail-toggle\n style={\n dragOffset ? { transform: `translate(${dragOffset.x}px, ${dragOffset.y}px)` } : undefined\n }\n onClick={toggle}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={() => {\n dragRef.current = null\n setDragOffset(null)\n }}\n >\n {/* Inline rather than an icon import so the glyph can't drift from the dock's geometry.\n Dimensions are attributes as well as CSS: a consumer whose reset reaches descendant\n svgs must not be able to leave this one unsized. */}\n <svg\n width=\"15\"\n height=\"15\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={1.6}\n aria-hidden\n >\n <path d=\"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z\" />\n </svg>\n {!open && unread > 0 ? (\n <span className=\"ps-chat-rail__badge\" data-chat-rail-unread>\n {unread > 99 ? '99+' : unread}\n </span>\n ) : null}\n </button>\n\n {open ? (\n <ChatRailComposer\n canWrite={canWrite}\n maxLength={maxLength}\n labels={text}\n onSend={send}\n />\n ) : null}\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,YAAY,WAAW;AAwMjB,SAGE,UAHF,KAGE,YAHF;AAhHN,IAAM,UAA4B,CAAC,YAAY,aAAa,eAAe,cAAc;AACzF,IAAM,UAAU;AAChB,IAAM,WAAW;AACjB,IAAM,oBAAoB;AAE1B,IAAM,iBAEF;AAAA,EACF,MAAM;AAAA,EACN,aAAa;AAAA,EACb,qBAAqB;AAAA,EACrB,MAAM;AAA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gBACC,CAAC,QAAQ,SAAS,IACjB,oBAAC,UAAK,WAAU,uBAAsB,yBAAqB,MACxD,mBAAS,KAAK,QAAQ,QACzB,IACE;AAAA;AAAA;AAAA,UACN;AAAA,UAEC,OACC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA,QAAQ;AAAA,cACR,QAAQ;AAAA;AAAA,UACV,IACE;AAAA,WACN;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["onPointerDown"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/react/use-can-hover.ts
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
var QUERY = "(hover: hover) and (pointer: fine)";
|
|
6
|
+
function useCanHover() {
|
|
7
|
+
const [canHover, setCanHover] = React.useState(true);
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
if (typeof window === "undefined" || !window.matchMedia) return;
|
|
10
|
+
const mql = window.matchMedia(QUERY);
|
|
11
|
+
const update = () => setCanHover(mql.matches);
|
|
12
|
+
update();
|
|
13
|
+
if (typeof mql.addEventListener === "function") {
|
|
14
|
+
mql.addEventListener("change", update);
|
|
15
|
+
return () => mql.removeEventListener("change", update);
|
|
16
|
+
}
|
|
17
|
+
mql.addListener(update);
|
|
18
|
+
return () => mql.removeListener(update);
|
|
19
|
+
}, []);
|
|
20
|
+
return canHover;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
useCanHover
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=chunk-PUDXPQEF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/use-can-hover.ts"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\n\nconst QUERY = \"(hover: hover) and (pointer: fine)\"\n\n/**\n * useCanHover — `true` when the pointer can actually hover (a mouse or trackpad), `false` on\n * touch. The distinction the library cares about is not screen WIDTH: a small window on a laptop\n * can still hover, and a large tablet still cannot. Anything that reveals content on hover needs\n * a second way in where this is false.\n *\n * Optimistically `true` until mounted, so server and first client render agree and the\n * hover-capable case (the common one on desktop) does not flash a touch affordance.\n */\nexport function useCanHover(): boolean {\n const [canHover, setCanHover] = React.useState(true)\n\n React.useEffect(() => {\n if (typeof window === \"undefined\" || !window.matchMedia) return\n const mql = window.matchMedia(QUERY)\n const update = () => setCanHover(mql.matches)\n update()\n // Older Safari and some WebViews only have the deprecated addListener; calling the modern\n // method there throws inside the effect and the touch path is never selected.\n if (typeof mql.addEventListener === \"function\") {\n mql.addEventListener(\"change\", update)\n return () => mql.removeEventListener(\"change\", update)\n }\n mql.addListener(update)\n return () => mql.removeListener(update)\n }, [])\n\n return canHover\n}\n"],"mappings":";;;AAEA,YAAY,WAAW;AAEvB,IAAM,QAAQ;AAWP,SAAS,cAAuB;AACrC,QAAM,CAAC,UAAU,WAAW,IAAU,eAAS,IAAI;AAEnD,EAAM,gBAAU,MAAM;AACpB,QAAI,OAAO,WAAW,eAAe,CAAC,OAAO,WAAY;AACzD,UAAM,MAAM,OAAO,WAAW,KAAK;AACnC,UAAM,SAAS,MAAM,YAAY,IAAI,OAAO;AAC5C,WAAO;AAGP,QAAI,OAAO,IAAI,qBAAqB,YAAY;AAC9C,UAAI,iBAAiB,UAAU,MAAM;AACrC,aAAO,MAAM,IAAI,oBAAoB,UAAU,MAAM;AAAA,IACvD;AACA,QAAI,YAAY,MAAM;AACtB,WAAO,MAAM,IAAI,eAAe,MAAM;AAAA,EACxC,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;","names":[]}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useCanHover
|
|
4
|
+
} from "./chunk-PUDXPQEF.js";
|
|
5
|
+
import {
|
|
6
|
+
HoverCard,
|
|
7
|
+
HoverCardContent,
|
|
8
|
+
HoverCardTrigger
|
|
9
|
+
} from "./chunk-COFADMT2.js";
|
|
10
|
+
import {
|
|
11
|
+
Dialog,
|
|
12
|
+
DialogContent,
|
|
13
|
+
DialogTitle
|
|
14
|
+
} from "./chunk-KUCOW3CI.js";
|
|
15
|
+
import {
|
|
16
|
+
cn
|
|
17
|
+
} from "./chunk-BRLBKYOJ.js";
|
|
18
|
+
|
|
19
|
+
// src/react/user-card/user-card-preview.tsx
|
|
20
|
+
import * as React from "react";
|
|
21
|
+
import { Info } from "lucide-react";
|
|
22
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
var OPEN_DELAY_MS = 200;
|
|
24
|
+
var CLOSE_DELAY_MS = 120;
|
|
25
|
+
var CARD_WIDTH = 272;
|
|
26
|
+
var BARE_SURFACE = "overflow-hidden rounded-none border-0 bg-transparent p-0 shadow-none";
|
|
27
|
+
function UserCardPreview({
|
|
28
|
+
children,
|
|
29
|
+
card,
|
|
30
|
+
label,
|
|
31
|
+
triggerLabel,
|
|
32
|
+
showTouchTrigger = true,
|
|
33
|
+
disabled = false,
|
|
34
|
+
openDelay = OPEN_DELAY_MS,
|
|
35
|
+
closeDelay = CLOSE_DELAY_MS,
|
|
36
|
+
contentClassName,
|
|
37
|
+
className
|
|
38
|
+
}) {
|
|
39
|
+
const canHover = useCanHover();
|
|
40
|
+
const [open, setOpen] = React.useState(false);
|
|
41
|
+
const [dialogOpen, setDialogOpen] = React.useState(false);
|
|
42
|
+
const resolve = (isOpen) => typeof card === "function" ? card(isOpen) : card;
|
|
43
|
+
if (disabled) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
44
|
+
if (!canHover) {
|
|
45
|
+
return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center gap-1", className), "data-slot": "user-card-preview", children: [
|
|
46
|
+
children,
|
|
47
|
+
showTouchTrigger ? /* @__PURE__ */ jsx(
|
|
48
|
+
"button",
|
|
49
|
+
{
|
|
50
|
+
type: "button",
|
|
51
|
+
"aria-label": triggerLabel ?? label,
|
|
52
|
+
"data-slot": "user-card-preview-trigger",
|
|
53
|
+
onClick: (event) => {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
event.stopPropagation();
|
|
56
|
+
setDialogOpen(true);
|
|
57
|
+
},
|
|
58
|
+
className: "inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground",
|
|
59
|
+
children: /* @__PURE__ */ jsx(Info, { className: "h-3.5 w-3.5", "aria-hidden": "true" })
|
|
60
|
+
}
|
|
61
|
+
) : null,
|
|
62
|
+
/* @__PURE__ */ jsx(Dialog, { open: dialogOpen, onOpenChange: setDialogOpen, children: /* @__PURE__ */ jsxs(
|
|
63
|
+
DialogContent,
|
|
64
|
+
{
|
|
65
|
+
"aria-describedby": void 0,
|
|
66
|
+
className: cn(
|
|
67
|
+
BARE_SURFACE,
|
|
68
|
+
"w-[272px] max-w-none gap-0 [&>button]:right-2 [&>button]:top-2 [&>button]:z-20 [&>button]:rounded-full [&>button]:bg-background/85 [&>button]:p-1 [&>button]:opacity-100 [&>button]:shadow-sm [&>button]:backdrop-blur-sm",
|
|
69
|
+
contentClassName
|
|
70
|
+
),
|
|
71
|
+
onClick: (event) => event.stopPropagation(),
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "sr-only", children: label }),
|
|
74
|
+
resolve(dialogOpen)
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
) })
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
return (
|
|
81
|
+
// The marker sits on an OUTER element, not on the trigger's child: `asChild` merges the
|
|
82
|
+
// primitive's own props onto whatever it is given, and its `data-slot` wins — a marker put
|
|
83
|
+
// there silently disappears.
|
|
84
|
+
/* @__PURE__ */ jsx("span", { className: cn("inline-flex", className), "data-slot": "user-card-preview", children: /* @__PURE__ */ jsxs(HoverCard, { open, onOpenChange: setOpen, openDelay, closeDelay, children: [
|
|
85
|
+
/* @__PURE__ */ jsx(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "inline-flex min-w-0", children }) }),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
HoverCardContent,
|
|
88
|
+
{
|
|
89
|
+
align: "start",
|
|
90
|
+
sideOffset: 8,
|
|
91
|
+
className: cn(BARE_SURFACE, contentClassName),
|
|
92
|
+
style: { width: CARD_WIDTH, maxWidth: CARD_WIDTH },
|
|
93
|
+
children: resolve(open)
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] }) })
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export {
|
|
101
|
+
UserCardPreview
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=chunk-ROQ3JZ2J.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/user-card/user-card-preview.tsx"],"sourcesContent":["\"use client\"\n\n/**\n * UserCardPreview — one way to ask \"who is that?\", spelled correctly for the pointer you have.\n *\n * Where hovering works, the card floats beside the trigger after a short delay. Where it does not\n * (touch), hover would be dead, so an inline info button opens the same card in a dialog. Both\n * routes render the SAME node — a person must not look different on a phone than on a laptop.\n *\n * `card` may be a function so the consumer can defer fetching until the card is actually asked\n * for: a roster of four people should cost four requests only if all four are looked at.\n */\n\nimport * as React from \"react\"\nimport { Info } from \"lucide-react\"\n\nimport { Dialog, DialogContent, DialogTitle } from \"../dialog\"\nimport { HoverCard, HoverCardContent, HoverCardTrigger } from \"../hover-card\"\nimport { useCanHover } from \"../use-can-hover\"\nimport { cn } from \"../utils\"\n\nexport interface UserCardPreviewProps {\n /** The thing you hover or stand the info button next to — usually the person's name. */\n children: React.ReactNode\n /** The card. As a function it receives whether the preview is open, for lazy fetching. */\n card: React.ReactNode | ((open: boolean) => React.ReactNode)\n /** The person's name. Titles the dialog, and names the trigger when `triggerLabel` is absent. */\n label: string\n /**\n * Accessible name for the touch trigger. A button announced as just \"Alice, button\" does not\n * say what pressing it DOES — pass something like \"Preview Alice\", localised by the consumer\n * (the library holds no copy of its own).\n */\n triggerLabel?: string\n /** Render the inline info button on touch devices. */\n showTouchTrigger?: boolean\n /** Skip the preview entirely and render the trigger alone. */\n disabled?: boolean\n openDelay?: number\n closeDelay?: number\n /**\n * Class for the portalled surface (hover content and dialog alike). Apps that portal into their\n * own theme need this — without it a portalled card resolves its tokens against the host\n * document and can come out unreadable.\n */\n contentClassName?: string\n className?: string\n}\n\nconst OPEN_DELAY_MS = 200\nconst CLOSE_DELAY_MS = 120\nconst CARD_WIDTH = 272\n\n/** The card surface is drawn by UserCard itself, so the container adds nothing of its own. */\nconst BARE_SURFACE = \"overflow-hidden rounded-none border-0 bg-transparent p-0 shadow-none\"\n\nexport function UserCardPreview({\n children,\n card,\n label,\n triggerLabel,\n showTouchTrigger = true,\n disabled = false,\n openDelay = OPEN_DELAY_MS,\n closeDelay = CLOSE_DELAY_MS,\n contentClassName,\n className,\n}: UserCardPreviewProps) {\n const canHover = useCanHover()\n const [open, setOpen] = React.useState(false)\n const [dialogOpen, setDialogOpen] = React.useState(false)\n\n const resolve = (isOpen: boolean) => (typeof card === \"function\" ? card(isOpen) : card)\n\n if (disabled) return <>{children}</>\n\n if (!canHover) {\n return (\n <span className={cn(\"inline-flex items-center gap-1\", className)} data-slot=\"user-card-preview\">\n {children}\n {showTouchTrigger ? (\n <button\n type=\"button\"\n aria-label={triggerLabel ?? label}\n data-slot=\"user-card-preview-trigger\"\n onClick={(event) => {\n // The trigger commonly sits inside a link or a row that has its own press\n // behaviour; asking about someone must not also navigate.\n event.preventDefault()\n event.stopPropagation()\n setDialogOpen(true)\n }}\n className=\"inline-flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground\"\n >\n <Info className=\"h-3.5 w-3.5\" aria-hidden=\"true\" />\n </button>\n ) : null}\n\n <Dialog open={dialogOpen} onOpenChange={setDialogOpen}>\n <DialogContent\n aria-describedby={undefined}\n className={cn(\n BARE_SURFACE,\n \"w-[272px] max-w-none gap-0 [&>button]:right-2 [&>button]:top-2 [&>button]:z-20 [&>button]:rounded-full [&>button]:bg-background/85 [&>button]:p-1 [&>button]:opacity-100 [&>button]:shadow-sm [&>button]:backdrop-blur-sm\",\n contentClassName\n )}\n onClick={(event) => event.stopPropagation()}\n >\n <DialogTitle className=\"sr-only\">{label}</DialogTitle>\n {resolve(dialogOpen)}\n </DialogContent>\n </Dialog>\n </span>\n )\n }\n\n return (\n // The marker sits on an OUTER element, not on the trigger's child: `asChild` merges the\n // primitive's own props onto whatever it is given, and its `data-slot` wins — a marker put\n // there silently disappears.\n <span className={cn(\"inline-flex\", className)} data-slot=\"user-card-preview\">\n <HoverCard open={open} onOpenChange={setOpen} openDelay={openDelay} closeDelay={closeDelay}>\n <HoverCardTrigger asChild>\n <span className=\"inline-flex min-w-0\">{children}</span>\n </HoverCardTrigger>\n <HoverCardContent\n align=\"start\"\n sideOffset={8}\n className={cn(BARE_SURFACE, contentClassName)}\n style={{ width: CARD_WIDTH, maxWidth: CARD_WIDTH }}\n >\n {resolve(open)}\n </HoverCardContent>\n </HoverCard>\n </span>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,YAAY,WAAW;AACvB,SAAS,YAAY;AA4DE,wBAyBb,YAzBa;AAzBvB,IAAM,gBAAgB;AACtB,IAAM,iBAAiB;AACvB,IAAM,aAAa;AAGnB,IAAM,eAAe;AAEd,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,WAAW,YAAY;AAC7B,QAAM,CAAC,MAAM,OAAO,IAAU,eAAS,KAAK;AAC5C,QAAM,CAAC,YAAY,aAAa,IAAU,eAAS,KAAK;AAExD,QAAM,UAAU,CAAC,WA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