typedoc-theme-oxide 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,43 +11,49 @@
11
11
  }
12
12
 
13
13
  .docblock pre > button {
14
- display: none;
15
- }
14
+ display: none;
15
+ }
16
16
 
17
17
  rustdoc-toolbar #help-button .shortcuts {
18
- width: 100%;
19
- }
18
+ width: 100%;
19
+ }
20
20
 
21
- rustdoc-toolbar #help-button .info {
22
- display: none;
23
- }
21
+ rustdoc-toolbar #help-button .infos {
22
+ display: none;
23
+ }
24
24
 
25
25
  oxide-search-results .search-results.active {
26
- display: table;
27
- width: 100%;
28
- }
29
-
30
- oxide-search-results .search-results.active > a {
31
- display: table-row;
32
- }
33
-
34
- oxide-search-results .search-results.active .result-name {
35
- display: table-cell;
36
- border-bottom: 1px solid var(--search-result-border-color);
37
- }
38
-
39
- oxide-search-results .search-results.active .result-name .typename {
40
- white-space: nowrap;
41
- padding-right: 1.5rem;
42
- }
43
-
44
- oxide-search-results .search-results.active .result-name .path span {
45
- display: inline-block;
46
- }
47
-
48
- oxide-search-results .search-results.active .result-name:first-child {
49
- width: 1px;
50
- vertical-align: middle;
51
- }
26
+ display: grid;
27
+ grid-template-columns: min-content 1fr;
28
+ }
29
+
30
+ oxide-search-results .search-results.active > .result-item {
31
+ display: grid;
32
+ grid-template-areas: none;
33
+ grid-template-columns: subgrid;
34
+ grid-column: 1 / 3;
35
+ }
36
+
37
+ oxide-search-results .search-results.active > .result-item .result-name {
38
+ display: grid;
39
+ grid-template-columns: subgrid;
40
+ grid-column: 1 / 3;
41
+ /* align-items: initial; */
42
+ }
43
+
44
+ oxide-search-results .search-results.active > .result-item .result-name .typename {
45
+ grid-column: 1 / 2;
46
+ width: auto;
47
+ white-space: nowrap;
48
+ /* line-height: 1.5rem; */
49
+ }
50
+
51
+ oxide-search-results .search-results.active > .result-item .result-name .path {
52
+ grid-column: 2 / 3;
53
+ }
54
+
55
+ oxide-search-results .search-results.active > .result-item .result-name .path span {
56
+ display: inline-block;
57
+ }
52
58
 
