@design.estate/dees-catalog 6.12.1 → 7.0.1

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.
Files changed (50) hide show
  1. package/.smartconfig.json +5 -1
  2. package/dist_bundle/bundle.js +24145 -1247
  3. package/dist_bundle/bundle.js.map +1 -0
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/.tsbundle-artifacts.json +7 -0
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/worker-KZQQYSUG.js +58301 -0
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/worker-KZQQYSUG.js.map +1 -0
  7. package/dist_bundle/third-party-notices.md +190 -0
  8. package/dist_ts_web/00_commitinfo_data.js +2 -2
  9. package/dist_ts_web/elements/00group-button/dees-button/dees-button.d.ts +8 -5
  10. package/dist_ts_web/elements/00group-button/dees-button/dees-button.js +100 -46
  11. package/dist_ts_web/elements/00group-form/dees-form-submit/dees-form-submit.js +2 -5
  12. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.d.ts +4 -1
  13. package/dist_ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.js +29 -2
  14. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.d.ts +4 -1
  15. package/dist_ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.js +65 -8
  16. package/dist_ts_web/elements/00group-harness/interfaces.d.ts +1 -0
  17. package/dist_ts_web/elements/00group-media/dees-pdf-shared/CanvasPool.d.ts +1 -0
  18. package/dist_ts_web/elements/00group-media/dees-pdf-shared/CanvasPool.js +15 -1
  19. package/dist_ts_web/elements/00group-media/dees-pdf-shared/PdfManager.d.ts +6 -4
  20. package/dist_ts_web/elements/00group-media/dees-pdf-shared/PdfManager.js +183 -21
  21. package/dist_ts_web/elements/00group-media/dees-pdf-shared/utils.d.ts +3 -0
  22. package/dist_ts_web/elements/00group-media/dees-pdf-shared/utils.js +67 -1
  23. package/dist_ts_web/elements/00group-media/dees-pdf-viewer/component.d.ts +25 -1
  24. package/dist_ts_web/elements/00group-media/dees-pdf-viewer/component.js +693 -285
  25. package/dist_ts_web/elements/00group-media/dees-pdf-viewer/demo.js +7 -7
  26. package/dist_ts_web/elements/00group-media/dees-thumbnail-pdf/component.d.ts +20 -1
  27. package/dist_ts_web/elements/00group-media/dees-thumbnail-pdf/component.js +379 -116
  28. package/dist_ts_web/elements/00group-media/dees-thumbnail-pdf/demo.js +2 -2
  29. package/dist_ts_web/elements/00group-media/dees-thumbnail-shared/DeesThumbnailBase.d.ts +1 -0
  30. package/dist_ts_web/elements/00group-media/dees-thumbnail-shared/DeesThumbnailBase.js +7 -1
  31. package/dist_ts_web/elements/00group-utility/dees-icon/dees-icon.js +2 -1
  32. package/package.json +5 -4
  33. package/readme.hints.md +26 -19
  34. package/readme.md +100 -53
  35. package/third-party-notices.md +190 -0
  36. package/ts_web/00_commitinfo_data.ts +1 -1
  37. package/ts_web/elements/00group-button/dees-button/dees-button.ts +97 -53
  38. package/ts_web/elements/00group-form/dees-form-submit/dees-form-submit.ts +1 -4
  39. package/ts_web/elements/00group-harness/dees-harness-chat/dees-harness-chat.ts +13 -0
  40. package/ts_web/elements/00group-harness/dees-harness-session-sidebar/dees-harness-session-sidebar.ts +51 -6
  41. package/ts_web/elements/00group-harness/interfaces.ts +2 -0
  42. package/ts_web/elements/00group-media/dees-pdf-shared/CanvasPool.ts +15 -1
  43. package/ts_web/elements/00group-media/dees-pdf-shared/PdfManager.ts +214 -24
  44. package/ts_web/elements/00group-media/dees-pdf-shared/utils.ts +77 -1
  45. package/ts_web/elements/00group-media/dees-pdf-viewer/component.ts +774 -327
  46. package/ts_web/elements/00group-media/dees-pdf-viewer/demo.ts +7 -7
  47. package/ts_web/elements/00group-media/dees-thumbnail-pdf/component.ts +427 -128
  48. package/ts_web/elements/00group-media/dees-thumbnail-pdf/demo.ts +1 -1
  49. package/ts_web/elements/00group-media/dees-thumbnail-shared/DeesThumbnailBase.ts +5 -0
  50. package/ts_web/elements/00group-utility/dees-icon/dees-icon.ts +1 -0
