@dxos/shell 0.4.10-main.f68a1ca → 0.4.10-main.f937af6

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.
Files changed (152) hide show
  1. package/dist/bundle/index-Cms4wG79.mjs +110 -0
  2. package/dist/bundle/index-Cms4wG79.mjs.map +1 -0
  3. package/dist/bundle/index-DACjPI-n.mjs +96625 -0
  4. package/dist/bundle/index-DACjPI-n.mjs.map +1 -0
  5. package/dist/bundle/shell.mjs +9 -81099
  6. package/dist/bundle/shell.mjs.map +1 -1
  7. package/dist/bundle/shell.umd.js +156 -88
  8. package/dist/bundle/shell.umd.js.map +1 -1
  9. package/dist/bundle/style.css +1 -1
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/react.mjs +866 -824
  12. package/dist/lib/browser/react.mjs.map +4 -4
  13. package/dist/lib/browser/testing/index.mjs +10 -9
  14. package/dist/lib/browser/testing/index.mjs.map +3 -3
  15. package/dist/types/src/components/AgentConfig.d.ts +3 -0
  16. package/dist/types/src/components/AgentConfig.d.ts.map +1 -0
  17. package/dist/types/src/components/AgentConfig.js +37 -0
  18. package/dist/types/src/components/AgentConfig.js.map +1 -0
  19. package/dist/types/src/components/DeviceList/DeviceList.d.ts +3 -0
  20. package/dist/types/src/components/DeviceList/DeviceList.d.ts.map +1 -0
  21. package/dist/types/src/components/DeviceList/DeviceList.js +29 -0
  22. package/dist/types/src/components/DeviceList/DeviceList.js.map +1 -0
  23. package/dist/types/src/components/DeviceList/DeviceListItem.d.ts +6 -0
  24. package/dist/types/src/components/DeviceList/DeviceListItem.d.ts.map +1 -0
  25. package/dist/types/src/components/DeviceList/DeviceListItem.js +72 -0
  26. package/dist/types/src/components/DeviceList/DeviceListItem.js.map +1 -0
  27. package/dist/types/src/components/DeviceList/DeviceListProps.d.ts +27 -0
  28. package/dist/types/src/components/DeviceList/DeviceListProps.d.ts.map +1 -0
  29. package/dist/types/src/components/DeviceList/DeviceListProps.js +6 -0
  30. package/dist/types/src/components/DeviceList/DeviceListProps.js.map +1 -0
  31. package/dist/types/src/components/DeviceList/index.d.ts +3 -0
  32. package/dist/types/src/components/DeviceList/index.d.ts.map +1 -0
  33. package/dist/types/src/components/DeviceList/index.js +22 -0
  34. package/dist/types/src/components/DeviceList/index.js.map +1 -0
  35. package/dist/types/src/components/EmojiPicker.d.ts +9 -2
  36. package/dist/types/src/components/EmojiPicker.d.ts.map +1 -1
  37. package/dist/types/src/components/EmojiPicker.js +57 -3
  38. package/dist/types/src/components/EmojiPicker.js.map +1 -1
  39. package/dist/types/src/components/HuePicker.d.ts +9 -2
  40. package/dist/types/src/components/HuePicker.d.ts.map +1 -1
  41. package/dist/types/src/components/HuePicker.js +75 -6
  42. package/dist/types/src/components/HuePicker.js.map +1 -1
  43. package/dist/types/src/components/IdentityList/index.d.ts +0 -1
  44. package/dist/types/src/components/IdentityList/index.d.ts.map +1 -1
  45. package/dist/types/src/components/IdentityList/index.js +0 -1
  46. package/dist/types/src/components/IdentityList/index.js.map +1 -1
  47. package/dist/types/src/components/InvitationList/InvitationListItem.js +5 -5
  48. package/dist/types/src/components/InvitationList/InvitationListItem.js.map +1 -1
  49. package/dist/types/src/components/Panel/Action.d.ts +2 -2
  50. package/dist/types/src/components/Viewport/Viewport.d.ts +1 -1
  51. package/dist/types/src/components/index.d.ts +2 -0
  52. package/dist/types/src/components/index.d.ts.map +1 -1
  53. package/dist/types/src/components/index.js +2 -0
  54. package/dist/types/src/components/index.js.map +1 -1
  55. package/dist/types/src/composites/Shell/Shell.d.ts.map +1 -1
  56. package/dist/types/src/composites/Shell/Shell.js +1 -5
  57. package/dist/types/src/composites/Shell/Shell.js.map +1 -1
  58. package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
  59. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +80 -40
  60. package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
  61. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts +0 -3
  62. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.d.ts.map +1 -1
  63. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js +1 -43
  64. package/dist/types/src/panels/IdentityPanel/IdentityPanel.stories.js.map +1 -1
  65. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +8 -11
  66. package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
  67. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts +1 -1
  68. package/dist/types/src/panels/IdentityPanel/identityMachine.d.ts.map +1 -1
  69. package/dist/types/src/panels/IdentityPanel/identityMachine.js +0 -24
  70. package/dist/types/src/panels/IdentityPanel/identityMachine.js.map +1 -1
  71. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +4 -4
  72. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
  73. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +9 -43
  74. package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
  75. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts +1 -1
  76. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.d.ts.map +1 -1
  77. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js +2 -2
  78. package/dist/types/src/panels/IdentityPanel/steps/ProfileForm.js.map +1 -1
  79. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts +0 -2
  80. package/dist/types/src/panels/IdentityPanel/steps/index.d.ts.map +1 -1
  81. package/dist/types/src/panels/IdentityPanel/steps/index.js +0 -2
  82. package/dist/types/src/panels/IdentityPanel/steps/index.js.map +1 -1
  83. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
  84. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +5 -1
  85. package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
  86. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.d.ts.map +1 -1
  87. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js +3 -1
  88. package/dist/types/src/panels/SpacePanel/steps/SpaceManager.js.map +1 -1
  89. package/dist/types/src/playwright/invitations.spec.js +3 -1
  90. package/dist/types/src/playwright/invitations.spec.js.map +1 -1
  91. package/dist/types/src/steps/ConfirmReset.d.ts.map +1 -1
  92. package/dist/types/src/steps/ConfirmReset.js +4 -3
  93. package/dist/types/src/steps/ConfirmReset.js.map +1 -1
  94. package/dist/types/src/steps/InvitationManager.d.ts +1 -1
  95. package/dist/types/src/steps/InvitationManager.d.ts.map +1 -1
  96. package/dist/types/src/steps/InvitationManager.js +3 -4
  97. package/dist/types/src/steps/InvitationManager.js.map +1 -1
  98. package/dist/types/src/stories/Invitations.e2e-stories.d.ts.map +1 -1
  99. package/dist/types/src/stories/Invitations.e2e-stories.js +5 -2
  100. package/dist/types/src/stories/Invitations.e2e-stories.js.map +1 -1
  101. package/dist/types/src/testing/shell-manager.d.ts.map +1 -1
  102. package/dist/types/src/testing/shell-manager.js +10 -9
  103. package/dist/types/src/testing/shell-manager.js.map +1 -1
  104. package/dist/types/src/translations/locales/en-US.d.ts +12 -2
  105. package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
  106. package/dist/types/src/translations/locales/en-US.js +12 -2
  107. package/dist/types/src/translations/locales/en-US.js.map +1 -1
  108. package/dist/types/src/types/index.js +1 -0
  109. package/dist/types/src/types/index.js.map +1 -1
  110. package/package.json +22 -21
  111. package/src/components/AgentConfig.tsx +66 -0
  112. package/src/components/DeviceList/DeviceList.tsx +54 -0
  113. package/src/components/DeviceList/DeviceListItem.tsx +120 -0
  114. package/src/components/DeviceList/DeviceListProps.ts +33 -0
  115. package/src/components/DeviceList/index.ts +6 -0
  116. package/src/components/EmojiPicker.tsx +101 -4
  117. package/src/components/HuePicker.tsx +99 -5
  118. package/src/components/IdentityList/index.ts +0 -1
  119. package/src/components/InvitationList/InvitationListItem.tsx +5 -5
  120. package/src/components/index.ts +2 -0
  121. package/src/composites/Shell/Shell.tsx +1 -7
  122. package/src/panels/IdentityPanel/IdentityPanel.stories.tsx +0 -63
  123. package/src/panels/IdentityPanel/IdentityPanel.tsx +123 -34
  124. package/src/panels/IdentityPanel/IdentityPanelProps.ts +10 -14
  125. package/src/panels/IdentityPanel/identityMachine.ts +1 -31
  126. package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +23 -76
  127. package/src/panels/IdentityPanel/steps/ProfileForm.tsx +12 -4
  128. package/src/panels/IdentityPanel/steps/index.ts +0 -2
  129. package/src/panels/IdentityPanel/useAgentHandlers.ts +5 -1
  130. package/src/panels/SpacePanel/steps/SpaceManager.tsx +3 -1
  131. package/src/playwright/invitations.spec.ts +3 -1
  132. package/src/steps/ConfirmReset.tsx +4 -3
  133. package/src/steps/InvitationManager.tsx +4 -4
  134. package/src/stories/Invitations.e2e-stories.tsx +6 -3
  135. package/src/testing/shell-manager.ts +10 -9
  136. package/src/translations/locales/en-US.ts +13 -2
  137. package/src/types/index.ts +2 -0
  138. package/dist/types/src/components/IdentityList/DeviceList.d.ts +0 -7
  139. package/dist/types/src/components/IdentityList/DeviceList.d.ts.map +0 -1
  140. package/dist/types/src/components/IdentityList/DeviceList.js +0 -34
  141. package/dist/types/src/components/IdentityList/DeviceList.js.map +0 -1
  142. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts +0 -3
  143. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.d.ts.map +0 -1
  144. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js +0 -26
  145. package/dist/types/src/panels/IdentityPanel/steps/AgentForm.js.map +0 -1
  146. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts +0 -10
  147. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.d.ts.map +0 -1
  148. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js +0 -23
  149. package/dist/types/src/panels/IdentityPanel/steps/DeviceManager.js.map +0 -1
  150. package/src/components/IdentityList/DeviceList.tsx +0 -49
  151. package/src/panels/IdentityPanel/steps/AgentForm.tsx +0 -61
  152. package/src/panels/IdentityPanel/steps/DeviceManager.tsx +0 -41
