API: Create a module bundle for 'apipretty' and 'apihelp'
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 30 Jul 2019 00:17:35 +0000 (01:17 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 30 Jul 2019 00:17:35 +0000 (01:17 +0100)
These are both fairly small modules used in related low-traffic
scenarios. The cost of registering both globally on all page views
as a top-level entry point does not seem worth the marginal gain
of loading only one of these two in the contexts where they are
needed.

Change-Id: I42458ebec3f8d6e14e52e44d62fb914fcbeda5db

includes/api/ApiHelp.php
resources/Resources.php
resources/src/mediawiki.apihelp.css [deleted file]
resources/src/mediawiki.apipretty.css [deleted file]
resources/src/mediawiki.apipretty/apihelp.css [new file with mode: 0644]
resources/src/mediawiki.apipretty/apipretty.css [new file with mode: 0644]

index cc96f90..988957b 100644 (file)
@@ -100,7 +100,7 @@ class ApiHelp extends ApiBase {
                $out = $context->getOutput();
                $out->addModuleStyles( [
                        'mediawiki.hlist',
-                       'mediawiki.apihelp',
+                       'mediawiki.apipretty',
                ] );
                if ( !empty( $options['toc'] ) ) {
                        $out->addModuleStyles( 'mediawiki.toc.styles' );
index 9a7b9e8..77d7d88 100644 (file)
@@ -768,10 +768,6 @@ return [
        ],
 
        /* MediaWiki */
-       'mediawiki.apihelp' => [
-               'styles' => 'resources/src/mediawiki.apihelp.css',
-               'targets' => [ 'desktop' ],
-       ],
        'mediawiki.template' => [
                'scripts' => 'resources/src/mediawiki.template.js',
                'targets' => [ 'desktop', 'mobile' ],
@@ -790,7 +786,10 @@ return [
                'dependencies' => 'mediawiki.template',
        ],
        'mediawiki.apipretty' => [
-               'styles' => 'resources/src/mediawiki.apipretty.css',
+               'styles' => [
+                       'resources/src/mediawiki.apipretty/apipretty.css',
+                       'resources/src/mediawiki.apipretty/apihelp.css',
+               ],
                'targets' => [ 'desktop', 'mobile' ],
        ],
        'mediawiki.api' => [
diff --git a/resources/src/mediawiki.apihelp.css b/resources/src/mediawiki.apihelp.css
deleted file mode 100644 (file)
index d1f32ab..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/* stylelint-disable selector-class-pattern */
-
-.apihelp-header {
-       clear: both;
-       margin-bottom: 0.1em;
-}
-
-.apihelp-header.apihelp-module-name {
-       /*
-        * This element is explicitly set to dir="ltr" in HTML.
-        * Set explicit alignment so that CSSJanus will flip it to "right";
-        * otherwise the alignment will be automatically set to "left" according
-        * to the element's direction, and this will have an inconsistent look.
-        */
-       text-align: left;
-}
-
-div.apihelp-linktrail {
-       font-size: smaller;
-}
-
-.apihelp-block {
-       margin-top: 0.5em;
-}
-
-.apihelp-block-head {
-       font-weight: bold;
-}
-
-.apihelp-flags {
-       font-size: smaller;
-       float: right;
-       border: 1px solid #000;
-       padding: 0.25em;
-       width: 20em;
-}
-
-.apihelp-deprecated,
-.apihelp-flag-deprecated,
-.apihelp-flag-internal strong {
-       font-weight: bold;
-       color: #d33;
-}
-
-.apihelp-deprecated-value {
-       text-decoration: line-through;
-}
-
-.apihelp-unknown {
-       color: #72777d;
-}
-
-.apihelp-empty {
-       color: #72777d;
-}
-
-.apihelp-help-urls ul {
-       list-style-image: none;
-       list-style-type: none;
-       margin-left: 0;
-}
-
-.apihelp-parameters dl,
-.apihelp-examples dl,
-.apihelp-permissions dl {
-       margin-left: 2em;
-}
-
-.apihelp-parameters dt {
-       float: left;
-       clear: left;
-       min-width: 10em;
-       white-space: nowrap;
-       line-height: 1.5em;
-}
-
-.apihelp-parameters dt:after {
-       content: ':\A0';
-}
-
-.apihelp-parameters dd {
-       margin: 0 0 0.5em 10em;
-       line-height: 1.5em;
-}
-
-.apihelp-parameters dd p:first-child {
-       margin-top: 0;
-}
-
-.apihelp-parameters dd.info {
-       margin-left: 12em;
-       text-indent: -2em;
-}
-
-.apihelp-examples dt {
-       font-weight: normal;
-}
-
-.api-main-links {
-       text-align: center;
-}
-
-.api-main-links ul:before {
-       content: '[';
-}
-
-.api-main-links ul:after {
-       content: ']';
-}
diff --git a/resources/src/mediawiki.apipretty.css b/resources/src/mediawiki.apipretty.css
deleted file mode 100644 (file)
index 3e921f4..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* stylelint-disable selector-class-pattern */
-
-.mw-special-ApiHelp h1.firstHeading {
-       display: none;
-}
-
-.api-pretty-header {
-       font-size: small;
-}
-
-.api-pretty-content {
-       white-space: pre-wrap;
-}
diff --git a/resources/src/mediawiki.apipretty/apihelp.css b/resources/src/mediawiki.apipretty/apihelp.css
new file mode 100644 (file)
index 0000000..d1f32ab
--- /dev/null
@@ -0,0 +1,109 @@
+/* stylelint-disable selector-class-pattern */
+
+.apihelp-header {
+       clear: both;
+       margin-bottom: 0.1em;
+}
+
+.apihelp-header.apihelp-module-name {
+       /*
+        * This element is explicitly set to dir="ltr" in HTML.
+        * Set explicit alignment so that CSSJanus will flip it to "right";
+        * otherwise the alignment will be automatically set to "left" according
+        * to the element's direction, and this will have an inconsistent look.
+        */
+       text-align: left;
+}
+
+div.apihelp-linktrail {
+       font-size: smaller;
+}
+
+.apihelp-block {
+       margin-top: 0.5em;
+}
+
+.apihelp-block-head {
+       font-weight: bold;
+}
+
+.apihelp-flags {
+       font-size: smaller;
+       float: right;
+       border: 1px solid #000;
+       padding: 0.25em;
+       width: 20em;
+}
+
+.apihelp-deprecated,
+.apihelp-flag-deprecated,
+.apihelp-flag-internal strong {
+       font-weight: bold;
+       color: #d33;
+}
+
+.apihelp-deprecated-value {
+       text-decoration: line-through;
+}
+
+.apihelp-unknown {
+       color: #72777d;
+}
+
+.apihelp-empty {
+       color: #72777d;
+}
+
+.apihelp-help-urls ul {
+       list-style-image: none;
+       list-style-type: none;
+       margin-left: 0;
+}
+
+.apihelp-parameters dl,
+.apihelp-examples dl,
+.apihelp-permissions dl {
+       margin-left: 2em;
+}
+
+.apihelp-parameters dt {
+       float: left;
+       clear: left;
+       min-width: 10em;
+       white-space: nowrap;
+       line-height: 1.5em;
+}
+
+.apihelp-parameters dt:after {
+       content: ':\A0';
+}
+
+.apihelp-parameters dd {
+       margin: 0 0 0.5em 10em;
+       line-height: 1.5em;
+}
+
+.apihelp-parameters dd p:first-child {
+       margin-top: 0;
+}
+
+.apihelp-parameters dd.info {
+       margin-left: 12em;
+       text-indent: -2em;
+}
+
+.apihelp-examples dt {
+       font-weight: normal;
+}
+
+.api-main-links {
+       text-align: center;
+}
+
+.api-main-links ul:before {
+       content: '[';
+}
+
+.api-main-links ul:after {
+       content: ']';
+}
diff --git a/resources/src/mediawiki.apipretty/apipretty.css b/resources/src/mediawiki.apipretty/apipretty.css
new file mode 100644 (file)
index 0000000..3e921f4
--- /dev/null
@@ -0,0 +1,13 @@
+/* stylelint-disable selector-class-pattern */
+
+.mw-special-ApiHelp h1.firstHeading {
+       display: none;
+}
+
+.api-pretty-header {
+       font-size: small;
+}
+
+.api-pretty-content {
+       white-space: pre-wrap;
+}