@matrix-widget-toolkit/mui 1.0.1
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 +84 -0
- package/build/cjs/index.js +951 -0
- package/build/esm/index.js +933 -0
- package/build/index.d.ts +107 -0
- package/build/locales/de/widget-toolkit.json +40 -0
- package/build/locales/en/widget-toolkit.json +40 -0
- package/package.json +71 -0
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation This package provides a MUI theme that fits to
|
|
3
|
+
* the default Element theme.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BackendModule } from 'i18next';
|
|
7
|
+
import { Capability } from 'matrix-widget-api';
|
|
8
|
+
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
9
|
+
import { PropsWithChildren } from 'react';
|
|
10
|
+
import { ReactElement } from 'react';
|
|
11
|
+
import { WidgetApi } from '@matrix-widget-toolkit/api';
|
|
12
|
+
import { WidgetEventCapability } from 'matrix-widget-api';
|
|
13
|
+
import { WidgetRegistration } from '@matrix-widget-toolkit/api';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Reads environment variables starting with `REACT_APP_` from a global variable
|
|
17
|
+
* at runtime and falls back to `process.env` build time variables.
|
|
18
|
+
*
|
|
19
|
+
* @param name - The name of the environment variable, should start with
|
|
20
|
+
* `REACT_APP_`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getEnvironment(name: string): string | undefined;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Reads environment variables starting with `REACT_APP_` from a global variable
|
|
26
|
+
* at runtime and falls back to `process.env` build time variables.
|
|
27
|
+
*
|
|
28
|
+
* @param name - The name of the environment variable, should start with
|
|
29
|
+
* `REACT_APP_`.
|
|
30
|
+
* @param defaultValue - The default value to return if the environment variable
|
|
31
|
+
* is not provided.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getEnvironment(name: string, defaultValue: string): string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve the nonce passed by our Docker base image.
|
|
37
|
+
* @returns A nonce that can be used to perform operations that are disabled in
|
|
38
|
+
* our CSP by default.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getNonce(): string | undefined;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A guard that ask the user for capabilities and only shows the `children`
|
|
44
|
+
* if all capabilities were accepted.
|
|
45
|
+
* If capabilities are denined, a message and a button to retry is displayed
|
|
46
|
+
* instead.
|
|
47
|
+
* @param param0 - {@link MuiCapabilitiesGuardProps}
|
|
48
|
+
*/
|
|
49
|
+
export declare function MuiCapabilitiesGuard({ capabilities, children, }: MuiCapabilitiesGuardProps): ReactElement;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Props for the {@link MuiCapabilitiesGuard} component.
|
|
53
|
+
*/
|
|
54
|
+
export declare type MuiCapabilitiesGuardProps = PropsWithChildren<{
|
|
55
|
+
/**
|
|
56
|
+
* Required capabilities to display the `children`.
|
|
57
|
+
*/
|
|
58
|
+
capabilities: Array<WidgetEventCapability | Capability>;
|
|
59
|
+
}>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Provide a semantic UI based theme to the child components.
|
|
63
|
+
* @param param0 - {@link MuiThemeProviderProps}
|
|
64
|
+
*/
|
|
65
|
+
export declare function MuiThemeProvider({ children, }: MuiThemeProviderProps): ReactElement;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Props for the {@link MuiThemeProvider} component.
|
|
69
|
+
*/
|
|
70
|
+
export declare type MuiThemeProviderProps = PropsWithChildren<{}>;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Provides the `WidgetApi` in the React context once it's fully
|
|
74
|
+
* initialized without errors.
|
|
75
|
+
* Use `useWidgetApi` to access it.
|
|
76
|
+
* @param param0 - {@link MuiWidgetApiProviderProps}
|
|
77
|
+
*/
|
|
78
|
+
export declare function MuiWidgetApiProvider({ widgetRegistration, widgetApiPromise, children, }: MuiWidgetApiProviderProps): ReactElement;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Props for the {@link (MuiWidgetApiProvider:function)} component.
|
|
82
|
+
*/
|
|
83
|
+
export declare type MuiWidgetApiProviderProps = PropsWithChildren<{
|
|
84
|
+
/**
|
|
85
|
+
* Configuration to set during Widget registration.
|
|
86
|
+
*/
|
|
87
|
+
widgetRegistration?: WidgetRegistration;
|
|
88
|
+
/**
|
|
89
|
+
* Result from a call to `WidgetApiImpl.create`.
|
|
90
|
+
*/
|
|
91
|
+
widgetApiPromise: Promise<WidgetApi>;
|
|
92
|
+
}>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* A language detector that reads the language from the widget url.
|
|
96
|
+
*/
|
|
97
|
+
export declare class WidgetApiLanguageDetector extends LanguageDetector {
|
|
98
|
+
constructor();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Backend for usage with `i18n-next` that provides translations for internal
|
|
103
|
+
* messages.
|
|
104
|
+
*/
|
|
105
|
+
export declare const WidgetToolkitI18nBackend: BackendModule<object>;
|
|
106
|
+
|
|
107
|
+
export { }
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": {
|
|
3
|
+
"copy-to-clipboard": "In die Zwischenablage kopieren"
|
|
4
|
+
},
|
|
5
|
+
"error": {
|
|
6
|
+
"instructions": "Im Widget ist ein Fehler aufgetreten. Der Fehler kann eventuell durch erneutes Öffnen des Widgets behoben werden.",
|
|
7
|
+
"title": "Ohh nein!"
|
|
8
|
+
},
|
|
9
|
+
"loading": {
|
|
10
|
+
"message": "Lädt…"
|
|
11
|
+
},
|
|
12
|
+
"missing-capabilities": {
|
|
13
|
+
"instructions": "Die minimal erforderlichen Rechte für dieses Widget fehlen. Es müssen alle angefragen Rechte erteilt werden.",
|
|
14
|
+
"request-capabilities": "Rechte erteilen",
|
|
15
|
+
"title": "Fehlende Rechte"
|
|
16
|
+
},
|
|
17
|
+
"missing-parameters": {
|
|
18
|
+
"completed": {
|
|
19
|
+
"instructions": "Widget Konfiguration abgeschlossen, das Widget muss erneut geöffnet werden.",
|
|
20
|
+
"title": "Widget Konfiguration abgeschlossen"
|
|
21
|
+
},
|
|
22
|
+
"instructions": "Das Widget ist nicht korrekt registriert. Es muss sichergestellt werden, das alle Parameter in der URL enthalten sind:",
|
|
23
|
+
"permissions-error": {
|
|
24
|
+
"close": "Schließen",
|
|
25
|
+
"instructions": "Fehlende Berechtigungen, das Widget konnte nicht konfiguriert werden. Die Korrektur muss durch einen Raum-Administrator durchgeführt werden.",
|
|
26
|
+
"title": "Fehler"
|
|
27
|
+
},
|
|
28
|
+
"repair": "Registrierung korrigieren",
|
|
29
|
+
"repair-instructions": "Die Widget Registrierung kann entweder manuell oder automatisch korrigiert werden:",
|
|
30
|
+
"title": "Fehlerhafte Widget Registrierung"
|
|
31
|
+
},
|
|
32
|
+
"mobile-client": {
|
|
33
|
+
"instructions": "Aufgrund von technischen Limitationen funktioniert das Widget nicht in den mobilen Apps. Das Widget muss in einer Desktop oder Web App geöffnet werden.",
|
|
34
|
+
"title": "Mobile Apps werden nicht unterstützt"
|
|
35
|
+
},
|
|
36
|
+
"outside-client": {
|
|
37
|
+
"instructions": "Diese URL muss als Widget registiert werden und kann nicht direkt aufgerufen werden. Mit dem folgenden Kommando kann das Widget in einem Raum eingerichtet werden:",
|
|
38
|
+
"title": "Nur als Widget ausführbar"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"code": {
|
|
3
|
+
"copy-to-clipboard": "Copy to clipboard"
|
|
4
|
+
},
|
|
5
|
+
"error": {
|
|
6
|
+
"instructions": "An error occured inside the widget. You can try to reopen the widget.",
|
|
7
|
+
"title": "Ohh no!"
|
|
8
|
+
},
|
|
9
|
+
"loading": {
|
|
10
|
+
"message": "Loading…"
|
|
11
|
+
},
|
|
12
|
+
"missing-capabilities": {
|
|
13
|
+
"instructions": "The minimum capabilities required for this widget are missing. Make sure to grant all requested capabilities.",
|
|
14
|
+
"request-capabilities": "Request capabilities",
|
|
15
|
+
"title": "Missing capabilities"
|
|
16
|
+
},
|
|
17
|
+
"missing-parameters": {
|
|
18
|
+
"completed": {
|
|
19
|
+
"instructions": "Configuration completed, reopen the widget to start using it.",
|
|
20
|
+
"title": "Widget configuration complete"
|
|
21
|
+
},
|
|
22
|
+
"instructions": "The widget is not registered correctly. Make sure to include the correct parameters in the widget URL:",
|
|
23
|
+
"permissions-error": {
|
|
24
|
+
"close": "Close",
|
|
25
|
+
"instructions": "Insufficient permissions, could not configure widget. Only room admins can configure the widget.",
|
|
26
|
+
"title": "Error"
|
|
27
|
+
},
|
|
28
|
+
"repair": "Repair registration",
|
|
29
|
+
"repair-instructions": "You can either modify the widget registration manually or fix it automatically:",
|
|
30
|
+
"title": "Wrong widget registration"
|
|
31
|
+
},
|
|
32
|
+
"mobile-client": {
|
|
33
|
+
"instructions": "The widget doesn't work in mobile clients due to technical limitations. Open the widget on you Desktop or Web client.",
|
|
34
|
+
"title": "Mobile clients are not supported"
|
|
35
|
+
},
|
|
36
|
+
"outside-client": {
|
|
37
|
+
"instructions": "You need to register this URL as a widget, it's not possible to use it standalone. Run this command in the matrix room you want to register the widget in:",
|
|
38
|
+
"title": "Only runs as a widget"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@matrix-widget-toolkit/mui",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A customized material-ui theme that matches the style of the Element Matrix client",
|
|
5
|
+
"author": "Nordeck IT + Consulting GmbH",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"source": "./src/index.ts",
|
|
8
|
+
"module": "./build/esm/index.js",
|
|
9
|
+
"types": "./build/index.d.ts",
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@craco/craco": "^6.4.5",
|
|
12
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
13
|
+
"@testing-library/react": "^12.1.5",
|
|
14
|
+
"@testing-library/user-event": "^14.4.3",
|
|
15
|
+
"@types/jest": "^27.5.2",
|
|
16
|
+
"@types/jest-axe": "^3.5.5",
|
|
17
|
+
"@types/node": "^16.11.64",
|
|
18
|
+
"@types/react": "^17.0.45",
|
|
19
|
+
"copyfiles": "^2.4.1",
|
|
20
|
+
"i18next-parser": "^6.6.0",
|
|
21
|
+
"jest-axe": "^6.0.0",
|
|
22
|
+
"react": "^17.0.2",
|
|
23
|
+
"react-scripts": "5.0.1",
|
|
24
|
+
"typescript": "^4.8.4"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc && rollup --config ../../rollup.config.mjs",
|
|
28
|
+
"postbuild": "copyfiles -E -u 1 src/locales/**/*.json build",
|
|
29
|
+
"tsc": "tsc",
|
|
30
|
+
"lint": "eslint .",
|
|
31
|
+
"test": "jest --watch",
|
|
32
|
+
"depcheck": "depcheck --ignores=@types/jest,@types/node,i18next-parser --ignore-dirs=lib,build",
|
|
33
|
+
"prepack": "node ../../scripts/prepack.js",
|
|
34
|
+
"postpack": "node ../../scripts/postpack.js",
|
|
35
|
+
"translate": "i18next src/**/*.{ts,tsx}",
|
|
36
|
+
"check-api-report": "api-extractor run --verbose",
|
|
37
|
+
"generate-api-report": "tsc && api-extractor run --verbose --local"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@emotion/cache": "^11.10.3",
|
|
41
|
+
"@emotion/react": "^11.10.4",
|
|
42
|
+
"@emotion/styled": "^11.10.4",
|
|
43
|
+
"@fontsource/inter": "^4.5.12",
|
|
44
|
+
"@mui/icons-material": "^5.10.3",
|
|
45
|
+
"@mui/material": "^5.10.8",
|
|
46
|
+
"@mui/utils": "^5.10.6",
|
|
47
|
+
"@matrix-widget-toolkit/api": "^1.0.1",
|
|
48
|
+
"@matrix-widget-toolkit/react": "^1.0.1",
|
|
49
|
+
"i18next": "^21.10.0",
|
|
50
|
+
"i18next-browser-languagedetector": "^6.1.5",
|
|
51
|
+
"i18next-resources-to-backend": "^1.0.0",
|
|
52
|
+
"matrix-widget-api": "^1.1.1",
|
|
53
|
+
"react": "^17.0.2",
|
|
54
|
+
"react-i18next": "^11.18.6",
|
|
55
|
+
"react-use": "^17.3.2"
|
|
56
|
+
},
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/nordeck/matrix-widget-toolkit.git",
|
|
60
|
+
"directory": "packages/mui"
|
|
61
|
+
},
|
|
62
|
+
"files": [
|
|
63
|
+
"build"
|
|
64
|
+
],
|
|
65
|
+
"keywords": [
|
|
66
|
+
"matrix",
|
|
67
|
+
"widget",
|
|
68
|
+
"matrix-widget-api"
|
|
69
|
+
],
|
|
70
|
+
"main": "./build/cjs/index.js"
|
|
71
|
+
}
|