@aquera/nile-elements 0.0.85 → 0.0.86

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "0.0.85",
6
+ "version": "0.0.86",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -78,7 +78,8 @@
78
78
  "./nile-split-panel": "./dist/src/nile-split-panel/index.js",
79
79
  "./nile-list": "./dist/src/nile-list/index.js",
80
80
  "./nile-list-item": "./dist/src/nile-list-item/index.js",
81
- "./nile-detail": "./dist/src/nile-detail/index.js"
81
+ "./nile-detail": "./dist/src/nile-detail/index.js",
82
+ "./nile-title": "./dist/src/nile-title/index.js"
82
83
  },
83
84
  "scripts": {
84
85
  "analyze": "cem analyze --litelement",
package/src/index.ts CHANGED
@@ -71,3 +71,4 @@ export { NileListItem } from './nile-list-item';
71
71
  export { NileList } from './nile-list';
72
72
  export { NileDetail } from './nile-detail';
73
73
  export { NileDivider } from './nile-divider';
74
+ export { NileTitle } from './nile-title';
@@ -0,0 +1 @@
1
+ export { NileTitle } from './nile-title';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {css} from 'lit-element';
9
+
10
+ /**
11
+ * Title CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ font: 500 20px / 30px var(--nile-font-family-sans-serif);
16
+ }
17
+ `;
18
+
19
+ export default [styles];
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';
9
+ import { customElement } from 'lit/decorators.js';
10
+ import {styles} from './nile-title.css';
11
+ import NileElement from '../internal/nile-element';
12
+
13
+ /**
14
+ * Nile title component.
15
+ *
16
+ * @tag nile-title
17
+ *
18
+ */
19
+ @customElement('nile-title')
20
+ export class NileTitle extends NileElement {
21
+ @property({ type: String }) headerText = '';
22
+
23
+ @property({ type: String }) pageTitle = '';
24
+
25
+ /**
26
+ * The styles for nile-title
27
+ * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
28
+ */
29
+ public static get styles(): CSSResultArray {
30
+ return [styles];
31
+ }
32
+
33
+ /* #endregion */
34
+
35
+ /* #region Methods */
36
+
37
+ /**
38
+ * Called when the component is updated
39
+ */
40
+ protected updated(_changedProperties: Map<string | number | symbol, unknown>): void {
41
+ super.updated(_changedProperties);
42
+ this.updateDocumentTitle();
43
+ }
44
+
45
+ /**
46
+ * Updates the document title based on pageTitle or headerText
47
+ */
48
+ private updateDocumentTitle(): void {
49
+ document.title = this.pageTitle || this.headerText;
50
+ }
51
+
52
+ /**
53
+ * Render method
54
+ * @slot This is a slot test
55
+ */
56
+ public render(): TemplateResult {
57
+ return html` ${this.headerText ? html` ${this.headerText} ` : ''} `;
58
+ }
59
+
60
+ /* #endregion */
61
+ }
62
+
63
+ export default NileTitle;
64
+
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ 'nile-title': NileTitle;
68
+ }
69
+ }