diff --git a/images/icons.svg b/images/icons.svg deleted file mode 100644 index 41238b538..000000000 --- a/images/icons.svg +++ /dev/null @@ -1,220 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/karma.conf.js b/karma.conf.js index 53b98f422..1831a0899 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -11,6 +11,7 @@ module.exports = function(config) { { pattern: 'dist/*.css.map', included: false }, { pattern: "dist/icons.js", served: true }, { pattern: "dist/emojis.js", served: true }, + "node_modules/lodash/lodash.min.js", "dist/converse.js", "dist/converse.css", { pattern: "dist/images/**/*.*", included: false }, diff --git a/package-lock.json b/package-lock.json index 2bf36f649..006dfa7f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2869,6 +2869,7 @@ "@converse/skeletor": { "version": "github:conversejs/skeletor#56a284bd36a07977d69c08d78e7c8c0fc9fc5c87", "from": "github:conversejs/skeletor#56a284bd36a07977d69c08d78e7c8c0fc9fc5c87", + "dev": true, "requires": { "lit-html": "^1.2.1", "lodash-es": "^4.17.15" @@ -5798,6 +5799,19 @@ "object.assign": "^4.1.0" } }, + "babel-plugin-lodash": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/babel-plugin-lodash/-/babel-plugin-lodash-3.3.4.tgz", + "integrity": "sha512-yDZLjK7TCkWl1gpBeBGmuaDIFhZKmkoL+Cu2MUUjv5VxUZx/z7tBGBCBcQs5RI1Bkz5LLmNdjx7paOyQtMovyg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0-beta.49", + "@babel/types": "^7.0.0-beta.49", + "glob": "^7.1.1", + "lodash": "^4.17.10", + "require-package-name": "^2.0.1" + } + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -9620,12 +9634,6 @@ "integrity": "sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig==", "dev": true }, - "fastparse": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", - "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", - "dev": true - }, "fastq": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.9.0.tgz", @@ -13308,7 +13316,8 @@ "lit-html": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/lit-html/-/lit-html-1.2.1.tgz", - "integrity": "sha512-GSJHHXMGLZDzTRq59IUfL9FCdAlGfqNp/dEa7k7aBaaWD+JKaCjsAk9KYm2V12ItonVaYx2dprN66Zdm1AuBTQ==" + "integrity": "sha512-GSJHHXMGLZDzTRq59IUfL9FCdAlGfqNp/dEa7k7aBaaWD+JKaCjsAk9KYm2V12ItonVaYx2dprN66Zdm1AuBTQ==", + "dev": true }, "load-json-file": { "version": "5.3.0", @@ -13384,31 +13393,6 @@ "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.20.tgz", "integrity": "sha512-JD1COMZsq8maT6mnuz1UMV0jvYD0E0aUsSOdrr1/nAG3dhqQXwRRgeW0cSqH1U43INKcqxaiVIQNOUDld7gRDA==" }, - "lodash-template-webpack-loader": { - "version": "github:jcbrand/lodash-template-webpack-loader#258c095ab22130dfde454fa59ee0986f302bb733", - "from": "github:jcbrand/lodash-template-webpack-loader", - "dev": true, - "requires": { - "fastparse": "^1.1.1", - "loader-utils": "^0.2.11", - "lodash": "^4.11.1", - "source-map": "^0.5.6" - }, - "dependencies": { - "loader-utils": { - "version": "0.2.17", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", - "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0", - "object-assign": "^4.0.1" - } - } - } - }, "lodash._reinterpolate": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz", @@ -20721,6 +20705,12 @@ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, + "require-package-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/require-package-name/-/require-package-name-2.0.1.tgz", + "integrity": "sha1-wR6XJ2tluOKSP3Xav1+y7ww4Qbk=", + "dev": true + }, "requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", diff --git a/package.json b/package.json index 5736bcb84..b298fc8d5 100644 --- a/package.json +++ b/package.json @@ -71,10 +71,12 @@ "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/preset-env": "^7.12.7", "@converse/headless": "file:src/headless", + "@converse/skeletor": "conversejs/skeletor#56a284bd36a07977d69c08d78e7c8c0fc9fc5c87", "@fortawesome/fontawesome-free": "5.14.0", "autoprefixer": "^9.8.6", "babel-eslint": "^10.1.0", "babel-loader": "^8.1.0", + "babel-plugin-lodash": "^3.3.4", "bootstrap": "^4.3.1", "bootstrap.native": "^2.0.27", "bootstrap.native-loader": "2.0.0", @@ -105,7 +107,6 @@ "lerna": "^3.22.1", "lit-element": "^2.4.0", "lit-html": "^1.2.1", - "lodash-template-webpack-loader": "jcbrand/lodash-template-webpack-loader", "mini-css-extract-plugin": "^0.9.0", "minimist": "^1.2.3", "node-sass": "^4.14.1", diff --git a/spec/bookmarks.js b/spec/bookmarks.js index 6bb49a22a..fbfb09366 100644 --- a/spec/bookmarks.js +++ b/spec/bookmarks.js @@ -1,4 +1,4 @@ -/* global mock, converse */ +/* global mock, converse, _ */ const { Strophe, u, sizzle, $iq } = converse.env; @@ -136,7 +136,7 @@ describe("A chat room", function () { ['rosterGroupsFetched'], {}, async function (done, _converse) { - const { u, _ } = converse.env; + const { u } = converse.env; await mock.waitUntilDiscoConfirmed( _converse, _converse.bare_jid, [{'category': 'pubsub', 'type': 'pep'}], diff --git a/spec/chatbox.js b/spec/chatbox.js index 5754cdeb3..dea4e4a6c 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -1,6 +1,5 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const _ = converse.env._; const $msg = converse.env.$msg; const Strophe = converse.env.Strophe; const u = converse.env.utils; diff --git a/spec/controlbox.js b/spec/controlbox.js index f4040bdcc..916fd22f2 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -1,6 +1,5 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const _ = converse.env._; const $msg = converse.env.$msg; const u = converse.env.utils; const Strophe = converse.env.Strophe; diff --git a/spec/headline.js b/spec/headline.js index 0163e4bc1..e0797ee7d 100644 --- a/spec/headline.js +++ b/spec/headline.js @@ -1,4 +1,4 @@ -/*global mock */ +/*global mock, converse, _ */ describe("A headlines box", function () { @@ -147,7 +147,7 @@ describe("A headlines box", function () { mock.initConverse( ['rosterGroupsFetched', 'chatBoxesFetched'], {}, function (done, _converse) { - const { $msg, _ } = converse.env; + const { $msg } = converse.env; _converse.allow_non_roster_messaging = false; const stanza = $msg({ 'type': 'headline', diff --git a/spec/http-file-upload.js b/spec/http-file-upload.js index 3480eceda..008570a90 100644 --- a/spec/http-file-upload.js +++ b/spec/http-file-upload.js @@ -1,8 +1,7 @@ -/*global mock, converse */ +/*global mock, converse, _ */ const Strophe = converse.env.Strophe; const $iq = converse.env.$iq; -const _ = converse.env._; const sizzle = converse.env.sizzle; const u = converse.env.utils; diff --git a/spec/messages.js b/spec/messages.js index ccae65bbc..502f6b032 100644 --- a/spec/messages.js +++ b/spec/messages.js @@ -1,6 +1,6 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const { Promise, Strophe, $msg, dayjs, sizzle, _ } = converse.env; +const { Promise, Strophe, $msg, dayjs, sizzle } = converse.env; const u = converse.env.utils; diff --git a/spec/modtools.js b/spec/modtools.js index b936928ea..e8a5ea379 100644 --- a/spec/modtools.js +++ b/spec/modtools.js @@ -1,6 +1,5 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const _ = converse.env._; const $iq = converse.env.$iq; const $pres = converse.env.$pres; const sizzle = converse.env.sizzle; diff --git a/spec/muc.js b/spec/muc.js index 93822ed3f..16eb8a22a 100644 --- a/spec/muc.js +++ b/spec/muc.js @@ -1,6 +1,5 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const _ = converse.env._; const $pres = converse.env.$pres; const $iq = converse.env.$iq; const $msg = converse.env.$msg; diff --git a/spec/notification.js b/spec/notification.js index 4f2780872..7f65186d6 100644 --- a/spec/notification.js +++ b/spec/notification.js @@ -1,6 +1,6 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const { Strophe, _ } = converse.env; +const { Strophe } = converse.env; const $msg = converse.env.$msg; const u = converse.env.utils; diff --git a/spec/omemo.js b/spec/omemo.js index 318a26e84..a28955296 100644 --- a/spec/omemo.js +++ b/spec/omemo.js @@ -1,6 +1,6 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const { $iq, $pres, $msg, _, omemo, Strophe } = converse.env; +const { $iq, $pres, $msg, omemo, Strophe } = converse.env; const u = converse.env.utils; async function deviceListFetched (_converse, jid) { diff --git a/spec/push.js b/spec/push.js index 8d53d30d7..fe2b6fe08 100644 --- a/spec/push.js +++ b/spec/push.js @@ -1,8 +1,7 @@ -/*global mock */ +/*global mock, converse, _ */ const $iq = converse.env.$iq; const Strophe = converse.env.Strophe; -const _ = converse.env._; const sizzle = converse.env.sizzle; const u = converse.env.utils; const original_timeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; diff --git a/spec/receipts.js b/spec/receipts.js index 5cf112657..0ea35de2a 100644 --- a/spec/receipts.js +++ b/spec/receipts.js @@ -1,6 +1,6 @@ -/*global mock, converse */ +/*global mock, converse, _ */ -const { Promise, Strophe, $msg, sizzle, _ } = converse.env; +const { Promise, Strophe, $msg, sizzle } = converse.env; const u = converse.env.utils; diff --git a/spec/register.js b/spec/register.js index ed7c1a1ec..adc070d97 100644 --- a/spec/register.js +++ b/spec/register.js @@ -1,8 +1,8 @@ -/*global mock, converse */ +/*global mock, converse, _ */ const Strophe = converse.env.Strophe; const $iq = converse.env.$iq; -const { _, sizzle} = converse.env; +const { sizzle} = converse.env; const u = converse.env.utils; describe("The Registration Panel", function () { diff --git a/spec/room_registration.js b/spec/room_registration.js index d20751c18..9581878fd 100644 --- a/spec/room_registration.js +++ b/spec/room_registration.js @@ -1,7 +1,6 @@ -/*global mock */ +/*global mock, converse, _ */ -const _ = converse.env._, - $iq = converse.env.$iq, +const $iq = converse.env.$iq, Strophe = converse.env.Strophe, sizzle = converse.env.sizzle, u = converse.env.utils; diff --git a/spec/roster.js b/spec/roster.js index d32832f5d..481a7c36e 100644 --- a/spec/roster.js +++ b/spec/roster.js @@ -1,9 +1,8 @@ -/*global mock, converse */ +/*global mock, converse, _ */ const $iq = converse.env.$iq; const $pres = converse.env.$pres; const Strophe = converse.env.Strophe; -const _ = converse.env._; const sizzle = converse.env.sizzle; const u = converse.env.utils; diff --git a/src/components/emoji-picker.js b/src/components/emoji-picker.js index ca14ca6f0..371613f0d 100644 --- a/src/components/emoji-picker.js +++ b/src/components/emoji-picker.js @@ -1,10 +1,10 @@ import "./emoji-picker-content.js"; import DOMNavigator from "../shared/dom-navigator"; +import debounce from 'lodash/debounce'; import { BaseDropdown } from "./dropdown.js"; import { CustomElement } from './element.js'; import { __ } from '../i18n'; import { _converse, api, converse } from "@converse/headless/core"; -import { debounce } from "lodash-es"; import { html } from "lit-element"; import { tpl_emoji_picker } from "../templates/emoji_picker.js"; import { until } from 'lit-html/directives/until.js'; diff --git a/src/components/font-awesome.js b/src/components/font-awesome.js index 93d86b0fa..e9eb06a3a 100644 --- a/src/components/font-awesome.js +++ b/src/components/font-awesome.js @@ -1,19 +1,9 @@ import { CustomElement } from './element.js'; -import { html } from "lit-element"; -import { unsafeSVG } from 'lit-html/directives/unsafe-svg.js'; -import { until } from 'lit-html/directives/until.js'; - +import tpl_icons from 'templates/icons.js'; export class FontAwesome extends CustomElement { - - constructor () { - super(); - const promise = import(/*webpackChunkName: "icons" */ '../../images/icons.svg'); - this.data = promise.then(d => html`${unsafeSVG(d.default())}`); - } - render () { // eslint-disable-line class-methods-use-this - return html`${until(this.data, '')}`; + return tpl_icons(); } } diff --git a/src/converse.js b/src/converse.js index 7465c7c2b..5eab75550 100644 --- a/src/converse.js +++ b/src/converse.js @@ -4,8 +4,6 @@ * @license Mozilla Public License (MPLv2) */ -import _ from './lodash.noconflict'; - import "@converse/headless/headless"; import "i18n"; import "shared/registry.js"; @@ -60,20 +58,6 @@ const WHITELISTED_PLUGINS = [ 'converse-singleton' ]; -// Use Mustache style syntax for variable interpolation -/* Configuration of Lodash templates (this config is distinct to the - * config of requirejs-tpl in main.js). This one is for normal inline templates. - */ -_.templateSettings = { - 'escape': /\{\{\{([\s\S]+?)\}\}\}/g, - 'evaluate': /\{\[([\s\S]+?)\]\}/g, - 'interpolate': /\{\{([\s\S]+?)\}\}/g, - 'imports': { '_': _ } -}; - -converse.env._ = _; - - const initialize = converse.initialize; converse.initialize = function (settings, callback) { diff --git a/src/headless/shared/connection.js b/src/headless/shared/connection.js index e5898b50a..3ea7e8e74 100644 --- a/src/headless/shared/connection.js +++ b/src/headless/shared/connection.js @@ -1,9 +1,10 @@ +import debounce from 'lodash/debounce'; +import isElement from 'lodash/isElement'; import log from "../log.js"; import sizzle from 'sizzle'; import u from '@converse/headless/utils/core'; import { Strophe } from 'strophe.js/src/core'; import { _converse, api, clearSession, tearDown } from "../core.js"; -import { debounce, isElement } from 'lodash'; const BOSH_WAIT = 59; diff --git a/src/headless/shared/rsm.js b/src/headless/shared/rsm.js index ce9c38574..3532db73c 100644 --- a/src/headless/shared/rsm.js +++ b/src/headless/shared/rsm.js @@ -7,7 +7,7 @@ * Copyright 2006-2017 Strophe (https://github.com/strophe/strophejs) */ import { _converse, converse } from "../core.js"; -import { pick } from 'lodash-es' +import pick from 'lodash/pick'; const { Strophe, $build } = converse.env; diff --git a/src/lodash.noconflict.js b/src/lodash.noconflict.js deleted file mode 100644 index 551e048fe..000000000 --- a/src/lodash.noconflict.js +++ /dev/null @@ -1,3 +0,0 @@ -define(['lodash'], function (_) { - return _.noConflict(); -}); diff --git a/src/templates/chatroom_bookmark_toggle.html b/src/templates/chatroom_bookmark_toggle.html deleted file mode 100644 index af80aba7a..000000000 --- a/src/templates/chatroom_bookmark_toggle.html +++ /dev/null @@ -1,2 +0,0 @@ - diff --git a/src/templates/chatroom_dragresize.html b/src/templates/chatroom_dragresize.html deleted file mode 100644 index 8bf87c39a..000000000 --- a/src/templates/chatroom_dragresize.html +++ /dev/null @@ -1,3 +0,0 @@ -
-
-
diff --git a/src/templates/icons.js b/src/templates/icons.js new file mode 100644 index 000000000..bb4b56f7a --- /dev/null +++ b/src/templates/icons.js @@ -0,0 +1,224 @@ +import { html } from "lit-html"; + +export default () => html` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`; diff --git a/src/templates/search_contact.html b/src/templates/search_contact.html deleted file mode 100644 index fc3f29737..000000000 --- a/src/templates/search_contact.html +++ /dev/null @@ -1,9 +0,0 @@ -
  • -
    - - -
    -
  • diff --git a/src/templates/status_option.html b/src/templates/status_option.html deleted file mode 100644 index bc5f0886e..000000000 --- a/src/templates/status_option.html +++ /dev/null @@ -1,6 +0,0 @@ -
  • - - - {{{ o.text }}} - -
  • diff --git a/src/templates/toolbar_fileupload.html b/src/templates/toolbar_fileupload.html deleted file mode 100644 index bd39130e6..000000000 --- a/src/templates/toolbar_fileupload.html +++ /dev/null @@ -1,4 +0,0 @@ -
  • - - -
  • diff --git a/webpack.common.js b/webpack.common.js index 717be1a92..3356695b8 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -1,5 +1,6 @@ /* global __dirname, module, process */ const path = require('path'); + let bootstrap_ignore_modules = ['carousel', 'scrollspy']; const BOOTSTRAP_IGNORE_MODULES = (process.env.BOOTSTRAP_IGNORE_MODULES || '').replace(/ /g, '').trim(); @@ -101,6 +102,7 @@ module.exports = { }] ], plugins: [ + 'lodash', '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-nullish-coalescing-operator', '@babel/plugin-proposal-optional-chaining',