Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to latest @converse/skeletor which adds types #3288

Merged
merged 20 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
"no-underscore-dangle": "off",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "off",
"no-unused-vars": "error",
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"no-unused-expressions": "off",
"no-use-before-define": "off",
"no-useless-call": "error",
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@

- Remove the old `_converse.BootstrapModal` in favor of `_converse.BaseModal` which is a web component.
- The connection is no longer available on the `_converse` object. Instead, use `api.connection.get()`.
- Add a new `exports` attribute on the `_converse` object which is meant for
providing access for 3rd party plugins to code (e.g. classes) from
converse.js. Some classes that were on the `_converse` object, like
`CustomElement` are not on `_converse.exports`.
- The `windowStateChanged` event has been removed. If you used it, rely on the
`visibilitychange` event on `document` instead.
- `api.modal.create` no longer takes a class, instead it takes the name of a custom DOM element.

## 10.1.6 (2023-08-31)

Expand Down
5 changes: 3 additions & 2 deletions docs/source/plugin_development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,13 @@ Hooks
-----

Converse has the concept of ``hooks``, which are special events that allow you
to modify it's behaviour at runtime.
to modify behaviour at runtime.

A hook is similar to an event, but it differs in two meaningful ways:

1. Converse will wait for all handlers of a hook to finish before continuing inside the function from where the hook was triggered.
2. Each hook contains a payload, which the handlers can modify or extend, before returning it (either to the function that triggered the hook or to subsequent handlers).
2. Each hook contains a payload, which the handlers can modify or extend, before returning it
(either to the function that triggered the hook or to subsequent handlers).

These two properties of hooks makes it possible for 3rd party plugins to
intercept and update data, allowing them to modify Converse without the need of
Expand Down
97 changes: 52 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@babel/core": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"@converse/headless": "file:src/headless",
"@types/webappsec-credential-management": "^0.6.8",
"@typescript-eslint/eslint-plugin": "^5.48.0",
"autoprefixer": "^10.4.5",
"babel-loader": "^9.1.0",
Expand Down Expand Up @@ -103,7 +104,6 @@
"sass": "^1.51.0",
"sass-loader": "^13.1.0",
"style-loader": "^3.1.0",
"tsc": "^2.0.4",
"typescript": "^4.9.5",
"typescript-eslint-parser": "^22.0.0",
"uglify-js": "^3.17.4",
Expand Down
4 changes: 3 additions & 1 deletion src/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const converse = {
*/
load (settings={}) {
if (settings.assets_path) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
__webpack_public_path__ = settings.assets_path; // eslint-disable-line no-undef
}
require('./index.js');
Expand All @@ -63,7 +65,7 @@ const converse = {
}
}

window.converse = converse;
window['converse'] = converse;

/**
* Once Converse.js has loaded, it'll dispatch a custom event with the name `converse-loaded`.
Expand Down
2 changes: 1 addition & 1 deletion src/headless/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dayjs.extend(advancedFormat);
*/

import "./plugins/bookmarks/index.js"; // XEP-0199 XMPP Ping
import "./plugins/bosh.js"; // XEP-0206 BOSH
import "./plugins/bosh/index.js"; // XEP-0206 BOSH
import "./plugins/caps/index.js"; // XEP-0115 Entity Capabilities
import "./plugins/chat/index.js"; // RFC-6121 Instant messaging
import "./plugins/chatboxes/index.js";
Expand Down
6 changes: 3 additions & 3 deletions src/headless/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default {
* When using the 'error' or 'warn' loglevels, a full stacktrace will be
* logged as well.
* @method log#log
* @param { string | Error } message - The message to be logged
* @param { string } level - The loglevel which allows for filtering of log messages
* @param {string|Element|Error} message - The message to be logged
* @param {string} level - The loglevel which allows for filtering of log messages
*/
log (message, level, style='') {
if (LEVELS[level] < LEVELS[this.loglevel]) {
Expand All @@ -59,7 +59,7 @@ export default {
if (message instanceof Error) {
message = message.stack;
} else if (isElement(message)) {
message = message.outerHTML;
message = /** @type {Element} */(message).outerHTML;
}
const prefix = style ? '%c' : '';
if (level === 'error') {
Expand Down
4 changes: 2 additions & 2 deletions src/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"dependencies": {
"@converse/openpromise": "^0.0.1",
"@converse/skeletor": "conversejs/skeletor#c845797101e21a163ac403fc65eac6db069a16b1",
"@converse/skeletor": "conversejs/skeletor#870f20b464a5870db3c230f821b155d11093ce9d",
"dayjs": "^1.11.8",
"dompurify": "^2.3.1",
"filesize": "^10.0.7",
Expand All @@ -41,7 +41,7 @@
"pluggable.js": "3.0.1",
"sizzle": "^2.3.5",
"sprintf-js": "^1.1.2",
"strophe.js": "strophe/strophejs#6b24a2a2121884b2d02aeb5756142f7dcaf05d9e",
"strophe.js": "strophe/strophejs#a75895308216e81b28f58d276395a01b15c9e645",
"urijs": "^1.19.10"
},
"devDependencies": {}
Expand Down
2 changes: 1 addition & 1 deletion src/headless/plugins/adhoc/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default {
* @param { String } sessionid
* @param { 'execute' | 'cancel' | 'prev' | 'next' | 'complete' } action
* @param { String } node
* @param { Array<{ string: string }> } inputs
* @param { Array<{ [k:string]: string }> } inputs
*/
async runCommand (jid, sessionid, node, action, inputs) {
const iq =
Expand Down
Loading
Loading