Files
element-web/packages/shared-components/package.json
T
Zack 8d076c897d Refactor EventContentBody to shared-components (#31914)
* Init of refactoring of eventcontentbody

* update stories css by copying css from element x to shared components

* Replaced old component EventContentBody with newly created mmvm component EventContentBodyViewModel

* Refactor TextualBody and EditHistoryMessage to properly manage EventContentBodyViewModel

* generated snapshot after vitest

* Update import placement for eslint to pass CI

* Fixed lint warnings

* Update css for codeblock to represent js highlight

* test: add EventContentBodyViewModel snapshot coverage

* fix: pass content ref to EventContentBodyView for link previews

* Fix: return to old code that passed tests

* Added storybook snapshots

* Removal of old component that is being unused

* Update snapshot

* Fix missing enableBigEmoji and shouldShowPillAvatar settings in EventContentBodyViewModel

* update snapshot

* narrow setProps to mutable fields and skip no-op snapshot recomputes

* Update Snapshots

* replace EventContentBodyViewModel setProps with explicit setters and update call sites

* render body in view and keep parser/replacer in snapshot

* Eslint Restruct

* Eslint Restructure

* Removed unused function, moved to shared component

* Remove Unused Module (Moved To Shared Component)

* Disable EventContent-body Test to check weather it fixes CI

* Enable EventContentBody Tests

* Remove EventTest

* Update Include in Vitest

* Added EventContentBody test

* Update Package.json

* Update Lockfile

* Update dependencies

* update lockfile

* ptimize EventContentBodyViewModel to recompute/merge only changed snapshot fields

* Update snapshots

* setEventContent and setStripReply run whenever the existing update block runs

* defined arrow functions for undefined runtime issues that might occur.

* Update test cases

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBodyView.tsx

Co-authored-by: R Midhun Suresh <rmidhunsuresh@gmail.com>

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBodyView.tsx

Co-authored-by: R Midhun Suresh <rmidhunsuresh@gmail.com>

* move big-emoji and pill-avatar setting watchers into EventContentBodyViewModel

* Update packages/shared-components/src/message-body/EventContentBody/index.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBodyView.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBody.test.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBody.stories.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBodyView.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Update packages/shared-components/src/message-body/EventContentBody/EventContentBodyView.tsx

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Fix dubblicate variables

* clarify applyReplacerOnString input/replacer params

* Added memo to the view

* Prettier Fix

* Update apps/web/src/viewmodels/message-body/EventContentBodyViewModel.ts

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>

* Added compund variables instead of reguler values

* Added boolean default values

* remove redundant setting props from TextualBody and EditHistoryMessage

* Prettier FIx

* replace MatrixClientPeg usage with `client: MatrixClient | null` passed from context

* TextualBody now passes EventContentBodyViewModel `client` from RoomContext.

* Remove redundant as prop from EventContentBody VM usage

* Normalize EventContentBodyViewModel renderer flags to booleans

---------

Co-authored-by: R Midhun Suresh <rmidhunsuresh@gmail.com>
Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
2026-03-09 09:58:05 +00:00

124 lines
4.9 KiB
JSON

{
"name": "@element-hq/web-shared-components",
"version": "0.0.2",
"description": "Shared components for Element",
"author": "New Vector Ltd.",
"repository": {
"type": "git",
"url": "https://github.com/element-hq/element-web"
},
"type": "module",
"exports": {
".": {
"require": {
"style": "./dist/element-web-shared-components.css",
"types": "./dist/element-web-shared-components.d.ts",
"default": "./dist/element-web-shared-components.umd.cjs"
},
"import": {
"style": "./dist/element-web-shared-components.css",
"types": "./dist/element-web-shared-components.d.ts",
"default": "./dist/element-web-shared-components.js"
}
},
"./dist/element-web-shared-components.css": {
"require": "./dist/element-web-shared-components.css",
"import": "./dist/element-web-shared-components.css"
}
},
"types": "dist/element-web-shared-components.d.ts",
"files": [
"dist",
"src",
"LICENSE",
"README.md",
"package.json"
],
"scripts": {
"i18n": "matrix-gen-i18n src && pnpm i18n:sort && pnpm i18n:lint",
"i18n:sort": "matrix-sort-i18n src/i18n/strings/en_EN.json",
"i18n:lint": "matrix-i18n-lint && prettier --log-level=silent --write src/i18n/strings/ --ignore-path /dev/null",
"test:unit": "vitest --project=unit",
"test:storybook": "pnpm build:doc && vitest --project=storybook",
"test:storybook:update": "CI=1 playwright-screenshots-experimental pnpm vitest --run --update --project=storybook",
"build": "nx build",
"prepack": "pnpm run build",
"storybook": "storybook dev -p 6007",
"build:storybook": "nx run @element-hq/web-shared-components:storybook",
"build:doc": "nx run @element-hq/web-shared-components:typedoc",
"lint": "pnpm lint:types && pnpm lint:js",
"lint:js": "eslint --max-warnings 0 src",
"lint:types": "tsc --noEmit && tsc --noEmit -p tsconfig.node.json"
},
"dependencies": {
"@element-hq/element-web-module-api": "catalog:",
"@matrix-org/spec": "^1.7.0",
"@vector-im/compound-design-tokens": "catalog:",
"classnames": "^2.5.1",
"counterpart": "^0.18.6",
"html-react-parser": "^5.2.2",
"lodash": "npm:lodash-es@^4.17.21",
"matrix-web-i18n": "catalog:",
"react-merge-refs": "^3.0.2",
"react-virtuoso": "^4.14.0",
"temporal-polyfill": "^0.3.0"
},
"devDependencies": {
"@element-hq/element-web-playwright-common-local": "workspace:*",
"@fetch-mock/vitest": "^0.2.18",
"@fontsource/inter": "catalog:",
"@matrix-org/react-sdk-module-api": "^2.5.0",
"@playwright/test": "catalog:",
"@storybook/addon-a11y": "^10.0.7",
"@storybook/addon-designs": "^11.0.1",
"@storybook/addon-docs": "^10.0.7",
"@storybook/addon-vitest": "^10.1.11",
"@storybook/icons": "^2.0.0",
"@storybook/react-vite": "^10.0.7",
"@stylistic/eslint-plugin": "^5.7.0",
"@testing-library/dom": "^10.4.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/counterpart": "^0.18.4",
"@types/lodash": "^4.17.20",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@typescript-eslint/eslint-plugin": "^8.53.1",
"@typescript-eslint/parser": "^8.53.1",
"@vector-im/compound-web": "catalog:",
"@vitest/browser-playwright": "^4.0.17",
"@vitest/coverage-v8": "^4.0.17",
"eslint": "8",
"eslint-config-google": "^0.14.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-deprecate": "^0.9.0",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-matrix-org": "^3.0.0",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-compiler": "^19.1.0-rc.2",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-storybook": "^10.0.7",
"eslint-plugin-unicorn": "^56.0.0",
"prettier": "^3.6.2",
"storybook": "^10.0.7",
"storybook-addon-vis": "^3.1.2",
"typedoc": "^0.28.16",
"typedoc-plugin-markdown": "^4.9.0",
"typedoc-plugin-missing-exports": "^4.1.2",
"typescript": "catalog:",
"vite": "^7.3.1",
"vite-plugin-dts": "^4.5.4",
"vite-plugin-node-polyfills": "^0.25.0",
"vitest": "^4.0.18",
"vitest-sonar-reporter": "^3.0.0"
},
"engines": {
"node": ">=20.0.0"
},
"packageManager": "pnpm@10.30.3+sha512.c961d1e0a2d8e354ecaa5166b822516668b7f44cb5bd95122d590dd81922f606f5473b6d23ec4a5be05e7fcd18e8488d47d978bbe981872f1145d06e9a740017",
"peerDependencies": {
"@vector-im/compound-web": "^8.3.5"
}
}