@thestatic-tv/dcl-sdk 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +26 -6
- package/dist/index.mjs +26 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -816,6 +816,13 @@ declare class ChatUIModule {
|
|
|
816
816
|
private formatTime;
|
|
817
817
|
/** Scale a dimension by shared uiScale */
|
|
818
818
|
private s;
|
|
819
|
+
/**
|
|
820
|
+
* The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
|
|
821
|
+
* tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
|
|
822
|
+
* generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
|
|
823
|
+
* top and bottom.
|
|
824
|
+
*/
|
|
825
|
+
private messageTextRoom;
|
|
819
826
|
/**
|
|
820
827
|
* Get the chat UI component for rendering
|
|
821
828
|
* Always renders toggle button, plus panel when visible
|
package/dist/index.d.ts
CHANGED
|
@@ -816,6 +816,13 @@ declare class ChatUIModule {
|
|
|
816
816
|
private formatTime;
|
|
817
817
|
/** Scale a dimension by shared uiScale */
|
|
818
818
|
private s;
|
|
819
|
+
/**
|
|
820
|
+
* The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
|
|
821
|
+
* tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
|
|
822
|
+
* generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
|
|
823
|
+
* top and bottom.
|
|
824
|
+
*/
|
|
825
|
+
private messageTextRoom;
|
|
819
826
|
/**
|
|
820
827
|
* Get the chat UI component for rendering
|
|
821
828
|
* Always renders toggle button, plus panel when visible
|
package/dist/index.js
CHANGED
|
@@ -1641,6 +1641,7 @@ var GuideUIModule = class {
|
|
|
1641
1641
|
renderAgeChoice(video) {
|
|
1642
1642
|
const buttonW = this.s(170);
|
|
1643
1643
|
const buttonH = this.s(44);
|
|
1644
|
+
const bodyH = this.s(UI_DIMENSIONS.guide.content.bodySize * 1.5 * 2);
|
|
1644
1645
|
return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
|
|
1645
1646
|
key: "age-choice",
|
|
1646
1647
|
uiTransform: {
|
|
@@ -1675,7 +1676,7 @@ var GuideUIModule = class {
|
|
|
1675
1676
|
uiText: { value: truncateText(video.name || "Unknown", 40), fontSize: this.s(16), color: THEME.colors.cyan }
|
|
1676
1677
|
}),
|
|
1677
1678
|
import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
|
|
1678
|
-
uiTransform: { width: "100%", marginBottom: this.s(20) },
|
|
1679
|
+
uiTransform: { width: "100%", minHeight: bodyH, marginBottom: this.s(20) },
|
|
1679
1680
|
uiText: {
|
|
1680
1681
|
value: "This channel is for viewers aged 18 and older. Are you 18 or older?",
|
|
1681
1682
|
fontSize: this.s(UI_DIMENSIONS.guide.content.bodySize),
|
|
@@ -1780,6 +1781,7 @@ var import_players = require("@dcl/sdk/players");
|
|
|
1780
1781
|
var import_RestrictedActions2 = require("~system/RestrictedActions");
|
|
1781
1782
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
1782
1783
|
var POLL_INTERVAL_PASSIVE = 3e4;
|
|
1784
|
+
var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
|
|
1783
1785
|
var ChatUIModule = class {
|
|
1784
1786
|
constructor(client, config = {}) {
|
|
1785
1787
|
// Visibility state
|
|
@@ -2153,6 +2155,17 @@ var ChatUIModule = class {
|
|
|
2153
2155
|
s(value) {
|
|
2154
2156
|
return Math.round(value * this.client.uiScale);
|
|
2155
2157
|
}
|
|
2158
|
+
/**
|
|
2159
|
+
* The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
|
|
2160
|
+
* tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
|
|
2161
|
+
* generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
|
|
2162
|
+
* top and bottom.
|
|
2163
|
+
*/
|
|
2164
|
+
messageTextRoom(text, fontSize) {
|
|
2165
|
+
const column = this.s(UI_DIMENSIONS.chat.width) - MESSAGE_TEXT_INSET;
|
|
2166
|
+
const lines = Math.max(1, Math.ceil(text.length * 0.6 * fontSize / column));
|
|
2167
|
+
return Math.ceil(lines * fontSize * 1.5) + 8;
|
|
2168
|
+
}
|
|
2156
2169
|
getPositionStyle() {
|
|
2157
2170
|
return { bottom: 55, right: 20 };
|
|
2158
2171
|
}
|
|
@@ -2211,11 +2224,17 @@ var ChatUIModule = class {
|
|
|
2211
2224
|
return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2212
2225
|
uiTransform: { flexGrow: 1, width: "100%", flexDirection: "row", overflow: "hidden" },
|
|
2213
2226
|
children: [
|
|
2214
|
-
// Messages
|
|
2227
|
+
// Messages - anchored at the bottom, so the newest stays in view now that a row grows with its text
|
|
2228
|
+
// (2026-10-20): a page taller than the column clipped its newest row, and offset 0 cannot scroll
|
|
2229
|
+
// past it; now its oldest clips at the top, one scroll up away. The rows keep their height
|
|
2230
|
+
// (flexShrink 0 - the protocol's default of 1 squeezes them onto each other) in one column
|
|
2231
|
+
// (nowrap - the protocol documents wrap as its default).
|
|
2215
2232
|
import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2216
2233
|
uiTransform: {
|
|
2217
2234
|
flexGrow: 1,
|
|
2218
2235
|
flexDirection: "column",
|
|
2236
|
+
justifyContent: "flex-end",
|
|
2237
|
+
flexWrap: "nowrap",
|
|
2219
2238
|
padding: { left: 12, right: 8, top: 8, bottom: 8 },
|
|
2220
2239
|
overflow: "hidden"
|
|
2221
2240
|
},
|
|
@@ -2278,7 +2297,7 @@ var ChatUIModule = class {
|
|
|
2278
2297
|
renderSystemMessage(msg, theme) {
|
|
2279
2298
|
return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2280
2299
|
key: msg.id,
|
|
2281
|
-
uiTransform: { width: "100%", height: 24, marginBottom: 4 },
|
|
2300
|
+
uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
|
|
2282
2301
|
uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
|
|
2283
2302
|
});
|
|
2284
2303
|
}
|
|
@@ -2290,9 +2309,10 @@ var ChatUIModule = class {
|
|
|
2290
2309
|
let accentColor = THEME.colors.cyan;
|
|
2291
2310
|
if (displayName.toLowerCase().includes("admin")) accentColor = THEME.colors.magenta;
|
|
2292
2311
|
else if (isCurrentUser) accentColor = THEME.colors.green;
|
|
2312
|
+
const textRoom = this.messageTextRoom(msg.text, theme.chatMessage);
|
|
2293
2313
|
return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2294
2314
|
key: msg.id,
|
|
2295
|
-
uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16 },
|
|
2315
|
+
uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16, flexShrink: 0 },
|
|
2296
2316
|
children: [
|
|
2297
2317
|
// Header row
|
|
2298
2318
|
import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
@@ -2318,11 +2338,11 @@ var ChatUIModule = class {
|
|
|
2318
2338
|
uiTransform: { width: "100%", flexDirection: "row", alignItems: "stretch", paddingLeft: 8 },
|
|
2319
2339
|
children: [
|
|
2320
2340
|
import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2321
|
-
uiTransform: { width: 3, minHeight:
|
|
2341
|
+
uiTransform: { width: 3, minHeight: textRoom },
|
|
2322
2342
|
uiBackground: { color: accentColor }
|
|
2323
2343
|
}),
|
|
2324
2344
|
import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
2325
|
-
uiTransform: { flexGrow: 1, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
|
|
2345
|
+
uiTransform: { flexGrow: 1, minHeight: textRoom, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
|
|
2326
2346
|
uiText: {
|
|
2327
2347
|
value: msg.text,
|
|
2328
2348
|
fontSize: theme.chatMessage,
|
package/dist/index.mjs
CHANGED
|
@@ -1593,6 +1593,7 @@ var GuideUIModule = class {
|
|
|
1593
1593
|
renderAgeChoice(video) {
|
|
1594
1594
|
const buttonW = this.s(170);
|
|
1595
1595
|
const buttonH = this.s(44);
|
|
1596
|
+
const bodyH = this.s(UI_DIMENSIONS.guide.content.bodySize * 1.5 * 2);
|
|
1596
1597
|
return ReactEcs2.createElement(UiEntity2, {
|
|
1597
1598
|
key: "age-choice",
|
|
1598
1599
|
uiTransform: {
|
|
@@ -1627,7 +1628,7 @@ var GuideUIModule = class {
|
|
|
1627
1628
|
uiText: { value: truncateText(video.name || "Unknown", 40), fontSize: this.s(16), color: THEME.colors.cyan }
|
|
1628
1629
|
}),
|
|
1629
1630
|
ReactEcs2.createElement(UiEntity2, {
|
|
1630
|
-
uiTransform: { width: "100%", marginBottom: this.s(20) },
|
|
1631
|
+
uiTransform: { width: "100%", minHeight: bodyH, marginBottom: this.s(20) },
|
|
1631
1632
|
uiText: {
|
|
1632
1633
|
value: "This channel is for viewers aged 18 and older. Are you 18 or older?",
|
|
1633
1634
|
fontSize: this.s(UI_DIMENSIONS.guide.content.bodySize),
|
|
@@ -1732,6 +1733,7 @@ import { getPlayer } from "@dcl/sdk/players";
|
|
|
1732
1733
|
import { openExternalUrl as openExternalUrl2 } from "~system/RestrictedActions";
|
|
1733
1734
|
var POLL_INTERVAL_ACTIVE = 5e3;
|
|
1734
1735
|
var POLL_INTERVAL_PASSIVE = 3e4;
|
|
1736
|
+
var MESSAGE_TEXT_INSET = 2 * 2 + 28 + 12 + 8 + 8 + 3 + 12;
|
|
1735
1737
|
var ChatUIModule = class {
|
|
1736
1738
|
constructor(client, config = {}) {
|
|
1737
1739
|
// Visibility state
|
|
@@ -2105,6 +2107,17 @@ var ChatUIModule = class {
|
|
|
2105
2107
|
s(value) {
|
|
2106
2108
|
return Math.round(value * this.client.uiScale);
|
|
2107
2109
|
}
|
|
2110
|
+
/**
|
|
2111
|
+
* The height a message's text needs (2026-10-20): a wrapped uiText with no height is laid out one line
|
|
2112
|
+
* tall, so a long message drew its other lines over the messages below it. Its lines are estimated at a
|
|
2113
|
+
* generous 0.6em a letter against the column it wraps in, each 1.5x the font size, plus its 4px padding
|
|
2114
|
+
* top and bottom.
|
|
2115
|
+
*/
|
|
2116
|
+
messageTextRoom(text, fontSize) {
|
|
2117
|
+
const column = this.s(UI_DIMENSIONS.chat.width) - MESSAGE_TEXT_INSET;
|
|
2118
|
+
const lines = Math.max(1, Math.ceil(text.length * 0.6 * fontSize / column));
|
|
2119
|
+
return Math.ceil(lines * fontSize * 1.5) + 8;
|
|
2120
|
+
}
|
|
2108
2121
|
getPositionStyle() {
|
|
2109
2122
|
return { bottom: 55, right: 20 };
|
|
2110
2123
|
}
|
|
@@ -2163,11 +2176,17 @@ var ChatUIModule = class {
|
|
|
2163
2176
|
return ReactEcs3.createElement(UiEntity3, {
|
|
2164
2177
|
uiTransform: { flexGrow: 1, width: "100%", flexDirection: "row", overflow: "hidden" },
|
|
2165
2178
|
children: [
|
|
2166
|
-
// Messages
|
|
2179
|
+
// Messages - anchored at the bottom, so the newest stays in view now that a row grows with its text
|
|
2180
|
+
// (2026-10-20): a page taller than the column clipped its newest row, and offset 0 cannot scroll
|
|
2181
|
+
// past it; now its oldest clips at the top, one scroll up away. The rows keep their height
|
|
2182
|
+
// (flexShrink 0 - the protocol's default of 1 squeezes them onto each other) in one column
|
|
2183
|
+
// (nowrap - the protocol documents wrap as its default).
|
|
2167
2184
|
ReactEcs3.createElement(UiEntity3, {
|
|
2168
2185
|
uiTransform: {
|
|
2169
2186
|
flexGrow: 1,
|
|
2170
2187
|
flexDirection: "column",
|
|
2188
|
+
justifyContent: "flex-end",
|
|
2189
|
+
flexWrap: "nowrap",
|
|
2171
2190
|
padding: { left: 12, right: 8, top: 8, bottom: 8 },
|
|
2172
2191
|
overflow: "hidden"
|
|
2173
2192
|
},
|
|
@@ -2230,7 +2249,7 @@ var ChatUIModule = class {
|
|
|
2230
2249
|
renderSystemMessage(msg, theme) {
|
|
2231
2250
|
return ReactEcs3.createElement(UiEntity3, {
|
|
2232
2251
|
key: msg.id,
|
|
2233
|
-
uiTransform: { width: "100%", height: 24, marginBottom: 4 },
|
|
2252
|
+
uiTransform: { width: "100%", height: 24, marginBottom: 4, flexShrink: 0 },
|
|
2234
2253
|
uiText: { value: msg.text, fontSize: theme.systemMessage, color: THEME.colors.green, textAlign: "middle-left" }
|
|
2235
2254
|
});
|
|
2236
2255
|
}
|
|
@@ -2242,9 +2261,10 @@ var ChatUIModule = class {
|
|
|
2242
2261
|
let accentColor = THEME.colors.cyan;
|
|
2243
2262
|
if (displayName.toLowerCase().includes("admin")) accentColor = THEME.colors.magenta;
|
|
2244
2263
|
else if (isCurrentUser) accentColor = THEME.colors.green;
|
|
2264
|
+
const textRoom = this.messageTextRoom(msg.text, theme.chatMessage);
|
|
2245
2265
|
return ReactEcs3.createElement(UiEntity3, {
|
|
2246
2266
|
key: msg.id,
|
|
2247
|
-
uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16 },
|
|
2267
|
+
uiTransform: { width: "100%", flexDirection: "column", marginBottom: 16, flexShrink: 0 },
|
|
2248
2268
|
children: [
|
|
2249
2269
|
// Header row
|
|
2250
2270
|
ReactEcs3.createElement(UiEntity3, {
|
|
@@ -2270,11 +2290,11 @@ var ChatUIModule = class {
|
|
|
2270
2290
|
uiTransform: { width: "100%", flexDirection: "row", alignItems: "stretch", paddingLeft: 8 },
|
|
2271
2291
|
children: [
|
|
2272
2292
|
ReactEcs3.createElement(UiEntity3, {
|
|
2273
|
-
uiTransform: { width: 3, minHeight:
|
|
2293
|
+
uiTransform: { width: 3, minHeight: textRoom },
|
|
2274
2294
|
uiBackground: { color: accentColor }
|
|
2275
2295
|
}),
|
|
2276
2296
|
ReactEcs3.createElement(UiEntity3, {
|
|
2277
|
-
uiTransform: { flexGrow: 1, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
|
|
2297
|
+
uiTransform: { flexGrow: 1, minHeight: textRoom, paddingLeft: 12, paddingTop: 4, paddingBottom: 4 },
|
|
2278
2298
|
uiText: {
|
|
2279
2299
|
value: msg.text,
|
|
2280
2300
|
fontSize: theme.chatMessage,
|
package/package.json
CHANGED