@design.estate/dees-catalog 3.95.0 → 3.96.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design.estate/dees-catalog",
3
- "version": "3.95.0",
3
+ "version": "3.96.0",
4
4
  "private": false,
5
5
  "description": "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.",
6
6
  "main": "dist_ts_web/index.js",
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@design.estate/dees-catalog',
6
- version: '3.95.0',
6
+ version: '3.96.0',
7
7
  description: 'A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript.'
8
8
  }
@@ -121,6 +121,16 @@ export interface ITiptapBundle {
121
121
  * const terminal = new xterm.Terminal({ ... });
122
122
  * ```
123
123
  */
124
+ // Fix for xterm.js WidthCache measurement container causing horizontal
125
+ // scrollbar: xterm creates it on document.body with width 50000px/top
126
+ // -50000px; moving it off-screen horizontally prevents scrollWidth expansion.
127
+ const xtermMeasurementFixCss = `
128
+ /* Fix xterm.js WidthCache measurement container causing horizontal scrollbar */
129
+ body > div[style*="top: -50000px"][style*="width: 50000px"] {
130
+ left: -50000px !important;
131
+ }
132
+ `;
133
+
124
134
  export class DeesServiceLibLoader {
125
135
  private static instance: DeesServiceLibLoader;
126
136
 
@@ -183,6 +193,37 @@ export class DeesServiceLibLoader {
183
193
  return this.xtermLoadingPromise;
184
194
  }
185
195
 
196
+ /**
197
+ * Provides xterm modules from the host application instead of the CDN.
198
+ * Hosts that bundle xterm (e.g. Electron apps that must work offline)
199
+ * call this before any terminal component initializes; subsequent
200
+ * loadXterm/loadXtermFitAddon calls resolve from these caches without
201
+ * network access. Pass the css text of xterm.css so the document-level
202
+ * styles (normally fetched from the CDN) are injected too.
203
+ */
204
+ public provideXtermModules(input: {
205
+ xterm: IXtermBundle;
206
+ fitAddon?: IXtermFitAddonBundle;
207
+ cssText?: string;
208
+ }): void {
209
+ this.xtermLib = { Terminal: input.xterm.Terminal };
210
+ if (input.fitAddon) {
211
+ this.xtermFitAddonLib = { FitAddon: input.fitAddon.FitAddon };
212
+ }
213
+ if (input.cssText) {
214
+ this.injectProvidedXtermStyles(input.cssText);
215
+ }
216
+ }
217
+
218
+ private injectProvidedXtermStyles(cssText: string): void {
219
+ const styleId = 'xterm-cdn-styles';
220
+ if (document.getElementById(styleId)) return;
221
+ const style = document.createElement('style');
222
+ style.id = styleId;
223
+ style.textContent = cssText + xtermMeasurementFixCss;
224
+ document.head.appendChild(style);
225
+ }
226
+
186
227
  /**
187
228
  * Load xterm-addon-fit from CDN
188
229
  * @returns Promise resolving to FitAddon class
@@ -248,20 +289,9 @@ export class DeesServiceLibLoader {
248
289
  const response = await fetch(cssUrl);
249
290
  const cssText = await response.text();
250
291
 
251
- // Fix for xterm.js WidthCache measurement container causing horizontal scrollbar
252
- // xterm.js creates this on document.body with width: 50000px, top: -50000px
253
- // Moving it off-screen horizontally prevents scrollWidth expansion
254
- const xtermMeasurementFix = `
255
- /* Fix xterm.js WidthCache measurement container causing horizontal scrollbar */
256
- /* xterm creates this on document.body - move it off-screen horizontally too */
257
- body > div[style*="top: -50000px"][style*="width: 50000px"] {
258
- left: -50000px !important;
259
- }
260
- `;
261
-
262
292
  const style = document.createElement('style');
263
293
  style.id = styleId;
264
- style.textContent = cssText + xtermMeasurementFix;
294
+ style.textContent = cssText + xtermMeasurementFixCss;
265
295
  document.head.appendChild(style);
266
296
  }
267
297