@@ -139,16 +139,16 @@ var ShellManager = class extends ScopedShellManager {
139
139
  }
140
140
  };
141
141
  this.page.on("dialog", handleDialog);
142
- await this.shell.getByTestId("devices-panel.sign-out").click();
143
- await this.shell.getByTestId("sign-out.reset-device").click();
144
- this.page.off("dialog", handleDialog);
142
+ await this.shell.getByTestId("device-list-item-current.options").click();
143
+ await this.shell.getByTestId("device-list-item-current.reset").click();
144
+ await this.shell.getByTestId("reset-storage.reset-identity-input").fill("CONFIRM");
145
+ await this.shell.getByTestId("reset-storage.reset-identity-confirm").click();
145
146
  }
146
147
  async joinNewIdentity(invitationCode) {
147
- await this.shell.getByTestId("devices-panel.sign-out").click();
148
- await this.shell.getByTestId("sign-out.join-new-identity").click();
149
- await this.shell.getByTestId("reset-identity-input").fill("CONFIRM");
150
- await this.shell.getByTestId("reset-identity-input-confirm").click();
151
- await this.shell.getByTestId("identity-chooser.join-identity").click();
148
+ await this.shell.getByTestId("device-list-item-current.options").click();
149
+ await this.shell.getByTestId("device-list-item-current.join-existing").click();
150
+ await this.shell.getByTestId("join-new-identity.reset-identity-input").fill("CONFIRM");
151
+ await this.shell.getByTestId("join-new-identity.reset-identity-confirm").click();
152
152
  await this.inputInvitation("device", invitationCode, this.shell);
153
153
  }
