1
0
mirror of https://github.com/element-hq/element-web.git synced 2026-10-23 11:09:01 +03:00
Files
element-web/apps/web/tsconfig.json
Timo 5fae057a60 Element call as a react component (#34935)
* Add an end-to-end Element Call test with a real MatrixRTC backend

Element Web's Playwright coverage of Element Call has only ever used a stand-in:
`sample-files/fake-element-call.html`, a page that does just enough for the widget
plumbing to be exercised. Nothing in the suite has ever carried media.

This adds one real call between two users, through the Element Call the build under
test ships (`@element-hq/element-call-embedded`, copied to `widgets/element-call/`),
against a real MatrixRTC backend:

- `testcontainers/livekit.ts` — a LiveKit SFU advertising loopback so the browser
  reaches it through published ports on macOS as well as Linux.
- `testcontainers/lk-jwt-service.ts` — the authorisation service, validating OpenID
  tokens over Synapse's federation API.
- `testcontainers/matrix-rtc.ts` — starts the two and produces the Synapse
  configuration that announces the transport (MSC4143) and enables the MSCs Element
  Call needs.
- `services.ts` — a `matrixRTC` worker option turning all of that on.

`routeConfigJson` no longer hard-codes the dev server's origin: it resolves
`config.json` against the context's `baseURL`, so a `BASE_URL` other than the default
works, and other origins a test loads keep their own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Make Renovate actually see the new testcontainer images

The custom manager's `depName` group is `[^@]+`, which matches newlines and
quotes, so it is only bounded by the next `@` in the file. In `synapse.ts` and
`mas.ts` an `@element-hq/…` import happens to sit above the image literal and
caps it; `livekit.ts` and `lk-jwt-service.ts` import `testcontainers` and `yaml`,
so the match instead starts at that import and swallows everything up to the
image name. Renovate gets a nonsense package name, finds nothing, and the pins
quietly rot.

Exclude quotes and whitespace from both groups. All four digest-pinned files now
extract correctly, synapse and mas unchanged.

Bump lk-jwt-service to 0.7.0 while here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Address the bundled Element Call by directory, not by index.html

The full-call spec passed against the webpack dev server and failed in CI, where
the production build is hosted by `serve`.

`ElementCall.generateWidgetUrl` built `./widgets/element-call/index.html#…`.
`serve` has `cleanUrls` on by default, so it 301s that to the extensionless
`/widgets/element-call`. Element Call's `index.html` references its chunks
relatively (`./assets/…`), and against a base with no trailing slash the browser
resolves those to `/widgets/assets/…` — 404. Element Call never boots, so the
lobby never appears and the test times out.

Address the directory instead. It is the same deployment, the trailing slash
sidesteps the redirect, and the hash is overwritten further down either way. This
is not only a test concern: Netlify also strips `.html` by default, and that is
what serves the PR previews and develop.element.io.

Doing it here rather than in the spec keeps the test honest — it exercises the
widget URL Element Web really generates, with no `Developer.elementCallUrl`
override. Setting `cleanUrls` in a `serve.json` was the other candidate and is
not viable: any value other than the default also stops `serve` resolving `/` to
`index.html`, which breaks every other test.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* EC react component Plan

* The implemantation Element Call React Component with mocked EC react
component

* final plan

* tests

* update plan to not do e2e tests in EW but in EC

* Start using the real react component instead of the mock (activation
react EC)

* add playwright e2e tests

* fix transport discovery (pass in via config. Hack the well-known source
for servers not supporting get_transports)

* stylesheet fixes

* Update element-call-react-plan.md

* add docuemnt pip

* Depend on the Element Call component from its git branch

`@element-hq/element-call-component` was a `link:` to a hand-built
`dist/` in a machine-local worktree. It is now a git dependency on the
`component` directory of element-hq/element-call, on the
`valere/component_ec_M1` branch (element-call#4233), whose `prepare`
script builds the component on install; pnpm has to be allowed to run
it (`allowBuilds`). The ref goes back to `main` once that PR has merged.

The branch first needs the commit that adds the component's manifest
and build (`toger5/component-package-manifest` in the EC checkout);
until it is pushed, `path:/component` resolves to no manifest and the
lockfile keeps the old `link:` entry. Both are written up in the plan.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* use the component_ec_m1 dep lock file entries

* fix element call reloading

* pass the right theme to element-call component

* bump element-call-component

* Return a call from the browser PiP window to where it left from

Closing the Document Picture-in-Picture window always dropped the call
into Element Web's floating PiP, even when it had filled the room's call
view a moment earlier and the user was still looking at that room.

The store now remembers whether the call left from the call view, and
on release opens the call view again when it did — unless the call has
ended, the user has moved to another room, or the user opened the call
view themselves (which is what closed the window). A call that was
floating in Element Web's PiP before goes back there, as it did.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Draw the call header's outline icons a little smaller

The room header's icons are Compound's solid set, but minimise,
maximise and pop-out exist only as outlines: Compound has no filled
counterparts, and nothing else in the set says what they say. At the
solid icons' size their open strokes look heavy-handed next to them.

Scaling the glyphs down slightly inside the buttons lets them sit
comfortably next to their neighbours without changing the buttons'
footprint.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Hand a persisted tree to the remaining placeholder on unmount

When two PersistedElements for the same key mount in one React commit
(a call returning from the browser PiP window into the call view, while
Element Web's floating PiP briefly shows it as well), whichever rendered
the tree last owns the child's ref. If that one is then the one to
unmount, it hid the tree, and the survivor, never having been handed the
child, could not show it again.

On unmount, if another placeholder is mounted, render the tree once more
with the most recently mounted survivor's wrapper so it takes over the
child and positions it; only hide the tree when nothing is left to show
it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* Adjust to updates done in EC
(simpler public api. More resilient to prop changes)

* package.json back to EC branch valere/component_ec_M1

* fix closing in component mode

* Configure pnpm store location in workflows

Keep the pnpm store out of node_modules to prevent incorrect
bundling of element-call-component when building git dependencies.

* update docs on EC packaging improvements

* fix ci

* Update pnpm-lock and tsconfig

* Move the browser Picture-in-Picture window and call header changes to a follow-up

Keeps this PR to Element Call as a React component. The Document
Picture-in-Picture window (DocumentPipStore, useDocumentPip, the
PersistedElement detach/reattach and placeholder hand-over, the
PipContainer awareness of it), the call header's minimise, maximise and
pop-out buttons with their outline-icon sizing, the browser API typings,
their strings, tests and e2e spec move to toger5/ec-document-pip.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* bump to main branch EC

* fix CI failing due to pnpm store

* remove docs and dev journals

* review

* CI: silence zizmor's github-env finding on the pnpm store action

zizmor flags every $GITHUB_ENV write inside a composite action, because it
cannot see which triggers the action will be used from. The value written
here is a constant built from RUNNER_TEMP with nothing attacker-controlled
in it, so suppress the finding the way the repo does elsewhere.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Keep the ready promise's rejection from going unobserved

close() rejects the pending ready promise so that a start() still waiting on
the component learns the call went away instead of hanging until the timeout.
Usually nothing is waiting, and the unobserved rejection then surfaced as an
unhandled promise rejection, which crashed the Vitest worker running
Call.test.ts. Mark the promise as handled before rejecting it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* review

* review: double import

* move types to EC repo (just import them here)

* review: refactor ElementCallAppTile to a MVVM shared compoenent

* merge useEffectiveTheme and useTheme hooks

* cnvert the ElementCallMock to MVVM

* use unstable EC branch. DO NOT MERGE UNTI THIS COMMIT IS REVERTED
this branch is used to test CI with the new exports from EC.
We need to first merge:
https://github.com/element-hq/element-call/pull/4269 before we can put
this back to main (revert this commit).

* Move Node and pnpm setup into a single action

The setup-node-pnpm action now includes pnpm/action-setup and
actions/setup-node alongside the store relocation, eliminating
boilerplate across workflows and fixing the setup order in one place.

* fix broken lock file

* test for review change "reject on promise race"

* review: letter spacing

* Import the EC CSS layered

* Use self-repository syntax

* Fix import path

* Fix webpack

* Revert actions syntax as Sonar doesn't seem compatible with it

* Switch to Flex

* Switch to a11y label

* Take client from SdkContext

* Make strings in mock view translatable

* Keep class names in EW

* Move mock view to shared components and add stories

* Exempt voip|element_call_mock|title

* Fix tests

* Clarify doc string

* Add labs.md entry

* Use text element

* Remove redundant test

* Remove redundant test

* Delint

* Format

* Update snapshots

* Bump element-call

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Johannes Marbach <n0-0ne+github@mailbox.org>
2026-09-25 15:12:19 +00:00

44 lines
1.7 KiB
JSON

{
"compilerOptions": {
"allowImportingTsExtensions": true,
"experimentalDecorators": false,
"emitDecoratorMetadata": false,
"resolveJsonModule": true,
"esModuleInterop": true,
"useDefineForClassFields": true,
"module": "preserve",
"moduleResolution": "bundler",
"target": "es2022",
"noUnusedLocals": true,
"sourceMap": false,
"noEmit": true,
"declaration": true,
"jsx": "react",
"lib": ["es2022", "es2024.promise", "dom", "dom.iterable", "ESNext.Collection"],
"strict": true,
"types": ["node", "modernizr"],
"paths": {
// The Element Call component's typings import matrix-js-sdk by its package entry and `lib/*`
// build outputs; resolve those to the `src/*` modules the rest of Element Web uses, so that e.g.
// `MatrixClient` is one type (mirrors the webpack aliases).
"matrix-js-sdk": ["./node_modules/matrix-js-sdk/src/matrix.ts"],
"matrix-js-sdk/lib/*": ["./node_modules/matrix-js-sdk/src/*"],
"test-utils-rtl": ["./src/test/test-utils/vitest-matrix-react"],
"test-utils": ["./src/test/test-utils"],
"test-utils/*": ["./src/test/test-utils/*"]
},
"skipLibCheck": true
},
"exclude": ["./src/**/*.test.browser.ts", "./src/@types/vitest-browser.d.ts"],
"include": [
"./node_modules/matrix-js-sdk/src/@types/*.d.ts",
"./src/**/*.ts",
"./src/**/*.tsx",
"./test/**/*.ts",
"./test/**/*.tsx",
"./scripts/*.ts",
"./@types/*.d.ts",
"./webpack.config.ts"
]
}