53
59
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["style.css"],"names":[],"mappings":"AAAA;EACE,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,qDAAqD;AACvD;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;AACb;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,cAAc;EACd,WAAW;AACb;;AAEA;EACE,kBAAkB;AACpB;;AAEA;EACE,mBAAmB;EACnB,0DAA0D;AAC5D;;AAEA;EACE,mBAAmB;EACnB,qBAAqB;AACvB;;AAEA;EACE,qBAAqB;AACvB;;AAEA;EACE,UAAU;EACV,sBAAsB;AACxB","file":"index.css","sourcesContent":[":target {\n display: block;\n}\n\n.tsd-anchor-icon {\n display: none;\n}\n\n.docblock {\n --code-background: var(--code-block-background-color);\n}\n\n.docblock pre > button {\n display: none;\n}\n\nrustdoc-toolbar #help-button .shortcuts {\n width: 100%;\n}\n\nrustdoc-toolbar #help-button .info {\n display: none;\n}\n\noxide-search-results .search-results.active {\n display: table;\n width: 100%;\n}\n\noxide-search-results .search-results.active > a {\n display: table-row;\n}\n\noxide-search-results .search-results.active .result-name {\n display: table-cell;\n border-bottom: 1px solid var(--search-result-border-color);\n}\n\noxide-search-results .search-results.active .result-name .typename {\n white-space: nowrap;\n padding-right: 1.5rem;\n}\n\noxide-search-results .search-results.active .result-name .path span {\n display: inline-block;\n}\n\noxide-search-results .search-results.active .result-name:first-child {\n width: 1px;\n vertical-align: middle;\n}\n"]}
1
+ {"version":3,"sources":["style.css"],"names":[],"mappings":"AAAA;EACE,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,qDAAqD;AAKvD;;AAHE;IACE,aAAa;EACf;;AAIA;IACE,WAAW;EACb;;AAEA;IACE,aAAa;EACf;;AAGF;EACE,aAAa;EACb,sCAAsC;AA8BxC;;AA5BE;IACE,aAAa;IACb,yBAAyB;IACzB,8BAA8B;IAC9B,kBAAkB;EAuBpB;;AArBE;MACE,aAAa;MACb,8BAA8B;MAC9B,kBAAkB;MAClB,0BAA0B;IAgB5B;;AAdE;QACE,kBAAkB;QAClB,WAAW;QACX,mBAAmB;QACnB,yBAAyB;MAC3B;;AAEA;QACE,kBAAkB;MAKpB;;AAHE;UACE,qBAAqB;QACvB","file":"index.css","sourcesContent":[":target {\n display: block;\n}\n\n.tsd-anchor-icon {\n display: none;\n}\n\n.docblock {\n --code-background: var(--code-block-background-color);\n\n pre > button {\n display: none;\n }\n}\n\nrustdoc-toolbar #help-button {\n .shortcuts {\n width: 100%;\n }\n\n .infos {\n display: none;\n }\n}\n\noxide-search-results .search-results.active {\n display: grid;\n grid-template-columns: min-content 1fr;\n\n > .result-item {\n display: grid;\n grid-template-areas: none;\n grid-template-columns: subgrid;\n grid-column: 1 / 3;\n\n .result-name {\n display: grid;\n grid-template-columns: subgrid;\n grid-column: 1 / 3;\n /* align-items: initial; */\n\n .typename {\n grid-column: 1 / 2;\n width: auto;\n white-space: nowrap;\n /* line-height: 1.5rem; */\n }\n\n .path {\n grid-column: 2 / 3;\n\n span {\n display: inline-block;\n }\n }\n }\n }\n}\n"]}
@@ -2658,21 +2658,31 @@
2658
2658
  const form = document.querySelector('rustdoc-search .search-form');
2659
2659
  const input = document.querySelector('rustdoc-search .search-input');
2660
2660
  const results = document.querySelector('oxide-search-results#search');
2661
+ const vars = document.querySelector('meta[name="rustdoc-vars"]');
2661
2662
  const main = document.getElementById('main-content');
2662
2663
  const alt = document.getElementById('alternative-display');
2663
2664
  form.addEventListener('submit', (event) => {
2664
2665
  event.preventDefault();
2665
2666
  event.stopPropagation();
2666
2667
  });
2667
- const index = await loadSearchIndex();
2668
- console.log(index);
2668
+ let index;
2669
+ const lazyLoadSearchIndex = async () => {
2670
+ index = await loadSearchIndex();
2671
+ };
2669
2672
  input.addEventListener('input', throttle(async (event) => {
2670
2673
  var _a;
2671
2674
  const text = (_a = event.target.value) === null || _a === void 0 ? void 0 : _a.trim();
2672
2675
  const [hide, show] = text ? [main, alt] : [alt, main];
2673
2676
  hide.classList.add('hidden');
2674
2677
  show.classList.remove('hidden');
2678
+ lazyLoadSearchIndex();
2679
+ if (!index) {
2680
+ return;
2681
+ }
2675
2682
  results.items = await performSearch(text, index);
2683
+ results.query = text;
2684
+ results.project = vars.dataset.currentCrate;
2685
+ results.loading = false;
2676
2686
  }, 300));
2677
2687
  });
2678
2688
  async function performSearch(query, index) {
@@ -2684,20 +2694,34 @@
2684
2694
  enrich: true,
2685
2695
  merge: true,
2686
2696
  });
2687
- console.log(items);
2688
2697
  return items.map((x) => x.doc).filter((x) => x !== null);
2689
2698
  }