154
154
  async authenticateDevice(authCode, skipDone = true) {
@@ -180,7 +180,8 @@ var ShellManager = class extends ScopedShellManager {
180
180
  }
181
181
  async _onConsoleMessage(message) {
182
182
  try {
183
- const json = JSON.parse(message.text());
183
+ const text = message.text();
184
+ const json = JSON.parse(text.slice(text.indexOf("{")));
184
185
  if (json.invitationCode) {
185
186
  this._invitationCode.wake(json.invitationCode);
186
187
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/testing/fixtures/identities.ts", "../../../../src/testing/fixtures/invitations.ts", "../../../../src/testing/scoped-shell-manager.ts", "../../../../src/testing/shell-manager.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/react-client';\nimport { SpaceMember } from '@dxos/react-client/echo';\n\nexport const alice: SpaceMember = {\n identity: {\n identityKey: PublicKey.random(),\n profile: {\n displayName: 'Alice',\n },\n },\n presence: SpaceMember.PresenceState.ONLINE,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/react-client';\nimport { Invitation, CancellableInvitationObservable } from '@dxos/react-client/invitations';\n\nexport const inviteWithState = (state: Invitation.State) =>\n new CancellableInvitationObservable({\n initialInvitation: {\n state,\n invitationId: Math.random().toString(16).slice(2),\n kind: Invitation.Kind.SPACE,\n authMethod: Invitation.AuthMethod.NONE,\n swarmKey: PublicKey.random(),\n type: Invitation.Type.INTERACTIVE,\n authCode: [Invitation.State.READY_FOR_AUTHENTICATION, Invitation.State.AUTHENTICATING].includes(state)\n ? '123456'\n : '',\n },\n subscriber: () => {},\n onCancel: async () => {},\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Locator, Page, FrameLocator } from '@playwright/test';\n\ntype Scope = Locator | FrameLocator | Page;\n\nexport class ScopedShellManager {\n page!: Page;\n\n authenticatorIsVisible(type: 'device' | 'space', scope?: Scope) {\n return (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).isVisible();\n }\n\n async invitationFailed(scope?: Scope, timeout = 3000) {\n const peer = scope || this.page;\n try {\n await peer.locator('[data-testid=invitation-rescuer-reset]:not([disabled])').waitFor({ timeout });\n return true;\n } catch {\n return false;\n }\n }\n\n async inputInvitation(type: 'device' | 'space', invitation: string, scope?: Scope) {\n await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input`).fill(invitation);\n await this.page.keyboard.press('Enter');\n }\n\n async invitationInputContinue(type: 'device' | 'space', scope?: Scope) {\n await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input-continue`).click();\n }\n\n async cancelInvitation(type: 'device' | 'space', kind: 'host' | 'guest', scope?: Scope) {\n if (kind === 'guest') {\n await (scope || this.page)\n .getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-cancel`)\n .click();\n } else {\n await (scope || this.page).getByTestId('cancel-invitation').nth(0).click();\n }\n }\n\n async readyToAuthenticate(type: 'device' | 'space', scope?: Scope, timeout = 3000) {\n const peer = scope || this.page;\n try {\n await peer\n .locator(`[data-testid=${type === 'device' ? 'halo' : 'space'}-auth-code-input]:not([disabled])`)\n .waitFor({ timeout });\n return true;\n } catch {\n return false;\n }\n }\n\n async authenticateInvitation(type: 'device' | 'space', authCode: string, scope?: Scope) {\n const peer = scope || this.page;\n // TODO(wittjosiah): Update ids.\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill(authCode);\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-next`).click();\n }\n\n async clearAuthCode(type: 'device' | 'space', scope?: Scope) {\n const peer = scope || this.page;\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill('');\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).focus();\n }\n\n async resetInvitation(scope?: Scope) {\n await (scope || this.page).getByTestId('invitation-rescuer-reset').click();\n }\n\n async doneInvitation(type: 'device' | 'space', scope?: Scope) {\n await (scope || this.page)\n .getByTestId(type === 'device' ? 'halo-invitation-accepted-done' : 'space-invitation-accepted-done')\n .click();\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { ConsoleMessage, Dialog, Page } from '@playwright/test';\n\nimport { sleep, Trigger } from '@dxos/async';\n\nimport { ScopedShellManager } from './scoped-shell-manager';\n\n// TODO(wittjosiah): Normalize data-testids between snake and camel case.\n\nexport class ShellManager extends ScopedShellManager {\n private _invitationCode = new Trigger<string>();\n private _authCode = new Trigger<string>();\n\n // prettier-ignore\n constructor(\n override readonly page: Page,\n readonly inIFrame = true,\n ) {\n super();\n this.page.on('console', (message) => this._onConsoleMessage(message));\n }\n\n get shell() {\n return this.inIFrame ? this.page.frameLocator('data-testid=dxos-shell') : this.page;\n }\n\n // Getters\n\n async getDisplayName(): Promise<string | null> {\n return this.shell.getByTestId('identityHeading.displayName').textContent();\n }\n\n async isCurrentSpaceViewVisible(): Promise<boolean> {\n return await this.shell.getByTestId('current-space-view').isVisible();\n }\n\n async isSpaceListViewVisible(): Promise<boolean> {\n return await this.shell.getByTestId('space-list-view').isVisible();\n }\n\n // Actions\n\n async createIdentity(name: string) {\n await this.shell.getByTestId('create-identity').click();\n await this.page.keyboard.type(name);\n await this.shell.getByTestId('create-identity-input-continue').click();\n await this.shell.getByTestId('halo-invitation-accepted-done').click();\n }\n\n async createDeviceInvitation(): Promise<string> {\n this._invitationCode = new Trigger<string>();\n this._authCode = new Trigger<string>();\n await this.shell.getByTestId('devices-panel.create-invitation').click();\n return await this._invitationCode.wait();\n }\n\n async resetDevice() {\n const handleDialog = async (dialog: Dialog) => {\n if (dialog.type() === 'confirm') {\n await dialog.accept();\n }\n };\n\n this.page.on('dialog', handleDialog);\n await this.shell.getByTestId('devices-panel.sign-out').click();\n await this.shell.getByTestId('sign-out.reset-device').click();\n this.page.off('dialog', handleDialog);\n }\n\n async joinNewIdentity(invitationCode: string) {\n await this.shell.getByTestId('devices-panel.sign-out').click();\n await this.shell.getByTestId('sign-out.join-new-identity').click();\n await this.shell.getByTestId('reset-identity-input').fill('CONFIRM');\n await this.shell.getByTestId('reset-identity-input-confirm').click();\n await this.shell.getByTestId('identity-chooser.join-identity').click();\n await this.inputInvitation('device', invitationCode, this.shell);\n }\n\n async authenticateDevice(authCode: string, skipDone = true) {\n // Wait for focus to shift before typing.\n await sleep(1500);\n await this.authenticateInvitation('device', authCode, this.shell);\n // TODO(wittjosiah): When \"signing out\" and joinging a new identity, the done step seems to be skipped.\n if (!skipDone) {\n await this.doneInvitation('device', this.shell);\n }\n }\n\n async closeShell() {\n await this.page.keyboard.press('Escape');\n }\n\n async createSpaceInvitation(): Promise<string> {\n this._invitationCode = new Trigger<string>();\n this._authCode = new Trigger<string>();\n await this.shell.getByTestId('spaces-panel.create-invitation').click();\n return await this._invitationCode.wait();\n }\n\n async acceptSpaceInvitation(invitationCode: string) {\n await this.inputInvitation('space', invitationCode, this.shell);\n }\n\n async getAuthCode(): Promise<string> {\n return await this._authCode.wait();\n }\n\n async authenticate(authCode: string) {\n // Wait for focus to shift before typing.\n await sleep(1500);\n await this.authenticateInvitation('space', authCode, this.shell);\n await this.doneInvitation('space', this.shell);\n }\n\n private async _onConsoleMessage(message: ConsoleMessage) {\n try {\n const json = JSON.parse(message.text());\n if (json.invitationCode) {\n this._invitationCode.wake(json.invitationCode);\n }\n if (json.authCode) {\n this._authCode.wake(json.authCode);\n }\n } catch {}\n }\n}\n"],
5
- "mappings": ";;;AAIA,SAASA,iBAAiB;AAC1B,SAASC,mBAAmB;AAErB,IAAMC,QAAqB;EAChCC,UAAU;IACRC,aAAaC,UAAUC,OAAM;IAC7BC,SAAS;MACPC,aAAa;IACf;EACF;EACAC,UAAUC,YAAYC,cAAcC;AACtC;;;ACXA,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,YAAYC,uCAAuC;AAErD,IAAMC,kBAAkB,CAACC,UAC9B,IAAIC,gCAAgC;EAClCC,mBAAmB;IACjBF;IACAG,cAAcC,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,MAAM,CAAA;IAC/CC,MAAMC,WAAWC,KAAKC;IACtBC,YAAYH,WAAWI,WAAWC;IAClCC,UAAUC,WAAUX,OAAM;IAC1BY,MAAMR,WAAWS,KAAKC;IACtBC,UAAU;MAACX,WAAWY,MAAMC;MAA0Bb,WAAWY,MAAME;MAAgBC,SAASxB,KAAAA,IAC5F,WACA;EACN;EACAyB,YAAY,MAAA;EAAO;EACnBC,U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random", "profile", "displayName", "presence", "SpaceMember", "PresenceState", "ONLINE", "PublicKey", "Invitation", "CancellableInvitationObservable", "inviteWithState", "state", "CancellableInvitationObservable", "initialInvitation", "invitationId", "Math", "random", "toString", "slice", "kind", "Invitation", "Kind", "SPACE", "authMethod", "AuthMethod", "NONE", "swarmKey", "PublicKey", "type", "Type", "INTERACTIVE", "authCode", "State", "READY_FOR_AUTHENTICATION", "AUTHENTICATING", "includes", "subscriber", "onCancel", "ScopedShellManager", "authenticatorIsVisible", "type", "scope", "page", "getByTestId", "isVisible", "invitationFailed", "timeout", "peer", "locator", "waitFor", "inputInvitation", "invitation", "fill", "keyboard", "press", "invitationInputContinue", "click", "cancelInvitation", "kind", "nth", "readyToAuthenticate", "authenticateInvitation", "authCode", "clearAuthCode", "focus", "resetInvitation", "doneInvitation", "sleep", "Trigger", "ShellManager", "ScopedShellManager", "constructor", "page", "inIFrame", "_invitationCode", "Trigger", "_authCode", "on", "message", "_onConsoleMessage", "shell", "frameLocator", "getDisplayName", "getByTestId", "textContent", "isCurrentSpaceViewVisible", "isVisible", "isSpaceListViewVisible", "createIdentity", "name", "click", "keyboard", "type", "createDeviceInvitation", "wait", "resetDevice", "handleDialog", "dialog", "accept", "off", "joinNewIdentity", "invitationCode", "fill", "inputInvitation", "authenticateDevice", "authCode", "skipDone", "sleep", "authenticateInvitation", "doneInvitation", "closeShell", "press", "createSpaceInvitation", "acceptSpaceInvitation", "getAuthCode", "authenticate", "json", "JSON", "parse", "text", "wake"]
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/react-client';\nimport { SpaceMember } from '@dxos/react-client/echo';\n\nexport const alice: SpaceMember = {\n identity: {\n identityKey: PublicKey.random(),\n profile: {\n displayName: 'Alice',\n },\n },\n presence: SpaceMember.PresenceState.ONLINE,\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { PublicKey } from '@dxos/react-client';\nimport { Invitation, CancellableInvitationObservable } from '@dxos/react-client/invitations';\n\nexport const inviteWithState = (state: Invitation.State) =>\n new CancellableInvitationObservable({\n initialInvitation: {\n state,\n invitationId: Math.random().toString(16).slice(2),\n kind: Invitation.Kind.SPACE,\n authMethod: Invitation.AuthMethod.NONE,\n swarmKey: PublicKey.random(),\n type: Invitation.Type.INTERACTIVE,\n authCode: [Invitation.State.READY_FOR_AUTHENTICATION, Invitation.State.AUTHENTICATING].includes(state)\n ? '123456'\n : '',\n },\n subscriber: () => {},\n onCancel: async () => {},\n });\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { Locator, Page, FrameLocator } from '@playwright/test';\n\ntype Scope = Locator | FrameLocator | Page;\n\nexport class ScopedShellManager {\n page!: Page;\n\n authenticatorIsVisible(type: 'device' | 'space', scope?: Scope) {\n return (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).isVisible();\n }\n\n async invitationFailed(scope?: Scope, timeout = 3000) {\n const peer = scope || this.page;\n try {\n await peer.locator('[data-testid=invitation-rescuer-reset]:not([disabled])').waitFor({ timeout });\n return true;\n } catch {\n return false;\n }\n }\n\n async inputInvitation(type: 'device' | 'space', invitation: string, scope?: Scope) {\n await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input`).fill(invitation);\n await this.page.keyboard.press('Enter');\n }\n\n async invitationInputContinue(type: 'device' | 'space', scope?: Scope) {\n await (scope || this.page).getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-input-continue`).click();\n }\n\n async cancelInvitation(type: 'device' | 'space', kind: 'host' | 'guest', scope?: Scope) {\n if (kind === 'guest') {\n await (scope || this.page)\n .getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-cancel`)\n .click();\n } else {\n await (scope || this.page).getByTestId('cancel-invitation').nth(0).click();\n }\n }\n\n async readyToAuthenticate(type: 'device' | 'space', scope?: Scope, timeout = 3000) {\n const peer = scope || this.page;\n try {\n await peer\n .locator(`[data-testid=${type === 'device' ? 'halo' : 'space'}-auth-code-input]:not([disabled])`)\n .waitFor({ timeout });\n return true;\n } catch {\n return false;\n }\n }\n\n async authenticateInvitation(type: 'device' | 'space', authCode: string, scope?: Scope) {\n const peer = scope || this.page;\n // TODO(wittjosiah): Update ids.\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill(authCode);\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-invitation-authenticator-next`).click();\n }\n\n async clearAuthCode(type: 'device' | 'space', scope?: Scope) {\n const peer = scope || this.page;\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).fill('');\n await peer.getByTestId(`${type === 'device' ? 'halo' : 'space'}-auth-code-input`).focus();\n }\n\n async resetInvitation(scope?: Scope) {\n await (scope || this.page).getByTestId('invitation-rescuer-reset').click();\n }\n\n async doneInvitation(type: 'device' | 'space', scope?: Scope) {\n await (scope || this.page)\n .getByTestId(type === 'device' ? 'halo-invitation-accepted-done' : 'space-invitation-accepted-done')\n .click();\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { ConsoleMessage, Dialog, Page } from '@playwright/test';\n\nimport { sleep, Trigger } from '@dxos/async';\n\nimport { ScopedShellManager } from './scoped-shell-manager';\n\n// TODO(wittjosiah): Normalize data-testids between snake and camel case.\n\nexport class ShellManager extends ScopedShellManager {\n private _invitationCode = new Trigger<string>();\n private _authCode = new Trigger<string>();\n\n // prettier-ignore\n constructor(\n override readonly page: Page,\n readonly inIFrame = true,\n ) {\n super();\n this.page.on('console', (message) => this._onConsoleMessage(message));\n }\n\n get shell() {\n return this.inIFrame ? this.page.frameLocator('data-testid=dxos-shell') : this.page;\n }\n\n // Getters\n\n async getDisplayName(): Promise<string | null> {\n return this.shell.getByTestId('identityHeading.displayName').textContent();\n }\n\n async isCurrentSpaceViewVisible(): Promise<boolean> {\n return await this.shell.getByTestId('current-space-view').isVisible();\n }\n\n async isSpaceListViewVisible(): Promise<boolean> {\n return await this.shell.getByTestId('space-list-view').isVisible();\n }\n\n // Actions\n\n async createIdentity(name: string) {\n await this.shell.getByTestId('create-identity').click();\n await this.page.keyboard.type(name);\n await this.shell.getByTestId('create-identity-input-continue').click();\n await this.shell.getByTestId('halo-invitation-accepted-done').click();\n }\n\n async createDeviceInvitation(): Promise<string> {\n this._invitationCode = new Trigger<string>();\n this._authCode = new Trigger<string>();\n await this.shell.getByTestId('devices-panel.create-invitation').click();\n return await this._invitationCode.wait();\n }\n\n async resetDevice() {\n const handleDialog = async (dialog: Dialog) => {\n if (dialog.type() === 'confirm') {\n await dialog.accept();\n }\n };\n\n this.page.on('dialog', handleDialog);\n await this.shell.getByTestId('device-list-item-current.options').click();\n await this.shell.getByTestId('device-list-item-current.reset').click();\n await this.shell.getByTestId('reset-storage.reset-identity-input').fill('CONFIRM');\n await this.shell.getByTestId('reset-storage.reset-identity-confirm').click();\n }\n\n async joinNewIdentity(invitationCode: string) {\n await this.shell.getByTestId('device-list-item-current.options').click();\n await this.shell.getByTestId('device-list-item-current.join-existing').click();\n await this.shell.getByTestId('join-new-identity.reset-identity-input').fill('CONFIRM');\n await this.shell.getByTestId('join-new-identity.reset-identity-confirm').click();\n await this.inputInvitation('device', invitationCode, this.shell);\n }\n\n async authenticateDevice(authCode: string, skipDone = true) {\n // Wait for focus to shift before typing.\n await sleep(1500);\n await this.authenticateInvitation('device', authCode, this.shell);\n // TODO(wittjosiah): When \"signing out\" and joinging a new identity, the done step seems to be skipped.\n if (!skipDone) {\n await this.doneInvitation('device', this.shell);\n }\n }\n\n async closeShell() {\n await this.page.keyboard.press('Escape');\n }\n\n async createSpaceInvitation(): Promise<string> {\n this._invitationCode = new Trigger<string>();\n this._authCode = new Trigger<string>();\n await this.shell.getByTestId('spaces-panel.create-invitation').click();\n return await this._invitationCode.wait();\n }\n\n async acceptSpaceInvitation(invitationCode: string) {\n await this.inputInvitation('space', invitationCode, this.shell);\n }\n\n async getAuthCode(): Promise<string> {\n return await this._authCode.wait();\n }\n\n async authenticate(authCode: string) {\n // Wait for focus to shift before typing.\n await sleep(1500);\n await this.authenticateInvitation('space', authCode, this.shell);\n await this.doneInvitation('space', this.shell);\n }\n\n private async _onConsoleMessage(message: ConsoleMessage) {\n try {\n const text = message.text();\n const json = JSON.parse(text.slice(text.indexOf('{')));\n if (json.invitationCode) {\n this._invitationCode.wake(json.invitationCode);\n }\n if (json.authCode) {\n this._authCode.wake(json.authCode);\n }\n } catch {}\n }\n}\n"],
5
+ "mappings": ";;;AAIA,SAASA,iBAAiB;AAC1B,SAASC,mBAAmB;AAErB,IAAMC,QAAqB;EAChCC,UAAU;IACRC,aAAaC,UAAUC,OAAM;IAC7BC,SAAS;MACPC,aAAa;IACf;EACF;EACAC,UAAUC,YAAYC,cAAcC;AACtC;;;ACXA,SAASC,aAAAA,kBAAiB;AAC1B,SAASC,YAAYC,uCAAuC;AAErD,IAAMC,kBAAkB,CAACC,UAC9B,IAAIC,gCAAgC;EAClCC,mBAAmB;IACjBF;IACAG,cAAcC,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,MAAM,CAAA;IAC/CC,MAAMC,WAAWC,KAAKC;IACtBC,YAAYH,WAAWI,WAAWC;IAClCC,UAAUC,WAAUX,OAAM;IAC1BY,MAAMR,WAAWS,KAAKC;IACtBC,UAAU;MAACX,WAAWY,MAAMC;MAA0Bb,WAAWY,MAAME;MAAgBC,SAASxB,KAAAA,IAC5F,WACA;EACN;EACAyB,YAAY,MAAA;EAAO;EACnBC,UAAU,YAAA;EAAa;AACzB,CAAA;;;ACdK,IAAMC,qBAAN,MAAMA;EAGXC,uBAAuBC,MAA0BC,OAAe;AAC9D,YAAQA,SAAS,KAAKC,MAAMC,YAAY,GAAGH,SAAS,WAAW,SAAS,OAAA,kBAAyB,EAAEI,UAAS;EAC9G;EAEA,MAAMC,iBAAiBJ,OAAeK,UAAU,KAAM;AACpD,UAAMC,OAAON,SAAS,KAAKC;AAC3B,QAAI;AACF,YAAMK,KAAKC,QAAQ,wDAAA,EAA0D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,aAAa;AACjB,UAAM,KAAKrC,KAAKmB,SAASmB,MAAM,QAAA;EACjC;EAEA,MAAMC,wBAAyC;AAC7C,SAAKrC,kBAAkB,IAAIC,QAAAA;AAC3B,SAAKC,YAAY,IAAID,QAAAA;AACrB,UAAM,KAAKK,MAAMG,YAAY,gCAAA,EAAkCO,MAAK;AACpE,WAAO,MAAM,KAAKhB,gBAAgBoB,KAAI;EACxC;EAEA,MAAMkB,sBAAsBX,gBAAwB;AAClD,UAAM,KAAKC,gBAAgB,SAASD,gBAAgB,KAAKrB,KAAK;EAChE;EAEA,MAAMiC,cAA+B;AACnC,WAAO,MAAM,KAAKrC,UAAUkB,KAAI;EAClC;EAEA,MAAMoB,aAAaV,UAAkB;AAEnC,UAAME,MAAM,IAAA;AACZ,UAAM,KAAKC,uBAAuB,SAASH,UAAU,KAAKxB,KAAK;AAC/D,UAAM,KAAK4B,eAAe,SAAS,KAAK5B,KAAK;EAC/C;EAEA,MAAcD,kBAAkBD,SAAyB;AACvD,QAAI;AACF,YAAMqC,OAAOrC,QAAQqC,KAAI;AACzB,YAAMC,OAAOC,KAAKC,MAAMH,KAAKI,MAAMJ,KAAKK,QAAQ,GAAA,CAAA,CAAA;AAChD,UAAIJ,KAAKf,gBAAgB;AACvB,aAAK3B,gBAAgB+C,KAAKL,KAAKf,cAAc;MAC/C;AACA,UAAIe,KAAKZ,UAAU;AACjB,aAAK5B,UAAU6C,KAAKL,KAAKZ,QAAQ;MACnC;IACF,QAAQ;IAAC;EACX;AACF;",
6
+ "names": ["PublicKey", "SpaceMember", "alice", "identity", "identityKey", "PublicKey", "random", "profile", "displayName", "presence", "SpaceMember", "PresenceState", "ONLINE", "PublicKey", "Invitation", "CancellableInvitationObservable", "inviteWithState", "state", "CancellableInvitationObservable", "initialInvitation", "invitationId", "Math", "random", "toString", "slice", "kind", "Invitation", "Kind", "SPACE", "authMethod", "AuthMethod", "NONE", "swarmKey", "PublicKey", "type", "Type", "INTERACTIVE", "authCode", "State", "READY_FOR_AUTHENTICATION", "AUTHENTICATING", "includes", "subscriber", "onCancel", "ScopedShellManager", "authenticatorIsVisible", "type", "scope", "page", "getByTestId", "isVisible", "invitationFailed", "timeout", "peer", "locator", "waitFor", "inputInvitation", "invitation", "fill", "keyboard", "press", "invitationInputContinue", "click", "cancelInvitation", "kind", "nth", "readyToAuthenticate", "authenticateInvitation", "authCode", "clearAuthCode", "focus", "resetInvitation", "doneInvitation", "sleep", "Trigger", "ShellManager", "ScopedShellManager", "constructor", "page", "inIFrame", "_invitationCode", "Trigger", "_authCode", "on", "message", "_onConsoleMessage", "shell", "frameLocator", "getDisplayName", "getByTestId", "textContent", "isCurrentSpaceViewVisible", "isVisible", "isSpaceListViewVisible", "createIdentity", "name", "click", "keyboard", "type", "createDeviceInvitation", "wait", "resetDevice", "handleDialog", "dialog", "accept", "fill", "joinNewIdentity", "invitationCode", "inputInvitation", "authenticateDevice", "authCode", "skipDone", "sleep", "authenticateInvitation", "doneInvitation", "closeShell", "press", "createSpaceInvitation", "acceptSpaceInvitation", "getAuthCode", "authenticate", "text", "json", "JSON", "parse", "slice", "indexOf", "wake"]
7
7
  }
@@ -0,0 +1,3 @@
1
+ import { type AgentFormProps } from './DeviceList';
2
+ export declare const AgentConfig: ({ agentActive, agentStatus, onAgentDestroy, onAgentCreate }: AgentFormProps) => JSX.Element;
3
+ //# sourceMappingURL=AgentConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentConfig.d.ts","sourceRoot":"","sources":["../../../../src/components/AgentConfig.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,WAAW,gEAAiE,cAAc,gBAqDtG,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2024 DXOS.org
4
+ //
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.AgentConfig = void 0;
10
+ const react_1 = require("@phosphor-icons/react");
11
+ const react_2 = __importDefault(require("react"));
12
+ const react_ui_1 = require("@dxos/react-ui");
13
+ const react_ui_theme_1 = require("@dxos/react-ui-theme");
14
+ const AgentConfig = ({ agentActive, agentStatus, onAgentDestroy, onAgentCreate }) => {
15
+ const { t } = (0, react_ui_1.useTranslation)('os');
16
+ return (react_2.default.createElement(react_2.default.Fragment, null,
17
+ react_2.default.createElement("h2", { className: (0, react_ui_theme_1.mx)(react_ui_theme_1.descriptionText, 'text-center mbs-4') }, t('agent heading')),
18
+ agentActive ? (react_2.default.createElement("div", { role: 'group', className: 'flex gap-2 items-center' },
19
+ react_2.default.createElement(react_ui_1.Avatar.Root, { status: agentStatus ? 'active' : 'inactive', variant: 'square' },
20
+ react_2.default.createElement(react_ui_1.Avatar.Frame, { classNames: 'place-self-center' },
21
+ react_2.default.createElement(react_1.Database, { weight: 'duotone', width: 24, height: 24, x: 8, y: 8 })),
22
+ react_2.default.createElement(react_ui_1.Avatar.Label, { classNames: 'flex-1 text-sm truncate' }, t('agent device label'))),
23
+ react_2.default.createElement(react_ui_1.Tooltip.Root, null,
24
+ react_2.default.createElement(react_ui_1.Tooltip.Trigger, { asChild: true },
25
+ react_2.default.createElement(react_ui_1.Button, { variant: 'ghost', classNames: 'pli-0 is-[--rail-action] bs-[--rail-action]', "data-testid": 'agent.destroy', onClick: onAgentDestroy },
26
+ react_2.default.createElement("span", { className: 'sr-only' }, t('destroy agent label')),
27
+ react_2.default.createElement(react_1.Power, { className: (0, react_ui_theme_1.getSize)(5) }))),
28
+ react_2.default.createElement(react_ui_1.Tooltip.Portal, null,
29
+ react_2.default.createElement(react_ui_1.Tooltip.Content, { side: 'bottom', classNames: 'z-50' }, t('destroy agent label')))))) : (react_2.default.createElement(react_2.default.Fragment, null,
30
+ react_2.default.createElement(react_ui_1.Button, { variant: 'ghost', classNames: 'mlb-2 is-full justify-start gap-2 !pis-0 !pie-3', "data-testid": 'devices-panel.create-agent', onClick: onAgentCreate, "aria-describedby": 'devices-panel.create-agent.description' },
31
+ react_2.default.createElement("div", { role: 'img', className: (0, react_ui_theme_1.mx)((0, react_ui_theme_1.getSize)(8), 'm-1 rounded-sm surface-input grid place-items-center') },
32
+ react_2.default.createElement(react_1.Plus, { weight: 'light', className: (0, react_ui_theme_1.getSize)(6) })),
33
+ react_2.default.createElement("span", { className: 'grow font-medium text-start' }, t('create agent label'))),
34
+ react_2.default.createElement("p", { id: 'devices-panel.create-agent.description', className: react_ui_theme_1.descriptionText }, t('agent message body'))))));
35
+ };
36
+ exports.AgentConfig = AgentConfig;
37
+ //# sourceMappingURL=AgentConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentConfig.js","sourceRoot":"","sources":["../../../../src/components/AgentConfig.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,iDAA8D;AAC9D,kDAA0B;AAE1B,6CAAyE;AACzE,yDAAoE;AAI7D,MAAM,WAAW,GAAG,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAkB,EAAE,EAAE;IACzG,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,OAAO,CACL;QACE,sCAAI,SAAS,EAAE,IAAA,mBAAE,EAAC,gCAAe,EAAE,mBAAmB,CAAC,IAAG,CAAC,CAAC,eAAe,CAAC,CAAM;QACjF,WAAW,CAAC,CAAC,CAAC,CACb,uCAAK,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,yBAAyB;YACnD,8BAAC,iBAAM,CAAC,IAAI,IAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,EAAE,OAAO,EAAC,QAAQ;gBACxE,8BAAC,iBAAM,CAAC,KAAK,IAAC,UAAU,EAAC,mBAAmB;oB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vE;YACT,qCAAG,EAAE,EAAC,wCAAwC,EAAC,SAAS,EAAE,gCAAe,IACtE,CAAC,CAAC,oBAAoB,CAAC,CACtB,CACH,CACJ,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,WAAW,eAqDtB"}
@@ -0,0 +1,3 @@
1
+ import { type DeviceListProps } from './DeviceListProps';
2
+ export declare const DeviceList: ({ devices, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, }: DeviceListProps) => JSX.Element;
3
+ //# sourceMappingURL=DeviceList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceList.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeviceList/DeviceList.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,eAAO,MAAM,UAAU,6EAMpB,eAAe,gBAiCjB,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 DXOS.org
4
+ //
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DeviceList = void 0;
10
+ const react_1 = require("@phosphor-icons/react");
11
+ const react_2 = __importDefault(require("react"));
12
+ const react_ui_1 = require("@dxos/react-ui");
13
+ const react_ui_theme_1 = require("@dxos/react-ui-theme");
14
+ const DeviceListItem_1 = require("./DeviceListItem");
15
+ const DeviceList = ({ devices, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, }) => {
16
+ const { t } = (0, react_ui_1.useTranslation)('os');
17
+ return (react_2.default.createElement(react_2.default.Fragment, null,
18
+ react_2.default.createElement("h2", { className: (0, react_ui_theme_1.mx)(react_ui_theme_1.descriptionText, 'text-center mbs-4') }, t('devices heading')),
19
+ devices.length > 0 && (react_2.default.createElement(react_ui_1.List, null, devices.map((device) => {
20
+ return (react_2.default.createElement(DeviceListItem_1.DeviceListItem, { key: device.deviceKey.toHex(), device: device, onClickEdit: () => onClickEdit === null || onClickEdit === void 0 ? void 0 : onClickEdit(device), onClickReset, onClickJoinExisting }));
21
+ }))),
22
+ react_2.default.createElement(react_ui_1.Button, { variant: 'ghost', classNames: 'justify-start gap-2 !pis-0 !pie-3', "data-testid": 'devices-panel.create-invitation', onClick: onClickAdd },
23
+ react_2.default.createElement("div", { role: 'img', className: (0, react_ui_theme_1.mx)((0, react_ui_theme_1.getSize)(8), 'm-1 rounded-sm surface-input grid place-items-center') },
24
+ react_2.default.createElement(react_1.Plus, { weight: 'light', className: (0, react_ui_theme_1.getSize)(6) })),
25
+ react_2.default.createElement("span", { className: 'grow font-medium text-start' }, t('choose add device label')),
26
+ react_2.default.createElement(react_1.CaretRight, { weight: 'bold', className: (0, react_ui_theme_1.getSize)(4) }))));
27
+ };
28
+ exports.DeviceList = DeviceList;
29
+ //# sourceMappingURL=DeviceList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceList.js","sourceRoot":"","sources":["../../../../../src/components/DeviceList/DeviceList.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,iDAAyD;AACzD,kDAA0B;AAG1B,6CAA8D;AAC9D,yDAAoE;AAEpE,qDAAkD;AAG3C,MAAM,UAAU,GAAG,CAAC,EACzB,OAAO,EACP,UAAU,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,GACH,EAAE,EAAE;IACpB,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,yBAAc,EAAC,IAAI,CAAC,CAAC;IACnC,OAAO,CACL;QACE,sCAAI,SAAS,EAAE,IAAA,mBAAE,EAAC,gCAAe,EAAE,mBAAmB,CAAC,IAAG,CAAC,CAAC,iBAAiB,CAAC,CAAM;QACnF,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,CACrB,8BAAC,eAAI,QACF,OAAO,CAAC,GAAG,CAAC,CAAC,MAAc,EAAE,EAAE;YAC9B,OAAO,CACL,8BAAC,+BAAc,IACb,GAAG,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAG,MAAM,CAAC,EAClC,YAAY,EAAE,mBAAmB,GACvC,CACH,CAAC;QACJ,CAAC,CAAC,CACG,CACR;QACD,8BAAC,iBAAM,IACL,OAAO,EAAC,OAAO,EACf,UAAU,EAAC,mCAAmC,iBAClC,iCAAiC,EAC7C,OAAO,EAAE,UAAU;YAEnB,uCAAK,IAAI,EAAC,KAAK,EAAC,SAAS,EAAE,IAAA,mBAAE,EAAC,IAAA,wBAAO,EAAC,CAAC,CAAC,EAAE,sDAAsD,CAAC;gBAC/F,8BAAC,YAAI,IAAC,MAAM,EAAC,OAAO,EAAC,SAAS,EAAE,IAAA,wBAAO,EAAC,CAAC,CAAC,GAAI,CAC1C;YACN,wCAAM,SAAS,EAAC,6BAA6B,IAAE,CAAC,CAAC,yBAAyB,CAAC,CAAQ;YACnF,8BAAC,kBAAU,IAAC,MAAM,EAAC,MAAM,EAAC,SAAS,EAAE,IAAA,wBAAO,EAAC,CAAC,CAAC,GAAI,CAC5C,CACR,CACJ,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,UAAU,cAuCrB"}
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { type DeviceListItemProps } from './DeviceListProps';
3
+ export declare const DeviceListItem: React.ForwardRefExoticComponent<Omit<Pick<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof React.LiHTMLAttributes<HTMLLIElement>>, "className"> & {
4
+ classNames?: import("@dxos/react-ui").ClassNameValue;
5
+ } & DeviceListItemProps & React.RefAttributes<HTMLLIElement>>;
6
+ //# sourceMappingURL=DeviceListItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceListItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeviceList/DeviceListItem.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAiBzE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAU7D,eAAO,MAAM,cAAc;;6DA6EzB,CAAC"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 DXOS.org
4
+ //
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.DeviceListItem = void 0;
30
+ const react_1 = require("@phosphor-icons/react");
31
+ const react_2 = __importStar(require("react"));
32
+ const display_name_1 = require("@dxos/display-name");
33
+ const halo_1 = require("@dxos/react-client/halo");
34
+ const react_ui_1 = require("@dxos/react-ui");
35
+ const react_ui_theme_1 = require("@dxos/react-ui-theme");
36
+ const util_1 = require("@dxos/util");
37
+ const iconProps = {
38
+ weight: 'duotone',
39
+ width: 24,
40
+ height: 24,
41
+ x: 8,
42
+ y: 8,
43
+ };
44
+ exports.DeviceListItem = (0, react_2.forwardRef)(({ device, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, classNames, ...props }, forwardedRef) => {
45
+ var _a;
46
+ const { t } = (0, react_ui_1.useTranslation)('os');
47
+ const fallbackValue = (0, util_1.keyToFallback)(device.deviceKey);
48
+ const labelId = (0, react_ui_1.useId)('identityListItem__label');
49
+ const displayName = device.profile
50
+ ? t('device name placeholder', { os: device.profile.os, platform: device.profile.platform })
51
+ : (0, display_name_1.generateName)(device.deviceKey.toHex());
52
+ const isCurrent = device.kind === halo_1.DeviceKind.CURRENT;
53
+ return (react_2.default.createElement(react_ui_1.ListItem.Root, { ...props, classNames: ['flex gap-2 items-center mlb-2', classNames], "data-testid": `device-list-item${isCurrent ? '-current' : ''}`, labelId: labelId, ref: forwardedRef },
54
+ react_2.default.createElement(react_ui_1.Avatar.Root, { status: device.presence === halo_1.Device.PresenceState.ONLINE ? 'active' : 'inactive', labelId: labelId, hue: fallbackValue.hue, variant: 'square' },
55
+ react_2.default.createElement(react_ui_1.Avatar.Frame, { classNames: 'place-self-center' }, ((_a = device.profile) === null || _a === void 0 ? void 0 : _a.type) ? (device.profile.type === halo_1.DeviceType.BROWSER ? (react_2.default.createElement(react_1.Compass, { ...iconProps })) : device.profile.type === halo_1.DeviceType.NATIVE ? (react_2.default.createElement(react_1.Desktop, { ...iconProps })) : [halo_1.DeviceType.AGENT, halo_1.DeviceType.AGENT_MANAGED].includes(device.profile.type) ? (react_2.default.createElement(react_1.Robot, { ...iconProps })) : device.profile.type === halo_1.DeviceType.MOBILE ? (react_2.default.createElement(react_1.DeviceMobile, { ...iconProps })) : (react_2.default.createElement(react_1.Devices, { ...iconProps }))) : (react_2.default.createElement(react_ui_1.Avatar.Fallback, { text: fallbackValue.emoji }))),
56
+ isCurrent && react_2.default.createElement(react_ui_1.Tag, { color: 'primary' }, t('current device tag label')),
57
+ react_2.default.createElement(react_ui_1.Avatar.Label, { classNames: 'flex-1 text-sm truncate' }, displayName),
58
+ device.kind === halo_1.DeviceKind.CURRENT && (react_2.default.createElement(react_ui_1.DropdownMenu.Root, null,
59
+ react_2.default.createElement(react_ui_1.DropdownMenu.Trigger, { asChild: true },
60
+ react_2.default.createElement(react_ui_1.Button, { variant: 'ghost', classNames: 'pli-0 is-[--rail-action] bs-[--rail-action]', "data-testid": `device-list-item${isCurrent ? '-current' : ''}.options` },
61
+ react_2.default.createElement("span", { className: 'sr-only' }, t('more options label')),
62
+ react_2.default.createElement(react_1.DotsThree, { className: (0, react_ui_theme_1.getSize)(5) }))),
63
+ react_2.default.createElement(react_ui_1.DropdownMenu.Content, null,
64
+ react_2.default.createElement(react_ui_1.DropdownMenu.Viewport, null,
65
+ react_2.default.createElement(react_ui_1.DropdownMenu.Item, { "data-testid": 'device-list-item-current.join-existing', onClick: onClickJoinExisting },
66
+ react_2.default.createElement(react_1.Intersect, { className: (0, react_ui_theme_1.getSize)(5) }),
67
+ t('choose join new identity label')),
68
+ react_2.default.createElement(react_ui_1.DropdownMenu.Item, { "data-testid": 'device-list-item-current.reset', onClick: onClickReset },
69
+ react_2.default.createElement(react_1.Power, { className: (0, react_ui_theme_1.getSize)(5) }),
70
+ t('reset device label')))))))));
71
+ });
72
+ //# sourceMappingURL=DeviceListItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceListItem.js","sourceRoot":"","sources":["../../../../../src/components/DeviceList/DeviceListItem.tsx"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,iDAU+B;AAC/B,+CAAyE;AAEzE,qDAAkD;AAClD,kDAAyE;AACzE,6CASwB;AACxB,yDAA+C;AAC/C,qCAA2C;AAI3C,MAAM,SAAS,GAAc;IAC3B,MAAM,EAAE,SAAS;IACjB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,CAAC,EAAE,CAAC;IACJ,CAAC,EAA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O,EAAC,OAAO,EACf,UAAU,EAAC,6CAA6C,iBAC3C,mBAAmB,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU;wBAErE,wCAAM,SAAS,EAAC,SAAS,IAAE,CAAC,CAAC,oBAAoB,CAAC,CAAQ;wBAC1D,8BAAC,iBAAS,IAAC,SAAS,EAAE,IAAA,wBAAO,EAAC,CAAC,CAAC,GAAI,CAC7B,CACY;gBACvB,8BAAC,uBAAY,CAAC,OAAO;oBACnB,8BAAC,uBAAY,CAAC,QAAQ;wBAKpB,8BAAC,uBAAY,CAAC,IAAI,mBAAa,wCAAwC,EAAC,OAAO,EAAE,mBAAmB;4BAClG,8BAAC,iBAAS,IAAC,SAAS,EAAE,IAAA,wBAAO,EAAC,CAAC,CAAC,GAAI;4BACnC,CAAC,CAAC,gCAAgC,CAAC,CAClB;wBACpB,8BAAC,uBAAY,CAAC,IAAI,mBAAa,gCAAgC,EAAC,OAAO,EAAE,YAAY;4BACnF,8BAAC,aAAK,IAAC,SAAS,EAAE,IAAA,wBAAO,EAAC,CAAC,CAAC,GAAI;4BAC/B,CAAC,CAAC,oBAAoB,CAAC,CACN,CACE,CACH,CACL,CACrB,CACW,CACA,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type SpaceMember } from '@dxos/react-client/echo';
2
+ import { type Device } from '@dxos/react-client/halo';
3
+ export type DeviceListProps = {
4
+ devices: Device[];
5
+ onClickAdd?: () => void;
6
+ onClickEdit?: (device: Device) => void;
7
+ onClickReset?: () => void;
8
+ onClickJoinExisting?: () => void;
9
+ };
10
+ export type AgentFormProps = {
11
+ onAgentCreate?: () => Promise<void>;
12
+ onAgentDestroy?: () => Promise<void>;
13
+ agentStatus?: string;
14
+ agentActive?: boolean;
15
+ agentProviderDisabled?: boolean;
16
+ validationMessage?: string;
17
+ agentHostingEnabled?: boolean;
18
+ };
19
+ export type DeviceListItemProps = {
20
+ device: Device;
21
+ presence?: SpaceMember['presence'];
22
+ onClickAdd?: () => void;
23
+ onClickEdit?: () => void;
24
+ onClickReset?: () => void;
25
+ onClickJoinExisting?: () => void;
26
+ };
27
+ //# sourceMappingURL=DeviceListProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceListProps.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeviceList/DeviceListProps.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;CAClC,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2024 DXOS.org
4
+ //
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=DeviceListProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeviceListProps.js","sourceRoot":"","sources":["../../../../../src/components/DeviceList/DeviceListProps.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE"}
@@ -0,0 +1,3 @@
1
+ export * from './DeviceList';
2
+ export * from './DeviceListProps';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/DeviceList/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2024 DXOS.org
4
+ //
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./DeviceList"), exports);
21
+ __exportStar(require("./DeviceListProps"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/DeviceList/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;AAEF,+CAA6B;AAC7B,oDAAkC"}
@@ -1,5 +1,5 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
- import { type ButtonProps } from '@dxos/react-ui';
2
+ import { type ButtonProps, type ThemedClassName } from '@dxos/react-ui';
3
3
  export type EmojiPickerProps = {
4
4
  disabled?: boolean;
5
5
  defaultEmoji?: string;
@@ -7,5 +7,12 @@ export type EmojiPickerProps = {
7
7
  onChangeEmoji?: Dispatch<SetStateAction<string>>;
8
8
  onClickClear?: ButtonProps['onClick'];
9
9
  };
10
- export declare const EmojiPicker: ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClear }: EmojiPickerProps) => JSX.Element;
10
+ /**
11
+ * A toolbar button for picking an emoji. Use only in `role=toolbar` elements. Unable to unset the value.
12
+ */
13
+ export declare const EmojiPickerToolbarButton: ({ disabled, defaultEmoji, emoji, onChangeEmoji, classNames, }: ThemedClassName<Omit<EmojiPickerProps, 'onClickClear'>>) => JSX.Element;
14
+ /**
15
+ * A button for picking an emoji alongside a button for unsetting it.
16
+ */
17
+ export declare const EmojiPickerBlock: ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClear }: EmojiPickerProps) => JSX.Element;
11
18
  //# sourceMappingURL=EmojiPicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmojiPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/EmojiPicker.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AAE5E,OAAO,EAA4C,KAAK,WAAW,EAAiB,MAAM,gBAAgB,CAAC;AAG3G,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,WAAW,mEAAoE,gBAAgB,gBA+D3G,CAAC"}
1
+ {"version":3,"file":"EmojiPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/EmojiPicker.tsx"],"names":[],"mappings":"AAOA,OAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAoB,MAAM,OAAO,CAAC;AAEpF,OAAO,EAKL,KAAK,WAAW,EAGhB,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAGxB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,kEAMlC,gBAAgB,KAAK,gBAAgB,EAAE,cAAc,CAAC,CAAC,gBA0EzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,mEAAoE,gBAAgB,gBA+DhH,CAAC"}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.EmojiPicker = void 0;
29
+ exports.EmojiPickerBlock = exports.EmojiPickerToolbarButton = void 0;
30
30
  //
31
31
  // Copyright 2024 DXOS.org
32
32
  //
@@ -37,7 +37,61 @@ const react_use_controllable_state_1 = require("@radix-ui/react-use-controllable
37
37
  const react_3 = __importStar(require("react"));
38
38
  const react_ui_1 = require("@dxos/react-ui");
39
39
  const react_ui_theme_1 = require("@dxos/react-ui-theme");
40
- const EmojiPicker = ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClear }) => {
40
+ /**
41
+ * A toolbar button for picking an emoji. Use only in `role=toolbar` elements. Unable to unset the value.
42
+ */
43
+ const EmojiPickerToolbarButton = ({ disabled, defaultEmoji, emoji, onChangeEmoji, classNames, }) => {
44
+ const { t } = (0, react_ui_1.useTranslation)('os');
45
+ const [_emojiValue, setEmojiValue] = (0, react_use_controllable_state_1.useControllableState)({
46
+ prop: emoji,
47
+ onChange: onChangeEmoji,
48
+ defaultProp: defaultEmoji,
49
+ });
50
+ const [emojiPickerOpen, setEmojiPickerOpen] = (0, react_3.useState)(false);
51
+ const suppressNextTooltip = (0, react_3.useRef)(false);
52
+ const [triggerTooltipOpen, setTriggerTooltipOpen] = (0, react_3.useState)(false);
53
+ return (react_3.default.createElement(react_ui_1.Tooltip.Root, { open: triggerTooltipOpen, onOpenChange: (nextOpen) => {
54
+ if (suppressNextTooltip.current) {
55
+ setTriggerTooltipOpen(false);
56
+ suppressNextTooltip.current = false;
57
+ }
58
+ else {
59
+ setTriggerTooltipOpen(nextOpen);
60
+ }
61
+ } },
62
+ react_3.default.createElement(react_ui_1.Popover.Root, { open: emojiPickerOpen, onOpenChange: (nextOpen) => {
63
+ setEmojiPickerOpen(nextOpen);
64
+ suppressNextTooltip.current = true;
65
+ } },
66
+ react_3.default.createElement(react_ui_1.Tooltip.Trigger, { asChild: true },
67
+ react_3.default.createElement(react_ui_1.Popover.Trigger, { asChild: true },
68
+ react_3.default.createElement(react_ui_1.Toolbar.Button, { classNames: ['gap-2 text-2xl plb-1', classNames], disabled: disabled },
69
+ react_3.default.createElement("span", { className: 'sr-only' }, t('select emoji label')),
70
+ react_3.default.createElement(react_2.ImageSquare, { className: (0, react_ui_theme_1.getSize)(5) })))),
71
+ react_3.default.createElement(react_ui_1.Tooltip.Portal, null,
72
+ react_3.default.createElement(react_ui_1.Tooltip.Content, { side: 'bottom', classNames: 'z-50' },
73
+ t('select emoji label'),
74
+ react_3.default.createElement(react_ui_1.Tooltip.Arrow, null))),
75
+ react_3.default.createElement(react_ui_1.Popover.Content, { side: 'bottom', onKeyDownCapture: (event) => {
76
+ if (event.key === 'Escape') {
77
+ event.stopPropagation();
78
+ setEmojiPickerOpen(false);
79
+ suppressNextTooltip.current = true;
80
+ }
81
+ } },
82
+ react_3.default.createElement(react_1.default, { data: data_1.default, onEmojiSelect: ({ native }) => {
83
+ if (native) {
84
+ setEmojiValue(native);
85
+ setEmojiPickerOpen(false);
86
+ }
87
+ }, autoFocus: true, maxFrequentRows: 0, noCountryFlags: true }),
88
+ react_3.default.createElement(react_ui_1.Popover.Arrow, null)))));
89
+ };
90
+ exports.EmojiPickerToolbarButton = EmojiPickerToolbarButton;
91
+ /**
92
+ * A button for picking an emoji alongside a button for unsetting it.
93
+ */
94
+ const EmojiPickerBlock = ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClear }) => {
41
95
  const { t } = (0, react_ui_1.useTranslation)('os');
42
96
  const [isMd] = (0, react_ui_1.useMediaQuery)('md', { ssr: false });
43
97
  const [emojiValue, setEmojiValue] = (0, react_use_controllable_state_1.useControllableState)({
@@ -76,5 +130,5 @@ const EmojiPicker = ({ disabled, defaultEmoji, emoji, onChangeEmoji, onClickClea
76
130
  t('clear label'),
77
131
  react_3.default.createElement(react_ui_1.Tooltip.Arrow, null))))));
