@q9labsai/chalk-react 4.1.4 → 4.1.5

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.
@@ -7665,7 +7665,7 @@ function choosePrimary(items, context) {
7665
7665
  if (items.length === 0) return null;
7666
7666
  const pinned = context.pinnedId ? items.find((item) => item.id === context.pinnedId) : void 0;
7667
7667
  if (pinned) return pinned;
7668
- const content = () => newestScreenShare(items, context.seenAt) ?? items.find((item) => item.kind === "whiteboard");
7668
+ const content = () => items.find((item) => item.kind === "whiteboard") ?? newestScreenShare(items, context.seenAt);
7669
7669
  const speaker = () => participantWhere(items, (participant) => participant.isActiveSpeaker === true) ?? participantWhere(items, (participant) => participant.isSpeaking === true) ?? (context.lastSpeakerId ? items.find((item) => item.kind === "participant" && item.id === context.lastSpeakerId) : void 0);
7670
7670
  const ordered = context.layout === "presentation" ? [content, speaker] : [speaker, content];
7671
7671
  for (const pick of ordered) {
@@ -12463,12 +12463,12 @@ function SpaceSurface(props) {
12463
12463
  const client = useSpaceClient();
12464
12464
  const self = useSelf();
12465
12465
  const media = useMedia();
12466
+ const whiteboardState = useWhiteboard();
12466
12467
  const canEndEpisode = useCan("endEpisode");
12467
12468
  const canDrawWhiteboard = useCan("drawWhiteboard");
12468
12469
  const [settingsOpen, setSettingsOpen] = useState51(false);
12469
12470
  const [settingsInitialSection, setSettingsInitialSection] = useState51();
12470
12471
  const [infoOpen, setInfoOpen] = useState51(false);
12471
- const [whiteboardOpen, setWhiteboardOpen] = useState51(false);
12472
12472
  const [commandError, setCommandError] = useState51(null);
12473
12473
  const [settings, setSettings] = useState51(() => createSettings(self.displayName ?? "", props.layout ?? "focus", props.theme?.skin ?? "classic", props.theme?.palette ?? (props.resolvedColorScheme === "dark" ? "warm-charcoal" : "light"), props.theme?.texture ?? "none"));
12474
12474
  const resolvedSkin = props.theme?.skin ?? "classic";
@@ -12513,13 +12513,14 @@ function SpaceSurface(props) {
12513
12513
  }
12514
12514
  }, []);
12515
12515
  const whiteboardTransport = client.whiteboard.transport();
12516
- const whiteboardEnabled = props.features?.whiteboard !== false && whiteboardOpen && canDrawWhiteboard;
12517
- const whiteboardSubscription = useWhiteboardSceneSubscription(whiteboardTransport, whiteboardEnabled);
12516
+ const whiteboardAvailable = props.features?.whiteboard !== false;
12517
+ const whiteboardSubscription = useWhiteboardSceneSubscription(whiteboardTransport, whiteboardAvailable);
12518
+ const setWhiteboardPresentation = whiteboardSubscription.status === "ready" ? whiteboardSubscription.transport.setPresentation : void 0;
12518
12519
  useEffect48(() => {
12519
12520
  if (whiteboardSubscription.status === "failed") setCommandError(whiteboardSubscription.error.message);
12520
12521
  else if (whiteboardSubscription.status === "loading" || whiteboardSubscription.status === "ready") setCommandError(null);
12521
12522
  }, [whiteboardSubscription]);
12522
- const whiteboard = whiteboardEnabled && whiteboardSubscription.status === "ready" ? {
12523
+ const whiteboard = whiteboardAvailable && whiteboardState.engine.presenting && whiteboardSubscription.status === "ready" ? {
12523
12524
  isOpen: true,
12524
12525
  props: {
12525
12526
  canDraw: canDrawWhiteboard,
@@ -12555,7 +12556,7 @@ function SpaceSurface(props) {
12555
12556
  features: { ...props.features, sounds: props.features?.sounds !== false && settings.experience.sounds },
12556
12557
  onOpenDiagnostics: props.onOpenDiagnostics,
12557
12558
  whiteboard,
12558
- onToggleWhiteboard: () => setWhiteboardOpen((open) => !open),
12559
+ onToggleWhiteboard: canDrawWhiteboard && setWhiteboardPresentation ? () => void runCommand(() => setWhiteboardPresentation(!whiteboardState.engine.presenting)) : void 0,
12559
12560
  infoDialog: props.features?.info !== false && props.inviteLink ? { isOpen: infoOpen, onOpenChange: setInfoOpen, spaceName: props.spaceName, inviteLink: props.inviteLink, onCopyLink: () => void navigator.clipboard?.writeText(props.inviteLink) } : void 0,
12560
12561
  onOpenSettings: props.features?.settings !== false ? () => {
12561
12562
  setSettingsInitialSection(void 0);
@@ -35,7 +35,7 @@ import {
35
35
  SettingsPanel,
36
36
  Stage,
37
37
  buildStageItems
38
- } from "../chunk-DDIM65MJ.js";
38
+ } from "../chunk-XF5YWLFY.js";
39
39
  import "../chunk-ZEZLA34O.js";
40
40
  export {
41
41
  AdmissionPanel,
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  useSelf,
36
36
  useSpaceClient,
37
37
  useWhiteboard
38
- } from "./chunk-DDIM65MJ.js";
38
+ } from "./chunk-XF5YWLFY.js";
39
39
  import "./chunk-ZEZLA34O.js";
40
40
  export {
41
41
  COSMIC_CHALK_THEME,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q9labsai/chalk-react",
3
- "version": "4.1.4",
3
+ "version": "4.1.5",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,10 +61,10 @@
61
61
  "@base-ui/react": "^1.7.0",
62
62
  "@hugeicons/core-free-icons": "^4.2.3",
63
63
  "@hugeicons/react": "^1.1.9",
64
- "@q9labsai/chalk-client": "^4.1.4",
65
- "@q9labsai/chalk-ui": "^4.1.4",
66
- "@q9labsai/chalk-whiteboard": "^4.1.4",
67
- "@q9labsai/facehash": "^4.1.4",
64
+ "@q9labsai/chalk-client": "^4.1.5",
65
+ "@q9labsai/chalk-ui": "^4.1.5",
66
+ "@q9labsai/chalk-whiteboard": "^4.1.5",
67
+ "@q9labsai/facehash": "^4.1.5",
68
68
  "class-variance-authority": "^0.7.1",
69
69
  "clsx": "^2.1.1",
70
70
  "sonner": "^2.0.8",