igniteui-astro-components 1.3.0 → 1.5.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/README.md +112 -2
- package/package.json +22 -20
- package/src/chrome/contract.d.mts +12 -0
- package/src/chrome/contract.mjs +92 -0
- package/src/chrome/integration.ts +173 -0
- package/src/components/DocsSidebar/DocsSidebar.astro +21 -1
- package/src/components/DocsSidebar/DocsSidebar.scss +31 -2
- package/src/components/DocsSidebar/README.md +12 -0
- package/src/components/DocsSidebar/SidebarLabel.astro +1 -1
- package/src/components/DocsSidebar/sidebar-tooltip.ts +174 -0
- package/src/components/DocsTree/DocsTreeItem.astro +9 -3
- package/src/components/DocsTree/README.md +13 -12
- package/src/components/DocsTree/docs-tree.scss +106 -39
- package/src/components/ThemingWidget/README.md +2 -1
- package/src/components/mdx/Sample/README.md +13 -0
- package/src/components/mdx/Sample/Sample.astro +160 -114
- package/src/components/mdx/Sample/Sample.scss +59 -58
- package/src/integration.ts +14 -1
- package/src/layouts/DocsLayout/DocsLayout.astro +56 -8
- package/src/layouts/DocsLayout/README.md +17 -0
- package/src/platform.ts +39 -11
- package/src/scripts/sample-widget.ts +31 -18
- package/src/virtual-modules.d.ts +7 -0
|
@@ -32,10 +32,25 @@ interface Props {
|
|
|
32
32
|
dv?: boolean;
|
|
33
33
|
/** Use crmDemoBaseUrl (for CRM demo samples). */
|
|
34
34
|
crm?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Load the sample from the Web Components samples browser (`wcDemosBaseUrl`)
|
|
37
|
+
* whatever the platform of the page, for demos that every platform's docs
|
|
38
|
+
* share. Falls back to `demosBaseUrl`, which is already the Web Components
|
|
39
|
+
* browser on the Web Components site. Code tabs and live editing follow it.
|
|
40
|
+
*/
|
|
41
|
+
wc?: boolean;
|
|
35
42
|
/** Render only the iframe — no navbar, no code tabs, no live-edit footer. */
|
|
36
43
|
iframeOnly?: boolean;
|
|
37
44
|
/** When used with iframeOnly, also render a "View in full screen" button below. */
|
|
38
45
|
fullscreenBtn?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Keep the widget's frame but drop its code viewer: no tabs header, no code
|
|
48
|
+
* fetch, and no live-edit or full-screen buttons. The footer then carries
|
|
49
|
+
* only the theme picker (see `showThemePicker`), and without one there is
|
|
50
|
+
* no footer at all. For demos whose code is not a usage example, e.g. ones
|
|
51
|
+
* that fake interaction states for display.
|
|
52
|
+
*/
|
|
53
|
+
hideCode?: boolean;
|
|
39
54
|
/**
|
|
40
55
|
* Opt in to the in-sample theme picker for this sample. Its initial theme is
|
|
41
56
|
* resolved from the site (see `defaultTheme` below), not passed per usage.
|
|
@@ -106,8 +121,10 @@ const {
|
|
|
106
121
|
lob = false,
|
|
107
122
|
dv = false,
|
|
108
123
|
crm = false,
|
|
124
|
+
wc = false,
|
|
109
125
|
iframeOnly = false,
|
|
110
126
|
fullscreenBtn = false,
|
|
127
|
+
hideCode = false,
|
|
111
128
|
showThemePicker = false,
|
|
112
129
|
fitContent = false,
|
|
113
130
|
spacing = 'none',
|
|
@@ -136,10 +153,13 @@ const env = Astro.locals.envVars ?? {};
|
|
|
136
153
|
// still override it for a whole site via `defaultSampleTheme`. This is not
|
|
137
154
|
// cosmetic — the picker's current selection is posted into the iframe on every
|
|
138
155
|
// load (sample-widget.ts), so a wrong default actively re-themes the demo.
|
|
156
|
+
// A `wc` sample comes from the Web Components browser whatever the page's
|
|
157
|
+
// platform, so it takes that browser's default.
|
|
139
158
|
const PLATFORM_DEFAULT_THEME: Partial<Record<PlatformContext['name'], string>> = {
|
|
140
159
|
Angular: 'material',
|
|
141
160
|
};
|
|
142
|
-
const defaultTheme =
|
|
161
|
+
const defaultTheme =
|
|
162
|
+
env.defaultSampleTheme ?? PLATFORM_DEFAULT_THEME[wc ? 'WebComponents' : name] ?? 'bootstrap';
|
|
143
163
|
|
|
144
164
|
// ─ Layout options (spacing / position / resize) ────────────────────────────────
|
|
145
165
|
const spacingVal = ['none', 'sm', 'md', 'lg'].includes(spacing) ? spacing : 'none';
|
|
@@ -148,11 +168,17 @@ const spacingVal = ['none', 'sm', 'md', 'lg'].includes(spacing) ? spacing : 'non
|
|
|
148
168
|
// height. The iframe carries `height` as the placeholder/fallback until the
|
|
149
169
|
// demo's measured/reported size replaces it (sample-widget.ts).
|
|
150
170
|
const containerStyle = fitContent ? undefined : `height: ${height}px`;
|
|
171
|
+
// The fullscreen bar sits inside the container, so it is added on top of
|
|
172
|
+
// `height` — the iframe keeps the height it was given.
|
|
173
|
+
const iframeOnlyContainerStyle =
|
|
174
|
+
fitContent || !fullscreenBtn
|
|
175
|
+
? containerStyle
|
|
176
|
+
: `height: calc(${height}px + var(--sample-container-header-height))`;
|
|
151
177
|
const iframeStyle = fitContent ? `width: 100%; height: ${height}px;` : 'width: 100%; height: 100%;';
|
|
152
178
|
|
|
153
179
|
// Split `position` into a horizontal + vertical token. "center" applies to
|
|
154
180
|
// whichever axis isn't otherwise specified. These become data-attributes the
|
|
155
|
-
// SCSS turns into
|
|
181
|
+
// SCSS turns into grid alignment (and gives the frame slack so the alignment is
|
|
156
182
|
// actually visible — a full-size frame has nothing to align).
|
|
157
183
|
const posTokens = (position ?? '').toLowerCase().split(/\s+/).filter(Boolean);
|
|
158
184
|
const hToken =
|
|
@@ -167,21 +193,27 @@ const vToken =
|
|
|
167
193
|
// measurement on resizable containers so the two never fight).
|
|
168
194
|
const isResizable = resizable;
|
|
169
195
|
|
|
170
|
-
// Flex layout is only needed (and only turned on) when one of the new options
|
|
171
|
-
// requires it — keeps the default rendering byte-for-byte unchanged.
|
|
172
|
-
const useFlex = Boolean(hToken || vToken || isResizable);
|
|
173
|
-
|
|
174
196
|
// DV samples (charts, gauges, maps, excel) use dvDemosBaseUrl when available.
|
|
175
197
|
const DV_PREFIXES = ['gauges/', 'maps/', 'excel/', 'charts/'];
|
|
176
198
|
const srcNoSlash = src.replace(/^\//, '');
|
|
177
199
|
const isDv = dv || DV_PREFIXES.some((p) => srcNoSlash.startsWith(p));
|
|
178
|
-
const baseUrl =
|
|
179
|
-
? (env.
|
|
180
|
-
:
|
|
181
|
-
? (env.
|
|
182
|
-
:
|
|
183
|
-
? (env.
|
|
184
|
-
:
|
|
200
|
+
const baseUrl = wc
|
|
201
|
+
? (env.wcDemosBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
|
|
202
|
+
: lob
|
|
203
|
+
? (env.lobDemosBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
|
|
204
|
+
: crm
|
|
205
|
+
? (env.crmDemoBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
|
|
206
|
+
: isDv
|
|
207
|
+
? (env.dvDemosBaseUrl ?? env.demosBaseUrl ?? '').replace(/\/$/, '')
|
|
208
|
+
: (env.demosBaseUrl ?? '').replace(/\/$/, '');
|
|
209
|
+
|
|
210
|
+
// Outside the Web Components site, `demosBaseUrl` is the page's own platform
|
|
211
|
+
// browser, so a `wc` sample without `wcDemosBaseUrl` silently loads the wrong one.
|
|
212
|
+
if (wc && !env.wcDemosBaseUrl && name !== 'WebComponents') {
|
|
213
|
+
console.warn(
|
|
214
|
+
`[Sample] ${src}: wc is set but wcDemosBaseUrl is not configured, so this sample won't load from the Web Components samples browser.`,
|
|
215
|
+
);
|
|
216
|
+
}
|
|
185
217
|
|
|
186
218
|
const iframeSrc = `${baseUrl}${src}`;
|
|
187
219
|
const githubSrc = srcNoSlash;
|
|
@@ -189,128 +221,142 @@ const githubSrc = srcNoSlash;
|
|
|
189
221
|
// Stable, unique element ID derived from the sample path.
|
|
190
222
|
const widgetId = 'cw' + src.replace(/[^a-z0-9]/gi, '-');
|
|
191
223
|
const exampleTabId = `${widgetId}-example`;
|
|
224
|
+
|
|
225
|
+
// The full widget's demo pane, shared by its two layouts: inside the EXAMPLE
|
|
226
|
+
// tab, or on its own when `hideCode` drops the tabs.
|
|
227
|
+
const samplePaneClass = [
|
|
228
|
+
'igd-sample-container',
|
|
229
|
+
'loading',
|
|
230
|
+
{
|
|
231
|
+
'igd-sample-container--fit-content': fitContent,
|
|
232
|
+
'igd-sample-container--resizable': isResizable,
|
|
233
|
+
'igd-sample-container--no-border': noBorder,
|
|
234
|
+
'igd-sample-container--no-background': noBackground,
|
|
235
|
+
'igd-sample-container--white-background': whiteBackground,
|
|
236
|
+
},
|
|
237
|
+
];
|
|
238
|
+
const samplePaneAttrs = {
|
|
239
|
+
'data-fit-content': fitContent ? 'true' : undefined,
|
|
240
|
+
'data-spacing': spacingVal,
|
|
241
|
+
'data-justify': hToken,
|
|
242
|
+
'data-valign': vToken,
|
|
243
|
+
'data-resizable': isResizable ? 'true' : undefined,
|
|
244
|
+
tabindex: isResizable ? '0' : undefined,
|
|
245
|
+
'aria-label': isResizable
|
|
246
|
+
? 'Resizable sample — use the left and right arrow keys to resize'
|
|
247
|
+
: undefined,
|
|
248
|
+
'aria-busy': 'true',
|
|
249
|
+
style: containerStyle,
|
|
250
|
+
};
|
|
251
|
+
const sampleIframeAttrs = {
|
|
252
|
+
'data-src': iframeSrc,
|
|
253
|
+
title: alt || `${name} Example`,
|
|
254
|
+
style: iframeStyle,
|
|
255
|
+
frameborder: '0',
|
|
256
|
+
seamless: true,
|
|
257
|
+
'aria-hidden': 'true',
|
|
258
|
+
};
|
|
192
259
|
---
|
|
193
260
|
|
|
194
|
-
{
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
261
|
+
{iframeOnly ? (
|
|
262
|
+
<>
|
|
263
|
+
<div
|
|
264
|
+
class:list={[
|
|
265
|
+
'igd-sample-container',
|
|
266
|
+
{
|
|
267
|
+
'igd-sample-container--fit-content': fitContent,
|
|
268
|
+
'igd-sample-container--resizable': isResizable,
|
|
269
|
+
'igd-sample-container--no-border': noBorder,
|
|
270
|
+
'igd-sample-container--no-background': noBackground,
|
|
271
|
+
'igd-sample-container--white-background': whiteBackground,
|
|
272
|
+
},
|
|
273
|
+
]}
|
|
274
|
+
data-fit-content={fitContent ? 'true' : undefined}
|
|
275
|
+
data-spacing={spacingVal}
|
|
276
|
+
data-justify={hToken}
|
|
277
|
+
data-valign={vToken}
|
|
278
|
+
data-resizable={isResizable ? 'true' : undefined}
|
|
279
|
+
tabindex={isResizable ? '0' : undefined}
|
|
280
|
+
aria-label={
|
|
281
|
+
isResizable ? 'Resizable sample — use the left and right arrow keys to resize' : undefined
|
|
282
|
+
}
|
|
283
|
+
style={iframeOnlyContainerStyle}
|
|
284
|
+
>
|
|
285
|
+
<div class="igd-sample-frame">
|
|
286
|
+
<iframe
|
|
287
|
+
src={iframeSrc}
|
|
288
|
+
title={alt || `${name} Example`}
|
|
289
|
+
style={iframeStyle}
|
|
290
|
+
frameborder="0"
|
|
291
|
+
seamless
|
|
292
|
+
/>
|
|
293
|
+
{isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
|
|
294
|
+
</div>
|
|
295
|
+
{fullscreenBtn && (
|
|
296
|
+
<div class="igd-code-view__header-actions">
|
|
297
|
+
<igc-icon-button
|
|
298
|
+
name="open-link-blank"
|
|
299
|
+
collection="docs"
|
|
300
|
+
variant="outlined"
|
|
301
|
+
class="igd-full-screen-btn igd-edit-in-btn"
|
|
302
|
+
href={iframeSrc}
|
|
303
|
+
target="_blank"
|
|
304
|
+
aria-label="Open in full screen"
|
|
227
305
|
/>
|
|
228
|
-
{isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
|
|
229
306
|
</div>
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
307
|
+
)}
|
|
308
|
+
</div>
|
|
309
|
+
</>
|
|
310
|
+
) : (
|
|
311
|
+
<>
|
|
312
|
+
<div
|
|
313
|
+
class:list={['igd-code-view', { 'igd-code-view--hide-code': hideCode }]}
|
|
314
|
+
id={widgetId}
|
|
315
|
+
data-iframe-src={iframeSrc}
|
|
316
|
+
data-demos-base-url={baseUrl}
|
|
317
|
+
data-github-src={githubSrc}
|
|
318
|
+
data-platform={wc ? 'wc' : lower}
|
|
319
|
+
data-hide-code={hideCode ? 'true' : undefined}
|
|
320
|
+
>
|
|
321
|
+
<div class="igd-code-view__inner">
|
|
322
|
+
{hideCode ? (
|
|
323
|
+
<div class:list={samplePaneClass} {...samplePaneAttrs}>
|
|
324
|
+
<igc-circular-progress
|
|
325
|
+
indeterminate
|
|
326
|
+
class="sample-loading-indicator"
|
|
327
|
+
aria-label="Loading sample"
|
|
240
328
|
/>
|
|
329
|
+
<div class="igd-sample-frame">
|
|
330
|
+
<iframe {...sampleIframeAttrs} />
|
|
331
|
+
{isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
|
|
332
|
+
</div>
|
|
241
333
|
</div>
|
|
242
|
-
)
|
|
243
|
-
</div>
|
|
244
|
-
</>
|
|
245
|
-
) : (
|
|
246
|
-
<>
|
|
247
|
-
<div
|
|
248
|
-
class="igd-code-view"
|
|
249
|
-
id={widgetId}
|
|
250
|
-
data-iframe-src={iframeSrc}
|
|
251
|
-
data-demos-base-url={baseUrl}
|
|
252
|
-
data-github-src={githubSrc}
|
|
253
|
-
data-platform={lower}
|
|
254
|
-
>
|
|
255
|
-
<div class="igd-code-view__inner">
|
|
334
|
+
) : (
|
|
256
335
|
<igc-tabs id={`${widgetId}-tabs`} alignment="start">
|
|
257
336
|
<igc-tab id={exampleTabId} label="EXAMPLE" selected>
|
|
258
|
-
<div
|
|
259
|
-
class:list={[
|
|
260
|
-
'igd-sample-container',
|
|
261
|
-
'loading',
|
|
262
|
-
{
|
|
263
|
-
'igd-sample-container--fit-content': fitContent,
|
|
264
|
-
'igd-sample-container--flex': useFlex,
|
|
265
|
-
'igd-sample-container--resizable': isResizable,
|
|
266
|
-
'igd-sample-container--no-border': noBorder,
|
|
267
|
-
'igd-sample-container--no-background': noBackground,
|
|
268
|
-
'igd-sample-container--white-background': whiteBackground,
|
|
269
|
-
},
|
|
270
|
-
]}
|
|
271
|
-
data-fit-content={fitContent ? 'true' : undefined}
|
|
272
|
-
data-spacing={spacingVal}
|
|
273
|
-
data-justify={hToken}
|
|
274
|
-
data-valign={vToken}
|
|
275
|
-
data-resizable={isResizable ? 'true' : undefined}
|
|
276
|
-
tabindex={isResizable ? '0' : undefined}
|
|
277
|
-
aria-label={
|
|
278
|
-
isResizable
|
|
279
|
-
? 'Resizable sample — use the left and right arrow keys to resize'
|
|
280
|
-
: undefined
|
|
281
|
-
}
|
|
282
|
-
aria-busy="true"
|
|
283
|
-
style={containerStyle}
|
|
284
|
-
>
|
|
337
|
+
<div class:list={samplePaneClass} {...samplePaneAttrs}>
|
|
285
338
|
<igc-circular-progress
|
|
286
339
|
indeterminate
|
|
287
340
|
class="sample-loading-indicator"
|
|
288
341
|
aria-label="Loading sample"
|
|
289
342
|
/>
|
|
290
343
|
<div class="igd-sample-frame">
|
|
291
|
-
<iframe
|
|
292
|
-
data-src={iframeSrc}
|
|
293
|
-
title={alt || `${name} Example`}
|
|
294
|
-
style={iframeStyle}
|
|
295
|
-
frameborder="0"
|
|
296
|
-
seamless
|
|
297
|
-
aria-hidden="true"
|
|
298
|
-
/>
|
|
344
|
+
<iframe {...sampleIframeAttrs} />
|
|
299
345
|
{isResizable && <div class="igd-sample-resize-handle" aria-hidden="true" />}
|
|
300
346
|
</div>
|
|
301
347
|
</div>
|
|
302
348
|
</igc-tab>
|
|
303
349
|
</igc-tabs>
|
|
304
|
-
</div>
|
|
305
|
-
{showThemePicker && (
|
|
306
|
-
<div class="igd-sample-theming" hidden>
|
|
307
|
-
<ThemingWidget selectedTheme={defaultTheme} />
|
|
308
|
-
</div>
|
|
309
350
|
)}
|
|
310
351
|
</div>
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
352
|
+
{showThemePicker && (
|
|
353
|
+
<div class="igd-sample-theming" hidden>
|
|
354
|
+
<ThemingWidget selectedTheme={defaultTheme} />
|
|
355
|
+
</div>
|
|
356
|
+
)}
|
|
357
|
+
</div>
|
|
358
|
+
</>
|
|
359
|
+
)}
|
|
314
360
|
|
|
315
361
|
<script>
|
|
316
362
|
// Astro deduplicates module scripts — this runs exactly once per full page load.
|
|
@@ -122,6 +122,22 @@ igc-tab::part(tab-header) {
|
|
|
122
122
|
display: flex;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
// `hideCode`: no tabs header, so the demo pane sits directly in the widget's
|
|
126
|
+
// own frame, which already draws the border, and takes its top corners.
|
|
127
|
+
.igd-code-view--hide-code {
|
|
128
|
+
.igd-sample-container {
|
|
129
|
+
flex: 1 1 0;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
border: none;
|
|
132
|
+
border-radius: rem(4px) rem(4px) 0 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Without a theme picker there is no footer, so the pane takes all four corners.
|
|
136
|
+
&:not(:has(.igd-code-view__footer-actions)) .igd-sample-container {
|
|
137
|
+
border-radius: rem(4px);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
125
141
|
.igd-sample-container {
|
|
126
142
|
--sample-container-header-height: #{rem(66px)};
|
|
127
143
|
// Two selectable backgrounds: the site's own light/dark surface (default),
|
|
@@ -131,6 +147,9 @@ igc-tab::part(tab-header) {
|
|
|
131
147
|
--igd-sample-bg-dark: #0a0b10;
|
|
132
148
|
|
|
133
149
|
display: grid;
|
|
150
|
+
// The iframe frame takes all the space left over; anything after it (the
|
|
151
|
+
// fullscreen bar in iframeOnly mode) keeps its own height.
|
|
152
|
+
grid-template-rows: minmax(0, 1fr);
|
|
134
153
|
position: relative;
|
|
135
154
|
border: rem(1px) solid var(--ig-gray-300);
|
|
136
155
|
overflow: hidden;
|
|
@@ -234,21 +253,18 @@ igc-tab::part(tab-header) {
|
|
|
234
253
|
}
|
|
235
254
|
}
|
|
236
255
|
|
|
237
|
-
// Wrapper around the iframe
|
|
238
|
-
// (fills the container just like the bare iframe did); when the container
|
|
239
|
-
// opts into flex layout it becomes the positioned/resizable element.
|
|
256
|
+
// Wrapper around the iframe; the element `position` aligns and the drag resizes.
|
|
240
257
|
.igd-sample-frame {
|
|
241
258
|
position: relative;
|
|
242
259
|
width: 100%;
|
|
243
260
|
height: 100%;
|
|
244
261
|
max-width: 100%;
|
|
245
|
-
flex: 0 0 auto;
|
|
246
262
|
overflow: auto;
|
|
247
263
|
z-index: 1;
|
|
248
264
|
}
|
|
249
265
|
|
|
250
266
|
// In fit-content mode the frame hugs the JS-sized iframe instead of filling
|
|
251
|
-
// the container, so
|
|
267
|
+
// the container, so alignment (position) can move the content-sized box
|
|
252
268
|
// around. Must come after the base .igd-sample-frame rule — same specificity,
|
|
253
269
|
// order decides.
|
|
254
270
|
&--fit-content .igd-sample-frame {
|
|
@@ -257,7 +273,7 @@ igc-tab::part(tab-header) {
|
|
|
257
273
|
// indefinite and collapse it to the 300px intrinsic default — inner
|
|
258
274
|
// horizontal scrollbars on every unmeasured/cross-origin demo. When a
|
|
259
275
|
// real content width is measured/reported, sample-widget.ts switches
|
|
260
|
-
// the frame to `width: auto` inline so
|
|
276
|
+
// the frame to `width: auto` inline so alignment can center it.
|
|
261
277
|
height: auto;
|
|
262
278
|
}
|
|
263
279
|
|
|
@@ -274,8 +290,9 @@ igc-tab::part(tab-header) {
|
|
|
274
290
|
padding: var(--igd-sample-spacing-sm, #{rem(8px)});
|
|
275
291
|
|
|
276
292
|
.igd-code-view__header-actions {
|
|
277
|
-
margin
|
|
278
|
-
|
|
293
|
+
margin: var(--igd-sample-spacing-sm, #{rem(8px)})
|
|
294
|
+
calc(var(--igd-sample-spacing-sm, #{rem(8px)}) * -1)
|
|
295
|
+
calc(var(--igd-sample-spacing-sm, #{rem(8px)}) * -1);
|
|
279
296
|
}
|
|
280
297
|
}
|
|
281
298
|
|
|
@@ -283,8 +300,9 @@ igc-tab::part(tab-header) {
|
|
|
283
300
|
padding: var(--igd-sample-spacing-md, #{rem(16px)});
|
|
284
301
|
|
|
285
302
|
.igd-code-view__header-actions {
|
|
286
|
-
margin
|
|
287
|
-
|
|
303
|
+
margin: var(--igd-sample-spacing-md, #{rem(16px)})
|
|
304
|
+
calc(var(--igd-sample-spacing-md, #{rem(16px)}) * -1)
|
|
305
|
+
calc(var(--igd-sample-spacing-md, #{rem(16px)}) * -1);
|
|
288
306
|
}
|
|
289
307
|
}
|
|
290
308
|
|
|
@@ -292,58 +310,41 @@ igc-tab::part(tab-header) {
|
|
|
292
310
|
padding: var(--igd-sample-spacing-lg, #{rem(32px)});
|
|
293
311
|
|
|
294
312
|
.igd-code-view__header-actions {
|
|
295
|
-
margin
|
|
296
|
-
|
|
313
|
+
margin: var(--igd-sample-spacing-lg, #{rem(32px)})
|
|
314
|
+
calc(var(--igd-sample-spacing-lg, #{rem(32px)}) * -1)
|
|
315
|
+
calc(var(--igd-sample-spacing-lg, #{rem(32px)}) * -1);
|
|
297
316
|
}
|
|
298
317
|
}
|
|
299
318
|
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}
|
|
320
|
-
&[data-valign='center'] {
|
|
321
|
-
align-items: center;
|
|
322
|
-
}
|
|
323
|
-
&[data-valign='bottom'] {
|
|
324
|
-
align-items: flex-end;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// A frame that fills the container has nothing to align, so give it slack
|
|
328
|
-
// on any axis that has an explicit (non-start/stretch) alignment. `start`
|
|
329
|
-
// keeps full width — it looks identical to the default. Resizing overrides
|
|
330
|
-
// the width inline, so this is only the initial state. Fit-content frames
|
|
331
|
-
// are excluded: there the measured content defines the frame size.
|
|
332
|
-
&[data-justify='center']:not([data-fit-content]) .igd-sample-frame,
|
|
333
|
-
&[data-justify='end']:not([data-fit-content]) .igd-sample-frame {
|
|
334
|
-
width: 65%;
|
|
335
|
-
}
|
|
336
|
-
&[data-valign]:not([data-fit-content]) .igd-sample-frame {
|
|
337
|
-
height: 65%;
|
|
338
|
-
}
|
|
319
|
+
// `position`, emitted as data-justify / data-valign.
|
|
320
|
+
&[data-justify='start'] > .igd-sample-frame {
|
|
321
|
+
justify-self: start;
|
|
322
|
+
}
|
|
323
|
+
&[data-justify='center'] > .igd-sample-frame {
|
|
324
|
+
justify-self: center;
|
|
325
|
+
}
|
|
326
|
+
&[data-justify='end'] > .igd-sample-frame {
|
|
327
|
+
justify-self: end;
|
|
328
|
+
}
|
|
329
|
+
&[data-valign='top'] > .igd-sample-frame {
|
|
330
|
+
align-self: start;
|
|
331
|
+
}
|
|
332
|
+
&[data-valign='center'] > .igd-sample-frame {
|
|
333
|
+
align-self: center;
|
|
334
|
+
}
|
|
335
|
+
&[data-valign='bottom'] > .igd-sample-frame {
|
|
336
|
+
align-self: end;
|
|
337
|
+
}
|
|
339
338
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
339
|
+
// A frame that fills the container has nothing to align, so give it slack
|
|
340
|
+
// on any axis with a non-start alignment. Resizing overrides the width
|
|
341
|
+
// inline; fit-content frames are sized by their content instead.
|
|
342
|
+
&[data-justify='center']:not([data-fit-content]) > .igd-sample-frame,
|
|
343
|
+
&[data-justify='end']:not([data-fit-content]) > .igd-sample-frame {
|
|
344
|
+
width: 65%;
|
|
345
|
+
}
|
|
346
|
+
&[data-valign]:not([data-fit-content]) > .igd-sample-frame {
|
|
347
|
+
height: 65%;
|
|
347
348
|
}
|
|
348
349
|
|
|
349
350
|
// Resizable mode: a drag handle on the right edge resizes the iframe's width
|
package/src/integration.ts
CHANGED
|
@@ -74,6 +74,8 @@ import { rehypeHeadingAnchors } from './plugins/rehype-heading-anchors';
|
|
|
74
74
|
export { rehypeHeadingAnchors } from './plugins/rehype-heading-anchors';
|
|
75
75
|
import { rehypePagefindIgnore } from './plugins/rehype-pagefind-ignore';
|
|
76
76
|
export { rehypePagefindIgnore } from './plugins/rehype-pagefind-ignore';
|
|
77
|
+
import { igChrome, type IgChromeOptions } from './chrome/integration';
|
|
78
|
+
export { igChrome, type IgChromeOptions } from './chrome/integration';
|
|
77
79
|
import { remarkMdLinks } from './plugins/remark-md-links';
|
|
78
80
|
import { remarkHtmlTransforms } from './plugins/remark-html-transforms';
|
|
79
81
|
|
|
@@ -558,6 +560,12 @@ export interface CreateDocsSiteOptions {
|
|
|
558
560
|
* and the build-time nav prefetch endpoint.
|
|
559
561
|
*/
|
|
560
562
|
platform?: PlatformKey | null;
|
|
563
|
+
/**
|
|
564
|
+
* Render the header and footer from a snapshot of the marketing site's
|
|
565
|
+
* exported chrome instead of the legacy fetched one. See
|
|
566
|
+
* src/chrome/integration.ts. Japanese builds keep the legacy chrome.
|
|
567
|
+
*/
|
|
568
|
+
chrome?: IgChromeOptions;
|
|
561
569
|
/** Locale for the nav prefetch URL. */
|
|
562
570
|
navLang?: NavLang;
|
|
563
571
|
/**
|
|
@@ -621,6 +629,7 @@ export function createDocsSite(
|
|
|
621
629
|
head = [],
|
|
622
630
|
llmsSets = [] as LlmsSet[],
|
|
623
631
|
integrations: extraIntegrations = [],
|
|
632
|
+
chrome,
|
|
624
633
|
...astroExtra
|
|
625
634
|
} = options;
|
|
626
635
|
|
|
@@ -645,7 +654,10 @@ export function createDocsSite(
|
|
|
645
654
|
}
|
|
646
655
|
|
|
647
656
|
// Platform CDN entries come first so site-specific `head` entries can override.
|
|
648
|
-
|
|
657
|
+
// The legacy chrome's own CSS/JS only where that chrome renders.
|
|
658
|
+
const platformHead = platform
|
|
659
|
+
? getPlatformHead(platform, navLang, { legacyChrome: !chrome || navLang === 'jp' })
|
|
660
|
+
: [];
|
|
649
661
|
|
|
650
662
|
// highlight.js for code-tab syntax highlighting inside code-view widgets.
|
|
651
663
|
const codeViewHead: HeadEntry[] = [
|
|
@@ -755,6 +767,7 @@ export function createDocsSite(
|
|
|
755
767
|
head: [...platformHead, ...codeViewHead, ...head],
|
|
756
768
|
}),
|
|
757
769
|
mdx(),
|
|
770
|
+
...(chrome ? [igChrome(chrome)] : []),
|
|
758
771
|
...(source.imagesDir ? [staticImagesIntegration(source.imagesDir)] : []),
|
|
759
772
|
...(base ? [createBasePrependIntegration(base)] : []),
|
|
760
773
|
...extraIntegrations,
|