2690
2699
  (() => {
2691
- var _OxideSearchResults_items_accessor_storage;
2700
+ var _OxideSearchResults_loading_accessor_storage, _OxideSearchResults_project_accessor_storage, _OxideSearchResults_query_accessor_storage, _OxideSearchResults_items_accessor_storage;
2692
2701
  let _classDecorators = [t('oxide-search-results')];
2693
2702
  let _classDescriptor;
2694
2703
  let _classExtraInitializers = [];
2695
2704
  let _classThis;
2696
2705
  let _classSuper = i;
2706
+ let _loading_decorators;
2707
+ let _loading_initializers = [];
2708
+ let _loading_extraInitializers = [];
2709
+ let _project_decorators;
2710
+ let _project_initializers = [];
2711
+ let _project_extraInitializers = [];
2712
+ let _query_decorators;
2713
+ let _query_initializers = [];
2714
+ let _query_extraInitializers = [];
2697
2715
  let _items_decorators;
2698
2716
  let _items_initializers = [];
2699
2717
  let _items_extraInitializers = [];
2700
2718
  var OxideSearchResults = _classThis = class extends _classSuper {
2719
+ get loading() { return __classPrivateFieldGet(this, _OxideSearchResults_loading_accessor_storage, "f"); }
2720
+ set loading(value) { __classPrivateFieldSet(this, _OxideSearchResults_loading_accessor_storage, value, "f"); }
2721
+ get project() { return __classPrivateFieldGet(this, _OxideSearchResults_project_accessor_storage, "f"); }
2722
+ set project(value) { __classPrivateFieldSet(this, _OxideSearchResults_project_accessor_storage, value, "f"); }
2723
+ get query() { return __classPrivateFieldGet(this, _OxideSearchResults_query_accessor_storage, "f"); }
2724
+ set query(value) { __classPrivateFieldSet(this, _OxideSearchResults_query_accessor_storage, value, "f"); }
2701
2725
  get items() { return __classPrivateFieldGet(this, _OxideSearchResults_items_accessor_storage, "f"); }
2702
2726
  set items(value) { __classPrivateFieldSet(this, _OxideSearchResults_items_accessor_storage, value, "f"); }
2703
2727
  createRenderRoot() {
@@ -2705,18 +2729,30 @@
2705
2729
  return this;
2706
2730
  }
2707
2731
  render() {
2732
+ if (this.loading) {
2733
+ return x `
2734
+ <div class="main-heading">
2735
+ <h1 class="search-results-title">Results</h1>
2736
+ </div>
2737
+
2738
+ <div id="results">
2739
+ <div class="search-failed active">
2740
+ Loading...
2741
+ </div>
2742
+ </div>
2743
+ `;
2744
+ }
2708
2745
  const items = this.items.map((item) => {
2709
2746
  var _a, _b, _c;
2710
- const trace = o((_b = (_a = item.parent) === null || _a === void 0 ? void 0 : _a.split('.').filter((x) => x)) !== null && _b !== void 0 ? _b : [], (name) => x `<span class="parent">${name}.</span>`);
2711
- const classname = (_c = OxideSearchResults.classes[item.kind]) !== null && _c !== void 0 ? _c : 'mod';
2747
+ const classname = (_a = OxideSearchResults.classes[item.kind]) !== null && _a !== void 0 ? _a : 'mod';
2748
+ const trace = o((_c = (_b = item.parent) === null || _b === void 0 ? void 0 : _b.split('.').filter((x) => x)) !== null && _c !== void 0 ? _c : [], (name) => x `<span class="parent">${name}.</span>`);
2712
2749
  return x `
2713
2750
  <a class="result-item" href="${OxideSearchResults.base}${item.url}">
2714
2751
  <span class="result-name">
2715
2752
  <span class="typename">
2716
2753
  ${getReflectionKindName(item.kind)}
2717
2754
  </span>
2718
- </span>
2719
- <span class="result-name">
2755
+
2720
2756
  <div class="path">
2721
2757
  ${trace}<span class="${classname}">${item.name}</span>
2722
2758
  </div>
@@ -2724,6 +2760,7 @@
2724
2760
  </a>
2725
2761
  `;
2726
2762
  });
2763
+ const ddgQuery = encodeURIComponent(`${this.project} ${this.query}`);
2727
2764
  return x `
2728
2765
  <div class="main-heading">
2729
2766
  <h1 class="search-results-title">Results</h1>
@@ -2736,33 +2773,36 @@
2736
2773
 
2737
2774
  <div class="search-failed ${this.items.length ? '' : 'active'}">
2738
2775
  No results :(
2739
- <!--
2740
- <br />
2741
- Try on <a href="https://duckduckgo.com/?q=rust%20result%3A%3Aok">DuckDuckGo</a>?
2742
- <br />
2743
2776
  <br />
2744
- Or try looking in one of these:
2745
- <ul>
2746
- <li>The <a href="https://doc.rust-lang.org/1.86.0/reference/index.html">Rust Reference</a> for technical
2747
- details about the language.</li>
2748
- </ul>
2749
- -->
2777
+ Try on <a href="https://duckduckgo.com/?q=${ddgQuery}" target="_blank">DuckDuckGo</a>?
2750
2778
  </div>
2751
2779
  </div>
2752
2780
  `;
2753
2781
  }
2754
2782
  constructor() {
2755
2783
  super(...arguments);
2756
- _OxideSearchResults_items_accessor_storage.set(this, __runInitializers$3(this, _items_initializers, []));
2784
+ _OxideSearchResults_loading_accessor_storage.set(this, __runInitializers$3(this, _loading_initializers, true));
2785
+ _OxideSearchResults_project_accessor_storage.set(this, (__runInitializers$3(this, _loading_extraInitializers), __runInitializers$3(this, _project_initializers, '')));
2786
+ _OxideSearchResults_query_accessor_storage.set(this, (__runInitializers$3(this, _project_extraInitializers), __runInitializers$3(this, _query_initializers, '')));
2787
+ _OxideSearchResults_items_accessor_storage.set(this, (__runInitializers$3(this, _query_extraInitializers), __runInitializers$3(this, _items_initializers, [])));
2757
2788
  __runInitializers$3(this, _items_extraInitializers);
2758
2789
  }
2759
2790
  };
2791
+ _OxideSearchResults_loading_accessor_storage = new WeakMap();
2792
+ _OxideSearchResults_project_accessor_storage = new WeakMap();
2793
+ _OxideSearchResults_query_accessor_storage = new WeakMap();
2760
2794
  _OxideSearchResults_items_accessor_storage = new WeakMap();
2761
2795
  __setFunctionName(_classThis, "OxideSearchResults");
2762
2796
  (() => {
2763
2797
  var _a;
2764
2798
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create((_a = _classSuper[Symbol.metadata]) !== null && _a !== void 0 ? _a : null) : void 0;
2799
+ _loading_decorators = [n({ attribute: false })];
2800
+ _project_decorators = [n({ attribute: false })];
2801
+ _query_decorators = [n({ attribute: false })];
2765
2802
  _items_decorators = [n({ attribute: false })];
2803
+ __esDecorate$3(_classThis, null, _loading_decorators, { kind: "accessor", name: "loading", static: false, private: false, access: { has: obj => "loading" in obj, get: obj => obj.loading, set: (obj, value) => { obj.loading = value; } }, metadata: _metadata }, _loading_initializers, _loading_extraInitializers);
2804
+ __esDecorate$3(_classThis, null, _project_decorators, { kind: "accessor", name: "project", static: false, private: false, access: { has: obj => "project" in obj, get: obj => obj.project, set: (obj, value) => { obj.project = value; } }, metadata: _metadata }, _project_initializers, _project_extraInitializers);
2805
+ __esDecorate$3(_classThis, null, _query_decorators, { kind: "accessor", name: "query", static: false, private: false, access: { has: obj => "query" in obj, get: obj => obj.query, set: (obj, value) => { obj.query = value; } }, metadata: _metadata }, _query_initializers, _query_extraInitializers);
2766
2806
  __esDecorate$3(_classThis, null, _items_decorators, { kind: "accessor", name: "items", static: false, private: false, access: { has: obj => "items" in obj, get: obj => obj.items, set: (obj, value) => { obj.items = value; } }, metadata: _metadata }, _items_initializers, _items_extraInitializers);
2767
2807
  __esDecorate$3(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
2768
2808
  OxideSearchResults = _classThis = _classDescriptor.value;