@thestatic-tv/dcl-sdk 2.14.0 → 2.15.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/README.md +26 -8
- package/dist/index.d.mts +30 -14
- package/dist/index.d.ts +30 -14
- package/dist/index.js +217 -197
- package/dist/index.mjs +217 -197
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,14 +150,32 @@ other, a `coversGuide` panel and those two close each other, and the chat stays
|
|
|
150
150
|
guide or the admin panel. A panel registered without the option is left to the scene there. The
|
|
151
151
|
names `guide`, `chat` and `admin` are the SDK's.
|
|
152
152
|
|
|
153
|
-
**
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
153
|
+
**Circles (2.15.0).** Every toolbar button is a round, see-through circle: a ring in the button's
|
|
154
|
+
own color (the face's `uiBackground` color), a white icon in the middle, its short tag under it,
|
|
155
|
+
and the chat's unread count as a badge. A phone: 72 across, in the column flush on the right
|
|
156
|
+
edge; desktop: 52 across, in the bottom-right row from right 20. A scene's button names its icon
|
|
157
|
+
(`chat`, `guide`, `sparkle`, `radio`, `admin`, or a full https URL) and its tag:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
staticTV.toolbarButton(3, {
|
|
161
|
+
uiBackground: { color: Color4.create(0.55, 0.4, 0.1, 0.95) }, // the ring
|
|
162
|
+
icon: 'sparkle', // from the SDK's site: <base URL's site>/sdk/icons/sparkle.png
|
|
163
|
+
tag: 'MY AI', // stays even if the icon cannot load
|
|
164
|
+
open: aiPanel.isOpen, // fills the circle while its panel is open
|
|
165
|
+
onMouseDown: () => aiPanel.toggle(),
|
|
166
|
+
})
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
A face with no icon still draws, its children inside the circle. On desktop a panel opening
|
|
170
|
+
under the circle row is raised to clear it (`toolbarPanel`).
|
|
171
|
+
|
|
172
|
+
**Fold (2.14.0; one circle since 2.15.0).** A circle with a chevron folds the toolbar: on top of
|
|
173
|
+
the phone's column (pointing right) or at the desktop row's left end (pointing down). Folded, the
|
|
174
|
+
whole toolbar is one circle, on the phone's edge at mid-height (pointing left) or in the
|
|
175
|
+
desktop's bottom-right corner (pointing up); a press brings the buttons back. Folding closes
|
|
176
|
+
every open panel, the scene's registered ones too. It lasts for the visit and starts open. A
|
|
177
|
+
scene's buttons drawn through `toolbarButton` fold with the rest; `staticTV.toolbarCollapsed`
|
|
178
|
+
says which it is.
|
|
161
179
|
|
|
162
180
|
**The version (2.14.0).** The guide shows `TheStatic SDK <version>` small and dim at the bottom
|
|
163
181
|
of its sidebar, so a visitor can name it when asking for help. The build writes it from
|
package/dist/index.d.mts
CHANGED
|
@@ -1487,8 +1487,6 @@ declare class AdminPanelUIModule {
|
|
|
1487
1487
|
* Uses same layout as NotificationBanner but with scaled font size
|
|
1488
1488
|
*/
|
|
1489
1489
|
private renderScaledNotification;
|
|
1490
|
-
/** The ADMIN / CLOSE button itself; its place is the row's or, on a phone, the column's (2.12.0) */
|
|
1491
|
-
private renderToggleFace;
|
|
1492
1490
|
/**
|
|
1493
1491
|
* Get the React-ECS component for the admin panel
|
|
1494
1492
|
* Always renders notification (scaled), admin panel only for admins
|
|
@@ -1533,13 +1531,25 @@ interface PanelOptions {
|
|
|
1533
1531
|
coversGuide?: boolean;
|
|
1534
1532
|
}
|
|
1535
1533
|
|
|
1536
|
-
/** A toolbar button's face
|
|
1534
|
+
/** A toolbar button's face (2.12.0; the circle's own props since 2.15.0) */
|
|
1537
1535
|
interface ToolbarButtonProps {
|
|
1538
|
-
/** Extra layout for
|
|
1536
|
+
/** Extra layout for what shows inside the circle when no icon is given */
|
|
1539
1537
|
uiTransform?: Record<string, unknown>;
|
|
1538
|
+
/** Its color: the circle's ring (2.15.0); before, the brick's fill */
|
|
1540
1539
|
uiBackground?: unknown;
|
|
1541
1540
|
onMouseDown?: () => void;
|
|
1541
|
+
/** Shown inside the circle when no icon is given (a pre-2.15.0 face's label) */
|
|
1542
1542
|
children?: unknown[];
|
|
1543
|
+
/** 2.15.0: the icon, a name on the SDK's icon host (chat, guide, sparkle, radio, admin) or a full https URL */
|
|
1544
|
+
icon?: string;
|
|
1545
|
+
/** 2.15.0: the short name under the circle (CHAT, GUIDE, MY AI...) */
|
|
1546
|
+
tag?: string;
|
|
1547
|
+
/** 2.15.0: the tag's color (white unless given; RADIO's turns green while a station plays) */
|
|
1548
|
+
tagColor?: unknown;
|
|
1549
|
+
/** 2.15.0: a small count on the circle (CHAT's unread messages); nothing when empty or 0 */
|
|
1550
|
+
badge?: string | number;
|
|
1551
|
+
/** 2.15.0: its panel is open - the circle fills with its ring color */
|
|
1552
|
+
open?: boolean;
|
|
1543
1553
|
[prop: string]: unknown;
|
|
1544
1554
|
}
|
|
1545
1555
|
|
|
@@ -2052,30 +2062,36 @@ declare class StaticTVClient {
|
|
|
2052
2062
|
* Draw one of the scene's own toolbar buttons in its slot: the row along the bottom right on desktop (where a scene
|
|
2053
2063
|
* placed its own by hand before), the column on a phone. Slots count from the right (the row) or the top (the
|
|
2054
2064
|
* column): 0 is CHAT's, 1 GUIDE's, 2 ADMIN's (for a non-admin the scene's first button may take it), then the
|
|
2055
|
-
* scene's. `props` is the button's face
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2065
|
+
* scene's. `props` is the button's face. Since 2.15.0 every button is a circle: its uiBackground color is the ring,
|
|
2066
|
+
* `icon` the white icon in the middle (a name on the SDK's icon host - chat, guide, sparkle, radio, admin - or a full
|
|
2067
|
+
* https URL), `tag` the short name under it, `tagColor`, `badge` (a small count) and `open` (its panel is open) are
|
|
2068
|
+
* optional; a face with no icon shows its children inside the circle. Folded (2.14.0), the buttons draw nothing:
|
|
2069
|
+
* the toolbar is one circle (toolbarHandle).
|
|
2058
2070
|
*
|
|
2059
2071
|
* @example
|
|
2060
2072
|
* ```typescript
|
|
2061
2073
|
* staticTV.toolbarButton(3, {
|
|
2062
|
-
* uiTransform: { justifyContent: 'center', alignItems: 'center' },
|
|
2063
2074
|
* uiBackground: { color: Color4.create(0.2, 0.4, 0.2, 0.9) },
|
|
2075
|
+
* icon: 'radio',
|
|
2076
|
+
* tag: 'MAP',
|
|
2077
|
+
* open: myPanel.isOpen,
|
|
2064
2078
|
* onMouseDown: () => myPanel.toggle(),
|
|
2065
|
-
* children: [ReactEcs.createElement(UiEntity, { uiText: { value: 'MAP', fontSize: 14 } })],
|
|
2066
2079
|
* })
|
|
2067
2080
|
* ```
|
|
2068
2081
|
*/
|
|
2069
2082
|
toolbarButton(slot: number, props: ToolbarButtonProps): any;
|
|
2083
|
+
/** The toolbar's last slot: ADMIN's (2) when it is drawn, else GUIDE's (1), or a scene button's past them */
|
|
2084
|
+
private toolbarLastSlot;
|
|
2070
2085
|
/**
|
|
2071
|
-
* The toolbar
|
|
2072
|
-
* closes every open panel, the scene's registered ones too;
|
|
2073
|
-
*
|
|
2086
|
+
* The toolbar folded (2.14.0, his ask: "small tabs out of users way"; one circle since 2.15.0): the fold circle
|
|
2087
|
+
* folds it and closes every open panel, the scene's registered ones too; the one folded circle opens it. For the
|
|
2088
|
+
* visit only; it starts open. A scene drawing its buttons through toolbarButton needs nothing more.
|
|
2074
2089
|
*/
|
|
2075
2090
|
get toolbarCollapsed(): boolean;
|
|
2076
2091
|
/**
|
|
2077
|
-
* The
|
|
2078
|
-
*
|
|
2092
|
+
* The fold circle, drawn by the SDK's chat (2.15.0): open, on top of a phone's column (chevron right) or past the
|
|
2093
|
+
* desktop row's last button (chevron down); folded, the toolbar's one circle, on a phone's edge at mid-height
|
|
2094
|
+
* (chevron left) or in the desktop's bottom-right corner (chevron up). A press folds or opens.
|
|
2079
2095
|
* @internal
|
|
2080
2096
|
*/
|
|
2081
2097
|
toolbarHandle(): any;
|
package/dist/index.d.ts
CHANGED
|
@@ -1487,8 +1487,6 @@ declare class AdminPanelUIModule {
|
|
|
1487
1487
|
* Uses same layout as NotificationBanner but with scaled font size
|
|
1488
1488
|
*/
|
|
1489
1489
|
private renderScaledNotification;
|
|
1490
|
-
/** The ADMIN / CLOSE button itself; its place is the row's or, on a phone, the column's (2.12.0) */
|
|
1491
|
-
private renderToggleFace;
|
|
1492
1490
|
/**
|
|
1493
1491
|
* Get the React-ECS component for the admin panel
|
|
1494
1492
|
* Always renders notification (scaled), admin panel only for admins
|
|
@@ -1533,13 +1531,25 @@ interface PanelOptions {
|
|
|
1533
1531
|
coversGuide?: boolean;
|
|
1534
1532
|
}
|
|
1535
1533
|
|
|
1536
|
-
/** A toolbar button's face
|
|
1534
|
+
/** A toolbar button's face (2.12.0; the circle's own props since 2.15.0) */
|
|
1537
1535
|
interface ToolbarButtonProps {
|
|
1538
|
-
/** Extra layout for
|
|
1536
|
+
/** Extra layout for what shows inside the circle when no icon is given */
|
|
1539
1537
|
uiTransform?: Record<string, unknown>;
|
|
1538
|
+
/** Its color: the circle's ring (2.15.0); before, the brick's fill */
|
|
1540
1539
|
uiBackground?: unknown;
|
|
1541
1540
|
onMouseDown?: () => void;
|
|
1541
|
+
/** Shown inside the circle when no icon is given (a pre-2.15.0 face's label) */
|
|
1542
1542
|
children?: unknown[];
|
|
1543
|
+
/** 2.15.0: the icon, a name on the SDK's icon host (chat, guide, sparkle, radio, admin) or a full https URL */
|
|
1544
|
+
icon?: string;
|
|
1545
|
+
/** 2.15.0: the short name under the circle (CHAT, GUIDE, MY AI...) */
|
|
1546
|
+
tag?: string;
|
|
1547
|
+
/** 2.15.0: the tag's color (white unless given; RADIO's turns green while a station plays) */
|
|
1548
|
+
tagColor?: unknown;
|
|
1549
|
+
/** 2.15.0: a small count on the circle (CHAT's unread messages); nothing when empty or 0 */
|
|
1550
|
+
badge?: string | number;
|
|
1551
|
+
/** 2.15.0: its panel is open - the circle fills with its ring color */
|
|
1552
|
+
open?: boolean;
|
|
1543
1553
|
[prop: string]: unknown;
|
|
1544
1554
|
}
|
|
1545
1555
|
|
|
@@ -2052,30 +2062,36 @@ declare class StaticTVClient {
|
|
|
2052
2062
|
* Draw one of the scene's own toolbar buttons in its slot: the row along the bottom right on desktop (where a scene
|
|
2053
2063
|
* placed its own by hand before), the column on a phone. Slots count from the right (the row) or the top (the
|
|
2054
2064
|
* column): 0 is CHAT's, 1 GUIDE's, 2 ADMIN's (for a non-admin the scene's first button may take it), then the
|
|
2055
|
-
* scene's. `props` is the button's face
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2065
|
+
* scene's. `props` is the button's face. Since 2.15.0 every button is a circle: its uiBackground color is the ring,
|
|
2066
|
+
* `icon` the white icon in the middle (a name on the SDK's icon host - chat, guide, sparkle, radio, admin - or a full
|
|
2067
|
+
* https URL), `tag` the short name under it, `tagColor`, `badge` (a small count) and `open` (its panel is open) are
|
|
2068
|
+
* optional; a face with no icon shows its children inside the circle. Folded (2.14.0), the buttons draw nothing:
|
|
2069
|
+
* the toolbar is one circle (toolbarHandle).
|
|
2058
2070
|
*
|
|
2059
2071
|
* @example
|
|
2060
2072
|
* ```typescript
|
|
2061
2073
|
* staticTV.toolbarButton(3, {
|
|
2062
|
-
* uiTransform: { justifyContent: 'center', alignItems: 'center' },
|
|
2063
2074
|
* uiBackground: { color: Color4.create(0.2, 0.4, 0.2, 0.9) },
|
|
2075
|
+
* icon: 'radio',
|
|
2076
|
+
* tag: 'MAP',
|
|
2077
|
+
* open: myPanel.isOpen,
|
|
2064
2078
|
* onMouseDown: () => myPanel.toggle(),
|
|
2065
|
-
* children: [ReactEcs.createElement(UiEntity, { uiText: { value: 'MAP', fontSize: 14 } })],
|
|
2066
2079
|
* })
|
|
2067
2080
|
* ```
|
|
2068
2081
|
*/
|
|
2069
2082
|
toolbarButton(slot: number, props: ToolbarButtonProps): any;
|
|
2083
|
+
/** The toolbar's last slot: ADMIN's (2) when it is drawn, else GUIDE's (1), or a scene button's past them */
|
|
2084
|
+
private toolbarLastSlot;
|
|
2070
2085
|
/**
|
|
2071
|
-
* The toolbar
|
|
2072
|
-
* closes every open panel, the scene's registered ones too;
|
|
2073
|
-
*
|
|
2086
|
+
* The toolbar folded (2.14.0, his ask: "small tabs out of users way"; one circle since 2.15.0): the fold circle
|
|
2087
|
+
* folds it and closes every open panel, the scene's registered ones too; the one folded circle opens it. For the
|
|
2088
|
+
* visit only; it starts open. A scene drawing its buttons through toolbarButton needs nothing more.
|
|
2074
2089
|
*/
|
|
2075
2090
|
get toolbarCollapsed(): boolean;
|
|
2076
2091
|
/**
|
|
2077
|
-
* The
|
|
2078
|
-
*
|
|
2092
|
+
* The fold circle, drawn by the SDK's chat (2.15.0): open, on top of a phone's column (chevron right) or past the
|
|
2093
|
+
* desktop row's last button (chevron down); folded, the toolbar's one circle, on a phone's edge at mid-height
|
|
2094
|
+
* (chevron left) or in the desktop's bottom-right corner (chevron up). A press folds or opens.
|
|
2079
2095
|
* @internal
|
|
2080
2096
|
*/
|
|
2081
2097
|
toolbarHandle(): any;
|
package/dist/index.js
CHANGED
|
@@ -1567,7 +1567,7 @@ function truncateText(text, maxLength) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
|
|
1569
1569
|
// src/version.ts
|
|
1570
|
-
var SDK_VERSION = true ? "2.
|
|
1570
|
+
var SDK_VERSION = true ? "2.15.0" : "unknown";
|
|
1571
1571
|
|
|
1572
1572
|
// src/ui/guide-ui.tsx
|
|
1573
1573
|
function withLock(mapped, v, fallback) {
|
|
@@ -2348,38 +2348,12 @@ var GuideUIModule = class {
|
|
|
2348
2348
|
});
|
|
2349
2349
|
}
|
|
2350
2350
|
renderToggleButton() {
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
color: THEME.colors.white,
|
|
2358
|
-
textAlign: "middle-center"
|
|
2359
|
-
}
|
|
2360
|
-
});
|
|
2361
|
-
const press = () => this._isVisible ? this.hide() : this.show();
|
|
2362
|
-
if (this.client.isPhone || this.client.toolbarCollapsed) {
|
|
2363
|
-
return this.client.toolbarButton(1, {
|
|
2364
|
-
uiTransform: { justifyContent: "center", alignItems: "center" },
|
|
2365
|
-
uiBackground: { color: buttonColor },
|
|
2366
|
-
onMouseDown: press,
|
|
2367
|
-
children: [label]
|
|
2368
|
-
});
|
|
2369
|
-
}
|
|
2370
|
-
const buttonPos = 20 + this.s(100) + 10;
|
|
2371
|
-
return import_react_ecs2.default.createElement(import_react_ecs2.UiEntity, {
|
|
2372
|
-
uiTransform: {
|
|
2373
|
-
positionType: "absolute",
|
|
2374
|
-
position: { right: buttonPos, bottom: 10 },
|
|
2375
|
-
width: this.s(100),
|
|
2376
|
-
height: this.s(45),
|
|
2377
|
-
justifyContent: "center",
|
|
2378
|
-
alignItems: "center"
|
|
2379
|
-
},
|
|
2380
|
-
uiBackground: { color: buttonColor },
|
|
2381
|
-
onMouseDown: press,
|
|
2382
|
-
children: [label]
|
|
2351
|
+
return this.client.toolbarButton(1, {
|
|
2352
|
+
uiBackground: { color: import_math3.Color4.create(0, 0.5, 0.5, 0.9) },
|
|
2353
|
+
icon: "guide",
|
|
2354
|
+
tag: "GUIDE",
|
|
2355
|
+
open: this._isVisible,
|
|
2356
|
+
onMouseDown: () => this._isVisible ? this.hide() : this.show()
|
|
2383
2357
|
});
|
|
2384
2358
|
}
|
|
2385
2359
|
};
|
|
@@ -3197,38 +3171,13 @@ var ChatUIModule = class {
|
|
|
3197
3171
|
});
|
|
3198
3172
|
}
|
|
3199
3173
|
renderToggleButton() {
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
color: THEME.colors.white,
|
|
3208
|
-
textAlign: "middle-center"
|
|
3209
|
-
}
|
|
3210
|
-
});
|
|
3211
|
-
const press = () => this._isVisible ? this.hide() : this.show();
|
|
3212
|
-
if (this.client.isPhone || this.client.toolbarCollapsed) {
|
|
3213
|
-
return this.client.toolbarButton(0, {
|
|
3214
|
-
uiTransform: { justifyContent: "center", alignItems: "center" },
|
|
3215
|
-
uiBackground: { color: buttonColor },
|
|
3216
|
-
onMouseDown: press,
|
|
3217
|
-
children: [label]
|
|
3218
|
-
});
|
|
3219
|
-
}
|
|
3220
|
-
return import_react_ecs3.default.createElement(import_react_ecs3.UiEntity, {
|
|
3221
|
-
uiTransform: {
|
|
3222
|
-
positionType: "absolute",
|
|
3223
|
-
position: { right: 20, bottom: 10 },
|
|
3224
|
-
width: this.s(100),
|
|
3225
|
-
height: this.s(45),
|
|
3226
|
-
justifyContent: "center",
|
|
3227
|
-
alignItems: "center"
|
|
3228
|
-
},
|
|
3229
|
-
uiBackground: { color: buttonColor },
|
|
3230
|
-
onMouseDown: press,
|
|
3231
|
-
children: [label]
|
|
3174
|
+
return this.client.toolbarButton(0, {
|
|
3175
|
+
uiBackground: { color: import_math4.Color4.create(0.6, 0, 0.5, 0.9) },
|
|
3176
|
+
icon: "chat",
|
|
3177
|
+
tag: "CHAT",
|
|
3178
|
+
badge: this._unreadCount > 0 ? this._unreadCount : void 0,
|
|
3179
|
+
open: this._isVisible,
|
|
3180
|
+
onMouseDown: () => this._isVisible ? this.hide() : this.show()
|
|
3232
3181
|
});
|
|
3233
3182
|
}
|
|
3234
3183
|
};
|
|
@@ -4421,19 +4370,13 @@ var AdminPanelUIModule = class {
|
|
|
4421
4370
|
}
|
|
4422
4371
|
},
|
|
4423
4372
|
this.renderScaledNotification(),
|
|
4424
|
-
this.client.
|
|
4425
|
-
uiBackground: { color:
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
|
|
4432
|
-
positionType: "absolute"
|
|
4433
|
-
}
|
|
4434
|
-
},
|
|
4435
|
-
this.renderToggleFace()
|
|
4436
|
-
),
|
|
4373
|
+
this.client.toolbarButton(2, {
|
|
4374
|
+
uiBackground: { color: C2.header },
|
|
4375
|
+
icon: "admin",
|
|
4376
|
+
tag: "ADMIN",
|
|
4377
|
+
open: this.panelOpen,
|
|
4378
|
+
onMouseDown: () => this.toggle()
|
|
4379
|
+
}),
|
|
4437
4380
|
this.panelOpen && this.client.toolbarPanel({
|
|
4438
4381
|
key: `admin-panel-${this.client.uiScale}`,
|
|
4439
4382
|
uiTransform: {
|
|
@@ -5757,31 +5700,20 @@ var AdminPanelUIModule = class {
|
|
|
5757
5700
|
)
|
|
5758
5701
|
);
|
|
5759
5702
|
}
|
|
5760
|
-
/** The ADMIN / CLOSE button itself; its place is the row's or, on a phone, the column's (2.12.0) */
|
|
5761
|
-
renderToggleFace() {
|
|
5762
|
-
return /* @__PURE__ */ import_react_ecs6.default.createElement(
|
|
5763
|
-
import_react_ecs6.Button,
|
|
5764
|
-
{
|
|
5765
|
-
uiTransform: { width: this.s(100), height: this.s(45) },
|
|
5766
|
-
uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
|
|
5767
|
-
value: this.panelOpen ? "CLOSE" : "ADMIN",
|
|
5768
|
-
fontSize: this.s(14),
|
|
5769
|
-
color: C2.text,
|
|
5770
|
-
onMouseDown: () => this.toggle()
|
|
5771
|
-
}
|
|
5772
|
-
);
|
|
5773
|
-
}
|
|
5774
5703
|
};
|
|
5775
5704
|
|
|
5776
5705
|
// src/StaticTVClient.ts
|
|
5777
5706
|
var import_Runtime2 = require("~system/Runtime");
|
|
5778
5707
|
|
|
5779
5708
|
// src/ui/toolbar.ts
|
|
5780
|
-
var
|
|
5781
|
-
|
|
5709
|
+
var CIRCLE = {
|
|
5710
|
+
phone: { diameter: 72, ring: 4, icon: 36, tagFont: 12, tag: 16, gap: 12, badge: 22 },
|
|
5711
|
+
desktop: { diameter: 52, ring: 3, icon: 26, tagFont: 11, tag: 14, gap: 12, badge: 18 }
|
|
5712
|
+
};
|
|
5782
5713
|
var PHONE_EDGE = 0;
|
|
5783
|
-
var
|
|
5784
|
-
var
|
|
5714
|
+
var DESK_EDGE = 20;
|
|
5715
|
+
var DESK_BOTTOM = 10;
|
|
5716
|
+
var PANEL_GAP = 10;
|
|
5785
5717
|
function platformOf(answer) {
|
|
5786
5718
|
const raw = answer?.platform;
|
|
5787
5719
|
if (typeof raw !== "string") return "unknown";
|
|
@@ -5792,38 +5724,53 @@ function isPhonePlatform(platform) {
|
|
|
5792
5724
|
return platform === "mobile";
|
|
5793
5725
|
}
|
|
5794
5726
|
var scaled = (value, uiScale) => Math.round(value * uiScale);
|
|
5795
|
-
function
|
|
5796
|
-
|
|
5797
|
-
}
|
|
5798
|
-
function columnSlot(slot, uiScale = 1) {
|
|
5799
|
-
const h = scaled(TOOLBAR.buttonHeight, uiScale);
|
|
5800
|
-
const handle = scaled(HANDLE, uiScale) + TOOLBAR.gap;
|
|
5727
|
+
function circleSize(phone, uiScale = 1) {
|
|
5728
|
+
const c = phone ? CIRCLE.phone : CIRCLE.desktop;
|
|
5801
5729
|
return {
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5730
|
+
diameter: scaled(c.diameter, uiScale),
|
|
5731
|
+
ring: Math.max(1, scaled(c.ring, uiScale)),
|
|
5732
|
+
icon: scaled(c.icon, uiScale),
|
|
5733
|
+
tagFont: scaled(c.tagFont, uiScale),
|
|
5734
|
+
tag: scaled(c.tag, uiScale),
|
|
5735
|
+
gap: c.gap,
|
|
5736
|
+
badge: scaled(c.badge, uiScale)
|
|
5805
5737
|
};
|
|
5806
5738
|
}
|
|
5739
|
+
function rowRight(slot, uiScale = 1) {
|
|
5740
|
+
const c = circleSize(false, uiScale);
|
|
5741
|
+
return DESK_EDGE + slot * (c.diameter + c.gap);
|
|
5742
|
+
}
|
|
5743
|
+
function columnSlot(slot, lastSlot, uiScale = 1) {
|
|
5744
|
+
const c = circleSize(true, uiScale);
|
|
5745
|
+
const step = c.diameter + c.tag + c.gap;
|
|
5746
|
+
const rows = Math.max(lastSlot, slot, 0) + 2;
|
|
5747
|
+
return { right: PHONE_EDGE, width: c.diameter, boxHeight: rows * step - c.gap, above: (Math.max(0, slot) + 1) * step };
|
|
5748
|
+
}
|
|
5807
5749
|
function handlePlace(phone, lastSlot, uiScale = 1) {
|
|
5750
|
+
const c = circleSize(phone, uiScale);
|
|
5808
5751
|
if (phone) {
|
|
5809
|
-
return {
|
|
5810
|
-
right: PHONE_EDGE,
|
|
5811
|
-
width: scaled(TOOLBAR.buttonWidth, uiScale),
|
|
5812
|
-
height: scaled(HANDLE, uiScale),
|
|
5813
|
-
boxHeight: columnSlot(0, uiScale).boxHeight,
|
|
5814
|
-
above: 0
|
|
5815
|
-
};
|
|
5752
|
+
return { right: PHONE_EDGE, width: c.diameter, height: c.diameter, boxHeight: columnSlot(0, lastSlot, uiScale).boxHeight, above: 0 };
|
|
5816
5753
|
}
|
|
5817
|
-
return {
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
};
|
|
5754
|
+
return { right: rowRight(Math.max(0, lastSlot) + 1, uiScale), bottom: DESK_BOTTOM, width: c.diameter, height: c.diameter + c.tag };
|
|
5755
|
+
}
|
|
5756
|
+
function foldedPlace(phone, uiScale = 1) {
|
|
5757
|
+
const c = circleSize(phone, uiScale);
|
|
5758
|
+
if (phone) return { right: PHONE_EDGE, width: c.diameter, height: c.diameter };
|
|
5759
|
+
return { right: DESK_EDGE, bottom: DESK_BOTTOM, width: c.diameter, height: c.diameter + c.tag };
|
|
5760
|
+
}
|
|
5761
|
+
function chevronOf(phone, collapsed) {
|
|
5762
|
+
if (phone) return collapsed ? "chevron-left" : "chevron-right";
|
|
5763
|
+
return collapsed ? "chevron-up" : "chevron-down";
|
|
5764
|
+
}
|
|
5765
|
+
function deskPanelBottom(uiScale = 1) {
|
|
5766
|
+
const c = circleSize(false, uiScale);
|
|
5767
|
+
return DESK_BOTTOM + c.diameter + c.tag + PANEL_GAP;
|
|
5823
5768
|
}
|
|
5824
|
-
function
|
|
5825
|
-
if (
|
|
5826
|
-
|
|
5769
|
+
function iconUrl(icon, baseUrl) {
|
|
5770
|
+
if (icon.includes("://")) return icon;
|
|
5771
|
+
const at = baseUrl.indexOf("/api/");
|
|
5772
|
+
const site = (at > 0 ? baseUrl.slice(0, at) : baseUrl).replace(/\/+$/, "");
|
|
5773
|
+
return `${site}/sdk/icons/${icon}.png`;
|
|
5827
5774
|
}
|
|
5828
5775
|
var ToolbarFold = class {
|
|
5829
5776
|
constructor(closeAll) {
|
|
@@ -5852,7 +5799,7 @@ var ToolbarFold = class {
|
|
|
5852
5799
|
}
|
|
5853
5800
|
};
|
|
5854
5801
|
function panelRight(phone, desktopRight, uiScale = 1) {
|
|
5855
|
-
return phone ? PHONE_EDGE +
|
|
5802
|
+
return phone ? PHONE_EDGE + circleSize(true, uiScale).diameter + PANEL_GAP : desktopRight;
|
|
5856
5803
|
}
|
|
5857
5804
|
var DESKTOP_CLOSES = { guide: ["admin"], admin: ["guide"] };
|
|
5858
5805
|
var GUIDE_PLACE = ["guide", "admin"];
|
|
@@ -5900,6 +5847,73 @@ var PanelRules = class {
|
|
|
5900
5847
|
|
|
5901
5848
|
// src/ui/toolbar-button.ts
|
|
5902
5849
|
var import_react_ecs7 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
5850
|
+
var import_math8 = require("@dcl/sdk/math");
|
|
5851
|
+
var GLASS = import_math8.Color4.create(18 / 255, 20 / 255, 34 / 255, 0.55);
|
|
5852
|
+
var FOLD_RING = import_math8.Color4.create(1, 1, 1, 0.45);
|
|
5853
|
+
var BADGE = import_math8.Color4.create(0.86, 0.15, 0.2, 1);
|
|
5854
|
+
var WHITE = import_math8.Color4.create(1, 1, 1, 1);
|
|
5855
|
+
function circleUnit(phone, uiScale, spec, place) {
|
|
5856
|
+
const c = circleSize(phone, uiScale);
|
|
5857
|
+
const inner = [];
|
|
5858
|
+
if (spec.icon) {
|
|
5859
|
+
inner.push(import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5860
|
+
uiTransform: { width: c.icon, height: c.icon },
|
|
5861
|
+
uiBackground: { texture: { src: spec.icon, filterMode: "bi-linear" }, textureMode: "stretch" }
|
|
5862
|
+
}));
|
|
5863
|
+
} else if (spec.content) {
|
|
5864
|
+
inner.push(...spec.content);
|
|
5865
|
+
}
|
|
5866
|
+
const badgeText = spec.badge === void 0 || spec.badge === null || spec.badge === 0 || spec.badge === "" ? null : String(spec.badge);
|
|
5867
|
+
if (badgeText) {
|
|
5868
|
+
inner.push(import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5869
|
+
uiTransform: {
|
|
5870
|
+
positionType: "absolute",
|
|
5871
|
+
position: { top: 0, right: 0 },
|
|
5872
|
+
width: c.badge,
|
|
5873
|
+
height: c.badge,
|
|
5874
|
+
borderRadius: c.badge / 2,
|
|
5875
|
+
justifyContent: "center",
|
|
5876
|
+
alignItems: "center"
|
|
5877
|
+
},
|
|
5878
|
+
uiBackground: { color: BADGE },
|
|
5879
|
+
uiText: { value: badgeText, fontSize: Math.round(c.badge * 0.6), color: WHITE, textAlign: "middle-center" }
|
|
5880
|
+
}));
|
|
5881
|
+
}
|
|
5882
|
+
const circle = import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5883
|
+
uiTransform: {
|
|
5884
|
+
width: c.diameter,
|
|
5885
|
+
height: c.diameter,
|
|
5886
|
+
flexShrink: 0,
|
|
5887
|
+
borderRadius: c.diameter / 2,
|
|
5888
|
+
borderWidth: c.ring,
|
|
5889
|
+
borderColor: spec.ring,
|
|
5890
|
+
justifyContent: "center",
|
|
5891
|
+
alignItems: "center",
|
|
5892
|
+
...spec.contentLayout || {}
|
|
5893
|
+
},
|
|
5894
|
+
uiBackground: { color: spec.fill },
|
|
5895
|
+
children: inner
|
|
5896
|
+
});
|
|
5897
|
+
const children = [circle];
|
|
5898
|
+
if (spec.tagRow) {
|
|
5899
|
+
children.push(import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5900
|
+
uiTransform: { width: c.diameter, height: c.tag, flexShrink: 0 },
|
|
5901
|
+
uiText: spec.tag ? { value: spec.tag, fontSize: c.tagFont, color: spec.tagColor ?? WHITE, textAlign: "middle-center" } : void 0
|
|
5902
|
+
}));
|
|
5903
|
+
}
|
|
5904
|
+
return import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5905
|
+
uiTransform: {
|
|
5906
|
+
...place,
|
|
5907
|
+
width: c.diameter,
|
|
5908
|
+
height: c.diameter + (spec.tagRow ? c.tag : 0),
|
|
5909
|
+
flexDirection: "column",
|
|
5910
|
+
alignItems: "center",
|
|
5911
|
+
flexShrink: 0
|
|
5912
|
+
},
|
|
5913
|
+
onMouseDown: spec.onMouseDown,
|
|
5914
|
+
children
|
|
5915
|
+
});
|
|
5916
|
+
}
|
|
5903
5917
|
function inColumn(width, boxHeight, above, right, entity) {
|
|
5904
5918
|
return import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5905
5919
|
uiTransform: {
|
|
@@ -5921,81 +5935,78 @@ function inColumn(width, boxHeight, above, right, entity) {
|
|
|
5921
5935
|
]
|
|
5922
5936
|
});
|
|
5923
5937
|
}
|
|
5924
|
-
function
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5938
|
+
function ringOf(props) {
|
|
5939
|
+
return props.uiBackground?.color ?? WHITE;
|
|
5940
|
+
}
|
|
5941
|
+
function toolbarButton(slot, props, phone, uiScale = 1, fold = { collapsed: false, expand: () => {
|
|
5942
|
+
}, lastSlot: slot }, baseUrl = "https://thestatic.tv/api/v1/dcl") {
|
|
5943
|
+
if (fold.collapsed) return null;
|
|
5944
|
+
const ring = ringOf(props);
|
|
5945
|
+
const r = ring;
|
|
5946
|
+
const spec = {
|
|
5947
|
+
ring,
|
|
5948
|
+
fill: props.open === true && typeof r.r === "number" ? import_math8.Color4.create(r.r, r.g ?? 0, r.b ?? 0, 0.55) : GLASS,
|
|
5949
|
+
icon: props.icon ? iconUrl(props.icon, baseUrl) : void 0,
|
|
5950
|
+
content: props.icon ? void 0 : props.children,
|
|
5951
|
+
contentLayout: props.icon ? void 0 : props.uiTransform,
|
|
5952
|
+
tag: props.tag,
|
|
5953
|
+
tagColor: props.tagColor,
|
|
5954
|
+
badge: props.badge,
|
|
5955
|
+
tagRow: true,
|
|
5956
|
+
onMouseDown: props.onMouseDown
|
|
5957
|
+
};
|
|
5958
|
+
if (!phone) {
|
|
5959
|
+
return circleUnit(false, uiScale, spec, { positionType: "absolute", position: { right: rowRight(slot, uiScale), bottom: DESK_BOTTOM } });
|
|
5960
|
+
}
|
|
5961
|
+
const place = columnSlot(slot, fold.lastSlot, uiScale);
|
|
5962
|
+
return inColumn(place.width, place.boxHeight, place.above, place.right, circleUnit(true, uiScale, spec, {}));
|
|
5963
|
+
}
|
|
5964
|
+
function toolbarHandle(phone, lastSlot, collapsed, toggle, uiScale = 1, baseUrl = "https://thestatic.tv/api/v1/dcl") {
|
|
5965
|
+
const spec = {
|
|
5966
|
+
ring: FOLD_RING,
|
|
5967
|
+
fill: GLASS,
|
|
5968
|
+
icon: iconUrl(chevronOf(phone, collapsed), baseUrl),
|
|
5969
|
+
tagRow: !phone,
|
|
5970
|
+
onMouseDown: toggle
|
|
5971
|
+
};
|
|
5972
|
+
if (collapsed) {
|
|
5973
|
+
const place2 = foldedPlace(phone, uiScale);
|
|
5930
5974
|
if (!phone) {
|
|
5931
|
-
return
|
|
5932
|
-
...face,
|
|
5933
|
-
uiTransform: {
|
|
5934
|
-
positionType: "absolute",
|
|
5935
|
-
position: { right: strip.right, bottom: strip.bottom },
|
|
5936
|
-
width: strip.width,
|
|
5937
|
-
height: strip.height
|
|
5938
|
-
}
|
|
5939
|
-
});
|
|
5975
|
+
return circleUnit(false, uiScale, spec, { positionType: "absolute", position: { right: place2.right, bottom: place2.bottom } });
|
|
5940
5976
|
}
|
|
5941
|
-
const place2 = columnSlot(slot, uiScale);
|
|
5942
|
-
return inColumn(strip.width, place2.boxHeight, place2.above, strip.right, import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5943
|
-
...face,
|
|
5944
|
-
uiTransform: { width: strip.width, height: strip.height, flexShrink: 0 }
|
|
5945
|
-
}));
|
|
5946
|
-
}
|
|
5947
|
-
if (!phone) {
|
|
5948
5977
|
return import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5949
|
-
...props,
|
|
5950
5978
|
uiTransform: {
|
|
5951
5979
|
positionType: "absolute",
|
|
5952
|
-
position: { right:
|
|
5953
|
-
width,
|
|
5954
|
-
height,
|
|
5955
|
-
|
|
5956
|
-
|
|
5980
|
+
position: { right: place2.right, top: 0 },
|
|
5981
|
+
width: place2.width,
|
|
5982
|
+
height: "100%",
|
|
5983
|
+
flexDirection: "column",
|
|
5984
|
+
justifyContent: "center"
|
|
5985
|
+
},
|
|
5986
|
+
children: [circleUnit(true, uiScale, spec, {})]
|
|
5957
5987
|
});
|
|
5958
5988
|
}
|
|
5959
|
-
const place = columnSlot(slot, uiScale);
|
|
5960
|
-
return inColumn(width, place.boxHeight, place.above, place.right, import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5961
|
-
...props,
|
|
5962
|
-
uiTransform: { width, height, flexShrink: 0, ...props.uiTransform }
|
|
5963
|
-
}));
|
|
5964
|
-
}
|
|
5965
|
-
function toolbarHandle(phone, lastSlot, collapse, uiScale = 1) {
|
|
5966
5989
|
const place = handlePlace(phone, lastSlot, uiScale);
|
|
5967
|
-
const face = {
|
|
5968
|
-
uiBackground: { color: THEME.colors.buttonBackground },
|
|
5969
|
-
onMouseDown: collapse,
|
|
5970
|
-
children: [
|
|
5971
|
-
import_react_ecs7.default.createElement(import_react_ecs7.UiEntity, {
|
|
5972
|
-
uiText: { value: ">", fontSize: Math.round(14 * uiScale), color: THEME.colors.gray, textAlign: "middle-center" }
|
|
5973
|
-
})
|
|
5974
|
-
]
|
|
5975
|
-
};
|
|
5976
5990
|
if (!phone) {
|
|
5977
|
-
return
|
|
5978
|
-
...face,
|
|
5979
|
-
uiTransform: {
|
|
5980
|
-
positionType: "absolute",
|
|
5981
|
-
position: { right: place.right, bottom: place.bottom },
|
|
5982
|
-
width: place.width,
|
|
5983
|
-
height: place.height,
|
|
5984
|
-
justifyContent: "center",
|
|
5985
|
-
alignItems: "center"
|
|
5986
|
-
}
|
|
5987
|
-
});
|
|
5991
|
+
return circleUnit(false, uiScale, spec, { positionType: "absolute", position: { right: place.right, bottom: place.bottom } });
|
|
5988
5992
|
}
|
|
5989
|
-
return inColumn(place.width, place.boxHeight, place.above, place.right,
|
|
5990
|
-
...face,
|
|
5991
|
-
uiTransform: { width: place.width, height: place.height, flexShrink: 0, justifyContent: "center", alignItems: "center" }
|
|
5992
|
-
}));
|
|
5993
|
+
return inColumn(place.width, place.boxHeight, place.above, place.right, circleUnit(true, uiScale, spec, {}));
|
|
5993
5994
|
}
|
|
5994
5995
|
|
|
5995
5996
|
// src/ui/toolbar-panel.ts
|
|
5996
5997
|
var import_react_ecs8 = __toESM(require("@dcl/sdk/react-ecs"));
|
|
5997
5998
|
function toolbarPanel(props, phone, uiScale = 1) {
|
|
5998
|
-
if (!phone)
|
|
5999
|
+
if (!phone) {
|
|
6000
|
+
const position = props.uiTransform?.position ?? {};
|
|
6001
|
+
const floor = deskPanelBottom(uiScale);
|
|
6002
|
+
if (typeof position.bottom === "number" && position.bottom < floor) {
|
|
6003
|
+
return import_react_ecs8.default.createElement(import_react_ecs8.UiEntity, {
|
|
6004
|
+
...props,
|
|
6005
|
+
uiTransform: { ...props.uiTransform, position: { ...position, bottom: floor } }
|
|
6006
|
+
});
|
|
6007
|
+
}
|
|
6008
|
+
return import_react_ecs8.default.createElement(import_react_ecs8.UiEntity, props);
|
|
6009
|
+
}
|
|
5999
6010
|
const { key, uiTransform = {}, ...rest } = props;
|
|
6000
6011
|
const { position: _position, positionType: _positionType, ...ownLayout } = uiTransform;
|
|
6001
6012
|
const spacer = () => import_react_ecs8.default.createElement(import_react_ecs8.UiEntity, { uiTransform: { height: 0, flexGrow: 1 } });
|
|
@@ -7023,17 +7034,20 @@ var _StaticTVClient = class _StaticTVClient {
|
|
|
7023
7034
|
* Draw one of the scene's own toolbar buttons in its slot: the row along the bottom right on desktop (where a scene
|
|
7024
7035
|
* placed its own by hand before), the column on a phone. Slots count from the right (the row) or the top (the
|
|
7025
7036
|
* column): 0 is CHAT's, 1 GUIDE's, 2 ADMIN's (for a non-admin the scene's first button may take it), then the
|
|
7026
|
-
* scene's. `props` is the button's face
|
|
7027
|
-
*
|
|
7028
|
-
*
|
|
7037
|
+
* scene's. `props` is the button's face. Since 2.15.0 every button is a circle: its uiBackground color is the ring,
|
|
7038
|
+
* `icon` the white icon in the middle (a name on the SDK's icon host - chat, guide, sparkle, radio, admin - or a full
|
|
7039
|
+
* https URL), `tag` the short name under it, `tagColor`, `badge` (a small count) and `open` (its panel is open) are
|
|
7040
|
+
* optional; a face with no icon shows its children inside the circle. Folded (2.14.0), the buttons draw nothing:
|
|
7041
|
+
* the toolbar is one circle (toolbarHandle).
|
|
7029
7042
|
*
|
|
7030
7043
|
* @example
|
|
7031
7044
|
* ```typescript
|
|
7032
7045
|
* staticTV.toolbarButton(3, {
|
|
7033
|
-
* uiTransform: { justifyContent: 'center', alignItems: 'center' },
|
|
7034
7046
|
* uiBackground: { color: Color4.create(0.2, 0.4, 0.2, 0.9) },
|
|
7047
|
+
* icon: 'radio',
|
|
7048
|
+
* tag: 'MAP',
|
|
7049
|
+
* open: myPanel.isOpen,
|
|
7035
7050
|
* onMouseDown: () => myPanel.toggle(),
|
|
7036
|
-
* children: [ReactEcs.createElement(UiEntity, { uiText: { value: 'MAP', fontSize: 14 } })],
|
|
7037
7051
|
* })
|
|
7038
7052
|
* ```
|
|
7039
7053
|
*/
|
|
@@ -7041,26 +7055,32 @@ var _StaticTVClient = class _StaticTVClient {
|
|
|
7041
7055
|
this.fold.seen(slot);
|
|
7042
7056
|
return toolbarButton(slot, props, this.isPhone, this.uiScale, {
|
|
7043
7057
|
collapsed: this.fold.collapsed,
|
|
7044
|
-
expand: () => this.fold.expand()
|
|
7045
|
-
|
|
7058
|
+
expand: () => this.fold.expand(),
|
|
7059
|
+
lastSlot: this.toolbarLastSlot()
|
|
7060
|
+
}, this.baseUrl);
|
|
7061
|
+
}
|
|
7062
|
+
/** The toolbar's last slot: ADMIN's (2) when it is drawn, else GUIDE's (1), or a scene button's past them */
|
|
7063
|
+
toolbarLastSlot() {
|
|
7064
|
+
return this.fold.lastSlot(this.adminPanel?.hasAccess === true ? 2 : 1);
|
|
7046
7065
|
}
|
|
7047
7066
|
/**
|
|
7048
|
-
* The toolbar
|
|
7049
|
-
* closes every open panel, the scene's registered ones too;
|
|
7050
|
-
*
|
|
7067
|
+
* The toolbar folded (2.14.0, his ask: "small tabs out of users way"; one circle since 2.15.0): the fold circle
|
|
7068
|
+
* folds it and closes every open panel, the scene's registered ones too; the one folded circle opens it. For the
|
|
7069
|
+
* visit only; it starts open. A scene drawing its buttons through toolbarButton needs nothing more.
|
|
7051
7070
|
*/
|
|
7052
7071
|
get toolbarCollapsed() {
|
|
7053
7072
|
return this.fold.collapsed;
|
|
7054
7073
|
}
|
|
7055
7074
|
/**
|
|
7056
|
-
* The
|
|
7057
|
-
*
|
|
7075
|
+
* The fold circle, drawn by the SDK's chat (2.15.0): open, on top of a phone's column (chevron right) or past the
|
|
7076
|
+
* desktop row's last button (chevron down); folded, the toolbar's one circle, on a phone's edge at mid-height
|
|
7077
|
+
* (chevron left) or in the desktop's bottom-right corner (chevron up). A press folds or opens.
|
|
7058
7078
|
* @internal
|
|
7059
7079
|
*/
|
|
7060
7080
|
toolbarHandle() {
|
|
7061
|
-
|
|
7062
|
-
const
|
|
7063
|
-
return toolbarHandle(this.isPhone, this.
|
|
7081
|
+
const collapsed = this.fold.collapsed;
|
|
7082
|
+
const toggle = () => collapsed ? this.fold.expand() : this.fold.collapse();
|
|
7083
|
+
return toolbarHandle(this.isPhone, this.toolbarLastSlot(), collapsed, toggle, this.uiScale, this.baseUrl);
|
|
7064
7084
|
}
|
|
7065
7085
|
/** Where a scene's own panel's right edge goes: on a phone one gap left of the column; elsewhere `desktopRight` */
|
|
7066
7086
|
panelRight(desktopRight) {
|
package/dist/index.mjs
CHANGED
|
@@ -1516,7 +1516,7 @@ function truncateText(text, maxLength) {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
|
|
1518
1518
|
// src/version.ts
|
|
1519
|
-
var SDK_VERSION = true ? "2.
|
|
1519
|
+
var SDK_VERSION = true ? "2.15.0" : "unknown";
|
|
1520
1520
|
|
|
1521
1521
|
// src/ui/guide-ui.tsx
|
|
1522
1522
|
function withLock(mapped, v, fallback) {
|
|
@@ -2297,38 +2297,12 @@ var GuideUIModule = class {
|
|
|
2297
2297
|
});
|
|
2298
2298
|
}
|
|
2299
2299
|
renderToggleButton() {
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
color: THEME.colors.white,
|
|
2307
|
-
textAlign: "middle-center"
|
|
2308
|
-
}
|
|
2309
|
-
});
|
|
2310
|
-
const press = () => this._isVisible ? this.hide() : this.show();
|
|
2311
|
-
if (this.client.isPhone || this.client.toolbarCollapsed) {
|
|
2312
|
-
return this.client.toolbarButton(1, {
|
|
2313
|
-
uiTransform: { justifyContent: "center", alignItems: "center" },
|
|
2314
|
-
uiBackground: { color: buttonColor },
|
|
2315
|
-
onMouseDown: press,
|
|
2316
|
-
children: [label]
|
|
2317
|
-
});
|
|
2318
|
-
}
|
|
2319
|
-
const buttonPos = 20 + this.s(100) + 10;
|
|
2320
|
-
return ReactEcs2.createElement(UiEntity2, {
|
|
2321
|
-
uiTransform: {
|
|
2322
|
-
positionType: "absolute",
|
|
2323
|
-
position: { right: buttonPos, bottom: 10 },
|
|
2324
|
-
width: this.s(100),
|
|
2325
|
-
height: this.s(45),
|
|
2326
|
-
justifyContent: "center",
|
|
2327
|
-
alignItems: "center"
|
|
2328
|
-
},
|
|
2329
|
-
uiBackground: { color: buttonColor },
|
|
2330
|
-
onMouseDown: press,
|
|
2331
|
-
children: [label]
|
|
2300
|
+
return this.client.toolbarButton(1, {
|
|
2301
|
+
uiBackground: { color: Color43.create(0, 0.5, 0.5, 0.9) },
|
|
2302
|
+
icon: "guide",
|
|
2303
|
+
tag: "GUIDE",
|
|
2304
|
+
open: this._isVisible,
|
|
2305
|
+
onMouseDown: () => this._isVisible ? this.hide() : this.show()
|
|
2332
2306
|
});
|
|
2333
2307
|
}
|
|
2334
2308
|
};
|
|
@@ -3146,38 +3120,13 @@ var ChatUIModule = class {
|
|
|
3146
3120
|
});
|
|
3147
3121
|
}
|
|
3148
3122
|
renderToggleButton() {
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
color: THEME.colors.white,
|
|
3157
|
-
textAlign: "middle-center"
|
|
3158
|
-
}
|
|
3159
|
-
});
|
|
3160
|
-
const press = () => this._isVisible ? this.hide() : this.show();
|
|
3161
|
-
if (this.client.isPhone || this.client.toolbarCollapsed) {
|
|
3162
|
-
return this.client.toolbarButton(0, {
|
|
3163
|
-
uiTransform: { justifyContent: "center", alignItems: "center" },
|
|
3164
|
-
uiBackground: { color: buttonColor },
|
|
3165
|
-
onMouseDown: press,
|
|
3166
|
-
children: [label]
|
|
3167
|
-
});
|
|
3168
|
-
}
|
|
3169
|
-
return ReactEcs3.createElement(UiEntity3, {
|
|
3170
|
-
uiTransform: {
|
|
3171
|
-
positionType: "absolute",
|
|
3172
|
-
position: { right: 20, bottom: 10 },
|
|
3173
|
-
width: this.s(100),
|
|
3174
|
-
height: this.s(45),
|
|
3175
|
-
justifyContent: "center",
|
|
3176
|
-
alignItems: "center"
|
|
3177
|
-
},
|
|
3178
|
-
uiBackground: { color: buttonColor },
|
|
3179
|
-
onMouseDown: press,
|
|
3180
|
-
children: [label]
|
|
3123
|
+
return this.client.toolbarButton(0, {
|
|
3124
|
+
uiBackground: { color: Color44.create(0.6, 0, 0.5, 0.9) },
|
|
3125
|
+
icon: "chat",
|
|
3126
|
+
tag: "CHAT",
|
|
3127
|
+
badge: this._unreadCount > 0 ? this._unreadCount : void 0,
|
|
3128
|
+
open: this._isVisible,
|
|
3129
|
+
onMouseDown: () => this._isVisible ? this.hide() : this.show()
|
|
3181
3130
|
});
|
|
3182
3131
|
}
|
|
3183
3132
|
};
|
|
@@ -4370,19 +4319,13 @@ var AdminPanelUIModule = class {
|
|
|
4370
4319
|
}
|
|
4371
4320
|
},
|
|
4372
4321
|
this.renderScaledNotification(),
|
|
4373
|
-
this.client.
|
|
4374
|
-
uiBackground: { color:
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
position: { right: 20 + this.s(100) + 10 + this.s(100) + 10, bottom: 10 },
|
|
4381
|
-
positionType: "absolute"
|
|
4382
|
-
}
|
|
4383
|
-
},
|
|
4384
|
-
this.renderToggleFace()
|
|
4385
|
-
),
|
|
4322
|
+
this.client.toolbarButton(2, {
|
|
4323
|
+
uiBackground: { color: C2.header },
|
|
4324
|
+
icon: "admin",
|
|
4325
|
+
tag: "ADMIN",
|
|
4326
|
+
open: this.panelOpen,
|
|
4327
|
+
onMouseDown: () => this.toggle()
|
|
4328
|
+
}),
|
|
4386
4329
|
this.panelOpen && this.client.toolbarPanel({
|
|
4387
4330
|
key: `admin-panel-${this.client.uiScale}`,
|
|
4388
4331
|
uiTransform: {
|
|
@@ -5706,31 +5649,20 @@ var AdminPanelUIModule = class {
|
|
|
5706
5649
|
)
|
|
5707
5650
|
);
|
|
5708
5651
|
}
|
|
5709
|
-
/** The ADMIN / CLOSE button itself; its place is the row's or, on a phone, the column's (2.12.0) */
|
|
5710
|
-
renderToggleFace() {
|
|
5711
|
-
return /* @__PURE__ */ ReactEcs6.createElement(
|
|
5712
|
-
Button4,
|
|
5713
|
-
{
|
|
5714
|
-
uiTransform: { width: this.s(100), height: this.s(45) },
|
|
5715
|
-
uiBackground: { color: this.panelOpen ? C2.btn : C2.header },
|
|
5716
|
-
value: this.panelOpen ? "CLOSE" : "ADMIN",
|
|
5717
|
-
fontSize: this.s(14),
|
|
5718
|
-
color: C2.text,
|
|
5719
|
-
onMouseDown: () => this.toggle()
|
|
5720
|
-
}
|
|
5721
|
-
);
|
|
5722
|
-
}
|
|
5723
5652
|
};
|
|
5724
5653
|
|
|
5725
5654
|
// src/StaticTVClient.ts
|
|
5726
5655
|
import { getExplorerInformation } from "~system/Runtime";
|
|
5727
5656
|
|
|
5728
5657
|
// src/ui/toolbar.ts
|
|
5729
|
-
var
|
|
5730
|
-
|
|
5658
|
+
var CIRCLE = {
|
|
5659
|
+
phone: { diameter: 72, ring: 4, icon: 36, tagFont: 12, tag: 16, gap: 12, badge: 22 },
|
|
5660
|
+
desktop: { diameter: 52, ring: 3, icon: 26, tagFont: 11, tag: 14, gap: 12, badge: 18 }
|
|
5661
|
+
};
|
|
5731
5662
|
var PHONE_EDGE = 0;
|
|
5732
|
-
var
|
|
5733
|
-
var
|
|
5663
|
+
var DESK_EDGE = 20;
|
|
5664
|
+
var DESK_BOTTOM = 10;
|
|
5665
|
+
var PANEL_GAP = 10;
|
|
5734
5666
|
function platformOf(answer) {
|
|
5735
5667
|
const raw = answer?.platform;
|
|
5736
5668
|
if (typeof raw !== "string") return "unknown";
|
|
@@ -5741,38 +5673,53 @@ function isPhonePlatform(platform) {
|
|
|
5741
5673
|
return platform === "mobile";
|
|
5742
5674
|
}
|
|
5743
5675
|
var scaled = (value, uiScale) => Math.round(value * uiScale);
|
|
5744
|
-
function
|
|
5745
|
-
|
|
5746
|
-
}
|
|
5747
|
-
function columnSlot(slot, uiScale = 1) {
|
|
5748
|
-
const h = scaled(TOOLBAR.buttonHeight, uiScale);
|
|
5749
|
-
const handle = scaled(HANDLE, uiScale) + TOOLBAR.gap;
|
|
5676
|
+
function circleSize(phone, uiScale = 1) {
|
|
5677
|
+
const c = phone ? CIRCLE.phone : CIRCLE.desktop;
|
|
5750
5678
|
return {
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5679
|
+
diameter: scaled(c.diameter, uiScale),
|
|
5680
|
+
ring: Math.max(1, scaled(c.ring, uiScale)),
|
|
5681
|
+
icon: scaled(c.icon, uiScale),
|
|
5682
|
+
tagFont: scaled(c.tagFont, uiScale),
|
|
5683
|
+
tag: scaled(c.tag, uiScale),
|
|
5684
|
+
gap: c.gap,
|
|
5685
|
+
badge: scaled(c.badge, uiScale)
|
|
5754
5686
|
};
|
|
5755
5687
|
}
|
|
5688
|
+
function rowRight(slot, uiScale = 1) {
|
|
5689
|
+
const c = circleSize(false, uiScale);
|
|
5690
|
+
return DESK_EDGE + slot * (c.diameter + c.gap);
|
|
5691
|
+
}
|
|
5692
|
+
function columnSlot(slot, lastSlot, uiScale = 1) {
|
|
5693
|
+
const c = circleSize(true, uiScale);
|
|
5694
|
+
const step = c.diameter + c.tag + c.gap;
|
|
5695
|
+
const rows = Math.max(lastSlot, slot, 0) + 2;
|
|
5696
|
+
return { right: PHONE_EDGE, width: c.diameter, boxHeight: rows * step - c.gap, above: (Math.max(0, slot) + 1) * step };
|
|
5697
|
+
}
|
|
5756
5698
|
function handlePlace(phone, lastSlot, uiScale = 1) {
|
|
5699
|
+
const c = circleSize(phone, uiScale);
|
|
5757
5700
|
if (phone) {
|
|
5758
|
-
return {
|
|
5759
|
-
right: PHONE_EDGE,
|
|
5760
|
-
width: scaled(TOOLBAR.buttonWidth, uiScale),
|
|
5761
|
-
height: scaled(HANDLE, uiScale),
|
|
5762
|
-
boxHeight: columnSlot(0, uiScale).boxHeight,
|
|
5763
|
-
above: 0
|
|
5764
|
-
};
|
|
5701
|
+
return { right: PHONE_EDGE, width: c.diameter, height: c.diameter, boxHeight: columnSlot(0, lastSlot, uiScale).boxHeight, above: 0 };
|
|
5765
5702
|
}
|
|
5766
|
-
return {
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
};
|
|
5703
|
+
return { right: rowRight(Math.max(0, lastSlot) + 1, uiScale), bottom: DESK_BOTTOM, width: c.diameter, height: c.diameter + c.tag };
|
|
5704
|
+
}
|
|
5705
|
+
function foldedPlace(phone, uiScale = 1) {
|
|
5706
|
+
const c = circleSize(phone, uiScale);
|
|
5707
|
+
if (phone) return { right: PHONE_EDGE, width: c.diameter, height: c.diameter };
|
|
5708
|
+
return { right: DESK_EDGE, bottom: DESK_BOTTOM, width: c.diameter, height: c.diameter + c.tag };
|
|
5709
|
+
}
|
|
5710
|
+
function chevronOf(phone, collapsed) {
|
|
5711
|
+
if (phone) return collapsed ? "chevron-left" : "chevron-right";
|
|
5712
|
+
return collapsed ? "chevron-up" : "chevron-down";
|
|
5713
|
+
}
|
|
5714
|
+
function deskPanelBottom(uiScale = 1) {
|
|
5715
|
+
const c = circleSize(false, uiScale);
|
|
5716
|
+
return DESK_BOTTOM + c.diameter + c.tag + PANEL_GAP;
|
|
5772
5717
|
}
|
|
5773
|
-
function
|
|
5774
|
-
if (
|
|
5775
|
-
|
|
5718
|
+
function iconUrl(icon, baseUrl) {
|
|
5719
|
+
if (icon.includes("://")) return icon;
|
|
5720
|
+
const at = baseUrl.indexOf("/api/");
|
|
5721
|
+
const site = (at > 0 ? baseUrl.slice(0, at) : baseUrl).replace(/\/+$/, "");
|
|
5722
|
+
return `${site}/sdk/icons/${icon}.png`;
|
|
5776
5723
|
}
|
|
5777
5724
|
var ToolbarFold = class {
|
|
5778
5725
|
constructor(closeAll) {
|
|
@@ -5801,7 +5748,7 @@ var ToolbarFold = class {
|
|
|
5801
5748
|
}
|
|
5802
5749
|
};
|
|
5803
5750
|
function panelRight(phone, desktopRight, uiScale = 1) {
|
|
5804
|
-
return phone ? PHONE_EDGE +
|
|
5751
|
+
return phone ? PHONE_EDGE + circleSize(true, uiScale).diameter + PANEL_GAP : desktopRight;
|
|
5805
5752
|
}
|
|
5806
5753
|
var DESKTOP_CLOSES = { guide: ["admin"], admin: ["guide"] };
|
|
5807
5754
|
var GUIDE_PLACE = ["guide", "admin"];
|
|
@@ -5849,6 +5796,73 @@ var PanelRules = class {
|
|
|
5849
5796
|
|
|
5850
5797
|
// src/ui/toolbar-button.ts
|
|
5851
5798
|
import ReactEcs7, { UiEntity as UiEntity7 } from "@dcl/sdk/react-ecs";
|
|
5799
|
+
import { Color4 as Color47 } from "@dcl/sdk/math";
|
|
5800
|
+
var GLASS = Color47.create(18 / 255, 20 / 255, 34 / 255, 0.55);
|
|
5801
|
+
var FOLD_RING = Color47.create(1, 1, 1, 0.45);
|
|
5802
|
+
var BADGE = Color47.create(0.86, 0.15, 0.2, 1);
|
|
5803
|
+
var WHITE = Color47.create(1, 1, 1, 1);
|
|
5804
|
+
function circleUnit(phone, uiScale, spec, place) {
|
|
5805
|
+
const c = circleSize(phone, uiScale);
|
|
5806
|
+
const inner = [];
|
|
5807
|
+
if (spec.icon) {
|
|
5808
|
+
inner.push(ReactEcs7.createElement(UiEntity7, {
|
|
5809
|
+
uiTransform: { width: c.icon, height: c.icon },
|
|
5810
|
+
uiBackground: { texture: { src: spec.icon, filterMode: "bi-linear" }, textureMode: "stretch" }
|
|
5811
|
+
}));
|
|
5812
|
+
} else if (spec.content) {
|
|
5813
|
+
inner.push(...spec.content);
|
|
5814
|
+
}
|
|
5815
|
+
const badgeText = spec.badge === void 0 || spec.badge === null || spec.badge === 0 || spec.badge === "" ? null : String(spec.badge);
|
|
5816
|
+
if (badgeText) {
|
|
5817
|
+
inner.push(ReactEcs7.createElement(UiEntity7, {
|
|
5818
|
+
uiTransform: {
|
|
5819
|
+
positionType: "absolute",
|
|
5820
|
+
position: { top: 0, right: 0 },
|
|
5821
|
+
width: c.badge,
|
|
5822
|
+
height: c.badge,
|
|
5823
|
+
borderRadius: c.badge / 2,
|
|
5824
|
+
justifyContent: "center",
|
|
5825
|
+
alignItems: "center"
|
|
5826
|
+
},
|
|
5827
|
+
uiBackground: { color: BADGE },
|
|
5828
|
+
uiText: { value: badgeText, fontSize: Math.round(c.badge * 0.6), color: WHITE, textAlign: "middle-center" }
|
|
5829
|
+
}));
|
|
5830
|
+
}
|
|
5831
|
+
const circle = ReactEcs7.createElement(UiEntity7, {
|
|
5832
|
+
uiTransform: {
|
|
5833
|
+
width: c.diameter,
|
|
5834
|
+
height: c.diameter,
|
|
5835
|
+
flexShrink: 0,
|
|
5836
|
+
borderRadius: c.diameter / 2,
|
|
5837
|
+
borderWidth: c.ring,
|
|
5838
|
+
borderColor: spec.ring,
|
|
5839
|
+
justifyContent: "center",
|
|
5840
|
+
alignItems: "center",
|
|
5841
|
+
...spec.contentLayout || {}
|
|
5842
|
+
},
|
|
5843
|
+
uiBackground: { color: spec.fill },
|
|
5844
|
+
children: inner
|
|
5845
|
+
});
|
|
5846
|
+
const children = [circle];
|
|
5847
|
+
if (spec.tagRow) {
|
|
5848
|
+
children.push(ReactEcs7.createElement(UiEntity7, {
|
|
5849
|
+
uiTransform: { width: c.diameter, height: c.tag, flexShrink: 0 },
|
|
5850
|
+
uiText: spec.tag ? { value: spec.tag, fontSize: c.tagFont, color: spec.tagColor ?? WHITE, textAlign: "middle-center" } : void 0
|
|
5851
|
+
}));
|
|
5852
|
+
}
|
|
5853
|
+
return ReactEcs7.createElement(UiEntity7, {
|
|
5854
|
+
uiTransform: {
|
|
5855
|
+
...place,
|
|
5856
|
+
width: c.diameter,
|
|
5857
|
+
height: c.diameter + (spec.tagRow ? c.tag : 0),
|
|
5858
|
+
flexDirection: "column",
|
|
5859
|
+
alignItems: "center",
|
|
5860
|
+
flexShrink: 0
|
|
5861
|
+
},
|
|
5862
|
+
onMouseDown: spec.onMouseDown,
|
|
5863
|
+
children
|
|
5864
|
+
});
|
|
5865
|
+
}
|
|
5852
5866
|
function inColumn(width, boxHeight, above, right, entity) {
|
|
5853
5867
|
return ReactEcs7.createElement(UiEntity7, {
|
|
5854
5868
|
uiTransform: {
|
|
@@ -5870,81 +5884,78 @@ function inColumn(width, boxHeight, above, right, entity) {
|
|
|
5870
5884
|
]
|
|
5871
5885
|
});
|
|
5872
5886
|
}
|
|
5873
|
-
function
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5887
|
+
function ringOf(props) {
|
|
5888
|
+
return props.uiBackground?.color ?? WHITE;
|
|
5889
|
+
}
|
|
5890
|
+
function toolbarButton(slot, props, phone, uiScale = 1, fold = { collapsed: false, expand: () => {
|
|
5891
|
+
}, lastSlot: slot }, baseUrl = "https://thestatic.tv/api/v1/dcl") {
|
|
5892
|
+
if (fold.collapsed) return null;
|
|
5893
|
+
const ring = ringOf(props);
|
|
5894
|
+
const r = ring;
|
|
5895
|
+
const spec = {
|
|
5896
|
+
ring,
|
|
5897
|
+
fill: props.open === true && typeof r.r === "number" ? Color47.create(r.r, r.g ?? 0, r.b ?? 0, 0.55) : GLASS,
|
|
5898
|
+
icon: props.icon ? iconUrl(props.icon, baseUrl) : void 0,
|
|
5899
|
+
content: props.icon ? void 0 : props.children,
|
|
5900
|
+
contentLayout: props.icon ? void 0 : props.uiTransform,
|
|
5901
|
+
tag: props.tag,
|
|
5902
|
+
tagColor: props.tagColor,
|
|
5903
|
+
badge: props.badge,
|
|
5904
|
+
tagRow: true,
|
|
5905
|
+
onMouseDown: props.onMouseDown
|
|
5906
|
+
};
|
|
5907
|
+
if (!phone) {
|
|
5908
|
+
return circleUnit(false, uiScale, spec, { positionType: "absolute", position: { right: rowRight(slot, uiScale), bottom: DESK_BOTTOM } });
|
|
5909
|
+
}
|
|
5910
|
+
const place = columnSlot(slot, fold.lastSlot, uiScale);
|
|
5911
|
+
return inColumn(place.width, place.boxHeight, place.above, place.right, circleUnit(true, uiScale, spec, {}));
|
|
5912
|
+
}
|
|
5913
|
+
function toolbarHandle(phone, lastSlot, collapsed, toggle, uiScale = 1, baseUrl = "https://thestatic.tv/api/v1/dcl") {
|
|
5914
|
+
const spec = {
|
|
5915
|
+
ring: FOLD_RING,
|
|
5916
|
+
fill: GLASS,
|
|
5917
|
+
icon: iconUrl(chevronOf(phone, collapsed), baseUrl),
|
|
5918
|
+
tagRow: !phone,
|
|
5919
|
+
onMouseDown: toggle
|
|
5920
|
+
};
|
|
5921
|
+
if (collapsed) {
|
|
5922
|
+
const place2 = foldedPlace(phone, uiScale);
|
|
5879
5923
|
if (!phone) {
|
|
5880
|
-
return
|
|
5881
|
-
...face,
|
|
5882
|
-
uiTransform: {
|
|
5883
|
-
positionType: "absolute",
|
|
5884
|
-
position: { right: strip.right, bottom: strip.bottom },
|
|
5885
|
-
width: strip.width,
|
|
5886
|
-
height: strip.height
|
|
5887
|
-
}
|
|
5888
|
-
});
|
|
5924
|
+
return circleUnit(false, uiScale, spec, { positionType: "absolute", position: { right: place2.right, bottom: place2.bottom } });
|
|
5889
5925
|
}
|
|
5890
|
-
const place2 = columnSlot(slot, uiScale);
|
|
5891
|
-
return inColumn(strip.width, place2.boxHeight, place2.above, strip.right, ReactEcs7.createElement(UiEntity7, {
|
|
5892
|
-
...face,
|
|
5893
|
-
uiTransform: { width: strip.width, height: strip.height, flexShrink: 0 }
|
|
5894
|
-
}));
|
|
5895
|
-
}
|
|
5896
|
-
if (!phone) {
|
|
5897
5926
|
return ReactEcs7.createElement(UiEntity7, {
|
|
5898
|
-
...props,
|
|
5899
5927
|
uiTransform: {
|
|
5900
5928
|
positionType: "absolute",
|
|
5901
|
-
position: { right:
|
|
5902
|
-
width,
|
|
5903
|
-
height,
|
|
5904
|
-
|
|
5905
|
-
|
|
5929
|
+
position: { right: place2.right, top: 0 },
|
|
5930
|
+
width: place2.width,
|
|
5931
|
+
height: "100%",
|
|
5932
|
+
flexDirection: "column",
|
|
5933
|
+
justifyContent: "center"
|
|
5934
|
+
},
|
|
5935
|
+
children: [circleUnit(true, uiScale, spec, {})]
|
|
5906
5936
|
});
|
|
5907
5937
|
}
|
|
5908
|
-
const place = columnSlot(slot, uiScale);
|
|
5909
|
-
return inColumn(width, place.boxHeight, place.above, place.right, ReactEcs7.createElement(UiEntity7, {
|
|
5910
|
-
...props,
|
|
5911
|
-
uiTransform: { width, height, flexShrink: 0, ...props.uiTransform }
|
|
5912
|
-
}));
|
|
5913
|
-
}
|
|
5914
|
-
function toolbarHandle(phone, lastSlot, collapse, uiScale = 1) {
|
|
5915
5938
|
const place = handlePlace(phone, lastSlot, uiScale);
|
|
5916
|
-
const face = {
|
|
5917
|
-
uiBackground: { color: THEME.colors.buttonBackground },
|
|
5918
|
-
onMouseDown: collapse,
|
|
5919
|
-
children: [
|
|
5920
|
-
ReactEcs7.createElement(UiEntity7, {
|
|
5921
|
-
uiText: { value: ">", fontSize: Math.round(14 * uiScale), color: THEME.colors.gray, textAlign: "middle-center" }
|
|
5922
|
-
})
|
|
5923
|
-
]
|
|
5924
|
-
};
|
|
5925
5939
|
if (!phone) {
|
|
5926
|
-
return
|
|
5927
|
-
...face,
|
|
5928
|
-
uiTransform: {
|
|
5929
|
-
positionType: "absolute",
|
|
5930
|
-
position: { right: place.right, bottom: place.bottom },
|
|
5931
|
-
width: place.width,
|
|
5932
|
-
height: place.height,
|
|
5933
|
-
justifyContent: "center",
|
|
5934
|
-
alignItems: "center"
|
|
5935
|
-
}
|
|
5936
|
-
});
|
|
5940
|
+
return circleUnit(false, uiScale, spec, { positionType: "absolute", position: { right: place.right, bottom: place.bottom } });
|
|
5937
5941
|
}
|
|
5938
|
-
return inColumn(place.width, place.boxHeight, place.above, place.right,
|
|
5939
|
-
...face,
|
|
5940
|
-
uiTransform: { width: place.width, height: place.height, flexShrink: 0, justifyContent: "center", alignItems: "center" }
|
|
5941
|
-
}));
|
|
5942
|
+
return inColumn(place.width, place.boxHeight, place.above, place.right, circleUnit(true, uiScale, spec, {}));
|
|
5942
5943
|
}
|
|
5943
5944
|
|
|
5944
5945
|
// src/ui/toolbar-panel.ts
|
|
5945
5946
|
import ReactEcs8, { UiEntity as UiEntity8 } from "@dcl/sdk/react-ecs";
|
|
5946
5947
|
function toolbarPanel(props, phone, uiScale = 1) {
|
|
5947
|
-
if (!phone)
|
|
5948
|
+
if (!phone) {
|
|
5949
|
+
const position = props.uiTransform?.position ?? {};
|
|
5950
|
+
const floor = deskPanelBottom(uiScale);
|
|
5951
|
+
if (typeof position.bottom === "number" && position.bottom < floor) {
|
|
5952
|
+
return ReactEcs8.createElement(UiEntity8, {
|
|
5953
|
+
...props,
|
|
5954
|
+
uiTransform: { ...props.uiTransform, position: { ...position, bottom: floor } }
|
|
5955
|
+
});
|
|
5956
|
+
}
|
|
5957
|
+
return ReactEcs8.createElement(UiEntity8, props);
|
|
5958
|
+
}
|
|
5948
5959
|
const { key, uiTransform = {}, ...rest } = props;
|
|
5949
5960
|
const { position: _position, positionType: _positionType, ...ownLayout } = uiTransform;
|
|
5950
5961
|
const spacer = () => ReactEcs8.createElement(UiEntity8, { uiTransform: { height: 0, flexGrow: 1 } });
|
|
@@ -6972,17 +6983,20 @@ var _StaticTVClient = class _StaticTVClient {
|
|
|
6972
6983
|
* Draw one of the scene's own toolbar buttons in its slot: the row along the bottom right on desktop (where a scene
|
|
6973
6984
|
* placed its own by hand before), the column on a phone. Slots count from the right (the row) or the top (the
|
|
6974
6985
|
* column): 0 is CHAT's, 1 GUIDE's, 2 ADMIN's (for a non-admin the scene's first button may take it), then the
|
|
6975
|
-
* scene's. `props` is the button's face
|
|
6976
|
-
*
|
|
6977
|
-
*
|
|
6986
|
+
* scene's. `props` is the button's face. Since 2.15.0 every button is a circle: its uiBackground color is the ring,
|
|
6987
|
+
* `icon` the white icon in the middle (a name on the SDK's icon host - chat, guide, sparkle, radio, admin - or a full
|
|
6988
|
+
* https URL), `tag` the short name under it, `tagColor`, `badge` (a small count) and `open` (its panel is open) are
|
|
6989
|
+
* optional; a face with no icon shows its children inside the circle. Folded (2.14.0), the buttons draw nothing:
|
|
6990
|
+
* the toolbar is one circle (toolbarHandle).
|
|
6978
6991
|
*
|
|
6979
6992
|
* @example
|
|
6980
6993
|
* ```typescript
|
|
6981
6994
|
* staticTV.toolbarButton(3, {
|
|
6982
|
-
* uiTransform: { justifyContent: 'center', alignItems: 'center' },
|
|
6983
6995
|
* uiBackground: { color: Color4.create(0.2, 0.4, 0.2, 0.9) },
|
|
6996
|
+
* icon: 'radio',
|
|
6997
|
+
* tag: 'MAP',
|
|
6998
|
+
* open: myPanel.isOpen,
|
|
6984
6999
|
* onMouseDown: () => myPanel.toggle(),
|
|
6985
|
-
* children: [ReactEcs.createElement(UiEntity, { uiText: { value: 'MAP', fontSize: 14 } })],
|
|
6986
7000
|
* })
|
|
6987
7001
|
* ```
|
|
6988
7002
|
*/
|
|
@@ -6990,26 +7004,32 @@ var _StaticTVClient = class _StaticTVClient {
|
|
|
6990
7004
|
this.fold.seen(slot);
|
|
6991
7005
|
return toolbarButton(slot, props, this.isPhone, this.uiScale, {
|
|
6992
7006
|
collapsed: this.fold.collapsed,
|
|
6993
|
-
expand: () => this.fold.expand()
|
|
6994
|
-
|
|
7007
|
+
expand: () => this.fold.expand(),
|
|
7008
|
+
lastSlot: this.toolbarLastSlot()
|
|
7009
|
+
}, this.baseUrl);
|
|
7010
|
+
}
|
|
7011
|
+
/** The toolbar's last slot: ADMIN's (2) when it is drawn, else GUIDE's (1), or a scene button's past them */
|
|
7012
|
+
toolbarLastSlot() {
|
|
7013
|
+
return this.fold.lastSlot(this.adminPanel?.hasAccess === true ? 2 : 1);
|
|
6995
7014
|
}
|
|
6996
7015
|
/**
|
|
6997
|
-
* The toolbar
|
|
6998
|
-
* closes every open panel, the scene's registered ones too;
|
|
6999
|
-
*
|
|
7016
|
+
* The toolbar folded (2.14.0, his ask: "small tabs out of users way"; one circle since 2.15.0): the fold circle
|
|
7017
|
+
* folds it and closes every open panel, the scene's registered ones too; the one folded circle opens it. For the
|
|
7018
|
+
* visit only; it starts open. A scene drawing its buttons through toolbarButton needs nothing more.
|
|
7000
7019
|
*/
|
|
7001
7020
|
get toolbarCollapsed() {
|
|
7002
7021
|
return this.fold.collapsed;
|
|
7003
7022
|
}
|
|
7004
7023
|
/**
|
|
7005
|
-
* The
|
|
7006
|
-
*
|
|
7024
|
+
* The fold circle, drawn by the SDK's chat (2.15.0): open, on top of a phone's column (chevron right) or past the
|
|
7025
|
+
* desktop row's last button (chevron down); folded, the toolbar's one circle, on a phone's edge at mid-height
|
|
7026
|
+
* (chevron left) or in the desktop's bottom-right corner (chevron up). A press folds or opens.
|
|
7007
7027
|
* @internal
|
|
7008
7028
|
*/
|
|
7009
7029
|
toolbarHandle() {
|
|
7010
|
-
|
|
7011
|
-
const
|
|
7012
|
-
return toolbarHandle(this.isPhone, this.
|
|
7030
|
+
const collapsed = this.fold.collapsed;
|
|
7031
|
+
const toggle = () => collapsed ? this.fold.expand() : this.fold.collapse();
|
|
7032
|
+
return toolbarHandle(this.isPhone, this.toolbarLastSlot(), collapsed, toggle, this.uiScale, this.baseUrl);
|
|
7013
7033
|
}
|
|
7014
7034
|
/** Where a scene's own panel's right edge goes: on a phone one gap left of the column; elsewhere `desktopRight` */
|
|
7015
7035
|
panelRight(desktopRight) {
|
package/package.json
CHANGED