78
132
  };
79
- exports.EmojiPicker = EmojiPicker;
133
+ exports.EmojiPickerBlock = EmojiPickerBlock;
80
134
  //# sourceMappingURL=EmojiPicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmojiPicker.js","sourceRoot":"","sources":["../../../../src/components/EmojiPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,EAAE;AACF,0BAA0B;AA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AgB,EAAE,CAAC,KAAK,EAAE,EAAE;oBAC1B,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE;wBAC1B,KAAK,CAAC,eAAe,EAAE,CAAC;wBACxB,kBAAkB,CAAC,KAAK,CAAC,CAAC;qBAC3B;gBACH,CAAC;gBAED,8BAAC,eAAS,IACR,IAAI,EAAE,cAAS,EACf,aAAa,EAAE,CAAC,EAAE,MAAM,EAAuB,EAAE,EAAE;wBACjD,IAAI,MAAM,EAAE;4BACV,aAAa,CAAC,MAAM,CAAC,CAAC;4BACtB,kBAAkB,CAAC,KAAK,CAAC,CAAC;yBAC3B;oBACH,CAAC,EACD,SAAS,EAAE,IAAI,EACf,eAAe,EAAE,CAAC,EAClB,cAAc,EAAE,IAAI,GACpB;gBACF,8BAAC,kBAAO,CAAC,KAAK,OAAG,CACD,CACL;QACf,8BAAC,kBAAO,CAAC,IAAI;YACX,8BAAC,kBAAO,CAAC,OAAO,IAAC,OAAO;gBACtB,8BAAC,iBAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ;oBAC/D,wCAAM,SAAS,EAAC,SAAS,IAAE,CAAC,CAAC,aAAa,CAAC,CAAQ;oBACnD,8BAAC,6BAAqB,OAAG,CAClB,CACO;YAClB,8BAAC,kBAAO,CAAC,MAAM;gBACb,8BAAC,kBAAO,CAAC,OAAO,IAAC,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAC,OAAO;oBACjD,CAAC,CAAC,aAAa,CAAC;oBACjB,8BAAC,kBAAO,CAAC,KAAK,OAAG,CACD,CACH,CACJ,CACd,CACJ,CAAC;AACJ,CAAC,CAAC;AA/DW,QAAA,gBAAgB,oBA+D3B"}
