about summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2023-06-23Make typenames a bit wider to support "existential type"Noah Lev-1/+1
2023-06-23Abbreviate long typenames so they don't get wrapped in resultsNoah Lev-2/+2
2023-06-23Link to the corresponding channel in the help popoverGuillaume Gomez-5/+6
2023-06-23Add link to rustdoc book search chapter in help popoverGuillaume Gomez-0/+3
2023-06-22Align search results horizontally for easy scanningNoah Lev-0/+2
The recent PR #110688 added info about an item's kind before its name in search results. However, because the kind and name are inline with no alignment, it's now hard to visually scan downward through the search results, looking at item names. This PR fixes that by horizontally aligning search results such that there are now two columns of information.
2023-06-19rustdoc: js: change color and reduce size of typename in search resultAlexis (Poliorcetics) Bourget-1/+7
2023-06-17Rollup merge of #112707 - GuillaumeGomez:back-in-history-fix, r=notriddleMatthias Krüger-19/+35
[rustdoc] Fix invalid handling of "going back in history" when "go to only search result" setting is enabled You can test the fix [here](https://rustdoc.crud.net/imperio/back-in-history-fix/lib2/index.html). Enable "Directly go to item in search if there is only one result", then search for `HasALongTraitWithParams` and finally go back to previous page. It should be back on the `index.html` page. The reason for this bug is that the JS state is cached as is, so when we go back to the page, it resumes where it was left, somewhat (very weird), meaning the search is run again etc. The best way to handle this is to force the JS re-execution in this case so that it doesn't try to resume from where it left and then lead us back to the current page. r? ``@notriddle``
2023-06-16Fix invalid handling of "going back in history" when "Directly go to item in ↵Guillaume Gomez-4/+21
search if there is only one result" setting is set to true
2023-06-16Auto merge of #110688 - GuillaumeGomez:result-search-type, r=notriddle,jshabors-11/+36
rustdoc: Add search result item types after their name Here what it looks like: ![Screenshot from 2023-04-22 15-16-58](https://user-images.githubusercontent.com/3050060/233789566-b5f3f625-3b78-4c56-a7ee-0a4f2d62e667.png) The idea is to improve accessibility by providing this information directly in the text and not only in the text color. Currently we already use it for doc aliases and for primitive types, so I extended it to all types. r? `@notriddle`
2023-06-16Unify history interactions in searchGuillaume Gomez-15/+14
2023-06-15Auto merge of #112233 - notriddle:notriddle/search-unify, r=GuillaumeGomezbors-166/+163
rustdoc-search: clean up type unification and "unboxing" This PR redesigns parameter matching, return matching, and generics matching to use a single function that compares two lists of types. It also makes the algorithms more consistent, so the "unboxing" behavior where `Vec<i32>` is considered a match for `i32` works inside generics, and not just at the top level.
2023-06-14Fix eBNF and handling of whitespace characters when not in a pathGuillaume Gomez-2/+11
2023-06-14Correctly display whitespace characters in search errorGuillaume Gomez-1/+1
2023-06-14Use whitespace as path separator like double colonGuillaume Gomez-71/+163
2023-06-12rustdoc-search: search never type with `!`Michael Howell-5/+43
This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for diverging functions. Part of #60485 It's already possible to do this search with `primitive:never`, but that's not what the Rust language itself uses, so nobody will try it if they aren't told or helped along.
2023-06-11rustdoc-search: fix order-independence bugMichael Howell-68/+98
2023-06-11rustdoc-search: build args, return, and generics on one unifierMichael Howell-138/+105
This enhances generics with the "unboxing" behavior where A<T> matches T. It makes this unboxing transitive over generics.
2023-06-11rustdoc-search: simplify JS in `checkGenerics`Michael Howell-68/+68
2023-06-10rustdoc: add note about slice/array searches to help popupMichael Howell-0/+4
2023-06-10rustdoc: search for slices and arrays by type with `[]`Michael Howell-82/+151
Part of #60485
2023-06-03Move type name directly into the same DOM elementGuillaume Gomez-19/+1
2023-06-02Improve new search result display on mobileGuillaume Gomez-0/+8
2023-06-02Move item kind before the item nameGuillaume Gomez-3/+13
2023-06-02Add search result item types after their nameGuillaume Gomez-11/+36
2023-05-31rustdoc: add jsdoc comments for complex functionsMichael Howell-1/+34
2023-05-23rustdoc: add hover indicator for notable trait tooltipMichael Howell-0/+4
2023-05-23rustdoc: add interaction delays for tooltip popoversMichael Howell-9/+112
Designing a good hover microinteraction is a matter of guessing user intent from what are, literally, vague gestures. In this case, guessing if hovering in our out of the tooltip base is intentional or not. To figure this out, a few different techniques are used: * When the mouse pointer enters a tooltip anchor point, its hitbox is grown on the bottom, where the popover is/will appear. This was already there before this commit: search "hover tunnel" in rustdoc.css for the implementation. * This commit adds a delay when the mouse pointer enters the base anchor, in case the mouse pointer was just passing through and the user didn't want to open it. * This commit also adds a delay when the mouse pointer exits the tooltip's base anchor or its popover, before hiding it. * A fade-out animation is layered onto the pointer exit delay to immediately inform the user that they successfully dismissed the popover, while still providing a way for them to cancel it if it was a mistake and they still wanted to interact with it. * No animation is used for revealing it, because we don't want people to try to interact with an element while it's in the middle of fading in: either they're allowed to interact with it while it's fading in, meaning it can't serve as mistake- proofing for opening the popover, or they can't, but they might try and be frustrated. See also: * https://www.nngroup.com/articles/timing-exposing-content/ * https://www.nngroup.com/articles/tooltip-guidelines/ * https://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown
2023-05-22rustdoc: remove unneeded `position: relative` setting CSSMichael Howell-1/+0
This was added to control percentage sizes, in 79956b96e875e6ba2bfa551fabda6b7896f988ac Now, the only percentage size is [`border-radius`], which is based on the size of the box itself, not its containing block. This leaves the property unused. [`border-radius`]: https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
2023-05-22rustdoc: merge identical CSS rulesMichael Howell-5/+3
2023-05-03Rollup merge of #110371 - notriddle:notriddle/search-corrections, ↵Manish Goregaokar-197/+232
r=GuillaumeGomez rustdoc: restructure type search engine to pick-and-use IDs Fixes #110029 Preview: https://notriddle.com/rustdoc-demo-html-3/search-corrections/std/index.html?search=-%3E%20streaming ![image](https://user-images.githubusercontent.com/1593513/233494900-ae77d5b4-e395-41f8-bbac-53ee55bb4a76.png) This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items. This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
2023-04-23Rollup merge of #110661 - notriddle:notriddle/settings-js-handlekey, ↵Matthias Krüger-19/+1
r=GuillaumeGomez rustdoc: clean up settings.css and settings.js `handleKey` was added in 9dc5dfb97504c538bc72f367a77bb9f714c30097 and 704050da2334c465784954d81c8990c4bc7a92c5 because the browser-native checkbox was `display: none`, breaking native keyboard accessibility. The native checkbox is now merely `appearance: none`, which does not turn off [behavior semantics], so JavaScript to reimplement it isn't needed any more. [behavior semantics]: https://w3c.github.io/csswg-drafts/css-ui/#appearance-semantics The other, one line change to settings.css is follow-up to #110205
2023-04-21rustdoc: remove unused CSS `color: inherit`Michael Howell-1/+0
This code was added back when `border-color: currentColor` was used. Since it was changed in ad9a89eef2857a24ef049b9eee2d1db5bcbf1d11, the current color is not used any more.
2023-04-21rustdoc: remove unneeded handleKey from settings.jsMichael Howell-18/+1
This code was added in 9dc5dfb97504c538bc72f367a77bb9f714c30097 and 704050da2334c465784954d81c8990c4bc7a92c5 because the browser- native checkbox was `display: none`, breaking native keyboard accessibility. The native checkbox is now merely `appearance: none`, which does not turn off [behavior semantics], so JavaScript to reimplement it isn't needed any more. [behavior semantics]: https://w3c.github.io/csswg-drafts/css-ui/#appearance-semantics
2023-04-21rustdoc: clean up redundant search hiding results codeMichael Howell-8/+1
* There's no need to call `history.replaceState` right before calling `searchState.hideResults`, which already does it. * There's no need to implement hiding search results when that is already implemented.
2023-04-21rustdoc: lift constant string manipulation out of loopMichael Howell-1/+1
2023-04-21rustdoc: use Set for ignored crates, instead of string matchingMichael Howell-2/+4
2023-04-20rustdoc-search: use more descriptive "x not found; y instead" messageMichael Howell-1/+1
2023-04-20rustdoc-search: make type name correction choice deterministicMichael Howell-0/+3
2023-04-20rustdoc-search: clean up `checkIfInGenerics` call at end of `checkType`Michael Howell-5/+1
2023-04-19rustdoc-search: give longer notification for type correctionsMichael Howell-2/+7
2023-04-17rustdoc: restructure type search engine to pick-and-use IDsMichael Howell-196/+227
This change makes it so, instead of mixing string distance with type unification, function signature search works by mapping names to IDs at the start, reporting to the user any cases where it had to make corrections, and then matches with IDs when going through the items. This only changes function searches. Name searches are left alone, and corrections are only done when there's a single item in the search query.
2023-04-17rustdoc-search: fix incorrect doc commentMichael Howell-1/+1
2023-04-17Rollup merge of #110341 - notriddle:notriddle/main-js-replacestate, ↵Matthias Krüger-4/+2
r=GuillaumeGomez rustdoc: stop passing a title to `replaceState` second argument As described on [MDN's replaceState page], this parameter is not currently used, and the empty string is "safe against future changes to the method." [MDN's replaceState page]: https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
2023-04-15rustdoc: stop passing a title to `replaceState` second argumentMichael Howell-4/+2
As described on [MDN's replaceState page], this parameter is not currently used, and the empty string is "safe against future changes to the method." [MDN's replaceState page]: https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState
2023-04-14rustdoc-search: add support for nested genericsMichael Howell-11/+10
2023-04-13rustdoc-search: use ES6 Map for `Result` instead of ObjectMichael Howell-21/+40
2023-04-13rustdoc-search: use ES6 `Set` for deduplication instead of `Object`Michael Howell-3/+3
2023-04-13rustdoc-search: use ES6 `Map` for generic matching instead of `Object`Michael Howell-23/+14
2023-04-13rustdoc-search: use ES6 `Map` for aliases instead of `Object`Michael Howell-11/+16
2023-04-12Rollup merge of #110205 - notriddle:notriddle/pixelated-border, r=GuillaumeGomezMatthias Krüger-1/+5
rustdoc: make settings radio and checks thicker, less contrast This is very dependent on subjectivity and what screen you use, but this change makes the radio buttons' outer circle less ugly. This is because I could see the pixels very clearly, thanks to the very thin line and high contrast. This change makes both less severe, giving your browser's antialiasing algorithm more to work with. Since it's thicker, lowering the contrast shouldn't impact visibility. ## Preview https://notriddle.com/rustdoc-demo-html-3/pixelated-border/settings.html ## Before ![image](https://user-images.githubusercontent.com/1593513/231274191-143acbea-c433-4fb1-b46d-e5e4fe328d60.png) ## After ![image](https://user-images.githubusercontent.com/1593513/231287415-c1e59fe8-8bf8-489d-b607-95ebb71e4ac5.png) <details><summary>Original "after" image with 2px border around checked box</summary> ![image](https://user-images.githubusercontent.com/1593513/231274253-8b5011c6-82fb-4396-84d0-47b6bdff2260.png) </details>