Skip to content

Commit 8b944e3

Browse files
committed
Shared between main site and documentation pages.
1 parent 9d5d707 commit 8b944e3

File tree

15 files changed

+211
-117
lines changed

15 files changed

+211
-117
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ node_modules
1818
.parcel-cache
1919
Public/main.js
2020
Public/main.js.map
21+
Public/shared.js
22+
Public/shared.js.map
2123
Public/main.css
2224
Public/main.css.map
25+
Public/shared.css
26+
Public/shared.css.map
2327
Public/docc.css
2428
Public/docc.css.map
2529
Tests/AppTests/__Snapshots__/WebpageSnapshotTests/*

FrontEnd/docc.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
$mobile-breakpoint: 740px;
2020

21-
@import 'styles/colors';
22-
@import 'styles/images';
23-
2421
header.spi,
2522
footer.spi {
2623
position: sticky;

FrontEnd/esbuild.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ import { sassPlugin } from 'esbuild-sass-plugin'
1717

1818
try {
1919
const context = await esbuild.context({
20-
entryPoints: ['FrontEnd/main.js', 'FrontEnd/main.scss', 'FrontEnd/docc.scss'],
20+
entryPoints: [
21+
'FrontEnd/main.js',
22+
'FrontEnd/shared.js',
23+
'FrontEnd/main.scss',
24+
'FrontEnd/docc.scss',
25+
'FrontEnd/shared.scss',
26+
],
2127
outdir: 'Public',
2228
bundle: true,
2329
sourcemap: true,

FrontEnd/main.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@ $mobile-breakpoint: 740px;
2222
@import 'styles/breadcrumbs';
2323
@import 'styles/build_logs';
2424
@import 'styles/build_monitor';
25-
@import 'styles/colors';
2625
@import 'styles/copyable_input';
27-
@import 'styles/debug_console';
2826
@import 'styles/error';
2927
@import 'styles/github_highlighting';
3028
@import 'styles/header_footer';
3129
@import 'styles/home';
32-
@import 'styles/images';
3330
@import 'styles/keywords';
3431
@import 'styles/layout';
3532
@import 'styles/maintainer_info';
@@ -46,5 +43,6 @@ $mobile-breakpoint: 740px;
4643
@import 'styles/spinner';
4744
@import 'styles/supporters';
4845
@import 'styles/tab_bar';
46+
@import 'styles/utility';
4947
@import 'styles/validate_manifest';
5048
@import 'styles/vega_charts';

FrontEnd/scripts/controllers/debug_console_controller.js

Lines changed: 0 additions & 59 deletions
This file was deleted.

FrontEnd/scripts/controllers/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import { PanelButtonController } from './panel_button_controller.js'
2121
import { UseThisPackagePanelController } from './use_this_package_panel_controller.js'
2222
import { BlogController } from './blog_controller.js'
2323
import { VegaChartController } from './vega_chart_controller.js'
24-
import { DebugConsoleController } from './debug_console_controller.js'
2524

2625
const application = Application.start()
2726
application.register('overflowing-list', OverflowingListController)
@@ -32,4 +31,3 @@ application.register('panel-button', PanelButtonController)
3231
application.register('use-this-package-panel', UseThisPackagePanelController)
3332
application.register('blog', BlogController)
3433
application.register('vega-chart', VegaChartController)
35-
application.register('debug-console', DebugConsoleController)

FrontEnd/scripts/debug_panel.js

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
export class SPIDebugPanel extends HTMLElement {
16+
connectedCallback() {
17+
// Debug console is Hidden by default. Make it visble by typing:
18+
// `localStorage.setItem('spiDebug', 'true');`
19+
// into the browser console.
20+
if (localStorage.getItem('spiDebug') === 'true') {
21+
this.classList.remove('hidden')
22+
this.addCanonicalUrls()
23+
}
24+
25+
this.querySelector('.buttons > .hide').addEventListener('click', () => {
26+
this.classList.add('hidden')
27+
})
28+
29+
this.querySelector('.buttons > .disable').addEventListener('click', () => {
30+
this.classList.add('hidden')
31+
localStorage.setItem('spiDebug', 'false')
32+
})
33+
}
34+
35+
disconnectedCallback() {
36+
console.log('SPIDebugPanel disconnectedCallback')
37+
}
38+
39+
newTableRow(title, value) {
40+
const rowElement = document.createElement('tr')
41+
42+
const titleCellElement = document.createElement('td')
43+
titleCellElement.innerText = title
44+
45+
const valueCellElement = document.createElement('td')
46+
valueCellElement.innerText = value
47+
48+
rowElement.appendChild(titleCellElement)
49+
rowElement.appendChild(valueCellElement)
50+
return rowElement
51+
}
52+
53+
addCanonicalUrls() {
54+
const tableElement = this.querySelector('table')
55+
const canonicalUrl = document.querySelector('link[rel="canonical"]').href
56+
const windowUrl = window.location.href
57+
58+
tableElement.appendChild(this.newTableRow('Canonical URL', canonicalUrl))
59+
tableElement.appendChild(this.newTableRow('Window URL', windowUrl))
60+
tableElement.appendChild(this.newTableRow('URLs Match', canonicalUrl === windowUrl))
61+
}
62+
}

FrontEnd/shared.js

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

FrontEnd/shared.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// -------------------------------------------------------------------------
16+
// Any styles shared between SPI and the SPI documentation pages.
17+
// -------------------------------------------------------------------------
18+
19+
@import 'styles/colors';
20+
@import 'styles/utility';
21+
@import 'styles/debug_panel';
22+
@import 'styles/images';

FrontEnd/styles/base.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,6 @@ a.big-button {
226226
background-color: var(--announcement-background);
227227
}
228228

229-
.hidden {
230-
display: none;
231-
}
232-
233-
.trimmed {
234-
overflow: hidden;
235-
text-overflow: ellipsis;
236-
}
237-
238229
.count-tag {
239230
padding: 1px 5px;
240231
font-size: 10px;

0 commit comments

Comments
 (0)