4 OOUI is a component-based JavaScript UI library. Key features:
6 * Common widgets, layouts, and dialogs
7 * Classes, elements, and mixins to create custom interfaces
8 * Internationalization and localization, like right-to-left (RTL) languages support
11 * Accessibility features
13 It is the standard library for Web products at the Wikimedia Foundation, having been originally created for use by [VisualEditor](https://www.mediawiki.org/wiki/VisualEditor).
19 The library is available on [npm](https://www.npmjs.com/package/oojs-ui). To install:
25 Once installed, include the following scripts and styles to get started:
28 <script src="node_modules/jquery/dist/jquery.min.js"></script>
29 <script src="node_modules/oojs/dist/oojs.min.js"></script>
31 <script src="node_modules/oojs-ui/dist/oojs-ui.min.js"></script>
32 <script src="node_modules/oojs-ui/dist/oojs-ui-wikimediaui.min.js"></script>
33 <link rel="stylesheet" href="node_modules/oojs-ui/dist/oojs-ui-wikimediaui.min.css">
40 While the distribution directory is chock-full of files, you will normally load only the following three:
42 * `oojs-ui.js`, containing the full library;
43 * One of `oojs-ui-wikimediaui.css` or `oojs-ui-apex.css`, containing theme-specific styles; and
44 * One of `oojs-ui-wikimediaui.js` or `oojs-ui-apex.js`, containing theme-specific code
46 You can load additional icon packs from files named `oojs-ui-wikimediaui-icons-*.css` or `oojs-ui-apex-icons-*.css`.
48 The remaining files make it possible to load only parts of the whole library.
50 Furthermore, every CSS file has a right-to-left (RTL) version available, to be used on pages using right-to-left languages if your environment doesn't automatically flip them as needed.
56 Found a bug or missing feature? Please report it in our [issue tracker Phabricator](https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=PHID-PROJ-dgmoevjqeqlerleqzzx5)!
62 We are always delighted when people contribute patches. To setup your development environment:
65 1. Clone the repo: `$ git clone https://gerrit.wikimedia.org/r/oojs/ui oojs-ui`
67 2. Move into the library directory:<br>`$ cd oojs-ui`
69 3. Install [composer](https://getcomposer.org/download/) and make sure running `composer` will execute it (*e.g.* add it to `$PATH` in POSIX environments).
71 4. Install dev dependencies:<br>`$ npm install`
73 5. Build the library (you can alternatively use `grunt quick-build` if you don't need to rebuild the PNGs):<br>`$ grunt build`
75 6. You can see a suite of demos in `/demos` by executing:<br>`$ npm run-script demos`
77 7. You can also copy the distribution files from the dist directory into your project.
79 8. You can start a local web server by running `php -S localhost:80` in your root dir.
81 9. You can navigate to http://localhost/tests/ to run the tests locally in your browser.
83 We use [Gerrit](https://gerrit.wikimedia.org/) for code review, and [Phabricator](https://phabricator.wikimedia.org) to track issues. To contribute patches or join discussions all you need is a [developer account](https://wikitech.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Help%3AGetting+Started).
85 * If you've found a bug, or wish to request a feature [raise a ticket on Phabricator](https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=PHID-PROJ-dgmoevjqeqlerleqzzx5).
86 * To submit your patch, follow [the "getting started" quick-guide](https://www.mediawiki.org/wiki/Gerrit/Getting_started). We try to review patches within a week.
87 * We automatically lint and style-check changes to JavaScript, PHP, LESS/CSS, Ruby and JSON files. You can test these yourself with `npm test` and `composer test` locally before pushing changes. SVG files should be squashed in advance of committing with [SVGO](https://github.com/svg/svgo) using `svgo --pretty --disable=removeXMLProcInst --disable=cleanupIDs <filename>`.
89 A new version of the library is released most weeks on Tuesdays.
94 Get updates, ask questions and join the discussion with maintainers and contributors:
96 * Join the Wikimedia Developers mailing list, [wikitech-l](https://lists.wikimedia.org/mailman/listinfo/wikitech-l).
97 * Chat with the maintainers on `#wikimedia-dev` on `irc.libera.chat`.
98 * Ask questions on [StackOverflow](https://stackoverflow.com/tags/oojs-ui/info).
99 * Watchlist the [documentation](https://www.mediawiki.org/wiki/OOUI) on MediaWiki to stay updated.
105 We use the [Semantic Versioning guidelines](http://semver.org/).
107 Releases will be numbered in the following format:
109 `<major>.<minor>.<patch>`
116 - [Create an NPM account](https://www.npmjs.com/signup), if you don't have one already
117 - Verify that you can [log into your NPM account](https://www.npmjs.com/login)
118 - Verify that you are [listed as a maintainer](https://www.npmjs.com/package/oojs-ui/access)
119 of the oojs-ui package. If not, ask an existing maintainer to add you.
120 - Make sure that you have two-factor authentication (2FA) set up.
121 - Run `npm login` and follow the steps. You should only need to do this once on each computer.
122 If you're not sure if you've already done this, you can run `npm whoami`; if it prints your
123 NPM username, you're already logged in.
124 - Clone the mediawiki/vendor repository: https://gerrit.wikimedia.org/r/admin/repos/mediawiki/vendor,general
126 ### Prepare and submit the release commit
127 From the root of this repository, update master and check out a new `release` branch:
130 $ git checkout -B release -t origin/master
133 Clean-install npm dependencies, update Composer dependencies, and ensure tests pass:
135 $ npm ci && composer update && npm test && composer test
138 Generate a list of commits that are part of this release:
140 $ git log --format='* %s (%aN)' --no-merges v$(node -e 'console.log(require("./package").version);')...HEAD | grep -v "Localisation updates from" | sort
143 In History.md, add a new heading for this version and date. Copy the list of commits into the new
144 section and sort into five sub-sections, in order, omitting any sub-section that has no commits:
153 Generate the list of Phabricator tasks for this release. Copy the resulting list and save it for
154 later. In a later step, you will add it to the commit message of the MediaWiki core commit.
156 $ git log --pretty=format:%b v$(node -e 'console.log(require("./package").version);')...HEAD | grep Bug: | sort | uniq
159 Update the version number (in the following command, change 'patch' to 'minor' if you've made
162 $ npm version patch --git-tag-version=false
165 Commit the release and submit to Gerrit. Note that if there is a Phabricator task associated with
166 the release, you should edit the commit to add the bug number before running `git review`.
169 $ git commit -m "Tag v$(node -e 'console.log(require("./package").version);')"
173 ### Publish the tag and push to NPM
174 After the tag commit is merged in this repo, push the tag and publish to NPM:
177 $ git checkout origin/master
178 $ git tag "v$(node -e 'console.log(require("./package").version);')"
179 $ npm run publish-build && git push --tags && npm publish
182 ### Update the mediawiki/vendor repo
183 In your local mediawiki/vendor repo, point composer to the new version and pull in the updated
186 # Replace 1.2.34 with the version number of the new release
187 $ composer require oojs/oojs-ui 1.2.34 --no-update
188 $ composer update --no-dev
191 Then commit the changes with the following commit message, replacing 1.2.34 with the new OOUI
192 version number (example: https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/813629).
198 Commit message format:
200 Update OOUI to v1.2.34
202 Release notes: https://gerrit.wikimedia.org/g/oojs/ui/+/v1.2.34/History.md
205 Push this to gerrit. Take note of the Change-Id in the commit message. Copy it and save it for
206 later. You will need it for the Depends-On: line in the commit message when updating MediaWiki.
209 # Show the last commit
213 ### Update the MediaWiki core repo
215 In your local MediaWiki core repo, open `composer.json` and update the version number of
216 `oojs/oojs-ui` to the new version number.
218 Open `RELEASE-NOTES-1.NN`. If there is already a list item about OOUI, update the latest version
219 number. For example, if there is a list item that says "Updated OOUI from v1.2.0 to v1.2.33",
220 update the latter version number fo `v1.2.34`. If there isn't a list item about OOUI yet, add one
221 in the `Changed external libraries` section.
223 Open `resources/lib/foreign-resources.yaml`. For the OOUI listing, change the `version`, the `purl`,
224 and the `src` URL to use the new version number. Compute the new integrity hash:
227 $ php maintenance/run.php manageForeignResources make-sri ooui
228 # Or if you're running Docker...
229 $ docker compose exec mediawiki php maintenance/run.php manageForeignResources make-sri ooui
232 Then update the OOUI library files:
234 $ php maintenance/run.php manageForeignResources update ooui
235 # Or if you're running Docker...
236 $ docker compose exec mediawiki php maintenance/run.php manageForeignResources update ooui
239 Then run the following command to update `foreign-resources.cdx.json`:
241 $ php maintenance/run.php manageForeignResources make-cdx
242 # Or if you're running Docker...
243 $ docker compose exec mediawiki php maintenance/run.php manageForeignResources make-cdx
246 Then commit the changes with the following commit message, replacing 1.2.34 with the new OOUI
253 Commit message format, where the list of bugs is the list you generated during the OOUI tag step,
254 and Depends-On is set to the Change-Id of the mediawiki/vendor commit:
256 Update OOUI to v1.2.34
258 Release notes: https://gerrit.wikimedia.org/g/oojs/ui/+/v1.2.34/History.md
262 Depends-On: I12345678901234567890
265 Then push that commit to gerrit:
270 ### Update the VisualEditor/VisualEditor repo
271 In your local VisualEditor/VisualEditor repo, run the script to create a commit updating the local
272 copy of OOUI, and push the commit to Gerrit:
275 $ ./bin/update-ooui.sh