igniteui-astro-components 0.0.22 → 0.0.23
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": "igniteui-astro-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Reusable Astro components, layouts, and integrations for Infragistics / Ignite UI documentation sites. Replaces the Starlight defaults with project-specific implementations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -184,15 +184,18 @@ function addFooter(
|
|
|
184
184
|
footer.appendChild(btn);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
187
|
+
// CodeSandbox hidden, re-enable when https://github.com/codesandbox/codesandbox-client/issues/8884 is fixed.
|
|
188
|
+
// https://github.com/codesandbox/codesandbox-client/issues/8883
|
|
189
|
+
// https://github.com/codesandbox/codesandbox-client/issues/8074
|
|
190
|
+
// if ((!explicitEditor || explicitEditor === 'csb') && onCodeSandbox) {
|
|
191
|
+
// const btn = document.createElement('igc-button') as HTMLElement;
|
|
192
|
+
// btn.setAttribute('variant', 'outlined');
|
|
193
|
+
// btn.setAttribute('aria-label', 'Edit in CodeSandbox');
|
|
194
|
+
// btn.className = 'codesandbox-btn igd-edit-in-btn';
|
|
195
|
+
// btn.innerHTML = codeSandboxSvg;
|
|
196
|
+
// btn.addEventListener('click', onCodeSandbox);
|
|
197
|
+
// footer.appendChild(btn);
|
|
198
|
+
// }
|
|
196
199
|
|
|
197
200
|
const fsBtn = document.createElement('igc-icon-button') as HTMLElement;
|
|
198
201
|
fsBtn.setAttribute('name', 'open-link-blank');
|
|
@@ -218,9 +221,7 @@ class AngularCodeService {
|
|
|
218
221
|
const samplePath = getSamplePath(iframeSrc, demosBaseUrl);
|
|
219
222
|
const isDv = isDvSample(samplePath);
|
|
220
223
|
const assetDir = isDv ? 'code-viewer' : 'samples';
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
const fallbackStackblitz = isDv ? null : () => this._openStackBlitzUrl(samplePath, demosBaseUrl);
|
|
224
|
+
const fallbackStackblitz = () => this._openStackBlitzUrl(samplePath, demosBaseUrl);
|
|
224
225
|
const fallbackCodeSandbox = () => this._openCodeSandboxUrl(samplePath, demosBaseUrl);
|
|
225
226
|
|
|
226
227
|
try {
|
|
@@ -256,12 +257,15 @@ class AngularCodeService {
|
|
|
256
257
|
.forEach((file: SampleFile) =>
|
|
257
258
|
addCodeTab(igcTabs, file));
|
|
258
259
|
|
|
259
|
-
|
|
260
|
-
|
|
260
|
+
// DV samples include all boilerplate in their own JSON, sharedData is for non DV only.
|
|
261
|
+
const onStackblitz = isDv
|
|
262
|
+
? () => this._openInStackBlitz(sampleData, null)
|
|
263
|
+
: () => this._openInStackBlitz(sampleData, sharedData);
|
|
264
|
+
addFooter(widget, iframeSrc, null, onStackblitz, fallbackCodeSandbox);
|
|
261
265
|
|
|
262
266
|
} catch (err: any) {
|
|
263
267
|
console.warn('[sample-widget] Could not fetch Angular sample files:', err.message);
|
|
264
|
-
addFooter(widget, iframeSrc,
|
|
268
|
+
addFooter(widget, iframeSrc, null, fallbackStackblitz, fallbackCodeSandbox);
|
|
265
269
|
}
|
|
266
270
|
}
|
|
267
271
|
|
|
@@ -274,12 +278,12 @@ class AngularCodeService {
|
|
|
274
278
|
return;
|
|
275
279
|
}
|
|
276
280
|
const files: Record<string, string> = {};
|
|
277
|
-
|
|
278
|
-
if (f.path
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
const addFile = (f: any) => {
|
|
282
|
+
if (!f.path || f.path.startsWith('..')) return;
|
|
283
|
+
files[f.path.replace(/^\.\//, '')] = f.content || '';
|
|
284
|
+
};
|
|
285
|
+
(sharedData?.files || []).forEach(addFile); // shared boilerplate for non-DV samples
|
|
286
|
+
(sampleData.sampleFiles || []).forEach(addFile);
|
|
283
287
|
sdk.openProject(
|
|
284
288
|
{
|
|
285
289
|
title: 'Infragistics Angular Components',
|
|
@@ -321,8 +325,9 @@ class AngularCodeService {
|
|
|
321
325
|
const repo = isDv ? 'igniteui-angular-examples' : 'igniteui-live-editing-samples';
|
|
322
326
|
const segs = new URL(demosBaseUrl).pathname.replace(/\/$/, '').split('/').filter(Boolean);
|
|
323
327
|
const prefix = isDv ? 'samples/' : (segs.pop() || 'angular-demos') + '/';
|
|
328
|
+
const params = isDv ? '?startScript=start' : '';
|
|
324
329
|
window.open(
|
|
325
|
-
`https://stackblitz.com/github/IgniteUI/${repo}/tree/${branch}/${prefix}${samplePath}`,
|
|
330
|
+
`https://stackblitz.com/github/IgniteUI/${repo}/tree/${branch}/${prefix}${samplePath}${params}`,
|
|
326
331
|
'_blank',
|
|
327
332
|
);
|
|
328
333
|
}
|
|
@@ -346,10 +351,8 @@ class XplatCodeService {
|
|
|
346
351
|
async init(ctx: WidgetContext): Promise<void> {
|
|
347
352
|
const { widget, iframeSrc, demosBaseUrl, igcTabs, githubSrc } = ctx;
|
|
348
353
|
const samplePath = getSamplePath(iframeSrc, demosBaseUrl);
|
|
349
|
-
const
|
|
350
|
-
|
|
351
|
-
addFooter(widget, iframeSrc, 'csb', null, () => this._openCodeSandbox(githubSrc, demosBaseUrl));
|
|
352
|
-
};
|
|
354
|
+
const fallbackStackblitz = () => this._openStackBlitzUrl(githubSrc, demosBaseUrl);
|
|
355
|
+
const fallbackCodeSandbox = () => this._openCodeSandbox(githubSrc, demosBaseUrl);
|
|
353
356
|
|
|
354
357
|
try {
|
|
355
358
|
// Blazor's local dev server uses a self-signed cert on a non-4200 port,
|
|
@@ -371,11 +374,90 @@ class XplatCodeService {
|
|
|
371
374
|
.forEach((file: SampleFile) =>
|
|
372
375
|
addCodeTab(igcTabs, file));
|
|
373
376
|
|
|
374
|
-
|
|
377
|
+
if (this.enableLiveEditing && githubSrc) {
|
|
378
|
+
// Use sdk.openProject() to avoid the StackBlitz GitHub clone freeze bug.
|
|
379
|
+
addFooter(widget, iframeSrc, null,
|
|
380
|
+
() => this._openInStackBlitz(data),
|
|
381
|
+
fallbackCodeSandbox);
|
|
382
|
+
}
|
|
375
383
|
} catch (err: any) {
|
|
376
384
|
console.warn('[sample-widget] Could not fetch xplat sample files:', err.message);
|
|
377
|
-
|
|
385
|
+
if (this.enableLiveEditing && githubSrc) {
|
|
386
|
+
addFooter(widget, iframeSrc, null, fallbackStackblitz, fallbackCodeSandbox);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
private async _openInStackBlitz(sampleData: any): Promise<void> {
|
|
392
|
+
let sdk: any;
|
|
393
|
+
try {
|
|
394
|
+
sdk = await this._loadStackBlitzSdk();
|
|
395
|
+
} catch (e: any) {
|
|
396
|
+
console.warn('[sample-widget] StackBlitz SDK failed to load:', e.message);
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const files: Record<string, string> = {};
|
|
400
|
+
const addFile = (f: any) => {
|
|
401
|
+
// Skip paths that still have the old full repo prefix (pre-fix JSONs).
|
|
402
|
+
if (!f.path || f.path.startsWith('..') || f.path.startsWith('./samples/')) return;
|
|
403
|
+
files[f.path.replace(/^\.\//, '')] = f.content || '';
|
|
404
|
+
};
|
|
405
|
+
(sampleData.sampleFiles || []).forEach(addFile);
|
|
406
|
+
|
|
407
|
+
// webpack-dev-server binds to localhost by default; StackBlitz WebContainers need 0.0.0.0.
|
|
408
|
+
if (this.platform === 'wc' && files['package.json']) {
|
|
409
|
+
try {
|
|
410
|
+
const pkg = JSON.parse(files['package.json']);
|
|
411
|
+
if (pkg.scripts) {
|
|
412
|
+
pkg.scripts['serve:dev'] =
|
|
413
|
+
'node node_modules/webpack-dev-server/bin/webpack-dev-server.js' +
|
|
414
|
+
' --mode development --config ./webpack.config.js --hot --host 0.0.0.0 --allowed-hosts all';
|
|
415
|
+
pkg.scripts['start'] = 'npm run serve:dev';
|
|
416
|
+
files['package.json'] = JSON.stringify(pkg, null, 2);
|
|
417
|
+
}
|
|
418
|
+
} catch { /* malformed package.json — leave as-is */ }
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// @babel/preset-env with useBuiltIns:"usage" auto-injects core-js polyfill imports,
|
|
422
|
+
// but core-js is absent from some samples' package.json, breaking the webpack build.
|
|
423
|
+
// StackBlitz runs in modern Chrome so polyfills are unnecessary — disable the injection.
|
|
424
|
+
if (this.platform === 'wc' && files['webpack.config.js']) {
|
|
425
|
+
files['webpack.config.js'] = files['webpack.config.js']
|
|
426
|
+
.replace('"useBuiltIns": "usage"', '"useBuiltIns": false')
|
|
427
|
+
.replace(/,?\s*"corejs":\s*3/, '');
|
|
378
428
|
}
|
|
429
|
+
|
|
430
|
+
const platformLabel = this.platform === 'react' ? 'React' : 'Web Components';
|
|
431
|
+
const mainFile = Object.keys(files).find(f => f.endsWith('index.tsx') || f.endsWith('index.ts')) || '';
|
|
432
|
+
sdk.openProject(
|
|
433
|
+
{
|
|
434
|
+
title: `Infragistics ${platformLabel} Components`,
|
|
435
|
+
description: `Auto-generated from Infragistics ${platformLabel} Docs`,
|
|
436
|
+
template: 'node',
|
|
437
|
+
files,
|
|
438
|
+
tags: [this.platform, 'igniteui', 'web', 'example'],
|
|
439
|
+
},
|
|
440
|
+
{ openFile: mainFile },
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
private _loadStackBlitzSdk(): Promise<any> {
|
|
445
|
+
if ((window as any).StackBlitzSDK) return Promise.resolve((window as any).StackBlitzSDK);
|
|
446
|
+
return new Promise((resolve, reject) => {
|
|
447
|
+
const s = document.createElement('script');
|
|
448
|
+
s.src = 'https://unpkg.com/@stackblitz/sdk/bundles/sdk.umd.js';
|
|
449
|
+
s.onload = () => resolve((window as any).StackBlitzSDK);
|
|
450
|
+
s.onerror = () => reject(new Error('Failed to load StackBlitz SDK'));
|
|
451
|
+
document.head.appendChild(s);
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
private _openStackBlitzUrl(githubSrc: string, demosBaseUrl: string): void {
|
|
456
|
+
const branch = getXplatBranch(demosBaseUrl);
|
|
457
|
+
window.open(
|
|
458
|
+
`https://stackblitz.com/github/IgniteUI/igniteui-${this.platform}-examples/tree/${branch}/samples/${githubSrc}`,
|
|
459
|
+
'_blank',
|
|
460
|
+
);
|
|
379
461
|
}
|
|
380
462
|
|
|
381
463
|
private _openCodeSandbox(githubSrc: string, demosBaseUrl: string): void {
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
display: grid;
|
|
26
26
|
grid-template-rows: auto 1fr;
|
|
27
27
|
overflow: auto;
|
|
28
|
+
|
|
29
|
+
// min-width: 0 is necessary to allow the content to shrink below its min-content width
|
|
30
|
+
// otherwise igc-tabs won't show the scroll buttons
|
|
31
|
+
min-width: 0;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
// Status
|
|
@@ -60,16 +60,16 @@
|
|
|
60
60
|
--igd-updated-border: light-dark(#BAE2F5, #1E3D6A);
|
|
61
61
|
|
|
62
62
|
--igd-new-bg: light-dark(#EAFEF6, #0A2A1C);
|
|
63
|
-
--igd-new-color: light-dark(#
|
|
63
|
+
--igd-new-color: light-dark(#018450, #3DBF85);
|
|
64
64
|
--igd-new-border: light-dark(#BAF5D7, #154A30);
|
|
65
65
|
|
|
66
66
|
--igd-preview-bg: light-dark(#FEF5EA, #2D1507);
|
|
67
67
|
--igd-preview-color: light-dark(#AF390A, #E06030);
|
|
68
68
|
--igd-preview-border: light-dark(#F5C8BA, #5C2810);
|
|
69
69
|
|
|
70
|
-
--igd-premium-
|
|
71
|
-
--igd-premium-
|
|
72
|
-
--igd-premium-border: light-dark(#
|
|
70
|
+
--igd-premium-bg: light-dark(#F5EAFE, #1E1030);
|
|
71
|
+
--igd-premium-color: light-dark(#8438FF, #B585FF);
|
|
72
|
+
--igd-premium-border: light-dark(#8438FF, #5A3A99);
|
|
73
73
|
|
|
74
74
|
--igd-opensource-color: light-dark(#535353, #B5B5B5);
|
|
75
75
|
--igd-opensource-bg: light-dark(#ECECEC, #383737);
|