@pb33f/cowboy-components 0.0.12 → 0.0.13

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.
@@ -1,9 +1,8 @@
1
1
  import { css } from "lit";
2
2
  export default css `
3
-
4
3
  sl-alert::part(message) {
5
4
  padding-bottom: var(--global-padding);
6
- color: var(--font-color-sub1);
5
+ color: var(--font-color);
7
6
  }
8
7
 
9
8
  sl-alert.error::part(message) {
@@ -12,6 +11,12 @@ export default css `
12
11
 
13
12
  sl-alert.warning::part(message) {
14
13
  color: var(--warn-300);
14
+
15
+ }
16
+
17
+ strong {
18
+ font-weight: normal;
19
+ font-family: var(--font-stack-bold), monospace;
15
20
  }
16
21
 
17
22
  .attention {
@@ -50,6 +55,12 @@ export default css `
50
55
  border-left: 5px solid var(--terminal-text);
51
56
  }
52
57
 
58
+ .question {
59
+ color: var(--secondary-color);
60
+ border-color: var(--secondary-color);
61
+ border-left: 5px solid var(--secondary-color);
62
+ }
63
+
53
64
 
54
65
  .warning {
55
66
  color: var(--warn-300);
@@ -3,6 +3,7 @@ export declare enum AttentionType {
3
3
  Context = "context",
4
4
  Info = "info",
5
5
  Success = "success",
6
+ Question = "question",
6
7
  Warning = "warning",
7
8
  Error = "error",
8
9
  Danger = "danger"
@@ -11,6 +12,7 @@ export declare class AttentionBox extends LitElement {
11
12
  static styles: import("lit").CSSResult[];
12
13
  type: AttentionType;
13
14
  headerText: string;
14
- getIcon(): "braces-asterisk" | "info-square" | "exclamation-triangle" | "exclamation-square" | "check-square";
15
+ constructor();
16
+ getIcon(): "braces-asterisk" | "info-square" | "exclamation-triangle" | "exclamation-square" | "check-square" | "question-square";
15
17
  render(): import("lit-html").TemplateResult<1>;
16
18
  }
@@ -13,11 +13,17 @@ export var AttentionType;
13
13
  AttentionType["Context"] = "context";
14
14
  AttentionType["Info"] = "info";
15
15
  AttentionType["Success"] = "success";
16
+ AttentionType["Question"] = "question";
16
17
  AttentionType["Warning"] = "warning";
17
18
  AttentionType["Error"] = "error";
18
19
  AttentionType["Danger"] = "danger";
19
20
  })(AttentionType || (AttentionType = {}));
20
21
  let AttentionBox = class AttentionBox extends LitElement {
22
+ constructor() {
23
+ super();
24
+ this.type = AttentionType.Context;
25
+ //this.headerText = 'information'
26
+ }
21
27
  getIcon() {
22
28
  switch (this.type) {
23
29
  case AttentionType.Context:
@@ -32,6 +38,8 @@ let AttentionBox = class AttentionBox extends LitElement {
32
38
  return 'exclamation-square';
33
39
  case AttentionType.Success:
34
40
  return 'check-square';
41
+ case AttentionType.Question:
42
+ return 'question-square';
35
43
  }
36
44
  }
37
45
  render() {
@@ -42,13 +50,13 @@ let AttentionBox = class AttentionBox extends LitElement {
42
50
  this.type = AttentionType.Error;
43
51
  }
44
52
  let header = html ``;
45
- if (this.headerText != '') {
53
+ if (this.headerText?.length > 0) {
46
54
  header = html `<strong>${this.headerText}</strong>`;
47
55
  }
48
56
  return html `
49
57
  <div class='attention ${this.type}'>
50
58
  <sl-alert class="${this.type}" open>
51
- <sl-icon slot="icon" name="${this.getIcon()}"></sl-icon>
59
+ <sl-icon slot="icon" name="${this.getIcon()}" class="${this.headerText ? '' : 'noheader'}"></sl-icon>
52
60
  ${header}
53
61
  <slot></slot>
54
62
  </sl-alert>
@@ -5,8 +5,10 @@ export declare class ChangelogComponent extends LitElement {
5
5
  project: string;
6
6
  summaries: ReleaseSummary[];
7
7
  private error;
8
+ private _linked;
8
9
  constructor();
9
10
  connectedCallback(): void;
11
+ extractHash(): void;
10
12
  fetchChangelogSummary(): Promise<any>;
11
13
  render(): TemplateResult<1>;
12
14
  }
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { customElement, property, state } from "lit/decorators.js";
8
8
  import { html, LitElement } from "lit";
9
9
  import { marked } from "marked";
10
- import { unsafeHTML } from "lit/directives/unsafe-html.js";
11
10
  import changelogCss from "./changelog.css.js";
12
11
  import sharedCss from "../../css/shared.css.js";
13
12
  import alertsCss from "../../css/alerts.css.js";
13
+ import { ReleaseComponent } from "./release.js";
14
14
  let ChangelogComponent = class ChangelogComponent extends LitElement {
15
15
  constructor() {
16
16
  super();
@@ -25,6 +25,10 @@ let ChangelogComponent = class ChangelogComponent extends LitElement {
25
25
  .catch((err) => {
26
26
  this.error = err;
27
27
  });
28
+ this.extractHash();
29
+ }
30
+ extractHash() {
31
+ this._linked = window.location.hash.substring(1);
28
32
  }
29
33
  async fetchChangelogSummary() {
30
34
  const response = await fetch(`${this.apiURL}/${this.project}`);
@@ -46,6 +50,7 @@ let ChangelogComponent = class ChangelogComponent extends LitElement {
46
50
  // parseInt(version.split('.')[1])
47
51
  const extractPatchVersion = (version) => parseInt(version.split('.')[2]);
48
52
  const items = [];
53
+ let selectedDetails = null;
49
54
  for (let i = 0; i < this.summaries?.length; i++) {
50
55
  const summary = this.summaries[i];
51
56
  let patchVersion = extractPatchVersion(summary.tag_name);
@@ -61,26 +66,38 @@ let ChangelogComponent = class ChangelogComponent extends LitElement {
61
66
  if (i == 0) {
62
67
  latest = true;
63
68
  }
69
+ const release = new ReleaseComponent();
70
+ release.latest = latest;
71
+ release.milestone = milestone;
72
+ release.name = summary.name;
73
+ release.published = summary.published_at;
74
+ release.link = summary.html_url;
75
+ release.author = summary.author;
76
+ release.tarball = summary.tarball_url;
77
+ release.authorLink = summary.author_url;
78
+ release.authorImage = summary.author_image;
79
+ release.body = parsed;
80
+ let open = false;
81
+ if (summary.name == this._linked) {
82
+ open = true;
83
+ }
84
+ if (open) {
85
+ selectedDetails = release;
86
+ }
64
87
  items.push(html `
65
88
  <pb33f-timeline-item id="release_${summary.name}">
66
89
  <span slot="icon">${icon}</span>
67
90
  <span slot="time" class="${milestone ? `major` : null}">${summary.publish_date}</span>
68
91
  <div slot="content">
69
- <pb33f-release
70
- .latest="${latest}"
71
- .milestone="${milestone}"
72
- name="${summary.name}"
73
- published="${summary.published_at}"
74
- link="${summary.html_url}"
75
- author="${summary.author}"
76
- tarball="${summary.tarball_url}"
77
- authorLink="${summary.author_url}"
78
- authorImage="${summary.author_image}">
79
- ${unsafeHTML(parsed)}
80
- </pb33f-release>
92
+ ${release}
81
93
  </div>
82
94
  </pb33f-timeline-item>`);
83
95
  }
96
+ if (selectedDetails) {
97
+ setTimeout(() => {
98
+ selectedDetails?.open();
99
+ });
100
+ }
84
101
  return html `
85
102
  <pb33f-timeline>
86
103
  ${items.map((item) => {
@@ -35,6 +35,7 @@ export default css `
35
35
  .published {
36
36
  color: var(--font-color-sub1);
37
37
  }
38
+
38
39
  hr {
39
40
  margin-top: 0;
40
41
  border-top: 1px dashed var(--bars-and-borders);
@@ -66,7 +67,7 @@ export default css `
66
67
  pb33f-kv-view {
67
68
  max-width: 500px;
68
69
  }
69
-
70
+
70
71
  @media only screen and (max-width: 800px) {
71
72
 
72
73
  sl-details {
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from "lit";
2
+ import { SlDetails } from "@shoelace-style/shoelace";
2
3
  export declare class ReleaseComponent extends LitElement {
3
4
  static styles: import("lit").CSSResult[];
4
5
  name: string;
@@ -11,6 +12,8 @@ export declare class ReleaseComponent extends LitElement {
11
12
  tarball: string;
12
13
  milestone: boolean;
13
14
  latest: boolean;
15
+ details: SlDetails;
14
16
  constructor();
17
+ open(): void;
15
18
  render(): import("lit-html").TemplateResult<1>;
16
19
  }
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement, property } from "lit/decorators.js";
7
+ import { customElement, property, query } from "lit/decorators.js";
8
8
  import { html, LitElement } from "lit";
9
9
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
10
10
  import { KVViewComponent } from "../kv-view/kv-view.js";
@@ -14,26 +14,23 @@ let ReleaseComponent = class ReleaseComponent extends LitElement {
14
14
  constructor() {
15
15
  super();
16
16
  }
17
+ open() {
18
+ if (this.details != null) {
19
+ this.details.show().then(() => {
20
+ window.scrollTo({
21
+ behavior: 'smooth',
22
+ top: this.details.getBoundingClientRect().top -
23
+ document.body.getBoundingClientRect().top -
24
+ 150,
25
+ });
26
+ });
27
+ }
28
+ }
17
29
  render() {
18
30
  const kv = new Map();
19
31
  if (this.link) {
20
32
  kv.set('Release ', `<a href="${this.link}">${this.link}</a>`);
21
33
  }
22
- if (this.author && this.authorImage) {
23
- let name = this.author;
24
- if (this.author == 'daveshanley') {
25
- name = 'quobix';
26
- }
27
- kv.set('Author', `<sl-avatar image="${this.authorImage}" label="Avatar of ${name}"></sl-avatar>
28
- <a href="${this.authorLink}">${name}</a>`);
29
- }
30
- if (this.author && !this.authorImage) {
31
- let name = this.author;
32
- if (this.author == 'daveshanley') {
33
- name = 'quobix';
34
- }
35
- kv.set('Author', `<a href="${this.authorLink}">${name}</a>`);
36
- }
37
34
  if (this.tarball) {
38
35
  kv.set('Tarball', `<a href="${this.tarball}">${this.tarball}</a>`);
39
36
  }
@@ -90,6 +87,9 @@ __decorate([
90
87
  __decorate([
91
88
  property({ type: Boolean })
92
89
  ], ReleaseComponent.prototype, "latest", void 0);
90
+ __decorate([
91
+ query('sl-details')
92
+ ], ReleaseComponent.prototype, "details", void 0);
93
93
  ReleaseComponent = __decorate([
94
94
  customElement('pb33f-release')
95
95
  ], ReleaseComponent);
@@ -20,7 +20,7 @@ export default css `
20
20
 
21
21
  header.pb33f-header > .logo {
22
22
  width: 170px;
23
- min-width: 145px;
23
+ min-width: 170px;
24
24
  padding: 9px 0 10px 10px;
25
25
  border-bottom: 1px dashed var(--secondary-color);
26
26
  height: 36px;
@@ -40,4 +40,12 @@ export default css `
40
40
  border-radius: 0;
41
41
  text-transform: uppercase;
42
42
  }
43
+
44
+ @media only screen and (max-width: 1000px) {
45
+
46
+ sl-button {
47
+ display: none;
48
+ }
49
+ }
50
+
43
51
  `;