Removed ES5 adapter, finished migration of Polymer components, cleanup

This commit is contained in:
Andrii V 2025-11-24 15:21:34 +01:00
parent 241837f815
commit b856331a05
10 changed files with 2408 additions and 1383 deletions

View file

@ -13,10 +13,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-terser');
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-webpack'); grunt.loadNpmTasks('grunt-webpack');
grunt.registerTask('default', ['less:production', 'less:components', 'copy', 'webpack', 'concat:dist', 'uglify:dist']); grunt.registerTask('default', ['less:production', 'less:components', 'copy', 'webpack', 'concat:dist', 'terser:dist']);
}; };

View file

@ -674,7 +674,7 @@ channelstream.server = channelstream:8000
; by external HTTP server such as Nginx or Apache ; by external HTTP server such as Nginx or Apache
; see Nginx/Apache configuration examples in our docs ; see Nginx/Apache configuration examples in our docs
; For development, comment this out to use auto-generated proxy URL ; For development, comment this out to use auto-generated proxy URL
channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream ;channelstream.ws_url = ws://rhodecode.yourserver.com/_channelstream
channelstream.secret = ENV_GENERATED channelstream.secret = ENV_GENERATED
channelstream.history.location = /var/opt/rhodecode_data/channelstream_history channelstream.history.location = /var/opt/rhodecode_data/channelstream_history

View file

@ -52,10 +52,12 @@ Supported Databases
Supported Browsers Supported Browsers
------------------ ------------------
* Chrome * Chrome 67+
* Safari * Firefox 63+
* Firefox * Safari 11.1+
* Internet Explorer 10 & 11 * Edge 79+
Note: Internet Explorer is no longer supported
System Requirements System Requirements
------------------- -------------------

View file

@ -102,10 +102,23 @@
"nonull": true "nonull": true
} }
}, },
"uglify": { "terser": {
"dist": { "dist": {
"src": "<%= dirs.js.dest %>/scripts.js", "options": {
"dest": "<%= dirs.js.dest %>/scripts.min.js" "compress": {
"ecma": 6
},
"mangle": {
"keep_classnames": true,
"keep_fnames": false
},
"output": {
"ecma": 6
}
},
"files": {
"<%= dirs.js.dest %>/scripts.min.js": "<%= dirs.js.dest %>/scripts.js"
}
} }
}, },
"less": { "less": {

3735
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -37,7 +37,7 @@
"grunt-contrib-copy": "^1.0.0", "grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jshint": "^0.12.0", "grunt-contrib-jshint": "^0.12.0",
"grunt-contrib-less": "^1.1.0", "grunt-contrib-less": "^1.1.0",
"grunt-contrib-uglify": "^4.0.1", "grunt-terser": "^1.0.0",
"grunt-contrib-watch": "^0.6.1", "grunt-contrib-watch": "^0.6.1",
"grunt-webpack": "^3.1.3", "grunt-webpack": "^3.1.3",
"html-loader": "^0.4.4", "html-loader": "^0.4.4",

View file

@ -76,7 +76,10 @@ export class ChannelstreamConnection extends LitElement {
connectedCallback() { connectedCallback() {
super.connectedCallback(); super.connectedCallback();
this.dispatchEvent(new CustomEvent('start-listening', {detail: {}}));
// Set up self-event listeners (replaces Polymer's 'listeners' property)
this.addEventListener('channelstream-connected', this.startListening.bind(this));
this.addEventListener('channelstream-connect-error', this.retryConnection.bind(this));
} }
/** /**
@ -428,10 +431,13 @@ export class ChannelstreamConnection extends LitElement {
set(path, value) { set(path, value) {
if (typeof path === 'string') { if (typeof path === 'string') {
this[path] = value; this[path] = value;
this.requestUpdate(path);
} else if (Array.isArray(path)) { } else if (Array.isArray(path)) {
// Handle nested path like ['channelsState', key] // Handle nested paths like ['channelsState', key] or ['userState', key]
if (path.length === 2 && path[0] === 'channelsState') { if (path.length === 2 && path[0] === 'channelsState') {
this.channelsState = {...this.channelsState, [path[1]]: value}; this.channelsState = {...this.channelsState, [path[1]]: value};
} else if (path.length === 2 && path[0] === 'userState') {
this.userState = {...this.userState, [path[1]]: value};
} }
} }
} }

View file

@ -58,7 +58,6 @@ c.template_context['attachment_store'] = {
</%def> </%def>
${self.robots()} ${self.robots()}
<link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" /> <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
<script src="${h.asset('js/vendors/webcomponentsjs/custom-elements-es5-adapter.js', ver=c.rhodecode_version_hash)}"></script>
<script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-bundle.js', ver=c.rhodecode_version_hash)}"></script> <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-bundle.js', ver=c.rhodecode_version_hash)}"></script>
## CSS definitions ## CSS definitions

File diff suppressed because one or more lines are too long

View file

@ -15,7 +15,7 @@ let babelRCOptions = {
"presets": [ "presets": [
["env", { ["env", {
"targets": { "targets": {
"browsers": ["last 2 versions"] "browsers": ["Chrome >= 67", "Firefox >= 63", "Safari >= 11.1", "Edge >= 79"]
}, },
"exclude": [ "exclude": [
"transform-es2015-classes", "transform-es2015-classes",
@ -75,9 +75,10 @@ module.exports = {
{ {
// If you see a file that ends in .js, just send it to the babel-loader. // If you see a file that ends in .js, just send it to the babel-loader.
test: /\.js$/, test: /\.js$/,
// Exclude node_modules, but process our Lit components
// Babel is configured to NOT transpile ES6 classes (see babelRCOptions exclude)
exclude: /node_modules/,
use: {loader: 'babel-loader', options: babelRCOptions} use: {loader: 'babel-loader', options: babelRCOptions}
// Optionally exclude node_modules from transpilation except for polymer-webpack-loader:
// exclude: /node_modules\/(?!polymer-webpack-loader\/).*/
}, },
// this is required because of bug: // this is required because of bug:
// https://github.com/webpack-contrib/polymer-webpack-loader/issues/49 // https://github.com/webpack-contrib/polymer-webpack-loader/issues/49