summaryrefslogtreecommitdiffstats
path: root/Documentation/pg-plugin-dev.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/pg-plugin-dev.txt')
-rw-r--r--Documentation/pg-plugin-dev.txt51
1 files changed, 19 insertions, 32 deletions
diff --git a/Documentation/pg-plugin-dev.txt b/Documentation/pg-plugin-dev.txt
index dc65da6e25..381c3e1fb3 100644
--- a/Documentation/pg-plugin-dev.txt
+++ b/Documentation/pg-plugin-dev.txt
@@ -30,10 +30,6 @@ Gerrit.install(plugin => {
});
```
-You can find more elaborate examples in the
-link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/samples/[polygerrit-ui/app/samples/]
-directory of the source tree.
-
== TypeScript API ==
Gerrit provides a TypeScript plugin API.
@@ -122,32 +118,26 @@ Gerrit.install(plugin => {
[[low-level-style]]
=== Styling DOM Elements
-A plugin may provide Polymer's
-https://polymer-library.polymer-project.org/3.0/docs/devguide/style-shadow-dom[style
-modules,role=external,window=_blank] to style individual endpoints using
-`plugin.registerStyleModule(endpointName, moduleName)`. A style must be defined
-as a standalone `<dom-module>` defined in the same .js file.
+Gerrit only offers customized CSS styling by setting
+link:https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_[custom_properties]
+(aka css variables).
-See
-link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/samples/theme-plugin.js[samples/theme-plugin.js]
-for an example.
+See link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/styles/themes/[app-theme.ts]
+for the list of available variables.
-``` js
-const styleElement = document.createElement('dom-module');
-styleElement.innerHTML =
- `<template>
- <style>
- html {
- --primary-text-color: red;
- }
- </style>
- </template>`;
-
-styleElement.register('some-style-module');
+Just add code like this to your JavaScript plugin:
-Gerrit.install(plugin => {
- plugin.registerStyleModule('change-metadata', 'some-style-module');
-});
+``` js
+ const styleEl = document.createElement('style');
+ styleEl.innerHTML = `
+ html {
+ --header-background-color: #c3d9ff;
+ }
+ html.darkTheme {
+ --header-background-color: #c3d9ff90;
+ }
+ `;
+ document.head.appendChild(styleEl);
```
[[high-level-api-concepts]]
@@ -173,10 +163,6 @@ link:https://polymer-library.polymer-project.org/3.0/docs/devguide/data-binding[
binding,role=external,window=_blank] for plugins that don't use Polymer. Can be used to bind element
attribute changes to callbacks.
-See
-link:https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/app/samples/bind-parameters.js[samples/bind-parameters.js]
-for an example.
-
=== hook
`plugin.hook(endpointName, opt_options)`
@@ -196,7 +182,8 @@ See link:pg-plugin-endpoints.html[endpoints].
=== registerStyleModule
`plugin.registerStyleModule(endpointName, moduleName)`
-See link:#low-level-style[above].
+This API is deprecated and will be removed either in version 3.6 or 3.7,
+see link:#low-level-style[above] for an alternative.
=== on
Register a JavaScript callback to be invoked when events occur within