Skip to content

Commit

Permalink
Merge of Insiders features tied to 'Caribbean Red' funding goal
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Sep 23, 2021
1 parent 62742b4 commit 377b4d6
Show file tree
Hide file tree
Showing 32 changed files with 228 additions and 198 deletions.
29 changes: 0 additions & 29 deletions material/assets/javascripts/bundle.48dfec6c.min.js

This file was deleted.

7 changes: 0 additions & 7 deletions material/assets/javascripts/bundle.48dfec6c.min.js.map

This file was deleted.

48 changes: 0 additions & 48 deletions material/assets/javascripts/workers/search.94ec81fe.min.js

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions material/assets/stylesheets/main.92558b1b.min.css

This file was deleted.

1 change: 0 additions & 1 deletion material/assets/stylesheets/main.92558b1b.min.css.map

This file was deleted.

12 changes: 7 additions & 5 deletions material/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{% endif %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.92558b1b.min.css' | url }}">
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.8b42a75e.min.css' | url }}">
{% if config.theme.palette %}
{% set palette = config.theme.palette %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.3f5d1f46.min.css' | url }}">
Expand Down Expand Up @@ -119,8 +119,10 @@
<div class="md-container" data-md-component="container">
{% block hero %}{% endblock %}
{% block tabs %}
{% if "navigation.tabs" in features %}
{% include "partials/tabs.html" %}
{% if not "navigation.tabs.sticky" in features %}
{% if "navigation.tabs" in features %}
{% include "partials/tabs.html" %}
{% endif %}
{% endif %}
{% endblock %}
<main class="md-main" data-md-component="main">
Expand Down Expand Up @@ -196,7 +198,7 @@ <h1>{{ page.title | d(config.site_name, true)}}</h1>
"base": base_url,
"features": features,
"translations": {},
"search": "assets/javascripts/workers/search.94ec81fe.min.js" | url,
"search": "assets/javascripts/workers/search.f8263e09.min.js" | url,
"version": config.extra.version or None
} -%}
{%- set translations = app.translations -%}
Expand All @@ -223,7 +225,7 @@ <h1>{{ page.title | d(config.site_name, true)}}</h1>
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.48dfec6c.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.4fc53ad4.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}
Expand Down
18 changes: 0 additions & 18 deletions material/overrides/assets/javascripts/bundle.f9a9c765.min.js

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion material/overrides/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
{% endblock %}
{% block scripts %}
{{ super() }}
<script src="{{ 'overrides/assets/javascripts/bundle.f9a9c765.min.js' | url }}"></script>
<script src="{{ 'overrides/assets/javascripts/bundle.5c8bd0f7.min.js' | url }}"></script>
{% endblock %}
10 changes: 6 additions & 4 deletions material/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@
{{ config.copyright }}
</div>
{% endif %}
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
{% if not config.extra.generator == false %}
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
{% endif %}
{{ extracopyright }}
</div>
{% include "partials/social.html" %}
Expand Down
11 changes: 10 additions & 1 deletion material/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{#-
This file was automatically generated - do not edit
-#}
<header class="md-header" data-md-component="header">
{% set class = "md-header" %}
{% if "navigation.tabs.sticky" in features %}
{% set class = class ~ " md-header--lifted" %}
{% endif %}
<header class="{{ class }}" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="{{ lang.t('header.title') }}">
<a href="{{ config.extra.homepage | d(nav.homepage.url, true) | url }}" title="{{ config.site_name | e }}" class="md-header__button md-logo" aria-label="{{ config.site_name }}" data-md-component="logo">
{% include "partials/logo.html" %}
Expand Down Expand Up @@ -74,4 +78,9 @@
</div>
{% endif %}
</nav>
{% if "navigation.tabs.sticky" in features %}
{% if "navigation.tabs" in features %}
{% include "partials/tabs.html" %}
{% endif %}
{% endif %}
</header>
32 changes: 27 additions & 5 deletions material/partials/nav-item.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,40 @@
{% else %}
<input class="md-nav__toggle md-toggle" data-md-toggle="{{ path }}" type="checkbox" id="{{ path }}" {{ checked }}>
{% endif %}
<label class="md-nav__link" for="{{ path }}">
{{ nav_item.title }}
<span class="md-nav__icon md-icon"></span>
</label>
{% set indexes = [] %}
{% if "navigation.indexes" in features %}
{% for item in nav_item.children %}
{% if item.is_index and not index is defined %}
{% set _ = indexes.append(item) %}
{% endif %}
{% endfor %}
{% endif %}
{% if not indexes %}
<label class="md-nav__link" for="{{ path }}">
{{ nav_item.title }}
<span class="md-nav__icon md-icon"></span>
</label>
{% else %}
{% set index = indexes | first %}
{% set class = "md-nav__link--active" if index == page %}
<div class="md-nav__link md-nav__link--container {{ class }}">
<a href="{{ index.url | url }}">{{ nav_item.title }}</a>
<label for="{{ path }}">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
{% endif %}
<nav class="md-nav" aria-label="{{ nav_item.title }}" data-md-level="{{ level }}">
<label class="md-nav__title" for="{{ path }}">
<span class="md-nav__icon md-icon"></span>
{{ nav_item.title }}
</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for nav_item in nav_item.children %}
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
{% if "navigation.indexes" in features and nav_item.is_index %}
{% else %}
{{ render(nav_item, path ~ "_" ~ loop.index, level + 1) }}
{% endif %}
{% endfor %}
</ul>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ nav:
- Meta tags: reference/meta-tags.md
- Variables: reference/variables.md
- Insiders:
- Sponsorship: insiders/index.md
- insiders/index.md
- Getting started:
- Installation: insiders/getting-started.md
- Changelog: insiders/changelog.md
Expand Down
4 changes: 3 additions & 1 deletion src/assets/javascripts/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export type Flag =
| "header.autohide" /* Hide header */
| "navigation.expand" /* Automatic expansion */
| "navigation.instant" /* Instant loading */
| "navigation.sections" /* Sections navigation */
| "navigation.indexes" /* Section pages */
| "navigation.sections" /* Section navigation */
| "navigation.tabs" /* Tabs navigation */
| "navigation.tabs.sticky" /* Tabs navigation (sticky) */
| "navigation.top" /* Back-to-top button */
| "search.highlight" /* Search highlighting */
| "search.share" /* Search sharing */
Expand Down
19 changes: 3 additions & 16 deletions src/assets/javascripts/browser/element/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*/
export function getElement<T extends keyof HTMLElementTagNameMap>(
selector: T, node?: ParentNode
): HTMLElementTagNameMap[T]
): HTMLElementTagNameMap[T] | undefined

