Commit graph

1391 commits

Author SHA1 Message Date
jenkins-bot 70c2f70262 Merge "Use .transform-origin() mixin" 2020-03-27 00:51:22 +00:00
jenkins-bot d2b19192c7 Merge "Add opt-out link to Sidebar for Vector/Logged-in Users Without Abstractions" 2020-03-27 00:36:29 +00:00
Nicholas Ray ec382a8c86 Add opt-out link to Sidebar for Vector/Logged-in Users Without Abstractions
This commit is singularly focused on adding a link to the sidebar for
Vector, logged-in users. It does the bare minimum to fulfill the
requirements of T243281.

Additionally, it will help to answer the question "Do we need to use
abstractions (other than maybe different templates) to separate Legacy
Vector from Vector" by intentionally leaving out any abstractions in
order to make it easier to compare with a follow-up patch
(Ib2ef15180df73360cc1de25b893e49d415d23e1a) which does use abstractions.

It is a good thing to question whether or not we need addtional
abstractions in VectorTemplate and if they will help us as unnecessary
abstractions can have the opposite effect and just lead to further
frustrations down the road.

Therefore, I urge you, the reviewer, to let me know your thoughts! If
abstractions are viewed as not making our lives any easier, the
follow-up patches may be completely discarded and that's totally okay
with me. :) I think it's a good think to talk about now though.

Important changes:

* The VectorTemplate constructor was changed to allow injecting the
config, templateParser, and isLegacy boolean (only the config was
allowed before this commit). According to MediaWiki's Stable Interface
Policy, "Constructor signatures are generally considered unstable unless
explicitly declared stable for calling" [3]. Given that VecorTemplate's
constructor is not marked as stable, it is justified to do this without
warning according to the policy.

* Due to the above, the 'setTemplate' method is no longer needed and was
marked as deprecated.

* VectorTemplateTest was made to adapt to the new VectorTemplate
constructor. Additionally, it now extends from
MediaWikiIntegrationTestCase which my intelliphense server can pick up.
I *think* MediaWikiTestCase is just an alias to
MediaWikiIntegrationTestCase [1] and MediaWikiTestCase file was renamed
to MediaWikiIntegrationTestCase in [2], but I'm willing to change it
back if there is pushback to this.

Open questions:

* What are VectorTemplate's responsibilities? To me, it acts right now
as a controller (because it echos the full HTML string from the
template), a model (because SkinTemplate::prepareQuickTemplate sets data
on it which it later retrieves through `$this->get()`), a presenter
(because it adds data tailored for a web-centric view), and a view
(because it renders HTML strings instead of letting the view/template be
solely responsible for that). Arguably, some business logic might be
mixed in there as well (because it checks to see if a User is logged
in/has necessary permissions to show x which my changes here add to).
This might not be a problem if we keep VectorTemplate relatively small,
but will it remain this way as we progress further in Desktop
Improvements?

* How do we write tests for VectorTemplate without exposing unnecessary
public methods? For example, if I want to test the `getSkinData()`
method to see what state will be sent to the template, how should I do
this? One option might be to use `TestingAccessWrapper` to expose these
private methods which is what
`VectorTemplateTest::testbuildViewsProps()` does. Another option is to
accept this method as public. Is there a better way? Keep in mind that
even with access to this method, there might be many things to mock.

[1] 0030cb525b/tests/common/TestsAutoLoader.php (L64)
[2] Ie717b0ecf4fcfd089d46248f14853c80b7ef4a76
[3] https://www.mediawiki.org/wiki/Stable_interface_policy

Bug: T243281
Change-Id: I0571b041bcd7f19bec9f103fa7bccdd093f6394d
2020-03-26 17:39:47 -06:00
Volker E d9d9fdc522 Use .transform-origin() mixin
Adding support for older Firefox and IE 9.

Change-Id: I9b9e1f4923707676a751ae58edd6b11d1182c01d
2020-03-26 15:50:05 -07:00
Stephen Niedzielski 6b6bed86ed [docs] [dev] [PHP] [FeatureManager] revise docs and add DynamicConfigRequirement test
Address some feedback from I7a2cdc2dfdf20d78e4548f07cf53994563b234b3:

- Miscellaneous documentation improvements.
- Add a false case test to `DynamicConfigRequirement->isMet()`.