@@ -1,5 +1,5 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
- import { type ButtonProps } from '@dxos/react-ui';
2
+ import { type ButtonProps, type ThemedClassName } from '@dxos/react-ui';
3
3
  export type HuePickerProps = {
4
4
  disabled?: boolean;
5
5
  defaultHue?: string;
@@ -7,5 +7,12 @@ export type HuePickerProps = {
7
7
  onChangeHue?: Dispatch<SetStateAction<string>>;
8
8
  onClickClear?: ButtonProps['onClick'];
9
9
  };
10
- export declare const HuePicker: ({ disabled, hue, onChangeHue, defaultHue, onClickClear }: HuePickerProps) => JSX.Element;
10
+ /**
11
+ * A toolbar button for picking hue. Use only in `role=toolbar` elements. Unable to unset the value.
12
+ */
13
+ export declare const HuePickerToolbarButton: ({ disabled, hue, onChangeHue, classNames, defaultHue, }: ThemedClassName<Omit<HuePickerProps, 'onClickClear'>>) => JSX.Element;
14
+ /**
15
+ * A button for picking hue alongside a button for unsetting it.
16
+ */
17
+ export declare const HuePickerBlock: ({ disabled, hue, onChangeHue, defaultHue, onClickClear }: HuePickerProps) => JSX.Element;
11
18
  //# sourceMappingURL=HuePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HuePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/HuePicker.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,EAAkE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAYlH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,YAAY,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,SAAS,6DAA8D,cAAc,gBA2DjG,CAAC"}
1
+ {"version":3,"file":"HuePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/HuePicker.tsx"],"names":[],"mappings":"AAKA,OAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAoB,MAAM,OAAO,CAAC;AAEpF,OAAO,EAML,KAAK,WAAW,EAEhB,KAAK,eAAe,EACrB,MAAM,gBAAgB,CAAC;AAYxB,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,YAAY,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,4DAMhC,gBAAgB,KAAK,cAAc,EAAE,cAAc,CAAC,CAAC,gBAuEvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,6DAA8D,cAAc,gBA2DtG,CAAC"}