@@ -0,0 +1,190 @@
1
+ # Third-Party Notices
2
+
3
+ This distribution includes third-party software subject to the terms below.
4
+
5
+ ## PDF.js 4.10.38
6
+
7
+ Copyright 2024 Mozilla Foundation
8
+
9
+ PDF.js is available from https://github.com/mozilla/pdf.js and is licensed under the
10
+ Apache License, Version 2.0. The distributed PDF.js object code, including its module
11
+ worker, has been bundled by esbuild for delivery with this package.
12
+
13
+ ### Apache License 2.0
14
+
15
+ Apache License
16
+ Version 2.0, January 2004
17
+ http://www.apache.org/licenses/
18
+
19
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
20
+
21
+ 1. Definitions.
22
+
23
+ "License" shall mean the terms and conditions for use, reproduction,
24
+ and distribution as defined by Sections 1 through 9 of this document.
25
+
26
+ "Licensor" shall mean the copyright owner or entity authorized by
27
+ the copyright owner that is granting the License.
28
+
29
+ "Legal Entity" shall mean the union of the acting entity and all
30
+ other entities that control, are controlled by, or are under common
31
+ control with that entity. For the purposes of this definition,
32
+ "control" means (i) the power, direct or indirect, to cause the
33
+ direction or management of such entity, whether by contract or
34
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
35
+ outstanding shares, or (iii) beneficial ownership of such entity.
36
+
37
+ "You" (or "Your") shall mean an individual or Legal Entity
38
+ exercising permissions granted by this License.
39
+
40
+ "Source" form shall mean the preferred form for making modifications,
41
+ including but not limited to software source code, documentation
42
+ source, and configuration files.
43
+
44
+ "Object" form shall mean any form resulting from mechanical
45
+ transformation or translation of a Source form, including but
46
+ not limited to compiled object code, generated documentation,
47
+ and conversions to other media types.
48
+
49
+ "Work" shall mean the work of authorship, whether in Source or
50
+ Object form, made available under the License, as indicated by a
51
+ copyright notice that is included in or attached to the work
52
+ (an example is provided in the Appendix below).
53
+
54
+ "Derivative Works" shall mean any work, whether in Source or Object
55
+ form, that is based on (or derived from) the Work and for which the
56
+ editorial revisions, annotations, elaborations, or other modifications
57
+ represent, as a whole, an original work of authorship. For the purposes
58
+ of this License, Derivative Works shall not include works that remain
59
+ separable from, or merely link (or bind by name) to the interfaces of,
60
+ the Work and Derivative Works thereof.
61
+
62
+ "Contribution" shall mean any work of authorship, including
63
+ the original version of the Work and any modifications or additions
64
+ to that Work or Derivative Works thereof, that is intentionally
65
+ submitted to Licensor for inclusion in the Work by the copyright owner
66
+ or by an individual or Legal Entity authorized to submit on behalf of
67
+ the copyright owner. For the purposes of this definition, "submitted"
68
+ means any form of electronic, verbal, or written communication sent
69
+ to the Licensor or its representatives, including but not limited to
70
+ communication on electronic mailing lists, source code control systems,
71
+ and issue tracking systems that are managed by, or on behalf of, the
72
+ Licensor for the purpose of discussing and improving the Work, but
73
+ excluding communication that is conspicuously marked or otherwise
74
+ designated in writing by the copyright owner as "Not a Contribution."
75
+
76
+ "Contributor" shall mean Licensor and any individual or Legal Entity
77
+ on behalf of whom a Contribution has been received by Licensor and
78
+ subsequently incorporated within the Work.
79
+
80
+ 2. Grant of Copyright License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ copyright license to reproduce, prepare Derivative Works of,
84
+ publicly display, publicly perform, sublicense, and distribute the
85
+ Work and such Derivative Works in Source or Object form.
86
+
87
+ 3. Grant of Patent License. Subject to the terms and conditions of
88
+ this License, each Contributor hereby grants to You a perpetual,
89
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
90
+ (except as stated in this section) patent license to make, have made,
91
+ use, offer to sell, sell, import, and otherwise transfer the Work,
92
+ where such license applies only to those patent claims licensable
93
+ by such Contributor that are necessarily infringed by their
94
+ Contribution(s) alone or by combination of their Contribution(s)
95
+ with the Work to which such Contribution(s) was submitted. If You
96
+ institute patent litigation against any entity (including a
97
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
98
+ or a Contribution incorporated within the Work constitutes direct
99
+ or contributory patent infringement, then any patent licenses
100
+ granted to You under this License for that Work shall terminate
101
+ as of the date such litigation is filed.
102
+
103
+ 4. Redistribution. You may reproduce and distribute copies of the
104
+ Work or Derivative Works thereof in any medium, with or without
105
+ modifications, and in Source or Object form, provided that You
106
+ meet the following conditions:
107
+
108
+ (a) You must give any other recipients of the Work or
109
+ Derivative Works a copy of this License; and
110
+
111
+ (b) You must cause any modified files to carry prominent notices
112
+ stating that You changed the files; and
113
+
114
+ (c) You must retain, in the Source form of any Derivative Works
115
+ that You distribute, all copyright, patent, trademark, and
116
+ attribution notices from the Source form of the Work,
117
+ excluding those notices that do not pertain to any part of
118
+ the Derivative Works; and
119
+
120
+ (d) If the Work includes a "NOTICE" text file as part of its
121
+ distribution, then any Derivative Works that You distribute must
122
+ include a readable copy of the attribution notices contained
123
+ within such NOTICE file, excluding those notices that do not
124
+ pertain to any part of the Derivative Works, in at least one
125
+ of the following places: within a NOTICE text file distributed
126
+ as part of the Derivative Works; within the Source form or
127
+ documentation, if provided along with the Derivative Works; or,
128
+ within a display generated by the Derivative Works, if and
129
+ wherever such third-party notices normally appear. The contents
130
+ of the NOTICE file are for informational purposes only and
131
+ do not modify the License. You may add Your own attribution
132
+ notices within Derivative Works that You distribute, alongside
133
+ or as an addendum to the NOTICE text from the Work, provided
134
+ that such additional attribution notices cannot be construed
135
+ as modifying the License.
136
+
137
+ You may add Your own copyright statement to Your modifications and
138
+ may provide additional or different license terms and conditions
139
+ for use, reproduction, or distribution of Your modifications, or
140
+ for any such Derivative Works as a whole, provided Your use,
141
+ reproduction, and distribution of the Work otherwise complies with
142
+ the conditions stated in this License.
143
+
144
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
145
+ any Contribution intentionally submitted for inclusion in the Work
146
+ by You to the Licensor shall be under the terms and conditions of
147
+ this License, without any additional terms or conditions.
148
+ Notwithstanding the above, nothing herein shall supersede or modify
149
+ the terms of any separate license agreement you may have executed
150
+ with Licensor regarding such Contributions.
151
+
152
+ 6. Trademarks. This License does not grant permission to use the trade
153
+ names, trademarks, service marks, or product names of the Licensor,
154
+ except as required for reasonable and customary use in describing the
155
+ origin of the Work and reproducing the content of the NOTICE file.
156
+
157
+ 7. Disclaimer of Warranty. Unless required by applicable law or
158
+ agreed to in writing, Licensor provides the Work (and each
159
+ Contributor provides its Contributions) on an "AS IS" BASIS,
160
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
161
+ implied, including, without limitation, any warranties or conditions
162
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
163
+ PARTICULAR PURPOSE. You are solely responsible for determining the
164
+ appropriateness of using or redistributing the Work and assume any
165
+ risks associated with Your exercise of permissions under this License.
166
+
167
+ 8. Limitation of Liability. In no event and under no legal theory,
168
+ whether in tort (including negligence), contract, or otherwise,
169
+ unless required by applicable law (such as deliberate and grossly
170
+ negligent acts) or agreed to in writing, shall any Contributor be
171
+ liable to You for damages, including any direct, indirect, special,
172
+ incidental, or consequential damages of any character arising as a
173
+ result of this License or out of the use or inability to use the
174
+ Work (including but not limited to damages for loss of goodwill,
175
+ work stoppage, computer failure or malfunction, or any and all
176
+ other commercial damages or losses), even if such Contributor
177
+ has been advised of the possibility of such damages.
178
+
179
+ 9. Accepting Warranty or Additional Liability. While redistributing
180
+ the Work or Derivative Works thereof, You may choose to offer,
181
+ and charge a fee for, acceptance of support, warranty, indemnity,
182
+ or other liability obligations and/or rights consistent with this
183
+ License. However, in accepting such obligations, You may act only
184
+ on Your own behalf and on Your sole responsibility, not on behalf
185
+ of any other Contributor, and only if You agree to indemnify,
186
+ defend, and hold each Contributor harmless for any liability
187
+ incurred by, or claims asserted against, such Contributor by reason
188
+ of your accepting any such warranty or additional liability.
189
+
190
+ END OF TERMS AND CONDITIONS
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '6.12.1',
6
+ version: '7.0.1',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -3,6 +3,7 @@ import {
3
3
  html,
4
4
  DeesElement,
5
5
  property,
6
+ state,
6
7
  type TemplateResult,
7
8
  cssManager,
8
9
  css,
@@ -93,18 +94,36 @@ export class DeesButton extends DeesElement {
93
94
  @property({ type: String, reflect: true })
94
95
  accessor iconPosition: 'left' | 'right' = 'left';
95
96
 
97
+ @state()
98
+ private accessor adoptedText = '';
99
+
100
+ @state()
101
+ private accessor adoptedIcon = '';
102
+
103
+ @state()
104
+ private accessor adoptedIconPosition: 'left' | 'right' = 'left';
105
+
106
+ private lightDomObserver: MutationObserver | undefined = undefined;
107
+
96
108
  constructor() {
97
109
  super();
98
110
  }
99
111
 
100
- public async connectedCallback() {
101
- await super.connectedCallback();
112
+ public async connectedCallback(): Promise<void> {
113
+ const superConnected = super.connectedCallback();
114
+ this.observeLightDom();
115
+ await superConnected;
102
116
  // Auto-detect if inside a form
103
117
  if (!this.insideForm && this.closest('dees-form')) {
104
118
  this.insideForm = true;
105
119
  }
106
120
  }
107
121
 
122
+ public async disconnectedCallback(): Promise<void> {
123
+ this.lightDomObserver?.disconnect();
124
+ await super.disconnectedCallback();
125
+ }
126
+
108
127
  public static styles = [
109
128
  themeDefaultStyles,
110
129
  cssManager.defaultStyles,
@@ -464,49 +483,76 @@ export class DeesButton extends DeesElement {
464
483
  `,
465
484
  ];
466
485
 
467
- /**
468
- * Extracts icon and text from light DOM and sets properties
469
- */
470
- private extractLightDom(): void {
471
- const iconElement = this.querySelector('dees-icon') as any;
472
-
473
- // Get all text content from light DOM
474
- const textContent = Array.from(this.childNodes)
475
- .filter(node => node.nodeType === Node.TEXT_NODE)
476
- .map(node => node.textContent?.trim())
477
- .filter(Boolean)
478
- .join(' ');
479
-
480
- if (textContent && !this.text) {
481
- this.text = textContent;
482
- }
483
-
484
- if (iconElement) {
485
- const iconValue = iconElement.icon || iconElement.getAttribute('icon') || null;
486
-
487
- if (iconValue) {
488
- // Determine position based on DOM order
489
- const children = Array.from(this.childNodes);
490
- const iconIndex = children.indexOf(iconElement);
491
- const textNodes = children.filter(node =>
492
- node.nodeType === Node.TEXT_NODE && node.textContent?.trim()
493
- );
494
-
495
- if (textNodes.length > 0) {
496
- const firstTextIndex = children.indexOf(textNodes[0]);
497
- this.iconPosition = iconIndex < firstTextIndex ? 'left' : 'right';
486
+ private observeLightDom(): void {
487
+ this.lightDomObserver ??= new MutationObserver((mutationsArg) => {
488
+ const supportedContentChanged = mutationsArg.some((mutationArg) => {
489
+ if (mutationArg.type === 'childList') {
490
+ return mutationArg.target === this;
491
+ }
492
+ if (mutationArg.type === 'characterData') {
493
+ return mutationArg.target.parentNode === this;
498
494
  }
495
+ return mutationArg.target.parentNode === this
496
+ && (mutationArg.target as Element).localName === 'dees-icon';
497
+ });
498
+ if (supportedContentChanged) {
499
+ this.adoptLightDom();
500
+ }
501
+ });
502
+ this.lightDomObserver.observe(this, {
503
+ attributes: true,
504
+ attributeFilter: ['icon'],
505
+ characterData: true,
506
+ childList: true,
507
+ subtree: true,
508
+ });
509
+ this.adoptLightDom();
510
+ }
499
511
 
500
- // Set the icon property
501
- this.icon = iconValue;
502
- }
512
+ /** Mirrors supported direct light content without taking ownership of consumer nodes. */
513
+ private adoptLightDom(): void {
514
+ const children = Array.from(this.childNodes);
515
+ const textNodes = children.filter(
516
+ (nodeArg) => nodeArg.nodeType === Node.TEXT_NODE && nodeArg.textContent?.trim(),
517
+ );
518
+ const iconElement = children.find(
519
+ (nodeArg): nodeArg is HTMLElement & { icon?: string } =>
520
+ nodeArg instanceof HTMLElement && nodeArg.localName === 'dees-icon',
521
+ );
503
522
 
504
- // Remove the light DOM icon element
505
- iconElement.remove();
523
+ const nextAdoptedText = textNodes
524
+ .map((nodeArg) => nodeArg.textContent!.trim())
525
+ .join(' ');
526
+ const nextAdoptedIcon = iconElement?.icon || iconElement?.getAttribute('icon') || '';
527
+ const nextAdoptedIconPosition =
528
+ iconElement && textNodes.length > 0
529
+ ? children.indexOf(iconElement) < children.indexOf(textNodes[0])
530
+ ? 'left'
531
+ : 'right'
532
+ : 'left';
533
+
534
+ const textFollowsLightDom = this.text === this.adoptedText;
535
+ const iconFollowsLightDom = (this.icon || '') === this.adoptedIcon;
536
+ const iconPositionFollowsLightDom = this.iconPosition === this.adoptedIconPosition;
537
+ const previousAdoptedIcon = this.adoptedIcon;
538
+
539
+ this.adoptedText = nextAdoptedText;
540
+ this.adoptedIcon = nextAdoptedIcon;
541
+ this.adoptedIconPosition = nextAdoptedIconPosition;
542
+
543
+ if (textFollowsLightDom && this.text !== nextAdoptedText) {
544
+ this.text = nextAdoptedText;
545
+ }
546
+ if (
547
+ iconFollowsLightDom
548
+ && this.icon !== nextAdoptedIcon
549
+ && Boolean(nextAdoptedIcon || previousAdoptedIcon)
550
+ ) {
551
+ this.icon = nextAdoptedIcon;
552
+ }
553
+ if (iconPositionFollowsLightDom && this.iconPosition !== nextAdoptedIconPosition) {
554
+ this.iconPosition = nextAdoptedIconPosition;
506
555
  }
507
-
508
- // Clear all remaining light DOM
509
- this.innerHTML = '';
510
556
  }
511
557
 
512
558
  public render(): TemplateResult {
@@ -520,17 +566,20 @@ export class DeesButton extends DeesElement {
520
566
 
521
567
  const actualType = typeMap[this.type] || this.type;
522
568
  const actualSize = this.type === 'big' ? 'lg' : this.size;
569
+ const effectiveText = this.text;
570
+ const effectiveIcon = this.icon;
571
+ const effectiveIconPosition = this.iconPosition;
523
572
 
524
- const leftIcon = this.iconPosition === 'left' && this.icon
525
- ? html`<dees-icon .icon=${this.icon}></dees-icon>`
573
+ const leftIcon = effectiveIconPosition === 'left' && effectiveIcon
574
+ ? html`<dees-icon .icon=${effectiveIcon}></dees-icon>`
526
575
  : '';
527
- const rightIcon = this.iconPosition === 'right' && this.icon
528
- ? html`<dees-icon .icon=${this.icon}></dees-icon>`
576
+ const rightIcon = effectiveIconPosition === 'right' && effectiveIcon
577
+ ? html`<dees-icon .icon=${effectiveIcon}></dees-icon>`
529
578
  : '';
530
579
 
531
580
  // No placeholder label: a button without text renders icon-only.
532
581
  // size-icon additionally suppresses text to keep its square geometry.
533
- const showText = Boolean(this.text) && !(actualSize === 'icon' && this.icon);
582
+ const showText = Boolean(effectiveText) && !(actualSize === 'icon' && effectiveIcon);
534
583
 
535
584
  return html`
536
585
  <div
@@ -541,7 +590,7 @@ export class DeesButton extends DeesElement {
541
590
  tabindex=${this.disabled ? -1 : 0}
542
591
  aria-disabled=${this.disabled ? 'true' : 'false'}
543
592
  aria-busy=${this.status === 'pending' ? 'true' : 'false'}
544
- .ariaLabel=${showText ? null : this.text || null}
593
+ .ariaLabel=${showText ? null : effectiveText || null}
545
594
  @click="${this.dispatchClick}"
546
595
  @keydown=${this.handleKeydown}
547
596
  @keyup=${this.handleKeyup}
@@ -554,7 +603,7 @@ export class DeesButton extends DeesElement {
554
603
  ></dees-spinner>
555
604
  `}
556
605
  ${leftIcon}
557
- ${showText ? html`<div class="textbox">${this.text}</div>` : ''}
606
+ ${showText ? html`<div class="textbox">${effectiveText}</div>` : ''}
558
607
  ${rightIcon}
559
608
  </div>
560
609
  `;
@@ -644,9 +693,4 @@ export class DeesButton extends DeesElement {
644
693
  }
645
694
  this.faceElement?.click();
646
695
  }
647
-
648
- public async firstUpdated() {
649
- // Extract light DOM content (icon + text) and set as properties
650
- this.extractLightDom();
651
- }
652
696
  }
@@ -91,10 +91,7 @@ export class DeesFormSubmit extends DeesElement {
91
91
  }
92
92
 
93
93
  public async firstUpdated() {
94
- // Capture light DOM text content as the button label. dees-button wipes
95
- // its own light DOM during extractLightDom(), so we cannot simply forward
96
- // a <slot> into it — we have to hoist the text onto the .text property
97
- // ourselves before handing it to dees-button.
94
+ // Capture this wrapper's light-DOM text as the controlled label for its nested button.
98
95
  if (!this.text) {
99
96
  const slotText = this.textContent?.trim();
100
97
  if (slotText) {
@@ -24,6 +24,7 @@ import type {
24
24
  IHarnessStatus,
25
25
  IHarnessTodoItem,
26
26
  IHarnessUsage,
27
+ THarnessIntelligenceAvailabilityStatus,
27
28
  THarnessStreamDelta,
28
29
  } from '../interfaces.js';
29
30
  import {
@@ -124,6 +125,15 @@ export class DeesHarnessChat extends DeesElement {
124
125
  @property({ type: Boolean })
125
126
  accessor sessionIntelligenceEnabled: boolean = false;
126
127
 
128
+ @property()
129
+ accessor intelligenceAvailabilityStatus: THarnessIntelligenceAvailabilityStatus = 'available';
130
+
131
+ @property()
132
+ accessor intelligenceUnavailableReason: string = '';
133
+
134
+ @property()
135
+ accessor intelligenceHeading: string = 'Session Intelligence';
136
+
127
137
  @property({ attribute: false })
128
138
  accessor intelligenceExchanges: IHarnessIntelligenceExchange[] = [];
129
139
 
@@ -691,6 +701,9 @@ export class DeesHarnessChat extends DeesElement {
691
701
  .scratchpadBusy=${this.scratchpadBusy}
692
702
  .scratchpadError=${this.scratchpadError}
693
703
  .intelligenceEnabled=${this.sessionIntelligenceEnabled}
704
+ .intelligenceAvailabilityStatus=${this.intelligenceAvailabilityStatus}
705
+ .intelligenceUnavailableReason=${this.intelligenceUnavailableReason}
706
+ .intelligenceHeading=${this.intelligenceHeading}
694
707
  .intelligenceExchanges=${this.intelligenceExchanges}
695
708
  .intelligenceBusy=${this.intelligenceBusy}
696
709
  .intelligenceError=${this.intelligenceError}
@@ -20,6 +20,7 @@ import type {
20
20
  IHarnessSessionMetrics,
21
21
  IHarnessTodoItem,
22
22
  IHarnessToolCall,
23
+ THarnessIntelligenceAvailabilityStatus,
23
24
  THarnessToolStatus,
24
25
  } from '../interfaces.js';
25
26
  import { harnessEffectiveToolStatus, harnessFormatRelativeTime } from '../harness.helpers.js';
@@ -84,6 +85,15 @@ export class DeesHarnessSessionSidebar extends DeesElement {
84
85
  @property({ type: Boolean })
85
86
  accessor intelligenceEnabled: boolean = false;
86
87
 
88
+ @property()
89
+ accessor intelligenceAvailabilityStatus: THarnessIntelligenceAvailabilityStatus = 'available';
90
+
91
+ @property()
92
+ accessor intelligenceUnavailableReason: string = '';
93
+
94
+ @property()
95
+ accessor intelligenceHeading: string = 'Session Intelligence';
96
+
87
97
  @property({ attribute: false })
88
98
  accessor intelligenceExchanges: IHarnessIntelligenceExchange[] = [];
89
99
 
@@ -337,6 +347,16 @@ export class DeesHarnessSessionSidebar extends DeesElement {
337
347
  min-width: 0;
338
348
  }
339
349
 
350
+ .intelligenceAvailability {
351
+ margin-bottom: var(--dees-spacing-sm);
352
+ padding: var(--dees-spacing-xs) var(--dees-spacing-sm);
353
+ border-radius: var(--dees-radius-md);
354
+ background: var(--dees-color-fill-secondary);
355
+ color: var(--dees-color-text-primary);
356
+ font-size: var(--dees-font-caption1-size, 11px);
357
+ line-height: 1.4;
358
+ }
359
+
340
360
  .activityList,
341
361
  .activityGroup {
342
362
  display: grid;
@@ -885,9 +905,16 @@ export class DeesHarnessSessionSidebar extends DeesElement {
885
905
  }
886
906
 
887
907
  private renderIntelligence(): TemplateResult {
908
+ const heading = this.intelligenceHeading.trim() || 'Session Intelligence';
909
+ const intelligenceAvailable = this.intelligenceAvailabilityStatus === 'available';
910
+ const availabilityMessage = this.intelligenceAvailabilityStatus === 'checking'
911
+ ? `Checking ${heading} availability…`
912
+ : this.intelligenceAvailabilityStatus === 'unavailable'
913
+ ? this.intelligenceUnavailableReason.trim() || `${heading} is unavailable.`
914
+ : '';
888
915
  return this.renderSection(
889
916
  'intelligence',
890
- 'Session Intelligence',
917
+ heading,
891
918
  'lucide:Sparkles',
892
919
  html`
893
920
  <div class="intelligenceHistory" role="log" aria-live="polite">
@@ -902,14 +929,22 @@ export class DeesHarnessSessionSidebar extends DeesElement {
902
929
  ` : html`<div class="empty">Ask about this session without interrupting its main work.</div>`}
903
930
  </div>
904
931
  <div class="intelligenceComposer">
932
+ <div
933
+ class="intelligenceAvailabilityStatus"
934
+ role="status"
935
+ aria-live="polite"
936
+ aria-atomic="true"
937
+ >${availabilityMessage
938
+ ? html`<div class="intelligenceAvailability">${availabilityMessage}</div>`
939
+ : ''}</div>
905
940
  <textarea
906
941
  class="intelligenceInput"
907
- aria-label="Ask Session Intelligence"
942
+ aria-label=${`Ask ${heading}`}
908
943
  placeholder="Ask a parallel question…"
909
944
  maxlength="8192"
910
945
  rows="2"
911
946
  .value=${this.intelligenceQuestion}
912
- ?disabled=${this.disabled || this.intelligenceBusy}
947
+ ?disabled=${this.disabled || this.intelligenceBusy || !intelligenceAvailable}
913
948
  @input=${(event: InputEvent) => {
914
949
  this.intelligenceQuestion = (event.currentTarget as HTMLTextAreaElement).value;
915
950
  }}
@@ -927,7 +962,10 @@ export class DeesHarnessSessionSidebar extends DeesElement {
927
962
  type="accent"
928
963
  text="Ask"
929
964
  .status=${this.intelligenceBusy ? 'pending' : 'normal'}
930
- ?disabled=${this.disabled || this.intelligenceBusy || !this.intelligenceQuestion.trim()}
965
+ ?disabled=${this.disabled
966
+ || this.intelligenceBusy
967
+ || !intelligenceAvailable
968
+ || !this.intelligenceQuestion.trim()}
931
969
  @clicked=${this.askIntelligence}
932
970
  ></dees-button>
933
971
  </div>
@@ -938,10 +976,11 @@ export class DeesHarnessSessionSidebar extends DeesElement {
938
976
  }
939
977
 
940
978
  private renderExchange(exchangeArg: IHarnessIntelligenceExchange): TemplateResult {
979
+ const heading = this.intelligenceHeading.trim() || 'Session Intelligence';
941
980
  const answer = exchangeArg.status === 'running'
942
981
  ? 'Thinking in parallel…'
943
982
  : exchangeArg.status === 'error'
944
- ? exchangeArg.error || 'Session Intelligence failed.'
983
+ ? exchangeArg.error || `${heading} failed.`
945
984
  : exchangeArg.answer || '';
946
985
  return html`
947
986
  <article class="exchange ${exchangeArg.status}">
@@ -993,7 +1032,13 @@ export class DeesHarnessSessionSidebar extends DeesElement {
993
1032
 
994
1033
  private readonly askIntelligence = (): void => {
995
1034
  const question = this.intelligenceQuestion.trim();
996
- if (!question || this.disabled || this.intelligenceBusy) return;
1035
+ if (
1036
+ !question
1037
+ || !this.intelligenceEnabled
1038
+ || this.intelligenceAvailabilityStatus !== 'available'
1039
+ || this.disabled
1040
+ || this.intelligenceBusy
1041
+ ) return;
997
1042
  const detail: IHarnessSessionIntelligenceAskDetail = { question };
998
1043
  this.dispatchEvent(new CustomEvent('harness-session-intelligence-ask', {
999
1044
  detail,
@@ -116,6 +116,8 @@ export interface IHarnessScratchpadSaveDetail {
116
116
 
117
117
  export type THarnessIntelligenceStatus = 'running' | 'completed' | 'error';
118
118
 
119
+ export type THarnessIntelligenceAvailabilityStatus = 'checking' | 'available' | 'unavailable';
120
+
119
121
  export interface IHarnessIntelligenceExchange {
120
122
  id: string;
121
123
  question: string;
@@ -88,9 +88,23 @@ export class CanvasPool {
88
88
  pooledCanvas.inUse = false;
89
89
  // Clear canvas to free memory
90
90
  pooledCanvas.ctx.clearRect(0, 0, pooledCanvas.canvas.width, pooledCanvas.canvas.height);
91
+ } else {
92
+ pooledCanvas.inUse = false;
93
+ pooledCanvas.canvas.width = 0;
94
+ pooledCanvas.canvas.height = 0;
91
95
  }
92
96
  }
93
97
 
98
+ public static discard(pooledCanvas: PooledCanvas): void {
99
+ const index = this.pool.indexOf(pooledCanvas);
100
+ if (index >= 0) {
101
+ this.pool.splice(index, 1);
102
+ }
103
+ pooledCanvas.inUse = false;
104
+ pooledCanvas.canvas.width = 0;
105
+ pooledCanvas.canvas.height = 0;
106
+ }
107
+
94
108
  public static releaseAll() {
95
109
  for (const item of this.pool) {
96
110
  item.inUse = false;
@@ -132,4 +146,4 @@ export class CanvasPool {
132
146
  }
133
147
  this.maxPoolSize = newSize;
134
148
  }
135
- }
149
+ }