Commit graph

3103 commits

Author SHA1 Message Date
Translation updater bot e7a44591a8 Localisation updates from https://translatewiki.net.
Change-Id: I6f46998c05fd6064563f161cbf000bfc2b762690
2024-03-25 08:36:31 +01:00
Fomafix 61c539d205 Get ResourceLoader from Context
Change-Id: I439266105ef18612da50a3d306b04a835c648eae
2024-03-23 08:38:13 +00:00
jenkins-bot fc9c41ee05 Merge "Inject 'Popups.Logger' into PopupsHooks" 2024-03-21 22:30:10 +00:00
jenkins-bot 3f0ecfe721 Merge "Inject Popups services into PopupsHooks" 2024-03-21 22:30:08 +00:00
Ed Sanders d4b0d10b13 Account for scroll offset when using non-mouse positioning
offsetTop includes the scroll offset, so when using it to
calculate clientTop (position relative to the viewport),
we need to substract that offset.

clientY comes from mouse events and is already relative
to the viewport so needs no adjustment.

Bug: T270215
Change-Id: I545b14059f416678fc0d35413a76334e57bfc495
2024-03-21 13:35:13 +00:00
Translation updater bot b46fc85941 Localisation updates from https://translatewiki.net.
Change-Id: I7921456f63163fc6806b6f20118e76e5d5299dca
2024-03-20 08:24:24 +01:00
Moh'd Khier Abualruz 609fb8149d Rename the skin night mode classes to more readable classes
The classes:
- skin-night-mode-clientpref-0
- skin-night-mode-clientpref-1
- skin-night-mode-clientpref-2
is being replaced with
- skin-theme-clientpref-day
- skin-theme-clientpref-night
- skin-theme-clientpref-os

Depends-on: Ia253de68f94236e7fe2219b736dd6084c64ce838

Bug: T359983
Change-Id: I262e07dfa6e5d8b38c06bff9aab8fa15e4cddee1
2024-03-19 23:28:39 +00:00
Fomafix 1ce8b38f9f Inject 'Popups.Logger' into PopupsHooks
The function PopupsContext::getLogger is not needed anymore.

Change-Id: Ib538372f1480d282857d827fedbe0ebe9abc0685
2024-03-19 20:26:53 +00:00
Fomafix a523b79232 Inject Popups services into PopupsHooks
Change-Id: I16ebb2aff9afab0449e3cc4b58a7ac6b3ed9870a
2024-03-19 20:10:36 +00:00
Adam Wight cf2a10e42e Remove referencePreviews tests
These are causing trouble because of the forwards-compatibility
logic.  When Cite is present, we transparently switch to using that
code base for reference previews which means these tests are running
against the wrong code.  Dropping tests here in favor of the Cite
tests.

Bug: T355194
Change-Id: Ide1940ad1e915eee7127f36fb2a7c87b5fb6f88a
2024-03-18 13:55:20 +01:00
jenkins-bot 2245ecee4e Merge "Fix popups night mode" 2024-03-13 20:26:10 +00:00
bwang 36160150cd Fix popups night mode
Bug: T359081
Change-Id: I96d5e292c71050d8ae7cdd12337a045ce146a5cc
2024-03-13 11:04:06 -05:00
Umherirrender 407a1011e9 build: Upgrade mediawiki/mediawiki-codesniffer to v43.0.0
Change-Id: I6b1cae8b9cc7a99e839e86f2db3f8d9e9b3ee546
2024-03-11 20:43:15 +01:00
Translation updater bot c555fd4840 Localisation updates from https://translatewiki.net.
Change-Id: I1134f6459252418dd18c45e44935e7c6b2d62397
2024-03-04 08:23:58 +01:00
Translation updater bot cdcf45aca1 Localisation updates from https://translatewiki.net.
Change-Id: I40d66c07bd26de32b5dd1da8c2b385368b30feb4
2024-03-01 08:33:54 +01:00
Translation updater bot 8f735476bb Localisation updates from https://translatewiki.net.
Change-Id: Ieac58ac10e75badc0cad4b1cfeca28b337e1e895
2024-02-26 08:36:52 +01:00
Translation updater bot 6cc868a9e1 Localisation updates from https://translatewiki.net.
Change-Id: Ie21c7d47344d87f17f426e2ffacbea8d53932d0b
2024-02-23 08:45:06 +01:00
Umherirrender 39f843226e build: Updating mediawiki/mediawiki-phan-config to 0.14.0
Change-Id: Id865d07d072ad22283d0aee5e7645f110beb7130
2024-02-19 20:53:00 +01:00
Translation updater bot 4c6f3f6062 Localisation updates from https://translatewiki.net.
Change-Id: I333c55291995775aa1085e6b571a269d4b53b1e6
2024-02-19 08:40:52 +01:00
Translation updater bot c32bac580f Localisation updates from https://translatewiki.net.
Change-Id: Ieff0237a168fe0466ed189d5a3141b892f14aa60
2024-02-15 13:28:54 +01:00
Translation updater bot 07bf389530 Localisation updates from https://translatewiki.net.
Change-Id: I956c8d5ffc0189a5948f9013a6a921db1b6efa45
2024-02-12 14:50:20 +01:00
jenkins-bot 15cf983fdb Merge "Allow Cite to define the reference preview module instead" 2024-02-08 16:09:02 +00:00
jenkins-bot cbe69cbf53 Merge "Reference previews should no longer use Webpack" 2024-02-08 16:09:00 +00:00
James D. Forrester 608fa2b69d build: Upgrade browserslist-config-wikimedia from 0.5.1 to 0.6.0
Change-Id: I8d0a00efb0464149951af33b7d24e407035c8d08
2024-02-07 14:32:44 -05:00
Jon Robson e9ac5dcf47 Allow Cite to define the reference preview module instead
This provides backwards compatibility with Cite, if Cite has register
its own preview module for reference tooltips.