Bug: T244481
Change-Id: Ic5637f42da755f871c5a6d545e14effd3ac8c670
2020-03-26 20:39:40 +00:00
Translation updater bot ac79997d87 Localisation updates from https://translatewiki.net.
Change-Id: Iacb49685bda1c21698f13d1f70682b7c04eb3edd
2020-03-26 08:34:53 +01:00
jdlrobson 4091a6729f Document setupTemplate method and mark Vector as @final
Various skins may extend SkinVector (although none are in production)
(https://github.com/search?q=%22extends+SkinVector%22&type=Code)
This makes it clear we no longer support that behaviour.

Because of the skins that are extending SkinVector currently we have
not resorted to using the final keyword at this time.

Depends-On: Ie3759c2acbf53c628577f6b05cfed17e0998a6bb
Bug: T248399
Change-Id: I2af8b2930c80f888791247bdaa2ae1c80576317e
2020-03-25 18:04:16 +00:00
jenkins-bot f855c3948e Merge "featureManager: Add DynamicConfigRequirement requirement" 2020-03-25 15:20:47 +00:00
Translation updater bot 04e539c531 Localisation updates from https://translatewiki.net.
Change-Id: I4d499dbbcd0729f2d09ad63e61251f19fe991b5a
2020-03-25 08:36:06 +01:00
jenkins-bot 3677f1901d Merge "Use only JSON syntax in .eslintrc.json" 2020-03-23 21:21:15 +00:00
Kunal Mehta b10df06c91 Use only JSON syntax in .eslintrc.json
Breaks libup otherwise.

Change-Id: Ib1aeb412939e14911e1afec29336c63ea3e8ef8a
2020-03-23 14:05:42 -07:00
Volker E eecd2a73f9 docs: Remove overqualified element-id combination selectors
Bug: T248137
Change-Id: I8b2bc0843f9151269d4dbcbf278f8ce43ee8f872
2020-03-23 13:25:45 -07:00
Translation updater bot 70f33d106d Localisation updates from https://translatewiki.net.
Change-Id: I74692926553636a9a5c6cea27022a2e0d2afdb9e
2020-03-23 09:08:05 +01:00
Umherirrender af4ce06bf6 Fix indent in en.json
Change-Id: I240883c739175b7b242b4bdd7c29c8e0997c8efd
2020-03-20 22:04:04 +01:00
Translation updater bot 6365eff58c Localisation updates from https://translatewiki.net.
Change-Id: If4e36572cc91c4e8aad2ea78e5c93a5d8bd41d8d
2020-03-20 08:27:04 +01:00
jenkins-bot 68d2cb26ae Merge "skins.vector.styles.legacy needs to define legacy feature" 2020-03-19 03:41:26 +00:00
jdlrobson 4615f7d6d1 skins.vector.styles.legacy needs to define legacy feature
Caused by If32b59036e5cd62cbb804944ca93fa1a101c5129. Looks like
that patch clashed with Ic7af947cfd5a5df4218f006232ede4ee7ed36c62
which touched same good without a merge conflict.

Bug: T247566
Change-Id: I0c918842ac2243e47bda702fb8fdc19ce57b005e
2020-03-18 20:20:43 -07:00
jenkins-bot 49b7140a99 Merge "Mustache Documentation: Cleanup/Clarify Mustache template params" 2020-03-18 22:26:21 +00:00
Nicholas Ray 9964e56156 Mustache Documentation: Cleanup/Clarify Mustache template params
* Content.mustache doc param order was modified to follow the html structure
order (with html-dataAfterContent at bottom ). `html-userlangattributes`
was added to param documention since it was absent.

* Footer.mustache doc param order was modified to follow the html structure
order (with `html-userlangattributes` placed after `html-vector-before-footer`)

* Navigation.mustache was modified to remove `html-sidebar`,
`html-navigation-left-tabs` and `html-navigation-right-tabs` params from
doc since those are absent from Navigation.mustache.

* `data-namespace-tabs`, `data-variants`, `data-page-actions`,
`data-page-actions-more`, `data-search-box`, `data-sidebar` params were
added in Navigation.mustache documentation since those are present.

Bug: T243281
Change-Id: I321f8d61ad0305f508521e8d4d805e846103b357
2020-03-18 14:47:31 -07:00
jenkins-bot 3618a6dede Merge "Add script 'npm run lint:fix:js' and 'lint:fix:styles', remove 'lint:fix'" 2020-03-18 19:26:11 +00:00
Sam Smith 84226b41b6 featureManager: Add DynamicConfigRequirement requirement
We expect the vast majority of requirements and features to be defined
in services as possible. However, there are some "complex" requirements
that require additional application/HTTP request state. Unfortunately,
service wiring is done before some of that state is available.

I65702426 attempted to work around this by requiring clients of the
Feature Manager to pass that additional state on every interaction with
the system. Those complex requirements would then select the parts of
the state that they required when it was required. However
implementations of \IContextSource are God objects and their use should
be limited.

Whilst reviewing I65702426, Stephen Niedzielski mentioned that the
application state being available is a requirement. This remarkably
simple solution:

- Keeps the Requirement interface and FeatureManager API free of God
  objects;

- Is true to the nature of the Feature Manager - it makes clear and
  centralizes the various checks for application state being available
  across the codebase; and

- Inject a Requirement implementations' dependencies at construction
  time

It just so happens that the $wgFullyInitialised variable flags whether
the application state is available...

Changes:

- Add the the FeatureManager\Requirements\DynamicConfigRequirement class
  and tests. The DynamicConfigRequirement lazily evaluates a single
  configuration value whenever ::isMet is invoked

- Register an DynamicConfigRequirement instance, configured to evaluate
  $wgFullyInitialised while constructing the Vector.FeatureManager
  service

Bug: T244481
Change-Id: I7a2cdc2dfdf20d78e4548f07cf53994563b234b3
2020-03-18 10:10:42 +00:00
jenkins-bot c85c0700a9 Merge "Add comments to the font-stacks, reference documentation" 2020-03-16 18:29:48 +00:00
jenkins-bot 8d65373883 Merge "[JavaScript] Validate types" 2020-03-16 15:59:53 +00:00
Stephen Niedzielski bd7bd75569 [JavaScript] Validate types
Lift the mists of confusion by checking that all JavaScript types align.
No ignores! This is the JavaScript equivalent to Phan.

This patch adds the necessary infrastructure for verifying typing and
fixes the few flaws found.

Bug: T239262
Change-Id: I2557471421196ea46cd13dfb786a52968fbfcc97
2020-03-16 09:10:08 -06:00
jenkins-bot 79042c53e9 Merge "Localisation updates from https://translatewiki.net." 2020-03-16 15:09:13 +00:00
Translation updater bot 8aeef146d9 Localisation updates from https://translatewiki.net.
Change-Id: I7b74e23054593f2285fa4a7d9530f83ba2c5f125
2020-03-16 16:05:25 +01:00
jenkins-bot 7d42117f7f Merge "Remove unnecessary devdependency 'stylelint'" 2020-03-16 15:04:48 +00:00
AronDemian 349d496808 Add comments to the font-stacks, reference documentation
Bug: T244794
Change-Id: Ie8f357ff747ffda9a41eb65856839e0f83f3853d
2020-03-16 15:07:43 +01:00
AronDemian ecf7f811e6 Add script 'npm run lint:fix:js' and 'lint:fix:styles', remove 'lint:fix'
Bug: T247004
Change-Id: I4187799d56c1bae537730af832fe35c655e8ec22
2020-03-16 15:05:33 +01:00
jenkins-bot cad658603e Merge "[fix] [LESS] Move print style variables to query" 2020-03-13 18:07:25 +00:00
Translation updater bot ac41baaf12 Localisation updates from https://translatewiki.net.
Change-Id: I11369a70d7a6faf7175cccb7baffbe5f0e18b203
2020-03-13 08:30:49 +01:00
AronDemian cc6a7cca61 Remove unnecessary devdependency 'stylelint'
package-lock.json regenerated using the following process to ensure a clean slate:
rm -r node_modules package-lock.json  ;  npm i

Bug: T247004
Change-Id: Ie7720509ef37b178538a54854c28153ed73e375e
2020-03-13 06:50:23 +01:00
jenkins-bot f1d8a9e472 Merge "Ship different ResourceLoader module for different versions" 2020-03-12 21:30:38 +00:00
jenkins-bot 09fedcc4bb Merge "[Refactor] Move HD styles into separate importable LESS file" 2020-03-12 20:57:50 +00:00
jdlrobson 9a3a3d3c96 Ship different ResourceLoader module for different versions
To have a clean break for upcoming changes we will duplicate
index.less into legacy.less and create a new module to clearly
separate new styles from old.

The preferred name however does come with some caching challenges.
Cached HTML served to anons will continue to load the style module
`skins.vector.styles` for a period of 1-4 weeks

Provided we are careful with our changes during this period this
should be okay.

Change-Id: If32b59036e5cd62cbb804944ca93fa1a101c5129
2020-03-12 13:36:52 -07:00
jdlrobson aecd83e528 [Refactor] Move HD styles into separate importable LESS file
Change-Id: Ie596a7906b0e876fc00c1b821c23ceb9d13147e2
2020-03-12 12:52:44 -07:00
jdlrobson b8a8c56284 Get legacy styles from ResourceLoaderSkinModule
Instead of relying on Skin::getDefaultModules to get
`mediawiki.legacy.styles` make the legacy style feature an explicit
opt in choice by including it in the features list.

This is done on the assumption that Icb910a563273bde92a09b1bb92857d5b6e3
will shortly be merged to deprecate this module to avoid double loading
the styles.

Bug: T242177
Depends-On: Icb910a563273bde92a09b1bb92857d5b6e348baa
Change-Id: Ic7af947cfd5a5df4218f006232ede4ee7ed36c62
2020-03-12 19:52:18 +00:00
Stephen Niedzielski 46276cd9dd [fix] [LESS] Move print style variables to query
Move print LESS variables within the print media query. When these
styles were collapsed into an index.less import via ac069fb, they lost
their outer print media query which caused them to override screen
styles.

Bug: T247537
Change-Id: I45502facd27f4a7a6c33436da2f1870bbd91a4ff
2020-03-12 10:49:44 -06:00
Translation updater bot 864cc97092 Localisation updates from https://translatewiki.net.
Change-Id: I17512d362f5a5f94b7c74914a02d2bbc5152226d
2020-03-12 08:20:11 +01:00
jdlrobson 59747a58c8 Separate first portal in sidebar from rest
This allows us to insert HTML underneath the first portal or wrap
the portal in a containing element in future if we want to target
additional CSS to it

Change-Id: Ied28d95407b8d59fc819bb07a2cce3242bd93088
2020-03-11 23:34:11 +00:00
jenkins-bot af4cbc2f57 Merge "[dev] Run npm t on Git pre-commit hook" 2020-03-11 21:54:08 +00:00
jenkins-bot c3bbe2acb3 Merge "docs: Improve VectorTemplate Mustache param docs" 2020-03-11 20:25:56 +00:00
Stephen Niedzielski f4f7f3623c [dev] Run npm t on Git pre-commit hook
Execute `npm test` prior to committing. This saves back-and-forth with
Jenkins. This is the same configuration used by Popups,
MobileFrontend, MinervaNeue, NearbyPages, ContentTranslation, and
others.

Change-Id: If61ab4f28b0ccd38492d11a4cd8a92a97b2eb582
2020-03-11 07:49:48 -06:00
jenkins-bot f1cad1b040 Merge "[dev] Consolidate ResourceLoader LESS style files" 2020-03-11 11:51:02 +00:00
AronDemian ea22d059f2 Fix iOS Safari searchbox appearance
Sets
* `-webkit-appearance: none;` for iOS and
* `-moz-appearance: textfield;` for Firefox that also applies 
  `-webkit-appearance`.

Bug: T247299
Change-Id: Iefc77bba54b85442862176e1875974f19b64193b
2020-03-10 22:16:28 +00:00
Stephen Niedzielski ac069fbec1 [dev] Consolidate ResourceLoader LESS style files
Move styles.less to index.less and import print.less from it. This keeps
the reasoning about styles constrained to LESS instead of spread out
over LESS _and_ ResourceLoader. The former is preferable since LESS is
more standardized than ResourceLoader.

The approach of moving styles.less to index.less and then referencing
print.less was chosen with the intent that it'd be easier to assume
styles are screen styles unless a media query says otherwise.

This patch also makes the variables import common among print and screen
styles.

Bug: T246419
Change-Id: I981d0937aaacb7cba082c337f98c90e90b46b340
2020-03-10 15:29:15 -06:00
Stephen Niedzielski 713d0ac2fd [dev] Favor LESS media queries to ResourceLoader
Prior to this patch, Vector used a mixture of LESS media queries and
ResourceLoader (RL) media queries[0]. So far as I can tell[1], the
latter only instructs RL to wrap the contents of a LESS file within a
query (there are no conditionals placed on style loading). Further,
according to a coauthor of RL (Roan), RL media query support was most
likely a replacement for `@media foo { @import foo.css }` to inline
print styles from a separate style sheet which Vector itself does not
use. The LESS solution is much more intuitive since it's not MediaWiki-
specific and only the LESS code needs to be considered instead of LESS
_and_ the RL configuration in skin.json.

This patch moves both screen media queries to screen.less for the
aforementioned consistency and to avoid nesting queries. It is hoped
that these changes will help make future work easier, such as those to
margin likely to take place in making the sidebar collapsible.

[0]: https://www.mediawiki.org/wiki/ResourceLoader/Developing_with_ResourceLoader#Media_queries
[1]: http://localhost:8181/w/load.php?debug=true&lang=en&modules=skins.vector.styles&only=styles&skin=vector

Bug: T246419
Change-Id: Ic0adfa254f3e81dfa87a26899f3aa585645956f1
2020-03-10 13:13:42 -06:00
jenkins-bot 524b534e14 Merge "featureManager: Add Requirement interface" 2020-03-10 17:08:59 +00:00
jenkins-bot fbc24715e7 Merge "featureManager: Add typehints" 2020-03-10 17:08:57 +00:00
Nicholas Ray 892eb489e6 Move watchstar import out of VectorTabs.less and into screen.less
* VectorTabs.stories.js and Navigation.stories.js were updated to
reflect this change.

Bug: T243281
Change-Id: I96a3b9b2c9a8d799a5835de1f296bc1a779803ee
2020-03-10 10:04:46 -06:00