@trimble-oss/modus-docs-hugo-theme 1.0.0-alpha1 → 1.0.0-alpha2

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.
package/README.md CHANGED
@@ -8,12 +8,8 @@ Status: Alpha. This theme is currently under development and is not yet ready fo
8
8
 
9
9
  1. Add this repo to your package.json as follows:
10
10
 
11
- ```json
12
- {
13
- "dependencies": {
14
- "modus-docs-hugo-theme": "git+github.com:trimble-oss/modus-docs-hugo-theme.git"
15
- }
16
- }
11
+ ```bash
12
+ npm i @trimble-oss/modus-docs-hugo-theme --save-dev
17
13
  ```
18
14
 
19
15
  2. Add the following mounts to your Hugo config:
@@ -1,3 +1,4 @@
1
+ // script adapted from Adam Argyle's tutorial: https://web.dev/building-a-theme-switch-component/
1
2
  (() => {
2
3
  'use strict';
3
4
 
@@ -108,3 +108,7 @@ article .nav-tabs .nav-link::after {
108
108
  background-image: none !important;
109
109
  width: 0 !important;
110
110
  }
111
+
112
+ article table {
113
+ width: 100%;
114
+ }
@@ -10,8 +10,10 @@
10
10
  {{ end }}
11
11
  </div>
12
12
  <div class="col-9 align-self-center">
13
- {{- .title }} <img src="/img/icons/external-link.svg" class="filter-greyscale opacity-50" height="14"
14
- width="14" alt="">
13
+ {{- .title }}
14
+ <svg class="filter-greyscale opacity-50" width="14" height="14" fill="currentColor">
15
+ <use xlink:href="/modus-solid-icons.svg#external-link" />
16
+ </svg>
15
17
  </div>
16
18
  </div>
17
19
  </a>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@trimble-oss/modus-docs-hugo-theme",
3
- "version": "1.0.0-alpha1",
4
- "description": "A Documentation heme for Hugo built by Trimble",
3
+ "version": "1.0.0-alpha2",
4
+ "description": "A Documentation theme for Hugo built by Trimble",
5
5
  "homepage": "https://github.com/trimble-oss/modus-docs-hugo-theme",
6
6
  "bugs": {
7
7
  "url": "https://github.com/trimble-oss/modus-docs-hugo-theme/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc"
@@ -10,29 +10,33 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/trimble-oss/modus-docs-hugo-theme"
12
12
  },
13
- "license": "private",
13
+ "license": "MIT",
14
14
  "author": "Trimble",
15
15
  "scripts": {
16
16
  "build": "npx hugo",
17
- "lint": "npm run lint-css && npm run lint-html",
17
+ "lint": "npm run lint-css && npm run lint-html && npm run lint-js",
18
18
  "lint-css": "stylelint \"assets/styles/*.*\" --fix",
19
19
  "lint-html": "htmlhint \"build/**/index.html\"",
20
+ "lint-js": "eslint assets/js/*.js --fix",
21
+ "lint-links": "npx linkinator content/ --recurse --silent --skip \"^(?!http://localhost)\"",
20
22
  "lint-spellcheck": "npx cspell \"content/**/*.md\" --no-progress",
21
23
  "prettier": "prettier --write \"**/*.{json,js,md,svg}\"",
22
24
  "serve": "hugo serve --port 4000 --disableFastRender --navigateToChanged",
23
- "test": "npm run lint-css && npm run lint-html"
25
+ "test": "npm run lint-css && npm run lint-html && npm run lint-js"
24
26
  },
25
27
  "dependencies": {
26
28
  "@trimble-oss/modus-icons": "1.4.0"
27
29
  },
28
30
  "devDependencies": {
29
31
  "autoprefixer": "10.4.15",
32
+ "eslint": "^8.47.0",
33
+ "eslint-config-prettier": "^9.0.0",
30
34
  "htmlhint": "1.1.4",
31
35
  "hugo-bin": "0.113.0",
32
36
  "postcss": "8.4.28",
33
37
  "postcss-cli": "10.1.0",
34
38
  "prettier": "3.0.2",
35
- "stylelint": "15.10.2",
39
+ "stylelint": "15.10.3",
36
40
  "stylelint-config-standard-scss": "10.0.0"
37
41
  },
38
42
  "hugo-bin": {
@@ -10,10 +10,7 @@ const onClick = () => {
10
10
 
11
11
  const getColorPreference = () => {
12
12
  if (localStorage.getItem(storageKey)) return localStorage.getItem(storageKey);
13
- else
14
- return window.matchMedia('(prefers-color-scheme: dark)').matches
15
- ? 'dark'
16
- : 'light';
13
+ else return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
17
14
  };
18
15
 
19
16
  const setPreference = () => {
@@ -24,9 +21,7 @@ const setPreference = () => {
24
21
  const reflectPreference = () => {
25
22
  document.firstElementChild.setAttribute('data-bs-theme', theme.value);
26
23
 
27
- document
28
- .querySelector('#theme-toggle')
29
- ?.setAttribute('aria-label', theme.value);
24
+ document.querySelector('#theme-toggle')?.setAttribute('aria-label', theme.value);
30
25
  };
31
26
 
32
27
  const theme = {
@@ -40,9 +35,7 @@ window.onload = () => {
40
35
  document.querySelector('#theme-toggle').addEventListener('click', onClick);
41
36
  };
42
37
 
43
- window
44
- .matchMedia('(prefers-color-scheme: dark)')
45
- .addEventListener('change', ({ matches: isDark }) => {
46
- theme.value = isDark ? 'dark' : 'light';
47
- setPreference();
48
- });
38
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches: isDark }) => {
39
+ theme.value = isDark ? 'dark' : 'light';
40
+ setPreference();
41
+ });