export function getElement<T extends HTMLElement>(
selector: string, node?: ParentNode
Expand Down Expand Up @@ -74,6 +74,8 @@ export function getElementOrThrow<T extends HTMLElement>(
throw new ReferenceError(
`Missing element: expected "${selector}" to be present`
)

/* Return element */
return el
}

Expand Down Expand Up @@ -114,21 +116,6 @@ export function getElements<T extends HTMLElement>(

/* ------------------------------------------------------------------------- */

/**
* Create an element
*
* @template T - Tag name type
*
* @param tagName - Tag name
*
* @returns Element
*/
export function createElement<T extends keyof HTMLElementTagNameMap>(
tagName: T
): HTMLElementTagNameMap[T] {
return document.createElement(tagName)
}

/**
* Replace an element with the given list of nodes
*
Expand Down
6 changes: 3 additions & 3 deletions src/assets/javascripts/browser/location/hash/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {
startWith
} from "rxjs/operators"

import { createElement, getElement } from "~/browser"
import { getElement } from "~/browser"
import { h } from "~/utilities"

/* ----------------------------------------------------------------------------
* Functions
Expand All @@ -54,8 +55,7 @@ export function getLocationHash(): string {
* @param hash - Location hash
*/
export function setLocationHash(hash: string): void {
const el = createElement("a")
el.href = hash
const el = h("a", { href: hash })
el.addEventListener("click", ev => ev.stopPropagation())
el.click()
}
Expand Down
4 changes: 2 additions & 2 deletions src/assets/javascripts/components/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { getElementOrThrow, getElements } from "~/browser"
* ------------------------------------------------------------------------- */

/**
* Component
* Component type
*/
export type ComponentType =
| "announce" /* Announcement bar */
Expand All @@ -52,7 +52,7 @@ export type ComponentType =
| "top" /* Back-to-top button */

/**
* A component
* Component
*
* @template T - Component type
* @template U - Reference type
Expand Down
5 changes: 3 additions & 2 deletions src/assets/javascripts/components/content/table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@

import { Observable, of } from "rxjs"

import { createElement, replaceElement } from "~/browser"
import { replaceElement } from "~/browser"
import { renderTable } from "~/templates"
import { h } from "~/utilities"

import { Component } from "../../_"

Expand All @@ -43,7 +44,7 @@ export interface DataTable {}
/**
* Sentinel for replacement
*/
const sentinel = createElement("table")
const sentinel = h("table")

/* ----------------------------------------------------------------------------
* Functions
Expand Down
2 changes: 1 addition & 1 deletion src/assets/javascripts/components/search/_/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export function mountSearch(

/* Search sharing */
...getComponentElements("search-share", el)
.map(child => mountSearchShare(child, { query$ })),
.map(child => mountSearchShare(child, { query$ })),

/* Search suggestions */
...getComponentElements("search-suggest", el)
Expand Down
14 changes: 12 additions & 2 deletions src/assets/javascripts/components/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@
* IN THE SOFTWARE.
*/

import { Observable, Subject, animationFrameScheduler } from "rxjs"
import {
Observable,
Subject,
animationFrameScheduler,
of
} from "rxjs"
import {
distinctUntilKeyChanged,
finalize,
Expand All @@ -30,6 +35,7 @@ import {
tap
} from "rxjs/operators"

import { feature } from "~/_"
import { resetTabsState, setTabsState } from "~/actions"
import {
Viewport,
Expand Down Expand Up @@ -134,7 +140,11 @@ export function mountTabs(
})

/* Create and return component */
return watchTabs(el, options)
return (
feature("navigation.tabs.sticky")
? of({ hidden: false })
: watchTabs(el, options)
)
.pipe(
tap(state => internal$.next(state)),
finalize(() => internal$.complete()),
Expand Down
11 changes: 7 additions & 4 deletions src/assets/javascripts/integrations/instant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ import {
switchMap
} from "rxjs/operators"

import { configuration } from "~/_"
import { configuration, feature } from "~/_"
import {
Viewport,
ViewportOffset,
createElement,
getElement,
getElements,
replaceElement,
Expand All @@ -60,6 +59,7 @@ import {
setViewportOffset
} from "~/browser"
import { getComponentElement } from "~/components"
import { h } from "~/utilities"

/* ----------------------------------------------------------------------------
* Types
Expand Down Expand Up @@ -283,7 +283,10 @@ export function setupInstantLoading(
"[data-md-component=container]",
"[data-md-component=header-topic]",
"[data-md-component=logo], .md-logo", // compat
"[data-md-component=skip]"
"[data-md-component=skip]",
...feature("navigation.tabs.sticky")
? ["[data-md-component=tabs]"]
: []
]) {
const source = getElement(selector)
const target = getElement(selector, replacement)
Expand All @@ -303,7 +306,7 @@ export function setupInstantLoading(
map(() => getComponentElement("container")),
switchMap(el => of(...getElements("script", el))),
concatMap(el => {
const script = createElement("script")
const script = h("script")
if (el.src) {
for (const name of el.getAttributeNames())
script.setAttribute(name, el.getAttribute(name)!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,30 @@ export const enum SearchMessageType {
/* ------------------------------------------------------------------------- */

/**
* A message containing the data necessary to setup the search index
* Message containing the data necessary to setup the search index
*/
export interface SearchSetupMessage {
type: SearchMessageType.SETUP /* Message type */
data: SearchIndex /* Message data */
}

/**
* A message indicating the search index is ready
* Message indicating the search index is ready
*/
export interface SearchReadyMessage {
type: SearchMessageType.READY /* Message type */
}

/**
* A message containing a search query
* Message containing a search query
*/
export interface SearchQueryMessage {
type: SearchMessageType.QUERY /* Message type */
data: string /* Message data */
}

/**
* A message containing results for a search query
* Message containing results for a search query
*/
export interface SearchResultMessage {
type: SearchMessageType.RESULT /* Message type */
Expand All @@ -72,7 +72,7 @@ export interface SearchResultMessage {
/* ------------------------------------------------------------------------- */

/**
* A message exchanged with the search worker
* Message exchanged with the search worker
*/
export type SearchMessage =
| SearchSetupMessage
Expand Down
3 changes: 2 additions & 1 deletion src/assets/javascripts/utilities/h/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"rules": {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-namespace": "off"
"@typescript-eslint/no-namespace": "off",
"jsdoc/require-jsdoc": "off"
}
}
Loading

0 comments on commit 377b4d6

Please sign in to comment.