@vscode-elements/elements 2.0.0 → 2.1.0

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.
@@ -32,6 +32,12 @@ import styles from './vscode-collapsible.styles.js';
32
32
  let VscodeCollapsible = class VscodeCollapsible extends VscElement {
33
33
  constructor() {
34
34
  super(...arguments);
35
+ /**
36
+ * When enabled, header actions are always visible; otherwise, they appear only when the cursor
37
+ * hovers over the component. Actions are shown only when the Collapsible component is open. This
38
+ * property is designed to use the `workbench.view.alwaysShowHeaderActions` setting.
39
+ */
40
+ this.alwaysShowHeaderActions = false;
35
41
  /**
36
42
  * Component heading text
37
43
  *
@@ -63,7 +69,11 @@ let VscodeCollapsible = class VscodeCollapsible extends VscElement {
63
69
  }
64
70
  }
65
71
  render() {
66
- const classes = classMap({ collapsible: true, open: this.open });
72
+ const classes = { collapsible: true, open: this.open };
73
+ const actionsClasses = {
74
+ actions: true,
75
+ 'always-visible': this.alwaysShowHeaderActions,
76
+ };
67
77
  const heading = this.heading ? this.heading : this.title;
68
78
  const icon = html `<svg
69
79
  width="16"
@@ -83,7 +93,7 @@ let VscodeCollapsible = class VscodeCollapsible extends VscElement {
83
93
  ? html `<span class="description">${this.description}</span>`
84
94
  : nothing;
85
95
  return html `
86
- <div class=${classes}>
96
+ <div class=${classMap(classes)}>
87
97
  <div
88
98
  class="collapsible-header"
89
99
  tabindex="0"
@@ -93,7 +103,9 @@ let VscodeCollapsible = class VscodeCollapsible extends VscElement {
93
103
  ${icon}
94
104
  <h3 class="title">${heading}${descriptionMarkup}</h3>
95
105
  <div class="header-slots">
96
- <div class="actions"><slot name="actions"></slot></div>
106
+ <div class=${classMap(actionsClasses)}>
107
+ <slot name="actions"></slot>
108
+ </div>
97
109
  <div class="decorations"><slot name="decorations"></slot></div>
98
110
  </div>
99
111
  </div>
@@ -105,6 +117,13 @@ let VscodeCollapsible = class VscodeCollapsible extends VscElement {
105
117
  }
106
118
  };
107
119
  VscodeCollapsible.styles = styles;
120
+ __decorate([
121
+ property({
122
+ type: Boolean,
123
+ reflect: true,
124
+ attribute: 'always-show-header-actions',
125
+ })
126
+ ], VscodeCollapsible.prototype, "alwaysShowHeaderActions", void 0);
108
127
  __decorate([
109
128
  property({ type: String })
110
129
  ], VscodeCollapsible.prototype, "title", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"vscode-collapsible.js","sourceRoot":"","sources":["../../src/vscode-collapsible/vscode-collapsible.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,MAAM,MAAM,gCAAgC,CAAC;AAIpD;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAGL;;;;;WAKG;QAEM,UAAK,GAAW,EAAE,CAAC;QAE5B;;WAEG;QAEH,YAAO,GAAG,EAAE,CAAC;QAEb,yCAAyC;QAEzC,gBAAW,GAAG,EAAE,CAAC;QAGjB,SAAI,GAAG,KAAK,CAAC;IAkEf,CAAC;IAhES,gBAAgB;QACtB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,wBAAwB,EAAE;YACxC,MAAM,EAAE,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAC;SAC1B,CAA8B,CAChC,CAAC;IACJ,CAAC;IAEO,cAAc;QACpB,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;QACvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC1B,CAAC;IAEO,gBAAgB,CAAC,KAAoB;QAC3C,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAEQ,MAAM;QACb,MAAM,OAAO,GAAG,QAAQ,CAAC,EAAC,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAC,CAAC,CAAC;QAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;QAEzD,MAAM,IAAI,GAAG,IAAI,CAAA;;;;;;;;;;;;;WAaV,CAAC;QAER,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW;YACxC,CAAC,CAAC,IAAI,CAAA,6BAA6B,IAAI,CAAC,WAAW,SAAS;YAC5D,CAAC,CAAC,OAAO,CAAC;QAEZ,OAAO,IAAI,CAAA;mBACI,OAAO;;;;mBAIP,IAAI,CAAC,cAAc;qBACjB,IAAI,CAAC,gBAAgB;;YAE9B,IAAI;8BACc,OAAO,GAAG,iBAAiB;;;;;;;;;;KAUpD,CAAC;IACJ,CAAC;;AAvFe,wBAAM,GAAG,MAAM,AAAT,CAAU;AASvB;IADR,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;gDACG;AAM5B;IADC,QAAQ,EAAE;kDACE;AAIb;IADC,QAAQ,EAAE;sDACM;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;+CAC5B;AAvBF,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAyF7B","sourcesContent":["import {html, nothing, TemplateResult} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement, VscElement} from '../includes/VscElement.js';\nimport styles from './vscode-collapsible.styles.js';\n\nexport type VscCollapsibleToggleEvent = CustomEvent<{open: boolean}>;\n\n/**\n * Allows users to reveal or hide related content on a page.\n *\n * @tag vscode-collapsible\n *\n * @slot - Main content.\n * @slot actions - You can place any action icon in this slot in the header, but it's also possible to use any HTML element in it. It's only visible when the component is open.\n * @slot decorations - The elements placed in the decorations slot are always visible.\n *\n * @fires {VscCollapsibleToggleEvent} vsc-collapsible-toggle - Dispatched when the content visibility is changed.\n *\n * @cssprop [--vscode-sideBar-background=#181818] - Background color\n * @cssprop [--vscode-focusBorder=#0078d4] - Focus border color\n * @cssprop [--vscode-font-family=sans-serif] - Header font family\n * @cssprop [--vscode-sideBarSectionHeader-background=#181818] - Header background\n * @cssprop [--vscode-icon-foreground=#cccccc] - Arrow icon color\n * @cssprop [--vscode-sideBarTitle-foreground=#cccccc] - Header font color\n *\n * @csspart body - Container for the toggleable content of the component. The container's overflow content is hidden by default. This CSS part can serve as an escape hatch to modify this behavior.\n */\n@customElement('vscode-collapsible')\nexport class VscodeCollapsible extends VscElement {\n static override styles = styles;\n\n /**\n * Component heading text\n *\n * @deprecated The `title` is a global HTML attribute and will unintentionally trigger a native\n * tooltip on the component. Use the `heading` property instead.\n */\n @property({type: String})\n override title: string = '';\n\n /**\n * Heading text.\n */\n @property()\n heading = '';\n\n /** Less prominent text in the header. */\n @property()\n description = '';\n\n @property({type: Boolean, reflect: true})\n open = false;\n\n private _emitToggleEvent() {\n this.dispatchEvent(\n new CustomEvent('vsc-collapsible-toggle', {\n detail: {open: this.open},\n }) as VscCollapsibleToggleEvent\n );\n }\n\n private _onHeaderClick() {\n this.open = !this.open;\n this._emitToggleEvent();\n }\n\n private _onHeaderKeyDown(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n this.open = !this.open;\n this._emitToggleEvent();\n }\n }\n\n override render(): TemplateResult {\n const classes = classMap({collapsible: true, open: this.open});\n const heading = this.heading ? this.heading : this.title;\n\n const icon = html`<svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n class=\"header-icon\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M10.072 8.024L5.715 3.667l.618-.62L11 7.716v.618L6.333 13l-.618-.619 4.357-4.357z\"\n />\n </svg>`;\n\n const descriptionMarkup = this.description\n ? html`<span class=\"description\">${this.description}</span>`\n : nothing;\n\n return html`\n <div class=${classes}>\n <div\n class=\"collapsible-header\"\n tabindex=\"0\"\n @click=${this._onHeaderClick}\n @keydown=${this._onHeaderKeyDown}\n >\n ${icon}\n <h3 class=\"title\">${heading}${descriptionMarkup}</h3>\n <div class=\"header-slots\">\n <div class=\"actions\"><slot name=\"actions\"></slot></div>\n <div class=\"decorations\"><slot name=\"decorations\"></slot></div>\n </div>\n </div>\n <div class=\"collapsible-body\" part=\"body\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-collapsible': VscodeCollapsible;\n }\n\n interface GlobalEventHandlersEventMap {\n 'vsc-collapsible-toggle': VscCollapsibleToggleEvent;\n }\n}\n"]}
1
+ {"version":3,"file":"vscode-collapsible.js","sourceRoot":"","sources":["../../src/vscode-collapsible/vscode-collapsible.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAiB,MAAM,KAAK,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,MAAM,MAAM,gCAAgC,CAAC;AAIpD;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,UAAU;IAA1C;;QAGL;;;;WAIG;QAMH,4BAAuB,GAAG,KAAK,CAAC;Q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IAAI,CAAA;mBACI,QAAQ,CAAC,OAAO,CAAC;;;;mBAIjB,IAAI,CAAC,cAAc;qBACjB,IAAI,CAAC,gBAAgB;;YAE9B,IAAI;8BACc,OAAO,GAAG,iBAAiB;;yBAEhC,QAAQ,CAAC,cAAc,CAAC;;;;;;;;;;KAU5C,CAAC;IACJ,CAAC;;AAzGe,wBAAM,GAAG,MAAM,AAAT,CAAU;AAYhC;IALC,QAAQ,CAAC;QACR,IAAI,EAAE,OAAO;QACb,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,4BAA4B;KACxC,CAAC;kEAC8B;AASvB;IADR,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;gDACG;AAM5B;IADC,QAAQ,EAAE;kDACE;AAIb;IADC,QAAQ,EAAE;sDACM;AAGjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;+CAC5B;AAnCF,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA2G7B","sourcesContent":["import {html, nothing, TemplateResult} from 'lit';\nimport {property} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement, VscElement} from '../includes/VscElement.js';\nimport styles from './vscode-collapsible.styles.js';\n\nexport type VscCollapsibleToggleEvent = CustomEvent<{open: boolean}>;\n\n/**\n * Allows users to reveal or hide related content on a page.\n *\n * @tag vscode-collapsible\n *\n * @slot - Main content.\n * @slot actions - You can place any action icon in this slot in the header, but it's also possible to use any HTML element in it. It's only visible when the component is open.\n * @slot decorations - The elements placed in the decorations slot are always visible.\n *\n * @fires {VscCollapsibleToggleEvent} vsc-collapsible-toggle - Dispatched when the content visibility is changed.\n *\n * @cssprop [--vscode-sideBar-background=#181818] - Background color\n * @cssprop [--vscode-focusBorder=#0078d4] - Focus border color\n * @cssprop [--vscode-font-family=sans-serif] - Header font family\n * @cssprop [--vscode-sideBarSectionHeader-background=#181818] - Header background\n * @cssprop [--vscode-icon-foreground=#cccccc] - Arrow icon color\n * @cssprop [--vscode-sideBarTitle-foreground=#cccccc] - Header font color\n *\n * @csspart body - Container for the toggleable content of the component. The container's overflow content is hidden by default. This CSS part can serve as an escape hatch to modify this behavior.\n */\n@customElement('vscode-collapsible')\nexport class VscodeCollapsible extends VscElement {\n static override styles = styles;\n\n /**\n * When enabled, header actions are always visible; otherwise, they appear only when the cursor\n * hovers over the component. Actions are shown only when the Collapsible component is open. This\n * property is designed to use the `workbench.view.alwaysShowHeaderActions` setting.\n */\n @property({\n type: Boolean,\n reflect: true,\n attribute: 'always-show-header-actions',\n })\n alwaysShowHeaderActions = false;\n\n /**\n * Component heading text\n *\n * @deprecated The `title` is a global HTML attribute and will unintentionally trigger a native\n * tooltip on the component. Use the `heading` property instead.\n */\n @property({type: String})\n override title: string = '';\n\n /**\n * Heading text.\n */\n @property()\n heading = '';\n\n /** Less prominent text in the header. */\n @property()\n description = '';\n\n @property({type: Boolean, reflect: true})\n open = false;\n\n private _emitToggleEvent() {\n this.dispatchEvent(\n new CustomEvent('vsc-collapsible-toggle', {\n detail: {open: this.open},\n }) as VscCollapsibleToggleEvent\n );\n }\n\n private _onHeaderClick() {\n this.open = !this.open;\n this._emitToggleEvent();\n }\n\n private _onHeaderKeyDown(event: KeyboardEvent) {\n if (event.key === 'Enter') {\n this.open = !this.open;\n this._emitToggleEvent();\n }\n }\n\n override render(): TemplateResult {\n const classes = {collapsible: true, open: this.open};\n const actionsClasses = {\n actions: true,\n 'always-visible': this.alwaysShowHeaderActions,\n };\n const heading = this.heading ? this.heading : this.title;\n\n const icon = html`<svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n class=\"header-icon\"\n >\n <path\n fill-rule=\"evenodd\"\n clip-rule=\"evenodd\"\n d=\"M10.072 8.024L5.715 3.667l.618-.62L11 7.716v.618L6.333 13l-.618-.619 4.357-4.357z\"\n />\n </svg>`;\n\n const descriptionMarkup = this.description\n ? html`<span class=\"description\">${this.description}</span>`\n : nothing;\n\n return html`\n <div class=${classMap(classes)}>\n <div\n class=\"collapsible-header\"\n tabindex=\"0\"\n @click=${this._onHeaderClick}\n @keydown=${this._onHeaderKeyDown}\n >\n ${icon}\n <h3 class=\"title\">${heading}${descriptionMarkup}</h3>\n <div class=\"header-slots\">\n <div class=${classMap(actionsClasses)}>\n <slot name=\"actions\"></slot>\n </div>\n <div class=\"decorations\"><slot name=\"decorations\"></slot></div>\n </div>\n </div>\n <div class=\"collapsible-body\" part=\"body\">\n <slot></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-collapsible': VscodeCollapsible;\n }\n\n interface GlobalEventHandlersEventMap {\n 'vsc-collapsible-toggle': VscCollapsibleToggleEvent;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"vscode-collapsible.styles.d.ts","sourceRoot":"","sources":["../../src/vscode-collapsible/vscode-collapsible.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,cAAc,EAAC,MAAM,KAAK,CAAC;AAGxC,QAAA,MAAM,MAAM,EAAE,cA4Fb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"vscode-collapsible.styles.d.ts","sourceRoot":"","sources":["../../src/vscode-collapsible/vscode-collapsible.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,cAAc,EAAC,MAAM,KAAK,CAAC;AAGxC,QAAA,MAAM,MAAM,EAAE,cA6Fb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -68,7 +68,8 @@ const styles = [
68
68
  display: none;
69
69
  }
70
70
 
71
- .collapsible.open .actions {
71
+ .collapsible.open .actions.always-visible,
72
+ .collapsible.open:hover .actions {
72
73
  display: block;
73
74
  }
74
75
 
@@ -1 +1 @@
1
- {"version":3,"file":"vscode-collapsible.styles.js","sourceRoot":"","sources":["../../src/vscode-collapsible/vscode-collapsible.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAiB,MAAM,KAAK,CAAC;AACxC,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAE1D,MAAM,MAAM,GAAmB;IAC7B,aAAa;IACb,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyFF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {css, CSSResultGroup} from 'lit';\nimport defaultStyles from '../includes/default.styles.js';\n\nconst styles: CSSResultGroup = [\n defaultStyles,\n css`\n .collapsible {\n background-color: var(--vscode-sideBar-background, #181818);\n }\n\n .collapsible-header {\n align-items: center;\n background-color: var(--vscode-sideBarSectionHeader-background, #181818);\n cursor: pointer;\n display: flex;\n height: 22px;\n line-height: 22px;\n user-select: none;\n }\n\n .collapsible-header:focus {\n opacity: 1;\n outline-offset: -1px;\n outline-style: solid;\n outline-width: 1px;\n outline-color: var(--vscode-focusBorder, #0078d4);\n }\n\n .title {\n color: var(--vscode-sideBarTitle-foreground, #cccccc);\n display: block;\n font-family: var(--vscode-font-family, sans-serif);\n font-size: 11px;\n font-weight: 700;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n }\n\n .title .description {\n font-weight: 400;\n margin-left: 10px;\n text-transform: none;\n opacity: 0.6;\n }\n\n .header-icon {\n color: var(--vscode-icon-foreground, #cccccc);\n display: block;\n flex-shrink: 0;\n margin: 0 3px;\n }\n\n .collapsible.open .header-icon {\n transform: rotate(90deg);\n }\n\n .header-slots {\n align-items: center;\n display: flex;\n height: 22px;\n margin-left: auto;\n margin-right: 4px;\n }\n\n .actions {\n display: none;\n }\n\n .collapsible.open .actions {\n display: block;\n }\n\n .header-slots slot {\n display: flex;\n max-height: 22px;\n overflow: hidden;\n }\n\n .header-slots slot::slotted(div) {\n align-items: center;\n display: flex;\n }\n\n .collapsible-body {\n display: none;\n overflow: hidden;\n }\n\n .collapsible.open .collapsible-body {\n display: block;\n }\n `,\n];\n\nexport default styles;\n"]}
1
+ {"version":3,"file":"vscode-collapsible.styles.js","sourceRoot":"","sources":["../../src/vscode-collapsible/vscode-collapsible.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAiB,MAAM,KAAK,CAAC;AACxC,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAE1D,MAAM,MAAM,GAAmB;IAC7B,aAAa;IACb,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FF;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {css, CSSResultGroup} from 'lit';\nimport defaultStyles from '../includes/default.styles.js';\n\nconst styles: CSSResultGroup = [\n defaultStyles,\n css`\n .collapsible {\n background-color: var(--vscode-sideBar-background, #181818);\n }\n\n .collapsible-header {\n align-items: center;\n background-color: var(--vscode-sideBarSectionHeader-background, #181818);\n cursor: pointer;\n display: flex;\n height: 22px;\n line-height: 22px;\n user-select: none;\n }\n\n .collapsible-header:focus {\n opacity: 1;\n outline-offset: -1px;\n outline-style: solid;\n outline-width: 1px;\n outline-color: var(--vscode-focusBorder, #0078d4);\n }\n\n .title {\n color: var(--vscode-sideBarTitle-foreground, #cccccc);\n display: block;\n font-family: var(--vscode-font-family, sans-serif);\n font-size: 11px;\n font-weight: 700;\n margin: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n text-transform: uppercase;\n white-space: nowrap;\n }\n\n .title .description {\n font-weight: 400;\n margin-left: 10px;\n text-transform: none;\n opacity: 0.6;\n }\n\n .header-icon {\n color: var(--vscode-icon-foreground, #cccccc);\n display: block;\n flex-shrink: 0;\n margin: 0 3px;\n }\n\n .collapsible.open .header-icon {\n transform: rotate(90deg);\n }\n\n .header-slots {\n align-items: center;\n display: flex;\n height: 22px;\n margin-left: auto;\n margin-right: 4px;\n }\n\n .actions {\n display: none;\n }\n\n .collapsible.open .actions.always-visible,\n .collapsible.open:hover .actions {\n display: block;\n }\n\n .header-slots slot {\n display: flex;\n max-height: 22px;\n overflow: hidden;\n }\n\n .header-slots slot::slotted(div) {\n align-items: center;\n display: flex;\n }\n\n .collapsible-body {\n display: none;\n overflow: hidden;\n }\n\n .collapsible.open .collapsible-body {\n display: block;\n }\n `,\n];\n\nexport default styles;\n"]}
@@ -23,7 +23,7 @@ let VscodeScrollable = class VscodeScrollable extends VscElement {
23
23
  * Scroll position.
24
24
  */
25
25
  set scrollPos(val) {
26
- this._scrollPos = val;
26
+ this._scrollPos = this._limitScrollPos(val);
27
27
  this._updateScrollbar();
28
28
  this._updateThumbPosition();
29
29
  this.requestUpdate();
@@ -1 +1 @@
1
- {"version":3,"file":"vscode-scrollable.js","sourceRoot":"","sources":["../../src/vscode-scrollable/vscode-scrollable.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAC,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,MAAM,MAAM,+BAA+B,CAAC;AAInD;;;;;;;GAOG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IA6C9C;;OAEG;IAEH,IAAI,SAAS,CAAC,GAAW;QACvB,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,oBAAoB,EAAE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Q,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC;uDAChD;AAQtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,yBAAyB,EAAC,CAAC;+DACrC;AAM1B;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAC,CAAC;sDACpC;AASlB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gCAAgC,EAAC,CAAC;qEACtC;AAMhC;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;gDAC3B;AAMd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;kDACxB;AAMjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC;iDAMjD;AAsBO;IADP,KAAK,EAAE;qDACoB;AAGpB;IADP,KAAK,EAAE;sDACiB;AAGjB;IADP,KAAK,EAAE;iDACY;AAGZ;IADP,KAAK,EAAE;uDACsB;AAGtB;IADP,KAAK,EAAE;oDACmB;AAGnB;IADP,KAAK,EAAE;sDACqB;AAGrB;IADP,KAAK,CAAC,UAAU,CAAC;yDACuB;AAGjC;IADP,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;6DACa;AAGrC;IADP,KAAK,CAAC,uBAAuB,CAAC;8DACe;AAGtC;IADP,qBAAqB,EAAE;2DACa;AAvG1B,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAyY5B","sourcesContent":["import {html, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement, VscElement} from '../includes/VscElement.js';\nimport {stylePropertyMap} from '../includes/style-property-map.js';\nimport styles from './vscode-scrollable.styles.js';\n\nexport type VscScrollableScrollEvent = CustomEvent<number>;\n\n/**\n * @tag vscode-scrollable\n *\n * @cssprop [--vscode-scrollbar-shadow=#000000]\n * @cssprop [--vscode-scrollbarSlider-background=rgba(121, 121, 121, 0.4)]\n * @cssprop [--vscode-scrollbarSlider-hoverBackground=rgba(100, 100, 100, 0.7)]\n * @cssprop [--vscode-scrollbarSlider-activeBackground=rgba(191, 191, 191, 0.4)]\n */\n@customElement('vscode-scrollable')\nexport class VscodeScrollable extends VscElement {\n static override styles = styles;\n\n /**\n * By default, the scrollbar appears only when the cursor hovers over the\n * component. With this option, the scrollbar will always be visible.\n */\n @property({type: Boolean, reflect: true, attribute: 'always-visible'})\n alwaysVisible = false;\n\n /**\n * Scrolling speed multiplier when pressing `Alt`. This property is designed to use the value of\n * `editor.fastScrollSensitivity`, `workbench.list.fastScrollSensitivity` or\n * `terminal.integrated.fastScrollSensitivity` depending on the context.\n */\n @property({type: Number, attribute: 'fast-scroll-sensitivity'})\n fastScrollSensitivity = 5;\n\n /**\n * This setting defines the scrollbar's minimum size when the component contains a large amount of content.\n */\n @property({type: Number, attribute: 'min-thumb-size'})\n minThumbSize = 20;\n\n /**\n * A multiplier to be used on the `deltaY` of the mouse wheel scroll events. This property is\n * designed to use the value of `editor.mouseWheelScrollSensitivity`,\n * `workbench.list.mouseWheelScrollSensitivity` or\n * `terminal.integrated.mouseWheelScrollSensitivity` depending on the context.\n */\n @property({type: Number, attribute: 'mouse-wheel-scroll-sensitivity'})\n mouseWheelScrollSensitivity = 1;\n\n /**\n * Controls shadow visibility when content overflows.\n */\n @property({type: Boolean, reflect: true})\n shadow = true;\n\n /**\n * It's true when `scrollPos` greater than 0\n */\n @property({type: Boolean, reflect: true})\n scrolled = false;\n\n /**\n * Scroll position.\n */\n @property({type: Number, attribute: 'scroll-pos'})\n set scrollPos(val: number) {\n this._scrollPos = val;\n this._updateScrollbar();\n this._updateThumbPosition();\n this.requestUpdate();\n }\n get scrollPos(): number {\n return this._scrollPos;\n }\n\n private _scrollPos = 0;\n\n /**\n * The maximum amount of the `scrollPos`.\n */\n get scrollMax(): number {\n if (!this._scrollableContainer) {\n return 0;\n }\n\n return (\n this._scrollableContainer.scrollHeight -\n this._scrollableContainer.clientHeight\n );\n }\n\n @state()\n private _isDragging = false;\n\n @state()\n private _thumbHeight = 0;\n\n @state()\n private _thumbY = 0;\n\n @state()\n private _thumbVisible = false;\n\n @state()\n private _thumbFade = false;\n\n @state()\n private _thumbActive = false;\n\n @query('.content')\n private _contentElement!: HTMLDivElement;\n\n @query('.scrollbar-thumb', true)\n private _scrollThumbElement!: HTMLDivElement;\n\n @query('.scrollable-container')\n private _scrollableContainer!: HTMLDivElement;\n\n @queryAssignedElements()\n private _assignedElements!: NodeList;\n\n private _hostResizeObserver!: ResizeObserver;\n private _contentResizeObserver!: ResizeObserver;\n private _scrollThumbStartY = 0;\n private _mouseStartY = 0;\n private _scrollbarVisible = true;\n private _scrollbarTrackZ = 0;\n\n //#region lifecycle methods\n\n constructor() {\n super();\n this.addEventListener('mouseover', this._handleComponentMouseOver);\n this.addEventListener('mouseout', this._handleComponentMouseOut);\n this.addEventListener('wheel', this._handleComponentWheel);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n this._hostResizeObserver = new ResizeObserver(this._resizeObserverCallback);\n this._contentResizeObserver = new ResizeObserver(\n this._resizeObserverCallback\n );\n\n this.requestUpdate();\n\n this.updateComplete.then(() => {\n this._hostResizeObserver.observe(this);\n this._contentResizeObserver.observe(this._contentElement);\n this._updateThumbPosition();\n });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this._hostResizeObserver.unobserve(this);\n this._hostResizeObserver.disconnect();\n this._contentResizeObserver.unobserve(this._contentElement);\n this._contentResizeObserver.disconnect();\n }\n\n protected override firstUpdated(_changedProperties: PropertyValues): void {\n this._updateThumbPosition();\n }\n\n //#endregion\n\n private _resizeObserverCallback = () => {\n this._updateScrollbar();\n this._updateThumbPosition();\n };\n\n private _calcThumbHeight() {\n const componentHeight = this.offsetHeight;\n const contentHeight = this._contentElement?.offsetHeight ?? 0;\n const proposedSize = componentHeight * (componentHeight / contentHeight);\n\n return Math.max(this.minThumbSize, proposedSize);\n }\n\n private _updateScrollbar() {\n const contentHeight = this._contentElement?.offsetHeight ?? 0;\n const componentHeight = this.offsetHeight;\n\n if (componentHeight >= contentHeight) {\n this._scrollbarVisible = false;\n } else {\n this._scrollbarVisible = true;\n this._thumbHeight = this._calcThumbHeight();\n }\n\n this.requestUpdate();\n }\n\n private _zIndexFix() {\n let highestZ = 0;\n\n this._assignedElements.forEach((n) => {\n if ('style' in n) {\n const computedZIndex = window.getComputedStyle(n as HTMLElement).zIndex;\n const isNumber = /([0-9-])+/g.test(computedZIndex);\n\n if (isNumber) {\n highestZ =\n Number(computedZIndex) > highestZ\n ? Number(computedZIndex)\n : highestZ;\n }\n }\n });\n\n this._scrollbarTrackZ = highestZ + 1;\n this.requestUpdate();\n }\n\n private _updateThumbPosition() {\n if (!this._scrollableContainer) {\n return;\n }\n\n this.scrolled = this.scrollPos > 0;\n\n const componentH = this.offsetHeight;\n const thumbH = this._thumbHeight;\n const contentH = this._contentElement.offsetHeight;\n\n const overflown = contentH - componentH;\n const ratio = this.scrollPos / overflown;\n const thumbYMax = componentH - thumbH;\n\n this._thumbY = Math.min(ratio * (componentH - thumbH), thumbYMax);\n }\n\n private _calculateScrollPosFromThumbPos(scrollPos: number) {\n const cmpH = this.getBoundingClientRect().height;\n const thumbH = this._scrollThumbElement.getBoundingClientRect().height;\n const contentH = this._contentElement.getBoundingClientRect().height;\n const rawScrollPos = (scrollPos / (cmpH - thumbH)) * (contentH - cmpH);\n\n return this._limitScrollPos(rawScrollPos);\n }\n\n private _limitScrollPos(newPos: number) {\n if (newPos < 0) {\n return 0;\n } else if (newPos > this.scrollMax) {\n return this.scrollMax;\n } else {\n return newPos;\n }\n }\n\n private _limitThumbPos(newPos: number) {\n const cmpH = this.getBoundingClientRect().height;\n const thumbH = this._scrollThumbElement.getBoundingClientRect().height;\n\n if (newPos < 0) {\n return 0;\n } else if (newPos > cmpH - thumbH) {\n return cmpH - thumbH;\n } else {\n return newPos;\n }\n }\n\n //#region event handlers\n private _handleSlotChange = () => {\n this._updateScrollbar();\n this._updateThumbPosition();\n this._zIndexFix();\n };\n\n private _handleScrollThumbMouseDown(event: MouseEvent) {\n const cmpCr = this.getBoundingClientRect();\n const thCr = this._scrollThumbElement.getBoundingClientRect();\n\n this._mouseStartY = event.screenY;\n this._scrollThumbStartY = thCr.top - cmpCr.top;\n this._isDragging = true;\n this._thumbActive = true;\n\n document.addEventListener('mousemove', this._handleScrollThumbMouseMove);\n document.addEventListener('mouseup', this._handleScrollThumbMouseUp);\n }\n\n private _handleScrollThumbMouseMove = (event: MouseEvent) => {\n const rawThumbPos =\n this._scrollThumbStartY + (event.screenY - this._mouseStartY);\n this._thumbY = this._limitThumbPos(rawThumbPos);\n this.scrollPos = this._calculateScrollPosFromThumbPos(this._thumbY);\n\n this.dispatchEvent(\n new CustomEvent('vsc-scrollable-scroll', {\n detail: this.scrollPos,\n })\n );\n };\n\n private _handleScrollThumbMouseUp = (event: MouseEvent) => {\n this._isDragging = false;\n this._thumbActive = false;\n\n const cr = this.getBoundingClientRect();\n const {x, y, width, height} = cr;\n const {pageX, pageY} = event;\n\n if (pageX > x + width || pageX < x || pageY > y + height || pageY < y) {\n this._thumbFade = true;\n this._thumbVisible = false;\n }\n\n document.removeEventListener('mousemove', this._handleScrollThumbMouseMove);\n document.removeEventListener('mouseup', this._handleScrollThumbMouseUp);\n };\n\n private _handleComponentMouseOver = () => {\n this._thumbVisible = true;\n this._thumbFade = false;\n };\n\n private _handleComponentMouseOut = () => {\n if (!this._thumbActive) {\n this._thumbVisible = false;\n this._thumbFade = true;\n }\n };\n\n private _handleComponentWheel = (ev: WheelEvent) => {\n ev.preventDefault();\n\n const multiplier = ev.altKey\n ? this.mouseWheelScrollSensitivity * this.fastScrollSensitivity\n : this.mouseWheelScrollSensitivity;\n\n this.scrollPos = this._limitScrollPos(\n this.scrollPos + ev.deltaY * multiplier\n );\n this.dispatchEvent(\n new CustomEvent('vsc-scrollable-scroll', {\n detail: this.scrollPos,\n })\n );\n };\n\n private _handleScrollbarTrackPress(ev: PointerEvent) {\n if (ev.target !== ev.currentTarget) {\n return;\n }\n\n this._thumbY = ev.offsetY - this._thumbHeight / 2;\n this.scrollPos = this._calculateScrollPosFromThumbPos(this._thumbY);\n }\n\n private _handleScrollableContainerScroll = (ev: Event) => {\n if (ev.currentTarget) {\n this.scrollPos = (ev.currentTarget as HTMLDivElement).scrollTop;\n }\n };\n\n //#endregion\n\n override render(): TemplateResult {\n return html`\n <div\n class=\"scrollable-container\"\n .style=${stylePropertyMap({\n userSelect: this._isDragging ? 'none' : 'auto',\n })}\n .scrollTop=${this.scrollPos}\n @scroll=${this._handleScrollableContainerScroll}\n >\n <div\n class=${classMap({shadow: true, visible: this.scrolled})}\n .style=${stylePropertyMap({\n zIndex: String(this._scrollbarTrackZ),\n })}\n ></div>\n ${this._isDragging\n ? html`<div class=\"prevent-interaction\"></div>`\n : nothing}\n <div\n class=${classMap({\n 'scrollbar-track': true,\n hidden: !this._scrollbarVisible,\n })}\n @mousedown=${this._handleScrollbarTrackPress}\n >\n <div\n class=${classMap({\n 'scrollbar-thumb': true,\n visible: this.alwaysVisible ? true : this._thumbVisible,\n fade: this.alwaysVisible ? false : this._thumbFade,\n active: this._thumbActive,\n })}\n .style=${stylePropertyMap({\n height: `${this._thumbHeight}px`,\n top: `${this._thumbY}px`,\n })}\n @mousedown=${this._handleScrollThumbMouseDown}\n ></div>\n </div>\n <div class=\"content\">\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-scrollable': VscodeScrollable;\n }\n\n interface GlobalEventHandlersEventMap {\n 'vsc-scrollable-scroll': VscScrollableScrollEvent;\n }\n}\n"]}
1
+ {"version":3,"file":"vscode-scrollable.js","sourceRoot":"","sources":["../../src/vscode-scrollable/vscode-scrollable.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,IAAI,EAAE,OAAO,EAAiC,MAAM,KAAK,CAAC;AAClE,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAC,gBAAgB,EAAC,MAAM,mCAAmC,CAAC;AACnE,OAAO,MAAM,MAAM,+BAA+B,CAAC;AAInD;;;;;;;GAOG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IA6C9C;;OAEG;IAEH,IAAI,SAAS,CAAC,GAAW;QACvB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,aAAa,EAAE,CAAC;IACvB,CAAC;IACD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAID;;OAEG;IACH,IAAI,SAAS;QACX,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC/B,OAAO,CAAC,CAAC;QACX,CAAC;QAED,OAAO,CACL,IAAI,CAAC,oBAAoB,CAAC,YAAY;YACtC,IAAI,CAAC,oBAAoB,CAAC,YAAY,CACvC,CAAC;IACJ,CAAC;IAuCD,2BAA2B;IAE3B;QACE,KAAK,EAAE,CAAC;QAhHV;;;WAGG;QAEH,kBAAa,GAAG,KAAK,CAAC;QAEtB;;;;WAIG;QAEH,0BA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C,CAAC;gDAC3B;AAMd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;kDACxB;AAMjB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC;iDAMjD;AAsBO;IADP,KAAK,EAAE;qDACoB;AAGpB;IADP,KAAK,EAAE;sDACiB;AAGjB;IADP,KAAK,EAAE;iDACY;AAGZ;IADP,KAAK,EAAE;uDACsB;AAGtB;IADP,KAAK,EAAE;oDACmB;AAGnB;IADP,KAAK,EAAE;sDACqB;AAGrB;IADP,KAAK,CAAC,UAAU,CAAC;yDACuB;AAGjC;IADP,KAAK,CAAC,kBAAkB,EAAE,IAAI,CAAC;6DACa;AAGrC;IADP,KAAK,CAAC,uBAAuB,CAAC;8DACe;AAGtC;IADP,qBAAqB,EAAE;2DACa;AAvG1B,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAyY5B","sourcesContent":["import {html, nothing, PropertyValues, TemplateResult} from 'lit';\nimport {property, query, queryAssignedElements, state} from 'lit/decorators.js';\nimport {classMap} from 'lit/directives/class-map.js';\nimport {customElement, VscElement} from '../includes/VscElement.js';\nimport {stylePropertyMap} from '../includes/style-property-map.js';\nimport styles from './vscode-scrollable.styles.js';\n\nexport type VscScrollableScrollEvent = CustomEvent<number>;\n\n/**\n * @tag vscode-scrollable\n *\n * @cssprop [--vscode-scrollbar-shadow=#000000]\n * @cssprop [--vscode-scrollbarSlider-background=rgba(121, 121, 121, 0.4)]\n * @cssprop [--vscode-scrollbarSlider-hoverBackground=rgba(100, 100, 100, 0.7)]\n * @cssprop [--vscode-scrollbarSlider-activeBackground=rgba(191, 191, 191, 0.4)]\n */\n@customElement('vscode-scrollable')\nexport class VscodeScrollable extends VscElement {\n static override styles = styles;\n\n /**\n * By default, the scrollbar appears only when the cursor hovers over the\n * component. With this option, the scrollbar will always be visible.\n */\n @property({type: Boolean, reflect: true, attribute: 'always-visible'})\n alwaysVisible = false;\n\n /**\n * Scrolling speed multiplier when pressing `Alt`. This property is designed to use the value of\n * `editor.fastScrollSensitivity`, `workbench.list.fastScrollSensitivity` or\n * `terminal.integrated.fastScrollSensitivity` depending on the context.\n */\n @property({type: Number, attribute: 'fast-scroll-sensitivity'})\n fastScrollSensitivity = 5;\n\n /**\n * This setting defines the scrollbar's minimum size when the component contains a large amount of content.\n */\n @property({type: Number, attribute: 'min-thumb-size'})\n minThumbSize = 20;\n\n /**\n * A multiplier to be used on the `deltaY` of the mouse wheel scroll events. This property is\n * designed to use the value of `editor.mouseWheelScrollSensitivity`,\n * `workbench.list.mouseWheelScrollSensitivity` or\n * `terminal.integrated.mouseWheelScrollSensitivity` depending on the context.\n */\n @property({type: Number, attribute: 'mouse-wheel-scroll-sensitivity'})\n mouseWheelScrollSensitivity = 1;\n\n /**\n * Controls shadow visibility when content overflows.\n */\n @property({type: Boolean, reflect: true})\n shadow = true;\n\n /**\n * It's true when `scrollPos` greater than 0\n */\n @property({type: Boolean, reflect: true})\n scrolled = false;\n\n /**\n * Scroll position.\n */\n @property({type: Number, attribute: 'scroll-pos'})\n set scrollPos(val: number) {\n this._scrollPos = this._limitScrollPos(val);\n this._updateScrollbar();\n this._updateThumbPosition();\n this.requestUpdate();\n }\n get scrollPos(): number {\n return this._scrollPos;\n }\n\n private _scrollPos = 0;\n\n /**\n * The maximum amount of the `scrollPos`.\n */\n get scrollMax(): number {\n if (!this._scrollableContainer) {\n return 0;\n }\n\n return (\n this._scrollableContainer.scrollHeight -\n this._scrollableContainer.clientHeight\n );\n }\n\n @state()\n private _isDragging = false;\n\n @state()\n private _thumbHeight = 0;\n\n @state()\n private _thumbY = 0;\n\n @state()\n private _thumbVisible = false;\n\n @state()\n private _thumbFade = false;\n\n @state()\n private _thumbActive = false;\n\n @query('.content')\n private _contentElement!: HTMLDivElement;\n\n @query('.scrollbar-thumb', true)\n private _scrollThumbElement!: HTMLDivElement;\n\n @query('.scrollable-container')\n private _scrollableContainer!: HTMLDivElement;\n\n @queryAssignedElements()\n private _assignedElements!: NodeList;\n\n private _hostResizeObserver!: ResizeObserver;\n private _contentResizeObserver!: ResizeObserver;\n private _scrollThumbStartY = 0;\n private _mouseStartY = 0;\n private _scrollbarVisible = true;\n private _scrollbarTrackZ = 0;\n\n //#region lifecycle methods\n\n constructor() {\n super();\n this.addEventListener('mouseover', this._handleComponentMouseOver);\n this.addEventListener('mouseout', this._handleComponentMouseOut);\n this.addEventListener('wheel', this._handleComponentWheel);\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n\n this._hostResizeObserver = new ResizeObserver(this._resizeObserverCallback);\n this._contentResizeObserver = new ResizeObserver(\n this._resizeObserverCallback\n );\n\n this.requestUpdate();\n\n this.updateComplete.then(() => {\n this._hostResizeObserver.observe(this);\n this._contentResizeObserver.observe(this._contentElement);\n this._updateThumbPosition();\n });\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n\n this._hostResizeObserver.unobserve(this);\n this._hostResizeObserver.disconnect();\n this._contentResizeObserver.unobserve(this._contentElement);\n this._contentResizeObserver.disconnect();\n }\n\n protected override firstUpdated(_changedProperties: PropertyValues): void {\n this._updateThumbPosition();\n }\n\n //#endregion\n\n private _resizeObserverCallback = () => {\n this._updateScrollbar();\n this._updateThumbPosition();\n };\n\n private _calcThumbHeight() {\n const componentHeight = this.offsetHeight;\n const contentHeight = this._contentElement?.offsetHeight ?? 0;\n const proposedSize = componentHeight * (componentHeight / contentHeight);\n\n return Math.max(this.minThumbSize, proposedSize);\n }\n\n private _updateScrollbar() {\n const contentHeight = this._contentElement?.offsetHeight ?? 0;\n const componentHeight = this.offsetHeight;\n\n if (componentHeight >= contentHeight) {\n this._scrollbarVisible = false;\n } else {\n this._scrollbarVisible = true;\n this._thumbHeight = this._calcThumbHeight();\n }\n\n this.requestUpdate();\n }\n\n private _zIndexFix() {\n let highestZ = 0;\n\n this._assignedElements.forEach((n) => {\n if ('style' in n) {\n const computedZIndex = window.getComputedStyle(n as HTMLElement).zIndex;\n const isNumber = /([0-9-])+/g.test(computedZIndex);\n\n if (isNumber) {\n highestZ =\n Number(computedZIndex) > highestZ\n ? Number(computedZIndex)\n : highestZ;\n }\n }\n });\n\n this._scrollbarTrackZ = highestZ + 1;\n this.requestUpdate();\n }\n\n private _updateThumbPosition() {\n if (!this._scrollableContainer) {\n return;\n }\n\n this.scrolled = this.scrollPos > 0;\n\n const componentH = this.offsetHeight;\n const thumbH = this._thumbHeight;\n const contentH = this._contentElement.offsetHeight;\n\n const overflown = contentH - componentH;\n const ratio = this.scrollPos / overflown;\n const thumbYMax = componentH - thumbH;\n\n this._thumbY = Math.min(ratio * (componentH - thumbH), thumbYMax);\n }\n\n private _calculateScrollPosFromThumbPos(scrollPos: number) {\n const cmpH = this.getBoundingClientRect().height;\n const thumbH = this._scrollThumbElement.getBoundingClientRect().height;\n const contentH = this._contentElement.getBoundingClientRect().height;\n const rawScrollPos = (scrollPos / (cmpH - thumbH)) * (contentH - cmpH);\n\n return this._limitScrollPos(rawScrollPos);\n }\n\n private _limitScrollPos(newPos: number) {\n if (newPos < 0) {\n return 0;\n } else if (newPos > this.scrollMax) {\n return this.scrollMax;\n } else {\n return newPos;\n }\n }\n\n private _limitThumbPos(newPos: number) {\n const cmpH = this.getBoundingClientRect().height;\n const thumbH = this._scrollThumbElement.getBoundingClientRect().height;\n\n if (newPos < 0) {\n return 0;\n } else if (newPos > cmpH - thumbH) {\n return cmpH - thumbH;\n } else {\n return newPos;\n }\n }\n\n //#region event handlers\n private _handleSlotChange = () => {\n this._updateScrollbar();\n this._updateThumbPosition();\n this._zIndexFix();\n };\n\n private _handleScrollThumbMouseDown(event: MouseEvent) {\n const cmpCr = this.getBoundingClientRect();\n const thCr = this._scrollThumbElement.getBoundingClientRect();\n\n this._mouseStartY = event.screenY;\n this._scrollThumbStartY = thCr.top - cmpCr.top;\n this._isDragging = true;\n this._thumbActive = true;\n\n document.addEventListener('mousemove', this._handleScrollThumbMouseMove);\n document.addEventListener('mouseup', this._handleScrollThumbMouseUp);\n }\n\n private _handleScrollThumbMouseMove = (event: MouseEvent) => {\n const rawThumbPos =\n this._scrollThumbStartY + (event.screenY - this._mouseStartY);\n this._thumbY = this._limitThumbPos(rawThumbPos);\n this.scrollPos = this._calculateScrollPosFromThumbPos(this._thumbY);\n\n this.dispatchEvent(\n new CustomEvent('vsc-scrollable-scroll', {\n detail: this.scrollPos,\n })\n );\n };\n\n private _handleScrollThumbMouseUp = (event: MouseEvent) => {\n this._isDragging = false;\n this._thumbActive = false;\n\n const cr = this.getBoundingClientRect();\n const {x, y, width, height} = cr;\n const {pageX, pageY} = event;\n\n if (pageX > x + width || pageX < x || pageY > y + height || pageY < y) {\n this._thumbFade = true;\n this._thumbVisible = false;\n }\n\n document.removeEventListener('mousemove', this._handleScrollThumbMouseMove);\n document.removeEventListener('mouseup', this._handleScrollThumbMouseUp);\n };\n\n private _handleComponentMouseOver = () => {\n this._thumbVisible = true;\n this._thumbFade = false;\n };\n\n private _handleComponentMouseOut = () => {\n if (!this._thumbActive) {\n this._thumbVisible = false;\n this._thumbFade = true;\n }\n };\n\n private _handleComponentWheel = (ev: WheelEvent) => {\n ev.preventDefault();\n\n const multiplier = ev.altKey\n ? this.mouseWheelScrollSensitivity * this.fastScrollSensitivity\n : this.mouseWheelScrollSensitivity;\n\n this.scrollPos = this._limitScrollPos(\n this.scrollPos + ev.deltaY * multiplier\n );\n this.dispatchEvent(\n new CustomEvent('vsc-scrollable-scroll', {\n detail: this.scrollPos,\n })\n );\n };\n\n private _handleScrollbarTrackPress(ev: PointerEvent) {\n if (ev.target !== ev.currentTarget) {\n return;\n }\n\n this._thumbY = ev.offsetY - this._thumbHeight / 2;\n this.scrollPos = this._calculateScrollPosFromThumbPos(this._thumbY);\n }\n\n private _handleScrollableContainerScroll = (ev: Event) => {\n if (ev.currentTarget) {\n this.scrollPos = (ev.currentTarget as HTMLDivElement).scrollTop;\n }\n };\n\n //#endregion\n\n override render(): TemplateResult {\n return html`\n <div\n class=\"scrollable-container\"\n .style=${stylePropertyMap({\n userSelect: this._isDragging ? 'none' : 'auto',\n })}\n .scrollTop=${this.scrollPos}\n @scroll=${this._handleScrollableContainerScroll}\n >\n <div\n class=${classMap({shadow: true, visible: this.scrolled})}\n .style=${stylePropertyMap({\n zIndex: String(this._scrollbarTrackZ),\n })}\n ></div>\n ${this._isDragging\n ? html`<div class=\"prevent-interaction\"></div>`\n : nothing}\n <div\n class=${classMap({\n 'scrollbar-track': true,\n hidden: !this._scrollbarVisible,\n })}\n @mousedown=${this._handleScrollbarTrackPress}\n >\n <div\n class=${classMap({\n 'scrollbar-thumb': true,\n visible: this.alwaysVisible ? true : this._thumbVisible,\n fade: this.alwaysVisible ? false : this._thumbFade,\n active: this._thumbActive,\n })}\n .style=${stylePropertyMap({\n height: `${this._thumbHeight}px`,\n top: `${this._thumbY}px`,\n })}\n @mousedown=${this._handleScrollThumbMouseDown}\n ></div>\n </div>\n <div class=\"content\">\n <slot @slotchange=${this._handleSlotChange}></slot>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'vscode-scrollable': VscodeScrollable;\n }\n\n interface GlobalEventHandlersEventMap {\n 'vsc-scrollable-scroll': VscScrollableScrollEvent;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode-elements/elements",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Web components for creating Visual Studio Code extensions",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/main.js",
@@ -152,7 +152,7 @@
152
152
  "@typescript-eslint/eslint-plugin": "^8.29.0",
153
153
  "@typescript-eslint/parser": "^8.29.0",
154
154
  "@vscode-elements/webview-playground": "^1.6.0",
155
- "@vscode/codicons": "^0.0.38",
155
+ "@vscode/codicons": "^0.0.39",
156
156
  "@web/dev-server": "^0.4.6",
157
157
  "@web/dev-server-esbuild": "^1.0.4",
158
158
  "@web/dev-server-legacy": "^2.1.1",
@@ -115,6 +115,16 @@
115
115
  { "name": "--vscode-menu-selectionForeground", "values": [] },
116
116
  { "name": "--vscode-menu-separatorBackground", "values": [] },
117
117
  { "name": "--vscode-foreground", "values": [] },
118
+ {
119
+ "name": "--label-width",
120
+ "description": "The width of the label in horizontal mode",
121
+ "values": []
122
+ },
123
+ {
124
+ "name": "--label-right-margin",
125
+ "description": "The right margin of the label in horizontal mode",
126
+ "values": []
127
+ },
118
128
  {
119
129
  "name": "--vsc-foreground-translucent",
120
130
  "description": "Default text color. 90% transparency version of `--vscode-foreground` by default.",
@@ -135,21 +145,7 @@
135
145
  { "name": "--vscode-font-family", "values": [] },
136
146
  { "name": "--vscode-font-size", "values": [] },
137
147
  { "name": "--vscode-foreground", "values": [] },
138
- {
139
- "name": "--label-width",
140
- "description": "The width of the label in horizontal mode",
141
- "values": []
142
- },
143
- {
144
- "name": "--label-right-margin",
145
- "description": "The right margin of the label in horizontal mode",
146
- "values": []
147
- },
148
- {
149
- "name": "--dropdown-z-index",
150
- "description": "workaround for dropdown z-index issues",
151
- "values": []
152
- },
148
+ { "name": "--dropdown-z-index", "values": [] },
153
149
  { "name": "--vscode-badge-background", "values": [] },
154
150
  { "name": "--vscode-badge-foreground", "values": [] },
155
151
  { "name": "--vscode-settings-dropdownBorder", "values": [] },
@@ -185,11 +181,7 @@
185
181
  { "name": "--vscode-scrollbarSlider-background", "values": [] },
186
182
  { "name": "--vscode-scrollbarSlider-hoverBackground", "values": [] },
187
183
  { "name": "--vscode-scrollbarSlider-activeBackground", "values": [] },
188
- {
189
- "name": "--dropdown-z-index",
190
- "description": "workaround for dropdown z-index issues",
191
- "values": []
192
- },
184
+ { "name": "--dropdown-z-index", "values": [] },
193
185
  { "name": "--vscode-badge-background", "values": [] },
194
186
  { "name": "--vscode-badge-foreground", "values": [] },
195
187
  { "name": "--vscode-settings-dropdownBorder", "values": [] },
@@ -134,6 +134,11 @@
134
134
  "name": "vscode-collapsible",
135
135
  "description": "Allows users to reveal or hide related content on a page.\n---\n\n\n### **Events:**\n - **vsc-collapsible-toggle** - Dispatched when the content visibility is changed.\n\n### **Slots:**\n - _default_ - Main content.\n- **actions** - You can place any action icon in this slot in the header, but it's also possible to use any HTML element in it. It's only visible when the component is open.\n- **decorations** - The elements placed in the decorations slot are always visible.\n\n### **CSS Properties:**\n - **--vscode-sideBar-background** - Background color _(default: #181818)_\n- **--vscode-focusBorder** - Focus border color _(default: #0078d4)_\n- **--vscode-font-family** - Header font family _(default: sans-serif)_\n- **--vscode-sideBarSectionHeader-background** - Header background _(default: #181818)_\n- **--vscode-icon-foreground** - Arrow icon color _(default: #cccccc)_\n- **--vscode-sideBarTitle-foreground** - Header font color _(default: #cccccc)_\n\n### **CSS Parts:**\n - **body** - Container for the toggleable content of the component. The container's overflow content is hidden by default. This CSS part can serve as an escape hatch to modify this behavior.",
136
136
  "attributes": [
137
+ {
138
+ "name": "always-show-header-actions",
139
+ "description": "When enabled, header actions are always visible; otherwise, they appear only when the cursor\nhovers over the component. Actions are shown only when the Collapsible component is open. This\nproperty is designed to use the `workbench.view.alwaysShowHeaderActions` setting.",
140
+ "values": []
141
+ },
137
142
  {
138
143
  "name": "title",
139
144
  "description": "Component heading text",
@@ -194,6 +199,14 @@
194
199
  ],
195
200
  "references": []
196
201
  },
202
+ {
203
+ "name": "vscode-form-group",
204
+ "description": "\n---\n\n\n### **CSS Properties:**\n - **--label-width** - The width of the label in horizontal mode _(default: 150px)_\n- **--label-right-margin** - The right margin of the label in horizontal mode _(default: 14px)_",
205
+ "attributes": [
206
+ { "name": "variant", "values": [{ "name": "FormGroupVariant" }] }
207
+ ],
208
+ "references": []
209
+ },
197
210
  {
198
211
  "name": "vscode-form-helper",
199
212
  "description": "Adds more detailed description to a [FromGroup](https://bendera.github.io/vscode-webview-elements/components/vscode-form-group/)\n---\n\n\n### **CSS Properties:**\n - **--vsc-foreground-translucent** - Default text color. 90% transparency version of `--vscode-foreground` by default. _(default: undefined)_",
@@ -243,17 +256,9 @@
243
256
  ],
244
257
  "references": []
245
258
  },
246
- {
247
- "name": "vscode-form-group",
248
- "description": "\n---\n\n\n### **CSS Properties:**\n - **--label-width** - The width of the label in horizontal mode _(default: 150px)_\n- **--label-right-margin** - The right margin of the label in horizontal mode _(default: 14px)_",
249
- "attributes": [
250
- { "name": "variant", "values": [{ "name": "FormGroupVariant" }] }
251
- ],
252
- "references": []
253
- },
254
259
  {
255
260
  "name": "vscode-multi-select",
256
- "description": "Allows to select multiple items from a list of options.\n\nWhen participating in a form, it supports the `:invalid` pseudo class. Otherwise the error styles\ncan be applied through the `invalid` property.\n---\n\n\n### **Events:**\n - **change**\n- **input**\n\n### **CSS Properties:**\n - **--dropdown-z-index** - workaround for dropdown z-index issues _(default: 2)_\n- **--vscode-badge-background** - undefined _(default: #616161)_\n- **--vscode-badge-foreground** - undefined _(default: #f8f8f8)_\n- **--vscode-settings-dropdownBorder** - undefined _(default: #3c3c3c)_\n- **--vscode-settings-checkboxBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownForeground** - undefined _(default: #cccccc)_\n- **--vscode-settings-dropdownListBorder** - undefined _(default: #454545)_\n- **--vscode-focusBorder** - undefined _(default: #0078d4)_\n- **--vscode-foreground** - undefined _(default: #cccccc)_\n- **--vscode-font-family** - undefined _(default: sans-serif)_\n- **--vscode-font-size** - undefined _(default: 13px)_\n- **--vscode-font-weight** - undefined _(default: normal)_\n- **--vscode-inputValidation-errorBackground** - undefined _(default: #5a1d1d)_\n- **--vscode-inputValidation-errorBorder** - undefined _(default: #be1100)_\n- **--vscode-list-activeSelectionBackground** - undefined _(default: #04395e)_\n- **--vscode-list-activeSelectionForeground** - undefined _(default: #ffffff)_\n- **--vscode-list-focusOutline** - undefined _(default: #0078d4)_\n- **--vscode-list-focusHighlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-highlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-hoverBackground** - undefined _(default: #2a2d2e)_\n- **--vscode-list-hoverForeground** - undefined _(default: #ffffff)_",
261
+ "description": "Allows to select multiple items from a list of options.\n\nWhen participating in a form, it supports the `:invalid` pseudo class. Otherwise the error styles\ncan be applied through the `invalid` property.\n---\n\n\n### **Events:**\n - **change**\n- **input**\n\n### **CSS Properties:**\n - **--dropdown-z-index** - undefined _(default: 2)_\n- **--vscode-badge-background** - undefined _(default: #616161)_\n- **--vscode-badge-foreground** - undefined _(default: #f8f8f8)_\n- **--vscode-settings-dropdownBorder** - undefined _(default: #3c3c3c)_\n- **--vscode-settings-checkboxBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownForeground** - undefined _(default: #cccccc)_\n- **--vscode-settings-dropdownListBorder** - undefined _(default: #454545)_\n- **--vscode-focusBorder** - undefined _(default: #0078d4)_\n- **--vscode-foreground** - undefined _(default: #cccccc)_\n- **--vscode-font-family** - undefined _(default: sans-serif)_\n- **--vscode-font-size** - undefined _(default: 13px)_\n- **--vscode-font-weight** - undefined _(default: normal)_\n- **--vscode-inputValidation-errorBackground** - undefined _(default: #5a1d1d)_\n- **--vscode-inputValidation-errorBorder** - undefined _(default: #be1100)_\n- **--vscode-list-activeSelectionBackground** - undefined _(default: #04395e)_\n- **--vscode-list-activeSelectionForeground** - undefined _(default: #ffffff)_\n- **--vscode-list-focusOutline** - undefined _(default: #0078d4)_\n- **--vscode-list-focusHighlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-highlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-hoverBackground** - undefined _(default: #2a2d2e)_\n- **--vscode-list-hoverForeground** - undefined _(default: #ffffff)_",
257
262
  "attributes": [
258
263
  {
259
264
  "name": "invalid",
@@ -414,7 +419,7 @@
414
419
  },
415
420
  {
416
421
  "name": "vscode-single-select",
417
- "description": "Allows to select an item from multiple options.\n\nWhen participating in a form, it supports the `:invalid` pseudo class. Otherwise the error styles\ncan be applied through the `invalid` property.\n---\n\n\n### **Events:**\n - **change**\n- **input**\n\n### **CSS Properties:**\n - **--dropdown-z-index** - workaround for dropdown z-index issues _(default: 2)_\n- **--vscode-badge-background** - undefined _(default: #616161)_\n- **--vscode-badge-foreground** - undefined _(default: #f8f8f8)_\n- **--vscode-settings-dropdownBorder** - undefined _(default: #3c3c3c)_\n- **--vscode-settings-checkboxBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownForeground** - undefined _(default: #cccccc)_\n- **--vscode-settings-dropdownListBorder** - undefined _(default: #454545)_\n- **--vscode-focusBorder** - undefined _(default: #0078d4)_\n- **--vscode-foreground** - undefined _(default: #cccccc)_\n- **--vscode-font-family** - undefined _(default: sans-serif)_\n- **--vscode-font-size** - undefined _(default: 13px)_\n- **--vscode-font-weight** - undefined _(default: normal)_\n- **--vscode-inputValidation-errorBackground** - undefined _(default: #5a1d1d)_\n- **--vscode-inputValidation-errorBorder** - undefined _(default: #be1100)_\n- **--vscode-list-activeSelectionBackground** - undefined _(default: #04395e)_\n- **--vscode-list-activeSelectionForeground** - undefined _(default: #ffffff)_\n- **--vscode-list-focusOutline** - undefined _(default: #0078d4)_\n- **--vscode-list-focusHighlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-highlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-hoverBackground** - undefined _(default: #2a2d2e)_\n- **--vscode-list-hoverForeground** - undefined _(default: #ffffff)_",
422
+ "description": "Allows to select an item from multiple options.\n\nWhen participating in a form, it supports the `:invalid` pseudo class. Otherwise the error styles\ncan be applied through the `invalid` property.\n---\n\n\n### **Events:**\n - **change**\n- **input**\n\n### **CSS Properties:**\n - **--dropdown-z-index** - undefined _(default: 2)_\n- **--vscode-badge-background** - undefined _(default: #616161)_\n- **--vscode-badge-foreground** - undefined _(default: #f8f8f8)_\n- **--vscode-settings-dropdownBorder** - undefined _(default: #3c3c3c)_\n- **--vscode-settings-checkboxBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownBackground** - undefined _(default: #313131)_\n- **--vscode-settings-dropdownForeground** - undefined _(default: #cccccc)_\n- **--vscode-settings-dropdownListBorder** - undefined _(default: #454545)_\n- **--vscode-focusBorder** - undefined _(default: #0078d4)_\n- **--vscode-foreground** - undefined _(default: #cccccc)_\n- **--vscode-font-family** - undefined _(default: sans-serif)_\n- **--vscode-font-size** - undefined _(default: 13px)_\n- **--vscode-font-weight** - undefined _(default: normal)_\n- **--vscode-inputValidation-errorBackground** - undefined _(default: #5a1d1d)_\n- **--vscode-inputValidation-errorBorder** - undefined _(default: #be1100)_\n- **--vscode-list-activeSelectionBackground** - undefined _(default: #04395e)_\n- **--vscode-list-activeSelectionForeground** - undefined _(default: #ffffff)_\n- **--vscode-list-focusOutline** - undefined _(default: #0078d4)_\n- **--vscode-list-focusHighlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-highlightForeground** - undefined _(default: #2aaaff)_\n- **--vscode-list-hoverBackground** - undefined _(default: #2a2d2e)_\n- **--vscode-list-hoverForeground** - undefined _(default: #ffffff)_",
418
423
  "attributes": [
419
424
  {
420
425
  "name": "invalid",