oojs / oojs-ui
Provides library of common widgets, layouts, and windows.
Installs: 807 697
Dependents: 2
Suggesters: 0
Security: 0
Stars: 63
Watchers: 11
Forks: 28
Language:JavaScript
Requires
- php: >=7.4.3
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 45.0.0
- mediawiki/mediawiki-phan-config: 0.14.0
- mediawiki/minus-x: 1.1.3
- php-parallel-lint/php-console-highlighter: 1.0.0
- php-parallel-lint/php-parallel-lint: 1.4.0
- phpunit/phpunit: 9.6.21
- dev-master
- v0.51.4
- v0.51.3
- v0.51.2
- v0.51.1
- v0.51.0
- v0.50.4
- v0.50.3
- v0.50.2
- v0.50.1
- v0.50.0
- v0.49.2
- v0.49.1
- v0.49.0
- v0.48.4
- v0.48.3
- v0.48.2
- v0.48.1
- v0.48.0
- v0.47.5
- v0.47.4
- v0.47.3
- v0.47.2
- v0.47.1
- v0.47.0
- v0.46.3
- v0.46.2
- v0.46.1
- v0.46.0
- v0.45.0
- v0.44.x-dev
- v0.44.5
- v0.44.4
- v0.44.3
- v0.44.2
- v0.44.1
- v0.44.0
- v0.43.2
- v0.43.1
- v0.43.0
- v0.42.1
- v0.42.0
- v0.41.3
- v0.41.2
- v0.41.1
- v0.41.0
- v0.40.4
- v0.40.3
- v0.40.2
- v0.40.1
- v0.40.0
- v0.39.3
- v0.39.2
- v0.39.1
- v0.39.0
- v0.38.1
- v0.38.0
- v0.37.1
- v0.37.0
- v0.36.5
- v0.36.4
- v0.36.3
- v0.36.2
- v0.36.1
- v0.36.0
- v0.35.1
- v0.35.0
- v0.34.1
- v0.34.0
- v0.33.4
- v0.33.3
- v0.33.2
- v0.33.1
- v0.33.0
- v0.32.1
- v0.32.0
- v0.31.6
- v0.31.5
- v0.31.4
- v0.31.3
- v0.31.2
- v0.31.1
- v0.31.0
- v0.30.4
- v0.30.3
- v0.30.2
- v0.30.1
- v0.30.0
- v0.29.6
- v0.29.5
- v0.29.4
- v0.29.3
- v0.29.2
- v0.29.1
- v0.29.0
- v0.28.2
- v0.28.1
- v0.28.0
- v0.27.6
- v0.27.5
- v0.27.4
- v0.27.3
- v0.27.2
- v0.27.1
- v0.27.0
- v0.26.5
- v0.26.4
- v0.26.3
- v0.26.2
- v0.26.1
- v0.26.0
- v0.25.3
- v0.25.2
- v0.25.1
- v0.25.0
- v0.24.4.x-dev
- v0.24.4
- v0.24.3
- v0.24.2
- v0.24.1
- v0.24.0
- v0.23.5
- v0.23.4
- v0.23.3
- v0.23.2
- v0.23.1
- v0.23.0
- v0.22.5
- v0.22.4
- v0.22.3
- v0.22.2
- v0.22.1
- v0.22.0
- v0.21.4
- v0.21.3
- v0.21.2
- v0.21.1
- v0.21.0
- v0.20.2
- v0.20.1
- v0.20.0
- v0.19.5
- v0.19.4
- v0.19.3
- v0.19.2
- v0.19.1
- v0.19.0
- v0.18.4
- v0.18.3
- v0.18.2
- v0.18.1
- v0.18.0
- v0.17.10
- v0.17.9
- v0.17.8
- v0.17.7
- v0.17.6
- v0.17.5
- v0.17.4
- v0.17.3
- v0.17.2
- v0.17.1
- v0.17.0
- v0.16.6
- v0.16.5
- v0.16.4
- v0.16.3
- v0.16.2
- v0.16.1
- v0.16.0
- v0.15.4
- v0.15.3
- v0.15.2
- v0.15.1
- v0.15.0
- v0.14.1
- v0.14.0
- v0.13.3
- v0.13.2
- v0.13.1
- v0.13.0
- v0.12.12
- v0.12.11
- v0.12.10
- v0.12.9
- v0.12.8.1
- v0.12.8
- v0.12.7
- v0.12.6
- v0.12.5
- v0.12.4
- v0.12.3
- v0.12.2
- v0.12.1
- v0.12.0
- v0.11.8
- v0.11.7
- v0.11.6
- v0.11.5
- v0.11.4
- v0.11.3
- v0.11.2
- v0.11.1
- v0.11.0
- v0.10.1
- v0.10.0
- v0.9.8
- v0.9.7
- v0.9.6
- v0.9.5
- v0.9.4
- v0.9.3
- v0.9.2
- v0.9.1
- v0.9.0
- v0.8.3
- v0.8.2
- v0.8.1
- v0.8.0
- v0.7.0
- v0.6.6
- v0.6.5
- v0.6.4
- v0.6.3
- v0.6.2
- v0.6.1
- v0.6.0
- v0.5.0
- v0.4.0
- v0.3.0
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- dev-0.23.0-no-at-ease
This package is auto-updated.
Last update: 2024-12-20 03:07:03 UTC
README
OOUI is a component-based JavaScript UI library. Key features:
- Common widgets, layouts, and dialogs
- Classes, elements, and mixins to create custom interfaces
- Internationalization and localization, like right-to-left (RTL) languages support
- Theme-ability
- Built-in icons
- Accessibility features
It is the standard library for Web products at the Wikimedia Foundation, having been originally created for use by VisualEditor.
Quick start
The library is available on npm. To install:
$ npm install oojs-ui
Once installed, include the following scripts and styles to get started:
<script src="node_modules/jquery/dist/jquery.min.js"></script> <script src="node_modules/oojs/dist/oojs.min.js"></script> <script src="node_modules/oojs-ui/dist/oojs-ui.min.js"></script> <script src="node_modules/oojs-ui/dist/oojs-ui-wikimediaui.min.js"></script> <link rel="stylesheet" href="node_modules/oojs-ui/dist/oojs-ui-wikimediaui.min.css">
Loading the library
While the distribution directory is chock-full of files, you will normally load only the following three:
oojs-ui.js
, containing the full library;- One of
oojs-ui-wikimediaui.css
oroojs-ui-apex.css
, containing theme-specific styles; and - One of
oojs-ui-wikimediaui.js
oroojs-ui-apex.js
, containing theme-specific code
You can load additional icon packs from files named oojs-ui-wikimediaui-icons-*.css
or oojs-ui-apex-icons-*.css
.
The remaining files make it possible to load only parts of the whole library.
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.
Issue tracker
Found a bug or missing feature? Please report it in our issue tracker Phabricator!
Contributing
We are always delighted when people contribute patches. To setup your development environment:
-
Clone the repo:
$ git clone https://gerrit.wikimedia.org/r/oojs/ui oojs-ui
-
Move into the library directory:
$ cd oojs-ui
-
Install composer and make sure running
composer
will execute it (e.g. add it to$PATH
in POSIX environments). -
Install dev dependencies:
$ npm install
-
Build the library (you can alternatively use
grunt quick-build
if you don't need to rebuild the PNGs):$ grunt build
-
You can see a suite of demos in
/demos
by executing:$ npm run-script demos
-
You can also copy the distribution files from the dist directory into your project.
-
You can start a local web server by running
php -S localhost:80
in your root dir. -
You can navigate to http://localhost/tests/ to run the tests locally in your browser.
We use Gerrit for code review, and Phabricator to track issues. To contribute patches or join discussions all you need is a developer account.
- If you've found a bug, or wish to request a feature raise a ticket on Phabricator.
- To submit your patch, follow the "getting started" quick-guide. We try to review patches within a week.
- We automatically lint and style-check changes to JavaScript, PHP, LESS/CSS, Ruby and JSON files. You can test these yourself with
npm test
andcomposer test
locally before pushing changes. SVG files should be squashed in advance of committing with SVGO usingsvgo --pretty --disable=removeXMLProcInst --disable=cleanupIDs <filename>
.
A new version of the library is released most weeks on Tuesdays.
Community
Get updates, ask questions and join the discussion with maintainers and contributors:
- Join the Wikimedia Developers mailing list, wikitech-l.
- Chat with the maintainers on
#wikimedia-dev
onirc.libera.chat
. - Ask questions on StackOverflow.
- Watchlist the documentation on MediaWiki to stay updated.
Versioning
We use the Semantic Versioning guidelines.
Releases will be numbered in the following format:
<major>.<minor>.<patch>
Release
Prerequisites
- Create an NPM account, if you don't have one already
- Verify that you can log into your NPM account
- Verify that you are listed as a maintainer of the oojs-ui package. If not, ask an existing maintainer to add you.
- Make sure that you have two-factor authentication (2FA) set up.
- Run
npm login
and follow the steps. You should only need to do this once on each computer. If you're not sure if you've already done this, you can runnpm whoami
; if it prints your NPM username, you're already logged in. - Clone the mediawiki/vendor repository: https://gerrit.wikimedia.org/r/admin/repos/mediawiki/vendor,general
Prepare and submit the release commit
From the root of this repository, update master and check out a new release
branch:
$ git remote update $ git checkout -B release -t origin/master
Clean-install npm dependencies, update Composer dependencies, and ensure tests pass:
$ npm ci && composer update && npm test && composer test
Generate a list of commits that are part of this release:
$ git log --format='* %s (%aN)' --no-merges v$(node -e 'console.log(require("./package").version);')...HEAD | grep -v "Localisation updates from" | sort
In History.md, add a new heading for this version and date. Copy the list of commits into the new section and sort into five sub-sections, in order, omitting any sub-section that has no commits:
### Breaking changes ### Deprecations ### Features ### Styles ### Code
Generate the list of Phabricator tasks for this release. Copy the resulting list and save it for later. In a later step, you will add it to the commit message of the MediaWiki core commit.
$ git log --pretty=format:%b v$(node -e 'console.log(require("./package").version);')...HEAD | grep Bug: | sort | uniq
Update the version number (in the following command, change 'patch' to 'minor' if you've made breaking changes):
$ npm version patch --git-tag-version=false
Commit the release and submit to Gerrit. Note that if there is a Phabricator task associated with
the release, you should edit the commit to add the bug number before running git review
.
$ git add -u
$ git commit -m "Tag v$(node -e 'console.log(require("./package").version);')"
$ git review
Publish the tag and push to NPM
After the tag commit is merged in this repo, push the tag and publish to NPM:
$ git remote update $ git checkout origin/master $ git tag "v$(node -e 'console.log(require("./package").version);')" $ npm run publish-build && git push --tags && npm publish
Update the mediawiki/vendor repo
In your local mediawiki/vendor repo, point composer to the new version and pull in the updated vendor files:
# Replace 1.2.34 with the version number of the new release
$ composer require oojs/oojs-ui 1.2.34 --no-update
$ composer update --no-dev
Then commit the changes with the following commit message, replacing 1.2.34 with the new OOUI version number (example: https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/813629).
$ git add -u $ git commit
Commit message format:
Update OOUI to v1.2.34 Release notes: https://gerrit.wikimedia.org/g/oojs/ui/+/v1.2.34/History.md
Push this to gerrit. Take note of the Change-Id in the commit message. Copy it and save it for later. You will need it for the Depends-On: line in the commit message when updating MediaWiki.
$ git review
# Show the last commit
$ git show --stat
Update the MediaWiki core repo
In your local MediaWiki core repo, open composer.json
and update the version number of
oojs/oojs-ui
to the new version number.
Open RELEASE-NOTES-1.NN
. If there is already a list item about OOUI, update the latest version
number. For example, if there is a list item that says "Updated OOUI from v1.2.0 to v1.2.33",
update the latter version number fo v1.2.34
. If there isn't a list item about OOUI yet, add one
in the Changed external libraries
section.
Open resources/lib/foreign-resources.yaml
. For the OOUI listing, change the version
, the purl
,
and the src
URL to use the new version number. Compute the new integrity hash:
$ php maintenance/run.php manageForeignResources make-sri ooui # Or if you're running Docker... $ docker compose exec mediawiki php maintenance/run.php manageForeignResources make-sri ooui
Then update the OOUI library files:
$ php maintenance/run.php manageForeignResources update ooui # Or if you're running Docker... $ docker compose exec mediawiki php maintenance/run.php manageForeignResources update ooui
Then run the following command to update foreign-resources.cdx.json
:
$ php maintenance/run.php manageForeignResources make-cdx # Or if you're running Docker... $ docker compose exec mediawiki php maintenance/run.php manageForeignResources make-cdx
Then commit the changes with the following commit message, replacing 1.2.34 with the new OOUI version number:
$ git add -u $ git commit
Commit message format, where the list of bugs is the list you generated during the OOUI tag step, and Depends-On is set to the Change-Id of the mediawiki/vendor commit:
Update OOUI to v1.2.34 Release notes: https://gerrit.wikimedia.org/g/oojs/ui/+/v1.2.34/History.md Bug: T123456 Bug: T234567 Depends-On: I12345678901234567890
Then push that commit to gerrit:
git review
Update the VisualEditor/VisualEditor repo
In your local VisualEditor/VisualEditor repo, run the script to create a commit updating the local copy of OOUI, and push the commit to Gerrit:
$ ./bin/update-ooui.sh $ git review