Bug: T355194
Change-Id: Iec6f3d4d6c5f765c151ae0dbba258049530e6bc0
2024-02-02 10:59:04 -08:00
Jon Robson 7172aae082 Reference previews should no longer use Webpack
As a precursor to moving this code to the Cite extension move it off
of webpack and switch to using require rather than import

Bug: T355194
Change-Id: Ib6486ad38b79a3b67a9744b716b1a2f5d3779795
2024-02-02 10:52:30 -08:00
Translation updater bot f36b554739 Localisation updates from https://translatewiki.net.
Change-Id: I9bd30556b5e546aeed67bf248317e6fc92121168
2024-02-02 08:54:01 +01:00
Umherirrender f5dd9a0bbf Add return type hint to functions in ServiceWiring.php
This is a common pattern for service wiring functions

Change-Id: I2c6a6b95ad5f9d69f90631ede39882e41e7c85df
2024-02-01 19:18:16 +01:00
Jon Robson 51059828bf Do not search for elements if no previews have been registered
The findNearestEligibleTarget method is now being called with an
empty array and thus an empty string as a selector

Follow up to
I5f293a134521f086c9f62babb9d06cd9c51d7d47

Bug: T355933
Bug: T356186
Bug: T356193
Change-Id: I3af44ae65d5097fc44744838a4edb07552568b17
2024-01-30 16:42:14 +00:00
Jon Robson 8e4996485f Add new @stable event.Popups.SettingChange event
Extensions may want to log metrics relating to settings being enabled
or disabled. This is currently the case with reference previews.

This is a follow up to
I1c434f0098ae23bd62256686a658e3d5ef7f70b9

Additional change: Add FIXME clarifying migrateOldPreferences is temporary
and setting a date it can be removed.

Bug: T353798
Change-Id: If9bac123d731e7da7429ba3a0ea92e80263df6a6
2024-01-29 14:42:11 -08:00
jenkins-bot 8fc7222b26 Merge "Don't bail out early when there are no selectors configured" 2024-01-29 22:28:22 +00:00
Translation updater bot dd0b924cb8 Localisation updates from https://translatewiki.net.
Change-Id: I1b306f378fa69fd87dd3d2a2529f466d5d4bc8e0
2024-01-28 16:07:51 +01:00
WMDE-Fisch bf10902f23 Don't bail out early when there are no selectors configured
It seems to me, that at this point 3rd parties might not have been
loaded that want to add custom preview types. So the list of
selectors is empty.

We still might want to initialze though for 3rd parties that load
later.

Bug: T355933
Change-Id: I5f293a134521f086c9f62babb9d06cd9c51d7d47
2024-01-26 12:38:47 +01:00
WMDE-Fisch 694b96a19f Set a global when reference previews are visible.
Used for tracking baseline stats in the Cite extension.

Also fixed the wireing of the Reference Preview type constant so
that the settings can be tracked. Not sure where this should go
best in the new code.

Bug: T353798
Change-Id: I1c434f0098ae23bd62256686a658e3d5ef7f70b9
2024-01-17 16:19:09 -08:00
WMDE-Fisch e15e2c4d14 Increase test coverage
More of a random thing done to increase the coverage a bit because
there are upcomming features that seem to be hard to test.

- Found one test case in reference previews that was configured
  wrongly

- Adding some sanity checks to the settingsDialogRender test

Change-Id: I95d3c6f30388b2dcc76b018d5dc0f958d06aad91
2024-01-16 10:44:53 +00:00
Jon Robson 381f8f5f7d Reduce bundlesize of reference previews by making it use stable APIs
This is a precursor to moving the code out to the Cite extension.

This can be squashed into parent commit or merged at same time.

I've kept the two patches separate to make them easier to review.

Bug: T326692
Change-Id: I50dbf28a1078df6c73fd0fbf77480488dd82c7b3
2024-01-16 11:44:07 +01:00
Jon Robson 59c6b8e88f Reference previews should use Popups registration
* Adds a new webpack entry point for references previews
* Reference related code in src/index.js is moved to new
file resources/ext.popups.referencePreviews/index.js

The changes:
* References previews now in its own module ext.popups.referencePreviews
* Loaded via getCustomPopupTypes
* OWNERS.md files make clear which team owns which part of the code.

Bug: T326692
Change-Id: Iea8a5b9221c0b1fd41e40bff2cbe01e42124d53f
2024-01-16 11:38:08 +01:00
Volker E 31ef381e90 build: Update 'svgo' to latest v3.2.0 and re-minify SVGs
The latest update of 'svgo' dependency includes three optimizations on
converting path commands, which
- improves closing paths and how we determine if to use absolute or
  relative commands.
- round arc or convert to lines based on the geometric sagitta
- convert cubic Bézier curves to quadratic Bézier curves where possible

Bug: T354875
Change-Id: Ibd611396c48ff6f971ee251b59f13e350e0f812f
2024-01-16 00:13:08 +01:00
James D. Forrester 2ef5278784 extension.json: Drop 'es6' flag, always true since MediaWiki 1.41
Change-Id: I6f8b1ce80138a98037ac245b2dc551c5e9167349
2024-01-12 19:04:39 -05:00
WMDE-Fisch a3f3cf9e3f build: Update eslint 0.26.0 and apply fixes
Mainly auto fixes but also getting rid of some straight forward lint
warnings to reduce the wall of issues a bit when running the tests.

Also removing some rule exceptions that seem to got more relaxed
upstream.

Change-Id: Icb4d73374583675be74517e6df6508314d61e8c2
2024-01-12 13:50:19 -05:00
James D. Forrester 863c442c32 .nvmrc: Update now we're using Node 18, and make CI pass
* Babel upgraded to a version that works with new Node's OpenSSL.
* Various loaders upgraded to match
* Babel config changed as plugin-proposal-private-property-in-object is now official
* Webpack config updated as noEmitOnErrors was renamed to not be a negation
* Webpack config updated as namedModules was renamed to the wider moduleIds
* Ignore the built Webpack output from eslint

Bug: T354943
Change-Id: I449f601b8218925d96bfb423fc0f349214d08385
2024-01-12 13:50:19 -05:00
jenkins-bot 93d9c88c26 Merge "Generalize settings code (attempt 2)" 2024-01-10 11:36:38 +00:00
Translation updater bot 9bde69f9bd Localisation updates from https://translatewiki.net.
Change-Id: Ibb5261f6dbbf03acb5a7b598e46a4a829d746d58
2024-01-10 08:33:17 +01:00
Jon Robson 2c09fd1d1c Generalize settings code (attempt 2)
This reverts commit a6a65204c6.
to restore custom preview types.

-- Changes since revert
The previous patch accidentally removed the syncUserSettings
changeListener. This has now been restored with several modifications:
* We have a migrate script which rewrites existing localStorage settings
to the new system
* The existing save functions are generalized.

The changes since this patch are captured in
Ia73467799a9b535f7a3cf7268727c9fab7af0d7e

-- More information

A new REGISTER_SETTING action replaces the BOOT action for
registering settings. This allows custom preview types to be
associated with a setting. They do this by adding the enabled
property to the module they provide to mw.popups.register

Every time the new action is called, we refresh the settings
dialog UI with the new settings.

Previously the settings dialog was hardcoded, but now it is generated
from the registered preview types by deriving associated messages
and checking they exist, so by default custom types will not show
up in the settings.

Benefits:
* This change empowers us to add a setting for Math previews to allow
them to be enabled or disabled.
* Allows us to separate references as its own module

Additional notes:
* The syncUserSettings.js changeListener is no longer needed as the logic
for this is handled inside the "userSettings" change listener in response to
the "settings" reducer which is responding to
SETTINGS_CHANGE and REGISTER_SETTING actions.

Upon merging:
* https://www.mediawiki.org/wiki/Extension:Popups#Extensibility will be
updated to detail how a setting can be registered.

Bug: T334261
Bug: T326692

Change-Id: Ie17d622870511ac9730fc9fa525698fc3aa0d5b6
2024-01-09 17:24:09 -08:00
James D. Forrester e74d335904 .browerslistrc: Update reference to upstream
Change-Id: I4d0ef1cc0b543a9ba85d9972efcb9d6ee7aa5c67
2024-01-09 10:44:18 -05:00
Translation updater bot a529de8140 Localisation updates from https://translatewiki.net.
Change-Id: I9253cee6cfda89ba84f48bcc60da89c380d7c87e
2024-01-08 11:31:34 +01:00
Umherirrender f3c4642fd5 Use namespaced classes
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: Ib30da35841aadb558709dbbe6e30be2241048c87
2024-01-05 22:41:45 +01:00
Translation updater bot 4a2238e460 Localisation updates from https://translatewiki.net.
Change-Id: Ifd554386ba214135fc615803c23031da8f8ea2ab
2023-12-26 14:43:25 +01:00
Translation updater bot a6b7122003 Localisation updates from https://translatewiki.net.
Change-Id: I2dbf7774d25246a8c05eb72fc260c306b94033c3
2023-12-18 18:18:42 +01:00
Translation updater bot 2e6e6d778c Localisation updates from https://translatewiki.net.
Change-Id: I20868e08439bae7742dac06075a8e1d2f2394034
2023-12-11 10:43:46 +01:00